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

Method get_modified_time

python/python3/tornado/web.py:2895–2913  ·  view source on GitHub ↗

Returns the time that ``self.absolute_path`` was last modified. May be overridden in subclasses. Should return a `~datetime.datetime` object or None. .. versionadded:: 3.1

(self)

Source from the content-addressed store, hash-verified

2893 return stat_result.st_size
2894
2895 def get_modified_time(self) -> Optional[datetime.datetime]:
2896 """Returns the time that ``self.absolute_path`` was last modified.
2897
2898 May be overridden in subclasses. Should return a `~datetime.datetime`
2899 object or None.
2900
2901 .. versionadded:: 3.1
2902 """
2903 stat_result = self._stat()
2904 # NOTE: Historically, this used stat_result[stat.ST_MTIME],
2905 # which truncates the fractional portion of the timestamp. It
2906 # was changed from that form to stat_result.st_mtime to
2907 # satisfy mypy (which disallows the bracket operator), but the
2908 # latter form returns a float instead of an int. For
2909 # consistency with the past (and because we have a unit test
2910 # that relies on this), we truncate the float here, although
2911 # I'm not sure that's the right thing to do.
2912 modified = datetime.datetime.utcfromtimestamp(int(stat_result.st_mtime))
2913 return modified
2914
2915 def get_content_type(self) -> str:
2916 """Returns the ``Content-Type`` header to be used for this request.

Callers 1

getMethod · 0.95

Calls 1

_statMethod · 0.95

Tested by

no test coverage detected