8000 sync with cpython 6421db1d · python/python-docs-zh-tw@6bd0c97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6bd0c97

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython 6421db1d
1 parent 30133c4 commit 6bd0c97

File tree

2 files changed

+509
-501
lines changed

2 files changed

+509
-501
lines changed

howto/enum.po

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: Python 3.12\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2023-11-30 00:03+0000\n"
11+
"POT-Creation-Date: 2024-06-20 00:03+0000\n"
1212
"PO-Revision-Da 8000 te: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -972,78 +972,78 @@ msgstr ""
972972
msgid "names of pseudo-flags are constructed from their members' names::"
973973
msgstr ""
974974

975-
#: ../../howto/enum.rst:1132
975+
#: ../../howto/enum.rst:1140
976976
msgid "multi-bit flags, aka aliases, can be returned from operations::"
977977
msgstr ""
978978

979-
#: ../../howto/enum.rst:1143
979+
#: ../../howto/enum.rst:1151
980980
msgid ""
981981
"membership / containment checking: zero-valued flags are always considered "
982982
"to be contained::"
983983
msgstr ""
984984

985-
#: ../../howto/enum.rst:1149
985+
#: ../../howto/enum.rst:1157
986986
msgid ""
987987
"otherwise, only if all bits of one flag are in the other flag will True be "
988988
"returned::"
989989
msgstr ""
990990

991-
#: ../../howto/enum.rst:1158
991+
#: ../../howto/enum.rst:1166
992992
msgid ""
993993
"There is a new boundary mechanism that controls how out-of-range / invalid "
994994
"bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:"
995995
msgstr ""
996996

997-
#: ../../howto/enum.rst:1161
997+
#: ../../howto/enum.rst:1169
998998
msgid "STRICT --> raises an exception when presented with invalid values"
999999
msgstr ""
10001000

1001-
#: ../../howto/enum.rst:1162
1001+
#: ../../howto/enum.rst:1170
10021002
msgid "CONFORM --> discards any invalid bits"
10031003
msgstr ""
10041004

1005-
#: ../../howto/enum.rst:1163
1005+
#: ../../howto/enum.rst:1171
10061006
msgid "EJECT --> lose Flag status and become a normal int with the given value"
10071007
msgstr ""
10081008

1009-
#: ../../howto/enum.rst:1164
1009+
#: ../../howto/enum.rst:1172
10101010
msgid "KEEP --> keep the extra bits"
10111011
msgstr ""
10121012

1013-
#: ../../howto/enum.rst:1166
1013+
#: ../../howto/enum.rst:1174
10141014
msgid "keeps Flag status and extra bits"
10151015
msgstr ""
10161016

1017-
#: ../../howto/enum.rst:1167
1017+
#: ../../howto/enum.rst:1175
10181018
msgid "extra bits do not show up in iteration"
10191019
msgstr ""
10201020

1021-
#: ../../howto/enum.rst:1168
1021+
#: ../../howto/enum.rst:1176
10221022
msgid "extra bits do show up in repr() and str()"
10231023
msgstr ""
10241024

1025-
#: ../../howto/enum.rst:1170
1025+
#: ../../howto/enum.rst:1178
10261026
msgid ""
10271027
"The default for Flag is ``STRICT``, the default for ``IntFlag`` is "
10281028
"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl."
10291029
"Options`` for an example of when ``KEEP`` is needed)."
10301030
msgstr ""
10311031

1032-
#: ../../howto/enum.rst:1178
1032+
#: ../../howto/enum.rst:1186
10331033
msgid "How are Enums and Flags different?"
10341034
msgstr ""
10351035

1036-
#: ../../howto/enum.rst:1180
1036+
#: ../../howto/enum.rst:1188
10371037
msgid ""
10381038
"Enums have a custom metaclass that affects many aspects of both derived :"
10391039
"class:`Enum` classes and their instances (members)."
10401040
msgstr ""
10411041

1042-
#: ../../howto/enum.rst:1185
1042+
#: ../../howto/enum.rst:1193
10431043
msgid "Enum Classes"
10441044
msgstr ""
10451045

1046-
#: ../../howto/enum.rst:1187
1046+
#: ../../howto/enum.rst:1195
10471047
msgid ""
10481048
"The :class:`EnumType` metaclass is responsible for providing the :meth:"
10491049
"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that "
@@ -1054,11 +1054,11 @@ msgid ""
10541054
"`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)."
10551055
msgstr ""
10561056

1057-
#: ../../howto/enum.rst:1196
1057+
#: ../../howto/enum.rst:1204
10581058
msgid "Flag Classes"
10591059
msgstr ""
10601060

1061-
#: ../../howto/enum.rst:1198
1061+
#: ../../howto/enum.rst:1206
10621062
msgid ""
10631063
"Flags have an expanded view of aliasing: to be canonical, the value of a "
10641064
"flag needs to be a power-of-two value, and not a duplicate name. So, in "
@@ -1067,11 +1067,11 @@ msgid ""
10671067
"considered an alias."
10681068
msgstr ""
10691069

