Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97b7acd

Browse files
[po] auto sync
1 parent b7501c0 commit 97b7acd

2 files changed

Lines changed: 56 additions & 20 deletions

File tree

howto/clinic.po

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# telnetning <[email protected]>, 2020
1111
# Alpha Du <[email protected]>, 2020
1212
# ppcfish <[email protected]>, 2020
13-
# Freesand Leo <[email protected]>, 2022
1413
# Dai Xu <[email protected]>, 2022
14+
# Freesand Leo <[email protected]>, 2022
1515
#
1616
#, fuzzy
1717
msgid ""
@@ -20,7 +20,7 @@ msgstr ""
2020
"Report-Msgid-Bugs-To: \n"
2121
"POT-Creation-Date: 2021-01-01 16:06+0000\n"
2222
"PO-Revision-Date: 2020-05-30 11:54+0000\n"
23-
"Last-Translator: Dai Xu <daixu61@hotmail.com>, 2022\n"
23+
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2022\n"
2424
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2525
"MIME-Version: 1.0\n"
2626
"Content-Type: text/plain; charset=UTF-8\n"
@@ -695,41 +695,41 @@ msgstr ""
695695
msgid ""
696696
"The default value you provide for a parameter can't be any arbitrary "
697697
"expression. Currently the following are explicitly supported:"
698-
msgstr ""
698+
msgstr "提供给参数的默认值不能是表达式。目前明确支持以下形式:"
699699

700700
#: ../../howto/clinic.rst:564
701701
msgid "Numeric constants (integer and float)"
702-
msgstr ""
702+
msgstr "数值型常数(整数和浮点数)。"
703703

704704
#: ../../howto/clinic.rst:565
705705
msgid "String constants"
706706
msgstr "字符串常量"
707707

708708
#: ../../howto/clinic.rst:566
709709
msgid "``True``, ``False``, and ``None``"
710-
msgstr ""
710+
msgstr "``True`` 、 ``False`` 和 ``None`` 。"
711711

712712
#: ../../howto/clinic.rst:567
713713
msgid ""
714714
"Simple symbolic constants like ``sys.maxsize``, which must start with the "
715715
"name of the module"
716-
msgstr ""
716+
msgstr "以模块名开头的简单符号常量,如 ``sys.maxsize``。"
717717

718718
#: ../../howto/clinic.rst:570
719719
msgid ""
720720
"In case you're curious, this is implemented in ``from_builtin()`` in "
721721
"``Lib/inspect.py``."
722-
msgstr ""
722+
msgstr "如果你感到好奇,这是在 ``from_builtin()`` ( ``Lib/inspect.py``) 中实现的。"
723723

724724
#: ../../howto/clinic.rst:573
725725
msgid ""
726726
"(In the future, this may need to get even more elaborate, to allow full "
727727
"expressions like ``CONSTANT - 1``.)"
728-
msgstr ""
728+
msgstr "(未来可能需要加以细化,以便可以采用 ``CONSTANT - 1`` 之类的完整表达式。)"
729729

730730
#: ../../howto/clinic.rst:578
731731
msgid "Renaming the C functions and variables generated by Argument Clinic"
732-
msgstr ""
732+
msgstr "对 Argument Clinic 生成的 C 函数和变量进行重命名"
733733

734734
#: ../../howto/clinic.rst:580
735735
msgid ""
@@ -742,18 +742,21 @@ msgid ""
742742
"function, then add ``\"_impl\"`` to the end and use that for the name of the"
743743
" impl function."
744744
msgstr ""
745+
"Argument Clinic 会自动为其生成的函数命名。如果生成的名称与现有的 C 函数冲突,这偶尔可能会造成问题,有一个简单的解决方案:覆盖 C "
746+
"函数的名称。只要在函数声明中加入关键字 ``\"as\"`` ,然后再加上要使用的函数名。Argument Clinic "
747+
"将以该函数名为基础作为(生成的)函数名,然后在后面加上 ``\"_impl\"``,并用作导入函数的名称。"
745748

746749
#: ../../howto/clinic.rst:588
747750
msgid ""
748751
"For example, if we wanted to rename the C function names generated for "
749752
"``pickle.Pickler.dump``, it'd look like this::"
750-
msgstr ""
753+
msgstr "例如,若对 ``pickle.Pickler.dump`` 生成的 C 函数进行重命名,应如下所示:"
751754

752755
#: ../../howto/clinic.rst:596
753756
msgid ""
754757
"The base function would now be named ``pickler_dumper()``, and the impl "
755758
"function would now be named ``pickler_dumper_impl()``."
756-
msgstr ""
759+
msgstr "原函数会被命名为 ``pickler_dumper()``,而实现函数现在被命名为``pickler_dumper_impl()``。"
757760

758761
#: ../../howto/clinic.rst:600
759762
msgid ""
@@ -762,20 +765,23 @@ msgid ""
762765
"Clinic allows you to give a parameter different names in Python and in C, "
763766
"using the same ``\"as\"`` syntax::"
764767
msgstr ""
768+
"同样的问题依然会出现:想给某个参数取个 Python 用名,但在 C 语言中可能用不了。Argument Clinic 允许在 Python 和 C "
769+
"中为同一个参数取不同的名字,语法依然是利用 ``\"as\"`` :"
765770

