MCPcopy Create free account
hub / github.com/EasyIME/PIME / get_content_version

Method get_content_version

python/python3/tornado/web.py:2858–2873  ·  view source on GitHub ↗

Returns a version string for the resource at the given path. This class method may be overridden by subclasses. The default implementation is a SHA-512 hash of the file's contents. .. versionadded:: 3.1

(cls, abspath: str)

Source from the content-addressed store, hash-verified

2856
2857 @classmethod
2858 def get_content_version(cls, abspath: str) -> str:
2859 """Returns a version string for the resource at the given path.
2860
2861 This class method may be overridden by subclasses. The
2862 default implementation is a SHA-512 hash of the file's contents.
2863
2864 .. versionadded:: 3.1
2865 """
2866 data = cls.get_content(abspath)
2867 hasher = hashlib.sha512()
2868 if isinstance(data, bytes):
2869 hasher.update(data)
2870 else:
2871 for chunk in data:
2872 hasher.update(chunk)
2873 return hasher.hexdigest()
2874
2875 def _stat(self) -> os.stat_result:
2876 assert self.absolute_path is not None

Callers 1

_get_cached_versionMethod · 0.80

Calls 2

get_contentMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected