Skip to content

Commit

Permalink
feat: to rst:600
Browse files Browse the repository at this point in the history
  • Loading branch information
ken71301 committed Dec 11, 2024
1 parent 85fadd9 commit b8f0cc5
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions reference/import.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-03 11:11+0800\n"
"PO-Revision-Date: 2024-11-06 14:55+0800\n"
"PO-Revision-Date: 2024-12-11 21:55+0800\n"
"Last-Translator: Ken Cheng <ken71301@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand Down Expand Up @@ -1007,7 +1007,7 @@ msgstr ""

#: ../../reference/import.rst:546
msgid "__path__ attributes on modules"
msgstr ""
msgstr "模組上的 __path__ 屬性"

#: ../../reference/import.rst:548
msgid ""
Expand All @@ -1016,6 +1016,9 @@ msgid ""
"submodules will be found. By definition, if a module has a :attr:`!__path__` "
"attribute, it is a :term:`package`."
msgstr ""
":attr:`~module.__path__` 屬性應該是一個(可能為空的):term:`序列 "
"<sequence>`,其包含列舉套件子模組位置的字串。根據定義,如果一個模組有 :attr:"
"`!__path__` 屬性,那麼它就是一個 :term:`套件 <package>`。"

#: ../../reference/import.rst:553
msgid ""
Expand All @@ -1025,13 +1028,18 @@ msgid ""
"during import. However, :attr:`!__path__` is typically much more constrained "
"than :data:`!sys.path`."
msgstr ""
"套件的 :attr:`~module.__path__` 屬性在引入其子套件時被使用。在引入機制中,其"
"功能與 :data:`sys.path` 類似,即提供在引入期間搜尋模組的位置串列。然而,:"
"attr:`!__path__` 通常比 :data:`!sys.path` 更受限制。"

#: ../../reference/import.rst:560
msgid ""
"The same rules used for :data:`sys.path` also apply to a package's :attr:`!"
"__path__`. :data:`sys.path_hooks` (described below) are consulted when "
"traversing a package's :attr:`!__path__`."
msgstr ""
":data:`sys.path` 適用的規則同樣也適用於套件的 :attr:`!__path__`。在遍歷套件"
"的 :attr:`!__path__` 時,會參考 :data:`sys.path_hooks`(於後文詳述)。"

#: ../../reference/import.rst:564
msgid ""
Expand All @@ -1042,17 +1050,23 @@ msgid ""
"containing only :attr:`!__path__` manipulation code; the import machinery "
"automatically sets :attr:`!__path__` correctly for the namespace package."
msgstr ""
"套件的 ``__init__.py`` 檔案可以設定或修改套件的 :attr:`~module.__path__` 屬"
"性,這通常是 :pep:`420` 之前實作命名空間套件的方式。隨著 :pep:`420` 的採用,"
"命名空間套件不再需要提供僅包含 :attr:`!__path__` 操作程式碼的 ``__init__."
"py`` 檔案;引入機制會自動為命名空間套件正確地設定 :attr:`!__path__`。"

#: ../../reference/import.rst:573
msgid "Module reprs"
msgstr ""
msgstr "模組的 reprs"

#: ../../reference/import.rst:575
msgid ""
"By default, all modules have a usable repr, however depending on the "
"attributes set above, and in the module's spec, you can more explicitly "
"control the repr of module objects."
msgstr ""
"預設情況下,所有模組都有可用的 repr,然而,根據上述設定及模組規格中的屬性,你"
"可以更明確地控制模組物件的 repr。"

#: ../../reference/import.rst:579
msgid ""
Expand All @@ -1063,40 +1077,50 @@ msgid ""
"__file__``, and ``module.__loader__`` as input into the repr, with defaults "
"for whatever information is missing."
msgstr ""
"如果模組具有規格(\\ ``__spec__``\\ ),引入機制將嘗試從規格中產生 repr。如果"
"失敗或沒有規格,引入系統將使用模組上可用的資訊製作一個預設的 repr。它會嘗試使"
"用 ``module.__name__``、``module.__file__`` 和 ``module.__loader__`` 作為 "
"repr 的輸入,並為缺少的資訊提供預設值。"

#: ../../reference/import.rst:586
msgid "Here are the exact rules used:"
msgstr ""
msgstr "以下是具體的使用規則:"

#: ../../reference/import.rst:588
msgid ""
"If the module has a ``__spec__`` attribute, the information in the spec is "
"used to generate the repr. The \"name\", \"loader\", \"origin\", and "
"\"has_location\" attributes are consulted."
msgstr ""
"如果模組具有 ``__spec__`` 屬性,則使用規格中的資訊產生 repr。會參考 "
"\"name\"\"loader\"\"origin\"\"has_location\" 屬性。"

#: ../../reference/import.rst:592
msgid ""
"If the module has a ``__file__`` attribute, this is used as part of the "
"module's repr."
msgstr ""
msgstr "如果模組具有 ``__file__`` 屬性,則會將其作為模組 repr 的一部分。"

#: ../../reference/import.rst:595
msgid ""
"If the module has no ``__file__`` but does have a ``__loader__`` that is not "
"``None``, then the loader's repr is used as part of the module's repr."
msgstr ""
"如果模組沒有 ``__file__`` 但有一個不為 ``None`` 的 ``__loader__`` ,則會將載"
"入器的 repr 作為模組 repr 的一部分。"

#: ../../reference/import.rst:598
msgid "Otherwise, just use the module's ``__name__`` in the repr."
msgstr ""
msgstr "否則,在 repr 中只使用模組的 ``__name__``。"

#: ../../reference/import.rst:600
msgid ""
"Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was "
"removed in Python 3.12 and is no longer called during the resolution of a "
"module's repr."
msgstr ""
":meth:`!module_repr` 自 Python 3.4 起被棄用,並在 Python 3.12 中移除,且不會"
"在解析模組的 repr 時被呼叫。"

#: ../../reference/import.rst:608
msgid "Cached bytecode invalidation"
Expand Down

0 comments on commit b8f0cc5

Please sign in to comment.