@@ -14,7 +14,7 @@ msgid ""
1414msgstr ""
1515"Project-Id-Version : Python 3.8\n "
1616"Report-Msgid-Bugs-To : \n "
17- "POT-Creation-Date : 2020-09-15 15:07 +0000\n "
17+ "POT-Creation-Date : 2020-09-23 15:13 +0000\n "
1818"PO-Revision-Date : 2020-05-30 12:01+0000\n "
1919"
Last-Translator :
Freesand Leo <[email protected] >, 2020\n "
2020"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -883,7 +883,19 @@ msgstr "使用自定义的 :meth:`__new__`"
883883msgid "Using an auto-numbering :meth:`__new__` would look like::"
884884msgstr "使用自动编号 :meth:`__new__` 的形式如下::"
885885
886- #: ../../library/enum.rst:894
886+ #: ../../library/enum.rst:891
887+ msgid ""
888+ "To make a more general purpose ``AutoNumber``, add ``*args`` to the "
889+ "signature::"
890+ msgstr ""
891+
892+ #: ../../library/enum.rst:901
893+ msgid ""
894+ "Then when you inherit from ``AutoNumber`` you can write your own "
895+ "``__init__`` to handle any extra arguments::"
896+ msgstr ""
897+
898+ #: ../../library/enum.rst:920
887899msgid ""
888900"The :meth:`__new__` method, if defined, is used during creation of the Enum "
889901"members; it is then replaced by Enum's :meth:`__new__` which is used after "
@@ -892,69 +904,69 @@ msgstr ""
892904"如果定义了 :meth:`__new__` 则它会在创建 Enum 成员期间被使用;随后它将被 Enum 的 :meth:`__new__` "
893905"所替换,该方法会在类创建后被用来查找现有成员。"
894906
895- #: ../../library/enum.rst:900
907+ #: ../../library/enum.rst:926
896908msgid "OrderedEnum"
897909msgstr "OrderedEnum"
898910
899- #: ../../library/enum.rst:902
911+ #: ../../library/enum.rst:928
900912msgid ""
901913"An ordered enumeration that is not based on :class:`IntEnum` and so "
902914"maintains the normal :class:`Enum` invariants (such as not being comparable "
903915"to other enumerations)::"
904916msgstr ""
905917"一个有序枚举,它不是基于 :class:`IntEnum`,因此保持了正常的 :class:`Enum` 不变特性(例如不可与其他枚举进行比较)::"
906918
907- #: ../../library/enum.rst:936
919+ #: ../../library/enum.rst:962
908920msgid "DuplicateFreeEnum"
909921msgstr "DuplicateFreeEnum"
910922
911- #: ../../library/enum.rst:938
923+ #: ../../library/enum.rst:964
912924msgid ""
913925"Raises an error if a duplicate member name is found instead of creating an "
914926"alias::"
915927msgstr "如果发现重复的成员名称则将引发错误而不是创建别名::"
916928
917- #: ../../library/enum.rst:963
929+ #: ../../library/enum.rst:989
918930msgid ""
919931"This is a useful example for subclassing Enum to add or change other "
920932"behaviors as well as disallowing aliases. If the only desired change is "
921933"disallowing aliases, the :func:`unique` decorator can be used instead."
922934msgstr ""
923935"这个例子适用于子类化 Enum 来添加或改变禁用别名以及其他行为。 如果需要的改变只是禁用别名,也可以选择使用 :func:`unique` 装饰器。"
924936
925- #: ../../library/enum.rst:969
937+ #: ../../library/enum.rst:995
926938msgid "Planet"
927939msgstr "Planet"
928940
929- #: ../../library/enum.rst:971
941+ #: ../../library/enum.rst:997
930942msgid ""
931943"If :meth:`__new__` or :meth:`__init__` is defined the value of the enum "
932944"member will be passed to those methods::"
933945msgstr "如果定义了 :meth:`__new__` 或 :meth:`__init__` 则枚举成员的值将被传给这些方法::"
934946
935- #: ../../library/enum.rst:999
947+ #: ../../library/enum.rst:1025
936948msgid "TimePeriod"
937949msgstr "TimePeriod"
938950
939- #: ../../library/enum.rst:1001
951+ #: ../../library/enum.rst:1027
940952msgid "An example to show the :attr:`_ignore_` attribute in use::"
941953msgstr "一个演示如何使用 :attr:`_ignore_` 属性的例子::"
942954
943- #: ../../library/enum.rst:1018
955+ #: ../../library/enum.rst:1044
944956msgid "How are Enums different?"
945957msgstr "各种枚举有何区别?"
946958
947- #: ../../library/enum.rst:1020
959+ #: ../../library/enum.rst:1046
948960msgid ""
949961"Enums have a custom metaclass that affects many aspects of both derived Enum"
950962" classes and their instances (members)."
951963msgstr "枚举具有自定义的元类,它会影响所派生枚举类及其实例(成员)的各个方面。"
952964
953- #: ../../library/enum.rst:1025
965+ #: ../../library/enum.rst:1051
954966msgid "Enum Classes"
955967msgstr "枚举类"
956968
957- #: ../../library/enum.rst:1027
969+ #: ../../library/enum.rst:1053
958970msgid ""
959971"The :class:`EnumMeta` metaclass is responsible for providing the "
960972":meth:`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods "
@@ -970,11 +982,11 @@ msgstr ""
970982"类中的各种其他方法是正确的 (例如 :meth:`__new__`, :meth:`__getnewargs__`, :meth:`__str__` 和"
971983" :meth:`__repr__`)。"
972984
973- #: ../../library/enum.rst:1037
985+ #: ../../library/enum.rst:1063
974986msgid "Enum Members (aka instances)"
975987msgstr "枚举成员(即实例)"
976988
977- #: ../../library/enum.rst:1039
989+ #: ../../library/enum.rst:1065
978990msgid ""
979991"The most interesting thing about Enum members is that they are singletons. "
980992":class:`EnumMeta` creates them all while it is creating the :class:`Enum` "
@@ -985,22 +997,22 @@ msgstr ""
985997"有关枚举成员最有趣的特点是它们都是单例对象。 :class:`EnumMeta` 会在创建 :class:`Enum` "
986998"类本身时将它们全部创建完成,然后准备好一个自定义的 :meth:`__new__`,通过只返回现有的成员实例来确保不会再实例化新的对象。"
987999
988- #: ../../library/enum.rst:1047
1000+ #: ../../library/enum.rst:1073
9891001msgid "Finer Points"
9901002msgstr "细节要点"
9911003
992- #: ../../library/enum.rst:1050
1004+ #: ../../library/enum.rst:1076
9931005msgid "Supported ``__dunder__`` names"
9941006msgstr "支持的 ``__dunder__`` 名称"
9951007
996- #: ../../library/enum.rst:1052
1008+ #: ../../library/enum.rst:1078
9971009msgid ""
9981010":attr:`__members__` is a read-only ordered mapping of "
9991011"``member_name``:``member`` items. It is only available on the class."
10001012msgstr ""
10011013":attr:`__members__` 是一个 ``member_name``:``member`` 条目的只读有序映射。 它只在类上可用。"
10021014
1003- #: ../../library/enum.rst:1055
1015+ #: ../../library/enum.rst:1081
10041016msgid ""
10051017":meth:`__new__`, if specified, must create and return the enum members; it "
10061018"is also a very good idea to set the member's :attr:`_value_` appropriately."
@@ -1009,40 +1021,40 @@ msgstr ""
10091021"如果指定了 :meth:`__new__`,它必须创建并返回枚举成员;相应地设定成员的 :attr:`_value_` 也是一个很好的主意。 "
10101022"一旦所有成员都创建完成它就不会再被使用。"
10111023
1012- #: ../../library/enum.rst:1061
1024+ #: ../../library/enum.rst:1087
10131025msgid "Supported ``_sunder_`` names"
10141026msgstr "支持的 ``_sunder_`` 名称"
10151027
1016- #: ../../library/enum.rst:1063
1028+ #: ../../library/enum.rst:1089
10171029msgid "``_name_`` -- name of the member"
10181030msgstr "``_name_`` -- 成员的名称"
10191031
1020- #: ../../library/enum.rst:1064
1032+ #: ../../library/enum.rst:1090
10211033msgid ""
10221034"``_value_`` -- value of the member; can be set / modified in ``__new__``"
10231035msgstr "``_value_`` -- 成员的值;可以在 ``__new__`` 中设置 / 修改"
10241036
1025- #: ../../library/enum.rst:1066
1037+ #: ../../library/enum.rst:1092
10261038msgid ""
10271039"``_missing_`` -- a lookup function used when a value is not found; may be "
10281040"overridden"
10291041msgstr "``_missing_`` -- 当未发现某个值时所使用的查找函数;可被重载"
10301042
1031- #: ../../library/enum.rst:1068
1043+ #: ../../library/enum.rst:1094
10321044msgid ""
10331045"``_ignore_`` -- a list of names, either as a :func:`list` or a :func:`str`, "
10341046"that will not be transformed into members, and will be removed from the "
10351047"final class"
10361048msgstr ""
10371049"``_ignore_`` -- 一个名称列表,可以为 :func:`list` 或 :func:`str`,它将不会被转化为成员,并会从最终类中被移除"
10381050
1039- #: ../../library/enum.rst:1071
1051+ #: ../../library/enum.rst:1097
10401052msgid ""
10411053"``_order_`` -- used in Python 2/3 code to ensure member order is consistent "
10421054"(class attribute, removed during class creation)"
10431055msgstr "``_order_`` -- 用于 Python 2/3 代码以确保成员顺序一致(类属性,在类创建期间会被移除)"
10441056
1045- #: ../../library/enum.rst:1073
1057+ #: ../../library/enum.rst:1099
10461058msgid ""
10471059"``_generate_next_value_`` -- used by the `Functional API`_ and by "
10481060":class:`auto` to get an appropriate value for an enum member; may be "
@@ -1051,15 +1063,15 @@ msgstr ""
10511063"``_generate_next_value_`` -- 用于 `Functional API`_ 并通过 :class:`auto` "
10521064"为枚举成员获取适当的值;可被重载"
10531065
1054- #: ../../library/enum.rst:1077
1066+ #: ../../library/enum.rst:1103
10551067msgid "``_missing_``, ``_order_``, ``_generate_next_value_``"
10561068msgstr "``_missing_``, ``_order_``, ``_generate_next_value_``"
10571069
1058- #: ../../library/enum.rst:1078
1070+ #: ../../library/enum.rst:1104
10591071msgid "``_ignore_``"
10601072msgstr "``_ignore_``"
10611073
1062- #: ../../library/enum.rst:1080
1074+ #: ../../library/enum.rst:1106
10631075msgid ""
10641076"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute "
10651077"can be provided. It will be checked against the actual order of the "
@@ -1068,17 +1080,17 @@ msgstr ""
10681080"用来帮助 Python 2 / Python 3 代码保持同步提供 :attr:`_order_` 属性。 "
10691081"它将与枚举的实际顺序进行对照检查,如果两者不匹配则会引发错误::"
10701082
1071- #: ../../library/enum.rst:1096
1083+ #: ../../library/enum.rst:1122
10721084msgid ""
10731085"In Python 2 code the :attr:`_order_` attribute is necessary as definition "
10741086"order is lost before it can be recorded."
10751087msgstr "在 Python 2 代码中 :attr:`_order_` 属性是必须的,因为定义顺序在被记录之前就会丢失。"
10761088
1077- #: ../../library/enum.rst:1100
1089+ #: ../../library/enum.rst:1126
10781090msgid "``Enum`` member type"
10791091msgstr "``Enum`` 成员类型"
10801092
1081- #: ../../library/enum.rst:1102
1093+ #: ../../library/enum.rst:1128
10821094msgid ""
10831095":class:`Enum` members are instances of their :class:`Enum` class, and are "
10841096"normally accessed as ``EnumClass.member``. Under certain circumstances they"
@@ -1092,11 +1104,11 @@ msgstr ""
10921104"的形式来访问,但你绝对不应这样做,因为查找可能失败,或者更糟糕地返回你所查找的 :class:`Enum` "
10931105"成员以外的对象(这也是成员应使用全大写名称的另一个好理由)::"
10941106
1095- #: ../../library/enum.rst:1123
1107+ #: ../../library/enum.rst:1149
10961108msgid "Boolean value of ``Enum`` classes and members"
10971109msgstr "``Enum`` 类和成员的布尔值"
10981110
1099- #: ../../library/enum.rst:1125
1111+ #: ../../library/enum.rst:1151
11001112msgid ""
11011113":class:`Enum` members that are mixed with non-:class:`Enum` types (such as "
11021114":class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in "
@@ -1108,15 +1120,15 @@ msgstr ""
11081120"成员会按所混合类型的规则被求值;在其他情况下,所有成员都将被求值为 :data:`True`。 要使你的自定义 Enum "
11091121"的布尔值取决于成员的值,请在你的类中添加以下代码::"
11101122
1111- #: ../../library/enum.rst:1134
1123+ #: ../../library/enum.rst:1160
11121124msgid ":class:`Enum` classes always evaluate as :data:`True`."
11131125msgstr ":class:`Enum` 类总是会被求值为 :data:`True`。"
11141126
1115- #: ../../library/enum.rst:1138
1127+ #: ../../library/enum.rst:1164
11161128msgid "``Enum`` classes with methods"
11171129msgstr "带有方法的 ``Enum`` 类"
11181130
1119- #: ../../library/enum.rst:1140
1131+ #: ../../library/enum.rst:1166
11201132msgid ""
11211133"If you give your :class:`Enum` subclass extra methods, like the `Planet`_ "
11221134"class above, those methods will show up in a :func:`dir` of the member, but "
@@ -1125,11 +1137,11 @@ msgstr ""
11251137"如果你为你的 :class:`Enum` 子类添加了额外的方法,如同上述的 `Planet`_ 类一样,这些方法将在对成员执行 :func:`dir` "
11261138"时显示出来,但对类执行时则不会显示::"
11271139
1128- #: ../../library/enum.rst:1151
1140+ #: ../../library/enum.rst:1177
11291141msgid "Combining members of ``Flag``"
11301142msgstr "组合 ``Flag`` 的成员"
11311143
1132- #: ../../library/enum.rst:1153
1144+ #: ../../library/enum.rst:1179
11331145msgid ""
11341146"If a combination of Flag members is not named, the :func:`repr` will include"
11351147" all named flags and all named combinations of flags that are in the value::"
0 commit comments