766771
#: ../../howto/clinic.rst:614
767772
msgid ""
768773
"Here, the name used in Python (in the signature and the ``keywords`` array) "
769774
"would be ``file``, but the C variable would be named ``file_obj``."
770775
msgstr ""
776+
"这里 Python(签名和 ``keywords`` 数组中)中用的名称是 ``file``,而 C 语言中的变量命名为 ``file_obj``。"
771777

772778
#: ../../howto/clinic.rst:617
773779
msgid "You can use this to rename the ``self`` parameter too!"
774-
msgstr ""
780+
msgstr "``self`` 参数也可以进行重命名。"
775781

776782
#: ../../howto/clinic.rst:621
777783
msgid "Converting functions using PyArg_UnpackTuple"
778-
msgstr ""
784+
msgstr "利用 PyArg_UnpackTuple 对函数进行转换"
779785

780786
#: ../../howto/clinic.rst:623
781787
msgid ""
@@ -785,16 +791,18 @@ msgid ""
785791
"type as appropriate. All arguments should be marked positional-only (add a "
786792
"``/`` on a line by itself after the last argument)."
787793
msgstr ""
794+
"若要将函数转换为采用 :c:func:`PyArg_UnpackTuple` 解析其参数,只需写出所有参数,并将每个参数定义为 "
795+
"``object``。可以指定 ``type`` 参数,以便能转换为合适的类型。所有参数都应标记为只认位置(在最后一个参数后面加上 ``/``)。"
788796

789797
#: ../../howto/clinic.rst:629
790798
msgid ""
791799
"Currently the generated code will use :c:func:`PyArg_ParseTuple`, but this "
792800
"will change soon."
793-
msgstr ""
801+
msgstr "目前,所生成的代码将会用到 :c:func:`PyArg_ParseTuple` ,但很快会做出改动。"
794802

795803
#: ../../howto/clinic.rst:633
796804
msgid "Optional Groups"
797-
msgstr ""
805+
msgstr "可选参数组"
798806

799807
#: ../../howto/clinic.rst:635
800808
msgid ""
@@ -806,6 +814,9 @@ msgid ""
806814
"optional arguments back before :c:func:`PyArg_ParseTupleAndKeywords` was "
807815
"created."
808816
msgstr ""
817+
"有些过时的函数用到了一种让人头疼的函数解析方式:计算位置参数的数量,据此用 ``switch`` 语句进行各个不同的 "
818+
":c:func:`PyArg_ParseTuple` 调用。(这些函数不能接受只认关键字的参数。)在没有 "
819+
":c:func:`PyArg_ParseTupleAndKeywords` 之前,这种方式曾被用于模拟可选参数。"
809820

810821
#: ../../howto/clinic.rst:642
811822
msgid ""
@@ -820,6 +831,11 @@ msgid ""
820831
" ``y``; if you call the function passing in ``x``, you must also pass in "
821832
"``y``—and if you don't pass in ``x`` you may not pass in ``y`` either.)"
822833
msgstr ""
834+
"虽然这种函数通常可以转换为采用 :c:func:`PyArg_ParseTupleAndKeywords` "
835+
"、可选参数和默认值的方式,但并不是全都可以做到。这些过时函数中, :c:func:`PyArg_ParseTupleAndKeywords` "
836+
"并不能直接支持某些功能。最明显的例子是内置函数 ``range()``,它的必需参数的 *左* 边存在一个可选参数!另一个例子是 "
837+
"``curses.window.addch()``,它的两个参数是一组,必须同时指定。(参数名为 ``x`` 和 ``y``;如果调用函数时传入了 "
838+
"``x``,则必须同时传入``y``;如果未传入 ``x`` ,则也不能传入 ``y``)。"
823839

824840
#: ../../howto/clinic.rst:654
825841
msgid ""
@@ -831,6 +847,9 @@ msgid ""
831847
"required arguments. They can *only* be used with positional-only "
832848
"parameters."
833849
msgstr ""
850+
"不管怎么说,Argument Clinic 的目标就是在不改变语义的情况下支持所有现有 CPython 内置参数的解析。因此,Argument "
851+
"Clinic 采用所谓的 *可选组* 方案来支持这种解析方式。可选组是必须一起传入的参数组。他们可以在必需参数的左边或右边,*只能* "
852+
"用于只认位置的参数。"
834853

835854
#: ../../howto/clinic.rst:662
836855
msgid ""
@@ -842,6 +861,9 @@ msgid ""
842861
"doesn't understand the concept. Please avoid using optional groups wherever"
843862
" possible."
844863
msgstr ""
864+
"可选组 *仅* 适用于多次调用 :c:func:`PyArg_ParseTuple` 的函数!采用 *任何* 其他方式解析参数的函数,应该 *几乎不* "
865+
"采用可选组转换为 Argument Clinic 解析。目前,采用可选组的函数在 Python 中无法获得准确的签名,因为 Python "
866+
"不能理解这个概念。请尽可能避免使用可选组。"
845867