1070-
#: ../../howto/enum.rst:1204
1070+
#: ../../howto/enum.rst:1212
10711071
msgid "Enum Members (aka instances)"
10721072
msgstr ""
10731073

1074-
#: ../../howto/enum.rst:1206
1074+
#: ../../howto/enum.rst:1214
10751075
msgid ""
10761076
"The most interesting thing about enum members is that they are singletons. :"
10771077
"class:`EnumType` creates them all while it is creating the enum class "
@@ -1080,193 +1080,193 @@ msgid ""
10801080
"instances."
10811081
msgstr ""
10821082

1083-
#: ../../howto/enum.rst:1212
1083+
#: ../../howto/enum.rst:1220
10841084
msgid "Flag Members"
10851085
msgstr ""
10861086

1087-
#: ../../howto/enum.rst:1214
1087+
#: ../../howto/enum.rst:1222
10881088
msgid ""
10891089
"Flag members can be iterated over just like the :class:`Flag` class, and "
10901090
"only the canonical members will be returned. For example::"
10911091
msgstr ""
10921092

1093-
#: ../../howto/enum.rst:1220
1093+
#: ../../howto/enum.rst:1228
10941094
msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)"
10951095
msgstr ""
10961096

1097-
#: ../../howto/enum.rst:1222
1097+
#: ../../howto/enum.rst:1230
10981098
msgid ""
10991099
"Inverting a flag member returns the corresponding positive value, rather "
11001100
"than a negative value --- for example::"
11011101
msgstr ""
11021102

1103-
#: ../../howto/enum.rst:1228
1103+
#: ../../howto/enum.rst:1236
11041104
msgid ""
11051105
"Flag members have a length corresponding to the number of power-of-two "
11061106
"values they contain. For example::"
11071107
msgstr ""
11081108

1109-
#: ../../howto/enum.rst:1238
1109+
#: ../../howto/enum.rst:1246
11101110
msgid "Enum Cookbook"
11111111
msgstr ""
11121112

1113-
#: ../../howto/enum.rst:1241
1113+
#: ../../howto/enum.rst:1249
11141114
msgid ""
11151115
"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :"
11161116
"class:`IntFlag` are expected to cover the majority of use-cases, they cannot "
11171117
"cover them all. Here are recipes for some different types of enumerations "
11181118
"that can be used directly, or as examples for creating one's own."
11191119
msgstr ""
11201120

1121-
#: ../../howto/enum.rst:1248
1121+
#: ../../howto/enum.rst:1256
11221122
msgid "Omitting values"
11231123
msgstr ""
11241124

1125-
#: ../../howto/enum.rst:1250
1125+
#: ../../howto/enum.rst:1258
11261126
msgid ""
11271127
"In many use-cases, one doesn't care what the actual value of an enumeration "
11281128
"is. There are several ways to define this type of simple enumeration:"
11291129
msgstr ""
11301130

1131-
#: ../../howto/enum.rst:1253
1131+
#: ../../howto/enum.rst:1261
11321132
msgid "use instances of :class:`auto` for the value"
11331133
msgstr ""
11341134

1135-
#: ../../howto/enum.rst:1254
1135+
#: ../../howto/enum.rst:1262
11361136
msgid "use instances of :class:`object` as the value"
11371137
msgstr ""
11381138

1139-
#: ../../howto/enum.rst:1255
1139+
#: ../../howto/enum.rst:1263
11401140
msgid "use a descriptive string as the value"
11411141
msgstr ""
11421142

1143-
#: ../../howto/enum.rst:1256
1143+
#: ../../howto/enum.rst:1264
11441144
msgid ""
11451145
"use a tuple as the value and a custom :meth:`__new__` to replace the tuple "
11461146
"with an :class:`int` value"
11471147
msgstr ""
11481148

1149-
#: ../../howto/enum.rst:1259
1149+
#: ../../howto/enum.rst:1267
11501150
msgid ""
11511151
"Using any of these methods signifies to the user that these values are not "
11521152
"important, and also enables one to add, remove, or reorder members without "
11531153
"having to renumber the remaining members."
11541154
msgstr ""
11551155

1156-
#: ../../howto/enum.rst:1265
1156+
#: ../../howto/enum.rst:1273
11571157
msgid "Using :class:`auto`"
11581158
msgstr ""
11591159

1160-
#: ../../howto/enum.rst:1267
1160+
#: ../../howto/enum.rst:1275
11611161
msgid "Using :class:`auto` would look like::"
11621162
msgstr ""
11631163

1164-
#: ../../howto/enum.rst:1279
1164+
#: ../../howto/enum.rst:1287
11651165
msgid "Using :class:`object`"
11661166
msgstr ""
11671167

1168-
#: ../../howto/enum.rst:1281
1168+
#: ../../howto/enum.rst:1289
11691169
msgid "Using :class:`object` would look like::"
11701170
msgstr ""
11711171

