-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathenum.po
1447 lines (1229 loc) · 58.8 KB
/
enum.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Takanori Suzuki <[email protected]>, 2021
# tomo, 2021
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.10\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-29 12:56+0000\n"
"PO-Revision-Date: 2021-06-28 00:53+0000\n"
"Last-Translator: tomo, 2021\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../howto/enum.rst:3
msgid "Enum HOWTO"
msgstr "列挙型 HOWTO"
#: ../../howto/enum.rst:0
msgid "Author"
msgstr "著者"
#: ../../howto/enum.rst:5
msgid "Ethan Furman <ethan at stoneleaf dot us>"
msgstr ""
#: ../../howto/enum.rst:12
msgid "Basic Enum Tutorial"
msgstr ""
#: ../../howto/enum.rst:14
msgid ""
"An :class:`Enum` is a set of symbolic names bound to unique values. They "
"are similar to global variables, but they offer a more useful :func:"
"`repr()`, grouping, type-safety, and a few other features."
msgstr ""
":class:`Enum` は、ユニークな値に束縛されたシンボル名の集合です。グローバル変"
"数に似ていますが、 :func:`repr()` がより便利だったり、グルーピングの機能、型"
"安全などいくつかの機能があります。"
#: ../../howto/enum.rst:18
msgid ""
"They are most useful when you have a variable that can take one of a limited "
"selection of values. For example, the days of the week::"
msgstr ""
"これらは、限られた選択肢の値の一つを取る変数がある場合に便利です。例えば、曜"
"日情報があります:"
#: ../../howto/enum.rst:31
msgid ""
"As you can see, creating an :class:`Enum` is as simple as writing a class "
"that inherits from :class:`Enum` itself."
msgstr ""
"ご覧の通り、 :class:`Enum` の作成は :class:`Enum` 自体を継承するクラスを作成"
"するのと同じくらい簡単です。"
#: ../../howto/enum.rst:34
msgid "Case of Enum Members"
msgstr "Enumメンバーは大文字/小文字?"
#: ../../howto/enum.rst:36
msgid ""
"Because Enums are used to represent constants we recommend using UPPER_CASE "
"names for members, and will be using that style in our examples."
msgstr ""
"Enumクラス群は定数を表現するために使われるため、メンバーの名前にはUPPER_CASE"
"を使うことを推奨します。本ページのドキュメントのサンプルでもそのスタイルを採"
"用します。"
#: ../../howto/enum.rst:39
msgid ""
"Depending on the nature of the enum a member's value may or may not be "
"important, but either way that value can be used to get the corresponding "
"member::"
msgstr ""
"列挙型の性質によって、メンバの値は重要な場合とそうでない場合がありますが、い"
"ずれの場合でも、その値は対応するメンバを取得するのに使えます::"
#: ../../howto/enum.rst:46
msgid ""
"As you can see, the ``repr()`` of a member shows the enum name and the "
"member name. The ``str()`` on a member shows only its name::"
msgstr ""
#: ../../howto/enum.rst:52
msgid "The *type* of an enumeration member is the enum it belongs to::"
msgstr "列挙型のメンバの型はそのメンバの属する列挙型です::"
#: ../../howto/enum.rst:59
msgid "Enum members have an attribute that contains just their :attr:`name`::"
msgstr "列挙型のメンバはその名前だけを含む属性 :attr:`name` を持っています::"
#: ../../howto/enum.rst:64
msgid "Likewise, they have an attribute for their :attr:`value`::"
msgstr "同じように、値のための属性 :attr:`value` もあります::"
#: ../../howto/enum.rst:70
msgid ""
"Unlike many languages that treat enumerations solely as name/value pairs, "
"Python Enums can have behavior added. For example, :class:`datetime.date` "
"has two methods for returning the weekday: :meth:`weekday` and :meth:"
"`isoweekday`. The difference is that one of them counts from 0-6 and the "
"other from 1-7. Rather than keep track of that ourselves we can add a method "
"to the :class:`Weekday` enum to extract the day from the :class:`date` "
"instance and return the matching enum member::"
msgstr ""
"多くの言語で列挙を名前と値のペアとしてのみ扱うのとは異なり、Pythonの列挙は振"
"る舞いを追加することができます。 例えば、 :class:`datetime.date` には曜日を"
"返すメソッドに :meth:`weekday` と :meth:`isoweekday` の2つがあります。違い"
"は、一方は0から6まで、もう一方は1から7まで数えることです。自分たちでそれらの"
"メソッドの挙動を理解しておく代わりに、:class:`Weekday` 列挙型にメソッドを追加"
"することで、 :class:`date` インスタンス から曜日を抽出し、それにマッチする"
"enumメンバーを返すことができます::"
#: ../../howto/enum.rst:82
msgid "The complete :class:`Weekday` enum now looks like this::"
msgstr "完全な :class:`Weekday` enumはこのようになります::"
#: ../../howto/enum.rst:97
msgid "Now we can find out what today is! Observe::"
msgstr "さて、これで今日が何曜日か調べることができます! 見てみましょう::"
#: ../../howto/enum.rst:103
msgid ""
"Of course, if you're reading this on some other day, you'll see that day "
"instead."
msgstr ""
"もちろん、あなたがこれを読んでいるのが他の曜日ならば、その曜日が代わりに表示"
"されます。"
#: ../../howto/enum.rst:105
msgid ""
"This :class:`Weekday` enum is great if our variable only needs one day, but "
"what if we need several? Maybe we're writing a function to plot chores "
"during a week, and don't want to use a :class:`list` -- we could use a "
"different type of :class:`Enum`::"
msgstr ""
"この :class:`Weekday` 列挙型は、変数が1つの曜日を必要とする場合には優れていま"
"すが、複数必要な場合はどうでしょうか? 1週間の家事を記録する関数を作成してい"
"て、:class:`list` は使いたくない場合、別の型の :class:`Enum` を使用することが"
"できます::"
#: ../../howto/enum.rst:120
msgid ""
"We've changed two things: we're inherited from :class:`Flag`, and the values "
"are all powers of 2."
msgstr ""
"ここでは2つの変更が行われています。:class:`Flag` を継承している点と、値がすべ"
"て2の累乗である点です。"
#: ../../howto/enum.rst:123
msgid ""
"Just like the original :class:`Weekday` enum above, we can have a single "
"selection::"
msgstr ""
"元々の :class:`Weekday` 列挙型と同じように、1つの要素を持つことができます::"
#: ../../howto/enum.rst:129
msgid ""
"But :class:`Flag` also allows us to combine several members into a single "
"variable::"
msgstr ""
"ただし、:class:`Flag` は複数のメンバーをひとつの変数にまとめることもできま"
"す::"
#: ../../howto/enum.rst:136
msgid "You can even iterate over a :class:`Flag` variable::"
msgstr ":class:`Flag` 変数は反復することもできます::"
#: ../../howto/enum.rst:143
msgid "Okay, let's get some chores set up::"
msgstr "さて、いくつかの家事を設定してみましょう::"
#: ../../howto/enum.rst:151
msgid "And a function to display the chores for a given day::"
msgstr "指定された日の家事を表示する関数も作成します::"
#: ../../howto/enum.rst:160
msgid ""
"In cases where the actual values of the members do not matter, you can save "
"yourself some work and use :func:`auto()` for the values::"
msgstr ""
"メンバーの実際の値が重要でない場合は、:func:`auto()` を使用することで手間を省"
"くことができます::"
#: ../../howto/enum.rst:177
msgid "Programmatic access to enumeration members and their attributes"
msgstr "列挙型メンバーおよびそれらの属性へのプログラム的アクセス"
#: ../../howto/enum.rst:179
msgid ""
"Sometimes it's useful to access members in enumerations programmatically (i."
"e. situations where ``Color.RED`` won't do because the exact color is not "
"known at program-writing time). ``Enum`` allows such access::"
msgstr ""
"プログラム的にメンバーに番号でアクセスしたほうが便利な場合があります (すなわ"
"ち、プログラムを書いている時点で正確な色がまだわからなく、``Color.RED`` と書"
"くのが無理な場合など)。 ``Enum`` ではそのようなアクセスも可能です::"
#: ../../howto/enum.rst:188
msgid "If you want to access enum members by *name*, use item access::"
msgstr ""
"列挙型メンバーに *名前* でアクセスしたい場合はアイテムとしてアクセスできま"
"す::"
#: ../../howto/enum.rst:195
msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::"
msgstr "列挙型メンバーの :attr:`name` か :attr:`value` が必要な場合::"
#: ../../howto/enum.rst:205
msgid "Duplicating enum members and values"
msgstr "列挙型メンバーと値の重複"
#: ../../howto/enum.rst:207
msgid "Having two enum members with the same name is invalid::"
msgstr "同じ名前の列挙型メンバーを複数持つことはできません::"
#: ../../howto/enum.rst:217
msgid ""
"However, an enum member can have other names associated with it. Given two "
"entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` "
"is an alias for the member ``A``. By-value lookup of the value of ``A`` "
"will return the member ``A``. By-name lookup of ``A`` will return the "
"member ``A``. By-name lookup of ``B`` will also return the member ``A``::"
msgstr ""
"しかし、列挙型メンバー は、別の名前を持つことができます。 同じ値を持つ "
"``A`` と``B`` が与えられた場合(そして ``A`` が先に定義されている場合)、 "
"``B`` はメンバー ``A`` に対するエイリアスとなります。 ``A`` の値での検索で"
"は、メンバー ``A`` が返されます。 ``A`` の名前での検索ではメンバー ``A`` を"
"返します。``B`` の名前での検索も、メンバー ``A`` を返します::"
#: ../../howto/enum.rst:238
msgid ""
"Attempting to create a member with the same name as an already defined "
"attribute (another member, a method, etc.) or attempting to create an "
"attribute with the same name as a member is not allowed."
msgstr ""
"すでに定義されている属性と同じ名前のメンバー (一方がメンバーでもう一方がメ"
"ソッド、など) の作成、あるいはメンバーと同じ名前の属性の作成はできません。"
#: ../../howto/enum.rst:244
msgid "Ensuring unique enumeration values"
msgstr "番号付けの値が一意であることの確認"
#: ../../howto/enum.rst:246
msgid ""
"By default, enumerations allow multiple names as aliases for the same value. "
"When this behavior isn't desired, you can use the :func:`unique` decorator::"
msgstr ""
"デフォルトでは、列挙型は同じ値のエイリアスとして複数の名前を許容します。この"
"振る舞いを望まない場合は、 :func:`unique` デコレータを使用できます::"
#: ../../howto/enum.rst:263
msgid "Using automatic values"
msgstr "値の自動設定を使う"
#: ../../howto/enum.rst:265
msgid "If the exact value is unimportant you can use :class:`auto`::"
msgstr "正確な値が重要でない場合、 :class:`auto` が使えます::"
#: ../../howto/enum.rst:276
msgid ""
"The values are chosen by :func:`_generate_next_value_`, which can be "
"overridden::"
msgstr ""
"その値は :func:`_generate_next_value_` によって選ばれ、この関数はオーバーライ"
"ドできます::"
#: ../../howto/enum.rst:294
msgid ""
"The :meth:`_generate_next_value_` method must be defined before any members."
msgstr ""
":meth:`_generate_next_value_` メソッドは他のメンバーよりも前に定義される必要"
"があります。"
#: ../../howto/enum.rst:297
msgid "Iteration"
msgstr "イテレーション"
#: ../../howto/enum.rst:299
msgid "Iterating over the members of an enum does not provide the aliases::"
msgstr "列挙型のメンバーのイテレートは別名をサポートしていません::"
#: ../../howto/enum.rst:304
msgid ""
"The special attribute ``__members__`` is a read-only ordered mapping of "
"names to members. It includes all names defined in the enumeration, "
"including the aliases::"
msgstr ""
"特殊属性 ``__members__`` は読み出し専用で、順序を保持した、対応する名前と列挙"
"型メンバーのマッピングです。これには別名も含め、列挙されたすべての名前が入っ"
"ています。"
#: ../../howto/enum.rst:316
msgid ""
"The ``__members__`` attribute can be used for detailed programmatic access "
"to the enumeration members. For example, finding all the aliases::"
msgstr ""
"属性 ``__members__`` は列挙型メンバーへの詳細なアクセスに使用できます。以下は"
"すべての別名を探す例です::"
#: ../../howto/enum.rst:324
msgid "Comparisons"
msgstr "比較"
#: ../../howto/enum.rst:326
msgid "Enumeration members are compared by identity::"
msgstr "列挙型メンバーは同一性を比較できます::"
#: ../../howto/enum.rst:335
msgid ""
"Ordered comparisons between enumeration values are *not* supported. Enum "
"members are not integers (but see `IntEnum`_ below)::"
msgstr ""
"列挙型の値の順序の比較はサポートされて *いません*。Enum メンバーは整数ではあ"
"りません (`IntEnum`_ を参照してください)::"
#: ../../howto/enum.rst:343
msgid "Equality comparisons are defined though::"
msgstr "ただし等価の比較は定義されています::"
#: ../../howto/enum.rst:352
msgid ""
"Comparisons against non-enumeration values will always compare not equal "
"(again, :class:`IntEnum` was explicitly designed to behave differently, see "
"below)::"
msgstr ""
"非列挙型の値との比較は常に不等となります (繰り返しになりますが、:class:"
"`IntEnum` はこれと異なる挙動になるよう設計されています)::"
#: ../../howto/enum.rst:361
msgid "Allowed members and attributes of enumerations"
msgstr "列挙型で許されるメンバーと属性"
#: ../../howto/enum.rst:363
msgid ""
"Most of the examples above use integers for enumeration values. Using "
"integers is short and handy (and provided by default by the `Functional "
"API`_), but not strictly enforced. In the vast majority of use-cases, one "
"doesn't care what the actual value of an enumeration is. But if the value "
"*is* important, enumerations can have arbitrary values."
msgstr ""
"これまでのほとんどの例では、列挙型の値に整数を使用しています。 整数を使うの"
"は短くて便利(そして、 `関数 API`_ ではデフォルトで設定される)ですが、これは"
"強制されているわけではありません。大半の使用例では、列挙値の実際の値が何であ"
"るかは意識しません。しかし、値が重要な場合、列挙型は任意の値を持つことができ"
"ます。"
#: ../../howto/enum.rst:369
msgid ""
"Enumerations are Python classes, and can have methods and special methods as "
"usual. If we have this enumeration::"
msgstr ""
"列挙型は Python のクラスであり、通常どおりメソッドや特殊メソッドを持つことが"
"できます::"
#: ../../howto/enum.rst:389
msgid "Then::"
msgstr "上記の結果が以下のようになります::"
#: ../../howto/enum.rst:398
msgid ""
"The rules for what is allowed are as follows: names that start and end with "
"a single underscore are reserved by enum and cannot be used; all other "
"attributes defined within an enumeration will become members of this "
"enumeration, with the exception of special methods (:meth:`__str__`, :meth:"
"`__add__`, etc.), descriptors (methods are also descriptors), and variable "
"names listed in :attr:`_ignore_`."
msgstr ""
"何が許されているかのルールは次のとおりです。先頭と末尾が 1 個のアンダースコア"
"の名前は列挙型により予約されているため、使用できません。列挙型内で定義された"
"その他すべての名前は、その列挙型のメンバーとして使用できます。特殊メソッド (:"
"meth:`__str__`, :meth:`__add__` など) と、メソッドを含むデスクリプタ(記述"
"子)、 :attr:`_ignore_` に記載されている変数名は例外です。"
#: ../../howto/enum.rst:405
msgid ""
"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` "
"then any value(s) given to the enum member will be passed into those "
"methods. See `Planet`_ for an example."
msgstr ""
"注意: 列挙型で :meth:`__new__` および/または :meth:`__init__` を定義した場"
"合、列挙型メンバーに与えられた値はすべてこれらのメソッドに渡されます。例 "
"`Planet`_ を参照してください。"
#: ../../howto/enum.rst:411
msgid "Restricted Enum subclassing"
msgstr "Enumのサブクラス化の制限"
#: ../../howto/enum.rst:413
msgid ""
"A new :class:`Enum` class must have one base enum class, up to one concrete "
"data type, and as many :class:`object`-based mixin classes as needed. The "
"order of these base classes is::"
msgstr ""
"新しい :class:`Enum` クラスは、ベースの enum クラスを1つ、具象データ型を1つ、"
"複数の :class:`object` ベースのミックスインクラスが許容されます。これらのベー"
"スクラスの順序は次の通りです::"
#: ../../howto/enum.rst:420
msgid ""
"Also, subclassing an enumeration is allowed only if the enumeration does not "
"define any members. So this is forbidden::"
msgstr ""
"列挙型のサブクラスの作成はその列挙型にメンバーが一つも定義されていない場合の"
"み行なえます。従って以下は許されません::"
#: ../../howto/enum.rst:430
msgid "But this is allowed::"
msgstr "以下のような場合は許されます::"
#: ../../howto/enum.rst:441
msgid ""
"Allowing subclassing of enums that define members would lead to a violation "
"of some important invariants of types and instances. On the other hand, it "
"makes sense to allow sharing some common behavior between a group of "
"enumerations. (See `OrderedEnum`_ for an example.)"
msgstr ""
"メンバーが定義された列挙型のサブクラス化を許可すると、いくつかのデータ型およ"
"びインスタンスの重要な不変条件の違反を引き起こします。とはいえ、それが許可さ"
"れると、列挙型のグループ間での共通の挙動を共有するという利点もあります。 "
"(`OrderedEnum`_ の例を参照してください。)"
#: ../../howto/enum.rst:448
msgid "Pickling"
msgstr "Pickle 化"
#: ../../howto/enum.rst:450
msgid "Enumerations can be pickled and unpickled::"
msgstr "列挙型は pickle 化と unpickle 化が行えます::"
#: ../../howto/enum.rst:457
msgid ""
"The usual restrictions for pickling apply: picklable enums must be defined "
"in the top level of a module, since unpickling requires them to be "
"importable from that module."
msgstr ""
"通常の pickle 化の制限事項が適用されます: pickle 可能な列挙型はモジュールの"
"トップレベルで定義されていなくてはならず、unpickle 化はモジュールからインポー"
"ト可能でなければなりません。"
#: ../../howto/enum.rst:463
msgid ""
"With pickle protocol version 4 it is possible to easily pickle enums nested "
"in other classes."
msgstr ""
"pickle プロトコルバージョン 4 では他のクラスで入れ子になった列挙型の pickle "
"化も容易です。"
#: ../../howto/enum.rst:466
msgid ""
"It is possible to modify how enum members are pickled/unpickled by defining :"
"meth:`__reduce_ex__` in the enumeration class."
msgstr ""
"enum のメンバーをどう pickle 化/unpickle 化するかは、列挙型クラス内の :meth:"
"`__reduce_ex__` で定義することで変更できます。"
#: ../../howto/enum.rst:471
msgid "Functional API"
msgstr "関数 API"
#: ../../howto/enum.rst:473
msgid ""
"The :class:`Enum` class is callable, providing the following functional API::"
msgstr ""
":class:`Enum` クラスは呼び出し可能で、以下の関数 API を提供しています::"
#: ../../howto/enum.rst:485
msgid ""
"The semantics of this API resemble :class:`~collections.namedtuple`. The "
"first argument of the call to :class:`Enum` is the name of the enumeration."
msgstr ""
"この API の動作は :class:`~collections.namedtuple` と似ています。:class:"
"`Enum` 呼び出しの第 1 引数は列挙型の名前です。"
#: ../../howto/enum.rst:488
msgid ""
"The second argument is the *source* of enumeration member names. It can be "
"a whitespace-separated string of names, a sequence of names, a sequence of 2-"
"tuples with key/value pairs, or a mapping (e.g. dictionary) of names to "
"values. The last two options enable assigning arbitrary values to "
"enumerations; the others auto-assign increasing integers starting with 1 "
"(use the ``start`` parameter to specify a different starting value). A new "
"class derived from :class:`Enum` is returned. In other words, the above "
"assignment to :class:`Animal` is equivalent to::"
msgstr ""
"第 2 引数は列挙型メンバー名の *ソース* です。空白で区切った名前の文字列、名前"
"のシーケンス、キー/値のペアの 2 要素タプルのシーケンス、あるいは名前と値の"
"マッピング (例: 辞書) を指定できます。最後の 2 個のオプションでは、列挙型へ任"
"意の値を割り当てることができます。前の 2 つのオプションでは、1 から始まり増加"
"していく整数を自動的に割り当てます (別の開始値を指定するには、``start`` 引数"
"を使用します)。:class:`Enum` から派生した新しいクラスが返されます。言い換えれ"
"ば、上記の :class:`Animal` への割り当ては以下と等価です::"
#: ../../howto/enum.rst:504
msgid ""
"The reason for defaulting to ``1`` as the starting number and not ``0`` is "
"that ``0`` is ``False`` in a boolean sense, but by default enum members all "
"evaluate to ``True``."
msgstr ""
"``0`` ではなく``1`` をデフォルトの開始番号とする理由は、``0`` が真偽値として"
"は ``False`` であり、デフォルトの列挙メンバーはすべて ``True`` 評価されるよう"
"にするためである。"
#: ../../howto/enum.rst:508
msgid ""
"Pickling enums created with the functional API can be tricky as frame stack "
"implementation details are used to try and figure out which module the "
"enumeration is being created in (e.g. it will fail if you use a utility "
"function in separate module, and also may not work on IronPython or Jython). "
"The solution is to specify the module name explicitly as follows::"
msgstr ""
"機能 API による Enum の pickle 化は、その列挙型がどのモジュールで作成されたか"
"を見つけ出すためにフレームスタックの実装の詳細が使われるので、トリッキーにな"
"ることがあります (例えば別のモジュールのユーティリティ関数を使うと失敗します"
"し、IronPython や Jython ではうまくいきません)。解決策は、以下のようにモ"
"ジュール名を明示的に指定することです::"
#: ../../howto/enum.rst:518
msgid ""
"If ``module`` is not supplied, and Enum cannot determine what it is, the new "
"Enum members will not be unpicklable; to keep errors closer to the source, "
"pickling will be disabled."
msgstr ""
"``module`` が与えられない場合、Enum はそれがなにか決定できないため、新しい "
"Enum メンバーは unpickle 化できなくなります; エラーをソースの近いところで発生"
"させるため、pickle 化は無効になります。"
#: ../../howto/enum.rst:522
msgid ""
"The new pickle protocol 4 also, in some circumstances, relies on :attr:"
"`~definition.__qualname__` being set to the location where pickle will be "
"able to find the class. For example, if the class was made available in "
"class SomeData in the global scope::"
msgstr ""
"新しい pickle プロトコルバージョン 4 では、一部の状況において、pickle がクラ"
"スを発見するための場所の設定に :attr:`~definition.__qualname__` を参照しま"
"す。例えば、そのクラスがグローバルスコープ内のクラス SomeData 内で利用可能と"
"するには以下のように指定します::"
#: ../../howto/enum.rst:529
msgid "The complete signature is::"
msgstr "完全な構文は以下のようになります::"
#: ../../howto/enum.rst:0
msgid "value"
msgstr "value"
#: ../../howto/enum.rst:541
msgid "What the new enum class will record as its name."
msgstr "新しい enum クラスに記録されるそれ自身の名前です。"
#: ../../howto/enum.rst:0
msgid "names"
msgstr "名前"
#: ../../howto/enum.rst:543
msgid ""
"The enum members. This can be a whitespace or comma separated string "
"(values will start at 1 unless otherwise specified)::"
msgstr ""
#: ../../howto/enum.rst:548
msgid "or an iterator of names::"
msgstr "または名前のイテレータで指定もできます::"
#: ../../howto/enum.rst:552
msgid "or an iterator of (name, value) pairs::"
msgstr "または (名前, 値) のペアのイテレータでも指定できます::"
#: ../../howto/enum.rst:556
msgid "or a mapping::"
msgstr "またはマッピングでも指定できます::"
#: ../../howto/enum.rst:0
msgid "module"
msgstr "module"
#: ../../howto/enum.rst:560
msgid "name of module where new enum class can be found."
msgstr "新しい enum クラスが属するモジュールの名前です。"
#: ../../howto/enum.rst:0
msgid "qualname"
msgstr "qualname"
#: ../../howto/enum.rst:562
msgid "where in module new enum class can be found."
msgstr "新しい enum クラスが属するモジュールの場所です。"
#: ../../howto/enum.rst:0
msgid "type"
msgstr "type"
#: ../../howto/enum.rst:564
msgid "type to mix in to new enum class."
msgstr "新しい enum クラスに複合されるデータ型です。"
#: ../../howto/enum.rst:0
msgid "start"
msgstr "start"
#: ../../howto/enum.rst:566
msgid "number to start counting at if only names are passed in."
msgstr "names のみが渡されたときにカウントを開始する数です。"
#: ../../howto/enum.rst:568
msgid "The *start* parameter was added."
msgstr "*start* 引数が追加されました。"
#: ../../howto/enum.rst:573
msgid "Derived Enumerations"
msgstr "派生列挙型"
#: ../../howto/enum.rst:576
msgid "IntEnum"
msgstr "IntEnum"
#: ../../howto/enum.rst:578
msgid ""
"The first variation of :class:`Enum` that is provided is also a subclass of :"
"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by "
"extension, integer enumerations of different types can also be compared to "
"each other::"
msgstr ""
"提供されている 1 つ目の :class:`Enum` の派生型であり、 :class:`int` のサブク"
"ラスでもあります。\n"
":class:`IntEnum` のメンバーは整数と比較できます;\n"
"さらに言うと、異なる整数列挙型どうしでも比較できます::"
#: ../../howto/enum.rst:599
msgid ""
"However, they still can't be compared to standard :class:`Enum` "
"enumerations::"
msgstr "ただし、これらも標準の :class:`Enum` 列挙型とは比較できません::"
#: ../../howto/enum.rst:612
msgid ""
":class:`IntEnum` values behave like integers in other ways you'd expect::"
msgstr ":class:`IntEnum` の値は他の用途では整数のように振る舞います::"
#: ../../howto/enum.rst:623
msgid "StrEnum"
msgstr "StrEnum"
#: ../../howto/enum.rst:625
msgid ""
"The second variation of :class:`Enum` that is provided is also a subclass "
"of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; "
"by extension, string enumerations of different types can also be compared to "
"each other. :class:`StrEnum` exists to help avoid the problem of getting an "
"incorrect member::"
msgstr ""
#: ../../howto/enum.rst:636
msgid ""
"Before :class:`StrEnum`, ``Directions.NORTH`` would have been the :class:"
"`tuple` ``('north',)``."
msgstr ""
#: ../../howto/enum.rst:643
msgid "IntFlag"
msgstr "IntFlag"
#: ../../howto/enum.rst:645
msgid ""
"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also "
"based on :class:`int`. The difference being :class:`IntFlag` members can be "
"combined using the bitwise operators (&, \\|, ^, ~) and the result is still "
"an :class:`IntFlag` member, if possible. However, as the name implies, :"
"class:`IntFlag` members also subclass :class:`int` and can be used wherever "
"an :class:`int` is used."
msgstr ""
#: ../../howto/enum.rst:654
msgid ""
"Any operation on an :class:`IntFlag` member besides the bit-wise operations "
"will lose the :class:`IntFlag` membership."
msgstr ""
":class:`IntFlag` メンバーに対してビット演算以外のどんな演算をしても、その結果"
"は :class:`IntFlag` メンバーではなくなります。"
#: ../../howto/enum.rst:657
msgid ""
"Bit-wise operations that result in invalid :class:`IntFlag` values will lose "
"the :class:`IntFlag` membership. See :class:`FlagBoundary` for details."
msgstr ""
"ビット単位演算の結果が :class:`IntFlag` として不正な値な値の場合、値は :"
"class:`IntFlag` メンバーではなくなります。 詳しくは :class:`FlagBoundary` を"
"参照してください。"
#: ../../howto/enum.rst:664
msgid "Sample :class:`IntFlag` class::"
msgstr ":class:`IntFlag` クラスの例::"
#: ../../howto/enum.rst:680
msgid "It is also possible to name the combinations::"
msgstr "組み合わせにも名前を付けられます::"
#: ../../howto/enum.rst:696
msgid ""
"Named combinations are considered aliases. Aliases do not show up during "
"iteration, but can be returned from by-value lookups."
msgstr ""
"組み合わせに名前をつけたものはエイリアスとみなされます。エイリアスはイテレー"
"ション中には表示されませんが、値による検索では返却されます。"
#: ../../howto/enum.rst:701
msgid ""
"Another important difference between :class:`IntFlag` and :class:`Enum` is "
"that if no flags are set (the value is 0), its boolean evaluation is :data:"
"`False`::"
msgstr ""
":class:`IntFlag` と :class:`Enum` のもう 1 つの重要な違いは、フラグが設定され"
"ていない (値が0である) 場合、その真偽値としての評価は :data:`False` になるこ"
"とです::"
#: ../../howto/enum.rst:709
msgid ""
"Because :class:`IntFlag` members are also subclasses of :class:`int` they "
"can be combined with them (but may lose :class:`IntFlag` membership::"
msgstr ""
":class:`IntFlag` メンバーも :class:`int` のサブクラスであるため、それらと組み"
"合わせることができます(ただし、 :class:`IntFlag` 型ではなくなる可能性があり"
"ます)::"
#: ../../howto/enum.rst:720
msgid ""
"The negation operator, ``~``, always returns an :class:`IntFlag` member with "
"a positive value::"
msgstr ""
"否定の演算子 ``~`` は、常に正の値を持つ :class:`IntFlag` メンバー を返す::"
#: ../../howto/enum.rst:726
msgid ":class:`IntFlag` members can also be iterated over::"
msgstr ":class:`IntFlag` メンバーは反復処理することもできます::"
#: ../../howto/enum.rst:735
msgid "Flag"
msgstr "Flag"
#: ../../howto/enum.rst:737
msgid ""
"The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` "
"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :"
"class:`IntFlag`, they cannot be combined with, nor compared against, any "
"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to "
"specify the values directly it is recommended to use :class:`auto` as the "
"value and let :class:`Flag` select an appropriate value."
msgstr ""
"最後の派生型は :class:`Flag` です。\n"
":class:`IntFlag` と同様に、 :class:`Flag` メンバーもビット演算子 (&, \\|, ^, "
"~) を使って組み合わせられます。\n"
"しかし :class:`IntFlag` とは違い、他のどの :class:`Flag` 列挙型とも :class:"
"`int` とも組み合わせたり、比較したりできません。\n"
"値を直接指定することも可能ですが、値として :class:`auto` を使い、 :class:"
"`Flag` に適切な値を選ばせることが推奨されています。"
#: ../../howto/enum.rst:746
msgid ""
"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in "
"no flags being set, the boolean evaluation is :data:`False`::"
msgstr ""
":class:`IntFlag` と同様に、 :class:`Flag` メンバーの組み合わせがどのフラグも"
"設定されていない状態になった場合、その真偽値としての評価は :data:`False` とな"
"ります::"
#: ../../howto/enum.rst:760
msgid ""
"Individual flags should have values that are powers of two (1, 2, 4, "
"8, ...), while combinations of flags won't::"
msgstr ""
"個別のフラグは 2 のべき乗 (1, 2, 4, 8, ...) の値を持つべきですが、フラグの組"
"み合わせはそうはなりません::"
#: ../../howto/enum.rst:772
msgid ""
"Giving a name to the \"no flags set\" condition does not change its boolean "
"value::"
msgstr ""
"\"フラグが設定されていない\" 状態に名前を付けても、その真偽値は変わりません::"
#: ../../howto/enum.rst:786
msgid ":class:`Flag` members can also be iterated over::"
msgstr ":class:`Flag` メンバーは反復処理することもできます::"
#: ../../howto/enum.rst:796
msgid ""
"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly "
"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic "
"promises of an enumeration (by being comparable to integers, and thus by "
"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:"
"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` "
"will not do; for example, when integer constants are replaced with "
"enumerations, or for interoperability with other systems."
msgstr ""
"ほとんどの新しいコードでは、 :class:`Enum` と :class:`Flag` が強く推奨されま"
"す。\n"
"というのは、 :class:`IntEnum` と :class:`IntFlag` は (整数と比較でき、従って"
"推移的に他の無関係な列挙型と比較できてしまうことにより) 列挙型の意味論的な約"
"束に反するからです。\n"
":class:`IntEnum` と :class:`IntFlag` は、 :class:`Enum` や :class:`Flag` では"
"上手くいかない場合のみに使うべきです;\n"
"例えば、整数定数を列挙型で置き換えるときや、他のシステムとの相互運用性を持た"
"せたいときです。"
#: ../../howto/enum.rst:806
msgid "Others"
msgstr "その他"
#: ../../howto/enum.rst:808
msgid ""
"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very "
"simple to implement independently::"
msgstr ""
":class:`IntEnum` は :mod:`enum` モジュールの一部ですが、単独での実装もとても"
"簡単に行なえます::"
#: ../../howto/enum.rst:814
msgid ""
"This demonstrates how similar derived enumerations can be defined; for "
"example a :class:`StrEnum` that mixes in :class:`str` instead of :class:"
"`int`."
msgstr ""
"ここでは似たような列挙型の派生を定義する方法を紹介します; 例えば、:class:"
"`StrEnum` は :class:`int` ではなく :class:`str` で複合させたものです。"
#: ../../howto/enum.rst:817
msgid "Some rules:"
msgstr "いくつかのルール:"
#: ../../howto/enum.rst:819
msgid ""
"When subclassing :class:`Enum`, mix-in types must appear before :class:"
"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example "
"above."
msgstr ""
":class:`Enum` のサブクラスを作成するとき、複合させるデータ型は、基底クラスの"
"並びで :class:`Enum` 自身より先に記述しなければなりません (上記 :class:"
"`IntEnum` の例を参照)。"
#: ../../howto/enum.rst:822
msgid ""
"While :class:`Enum` can have members of any type, once you mix in an "
"additional type, all the members must have values of that type, e.g. :class:"
"`int` above. This restriction does not apply to mix-ins which only add "
"methods and don't specify another type."
msgstr ""
":class:`Enum` のメンバーはどんなデータ型でも構いませんが、追加のデータ型 (例"
"えば、上の例の :class:`int`) と複合させてしまうと、すべてのメンバーの値はその"
"データ型でなければならなくなります。この制限は、メソッドの追加するだけの、他"
"のデータ型を指定しない複合には適用されません。"
#: ../../howto/enum.rst:826
msgid ""
"When another data type is mixed in, the :attr:`value` attribute is *not the "
"same* as the enum member itself, although it is equivalent and will compare "
"equal."
msgstr ""
"他のデータ型と複合された場合、 :attr:`value` 属性は、たとえ等価であり等価であ"
"ると比較が行えても、列挙型メンバー自身としては *同じではありません* 。"
#: ../../howto/enum.rst:829
msgid ""
"%-style formatting: `%s` and `%r` call the :class:`Enum` class's :meth:"
"`__str__` and :meth:`__repr__` respectively; other codes (such as `%i` or "
"`%h` for IntEnum) treat the enum member as its mixed-in type."
msgstr ""
"%-方式の書式: `%s` および `%r` はそれぞれ :class:`Enum` クラスの :meth:"
"`__str__` および :meth:`__repr__` を呼び出します;\n"
"その他のコード (IntEnum の `%i` や `%h` など) は列挙型のメンバーを複合された"
"データ型として扱います。"
#: ../../howto/enum.rst:832
msgid ""
":ref:`Formatted string literals <f-strings>`, :meth:`str.format`, and :func:"
"`format` will use the mixed-in type's :meth:`__format__` unless :meth:"
"`__str__` or :meth:`__format__` is overridden in the subclass, in which case "
"the overridden methods or :class:`Enum` methods will be used. Use the !s "
"and !r format codes to force usage of the :class:`Enum` class's :meth:"
"`__str__` and :meth:`__repr__` methods."
msgstr ""
#: ../../howto/enum.rst:840
msgid "When to use :meth:`__new__` vs. :meth:`__init__`"
msgstr ":meth:`__new__` と :meth:`__init__` のどちらを使うべきか"
#: ../../howto/enum.rst:842
msgid ""
":meth:`__new__` must be used whenever you want to customize the actual value "
"of the :class:`Enum` member. Any other modifications may go in either :meth:"
"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred."
msgstr ""
":meth:`__new__` は :class:`Enum` メンバーの実際の値をカスタマイズしたいときに"
"利用します。他の変更を加える場合、 :meth:`__new__` と :meth:`__init__` のどち"
"らを利用するかは、:meth:`__init__` の方が望ましいでしょう。"
#: ../../howto/enum.rst:846
msgid ""
"For example, if you want to pass several items to the constructor, but only "
"want one of them to be the value::"
msgstr ""
"例えば、複数の値をコンストラクタに渡すが、その中の1つだけを値として使いたい場"
"合は次のようにします:"
#: ../../howto/enum.rst:873
msgid "Finer Points"
msgstr "細かい点"
#: ../../howto/enum.rst:876
msgid "Supported ``__dunder__`` names"
msgstr "``__dunder__`` 名のサポート"
#: ../../howto/enum.rst:878
msgid ""
":attr:`__members__` is a read-only ordered mapping of ``member_name``:"
"``member`` items. It is only available on the class."
msgstr ""
":attr:`__members__` は読み込み専用の、 ``member_name``:``member`` を要素とす"
"る順序付きマッピングです。これはクラスでのみ利用可能です。"
#: ../../howto/enum.rst:881
msgid ""
":meth:`__new__`, if specified, must create and return the enum members; it "
"is also a very good idea to set the member's :attr:`_value_` appropriately. "
"Once all the members are created it is no longer used."
msgstr ""
":meth:`__new__` が、もし指定されていた場合、列挙型のメンバーを作成し、返しま"
"す;\n"
"そのメンバー の :attr:`_value_` を適切に設定するのも非常によい考えです。\n"
"いったん全てのメンバーが作成されると、それ以降 :meth:`__new__` は使われませ"
"ん。"
#: ../../howto/enum.rst:887
msgid "Supported ``_sunder_`` names"
msgstr "``_sunder_`` 名のサポート"
#: ../../howto/enum.rst:889
msgid "``_name_`` -- name of the member"
msgstr "``_name_`` -- メンバー名"
#: ../../howto/enum.rst:890
msgid ""
"``_value_`` -- value of the member; can be set / modified in ``__new__``"
msgstr ""
"``_value_`` -- メンバーの値; ``__new__`` で設定したり、変更したりできます"
#: ../../howto/enum.rst:892
msgid ""
"``_missing_`` -- a lookup function used when a value is not found; may be "
"overridden"
msgstr ""
"``_missing_`` -- 値が見付からなかったときに使われる検索関数; オーバーライドさ"
"れていることがあります"
#: ../../howto/enum.rst:894
msgid ""
"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:"
"`str`, that will not be transformed into members, and will be removed from "
"the final class"
msgstr ""
"``_ignore_`` -- 名前のリストで、 :class:`list` もしくは :class:`str` です。こ"
"の名前の要素はメンバーへの変換が行われず、最終的なクラスから削除されます。"
#: ../../howto/enum.rst:897
msgid ""
"``_order_`` -- used in Python 2/3 code to ensure member order is consistent "
"(class attribute, removed during class creation)"
msgstr ""
"``_order_`` -- Python 2/3のコードでメンバーの順序を固定化するのに利用されます"
"(クラス属性で、クラス作成時に削除されます)"
#: ../../howto/enum.rst:899
msgid ""
"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:"
"`auto` to get an appropriate value for an enum member; may be overridden"
msgstr ""
"``_generate_next_value_`` -- `Functional API`_ から利用され、 :class:`auto` "
"が列挙型のメンバーの適切な値を取得するのに使われます。オーバーライドされま"
"す。"
#: ../../howto/enum.rst:905
msgid ""
"For standard :class:`Enum` classes the next value chosen is the last value "
"seen incremented by one."
msgstr ""
"標準の :class:`Enum` クラスの場合、次の値として選択されるのは、最後に定義され"
"た値に1を加えたものです。"