Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99de7c1

Browse files
[po] auto sync
1 parent 010f0c9 commit 99de7c1

1 file changed

Lines changed: 22 additions & 24 deletions

File tree

tutorial/modules.po

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# eric R <[email protected]>, 2018
99
# ww song <[email protected]>, 2018
1010
# Junkai Shao <[email protected]>, 2018
11-
# Freesand Leo <[email protected]>, 2020
11+
# Freesand Leo <[email protected]>, 2018
1212
# jaystone776 <[email protected]>, 2021
1313
#
1414
#, fuzzy
@@ -557,16 +557,16 @@ msgid ""
557557
"for importing \\* from their package. For example, the file "
558558
":file:`sound/effects/__init__.py` could contain the following code::"
559559
msgstr ""
560-
"唯一的解决方案是让包作者提供一个包的显式索引。:keyword:`import` 语句使用下面的规范:如果一个包的 "
561-
":file:`__init__.py` 代码定义了一个名为 ``__all__`` 的列表,它会被视为在遇到 ``from package import"
562-
" *`` 时应该导入的模块名列表。在发布该包的新版本时,包作者可以决定是否让此列表保持更新。包作者如果认为从他们的包中导入 \\* "
563-
"的操作没有必要被使用,也可以决定不支持此列表。例如,文件 :file:`sound/effects/__init__.py` 可以包含以下代码::"
560+
"唯一的解决方案是提供包的显式索引。:keyword:`import` 语句使用如下惯例:如果包的 :file:`__init__.py` 代码定义了列表"
561+
" ``__all__``,运行 ``from package import *`` "
562+
"时,它就是用于导入的模块名列表。发布包的新版本时,包的作者应更新此列表。如果包的作者认为没有必要在包中执行导入 \\* "
563+
"操作,也可以不提供此列表。例如,:file:`sound/effects/__init__.py` 文件包含以下代码:"
564564

565565
#: ../../tutorial/modules.rst:505
566566
msgid ""
567567
"This would mean that ``from sound.effects import *`` would import the three "
568568
"named submodules of the :mod:`sound` package."
569-
msgstr "这意味着 ``from sound.effects import *`` 将导入 :mod:`sound` 包的三个命名子模块。"
569+
msgstr "即,``from sound.effects import *`` 将导入 :mod:`sound` 包中的这三个命名子模块。"
570570

571571
#: ../../tutorial/modules.rst:508
572572
msgid ""
@@ -580,10 +580,10 @@ msgid ""
580580
"package that were explicitly loaded by previous :keyword:`import` "
581581
"statements. Consider this code::"
582582
msgstr ""
583-
"如果没有定义 ``__all__``,``from sound.effects import *`` 语句 *不会* 从包 "
584-
":mod:`sound.effects` 中导入所有子模块到当前命名空间;它只确保导入了包 :mod:`sound.effects` (可能运行任何在 "
585-
":file:`__init__.py` 中的初始化代码),然后导入包中定义的任何名称。 这包括 :file:`__init__.py` "
586-
"定义的任何名称(以及显式加载的子模块)。它还包括由之前的 :keyword:`import` 语句显式加载的包的任何子模块。思考下面的代码::"
583+
"如果没有定义 ``__all__``,``from sound.effects import *`` 语句 *不会* 把包 "
584+
":mod:`sound.effects` 中所有子模块都导入到当前命名空间;该语句只确保导入包 :mod:`sound.effects` (可能还会运行"
585+
" :file:`__init__.py` 中的初始化代码),然后,再导入包中定义的名称。这些名称包括 :file:`__init__.py` "
586+
"中定义的任何名称(以及显式加载的子模块),还包括之前 :keyword:`import` 语句显式加载的包里的子模块。请看以下代码:"
587587

588588
#: ../../tutorial/modules.rst:521
589589
msgid ""
@@ -592,15 +592,15 @@ msgid ""
592592
"package when the ``from...import`` statement is executed. (This also works "
593593
"when ``__all__`` is defined.)"
594594
msgstr ""
595-
"在这个例子中, :mod:`echo` 和 :mod:`surround` 模块是在执行 ``from...import`` "
596-
"语句时导入到当前命名空间中的,因为它们定义在 :mod:`sound.effects` 包中。(这在定义了 ``__all__`` 时也有效。)"
595+
"本例中,执行 ``from...import`` 语句时,将把 :mod:`echo` 和 :mod:`surround` "
596+
"模块导入至当前命名空间,因为,它们是在 :mod:`sound.effects` 包里定义的。(该导入操作在定义了 ``__all__`` 时也有效。)"
597597

