diff --git a/library/configparser.po b/library/configparser.po index 74161a66b1..2da4f0ed24 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-23 00:13+0000\n" +"POT-Creation-Date: 2022-03-24 00:12+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -229,7 +229,7 @@ msgid "" "can be provided on initialization." msgstr "" -#: ../../library/configparser.rst:352 +#: ../../library/configparser.rst:353 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -239,14 +239,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: ../../library/configparser.rst:359 +#: ../../library/configparser.rst:360 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return ``" "%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: ../../library/configparser.rst:367 +#: ../../library/configparser.rst:368 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -256,21 +256,21 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: ../../library/configparser.rst:374 +#: ../../library/configparser.rst:375 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: ../../library/configparser.rst:387 +#: ../../library/configparser.rst:389 msgid "Values from other sections can be fetched as well:" msgstr "" -#: ../../library/configparser.rst:409 +#: ../../library/configparser.rst:411 msgid "Mapping Protocol Access" msgstr "" -#: ../../library/configparser.rst:413 +#: ../../library/configparser.rst:415 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -278,7 +278,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: ../../library/configparser.rst:418 +#: ../../library/configparser.rst:420 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -287,7 +287,7 @@ msgid "" "original parser." msgstr "" -#: ../../library/configparser.rst:424 +#: ../../library/configparser.rst:426 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -295,7 +295,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: ../../library/configparser.rst:429 +#: ../../library/configparser.rst:431 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -304,7 +304,7 @@ msgid "" "expressions return ``True``::" msgstr "" -#: ../../library/configparser.rst:437 +#: ../../library/configparser.rst:439 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -314,30 +314,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: ../../library/configparser.rst:444 +#: ../../library/configparser.rst:446 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: ../../library/configparser.rst:446 +#: ../../library/configparser.rst:448 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: ../../library/configparser.rst:448 +#: ../../library/configparser.rst:450 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: ../../library/configparser.rst:450 +#: ../../library/configparser.rst:452 msgid "``parser.popitem()`` never returns it." msgstr "" -#: ../../library/configparser.rst:452 +#: ../../library/configparser.rst:454 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: ../../library/configparser.rst:456 +#: ../../library/configparser.rst:458 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -347,18 +347,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: ../../library/configparser.rst:463 +#: ../../library/configparser.rst:465 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: ../../library/configparser.rst:469 +#: ../../library/configparser.rst:471 msgid "Customizing Parser Behaviour" msgstr "" -#: ../../library/configparser.rst:471 +#: ../../library/configparser.rst:473 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -367,17 +367,17 @@ msgid "" "customize some of the features." msgstr "" -#: ../../library/configparser.rst:477 +#: ../../library/configparser.rst:479 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`__init__` options:" msgstr "" -#: ../../library/configparser.rst:480 +#: ../../library/configparser.rst:482 msgid "*defaults*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:482 +#: ../../library/configparser.rst:484 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -385,17 +385,17 @@ msgid "" "the documented default." msgstr "" -#: ../../library/configparser.rst:487 +#: ../../library/configparser.rst:489 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`read_dict` before you read the actual file." msgstr "" -#: ../../library/configparser.rst:490 +#: ../../library/configparser.rst:492 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: ../../library/configparser.rst:492 +#: ../../library/configparser.rst:494 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -403,24 +403,24 @@ msgid "" "goes for options within sections." msgstr "" -#: ../../library/configparser.rst:497 +#: ../../library/configparser.rst:499 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: ../../library/configparser.rst:500 +#: ../../library/configparser.rst:502 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: ../../library/configparser.rst:522 +#: ../../library/configparser.rst:524 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: ../../library/configparser.rst:524 +#: ../../library/configparser.rst:526 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -428,32 +428,32 @@ msgid "" "such values should be accepted:" msgstr "" -#: ../../library/configparser.rst:559 +#: ../../library/configparser.rst:561 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: ../../library/configparser.rst:561 +#: ../../library/configparser.rst:563 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: ../../library/configparser.rst:565 +#: ../../library/configparser.rst:567 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: ../../library/configparser.rst:568 +#: ../../library/configparser.rst:570 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: ../../library/configparser.rst:570 +#: ../../library/configparser.rst:572 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:572 +#: ../../library/configparser.rst:574 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -463,13 +463,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: ../../library/configparser.rst:579 +#: ../../library/configparser.rst:581 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: ../../library/configparser.rst:583 +#: ../../library/configparser.rst:585 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -479,11 +479,11 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: ../../library/configparser.rst:629 +#: ../../library/configparser.rst:631 msgid "*strict*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:631 +#: ../../library/configparser.rst:633 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`read_file`, :" @@ -491,17 +491,17 @@ msgid "" "parsers in new applications." msgstr "" -#: ../../library/configparser.rst:636 +#: ../../library/configparser.rst:638 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: ../../library/configparser.rst:640 +#: ../../library/configparser.rst:642 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:642 +#: ../../library/configparser.rst:644 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -511,7 +511,7 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: ../../library/configparser.rst:657 +#: ../../library/configparser.rst:659 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -520,13 +520,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: ../../library/configparser.rst:663 +#: ../../library/configparser.rst:665 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: ``" "\"DEFAULT\"``)" msgstr "" -#: ../../library/configparser.rst:666 +#: ../../library/configparser.rst:668 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -540,11 +540,11 @@ msgid "" "files from one format to another)." msgstr "" -#: ../../library/configparser.rst:677 +#: ../../library/configparser.rst:679 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: ../../library/configparser.rst:679 +#: ../../library/configparser.rst:681 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -554,11 +554,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: ../../library/configparser.rst:686 +#: ../../library/configparser.rst:688 msgid "*converters*, default value: not set" msgstr "" -#: ../../library/configparser.rst:688 +#: ../../library/configparser.rst:690 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -572,7 +572,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: ../../library/configparser.rst:699 +#: ../../library/configparser.rst:701 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -580,14 +580,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: ../../library/configparser.rst:704 +#: ../../library/configparser.rst:706 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: ../../library/configparser.rst:710 +#: ../../library/configparser.rst:712 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -596,13 +596,13 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: ../../library/configparser.rst:728 +#: ../../library/configparser.rst:730 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: ../../library/configparser.rst:734 +#: ../../library/configparser.rst:736 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -610,14 +610,14 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: ../../library/configparser.rst:764 +#: ../../library/configparser.rst:766 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: ../../library/configparser.rst:771 +#: ../../library/configparser.rst:773 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -626,18 +626,18 @@ msgid "" "example:" msgstr "" -#: ../../library/configparser.rst:799 +#: ../../library/configparser.rst:801 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: ../../library/configparser.rst:805 +#: ../../library/configparser.rst:807 msgid "Legacy API Examples" msgstr "" -#: ../../library/configparser.rst:807 +#: ../../library/configparser.rst:809 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -646,29 +646,29 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: ../../library/configparser.rst:813 +#: ../../library/configparser.rst:815 msgid "An example of writing to a configuration file::" msgstr "" -#: ../../library/configparser.rst:836 +#: ../../library/configparser.rst:838 msgid "An example of reading the configuration file again::" msgstr "" -#: ../../library/configparser.rst:854 +#: ../../library/configparser.rst:856 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: ../../library/configparser.rst:887 +#: ../../library/configparser.rst:889 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: ../../library/configparser.rst:905 +#: ../../library/configparser.rst:907 msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:909 +#: ../../library/configparser.rst:911 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -676,7 +676,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:914 +#: ../../library/configparser.rst:916 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -685,7 +685,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:920 +#: ../../library/configparser.rst:922 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -698,7 +698,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:930 +#: ../../library/configparser.rst:932 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -706,7 +706,7 @@ msgid "" "on runtime using the ``default_section`` instance attribute." msgstr "" -#: ../../library/configparser.rst:935 +#: ../../library/configparser.rst:937 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -715,7 +715,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:941 +#: ../../library/configparser.rst:943 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -724,7 +724,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:947 +#: ../../library/configparser.rst:949 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -733,44 +733,44 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:953 +#: ../../library/configparser.rst:955 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:956 +#: ../../library/configparser.rst:958 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:961 +#: ../../library/configparser.rst:963 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:964 +#: ../../library/configparser.rst:966 msgid "" "The *defaults* argument is read with :meth:`read_dict()`, providing " "consistent behavior across the parser: non-string keys and values are " "implicitly converted to strings." msgstr "" -#: ../../library/configparser.rst:969 ../../library/configparser.rst:1254 +#: ../../library/configparser.rst:971 ../../library/configparser.rst:1256 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:975 +#: ../../library/configparser.rst:977 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:980 +#: ../../library/configparser.rst:982 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:986 +#: ../../library/configparser.rst:988 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -778,34 +778,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:991 +#: ../../library/configparser.rst:993 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:997 +#: ../../library/configparser.rst:999 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1003 +#: ../../library/configparser.rst:1005 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1008 +#: ../../library/configparser.rst:1010 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1015 +#: ../../library/configparser.rst:1017 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1018 +#: ../../library/configparser.rst:1020 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -816,7 +816,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1027 +#: ../../library/configparser.rst:1029 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -824,49 +824,49 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1040 +#: ../../library/configparser.rst:1042 msgid "" "The *encoding* parameter. Previously, all files were read using the default " "encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1044 +#: ../../library/configparser.rst:1046 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1047 +#: ../../library/configparser.rst:1049 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1053 +#: ../../library/configparser.rst:1055 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1056 +#: ../../library/configparser.rst:1058 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1060 +#: ../../library/configparser.rst:1062 msgid "Replaces :meth:`readfp`." msgstr "" -#: ../../library/configparser.rst:1065 +#: ../../library/configparser.rst:1067 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1067 +#: ../../library/configparser.rst:1069 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1076 +#: ../../library/configparser.rst:1078 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -875,17 +875,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1082 +#: ../../library/configparser.rst:1084 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1085 +#: ../../library/configparser.rst:1087 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1092 +#: ../../library/configparser.rst:1094 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -894,35 +894,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1098 +#: ../../library/configparser.rst:1100 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1102 +#: ../../library/configparser.rst:1104 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1110 +#: ../../library/configparser.rst:1112 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1117 +#: ../../library/configparser.rst:1119 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1124 +#: ../../library/configparser.rst:1126 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -934,34 +934,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1137 +#: ../../library/configparser.rst:1139 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1140 +#: ../../library/configparser.rst:1142 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1144 +#: ../../library/configparser.rst:1146 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1152 +#: ../../library/configparser.rst:1154 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1159 +#: ../../library/configparser.rst:1161 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -970,27 +970,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1167 +#: ../../library/configparser.rst:1169 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1175 +#: ../../library/configparser.rst:1177 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1183 +#: ../../library/configparser.rst:1185 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1189 +#: ../../library/configparser.rst:1191 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -999,7 +999,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1195 +#: ../../library/configparser.rst:1197 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1007,46 +1007,46 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1203 +#: ../../library/configparser.rst:1205 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1209 +#: ../../library/configparser.rst:1211 msgid "Use :meth:`read_file` instead." msgstr "" -#: ../../library/configparser.rst:1212 +#: ../../library/configparser.rst:1214 msgid "" ":meth:`readfp` now iterates on *fp* instead of calling ``fp.readline()``." msgstr "" -#: ../../library/configparser.rst:1215 +#: ../../library/configparser.rst:1217 msgid "" "For existing code calling :meth:`readfp` with arguments which don't support " "iteration, the following generator may be used as a wrapper around the file-" "like object::" msgstr "" -#: ../../library/configparser.rst:1225 +#: ../../library/configparser.rst:1227 msgid "" "Instead of ``parser.readfp(fp)`` use ``parser." "read_file(readline_generator(fp))``." msgstr "" -#: ../../library/configparser.rst:1231 +#: ../../library/configparser.rst:1233 msgid "" "The maximum depth for recursive interpolation for :meth:`get` when the *raw* " "parameter is false. This is relevant only when the default *interpolation* " "is used." msgstr "" -#: ../../library/configparser.rst:1239 +#: ../../library/configparser.rst:1241 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1249 +#: ../../library/configparser.rst:1251 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1054,27 +1054,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1259 +#: ../../library/configparser.rst:1261 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1266 +#: ../../library/configparser.rst:1268 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1270 +#: ../../library/configparser.rst:1272 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1276 +#: ../../library/configparser.rst:1278 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1084,7 +1084,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1283 +#: ../../library/configparser.rst:1285 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1092,32 +1092,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1290 +#: ../../library/configparser.rst:1292 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1294 +#: ../../library/configparser.rst:1296 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1299 +#: ../../library/configparser.rst:1301 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1304 +#: ../../library/configparser.rst:1306 msgid "" "Exception raised if :meth:`add_section` is called with the name of a section " "that is already present or in strict parsers when a section if found more " "than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1308 +#: ../../library/configparser.rst:1310 msgid "" "Optional ``source`` and ``lineno`` attributes and arguments to :meth:" "`__init__` were added." msgstr "" -#: ../../library/configparser.rst:1315 +#: ../../library/configparser.rst:1317 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1125,58 +1125,58 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1323 +#: ../../library/configparser.rst:1325 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1329 +#: ../../library/configparser.rst:1331 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1335 +#: ../../library/configparser.rst:1337 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1342 +#: ../../library/configparser.rst:1344 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1348 +#: ../../library/configparser.rst:1350 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1354 +#: ../../library/configparser.rst:1356 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1360 +#: ../../library/configparser.rst:1362 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1362 +#: ../../library/configparser.rst:1364 msgid "" "The ``filename`` attribute and :meth:`__init__` argument were renamed to " "``source`` for consistency." msgstr "" -#: ../../library/configparser.rst:1368 +#: ../../library/configparser.rst:1370 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1369 +#: ../../library/configparser.rst:1371 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " diff --git a/library/contextlib.po b/library/contextlib.po index 591de86a60..d53e4f5c0e 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-25 17:41+0000\n" +"POT-Creation-Date: 2022-03-30 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -380,20 +380,26 @@ msgstr "" #: ../../library/contextlib.rst:488 msgid "" +"The :meth:`__enter__` method returns the :class:`ExitStack` instance, and " +"performs no additional operations." +msgstr "" + +#: ../../library/contextlib.rst:491 +msgid "" "Each instance maintains a stack of registered callbacks that are called in " "reverse order when the instance is closed (either explicitly or implicitly " "at the end of a :keyword:`with` statement). Note that callbacks are *not* " "invoked implicitly when the context stack instance is garbage collected." msgstr "" -#: ../../library/contextlib.rst:493 +#: ../../library/contextlib.rst:496 msgid "" "This stack model is used so that context managers that acquire their " "resources in their ``__init__`` method (such as file objects) can be handled " "correctly." msgstr "" -#: ../../library/contextlib.rst:497 +#: ../../library/contextlib.rst:500 msgid "" "Since registered callbacks are invoked in the reverse order of registration, " "this ends up behaving as if multiple nested :keyword:`with` statements had " @@ -403,7 +409,7 @@ msgid "" "updated state." msgstr "" -#: ../../library/contextlib.rst:504 +#: ../../library/contextlib.rst:507 msgid "" "This is a relatively low level API that takes care of the details of " "correctly unwinding the stack of exit callbacks. It provides a suitable " @@ -411,68 +417,68 @@ msgid "" "in application specific ways." msgstr "" -#: ../../library/contextlib.rst:513 +#: ../../library/contextlib.rst:516 msgid "" "Enters a new context manager and adds its :meth:`__exit__` method to the " "callback stack. The return value is the result of the context manager's own :" "meth:`__enter__` method." msgstr "" -#: ../../library/contextlib.rst:517 +#: ../../library/contextlib.rst:520 msgid "" "These context managers may suppress exceptions just as they normally would " "if used directly as part of a :keyword:`with` statement." msgstr "" -#: ../../library/contextlib.rst:522 +#: ../../library/contextlib.rst:525 msgid "Adds a context manager's :meth:`__exit__` method to the callback stack." msgstr "" -#: ../../library/contextlib.rst:524 +#: ../../library/contextlib.rst:527 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " "an :meth:`__enter__` implementation with a context manager's own :meth:" "`__exit__` method." msgstr "" -#: ../../library/contextlib.rst:528 +#: ../../library/contextlib.rst:531 msgid "" "If passed an object that is not a context manager, this method assumes it is " "a callback with the same signature as a context manager's :meth:`__exit__` " "method and adds it directly to the callback stack." msgstr "" -#: ../../library/contextlib.rst:532 +#: ../../library/contextlib.rst:535 msgid "" "By returning true values, these callbacks can suppress exceptions the same " "way context manager :meth:`__exit__` methods can." msgstr "" -#: ../../library/contextlib.rst:535 +#: ../../library/contextlib.rst:538 msgid "" "The passed in object is returned from the function, allowing this method to " "be used as a function decorator." msgstr "" -#: ../../library/contextlib.rst:540 +#: ../../library/contextlib.rst:543 msgid "" "Accepts an arbitrary callback function and arguments and adds it to the " "callback stack." msgstr "" -#: ../../library/contextlib.rst:543 +#: ../../library/contextlib.rst:546 msgid "" "Unlike the other methods, callbacks added this way cannot suppress " "exceptions (as they are never passed the exception details)." msgstr "" -#: ../../library/contextlib.rst:546 +#: ../../library/contextlib.rst:549 msgid "" "The passed in callback is returned from the function, allowing this method " "to be used as a function decorator." msgstr "" -#: ../../library/contextlib.rst:551 +#: ../../library/contextlib.rst:554 msgid "" "Transfers the callback stack to a fresh :class:`ExitStack` instance and " "returns it. No callbacks are invoked by this operation - instead, they will " @@ -480,70 +486,70 @@ msgid "" "at the end of a :keyword:`with` statement)." msgstr "" -#: ../../library/contextlib.rst:556 +#: ../../library/contextlib.rst:559 msgid "" "For example, a group of files can be opened as an \"all or nothing\" " "operation as follows::" msgstr "" -#: ../../library/contextlib.rst:570 +#: ../../library/contextlib.rst:573 msgid "" "Immediately unwinds the callback stack, invoking callbacks in the reverse " "order of registration. For any context managers and exit callbacks " "registered, the arguments passed in will indicate that no exception occurred." msgstr "" -#: ../../library/contextlib.rst:577 +#: ../../library/contextlib.rst:580 msgid "" "An :ref:`asynchronous context manager `, similar to :" "class:`ExitStack`, that supports combining both synchronous and asynchronous " "context managers, as well as having coroutines for cleanup logic." msgstr "" -#: ../../library/contextlib.rst:582 +#: ../../library/contextlib.rst:585 msgid "" "The :meth:`close` method is not implemented, :meth:`aclose` must be used " "instead." msgstr "" -#: ../../library/contextlib.rst:587 +#: ../../library/contextlib.rst:590 msgid "" "Similar to :meth:`enter_context` but expects an asynchronous context manager." msgstr "" -#: ../../library/contextlib.rst:592 +#: ../../library/contextlib.rst:595 msgid "" "Similar to :meth:`push` but expects either an asynchronous context manager " "or a coroutine function." msgstr "" -#: ../../library/contextlib.rst:597 +#: ../../library/contextlib.rst:600 msgid "Similar to :meth:`callback` but expects a coroutine function." msgstr "" -#: ../../library/contextlib.rst:601 +#: ../../library/contextlib.rst:604 msgid "Similar to :meth:`close` but properly handles awaitables." msgstr "" -#: ../../library/contextlib.rst:603 +#: ../../library/contextlib.rst:606 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: ../../library/contextlib.rst:615 +#: ../../library/contextlib.rst:618 msgid "Examples and Recipes" msgstr "" -#: ../../library/contextlib.rst:617 +#: ../../library/contextlib.rst:620 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: ../../library/contextlib.rst:622 +#: ../../library/contextlib.rst:625 msgid "Supporting a variable number of context managers" msgstr "" -#: ../../library/contextlib.rst:624 +#: ../../library/contextlib.rst:627 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -553,18 +559,18 @@ msgid "" "of the context managers being optional::" msgstr "" -#: ../../library/contextlib.rst:639 +#: ../../library/contextlib.rst:642 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: ../../library/contextlib.rst:645 +#: ../../library/contextlib.rst:648 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: ../../library/contextlib.rst:647 +#: ../../library/contextlib.rst:650 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " "method implementation, *without* inadvertently catching exceptions from the :" @@ -573,7 +579,7 @@ msgid "" "be separated slightly in order to allow this::" msgstr "" -#: ../../library/contextlib.rst:662 +#: ../../library/contextlib.rst:665 msgid "" "Actually needing to do this is likely to indicate that the underlying API " "should be providing a direct resource management interface for use with :" @@ -584,29 +590,29 @@ msgid "" "`with` statement." msgstr "" -#: ../../library/contextlib.rst:672 +#: ../../library/contextlib.rst:675 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: ../../library/contextlib.rst:674 +#: ../../library/contextlib.rst:677 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " "useful in cleaning up an already allocated resource if later steps in the :" "meth:`__enter__` implementation fail." msgstr "" -#: ../../library/contextlib.rst:678 +#: ../../library/contextlib.rst:681 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: ../../library/contextlib.rst:718 +#: ../../library/contextlib.rst:721 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: ../../library/contextlib.rst:720 +#: ../../library/contextlib.rst:723 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -614,57 +620,57 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: ../../library/contextlib.rst:734 +#: ../../library/contextlib.rst:737 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: ../../library/contextlib.rst:738 +#: ../../library/contextlib.rst:741 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: ../../library/contextlib.rst:750 +#: ../../library/contextlib.rst:753 msgid "" "This allows the intended cleanup up behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: ../../library/contextlib.rst:753 +#: ../../library/contextlib.rst:756 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: ../../library/contextlib.rst:771 +#: ../../library/contextlib.rst:774 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " "function, then it is still possible to use the decorator form of :meth:" "`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: ../../library/contextlib.rst:786 +#: ../../library/contextlib.rst:789 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: ../../library/contextlib.rst:792 +#: ../../library/contextlib.rst:795 msgid "Using a context manager as a function decorator" msgstr "" -#: ../../library/contextlib.rst:794 +#: ../../library/contextlib.rst:797 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: ../../library/contextlib.rst:797 +#: ../../library/contextlib.rst:800 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -673,15 +679,15 @@ msgid "" "in a single definition::" msgstr "" -#: ../../library/contextlib.rst:818 +#: ../../library/contextlib.rst:821 msgid "Instances of this class can be used as both a context manager::" msgstr "" -#: ../../library/contextlib.rst:824 +#: ../../library/contextlib.rst:827 msgid "And also as a function decorator::" msgstr "" -#: ../../library/contextlib.rst:831 +#: ../../library/contextlib.rst:834 msgid "" "Note that there is one additional limitation when using context managers as " "function decorators: there's no way to access the return value of :meth:" @@ -689,21 +695,21 @@ msgid "" "explicit ``with`` statement." msgstr "" -#: ../../library/contextlib.rst:839 +#: ../../library/contextlib.rst:842 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../library/contextlib.rst:839 +#: ../../library/contextlib.rst:842 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../library/contextlib.rst:845 +#: ../../library/contextlib.rst:848 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:847 +#: ../../library/contextlib.rst:850 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -711,32 +717,32 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: ../../library/contextlib.rst:853 +#: ../../library/contextlib.rst:856 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: ../../library/contextlib.rst:857 +#: ../../library/contextlib.rst:860 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: ../../library/contextlib.rst:861 +#: ../../library/contextlib.rst:864 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: ../../library/contextlib.rst:889 +#: ../../library/contextlib.rst:892 msgid "Reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:891 +#: ../../library/contextlib.rst:894 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -744,21 +750,21 @@ msgid "" "the same context manager." msgstr "" -#: ../../library/contextlib.rst:896 +#: ../../library/contextlib.rst:899 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " "are :func:`suppress` and :func:`redirect_stdout`. Here's a very simple " "example of reentrant use::" msgstr "" -#: ../../library/contextlib.rst:915 +#: ../../library/contextlib.rst:918 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: ../../library/contextlib.rst:919 +#: ../../library/contextlib.rst:922 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " @@ -766,11 +772,11 @@ msgid "" "stdout` to a different stream." msgstr "" -#: ../../library/contextlib.rst:928 +#: ../../library/contextlib.rst:931 msgid "Reusable context managers" msgstr "" -#: ../../library/contextlib.rst:930 +#: ../../library/contextlib.rst:933 msgid "" "Distinct from both single use and reentrant context managers are \"reusable" "\" context managers (or, to be completely explicit, \"reusable, but not " @@ -780,21 +786,21 @@ msgid "" "instance has already been used in a containing with statement." msgstr "" -#: ../../library/contextlib.rst:937 +#: ../../library/contextlib.rst:940 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " "context manager (for a reentrant lock, it is necessary to use :class:" "`threading.RLock` instead)." msgstr "" -#: ../../library/contextlib.rst:941 +#: ../../library/contextlib.rst:944 msgid "" "Another example of a reusable, but not reentrant, context manager is :class:" "`ExitStack`, as it invokes *all* currently registered callbacks when leaving " "any with statement, regardless of where those callbacks were added::" msgstr "" -#: ../../library/contextlib.rst:972 +#: ../../library/contextlib.rst:975 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -802,7 +808,7 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: ../../library/contextlib.rst:977 +#: ../../library/contextlib.rst:980 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" diff --git a/library/ctypes.po b/library/ctypes.po index 1000a2c1ba..5df037c7b0 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-24 00:11+0000\n" +"POT-Creation-Date: 2022-03-30 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2620,7 +2620,7 @@ msgstr "" #: ../../library/ctypes.rst:2515 msgid "" "The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a positive integer. Alternatively, you can " +"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " "subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " diff --git a/library/exceptions.po b/library/exceptions.po index b917114498..94ece3ad60 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-28 00:10+0000\n" +"POT-Creation-Date: 2022-03-30 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -293,7 +293,16 @@ msgid "" "the interpreter from exiting." msgstr "" -#: ../../library/exceptions.rst:252 +#: ../../library/exceptions.rst:251 +msgid "" +"Catching a :exc:`KeyboardInterrupt` requires special consideration. Because " +"it can be raised at unpredictable points, it may, in some circumstances, " +"leave the running program in an inconsistent state. It is generally best to " +"allow :exc:`KeyboardInterrupt` to end the program as quickly as possible or " +"avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" +msgstr "" + +#: ../../library/exceptions.rst:261 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " @@ -304,25 +313,25 @@ msgid "" "stack traceback can be printed, in case a run-away program was the cause." msgstr "" -#: ../../library/exceptions.rst:263 +#: ../../library/exceptions.rst:272 msgid "" "Raised when a local or global name is not found. This applies only to " "unqualified names. The associated value is an error message that includes " "the name that could not be found." msgstr "" -#: ../../library/exceptions.rst:267 +#: ../../library/exceptions.rst:276 msgid "" "The :attr:`name` attribute can be set using a keyword-only argument to the " "constructor. When set it represent the name of the variable that was " "attempted to be accessed." msgstr "" -#: ../../library/exceptions.rst:271 +#: ../../library/exceptions.rst:280 msgid "Added the :attr:`name` attribute." msgstr "新增 :attr:`name` 屬性。" -#: ../../library/exceptions.rst:277 +#: ../../library/exceptions.rst:286 msgid "" "This exception is derived from :exc:`RuntimeError`. In user defined base " "classes, abstract methods should raise this exception when they require " @@ -330,28 +339,28 @@ msgid "" "developed to indicate that the real implementation still needs to be added." msgstr "" -#: ../../library/exceptions.rst:284 +#: ../../library/exceptions.rst:293 msgid "" "It should not be used to indicate that an operator or method is not meant to " "be supported at all -- in that case either leave the operator / method " "undefined or, if a subclass, set it to :data:`None`." msgstr "" -#: ../../library/exceptions.rst:290 +#: ../../library/exceptions.rst:299 msgid "" "``NotImplementedError`` and ``NotImplemented`` are not interchangeable, even " "though they have similar names and purposes. See :data:`NotImplemented` for " "details on when to use it." msgstr "" -#: ../../library/exceptions.rst:299 +#: ../../library/exceptions.rst:308 msgid "" "This exception is raised when a system function returns a system-related " "error, including I/O failures such as \"file not found\" or \"disk full" "\" (not for illegal argument types or other incidental errors)." msgstr "" -#: ../../library/exceptions.rst:303 +#: ../../library/exceptions.rst:312 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " @@ -360,7 +369,7 @@ msgid "" "constructor arguments." msgstr "" -#: ../../library/exceptions.rst:309 +#: ../../library/exceptions.rst:318 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " @@ -369,18 +378,18 @@ msgid "" "subclassing." msgstr "" -#: ../../library/exceptions.rst:317 +#: ../../library/exceptions.rst:326 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "" -#: ../../library/exceptions.rst:321 +#: ../../library/exceptions.rst:330 msgid "" "Under Windows, this gives you the native Windows error code. The :attr:`." "errno` attribute is then an approximate translation, in POSIX terms, of that " "native error code." msgstr "" -#: ../../library/exceptions.rst:325 +#: ../../library/exceptions.rst:334 msgid "" "Under Windows, if the *winerror* constructor argument is an integer, the :" "attr:`.errno` attribute is determined from the Windows error code, and the " @@ -388,14 +397,14 @@ msgid "" "ignored, and the :attr:`winerror` attribute does not exist." msgstr "" -#: ../../library/exceptions.rst:333 +#: ../../library/exceptions.rst:342 msgid "" "The corresponding error message, as provided by the operating system. It is " "formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" "`FormatMessage` under Windows." msgstr "" -#: ../../library/exceptions.rst:341 +#: ../../library/exceptions.rst:350 msgid "" "For exceptions that involve a file system path (such as :func:`open` or :" "func:`os.unlink`), :attr:`filename` is the file name passed to the function. " @@ -404,14 +413,14 @@ msgid "" "the function." msgstr "" -#: ../../library/exceptions.rst:348 +#: ../../library/exceptions.rst:357 msgid "" ":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." "error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" "`OSError`, and the constructor may return a subclass." msgstr "" -#: ../../library/exceptions.rst:354 +#: ../../library/exceptions.rst:363 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " "function, instead of the name encoded to or decoded from the :term:" @@ -419,7 +428,7 @@ msgid "" "argument and attribute was added." msgstr "" -#: ../../library/exceptions.rst:363 +#: ../../library/exceptions.rst:372 msgid "" "Raised when the result of an arithmetic operation is too large to be " "represented. This cannot occur for integers (which would rather raise :exc:" @@ -429,18 +438,18 @@ msgid "" "in C, most floating point operations are not checked." msgstr "" -#: ../../library/exceptions.rst:373 +#: ../../library/exceptions.rst:382 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " "interpreter detects that the maximum recursion depth (see :func:`sys." "getrecursionlimit`) is exceeded." msgstr "" -#: ../../library/exceptions.rst:377 +#: ../../library/exceptions.rst:386 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/exceptions.rst:383 +#: ../../library/exceptions.rst:392 msgid "" "This exception is raised when a weak reference proxy, created by the :func:" "`weakref.proxy` function, is used to access an attribute of the referent " @@ -448,65 +457,65 @@ msgid "" "references, see the :mod:`weakref` module." msgstr "" -#: ../../library/exceptions.rst:391 +#: ../../library/exceptions.rst:400 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " "wrong." msgstr "" -#: ../../library/exceptions.rst:398 +#: ../../library/exceptions.rst:407 msgid "" "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" "`~iterator.__next__` method to signal that there are no further items " "produced by the iterator." msgstr "" -#: ../../library/exceptions.rst:402 +#: ../../library/exceptions.rst:411 msgid "" "The exception object has a single attribute :attr:`value`, which is given as " "an argument when constructing the exception, and defaults to :const:`None`." msgstr "" -#: ../../library/exceptions.rst:406 +#: ../../library/exceptions.rst:415 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" "`StopIteration` instance is raised, and the value returned by the function " "is used as the :attr:`value` parameter to the constructor of the exception." msgstr "" -#: ../../library/exceptions.rst:411 +#: ../../library/exceptions.rst:420 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -#: ../../library/exceptions.rst:415 +#: ../../library/exceptions.rst:424 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "" -#: ../../library/exceptions.rst:419 +#: ../../library/exceptions.rst:428 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." msgstr "" -#: ../../library/exceptions.rst:423 +#: ../../library/exceptions.rst:432 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." msgstr "" -#: ../../library/exceptions.rst:429 +#: ../../library/exceptions.rst:438 msgid "" "Must be raised by :meth:`__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." msgstr "" -#: ../../library/exceptions.rst:436 +#: ../../library/exceptions.rst:445 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" @@ -514,45 +523,45 @@ msgid "" "or standard input (also interactively)." msgstr "" -#: ../../library/exceptions.rst:442 +#: ../../library/exceptions.rst:451 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." msgstr "" -#: ../../library/exceptions.rst:447 +#: ../../library/exceptions.rst:456 msgid "The name of the file the syntax error occurred in." msgstr "" -#: ../../library/exceptions.rst:451 +#: ../../library/exceptions.rst:460 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" -#: ../../library/exceptions.rst:456 +#: ../../library/exceptions.rst:465 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." msgstr "" -#: ../../library/exceptions.rst:461 +#: ../../library/exceptions.rst:470 msgid "The source code text involved in the error." msgstr "" -#: ../../library/exceptions.rst:465 +#: ../../library/exceptions.rst:474 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." msgstr "" -#: ../../library/exceptions.rst:470 +#: ../../library/exceptions.rst:479 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." msgstr "" -#: ../../library/exceptions.rst:473 +#: ../../library/exceptions.rst:482 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -560,30 +569,30 @@ msgid "" "attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" -#: ../../library/exceptions.rst:478 +#: ../../library/exceptions.rst:487 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:483 +#: ../../library/exceptions.rst:492 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" -#: ../../library/exceptions.rst:489 +#: ../../library/exceptions.rst:498 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -#: ../../library/exceptions.rst:495 +#: ../../library/exceptions.rst:504 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " "a string indicating what went wrong (in low-level terms)." msgstr "" -#: ../../library/exceptions.rst:499 +#: ../../library/exceptions.rst:508 msgid "" "You should report this to the author or maintainer of your Python " "interpreter. Be sure to report the version of the Python interpreter (``sys." @@ -592,7 +601,7 @@ msgid "" "possible the source of the program that triggered the error." msgstr "" -#: ../../library/exceptions.rst:508 +#: ../../library/exceptions.rst:517 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -606,7 +615,7 @@ msgid "" "printed and the exit status is one." msgstr "" -#: ../../library/exceptions.rst:519 +#: ../../library/exceptions.rst:528 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -616,20 +625,20 @@ msgid "" "child process after a call to :func:`os.fork`)." msgstr "" -#: ../../library/exceptions.rst:528 +#: ../../library/exceptions.rst:537 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "" -#: ../../library/exceptions.rst:534 +#: ../../library/exceptions.rst:543 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -#: ../../library/exceptions.rst:537 +#: ../../library/exceptions.rst:546 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -637,7 +646,7 @@ msgid "" "implementation, :exc:`NotImplementedError` is the proper exception to raise." msgstr "" -#: ../../library/exceptions.rst:542 +#: ../../library/exceptions.rst:551 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" "class:`int` is expected) should result in a :exc:`TypeError`, but passing " @@ -645,135 +654,135 @@ msgid "" "should result in a :exc:`ValueError`." msgstr "" -#: ../../library/exceptions.rst:549 +#: ../../library/exceptions.rst:558 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass of :exc:" "`NameError`." msgstr "" -#: ../../library/exceptions.rst:556 +#: ../../library/exceptions.rst:565 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." msgstr "" -#: ../../library/exceptions.rst:559 +#: ../../library/exceptions.rst:568 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -#: ../../library/exceptions.rst:565 +#: ../../library/exceptions.rst:574 msgid "The name of the encoding that raised the error." msgstr "" -#: ../../library/exceptions.rst:569 +#: ../../library/exceptions.rst:578 msgid "A string describing the specific codec error." msgstr "" -#: ../../library/exceptions.rst:573 +#: ../../library/exceptions.rst:582 msgid "The object the codec was attempting to encode or decode." msgstr "" -#: ../../library/exceptions.rst:577 +#: ../../library/exceptions.rst:586 msgid "The first index of invalid data in :attr:`object`." msgstr "" -#: ../../library/exceptions.rst:581 +#: ../../library/exceptions.rst:590 msgid "The index after the last invalid data in :attr:`object`." msgstr "" -#: ../../library/exceptions.rst:586 +#: ../../library/exceptions.rst:595 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:592 +#: ../../library/exceptions.rst:601 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:598 +#: ../../library/exceptions.rst:607 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: ../../library/exceptions.rst:604 +#: ../../library/exceptions.rst:613 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -#: ../../library/exceptions.rst:611 +#: ../../library/exceptions.rst:620 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " "operation." msgstr "" -#: ../../library/exceptions.rst:616 +#: ../../library/exceptions.rst:625 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -#: ../../library/exceptions.rst:625 +#: ../../library/exceptions.rst:634 msgid "Only available on Windows." msgstr "" -#: ../../library/exceptions.rst:629 +#: ../../library/exceptions.rst:638 msgid "OS exceptions" msgstr "" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:640 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "" -#: ../../library/exceptions.rst:636 +#: ../../library/exceptions.rst:645 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` ``EAGAIN``, ``EALREADY``, " "``EWOULDBLOCK`` and ``EINPROGRESS``." msgstr "" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:650 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" -#: ../../library/exceptions.rst:646 +#: ../../library/exceptions.rst:655 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " "from the :mod:`io` module." msgstr "" -#: ../../library/exceptions.rst:652 +#: ../../library/exceptions.rst:661 msgid "" "Raised when an operation on a child process failed. Corresponds to :c:data:" "`errno` ``ECHILD``." msgstr "" -#: ../../library/exceptions.rst:657 +#: ../../library/exceptions.rst:666 msgid "A base class for connection-related issues." msgstr "" -#: ../../library/exceptions.rst:659 +#: ../../library/exceptions.rst:668 msgid "" "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError` and :exc:`ConnectionResetError`." msgstr "" -#: ../../library/exceptions.rst:664 +#: ../../library/exceptions.rst:673 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -781,56 +790,56 @@ msgid "" "``ESHUTDOWN``." msgstr "" -#: ../../library/exceptions.rst:671 +#: ../../library/exceptions.rst:680 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds to :c:data:`errno` ``ECONNABORTED``." msgstr "" -#: ../../library/exceptions.rst:677 +#: ../../library/exceptions.rst:686 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds to :c:data:`errno` ``ECONNREFUSED``." msgstr "" -#: ../../library/exceptions.rst:683 +#: ../../library/exceptions.rst:692 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` ``ECONNRESET``." msgstr "" -#: ../../library/exceptions.rst:689 +#: ../../library/exceptions.rst:698 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` ``EEXIST``." msgstr "" -#: ../../library/exceptions.rst:694 +#: ../../library/exceptions.rst:703 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` ``ENOENT``." msgstr "" -#: ../../library/exceptions.rst:699 +#: ../../library/exceptions.rst:708 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:data:`~errno.EINTR`." msgstr "" -#: ../../library/exceptions.rst:702 +#: ../../library/exceptions.rst:711 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -#: ../../library/exceptions.rst:709 +#: ../../library/exceptions.rst:718 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` ``EISDIR``." msgstr "" -#: ../../library/exceptions.rst:715 +#: ../../library/exceptions.rst:724 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -838,131 +847,131 @@ msgid "" "as if it were a directory. Corresponds to :c:data:`errno` ``ENOTDIR``." msgstr "" -#: ../../library/exceptions.rst:723 +#: ../../library/exceptions.rst:732 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds to :c:data:`errno` " "``EACCES`` and ``EPERM``." msgstr "" -#: ../../library/exceptions.rst:729 +#: ../../library/exceptions.rst:738 msgid "" "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` " "``ESRCH``." msgstr "" -#: ../../library/exceptions.rst:734 +#: ../../library/exceptions.rst:743 msgid "" "Raised when a system function timed out at the system level. Corresponds to :" "c:data:`errno` ``ETIMEDOUT``." msgstr "" -#: ../../library/exceptions.rst:737 +#: ../../library/exceptions.rst:746 msgid "All the above :exc:`OSError` subclasses were added." msgstr "" -#: ../../library/exceptions.rst:743 +#: ../../library/exceptions.rst:752 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr "" -#: ../../library/exceptions.rst:749 +#: ../../library/exceptions.rst:758 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:751 +#: ../../library/exceptions.rst:760 msgid "" "The following exceptions are used as warning categories; see the :ref:" "`warning-categories` documentation for more details." msgstr "" -#: ../../library/exceptions.rst:756 +#: ../../library/exceptions.rst:765 msgid "Base class for warning categories." msgstr "" -#: ../../library/exceptions.rst:761 +#: ../../library/exceptions.rst:770 msgid "Base class for warnings generated by user code." msgstr "" -#: ../../library/exceptions.rst:766 +#: ../../library/exceptions.rst:775 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "" -#: ../../library/exceptions.rst:769 +#: ../../library/exceptions.rst:778 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module (:" "pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " "warning." msgstr "" -#: ../../library/exceptions.rst:773 ../../library/exceptions.rst:789 +#: ../../library/exceptions.rst:782 ../../library/exceptions.rst:798 msgid "The deprecation policy is described in :pep:`387`." msgstr "" -#: ../../library/exceptions.rst:778 +#: ../../library/exceptions.rst:787 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "" -#: ../../library/exceptions.rst:782 +#: ../../library/exceptions.rst:791 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " "already active deprecations." msgstr "" -#: ../../library/exceptions.rst:786 ../../library/exceptions.rst:812 -#: ../../library/exceptions.rst:839 +#: ../../library/exceptions.rst:795 ../../library/exceptions.rst:821 +#: ../../library/exceptions.rst:848 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." msgstr "" -#: ../../library/exceptions.rst:794 +#: ../../library/exceptions.rst:803 msgid "Base class for warnings about dubious syntax." msgstr "" -#: ../../library/exceptions.rst:799 +#: ../../library/exceptions.rst:808 msgid "Base class for warnings about dubious runtime behavior." msgstr "" -#: ../../library/exceptions.rst:804 +#: ../../library/exceptions.rst:813 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." msgstr "" -#: ../../library/exceptions.rst:810 +#: ../../library/exceptions.rst:819 msgid "Base class for warnings about probable mistakes in module imports." msgstr "" -#: ../../library/exceptions.rst:818 +#: ../../library/exceptions.rst:827 msgid "Base class for warnings related to Unicode." msgstr "" -#: ../../library/exceptions.rst:823 +#: ../../library/exceptions.rst:832 msgid "Base class for warnings related to encodings." msgstr "" -#: ../../library/exceptions.rst:825 +#: ../../library/exceptions.rst:834 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`\\ 。" -#: ../../library/exceptions.rst:832 +#: ../../library/exceptions.rst:841 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/exceptions.rst:837 +#: ../../library/exceptions.rst:846 msgid "Base class for warnings related to resource usage." msgstr "" -#: ../../library/exceptions.rst:847 +#: ../../library/exceptions.rst:856 msgid "Exception hierarchy" msgstr "" -#: ../../library/exceptions.rst:849 +#: ../../library/exceptions.rst:858 msgid "The class hierarchy for built-in exceptions is:" msgstr "" diff --git a/library/grp.po b/library/grp.po index b18f4903d7..0a0514821a 100644 --- a/library/grp.po +++ b/library/grp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-03-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,7 @@ msgstr "" msgid "" "Group database entries are reported as a tuple-like object, whose attributes " "correspond to the members of the ``group`` structure (Attribute field below, " -"see ````):" +"see ````):" msgstr "" #: ../../library/grp.rst:18 diff --git a/library/pathlib.po b/library/pathlib.po index cbeb338ca8..1d75b7ec50 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-03-23 08:26+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -651,7 +651,7 @@ msgstr "" msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " -"directory after creating the iterator, whether an path object for that file " +"directory after creating the iterator, whether a path object for that file " "be included is unspecified." msgstr "" diff --git a/library/signal.po b/library/signal.po index f3c507cab4..7d67d7acc3 100644 --- a/library/signal.po +++ b/library/signal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-03-30 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,11 +79,18 @@ msgid "" "signal handlers will be called when the calculation finishes." msgstr "" -#: ../../library/signal.rst:54 +#: ../../library/signal.rst:49 +msgid "" +"If the handler raises an exception, it will be raised \"out of thin air\" in " +"the main thread. See the :ref:`note below ` for a " +"discussion." +msgstr "" + +#: ../../library/signal.rst:57 msgid "Signals and threads" msgstr "" -#: ../../library/signal.rst:56 +#: ../../library/signal.rst:59 msgid "" "Python signal handlers are always executed in the main Python thread of the " "main interpreter, even if the signal was received in another thread. This " @@ -92,17 +99,17 @@ msgid "" "instead." msgstr "" -#: ../../library/signal.rst:61 +#: ../../library/signal.rst:64 msgid "" "Besides, only the main thread of the main interpreter is allowed to set a " "new signal handler." msgstr "" -#: ../../library/signal.rst:65 +#: ../../library/signal.rst:68 msgid "Module contents" msgstr "模組內容" -#: ../../library/signal.rst:67 +#: ../../library/signal.rst:70 msgid "" "signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" "const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " @@ -111,11 +118,11 @@ msgid "" "functions return human-readable :class:`enums `." msgstr "" -#: ../../library/signal.rst:77 +#: ../../library/signal.rst:80 msgid "The variables defined in the :mod:`signal` module are:" msgstr "" -#: ../../library/signal.rst:82 +#: ../../library/signal.rst:85 msgid "" "This is one of two standard signal handling options; it will simply perform " "the default function for the signal. For example, on most systems the " @@ -123,118 +130,118 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" -#: ../../library/signal.rst:90 +#: ../../library/signal.rst:93 msgid "" "This is another standard signal handler, which will simply ignore the given " "signal." msgstr "" -#: ../../library/signal.rst:96 +#: ../../library/signal.rst:99 msgid "Abort signal from :manpage:`abort(3)`." msgstr "" -#: ../../library/signal.rst:100 +#: ../../library/signal.rst:103 msgid "Timer signal from :manpage:`alarm(2)`." msgstr "" -#: ../../library/signal.rst:102 ../../library/signal.rst:114 -#: ../../library/signal.rst:120 ../../library/signal.rst:130 -#: ../../library/signal.rst:144 ../../library/signal.rst:162 -#: ../../library/signal.rst:170 ../../library/signal.rst:184 -#: ../../library/signal.rst:190 ../../library/signal.rst:196 -#: ../../library/signal.rst:447 ../../library/signal.rst:454 +#: ../../library/signal.rst:105 ../../library/signal.rst:117 +#: ../../library/signal.rst:123 ../../library/signal.rst:133 +#: ../../library/signal.rst:147 ../../library/signal.rst:165 +#: ../../library/signal.rst:173 ../../library/signal.rst:187 +#: ../../library/signal.rst:193 ../../library/signal.rst:199 +#: ../../library/signal.rst:450 ../../library/signal.rst:457 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/signal.rst:106 +#: ../../library/signal.rst:109 msgid "Interrupt from keyboard (CTRL + BREAK)." msgstr "" -#: ../../library/signal.rst:108 ../../library/signal.rst:215 -#: ../../library/signal.rst:225 +#: ../../library/signal.rst:111 ../../library/signal.rst:218 +#: ../../library/signal.rst:228 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/signal.rst:112 +#: ../../library/signal.rst:115 msgid "Bus error (bad memory access)." msgstr "" -#: ../../library/signal.rst:118 +#: ../../library/signal.rst:121 msgid "Child process stopped or terminated." msgstr "" -#: ../../library/signal.rst:124 +#: ../../library/signal.rst:127 msgid "Alias to :data:`SIGCHLD`." msgstr "" -#: ../../library/signal.rst:128 +#: ../../library/signal.rst:131 msgid "Continue the process if it is currently stopped" msgstr "" -#: ../../library/signal.rst:134 +#: ../../library/signal.rst:137 msgid "Floating-point exception. For example, division by zero." msgstr "" -#: ../../library/signal.rst:137 +#: ../../library/signal.rst:140 msgid "" ":exc:`ZeroDivisionError` is raised when the second argument of a division or " "modulo operation is zero." msgstr "" -#: ../../library/signal.rst:142 +#: ../../library/signal.rst:145 msgid "" "Hangup detected on controlling terminal or death of controlling process." msgstr "" -#: ../../library/signal.rst:148 +#: ../../library/signal.rst:151 msgid "Illegal instruction." msgstr "" -#: ../../library/signal.rst:152 +#: ../../library/signal.rst:155 msgid "Interrupt from keyboard (CTRL + C)." msgstr "" -#: ../../library/signal.rst:154 +#: ../../library/signal.rst:157 msgid "Default action is to raise :exc:`KeyboardInterrupt`." msgstr "" -#: ../../library/signal.rst:158 +#: ../../library/signal.rst:161 msgid "Kill signal." msgstr "" -#: ../../library/signal.rst:160 +#: ../../library/signal.rst:163 msgid "It cannot be caught, blocked, or ignored." msgstr "" -#: ../../library/signal.rst:166 +#: ../../library/signal.rst:169 msgid "Broken pipe: write to pipe with no readers." msgstr "" -#: ../../library/signal.rst:168 +#: ../../library/signal.rst:171 msgid "Default action is to ignore the signal." msgstr "" -#: ../../library/signal.rst:174 +#: ../../library/signal.rst:177 msgid "Segmentation fault: invalid memory reference." msgstr "" -#: ../../library/signal.rst:178 +#: ../../library/signal.rst:181 msgid "Termination signal." msgstr "" -#: ../../library/signal.rst:182 +#: ../../library/signal.rst:185 msgid "User-defined signal 1." msgstr "" -#: ../../library/signal.rst:188 +#: ../../library/signal.rst:191 msgid "User-defined signal 2." msgstr "" -#: ../../library/signal.rst:194 +#: ../../library/signal.rst:197 msgid "Window resize signal." msgstr "" -#: ../../library/signal.rst:200 +#: ../../library/signal.rst:203 msgid "" "All the signal numbers are defined symbolically. For example, the hangup " "signal is defined as :const:`signal.SIGHUP`; the variable names are " @@ -245,35 +252,35 @@ msgid "" "only those names defined by the system are defined by this module." msgstr "" -#: ../../library/signal.rst:211 +#: ../../library/signal.rst:214 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -#: ../../library/signal.rst:221 +#: ../../library/signal.rst:224 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." msgstr "" -#: ../../library/signal.rst:231 +#: ../../library/signal.rst:234 msgid "One more than the number of the highest signal number." msgstr "" -#: ../../library/signal.rst:236 +#: ../../library/signal.rst:239 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "" -#: ../../library/signal.rst:242 +#: ../../library/signal.rst:245 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." msgstr "" -#: ../../library/signal.rst:248 +#: ../../library/signal.rst:251 msgid "" "Decrements interval timer both when the process executes and when the system " "is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this " @@ -281,29 +288,29 @@ msgid "" "and kernel space. SIGPROF is delivered upon expiration." msgstr "" -#: ../../library/signal.rst:256 +#: ../../library/signal.rst:259 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." msgstr "" -#: ../../library/signal.rst:263 +#: ../../library/signal.rst:266 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." msgstr "" -#: ../../library/signal.rst:270 +#: ../../library/signal.rst:273 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." msgstr "" -#: ../../library/signal.rst:276 +#: ../../library/signal.rst:279 msgid "The :mod:`signal` module defines one exception:" msgstr "" -#: ../../library/signal.rst:280 +#: ../../library/signal.rst:283 msgid "" "Raised to signal an error from the underlying :func:`setitimer` or :func:" "`getitimer` implementation. Expect this error if an invalid interval timer " @@ -311,17 +318,17 @@ msgid "" "of :exc:`OSError`." msgstr "" -#: ../../library/signal.rst:285 +#: ../../library/signal.rst:288 msgid "" "This error used to be a subtype of :exc:`IOError`, which is now an alias of :" "exc:`OSError`." msgstr "" -#: ../../library/signal.rst:290 +#: ../../library/signal.rst:293 msgid "The :mod:`signal` module defines the following functions:" msgstr "" -#: ../../library/signal.rst:295 +#: ../../library/signal.rst:298 msgid "" "If *time* is non-zero, this function requests that a :const:`SIGALRM` signal " "be sent to the process in *time* seconds. Any previously scheduled alarm is " @@ -332,13 +339,13 @@ msgid "" "scheduled." msgstr "" -#: ../../library/signal.rst:303 +#: ../../library/signal.rst:306 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`alarm(2)` for further information." msgstr "" -#: ../../library/signal.rst:308 +#: ../../library/signal.rst:311 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " "value may be a callable Python object, or one of the special values :const:" @@ -349,43 +356,43 @@ msgid "" "not installed from Python." msgstr "" -#: ../../library/signal.rst:319 +#: ../../library/signal.rst:322 msgid "" "Return the system description of the signal *signalnum*, such as \"Interrupt" "\", \"Segmentation fault\", etc. Returns :const:`None` if the signal is not " "recognized." msgstr "" -#: ../../library/signal.rst:328 +#: ../../library/signal.rst:331 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " "internal use." msgstr "" -#: ../../library/signal.rst:337 +#: ../../library/signal.rst:340 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." msgstr "" -#: ../../library/signal.rst:342 +#: ../../library/signal.rst:345 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`signal(2)` for further information." msgstr "" -#: ../../library/signal.rst:343 +#: ../../library/signal.rst:346 msgid "" "See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" "func:`sigpending`." msgstr "" -#: ../../library/signal.rst:349 +#: ../../library/signal.rst:352 msgid "Sends a signal to the calling process. Returns nothing." msgstr "" -#: ../../library/signal.rst:356 +#: ../../library/signal.rst:359 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " @@ -393,15 +400,15 @@ msgid "" "values are currently defined." msgstr "" -#: ../../library/signal.rst:361 +#: ../../library/signal.rst:364 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" -#: ../../library/signal.rst:363 +#: ../../library/signal.rst:366 msgid ":ref:`Availability `: Linux 5.1+" msgstr ":ref:`適用 `:Linux 5.1+" -#: ../../library/signal.rst:369 +#: ../../library/signal.rst:372 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " "same process as the caller. The target thread can be executing any code " @@ -412,94 +419,94 @@ msgid "" "running system call to fail with :exc:`InterruptedError`." msgstr "" -#: ../../library/signal.rst:377 +#: ../../library/signal.rst:380 msgid "" "Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -#: ../../library/signal.rst:381 +#: ../../library/signal.rst:384 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." msgstr "" -#: ../../library/signal.rst:384 +#: ../../library/signal.rst:387 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." msgstr "" -#: ../../library/signal.rst:388 +#: ../../library/signal.rst:391 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`pthread_kill(3)` for further information." msgstr "" -#: ../../library/signal.rst:389 +#: ../../library/signal.rst:392 msgid "See also :func:`os.kill`." msgstr "另請參閱 :func:`os.kill`\\ 。" -#: ../../library/signal.rst:396 +#: ../../library/signal.rst:399 msgid "" "Fetch and/or change the signal mask of the calling thread. The signal mask " "is the set of signals whose delivery is currently blocked for the caller. " "Return the old signal mask as a set of signals." msgstr "" -#: ../../library/signal.rst:400 +#: ../../library/signal.rst:403 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." msgstr "" -#: ../../library/signal.rst:402 +#: ../../library/signal.rst:405 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" -#: ../../library/signal.rst:404 +#: ../../library/signal.rst:407 msgid "" ":data:`SIG_UNBLOCK`: The signals in *mask* are removed from the current set " "of blocked signals. It is permissible to attempt to unblock a signal which " "is not blocked." msgstr "" -#: ../../library/signal.rst:407 +#: ../../library/signal.rst:410 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." msgstr "" -#: ../../library/signal.rst:410 +#: ../../library/signal.rst:413 msgid "" "*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" "`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " "including all signals." msgstr "" -#: ../../library/signal.rst:414 +#: ../../library/signal.rst:417 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." msgstr "" -#: ../../library/signal.rst:417 +#: ../../library/signal.rst:420 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." msgstr "" -#: ../../library/signal.rst:421 +#: ../../library/signal.rst:424 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` for further information." msgstr "" -#: ../../library/signal.rst:422 +#: ../../library/signal.rst:425 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`\\ 、\\ :func:`sigpending` 與 :func:`sigwait`。" -#: ../../library/signal.rst:429 +#: ../../library/signal.rst:432 msgid "" "Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" "`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " @@ -509,7 +516,7 @@ msgid "" "zero." msgstr "" -#: ../../library/signal.rst:436 +#: ../../library/signal.rst:439 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " @@ -517,21 +524,21 @@ msgid "" "`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -#: ../../library/signal.rst:442 +#: ../../library/signal.rst:445 msgid "The old values are returned as a tuple: (delay, interval)." msgstr "" -#: ../../library/signal.rst:444 +#: ../../library/signal.rst:447 msgid "" "Attempting to pass an invalid interval timer will cause an :exc:" "`ItimerError`." msgstr "" -#: ../../library/signal.rst:452 +#: ../../library/signal.rst:455 msgid "Returns current value of a given interval timer specified by *which*." msgstr "" -#: ../../library/signal.rst:459 +#: ../../library/signal.rst:462 msgid "" "Set the wakeup file descriptor to *fd*. When a signal is received, the " "signal number is written as a single byte into the fd. This can be used by " @@ -539,7 +546,7 @@ msgid "" "processed." msgstr "" -#: ../../library/signal.rst:464 +#: ../../library/signal.rst:467 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -547,7 +554,7 @@ msgid "" "*fd* before calling poll or select again." msgstr "" -#: ../../library/signal.rst:469 ../../library/signal.rst:523 +#: ../../library/signal.rst:472 ../../library/signal.rst:526 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -555,14 +562,14 @@ msgid "" "raised." msgstr "" -#: ../../library/signal.rst:474 +#: ../../library/signal.rst:477 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" -#: ../../library/signal.rst:479 +#: ../../library/signal.rst:482 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -573,7 +580,7 @@ msgid "" "warning to be printed to stderr when signals are lost." msgstr "" -#: ../../library/signal.rst:488 +#: ../../library/signal.rst:491 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -583,35 +590,35 @@ msgid "" "spurious warning messages." msgstr "" -#: ../../library/signal.rst:495 +#: ../../library/signal.rst:498 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../library/signal.rst:498 +#: ../../library/signal.rst:501 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:503 +#: ../../library/signal.rst:506 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " "system calls will be interrupted. Returns nothing." msgstr "" -#: ../../library/signal.rst:509 +#: ../../library/signal.rst:512 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`siginterrupt(3)` for further information." msgstr "" -#: ../../library/signal.rst:510 +#: ../../library/signal.rst:513 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:" "`siginterrupt` with a true *flag* value for the given signal." msgstr "" -#: ../../library/signal.rst:517 +#: ../../library/signal.rst:520 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " @@ -621,7 +628,7 @@ msgid "" "information.)" msgstr "" -#: ../../library/signal.rst:528 +#: ../../library/signal.rst:531 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -629,7 +636,7 @@ msgid "" "see the attribute descriptions in the :mod:`inspect` module)." msgstr "" -#: ../../library/signal.rst:533 +#: ../../library/signal.rst:536 msgid "" "On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" "`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" @@ -639,25 +646,25 @@ msgid "" "``SIG*`` module level constant." msgstr "" -#: ../../library/signal.rst:544 +#: ../../library/signal.rst:547 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " "set of the pending signals." msgstr "" -#: ../../library/signal.rst:550 +#: ../../library/signal.rst:553 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`sigpending(2)` for further information." msgstr "" -#: ../../library/signal.rst:551 +#: ../../library/signal.rst:554 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "" "另請參閱 :func:`pause`\\ 、\\ :func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:558 +#: ../../library/signal.rst:561 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -665,19 +672,19 @@ msgid "" "number." msgstr "" -#: ../../library/signal.rst:564 +#: ../../library/signal.rst:567 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`sigwait(3)` for further information." msgstr "" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:568 msgid "" "See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" "`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" -#: ../../library/signal.rst:573 +#: ../../library/signal.rst:576 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -688,7 +695,7 @@ msgid "" "`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" -#: ../../library/signal.rst:582 +#: ../../library/signal.rst:585 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" @@ -696,52 +703,53 @@ msgid "" "`si_band`." msgstr "" -#: ../../library/signal.rst:589 +#: ../../library/signal.rst:592 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`sigwaitinfo(2)` for further information." msgstr "" -#: ../../library/signal.rst:590 +#: ../../library/signal.rst:593 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." -msgstr "另請參閱 :func:`pause`\\ 、\\ :func:`sigwait` 與 :func:`sigtimedwait`。" +msgstr "" +"另請參閱 :func:`pause`\\ 、\\ :func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:594 +#: ../../library/signal.rst:597 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" -#: ../../library/signal.rst:602 +#: ../../library/signal.rst:605 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as :const:`0`, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" -#: ../../library/signal.rst:608 +#: ../../library/signal.rst:611 msgid "" ":ref:`Availability `: Unix. See the man page :manpage:" "`sigtimedwait(2)` for further information." msgstr "" -#: ../../library/signal.rst:609 +#: ../../library/signal.rst:612 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`\\ 、\\ :func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:613 +#: ../../library/signal.rst:616 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:625 msgid "Example" msgstr "範例" -#: ../../library/signal.rst:624 +#: ../../library/signal.rst:627 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -751,11 +759,11 @@ msgid "" "signal will be sent, and the handler raises an exception. ::" msgstr "" -#: ../../library/signal.rst:647 +#: ../../library/signal.rst:650 msgid "Note on SIGPIPE" msgstr "" -#: ../../library/signal.rst:649 +#: ../../library/signal.rst:652 msgid "" "Piping output of your program to tools like :manpage:`head(1)` will cause a :" "const:`SIGPIPE` signal to be sent to your process when the receiver of its " @@ -764,10 +772,40 @@ msgid "" "entry point to catch this exception as follows::" msgstr "" -#: ../../library/signal.rst:676 +#: ../../library/signal.rst:679 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " "unexpectedly also whenever any socket connection is interrupted while your " "program is still writing to it." msgstr "" + +#: ../../library/signal.rst:687 +msgid "Note on Signal Handlers and Exceptions" +msgstr "" + +#: ../../library/signal.rst:689 +msgid "" +"If a signal handler raises an exception, the exception will be propagated to " +"the main thread and may be raised after any :term:`bytecode` instruction. " +"Most notably, a :exc:`KeyboardInterrupt` may appear at any point during " +"execution. Most Python code, including the standard library, cannot be made " +"robust against this, and so a :exc:`KeyboardInterrupt` (or any other " +"exception resulting from a signal handler) may on rare occasions put the " +"program in an unexpected state." +msgstr "" + +#: ../../library/signal.rst:696 +msgid "To illustrate this issue, consider the following code::" +msgstr "" + +#: ../../library/signal.rst:713 +msgid "" +"For many programs, especially those that merely want to exit on :exc:" +"`KeyboardInterrupt`, this is not a problem, but applications that are " +"complex or require high reliability should avoid raising exceptions from " +"signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " +"a means of gracefully shutting down. Instead, they should install their " +"own :const:`SIGINT` handler. Below is an example of an HTTP server that " +"avoids :exc:`KeyboardInterrupt`::" +msgstr "" diff --git a/library/tempfile.po b/library/tempfile.po index 5332a8d1a5..3697f38e71 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-25 12:56+0000\n" +"POT-Creation-Date: 2022-03-24 00:12+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -137,9 +137,9 @@ msgstr "" #: ../../library/tempfile.rst:101 msgid "" -"This function operates exactly as :func:`TemporaryFile` does, except that " -"data is spooled in memory until the file size exceeds *max_size*, or until " -"the file's :func:`fileno` method is called, at which point the contents are " +"This class operates exactly as :func:`TemporaryFile` does, except that data " +"is spooled in memory until the file size exceeds *max_size*, or until the " +"file's :func:`fileno` method is called, at which point the contents are " "written to disk and operation proceeds as with :func:`TemporaryFile`." msgstr "" @@ -164,10 +164,10 @@ msgstr "" #: ../../library/tempfile.rst:126 msgid "" -"This function securely creates a temporary directory using the same rules " -"as :func:`mkdtemp`. The resulting object can be used as a context manager " -"(see :ref:`tempfile-examples`). On completion of the context or destruction " -"of the temporary directory object, the newly created temporary directory and " +"This class securely creates a temporary directory using the same rules as :" +"func:`mkdtemp`. The resulting object can be used as a context manager (see :" +"ref:`tempfile-examples`). On completion of the context or destruction of " +"the temporary directory object, the newly created temporary directory and " "all its contents are removed from the filesystem." msgstr "" diff --git a/library/typing.po b/library/typing.po index ac589f4f24..651a6b4aaa 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-13 00:13+0000\n" +"POT-Creation-Date: 2022-03-23 08:26+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -281,7 +281,7 @@ msgid "" msgstr "" #: ../../library/typing.rst:203 ../../library/typing.rst:1015 -#: ../../library/typing.rst:2177 +#: ../../library/typing.rst:2244 msgid "For example::" msgstr "" "舉例來說:\n" @@ -331,8 +331,8 @@ msgstr "" #: ../../library/typing.rst:250 msgid "" -"Generics can be parameterized by using a new factory available in typing " -"called :class:`TypeVar`." +"Generics can be parameterized by using a factory available in typing called :" +"class:`TypeVar`." msgstr "" #: ../../library/typing.rst:266 @@ -358,8 +358,8 @@ msgstr "" #: ../../library/typing.rst:307 msgid "" -"A generic type can have any number of type variables, and type variables may " -"be constrained::" +"A generic type can have any number of type variables. All varieties of :" +"class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" #: ../../library/typing.rst:319 @@ -770,7 +770,7 @@ msgid "" "passed in::" msgstr "" -#: ../../library/typing.rst:774 ../../library/typing.rst:1194 +#: ../../library/typing.rst:774 ../../library/typing.rst:1261 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)." @@ -871,7 +871,7 @@ msgid "" "be re-assigned or overridden in a subclass. For example::" msgstr "" -#: ../../library/typing.rst:893 ../../library/typing.rst:2072 +#: ../../library/typing.rst:893 ../../library/typing.rst:2139 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." @@ -1067,15 +1067,15 @@ msgstr "" msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1084 ../../library/typing.rst:1123 -#: ../../library/typing.rst:1300 +#: ../../library/typing.rst:1084 ../../library/typing.rst:1190 +#: ../../library/typing.rst:1367 msgid "Usage::" msgstr "" "用法:\n" "\n" "::" -#: ../../library/typing.rst:1089 +#: ../../library/typing.rst:1090 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -1083,37 +1083,64 @@ msgid "" "types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1102 +#: ../../library/typing.rst:1110 +msgid "" +"Note that type variables can be *bound*, *constrained*, or neither, but " +"cannot be both bound *and* constrained." +msgstr "" + +#: ../../library/typing.rst:1113 +msgid "" +"Constrained type variables and bound type variables have different semantics " +"in several important ways. Using a *constrained* type variable means that " +"the ``TypeVar`` can only ever be solved as being exactly one of the " +"constraints given::" +msgstr "" + +#: ../../library/typing.rst:1123 msgid "" -"The latter example's signature is essentially the overloading of ``(str, " -"str) -> str`` and ``(bytes, bytes) -> bytes``. Also note that if the " -"arguments are instances of some subclass of :class:`str`, the return type is " -"still plain :class:`str`." +"Using a *bound* type variable, however, means that the ``TypeVar`` will be " +"solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1107 +#: ../../library/typing.rst:1134 +msgid "" +"Type variables can be bound to concrete types, abstract types (ABCs or " +"protocols), and even unions of types::" +msgstr "" + +#: ../../library/typing.rst:1140 +msgid "" +"Bound type variables are particularly useful for annotating :func:" +"`classmethods ` that serve as alternative constructors. In the " +"following example (© `Raymond Hettinger `_), the type variable ``C`` is bound to the ``Circle`` class " +"through the use of a forward reference. Using this type variable to annotate " +"the ``with_circumference`` classmethod, rather than hardcoding the return " +"type as ``Circle``, means that a type checker can correctly infer the return " +"type even if the method is called on a subclass::" +msgstr "" + +#: ../../library/typing.rst:1178 msgid "" "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`. In general, :" "func:`isinstance` and :func:`issubclass` should not be used with types." msgstr "" -#: ../../library/typing.rst:1110 +#: ../../library/typing.rst:1181 msgid "" "Type variables may be marked covariant or contravariant by passing " "``covariant=True`` or ``contravariant=True``. See :pep:`484` for more " -"details. By default type variables are invariant. Alternatively, a type " -"variable may specify an upper bound using ``bound=``. This means that " -"an actual type substituted (explicitly or implicitly) for the type variable " -"must be a subclass of the boundary type, see :pep:`484`." +"details. By default, type variables are invariant." msgstr "" -#: ../../library/typing.rst:1120 +#: ../../library/typing.rst:1187 msgid "" "Parameter specification variable. A specialized version of :class:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1127 +#: ../../library/typing.rst:1194 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1123,7 +1150,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1134 +#: ../../library/typing.rst:1201 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -1131,27 +1158,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1158 +#: ../../library/typing.rst:1225 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1162 +#: ../../library/typing.rst:1229 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:1164 +#: ../../library/typing.rst:1231 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:1171 +#: ../../library/typing.rst:1238 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1164,7 +1191,7 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1181 +#: ../../library/typing.rst:1248 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1173,17 +1200,17 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1190 +#: ../../library/typing.rst:1257 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1196 +#: ../../library/typing.rst:1263 msgid ":class:`Callable` and :class:`Concatenate`." msgstr ":class:`Callable` 和 :class:`Concatenate`\\ 。" -#: ../../library/typing.rst:1201 +#: ../../library/typing.rst:1268 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1191,36 +1218,36 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1206 +#: ../../library/typing.rst:1273 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``::" msgstr "" -#: ../../library/typing.rst:1218 +#: ../../library/typing.rst:1285 msgid "" -"``AnyStr`` is a type variable defined as ``AnyStr = TypeVar('AnyStr', str, " -"bytes)``." +"``AnyStr`` is a :class:`constrained type variable ` defined as " +"``AnyStr = TypeVar('AnyStr', str, bytes)``." msgstr "" -#: ../../library/typing.rst:1221 +#: ../../library/typing.rst:1288 msgid "" "It is meant to be used for functions that may accept any kind of string " "without allowing different kinds of strings to mix. For example::" msgstr "" -#: ../../library/typing.rst:1233 +#: ../../library/typing.rst:1300 msgid "" "Base class for protocol classes. Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:1239 +#: ../../library/typing.rst:1306 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:1251 +#: ../../library/typing.rst:1318 msgid "" "See :pep:`544` for details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1228,15 +1255,15 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:1256 +#: ../../library/typing.rst:1323 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:1266 +#: ../../library/typing.rst:1333 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:1268 +#: ../../library/typing.rst:1335 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -1245,7 +1272,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/typing.rst:1281 +#: ../../library/typing.rst:1348 msgid "" ":func:`runtime_checkable` will check only the presence of the required " "methods, not their type signatures. For example, :class:`ssl.SSLObject` is a " @@ -1255,38 +1282,38 @@ msgid "" "making it impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:1292 +#: ../../library/typing.rst:1359 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1294 +#: ../../library/typing.rst:1361 msgid "" "These are not used in annotations. They are building blocks for declaring " "types." msgstr "" -#: ../../library/typing.rst:1298 +#: ../../library/typing.rst:1365 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1306 +#: ../../library/typing.rst:1373 msgid "This is equivalent to::" msgstr "" "這等價於:\n" "\n" "::" -#: ../../library/typing.rst:1310 +#: ../../library/typing.rst:1377 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1319 +#: ../../library/typing.rst:1386 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1321 +#: ../../library/typing.rst:1388 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -1294,52 +1321,52 @@ msgid "" "attribute both of which are part of the namedtuple API.)" msgstr "" -#: ../../library/typing.rst:1327 +#: ../../library/typing.rst:1394 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:1337 +#: ../../library/typing.rst:1404 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1408 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:1344 +#: ../../library/typing.rst:1411 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:1347 +#: ../../library/typing.rst:1414 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:1351 +#: ../../library/typing.rst:1418 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:1357 +#: ../../library/typing.rst:1424 msgid "" "A helper class to indicate a distinct type to a typechecker, see :ref:" "`distinct`. At runtime it returns an object that returns its argument when " "called. Usage::" msgstr "" -#: ../../library/typing.rst:1367 +#: ../../library/typing.rst:1434 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:1372 +#: ../../library/typing.rst:1439 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1442 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -1347,27 +1374,27 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:1391 +#: ../../library/typing.rst:1458 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " "syntactic forms::" msgstr "" -#: ../../library/typing.rst:1398 +#: ../../library/typing.rst:1465 msgid "" "The functional syntax should also be used when any of the keys are not " "valid :ref:`identifiers`, for example because they are keywords or contain " "hyphens. Example::" msgstr "" -#: ../../library/typing.rst:1410 +#: ../../library/typing.rst:1477 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "override this by specifying totality. Usage::" msgstr "" -#: ../../library/typing.rst:1418 +#: ../../library/typing.rst:1485 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -1375,37 +1402,37 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:1423 +#: ../../library/typing.rst:1490 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1497 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:1438 +#: ../../library/typing.rst:1505 msgid "" "A ``TypedDict`` cannot inherit from a non-TypedDict class, notably " "including :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:1456 +#: ../../library/typing.rst:1523 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:1462 +#: ../../library/typing.rst:1529 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example::" msgstr "" -#: ../../library/typing.rst:1479 +#: ../../library/typing.rst:1546 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " @@ -1415,152 +1442,152 @@ msgid "" "it from another ``TypedDict`` with a different value for ``total``. Usage::" msgstr "" -#: ../../library/typing.rst:1499 +#: ../../library/typing.rst:1566 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:1504 +#: ../../library/typing.rst:1571 msgid "Generic concrete collections" msgstr "" -#: ../../library/typing.rst:1507 +#: ../../library/typing.rst:1574 msgid "Corresponding to built-in types" msgstr "" -#: ../../library/typing.rst:1511 +#: ../../library/typing.rst:1578 msgid "" "A generic version of :class:`dict`. Useful for annotating return types. To " "annotate arguments it is preferred to use an abstract collection type such " "as :class:`Mapping`." msgstr "" -#: ../../library/typing.rst:1515 +#: ../../library/typing.rst:1582 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:1520 +#: ../../library/typing.rst:1587 msgid "" ":class:`builtins.dict ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1526 +#: ../../library/typing.rst:1593 msgid "" "Generic version of :class:`list`. Useful for annotating return types. To " "annotate arguments it is preferred to use an abstract collection type such " "as :class:`Sequence` or :class:`Iterable`." msgstr "" -#: ../../library/typing.rst:1531 +#: ../../library/typing.rst:1598 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:1541 +#: ../../library/typing.rst:1608 msgid "" ":class:`builtins.list ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1547 +#: ../../library/typing.rst:1614 msgid "" "A generic version of :class:`builtins.set `. Useful for annotating " "return types. To annotate arguments it is preferred to use an abstract " "collection type such as :class:`AbstractSet`." msgstr "" -#: ../../library/typing.rst:1551 +#: ../../library/typing.rst:1618 msgid "" ":class:`builtins.set ` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1624 msgid "A generic version of :class:`builtins.frozenset `." msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1626 msgid "" ":class:`builtins.frozenset ` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1563 +#: ../../library/typing.rst:1630 msgid ":data:`Tuple` is a special form." msgstr "" -#: ../../library/typing.rst:1566 +#: ../../library/typing.rst:1633 msgid "Corresponding to types in :mod:`collections`" msgstr "" -#: ../../library/typing.rst:1570 +#: ../../library/typing.rst:1637 msgid "A generic version of :class:`collections.defaultdict`." msgstr "" -#: ../../library/typing.rst:1574 +#: ../../library/typing.rst:1641 msgid "" ":class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1580 +#: ../../library/typing.rst:1647 msgid "A generic version of :class:`collections.OrderedDict`." msgstr "" -#: ../../library/typing.rst:1584 +#: ../../library/typing.rst:1651 msgid "" ":class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1657 msgid "A generic version of :class:`collections.ChainMap`." msgstr "" -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1662 msgid "" ":class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1601 +#: ../../library/typing.rst:1668 msgid "A generic version of :class:`collections.Counter`." msgstr "" -#: ../../library/typing.rst:1606 +#: ../../library/typing.rst:1673 msgid "" ":class:`collections.Counter` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1612 +#: ../../library/typing.rst:1679 msgid "A generic version of :class:`collections.deque`." msgstr "" -#: ../../library/typing.rst:1617 +#: ../../library/typing.rst:1684 msgid "" ":class:`collections.deque` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1622 +#: ../../library/typing.rst:1689 msgid "Other concrete types" msgstr "" -#: ../../library/typing.rst:1628 +#: ../../library/typing.rst:1695 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:1635 +#: ../../library/typing.rst:1702 msgid "" "The ``typing.io`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1640 +#: ../../library/typing.rst:1707 msgid "" "These type aliases correspond to the return types from :func:`re.compile` " "and :func:`re.match`. These types (and the corresponding functions) are " @@ -1568,413 +1595,413 @@ msgid "" "``Pattern[bytes]``, ``Match[str]``, or ``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:1650 +#: ../../library/typing.rst:1717 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:1651 +#: ../../library/typing.rst:1718 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1657 +#: ../../library/typing.rst:1724 msgid "" "``Text`` is an alias for ``str``. It is provided to supply a forward " "compatible path for Python 2 code: in Python 2, ``Text`` is an alias for " "``unicode``." msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1728 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1737 msgid "Abstract Base Classes" msgstr "" -#: ../../library/typing.rst:1673 +#: ../../library/typing.rst:1740 msgid "Corresponding to collections in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1677 +#: ../../library/typing.rst:1744 msgid "A generic version of :class:`collections.abc.Set`." msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1746 msgid "" ":class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and :ref:" "`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1752 msgid "A generic version of :class:`collections.abc.ByteString`." msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1754 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:1690 +#: ../../library/typing.rst:1757 msgid "" "As a shorthand for this type, :class:`bytes` can be used to annotate " "arguments of any of the types mentioned above." msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1760 msgid "" ":class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1766 msgid "A generic version of :class:`collections.abc.Collection`" msgstr "" -#: ../../library/typing.rst:1703 +#: ../../library/typing.rst:1770 msgid "" ":class:`collections.abc.Collection` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1709 +#: ../../library/typing.rst:1776 msgid "A generic version of :class:`collections.abc.Container`." msgstr "" -#: ../../library/typing.rst:1711 +#: ../../library/typing.rst:1778 msgid "" ":class:`collections.abc.Container` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1717 +#: ../../library/typing.rst:1784 msgid "A generic version of :class:`collections.abc.ItemsView`." msgstr "" -#: ../../library/typing.rst:1719 +#: ../../library/typing.rst:1786 msgid "" ":class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1725 +#: ../../library/typing.rst:1792 msgid "A generic version of :class:`collections.abc.KeysView`." msgstr "" -#: ../../library/typing.rst:1727 +#: ../../library/typing.rst:1794 msgid "" ":class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1733 +#: ../../library/typing.rst:1800 msgid "" "A generic version of :class:`collections.abc.Mapping`. This type can be used " "as follows::" msgstr "" -#: ../../library/typing.rst:1739 +#: ../../library/typing.rst:1806 msgid "" ":class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1812 msgid "A generic version of :class:`collections.abc.MappingView`." msgstr "" -#: ../../library/typing.rst:1747 +#: ../../library/typing.rst:1814 msgid "" ":class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1753 +#: ../../library/typing.rst:1820 msgid "A generic version of :class:`collections.abc.MutableMapping`." msgstr "" -#: ../../library/typing.rst:1755 +#: ../../library/typing.rst:1822 msgid "" ":class:`collections.abc.MutableMapping` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1761 +#: ../../library/typing.rst:1828 msgid "A generic version of :class:`collections.abc.MutableSequence`." msgstr "" -#: ../../library/typing.rst:1763 +#: ../../library/typing.rst:1830 msgid "" ":class:`collections.abc.MutableSequence` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1836 msgid "A generic version of :class:`collections.abc.MutableSet`." msgstr "" -#: ../../library/typing.rst:1771 +#: ../../library/typing.rst:1838 msgid "" ":class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1777 +#: ../../library/typing.rst:1844 msgid "A generic version of :class:`collections.abc.Sequence`." msgstr "" -#: ../../library/typing.rst:1779 +#: ../../library/typing.rst:1846 msgid "" ":class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1785 +#: ../../library/typing.rst:1852 msgid "A generic version of :class:`collections.abc.ValuesView`." msgstr "" -#: ../../library/typing.rst:1787 +#: ../../library/typing.rst:1854 msgid "" ":class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1859 msgid "Corresponding to other types in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:1796 +#: ../../library/typing.rst:1863 msgid "A generic version of :class:`collections.abc.Iterable`." msgstr "" -#: ../../library/typing.rst:1798 +#: ../../library/typing.rst:1865 msgid "" ":class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1871 msgid "A generic version of :class:`collections.abc.Iterator`." msgstr "" -#: ../../library/typing.rst:1806 +#: ../../library/typing.rst:1873 msgid "" ":class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1812 +#: ../../library/typing.rst:1879 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:1821 +#: ../../library/typing.rst:1888 msgid "" "Note that unlike many other generics in the typing module, the ``SendType`` " "of :class:`Generator` behaves contravariantly, not covariantly or " "invariantly." msgstr "" -#: ../../library/typing.rst:1825 +#: ../../library/typing.rst:1892 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1900 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1908 msgid "" ":class:`collections.abc.Generator` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1914 msgid "An alias to :class:`collections.abc.Hashable`" msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:1918 msgid "A generic version of :class:`collections.abc.Reversible`." msgstr "" -#: ../../library/typing.rst:1853 +#: ../../library/typing.rst:1920 msgid "" ":class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1859 +#: ../../library/typing.rst:1926 msgid "An alias to :class:`collections.abc.Sized`" msgstr "" -#: ../../library/typing.rst:1862 +#: ../../library/typing.rst:1929 msgid "Asynchronous programming" msgstr "" -#: ../../library/typing.rst:1866 +#: ../../library/typing.rst:1933 msgid "" "A generic version of :class:`collections.abc.Coroutine`. The variance and " "order of type variables correspond to those of :class:`Generator`, for " "example::" msgstr "" -#: ../../library/typing.rst:1878 +#: ../../library/typing.rst:1945 msgid "" ":class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1884 +#: ../../library/typing.rst:1951 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:1893 +#: ../../library/typing.rst:1960 msgid "" "Unlike normal generators, async generators cannot return a value, so there " "is no ``ReturnType`` type parameter. As with :class:`Generator`, the " "``SendType`` behaves contravariantly." msgstr "" -#: ../../library/typing.rst:1897 +#: ../../library/typing.rst:1964 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:1905 +#: ../../library/typing.rst:1972 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:1915 +#: ../../library/typing.rst:1982 msgid "" ":class:`collections.abc.AsyncGenerator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1921 +#: ../../library/typing.rst:1988 msgid "A generic version of :class:`collections.abc.AsyncIterable`." msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:1992 msgid "" ":class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1931 +#: ../../library/typing.rst:1998 msgid "A generic version of :class:`collections.abc.AsyncIterator`." msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:2002 msgid "" ":class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585` " "and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1941 +#: ../../library/typing.rst:2008 msgid "A generic version of :class:`collections.abc.Awaitable`." msgstr "" -#: ../../library/typing.rst:1945 +#: ../../library/typing.rst:2012 msgid "" ":class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585` and :" "ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1951 +#: ../../library/typing.rst:2018 msgid "Context manager types" msgstr "" -#: ../../library/typing.rst:1955 +#: ../../library/typing.rst:2022 msgid "A generic version of :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:1960 +#: ../../library/typing.rst:2027 msgid "" ":class:`contextlib.AbstractContextManager` now supports ``[]``. See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1966 +#: ../../library/typing.rst:2033 msgid "A generic version of :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:1971 +#: ../../library/typing.rst:2038 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:1976 +#: ../../library/typing.rst:2043 msgid "Protocols" msgstr "" -#: ../../library/typing.rst:1978 +#: ../../library/typing.rst:2045 msgid "These protocols are decorated with :func:`runtime_checkable`." msgstr "" -#: ../../library/typing.rst:1982 +#: ../../library/typing.rst:2049 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:2054 msgid "An ABC with one abstract method ``__bytes__``." msgstr "" -#: ../../library/typing.rst:1991 +#: ../../library/typing.rst:2058 msgid "An ABC with one abstract method ``__complex__``." msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:2062 msgid "An ABC with one abstract method ``__float__``." msgstr "" -#: ../../library/typing.rst:1999 +#: ../../library/typing.rst:2066 msgid "An ABC with one abstract method ``__index__``." msgstr "" -#: ../../library/typing.rst:2005 +#: ../../library/typing.rst:2072 msgid "An ABC with one abstract method ``__int__``." msgstr "" -#: ../../library/typing.rst:2009 +#: ../../library/typing.rst:2076 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2080 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2017 +#: ../../library/typing.rst:2084 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2019 +#: ../../library/typing.rst:2086 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2026 +#: ../../library/typing.rst:2093 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -1989,69 +2016,69 @@ msgid "" "variable::" msgstr "" -#: ../../library/typing.rst:2050 +#: ../../library/typing.rst:2117 msgid "See :pep:`484` for details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:2054 +#: ../../library/typing.rst:2121 msgid "" "A decorator to indicate to type checkers that the decorated method cannot be " "overridden, and the decorated class cannot be subclassed. For example::" msgstr "" -#: ../../library/typing.rst:2079 +#: ../../library/typing.rst:2146 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2081 +#: ../../library/typing.rst:2148 msgid "" "This works as class or function :term:`decorator`. With a class, it applies " "recursively to all methods defined in that class (but not to methods defined " "in its superclasses or subclasses)." msgstr "" -#: ../../library/typing.rst:2085 +#: ../../library/typing.rst:2152 msgid "This mutates the function(s) in place." msgstr "" -#: ../../library/typing.rst:2089 +#: ../../library/typing.rst:2156 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2091 +#: ../../library/typing.rst:2158 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2096 +#: ../../library/typing.rst:2163 msgid "Decorator to mark a class or function to be unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2165 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2176 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2113 +#: ../../library/typing.rst:2180 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2117 +#: ../../library/typing.rst:2184 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2120 +#: ../../library/typing.rst:2187 msgid "" "This is often the same as ``obj.__annotations__``. In addition, forward " "references encoded as string literals are handled by evaluating them in " @@ -2061,29 +2088,29 @@ msgid "" "merging all the ``__annotations__`` along ``C.__mro__`` in reverse order." msgstr "" -#: ../../library/typing.rst:2128 +#: ../../library/typing.rst:2195 msgid "" "The function recursively replaces all ``Annotated[T, ...]`` with ``T``, " "unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for " "more information). For example::" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2210 msgid "" ":func:`get_type_hints` does not work with imported :ref:`type aliases ` that include forward references. Enabling postponed evaluation of " "annotations (:pep:`563`) may remove the need for most forward references." msgstr "" -#: ../../library/typing.rst:2148 +#: ../../library/typing.rst:2215 msgid "Added ``include_extras`` parameter as part of :pep:`593`." msgstr "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。" -#: ../../library/typing.rst:2154 +#: ../../library/typing.rst:2221 msgid "Provide basic introspection for generic types and special typing forms." msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2223 msgid "" "For a typing object of the form ``X[Y, Z, ...]`` these functions return " "``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or :mod:" @@ -2094,11 +2121,11 @@ msgid "" "and ``()`` correspondingly. Examples::" msgstr "" -#: ../../library/typing.rst:2175 +#: ../../library/typing.rst:2242 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2190 +#: ../../library/typing.rst:2257 msgid "" "A class used for internal typing representation of string forward " "references. For example, ``List[\"SomeClass\"]`` is implicitly transformed " @@ -2106,24 +2133,24 @@ msgid "" "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2196 +#: ../../library/typing.rst:2263 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:2203 +#: ../../library/typing.rst:2270 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2274 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime. Usage::" msgstr "" -#: ../../library/typing.rst:2216 +#: ../../library/typing.rst:2283 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2131,7 +2158,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2290 msgid "" "If ``from __future__ import annotations`` is used in Python 3.7 or later, " "annotations are not evaluated at function definition time. Instead, they are "