1172-
#: ../../howto/enum.rst:1291
1172+
#: ../../howto/enum.rst:1299
11731173
msgid ""
11741174
"This is also a good example of why you might want to write your own :meth:"
11751175
"`__repr__`::"
11761176
msgstr ""
11771177

1178-
#: ../../howto/enum.rst:1307
1178+
#: ../../howto/enum.rst:1315
11791179
msgid "Using a descriptive string"
11801180
msgstr ""
11811181

1182-
#: ../../howto/enum.rst:1309
1182+
#: ../../howto/enum.rst:1317
11831183
msgid "Using a string as the value would look like::"
11841184
msgstr ""
11851185

1186-
#: ../../howto/enum.rst:1321
1186+
#: ../../howto/enum.rst:1329
11871187
msgid "Using a custom :meth:`__new__`"
11881188
msgstr ""
11891189

1190-
#: ../../howto/enum.rst:1323
1190+
#: ../../howto/enum.rst:1331
11911191
msgid "Using an auto-numbering :meth:`__new__` would look like::"
11921192
msgstr ""
11931193

1194-
#: ../../howto/enum.rst:1340
1194+
#: ../../howto/enum.rst:1348
11951195
msgid ""
11961196
"To make a more general purpose ``AutoNumber``, add ``*args`` to the "
11971197
"signature::"
11981198
msgstr ""
11991199

1200-
#: ../../howto/enum.rst:1350
1200+
#: ../../howto/enum.rst:1358
12011201
msgid ""
12021202
"Then when you inherit from ``AutoNumber`` you can write your own "
12031203
"``__init__`` to handle any extra arguments::"
12041204
msgstr ""
12051205

1206-
#: ../../howto/enum.rst:1369
1206+
#: ../../howto/enum.rst:1377
12071207
msgid ""
12081208
"The :meth:`__new__` method, if defined, is used during creation of the Enum "
12091209
"members; it is then replaced by Enum's :meth:`__new__` which is used after "
12101210
"class creation for lookup of existing members."
12111211
msgstr ""
12121212

1213-
#: ../../howto/enum.rst:1375
1213+
#: ../../howto/enum.rst:1383
12141214
msgid ""
12151215
"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the "
12161216
"one that is found; instead, use the data type directly -- e.g.::"
12171217
msgstr ""
12181218

1219-
#: ../../howto/enum.rst:1382
1219+
#: ../../howto/enum.rst:1390
12201220
msgid "OrderedEnum"
12211221
msgstr ""
12221222

1223-
#: ../../howto/enum.rst:1384
1223+
#: ../../howto/enum.rst:1392
12241224
msgid ""
12251225
"An ordered enumeration that is not based on :class:`IntEnum` and so "
12261226
"maintains the normal :class:`Enum` invariants (such as not being comparable "
12271227
"to other enumerations)::"
12281228
msgstr ""
12291229

1230-
#: ../../howto/enum.rst:1418
1230+
#: ../../howto/enum.rst:1426
12311231
msgid "DuplicateFreeEnum"
12321232
msgstr ""
12331233

1234-
#: ../../howto/enum.rst:1420
1234+
#: ../../howto/enum.rst:1428
12351235
msgid ""
12361236
"Raises an error if a duplicate member value is found instead of creating an "
12371237
"alias::"
12381238
msgstr ""
12391239

1240-
#: ../../howto/enum.rst:1445
1240+
#: ../../howto/enum.rst:1453
12411241
msgid ""
12421242
"This is a useful example for subclassing Enum to add or change other "
12431243
"behaviors as well as disallowing aliases. If the only desired change is "
12441244
"disallowing aliases, the :func:`unique` decorator can be used instead."
12451245
msgstr ""
12461246

1247-
#: ../../howto/enum.rst:1451
1247+
#: ../../howto/enum.rst:1459
12481248
msgid "Planet"
12491249
msgstr ""
12501250

1251-
#: ../../howto/enum.rst:1453
1251+
#: ../../howto/enum.rst:1461
12521252
msgid ""
12531253
"If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum "
12541254
"member will be passed to those methods::"
12551255
msgstr ""
12561256

1257-
#: ../../howto/enum.rst:1482
1257+
#: ../../howto/enum.rst:1490
12581258
msgid "TimePeriod"
12591259
msgstr ""
12601260

1261-
#: ../../howto/enum.rst:1484
1261+
#: ../../howto/enum.rst:1492
12621262
msgid "An example to show the :attr:`_ignore_` attribute in use::"
12631263
msgstr ""
12641264

1265-
#: ../../howto/enum.rst:1503
1265+
#: ../../howto/enum.rst:1511
12661266
msgid "Subclassing EnumType"
12671267
msgstr ""
12681268

1269-
#: ../../howto/enum.rst:1505
1269+
#: ../../howto/enum.rst:1513
12701270
msgid ""
12711271
"While most enum needs can be met by customizing :class:`Enum` subclasses, "
12721272
"either with class decorators or custom functions, :class:`EnumType` can be "

0 commit comments

Comments
 (0)
0