598598
#: ../../tutorial/modules.rst:526
599599
msgid ""
600600
"Although certain modules are designed to export only names that follow "
601601
"certain patterns when you use ``import *``, it is still considered bad "
602602
"practice in production code."
603-
msgstr "虽然某些模块被设计为在使用 ``import *`` 时只导出遵循某些模式的名称,但在生产代码中它仍然被认为是不好的做法。"
603+
msgstr "虽然,可以把模块设计为用 ``import *`` 时只导出遵循指定模式的名称,但仍不提倡在生产代码中使用这种做法。"
604604

605605
#: ../../tutorial/modules.rst:530
606606
msgid ""
@@ -609,8 +609,8 @@ msgid ""
609609
"importing module needs to use submodules with the same name from different "
610610
"packages."
611611
msgstr ""
612-
"请记住,使用 ``from package import specific_submodule`` 没有任何问题! "
613-
"实际上,除非导入的模块需要使用来自不同包的同名子模块,否则这是推荐的表示法。"
612+
"记住,使用 ``from package import specific_submodule`` 没有任何问题! "
613+
"实际上,除了导入模块使用不同包的同名子模块之外,这种方式是推荐用法。"
614614

615615
#: ../../tutorial/modules.rst:537
616616
msgid "Intra-package References"
@@ -624,9 +624,9 @@ msgid ""
624624
":mod:`sound.filters.vocoder` needs to use the :mod:`echo` module in the "
625625
":mod:`sound.effects` package, it can use ``from sound.effects import echo``."
626626
msgstr ""
627-
"当包被构造成子包时(与示例中的 :mod:`sound` 包一样),你可以使用绝对导入来引用兄弟包的子模块。例如,如果模块 "
628-
":mod:`sound.filters.vocoder` 需要在 :mod:`sound.effects` 包中使用 :mod:`echo` "
629-
"模块,它可以使用 ``from sound.effects import echo`` 。"
627+
"包中含有多个子包时(与示例中的 :mod:`sound` 包一样),可以使用绝对导入引用兄弟包中的子模块。例如,要在模块 "
628+
":mod:`sound.filters.vocoder` 中使用 :mod:`sound.effects` 包的 :mod:`echo` 模块时,可以用"
629+
" ``from sound.effects import echo`` 导入。"
630630

631631
#: ../../tutorial/modules.rst:545
632632
msgid ""
@@ -635,22 +635,20 @@ msgid ""
635635
"current and parent packages involved in the relative import. From the "
636636
":mod:`surround` module for example, you might use::"
637637
msgstr ""
638-
"你还可以使用import语句的 ``from module import name`` "
639-
"形式编写相对导入。这些导入使用前导点来指示相对导入中涉及的当前包和父包。例如, :mod:`surround` 模块,你可以使用::"
638+
"还可以用 import 语句的 ``from module import name`` "
639+
"形式执行相对导入。这些导入语句使用前导句点表示相对导入中的当前包和父包。例如,相对于 :mod:`surround` 模块,可以使用:"
640640

641641
#: ../../tutorial/modules.rst:554
642642
msgid ""
643643
"Note that relative imports are based on the name of the current module. "
644644
"Since the name of the main module is always ``\"__main__\"``, modules "
645645
"intended for use as the main module of a Python application must always use "
646646
"absolute imports."
647-
msgstr ""
648-
"请注意,相对导入是基于当前模块的名称进行导入的。由于主模块的名称总是 ``\"__main__\"`` "
649-
",因此用作Python应用程序主模块的模块必须始终使用绝对导入。"
647+
msgstr "注意,相对导入基于的是当前模块名。由于,主模块名是 ``\"__main__\"`` ,因此,Python 应用程序的主模块必须始终使用绝对导入。"
650648

651649
#: ../../tutorial/modules.rst:560
652650
msgid "Packages in Multiple Directories"
653-
msgstr "多个目录中的包"
651+
msgstr "多目录中的包"
654652

655653
#: ../../tutorial/modules.rst:562
656654
msgid ""

0 commit comments

Comments
 (0)