846868
#: ../../howto/clinic.rst:671
847869
msgid ""
@@ -851,6 +873,8 @@ msgid ""
851873
"optional groups to make the first two parameters and the last parameter "
852874
"optional::"
853875
msgstr ""
876+
"若要定义可选组,可在要分组的参数前面加上 ``[``,在这些参数后加上``]`` ,要在同一行上。举个例子,下面是 "
877+
"``curses.window.addch`` 采用可选组的用法,前两个参数和最后一个参数可选:"
854878

855879
#: ../../howto/clinic.rst:700
856880
msgid "Notes:"
@@ -868,22 +892,26 @@ msgid ""
868892
"was unused, and set to non-zero if this group was used. (By used or unused, "
869893
"I mean whether or not the parameters received arguments in this invocation.)"
870894
msgstr ""
895+
"每一个可选组,都会额外传入一个代表分组的参数。 参数为 int 型,名为 ``group_{direction}_{number}``,其中 "
896+
"``{direction}`` 取决于此参数组位于必需参数 ``right`` 还是 ``left``,而 ``{number}`` 是一个递增数字(从"
897+
" 1 开始),表示此参数组与必需参数之间的距离。 在调用函数时,若未用到此参数组则此参数将设为零,若用到了参数组则该参数为非零。 "
898+
"所谓的用到或未用到,是指在本次调用中形参是否收到了实参。"
871899

872900
#: ../../howto/clinic.rst:713
873901
msgid ""
874902
"If there are no required arguments, the optional groups will behave as if "
875903
"they're to the right of the required arguments."
876-
msgstr ""
904+
msgstr "如果不存在必需参数,可选组的行为等同于出现在必需参数的右侧。"
877905

878906
#: ../../howto/clinic.rst:716
879907
msgid ""
880908
"In the case of ambiguity, the argument parsing code favors parameters on the"
881909
" left (before the required parameters)."
882-
msgstr ""
910+
msgstr "在模棱两可的情况下,参数解析代码更倾向于参数左侧(在必需参数之前)。"
883911

884912
#: ../../howto/clinic.rst:719
885913
msgid "Optional groups can only contain positional-only parameters."
886-
msgstr ""
914+
msgstr "可选组只能包含只认位置的参数。"
887915

888916
#: ../../howto/clinic.rst:721
889917
msgid ""

library/unittest.mock.po

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ msgstr ":attr:`side_effect` 可以在构造器中设置。 下面是在 mock 被
584584

585585
#: ../../library/unittest.mock.rst:597
586586
msgid "Setting :attr:`side_effect` to ``None`` clears it:"
587-
msgstr ""
587+
msgstr "将 :attr:`side_effect` 设为 ``None`` 可以清除它:"
588588

589589
#: ../../library/unittest.mock.rst:611
590590
msgid ""
@@ -595,6 +595,9 @@ msgid ""
595595
"second member, which can also be accessed through the ``kwargs`` property, "
596596
"is any keyword arguments (or an empty dictionary)."
597597
msgstr ""
598+
"这可以是 ``None`` (如果 mock 没有被调用),或是 mock 最近一次被调用时附带的参数。 这将采用元组的形式:第一个成员也可以通过 "
599+
"``args`` 特征属性来访问,它是 mock 被调用时所附带的任何位置参数 (或为空元组),而第二个成员也可以通过 ``kwargs`` "
600+
"特征属性来访问,它则是任何关键字参数 (或为空字典)。"
598601

599602
#: ../../library/unittest.mock.rst:644
600603
msgid ""
@@ -603,10 +606,13 @@ msgid ""
603606
"are tuples, so they can be unpacked to get at the individual arguments and "
604607
"make more complex assertions. See :ref:`calls as tuples <calls-as-tuples>`."
605608
msgstr ""
609+
":attr:`call_args`,以及列表 :attr:`call_args_list`, :attr:`method_calls` 和 "
610+
":attr:`mock_calls` 的成员都是 :data:`call` 对象。 "
611+
"这些对象属性元组,因此它们可被解包以获得单独的参数并创建更复杂的断言。 参见 :ref:`作为元组的 call <calls-as-tuples>`。"
606612

607613
#: ../../library/unittest.mock.rst:650
608614
msgid "Added ``args`` and ``kwargs`` properties."
609-
msgstr ""
615+
msgstr "增加了 ``args`` 和 ``kwargs`` 特征属性。properties."
610616

611617
#: ../../library/unittest.mock.rst:656
612618
msgid ""
@@ -616,6 +622,8 @@ msgid ""
616622
"used for conveniently constructing lists of calls to compare with "
617623
":attr:`call_args_list`."
618624
msgstr ""
625+
"这是一个已排序的对 mock 对象的所有调用的列表(因此该列表的长度就是它已被调用的次数)。 在执行任何调用之前它将是一个空列表。 "
626+
":data:`call` 对象可以被用来方便地构造调用列表以与 :attr:`call_args_list` 相比较。"
619627

620628
#: ../../library/unittest.mock.rst:672
621629
msgid ""

0 commit comments

Comments
 (0)