MCPcopy Create free account
hub / github.com/numpy/numpy / cache_flush

Method cache_flush

numpy/distutils/ccompiler_opt.py:857–883  ·  view source on GitHub ↗

Force update the cache.

(self)

Source from the content-addressed store, hash-verified

855 break
856
857 def cache_flush(self):
858 """
859 Force update the cache.
860 """
861 if not self._cache_path:
862 return
863 # TODO: don't write if the cache doesn't change
864 self.dist_log("write cache to path ->", self._cache_path)
865 cdict = self.__dict__.copy()
866 for attr in self.__dict__.keys():
867 if re.match(self._cache_ignore, attr):
868 cdict.pop(attr)
869
870 d = os.path.dirname(self._cache_path)
871 if not os.path.exists(d):
872 os.makedirs(d)
873
874 repr_dict = pprint.pformat(cdict, compact=True)
875 with open(self._cache_path, "w") as f:
876 f.write(textwrap.dedent("""\
877 # AUTOGENERATED DON'T EDIT
878 # Please make changes to the code generator \
879 (distutils/ccompiler_opt.py)
880 hash = {}
881 data = \\
882 """).format(self._cache_hash))
883 f.write(repr_dict)
884
885 def cache_hash(self, *factors):
886 # is there a built-in non-crypto hash?

Callers 2

runMethod · 0.80
runMethod · 0.80

Calls 6

openFunction · 0.85
keysMethod · 0.80
dist_logMethod · 0.45
copyMethod · 0.45
existsMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected