@@ -15,7 +15,7 @@ msgid ""
1515msgstr ""
1616"Project-Id-Version : Python 3.9\n "
1717"Report-Msgid-Bugs-To : \n "
18- "POT-Creation-Date : 2020-09-17 04:21 +0000\n "
18+ "POT-Creation-Date : 2020-09-23 04:10 +0000\n "
1919"PO-Revision-Date : 2017-02-16 23:09+0000\n "
2020"
Last-Translator :
Freesand Leo <[email protected] >, 2020\n "
2121"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:893
886+ #: ../../library/enum.rst:890
887+ msgid ""
888+ "To make a more general purpose ``AutoNumber``, add ``*args`` to the "
889+ "signature::"
890+ msgstr ""
891+
892+ #: ../../library/enum.rst:900
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:919
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:899
907+ #: ../../library/enum.rst:925
896908msgid "OrderedEnum"
897909msgstr "OrderedEnum"
898910
899- #: ../../library/enum.rst:901
911+ #: ../../library/enum.rst:927
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:935
919+ #: ../../library/enum.rst:961
908920msgid "DuplicateFreeEnum"
909921msgstr "DuplicateFreeEnum"
910922
911- #: ../../library/enum.rst:937
923+ #: ../../library/enum.rst:963
912924msgid ""
913925"Raises an error if a duplicate member name is found instead of creating an "
914926"alias::"
915927msgstr "如果发现重复的成员名称则将引发错误而不是创建别名::"
916928
917- #: ../../library/enum.rst:962
929+ #: ../../library/enum.rst:988
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:968
937+ #: ../../library/enum.rst:994
926938msgid "Planet"
927939msgstr "Planet"
928940
929- #: ../../library/enum.rst:970
941+ #: ../../library/enum.rst:996
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:998
947+ #: ../../library/enum.rst:1024
936948msgid "TimePeriod"
937949msgstr "TimePeriod"
938950
939- #: ../../library/enum.rst:1000
951+ #: ../../library/enum.rst:1026
940952msgid "An example to show the :attr:`_ignore_` attribute in use::"
941953msgstr "一个演示如何使用 :attr:`_ignore_` 属性的例子::"
942954
943- #: ../../library/enum.rst:1017
955+ #: ../../library/enum.rst:1043
944956msgid "How are Enums different?"
945957msgstr "各种枚举有何区别?"
946958
947- #: ../../library/enum.rst:1019
959+ #: ../../library/enum.rst:1045
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:1024
965+ #: ../../library/enum.rst:1050
954966msgid "Enum Classes"
955967msgstr "枚举类"
956968
957- #: ../../library/enum.rst:1026
969+ #: ../../library/enum.rst:1052
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:1036
985+ #: ../../library/enum.rst:1062
974986msgid "Enum Members (aka instances)"
975987msgstr "枚举成员(即实例)"
976988
977- #: ../../library/enum.rst:1038
989+ #: ../../library/enum.rst:1064
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:1046
1000+ #: ../../library/enum.rst:1072
9891001msgid "Finer Points"
9901002msgstr "细节要点"
9911003
992- #: ../../library/enum.rst:1049
1004+ #: ../../library/enum.rst:1075
9931005msgid "Supported ``__dunder__`` names"
9941006msgstr "支持的 ``__dunder__`` 名称"
9951007
996- #: ../../library/enum.rst:1051
1008+ #: ../../library/enum.rst:1077
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:1054
1015+ #: ../../library/enum.rst:1080
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:1060
1024+ #: ../../library/enum.rst:1086
10131025msgid "Supported ``_sunder_`` names"
10141026msgstr "支持的 ``_sunder_`` 名称"
10151027
1016- #: ../../library/enum.rst:1062
1028+ #: ../../library/enum.rst:1088
10171029msgid "``_name_`` -- name of the member"
10181030msgstr "``_name_`` -- 成员的名称"
10191031
1020- #: ../../library/enum.rst:1063
1032+ #: ../../library/enum.rst:1089
10211033msgid ""
10221034"``_value_`` -- value of the member; can be set / modified in ``__new__``"
10231035msgstr "``_value_`` -- 成员的值;可以在 ``__new__`` 中设置 / 修改"
10241036
1025- #: ../../library/enum.rst:1065
1037+ #: ../../library/enum.rst:1091
10261038msgid ""
10271039"``_missing_`` -- a lookup function used when a value is not found; may be "
10281040"overridden"
10291041msgstr "``_missing_`` -- 当未发现某个值时所使用的查找函数;可被重载"
10301042
1031- #: ../../library/enum.rst:1067
1043+ #: ../../library/enum.rst:1093
10321044msgid ""
10331045"``_ignore_`` -- a list of names, either as a :class:`list` or a "
10341046":class:`str`, that will not be transformed into members, and will be removed"
10351047" from the final class"
10361048msgstr ""
10371049"``_ignore_`` -- 一个名称列表,可以为 :class:`list` 或 :class:`str`,它不会被转化为成员,并将从最终类中被移除"
10381050
1039- #: ../../library/enum.rst:1070
1051+ #: ../../library/enum.rst:1096
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:1072
1057+ #: ../../library/enum.rst:1098
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:1076
1066+ #: ../../library/enum.rst:1102
10551067msgid "``_missing_``, ``_order_``, ``_generate_next_value_``"
10561068msgstr "``_missing_``, ``_order_``, ``_generate_next_value_``"
10571069
1058- #: ../../library/enum.rst:1077
1070+ #: ../../library/enum.rst:1103
10591071msgid "``_ignore_``"
10601072msgstr "``_ignore_``"
10611073
1062- #: ../../library/enum.rst:1079
1074+ #: ../../library/enum.rst:1105
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:1095
1083+ #: ../../library/enum.rst:1121
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:1099
1089+ #: ../../library/enum.rst:1125
10781090msgid "``Enum`` member type"
10791091msgstr "``Enum`` 成员类型"
10801092
1081- #: ../../library/enum.rst:1101
1093+ #: ../../library/enum.rst:1127
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:1122
1107+ #: ../../library/enum.rst:1148
10961108msgid "Boolean value of ``Enum`` classes and members"
10971109msgstr "``Enum`` 类和成员的布尔值"
10981110
1099- #: ../../library/enum.rst:1124
1111+ #: ../../library/enum.rst:1150
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:1133
1123+ #: ../../library/enum.rst:1159
11121124msgid ":class:`Enum` classes always evaluate as :data:`True`."
11131125msgstr ":class:`Enum` 类总是会被求值为 :data:`True`。"
11141126
1115- #: ../../library/enum.rst:1137
1127+ #: ../../library/enum.rst:1163
11161128msgid "``Enum`` classes with methods"
11171129msgstr "带有方法的 ``Enum`` 类"
11181130
1119- #: ../../library/enum.rst:1139
1131+ #: ../../library/enum.rst:1165
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:1150
1140+ #: ../../library/enum.rst:1176
11291141msgid "Combining members of ``Flag``"
11301142msgstr "组合 ``Flag`` 的成员"
11311143
1132- #: ../../library/enum.rst:1152
1144+ #: ../../library/enum.rst:1178
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