MCPcopy Index your code
hub / github.com/RustPython/RustPython / _stat

Method _stat

Lib/pathlib/_os.py:324–356  ·  view source on GitHub ↗

Return the status as an os.stat_result, or None if stat() fails and ignore_errors is true.

(self, *, follow_symlinks=True, ignore_errors=False)

Source from the content-addressed store, hash-verified

322 return f"<{path_type}.info>"
323
324 def _stat(self, *, follow_symlinks=True, ignore_errors=False):
325 """Return the status as an os.stat_result, or None if stat() fails and
326 ignore_errors is true."""
327 if follow_symlinks:
328 try:
329 result = self._stat_result
330 except AttributeError:
331 pass
332 else:
333 if ignore_errors or result is not None:
334 return result
335 try:
336 self._stat_result = os.stat(self._path)
337 except (OSError, ValueError):
338 self._stat_result = None
339 if not ignore_errors:
340 raise
341 return self._stat_result
342 else:
343 try:
344 result = self._lstat_result
345 except AttributeError:
346 pass
347 else:
348 if ignore_errors or result is not None:
349 return result
350 try:
351 self._lstat_result = os.lstat(self._path)
352 except (OSError, ValueError):
353 self._lstat_result = None
354 if not ignore_errors:
355 raise
356 return self._lstat_result
357
358 def _posix_permissions(self, *, follow_symlinks=True):
359 """Return the POSIX file permissions."""

Callers 5

_posix_permissionsMethod · 0.95
_file_idMethod · 0.95
_access_time_nsMethod · 0.95
_mod_time_nsMethod · 0.95
_bsd_flagsMethod · 0.95

Calls 2

lstatMethod · 0.80
statMethod · 0.45

Tested by

no test coverage detected