@@ -2860,6 +2860,8 @@ msgid ""
28602860" making additional system calls. When a ``stat()`` or ``lstat()`` system "
28612861"call is made, the ``os.DirEntry`` object will cache the result."
28622862msgstr ""
2863+ ":func:`scandir` 将在不进行额外系统调用的情况下,提供尽可能多的此类信息。每次进行 ``stat()`` 或 ``lstat()`` "
2864+ "系统调用时,``os.DirEntry`` 对象会将结果缓存下来。"
28632865
28642866#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2274
28652867msgid ""
@@ -2868,6 +2870,8 @@ msgid ""
28682870"elapsed since calling :func:`scandir`, call ``os.stat(entry.path)`` to fetch"
28692871" up-to-date information."
28702872msgstr ""
2873+ "``os.DirEntry`` 实例不适合存储在长期存在的数据结构中,如果你知道文件元数据已更改,或者自调用 :func:`scandir` "
2874+ "以来已经经过了很长时间,请调用 ``os.stat(entry.path)`` 来获取最新信息。"
28712875
28722876#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2279
28732877msgid ""
@@ -2876,28 +2880,34 @@ msgid ""
28762880"errors, you can catch :exc:`OSError` when calling one of the ``os.DirEntry``"
28772881" methods and handle as appropriate."
28782882msgstr ""
2883+ "因为 ``os.DirEntry`` 方法可以进行系统调用,所以它也可能抛出 :exc:`OSError` 异常。如需精确定位错误,可以逐个调用 "
2884+ "``os.DirEntry`` 中的方法来捕获 :exc:`OSError`,并适当处理。"
28792885
28802886#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2284
28812887msgid ""
28822888"To be directly usable as a :term:`path-like object`, ``os.DirEntry`` "
28832889"implements the :class:`PathLike` interface."
28842890msgstr ""
2891+ "为了能直接用作 :term:`类路径对象 <path-like object>`,``os.DirEntry`` 实现了 "
2892+ ":class:`PathLike` 接口。"
28852893
28862894#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2287
28872895msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:"
2888- msgstr ""
2896+ msgstr "``os.DirEntry`` 实例所包含的属性和方法如下: "
28892897
28902898#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2291
28912899msgid ""
28922900"The entry's base filename, relative to the :func:`scandir` *path* argument."
2893- msgstr ""
2901+ msgstr "本条目的基本文件名,是根据 :func:`scandir` 的 *path* 参数得出的相对路径。 "
28942902
28952903#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2294
28962904msgid ""
28972905"The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* "
28982906"argument is of type ``bytes`` and ``str`` otherwise. Use "
28992907":func:`~os.fsdecode` to decode byte filenames."
29002908msgstr ""
2909+ "如果 :func:`scandir` 的 *path* 参数是 ``bytes`` 类型,则 :attr:`name` 属性也是 ``bytes`` "
2910+ "类型,否则为 ``str``。使用 :func:`~os.fsdecode` 解码 byte 类型的文件名。"
29012911
29022912#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2300
29032913msgid ""
@@ -2908,30 +2918,38 @@ msgid ""
29082918"descriptor <path_fd>`, the :attr:`path` attribute is the same as the "
29092919":attr:`name` attribute."
29102920msgstr ""
2921+ "本条目的完整路径:等效于 ``os.path.join(scandir_path, entry.name)``,其中 *scandir_path* 就是"
2922+ " :func:`scandir` 的 *path* 参数。仅当 :func:`scandir` 的 *path* "
2923+ "参数为绝对路径时,本路径才是绝对路径。如果 :func:`scandir` 的 *path* 参数是 :ref:`文件描述符 <path_fd>`,则 "
2924+ ":attr:`path` 属性与上述 :attr:`name` 属性相同。"
29112925
29122926#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2307
29132927msgid ""
29142928"The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* "
29152929"argument is of type ``bytes`` and ``str`` otherwise. Use "
29162930":func:`~os.fsdecode` to decode byte filenames."
29172931msgstr ""
2932+ "如果 :func:`scandir` 的 *path* 参数是 ``bytes`` 类型,则 :attr:`path` 属性也是 ``bytes`` "
2933+ "类型,否则为 ``str``。使用 :func:`~os.fsdecode` 解码 byte 类型的文件名。"
29182934
29192935#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2313
29202936msgid "Return the inode number of the entry."
2921- msgstr ""
2937+ msgstr "返回本条目的索引节点号。 "
29222938
29232939#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2315
29242940msgid ""
29252941"The result is cached on the ``os.DirEntry`` object. Use "
29262942"``os.stat(entry.path, follow_symlinks=False).st_ino`` to fetch up-to-date "
29272943"information."
29282944msgstr ""
2945+ "这一结果是缓存在 ``os.DirEntry`` 对象中的,请调用 ``os.stat(entry.path, "
2946+ "follow_symlinks=False).st_ino`` 来获取最新信息。"
29292947
29302948#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2319
29312949msgid ""
29322950"On the first, uncached call, a system call is required on Windows but not on"
29332951" Unix."
2934- msgstr ""
2952+ msgstr "一开始没有缓存时,在 Windows 上需要一次系统调用,但在 Unix 上不需要。 "
29352953
29362954#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2324
29372955msgid ""
0 commit comments