-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathenum.po
More file actions
2194 lines (1885 loc) · 105 KB
/
Copy pathenum.po
File metadata and controls
2194 lines (1885 loc) · 105 KB
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 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Alireza Shabani (Revisto) <theRevisto@gmail.com>, 2025
# Danial Behzadi <dani.behzi@ubuntu.com>, 2025
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
# Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-16 12:56+0000\n"
"PO-Revision-Date: 2021-06-28 00:53+0000\n"
"Last-Translator: Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026\n"
"Language-Team: Persian (https://github.com/python/python-docs-fa/fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "Enum HOWTO"
msgstr "راهنمای عملی Enum"
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` مفیدتری، گروهبندی، ایمنی نوع و چند قابلیت دیگر ارائه میدهند."
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 "آنها زمانی بیشترین کاربرد را دارند که متغیری دارید که میتواند یکی از مقادیر یک مجموعه محدود را بگیرد. برای مثال، روزهای هفته::"
msgid ""
">>> from enum import Enum\n"
">>> class Weekday(Enum):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 3\n"
"... THURSDAY = 4\n"
"... FRIDAY = 5\n"
"... SATURDAY = 6\n"
"... SUNDAY = 7"
msgstr ""
">>> from enum import Enum\n"
">>> class Weekday(Enum):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 3\n"
"... THURSDAY = 4\n"
"... FRIDAY = 5\n"
"... SATURDAY = 6\n"
"... SUNDAY = 7"
msgid "Or perhaps the RGB primary colors::"
msgstr "یا شاید رنگهای اصلی RGB::"
msgid ""
">>> from enum import Enum\n"
">>> class Color(Enum):\n"
"... RED = 1\n"
"... GREEN = 2\n"
"... BLUE = 3"
msgstr ""
">>> from enum import Enum\n"
">>> class Color(Enum):\n"
"... RED = 1\n"
"... GREEN = 2\n"
"... BLUE = 3"
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` به ارث میبرد."
msgid "Case of Enum Members"
msgstr "بزرگی و کوچکی حروف اعضای Enum"
msgid "Because Enums are used to represent constants, and to help avoid issues with name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples."
msgstr "از آنجا که Enumها برای نمایش ثابتها استفاده میشوند، و برای کمک به جلوگیری از مشکلات ناشی از تداخل نامها میان متدها/ویژگیهای کلاسهای mixin و نامهای enum، اکیداً توصیه میکنیم برای اعضا از نامهای UPPER_CASE استفاده کنید، و در مثالهای خود نیز از همین سبک استفاده خواهیم کرد."
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 "بسته به ماهیت enum، مقدار یک عضو ممکن است مهم باشد یا نباشد، اما در هر صورت میتوان از آن مقدار برای دریافت عضو متناظر استفاده کرد::"
msgid ""
">>> Weekday(3)\n"
"<Weekday.WEDNESDAY: 3>"
msgstr ""
">>> Weekday(3)\n"
"<Weekday.WEDNESDAY: 3>"
msgid "As you can see, the ``repr()`` of a member shows the enum name, the member name, and the value. The ``str()`` of a member shows only the enum name and member name::"
msgstr "همانطور که میبینید، ``repr()`` یک عضو، نام enum، نام عضو و مقدار را نشان میدهد. ``str()`` یک عضو فقط نام enum و نام عضو را نشان میدهد::"
msgid ""
">>> print(Weekday.THURSDAY)\n"
"Weekday.THURSDAY"
msgstr ""
">>> print(Weekday.THURSDAY)\n"
"Weekday.THURSDAY"
msgid "The *type* of an enumeration member is the enum it belongs to::"
msgstr "*نوع* یک عضو شمارش، همان enum است که به آن تعلق دارد::"
msgid ""
">>> type(Weekday.MONDAY)\n"
"<enum 'Weekday'>\n"
">>> isinstance(Weekday.FRIDAY, Weekday)\n"
"True"
msgstr ""
">>> type(Weekday.MONDAY)\n"
"<enum 'Weekday'>\n"
">>> isinstance(Weekday.FRIDAY, Weekday)\n"
"True"
msgid "Enum members have an attribute that contains just their :attr:`!name`::"
msgstr "اعضای Enum دارای ویژگیای هستند که فقط شامل :attr:`!name` آنها میشود::"
msgid ""
">>> print(Weekday.TUESDAY.name)\n"
"TUESDAY"
msgstr ""
">>> print(Weekday.TUESDAY.name)\n"
"TUESDAY"
msgid "Likewise, they have an attribute for their :attr:`!value`::"
msgstr "به همین ترتیب، آنها یک ویژگی برای :attr:`!value` خود دارند::"
msgid ""
">>> Weekday.WEDNESDAY.value\n"
"3"
msgstr ""
">>> Weekday.WEDNESDAY.value\n"
"3"
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:`~datetime.date.weekday` and :meth:`~datetime.date.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:`~datetime.date` instance and return the matching enum member::"
msgstr "برخلاف بسیاری از زبانها که شمارشها را صرفاً بهعنوان جفتهای نام/مقدار در نظر میگیرند، میتوان به شمارشهای پایتون رفتار اضافه کرد. برای مثال، :class:`datetime.date` دو متد برای برگرداندن روز هفته دارد: :meth:`~datetime.date.weekday` و :meth:`~datetime.date.isoweekday`. تفاوت این است که یکی از آنها از ۰ تا ۶ و دیگری از ۱ تا ۷ میشمارد. بهجای اینکه خودمان این موضوع را پیگیری کنیم، میتوانیم متدی به شمارش :class:`!Weekday` اضافه کنیم تا روز را از نمونه :class:`~datetime.date` استخراج کند و عضو متناظر شمارش را برگرداند::"
msgid ""
"@classmethod\n"
"def from_date(cls, date):\n"
" return cls(date.isoweekday())"
msgstr ""
"@classmethod\n"
"def from_date(cls, date):\n"
" return cls(date.isoweekday())"
msgid "The complete :class:`!Weekday` enum now looks like this::"
msgstr "شمارش کامل :class:`!Weekday` اکنون به این شکل است::"
msgid ""
">>> class Weekday(Enum):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 3\n"
"... THURSDAY = 4\n"
"... FRIDAY = 5\n"
"... SATURDAY = 6\n"
"... SUNDAY = 7\n"
"... #\n"
"... @classmethod\n"
"... def from_date(cls, date):\n"
"... return cls(date.isoweekday())"
msgstr ""
">>> class Weekday(Enum):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 3\n"
"... THURSDAY = 4\n"
"... FRIDAY = 5\n"
"... SATURDAY = 6\n"
"... SUNDAY = 7\n"
"... #\n"
"... @classmethod\n"
"... def from_date(cls, date):\n"
"... return cls(date.isoweekday())"
msgid "Now we can find out what today is! Observe::"
msgstr "اکنون میتوانیم بفهمیم امروز چه روزی است! مشاهده کنید::"
msgid ""
">>> import datetime as dt\n"
">>> Weekday.from_date(dt.date.today())\n"
"<Weekday.TUESDAY: 2>"
msgstr ""
">>> import datetime as dt\n"
">>> Weekday.from_date(dt.date.today())\n"
"<Weekday.TUESDAY: 2>"
msgid "Of course, if you're reading this on some other day, you'll see that day instead."
msgstr "البته، اگر این متن را در روز دیگری میخوانید، آن روز را خواهید دید."
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` زمانی عالی است که متغیر ما فقط به یک روز نیاز داشته باشد، اما اگر به چندین روز نیاز داشته باشیم چطور؟ شاید در حال نوشتن تابعی برای رسم کارها در طول هفته باشیم و نمیخواهیم از :class:`list` استفاده کنیم -- میتوانیم از نوع متفاوتی از :class:`Enum` استفاده کنیم::"
msgid ""
">>> from enum import Flag\n"
">>> class Weekday(Flag):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 4\n"
"... THURSDAY = 8\n"
"... FRIDAY = 16\n"
"... SATURDAY = 32\n"
"... SUNDAY = 64"
msgstr ""
">>> from enum import Flag\n"
">>> class Weekday(Flag):\n"
"... MONDAY = 1\n"
"... TUESDAY = 2\n"
"... WEDNESDAY = 4\n"
"... THURSDAY = 8\n"
"... FRIDAY = 16\n"
"... SATURDAY = 32\n"
"... SUNDAY = 64"
msgid "We've changed two things: we're inherited from :class:`Flag`, and the values are all powers of 2."
msgstr "ما دو چیز را تغییر دادهایم: از :class:`Flag` ارث میبریم، و مقدارها همگی توانهای ۲ هستند."
msgid "Just like the original :class:`!Weekday` enum above, we can have a single selection::"
msgstr "درست مانند enum اصلی :class:`!Weekday` در بالا، میتوانیم یک انتخاب واحد داشته باشیم::"
msgid ""
">>> first_week_day = Weekday.MONDAY\n"
">>> first_week_day\n"
"<Weekday.MONDAY: 1>"
msgstr ""
">>> first_week_day = Weekday.MONDAY\n"
">>> first_week_day\n"
"<Weekday.MONDAY: 1>"
msgid "But :class:`Flag` also allows us to combine several members into a single variable::"
msgstr "اما :class:`Flag` همچنین به ما اجازه میدهد چند عضو را در یک متغیر ترکیب کنیم::"
msgid ""
">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n"
">>> weekend\n"
"<Weekday.SATURDAY|SUNDAY: 96>"
msgstr ""
">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n"
">>> weekend\n"
"<Weekday.SATURDAY|SUNDAY: 96>"
msgid "You can even iterate over a :class:`Flag` variable::"
msgstr "شما حتی میتوانید یک متغیر :class:`Flag` را پیمایش کنید::"
msgid ""
">>> for day in weekend:\n"
"... print(day)\n"
"Weekday.SATURDAY\n"
"Weekday.SUNDAY"
msgstr ""
">>> for day in weekend:\n"
"... print(day)\n"
"Weekday.SATURDAY\n"
"Weekday.SUNDAY"
msgid "Okay, let's get some chores set up::"
msgstr "بسیار خوب، بیایید چند کار را راهاندازی کنیم::"
msgid ""
">>> chores_for_ethan = {\n"
"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY,\n"
"... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n"
"... 'answer SO questions': Weekday.SATURDAY,\n"
"... }"
msgstr ""
">>> chores_for_ethan = {\n"
"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY,\n"
"... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n"
"... 'answer SO questions': Weekday.SATURDAY,\n"
"... }"
msgid "And a function to display the chores for a given day::"
msgstr "و تابعی برای نمایش کارهای یک روز مشخص::"
msgid ""
">>> def show_chores(chores, day):\n"
"... for chore, days in chores.items():\n"
"... if day in days:\n"
"... print(chore)\n"
"...\n"
">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n"
"answer SO questions"
msgstr ""
">>> def show_chores(chores, day):\n"
"... for chore, days in chores.items():\n"
"... if day in days:\n"
"... print(chore)\n"
"...\n"
">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n"
"answer SO questions"
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` استفاده کنید::"
msgid ""
">>> from enum import auto\n"
">>> class Weekday(Flag):\n"
"... MONDAY = auto()\n"
"... TUESDAY = auto()\n"
"... WEDNESDAY = auto()\n"
"... THURSDAY = auto()\n"
"... FRIDAY = auto()\n"
"... SATURDAY = auto()\n"
"... SUNDAY = auto()\n"
"... WEEKEND = SATURDAY | SUNDAY"
msgstr ""
">>> from enum import auto\n"
">>> class Weekday(Flag):\n"
"... MONDAY = auto()\n"
"... TUESDAY = auto()\n"
"... WEDNESDAY = auto()\n"
"... THURSDAY = auto()\n"
"... FRIDAY = auto()\n"
"... SATURDAY = auto()\n"
"... SUNDAY = auto()\n"
"... WEEKEND = SATURDAY | SUNDAY"
msgid "Programmatic access to enumeration members and their attributes"
msgstr "دسترسی برنامهای به اعضای شمارش و ویژگیهای آنها"
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`` چنین دسترسیای را فراهم میکند::"
msgid ""
">>> Color(1)\n"
"<Color.RED: 1>\n"
">>> Color(3)\n"
"<Color.BLUE: 3>"
msgstr ""
">>> Color(1)\n"
"<Color.RED: 1>\n"
">>> Color(3)\n"
"<Color.BLUE: 3>"
msgid "If you want to access enum members by *name*, use item access::"
msgstr "اگر میخواهید به اعضای enum با *نام* دسترسی پیدا کنید، از دسترسی آیتمی استفاده کنید::"
msgid ""
">>> Color['RED']\n"
"<Color.RED: 1>\n"
">>> Color['GREEN']\n"
"<Color.GREEN: 2>"
msgstr ""
">>> Color['RED']\n"
"<Color.RED: 1>\n"
">>> Color['GREEN']\n"
"<Color.GREEN: 2>"
msgid "If you have an enum member and need its :attr:`!name` or :attr:`!value`::"
msgstr "اگر یک عضو enum دارید و به :attr:`!name` یا :attr:`!value` آن نیاز دارید::"
msgid ""
">>> member = Color.RED\n"
">>> member.name\n"
"'RED'\n"
">>> member.value\n"
"1"
msgstr ""
">>> member = Color.RED\n"
">>> member.name\n"
"'RED'\n"
">>> member.value\n"
"1"
msgid "Duplicating enum members and values"
msgstr "تکرار اعضای enum و مقدارهای آن"
msgid "Having two enum members with the same name is invalid::"
msgstr "داشتن دو عضو enum با نام یکسان نامعتبر است::"
msgid ""
">>> class Shape(Enum):\n"
"... SQUARE = 2\n"
"... SQUARE = 3\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"TypeError: 'SQUARE' already defined as 2"
msgstr ""
">>> class Shape(Enum):\n"
"... SQUARE = 2\n"
"... SQUARE = 3\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"TypeError: 'SQUARE' already defined as 2"
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 "با این حال، یک عضو enum میتواند نامهای دیگری نیز داشته باشد که به آن مرتبط هستند. با فرض دو ورودی ``A`` و ``B`` با مقدار یکسان (و ``A`` ابتدا تعریف شده باشد)، ``B`` نام مستعاری برای عضو ``A`` است. جستوجوی بر اساس مقدار برای مقدار ``A``، عضو ``A`` را برمیگرداند. جستوجوی بر اساس نام برای ``A``، عضو ``A`` را برمیگرداند. جستوجوی بر اساس نام برای ``B`` نیز عضو ``A`` را برمیگرداند::"
msgid ""
">>> class Shape(Enum):\n"
"... SQUARE = 2\n"
"... DIAMOND = 1\n"
"... CIRCLE = 3\n"
"... ALIAS_FOR_SQUARE = 2\n"
"...\n"
">>> Shape.SQUARE\n"
"<Shape.SQUARE: 2>\n"
">>> Shape.ALIAS_FOR_SQUARE\n"
"<Shape.SQUARE: 2>\n"
">>> Shape(2)\n"
"<Shape.SQUARE: 2>"
msgstr ""
">>> class Shape(Enum):\n"
"... SQUARE = 2\n"
"... DIAMOND = 1\n"
"... CIRCLE = 3\n"
"... ALIAS_FOR_SQUARE = 2\n"
"...\n"
">>> Shape.SQUARE\n"
"<Shape.SQUARE: 2>\n"
">>> Shape.ALIAS_FOR_SQUARE\n"
"<Shape.SQUARE: 2>\n"
">>> Shape(2)\n"
"<Shape.SQUARE: 2>"
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 "تلاش برای ایجاد عضوی همنام با یک ویژگی از پیش تعریفشده (عضوی دیگر، یک متد و غیره) یا تلاش برای ایجاد ویژگی همنام با یک عضو مجاز نیست."
msgid "Ensuring unique enumeration values"
msgstr "اطمینان از یکتایی مقادیر شمارش"
msgid "By default, enumerations allow multiple names as aliases for the same value. When this behavior isn't desired, you can use the :deco:`unique` decorator::"
msgstr "بهطور پیشفرض، شمارشها اجازه میدهند چندین نام بهعنوان نامهای مستعار برای یک مقدار یکسان استفاده شوند. هنگامی که این رفتار مطلوب نباشد، میتوانید از دکوراتور :deco:`unique` استفاده کنید::"
msgid ""
">>> from enum import Enum, unique\n"
">>> @unique\n"
"... class Mistake(Enum):\n"
"... ONE = 1\n"
"... TWO = 2\n"
"... THREE = 3\n"
"... FOUR = 3\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"ValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE"
msgstr ""
">>> from enum import Enum, unique\n"
">>> @unique\n"
"... class Mistake(Enum):\n"
"... ONE = 1\n"
"... TWO = 2\n"
"... THREE = 3\n"
"... FOUR = 3\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"ValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE"
msgid "Using automatic values"
msgstr "استفاده از مقادیر خودکار"
msgid "If the exact value is unimportant you can use :class:`auto`::"
msgstr "اگر مقدار دقیق مهم نیست، میتوانید از :class:`auto` استفاده کنید::"
msgid ""
">>> from enum import Enum, auto\n"
">>> class Color(Enum):\n"
"... RED = auto()\n"
"... BLUE = auto()\n"
"... GREEN = auto()\n"
"...\n"
">>> [member.value for member in Color]\n"
"[1, 2, 3]"
msgstr ""
">>> from enum import Enum, auto\n"
">>> class Color(Enum):\n"
"... RED = auto()\n"
"... BLUE = auto()\n"
"... GREEN = auto()\n"
"...\n"
">>> [member.value for member in Color]\n"
"[1, 2, 3]"
msgid "The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden::"
msgstr "مقادیر توسط :func:`~Enum._generate_next_value_` انتخاب میشوند، که میتوان آن را بازنویسی کرد::"
msgid ""
">>> class AutoName(Enum):\n"
"... @staticmethod\n"
"... def _generate_next_value_(name, start, count, last_values):\n"
"... return name\n"
"...\n"
">>> class Ordinal(AutoName):\n"
"... NORTH = auto()\n"
"... SOUTH = auto()\n"
"... EAST = auto()\n"
"... WEST = auto()\n"
"...\n"
">>> [member.value for member in Ordinal]\n"
"['NORTH', 'SOUTH', 'EAST', 'WEST']"
msgstr ""
">>> class AutoName(Enum):\n"
"... @staticmethod\n"
"... def _generate_next_value_(name, start, count, last_values):\n"
"... return name\n"
"...\n"
">>> class Ordinal(AutoName):\n"
"... NORTH = auto()\n"
"... SOUTH = auto()\n"
"... EAST = auto()\n"
"... WEST = auto()\n"
"...\n"
">>> [member.value for member in Ordinal]\n"
"['NORTH', 'SOUTH', 'EAST', 'WEST']"
msgid "The :meth:`~Enum._generate_next_value_` method must be defined before any members."
msgstr "متد :meth:`~Enum._generate_next_value_` باید پیش از هر عضوی تعریف شود."
msgid "Iteration"
msgstr "تکرار"
msgid "Iterating over the members of an enum does not provide the aliases::"
msgstr "پیمایش اعضای یک enum، نامهای مستعار را ارائه نمیدهد::"
msgid ""
">>> list(Shape)\n"
"[<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]\n"
">>> list(Weekday)\n"
"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: 64>]"
msgstr ""
">>> list(Shape)\n"
"[<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]\n"
">>> list(Weekday)\n"
"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: 64>]"
msgid "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` aren't shown."
msgstr "توجه داشته باشید که نامهای مستعار ``Shape.ALIAS_FOR_SQUARE`` و ``Weekday.WEEKEND`` نمایش داده نمیشوند."
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__`` یک نگاشت مرتب فقطخواندنی از نامها به اعضا است. این ویژگی شامل تمام نامهای تعریفشده در شمارش، از جمله نامهای مستعار است::"
msgid ""
">>> for name, member in Shape.__members__.items():\n"
"... name, member\n"
"...\n"
"('SQUARE', <Shape.SQUARE: 2>)\n"
"('DIAMOND', <Shape.DIAMOND: 1>)\n"
"('CIRCLE', <Shape.CIRCLE: 3>)\n"
"('ALIAS_FOR_SQUARE', <Shape.SQUARE: 2>)"
msgstr ""
">>> for name, member in Shape.__members__.items():\n"
"... name, member\n"
"...\n"
"('SQUARE', <Shape.SQUARE: 2>)\n"
"('DIAMOND', <Shape.DIAMOND: 1>)\n"
"('CIRCLE', <Shape.CIRCLE: 3>)\n"
"('ALIAS_FOR_SQUARE', <Shape.SQUARE: 2>)"
msgid "The ``__members__`` attribute can be used for detailed programmatic access to the enumeration members. For example, finding all the aliases::"
msgstr "میتوان از ویژگی ``__members__`` برای دسترسی برنامهای با جزئیات به اعضای شمارش استفاده کرد. برای مثال، یافتن همهی نامهای مستعار::"
msgid ""
">>> [name for name, member in Shape.__members__.items() if member.name != name]\n"
"['ALIAS_FOR_SQUARE']"
msgstr ""
">>> [name for name, member in Shape.__members__.items() if member.name != name]\n"
"['ALIAS_FOR_SQUARE']"
msgid "Aliases for flags include values with multiple flags set, such as ``3``, and no flags set, i.e. ``0``."
msgstr "نامهای مستعار پرچمها شامل مقادیری با چند پرچم فعال، مانند ``3``، و بدون پرچم فعال، یعنی ``0`` میشوند."
msgid "Comparisons"
msgstr "مقایسهها"
msgid "Enumeration members are compared by identity::"
msgstr "اعضای شمارش بر اساس هویت مقایسه میشوند::"
msgid ""
">>> Color.RED is Color.RED\n"
"True\n"
">>> Color.RED is Color.BLUE\n"
"False\n"
">>> Color.RED is not Color.BLUE\n"
"True"
msgstr ""
">>> Color.RED is Color.RED\n"
"True\n"
">>> Color.RED is Color.BLUE\n"
"False\n"
">>> Color.RED is not Color.BLUE\n"
"True"
msgid "Ordered comparisons between enumeration values are *not* supported. Enum members are not integers (but see `IntEnum`_ below)::"
msgstr "مقایسههای ترتیبی بین مقادیر enum پشتیبانی *نمیشوند*. اعضای Enum عدد صحیح نیستند (اما در ادامه `IntEnum`_ را ببینید)::"
msgid ""
">>> Color.RED < Color.BLUE\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: '<' not supported between instances of 'Color' and 'Color'"
msgstr ""
">>> Color.RED < Color.BLUE\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: '<' not supported between instances of 'Color' and 'Color'"
msgid "Equality comparisons are defined though::"
msgstr "با این حال، مقایسههای برابری تعریف شدهاند::"
msgid ""
">>> Color.BLUE == Color.RED\n"
"False\n"
">>> Color.BLUE != Color.RED\n"
"True\n"
">>> Color.BLUE == Color.BLUE\n"
"True"
msgstr ""
">>> Color.BLUE == Color.RED\n"
"False\n"
">>> Color.BLUE != Color.RED\n"
"True\n"
">>> Color.BLUE == Color.BLUE\n"
"True"
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` بهصراحت برای رفتار متفاوتی طراحی شده است، در زیر ببینید)::"
msgid ""
">>> Color.BLUE == 2\n"
"False"
msgstr ""
">>> Color.BLUE == 2\n"
"False"
msgid "It is possible to reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members."
msgstr "بارگذاری مجدد ماژولها امکانپذیر است — اگر ماژولی که دوباره بارگذاریشده است شامل enumها (enums) باشد، آنها دوباره ایجاد میشوند و ممکن است اعضای جدید در مقایسه با اعضای اصلی یکسان/برابر نباشند."
msgid "Allowed members and attributes of enumerations"
msgstr "اعضا و ویژگیهای مجاز شمارشها"
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 "بیشتر مثالهای بالا از اعداد صحیح برای مقادیر شمارش استفاده میکنند. استفاده از اعداد صحیح کوتاه و راحت است (و بهطور پیشفرض توسط `Functional API`_ فراهم میشود)، اما بهطور اکید اعمال نمیشود. در اکثر قریب به اتفاق موارد استفاده، اهمیت ندارد که مقدار واقعی یک شمارش چیست. اما اگر مقدار *مهم* باشد، شمارشها میتوانند مقادیر دلخواهی داشته باشند."
msgid "Enumerations are Python classes, and can have methods and special methods as usual. If we have this enumeration::"
msgstr "شمارشها کلاسهای پایتون هستند و میتوانند مانند معمول متدها و متدهای ویژه داشته باشند. اگر این شمارش را داشته باشیم::"
msgid ""
">>> class Mood(Enum):\n"
"... FUNKY = 1\n"
"... HAPPY = 3\n"
"...\n"
"... def describe(self):\n"
"... # self is the member here\n"
"... return self.name, self.value\n"
"...\n"
"... def __str__(self):\n"
"... return 'my custom str! {0}'.format(self.value)\n"
"...\n"
"... @classmethod\n"
"... def favorite_mood(cls):\n"
"... # cls here is the enumeration\n"
"... return cls.HAPPY\n"
"..."
msgstr ""
">>> class Mood(Enum):\n"
"... FUNKY = 1\n"
"... HAPPY = 3\n"
"...\n"
"... def describe(self):\n"
"... # self is the member here\n"
"... return self.name, self.value\n"
"...\n"
"... def __str__(self):\n"
"... return 'my custom str! {0}'.format(self.value)\n"
"...\n"
"... @classmethod\n"
"... def favorite_mood(cls):\n"
"... # cls here is the enumeration\n"
"... return cls.HAPPY\n"
"..."
msgid "Then::"
msgstr "سپس::"
msgid ""
">>> Mood.favorite_mood()\n"
"<Mood.HAPPY: 3>\n"
">>> Mood.HAPPY.describe()\n"
"('HAPPY', 3)\n"
">>> str(Mood.FUNKY)\n"
"'my custom str! 1'"
msgstr ""
">>> Mood.favorite_mood()\n"
"<Mood.HAPPY: 3>\n"
">>> Mood.HAPPY.describe()\n"
"('HAPPY', 3)\n"
">>> str(Mood.FUNKY)\n"
"'my custom str! 1'"
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:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also descriptors), and variable names listed in :attr:`~Enum._ignore_`."
msgstr "قواعد مربوط به آنچه مجاز است به شرح زیر است: نامهایی که با یک زیرخط آغاز میشوند و با یک زیرخط ختم میشوند، توسط enum رزرو شدهاند و نمیتوان از آنها استفاده کرد؛ تمام ویژگیهای دیگری که در یک شمارش تعریف میشوند، به اعضای این شمارش تبدیل خواهند شد، به استثنای متدهای ویژه (:meth:`~object.__str__`، :meth:`~object.__add__` و غیره)، توصیفگرها (متدها نیز توصیفگر هستند) و نام متغیرهای فهرستشده در :attr:`~Enum._ignore_`."
msgid "Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:`~object.__init__`, any value(s) given to the enum member will be passed into those methods. See `Planet`_ for an example."
msgstr "توجه: اگر شمارش شما :meth:`~object.__new__` و/یا :meth:`~object.__init__` را تعریف کند، هر مقدار(هایی) که به عضو شمارش داده شود، به آن متدها پاس داده میشود. برای یک مثال `Planet`_ را ببینید."
msgid "The :meth:`~object.__new__` method, if defined, is used during creation of the Enum members; it is then replaced by Enum's :meth:`~object.__new__` which is used after class creation for lookup of existing members. See :ref:`new-vs-init` for more details."
msgstr "متد :meth:`~object.__new__`، در صورت تعریف شدن، در هنگام ایجاد اعضای Enum استفاده میشود؛ سپس با متد :meth:`~object.__new__` خود Enum جایگزین میشود که پس از ایجاد کلاس برای جستوجوی اعضای موجود استفاده میشود. برای جزئیات بیشتر :ref:`new-vs-init` را ببینید."
msgid "Restricted Enum subclassing"
msgstr "زیرکلاسسازی محدود Enum"
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 پایه، حداکثر یک نوع داده مشخص، و هر تعداد کلاس میکساین مبتنی بر :class:`object` که لازم باشد، داشته باشد. ترتیب این کلاسهای پایه به این صورت است::"
msgid ""
"class EnumName([mix-in, ...,] [data-type,] base-enum):\n"
" pass"
msgstr ""
"class EnumName([mix-in, ...,] [data-type,] base-enum):\n"
" pass"
msgid "Also, subclassing an enumeration is allowed only if the enumeration does not define any members. So this is forbidden::"
msgstr "همچنین، زیرکلاسسازی از یک شمارش تنها در صورتی مجاز است که آن شمارش هیچ عضوی را تعریف نکرده باشد. بنابراین این کار ممنوع است::"
msgid ""
">>> class MoreColor(Color):\n"
"... PINK = 17\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"TypeError: <enum 'MoreColor'> cannot extend <enum 'Color'>"
msgstr ""
">>> class MoreColor(Color):\n"
"... PINK = 17\n"
"...\n"
"Traceback (most recent call last):\n"
"...\n"
"TypeError: <enum 'MoreColor'> cannot extend <enum 'Color'>"
msgid "But this is allowed::"
msgstr "اما این مجاز است::"
msgid ""
">>> class Foo(Enum):\n"
"... def some_behavior(self):\n"
"... pass\n"
"...\n"
">>> class Bar(Foo):\n"
"... HAPPY = 1\n"
"... SAD = 2\n"
"..."
msgstr ""
">>> class Foo(Enum):\n"
"... def some_behavior(self):\n"
"... pass\n"
"...\n"
">>> class Bar(Foo):\n"
"... HAPPY = 1\n"
"... SAD = 2\n"
"..."
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 "مجاز کردن زیرکلاسسازی از enumهایی که اعضا را تعریف میکنند، منجر به نقض برخی از ناورداهای مهم انواع و نمونهها میشود. از سوی دیگر، منطقی است که اجازه داده شود برخی رفتارهای مشترک میان گروهی از enumها به اشتراک گذاشته شود. (برای نمونه `OrderedEnum`_ را ببینید.)"
msgid "Dataclass support"
msgstr "پشتیبانی از دیتاکلاس"
msgid "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum.__repr__` omits the inherited class' name. For example::"
msgstr "هنگام ارثبردن از یک :class:`~dataclasses.dataclass`، متد :meth:`~Enum.__repr__` نام کلاس بهارثبردهشده را حذف میکند. برای مثال::"
msgid ""
">>> from dataclasses import dataclass, field\n"
">>> @dataclass\n"
"... class CreatureDataMixin:\n"
"... size: str\n"
"... legs: int\n"
"... tail: bool = field(repr=False, default=True)\n"
"...\n"
">>> class Creature(CreatureDataMixin, Enum):\n"
"... BEETLE = 'small', 6\n"
"... DOG = 'medium', 4\n"
"...\n"
">>> Creature.DOG\n"
"<Creature.DOG: size='medium', legs=4>"
msgstr ""
">>> from dataclasses import dataclass, field\n"
">>> @dataclass\n"
"... class CreatureDataMixin:\n"
"... size: str\n"
"... legs: int\n"
"... tail: bool = field(repr=False, default=True)\n"
"...\n"
">>> class Creature(CreatureDataMixin, Enum):\n"
"... BEETLE = 'small', 6\n"
"... DOG = 'medium', 4\n"
"...\n"
">>> Creature.DOG\n"
"<Creature.DOG: size='medium', legs=4>"
msgid "Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the standard :func:`repr`."
msgstr "برای استفاده از :func:`repr` استاندارد، از آرگومان ``repr=False`` در :func:`~dataclasses.dataclass` استفاده کنید."
msgid "Only the dataclass fields are shown in the value area, not the dataclass' name."
msgstr "تنها فیلدهای دیتاکلاس در ناحیهی مقدار نمایش داده میشوند، نه نام دیتاکلاس."
msgid "Adding :deco:`~dataclasses.dataclass` decorator to :class:`Enum` and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other::"
msgstr "افزودن دکوراتور :deco:`~dataclasses.dataclass` به :class:`Enum` و زیرکلاسهای آن پشتیبانی نمیشود. این کار هیچ خطایی را پرتاب نمیکند، اما نتایج بسیار عجیبی در رانتایم تولید میکند، مانند برابر بودن اعضا با یکدیگر::"
msgid ""
">>> @dataclass # don't do this: it does not make any sense\n"
"... class Color(Enum):\n"
"... RED = 1\n"
"... BLUE = 2\n"
"...\n"
">>> Color.RED is Color.BLUE\n"
"False\n"
">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n"
"True"
msgstr ""
">>> @dataclass # don't do this: it does not make any sense\n"
"... class Color(Enum):\n"
"... RED = 1\n"
"... BLUE = 2\n"
"...\n"
">>> Color.RED is Color.BLUE\n"
"False\n"
">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n"
"True"
msgid "Pickling"
msgstr "پیکلکردن"
msgid "Enumerations can be pickled and unpickled::"
msgstr "میتوان شمارشها را پیکل و پیکلگشایی (unpickle) کرد::"
msgid ""
">>> from test.test_enum import Fruit\n"
">>> from pickle import dumps, loads\n"
">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n"
"True"
msgstr ""
">>> from test.test_enum import Fruit\n"
">>> from pickle import dumps, loads\n"
">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n"
"True"
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 "محدودیتهای معمول برای پیکلکردن اعمال میشوند: enumهای قابل پیکلکردن باید در بالاترین سطح یک ماژول تعریف شوند، زیرا برای پیکلگشایی لازم است که بتوان آنها را از آن ماژول ایمپورت کرد."
msgid "With pickle protocol version 4 it is possible to easily pickle enums nested in other classes."
msgstr "با نسخهی ۴ پروتکل پیکل، میتوان enumهای تودرتو در کلاسهای دیگر را بهسادگی پیکل کرد."
msgid "It is possible to modify how enum members are pickled/unpickled by defining :meth:`~object.__reduce_ex__` in the enumeration class. The default method is by-value, but enums with complicated values may want to use by-name::"
msgstr "میتوان با تعریف :meth:`~object.__reduce_ex__` در کلاس enum، نحوهی پیکلکردن/از پیکل خارجشدن اعضای enum را تغییر داد. روش پیشفرض بر اساس مقدار (by-value) است، اما enumهایی با مقادیر پیچیده ممکن است بخواهند از روش ناممحور (by-name) استفاده کنند::"
msgid ""
">>> import enum\n"
">>> class MyEnum(enum.Enum):\n"
"... __reduce_ex__ = enum.pickle_by_enum_name"
msgstr ""
">>> import enum\n"
">>> class MyEnum(enum.Enum):\n"
"... __reduce_ex__ = enum.pickle_by_enum_name"
msgid "Using by-name for flags is not recommended, as unnamed aliases will not unpickle."
msgstr "استفاده از روش ناممحور (by-name) برای پرچمها توصیه نمیشود، زیرا نامهای مستعار بینام پیکلگشایی (unpickle) نخواهند شد."
msgid "Functional API"
msgstr "API تابعی"
msgid "The :class:`Enum` class is callable, providing the following functional API::"
msgstr "کلاس :class:`Enum` فراخوانیپذیر است و API تابعی زیر را فراهم میکند::"
msgid ""
">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n"
">>> Animal\n"
"<enum 'Animal'>\n"
">>> Animal.ANT\n"
"<Animal.ANT: 1>\n"
">>> list(Animal)\n"
"[<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]"
msgstr ""
">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n"
">>> Animal\n"
"<enum 'Animal'>\n"
">>> Animal.ANT\n"
"<Animal.ANT: 1>\n"
">>> list(Animal)\n"
"[<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]"
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` نام شمارش است."
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 "آرگومان دوم، *منبع* نامهای اعضای شمارش است. این آرگومان میتواند رشتهای از نامها که با فضای خالی از هم جدا شدهاند، دنبالهای از نامها، دنبالهای از تاپلهای دوتایی با جفتهای کلید/مقدار، یا نگاشتی (مثلاً دیکشنری) از نامها به مقادیر باشد. دو گزینه آخر امکان اختصاص مقادیر دلخواه به شمارشها را فراهم میکنند؛ سایر گزینهها بهطور خودکار اعداد صحیح افزایشی را از ۱ اختصاص میدهند (برای تعیین مقدار شروع متفاوت، از پارامتر ``start`` استفاده کنید). کلاس جدیدی مشتقشده از :class:`Enum` بازگردانده میشود. به عبارت دیگر، انتساب بالا به :class:`!Animal` معادل است با::"
msgid ""
">>> class Animal(Enum):\n"
"... ANT = 1\n"
"... BEE = 2\n"
"... CAT = 3\n"
"... DOG = 4\n"
"..."
msgstr ""
">>> class Animal(Enum):\n"
"... ANT = 1\n"
"... BEE = 2\n"
"... CAT = 3\n"
"... DOG = 4\n"
"..."
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 "دلیل پیشفرض قرار دادن ``1`` بهعنوان عدد آغازین و نه ``0`` این است که ``0`` از نظر بولی ``False`` است، اما بهطور پیشفرض همه اعضای enum به ``True`` ارزیابی میشوند."
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 a separate module, and also may not work on IronPython or Jython). The solution is to specify the module name explicitly as follows::"
msgstr "پیکلکردن enumهای ایجادشده با API تابعی ممکن است دشوار باشد، زیرا جزئیات پیادهسازی پشتهی فریمها برای تلاش و تشخیص اینکه enum در کدام ماژول ایجاد میشود به کار میروند (برای مثال، اگر از یک تابع کمکی در یک ماژول جداگانه استفاده کنید، این کار شکست میخورد و همچنین ممکن است روی IronPython یا Jython کار نکند). راهحل این است که نام ماژول را بهصورت صریح به شرح زیر مشخص کنید::"
msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)"
msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)"
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 غیرقابل پیکل (unpicklable) نخواهند بود؛ برای نزدیکتر نگهداشتن خطاها به منبع، پیکلکردن غیرفعال خواهد شد."
msgid "The new pickle protocol 4 also, in some circumstances, relies on :attr:`~type.__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 همچنین، در برخی شرایط، به این موضوع متکی است که :attr:`~type.__qualname__` روی مکانی تنظیم شده باشد که pickle بتواند کلاس را بیابد. برای مثال، اگر کلاس در کلاس SomeData در محدوده سراسری در دسترس قرار گرفته باشد::"
msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')"
msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')"
msgid "The complete signature is::"
msgstr "امضای کامل به این صورت است::"
msgid ""
"Enum(\n"
" value='NewEnumName',\n"
" names=<...>,\n"
" *,\n"
" module='...',\n"
" qualname='...',\n"
" type=<mixed-in class>,\n"
" start=1,\n"
" )"
msgstr ""
"Enum(\n"
" value='NewEnumName',\n"
" names=<...>,\n"
" *,\n"
" module='...',\n"
" qualname='...',\n"
" type=<mixed-in class>,\n"
" start=1,\n"
" )"
msgid "*value*: What the new enum class will record as its name."
msgstr "*value*: آنچه کلاس enum جدید بهعنوان نام خود ثبت خواهد کرد."
msgid "*names*: The enum members. This can be a whitespace- or comma-separated string (values will start at 1 unless otherwise specified)::"
msgstr "*names*: اعضای enum. این میتواند رشتهای جداشده با فضای خالی یا ویرگول باشد (مقادیر از ۱ شروع خواهند شد مگر اینکه خلاف آن مشخص شده باشد)::"
msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'"
msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'"
msgid "or an iterator of names::"
msgstr "یا یک پیمایشگر از نامها::"
msgid "['RED', 'GREEN', 'BLUE']"
msgstr "['RED', 'GREEN', 'BLUE']"
msgid "or an iterator of (name, value) pairs::"
msgstr "یا پیمایشگری از جفتهای (نام، مقدار)::"
msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]"
msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]"
msgid "or a mapping::"
msgstr "یا یک نگاشت::"
msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}"
msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}"
msgid "*module*: name of module where new enum class can be found."
msgstr "*module*: نام ماژولی که کلاس enum جدید در آن یافت میشود."
msgid "*qualname*: where in module new enum class can be found."
msgstr "*qualname*: جایگاهی در ماژول که کلاس enum جدید در آن یافت میشود."
msgid "*type*: type to mix in to new enum class."
msgstr "*type*: نوعی که باید در کلاس enum جدید ادغامشود."
msgid "*start*: number to start counting at if only names are passed in."
msgstr "*start*: عددی که اگر فقط نامها ارسال شده باشند، شمارش از آن آغاز میشود."
msgid "The *start* parameter was added."
msgstr "پارامتر *start* اضافه شد."
msgid "Derived Enumerations"
msgstr "شمارشهای مشتقشده"
msgid "IntEnum"
msgstr "IntEnum"
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 "اولین گونه از :class:`Enum` که ارائه شده است، همچنین زیرکلاسی از :class:`int` است. اعضای یک :class:`IntEnum` میتوانند با اعداد صحیح مقایسه شوند؛ بهتبع، شمارشهای عدد صحیح از انواع مختلف نیز میتوانند با یکدیگر مقایسه شوند::"
msgid ""