-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy path2to3.po
More file actions
715 lines (595 loc) · 29.8 KB
/
2to3.po
File metadata and controls
715 lines (595 loc) · 29.8 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
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.9\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-03 16:35+0000\n"
"PO-Revision-Date: 2025-09-22 17:54+0000\n"
"Last-Translator: python-doc bot, 2025\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/2to3.rst:4
msgid "2to3 - Automated Python 2 to 3 code translation"
msgstr "2to3 - 自动将 Python 2 代码转为 Python 3 代码"
#: ../../library/2to3.rst:8
msgid ""
"2to3 is a Python program that reads Python 2.x source code and applies a "
"series of *fixers* to transform it into valid Python 3.x code. The standard"
" library contains a rich set of fixers that will handle almost all code. "
"2to3 supporting library :mod:`lib2to3` is, however, a flexible and generic "
"library, so it is possible to write your own fixers for 2to3."
msgstr ""
"2to3 是一个 Python 程序,它可以读取 Python 2.x 的源代码并使用一系列的 *修复器* 来将其转换为合法的 Python 3.x "
"代码。 标准库已包含了丰富的修复器,这足以处理几乎所有代码。 不过 2to3 的支持库 :mod:`lib2to3` "
"是一个很灵活通用的库,所以还可以编写你自己的 2to3 修复器。"
#: ../../library/2to3.rst:18
msgid "Using 2to3"
msgstr "使用 2to3"
#: ../../library/2to3.rst:20
msgid ""
"2to3 will usually be installed with the Python interpreter as a script. It "
"is also located in the :file:`Tools/scripts` directory of the Python root."
msgstr ""
"2to3 通常会作为脚本和 Python 解释器一起安装,你可以在 Python 根目录的 :file:`Tools/scripts` 文件夹下找到它。"
#: ../../library/2to3.rst:23
msgid ""
"2to3's basic arguments are a list of files or directories to transform. The"
" directories are recursively traversed for Python sources."
msgstr "2to3 的基本调用参数是一个需要转换的文件或目录列表。对于目录,会递归地寻找其中的 Python 源码。"
#: ../../library/2to3.rst:26
msgid "Here is a sample Python 2.x source file, :file:`example.py`::"
msgstr "这里有一个 Python 2.x 的源码文件,:file:`example.py`:"
#: ../../library/2to3.rst:34
msgid "It can be converted to Python 3.x code via 2to3 on the command line:"
msgstr "它可以在命令行中使用 2to3 转换成 Python 3.x 版本的代码:"
#: ../../library/2to3.rst:40
msgid ""
"A diff against the original source file is printed. 2to3 can also write the"
" needed modifications right back to the source file. (A backup of the "
"original file is made unless :option:`!-n` is also given.) Writing the "
"changes back is enabled with the :option:`!-w` flag:"
msgstr ""
"这个命令会打印出和源文件的区别。通过传入 :option:`!-w` 参数,2to3 也可以把需要的修改写回到原文件中(除非传入了 "
":option:`!-n` 参数,否则会为原始文件创建一个副本):"
#: ../../library/2to3.rst:49
msgid "After transformation, :file:`example.py` looks like this::"
msgstr "在转换完成后,:file:`example.py` 看起来像是这样:"
#: ../../library/2to3.rst:57
msgid ""
"Comments and exact indentation are preserved throughout the translation "
"process."
msgstr "注释和缩进都会在转换过程中保持不变。"
#: ../../library/2to3.rst:59
msgid ""
"By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The "
":option:`!-l` flag lists all available fixers. An explicit set of fixers to"
" run can be given with :option:`!-f`. Likewise the :option:`!-x` explicitly"
" disables a fixer. The following example runs only the ``imports`` and "
"``has_key`` fixers:"
msgstr ""
"默认情况下,2to3 会执行 :ref:`预定义修复器 <2to3-fixers>` 的集合。使用 :option:`!-l` "
"参数可以列出所有可用的修复器。使用 :option:`!-f` 参数可以明确指定需要使用的修复器集合。而使用 :option:`!-x` "
"参数则可以明确指定不使用的修复器。下面的例子会只使用 ``imports`` 和 ``has_key`` 修复器运行:"
#: ../../library/2to3.rst:68
msgid "This command runs every fixer except the ``apply`` fixer:"
msgstr "这个命令会执行除了 ``apply`` 之外的所有修复器:"
#: ../../library/2to3.rst:74
msgid ""
"Some fixers are *explicit*, meaning they aren't run by default and must be "
"listed on the command line to be run. Here, in addition to the default "
"fixers, the ``idioms`` fixer is run:"
msgstr ""
"有一些修复器是需要 *显式指定* 的,它们默认不会执行,必须在命令行中列出才会执行。比如下面的例子,除了默认的修复器以外,还会执行 ``idioms``"
" 修复器:"
#: ../../library/2to3.rst:82
msgid "Notice how passing ``all`` enables all default fixers."
msgstr "注意这里使用 ``all`` 来启用所有默认的修复器。"
#: ../../library/2to3.rst:84
msgid ""
"Sometimes 2to3 will find a place in your source code that needs to be "
"changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a"
" warning beneath the diff for a file. You should address the warning in "
"order to have compliant 3.x code."
msgstr ""
"有些情况下 2to3 会找到源码中有一些需要修改,但是无法自动处理的代码。在这种情况下,2to3 "
"会在差异处下面打印一个警告信息。你应该定位到相应的代码并对其进行修改,以使其兼容 Python 3.x。"
#: ../../library/2to3.rst:89
msgid ""
"2to3 can also refactor doctests. To enable this mode, use the :option:`!-d`"
" flag. Note that *only* doctests will be refactored. This also doesn't "
"require the module to be valid Python. For example, doctest like examples "
"in a reST document could also be refactored with this option."
msgstr ""
"2to3 也可以重构 doctests。使用 :option:`!-d` 开启这个模式。需要注意*只有* doctests "
"会被重构。这种模式下不需要文件是合法的 Python 代码。举例来说,reST 文档中类似 doctests 的示例也可以使用这个选项进行重构。"
#: ../../library/2to3.rst:94
msgid ""
"The :option:`!-v` option enables output of more information on the "
"translation process."
msgstr ":option:`!-v` 选项可以输出更多转换程序的详细信息。"
#: ../../library/2to3.rst:97
msgid ""
"Since some print statements can be parsed as function calls or statements, "
"2to3 cannot always read files containing the print function. When 2to3 "
"detects the presence of the ``from __future__ import print_function`` "
"compiler directive, it modifies its internal grammar to interpret "
":func:`print` as a function. This change can also be enabled manually with "
"the :option:`!-p` flag. Use :option:`!-p` to run fixers on code that "
"already has had its print statements converted. Also :option:`!-e` can be "
"used to make :func:`exec` a function."
msgstr ""
"由于某些 print 语句可被解读为函数调用或是语句,2to3 并不总能读取包含 print 函数的文件。 当 2to3 检测到存在 ``from "
"__future__ import print_function`` 编译器指令时,会修改其内部语法将 :func:`print` 解读为函数。 "
"这一变动也可以使用 :option:`!-p` 旗标手动开启。 使用 :option:`!-p` 来为已转换过 print 语句的代码运行修复器。 "
"也可以使用 :option:`!-e` 将 :func:`exec` 解读为函数。"
#: ../../library/2to3.rst:105
msgid ""
"The :option:`!-o` or :option:`!--output-dir` option allows specification of "
"an alternate directory for processed output files to be written to. The "
":option:`!-n` flag is required when using this as backup files do not make "
"sense when not overwriting the input files."
msgstr ""
":option:`!-o` 或 :option:`!--output-dir` "
"选项可以指定将转换后的文件写入其他目录中。由于这种情况下不会覆写原始文件,所以创建副本文件毫无意义,因此也需要使用 :option:`!-n` "
"选项来禁用创建副本。"
#: ../../library/2to3.rst:110
msgid "The :option:`!-o` option was added."
msgstr "增加了 :option:`!-o` 选项。"
#: ../../library/2to3.rst:113
msgid ""
"The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to "
"always write output files even if no changes were required to the file. "
"This is most useful with :option:`!-o` so that an entire Python source tree "
"is copied with translation from one directory to another. This option "
"implies the :option:`!-w` flag as it would not make sense otherwise."
msgstr ""
":option:`!-W` 或 :option:`!--write-unchanged-files` 选项用来告诉 2to3 "
"始终需要输出文件,即使没有任何改动。这在使用 :option:`!-o` 参数时十分有用,这样就可以将整个 Python "
"源码包完整地转换到另一个目录。这个选项隐含了 :option:`!-w` 选项,否则等于没有作用。"
#: ../../library/2to3.rst:119
msgid "The :option:`!-W` flag was added."
msgstr "增加了 :option:`!-W` 选项。"
#: ../../library/2to3.rst:122
msgid ""
"The :option:`!--add-suffix` option specifies a string to append to all "
"output filenames. The :option:`!-n` flag is required when specifying this "
"as backups are not necessary when writing to different filenames. Example:"
msgstr ""
":option:`!--add-suffix` "
"选项接受一个字符串,用来作为后缀附加在输出文件名后面的后面。由于写入的文件名与原始文件不同,所以没有必要创建副本,因此 :option:`!-n` "
"选项也是必要的。举个例子:"
#: ../../library/2to3.rst:130
msgid "Will cause a converted file named ``example.py3`` to be written."
msgstr "这样会把转换后的文件写入 ``example.py3`` 文件。"
#: ../../library/2to3.rst:132
msgid "The :option:`!--add-suffix` option was added."
msgstr "增加了 :option:`!--add-suffix` 选项。"
#: ../../library/2to3.rst:135
msgid "To translate an entire project from one directory tree to another use:"
msgstr "将整个项目从一个目录转换到另一个目录可以用这样的命令:"
#: ../../library/2to3.rst:145
msgid "Fixers"
msgstr "修复器"
#: ../../library/2to3.rst:147
msgid ""
"Each step of transforming code is encapsulated in a fixer. The command "
"``2to3 -l`` lists them. As :ref:`documented above <2to3-using>`, each can "
"be turned on and off individually. They are described here in more detail."
msgstr ""
"转换代码的每一个步骤都封装在修复器中。可以使用 ``2to3 -l`` 来列出可用的修复器。:ref:`之前已经提到 "
"<2to3-using>`,每个修复器都可以独立地打开或是关闭。下面会对各个修复器做更详细的描述。"
#: ../../library/2to3.rst:154
msgid ""
"Removes usage of :func:`apply`. For example ``apply(function, *args, "
"**kwargs)`` is converted to ``function(*args, **kwargs)``."
msgstr ""
"移除对 :func:`apply` 的使用,举例来说,``apply(function, *args, **kwargs)`` 会被转换成 "
"``function(*args, **kwargs)``。"
#: ../../library/2to3.rst:159
msgid ""
"Replaces deprecated :mod:`unittest` method names with the correct ones."
msgstr "将已弃用的 :mod:`unittest` 方法替换为正确的。"
#: ../../library/2to3.rst:162 ../../library/2to3.rst:351
msgid "From"
msgstr "从"
#: ../../library/2to3.rst:162 ../../library/2to3.rst:351
msgid "To"
msgstr "到"
#: ../../library/2to3.rst:164
msgid "``failUnlessEqual(a, b)``"
msgstr "``failUnlessEqual(a, b)``"
#: ../../library/2to3.rst:164 ../../library/2to3.rst:166
msgid ":meth:`assertEqual(a, b) <unittest.TestCase.assertEqual>`"
msgstr ":meth:`assertEqual(a, b) <unittest.TestCase.assertEqual>`"
#: ../../library/2to3.rst:166
msgid "``assertEquals(a, b)``"
msgstr "``assertEquals(a, b)``"
#: ../../library/2to3.rst:168
msgid "``failIfEqual(a, b)``"
msgstr "``failIfEqual(a, b)``"
#: ../../library/2to3.rst:168 ../../library/2to3.rst:170
msgid ":meth:`assertNotEqual(a, b) <unittest.TestCase.assertNotEqual>`"
msgstr ":meth:`assertNotEqual(a, b) <unittest.TestCase.assertNotEqual>`"
#: ../../library/2to3.rst:170
msgid "``assertNotEquals(a, b)``"
msgstr "``assertNotEquals(a, b)``"
#: ../../library/2to3.rst:172
msgid "``failUnless(a)``"
msgstr "``failUnless(a)``"
#: ../../library/2to3.rst:172 ../../library/2to3.rst:174
msgid ":meth:`assertTrue(a) <unittest.TestCase.assertTrue>`"
msgstr ":meth:`assertTrue(a) <unittest.TestCase.assertTrue>`"
#: ../../library/2to3.rst:174
msgid "``assert_(a)``"
msgstr "``assert_(a)``"
#: ../../library/2to3.rst:176
msgid "``failIf(a)``"
msgstr "``failIf(a)``"
#: ../../library/2to3.rst:176
msgid ":meth:`assertFalse(a) <unittest.TestCase.assertFalse>`"
msgstr ":meth:`assertFalse(a) <unittest.TestCase.assertFalse>`"
#: ../../library/2to3.rst:178
msgid "``failUnlessRaises(exc, cal)``"
msgstr "``failUnlessRaises(exc, cal)``"
#: ../../library/2to3.rst:178
msgid ":meth:`assertRaises(exc, cal) <unittest.TestCase.assertRaises>`"
msgstr ":meth:`assertRaises(exc, cal) <unittest.TestCase.assertRaises>`"
#: ../../library/2to3.rst:180
msgid "``failUnlessAlmostEqual(a, b)``"
msgstr "``failUnlessAlmostEqual(a, b)``"
#: ../../library/2to3.rst:180 ../../library/2to3.rst:182
msgid ":meth:`assertAlmostEqual(a, b) <unittest.TestCase.assertAlmostEqual>`"
msgstr ":meth:`assertAlmostEqual(a, b) <unittest.TestCase.assertAlmostEqual>`"
#: ../../library/2to3.rst:182
msgid "``assertAlmostEquals(a, b)``"
msgstr "``assertAlmostEquals(a, b)``"
#: ../../library/2to3.rst:184
msgid "``failIfAlmostEqual(a, b)``"
msgstr "``failIfAlmostEqual(a, b)``"
#: ../../library/2to3.rst:184 ../../library/2to3.rst:186
msgid ""
":meth:`assertNotAlmostEqual(a, b) <unittest.TestCase.assertNotAlmostEqual>`"
msgstr ""
":meth:`assertNotAlmostEqual(a, b) <unittest.TestCase.assertNotAlmostEqual>`"
#: ../../library/2to3.rst:186
msgid "``assertNotAlmostEquals(a, b)``"
msgstr "``assertNotAlmostEquals(a, b)``"
#: ../../library/2to3.rst:192
msgid "Converts :class:`basestring` to :class:`str`."
msgstr "将 :class:`basestring` 转换为 :class:`str`。"
#: ../../library/2to3.rst:196
msgid ""
"Converts :class:`buffer` to :class:`memoryview`. This fixer is optional "
"because the :class:`memoryview` API is similar but not exactly the same as "
"that of :class:`buffer`."
msgstr ""
"将 :class:`buffer` 转换为 :class:`memoryview`。这个修复器是可选的,因为 :class:`memoryview` "
"API 和 :class:`buffer` 很相似,但不完全一样。"
#: ../../library/2to3.rst:202
msgid ""
"Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to "
":meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and "
":meth:`dict.itervalues` to :meth:`dict.values`. Similarly, "
":meth:`dict.viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` "
"are converted respectively to :meth:`dict.items`, :meth:`dict.keys` and "
":meth:`dict.values`. It also wraps existing usages of :meth:`dict.items`, "
":meth:`dict.keys`, and :meth:`dict.values` in a call to :class:`list`."
msgstr ""
"修复字典迭代方法。:meth:`dict.iteritems` 会转换成 "
":meth:`dict.items`,:meth:`dict.iterkeys` 会转换成 "
":meth:`dict.keys`,:meth:`dict.itervalues` 会转换成 "
":meth:`dict.values`。类似的,:meth:`dict.viewitems`,:meth:`dict.viewkeys` 和 "
":meth:`dict.viewvalues` 会分别转换成 :meth:`dict.items`,:meth:`dict.keys` 和 "
":meth:`dict.values`。另外也会将原有的 :meth:`dict.items`,:meth:`dict.keys` 和 "
":meth:`dict.values` 方法调用用 :class:`list` 包装一层。"
#: ../../library/2to3.rst:212
msgid "Converts ``except X, T`` to ``except X as T``."
msgstr "将 ``except X, T`` 转换为 ``except X as T``。"
#: ../../library/2to3.rst:216
msgid "Converts the ``exec`` statement to the :func:`exec` function."
msgstr "将 ``exec`` 语句转换为 :func:`exec` 函数调用。"
#: ../../library/2to3.rst:220
msgid ""
"Removes usage of :func:`execfile`. The argument to :func:`execfile` is "
"wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`."
msgstr ""
"移除 :func:`execfile` 的使用。:func:`execfile` 的实参会使用 :func:`open`,:func:`compile`"
" 和 :func:`exec` 包装。"
#: ../../library/2to3.rst:225
msgid ""
"Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit` "
"module."
msgstr "将对 :attr:`sys.exitfunc` 的赋值改为使用 :mod:`atexit` 模块代替。"
#: ../../library/2to3.rst:230
msgid "Wraps :func:`filter` usage in a :class:`list` call."
msgstr "将 :func:`filter` 函数用 :class:`list` 包装一层。"
#: ../../library/2to3.rst:234
msgid ""
"Fixes function attributes that have been renamed. For example, "
"``my_function.func_closure`` is converted to ``my_function.__closure__``."
msgstr ""
"修复已经重命名的函数属性。比如 ``my_function.func_closure`` 会被转换为 "
"``my_function.__closure__``。"
#: ../../library/2to3.rst:239
msgid "Removes ``from __future__ import new_feature`` statements."
msgstr "移除 ``from __future__ import new_feature`` 语句。"
#: ../../library/2to3.rst:243
msgid "Renames :func:`os.getcwdu` to :func:`os.getcwd`."
msgstr "将 :func:`os.getcwdu` 重命名为 :func:`os.getcwd`。"
#: ../../library/2to3.rst:247
msgid "Changes ``dict.has_key(key)`` to ``key in dict``."
msgstr "将 ``dict.has_key(key)`` 转换为 ``key in dict``。"
#: ../../library/2to3.rst:251
msgid ""
"This optional fixer performs several transformations that make Python code "
"more idiomatic. Type comparisons like ``type(x) is SomeClass`` and "
"``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``. "
"``while 1`` becomes ``while True``. This fixer also tries to make use of "
":func:`sorted` in appropriate places. For example, this block ::"
msgstr ""
"这是一个可选的修复器,会进行多种转换,将 Python 代码变成更加常见的写法。类似 ``type(x) is SomeClass`` 和 "
"``type(x) == SomeClass`` 的类型对比会被转换成 ``isinstance(x, SomeClass)``。``while 1``"
" 转换成 ``while True``。这个修复器还会在合适的地方使用 :func:`sorted` 函数。举个例子,这样的代码块:"
#: ../../library/2to3.rst:260
msgid "is changed to ::"
msgstr "会被转换为:"
#: ../../library/2to3.rst:266
msgid "Detects sibling imports and converts them to relative imports."
msgstr "检测 sibling imports,并将其转换成相对 import。"
#: ../../library/2to3.rst:270
msgid "Handles module renames in the standard library."
msgstr "处理标准库模块的重命名。"
#: ../../library/2to3.rst:274
msgid ""
"Handles other modules renames in the standard library. It is separate from "
"the :2to3fixer:`imports` fixer only because of technical limitations."
msgstr "处理标准库中其他模块的重命名。这个修复器由于一些技术上的限制,因此和 :2to3fixer:`imports` 拆分开了。"
#: ../../library/2to3.rst:279
msgid "Converts ``input(prompt)`` to ``eval(input(prompt))``."
msgstr "将 ``input(prompt)`` 转换为 ``eval(input(prompt))``。"
#: ../../library/2to3.rst:283
msgid "Converts :func:`intern` to :func:`sys.intern`."
msgstr "将 :func:`intern` 转换为 :func:`sys.intern`。"
#: ../../library/2to3.rst:287
msgid ""
"Fixes duplicate types in the second argument of :func:`isinstance`. For "
"example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x, "
"int)`` and ``isinstance(x, (int, float, int))`` is converted to "
"``isinstance(x, (int, float))``."
msgstr ""
"修复 :func:`isinstance` 函数第二个实参中重复的类型。举例来说,``isinstance(x, (int, int))`` 会转换为 "
"``isinstance(x, int)``, ``isinstance(x, (int, float, int))`` 会转换为 "
"``isinstance(x, (int, float))``。"
#: ../../library/2to3.rst:294
msgid ""
"Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and "
":func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also "
"changed to :func:`itertools.filterfalse`."
msgstr ""
"移除 :func:`itertools.ifilter`,:func:`itertools.izip` 以及 "
":func:`itertools.imap` 的 import。对 :func:`itertools.ifilterfalse` 的 import "
"也会替换成 :func:`itertools.filterfalse`。"
#: ../../library/2to3.rst:300
msgid ""
"Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and "
":func:`itertools.imap` to their built-in equivalents. "
":func:`itertools.ifilterfalse` is changed to :func:`itertools.filterfalse`."
msgstr ""
"修改 :func:`itertools.ifilter`,:func:`itertools.izip` 和 :func:`itertools.imap`"
" 的调用为对应的内建实现。:func:`itertools.ifilterfalse` 会替换成 "
":func:`itertools.filterfalse`。"
#: ../../library/2to3.rst:306
msgid "Renames :class:`long` to :class:`int`."
msgstr "将 :class:`long` 重命名为 :class:`int`。"
#: ../../library/2to3.rst:310
msgid ""
"Wraps :func:`map` in a :class:`list` call. It also changes ``map(None, x)``"
" to ``list(x)``. Using ``from future_builtins import map`` disables this "
"fixer."
msgstr ""
"用 :class:`list` 包装 :func:`map`。同时也会将 ``map(None, x)`` 替换为 ``list(x)``。使用 "
"``from future_builtins import map`` 禁用这个修复器。"
#: ../../library/2to3.rst:316
msgid ""
"Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class "
"body) to the new (``class X(metaclass=Meta)``)."
msgstr ""
"将老的元类语法(类体中的 ``__metaclass__ = Meta``)替换为新的(``class X(metaclass=Meta)``)。"
#: ../../library/2to3.rst:321
msgid ""
"Fixes old method attribute names. For example, ``meth.im_func`` is "
"converted to ``meth.__func__``."
msgstr "修复老的方法属性名。例如 ``meth.im_func`` 会被转换为 ``meth.__func__``。"
#: ../../library/2to3.rst:326
msgid "Converts the old not-equal syntax, ``<>``, to ``!=``."
msgstr "转换老的不等语法,将 ``<>`` 转为 ``!=``。"
#: ../../library/2to3.rst:330
msgid ""
"Converts the use of iterator's :meth:`~iterator.next` methods to the "
":func:`next` function. It also renames :meth:`next` methods to "
":meth:`~iterator.__next__`."
msgstr ""
"将迭代器的 :meth:`~iterator.next` 方法调用转为 :func:`next` 函数。也会将 :meth:`next` 方法重命名为 "
":meth:`~iterator.__next__`。"
#: ../../library/2to3.rst:336
msgid ""
"Renames definitions of methods called :meth:`__nonzero__` to "
":meth:`~object.__bool__`."
msgstr "将被调用的方法定义 :meth:`__nonzero__` 改名为 :meth:`~object.__bool__`。"
#: ../../library/2to3.rst:341
msgid "Converts octal literals into the new syntax."
msgstr "将八进制字面量转为新的语法。"
#: ../../library/2to3.rst:345
msgid ""
"Converts calls to various functions in the :mod:`operator` module to other, "
"but equivalent, function calls. When needed, the appropriate ``import`` "
"statements are added, e.g. ``import collections.abc``. The following "
"mapping are made:"
msgstr ""
"将 :mod:`operator` 模块中的许多方法调用转为其他的等效函数调用。如果有需要,会添加适当的 ``import`` 语句,比如 "
"``import collections.abc``。有以下转换映射:"
#: ../../library/2to3.rst:353
msgid "``operator.isCallable(obj)``"
msgstr "``operator.isCallable(obj)``"
#: ../../library/2to3.rst:353
msgid "``callable(obj)``"
msgstr "``callable(obj)``"
#: ../../library/2to3.rst:354
msgid "``operator.sequenceIncludes(obj)``"
msgstr "``operator.sequenceIncludes(obj)``"
#: ../../library/2to3.rst:354
msgid "``operator.contains(obj)``"
msgstr "``operator.contains(obj)``"
#: ../../library/2to3.rst:355
msgid "``operator.isSequenceType(obj)``"
msgstr "``operator.isSequenceType(obj)``"
#: ../../library/2to3.rst:355
msgid "``isinstance(obj, collections.abc.Sequence)``"
msgstr "``isinstance(obj, collections.abc.Sequence)``"
#: ../../library/2to3.rst:356
msgid "``operator.isMappingType(obj)``"
msgstr "``operator.isMappingType(obj)``"
#: ../../library/2to3.rst:356
msgid "``isinstance(obj, collections.abc.Mapping)``"
msgstr "``isinstance(obj, collections.abc.Mapping)``"
#: ../../library/2to3.rst:357
msgid "``operator.isNumberType(obj)``"
msgstr "``operator.isNumberType(obj)``"
#: ../../library/2to3.rst:357
msgid "``isinstance(obj, numbers.Number)``"
msgstr "``isinstance(obj, numbers.Number)``"
#: ../../library/2to3.rst:358
msgid "``operator.repeat(obj, n)``"
msgstr "``operator.repeat(obj, n)``"
#: ../../library/2to3.rst:358
msgid "``operator.mul(obj, n)``"
msgstr "``operator.mul(obj, n)``"
#: ../../library/2to3.rst:359
msgid "``operator.irepeat(obj, n)``"
msgstr "``operator.irepeat(obj, n)``"
#: ../../library/2to3.rst:359
msgid "``operator.imul(obj, n)``"
msgstr "``operator.imul(obj, n)``"
#: ../../library/2to3.rst:364
msgid ""
"Add extra parenthesis where they are required in list comprehensions. For "
"example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``."
msgstr "在列表生成式中增加必须的括号。例如将 ``[x for x in 1, 2]`` 转换为 ``[x for x in (1, 2)]``。"
#: ../../library/2to3.rst:369
msgid "Converts the ``print`` statement to the :func:`print` function."
msgstr "将 ``print`` 语句转换为 :func:`print` 函数。"
#: ../../library/2to3.rst:373
msgid ""
"Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise "
"E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be "
"incorrect because substituting tuples for exceptions has been removed in "
"3.0."
msgstr ""
"将 ``raise E, V`` 转换为 ``raise E(V)``,将 ``raise E, V, T`` 转换为 ``raise "
"E(V).with_traceback(T)``。如果 ``E`` 是元组,这样的转换是不正确的,因为用元组代替异常的做法在 3.0 中已经移除了。"
#: ../../library/2to3.rst:379
msgid "Converts :func:`raw_input` to :func:`input`."
msgstr "将 :func:`raw_input` 转换为 :func:`input`。"
#: ../../library/2to3.rst:383
msgid "Handles the move of :func:`reduce` to :func:`functools.reduce`."
msgstr "将 :func:`reduce` 转换为 :func:`functools.reduce`。"
#: ../../library/2to3.rst:387
msgid "Converts :func:`reload` to :func:`importlib.reload`."
msgstr "将 :func:`reload` 转换为 :func:`importlib.reload`。"
#: ../../library/2to3.rst:391
msgid "Changes :data:`sys.maxint` to :data:`sys.maxsize`."
msgstr "将 :data:`sys.maxint` 转换为 :data:`sys.maxsize`。"
#: ../../library/2to3.rst:395
msgid "Replaces backtick repr with the :func:`repr` function."
msgstr "将反引号 repr 表达式替换为 :func:`repr` 函数。"
#: ../../library/2to3.rst:399
msgid ""
"Replaces use of the :class:`set` constructor with set literals. This fixer "
"is optional."
msgstr "将 :class:`set` 构造函数替换为 set literals 写法。这个修复器是可选的。"
#: ../../library/2to3.rst:404
msgid "Renames :exc:`StandardError` to :exc:`Exception`."
msgstr "将 :exc:`StandardError` 重命名为 :exc:`Exception`。"
#: ../../library/2to3.rst:408
msgid ""
"Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, "
":data:`sys.exc_traceback` to use :func:`sys.exc_info`."
msgstr ""
"将弃用的 :data:`sys.exc_value`,:data:`sys.exc_type`,:data:`sys.exc_traceback` "
"替换为 :func:`sys.exc_info` 的用法。"
#: ../../library/2to3.rst:413
msgid "Fixes the API change in generator's :meth:`throw` method."
msgstr "修复生成器的 :meth:`throw` 方法的 API 变更。"
#: ../../library/2to3.rst:417
msgid ""
"Removes implicit tuple parameter unpacking. This fixer inserts temporary "
"variables."
msgstr "移除隐式的元组参数解包。这个修复器会插入临时变量。"
#: ../../library/2to3.rst:422
msgid ""
"Fixes code broken from the removal of some members in the :mod:`types` "
"module."
msgstr "修复 :mod:`type` 模块中一些成员的移除引起的代码问题。"
#: ../../library/2to3.rst:427
msgid "Renames :class:`unicode` to :class:`str`."
msgstr "将 :class:`unicode` 重命名为 :class:`str`。"
#: ../../library/2to3.rst:431
msgid ""
"Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib` "
"package."
msgstr "将 :mod:`urllib` 和 :mod:`urllib2` 重命名为 :mod:`urllib` 包。"
#: ../../library/2to3.rst:436
msgid ""
"Removes excess whitespace from comma separated items. This fixer is "
"optional."
msgstr "移除逗号分隔的元素之间多余的空白。这个修复器是可选的。"
#: ../../library/2to3.rst:441
msgid ""
"Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` "
"calls with :class:`list`."
msgstr ""
"将 :func:`xrange` 重命名为 :func:`range`,并用 :class:`list` 包装原有的 :func:`range`。"
#: ../../library/2to3.rst:446
msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``."
msgstr "将 ``for x in file.xreadlines()`` 转换为 ``for x in file``。"
#: ../../library/2to3.rst:450
msgid ""
"Wraps :func:`zip` usage in a :class:`list` call. This is disabled when "
"``from future_builtins import zip`` appears."
msgstr ""
"用 :class:`list` 包装 :func:`zip`。如果使用了 ``from future_builtins import zip`` "
"的话会禁用。"
#: ../../library/2to3.rst:455
msgid ":mod:`lib2to3` - 2to3's library"
msgstr ":mod:`lib2to3` —— 2to3 支持库"
#: ../../library/2to3.rst:464
msgid "**Source code:** :source:`Lib/lib2to3/`"
msgstr "**源代码:** :source:`Lib/lib2to3/`"
#: ../../library/2to3.rst:468
msgid ""
"Python 3.9 will switch to a PEG parser (see :pep:`617`), and Python 3.10 may"
" include new language syntax that is not parsable by lib2to3's LL(1) parser."
" The ``lib2to3`` module may be removed from the standard library in a future"
" Python version. Consider third-party alternatives such as `LibCST`_ or "
"`parso`_."
msgstr ""
"Python 3.9 将切换到 PEG 解析器 (参见 :pep:`617`),Python 3.10 可能会包含 lib2to3 的 LL(1) "
"解析器所不能解析的新语法。 ``lib2to3`` 模块可能会在未来的 Python 版本中被移出标准库。 请考虑使用第三方替代例如 `LibCST`_"
" 或 `parso`_。"
#: ../../library/2to3.rst:477
msgid ""
"The :mod:`lib2to3` API should be considered unstable and may change "
"drastically in the future."
msgstr ":mod:`lib2to3` API 并不稳定,并可能在未来大幅修改。"