diff --git a/.github/workflows/summarize_progress.yml b/.github/workflows/summarize_progress.yml index d0f454f759..ec594b0666 100644 --- a/.github/workflows/summarize_progress.yml +++ b/.github/workflows/summarize_progress.yml @@ -1,6 +1,7 @@ name: summarize_progress on: + workflow_dispatch: schedule: - cron: '30 23 * * 5' @@ -40,4 +41,4 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Weekly Update -- Summarize Progress - repository: markdown \ No newline at end of file + repository: markdown diff --git a/.scripts/summarize_progress/main.py b/.scripts/summarize_progress/main.py index 328fbfde6e..cee4ffca34 100644 --- a/.scripts/summarize_progress/main.py +++ b/.scripts/summarize_progress/main.py @@ -97,8 +97,9 @@ def format_issue_link(url: str) -> str: return f"[{url.split('/')[-1]}]({url})" if len(url) > 0 else '' -def format_line_file(filename: str, data: dict) -> str: - return f"|`{filename}`|{data['progress']}|{format_issue_link(data['issue'])}|{data['assignee']}|\r\n" +def format_line_file(dirname: str, filename: str, data: dict) -> str: + return f"|[`{filename}`](https://github.com/python/python-docs-zh-tw/tree/3.13/{dirname}/{filename})" + \ + f"|{data['progress']}|{format_issue_link(data['issue'])}|{data['assignee']}|\r\n" def format_line_directory(dirname: str) -> str: @@ -152,7 +153,7 @@ def format_line_directory(dirname: str) -> str: filedict_sorted = dict(sorted(filedict.items())) for filename, filedata in filedict_sorted.items(): - writeliner.append(format_line_file(filename, filedata)) + writeliner.append(format_line_file(dirname, filename, filedata)) with open( f"summarize_progress/result.md", diff --git a/TRANSLATORS b/TRANSLATORS index 0eac99e39c..772cb45f33 100644 --- a/TRANSLATORS +++ b/TRANSLATORS @@ -18,6 +18,7 @@ Steven Hsu (StevenHsuYL) Taihsiang Ho (tai271828) Tsai, Chia-Wen Wei-Hsiang (Matt) Wang +Weilin Du (LamentXU) Wilson Wang (Josix) Yu Chun Yang Jason (chairco) diff --git a/c-api/frame.po b/c-api/frame.po index da34208fb5..1bbe0b32c7 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -42,7 +42,7 @@ msgstr "" #: ../../c-api/frame.rst:20 msgid "See also :ref:`Reflection `." -msgstr "" +msgstr "另請參閱 :ref:`Reflection `。" #: ../../c-api/frame.rst:24 msgid "" diff --git a/c-api/init.po b/c-api/init.po index eaedaa945b..5d46190f3e 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -981,7 +981,7 @@ msgstr "" #: ../../c-api/init.rst:736 msgid "See also the :c:var:`Py_Version` constant." -msgstr "" +msgstr "另請參閱 :c:var:`Py_Version` 常數。" #: ../../c-api/init.rst:743 msgid "" @@ -2453,7 +2453,7 @@ msgstr "" #: ../../c-api/init.rst:2016 msgid "See also the :func:`sys.setprofile` function." -msgstr "" +msgstr "另請參閱 :func:`sys.setprofile` 函式。" #: ../../c-api/init.rst:2018 ../../c-api/init.rst:2025 #: ../../c-api/init.rst:2044 ../../c-api/init.rst:2051 diff --git a/c-api/init_config.po b/c-api/init_config.po index 3397a5853b..434dd0394e 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -810,7 +810,7 @@ msgstr "預設值:``NULL``。" #: ../../c-api/init_config.rst:580 msgid "See also the :c:member:`~PyConfig.orig_argv` member." -msgstr "" +msgstr "另請參閱 :c:member:`~PyConfig.orig_argv` 成員。" #: ../../c-api/init_config.rst:584 msgid "" @@ -1108,7 +1108,7 @@ msgstr "" #: ../../c-api/init_config.rst:791 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." -msgstr "" +msgstr "另請參閱 :c:member:`~PyConfig.filesystem_errors` 成員。" #: ../../c-api/init_config.rst:795 msgid "" @@ -1141,11 +1141,11 @@ msgstr "``\"surrogateescape\"``" #: ../../c-api/init_config.rst:808 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" -msgstr "" +msgstr "``\"surrogatepass\"``\\ (僅支援 UTF-8 編碼)" #: ../../c-api/init_config.rst:810 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." -msgstr "" +msgstr "另請參閱 :c:member:`~PyConfig.filesystem_encoding` 成員。" #: ../../c-api/init_config.rst:815 msgid "Randomized hash function seed." @@ -1159,7 +1159,7 @@ msgstr "" #: ../../c-api/init_config.rst:820 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." -msgstr "" +msgstr "由 :envvar:`PYTHONHASHSEED` 環境變數設定。" #: ../../c-api/init_config.rst:822 msgid "" @@ -1174,7 +1174,7 @@ msgstr "" #: ../../c-api/init_config.rst:830 msgid "Set by the :envvar:`PYTHONHOME` environment variable." -msgstr "" +msgstr "由 :envvar:`PYTHONHOME` 環境變數設定。" #: ../../c-api/init_config.rst:834 ../../c-api/init_config.rst:964 #: ../../c-api/init_config.rst:984 ../../c-api/init_config.rst:1073 diff --git a/c-api/sys.po b/c-api/sys.po index 9037d85432..79a6fb3f3f 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -371,7 +371,7 @@ msgstr "" #: ../../c-api/sys.rst:314 msgid "See also :c:func:`PySys_AuditTuple`." -msgstr "" +msgstr "請參閱 :c:func:`PySys_AuditTuple`。" #: ../../c-api/sys.rst:320 msgid "" diff --git a/howto/enum.po b/howto/enum.po index 924ee16d8a..92490f02e6 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1515,7 +1515,7 @@ msgstr "" #: ../../howto/enum.rst:806 msgid ":class:`IntFlag` members can also be iterated over::" -msgstr "" +msgstr ":class:`IntFlag` 成員也可以被疊代:" #: ../../howto/enum.rst:808 msgid "" @@ -1627,7 +1627,7 @@ msgstr "" #: ../../howto/enum.rst:866 msgid ":class:`Flag` members can also be iterated over::" -msgstr "" +msgstr ":class:`Flag` 成員也可以被疊代:" #: ../../howto/enum.rst:868 msgid "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 725f48933a..bb686c54de 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-21 00:13+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,8 +68,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" -"(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -100,8 +100,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = " -"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" +" self.logger = logging.getLogger('spam_application.auxiliary." +"Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -163,8 +163,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" -"(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " +"%(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -241,8 +241,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" -"(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -295,8 +295,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s %" -"(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s " +"%(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -504,9 +504,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the " -"``__main__.filter_maker`` in the filter configuration. You will need to " -"change that if you define it in a different module." +"command line, so its module will be ``__main__`` - hence the ``__main__." +"filter_maker`` in the filter configuration. You will need to change that if " +"you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -713,13 +713,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is " -"the :class:`SMTPHandler`: sending emails can take a long time, for a number " -"of reasons outside the developer's control (for example, a poorly performing " -"mail or network infrastructure). But almost any network-based handler can " -"block: Even a :class:`SocketHandler` operation may do a DNS query under the " -"hood which is too slow (and this query can be deep in the socket library " -"code, below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is the :class:" +"`SMTPHandler`: sending emails can take a long time, for a number of reasons " +"outside the developer's control (for example, a poorly performing mail or " +"network infrastructure). But almost any network-based handler can block: " +"Even a :class:`SocketHandler` operation may do a DNS query under the hood " +"which is too slow (and this query can be deep in the socket library code, " +"below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -739,12 +739,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. " -"A :class:`QueueListener` is very simple: it's passed a queue and some " -"handlers, and it fires up an internal thread which listens to its queue for " -"LogRecords sent from ``QueueHandlers`` (or any other source of " -"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " -"queue and passed to the handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. A :class:" +"`QueueListener` is very simple: it's passed a queue and some handlers, and " +"it fires up an internal thread which listens to its queue for LogRecords " +"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " +"matter). The ``LogRecords`` are removed from the queue and passed to the " +"handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -792,10 +792,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done " -"from :mod:`asyncio` internals. It might be best, if any async code is used " -"in an application, to use the above approach for logging, so that any " -"blocking code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done from :mod:" +"`asyncio` internals. It might be best, if any async code is used in an " +"application, to use the above approach for logging, so that any blocking " +"code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -817,8 +817,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:634 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching " -"a :class:`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching a :class:" +"`SocketHandler` instance to the root logger at the sending end::" msgstr "" #: ../../howto/logging-cookbook.rst:638 @@ -851,8 +851,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:662 msgid "" -"At the receiving end, you can set up a receiver using " -"the :mod:`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using the :mod:" +"`socketserver` module. Here is a basic working example::" msgstr "" #: ../../howto/logging-cookbook.rst:665 @@ -936,8 +936,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" -"(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " +"%(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -1070,8 +1070,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:811 msgid "" -"Download `the Gist `__ as a ZIP archive using " -"the :guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using the :" +"guilabel:`Download ZIP` button." msgstr "" #: ../../howto/logging-cookbook.rst:814 @@ -1155,8 +1155,8 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number " -"of :class:`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number of :class:" +"`Logger` instances becomes effectively unbounded." msgstr "" #: ../../howto/logging-cookbook.rst:873 @@ -1167,22 +1167,22 @@ msgstr "" msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can " -"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " -"and :meth:`log`. These methods have the same signatures as their " -"counterparts in :class:`Logger`, so you can use the two types of instances " -"interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can call :" +"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" +"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " +"signatures as their counterparts in :class:`Logger`, so you can use the two " +"types of instances interchangeably." msgstr "" #: ../../howto/logging-cookbook.rst:883 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it " -"a :class:`Logger` instance and a dict-like object which contains your " -"contextual information. When you call one of the logging methods on an " -"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " -"instance of :class:`Logger` passed to its constructor, and arranges to pass " -"the contextual information in the delegated call. Here's a snippet from the " -"code of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" +"`Logger` instance and a dict-like object which contains your contextual " +"information. When you call one of the logging methods on an instance of :" +"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" +"class:`Logger` passed to its constructor, and arranges to pass the " +"contextual information in the delegated call. Here's a snippet from the code " +"of :class:`LoggerAdapter`::" msgstr "" #: ../../howto/logging-cookbook.rst:891 @@ -1216,9 +1216,8 @@ msgid "" "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and " -"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " -"simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" +"`~LoggerAdapter.process` to do what you need. Here is a simple example::" msgstr "" #: ../../howto/logging-cookbook.rst:916 @@ -1267,23 +1266,23 @@ msgstr "" #: ../../howto/logging-cookbook.rst:946 msgid "" -"You can also add contextual information to log output using a user-" -"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-defined :" +"class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a " -"custom :class:`Formatter`." +"can then be output using a suitable format string, or if needed a custom :" +"class:`Formatter`." msgstr "" #: ../../howto/logging-cookbook.rst:951 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal " -"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " -"add, say, information from the request - say, the remote IP address and " -"remote user's username - to the ``LogRecord``, using the attribute names " -"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " -"same format string can be used to get similar output to that shown above. " -"Here's an example script::" +"the interesting parts of it) can be stored in a threadlocal (:class:" +"`threading.local`) variable, and then accessed from a ``Filter`` to add, " +"say, information from the request - say, the remote IP address and remote " +"user's username - to the ``LogRecord``, using the attribute names 'ip' and " +"'user' as in the ``LoggerAdapter`` example above. In that case, the same " +"format string can be used to get similar output to that shown above. Here's " +"an example script::" msgstr "" #: ../../howto/logging-cookbook.rst:960 @@ -1440,8 +1439,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from " -"192.168.2.XXX\n" +"# from this list randomly. Note that all GET requests are from 192.168.2." +"XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1459,8 +1458,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" -"(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " +"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1699,19 +1698,18 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this " -"function.) :ref:`This section ` documents this approach in " -"more detail and includes a working socket receiver which can be used as a " -"starting point for you to adapt in your own applications." +"thread in one of the existing processes to perform this function.) :ref:" +"`This section ` documents this approach in more detail and " +"includes a working socket receiver which can be used as a starting point for " +"you to adapt in your own applications." msgstr "" #: ../../howto/logging-cookbook.rst:1281 msgid "" -"You could also write your own handler which uses " -"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " -"module to serialize access to the file from your processes. The " -"stdlib :class:`FileHandler` and subclasses do not make use " -"of :mod:`multiprocessing`." +"You could also write your own handler which uses the :class:" +"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " +"serialize access to the file from your processes. The stdlib :class:" +"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" #: ../../howto/logging-cookbook.rst:1288 @@ -1762,8 +1760,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" -"(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " +"%(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1895,8 +1893,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" -"(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -2110,9 +2108,9 @@ msgstr "" msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting " -"approaches: :class:`string.Template` (added in Python 2.4) " -"and :meth:`str.format` (added in Python 2.6)." +"method. Since then, Python has gained two new formatting approaches: :class:" +"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " +"Python 2.6)." msgstr "" #: ../../howto/logging-cookbook.rst:1622 @@ -2123,9 +2121,9 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work " -"with :meth:`str.format` or :class:`string.Template`. Here's an example " -"console session to show the possibilities:" +"parameter, you get the ability to specify format strings which work with :" +"meth:`str.format` or :class:`string.Template`. Here's an example console " +"session to show the possibilities:" msgstr "" #: ../../howto/logging-cookbook.rst:1632 @@ -2175,12 +2173,12 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` " -"or :class:`string.Template` syntax, because internally the logging package " -"uses %-formatting to merge the format string and the variable arguments. " -"There would be no changing this while preserving backward compatibility, " -"since all logging calls which are out there in existing code will be using %-" -"format strings." +"you cannot directly make logging calls using :meth:`str.format` or :class:" +"`string.Template` syntax, because internally the logging package uses %-" +"formatting to merge the format string and the variable arguments. There " +"would be no changing this while preserving backward compatibility, since all " +"logging calls which are out there in existing code will be using %-format " +"strings." msgstr "" #: ../../howto/logging-cookbook.rst:1677 @@ -2333,10 +2331,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:1783 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, " -"a :class:`LogRecord` is created, populated with information about the event " -"and then passed to the handlers for that logger (and its ancestors, up to " -"and including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, a :class:" +"`LogRecord` is created, populated with information about the event and then " +"passed to the handlers for that logger (and its ancestors, up to and " +"including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" @@ -2352,22 +2350,21 @@ msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via " -"an :class:`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" +"`~handlers.HTTPHandler`)." msgstr "" #: ../../howto/logging-cookbook.rst:1799 msgid "" -"This has usually meant that if you need to do anything special with " -"a :class:`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with a :class:" +"`LogRecord`, you've had to do one of the following." msgstr "" #: ../../howto/logging-cookbook.rst:1802 msgid "" -"Create your own :class:`Logger` subclass, which " -"overrides :meth:`Logger.makeRecord`, and set it " -"using :func:`~logging.setLoggerClass` before any loggers that you care about " -"are instantiated." +"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." +"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " +"loggers that you care about are instantiated." msgstr "" #: ../../howto/logging-cookbook.rst:1805 @@ -2412,10 +2409,10 @@ msgstr "" msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate " -"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " -"same signature as the :class:`~logging.LogRecord` constructor, " -"as :class:`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" +"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " +"signature as the :class:`~logging.LogRecord` constructor, as :class:" +"`LogRecord` is the default setting for the factory." msgstr "" #: ../../howto/logging-cookbook.rst:1835 @@ -2535,10 +2532,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:1924 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " -"following snippets illustrate -- you can test them in an environment which " -"has ``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " +"snippets illustrate -- you can test them in an environment which has " +"``pynng`` installed. Just for variety, we present the listener first." msgstr "" #: ../../howto/logging-cookbook.rst:1934 @@ -2636,8 +2633,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s %" -"(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s " +"%(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2732,8 +2729,8 @@ msgstr "" msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed " -"to :func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed to :" +"func:`~config.dictConfig` to put the configuration into effect::" msgstr "" #: ../../howto/logging-cookbook.rst:2114 @@ -3114,13 +3111,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" -"(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" -"(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " +"%(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3224,9 +3221,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2465 msgid "" -"Attach a :class:`~logging.Formatter` instance to " -"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " -"such as::" +"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." +"handlers.SysLogHandler` instance, with a format string such as::" msgstr "" #: ../../howto/logging-cookbook.rst:2469 @@ -3394,9 +3390,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2588 msgid "" -"You can then specify, in a logging configuration passed " -"to :func:`dictConfig`, that a logging handler be created by calling this " -"function::" +"You can then specify, in a logging configuration passed to :func:" +"`dictConfig`, that a logging handler be created by calling this function::" msgstr "" #: ../../howto/logging-cookbook.rst:2591 @@ -3500,11 +3495,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2678 msgid "" -"Note that this example uses Python 3.3 because that's " -"where :func:`shutil.chown` makes an appearance. This approach should work " -"with any Python version that supports :func:`dictConfig` - namely, Python " -"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " -"actual ownership change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's where :func:`shutil." +"chown` makes an appearance. This approach should work with any Python " +"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " +"With pre-3.3 versions, you would need to implement the actual ownership " +"change using e.g. :func:`os.chown`." msgstr "" #: ../../howto/logging-cookbook.rst:2684 @@ -3570,12 +3565,11 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` " -"or :class:`string.Template` syntax, because internally the logging package " -"uses %-formatting to merge the format string and the variable arguments. " -"There would be no changing this while preserving backward compatibility, " -"since all logging calls which are out there in existing code will be using %-" -"format strings." +"directly make logging calls using :meth:`str.format` or :class:`string." +"Template` syntax, because internally the logging package uses %-formatting " +"to merge the format string and the variable arguments. There would be no " +"changing this while preserving backward compatibility, since all logging " +"calls which are out there in existing code will be using %-format strings." msgstr "" #: ../../howto/logging-cookbook.rst:2733 @@ -3615,8 +3609,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2757 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` " -"and :class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` and :" +"class:`LogRecord` for more information." msgstr "" #: ../../howto/logging-cookbook.rst:2762 @@ -3626,11 +3620,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2764 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall " -"(from :ref:`arbitrary-object-messages`) that when logging you can use an " -"arbitrary object as a message format string, and that the logging package " -"will call :func:`str` on that object to get the actual format string. " -"Consider the following two classes::" +"to construct your individual log messages. You may recall (from :ref:" +"`arbitrary-object-messages`) that when logging you can use an arbitrary " +"object as a message format string, and that the logging package will call :" +"func:`str` on that object to get the actual format string. Consider the " +"following two classes::" msgstr "" #: ../../howto/logging-cookbook.rst:2789 @@ -3646,8 +3640,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2797 msgid "" -"Examples of this approach are given below. Firstly, formatting " -"with :meth:`str.format`::" +"Examples of this approach are given below. Firstly, formatting with :meth:" +"`str.format`::" msgstr "" #: ../../howto/logging-cookbook.rst:2800 @@ -3699,13 +3693,13 @@ msgid "" "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your " -"own :class:`~logging.Filter` subclass with an " -"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " -"``()`` key in the configuration dictionary for the filter, specifying a " -"callable which will be used to create the filter (a class is the most " -"obvious, but you can provide any callable which returns " -"a :class:`~logging.Filter` instance). Here is a complete example::" +"only there as a base class), you will typically need to define your own :" +"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." +"filter` method. To do this, specify the ``()`` key in the configuration " +"dictionary for the filter, specifying a callable which will be used to " +"create the filter (a class is the most obvious, but you can provide any " +"callable which returns a :class:`~logging.Filter` instance). Here is a " +"complete example::" msgstr "" #: ../../howto/logging-cookbook.rst:2845 @@ -3918,14 +3912,14 @@ msgid "" "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler " -"using :mod:`subprocess`. It's assumed here that TTS command line programs " -"won't expect to interact with users or take a long time to complete, and " -"that the frequency of logged messages will be not so high as to swamp the " -"user with messages, and that it's acceptable to have the messages spoken one " -"at a time rather than concurrently, The example implementation below waits " -"for one message to be spoken before the next is processed, and this might " -"cause other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler using :mod:" +"`subprocess`. It's assumed here that TTS command line programs won't expect " +"to interact with users or take a long time to complete, and that the " +"frequency of logged messages will be not so high as to swamp the user with " +"messages, and that it's acceptable to have the messages spoken one at a time " +"rather than concurrently, The example implementation below waits for one " +"message to be spoken before the next is processed, and this might cause " +"other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" @@ -4017,9 +4011,9 @@ msgid "" "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to " -"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " -"``logging.ERROR`` and ``100`` respectively." +"the buffer (number of records buffered). These default to a :class:`~logging." +"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " +"respectively." msgstr "" #: ../../howto/logging-cookbook.rst:3059 @@ -4150,13 +4144,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3168 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can " -"subclass :class:`~logging.handlers.BufferingHandler`. In the following " -"example, which you can adapt to suit your specific needs, a simple test " -"harness is provided which allows you to run the script with command line " -"arguments specifying what you typically need to send things via SMTP. (Run " -"the downloaded script with the ``-h`` argument to see the required and " -"optional arguments.)" +"of messages are sent per email, you can subclass :class:`~logging.handlers." +"BufferingHandler`. In the following example, which you can adapt to suit " +"your specific needs, a simple test harness is provided which allows you to " +"run the script with command line arguments specifying what you typically " +"need to send things via SMTP. (Run the downloaded script with the ``-h`` " +"argument to see the required and optional arguments.)" msgstr "" #: ../../howto/logging-cookbook.rst:3176 @@ -4179,8 +4172,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" -"(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " +"%(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4256,10 +4249,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3259 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead " -"of :class:`~logging.Formatter`. If you want to do that via configuration, " -"you can use the :func:`~logging.config.dictConfig` API with an approach " -"illustrated by the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead of :class:" +"`~logging.Formatter`. If you want to do that via configuration, you can use " +"the :func:`~logging.config.dictConfig` API with an approach illustrated by " +"the following complete example::" msgstr "" #: ../../howto/logging-cookbook.rst:3264 @@ -4491,8 +4484,8 @@ msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, " -"``stop.py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, ``stop." +"py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" @@ -4532,8 +4525,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % " -"options.command)\n" +" print('Unable to find the code for command \\'%s\\'' % options." +"command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4685,8 +4678,8 @@ msgstr "" msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` " -"or :pypi:`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" +"`PyQt5` libraries." msgstr "" #: ../../howto/logging-cookbook.rst:3591 @@ -4897,8 +4890,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : " -"self.work_button.setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : self.work_button." +"setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -4975,9 +4968,8 @@ msgid "" "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, " -"the :class:`~logging.handlers.SysLogHandler` functionality has not been " -"updated." +"been widespread deployment of it in syslog servers, the :class:`~logging." +"handlers.SysLogHandler` functionality has not been updated." msgstr "" #: ../../howto/logging-cookbook.rst:3848 @@ -5007,8 +4999,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = " -"datetime.datetime.fromtimestamp(record.created).isoformat()\n" +" asctime = datetime.datetime.fromtimestamp(record.created)." +"isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -5143,11 +5135,13 @@ msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" +"INFO:demo:An INFO message\n" +"DEBUG:demo:A DEBUG message" #: ../../howto/logging-cookbook.rst:3977 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " -"``sys.stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." +"stderr`` by doing something like this:" msgstr "" #: ../../howto/logging-cookbook.rst:3980 @@ -5165,9 +5159,9 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3987 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the " -"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " -"instance). Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the ``sys." +"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " +"Then, you'd get this kind of result:" msgstr "" #: ../../howto/logging-cookbook.rst:3992 @@ -5186,9 +5180,9 @@ msgstr "" #: ../../howto/logging-cookbook.rst:4000 msgid "" -"Of course, the examples above show output according to the format used " -"by :func:`~logging.basicConfig`, but you can use a different formatter when " -"you configure logging." +"Of course, the examples above show output according to the format used by :" +"func:`~logging.basicConfig`, but you can use a different formatter when you " +"configure logging." msgstr "" #: ../../howto/logging-cookbook.rst:4004 @@ -5299,11 +5293,86 @@ msgstr "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4072 +#: ../../howto/logging-cookbook.rst:4069 +msgid "How to uniformly handle newlines in logging output" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4071 +msgid "" +"Usually, messages that are logged (say to console or file) consist of a " +"single line of text. However, sometimes there is a need to handle messages " +"with multiple lines - whether because a logging format string contains " +"newlines, or logged data contains newlines. If you want to handle such " +"messages uniformly, so that each line in the logged message appears " +"uniformly formatted as if it was logged separately, you can do this using a " +"handler mixin, as in the following snippet:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4079 +msgid "" +"# Assume this is in a module mymixins.py\n" +"import copy\n" +"\n" +"class MultilineMixin:\n" +" def emit(self, record):\n" +" s = record.getMessage()\n" +" if '\\n' not in s:\n" +" super().emit(record)\n" +" else:\n" +" lines = s.splitlines()\n" +" rec = copy.copy(record)\n" +" rec.args = None\n" +" for line in lines:\n" +" rec.msg = line\n" +" super().emit(rec)" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4097 +msgid "You can use the mixin as in the following script:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4099 +msgid "" +"import logging\n" +"\n" +"from mymixins import MultilineMixin\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"class StreamHandler(MultilineMixin, logging.StreamHandler):\n" +" pass\n" +"\n" +"if __name__ == '__main__':\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s " +"%(levelname)-9s %(message)s',\n" +" handlers = [StreamHandler()])\n" +" logger.debug('Single line')\n" +" logger.debug('Multiple lines:\\nfool me once ...')\n" +" logger.debug('Another single line')\n" +" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled " +"again')" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4118 +msgid "The script, when run, prints something like:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4120 +msgid "" +"2025-07-02 13:54:47,234 DEBUG Single line\n" +"2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" +"2025-07-02 13:54:47,234 DEBUG fool me once ...\n" +"2025-07-02 13:54:47,234 DEBUG Another single line\n" +"2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" +"2025-07-02 13:54:47,234 DEBUG fool me ...\n" +"2025-07-02 13:54:47,234 DEBUG can't get fooled again" +msgstr "" + +#: ../../howto/logging-cookbook.rst:4134 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4074 +#: ../../howto/logging-cookbook.rst:4136 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5311,11 +5380,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4142 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4082 +#: ../../howto/logging-cookbook.rst:4144 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5323,32 +5392,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4149 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4090 +#: ../../howto/logging-cookbook.rst:4152 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4093 +#: ../../howto/logging-cookbook.rst:4155 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4097 +#: ../../howto/logging-cookbook.rst:4159 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4100 +#: ../../howto/logging-cookbook.rst:4162 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5357,7 +5426,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4106 +#: ../../howto/logging-cookbook.rst:4168 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5367,17 +5436,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4113 +#: ../../howto/logging-cookbook.rst:4175 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4117 +#: ../../howto/logging-cookbook.rst:4179 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4119 +#: ../../howto/logging-cookbook.rst:4181 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5388,13 +5457,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4128 +#: ../../howto/logging-cookbook.rst:4190 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4130 +#: ../../howto/logging-cookbook.rst:4192 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5402,11 +5471,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4136 +#: ../../howto/logging-cookbook.rst:4198 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4138 +#: ../../howto/logging-cookbook.rst:4200 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5417,38 +5486,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4211 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4153 +#: ../../howto/logging-cookbook.rst:4215 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4154 +#: ../../howto/logging-cookbook.rst:4216 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4156 +#: ../../howto/logging-cookbook.rst:4218 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4157 +#: ../../howto/logging-cookbook.rst:4219 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4159 +#: ../../howto/logging-cookbook.rst:4221 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4160 +#: ../../howto/logging-cookbook.rst:4222 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4162 +#: ../../howto/logging-cookbook.rst:4224 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4164 +#: ../../howto/logging-cookbook.rst:4226 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 65aa9231e1..9d69ab5503 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -1603,7 +1603,7 @@ msgstr "" #: ../../library/asyncio-task.rst:1189 msgid "Added support for the :mod:`contextvars` module." -msgstr "" +msgstr "新增對 :mod:`contextvars` 模組的支援。" #: ../../library/asyncio-task.rst:1195 msgid "" diff --git a/library/asyncio.po b/library/asyncio.po index dab5421359..996c4a1340 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -5,13 +5,14 @@ # Adrian Liaw , 2018 # Matt Wang , 2021 # Leo Wang , 2023 +# Weilin Du, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-10-11 00:13+0000\n" -"PO-Revision-Date: 2021-11-23 12:40+0800\n" -"Last-Translator: Matt Wang \n" +"PO-Revision-Date: 2025-07-06 17:13+0800\n" +"Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -19,7 +20,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0\n" #: ../../library/asyncio.rst:91 msgid "High-level APIs" @@ -149,7 +149,7 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "可用性" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -194,17 +194,19 @@ msgstr "" msgid "" "Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " "arguments." -msgstr "" +msgstr "產生一個 :ref:`稽核事件 ` `cpython.run_stdin`` 且沒有引數。" #: ../../library/asyncio.rst:79 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." -msgstr "" +msgstr "(也包括 3.11.10、3.10.15、3.9.20 及 3.8.20)發出稽核事件。" #: ../../library/asyncio.rst:82 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" +"可能的話使用 PyREPL,在這種情況下 :envvar:`PYTHONSTARTUP` 也會被執行。發出稽核" +"事件。" #: ../../library/asyncio.rst:90 msgid "Reference" diff --git a/library/bdb.po b/library/bdb.po index 5f1e59843e..3dcb927100 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -124,11 +124,11 @@ msgstr "" #: ../../library/bdb.rst:77 msgid ":class:`Breakpoint` instances have the following attributes:" -msgstr "" +msgstr ":class:`Breakpoint` 實例有以下屬性:" #: ../../library/bdb.rst:81 msgid "File name of the :class:`Breakpoint`." -msgstr "" +msgstr ":class:`Breakpoint` 的檔案名稱。" #: ../../library/bdb.rst:85 msgid "Line number of the :class:`Breakpoint` within :attr:`file`." diff --git a/library/bz2.po b/library/bz2.po index 9424d42055..f0ec58fb6a 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -154,7 +154,7 @@ msgstr "" #: ../../library/bz2.rst:94 msgid ":class:`BZ2File` also provides the following methods and attributes:" -msgstr "" +msgstr ":class:`BZ2File` 也提供了以下方法和屬性:" #: ../../library/bz2.rst:98 msgid "" diff --git a/library/codecs.po b/library/codecs.po index 0079868039..c7f61788ff 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -2298,7 +2298,7 @@ msgstr "" #: ../../library/codecs.rst:1315 msgid "``cp65001`` is now an alias to ``utf_8``." -msgstr "" +msgstr "``cp65001`` 現在是 ``utf_8`` 的別名。" #: ../../library/codecs.rst:1320 msgid "Python Specific Encodings" diff --git a/library/datetime.po b/library/datetime.po index 7497e0bffb..5078659845 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -1394,7 +1394,7 @@ msgstr "" #: ../../library/datetime.rst:882 msgid "Constructor:" -msgstr "" +msgstr "建構函式:" #: ../../library/datetime.rst:886 msgid "" @@ -1433,7 +1433,7 @@ msgstr "``0 <= microsecond < 1000000``," #: ../../library/datetime.rst:897 ../../library/datetime.rst:1775 msgid "``fold in [0, 1]``." -msgstr "" +msgstr "``fold in [0, 1]``。" #: ../../library/datetime.rst:901 ../../library/datetime.rst:1342 #: ../../library/datetime.rst:1920 diff --git a/library/dbm.po b/library/dbm.po index 473658aa90..e6eb743921 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -237,7 +237,7 @@ msgstr "" #: ../../library/dbm.rst:148 msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" -msgstr "" +msgstr ":mod:`dbm.sqlite3` --- dbm 的 SQLite 後端" #: ../../library/dbm.rst:156 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" diff --git a/library/difflib.po b/library/difflib.po index f637faac83..c0d1130505 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -471,7 +471,7 @@ msgstr "" #: ../../library/difflib.rst:399 msgid ":class:`SequenceMatcher` objects have the following methods:" -msgstr "" +msgstr ":class:`SequenceMatcher` 物件有以下方法:" #: ../../library/difflib.rst:403 msgid "Set the two sequences to be compared." @@ -590,7 +590,7 @@ msgstr "``'replace'``" #: ../../library/difflib.rst:498 msgid "``a[i1:i2]`` should be replaced by ``b[j1:j2]``." -msgstr "" +msgstr "``a[i1:i2]`` 應該被替換為 ``b[j1:j2]``。" #: ../../library/difflib.rst:501 msgid "``'delete'``" @@ -598,7 +598,7 @@ msgstr "``'delete'``" #: ../../library/difflib.rst:501 msgid "``a[i1:i2]`` should be deleted. Note that ``j1 == j2`` in this case." -msgstr "" +msgstr "``a[i1:i2]`` 應該被刪除。請注意,在這種情況下 ``j1 == j2``。" #: ../../library/difflib.rst:504 msgid "``'insert'``" @@ -781,7 +781,7 @@ msgstr "" #: ../../library/difflib.rst:649 msgid "The :class:`Differ` class has this constructor:" -msgstr "" +msgstr ":class:`Differ` 類別有這個建構函式:" #: ../../library/difflib.rst:655 msgid "" @@ -867,7 +867,7 @@ msgstr "" #: ../../library/difflib.rst:757 msgid "A command-line interface to difflib" -msgstr "" +msgstr "difflib 的命令列介面" #: ../../library/difflib.rst:759 msgid "" @@ -940,6 +940,69 @@ msgid "" "if __name__ == '__main__':\n" " main()\n" msgstr "" +"\"\"\" Command line interface to difflib.py providing diffs in four " +"formats:\n" +"\n" +"* ndiff: lists every line and highlights interline changes.\n" +"* context: highlights clusters of changes in a before/after format.\n" +"* unified: highlights clusters of changes in an inline format.\n" +"* html: generates side by side comparison with change highlights.\n" +"\n" +"\"\"\"\n" +"\n" +"import sys, os, difflib, argparse\n" +"from datetime import datetime, timezone\n" +"\n" +"def file_mtime(path):\n" +" t = datetime.fromtimestamp(os.stat(path).st_mtime,\n" +" timezone.utc)\n" +" return t.astimezone().isoformat()\n" +"\n" +"def main():\n" +"\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-c', action='store_true', default=False,\n" +" help='Produce a context format diff (default)')\n" +" parser.add_argument('-u', action='store_true', default=False,\n" +" help='Produce a unified format diff')\n" +" parser.add_argument('-m', action='store_true', default=False,\n" +" help='Produce HTML side by side diff '\n" +" '(can use -c and -l in conjunction)')\n" +" parser.add_argument('-n', action='store_true', default=False,\n" +" help='Produce a ndiff format diff')\n" +" parser.add_argument('-l', '--lines', type=int, default=3,\n" +" help='Set number of context lines (default 3)')\n" +" parser.add_argument('fromfile')\n" +" parser.add_argument('tofile')\n" +" options = parser.parse_args()\n" +"\n" +" n = options.lines\n" +" fromfile = options.fromfile\n" +" tofile = options.tofile\n" +"\n" +" fromdate = file_mtime(fromfile)\n" +" todate = file_mtime(tofile)\n" +" with open(fromfile) as ff:\n" +" fromlines = ff.readlines()\n" +" with open(tofile) as tf:\n" +" tolines = tf.readlines()\n" +"\n" +" if options.u:\n" +" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" +" elif options.n:\n" +" diff = difflib.ndiff(fromlines, tolines)\n" +" elif options.m:\n" +" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile," +"tofile,context=options.c,numlines=n)\n" +" else:\n" +" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" +"\n" +" sys.stdout.writelines(diff)\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" #: ../../library/difflib.rst:764 msgid "ndiff example" diff --git a/library/dis.po b/library/dis.po index e1585fde13..e2b3b3abee 100644 --- a/library/dis.po +++ b/library/dis.po @@ -504,7 +504,7 @@ msgstr "" #: ../../library/dis.rst:397 msgid "Python Bytecode Instructions" -msgstr "" +msgstr "Python 位元組碼指令" #: ../../library/dis.rst:399 msgid "" @@ -514,7 +514,7 @@ msgstr "" #: ../../library/dis.rst:404 msgid "Details for a bytecode operation" -msgstr "" +msgstr "位元組碼操作的詳細資訊" #: ../../library/dis.rst:408 msgid "" @@ -524,7 +524,7 @@ msgstr "" #: ../../library/dis.rst:414 msgid "human readable name for operation" -msgstr "" +msgstr "操作的可讀名稱" #: ../../library/dis.rst:419 msgid "" @@ -544,7 +544,7 @@ msgstr "" #: ../../library/dis.rst:435 msgid "alias for :data:`arg`" -msgstr "" +msgstr ":data:`arg` 的別名。" #: ../../library/dis.rst:439 msgid "resolved arg value (if any), otherwise ``None``" @@ -634,7 +634,7 @@ msgstr "" #: ../../library/dis.rst:533 msgid "**General instructions**" -msgstr "" +msgstr "**一般指令**" #: ../../library/dis.rst:535 msgid "" @@ -723,11 +723,11 @@ msgstr "" #: ../../library/dis.rst:615 msgid "Implements ``STACK[-1] = -STACK[-1]``." -msgstr "" +msgstr "實作 ``STACK[-1] = -STACK[-1]``。" #: ../../library/dis.rst:620 msgid "Implements ``STACK[-1] = not STACK[-1]``." -msgstr "" +msgstr "實作 ``STACK[-1] = not STACK[-1]``。" #: ../../library/dis.rst:622 ../../library/dis.rst:1318 #: ../../library/dis.rst:1334 @@ -736,11 +736,11 @@ msgstr "" #: ../../library/dis.rst:628 msgid "Implements ``STACK[-1] = ~STACK[-1]``." -msgstr "" +msgstr "實作 ``STACK[-1] = ~STACK[-1]``。" #: ../../library/dis.rst:633 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." -msgstr "" +msgstr "實作 ``STACK[-1] = iter(STACK[-1])``。" #: ../../library/dis.rst:638 msgid "" @@ -1658,11 +1658,11 @@ msgstr "" #: ../../library/dis.rst:1507 ../../library/dis.rst:1531 msgid "``self`` or ``NULL``" -msgstr "" +msgstr "``self`` 或 ``NULL``" #: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The remaining positional arguments" -msgstr "" +msgstr "剩餘的位置引數" #: ../../library/dis.rst:1510 msgid "``argc`` is the total of the positional arguments, excluding ``self``." @@ -2316,9 +2316,3 @@ msgstr "built-in function(內建函式)" #: ../../library/dis.rst:1602 msgid "slice" msgstr "slice(切片)" - -#~ msgid "or:" -#~ msgstr "或:" - -#~ msgid "``self``" -#~ msgstr "``self``" diff --git a/library/doctest.po b/library/doctest.po index e23645d07a..1e8a7c2bce 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -2034,7 +2034,7 @@ msgstr "" #: ../../library/doctest.rst:1383 msgid ":class:`DocTestFinder` defines the following method:" -msgstr "" +msgstr ":class:`DocTestFinder` 定義了以下方法:" #: ../../library/doctest.rst:1388 msgid "" @@ -2107,7 +2107,7 @@ msgstr "" #: ../../library/doctest.rst:1435 msgid ":class:`DocTestParser` defines the following methods:" -msgstr "" +msgstr ":class:`DocTestParser` 定義了以下方法:" #: ../../library/doctest.rst:1440 msgid "" @@ -2218,7 +2218,7 @@ msgstr "" #: ../../library/doctest.rst:1528 msgid ":class:`DocTestRunner` defines the following methods:" -msgstr "" +msgstr ":class:`DocTestRunner` 定義了以下方法:" #: ../../library/doctest.rst:1533 msgid "" @@ -2343,7 +2343,7 @@ msgstr "" #: ../../library/doctest.rst:1637 msgid ":class:`OutputChecker` defines the following methods:" -msgstr "" +msgstr ":class:`OutputChecker` 定義了以下方法:" #: ../../library/doctest.rst:1641 msgid "" @@ -2682,7 +2682,7 @@ msgstr "" #: ../../library/doctest.rst:1863 msgid ":exc:`UnexpectedException` defines the following attributes:" -msgstr "" +msgstr ":exc:`UnexpectedException` 定義了以下屬性:" #: ../../library/doctest.rst:1878 msgid "" diff --git a/library/fileinput.po b/library/fileinput.po index 92b59172fd..6c58733102 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -67,7 +67,7 @@ msgstr "" #: ../../library/fileinput.rst:35 msgid ":exc:`IOError` used to be raised; it is now an alias of :exc:`OSError`." -msgstr "" +msgstr ":exc:`IOError` 曾經被引發;現在它是一個 :exc:`OSError` 的別名。" #: ../../library/fileinput.rst:38 msgid "" diff --git a/library/gettext.po b/library/gettext.po index c7634d5d75..dd2bec9239 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -227,7 +227,7 @@ msgstr "" #: ../../library/gettext.rst:169 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr ":exc:`IOError` 曾經被引發,現在它是一個 :exc:`OSError` 的別名。" #: ../../library/gettext.rst:172 msgid "*codeset* parameter is removed." diff --git a/library/language.po b/library/language.po index faf9fb5c18..bed2481ca4 100644 --- a/library/language.po +++ b/library/language.po @@ -28,7 +28,7 @@ msgid "" "bytecode disassembly, and various other facilities." msgstr "" "Python 提供了許多模組來協助處理 Python 語言。這些模組支援標記化、剖析、語法分" -"析、位元碼反組譯,以及其他各種設施。" +"析、位元組碼反組譯,以及其他各種設施。" #: ../../library/language.rst:11 msgid "These modules include:" diff --git a/library/mimetypes.po b/library/mimetypes.po index fe246b5824..ca3ae2b140 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -83,7 +83,7 @@ msgstr "" #: ../../library/mimetypes.rst:54 msgid "Added support for *url* being a :term:`path-like object`." -msgstr "" +msgstr "新增 *url* 做為 :term:`path-like object` 的支援。" #: ../../library/mimetypes.rst:57 msgid "" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 77bc4341ef..48c18f3e30 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-07-07 00:17+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1665,60 +1665,62 @@ msgstr "" #: ../../library/multiprocessing.rst:1082 msgid "" -"If *method* is ``None`` then the default context is returned. Otherwise " -"*method* should be ``'fork'``, ``'spawn'``, ``'forkserver'``. :exc:" -"`ValueError` is raised if the specified start method is not available. See :" -"ref:`multiprocessing-start-methods`." +"If *method* is ``None`` then the default context is returned. Note that if " +"the global start method has not been set, this will set it to the default " +"method. Otherwise *method* should be ``'fork'``, ``'spawn'``, " +"``'forkserver'``. :exc:`ValueError` is raised if the specified start method " +"is not available. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1091 +#: ../../library/multiprocessing.rst:1093 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1093 +#: ../../library/multiprocessing.rst:1095 msgid "" -"If the start method has not been fixed and *allow_none* is false, then the " -"start method is fixed to the default and the name is returned. If the start " -"method has not been fixed and *allow_none* is true then ``None`` is returned." +"If the global start method has not been set and *allow_none* is ``False``, " +"then the start method is set to the default and the name is returned. If the " +"start method has not been set and *allow_none* is ``True`` then ``None`` is " +"returned." msgstr "" -#: ../../library/multiprocessing.rst:1098 +#: ../../library/multiprocessing.rst:1100 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1105 +#: ../../library/multiprocessing.rst:1107 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:1111 +#: ../../library/multiprocessing.rst:1113 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1117 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1117 +#: ../../library/multiprocessing.rst:1119 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1119 +#: ../../library/multiprocessing.rst:1121 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1122 +#: ../../library/multiprocessing.rst:1124 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1127 +#: ../../library/multiprocessing.rst:1129 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1727,19 +1729,19 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1133 +#: ../../library/multiprocessing.rst:1135 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1136 +#: ../../library/multiprocessing.rst:1138 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1143 +#: ../../library/multiprocessing.rst:1145 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1749,17 +1751,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1150 +#: ../../library/multiprocessing.rst:1152 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1154 +#: ../../library/multiprocessing.rst:1156 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1160 +#: ../../library/multiprocessing.rst:1162 msgid "" ":mod:`multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1767,75 +1769,75 @@ msgid "" "local`." msgstr "" -#: ../../library/multiprocessing.rst:1167 +#: ../../library/multiprocessing.rst:1169 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1171 +#: ../../library/multiprocessing.rst:1173 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1174 +#: ../../library/multiprocessing.rst:1176 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1182 +#: ../../library/multiprocessing.rst:1184 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1185 +#: ../../library/multiprocessing.rst:1187 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1190 +#: ../../library/multiprocessing.rst:1192 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1197 +#: ../../library/multiprocessing.rst:1199 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1201 +#: ../../library/multiprocessing.rst:1203 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1203 +#: ../../library/multiprocessing.rst:1205 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1207 +#: ../../library/multiprocessing.rst:1209 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1209 +#: ../../library/multiprocessing.rst:1211 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1213 +#: ../../library/multiprocessing.rst:1215 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1218 +#: ../../library/multiprocessing.rst:1220 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1220 +#: ../../library/multiprocessing.rst:1222 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1843,7 +1845,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1227 +#: ../../library/multiprocessing.rst:1229 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1851,19 +1853,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1232 +#: ../../library/multiprocessing.rst:1234 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1236 +#: ../../library/multiprocessing.rst:1238 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1243 +#: ../../library/multiprocessing.rst:1245 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1871,38 +1873,38 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1249 +#: ../../library/multiprocessing.rst:1251 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1254 +#: ../../library/multiprocessing.rst:1256 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1258 +#: ../../library/multiprocessing.rst:1260 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1262 +#: ../../library/multiprocessing.rst:1264 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1266 +#: ../../library/multiprocessing.rst:1268 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1268 +#: ../../library/multiprocessing.rst:1270 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -1938,14 +1940,14 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1291 +#: ../../library/multiprocessing.rst:1293 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1295 +#: ../../library/multiprocessing.rst:1297 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1953,73 +1955,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1302 +#: ../../library/multiprocessing.rst:1304 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1308 +#: ../../library/multiprocessing.rst:1310 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1312 +#: ../../library/multiprocessing.rst:1314 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1316 +#: ../../library/multiprocessing.rst:1318 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1321 +#: ../../library/multiprocessing.rst:1323 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1327 +#: ../../library/multiprocessing.rst:1329 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1330 -#: ../../library/multiprocessing.rst:1468 +#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1470 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1334 +#: ../../library/multiprocessing.rst:1336 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1339 +#: ../../library/multiprocessing.rst:1341 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1341 +#: ../../library/multiprocessing.rst:1343 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1344 -#: ../../library/multiprocessing.rst:1882 +#: ../../library/multiprocessing.rst:1346 +#: ../../library/multiprocessing.rst:1884 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1349 +#: ../../library/multiprocessing.rst:1351 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1354 +#: ../../library/multiprocessing.rst:1356 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -2030,25 +2032,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1362 +#: ../../library/multiprocessing.rst:1364 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1366 +#: ../../library/multiprocessing.rst:1368 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1371 -#: ../../library/multiprocessing.rst:1422 +#: ../../library/multiprocessing.rst:1373 +#: ../../library/multiprocessing.rst:1424 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1373 +#: ../../library/multiprocessing.rst:1375 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -2056,14 +2058,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1378 +#: ../../library/multiprocessing.rst:1380 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1382 +#: ../../library/multiprocessing.rst:1384 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -2077,19 +2079,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1397 +#: ../../library/multiprocessing.rst:1399 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1400 +#: ../../library/multiprocessing.rst:1402 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1406 +#: ../../library/multiprocessing.rst:1408 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -2098,20 +2100,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1412 +#: ../../library/multiprocessing.rst:1414 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1416 +#: ../../library/multiprocessing.rst:1418 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1424 +#: ../../library/multiprocessing.rst:1426 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -2124,7 +2126,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1434 +#: ../../library/multiprocessing.rst:1436 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -2135,14 +2137,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1442 +#: ../../library/multiprocessing.rst:1444 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1449 +#: ../../library/multiprocessing.rst:1451 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -2152,7 +2154,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1457 +#: ../../library/multiprocessing.rst:1459 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -2161,17 +2163,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1466 +#: ../../library/multiprocessing.rst:1468 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1473 +#: ../../library/multiprocessing.rst:1475 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1478 +#: ../../library/multiprocessing.rst:1480 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -2180,32 +2182,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1486 +#: ../../library/multiprocessing.rst:1488 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1488 +#: ../../library/multiprocessing.rst:1490 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1493 +#: ../../library/multiprocessing.rst:1495 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1497 -#: ../../library/multiprocessing.rst:1584 +#: ../../library/multiprocessing.rst:1499 +#: ../../library/multiprocessing.rst:1586 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1501 +#: ../../library/multiprocessing.rst:1503 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -2215,24 +2217,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1508 +#: ../../library/multiprocessing.rst:1510 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1512 +#: ../../library/multiprocessing.rst:1514 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1514 +#: ../../library/multiprocessing.rst:1516 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1517 +#: ../../library/multiprocessing.rst:1519 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2240,19 +2242,19 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1520 -#: ../../library/multiprocessing.rst:1610 -#: ../../library/multiprocessing.rst:1625 +#: ../../library/multiprocessing.rst:1522 +#: ../../library/multiprocessing.rst:1612 +#: ../../library/multiprocessing.rst:1627 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1524 +#: ../../library/multiprocessing.rst:1526 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1527 +#: ../../library/multiprocessing.rst:1529 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2262,7 +2264,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1534 +#: ../../library/multiprocessing.rst:1536 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -2272,28 +2274,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1541 +#: ../../library/multiprocessing.rst:1543 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1543 +#: ../../library/multiprocessing.rst:1545 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1548 +#: ../../library/multiprocessing.rst:1550 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr ":mod:`multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1553 +#: ../../library/multiprocessing.rst:1555 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1559 +#: ../../library/multiprocessing.rst:1561 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -2302,11 +2304,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1567 +#: ../../library/multiprocessing.rst:1569 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1569 +#: ../../library/multiprocessing.rst:1571 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2316,40 +2318,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1576 +#: ../../library/multiprocessing.rst:1578 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1582 +#: ../../library/multiprocessing.rst:1584 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1588 +#: ../../library/multiprocessing.rst:1590 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1592 +#: ../../library/multiprocessing.rst:1594 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1598 +#: ../../library/multiprocessing.rst:1600 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1602 -#: ../../library/multiprocessing.rst:1618 +#: ../../library/multiprocessing.rst:1604 +#: ../../library/multiprocessing.rst:1620 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -2359,113 +2361,113 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1614 +#: ../../library/multiprocessing.rst:1616 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1629 +#: ../../library/multiprocessing.rst:1631 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1634 +#: ../../library/multiprocessing.rst:1636 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1638 +#: ../../library/multiprocessing.rst:1640 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1642 +#: ../../library/multiprocessing.rst:1644 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1645 +#: ../../library/multiprocessing.rst:1647 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1651 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1654 +#: ../../library/multiprocessing.rst:1656 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1654 +#: ../../library/multiprocessing.rst:1656 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1654 +#: ../../library/multiprocessing.rst:1656 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1658 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1658 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1658 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1657 +#: ../../library/multiprocessing.rst:1659 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1657 +#: ../../library/multiprocessing.rst:1659 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1658 +#: ../../library/multiprocessing.rst:1660 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1658 +#: ../../library/multiprocessing.rst:1660 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1658 +#: ../../library/multiprocessing.rst:1660 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1661 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1661 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1661 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1663 +#: ../../library/multiprocessing.rst:1665 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1666 +#: ../../library/multiprocessing.rst:1668 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2531,11 +2533,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1701 +#: ../../library/multiprocessing.rst:1703 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1703 +#: ../../library/multiprocessing.rst:1705 msgid "" "49\n" "0.1111111111111111\n" @@ -2547,11 +2549,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1714 +#: ../../library/multiprocessing.rst:1716 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1716 +#: ../../library/multiprocessing.rst:1718 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2560,7 +2562,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1725 +#: ../../library/multiprocessing.rst:1727 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2568,31 +2570,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1733 +#: ../../library/multiprocessing.rst:1735 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1739 +#: ../../library/multiprocessing.rst:1741 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1741 +#: ../../library/multiprocessing.rst:1743 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1744 +#: ../../library/multiprocessing.rst:1746 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1747 +#: ../../library/multiprocessing.rst:1749 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -2600,19 +2602,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1752 +#: ../../library/multiprocessing.rst:1754 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1755 +#: ../../library/multiprocessing.rst:1757 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1758 +#: ../../library/multiprocessing.rst:1760 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -2620,24 +2622,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1763 +#: ../../library/multiprocessing.rst:1765 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1768 +#: ../../library/multiprocessing.rst:1770 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1773 +#: ../../library/multiprocessing.rst:1775 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1777 +#: ../../library/multiprocessing.rst:1779 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2649,15 +2651,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1782 +#: ../../library/multiprocessing.rst:1784 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1786 +#: ../../library/multiprocessing.rst:1788 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1788 +#: ../../library/multiprocessing.rst:1790 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2667,29 +2669,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1796 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1799 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1801 +#: ../../library/multiprocessing.rst:1803 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1804 +#: ../../library/multiprocessing.rst:1806 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1807 +#: ../../library/multiprocessing.rst:1809 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2697,14 +2699,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1813 +#: ../../library/multiprocessing.rst:1815 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1817 +#: ../../library/multiprocessing.rst:1819 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2715,7 +2717,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1826 +#: ../../library/multiprocessing.rst:1828 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2725,22 +2727,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1833 +#: ../../library/multiprocessing.rst:1835 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1837 +#: ../../library/multiprocessing.rst:1839 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1841 +#: ../../library/multiprocessing.rst:1843 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1843 +#: ../../library/multiprocessing.rst:1845 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2748,121 +2750,121 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1849 +#: ../../library/multiprocessing.rst:1851 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1854 +#: ../../library/multiprocessing.rst:1856 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1858 +#: ../../library/multiprocessing.rst:1860 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1864 +#: ../../library/multiprocessing.rst:1866 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1871 +#: ../../library/multiprocessing.rst:1873 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1876 +#: ../../library/multiprocessing.rst:1878 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1879 +#: ../../library/multiprocessing.rst:1881 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1887 +#: ../../library/multiprocessing.rst:1889 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1891 +#: ../../library/multiprocessing.rst:1893 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1895 +#: ../../library/multiprocessing.rst:1897 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1899 +#: ../../library/multiprocessing.rst:1901 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1903 +#: ../../library/multiprocessing.rst:1905 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1907 +#: ../../library/multiprocessing.rst:1909 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1912 +#: ../../library/multiprocessing.rst:1914 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1916 +#: ../../library/multiprocessing.rst:1918 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1923 +#: ../../library/multiprocessing.rst:1925 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1928 +#: ../../library/multiprocessing.rst:1930 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1930 +#: ../../library/multiprocessing.rst:1932 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1937 +#: ../../library/multiprocessing.rst:1939 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1939 +#: ../../library/multiprocessing.rst:1941 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1942 +#: ../../library/multiprocessing.rst:1944 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1946 +#: ../../library/multiprocessing.rst:1948 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -2874,18 +2876,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:1959 +#: ../../library/multiprocessing.rst:1961 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1961 +#: ../../library/multiprocessing.rst:1963 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1965 +#: ../../library/multiprocessing.rst:1967 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -2925,23 +2927,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:1986 +#: ../../library/multiprocessing.rst:1988 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1988 +#: ../../library/multiprocessing.rst:1990 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1991 +#: ../../library/multiprocessing.rst:1993 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1994 +#: ../../library/multiprocessing.rst:1996 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -2961,11 +2963,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2003 +#: ../../library/multiprocessing.rst:2005 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2005 +#: ../../library/multiprocessing.rst:2007 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -2985,11 +2987,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2013 +#: ../../library/multiprocessing.rst:2015 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2015 +#: ../../library/multiprocessing.rst:2017 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3011,13 +3013,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2024 +#: ../../library/multiprocessing.rst:2026 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2027 +#: ../../library/multiprocessing.rst:2029 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3057,18 +3059,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2049 +#: ../../library/multiprocessing.rst:2051 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2051 +#: ../../library/multiprocessing.rst:2053 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2055 +#: ../../library/multiprocessing.rst:2057 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3076,7 +3078,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2059 +#: ../../library/multiprocessing.rst:2061 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3102,14 +3104,14 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2073 +#: ../../library/multiprocessing.rst:2075 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2077 +#: ../../library/multiprocessing.rst:2079 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -3117,7 +3119,7 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2082 +#: ../../library/multiprocessing.rst:2084 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3129,11 +3131,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2093 +#: ../../library/multiprocessing.rst:2095 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2095 +#: ../../library/multiprocessing.rst:2097 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3157,7 +3159,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2106 +#: ../../library/multiprocessing.rst:2108 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -3168,7 +3170,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2114 +#: ../../library/multiprocessing.rst:2116 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3182,20 +3184,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2125 +#: ../../library/multiprocessing.rst:2127 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2131 +#: ../../library/multiprocessing.rst:2133 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2134 +#: ../../library/multiprocessing.rst:2136 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3203,48 +3205,48 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2139 +#: ../../library/multiprocessing.rst:2141 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2143 +#: ../../library/multiprocessing.rst:2145 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2147 +#: ../../library/multiprocessing.rst:2149 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2149 +#: ../../library/multiprocessing.rst:2151 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2151 +#: ../../library/multiprocessing.rst:2153 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2153 +#: ../../library/multiprocessing.rst:2155 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2155 +#: ../../library/multiprocessing.rst:2157 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2157 +#: ../../library/multiprocessing.rst:2159 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2159 +#: ../../library/multiprocessing.rst:2161 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2163 +#: ../../library/multiprocessing.rst:2165 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -3252,17 +3254,17 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2168 +#: ../../library/multiprocessing.rst:2170 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2171 +#: ../../library/multiprocessing.rst:2173 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2173 +#: ../../library/multiprocessing.rst:2175 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3284,69 +3286,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2187 +#: ../../library/multiprocessing.rst:2189 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2189 +#: ../../library/multiprocessing.rst:2191 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2193 +#: ../../library/multiprocessing.rst:2195 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2197 +#: ../../library/multiprocessing.rst:2199 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2201 +#: ../../library/multiprocessing.rst:2203 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2203 +#: ../../library/multiprocessing.rst:2205 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2208 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2211 +#: ../../library/multiprocessing.rst:2213 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2216 +#: ../../library/multiprocessing.rst:2218 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2221 +#: ../../library/multiprocessing.rst:2223 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2225 +#: ../../library/multiprocessing.rst:2227 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2228 -#: ../../library/multiprocessing.rst:2792 +#: ../../library/multiprocessing.rst:2230 +#: ../../library/multiprocessing.rst:2794 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2231 +#: ../../library/multiprocessing.rst:2233 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -3354,7 +3356,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2236 +#: ../../library/multiprocessing.rst:2238 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -3362,13 +3364,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2242 +#: ../../library/multiprocessing.rst:2244 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2246 +#: ../../library/multiprocessing.rst:2248 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -3376,28 +3378,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2251 +#: ../../library/multiprocessing.rst:2253 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2255 +#: ../../library/multiprocessing.rst:2257 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2258 +#: ../../library/multiprocessing.rst:2260 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2261 +#: ../../library/multiprocessing.rst:2263 msgid "" "*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" "`os.cpu_count`." msgstr "" -#: ../../library/multiprocessing.rst:2267 +#: ../../library/multiprocessing.rst:2269 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -3408,7 +3410,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2277 +#: ../../library/multiprocessing.rst:2279 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -3416,14 +3418,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2284 +#: ../../library/multiprocessing.rst:2286 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2287 -#: ../../library/multiprocessing.rst:2318 +#: ../../library/multiprocessing.rst:2289 +#: ../../library/multiprocessing.rst:2320 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -3431,60 +3433,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2292 -#: ../../library/multiprocessing.rst:2323 +#: ../../library/multiprocessing.rst:2294 +#: ../../library/multiprocessing.rst:2325 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2296 -#: ../../library/multiprocessing.rst:2327 +#: ../../library/multiprocessing.rst:2298 +#: ../../library/multiprocessing.rst:2329 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2301 +#: ../../library/multiprocessing.rst:2303 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2305 +#: ../../library/multiprocessing.rst:2307 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2309 +#: ../../library/multiprocessing.rst:2311 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2315 +#: ../../library/multiprocessing.rst:2317 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2332 +#: ../../library/multiprocessing.rst:2334 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2334 +#: ../../library/multiprocessing.rst:2336 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2339 +#: ../../library/multiprocessing.rst:2341 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -3492,65 +3494,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2346 +#: ../../library/multiprocessing.rst:2348 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2352 +#: ../../library/multiprocessing.rst:2354 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2356 +#: ../../library/multiprocessing.rst:2358 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2363 +#: ../../library/multiprocessing.rst:2365 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2371 +#: ../../library/multiprocessing.rst:2373 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2376 +#: ../../library/multiprocessing.rst:2378 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2382 +#: ../../library/multiprocessing.rst:2384 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2385 +#: ../../library/multiprocessing.rst:2387 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2393 +#: ../../library/multiprocessing.rst:2395 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2398 +#: ../../library/multiprocessing.rst:2400 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -3558,31 +3560,31 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2405 +#: ../../library/multiprocessing.rst:2407 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2409 +#: ../../library/multiprocessing.rst:2411 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2413 +#: ../../library/multiprocessing.rst:2415 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2416 +#: ../../library/multiprocessing.rst:2418 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2420 +#: ../../library/multiprocessing.rst:2422 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2422 +#: ../../library/multiprocessing.rst:2424 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3610,17 +3612,17 @@ msgid "" "TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2447 +#: ../../library/multiprocessing.rst:2449 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2452 +#: ../../library/multiprocessing.rst:2454 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2456 +#: ../../library/multiprocessing.rst:2458 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3629,46 +3631,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2465 +#: ../../library/multiprocessing.rst:2467 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2468 +#: ../../library/multiprocessing.rst:2470 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2474 +#: ../../library/multiprocessing.rst:2476 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2477 +#: ../../library/multiprocessing.rst:2479 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2482 +#: ../../library/multiprocessing.rst:2484 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2485 +#: ../../library/multiprocessing.rst:2487 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2489 -#: ../../library/multiprocessing.rst:2524 +#: ../../library/multiprocessing.rst:2491 +#: ../../library/multiprocessing.rst:2526 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " @@ -3677,26 +3679,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2497 +#: ../../library/multiprocessing.rst:2499 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2500 +#: ../../library/multiprocessing.rst:2502 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2505 +#: ../../library/multiprocessing.rst:2507 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2509 +#: ../../library/multiprocessing.rst:2511 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -3710,49 +3712,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2520 +#: ../../library/multiprocessing.rst:2522 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2532 +#: ../../library/multiprocessing.rst:2534 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2539 +#: ../../library/multiprocessing.rst:2541 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2543 +#: ../../library/multiprocessing.rst:2545 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2547 +#: ../../library/multiprocessing.rst:2549 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2551 +#: ../../library/multiprocessing.rst:2553 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2554 +#: ../../library/multiprocessing.rst:2556 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2561 +#: ../../library/multiprocessing.rst:2563 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -3761,32 +3763,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2567 +#: ../../library/multiprocessing.rst:2569 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2570 +#: ../../library/multiprocessing.rst:2572 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2571 +#: ../../library/multiprocessing.rst:2573 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2572 +#: ../../library/multiprocessing.rst:2574 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2575 +#: ../../library/multiprocessing.rst:2577 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2578 +#: ../../library/multiprocessing.rst:2580 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -3794,7 +3796,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2584 +#: ../../library/multiprocessing.rst:2586 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -3804,18 +3806,18 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2594 +#: ../../library/multiprocessing.rst:2596 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2596 +#: ../../library/multiprocessing.rst:2598 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2600 +#: ../../library/multiprocessing.rst:2602 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -3833,13 +3835,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2615 +#: ../../library/multiprocessing.rst:2617 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2618 +#: ../../library/multiprocessing.rst:2620 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -3869,13 +3871,13 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2632 +#: ../../library/multiprocessing.rst:2634 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2635 +#: ../../library/multiprocessing.rst:2637 msgid "" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" @@ -3909,23 +3911,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2670 +#: ../../library/multiprocessing.rst:2672 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2672 +#: ../../library/multiprocessing.rst:2674 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2675 +#: ../../library/multiprocessing.rst:2677 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2678 +#: ../../library/multiprocessing.rst:2680 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -3934,17 +3936,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2683 +#: ../../library/multiprocessing.rst:2685 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2690 +#: ../../library/multiprocessing.rst:2692 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2692 +#: ../../library/multiprocessing.rst:2694 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -3952,7 +3954,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2698 +#: ../../library/multiprocessing.rst:2700 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -3960,7 +3962,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2704 +#: ../../library/multiprocessing.rst:2706 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -3971,17 +3973,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2712 +#: ../../library/multiprocessing.rst:2714 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2716 +#: ../../library/multiprocessing.rst:2718 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2718 +#: ../../library/multiprocessing.rst:2720 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -3989,27 +3991,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2725 +#: ../../library/multiprocessing.rst:2727 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2728 +#: ../../library/multiprocessing.rst:2730 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2732 +#: ../../library/multiprocessing.rst:2734 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2739 +#: ../../library/multiprocessing.rst:2741 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4018,11 +4020,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2745 +#: ../../library/multiprocessing.rst:2747 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2747 +#: ../../library/multiprocessing.rst:2749 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4050,21 +4052,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2760 +#: ../../library/multiprocessing.rst:2762 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2764 +#: ../../library/multiprocessing.rst:2766 msgid "The :mod:`multiprocessing.dummy` module" msgstr ":mod:`multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2769 +#: ../../library/multiprocessing.rst:2771 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2774 +#: ../../library/multiprocessing.rst:2776 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4072,7 +4074,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2782 +#: ../../library/multiprocessing.rst:2784 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4082,18 +4084,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2789 +#: ../../library/multiprocessing.rst:2791 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2795 +#: ../../library/multiprocessing.rst:2797 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2799 +#: ../../library/multiprocessing.rst:2801 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -4103,7 +4105,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2806 +#: ../../library/multiprocessing.rst:2808 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4112,69 +4114,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2816 +#: ../../library/multiprocessing.rst:2818 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2818 +#: ../../library/multiprocessing.rst:2820 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2823 +#: ../../library/multiprocessing.rst:2825 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2825 +#: ../../library/multiprocessing.rst:2827 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2827 +#: ../../library/multiprocessing.rst:2829 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2829 +#: ../../library/multiprocessing.rst:2831 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2832 +#: ../../library/multiprocessing.rst:2834 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2836 +#: ../../library/multiprocessing.rst:2838 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2838 +#: ../../library/multiprocessing.rst:2840 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2840 +#: ../../library/multiprocessing.rst:2842 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2842 +#: ../../library/multiprocessing.rst:2844 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2845 +#: ../../library/multiprocessing.rst:2847 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2847 +#: ../../library/multiprocessing.rst:2849 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2849 +#: ../../library/multiprocessing.rst:2851 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -4185,11 +4187,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2857 +#: ../../library/multiprocessing.rst:2859 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2859 +#: ../../library/multiprocessing.rst:2861 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -4199,11 +4201,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2867 +#: ../../library/multiprocessing.rst:2869 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2871 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4211,18 +4213,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2875 +#: ../../library/multiprocessing.rst:2877 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2879 +#: ../../library/multiprocessing.rst:2881 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2881 +#: ../../library/multiprocessing.rst:2883 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -4231,7 +4233,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2887 +#: ../../library/multiprocessing.rst:2889 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4240,11 +4242,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2893 +#: ../../library/multiprocessing.rst:2895 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2895 +#: ../../library/multiprocessing.rst:2897 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4259,17 +4261,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:2907 +#: ../../library/multiprocessing.rst:2909 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2910 +#: ../../library/multiprocessing.rst:2912 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2912 +#: ../../library/multiprocessing.rst:2914 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4277,7 +4279,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2917 +#: ../../library/multiprocessing.rst:2919 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4286,11 +4288,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2924 +#: ../../library/multiprocessing.rst:2926 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2926 +#: ../../library/multiprocessing.rst:2928 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4312,11 +4314,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:2936 +#: ../../library/multiprocessing.rst:2938 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2938 +#: ../../library/multiprocessing.rst:2940 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4338,25 +4340,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:2948 +#: ../../library/multiprocessing.rst:2950 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2950 +#: ../../library/multiprocessing.rst:2952 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2952 +#: ../../library/multiprocessing.rst:2954 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:2954 +#: ../../library/multiprocessing.rst:2956 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2957 +#: ../../library/multiprocessing.rst:2959 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4364,7 +4366,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:2960 +#: ../../library/multiprocessing.rst:2962 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4374,14 +4376,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2967 +#: ../../library/multiprocessing.rst:2969 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2971 +#: ../../library/multiprocessing.rst:2973 msgid "" "@property\n" "def cache(self):\n" @@ -4399,26 +4401,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:2979 +#: ../../library/multiprocessing.rst:2981 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2982 +#: ../../library/multiprocessing.rst:2984 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2984 +#: ../../library/multiprocessing.rst:2986 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2987 +#: ../../library/multiprocessing.rst:2989 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2989 +#: ../../library/multiprocessing.rst:2991 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -4426,11 +4428,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2994 +#: ../../library/multiprocessing.rst:2996 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2996 +#: ../../library/multiprocessing.rst:2998 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -4438,30 +4440,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:3001 +#: ../../library/multiprocessing.rst:3003 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:3006 +#: ../../library/multiprocessing.rst:3008 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:3008 +#: ../../library/multiprocessing.rst:3010 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3012 +#: ../../library/multiprocessing.rst:3014 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3016 +#: ../../library/multiprocessing.rst:3018 msgid "" "from multiprocessing import Process\n" "\n" @@ -4479,13 +4481,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3024 +#: ../../library/multiprocessing.rst:3026 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3027 +#: ../../library/multiprocessing.rst:3029 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4509,33 +4511,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3038 +#: ../../library/multiprocessing.rst:3040 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3041 +#: ../../library/multiprocessing.rst:3043 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3044 +#: ../../library/multiprocessing.rst:3046 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3051 +#: ../../library/multiprocessing.rst:3053 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3053 +#: ../../library/multiprocessing.rst:3055 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3055 +#: ../../library/multiprocessing.rst:3057 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4629,11 +4631,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3059 +#: ../../library/multiprocessing.rst:3061 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3061 +#: ../../library/multiprocessing.rst:3063 msgid "" "import multiprocessing\n" "import time\n" @@ -4793,13 +4795,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3065 +#: ../../library/multiprocessing.rst:3067 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3068 +#: ../../library/multiprocessing.rst:3070 msgid "" "import time\n" "import random\n" diff --git a/library/optparse.po b/library/optparse.po index b23b142f75..f759497dfe 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1598,7 +1598,7 @@ msgstr "" #: ../../library/optparse.rst:922 msgid "``usage`` (default: ``\"%prog [options]\"``)" -msgstr "" +msgstr "``usage``\\ (預設值:``\"%prog [options]\"``)" #: ../../library/optparse.rst:923 msgid "" @@ -1611,7 +1611,7 @@ msgstr "" #: ../../library/optparse.rst:929 msgid "``option_list`` (default: ``[]``)" -msgstr "" +msgstr "``option_list``\\ (預設值:``[]``)" #: ../../library/optparse.rst:930 msgid "" @@ -1632,7 +1632,7 @@ msgstr "" #: ../../library/optparse.rst:939 msgid "``version`` (default: ``None``)" -msgstr "" +msgstr "``version``\\ (預設值:``None``)" #: ../../library/optparse.rst:940 msgid "" @@ -1644,7 +1644,7 @@ msgstr "" #: ../../library/optparse.rst:945 msgid "``conflict_handler`` (default: ``\"error\"``)" -msgstr "" +msgstr "``conflict_handler``\\ (預設值:``\"error\"``)" #: ../../library/optparse.rst:946 msgid "" @@ -1654,7 +1654,7 @@ msgstr "" #: ../../library/optparse.rst:950 msgid "``description`` (default: ``None``)" -msgstr "" +msgstr "``description``\\ (預設值:``None``)" #: ../../library/optparse.rst:951 msgid "" @@ -1677,7 +1677,7 @@ msgstr "" #: ../../library/optparse.rst:961 msgid "``add_help_option`` (default: ``True``)" -msgstr "" +msgstr "``add_help_option``\\ (預設值:``True``)" #: ../../library/optparse.rst:962 msgid "" @@ -1697,7 +1697,7 @@ msgstr "" #: ../../library/optparse.rst:969 msgid "``epilog`` (default: ``None``)" -msgstr "" +msgstr "``epilog``\\ (預設值:``None``)" #: ../../library/optparse.rst:970 msgid "A paragraph of help text to print after the option help." diff --git a/library/os.po b/library/os.po index b2f2e44c90..2b236a1956 100644 --- a/library/os.po +++ b/library/os.po @@ -3150,7 +3150,7 @@ msgstr "" #: ../../library/os.rst:2840 msgid "Added support for :ref:`file descriptors ` on Unix." -msgstr "" +msgstr "新增對 Unix 上的\\ :ref:`檔案描述器 `\\ 的支援。" #: ../../library/os.rst:2846 msgid "" @@ -5946,7 +5946,7 @@ msgstr "" #: ../../library/os.rst:5234 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." -msgstr "" +msgstr "新增 :data:`CLD_KILLED` 和 :data:`CLD_STOPPED` 值。" #: ../../library/os.rst:5240 msgid "Convert a wait status to an exit code." @@ -5954,7 +5954,7 @@ msgstr "" #: ../../library/os.rst:5242 msgid "On Unix:" -msgstr "" +msgstr "在 Unix 上:" #: ../../library/os.rst:5244 msgid "" @@ -5973,7 +5973,7 @@ msgstr "" #: ../../library/os.rst:5251 msgid "Otherwise, raise a :exc:`ValueError`." -msgstr "" +msgstr "否則,引發 :exc:`ValueError`。" #: ../../library/os.rst:5253 msgid "On Windows, return *status* shifted right by 8 bits." @@ -6069,7 +6069,7 @@ msgstr "" #: ../../library/os.rst:5351 msgid "Interface to the scheduler" -msgstr "" +msgstr "排程器介面" #: ../../library/os.rst:5353 msgid "" @@ -6104,11 +6104,11 @@ msgstr "" #: ../../library/os.rst:5383 msgid "A First In First Out scheduling policy." -msgstr "" +msgstr "先進先出排程策略。" #: ../../library/os.rst:5387 msgid "A round-robin scheduling policy." -msgstr "" +msgstr "輪轉排程策略。" #: ../../library/os.rst:5391 msgid "" diff --git a/library/platform.po b/library/platform.po index d7f235e812..8abe17dd5e 100644 --- a/library/platform.po +++ b/library/platform.po @@ -402,7 +402,7 @@ msgstr "" #: ../../library/platform.rst:263 msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." -msgstr "" +msgstr "``system`` 是 OS 名稱;可能是 ``'iOS'`` 或 ``'iPadOS'``。" #: ../../library/platform.rst:264 msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." diff --git a/library/py_compile.po b/library/py_compile.po index 19828595ae..c7c02a8446 100644 --- a/library/py_compile.po +++ b/library/py_compile.po @@ -169,7 +169,7 @@ msgstr "" #: ../../library/py_compile.rst:131 msgid "Command-Line Interface" -msgstr "" +msgstr "命令列介面" #: ../../library/py_compile.rst:133 msgid "" diff --git a/library/pyexpat.po b/library/pyexpat.po index b5d6eca3f3..e9a5a8b571 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,12 +23,11 @@ msgstr ":mod:`!xml.parsers.expat` --- 使用 Expat 進行快速 XML 剖析" #: ../../library/pyexpat.rst:21 msgid "" -"The :mod:`pyexpat` module is not secure against maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see :ref:`xml-" -"vulnerabilities`." -msgstr "" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/pyexpat.rst:28 +#: ../../library/pyexpat.rst:27 msgid "" "The :mod:`xml.parsers.expat` module is a Python interface to the Expat non-" "validating XML parser. The module provides a single extension type, :class:" @@ -39,39 +38,39 @@ msgid "" "in the XML document." msgstr "" -#: ../../library/pyexpat.rst:38 +#: ../../library/pyexpat.rst:37 msgid "" "This module uses the :mod:`pyexpat` module to provide access to the Expat " "parser. Direct use of the :mod:`pyexpat` module is deprecated." msgstr "" -#: ../../library/pyexpat.rst:41 +#: ../../library/pyexpat.rst:40 msgid "This module provides one exception and one type object:" -msgstr "" +msgstr "這個模組提供一個例外和一個型別物件:" -#: ../../library/pyexpat.rst:46 +#: ../../library/pyexpat.rst:45 msgid "" "The exception raised when Expat reports an error. See section :ref:" "`expaterror-objects` for more information on interpreting Expat errors." msgstr "" -#: ../../library/pyexpat.rst:52 +#: ../../library/pyexpat.rst:51 msgid "Alias for :exc:`ExpatError`." msgstr ":exc:`ExpatError` 的別名。" -#: ../../library/pyexpat.rst:57 +#: ../../library/pyexpat.rst:56 msgid "The type of the return values from the :func:`ParserCreate` function." msgstr "" -#: ../../library/pyexpat.rst:59 +#: ../../library/pyexpat.rst:58 msgid "The :mod:`xml.parsers.expat` module contains two functions:" -msgstr "" +msgstr ":mod:`xml.parsers.expat` 模組包含兩個函式:" -#: ../../library/pyexpat.rst:64 +#: ../../library/pyexpat.rst:63 msgid "Returns an explanatory string for a given error number *errno*." -msgstr "" +msgstr "回傳一個給定錯誤編號 *errno* 的解釋字串。" -#: ../../library/pyexpat.rst:69 +#: ../../library/pyexpat.rst:68 msgid "" "Creates and returns a new :class:`xmlparser` object. *encoding*, if " "specified, must be a string naming the encoding used by the XML data. " @@ -81,7 +80,7 @@ msgid "" "implicit or explicit encoding of the document." msgstr "" -#: ../../library/pyexpat.rst:76 +#: ../../library/pyexpat.rst:75 msgid "" "Expat can optionally do XML namespace processing for you, enabled by " "providing a value for *namespace_separator*. The value must be a one-" @@ -96,13 +95,13 @@ msgid "" "concatenated without any separator." msgstr "" -#: ../../library/pyexpat.rst:88 +#: ../../library/pyexpat.rst:87 msgid "" "For example, if *namespace_separator* is set to a space character (``' '``) " "and the following document is parsed:" msgstr "" -#: ../../library/pyexpat.rst:91 +#: ../../library/pyexpat.rst:90 msgid "" "\n" "\n" "" -#: ../../library/pyexpat.rst:100 +#: ../../library/pyexpat.rst:99 msgid "" ":attr:`StartElementHandler` will receive the following strings for each " "element::" msgstr "" +":attr:`StartElementHandler` 將會收到每個元素的以下字串: ::" -#: ../../library/pyexpat.rst:103 +#: ../../library/pyexpat.rst:102 msgid "" "http://default-namespace.org/ root\n" "http://www.python.org/ns/ elem1\n" @@ -134,7 +134,7 @@ msgstr "" "http://www.python.org/ns/ elem1\n" "elem2" -#: ../../library/pyexpat.rst:107 +#: ../../library/pyexpat.rst:106 msgid "" "Due to limitations in the ``Expat`` library used by :mod:`pyexpat`, the :" "class:`xmlparser` instance returned can only be used to parse a single XML " @@ -142,23 +142,23 @@ msgid "" "instances." msgstr "" -#: ../../library/pyexpat.rst:115 +#: ../../library/pyexpat.rst:114 msgid "`The Expat XML Parser `_" -msgstr "" +msgstr "`Expat XML 剖析器 `_" -#: ../../library/pyexpat.rst:116 +#: ../../library/pyexpat.rst:115 msgid "Home page of the Expat project." -msgstr "" +msgstr "Expat 專案的首頁。" -#: ../../library/pyexpat.rst:122 +#: ../../library/pyexpat.rst:121 msgid "XMLParser Objects" msgstr "XMLParser 物件" -#: ../../library/pyexpat.rst:124 +#: ../../library/pyexpat.rst:123 msgid ":class:`xmlparser` objects have the following methods:" -msgstr "" +msgstr ":class:`xmlparser` 物件擁有以下方法:" -#: ../../library/pyexpat.rst:129 +#: ../../library/pyexpat.rst:128 msgid "" "Parses the contents of the string *data*, calling the appropriate handler " "functions to process the parsed data. *isfinal* must be true on the final " @@ -167,14 +167,14 @@ msgid "" "time." msgstr "" -#: ../../library/pyexpat.rst:138 +#: ../../library/pyexpat.rst:137 msgid "" "Parse XML data reading from the object *file*. *file* only needs to provide " "the ``read(nbytes)`` method, returning the empty string when there's no more " "data." msgstr "" -#: ../../library/pyexpat.rst:145 +#: ../../library/pyexpat.rst:144 msgid "" "Sets the base to be used for resolving relative URIs in system identifiers " "in declarations. Resolving relative identifiers is left to the application: " @@ -183,20 +183,20 @@ msgid "" "`UnparsedEntityDeclHandler` functions." msgstr "" -#: ../../library/pyexpat.rst:154 +#: ../../library/pyexpat.rst:153 msgid "" "Returns a string containing the base set by a previous call to :meth:" "`SetBase`, or ``None`` if :meth:`SetBase` hasn't been called." msgstr "" -#: ../../library/pyexpat.rst:160 +#: ../../library/pyexpat.rst:159 msgid "" "Returns the input data that generated the current event as a string. The " "data is in the encoding of the entity which contains the text. When called " "while an event handler is not active, the return value is ``None``." msgstr "" -#: ../../library/pyexpat.rst:167 +#: ../../library/pyexpat.rst:166 msgid "" "Create a \"child\" parser which can be used to parse an external parsed " "entity referred to by content parsed by the parent parser. The *context* " @@ -206,7 +206,7 @@ msgid "" "`specified_attributes` set to the values of this parser." msgstr "" -#: ../../library/pyexpat.rst:176 +#: ../../library/pyexpat.rst:175 msgid "" "Control parsing of parameter entities (including the external DTD subset). " "Possible *flag* values are :const:`XML_PARAM_ENTITY_PARSING_NEVER`, :const:" @@ -215,7 +215,7 @@ msgid "" "successful." msgstr "" -#: ../../library/pyexpat.rst:184 +#: ../../library/pyexpat.rst:183 msgid "" "Calling this with a true value for *flag* (the default) will cause Expat to " "call the :attr:`ExternalEntityRefHandler` with :const:`None` for all " @@ -225,13 +225,13 @@ msgid "" "`EndDoctypeDeclHandler` will not be called." msgstr "" -#: ../../library/pyexpat.rst:191 +#: ../../library/pyexpat.rst:190 msgid "" "Passing a false value for *flag* will cancel a previous call that passed a " "true value, but otherwise has no effect." msgstr "" -#: ../../library/pyexpat.rst:194 +#: ../../library/pyexpat.rst:193 msgid "" "This method can only be called before the :meth:`Parse` or :meth:`ParseFile` " "methods are called; calling it after either of those have been called " @@ -239,14 +239,14 @@ msgid "" "``errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]``." msgstr "" -#: ../../library/pyexpat.rst:203 +#: ../../library/pyexpat.rst:202 msgid "" "Calling ``SetReparseDeferralEnabled(False)`` has security implications, as " "detailed below; please make sure to understand these consequences prior to " "using the ``SetReparseDeferralEnabled`` method." msgstr "" -#: ../../library/pyexpat.rst:207 +#: ../../library/pyexpat.rst:206 msgid "" "Expat 2.6.0 introduced a security mechanism called \"reparse deferral\" " "where instead of causing denial of service through quadratic runtime from " @@ -261,7 +261,7 @@ msgid "" "``SetReparseDeferralEnabled(True)`` allows re-enabling reparse deferral." msgstr "" -#: ../../library/pyexpat.rst:220 +#: ../../library/pyexpat.rst:219 msgid "" "Note that :meth:`SetReparseDeferralEnabled` has been backported to some " "prior releases of CPython as a security fix. Check for availability of :" @@ -269,24 +269,24 @@ msgid "" "running across a variety of Python versions." msgstr "" -#: ../../library/pyexpat.rst:229 +#: ../../library/pyexpat.rst:228 msgid "" "Returns whether reparse deferral is currently enabled for the given Expat " "parser instance." msgstr "" -#: ../../library/pyexpat.rst:235 +#: ../../library/pyexpat.rst:234 msgid ":class:`xmlparser` objects have the following attributes:" msgstr ":class:`xmlparser` 物件擁有以下屬性:" -#: ../../library/pyexpat.rst:240 +#: ../../library/pyexpat.rst:239 msgid "" "The size of the buffer used when :attr:`buffer_text` is true. A new buffer " "size can be set by assigning a new integer value to this attribute. When the " "size is changed, the buffer will be flushed." msgstr "" -#: ../../library/pyexpat.rst:248 +#: ../../library/pyexpat.rst:247 msgid "" "Setting this to true causes the :class:`xmlparser` object to buffer textual " "content returned by Expat to avoid multiple calls to the :meth:" @@ -297,14 +297,14 @@ msgid "" "newlines may be chunked too." msgstr "" -#: ../../library/pyexpat.rst:259 +#: ../../library/pyexpat.rst:258 msgid "" "If :attr:`buffer_text` is enabled, the number of bytes stored in the buffer. " "These bytes represent UTF-8 encoded text. This attribute has no meaningful " "interpretation when :attr:`buffer_text` is false." msgstr "" -#: ../../library/pyexpat.rst:266 +#: ../../library/pyexpat.rst:265 msgid "" "Setting this attribute to a non-zero integer causes the attributes to be " "reported as a list rather than a dictionary. The attributes are presented " @@ -314,7 +314,7 @@ msgid "" "is false; it may be changed at any time." msgstr "" -#: ../../library/pyexpat.rst:276 +#: ../../library/pyexpat.rst:275 msgid "" "If set to a non-zero integer, the parser will report only those attributes " "which were specified in the document instance and not those which were " @@ -325,7 +325,7 @@ msgid "" "time." msgstr "" -#: ../../library/pyexpat.rst:284 +#: ../../library/pyexpat.rst:283 msgid "" "The following attributes contain values relating to the most recent error " "encountered by an :class:`xmlparser` object, and will only have correct " @@ -333,26 +333,26 @@ msgid "" "`xml.parsers.expat.ExpatError` exception." msgstr "" -#: ../../library/pyexpat.rst:292 +#: ../../library/pyexpat.rst:291 msgid "Byte index at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:297 +#: ../../library/pyexpat.rst:296 msgid "" "Numeric code specifying the problem. This value can be passed to the :func:" "`ErrorString` function, or compared to one of the constants defined in the " "``errors`` object." msgstr "" -#: ../../library/pyexpat.rst:304 +#: ../../library/pyexpat.rst:303 msgid "Column number at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:309 +#: ../../library/pyexpat.rst:308 msgid "Line number at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:311 +#: ../../library/pyexpat.rst:310 msgid "" "The following attributes contain values relating to the current parse " "location in an :class:`xmlparser` object. During a callback reporting a " @@ -362,19 +362,19 @@ msgid "" "whether there was an associated callback)." msgstr "" -#: ../../library/pyexpat.rst:321 +#: ../../library/pyexpat.rst:320 msgid "Current byte index in the parser input." msgstr "" -#: ../../library/pyexpat.rst:326 +#: ../../library/pyexpat.rst:325 msgid "Current column number in the parser input." msgstr "" -#: ../../library/pyexpat.rst:331 +#: ../../library/pyexpat.rst:330 msgid "Current line number in the parser input." msgstr "" -#: ../../library/pyexpat.rst:333 +#: ../../library/pyexpat.rst:332 msgid "" "Here is the list of handlers that can be set. To set a handler on an :class:" "`xmlparser` object *o*, use ``o.handlername = func``. *handlername* must be " @@ -383,7 +383,7 @@ msgid "" "unless otherwise stated." msgstr "" -#: ../../library/pyexpat.rst:342 +#: ../../library/pyexpat.rst:341 msgid "" "Called when the XML declaration is parsed. The XML declaration is the " "(optional) declaration of the applicable version of the XML recommendation, " @@ -394,7 +394,7 @@ msgid "" "only available with Expat version 1.95.0 or newer." msgstr "" -#: ../../library/pyexpat.rst:353 +#: ../../library/pyexpat.rst:352 msgid "" "Called when Expat begins parsing the document type declaration (``'``." msgstr "" -#: ../../library/pyexpat.rst:470 +#: ../../library/pyexpat.rst:469 msgid "" "Called at the start of a CDATA section. This and :attr:" "`EndCdataSectionHandler` are needed to be able to identify the syntactical " "start and end for CDATA sections." msgstr "" -#: ../../library/pyexpat.rst:477 +#: ../../library/pyexpat.rst:476 msgid "Called at the end of a CDATA section." -msgstr "" +msgstr "在 CDATA 區塊結束時呼叫。" -#: ../../library/pyexpat.rst:482 +#: ../../library/pyexpat.rst:481 msgid "" "Called for any characters in the XML document for which no applicable " "handler has been specified. This means characters that are part of a " @@ -528,14 +528,14 @@ msgid "" "supplied." msgstr "" -#: ../../library/pyexpat.rst:489 +#: ../../library/pyexpat.rst:488 msgid "" "This is the same as the :func:`DefaultHandler`, but doesn't inhibit " "expansion of internal entities. The entity reference will not be passed to " "the default handler." msgstr "" -#: ../../library/pyexpat.rst:496 +#: ../../library/pyexpat.rst:495 msgid "" "Called if the XML document hasn't been declared as being a standalone " "document. This happens when there is an external subset or a reference to a " @@ -545,7 +545,7 @@ msgid "" "set, no exception is raised by the parser for this condition." msgstr "" -#: ../../library/pyexpat.rst:506 +#: ../../library/pyexpat.rst:505 msgid "" "Called for references to external entities. *base* is the current base, as " "set by a previous call to :meth:`SetBase`. The public and system " @@ -554,7 +554,7 @@ msgid "" "is opaque and should only be used as described below." msgstr "" -#: ../../library/pyexpat.rst:512 +#: ../../library/pyexpat.rst:511 msgid "" "For external entities to be parsed, this handler must be implemented. It is " "responsible for creating the sub-parser using " @@ -564,28 +564,28 @@ msgid "" "`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will continue." msgstr "" -#: ../../library/pyexpat.rst:520 +#: ../../library/pyexpat.rst:519 msgid "" "If this handler is not provided, external entities are reported by the :attr:" "`DefaultHandler` callback, if provided." msgstr "" -#: ../../library/pyexpat.rst:527 +#: ../../library/pyexpat.rst:526 msgid "ExpatError Exceptions" msgstr "ExpatError 例外" -#: ../../library/pyexpat.rst:532 +#: ../../library/pyexpat.rst:531 msgid ":exc:`ExpatError` exceptions have a number of interesting attributes:" msgstr "" -#: ../../library/pyexpat.rst:537 +#: ../../library/pyexpat.rst:536 msgid "" "Expat's internal error number for the specific error. The :data:`errors." "messages ` dictionary maps these error " "numbers to Expat's error messages. For example::" msgstr "" -#: ../../library/pyexpat.rst:541 +#: ../../library/pyexpat.rst:540 msgid "" "from xml.parsers.expat import ParserCreate, ExpatError, errors\n" "\n" @@ -603,36 +603,36 @@ msgstr "" "except ExpatError as err:\n" " print(\"Error:\", errors.messages[err.code])" -#: ../../library/pyexpat.rst:549 +#: ../../library/pyexpat.rst:548 msgid "" "The :mod:`~xml.parsers.expat.errors` module also provides error message " "constants and a dictionary :data:`~xml.parsers.expat.errors.codes` mapping " "these messages back to the error codes, see below." msgstr "" -#: ../../library/pyexpat.rst:556 +#: ../../library/pyexpat.rst:555 msgid "" "Line number on which the error was detected. The first line is numbered " "``1``." msgstr "" -#: ../../library/pyexpat.rst:561 +#: ../../library/pyexpat.rst:560 msgid "" "Character offset into the line where the error occurred. The first column " "is numbered ``0``." msgstr "" -#: ../../library/pyexpat.rst:568 +#: ../../library/pyexpat.rst:567 msgid "Example" msgstr "範例" -#: ../../library/pyexpat.rst:570 +#: ../../library/pyexpat.rst:569 msgid "" "The following program defines three handlers that just print out their " "arguments. ::" msgstr "" -#: ../../library/pyexpat.rst:573 +#: ../../library/pyexpat.rst:572 msgid "" "import xml.parsers.expat\n" "\n" @@ -676,11 +676,11 @@ msgstr "" "More text\n" "\"\"\", 1)" -#: ../../library/pyexpat.rst:594 +#: ../../library/pyexpat.rst:593 msgid "The output from this program is::" -msgstr "" +msgstr "這個程式的輸出是: ::" -#: ../../library/pyexpat.rst:596 +#: ../../library/pyexpat.rst:595 msgid "" "Start element: parent {'id': 'top'}\n" "Start element: child1 {'name': 'paul'}\n" @@ -704,76 +704,76 @@ msgstr "" "Character data: '\\n'\n" "End element: parent" -#: ../../library/pyexpat.rst:611 +#: ../../library/pyexpat.rst:610 msgid "Content Model Descriptions" msgstr "" -#: ../../library/pyexpat.rst:617 +#: ../../library/pyexpat.rst:616 msgid "" "Content models are described using nested tuples. Each tuple contains four " "values: the type, the quantifier, the name, and a tuple of children. " "Children are simply additional content model descriptions." msgstr "" -#: ../../library/pyexpat.rst:621 +#: ../../library/pyexpat.rst:620 msgid "" "The values of the first two fields are constants defined in the :mod:`xml." "parsers.expat.model` module. These constants can be collected in two " "groups: the model type group and the quantifier group." msgstr "" -#: ../../library/pyexpat.rst:625 +#: ../../library/pyexpat.rst:624 msgid "The constants in the model type group are:" msgstr "" -#: ../../library/pyexpat.rst:631 +#: ../../library/pyexpat.rst:630 msgid "" "The element named by the model name was declared to have a content model of " "``ANY``." msgstr "" -#: ../../library/pyexpat.rst:638 +#: ../../library/pyexpat.rst:637 msgid "" "The named element allows a choice from a number of options; this is used for " "content models such as ``(A | B | C)``." msgstr "" -#: ../../library/pyexpat.rst:645 +#: ../../library/pyexpat.rst:644 msgid "Elements which are declared to be ``EMPTY`` have this model type." msgstr "" -#: ../../library/pyexpat.rst:659 +#: ../../library/pyexpat.rst:658 msgid "" "Models which represent a series of models which follow one after the other " "are indicated with this model type. This is used for models such as ``(A, " "B, C)``." msgstr "" -#: ../../library/pyexpat.rst:662 +#: ../../library/pyexpat.rst:661 msgid "The constants in the quantifier group are:" msgstr "" -#: ../../library/pyexpat.rst:668 +#: ../../library/pyexpat.rst:667 msgid "No modifier is given, so it can appear exactly once, as for ``A``." msgstr "" -#: ../../library/pyexpat.rst:674 +#: ../../library/pyexpat.rst:673 msgid "The model is optional: it can appear once or not at all, as for ``A?``." msgstr "" -#: ../../library/pyexpat.rst:680 +#: ../../library/pyexpat.rst:679 msgid "The model must occur one or more times (like ``A+``)." msgstr "" -#: ../../library/pyexpat.rst:686 +#: ../../library/pyexpat.rst:685 msgid "The model must occur zero or more times, as for ``A*``." msgstr "" -#: ../../library/pyexpat.rst:692 +#: ../../library/pyexpat.rst:691 msgid "Expat error constants" -msgstr "" +msgstr "Expat 錯誤常數" -#: ../../library/pyexpat.rst:696 +#: ../../library/pyexpat.rst:695 msgid "" "The following constants are provided in the :mod:`xml.parsers.expat.errors` " "module. These constants are useful in interpreting some of the attributes " @@ -784,206 +784,206 @@ msgid "" "XML_ERROR_{CONSTANT_NAME}]`." msgstr "" -#: ../../library/pyexpat.rst:704 +#: ../../library/pyexpat.rst:703 msgid "The ``errors`` module has the following attributes:" msgstr "" -#: ../../library/pyexpat.rst:708 +#: ../../library/pyexpat.rst:707 msgid "A dictionary mapping string descriptions to their error codes." msgstr "" -#: ../../library/pyexpat.rst:715 +#: ../../library/pyexpat.rst:714 msgid "A dictionary mapping numeric error codes to their string descriptions." msgstr "" -#: ../../library/pyexpat.rst:725 +#: ../../library/pyexpat.rst:724 msgid "" "An entity reference in an attribute value referred to an external entity " "instead of an internal entity." msgstr "" -#: ../../library/pyexpat.rst:731 +#: ../../library/pyexpat.rst:730 msgid "" "A character reference referred to a character which is illegal in XML (for " "example, character ``0``, or '``�``')." msgstr "" -#: ../../library/pyexpat.rst:737 +#: ../../library/pyexpat.rst:736 msgid "" "An entity reference referred to an entity which was declared with a " "notation, so cannot be parsed." msgstr "" -#: ../../library/pyexpat.rst:743 +#: ../../library/pyexpat.rst:742 msgid "An attribute was used more than once in a start tag." msgstr "" -#: ../../library/pyexpat.rst:751 +#: ../../library/pyexpat.rst:750 msgid "" "Raised when an input byte could not properly be assigned to a character; for " "example, a NUL byte (value ``0``) in a UTF-8 input stream." msgstr "" -#: ../../library/pyexpat.rst:757 +#: ../../library/pyexpat.rst:756 msgid "Something other than whitespace occurred after the document element." msgstr "" -#: ../../library/pyexpat.rst:762 +#: ../../library/pyexpat.rst:761 msgid "" "An XML declaration was found somewhere other than the start of the input " "data." msgstr "" -#: ../../library/pyexpat.rst:767 +#: ../../library/pyexpat.rst:766 msgid "" "The document contains no elements (XML requires all documents to contain " "exactly one top-level element).." msgstr "" -#: ../../library/pyexpat.rst:773 +#: ../../library/pyexpat.rst:772 msgid "Expat was not able to allocate memory internally." msgstr "" -#: ../../library/pyexpat.rst:778 +#: ../../library/pyexpat.rst:777 msgid "A parameter entity reference was found where it was not allowed." msgstr "" -#: ../../library/pyexpat.rst:783 +#: ../../library/pyexpat.rst:782 msgid "An incomplete character was found in the input." msgstr "" -#: ../../library/pyexpat.rst:788 +#: ../../library/pyexpat.rst:787 msgid "" "An entity reference contained another reference to the same entity; possibly " "via a different name, and possibly indirectly." msgstr "" -#: ../../library/pyexpat.rst:794 +#: ../../library/pyexpat.rst:793 msgid "Some unspecified syntax error was encountered." msgstr "" -#: ../../library/pyexpat.rst:799 +#: ../../library/pyexpat.rst:798 msgid "An end tag did not match the innermost open start tag." msgstr "" -#: ../../library/pyexpat.rst:804 +#: ../../library/pyexpat.rst:803 msgid "" "Some token (such as a start tag) was not closed before the end of the stream " "or the next token was encountered." msgstr "" -#: ../../library/pyexpat.rst:810 +#: ../../library/pyexpat.rst:809 msgid "A reference was made to an entity which was not defined." msgstr "" -#: ../../library/pyexpat.rst:815 +#: ../../library/pyexpat.rst:814 msgid "The document encoding is not supported by Expat." msgstr "" -#: ../../library/pyexpat.rst:820 +#: ../../library/pyexpat.rst:819 msgid "A CDATA marked section was not closed." msgstr "" -#: ../../library/pyexpat.rst:828 +#: ../../library/pyexpat.rst:827 msgid "" "The parser determined that the document was not \"standalone\" though it " "declared itself to be in the XML declaration, and the :attr:" "`NotStandaloneHandler` was set and returned ``0``." msgstr "" -#: ../../library/pyexpat.rst:841 +#: ../../library/pyexpat.rst:840 msgid "" "An operation was requested that requires DTD support to be compiled in, but " "Expat was configured without DTD support. This should never be reported by " "a standard build of the :mod:`xml.parsers.expat` module." msgstr "" -#: ../../library/pyexpat.rst:848 +#: ../../library/pyexpat.rst:847 msgid "" "A behavioral change was requested after parsing started that can only be " "changed before parsing has started. This is (currently) only raised by :" "meth:`UseForeignDTD`." msgstr "" -#: ../../library/pyexpat.rst:855 +#: ../../library/pyexpat.rst:854 msgid "An undeclared prefix was found when namespace processing was enabled." msgstr "" -#: ../../library/pyexpat.rst:860 +#: ../../library/pyexpat.rst:859 msgid "" "The document attempted to remove the namespace declaration associated with a " "prefix." msgstr "" -#: ../../library/pyexpat.rst:866 +#: ../../library/pyexpat.rst:865 msgid "A parameter entity contained incomplete markup." msgstr "" -#: ../../library/pyexpat.rst:871 +#: ../../library/pyexpat.rst:870 msgid "The document contained no document element at all." msgstr "" -#: ../../library/pyexpat.rst:876 +#: ../../library/pyexpat.rst:875 msgid "There was an error parsing a text declaration in an external entity." msgstr "" -#: ../../library/pyexpat.rst:881 +#: ../../library/pyexpat.rst:880 msgid "Characters were found in the public id that are not allowed." msgstr "" -#: ../../library/pyexpat.rst:886 +#: ../../library/pyexpat.rst:885 msgid "" "The requested operation was made on a suspended parser, but isn't allowed. " "This includes attempts to provide additional input or to stop the parser." msgstr "" -#: ../../library/pyexpat.rst:892 +#: ../../library/pyexpat.rst:891 msgid "" "An attempt to resume the parser was made when the parser had not been " "suspended." msgstr "" -#: ../../library/pyexpat.rst:897 ../../library/pyexpat.rst:930 -#: ../../library/pyexpat.rst:935 +#: ../../library/pyexpat.rst:896 ../../library/pyexpat.rst:929 +#: ../../library/pyexpat.rst:934 msgid "This should not be reported to Python applications." msgstr "" -#: ../../library/pyexpat.rst:902 +#: ../../library/pyexpat.rst:901 msgid "" "The requested operation was made on a parser which was finished parsing " "input, but isn't allowed. This includes attempts to provide additional " "input or to stop the parser." msgstr "" -#: ../../library/pyexpat.rst:912 +#: ../../library/pyexpat.rst:911 msgid "" "An attempt was made to undeclare reserved namespace prefix ``xml`` or to " "bind it to another namespace URI." msgstr "" -#: ../../library/pyexpat.rst:919 +#: ../../library/pyexpat.rst:918 msgid "" "An attempt was made to declare or undeclare reserved namespace prefix " "``xmlns``." msgstr "" -#: ../../library/pyexpat.rst:924 +#: ../../library/pyexpat.rst:923 msgid "" "An attempt was made to bind the URI of one the reserved namespace prefixes " "``xml`` and ``xmlns`` to another namespace prefix." msgstr "" -#: ../../library/pyexpat.rst:940 +#: ../../library/pyexpat.rst:939 msgid "" "The limit on input amplification factor (from DTD and entities) has been " "breached." msgstr "" -#: ../../library/pyexpat.rst:945 +#: ../../library/pyexpat.rst:944 msgid "Footnotes" msgstr "註解" -#: ../../library/pyexpat.rst:946 +#: ../../library/pyexpat.rst:945 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See https://" @@ -991,14 +991,14 @@ msgid "" "org/assignments/character-sets/character-sets.xhtml." msgstr "" -#: ../../library/pyexpat.rst:26 +#: ../../library/pyexpat.rst:25 msgid "Expat" msgstr "Expat" -#: ../../library/pyexpat.rst:36 +#: ../../library/pyexpat.rst:35 msgid "module" msgstr "module(模組)" -#: ../../library/pyexpat.rst:36 +#: ../../library/pyexpat.rst:35 msgid "pyexpat" msgstr "pyexpat" diff --git a/library/random.po b/library/random.po index b4196649ec..beb245217d 100644 --- a/library/random.po +++ b/library/random.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2025-03-07 19:17+0800\n" "Last-Translator: Dr.XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -731,7 +731,15 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random." "getrandbits` 行為。" -#: ../../library/random.rst:453 +#: ../../library/random.rst:452 +msgid "" +"Override this method in subclasses to customise the :meth:`~random." +"randbytes` behaviour of :class:`!Random` instances." +msgstr "" +"在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random." +"randbytes` 行為。" + +#: ../../library/random.rst:458 msgid "" "Class that uses the :func:`os.urandom` function for generating random " "numbers from sources provided by the operating system. Not available on all " @@ -745,11 +753,11 @@ msgstr "" "有效果且被忽略。如果呼叫 :meth:`getstate` 和 :meth:`setstate` 方法會引發 :" "exc:`NotImplementedError`。" -#: ../../library/random.rst:462 +#: ../../library/random.rst:467 msgid "Notes on Reproducibility" msgstr "關於 Reproducibility(復現性)的注意事項" -#: ../../library/random.rst:464 +#: ../../library/random.rst:469 msgid "" "Sometimes it is useful to be able to reproduce the sequences given by a " "pseudo-random number generator. By reusing a seed value, the same sequence " @@ -759,7 +767,7 @@ msgstr "" "有時,能夠重現偽隨機數產生器給出的序列很有用。只要多執行緒未運行,透過重複使" "用種子值,同一序列就應該可以被復現。" -#: ../../library/random.rst:468 +#: ../../library/random.rst:473 msgid "" "Most of the random module's algorithms and seeding functions are subject to " "change across Python versions, but two aspects are guaranteed not to change:" @@ -767,13 +775,13 @@ msgstr "" "大多數隨機 module 的演算法和 seed 設定函式在 Python 版本中可能會發生變化,但" "可以保證兩個方面不會改變:" -#: ../../library/random.rst:471 +#: ../../library/random.rst:476 msgid "" "If a new seeding method is added, then a backward compatible seeder will be " "offered." msgstr "如果增加了新的 seed 設定函式,則將提供向後相容的播種器 (seeder)。" -#: ../../library/random.rst:474 +#: ../../library/random.rst:479 msgid "" "The generator's :meth:`~Random.random` method will continue to produce the " "same sequence when the compatible seeder is given the same seed." @@ -781,15 +789,15 @@ msgstr "" "當相容的播種器被賦予相同的種子時,產生器的 :meth:`~Random.random` 方法將持續" "產生相同的序列。" -#: ../../library/random.rst:480 +#: ../../library/random.rst:485 msgid "Examples" msgstr "範例" -#: ../../library/random.rst:482 +#: ../../library/random.rst:487 msgid "Basic examples::" msgstr "基礎範例: ::" -#: ../../library/random.rst:484 +#: ../../library/random.rst:489 msgid "" ">>> random() # Random float: 0.0 <= x < 1.0\n" "0.37444887175646646\n" @@ -846,11 +854,11 @@ msgstr "" ">>> sample([10, 20, 30, 40, 50], k=4) # 四個無重置的樣本\n" "[40, 10, 50, 30]" -#: ../../library/random.rst:510 +#: ../../library/random.rst:515 msgid "Simulations::" msgstr "模擬: ::" -#: ../../library/random.rst:512 +#: ../../library/random.rst:517 msgid "" ">>> # Six roulette wheel spins (weighted sampling with replacement)\n" ">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" @@ -897,7 +905,7 @@ msgstr "" ">>> sum(trial() for i in range(10_000)) / 10_000\n" "0.7958" -#: ../../library/random.rst:535 +#: ../../library/random.rst:540 msgid "" "Example of `statistical bootstrapping `_ using resampling with replacement to estimate " @@ -907,7 +915,7 @@ msgstr "" "Bootstrapping_(statistics)>`_\\ 的範例,使用有重置的重新取樣來估計樣本平均數" "的信賴區間: ::" -#: ../../library/random.rst:539 +#: ../../library/random.rst:544 msgid "" "# https://www.thoughtco.com/example-of-bootstrapping-3126155\n" "from statistics import fmean as mean\n" @@ -927,7 +935,7 @@ msgstr "" "print(f'The sample mean of {mean(data):.1f} has a 90% confidence '\n" " f'interval from {means[5]:.1f} to {means[94]:.1f}')" -#: ../../library/random.rst:548 +#: ../../library/random.rst:553 msgid "" "Example of a `resampling permutation test `_ to determine the statistical " @@ -939,7 +947,7 @@ msgstr "" "慰劑之間差異的統計學意義或 `p 值 `_\\ " ": ::" -#: ../../library/random.rst:554 +#: ../../library/random.rst:559 msgid "" "# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\n" "from statistics import fmean as mean\n" @@ -987,12 +995,12 @@ msgstr "" "print(f'單邊 p 值 {count / n:.4f} 使我們拒絕無效假設')\n" "print(f'即藥物與安慰劑之間沒有差異。')" -#: ../../library/random.rst:575 +#: ../../library/random.rst:580 msgid "" "Simulation of arrival times and service deliveries for a multiserver queue::" msgstr "模擬多伺服器佇列 (queue) 的到達時間與服務交付: ::" -#: ../../library/random.rst:577 +#: ../../library/random.rst:582 msgid "" "from heapq import heapify, heapreplace\n" "from random import expovariate, gauss\n" @@ -1046,7 +1054,7 @@ msgstr "" "print(f'平均等待時間:{mean(waits):.1f} 最大等待時間:{max(waits):.1f}')\n" "print('四分位數:', [round(q, 1) for q in quantiles(waits)])" -#: ../../library/random.rst:604 +#: ../../library/random.rst:609 msgid "" "`Statistics for Hackers `_ a " "video tutorial by `Jake Vanderplas `_ 製作的教" "學影片,僅使用幾個基本概念(包括模擬、取樣、洗牌、交叉驗證)進行統計分析。" -#: ../../library/random.rst:610 +#: ../../library/random.rst:615 msgid "" "`Economics Simulation `_ a simulation of a marketplace by `Peter Norvig `_ a tutorial by `Peter Norvig " @@ -1081,11 +1089,11 @@ msgstr "" "Probability.ipynb>`_\\ 為 `Peter Norvig `_ 的教" "學課程,涵蓋了機率理論的基礎知識與如何模擬以及使用 Python 執行數據分析。" -#: ../../library/random.rst:625 +#: ../../library/random.rst:630 msgid "Recipes" msgstr "使用方案" -#: ../../library/random.rst:627 +#: ../../library/random.rst:632 msgid "" "These recipes show how to efficiently make random selections from the " "combinatoric iterators in the :mod:`itertools` module:" @@ -1093,7 +1101,7 @@ msgstr "" "這些使用方案展示了如何有效地從 :mod:`itertools` 模組的組合疊代器 " "(combinatoric iterators) 中進行隨機選擇:" -#: ../../library/random.rst:630 +#: ../../library/random.rst:635 msgid "" "def random_product(*args, repeat=1):\n" " \"Random selection from itertools.product(*args, **kwds)\"\n" @@ -1149,7 +1157,7 @@ msgstr "" " indices = sorted(random.choices(range(n), k=r))\n" " return tuple(pool[i] for i in indices)" -#: ../../library/random.rst:659 +#: ../../library/random.rst:664 msgid "" "The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x " "< 1.0*. All such numbers are evenly spaced and are exactly representable as " @@ -1161,7 +1169,7 @@ msgstr "" "均勻分佈的,並且可以完全表示為 Python float。但是,該間隔中的許多其他可表示" "的 float 不是可能的選擇。 例如 ``0.05954861408025609`` 不是 2⁻⁵³ 的整數倍。" -#: ../../library/random.rst:665 +#: ../../library/random.rst:670 msgid "" "The following recipe takes a different approach. All floats in the interval " "are possible selections. The mantissa comes from a uniform distribution of " @@ -1173,7 +1181,7 @@ msgstr "" "數 < 2⁵³* 範圍內的整數均勻分佈。指數來自幾何分佈,其中小於 *-53* 的指數的出現" "頻率是下一個較大指數的一半。" -#: ../../library/random.rst:673 +#: ../../library/random.rst:678 msgid "" "from random import Random\n" "from math import ldexp\n" @@ -1203,7 +1211,7 @@ msgstr "" " exponent += x.bit_length() - 32\n" " return ldexp(mantissa, exponent)" -#: ../../library/random.rst:687 +#: ../../library/random.rst:692 msgid "" "All :ref:`real valued distributions ` in the " "class will use the new method::" @@ -1211,7 +1219,7 @@ msgstr "" "Class 中的所有\\ :ref:`實數分佈 `\\ 都將使用新方" "法: ::" -#: ../../library/random.rst:690 +#: ../../library/random.rst:695 msgid "" ">>> fr = FullRandom()\n" ">>> fr.random()\n" @@ -1225,7 +1233,7 @@ msgstr "" ">>> fr.expovariate(0.25)\n" "8.87925541791544" -#: ../../library/random.rst:696 +#: ../../library/random.rst:701 msgid "" "The recipe is conceptually equivalent to an algorithm that chooses from all " "the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are " @@ -1238,7 +1246,7 @@ msgstr "" "示的 Python float。(2⁻¹⁰⁷⁴ 是最小為正的非正規化 float,等於 ``math." "ulp(0.0)``)" -#: ../../library/random.rst:705 +#: ../../library/random.rst:710 msgid "" "`Generating Pseudo-random Floating-Point Values `_ a paper by Allen B. Downey describing " @@ -1249,68 +1257,68 @@ msgstr "" "pdf>`_ Allen B. Downey 的一篇論文描述了產生比通常由 :func:`.random` 產生的 " "float 更 fine-grained(細粒的)的方法。" -#: ../../library/random.rst:713 +#: ../../library/random.rst:718 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/random.rst:717 +#: ../../library/random.rst:722 msgid "The :mod:`!random` module can be executed from the command line." msgstr ":mod:`!random` 模組可以從命令列執行。" -#: ../../library/random.rst:719 +#: ../../library/random.rst:724 msgid "" "python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" msgstr "" "python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" -#: ../../library/random.rst:723 +#: ../../library/random.rst:728 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/random.rst:729 +#: ../../library/random.rst:734 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/random.rst:734 +#: ../../library/random.rst:739 msgid "Print a random choice, using :meth:`choice`." msgstr "列印一個隨機選擇,使用 :meth:`choice`。" -#: ../../library/random.rst:739 +#: ../../library/random.rst:744 msgid "" "Print a random integer between 1 and N inclusive, using :meth:`randint`." msgstr "列印 1 到 N(含)之間的隨機整數,使用 :meth:`randint`。" -#: ../../library/random.rst:744 +#: ../../library/random.rst:749 msgid "" "Print a random floating-point number between 0 and N inclusive, using :meth:" "`uniform`." msgstr "列印 0 到 N(含)之間的隨機浮點數,使用 :meth:`uniform`。" -#: ../../library/random.rst:747 +#: ../../library/random.rst:752 msgid "If no options are given, the output depends on the input:" msgstr "如果未給定選項,則輸出取決於輸入:" -#: ../../library/random.rst:749 +#: ../../library/random.rst:754 msgid "String or multiple: same as :option:`--choice`." msgstr "字串或多個:與 :option:`--choice` 相同。" -#: ../../library/random.rst:750 +#: ../../library/random.rst:755 msgid "Integer: same as :option:`--integer`." msgstr "整數:與 :option:`--integer` 相同。" -#: ../../library/random.rst:751 +#: ../../library/random.rst:756 msgid "Float: same as :option:`--float`." msgstr "浮點數:與 :option:`--float` 相同。" -#: ../../library/random.rst:756 +#: ../../library/random.rst:761 msgid "Command-line example" msgstr "命令列範例" -#: ../../library/random.rst:758 +#: ../../library/random.rst:763 msgid "Here are some examples of the :mod:`!random` command-line interface:" msgstr "以下是 :mod:`!random` 命令列介面的一些範例:" -#: ../../library/random.rst:760 +#: ../../library/random.rst:765 msgid "" "$ # Choose one at random\n" "$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " @@ -1343,8 +1351,8 @@ msgid "" "3.1942323316565915" msgstr "" "$ # 隨機選擇一個\n" -"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux " -"crevettes with a Mornay sauce\"\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " +"with a Mornay sauce\"\n" "Lobster Thermidor aux crevettes with a Mornay sauce\n" "\n" "$ # 隨機整數\n" @@ -1356,8 +1364,8 @@ msgstr "" "1.7080016272295635\n" "\n" "$ # 使用明確的引數\n" -"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor " -"aux crevettes with a Mornay sauce\"\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" "egg\n" "\n" "$ python -m random --integer 6\n" diff --git a/library/runpy.po b/library/runpy.po index 3b338bcfc3..3ff8f9771d 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -137,7 +137,7 @@ msgstr "" #: ../../library/runpy.rst:87 msgid "Added ``__cached__`` global variable (see :pep:`3147`)." -msgstr "" +msgstr "新增 ``__cached__`` 全域變數(請參閱 :pep:`3147`)。" #: ../../library/runpy.rst:90 msgid "" diff --git a/library/security_warnings.po b/library/security_warnings.po index 243d024c02..498084b77a 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2023-08-21 02:41+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -102,8 +102,8 @@ msgstr "" "`" #: ../../library/security_warnings.rst:31 -msgid ":mod:`xml`: :ref:`XML vulnerabilities `" -msgstr ":mod:`xml`::ref:`XML 漏洞 `" +msgid ":mod:`xml`: :ref:`XML security `" +msgstr ":mod:`xml`::ref:`XML 安全性 `" #: ../../library/security_warnings.rst:32 msgid "" @@ -129,5 +129,8 @@ msgstr "" msgid "security considerations" msgstr "security considerations(安全性注意事項)" +#~ msgid ":mod:`xml`: :ref:`XML vulnerabilities `" +#~ msgstr ":mod:`xml`::ref:`XML 漏洞 `" + #~ msgid ":mod:`cgi`: :ref:`CGI security considerations `" #~ msgstr ":mod:`cgi`::ref:`CGI 安全性注意事項 `" diff --git a/library/stdtypes.po b/library/stdtypes.po index 47a6ffbbe8..0c11bd015b 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -2626,6 +2626,12 @@ msgid "" ">>> 'Python'.center(4)\n" "'Python'" msgstr "" +">>> 'Python'.center(10)\n" +"' Python '\n" +">>> 'Python'.center(10, '-')\n" +"'--Python--'\n" +">>> 'Python'.center(4)\n" +"'Python'" #: ../../library/stdtypes.rst:1672 msgid "" @@ -2653,6 +2659,16 @@ msgid "" ">>> 'spam, spam, spam'.count('')\n" "17" msgstr "" +">>> 'spam, spam, spam'.count('spam')\n" +"3\n" +">>> 'spam, spam, spam'.count('spam', 5)\n" +"2\n" +">>> 'spam, spam, spam'.count('spam', 5, 10)\n" +"1\n" +">>> 'spam, spam, spam'.count('eggs')\n" +"0\n" +">>> 'spam, spam, spam'.count('')\n" +"17" #: ../../library/stdtypes.rst:1692 msgid "Return the string encoded to :class:`bytes`." @@ -2688,6 +2704,11 @@ msgid "" ">>> encoded_str_to_bytes\n" "b'Python'" msgstr "" +">>> encoded_str_to_bytes = 'Python'.encode()\n" +">>> type(encoded_str_to_bytes)\n" +"\n" +">>> encoded_str_to_bytes\n" +"b'Python'" #: ../../library/stdtypes.rst:1717 ../../library/stdtypes.rst:3045 msgid "Added support for keyword arguments." @@ -2719,10 +2740,18 @@ msgid "" ">>> 'Python is amazing'.endswith('is', 0, 9)\n" "True" msgstr "" +">>> 'Python'.endswith('on')\n" +"True\n" +">>> 'a tuple of suffixes'.endswith(('at', 'in'))\n" +"False\n" +">>> 'a tuple of suffixes'.endswith(('at', 'es'))\n" +"True\n" +">>> 'Python is amazing'.endswith('is', 0, 9)\n" +"True" #: ../../library/stdtypes.rst:1742 msgid "See also :meth:`startswith` and :meth:`removesuffix`." -msgstr "" +msgstr "另請參閱 :meth:`startswith` 和 :meth:`removesuffix`。" #: ../../library/stdtypes.rst:1747 msgid "" @@ -2741,7 +2770,6 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:1760 -#, fuzzy msgid "" ">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" "'01 012 0123 01234'\n" @@ -2751,10 +2779,13 @@ msgid "" "01 012\n" "0123 01234" msgstr "" -">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" -"b'01 012 0123 01234'\n" -">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" -"b'01 012 0123 01234'" +">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" +"'01 012 0123 01234'\n" +">>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"'01 012 0123 01234'\n" +">>> print('01\\t012\\n0123\\t01234'.expandtabs(4))\n" +"01 012\n" +"0123 01234" #: ../../library/stdtypes.rst:1771 msgid "" @@ -3283,6 +3314,12 @@ msgid "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" msgstr "" +">>> \"\".split(None, 0)\n" +"[]\n" +">>> \" \".split(None, 0)\n" +"[]\n" +">>> \" foo \".split(maxsplit=0)\n" +"['foo ']" #: ../../library/stdtypes.rst:2198 msgid "" diff --git a/library/string.po b/library/string.po index 5c7082916c..c488a87a64 100644 --- a/library/string.po +++ b/library/string.po @@ -422,7 +422,7 @@ msgid "" "define how the format specification is to be interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" -"何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`\\ )。它們也能夠直" +"何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`)。它們也能夠直" "接傳遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以" "定義格式規格如何被直譯。" @@ -573,7 +573,7 @@ msgstr "" #: ../../library/string.rst:402 msgid "Added the ``'z'`` option (see also :pep:`682`)." -msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" +msgstr "新增 ``'z'`` 選項(請見 :pep:`682`)。" #: ../../library/string.rst:407 msgid "" @@ -655,11 +655,11 @@ msgstr "" #: ../../library/string.rst:462 msgid "Added the ``','`` option (see also :pep:`378`)." -msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" +msgstr "新增 ``','`` 選項(請見 :pep:`378`)。" #: ../../library/string.rst:465 msgid "Added the ``'_'`` option (see also :pep:`515`)." -msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" +msgstr "新增 ``'_'`` 選項(請見 :pep:`515`)。" #: ../../library/string.rst:468 msgid "" diff --git a/library/struct.po b/library/struct.po index 690def85aa..b24bc454b8 100644 --- a/library/struct.po +++ b/library/struct.po @@ -618,7 +618,7 @@ msgstr "" #: ../../library/struct.rst:291 msgid "Added use of the :meth:`~object.__index__` method for non-integers." -msgstr "" +msgstr "新增對非整數使用 :meth:`~object.__index__` 方法的支援。" #: ../../library/struct.rst:295 msgid "" diff --git a/library/sys.po b/library/sys.po index b4321d66db..07e572cfeb 100644 --- a/library/sys.po +++ b/library/sys.po @@ -1559,7 +1559,7 @@ msgstr "" #: ../../library/sys.rst:1247 msgid "See also the :exc:`PythonFinalizationError` exception." -msgstr "" +msgstr "另請參閱 :exc:`PythonFinalizationError` 例外。" #: ../../library/sys.rst:1253 msgid "" diff --git a/library/tarfile.po b/library/tarfile.po index e996b848ab..8d4ea43807 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -1,13 +1,13 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-07-07 01:58+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-" @@ -68,7 +68,7 @@ msgstr "" #: ../../library/tarfile.rst:36 msgid "Added support for :mod:`lzma` compression." -msgstr "" +msgstr "新增對 :mod:`lzma` 壓縮的支援。" #: ../../library/tarfile.rst:39 msgid "" @@ -91,18 +91,20 @@ msgid "" "*mode* has to be a string of the form ``'filemode[:compression]'``, it " "defaults to ``'r'``. Here is a full list of mode combinations:" msgstr "" +"*mode* 必須是 ``'filemode[:compression]'`` 形式的字串,預設為 ``'r'``。以下是所有可" +"能的模式組合:" #: ../../library/tarfile.rst:57 msgid "mode" -msgstr "" +msgstr "模式" #: ../../library/tarfile.rst:57 msgid "action" -msgstr "" +msgstr "操作" #: ../../library/tarfile.rst:59 -msgid "``'r' or 'r:*'``" -msgstr "``'r' 或 'r:*'``" +msgid "``'r'`` or ``'r:*'``" +msgstr "``'r'`` 或 ``'r:*'``" #: ../../library/tarfile.rst:59 msgid "Open for reading with transparent compression (recommended)." @@ -122,7 +124,7 @@ msgstr "``'r:gz'``" #: ../../library/tarfile.rst:65 msgid "Open for reading with gzip compression." -msgstr "" +msgstr "開啟以讀取 gzip 壓縮。" #: ../../library/tarfile.rst:67 msgid "``'r:bz2'``" @@ -130,7 +132,7 @@ msgstr "``'r:bz2'``" #: ../../library/tarfile.rst:67 msgid "Open for reading with bzip2 compression." -msgstr "" +msgstr "開啟以讀取 bzip2 壓縮。" #: ../../library/tarfile.rst:69 msgid "``'r:xz'``" @@ -138,7 +140,7 @@ msgstr "``'r:xz'``" #: ../../library/tarfile.rst:69 msgid "Open for reading with lzma compression." -msgstr "" +msgstr "開啟以讀取 lzma 壓縮。" #: ../../library/tarfile.rst:71 msgid "``'x'`` or ``'x:'``" @@ -181,8 +183,8 @@ msgid "" msgstr "" #: ../../library/tarfile.rst:88 -msgid "``'a' or 'a:'``" -msgstr "``'a' 或 'a:'``" +msgid "``'a'`` or ``'a:'``" +msgstr "``'a'`` 或 ``'a:'``" #: ../../library/tarfile.rst:88 msgid "" @@ -191,38 +193,38 @@ msgid "" msgstr "" #: ../../library/tarfile.rst:91 -msgid "``'w' or 'w:'``" -msgstr "``'w' 或 'w:'``" +msgid "``'w'`` or ``'w:'``" +msgstr "``'w'`` 或 ``'w:'``" #: ../../library/tarfile.rst:91 msgid "Open for uncompressed writing." msgstr "" -#: ../../library/tarfile.rst:93 +#: ../../library/tarfile.rst:94 msgid "``'w:gz'``" msgstr "``'w:gz'``" -#: ../../library/tarfile.rst:93 +#: ../../library/tarfile.rst:94 msgid "Open for gzip compressed writing." -msgstr "" +msgstr "開啟以用於 gzip 壓縮寫入。" -#: ../../library/tarfile.rst:95 +#: ../../library/tarfile.rst:96 msgid "``'w:bz2'``" msgstr "``'w:bz2'``" -#: ../../library/tarfile.rst:95 +#: ../../library/tarfile.rst:96 msgid "Open for bzip2 compressed writing." -msgstr "" +msgstr "開啟以用於 bzip2 壓縮寫入。" -#: ../../library/tarfile.rst:97 +#: ../../library/tarfile.rst:98 msgid "``'w:xz'``" msgstr "``'w:xz'``" -#: ../../library/tarfile.rst:97 +#: ../../library/tarfile.rst:98 msgid "Open for lzma compressed writing." -msgstr "" +msgstr "開啟以用於 lzma 壓縮寫入。" -#: ../../library/tarfile.rst:100 +#: ../../library/tarfile.rst:101 msgid "" "Note that ``'a:gz'``, ``'a:bz2'`` or ``'a:xz'`` is not possible. If *mode* " "is not suitable to open a certain (compressed) file for reading, :exc:" @@ -230,26 +232,26 @@ msgid "" "method is not supported, :exc:`CompressionError` is raised." msgstr "" -#: ../../library/tarfile.rst:105 +#: ../../library/tarfile.rst:106 msgid "" "If *fileobj* is specified, it is used as an alternative to a :term:`file " "object` opened in binary mode for *name*. It is supposed to be at position 0." msgstr "" -#: ../../library/tarfile.rst:108 +#: ../../library/tarfile.rst:109 msgid "" "For modes ``'w:gz'``, ``'x:gz'``, ``'w|gz'``, ``'w:bz2'``, ``'x:bz2'``, ``'w|" "bz2'``, :func:`tarfile.open` accepts the keyword argument *compresslevel* " "(default ``9``) to specify the compression level of the file." msgstr "" -#: ../../library/tarfile.rst:112 +#: ../../library/tarfile.rst:113 msgid "" "For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the " "keyword argument *preset* to specify the compression level of the file." msgstr "" -#: ../../library/tarfile.rst:115 +#: ../../library/tarfile.rst:116 msgid "" "For special purposes, there is a second format for *mode*: ``'filemode|" "[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` " @@ -263,186 +265,186 @@ msgid "" "random access, see :ref:`tar-examples`. The currently possible modes:" msgstr "" -#: ../../library/tarfile.rst:129 +#: ../../library/tarfile.rst:130 msgid "Mode" -msgstr "" +msgstr "模式" -#: ../../library/tarfile.rst:129 +#: ../../library/tarfile.rst:130 msgid "Action" -msgstr "" +msgstr "操作" -#: ../../library/tarfile.rst:131 +#: ../../library/tarfile.rst:132 msgid "``'r|*'``" msgstr "``'r|*'``" -#: ../../library/tarfile.rst:131 +#: ../../library/tarfile.rst:132 msgid "Open a *stream* of tar blocks for reading with transparent compression." msgstr "" -#: ../../library/tarfile.rst:134 +#: ../../library/tarfile.rst:135 msgid "``'r|'``" msgstr "``'r|'``" -#: ../../library/tarfile.rst:134 +#: ../../library/tarfile.rst:135 msgid "Open a *stream* of uncompressed tar blocks for reading." msgstr "" -#: ../../library/tarfile.rst:137 +#: ../../library/tarfile.rst:138 msgid "``'r|gz'``" msgstr "``'r|gz'``" -#: ../../library/tarfile.rst:137 +#: ../../library/tarfile.rst:138 msgid "Open a gzip compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:140 +#: ../../library/tarfile.rst:141 msgid "``'r|bz2'``" msgstr "``'r|bz2'``" -#: ../../library/tarfile.rst:140 +#: ../../library/tarfile.rst:141 msgid "Open a bzip2 compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:143 +#: ../../library/tarfile.rst:144 msgid "``'r|xz'``" msgstr "``'r|xz'``" -#: ../../library/tarfile.rst:143 +#: ../../library/tarfile.rst:144 msgid "Open an lzma compressed *stream* for reading." msgstr "" -#: ../../library/tarfile.rst:146 +#: ../../library/tarfile.rst:147 msgid "``'w|'``" msgstr "``'w|'``" -#: ../../library/tarfile.rst:146 +#: ../../library/tarfile.rst:147 msgid "Open an uncompressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:148 +#: ../../library/tarfile.rst:149 msgid "``'w|gz'``" msgstr "``'w|gz'``" -#: ../../library/tarfile.rst:148 +#: ../../library/tarfile.rst:149 msgid "Open a gzip compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:151 +#: ../../library/tarfile.rst:152 msgid "``'w|bz2'``" msgstr "``'w|bz2'``" -#: ../../library/tarfile.rst:151 +#: ../../library/tarfile.rst:152 msgid "Open a bzip2 compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:154 +#: ../../library/tarfile.rst:155 msgid "``'w|xz'``" msgstr "``'w|xz'``" -#: ../../library/tarfile.rst:154 +#: ../../library/tarfile.rst:155 msgid "Open an lzma compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:158 ../../library/tarfile.rst:434 +#: ../../library/tarfile.rst:159 ../../library/tarfile.rst:435 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/tarfile.rst:161 ../../library/tarfile.rst:437 -#: ../../library/tarfile.rst:682 +#: ../../library/tarfile.rst:162 ../../library/tarfile.rst:438 +#: ../../library/tarfile.rst:683 msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:164 +#: ../../library/tarfile.rst:165 msgid "The *compresslevel* keyword argument also works for streams." msgstr "" -#: ../../library/tarfile.rst:171 +#: ../../library/tarfile.rst:172 msgid "" "Class for reading and writing tar archives. Do not use this class directly: " "use :func:`tarfile.open` instead. See :ref:`tarfile-objects`." msgstr "" -#: ../../library/tarfile.rst:177 +#: ../../library/tarfile.rst:178 msgid "" "Return :const:`True` if *name* is a tar archive file, that the :mod:" "`tarfile` module can read. *name* may be a :class:`str`, file, or file-like " "object." msgstr "" -#: ../../library/tarfile.rst:180 +#: ../../library/tarfile.rst:181 msgid "Support for file and file-like objects." msgstr "" -#: ../../library/tarfile.rst:184 +#: ../../library/tarfile.rst:185 msgid "The :mod:`tarfile` module defines the following exceptions:" msgstr "" -#: ../../library/tarfile.rst:189 +#: ../../library/tarfile.rst:190 msgid "Base class for all :mod:`tarfile` exceptions." msgstr "" -#: ../../library/tarfile.rst:194 +#: ../../library/tarfile.rst:195 msgid "" "Is raised when a tar archive is opened, that either cannot be handled by " "the :mod:`tarfile` module or is somehow invalid." msgstr "" -#: ../../library/tarfile.rst:200 +#: ../../library/tarfile.rst:201 msgid "" "Is raised when a compression method is not supported or when the data cannot " "be decoded properly." msgstr "" -#: ../../library/tarfile.rst:206 +#: ../../library/tarfile.rst:207 msgid "" "Is raised for the limitations that are typical for stream-like :class:" "`TarFile` objects." msgstr "" -#: ../../library/tarfile.rst:212 +#: ../../library/tarfile.rst:213 msgid "" "Is raised for *non-fatal* errors when using :meth:`TarFile.extract`, but " "only if :attr:`TarFile.errorlevel`\\ ``== 2``." msgstr "" -#: ../../library/tarfile.rst:218 +#: ../../library/tarfile.rst:219 msgid "Is raised by :meth:`TarInfo.frombuf` if the buffer it gets is invalid." msgstr "" -#: ../../library/tarfile.rst:223 +#: ../../library/tarfile.rst:224 msgid "" "Base class for members :ref:`refused ` by filters." msgstr "" -#: ../../library/tarfile.rst:228 +#: ../../library/tarfile.rst:229 msgid "" "Information about the member that the filter refused to extract, as :ref:" "`TarInfo `." msgstr "" -#: ../../library/tarfile.rst:233 +#: ../../library/tarfile.rst:234 msgid "Raised to refuse extracting a member with an absolute path." msgstr "" -#: ../../library/tarfile.rst:237 +#: ../../library/tarfile.rst:238 msgid "Raised to refuse extracting a member outside the destination directory." msgstr "" -#: ../../library/tarfile.rst:241 +#: ../../library/tarfile.rst:242 msgid "Raised to refuse extracting a special file (e.g. a device or pipe)." msgstr "" -#: ../../library/tarfile.rst:245 +#: ../../library/tarfile.rst:246 msgid "Raised to refuse extracting a symbolic link with an absolute path." msgstr "" -#: ../../library/tarfile.rst:249 +#: ../../library/tarfile.rst:250 msgid "" "Raised to refuse extracting a symbolic link pointing outside the destination " "directory." msgstr "" -#: ../../library/tarfile.rst:254 +#: ../../library/tarfile.rst:255 msgid "" "Raised to refuse emulating a link (hard or symbolic) by extracting another " "archive member, when that member would be rejected by the filter location. " @@ -450,124 +452,124 @@ msgid "" "as :attr:`!BaseException.__context__`." msgstr "" -#: ../../library/tarfile.rst:262 +#: ../../library/tarfile.rst:263 msgid "The following constants are available at the module level:" msgstr "" -#: ../../library/tarfile.rst:266 +#: ../../library/tarfile.rst:267 msgid "" "The default character encoding: ``'utf-8'`` on Windows, the value returned " "by :func:`sys.getfilesystemencoding` otherwise." msgstr "" -#: ../../library/tarfile.rst:272 +#: ../../library/tarfile.rst:273 msgid "A regular file :attr:`~TarInfo.type`." -msgstr "" +msgstr "一個普通檔案 :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:276 +#: ../../library/tarfile.rst:277 msgid "A link (inside tarfile) :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:280 +#: ../../library/tarfile.rst:281 msgid "A symbolic link :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:284 +#: ../../library/tarfile.rst:285 msgid "A character special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:288 +#: ../../library/tarfile.rst:289 msgid "A block special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:292 +#: ../../library/tarfile.rst:293 msgid "A directory :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:296 +#: ../../library/tarfile.rst:297 msgid "A FIFO special device :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:300 +#: ../../library/tarfile.rst:301 msgid "A contiguous file :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:304 +#: ../../library/tarfile.rst:305 msgid "A GNU tar longname :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:308 +#: ../../library/tarfile.rst:309 msgid "A GNU tar longlink :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:312 +#: ../../library/tarfile.rst:313 msgid "A GNU tar sparse file :attr:`~TarInfo.type`." msgstr "" -#: ../../library/tarfile.rst:315 +#: ../../library/tarfile.rst:316 msgid "" "Each of the following constants defines a tar archive format that the :mod:" "`tarfile` module is able to create. See section :ref:`tar-formats` for " "details." msgstr "" -#: ../../library/tarfile.rst:322 +#: ../../library/tarfile.rst:323 msgid "POSIX.1-1988 (ustar) format." -msgstr "" +msgstr "POSIX.1-1988 (ustar) 格式。" -#: ../../library/tarfile.rst:327 +#: ../../library/tarfile.rst:328 msgid "GNU tar format." -msgstr "" +msgstr "GNU tar 格式。" -#: ../../library/tarfile.rst:332 +#: ../../library/tarfile.rst:333 msgid "POSIX.1-2001 (pax) format." -msgstr "" +msgstr "POSIX.1-2001 (pax) 格式。" -#: ../../library/tarfile.rst:337 +#: ../../library/tarfile.rst:338 msgid "" "The default format for creating archives. This is currently :const:" "`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:339 +#: ../../library/tarfile.rst:340 msgid "" "The default format for new archives was changed to :const:`PAX_FORMAT` from :" "const:`GNU_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:346 +#: ../../library/tarfile.rst:347 msgid "Module :mod:`zipfile`" msgstr ":mod:`zipfile` 模組" -#: ../../library/tarfile.rst:347 +#: ../../library/tarfile.rst:348 msgid "Documentation of the :mod:`zipfile` standard module." -msgstr "" +msgstr ":mod:`zipfile` 標準模組的文件。" -#: ../../library/tarfile.rst:349 +#: ../../library/tarfile.rst:350 msgid ":ref:`archiving-operations`" msgstr ":ref:`archiving-operations`" -#: ../../library/tarfile.rst:350 +#: ../../library/tarfile.rst:351 msgid "" "Documentation of the higher-level archiving facilities provided by the " "standard :mod:`shutil` module." msgstr "" -#: ../../library/tarfile.rst:353 +#: ../../library/tarfile.rst:354 msgid "" "`GNU tar manual, Basic Tar Format `_" msgstr "" -#: ../../library/tarfile.rst:354 +#: ../../library/tarfile.rst:355 msgid "Documentation for tar archive files, including GNU tar extensions." msgstr "" -#: ../../library/tarfile.rst:360 +#: ../../library/tarfile.rst:361 msgid "TarFile Objects" msgstr "TarFile 物件" -#: ../../library/tarfile.rst:362 +#: ../../library/tarfile.rst:363 msgid "" "The :class:`TarFile` object provides an interface to a tar archive. A tar " "archive is a sequence of blocks. An archive member (a stored file) is made " @@ -576,7 +578,7 @@ msgid "" "class:`TarInfo` object, see :ref:`tarinfo-objects` for details." msgstr "" -#: ../../library/tarfile.rst:368 +#: ../../library/tarfile.rst:369 msgid "" "A :class:`TarFile` object can be used as a context manager in a :keyword:" "`with` statement. It will automatically be closed when the block is " @@ -585,24 +587,24 @@ msgid "" "be closed. See the :ref:`tar-examples` section for a use case." msgstr "" -#: ../../library/tarfile.rst:374 +#: ../../library/tarfile.rst:375 msgid "Added support for the context management protocol." -msgstr "" +msgstr "新增對情境管理協定的支援。" -#: ../../library/tarfile.rst:379 +#: ../../library/tarfile.rst:380 msgid "" "All following arguments are optional and can be accessed as instance " "attributes as well." msgstr "" -#: ../../library/tarfile.rst:382 +#: ../../library/tarfile.rst:383 msgid "" "*name* is the pathname of the archive. *name* may be a :term:`path-like " "object`. It can be omitted if *fileobj* is given. In this case, the file " "object's :attr:`!name` attribute is used if it exists." msgstr "" -#: ../../library/tarfile.rst:386 +#: ../../library/tarfile.rst:387 msgid "" "*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append " "data to an existing file, ``'w'`` to create a new file overwriting an " @@ -610,18 +612,18 @@ msgid "" "exist." msgstr "" -#: ../../library/tarfile.rst:390 +#: ../../library/tarfile.rst:391 msgid "" "If *fileobj* is given, it is used for reading or writing data. If it can be " "determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used " "from position 0." msgstr "" -#: ../../library/tarfile.rst:396 +#: ../../library/tarfile.rst:397 msgid "*fileobj* is not closed, when :class:`TarFile` is closed." msgstr "" -#: ../../library/tarfile.rst:398 +#: ../../library/tarfile.rst:399 msgid "" "*format* controls the archive format for writing. It must be one of the " "constants :const:`USTAR_FORMAT`, :const:`GNU_FORMAT` or :const:`PAX_FORMAT` " @@ -629,20 +631,20 @@ msgid "" "detected, even if different formats are present in a single archive." msgstr "" -#: ../../library/tarfile.rst:403 +#: ../../library/tarfile.rst:404 msgid "" "The *tarinfo* argument can be used to replace the default :class:`TarInfo` " "class with a different one." msgstr "" -#: ../../library/tarfile.rst:406 +#: ../../library/tarfile.rst:407 msgid "" "If *dereference* is :const:`False`, add symbolic and hard links to the " "archive. If it is :const:`True`, add the content of the target files to the " "archive. This has no effect on systems that do not support symbolic links." msgstr "" -#: ../../library/tarfile.rst:410 +#: ../../library/tarfile.rst:411 msgid "" "If *ignore_zeros* is :const:`False`, treat an empty block as the end of the " "archive. If it is :const:`True`, skip empty (and invalid) blocks and try to " @@ -650,19 +652,19 @@ msgid "" "concatenated or damaged archives." msgstr "" -#: ../../library/tarfile.rst:414 +#: ../../library/tarfile.rst:415 msgid "" "*debug* can be set from ``0`` (no debug messages) up to ``3`` (all debug " "messages). The messages are written to ``sys.stderr``." msgstr "" -#: ../../library/tarfile.rst:417 +#: ../../library/tarfile.rst:418 msgid "" "*errorlevel* controls how extraction errors are handled, see :attr:`the " "corresponding attribute `." msgstr "" -#: ../../library/tarfile.rst:420 +#: ../../library/tarfile.rst:421 msgid "" "The *encoding* and *errors* arguments define the character encoding to be " "used for reading or writing the archive and how conversion errors are going " @@ -670,57 +672,57 @@ msgid "" "ref:`tar-unicode` for in-depth information." msgstr "" -#: ../../library/tarfile.rst:425 +#: ../../library/tarfile.rst:426 msgid "" "The *pax_headers* argument is an optional dictionary of strings which will " "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:428 +#: ../../library/tarfile.rst:429 msgid "" "If *stream* is set to :const:`True` then while reading the archive info " "about files in the archive are not cached, saving memory." msgstr "" -#: ../../library/tarfile.rst:431 ../../library/tarfile.rst:751 +#: ../../library/tarfile.rst:432 ../../library/tarfile.rst:752 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." -msgstr "" +msgstr "使用 ``'surrogateescape'`` 作為 *errors* 引數的預設值。" -#: ../../library/tarfile.rst:440 +#: ../../library/tarfile.rst:441 msgid "Add the *stream* parameter." msgstr "新增 *stream* 參數。" -#: ../../library/tarfile.rst:445 +#: ../../library/tarfile.rst:446 msgid "" "Alternative constructor. The :func:`tarfile.open` function is actually a " "shortcut to this classmethod." msgstr "" -#: ../../library/tarfile.rst:451 +#: ../../library/tarfile.rst:452 msgid "" "Return a :class:`TarInfo` object for member *name*. If *name* can not be " "found in the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:456 +#: ../../library/tarfile.rst:457 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -#: ../../library/tarfile.rst:462 +#: ../../library/tarfile.rst:463 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -#: ../../library/tarfile.rst:468 +#: ../../library/tarfile.rst:469 msgid "" "Return the members as a list of their names. It has the same order as the " "list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:474 +#: ../../library/tarfile.rst:475 msgid "" "Print a table of contents to ``sys.stdout``. If *verbose* is :const:`False`, " "only the names of the members are printed. If it is :const:`True`, output " @@ -728,18 +730,18 @@ msgid "" "given, it must be a subset of the list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:479 +#: ../../library/tarfile.rst:480 msgid "Added the *members* parameter." msgstr "新增 *members* 參數。" -#: ../../library/tarfile.rst:485 +#: ../../library/tarfile.rst:486 msgid "" "Return the next member of the archive as a :class:`TarInfo` object, when :" "class:`TarFile` is opened for reading. Return :const:`None` if there is no " "more available." msgstr "" -#: ../../library/tarfile.rst:492 +#: ../../library/tarfile.rst:493 msgid "" "Extract all members from the archive to the current working directory or " "directory *path*. If optional *members* is given, it must be a subset of the " @@ -751,14 +753,14 @@ msgid "" "fail." msgstr "" -#: ../../library/tarfile.rst:500 +#: ../../library/tarfile.rst:501 msgid "" "If *numeric_owner* is :const:`True`, the uid and gid numbers from the " "tarfile are used to set the owner/group for the extracted files. Otherwise, " "the named values from the tarfile are used." msgstr "" -#: ../../library/tarfile.rst:504 +#: ../../library/tarfile.rst:505 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " @@ -766,7 +768,7 @@ msgid "" "need to support." msgstr "" -#: ../../library/tarfile.rst:512 +#: ../../library/tarfile.rst:513 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -774,26 +776,26 @@ msgid "" "\"``." msgstr "" -#: ../../library/tarfile.rst:517 ../../library/tarfile.rst:550 +#: ../../library/tarfile.rst:518 ../../library/tarfile.rst:551 msgid "" "Set ``filter='data'`` to prevent the most dangerous security issues, and " "read the :ref:`tarfile-extraction-filter` section for details." msgstr "" -#: ../../library/tarfile.rst:520 ../../library/tarfile.rst:556 +#: ../../library/tarfile.rst:521 ../../library/tarfile.rst:557 msgid "Added the *numeric_owner* parameter." msgstr "新增 *numeric_owner* 參數。" -#: ../../library/tarfile.rst:523 ../../library/tarfile.rst:559 +#: ../../library/tarfile.rst:524 ../../library/tarfile.rst:560 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:526 ../../library/tarfile.rst:562 -#: ../../library/tarfile.rst:644 +#: ../../library/tarfile.rst:527 ../../library/tarfile.rst:563 +#: ../../library/tarfile.rst:645 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/tarfile.rst:532 +#: ../../library/tarfile.rst:533 msgid "" "Extract a member from the archive to the current working directory, using " "its full name. Its file information is extracted as accurately as possible. " @@ -802,27 +804,27 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" -#: ../../library/tarfile.rst:538 +#: ../../library/tarfile.rst:539 msgid "" "The *numeric_owner* and *filter* arguments are the same as for :meth:" "`extractall`." msgstr "" -#: ../../library/tarfile.rst:543 +#: ../../library/tarfile.rst:544 msgid "" "The :meth:`extract` method does not take care of several extraction issues. " "In most cases you should consider using the :meth:`extractall` method." msgstr "" -#: ../../library/tarfile.rst:548 +#: ../../library/tarfile.rst:549 msgid "See the warning for :meth:`extractall`." msgstr "參閱 :meth:`extractall` 的警告。" -#: ../../library/tarfile.rst:553 +#: ../../library/tarfile.rst:554 msgid "Added the *set_attrs* parameter." msgstr "增加 *set_attrs* 參數。" -#: ../../library/tarfile.rst:568 +#: ../../library/tarfile.rst:569 msgid "" "Extract a member from the archive as a file object. *member* may be a " "filename or a :class:`TarInfo` object. If *member* is a regular file or a " @@ -831,17 +833,17 @@ msgid "" "the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:574 +#: ../../library/tarfile.rst:575 msgid "Return an :class:`io.BufferedReader` object." msgstr "" -#: ../../library/tarfile.rst:577 +#: ../../library/tarfile.rst:578 msgid "" "The returned :class:`io.BufferedReader` object has the :attr:`!mode` " "attribute which is always equal to ``'rb'``." msgstr "" -#: ../../library/tarfile.rst:584 +#: ../../library/tarfile.rst:585 msgid "" "If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." "extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " @@ -851,39 +853,39 @@ msgid "" "exc:`TarError` exceptions as well." msgstr "" -#: ../../library/tarfile.rst:592 +#: ../../library/tarfile.rst:593 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" -#: ../../library/tarfile.rst:595 +#: ../../library/tarfile.rst:596 msgid "" "Custom :ref:`extraction filters ` should raise :" "exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " "ones." msgstr "" -#: ../../library/tarfile.rst:599 +#: ../../library/tarfile.rst:600 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" -#: ../../library/tarfile.rst:606 +#: ../../library/tarfile.rst:607 msgid "" "The :ref:`extraction filter ` used as a default " "for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`." msgstr "" -#: ../../library/tarfile.rst:610 +#: ../../library/tarfile.rst:611 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" -#: ../../library/tarfile.rst:614 +#: ../../library/tarfile.rst:615 msgid "" "If ``extraction_filter`` is ``None`` (the default), calling an extraction " "method without a *filter* argument will raise a ``DeprecationWarning``, and " @@ -891,13 +893,13 @@ msgid "" "dangerous behavior matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:620 +#: ../../library/tarfile.rst:621 msgid "" "In Python 3.14+, leaving ``extraction_filter=None`` will cause extraction " "methods to use the :func:`data ` filter by default." msgstr "" -#: ../../library/tarfile.rst:623 +#: ../../library/tarfile.rst:624 msgid "" "The attribute may be set on instances or overridden in subclasses. It also " "is possible to set it on the ``TarFile`` class itself to set a global " @@ -907,7 +909,7 @@ msgid "" "wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." msgstr "" -#: ../../library/tarfile.rst:633 +#: ../../library/tarfile.rst:634 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " @@ -920,11 +922,11 @@ msgid "" "ref:`tar-examples` for an example." msgstr "" -#: ../../library/tarfile.rst:647 +#: ../../library/tarfile.rst:648 msgid "Recursion adds entries in sorted order." msgstr "" -#: ../../library/tarfile.rst:653 +#: ../../library/tarfile.rst:654 msgid "" "Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " "represents a non zero-size regular file, the *fileobj* argument should be a :" @@ -933,11 +935,11 @@ msgid "" "meth:`gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:660 +#: ../../library/tarfile.rst:661 msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" -#: ../../library/tarfile.rst:665 +#: ../../library/tarfile.rst:666 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -948,7 +950,7 @@ msgid "" "The name should be a text string." msgstr "" -#: ../../library/tarfile.rst:674 +#: ../../library/tarfile.rst:675 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " @@ -958,21 +960,21 @@ msgid "" "case *arcname* could be a dummy string." msgstr "" -#: ../../library/tarfile.rst:688 +#: ../../library/tarfile.rst:689 msgid "" "Close the :class:`TarFile`. In write mode, two finishing zero blocks are " "appended to the archive." msgstr "" -#: ../../library/tarfile.rst:695 +#: ../../library/tarfile.rst:696 msgid "A dictionary containing key-value pairs of pax global headers." msgstr "" -#: ../../library/tarfile.rst:702 +#: ../../library/tarfile.rst:703 msgid "TarInfo Objects" msgstr "TarInfo 物件" -#: ../../library/tarfile.rst:704 +#: ../../library/tarfile.rst:705 msgid "" "A :class:`TarInfo` object represents one member in a :class:`TarFile`. Aside " "from storing all required attributes of a file (like file type, size, time, " @@ -980,14 +982,14 @@ msgid "" "type. It does *not* contain the file's data itself." msgstr "" -#: ../../library/tarfile.rst:709 +#: ../../library/tarfile.rst:710 msgid "" ":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" "`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." "gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:713 +#: ../../library/tarfile.rst:714 msgid "" "Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" "`~TarFile.getmembers` will affect all subsequent operations on the archive. " @@ -996,82 +998,82 @@ msgid "" "step." msgstr "" -#: ../../library/tarfile.rst:719 +#: ../../library/tarfile.rst:720 msgid "" "Several attributes can be set to ``None`` to indicate that a piece of " "metadata is unused or unknown. Different :class:`TarInfo` methods handle " "``None`` differently:" msgstr "" -#: ../../library/tarfile.rst:723 +#: ../../library/tarfile.rst:724 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" -#: ../../library/tarfile.rst:725 +#: ../../library/tarfile.rst:726 msgid ":meth:`~TarFile.addfile` will fail." msgstr "" -#: ../../library/tarfile.rst:726 +#: ../../library/tarfile.rst:727 msgid ":meth:`~TarFile.list` will print a placeholder string." msgstr "" -#: ../../library/tarfile.rst:730 +#: ../../library/tarfile.rst:731 msgid "Create a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:735 +#: ../../library/tarfile.rst:736 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -#: ../../library/tarfile.rst:737 +#: ../../library/tarfile.rst:738 msgid "Raises :exc:`HeaderError` if the buffer is invalid." msgstr "" -#: ../../library/tarfile.rst:742 +#: ../../library/tarfile.rst:743 msgid "" "Read the next member from the :class:`TarFile` object *tarfile* and return " "it as a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:748 +#: ../../library/tarfile.rst:749 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:755 +#: ../../library/tarfile.rst:756 msgid "A ``TarInfo`` object has the following public data attributes:" msgstr "" -#: ../../library/tarfile.rst:761 +#: ../../library/tarfile.rst:762 msgid "Name of the archive member." msgstr "" -#: ../../library/tarfile.rst:767 +#: ../../library/tarfile.rst:768 msgid "Size in bytes." msgstr "" -#: ../../library/tarfile.rst:773 +#: ../../library/tarfile.rst:774 msgid "" "Time of last modification in seconds since the :ref:`epoch `, as in :" "attr:`os.stat_result.st_mtime`." msgstr "" -#: ../../library/tarfile.rst:778 ../../library/tarfile.rst:789 -#: ../../library/tarfile.rst:821 ../../library/tarfile.rst:832 -#: ../../library/tarfile.rst:843 ../../library/tarfile.rst:854 +#: ../../library/tarfile.rst:779 ../../library/tarfile.rst:790 +#: ../../library/tarfile.rst:822 ../../library/tarfile.rst:833 +#: ../../library/tarfile.rst:844 ../../library/tarfile.rst:855 msgid "" "Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`, causing extraction to skip applying this attribute." msgstr "" -#: ../../library/tarfile.rst:785 +#: ../../library/tarfile.rst:786 msgid "Permission bits, as for :func:`os.chmod`." msgstr "" -#: ../../library/tarfile.rst:795 +#: ../../library/tarfile.rst:796 msgid "" "File type. *type* is usually one of these constants: :const:`REGTYPE`, :" "const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" @@ -1080,128 +1082,128 @@ msgid "" "more conveniently, use the ``is*()`` methods below." msgstr "" -#: ../../library/tarfile.rst:805 +#: ../../library/tarfile.rst:806 msgid "" "Name of the target file name, which is only present in :class:`TarInfo` " "objects of type :const:`LNKTYPE` and :const:`SYMTYPE`." msgstr "" -#: ../../library/tarfile.rst:808 +#: ../../library/tarfile.rst:809 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" -#: ../../library/tarfile.rst:817 +#: ../../library/tarfile.rst:818 msgid "User ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:828 +#: ../../library/tarfile.rst:829 msgid "Group ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:839 +#: ../../library/tarfile.rst:840 msgid "User name." msgstr "" -#: ../../library/tarfile.rst:850 +#: ../../library/tarfile.rst:851 msgid "Group name." msgstr "" -#: ../../library/tarfile.rst:861 +#: ../../library/tarfile.rst:862 msgid "Header checksum." msgstr "" -#: ../../library/tarfile.rst:867 +#: ../../library/tarfile.rst:868 msgid "Device major number." msgstr "" -#: ../../library/tarfile.rst:873 +#: ../../library/tarfile.rst:874 msgid "Device minor number." msgstr "" -#: ../../library/tarfile.rst:879 +#: ../../library/tarfile.rst:880 msgid "The tar header starts here." msgstr "" -#: ../../library/tarfile.rst:885 +#: ../../library/tarfile.rst:886 msgid "The file's data starts here." msgstr "" -#: ../../library/tarfile.rst:890 +#: ../../library/tarfile.rst:891 msgid "Sparse member information." msgstr "" -#: ../../library/tarfile.rst:896 +#: ../../library/tarfile.rst:897 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "" -#: ../../library/tarfile.rst:904 +#: ../../library/tarfile.rst:905 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" -#: ../../library/tarfile.rst:908 +#: ../../library/tarfile.rst:909 msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" msgstr "new_tarinfo = old_tarinfo.replace(gname='staff')" -#: ../../library/tarfile.rst:910 +#: ../../library/tarfile.rst:911 msgid "" "By default, a deep copy is made. If *deep* is false, the copy is shallow, i." "e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" -#: ../../library/tarfile.rst:914 +#: ../../library/tarfile.rst:915 msgid "A :class:`TarInfo` object also provides some convenient query methods:" msgstr "" -#: ../../library/tarfile.rst:919 +#: ../../library/tarfile.rst:920 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" -#: ../../library/tarfile.rst:924 +#: ../../library/tarfile.rst:925 msgid "Same as :meth:`isfile`." msgstr "" -#: ../../library/tarfile.rst:929 +#: ../../library/tarfile.rst:930 msgid "Return :const:`True` if it is a directory." -msgstr "" +msgstr "如果它是一個目錄,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:934 +#: ../../library/tarfile.rst:935 msgid "Return :const:`True` if it is a symbolic link." -msgstr "" +msgstr "如果它是一個符號連結,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:939 +#: ../../library/tarfile.rst:940 msgid "Return :const:`True` if it is a hard link." msgstr "" -#: ../../library/tarfile.rst:944 +#: ../../library/tarfile.rst:945 msgid "Return :const:`True` if it is a character device." -msgstr "" +msgstr "如果它是一個字元裝置,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:949 +#: ../../library/tarfile.rst:950 msgid "Return :const:`True` if it is a block device." -msgstr "" +msgstr "如果它是一個區塊裝置,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:954 +#: ../../library/tarfile.rst:955 msgid "Return :const:`True` if it is a FIFO." -msgstr "" +msgstr "如果它是一個 FIFO,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:959 +#: ../../library/tarfile.rst:960 msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." -msgstr "" +msgstr "如果它是一個字元裝置、區塊裝置或 FIFO,則回傳 :const:`True`。" -#: ../../library/tarfile.rst:965 +#: ../../library/tarfile.rst:966 msgid "Extraction filters" msgstr "" -#: ../../library/tarfile.rst:969 +#: ../../library/tarfile.rst:970 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1211,66 +1213,66 @@ msgid "" "components, or symlinks that affect later members)." msgstr "" -#: ../../library/tarfile.rst:977 +#: ../../library/tarfile.rst:978 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" -#: ../../library/tarfile.rst:983 +#: ../../library/tarfile.rst:984 msgid ":pep:`706`" msgstr ":pep:`706`" -#: ../../library/tarfile.rst:984 +#: ../../library/tarfile.rst:985 msgid "Contains further motivation and rationale behind the design." msgstr "" -#: ../../library/tarfile.rst:986 +#: ../../library/tarfile.rst:987 msgid "" "The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." "extractall` can be:" msgstr "" -#: ../../library/tarfile.rst:989 +#: ../../library/tarfile.rst:990 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" -#: ../../library/tarfile.rst:994 +#: ../../library/tarfile.rst:995 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" -#: ../../library/tarfile.rst:998 +#: ../../library/tarfile.rst:999 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " "filesystems. Intended for extracting cross-platform data archives. See :func:" "`data_filter` for details." msgstr "" -#: ../../library/tarfile.rst:1002 +#: ../../library/tarfile.rst:1003 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:1004 +#: ../../library/tarfile.rst:1005 msgid "" "If that is also ``None`` (the default), raise a ``DeprecationWarning``, and " "fall back to the ``'fully_trusted'`` filter, whose dangerous behavior " "matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:1008 +#: ../../library/tarfile.rst:1009 msgid "" "In Python 3.14, the ``'data'`` filter will become the default instead. It's " "possible to switch earlier; see :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:1011 +#: ../../library/tarfile.rst:1012 msgid "" "A callable which will be called for each extracted member with a :ref:" "`TarInfo ` describing the member and the destination path " @@ -1278,27 +1280,27 @@ msgid "" "members)::" msgstr "" -#: ../../library/tarfile.rst:1016 +#: ../../library/tarfile.rst:1017 msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" msgstr "filter(member: TarInfo, path: str, /) -> TarInfo | None" -#: ../../library/tarfile.rst:1018 +#: ../../library/tarfile.rst:1019 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" -#: ../../library/tarfile.rst:1022 +#: ../../library/tarfile.rst:1023 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" -#: ../../library/tarfile.rst:1024 +#: ../../library/tarfile.rst:1025 msgid "return ``None``, in which case the member will be skipped, or" msgstr "" -#: ../../library/tarfile.rst:1025 +#: ../../library/tarfile.rst:1026 msgid "" "raise an exception to abort the operation or skip the member, depending on :" "attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" @@ -1306,62 +1308,62 @@ msgid "" "attempt to clean up." msgstr "" -#: ../../library/tarfile.rst:1031 +#: ../../library/tarfile.rst:1032 msgid "Default named filters" msgstr "" -#: ../../library/tarfile.rst:1033 +#: ../../library/tarfile.rst:1034 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" -#: ../../library/tarfile.rst:1038 +#: ../../library/tarfile.rst:1039 msgid "Return *member* unchanged." msgstr "" -#: ../../library/tarfile.rst:1040 +#: ../../library/tarfile.rst:1041 msgid "This implements the ``'fully_trusted'`` filter." msgstr "" -#: ../../library/tarfile.rst:1044 +#: ../../library/tarfile.rst:1045 msgid "Implements the ``'tar'`` filter." msgstr "" -#: ../../library/tarfile.rst:1046 +#: ../../library/tarfile.rst:1047 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" -#: ../../library/tarfile.rst:1047 +#: ../../library/tarfile.rst:1048 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" -#: ../../library/tarfile.rst:1051 +#: ../../library/tarfile.rst:1052 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1054 +#: ../../library/tarfile.rst:1055 msgid "" "Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" "const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" -#: ../../library/tarfile.rst:1057 ../../library/tarfile.rst:1096 +#: ../../library/tarfile.rst:1058 ../../library/tarfile.rst:1097 msgid "Return the modified ``TarInfo`` member." msgstr "" -#: ../../library/tarfile.rst:1061 +#: ../../library/tarfile.rst:1062 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" -#: ../../library/tarfile.rst:1064 +#: ../../library/tarfile.rst:1065 msgid "" "Normalize link targets (:attr:`TarInfo.linkname`) using :func:`os.path." "normpath`. Note that this removes internal ``..`` components, which may " @@ -1369,67 +1371,67 @@ msgid "" "traverses symbolic links." msgstr "" -#: ../../library/tarfile.rst:1070 +#: ../../library/tarfile.rst:1071 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" -#: ../../library/tarfile.rst:1073 +#: ../../library/tarfile.rst:1074 msgid "" "This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." "LinkOutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1076 +#: ../../library/tarfile.rst:1077 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" -#: ../../library/tarfile.rst:1079 +#: ../../library/tarfile.rst:1080 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" -#: ../../library/tarfile.rst:1083 +#: ../../library/tarfile.rst:1084 msgid "For regular files, including hard links:" msgstr "" -#: ../../library/tarfile.rst:1085 +#: ../../library/tarfile.rst:1086 msgid "" "Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" "`~stat.S_IWUSR`)." msgstr "" -#: ../../library/tarfile.rst:1087 +#: ../../library/tarfile.rst:1088 msgid "" "Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" "const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." msgstr "" -#: ../../library/tarfile.rst:1091 +#: ../../library/tarfile.rst:1092 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" -#: ../../library/tarfile.rst:1093 +#: ../../library/tarfile.rst:1094 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" -#: ../../library/tarfile.rst:1100 +#: ../../library/tarfile.rst:1101 msgid "Link targets are now normalized." msgstr "" -#: ../../library/tarfile.rst:1106 +#: ../../library/tarfile.rst:1107 msgid "Filter errors" msgstr "" -#: ../../library/tarfile.rst:1108 +#: ../../library/tarfile.rst:1109 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1438,11 +1440,11 @@ msgid "" "continue." msgstr "" -#: ../../library/tarfile.rst:1116 +#: ../../library/tarfile.rst:1117 msgid "Hints for further verification" msgstr "" -#: ../../library/tarfile.rst:1118 +#: ../../library/tarfile.rst:1119 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" @@ -1450,73 +1452,73 @@ msgid "" "additional checks." msgstr "" -#: ../../library/tarfile.rst:1123 +#: ../../library/tarfile.rst:1124 msgid "Here is an incomplete list of things to consider:" msgstr "" -#: ../../library/tarfile.rst:1125 +#: ../../library/tarfile.rst:1126 msgid "" "Extract to a :func:`new temporary directory ` to prevent e." "g. exploiting pre-existing links, and to make it easier to clean up after a " "failed extraction." msgstr "" -#: ../../library/tarfile.rst:1128 +#: ../../library/tarfile.rst:1129 msgid "Disallow symbolic links if you do not need the functionality." msgstr "" -#: ../../library/tarfile.rst:1129 +#: ../../library/tarfile.rst:1130 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" -#: ../../library/tarfile.rst:1131 +#: ../../library/tarfile.rst:1132 msgid "" "Check filenames against an allow-list of characters (to filter out control " "characters, confusables, foreign path separators, etc.)." msgstr "" -#: ../../library/tarfile.rst:1134 +#: ../../library/tarfile.rst:1135 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" -#: ../../library/tarfile.rst:1136 +#: ../../library/tarfile.rst:1137 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" -#: ../../library/tarfile.rst:1138 +#: ../../library/tarfile.rst:1139 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" -#: ../../library/tarfile.rst:1140 +#: ../../library/tarfile.rst:1141 msgid "Also note that:" msgstr "" -#: ../../library/tarfile.rst:1142 +#: ../../library/tarfile.rst:1143 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" -#: ../../library/tarfile.rst:1146 +#: ../../library/tarfile.rst:1147 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" -#: ../../library/tarfile.rst:1152 +#: ../../library/tarfile.rst:1153 msgid "Supporting older Python versions" msgstr "" -#: ../../library/tarfile.rst:1154 +#: ../../library/tarfile.rst:1155 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " @@ -1524,18 +1526,18 @@ msgid "" "version." msgstr "" -#: ../../library/tarfile.rst:1159 +#: ../../library/tarfile.rst:1160 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" -#: ../../library/tarfile.rst:1163 +#: ../../library/tarfile.rst:1164 msgid "Fully trusted archive::" msgstr "" -#: ../../library/tarfile.rst:1165 +#: ../../library/tarfile.rst:1166 msgid "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" @@ -1543,13 +1545,13 @@ msgstr "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1168 +#: ../../library/tarfile.rst:1169 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" -#: ../../library/tarfile.rst:1171 +#: ../../library/tarfile.rst:1172 msgid "" "my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" " (lambda member, path: member))\n" @@ -1559,19 +1561,19 @@ msgstr "" " (lambda member, path: member))\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1175 +#: ../../library/tarfile.rst:1176 msgid "Use the ``'data'`` filter; *fail* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1177 +#: ../../library/tarfile.rst:1178 msgid "my_tarfile.extractall(filter=tarfile.data_filter)" msgstr "my_tarfile.extractall(filter=tarfile.data_filter)" -#: ../../library/tarfile.rst:1179 +#: ../../library/tarfile.rst:1180 msgid "or::" msgstr "或: ::" -#: ../../library/tarfile.rst:1181 +#: ../../library/tarfile.rst:1182 msgid "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" @@ -1579,11 +1581,11 @@ msgstr "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1184 +#: ../../library/tarfile.rst:1185 msgid "Use the ``'data'`` filter; *warn* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1186 +#: ../../library/tarfile.rst:1187 msgid "" "if hasattr(tarfile, 'data_filter'):\n" " my_tarfile.extractall(filter='data')\n" @@ -1592,19 +1594,25 @@ msgid "" " warn_the_user('Extracting may be unsafe; consider updating Python')\n" " my_tarfile.extractall()" msgstr "" +"if hasattr(tarfile, 'data_filter'):\n" +" my_tarfile.extractall(filter='data')\n" +"else:\n" +" # 當不再需要時移除它\n" +" warn_the_user('Extracting may be unsafe; consider updating Python')\n" +" my_tarfile.extractall()" -#: ../../library/tarfile.rst:1195 +#: ../../library/tarfile.rst:1196 msgid "Stateful extraction filter example" msgstr "" -#: ../../library/tarfile.rst:1197 +#: ../../library/tarfile.rst:1198 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" -#: ../../library/tarfile.rst:1201 +#: ../../library/tarfile.rst:1202 msgid "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" @@ -1612,11 +1620,11 @@ msgstr "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" -#: ../../library/tarfile.rst:1204 +#: ../../library/tarfile.rst:1205 msgid "Such a filter can be written as, for example::" msgstr "" -#: ../../library/tarfile.rst:1206 +#: ../../library/tarfile.rst:1207 msgid "" "class StatefulFilter:\n" " def __init__(self):\n" @@ -1632,104 +1640,117 @@ msgid "" " def __exit__(self, *exc_info):\n" " print(f'{self.file_count} files extracted')" msgstr "" +"class StatefulFilter:\n" +" def __init__(self):\n" +" self.file_count = 0\n" +"\n" +" def __enter__(self):\n" +" return self\n" +"\n" +" def __call__(self, member, path):\n" +" self.file_count += 1\n" +" return member\n" +"\n" +" def __exit__(self, *exc_info):\n" +" print(f'{self.file_count} files extracted')" -#: ../../library/tarfile.rst:1226 +#: ../../library/tarfile.rst:1227 msgid "Command-Line Interface" -msgstr "" +msgstr "命令列介面" -#: ../../library/tarfile.rst:1230 +#: ../../library/tarfile.rst:1231 msgid "" "The :mod:`tarfile` module provides a simple command-line interface to " "interact with tar archives." msgstr "" -#: ../../library/tarfile.rst:1233 +#: ../../library/tarfile.rst:1234 msgid "" "If you want to create a new tar archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/tarfile.rst:1236 +#: ../../library/tarfile.rst:1237 msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" msgstr "$ python -m tarfile -c monty.tar spam.txt eggs.txt" -#: ../../library/tarfile.rst:1240 +#: ../../library/tarfile.rst:1241 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/tarfile.rst:1242 +#: ../../library/tarfile.rst:1243 msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" msgstr "$ python -m tarfile -c monty.tar life-of-brian_1979/" -#: ../../library/tarfile.rst:1246 +#: ../../library/tarfile.rst:1247 msgid "" "If you want to extract a tar archive into the current directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/tarfile.rst:1249 +#: ../../library/tarfile.rst:1250 msgid "$ python -m tarfile -e monty.tar" msgstr "$ python -m tarfile -e monty.tar" -#: ../../library/tarfile.rst:1253 +#: ../../library/tarfile.rst:1254 msgid "" "You can also extract a tar archive into a different directory by passing the " "directory's name:" msgstr "" -#: ../../library/tarfile.rst:1256 +#: ../../library/tarfile.rst:1257 msgid "$ python -m tarfile -e monty.tar other-dir/" msgstr "$ python -m tarfile -e monty.tar other-dir/" -#: ../../library/tarfile.rst:1260 +#: ../../library/tarfile.rst:1261 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" -#: ../../library/tarfile.rst:1262 +#: ../../library/tarfile.rst:1263 msgid "$ python -m tarfile -l monty.tar" msgstr "$ python -m tarfile -l monty.tar" -#: ../../library/tarfile.rst:1268 +#: ../../library/tarfile.rst:1269 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/tarfile.rst:1273 +#: ../../library/tarfile.rst:1274 msgid "List files in a tarfile." msgstr "" -#: ../../library/tarfile.rst:1278 +#: ../../library/tarfile.rst:1279 msgid "Create tarfile from source files." msgstr "" -#: ../../library/tarfile.rst:1283 +#: ../../library/tarfile.rst:1284 msgid "" "Extract tarfile into the current directory if *output_dir* is not specified." msgstr "" -#: ../../library/tarfile.rst:1288 +#: ../../library/tarfile.rst:1289 msgid "Test whether the tarfile is valid or not." msgstr "" -#: ../../library/tarfile.rst:1292 +#: ../../library/tarfile.rst:1293 msgid "Verbose output." msgstr "" -#: ../../library/tarfile.rst:1296 +#: ../../library/tarfile.rst:1297 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" -#: ../../library/tarfile.rst:1304 +#: ../../library/tarfile.rst:1305 msgid "Examples" msgstr "範例" -#: ../../library/tarfile.rst:1306 +#: ../../library/tarfile.rst:1307 msgid "How to extract an entire tar archive to the current working directory::" msgstr "" -#: ../../library/tarfile.rst:1308 +#: ../../library/tarfile.rst:1309 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\")\n" @@ -1741,13 +1762,13 @@ msgstr "" "tar.extractall(filter='data')\n" "tar.close()" -#: ../../library/tarfile.rst:1313 +#: ../../library/tarfile.rst:1314 msgid "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -#: ../../library/tarfile.rst:1316 +#: ../../library/tarfile.rst:1317 msgid "" "import os\n" "import tarfile\n" @@ -1773,11 +1794,11 @@ msgstr "" "tar.extractall(members=py_files(tar))\n" "tar.close()" -#: ../../library/tarfile.rst:1328 +#: ../../library/tarfile.rst:1329 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "" -#: ../../library/tarfile.rst:1330 +#: ../../library/tarfile.rst:1331 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar\", \"w\")\n" @@ -1791,11 +1812,11 @@ msgstr "" " tar.add(name)\n" "tar.close()" -#: ../../library/tarfile.rst:1336 +#: ../../library/tarfile.rst:1337 msgid "The same example using the :keyword:`with` statement::" msgstr "" -#: ../../library/tarfile.rst:1338 +#: ../../library/tarfile.rst:1339 msgid "" "import tarfile\n" "with tarfile.open(\"sample.tar\", \"w\") as tar:\n" @@ -1807,13 +1828,13 @@ msgstr "" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" -#: ../../library/tarfile.rst:1343 +#: ../../library/tarfile.rst:1344 msgid "" "How to read a gzip compressed tar archive and display some member " "information::" msgstr "" -#: ../../library/tarfile.rst:1345 +#: ../../library/tarfile.rst:1346 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" @@ -1829,13 +1850,13 @@ msgid "" "tar.close()" msgstr "" -#: ../../library/tarfile.rst:1357 +#: ../../library/tarfile.rst:1358 msgid "" "How to create an archive and reset the user information using the *filter* " "parameter in :meth:`TarFile.add`::" msgstr "" -#: ../../library/tarfile.rst:1360 +#: ../../library/tarfile.rst:1361 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -1855,17 +1876,17 @@ msgstr "" "tar.add(\"foo\", filter=reset)\n" "tar.close()" -#: ../../library/tarfile.rst:1373 +#: ../../library/tarfile.rst:1374 msgid "Supported tar formats" msgstr "" -#: ../../library/tarfile.rst:1375 +#: ../../library/tarfile.rst:1376 msgid "" "There are three tar formats that can be created with the :mod:`tarfile` " "module:" msgstr "" -#: ../../library/tarfile.rst:1377 +#: ../../library/tarfile.rst:1378 msgid "" "The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames " "up to a length of at best 256 characters and linknames up to 100 characters. " @@ -1873,7 +1894,7 @@ msgid "" "supported format." msgstr "" -#: ../../library/tarfile.rst:1382 +#: ../../library/tarfile.rst:1383 msgid "" "The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and " "linknames, files bigger than 8 GiB and sparse files. It is the de facto " @@ -1881,7 +1902,7 @@ msgid "" "extensions for long names, sparse file support is read-only." msgstr "" -#: ../../library/tarfile.rst:1387 +#: ../../library/tarfile.rst:1388 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -1892,7 +1913,7 @@ msgid "" "*ustar* format. It is the current default format for new archives." msgstr "" -#: ../../library/tarfile.rst:1395 +#: ../../library/tarfile.rst:1396 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -1901,13 +1922,13 @@ msgid "" "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" -#: ../../library/tarfile.rst:1401 +#: ../../library/tarfile.rst:1402 msgid "" "There are some more variants of the tar format which can be read, but not " "created:" msgstr "" -#: ../../library/tarfile.rst:1404 +#: ../../library/tarfile.rst:1405 msgid "" "The ancient V7 format. This is the first tar format from Unix Seventh " "Edition, storing only regular files and directories. Names must not be " @@ -1916,17 +1937,17 @@ msgid "" "ASCII characters." msgstr "" -#: ../../library/tarfile.rst:1409 +#: ../../library/tarfile.rst:1410 msgid "" "The SunOS tar extended format. This format is a variant of the POSIX.1-2001 " "pax format, but is not compatible." msgstr "" -#: ../../library/tarfile.rst:1415 +#: ../../library/tarfile.rst:1416 msgid "Unicode issues" msgstr "" -#: ../../library/tarfile.rst:1417 +#: ../../library/tarfile.rst:1418 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -1941,13 +1962,13 @@ msgid "" "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -#: ../../library/tarfile.rst:1429 +#: ../../library/tarfile.rst:1430 msgid "" "The details of character conversion in :mod:`tarfile` are controlled by the " "*encoding* and *errors* keyword arguments of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:1432 +#: ../../library/tarfile.rst:1433 msgid "" "*encoding* defines the character encoding to use for the metadata in the " "archive. The default value is :func:`sys.getfilesystemencoding` or " @@ -1956,7 +1977,7 @@ msgid "" "not set appropriately, this conversion may fail." msgstr "" -#: ../../library/tarfile.rst:1438 +#: ../../library/tarfile.rst:1439 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " @@ -1964,10 +1985,16 @@ msgid "" "system calls, see :ref:`os-filenames`." msgstr "" -#: ../../library/tarfile.rst:1443 +#: ../../library/tarfile.rst:1444 msgid "" "For :const:`PAX_FORMAT` archives (the default), *encoding* is generally not " "needed because all the metadata is stored using *UTF-8*. *encoding* is only " "used in the rare cases when binary pax headers are decoded or when strings " "with surrogate characters are stored." msgstr "" + +#~ msgid "``'a' or 'a:'``" +#~ msgstr "``'a' 或 'a:'``" + +#~ msgid "``'w' or 'w:'``" +#~ msgstr "``'w' 或 'w:'``" diff --git a/library/test.po b/library/test.po index e0fe8b9e31..77d4a423c3 100644 --- a/library/test.po +++ b/library/test.po @@ -501,7 +501,7 @@ msgstr "" #: ../../library/test.rst:378 msgid "See also the :data:`HAVE_DOCSTRINGS` variable." -msgstr "" +msgstr "另請參閱 :data:`HAVE_DOCSTRINGS` 變數。" #: ../../library/test.rst:383 msgid "" diff --git a/library/token.po b/library/token.po index 372ad403c3..120e3cfe6e 100644 --- a/library/token.po +++ b/library/token.po @@ -1,8 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" @@ -241,195 +241,195 @@ msgstr "" #: ../../library/token-list.inc:10 msgid "``\"(\"``" -msgstr "" +msgstr "``\"(\"``" #: ../../library/token-list.inc:12 msgid "``\")\"``" -msgstr "" +msgstr "``\")\"``" #: ../../library/token-list.inc:14 msgid "``\"[\"``" -msgstr "" +msgstr "``\"[\"``" #: ../../library/token-list.inc:16 msgid "``\"]\"``" -msgstr "" +msgstr "``\"]\"``" #: ../../library/token-list.inc:18 msgid "``\":\"``" -msgstr "" +msgstr "``\":\"``" #: ../../library/token-list.inc:20 msgid "``\",\"``" -msgstr "" +msgstr "``\",\"``" #: ../../library/token-list.inc:22 msgid "``\";\"``" -msgstr "" +msgstr "``\";\"``" #: ../../library/token-list.inc:24 msgid "``\"+\"``" -msgstr "" +msgstr "``\"+\"``" #: ../../library/token-list.inc:26 msgid "``\"-\"``" -msgstr "" +msgstr "``\"-\"``" #: ../../library/token-list.inc:28 msgid "``\"*\"``" -msgstr "" +msgstr "``\"*\"``" #: ../../library/token-list.inc:30 msgid "``\"/\"``" -msgstr "" +msgstr "``\"/\"``" #: ../../library/token-list.inc:32 msgid "``\"|\"``" -msgstr "" +msgstr "``\"|\"``" #: ../../library/token-list.inc:34 msgid "``\"&\"``" -msgstr "" +msgstr "``\"&\"``" #: ../../library/token-list.inc:36 msgid "``\"<\"``" -msgstr "" +msgstr "``\"<\"``" #: ../../library/token-list.inc:38 msgid "``\">\"``" -msgstr "" +msgstr "``\">\"``" #: ../../library/token-list.inc:40 msgid "``\"=\"``" -msgstr "" +msgstr "``\"=\"``" #: ../../library/token-list.inc:42 msgid "``\".\"``" -msgstr "" +msgstr "``\".\"``" #: ../../library/token-list.inc:44 msgid "``\"%\"``" -msgstr "" +msgstr "``\"%\"``" #: ../../library/token-list.inc:46 msgid "``\"{\"``" -msgstr "" +msgstr "``\"{\"``" #: ../../library/token-list.inc:48 msgid "``\"}\"``" -msgstr "" +msgstr "``\"}\"``" #: ../../library/token-list.inc:50 msgid "``\"==\"``" -msgstr "" +msgstr "``\"==\"``" #: ../../library/token-list.inc:52 msgid "``\"!=\"``" -msgstr "" +msgstr "``\"!=\"``" #: ../../library/token-list.inc:54 msgid "``\"<=\"``" -msgstr "" +msgstr "``\"<=\"``" #: ../../library/token-list.inc:56 msgid "``\">=\"``" -msgstr "" +msgstr "``\">=\"``" #: ../../library/token-list.inc:58 msgid "``\"~\"``" -msgstr "" +msgstr "``\"~\"``" #: ../../library/token-list.inc:60 msgid "``\"^\"``" -msgstr "" +msgstr "``\"^\"``" #: ../../library/token-list.inc:62 msgid "``\"<<\"``" -msgstr "" +msgstr "``\"<<\"``" #: ../../library/token-list.inc:64 msgid "``\">>\"``" -msgstr "" +msgstr "``\">>\"``" #: ../../library/token-list.inc:66 msgid "``\"**\"``" -msgstr "" +msgstr "``\"**\"``" #: ../../library/token-list.inc:68 msgid "``\"+=\"``" -msgstr "" +msgstr "``\"+=\"``" #: ../../library/token-list.inc:70 msgid "``\"-=\"``" -msgstr "" +msgstr "``\"-=\"``" #: ../../library/token-list.inc:72 msgid "``\"*=\"``" -msgstr "" +msgstr "``\"*=\"``" #: ../../library/token-list.inc:74 msgid "``\"/=\"``" -msgstr "" +msgstr "``\"/=\"``" #: ../../library/token-list.inc:76 msgid "``\"%=\"``" -msgstr "" +msgstr "``\"%=\"``" #: ../../library/token-list.inc:78 msgid "``\"&=\"``" -msgstr "" +msgstr "``\"&=\"``" #: ../../library/token-list.inc:80 msgid "``\"|=\"``" -msgstr "" +msgstr "``\"|=\"``" #: ../../library/token-list.inc:82 msgid "``\"^=\"``" -msgstr "" +msgstr "``\"^=\"``" #: ../../library/token-list.inc:84 msgid "``\"<<=\"``" -msgstr "" +msgstr "``\"<<=\"``" #: ../../library/token-list.inc:86 msgid "``\">>=\"``" -msgstr "" +msgstr "``\">>=\"``" #: ../../library/token-list.inc:88 msgid "``\"**=\"``" -msgstr "" +msgstr "``\"**=\"``" #: ../../library/token-list.inc:90 msgid "``\"//\"``" -msgstr "" +msgstr "``\"//\"``" #: ../../library/token-list.inc:92 msgid "``\"//=\"``" -msgstr "" +msgstr "``\"//=\"``" #: ../../library/token-list.inc:94 msgid "``\"@\"``" -msgstr "" +msgstr "``\"@\"``" #: ../../library/token-list.inc:96 msgid "``\"@=\"``" -msgstr "" +msgstr "``\"@=\"``" #: ../../library/token-list.inc:98 msgid "``\"->\"``" -msgstr "" +msgstr "``\"->\"``" #: ../../library/token-list.inc:100 msgid "``\"...\"``" -msgstr "" +msgstr "``\"...\"``" #: ../../library/token-list.inc:102 msgid "``\":=\"``" -msgstr "" +msgstr "``\":=\"``" #: ../../library/token-list.inc:104 msgid "``\"!\"``" -msgstr "" +msgstr "``\"!\"``" #: ../../library/token.rst:193 msgid "The following non-token constants are provided:" @@ -469,7 +469,7 @@ msgstr "" #: ../../library/token.rst:225 msgid "Added :data:`EXCLAMATION`." -msgstr "" +msgstr "新增 :data:`EXCLAMATION`。" #: ../../library/token.rst:228 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." diff --git a/library/tracemalloc.po b/library/tracemalloc.po index 8ce369cc18..aa9a9baf2b 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -956,7 +956,7 @@ msgstr "" #: ../../library/tracemalloc.rst:623 msgid "See also the :class:`StatisticDiff` class." -msgstr "" +msgstr "另請參閱 :class:`StatisticDiff` 類別。" #: ../../library/tracemalloc.rst:627 msgid "Number of memory blocks (``int``)." diff --git a/library/turtle.po b/library/turtle.po index ef88f69b8e..037a2eacaa 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -2902,7 +2902,7 @@ msgstr "" #: ../../library/turtle.rst:1969 msgid "See also the RawTurtle/Turtle method :func:`speed`." -msgstr "" +msgstr "另請參閱 RawTurtle/Turtle 的 :func:`speed` 方法。" #: ../../library/turtle.rst:1977 msgid "" diff --git a/library/unittest.po b/library/unittest.po index 6940a80894..110f6e1d74 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -266,8 +266,8 @@ msgid "" "provides a command-line interface to the test script. When run from the " "command line, the above script produces an output that looks like this::" msgstr "" -"最後將顯示一個簡單的方法去執行測試 :func:`unittest.main` 提供一個命令執行列介" -"面測試腳本。當透過命令執行列執行,輸出結果將會像是: ::" +"最後將顯示一個簡單的方法去執行測試 :func:`unittest.main` 提供一個命令列介" +"面測試腳本。當透過命令列執行,輸出結果將會像是: ::" #: ../../library/unittest.rst:133 msgid "" @@ -329,14 +329,14 @@ msgstr "" #: ../../library/unittest.rst:163 msgid "Command-Line Interface" -msgstr "命令執行列介面 (Command-Line Interface)" +msgstr "命令列介面" #: ../../library/unittest.rst:165 msgid "" "The unittest module can be used from the command line to run tests from " "modules, classes or even individual test methods::" msgstr "" -"單元測試模組可以透過命令執行列執行測試模組,物件甚至個別的測試方法: ::" +"單元測試模組可以透過命令列執行測試模組,物件甚至個別的測試方法: ::" #: ../../library/unittest.rst:168 msgid "" diff --git a/library/xml.dom.minidom.po b/library/xml.dom.minidom.po index edf87d6176..ee2ea5fccb 100644 --- a/library/xml.dom.minidom.po +++ b/library/xml.dom.minidom.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,18 +36,17 @@ msgstr "" #: ../../library/xml.dom.minidom.rst:24 msgid "" -"The :mod:`xml.dom.minidom` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." -msgstr "" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/xml.dom.minidom.rst:29 +#: ../../library/xml.dom.minidom.rst:28 msgid "" "DOM applications typically start by parsing some XML into a DOM. With :mod:" "`xml.dom.minidom`, this is done through the parse functions::" msgstr "" -#: ../../library/xml.dom.minidom.rst:32 +#: ../../library/xml.dom.minidom.rst:31 msgid "" "from xml.dom.minidom import parse, parseString\n" "\n" @@ -59,13 +57,21 @@ msgid "" "\n" "dom3 = parseString('Some data some more data')" msgstr "" +"from xml.dom.minidom import parse, parseString\n" +"\n" +"dom1 = parse('c:\\\\temp\\\\mydata.xml') # 以檔名來剖析 XML 檔案\n" +"\n" +"datasource = open('c:\\\\temp\\\\mydata.xml')\n" +"dom2 = parse(datasource) # 剖析開啟的檔案\n" +"\n" +"dom3 = parseString('Some data some more data')" -#: ../../library/xml.dom.minidom.rst:41 +#: ../../library/xml.dom.minidom.rst:40 msgid "" "The :func:`parse` function can take either a filename or an open file object." -msgstr "" +msgstr ":func:`parse` 函式可以接受一個檔案名稱或開啟的檔案物件。" -#: ../../library/xml.dom.minidom.rst:46 +#: ../../library/xml.dom.minidom.rst:45 msgid "" "Return a :class:`Document` from the given input. *filename_or_file* may be " "either a file name, or a file-like object. *parser*, if given, must be a " @@ -74,26 +80,27 @@ msgid "" "setting an entity resolver) must have been done in advance." msgstr "" -#: ../../library/xml.dom.minidom.rst:52 +#: ../../library/xml.dom.minidom.rst:51 msgid "" "If you have XML in a string, you can use the :func:`parseString` function " "instead:" msgstr "" +"如果你有一個字串中的 XML,你可以使用 :func:`parseString` 函式來代替:" -#: ../../library/xml.dom.minidom.rst:58 +#: ../../library/xml.dom.minidom.rst:57 msgid "" "Return a :class:`Document` that represents the *string*. This method creates " "an :class:`io.StringIO` object for the string and passes that on to :func:" "`parse`." msgstr "" -#: ../../library/xml.dom.minidom.rst:61 +#: ../../library/xml.dom.minidom.rst:60 msgid "" "Both functions return a :class:`Document` object representing the content of " "the document." -msgstr "" +msgstr "這兩個函式都會回傳一個 :class:`Document` 物件,表示文件的內容。" -#: ../../library/xml.dom.minidom.rst:64 +#: ../../library/xml.dom.minidom.rst:63 msgid "" "What the :func:`parse` and :func:`parseString` functions do is connect an " "XML parser with a \"DOM builder\" that can accept parse events from any SAX " @@ -104,7 +111,7 @@ msgid "" "themselves." msgstr "" -#: ../../library/xml.dom.minidom.rst:71 +#: ../../library/xml.dom.minidom.rst:70 msgid "" "You can also create a :class:`Document` by calling a method on a \"DOM " "Implementation\" object. You can get this object either by calling the :" @@ -113,7 +120,7 @@ msgid "" "add child nodes to it to populate the DOM::" msgstr "" -#: ../../library/xml.dom.minidom.rst:77 +#: ../../library/xml.dom.minidom.rst:76 msgid "" "from xml.dom.minidom import getDOMImplementation\n" "\n" @@ -124,8 +131,16 @@ msgid "" "text = newdoc.createTextNode('Some textual content.')\n" "top_element.appendChild(text)" msgstr "" +"from xml.dom.minidom import getDOMImplementation\n" +"\n" +"impl = getDOMImplementation()\n" +"\n" +"newdoc = impl.createDocument(None, \"some_tag\", None)\n" +"top_element = newdoc.documentElement\n" +"text = newdoc.createTextNode('Some textual content.')\n" +"top_element.appendChild(text)" -#: ../../library/xml.dom.minidom.rst:86 +#: ../../library/xml.dom.minidom.rst:85 msgid "" "Once you have a DOM document object, you can access the parts of your XML " "document through its properties and methods. These properties are defined " @@ -134,13 +149,15 @@ msgid "" "document: the one that holds all others. Here is an example program::" msgstr "" -#: ../../library/xml.dom.minidom.rst:92 +#: ../../library/xml.dom.minidom.rst:91 msgid "" "dom3 = parseString(\"Some data\")\n" "assert dom3.documentElement.tagName == \"myxml\"" msgstr "" +"dom3 = parseString(\"Some data\")\n" +"assert dom3.documentElement.tagName == \"myxml\"" -#: ../../library/xml.dom.minidom.rst:95 +#: ../../library/xml.dom.minidom.rst:94 msgid "" "When you are finished with a DOM tree, you may optionally call the :meth:" "`unlink` method to encourage early cleanup of the now-unneeded objects. :" @@ -150,28 +167,30 @@ msgid "" "objects in the tree." msgstr "" -#: ../../library/xml.dom.minidom.rst:104 +#: ../../library/xml.dom.minidom.rst:103 msgid "" "`Document Object Model (DOM) Level 1 Specification `_" msgstr "" +"`Document Object Model (DOM) Level 1 Specification `_" -#: ../../library/xml.dom.minidom.rst:105 +#: ../../library/xml.dom.minidom.rst:104 msgid "The W3C recommendation for the DOM supported by :mod:`xml.dom.minidom`." -msgstr "" +msgstr "W3C 對 :mod:`xml.dom.minidom` DOM 支援 的建議。" -#: ../../library/xml.dom.minidom.rst:111 +#: ../../library/xml.dom.minidom.rst:110 msgid "DOM Objects" msgstr "DOM 物件" -#: ../../library/xml.dom.minidom.rst:113 +#: ../../library/xml.dom.minidom.rst:112 msgid "" "The definition of the DOM API for Python is given as part of the :mod:`xml." "dom` module documentation. This section lists the differences between the " "API and :mod:`xml.dom.minidom`." msgstr "" -#: ../../library/xml.dom.minidom.rst:120 +#: ../../library/xml.dom.minidom.rst:119 msgid "" "Break internal references within the DOM so that it will be garbage " "collected on versions of Python without cyclic GC. Even when cyclic GC is " @@ -181,20 +200,22 @@ msgid "" "may be called on child nodes to discard children of that node." msgstr "" -#: ../../library/xml.dom.minidom.rst:127 +#: ../../library/xml.dom.minidom.rst:126 msgid "" "You can avoid calling this method explicitly by using the :keyword:`with` " "statement. The following code will automatically unlink *dom* when the :" "keyword:`!with` block is exited::" msgstr "" -#: ../../library/xml.dom.minidom.rst:131 +#: ../../library/xml.dom.minidom.rst:130 msgid "" "with xml.dom.minidom.parse(datasource) as dom:\n" " ... # Work with dom." msgstr "" +"with xml.dom.minidom.parse(datasource) as dom:\n" +" ... # 使用 dom。" -#: ../../library/xml.dom.minidom.rst:138 +#: ../../library/xml.dom.minidom.rst:137 msgid "" "Write XML to the writer object. The writer receives texts but not bytes as " "input, it should have a :meth:`write` method which matches that of the file " @@ -204,13 +225,13 @@ msgid "" "use to terminate newlines." msgstr "" -#: ../../library/xml.dom.minidom.rst:145 +#: ../../library/xml.dom.minidom.rst:144 msgid "" "For the :class:`Document` node, an additional keyword argument *encoding* " "can be used to specify the encoding field of the XML header." msgstr "" -#: ../../library/xml.dom.minidom.rst:148 +#: ../../library/xml.dom.minidom.rst:147 msgid "" "Similarly, explicitly stating the *standalone* argument causes the " "standalone document declarations to be added to the prologue of the XML " @@ -219,24 +240,24 @@ msgid "" "declaration from the document." msgstr "" -#: ../../library/xml.dom.minidom.rst:155 +#: ../../library/xml.dom.minidom.rst:154 msgid "" "The :meth:`writexml` method now preserves the attribute order specified by " "the user." msgstr "" -#: ../../library/xml.dom.minidom.rst:159 ../../library/xml.dom.minidom.rst:180 -#: ../../library/xml.dom.minidom.rst:199 +#: ../../library/xml.dom.minidom.rst:158 ../../library/xml.dom.minidom.rst:179 +#: ../../library/xml.dom.minidom.rst:198 msgid "The *standalone* parameter was added." msgstr "新增 *standalone* 參數。" -#: ../../library/xml.dom.minidom.rst:164 +#: ../../library/xml.dom.minidom.rst:163 msgid "" "Return a string or byte string containing the XML represented by the DOM " "node." msgstr "" -#: ../../library/xml.dom.minidom.rst:167 +#: ../../library/xml.dom.minidom.rst:166 msgid "" "With an explicit *encoding* [1]_ argument, the result is a byte string in " "the specified encoding. With no *encoding* argument, the result is a Unicode " @@ -245,47 +266,47 @@ msgid "" "incorrect, since UTF-8 is the default encoding of XML." msgstr "" -#: ../../library/xml.dom.minidom.rst:174 ../../library/xml.dom.minidom.rst:193 +#: ../../library/xml.dom.minidom.rst:173 ../../library/xml.dom.minidom.rst:192 msgid "The *standalone* argument behaves exactly as in :meth:`writexml`." msgstr "" -#: ../../library/xml.dom.minidom.rst:176 +#: ../../library/xml.dom.minidom.rst:175 msgid "" "The :meth:`toxml` method now preserves the attribute order specified by the " "user." -msgstr "" +msgstr "現在 :meth:`toxml` 方法會保留使用者指定的屬性順序。" -#: ../../library/xml.dom.minidom.rst:186 +#: ../../library/xml.dom.minidom.rst:185 msgid "" "Return a pretty-printed version of the document. *indent* specifies the " "indentation string and defaults to a tabulator; *newl* specifies the string " "emitted at the end of each line and defaults to ``\\n``." msgstr "" -#: ../../library/xml.dom.minidom.rst:190 +#: ../../library/xml.dom.minidom.rst:189 msgid "" "The *encoding* argument behaves like the corresponding argument of :meth:" "`toxml`." msgstr "" -#: ../../library/xml.dom.minidom.rst:195 +#: ../../library/xml.dom.minidom.rst:194 msgid "" "The :meth:`toprettyxml` method now preserves the attribute order specified " "by the user." msgstr "" -#: ../../library/xml.dom.minidom.rst:205 +#: ../../library/xml.dom.minidom.rst:204 msgid "DOM Example" msgstr "DOM 範例" -#: ../../library/xml.dom.minidom.rst:207 +#: ../../library/xml.dom.minidom.rst:206 msgid "" "This example program is a fairly realistic example of a simple program. In " "this particular case, we do not take much advantage of the flexibility of " "the DOM." msgstr "" -#: ../../library/xml.dom.minidom.rst:210 +#: ../../library/xml.dom.minidom.rst:209 msgid "" "import xml.dom.minidom\n" "\n" @@ -417,23 +438,23 @@ msgstr "" "\n" "handleSlideshow(dom)\n" -#: ../../library/xml.dom.minidom.rst:216 +#: ../../library/xml.dom.minidom.rst:215 msgid "minidom and the DOM standard" -msgstr "" +msgstr "minidom 和 DOM 標準" -#: ../../library/xml.dom.minidom.rst:218 +#: ../../library/xml.dom.minidom.rst:217 msgid "" "The :mod:`xml.dom.minidom` module is essentially a DOM 1.0-compatible DOM " "with some DOM 2 features (primarily namespace features)." msgstr "" -#: ../../library/xml.dom.minidom.rst:221 +#: ../../library/xml.dom.minidom.rst:220 msgid "" "Usage of the DOM interface in Python is straight-forward. The following " "mapping rules apply:" msgstr "" -#: ../../library/xml.dom.minidom.rst:224 +#: ../../library/xml.dom.minidom.rst:223 msgid "" "Interfaces are accessed through instance objects. Applications should not " "instantiate the classes themselves; they should use the creator functions " @@ -442,14 +463,14 @@ msgid "" "operations." msgstr "" -#: ../../library/xml.dom.minidom.rst:229 +#: ../../library/xml.dom.minidom.rst:228 msgid "" "Operations are used as methods. Since the DOM uses only :keyword:`in` " "parameters, the arguments are passed in normal order (from left to right). " "There are no optional arguments. ``void`` operations return ``None``." msgstr "" -#: ../../library/xml.dom.minidom.rst:233 +#: ../../library/xml.dom.minidom.rst:232 msgid "" "IDL attributes map to instance attributes. For compatibility with the OMG " "IDL language mapping for Python, an attribute ``foo`` can also be accessed " @@ -457,13 +478,13 @@ msgid "" "``readonly`` attributes must not be changed; this is not enforced at runtime." msgstr "" -#: ../../library/xml.dom.minidom.rst:238 +#: ../../library/xml.dom.minidom.rst:237 msgid "" "The types ``short int``, ``unsigned int``, ``unsigned long long``, and " "``boolean`` all map to Python integer objects." msgstr "" -#: ../../library/xml.dom.minidom.rst:241 +#: ../../library/xml.dom.minidom.rst:240 msgid "" "The type ``DOMString`` maps to Python strings. :mod:`xml.dom.minidom` " "supports either bytes or strings, but will normally produce strings. Values " @@ -471,21 +492,21 @@ msgid "" "``null`` value by the DOM specification from the W3C." msgstr "" -#: ../../library/xml.dom.minidom.rst:246 +#: ../../library/xml.dom.minidom.rst:245 msgid "" "``const`` declarations map to variables in their respective scope (e.g. " "``xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE``); they must not be " "changed." msgstr "" -#: ../../library/xml.dom.minidom.rst:249 +#: ../../library/xml.dom.minidom.rst:248 msgid "" "``DOMException`` is currently not supported in :mod:`xml.dom.minidom`. " "Instead, :mod:`xml.dom.minidom` uses standard Python exceptions such as :exc:" "`TypeError` and :exc:`AttributeError`." msgstr "" -#: ../../library/xml.dom.minidom.rst:253 +#: ../../library/xml.dom.minidom.rst:252 msgid "" ":class:`NodeList` objects are implemented using Python's built-in list type. " "These objects provide the interface defined in the DOM specification, but " @@ -494,30 +515,30 @@ msgid "" "recommendations." msgstr "" -#: ../../library/xml.dom.minidom.rst:259 +#: ../../library/xml.dom.minidom.rst:258 msgid "" "The following interfaces have no implementation in :mod:`xml.dom.minidom`:" msgstr "" -#: ../../library/xml.dom.minidom.rst:261 +#: ../../library/xml.dom.minidom.rst:260 msgid ":class:`DOMTimeStamp`" msgstr ":class:`DOMTimeStamp`" -#: ../../library/xml.dom.minidom.rst:263 +#: ../../library/xml.dom.minidom.rst:262 msgid ":class:`EntityReference`" msgstr ":class:`EntityReference`" -#: ../../library/xml.dom.minidom.rst:265 +#: ../../library/xml.dom.minidom.rst:264 msgid "" "Most of these reflect information in the XML document that is not of general " "utility to most DOM users." msgstr "" -#: ../../library/xml.dom.minidom.rst:269 +#: ../../library/xml.dom.minidom.rst:268 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/xml.dom.minidom.rst:270 +#: ../../library/xml.dom.minidom.rst:269 msgid "" "The encoding name included in the XML output should conform to the " "appropriate standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not " diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index 736f1f62c2..bc91d5c066 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -1,13 +1,13 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,19 +40,18 @@ msgstr "" #: ../../library/xml.dom.pulldom.rst:24 msgid "" -"The :mod:`xml.dom.pulldom` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." -msgstr "" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/xml.dom.pulldom.rst:30 +#: ../../library/xml.dom.pulldom.rst:29 msgid "" "The SAX parser no longer processes general external entities by default to " "increase security by default. To enable processing of external entities, " "pass a custom parser instance in::" msgstr "" -#: ../../library/xml.dom.pulldom.rst:34 +#: ../../library/xml.dom.pulldom.rst:33 msgid "" "from xml.dom.pulldom import parse\n" "from xml.sax import make_parser\n" @@ -70,11 +69,11 @@ msgstr "" "parser.setFeature(feature_external_ges, True)\n" "parse(filename, parser=parser)" -#: ../../library/xml.dom.pulldom.rst:43 +#: ../../library/xml.dom.pulldom.rst:42 msgid "Example::" msgstr "範例: ::" -#: ../../library/xml.dom.pulldom.rst:45 +#: ../../library/xml.dom.pulldom.rst:44 msgid "" "from xml.dom import pulldom\n" "\n" @@ -94,49 +93,49 @@ msgstr "" " doc.expandNode(node)\n" " print(node.toxml())" -#: ../../library/xml.dom.pulldom.rst:54 +#: ../../library/xml.dom.pulldom.rst:53 msgid "``event`` is a constant and can be one of:" -msgstr "" +msgstr "``event`` 是一個常數,可以是以下其中一個:" -#: ../../library/xml.dom.pulldom.rst:56 +#: ../../library/xml.dom.pulldom.rst:55 msgid ":data:`START_ELEMENT`" msgstr ":data:`START_ELEMENT`" -#: ../../library/xml.dom.pulldom.rst:57 +#: ../../library/xml.dom.pulldom.rst:56 msgid ":data:`END_ELEMENT`" msgstr ":data:`END_ELEMENT`" -#: ../../library/xml.dom.pulldom.rst:58 +#: ../../library/xml.dom.pulldom.rst:57 msgid ":data:`COMMENT`" msgstr ":data:`COMMENT`" -#: ../../library/xml.dom.pulldom.rst:59 +#: ../../library/xml.dom.pulldom.rst:58 msgid ":data:`START_DOCUMENT`" msgstr ":data:`START_DOCUMENT`" -#: ../../library/xml.dom.pulldom.rst:60 +#: ../../library/xml.dom.pulldom.rst:59 msgid ":data:`END_DOCUMENT`" msgstr ":data:`END_DOCUMENT`" -#: ../../library/xml.dom.pulldom.rst:61 +#: ../../library/xml.dom.pulldom.rst:60 msgid ":data:`CHARACTERS`" msgstr ":data:`CHARACTERS`" -#: ../../library/xml.dom.pulldom.rst:62 +#: ../../library/xml.dom.pulldom.rst:61 msgid ":data:`PROCESSING_INSTRUCTION`" msgstr ":data:`PROCESSING_INSTRUCTION`" -#: ../../library/xml.dom.pulldom.rst:63 +#: ../../library/xml.dom.pulldom.rst:62 msgid ":data:`IGNORABLE_WHITESPACE`" msgstr ":data:`IGNORABLE_WHITESPACE`" -#: ../../library/xml.dom.pulldom.rst:65 +#: ../../library/xml.dom.pulldom.rst:64 msgid "" "``node`` is an object of type :class:`xml.dom.minidom.Document`, :class:`xml." "dom.minidom.Element` or :class:`xml.dom.minidom.Text`." msgstr "" -#: ../../library/xml.dom.pulldom.rst:68 +#: ../../library/xml.dom.pulldom.rst:67 msgid "" "Since the document is treated as a \"flat\" stream of events, the document " "\"tree\" is implicitly traversed and the desired elements are found " @@ -148,11 +147,11 @@ msgid "" "`DOMEventStream.expandNode` method and switch to DOM-related processing." msgstr "" -#: ../../library/xml.dom.pulldom.rst:80 ../../library/xml.dom.pulldom.rst:85 +#: ../../library/xml.dom.pulldom.rst:79 ../../library/xml.dom.pulldom.rst:84 msgid "Subclass of :class:`xml.sax.handler.ContentHandler`." -msgstr "" +msgstr ":class:`xml.sax.handler.ContentHandler` 的子類別。" -#: ../../library/xml.dom.pulldom.rst:90 +#: ../../library/xml.dom.pulldom.rst:89 msgid "" "Return a :class:`DOMEventStream` from the given input. *stream_or_string* " "may be either a file name, or a file-like object. *parser*, if given, must " @@ -162,36 +161,36 @@ msgid "" "done in advance." msgstr "" -#: ../../library/xml.dom.pulldom.rst:97 +#: ../../library/xml.dom.pulldom.rst:96 msgid "" "If you have XML in a string, you can use the :func:`parseString` function " "instead:" msgstr "" -#: ../../library/xml.dom.pulldom.rst:101 +#: ../../library/xml.dom.pulldom.rst:100 msgid "" "Return a :class:`DOMEventStream` that represents the (Unicode) *string*." -msgstr "" +msgstr "回傳一個表示 (Unicode) *string* 的 :class:`DOMEventStream`。" -#: ../../library/xml.dom.pulldom.rst:105 +#: ../../library/xml.dom.pulldom.rst:104 msgid "Default value for the *bufsize* parameter to :func:`parse`." msgstr "" -#: ../../library/xml.dom.pulldom.rst:107 +#: ../../library/xml.dom.pulldom.rst:106 msgid "" "The value of this variable can be changed before calling :func:`parse` and " "the new value will take effect." msgstr "" -#: ../../library/xml.dom.pulldom.rst:113 +#: ../../library/xml.dom.pulldom.rst:112 msgid "DOMEventStream Objects" msgstr "DOMEventStream 物件" -#: ../../library/xml.dom.pulldom.rst:117 +#: ../../library/xml.dom.pulldom.rst:116 msgid "Support for :meth:`~object.__getitem__` method has been removed." -msgstr "" +msgstr "已移除對 :meth:`~object.__getitem__` 方法的支援。" -#: ../../library/xml.dom.pulldom.rst:122 +#: ../../library/xml.dom.pulldom.rst:121 msgid "" "Return a tuple containing *event* and the current *node* as :class:`xml.dom." "minidom.Document` if event equals :data:`START_DOCUMENT`, :class:`xml.dom." @@ -201,11 +200,11 @@ msgid "" "children, unless :func:`expandNode` is called." msgstr "" -#: ../../library/xml.dom.pulldom.rst:132 +#: ../../library/xml.dom.pulldom.rst:131 msgid "Expands all children of *node* into *node*. Example::" -msgstr "" +msgstr "展開 *node* 的所有子節點到 *node*。範例: ::" -#: ../../library/xml.dom.pulldom.rst:134 +#: ../../library/xml.dom.pulldom.rst:133 msgid "" "from xml.dom import pulldom\n" "\n" @@ -221,3 +220,16 @@ msgid "" "text
and more

'\n" " print(node.toxml())" msgstr "" +"from xml.dom import pulldom\n" +"\n" +"xml = 'Foo

Some text

and more

'\n" +"doc = pulldom.parseString(xml)\n" +"for event, node in doc:\n" +" if event == pulldom.START_ELEMENT and node.tagName == 'p':\n" +" # 以下陳述式只會印出 '

'\n" +" print(node.toxml())\n" +" doc.expandNode(node)\n" +" # 以下陳述式會印出包含所有子節點的節點 '

Some " +"text

and more

'\n" +" print(node.toxml())" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index b5a9518fc2..bfd50c500c 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,27 +41,26 @@ msgstr ":mod:`!xml.etree.cElementTree` 模組已被棄用。" #: ../../library/xml.etree.elementtree.rst:25 msgid "" -"The :mod:`xml.etree.ElementTree` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." -msgstr "" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/xml.etree.elementtree.rst:30 +#: ../../library/xml.etree.elementtree.rst:29 msgid "Tutorial" msgstr "教學" -#: ../../library/xml.etree.elementtree.rst:32 +#: ../../library/xml.etree.elementtree.rst:31 msgid "" "This is a short tutorial for using :mod:`xml.etree.ElementTree` (``ET`` in " "short). The goal is to demonstrate some of the building blocks and basic " "concepts of the module." msgstr "" -#: ../../library/xml.etree.elementtree.rst:37 +#: ../../library/xml.etree.elementtree.rst:36 msgid "XML tree and elements" msgstr "" -#: ../../library/xml.etree.elementtree.rst:39 +#: ../../library/xml.etree.elementtree.rst:38 msgid "" "XML is an inherently hierarchical data format, and the most natural way to " "represent it is with a tree. ``ET`` has two classes for this purpose - :" @@ -72,17 +71,17 @@ msgid "" "sub-elements are done on the :class:`Element` level." msgstr "" -#: ../../library/xml.etree.elementtree.rst:50 +#: ../../library/xml.etree.elementtree.rst:49 msgid "Parsing XML" msgstr "剖析 XML" -#: ../../library/xml.etree.elementtree.rst:52 +#: ../../library/xml.etree.elementtree.rst:51 msgid "" "We'll be using the fictive :file:`country_data.xml` XML document as the " "sample data for this section:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:54 +#: ../../library/xml.etree.elementtree.rst:53 msgid "" "\n" "\n" @@ -132,11 +131,11 @@ msgstr "" " \n" "" -#: ../../library/xml.etree.elementtree.rst:80 +#: ../../library/xml.etree.elementtree.rst:79 msgid "We can import this data by reading from a file::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:82 +#: ../../library/xml.etree.elementtree.rst:81 msgid "" "import xml.etree.ElementTree as ET\n" "tree = ET.parse('country_data.xml')\n" @@ -146,15 +145,15 @@ msgstr "" "tree = ET.parse('country_data.xml')\n" "root = tree.getroot()" -#: ../../library/xml.etree.elementtree.rst:86 +#: ../../library/xml.etree.elementtree.rst:85 msgid "Or directly from a string::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:88 +#: ../../library/xml.etree.elementtree.rst:87 msgid "root = ET.fromstring(country_data_as_string)" msgstr "root = ET.fromstring(country_data_as_string)" -#: ../../library/xml.etree.elementtree.rst:90 +#: ../../library/xml.etree.elementtree.rst:89 msgid "" ":func:`fromstring` parses XML from a string directly into an :class:" "`Element`, which is the root element of the parsed tree. Other parsing " @@ -162,12 +161,12 @@ msgid "" "sure." msgstr "" -#: ../../library/xml.etree.elementtree.rst:94 +#: ../../library/xml.etree.elementtree.rst:93 msgid "" "As an :class:`Element`, ``root`` has a tag and a dictionary of attributes::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:96 +#: ../../library/xml.etree.elementtree.rst:95 msgid "" ">>> root.tag\n" "'data'\n" @@ -179,11 +178,11 @@ msgstr "" ">>> root.attrib\n" "{}" -#: ../../library/xml.etree.elementtree.rst:101 +#: ../../library/xml.etree.elementtree.rst:100 msgid "It also has children nodes over which we can iterate::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:103 +#: ../../library/xml.etree.elementtree.rst:102 msgid "" ">>> for child in root:\n" "... print(child.tag, child.attrib)\n" @@ -199,11 +198,11 @@ msgstr "" "country {'name': 'Singapore'}\n" "country {'name': 'Panama'}" -#: ../../library/xml.etree.elementtree.rst:110 +#: ../../library/xml.etree.elementtree.rst:109 msgid "Children are nested, and we can access specific child nodes by index::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:112 +#: ../../library/xml.etree.elementtree.rst:111 msgid "" ">>> root[0][1].text\n" "'2008'" @@ -211,7 +210,7 @@ msgstr "" ">>> root[0][1].text\n" "'2008'" -#: ../../library/xml.etree.elementtree.rst:118 +#: ../../library/xml.etree.elementtree.rst:117 msgid "" "Not all elements of the XML input will end up as elements of the parsed " "tree. Currently, this module skips over any XML comments, processing " @@ -223,11 +222,11 @@ msgid "" "constructor." msgstr "" -#: ../../library/xml.etree.elementtree.rst:132 +#: ../../library/xml.etree.elementtree.rst:131 msgid "Pull API for non-blocking parsing" msgstr "" -#: ../../library/xml.etree.elementtree.rst:134 +#: ../../library/xml.etree.elementtree.rst:133 msgid "" "Most parsing functions provided by this module require the whole document to " "be read at once before returning any result. It is possible to use an :" @@ -238,7 +237,7 @@ msgid "" "the convenience of fully constructed :class:`Element` objects." msgstr "" -#: ../../library/xml.etree.elementtree.rst:142 +#: ../../library/xml.etree.elementtree.rst:141 msgid "" "The most powerful tool for doing this is :class:`XMLPullParser`. It does " "not require a blocking read to obtain the XML data, and is instead fed with " @@ -246,7 +245,7 @@ msgid "" "XML elements, call :meth:`XMLPullParser.read_events`. Here is an example::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:147 +#: ../../library/xml.etree.elementtree.rst:146 msgid "" ">>> parser = ET.XMLPullParser(['start', 'end'])\n" ">>> parser.feed('sometext')\n" @@ -260,15 +259,26 @@ msgid "" "end\n" "mytag text= sometext more text" msgstr "" +">>> parser = ET.XMLPullParser(['start', 'end'])\n" +">>> parser.feed('sometext')\n" +">>> list(parser.read_events())\n" +"[('start', )]\n" +">>> parser.feed(' more text')\n" +">>> for event, elem in parser.read_events():\n" +"... print(event)\n" +"... print(elem.tag, 'text=', elem.text)\n" +"...\n" +"end\n" +"mytag text= sometext more text" -#: ../../library/xml.etree.elementtree.rst:159 +#: ../../library/xml.etree.elementtree.rst:158 msgid "" "The obvious use case is applications that operate in a non-blocking fashion " "where the XML data is being received from a socket or read incrementally " "from some storage device. In such cases, blocking reads are unacceptable." msgstr "" -#: ../../library/xml.etree.elementtree.rst:163 +#: ../../library/xml.etree.elementtree.rst:162 msgid "" "Because it's so flexible, :class:`XMLPullParser` can be inconvenient to use " "for simpler use-cases. If you don't mind your application blocking on " @@ -278,25 +288,25 @@ msgid "" "memory." msgstr "" -#: ../../library/xml.etree.elementtree.rst:169 +#: ../../library/xml.etree.elementtree.rst:168 msgid "" "Where *immediate* feedback through events is wanted, calling method :meth:" "`XMLPullParser.flush` can help reduce delay; please make sure to study the " "related security notes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:175 +#: ../../library/xml.etree.elementtree.rst:174 msgid "Finding interesting elements" msgstr "" -#: ../../library/xml.etree.elementtree.rst:177 +#: ../../library/xml.etree.elementtree.rst:176 msgid "" ":class:`Element` has some useful methods that help iterate recursively over " "all the sub-tree below it (its children, their children, and so on). For " "example, :meth:`Element.iter`::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:181 +#: ../../library/xml.etree.elementtree.rst:180 msgid "" ">>> for neighbor in root.iter('neighbor'):\n" "... print(neighbor.attrib)\n" @@ -316,7 +326,7 @@ msgstr "" "{'name': 'Costa Rica', 'direction': 'W'}\n" "{'name': 'Colombia', 'direction': 'E'}" -#: ../../library/xml.etree.elementtree.rst:190 +#: ../../library/xml.etree.elementtree.rst:189 msgid "" ":meth:`Element.findall` finds only elements with a tag which are direct " "children of the current element. :meth:`Element.find` finds the *first* " @@ -324,7 +334,7 @@ msgid "" "text content. :meth:`Element.get` accesses the element's attributes::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:195 +#: ../../library/xml.etree.elementtree.rst:194 msgid "" ">>> for country in root.findall('country'):\n" "... rank = country.find('rank').text\n" @@ -344,23 +354,23 @@ msgstr "" "Singapore 4\n" "Panama 68" -#: ../../library/xml.etree.elementtree.rst:204 +#: ../../library/xml.etree.elementtree.rst:203 msgid "" "More sophisticated specification of which elements to look for is possible " "by using :ref:`XPath `." msgstr "" -#: ../../library/xml.etree.elementtree.rst:208 +#: ../../library/xml.etree.elementtree.rst:207 msgid "Modifying an XML File" msgstr "改動 XML 檔案" -#: ../../library/xml.etree.elementtree.rst:210 +#: ../../library/xml.etree.elementtree.rst:209 msgid "" ":class:`ElementTree` provides a simple way to build XML documents and write " "them to files. The :meth:`ElementTree.write` method serves this purpose." msgstr "" -#: ../../library/xml.etree.elementtree.rst:213 +#: ../../library/xml.etree.elementtree.rst:212 msgid "" "Once created, an :class:`Element` object may be manipulated by directly " "changing its fields (such as :attr:`Element.text`), adding and modifying " @@ -368,13 +378,13 @@ msgid "" "example with :meth:`Element.append`)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:218 +#: ../../library/xml.etree.elementtree.rst:217 msgid "" "Let's say we want to add one to each country's rank, and add an ``updated`` " "attribute to the rank element::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:221 +#: ../../library/xml.etree.elementtree.rst:220 msgid "" ">>> for rank in root.iter('rank'):\n" "... new_rank = int(rank.text) + 1\n" @@ -390,12 +400,12 @@ msgstr "" "...\n" ">>> tree.write('output.xml')" -#: ../../library/xml.etree.elementtree.rst:228 -#: ../../library/xml.etree.elementtree.rst:272 +#: ../../library/xml.etree.elementtree.rst:227 +#: ../../library/xml.etree.elementtree.rst:271 msgid "Our XML now looks like this:" msgstr "XML 現在看起來像這樣:" -#: ../../library/xml.etree.elementtree.rst:230 +#: ../../library/xml.etree.elementtree.rst:229 msgid "" "\n" "\n" @@ -445,13 +455,13 @@ msgstr "" " \n" "" -#: ../../library/xml.etree.elementtree.rst:256 +#: ../../library/xml.etree.elementtree.rst:255 msgid "" "We can remove elements using :meth:`Element.remove`. Let's say we want to " "remove all countries with a rank higher than 50::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:259 +#: ../../library/xml.etree.elementtree.rst:258 msgid "" ">>> for country in root.findall('country'):\n" "... # using root.findall() to avoid removal during traversal\n" @@ -461,8 +471,15 @@ msgid "" "...\n" ">>> tree.write('output.xml')" msgstr "" +">>> for country in root.findall('country'):\n" +"... # 使用 root.findall() 來避免在遍歷時移除\n" +"... rank = int(country.find('rank').text)\n" +"... if rank > 50:\n" +"... root.remove(country)\n" +"...\n" +">>> tree.write('output.xml')" -#: ../../library/xml.etree.elementtree.rst:267 +#: ../../library/xml.etree.elementtree.rst:266 msgid "" "Note that concurrent modification while iterating can lead to problems, just " "like when iterating and modifying Python lists or dicts. Therefore, the " @@ -470,7 +487,7 @@ msgid "" "only then iterates over the list of matches." msgstr "" -#: ../../library/xml.etree.elementtree.rst:274 +#: ../../library/xml.etree.elementtree.rst:273 msgid "" "\n" "\n" @@ -506,17 +523,17 @@ msgstr "" " \n" "" -#: ../../library/xml.etree.elementtree.rst:294 +#: ../../library/xml.etree.elementtree.rst:293 msgid "Building XML documents" -msgstr "" +msgstr "建立 XML 文件" -#: ../../library/xml.etree.elementtree.rst:296 +#: ../../library/xml.etree.elementtree.rst:295 msgid "" "The :func:`SubElement` function also provides a convenient way to create new " "sub-elements for a given element::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:299 +#: ../../library/xml.etree.elementtree.rst:298 msgid "" ">>> a = ET.Element('a')\n" ">>> b = ET.SubElement(a, 'b')\n" @@ -532,11 +549,11 @@ msgstr "" ">>> ET.dump(a)\n" "" -#: ../../library/xml.etree.elementtree.rst:307 +#: ../../library/xml.etree.elementtree.rst:306 msgid "Parsing XML with Namespaces" msgstr "" -#: ../../library/xml.etree.elementtree.rst:309 +#: ../../library/xml.etree.elementtree.rst:308 msgid "" "If the XML input has `namespaces `__, tags and attributes with prefixes in the form ``prefix:" @@ -546,13 +563,13 @@ msgid "" "prefixed tags." msgstr "" -#: ../../library/xml.etree.elementtree.rst:317 +#: ../../library/xml.etree.elementtree.rst:316 msgid "" "Here is an XML example that incorporates two namespaces, one with the prefix " "\"fictional\" and the other serving as the default namespace:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:320 +#: ../../library/xml.etree.elementtree.rst:319 msgid "" "\n" "\n" "" -#: ../../library/xml.etree.elementtree.rst:338 +#: ../../library/xml.etree.elementtree.rst:337 msgid "" "One way to search and explore this XML example is to manually add the URI to " "every tag or attribute in the xpath of a :meth:`~Element.find` or :meth:" "`~Element.findall`::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:342 +#: ../../library/xml.etree.elementtree.rst:341 msgid "" "root = fromstring(xml_text)\n" "for actor in root.findall('{http://people.example.com}actor'):\n" @@ -609,13 +626,13 @@ msgstr "" " for char in actor.findall('{http://characters.example.com}character'):\n" " print(' |-->', char.text)" -#: ../../library/xml.etree.elementtree.rst:349 +#: ../../library/xml.etree.elementtree.rst:348 msgid "" "A better way to search the namespaced XML example is to create a dictionary " "with your own prefixes and use those in the search functions::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:352 +#: ../../library/xml.etree.elementtree.rst:351 msgid "" "ns = {'real_person': 'http://people.example.com',\n" " 'role': 'http://characters.example.com'}\n" @@ -635,11 +652,11 @@ msgstr "" " for char in actor.findall('role:character', ns):\n" " print(' |-->', char.text)" -#: ../../library/xml.etree.elementtree.rst:361 +#: ../../library/xml.etree.elementtree.rst:360 msgid "These two approaches both output::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:363 +#: ../../library/xml.etree.elementtree.rst:362 msgid "" "John Cleese\n" " |--> Lancelot\n" @@ -657,11 +674,11 @@ msgstr "" " |--> Gunther\n" " |--> Commander Clement" -#: ../../library/xml.etree.elementtree.rst:375 +#: ../../library/xml.etree.elementtree.rst:374 msgid "XPath support" msgstr "XPath 支援" -#: ../../library/xml.etree.elementtree.rst:377 +#: ../../library/xml.etree.elementtree.rst:376 msgid "" "This module provides limited support for `XPath expressions `_ for locating elements in a tree. The goal is to support a " @@ -669,19 +686,19 @@ msgid "" "scope of the module." msgstr "" -#: ../../library/xml.etree.elementtree.rst:383 -#: ../../library/xml.etree.elementtree.rst:782 +#: ../../library/xml.etree.elementtree.rst:382 +#: ../../library/xml.etree.elementtree.rst:781 msgid "Example" msgstr "範例" -#: ../../library/xml.etree.elementtree.rst:385 +#: ../../library/xml.etree.elementtree.rst:384 msgid "" "Here's an example that demonstrates some of the XPath capabilities of the " "module. We'll be using the ``countrydata`` XML document from the :ref:" "`Parsing XML ` section::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:389 +#: ../../library/xml.etree.elementtree.rst:388 msgid "" "import xml.etree.ElementTree as ET\n" "\n" @@ -704,35 +721,35 @@ msgid "" "root.findall(\".//neighbor[2]\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:409 +#: ../../library/xml.etree.elementtree.rst:408 msgid "" "For XML with namespaces, use the usual qualified ``{namespace}tag`` " "notation::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:411 +#: ../../library/xml.etree.elementtree.rst:410 msgid "" "# All dublin-core \"title\" tags in the document\n" "root.findall(\".//{http://purl.org/dc/elements/1.1/}title\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:416 +#: ../../library/xml.etree.elementtree.rst:415 msgid "Supported XPath syntax" -msgstr "" +msgstr "支援的 XPath 語法" -#: ../../library/xml.etree.elementtree.rst:421 +#: ../../library/xml.etree.elementtree.rst:420 msgid "Syntax" msgstr "語法" -#: ../../library/xml.etree.elementtree.rst:421 +#: ../../library/xml.etree.elementtree.rst:420 msgid "Meaning" msgstr "意義" -#: ../../library/xml.etree.elementtree.rst:423 +#: ../../library/xml.etree.elementtree.rst:422 msgid "``tag``" msgstr "``tag``" -#: ../../library/xml.etree.elementtree.rst:423 +#: ../../library/xml.etree.elementtree.rst:422 msgid "" "Selects all child elements with the given tag. For example, ``spam`` selects " "all child elements named ``spam``, and ``spam/egg`` selects all " @@ -742,133 +759,133 @@ msgid "" "not in a namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:432 +#: ../../library/xml.etree.elementtree.rst:431 msgid "Support for star-wildcards was added." msgstr "新增對星號萬用字元的支援。" -#: ../../library/xml.etree.elementtree.rst:435 +#: ../../library/xml.etree.elementtree.rst:434 msgid "``*``" msgstr "``*``" -#: ../../library/xml.etree.elementtree.rst:435 +#: ../../library/xml.etree.elementtree.rst:434 msgid "" "Selects all child elements, including comments and processing instructions. " "For example, ``*/egg`` selects all grandchildren named ``egg``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:439 +#: ../../library/xml.etree.elementtree.rst:438 msgid "``.``" msgstr "``.``" -#: ../../library/xml.etree.elementtree.rst:439 +#: ../../library/xml.etree.elementtree.rst:438 msgid "" "Selects the current node. This is mostly useful at the beginning of the " "path, to indicate that it's a relative path." msgstr "" -#: ../../library/xml.etree.elementtree.rst:443 +#: ../../library/xml.etree.elementtree.rst:442 msgid "``//``" msgstr "``//``" -#: ../../library/xml.etree.elementtree.rst:443 +#: ../../library/xml.etree.elementtree.rst:442 msgid "" "Selects all subelements, on all levels beneath the current element. For " "example, ``.//egg`` selects all ``egg`` elements in the entire tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:447 +#: ../../library/xml.etree.elementtree.rst:446 msgid "``..``" msgstr "``..``" -#: ../../library/xml.etree.elementtree.rst:447 +#: ../../library/xml.etree.elementtree.rst:446 msgid "" "Selects the parent element. Returns ``None`` if the path attempts to reach " "the ancestors of the start element (the element ``find`` was called on)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:451 +#: ../../library/xml.etree.elementtree.rst:450 msgid "``[@attrib]``" msgstr "``[@attrib]``" -#: ../../library/xml.etree.elementtree.rst:451 +#: ../../library/xml.etree.elementtree.rst:450 msgid "Selects all elements that have the given attribute." msgstr "選擇所有具有給定屬性的元素。" -#: ../../library/xml.etree.elementtree.rst:453 +#: ../../library/xml.etree.elementtree.rst:452 msgid "``[@attrib='value']``" msgstr "``[@attrib='value']``" -#: ../../library/xml.etree.elementtree.rst:453 +#: ../../library/xml.etree.elementtree.rst:452 msgid "" "Selects all elements for which the given attribute has the given value. The " "value cannot contain quotes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:457 +#: ../../library/xml.etree.elementtree.rst:456 msgid "``[@attrib!='value']``" msgstr "``[@attrib!='value']``" -#: ../../library/xml.etree.elementtree.rst:457 +#: ../../library/xml.etree.elementtree.rst:456 msgid "" "Selects all elements for which the given attribute does not have the given " "value. The value cannot contain quotes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:463 +#: ../../library/xml.etree.elementtree.rst:462 msgid "``[tag]``" msgstr "``[tag]``" -#: ../../library/xml.etree.elementtree.rst:463 +#: ../../library/xml.etree.elementtree.rst:462 msgid "" "Selects all elements that have a child named ``tag``. Only immediate " "children are supported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:466 +#: ../../library/xml.etree.elementtree.rst:465 msgid "``[.='text']``" msgstr "``[.='text']``" -#: ../../library/xml.etree.elementtree.rst:466 +#: ../../library/xml.etree.elementtree.rst:465 msgid "" "Selects all elements whose complete text content, including descendants, " "equals the given ``text``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:471 +#: ../../library/xml.etree.elementtree.rst:470 msgid "``[.!='text']``" msgstr "``[.!='text']``" -#: ../../library/xml.etree.elementtree.rst:471 +#: ../../library/xml.etree.elementtree.rst:470 msgid "" "Selects all elements whose complete text content, including descendants, " "does not equal the given ``text``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:477 +#: ../../library/xml.etree.elementtree.rst:476 msgid "``[tag='text']``" msgstr "``[tag='text']``" -#: ../../library/xml.etree.elementtree.rst:477 +#: ../../library/xml.etree.elementtree.rst:476 msgid "" "Selects all elements that have a child named ``tag`` whose complete text " "content, including descendants, equals the given ``text``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:481 +#: ../../library/xml.etree.elementtree.rst:480 msgid "``[tag!='text']``" msgstr "``[tag!='text']``" -#: ../../library/xml.etree.elementtree.rst:481 +#: ../../library/xml.etree.elementtree.rst:480 msgid "" "Selects all elements that have a child named ``tag`` whose complete text " "content, including descendants, does not equal the given ``text``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:487 +#: ../../library/xml.etree.elementtree.rst:486 msgid "``[position]``" msgstr "``[position]``" -#: ../../library/xml.etree.elementtree.rst:487 +#: ../../library/xml.etree.elementtree.rst:486 msgid "" "Selects all elements that are located at the given position. The position " "can be either an integer (1 is the first position), the expression " @@ -876,28 +893,28 @@ msgid "" "position (e.g. ``last()-1``)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:494 +#: ../../library/xml.etree.elementtree.rst:493 msgid "" "Predicates (expressions within square brackets) must be preceded by a tag " "name, an asterisk, or another predicate. ``position`` predicates must be " "preceded by a tag name." msgstr "" -#: ../../library/xml.etree.elementtree.rst:499 -#: ../../library/xml.etree.elementtree.rst:834 +#: ../../library/xml.etree.elementtree.rst:498 +#: ../../library/xml.etree.elementtree.rst:833 msgid "Reference" msgstr "" -#: ../../library/xml.etree.elementtree.rst:504 -#: ../../library/xml.etree.elementtree.rst:839 +#: ../../library/xml.etree.elementtree.rst:503 +#: ../../library/xml.etree.elementtree.rst:838 msgid "Functions" msgstr "函式" -#: ../../library/xml.etree.elementtree.rst:508 +#: ../../library/xml.etree.elementtree.rst:507 msgid "`C14N 2.0 `_ transformation function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:510 +#: ../../library/xml.etree.elementtree.rst:509 msgid "" "Canonicalization is a way to normalise XML output in a way that allows byte-" "by-byte comparisons and digital signatures. It reduces the freedom that XML " @@ -906,7 +923,7 @@ msgid "" "declarations, the ordering of attributes, and ignorable whitespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:516 +#: ../../library/xml.etree.elementtree.rst:515 msgid "" "This function takes an XML data string (*xml_data*) or a file path or file-" "like object (*from_file*) as input, converts it to the canonical form, and " @@ -915,11 +932,11 @@ msgid "" "should therefore be opened in text mode with ``utf-8`` encoding." msgstr "" -#: ../../library/xml.etree.elementtree.rst:523 +#: ../../library/xml.etree.elementtree.rst:522 msgid "Typical uses::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:525 +#: ../../library/xml.etree.elementtree.rst:524 msgid "" "xml_data = \"...\"\n" "print(canonicalize(xml_data))\n" @@ -939,59 +956,59 @@ msgstr "" "with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" " canonicalize(from_file=\"inputfile.xml\", out=out_file)" -#: ../../library/xml.etree.elementtree.rst:534 +#: ../../library/xml.etree.elementtree.rst:533 msgid "The configuration *options* are as follows:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:536 +#: ../../library/xml.etree.elementtree.rst:535 msgid "*with_comments*: set to true to include comments (default: false)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:537 +#: ../../library/xml.etree.elementtree.rst:536 msgid "" "*strip_text*: set to true to strip whitespace before and after text content" msgstr "" -#: ../../library/xml.etree.elementtree.rst:538 -#: ../../library/xml.etree.elementtree.rst:540 +#: ../../library/xml.etree.elementtree.rst:537 +#: ../../library/xml.etree.elementtree.rst:539 msgid "(default: false)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:539 +#: ../../library/xml.etree.elementtree.rst:538 msgid "" "*rewrite_prefixes*: set to true to replace namespace prefixes by " "\"n{number}\"" msgstr "" -#: ../../library/xml.etree.elementtree.rst:541 +#: ../../library/xml.etree.elementtree.rst:540 msgid "*qname_aware_tags*: a set of qname aware tag names in which prefixes" msgstr "" -#: ../../library/xml.etree.elementtree.rst:542 -#: ../../library/xml.etree.elementtree.rst:544 +#: ../../library/xml.etree.elementtree.rst:541 +#: ../../library/xml.etree.elementtree.rst:543 msgid "should be replaced in text content (default: empty)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:543 +#: ../../library/xml.etree.elementtree.rst:542 msgid "" "*qname_aware_attrs*: a set of qname aware attribute names in which prefixes" msgstr "" -#: ../../library/xml.etree.elementtree.rst:545 +#: ../../library/xml.etree.elementtree.rst:544 msgid "*exclude_attrs*: a set of attribute names that should not be serialised" msgstr "" -#: ../../library/xml.etree.elementtree.rst:546 +#: ../../library/xml.etree.elementtree.rst:545 msgid "*exclude_tags*: a set of tag names that should not be serialised" msgstr "" -#: ../../library/xml.etree.elementtree.rst:548 +#: ../../library/xml.etree.elementtree.rst:547 msgid "" "In the option list above, \"a set\" refers to any collection or iterable of " "strings, no ordering is expected." msgstr "" -#: ../../library/xml.etree.elementtree.rst:556 +#: ../../library/xml.etree.elementtree.rst:555 msgid "" "Comment element factory. This factory function creates a special element " "that will be serialized as an XML comment by the standard serializer. The " @@ -1000,7 +1017,7 @@ msgid "" "representing a comment." msgstr "" -#: ../../library/xml.etree.elementtree.rst:562 +#: ../../library/xml.etree.elementtree.rst:561 msgid "" "Note that :class:`XMLParser` skips over comments in the input instead of " "creating comment objects for them. An :class:`ElementTree` will only contain " @@ -1008,29 +1025,29 @@ msgid "" "class:`Element` methods." msgstr "" -#: ../../library/xml.etree.elementtree.rst:569 +#: ../../library/xml.etree.elementtree.rst:568 msgid "" "Writes an element tree or element structure to sys.stdout. This function " "should be used for debugging only." msgstr "" -#: ../../library/xml.etree.elementtree.rst:572 +#: ../../library/xml.etree.elementtree.rst:571 msgid "" "The exact output format is implementation dependent. In this version, it's " "written as an ordinary XML file." msgstr "" -#: ../../library/xml.etree.elementtree.rst:575 +#: ../../library/xml.etree.elementtree.rst:574 msgid "*elem* is an element tree or an individual element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:577 +#: ../../library/xml.etree.elementtree.rst:576 msgid "" "The :func:`dump` function now preserves the attribute order specified by the " "user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:584 +#: ../../library/xml.etree.elementtree.rst:583 msgid "" "Parses an XML section from a string constant. Same as :func:`XML`. *text* " "is a string containing XML data. *parser* is an optional parser instance. " @@ -1038,7 +1055,7 @@ msgid "" "class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:592 +#: ../../library/xml.etree.elementtree.rst:591 msgid "" "Parses an XML document from a sequence of string fragments. *sequence* is a " "list or other sequence containing XML data fragments. *parser* is an " @@ -1046,7 +1063,7 @@ msgid "" "parser is used. Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:602 +#: ../../library/xml.etree.elementtree.rst:601 msgid "" "Appends whitespace to the subtree to indent the tree visually. This can be " "used to generate pretty-printed XML output. *tree* can be an Element or " @@ -1056,13 +1073,13 @@ msgid "" "indentation level as *level*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:614 +#: ../../library/xml.etree.elementtree.rst:613 msgid "" "Check if an object appears to be a valid element object. *element* is an " "element instance. Return ``True`` if this is an element object." msgstr "" -#: ../../library/xml.etree.elementtree.rst:620 +#: ../../library/xml.etree.elementtree.rst:619 msgid "" "Parses an XML section into an element tree incrementally, and reports what's " "going on to the user. *source* is a filename or :term:`file object` " @@ -1080,7 +1097,7 @@ msgid "" "file object if *source* is a filename." msgstr "" -#: ../../library/xml.etree.elementtree.rst:636 +#: ../../library/xml.etree.elementtree.rst:635 msgid "" "Note that while :func:`iterparse` builds the tree incrementally, it issues " "blocking reads on *source* (or the file it names). As such, it's unsuitable " @@ -1088,7 +1105,7 @@ msgid "" "parsing, see :class:`XMLPullParser`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:643 +#: ../../library/xml.etree.elementtree.rst:642 msgid "" ":func:`iterparse` only guarantees that it has seen the \">\" character of a " "starting tag when it emits a \"start\" event, so the attributes are defined, " @@ -1097,25 +1114,25 @@ msgid "" "present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:649 -#: ../../library/xml.etree.elementtree.rst:1522 +#: ../../library/xml.etree.elementtree.rst:648 +#: ../../library/xml.etree.elementtree.rst:1521 msgid "If you need a fully populated element, look for \"end\" events instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:651 +#: ../../library/xml.etree.elementtree.rst:650 msgid "The *parser* argument." msgstr "*parser* 引數。" -#: ../../library/xml.etree.elementtree.rst:654 -#: ../../library/xml.etree.elementtree.rst:1526 +#: ../../library/xml.etree.elementtree.rst:653 +#: ../../library/xml.etree.elementtree.rst:1525 msgid "The ``comment`` and ``pi`` events were added." msgstr "新增 *context* 與 *check_hostname* 事件。" -#: ../../library/xml.etree.elementtree.rst:657 +#: ../../library/xml.etree.elementtree.rst:656 msgid "Added the :meth:`!close` method." -msgstr "" +msgstr "新增 :meth:`!close` 方法。" -#: ../../library/xml.etree.elementtree.rst:663 +#: ../../library/xml.etree.elementtree.rst:662 msgid "" "Parses an XML section into an element tree. *source* is a filename or file " "object containing XML data. *parser* is an optional parser instance. If " @@ -1123,7 +1140,7 @@ msgid "" "class:`ElementTree` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:671 +#: ../../library/xml.etree.elementtree.rst:670 msgid "" "PI element factory. This factory function creates a special element that " "will be serialized as an XML processing instruction. *target* is a string " @@ -1131,7 +1148,7 @@ msgid "" "given. Returns an element instance, representing a processing instruction." msgstr "" -#: ../../library/xml.etree.elementtree.rst:676 +#: ../../library/xml.etree.elementtree.rst:675 msgid "" "Note that :class:`XMLParser` skips over processing instructions in the input " "instead of creating PI objects for them. An :class:`ElementTree` will only " @@ -1139,7 +1156,7 @@ msgid "" "tree using one of the :class:`Element` methods." msgstr "" -#: ../../library/xml.etree.elementtree.rst:684 +#: ../../library/xml.etree.elementtree.rst:683 msgid "" "Registers a namespace prefix. The registry is global, and any existing " "mapping for either the given prefix or the namespace URI will be removed. " @@ -1148,13 +1165,13 @@ msgid "" "all possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:695 +#: ../../library/xml.etree.elementtree.rst:694 msgid "" "Subelement factory. This function creates an element instance, and appends " "it to an existing element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:698 +#: ../../library/xml.etree.elementtree.rst:697 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *parent* is the parent element. *tag* is " @@ -1163,7 +1180,7 @@ msgid "" "arguments. Returns an element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:709 +#: ../../library/xml.etree.elementtree.rst:708 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1175,24 +1192,24 @@ msgid "" "Returns an (optionally) encoded string containing the XML data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:718 -#: ../../library/xml.etree.elementtree.rst:745 -#: ../../library/xml.etree.elementtree.rst:1199 +#: ../../library/xml.etree.elementtree.rst:717 +#: ../../library/xml.etree.elementtree.rst:744 +#: ../../library/xml.etree.elementtree.rst:1198 msgid "Added the *short_empty_elements* parameter." msgstr "新增 *short_empty_elements* 參數。" -#: ../../library/xml.etree.elementtree.rst:721 -#: ../../library/xml.etree.elementtree.rst:748 +#: ../../library/xml.etree.elementtree.rst:720 +#: ../../library/xml.etree.elementtree.rst:747 msgid "Added the *xml_declaration* and *default_namespace* parameters." msgstr "新增 *xml_declaration* 與 *default_namespace* 參數。" -#: ../../library/xml.etree.elementtree.rst:724 +#: ../../library/xml.etree.elementtree.rst:723 msgid "" "The :func:`tostring` function now preserves the attribute order specified by " "the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:733 +#: ../../library/xml.etree.elementtree.rst:732 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1206,13 +1223,13 @@ msgid "" "join(tostringlist(element)) == tostring(element)``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:751 +#: ../../library/xml.etree.elementtree.rst:750 msgid "" "The :func:`tostringlist` function now preserves the attribute order " "specified by the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:758 +#: ../../library/xml.etree.elementtree.rst:757 msgid "" "Parses an XML section from a string constant. This function can be used to " "embed \"XML literals\" in Python code. *text* is a string containing XML " @@ -1220,7 +1237,7 @@ msgid "" "class:`XMLParser` parser is used. Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:766 +#: ../../library/xml.etree.elementtree.rst:765 msgid "" "Parses an XML section from a string constant, and also returns a dictionary " "which maps from element id:s to elements. *text* is a string containing XML " @@ -1229,11 +1246,11 @@ msgid "" "`Element` instance and a dictionary." msgstr "" -#: ../../library/xml.etree.elementtree.rst:776 +#: ../../library/xml.etree.elementtree.rst:775 msgid "XInclude support" msgstr "" -#: ../../library/xml.etree.elementtree.rst:778 +#: ../../library/xml.etree.elementtree.rst:777 msgid "" "This module provides limited support for `XInclude directives `_, via the :mod:`xml.etree.ElementInclude` helper " @@ -1241,7 +1258,7 @@ msgid "" "element trees, based on information in the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:784 +#: ../../library/xml.etree.elementtree.rst:783 msgid "" "Here's an example that demonstrates use of the XInclude module. To include " "an XML document in the current document, use the ``{http://www.w3.org/2001/" @@ -1249,7 +1266,7 @@ msgid "" "and use the **href** attribute to specify the document to include." msgstr "" -#: ../../library/xml.etree.elementtree.rst:786 +#: ../../library/xml.etree.elementtree.rst:785 msgid "" "\n" "\n" @@ -1261,20 +1278,20 @@ msgstr "" " \n" "" -#: ../../library/xml.etree.elementtree.rst:793 +#: ../../library/xml.etree.elementtree.rst:792 msgid "" "By default, the **href** attribute is treated as a file name. You can use " "custom loaders to override this behaviour. Also note that the standard " "helper does not support XPointer syntax." msgstr "" -#: ../../library/xml.etree.elementtree.rst:795 +#: ../../library/xml.etree.elementtree.rst:794 msgid "" "To process this file, load it as usual, and pass the root element to the :" "mod:`xml.etree.ElementTree` module:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:797 +#: ../../library/xml.etree.elementtree.rst:796 msgid "" "from xml.etree import ElementTree, ElementInclude\n" "\n" @@ -1290,14 +1307,14 @@ msgstr "" "\n" "ElementInclude.include(root)" -#: ../../library/xml.etree.elementtree.rst:806 +#: ../../library/xml.etree.elementtree.rst:805 msgid "" "The ElementInclude module replaces the ``{http://www.w3.org/2001/XInclude}" "include`` element with the root element from the **source.xml** document. " "The result might look something like this:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:808 +#: ../../library/xml.etree.elementtree.rst:807 msgid "" "\n" " This is a paragraph.\n" @@ -1307,19 +1324,19 @@ msgstr "" " This is a paragraph.\n" "" -#: ../../library/xml.etree.elementtree.rst:814 +#: ../../library/xml.etree.elementtree.rst:813 msgid "" "If the **parse** attribute is omitted, it defaults to \"xml\". The href " "attribute is required." msgstr "" -#: ../../library/xml.etree.elementtree.rst:816 +#: ../../library/xml.etree.elementtree.rst:815 msgid "" "To include a text document, use the ``{http://www.w3.org/2001/XInclude}" "include`` element, and set the **parse** attribute to \"text\":" msgstr "" -#: ../../library/xml.etree.elementtree.rst:818 +#: ../../library/xml.etree.elementtree.rst:817 msgid "" "\n" "\n" @@ -1331,11 +1348,11 @@ msgstr "" " Copyright (c) .\n" "" -#: ../../library/xml.etree.elementtree.rst:825 +#: ../../library/xml.etree.elementtree.rst:824 msgid "The result might look something like:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:827 +#: ../../library/xml.etree.elementtree.rst:826 msgid "" "\n" " Copyright (c) 2003.\n" @@ -1345,7 +1362,7 @@ msgstr "" " Copyright (c) 2003.\n" "" -#: ../../library/xml.etree.elementtree.rst:845 +#: ../../library/xml.etree.elementtree.rst:844 msgid "" "Default loader. This default loader reads an included resource from disk. " "*href* is a URL. *parse* is for parse mode either \"xml\" or \"text\". " @@ -1356,7 +1373,7 @@ msgid "" "``None`` or raise an exception." msgstr "" -#: ../../library/xml.etree.elementtree.rst:856 +#: ../../library/xml.etree.elementtree.rst:855 msgid "" "This function expands XInclude directives in-place in tree pointed by " "*elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or " @@ -1369,21 +1386,21 @@ msgid "" "malicious content explosion. Pass ``None`` to disable the limitation." msgstr "" -#: ../../library/xml.etree.elementtree.rst:866 +#: ../../library/xml.etree.elementtree.rst:865 msgid "Added the *base_url* and *max_depth* parameters." msgstr "新增 *base_url* 與 *max_depth* 參數。" -#: ../../library/xml.etree.elementtree.rst:873 +#: ../../library/xml.etree.elementtree.rst:872 msgid "Element Objects" msgstr "Element 物件" -#: ../../library/xml.etree.elementtree.rst:881 +#: ../../library/xml.etree.elementtree.rst:880 msgid "" "Element class. This class defines the Element interface, and provides a " "reference implementation of this interface." msgstr "" -#: ../../library/xml.etree.elementtree.rst:884 +#: ../../library/xml.etree.elementtree.rst:883 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *tag* is the element name. *attrib* is an " @@ -1391,13 +1408,13 @@ msgid "" "additional attributes, given as keyword arguments." msgstr "" -#: ../../library/xml.etree.elementtree.rst:892 +#: ../../library/xml.etree.elementtree.rst:891 msgid "" "A string identifying what kind of data this element represents (the element " "type, in other words)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:899 +#: ../../library/xml.etree.elementtree.rst:898 msgid "" "These attributes can be used to hold additional data associated with the " "element. Their values are usually strings but may be any application-" @@ -1408,11 +1425,11 @@ msgid "" "the XML data" msgstr "" -#: ../../library/xml.etree.elementtree.rst:907 +#: ../../library/xml.etree.elementtree.rst:906 msgid "1234" msgstr "1234" -#: ../../library/xml.etree.elementtree.rst:911 +#: ../../library/xml.etree.elementtree.rst:910 msgid "" "the *a* element has ``None`` for both *text* and *tail* attributes, the *b* " "element has *text* ``\"1\"`` and *tail* ``\"4\"``, the *c* element has " @@ -1420,17 +1437,17 @@ msgid "" "``None`` and *tail* ``\"3\"``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:916 +#: ../../library/xml.etree.elementtree.rst:915 msgid "" "To collect the inner text of an element, see :meth:`itertext`, for example " "``\"\".join(element.itertext())``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:919 +#: ../../library/xml.etree.elementtree.rst:918 msgid "Applications may store arbitrary objects in these attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:924 +#: ../../library/xml.etree.elementtree.rst:923 msgid "" "A dictionary containing the element's attributes. Note that while the " "*attrib* value is always a real mutable Python dictionary, an ElementTree " @@ -1439,59 +1456,59 @@ msgid "" "implementations, use the dictionary methods below whenever possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:930 +#: ../../library/xml.etree.elementtree.rst:929 msgid "The following dictionary-like methods work on the element attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:935 +#: ../../library/xml.etree.elementtree.rst:934 msgid "" "Resets an element. This function removes all subelements, clears all " "attributes, and sets the text and tail attributes to ``None``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:941 +#: ../../library/xml.etree.elementtree.rst:940 msgid "Gets the element attribute named *key*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:943 +#: ../../library/xml.etree.elementtree.rst:942 msgid "" "Returns the attribute value, or *default* if the attribute was not found." msgstr "" -#: ../../library/xml.etree.elementtree.rst:948 +#: ../../library/xml.etree.elementtree.rst:947 msgid "" "Returns the element attributes as a sequence of (name, value) pairs. The " "attributes are returned in an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:954 +#: ../../library/xml.etree.elementtree.rst:953 msgid "" "Returns the elements attribute names as a list. The names are returned in " "an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:960 +#: ../../library/xml.etree.elementtree.rst:959 msgid "Set the attribute *key* on the element to *value*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:962 +#: ../../library/xml.etree.elementtree.rst:961 msgid "The following methods work on the element's children (subelements)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:967 +#: ../../library/xml.etree.elementtree.rst:966 msgid "" "Adds the element *subelement* to the end of this element's internal list of " "subelements. Raises :exc:`TypeError` if *subelement* is not an :class:" "`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:974 +#: ../../library/xml.etree.elementtree.rst:973 msgid "" "Appends *subelements* from an iterable of elements. Raises :exc:`TypeError` " "if a subelement is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:982 +#: ../../library/xml.etree.elementtree.rst:981 msgid "" "Finds the first subelement matching *match*. *match* may be a tag name or " "a :ref:`path `. Returns an element instance or " @@ -1500,7 +1517,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:991 +#: ../../library/xml.etree.elementtree.rst:990 msgid "" "Finds all matching subelements, by tag name or :ref:`path `. Returns a list containing all matching elements in document " @@ -1509,7 +1526,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1000 +#: ../../library/xml.etree.elementtree.rst:999 msgid "" "Finds text for the first subelement matching *match*. *match* may be a tag " "name or a :ref:`path `. Returns the text content of the " @@ -1520,13 +1537,13 @@ msgid "" "into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1011 +#: ../../library/xml.etree.elementtree.rst:1010 msgid "" "Inserts *subelement* at the given position in this element. Raises :exc:" "`TypeError` if *subelement* is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1017 +#: ../../library/xml.etree.elementtree.rst:1016 msgid "" "Creates a tree :term:`iterator` with the current element as the root. The " "iterator iterates over this element and all elements below it, in document " @@ -1535,7 +1552,7 @@ msgid "" "structure is modified during iteration, the result is undefined." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1028 +#: ../../library/xml.etree.elementtree.rst:1027 msgid "" "Finds all matching subelements, by tag name or :ref:`path `. Returns an iterable yielding all matching elements in document " @@ -1543,33 +1560,33 @@ msgid "" "name." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1039 +#: ../../library/xml.etree.elementtree.rst:1038 msgid "" "Creates a text iterator. The iterator loops over this element and all " "subelements, in document order, and returns all inner text." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1047 +#: ../../library/xml.etree.elementtree.rst:1046 msgid "" "Creates a new element object of the same type as this element. Do not call " "this method, use the :func:`SubElement` factory function instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1053 +#: ../../library/xml.etree.elementtree.rst:1052 msgid "" "Removes *subelement* from the element. Unlike the find\\* methods this " "method compares elements based on the instance identity, not on tag value or " "contents." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1057 +#: ../../library/xml.etree.elementtree.rst:1056 msgid "" ":class:`Element` objects also support the following sequence type methods " "for working with subelements: :meth:`~object.__delitem__`, :meth:`~object." "__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1062 +#: ../../library/xml.etree.elementtree.rst:1061 msgid "" "Caution: Elements with no subelements will test as ``False``. In a future " "release of Python, all elements will test as ``True`` regardless of whether " @@ -1577,7 +1594,7 @@ msgid "" "None`` tests.::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1067 +#: ../../library/xml.etree.elementtree.rst:1066 msgid "" "element = root.find('foo')\n" "\n" @@ -1588,11 +1605,11 @@ msgid "" " print(\"element not found\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1075 +#: ../../library/xml.etree.elementtree.rst:1074 msgid "Testing the truth value of an Element emits :exc:`DeprecationWarning`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1078 +#: ../../library/xml.etree.elementtree.rst:1077 msgid "" "Prior to Python 3.8, the serialisation order of the XML attributes of " "elements was artificially made predictable by sorting the attributes by " @@ -1601,7 +1618,7 @@ msgid "" "attributes were originally parsed or created by user code." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1084 +#: ../../library/xml.etree.elementtree.rst:1083 msgid "" "In general, user code should try not to depend on a specific ordering of " "attributes, given that the `XML Information Set \n" " \n" @@ -1750,13 +1767,13 @@ msgstr "" " \n" "" -#: ../../library/xml.etree.elementtree.rst:1219 +#: ../../library/xml.etree.elementtree.rst:1218 msgid "" "Example of changing the attribute \"target\" of every link in first " "paragraph::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1221 +#: ../../library/xml.etree.elementtree.rst:1220 msgid "" ">>> from xml.etree.ElementTree import ElementTree\n" ">>> tree = ElementTree()\n" @@ -1774,11 +1791,11 @@ msgid "" ">>> tree.write(\"output.xhtml\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1239 +#: ../../library/xml.etree.elementtree.rst:1238 msgid "QName Objects" msgstr "QName 物件" -#: ../../library/xml.etree.elementtree.rst:1244 +#: ../../library/xml.etree.elementtree.rst:1243 msgid "" "QName wrapper. This can be used to wrap a QName attribute value, in order " "to get proper namespace handling on output. *text_or_uri* is a string " @@ -1788,11 +1805,11 @@ msgid "" "class:`QName` instances are opaque." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1256 +#: ../../library/xml.etree.elementtree.rst:1255 msgid "TreeBuilder Objects" msgstr "TreeBuilder 物件" -#: ../../library/xml.etree.elementtree.rst:1262 +#: ../../library/xml.etree.elementtree.rst:1261 msgid "" "Generic element structure builder. This builder converts a sequence of " "start, data, end, comment and pi method calls to a well-formed element " @@ -1800,14 +1817,14 @@ msgid "" "custom XML parser, or a parser for some other XML-like format." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1267 +#: ../../library/xml.etree.elementtree.rst:1266 msgid "" "*element_factory*, when given, must be a callable accepting two positional " "arguments: a tag and a dict of attributes. It is expected to return a new " "element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1271 +#: ../../library/xml.etree.elementtree.rst:1270 msgid "" "The *comment_factory* and *pi_factory* functions, when given, should behave " "like the :func:`Comment` and :func:`ProcessingInstruction` functions to " @@ -1817,56 +1834,56 @@ msgid "" "element (but not outside of it)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1280 +#: ../../library/xml.etree.elementtree.rst:1279 msgid "" "Flushes the builder buffers, and returns the toplevel document element. " "Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1286 +#: ../../library/xml.etree.elementtree.rst:1285 msgid "" "Adds text to the current element. *data* is a string. This should be " "either a bytestring, or a Unicode string." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1292 +#: ../../library/xml.etree.elementtree.rst:1291 msgid "" "Closes the current element. *tag* is the element name. Returns the closed " "element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1298 +#: ../../library/xml.etree.elementtree.rst:1297 msgid "" "Opens a new element. *tag* is the element name. *attrs* is a dictionary " "containing element attributes. Returns the opened element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1304 +#: ../../library/xml.etree.elementtree.rst:1303 msgid "" "Creates a comment with the given *text*. If ``insert_comments`` is true, " "this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1312 +#: ../../library/xml.etree.elementtree.rst:1311 msgid "" "Creates a process instruction with the given *target* name and *text*. If " "``insert_pis`` is true, this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1318 +#: ../../library/xml.etree.elementtree.rst:1317 msgid "" "In addition, a custom :class:`TreeBuilder` object can provide the following " "methods:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1323 +#: ../../library/xml.etree.elementtree.rst:1322 msgid "" "Handles a doctype declaration. *name* is the doctype name. *pubid* is the " "public identifier. *system* is the system identifier. This method does not " "exist on the default :class:`TreeBuilder` class." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1331 +#: ../../library/xml.etree.elementtree.rst:1330 msgid "" "Is called whenever the parser encounters a new namespace declaration, before " "the ``start()`` callback for the opening element that defines it. *prefix* " @@ -1874,14 +1891,14 @@ msgid "" "otherwise. *uri* is the namespace URI." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1340 +#: ../../library/xml.etree.elementtree.rst:1339 msgid "" "Is called after the ``end()`` callback of an element that declared a " "namespace prefix mapping, with the name of the *prefix* that went out of " "scope." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1352 +#: ../../library/xml.etree.elementtree.rst:1351 msgid "" "A `C14N 2.0 `_ writer. Arguments are the " "same as for the :func:`canonicalize` function. This class does not build a " @@ -1889,11 +1906,11 @@ msgid "" "using the *write* function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1363 +#: ../../library/xml.etree.elementtree.rst:1362 msgid "XMLParser Objects" msgstr "XMLParser 物件" -#: ../../library/xml.etree.elementtree.rst:1368 +#: ../../library/xml.etree.elementtree.rst:1367 msgid "" "This class is the low-level building block of the module. It uses :mod:`xml." "parsers.expat` for efficient, event-based parsing of XML. It can be fed XML " @@ -1904,25 +1921,25 @@ msgid "" "XML file." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1376 +#: ../../library/xml.etree.elementtree.rst:1375 msgid "" "Parameters are now :ref:`keyword-only `. The *html* " "argument is no longer supported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1383 +#: ../../library/xml.etree.elementtree.rst:1382 msgid "" "Finishes feeding data to the parser. Returns the result of calling the " "``close()`` method of the *target* passed during construction; by default, " "this is the toplevel document element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1390 +#: ../../library/xml.etree.elementtree.rst:1389 msgid "Feeds data to the parser. *data* is encoded data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1395 -#: ../../library/xml.etree.elementtree.rst:1473 +#: ../../library/xml.etree.elementtree.rst:1394 +#: ../../library/xml.etree.elementtree.rst:1472 msgid "" "Triggers parsing of any previously fed unparsed data, which can be used to " "ensure more immediate feedback, in particular with Expat >=2.6.0. The " @@ -1932,15 +1949,15 @@ msgid "" "xmlparser.SetReparseDeferralEnabled` for details." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1402 -#: ../../library/xml.etree.elementtree.rst:1480 +#: ../../library/xml.etree.elementtree.rst:1401 +#: ../../library/xml.etree.elementtree.rst:1479 msgid "" "Note that :meth:`flush` has been backported to some prior releases of " "CPython as a security fix. Check for availability of :meth:`flush` using :" "func:`hasattr` if used in code running across a variety of Python versions." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1410 +#: ../../library/xml.etree.elementtree.rst:1409 msgid "" ":meth:`XMLParser.feed` calls *target*\\'s ``start(tag, attrs_dict)`` method " "for each opening tag, its ``end(tag)`` method for each closing tag, and data " @@ -1951,7 +1968,7 @@ msgid "" "of an XML file::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1418 +#: ../../library/xml.etree.elementtree.rst:1417 msgid "" ">>> from xml.etree.ElementTree import XMLParser\n" ">>> class MaxDepth: # The target object of the parser\n" @@ -1986,11 +2003,11 @@ msgid "" "4" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1454 +#: ../../library/xml.etree.elementtree.rst:1453 msgid "XMLPullParser Objects" msgstr "XMLPullParser 物件" -#: ../../library/xml.etree.elementtree.rst:1458 +#: ../../library/xml.etree.elementtree.rst:1457 msgid "" "A pull parser suitable for non-blocking applications. Its input-side API is " "similar to that of :class:`XMLParser`, but instead of pushing calls to a " @@ -2002,11 +2019,11 @@ msgid "" "If *events* is omitted, only ``\"end\"`` events are reported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1469 +#: ../../library/xml.etree.elementtree.rst:1468 msgid "Feed the given bytes data to the parser." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1489 +#: ../../library/xml.etree.elementtree.rst:1488 msgid "" "Signal the parser that the data stream is terminated. Unlike :meth:" "`XMLParser.close`, this method always returns :const:`None`. Any events not " @@ -2014,7 +2031,7 @@ msgid "" "`read_events`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1496 +#: ../../library/xml.etree.elementtree.rst:1495 msgid "" "Return an iterator over the events which have been encountered in the data " "fed to the parser. The iterator yields ``(event, elem)`` pairs, where " @@ -2023,25 +2040,25 @@ msgid "" "follows." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1502 +#: ../../library/xml.etree.elementtree.rst:1501 msgid "``start``, ``end``: the current Element." msgstr "``start``、``end``:目前的 Element。" -#: ../../library/xml.etree.elementtree.rst:1503 +#: ../../library/xml.etree.elementtree.rst:1502 msgid "``comment``, ``pi``: the current comment / processing instruction" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1504 +#: ../../library/xml.etree.elementtree.rst:1503 msgid "" "``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace " "mapping." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1506 +#: ../../library/xml.etree.elementtree.rst:1505 msgid "``end-ns``: :const:`None` (this may change in a future version)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1508 +#: ../../library/xml.etree.elementtree.rst:1507 msgid "" "Events provided in a previous call to :meth:`read_events` will not be " "yielded again. Events are consumed from the internal queue only when they " @@ -2050,7 +2067,7 @@ msgid "" "results." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1516 +#: ../../library/xml.etree.elementtree.rst:1515 msgid "" ":class:`XMLPullParser` only guarantees that it has seen the \">\" character " "of a starting tag when it emits a \"start\" event, so the attributes are " @@ -2059,11 +2076,11 @@ msgid "" "be present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1531 +#: ../../library/xml.etree.elementtree.rst:1530 msgid "Exceptions" msgstr "例外" -#: ../../library/xml.etree.elementtree.rst:1535 +#: ../../library/xml.etree.elementtree.rst:1534 msgid "" "XML parse error, raised by the various parsing methods in this module when " "parsing fails. The string representation of an instance of this exception " @@ -2071,22 +2088,22 @@ msgid "" "following attributes available:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1542 +#: ../../library/xml.etree.elementtree.rst:1541 msgid "" "A numeric error code from the expat parser. See the documentation of :mod:" "`xml.parsers.expat` for the list of error codes and their meanings." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1547 +#: ../../library/xml.etree.elementtree.rst:1546 msgid "" "A tuple of *line*, *column* numbers, specifying where the error occurred." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1550 +#: ../../library/xml.etree.elementtree.rst:1549 msgid "Footnotes" msgstr "註解" -#: ../../library/xml.etree.elementtree.rst:1551 +#: ../../library/xml.etree.elementtree.rst:1550 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See " diff --git a/library/xml.po b/library/xml.po index d23f35acd4..9793de3e4f 100644 --- a/library/xml.po +++ b/library/xml.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2023-08-21 02:16+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,14 +34,11 @@ msgstr "Python 處理 XML 的介面被歸類於 ``xml`` 套件中。" #: ../../library/xml.rst:20 msgid "" -"The XML modules are not secure against erroneous or maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see the :ref:" -"`xml-vulnerabilities` and :ref:`defusedxml-package` sections." -msgstr "" -"XML 模組無法抵禦錯誤或惡意建構的資料。如果你需要剖析不受信任或未經身份驗證的" -"資料,請參閱 :ref:`xml-vulnerabilities` 和 :ref:`defusedxml-package` 段落。" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/xml.rst:25 +#: ../../library/xml.rst:23 msgid "" "It is important to note that modules in the :mod:`xml` package require that " "there be at least one SAX-compliant XML parser available. The Expat parser " @@ -52,7 +49,7 @@ msgstr "" "Expat 剖析器包含在 Python 中,所以總是可以使用 :mod:`xml.parsers.expat` 模" "組。" -#: ../../library/xml.rst:30 +#: ../../library/xml.rst:28 msgid "" "The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the " "definition of the Python bindings for the DOM and SAX interfaces." @@ -60,189 +57,70 @@ msgstr "" ":mod:`xml.dom` 和 :mod:`xml.sax` 套件的文件為 DOM 和 SAX 介面的 Python 繫結的" "定義。" -#: ../../library/xml.rst:33 +#: ../../library/xml.rst:31 msgid "The XML handling submodules are:" msgstr "以下是 XML 處理子模組:" -#: ../../library/xml.rst:35 +#: ../../library/xml.rst:33 msgid "" ":mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight " "XML processor" msgstr "" ":mod:`xml.etree.ElementTree`:ElementTree API,一個簡單且輕量級的 XML 處理器" -#: ../../library/xml.rst:40 +#: ../../library/xml.rst:38 msgid ":mod:`xml.dom`: the DOM API definition" msgstr ":mod:`xml.dom`:DOM API 定義" -#: ../../library/xml.rst:41 +#: ../../library/xml.rst:39 msgid ":mod:`xml.dom.minidom`: a minimal DOM implementation" msgstr ":mod:`xml.dom.minidom`:最小的 DOM 實作" -#: ../../library/xml.rst:42 +#: ../../library/xml.rst:40 msgid ":mod:`xml.dom.pulldom`: support for building partial DOM trees" msgstr ":mod:`xml.dom.pulldom`:支援建置部分 DOM 樹" -#: ../../library/xml.rst:46 +#: ../../library/xml.rst:44 msgid ":mod:`xml.sax`: SAX2 base classes and convenience functions" msgstr ":mod:`xml.sax`:SAX2 基底類別和便利函式" -#: ../../library/xml.rst:47 +#: ../../library/xml.rst:45 msgid ":mod:`xml.parsers.expat`: the Expat parser binding" msgstr ":mod:`xml.parsers.expat`:Expat 剖析器繫結" -#: ../../library/xml.rst:53 -msgid "XML vulnerabilities" -msgstr "XML 漏洞" - -#: ../../library/xml.rst:55 -msgid "" -"The XML processing modules are not secure against maliciously constructed " -"data. An attacker can abuse XML features to carry out denial of service " -"attacks, access local files, generate network connections to other machines, " -"or circumvent firewalls." -msgstr "" -"XML 處理模組無法抵禦惡意建構的資料。攻擊者可以濫用 XML 功能來執行阻斷服務攻" -"擊 (denial of service attack)、存取本地檔案、生成與其他機器的網路連接或繞過防" -"火牆。" - -#: ../../library/xml.rst:60 -msgid "" -"The following table gives an overview of the known attacks and whether the " -"various modules are vulnerable to them." -msgstr "下表概述了已知的攻擊以及各個模組是否易有漏洞。" - -#: ../../library/xml.rst:64 -msgid "kind" -msgstr "種類" - -#: ../../library/xml.rst:64 -msgid "sax" -msgstr "sax" - -#: ../../library/xml.rst:64 -msgid "etree" -msgstr "etree" - -#: ../../library/xml.rst:64 -msgid "minidom" -msgstr "minidom" - -#: ../../library/xml.rst:64 -msgid "pulldom" -msgstr "pulldom" - -#: ../../library/xml.rst:64 -msgid "xmlrpc" -msgstr "xmlrpc" - -#: ../../library/xml.rst:66 -msgid "billion laughs" -msgstr "十億笑聲 (billion laughs)" - -#: ../../library/xml.rst:66 ../../library/xml.rst:67 -msgid "**Vulnerable** (1)" -msgstr "**脆弱** (1)" - -#: ../../library/xml.rst:67 -msgid "quadratic blowup" -msgstr "二次爆炸 (quadratic blowup)" - -#: ../../library/xml.rst:68 ../../library/xml.rst:106 -msgid "external entity expansion" -msgstr "外部實體擴展 (external entity expansion)" - -#: ../../library/xml.rst:68 ../../library/xml.rst:69 -msgid "Safe (5)" -msgstr "安全 (5)" - -#: ../../library/xml.rst:68 -msgid "Safe (2)" -msgstr "安全 (2)" - -#: ../../library/xml.rst:68 -msgid "Safe (3)" -msgstr "安全 (3)" - -#: ../../library/xml.rst:68 -msgid "Safe (4)" -msgstr "安全 (4)" - -#: ../../library/xml.rst:69 ../../library/xml.rst:111 -msgid "`DTD`_ retrieval" -msgstr "`DTD`_ 檢索" - -#: ../../library/xml.rst:69 ../../library/xml.rst:70 -msgid "Safe" -msgstr "安全" - -#: ../../library/xml.rst:70 ../../library/xml.rst:116 -msgid "decompression bomb" -msgstr "解壓縮炸彈 (decompression bomb)" - -#: ../../library/xml.rst:70 -msgid "**Vulnerable**" -msgstr "**脆弱**" - -#: ../../library/xml.rst:71 ../../library/xml.rst:123 -msgid "large tokens" -msgstr "大型 token" - -#: ../../library/xml.rst:71 -msgid "**Vulnerable** (6)" -msgstr "**脆弱** (6)" +#: ../../library/xml.rst:52 +msgid "XML security" +msgstr "XML 安全性" -#: ../../library/xml.rst:74 +#: ../../library/xml.rst:54 msgid "" -"Expat 2.4.1 and newer is not vulnerable to the \"billion laughs\" and " -"\"quadratic blowup\" vulnerabilities. Items still listed as vulnerable due " -"to potential reliance on system-provided libraries. Check :const:`!pyexpat." -"EXPAT_VERSION`." +"An attacker can abuse XML features to carry out denial of service attacks, " +"access local files, generate network connections to other machines, or " +"circumvent firewalls." msgstr "" -"Expat 2.4.1 及更新的版本不易受到「十億笑聲」和「二次爆炸」漏洞的影響。但仍可" -"能由於依賴系統提供的函式庫而被列為易受攻擊的項目。請檢查 :const:`!pyexpat." -"EXPAT_VERSION`。" +"攻擊者可以濫用 XML 功能來執行阻斷服務攻擊 (denial of service attack)、存取本地檔案" +"、生成與其他機器的網路連接或繞過防火牆。" -#: ../../library/xml.rst:78 +#: ../../library/xml.rst:58 msgid "" -":mod:`xml.etree.ElementTree` doesn't expand external entities and raises a :" -"exc:`~xml.etree.ElementTree.ParseError` when an entity occurs." +"Expat versions lower that 2.6.0 may be vulnerable to \"billion laughs\", " +"\"quadratic blowup\" and \"large tokens\". Python may be vulnerable if it " +"uses such older versions of Expat as a system-provided library. Check :const:" +"`!pyexpat.EXPAT_VERSION`." msgstr "" -":mod:`xml.etree.ElementTree` 不會擴展外部實體,並在實體出現時引發 :exc:`~xml." -"etree.ElementTree.ParseError`。" +"Expat 低於 2.6.0 的版本容易受到「十億笑聲」、「二次爆炸」與「大型 token」的影響。" +"Python 也可能因為使用這些系統提供的舊版 Expat 而易受攻擊。請檢查 :const:" +"`!pyexpat.EXPAT_VERSION`。" -#: ../../library/xml.rst:80 -msgid "" -":mod:`xml.dom.minidom` doesn't expand external entities and simply returns " -"the unexpanded entity verbatim." -msgstr ":mod:`xml.dom.minidom` 不會擴展外部實體,只會逐字回傳未擴展的實體。" - -#: ../../library/xml.rst:82 -msgid ":mod:`xmlrpc.client` doesn't expand external entities and omits them." -msgstr ":mod:`xmlrpc.client` 不會擴展外部實體且會忽略它們。" - -#: ../../library/xml.rst:83 -msgid "" -"Since Python 3.7.1, external general entities are no longer processed by " -"default." -msgstr "從 Python 3.7.1 開始,預設情況下不再處理外部通用實體。" +#: ../../library/xml.rst:63 +msgid ":mod:`xmlrpc` is **vulnerable** to the \"decompression bomb\" attack." +msgstr ":mod:`xmlrpc` 容易受到「解壓縮炸彈」攻擊。" -#: ../../library/xml.rst:85 -msgid "" -"Expat 2.6.0 and newer is not vulnerable to denial of service through " -"quadratic runtime caused by parsing large tokens. Items still listed as " -"vulnerable due to potential reliance on system-provided libraries. Check :" -"const:`!pyexpat.EXPAT_VERSION`." -msgstr "" -"Expat 2.6.0 及更新版本不易受到剖析大型 token 所導致的二次 runtime 阻斷服務的" -"影響。由於可能依賴系統提供的函式庫,因此仍被列為易受攻擊的項目。請參考 :" -"const:`!pyexpat.EXPAT_VERSION`。" - -#: ../../library/xml.rst:92 +#: ../../library/xml.rst:66 msgid "billion laughs / exponential entity expansion" msgstr "十億笑聲 / 指數實體擴展" -#: ../../library/xml.rst:93 +#: ../../library/xml.rst:67 msgid "" "The `Billion Laughs`_ attack -- also known as exponential entity expansion " "-- uses multiple levels of nested entities. Each entity refers to another " @@ -254,11 +132,11 @@ msgstr "" "expansion))使用多層巢狀實體。每個實體多次引用另一個實體,最終的實體定義包含" "一個小字串。指數擴展會產生數 GB 的文本,並消耗大量記憶體和 CPU 時間。" -#: ../../library/xml.rst:99 +#: ../../library/xml.rst:73 msgid "quadratic blowup entity expansion" msgstr "二次爆炸實體擴展" -#: ../../library/xml.rst:100 +#: ../../library/xml.rst:74 msgid "" "A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it " "abuses entity expansion, too. Instead of nested entities it repeats one " @@ -270,25 +148,11 @@ msgstr "" "它不是巢狀實體,而是一遍又一遍地重複一個具有幾千個字元的大型實體。該攻擊不如" "指數擴展那麼有效率,但它不會觸發那些用來防止深度巢狀實體的剖析器對策。" -#: ../../library/xml.rst:107 -msgid "" -"Entity declarations can contain more than just text for replacement. They " -"can also point to external resources or local files. The XML parser accesses " -"the resource and embeds the content into the XML document." -msgstr "" -"實體聲明不僅僅可以包含用於替換的文本,它們還可以指向外部資源或本地檔案。XML " -"剖析器會存取資源並將內容嵌入到 XML 文件中。" - -#: ../../library/xml.rst:112 -msgid "" -"Some XML libraries like Python's :mod:`xml.dom.pulldom` retrieve document " -"type definitions from remote or local locations. The feature has similar " -"implications as the external entity expansion issue." -msgstr "" -"一些 XML 函式庫(例如 Python 的 :mod:`xml.dom.pulldom`)從遠端或本地位置檢索" -"文件類型定義。該功能與外部實體擴展問題具有類似的含義。" +#: ../../library/xml.rst:80 +msgid "decompression bomb" +msgstr "解壓縮炸彈 (decompression bomb)" -#: ../../library/xml.rst:117 +#: ../../library/xml.rst:81 msgid "" "Decompression bombs (aka `ZIP bomb`_) apply to all XML libraries that can " "parse compressed XML streams such as gzipped HTTP streams or LZMA-compressed " @@ -299,7 +163,11 @@ msgstr "" "壓縮的 HTTP 串流或 LZMA 壓縮檔案)的 XML 函式庫。對於攻擊者來說,它可以將傳輸" "的資料量減少三個或更多數量級。" -#: ../../library/xml.rst:124 +#: ../../library/xml.rst:87 +msgid "large tokens" +msgstr "大型 token" + +#: ../../library/xml.rst:88 msgid "" "Expat needs to re-parse unfinished tokens; without the protection introduced " "in Expat 2.6.0, this can lead to quadratic runtime that can be used to cause " @@ -309,28 +177,3 @@ msgstr "" "Expat 需要重新剖析未完成的 token;如果沒有 Expat 2.6.0 中引入的保護,這可能會" "導致二次 runtime 而導致剖析 XML 的應用程式出現阻斷服務。此問題記錄於 :cve:" "`2023-52425`。" - -#: ../../library/xml.rst:129 -msgid "" -"The documentation for :pypi:`defusedxml` on PyPI has further information " -"about all known attack vectors with examples and references." -msgstr "" -"PyPI 上的 :pypi:`defusedxml` 文件包含有關所有已知攻擊媒介 (attack vector) 的" -"更多資訊以及範例和參考資料。" - -#: ../../library/xml.rst:135 -msgid "The :mod:`!defusedxml` Package" -msgstr ":mod:`!defusedxml` 套件" - -#: ../../library/xml.rst:137 -msgid "" -":pypi:`defusedxml` is a pure Python package with modified subclasses of all " -"stdlib XML parsers that prevent any potentially malicious operation. Use of " -"this package is recommended for any server code that parses untrusted XML " -"data. The package also ships with example exploits and extended " -"documentation on more XML exploits such as XPath injection." -msgstr "" -":pypi:`defusedxml` 是一個純 Python 套件,其中包含所有標準函式庫中 XML 剖析器" -"的修正版本子類別,可防止任何潛在的惡意操作。當伺服器程式會剖析任何不受信任的 " -"XML 資料時建議使用此套件。該套件還附帶了更多有關 XML 漏洞(例如 XPath 注入)" -"的範例和延伸文件。" diff --git a/library/xml.sax.po b/library/xml.sax.po index 2e824867ca..84e8592adb 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -1,13 +1,13 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang , 2016 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,12 +36,11 @@ msgstr "" #: ../../library/xml.sax.rst:23 msgid "" -"The :mod:`xml.sax` module is not secure against maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see :ref:`xml-" -"vulnerabilities`." -msgstr "" +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." +msgstr "如果你需要剖析不受信任或未經驗證的資料,請參閱 :ref:`xml-security`。" -#: ../../library/xml.sax.rst:29 +#: ../../library/xml.sax.rst:28 msgid "" "The SAX parser no longer processes general external entities by default to " "increase security. Before, the parser created network connections to fetch " @@ -51,11 +50,11 @@ msgid "" "`~xml.sax.handler.feature_external_ges`." msgstr "" -#: ../../library/xml.sax.rst:36 +#: ../../library/xml.sax.rst:35 msgid "The convenience functions are:" msgstr "" -#: ../../library/xml.sax.rst:41 +#: ../../library/xml.sax.rst:40 msgid "" "Create and return a SAX :class:`~xml.sax.xmlreader.XMLReader` object. The " "first parser found will be used. If *parser_list* is provided, it must be " @@ -64,11 +63,11 @@ msgid "" "modules in the default list of parsers." msgstr "" -#: ../../library/xml.sax.rst:47 +#: ../../library/xml.sax.rst:46 msgid "The *parser_list* argument can be any iterable, not just a list." msgstr "" -#: ../../library/xml.sax.rst:53 +#: ../../library/xml.sax.rst:52 msgid "" "Create a SAX parser and use it to parse a document. The document, passed in " "as *filename_or_stream*, can be a filename or a file object. The *handler* " @@ -79,18 +78,18 @@ msgid "" "passed in." msgstr "" -#: ../../library/xml.sax.rst:64 +#: ../../library/xml.sax.rst:63 msgid "" "Similar to :func:`parse`, but parses from a buffer *string* received as a " "parameter. *string* must be a :class:`str` instance or a :term:`bytes-like " "object`." msgstr "" -#: ../../library/xml.sax.rst:68 +#: ../../library/xml.sax.rst:67 msgid "Added support of :class:`str` instances." msgstr "新增 :class:`str` 實例的支援。" -#: ../../library/xml.sax.rst:71 +#: ../../library/xml.sax.rst:70 msgid "" "A typical SAX application uses three kinds of objects: readers, handlers and " "input sources. \"Reader\" in this context is another term for parser, i.e. " @@ -104,7 +103,7 @@ msgid "" "structural and syntactic events from the input data." msgstr "" -#: ../../library/xml.sax.rst:82 +#: ../../library/xml.sax.rst:81 msgid "" "For these objects, only the interfaces are relevant; they are normally not " "instantiated by the application itself. Since Python does not have an " @@ -120,13 +119,13 @@ msgid "" "interfaces are described below." msgstr "" -#: ../../library/xml.sax.rst:95 +#: ../../library/xml.sax.rst:94 msgid "" "In addition to these classes, :mod:`xml.sax` provides the following " "exception classes." msgstr "" -#: ../../library/xml.sax.rst:101 +#: ../../library/xml.sax.rst:100 msgid "" "Encapsulate an XML error or warning. This class can contain basic error or " "warning information from either the XML parser or the application: it can be " @@ -137,7 +136,7 @@ msgid "" "container for information." msgstr "" -#: ../../library/xml.sax.rst:109 +#: ../../library/xml.sax.rst:108 msgid "" "When instantiated, *msg* should be a human-readable description of the " "error. The optional *exception* parameter, if given, should be ``None`` or " @@ -145,11 +144,11 @@ msgid "" "as information." msgstr "" -#: ../../library/xml.sax.rst:113 +#: ../../library/xml.sax.rst:112 msgid "This is the base class for the other SAX exception classes." msgstr "" -#: ../../library/xml.sax.rst:118 +#: ../../library/xml.sax.rst:117 msgid "" "Subclass of :exc:`SAXException` raised on parse errors. Instances of this " "class are passed to the methods of the SAX :class:`~xml.sax.handler." @@ -158,14 +157,14 @@ msgid "" "as the :class:`SAXException` interface." msgstr "" -#: ../../library/xml.sax.rst:128 +#: ../../library/xml.sax.rst:127 msgid "" "Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." "XMLReader` is confronted with an unrecognized feature or property. SAX " "applications and extensions may use this class for similar purposes." msgstr "" -#: ../../library/xml.sax.rst:136 +#: ../../library/xml.sax.rst:135 msgid "" "Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." "XMLReader` is asked to enable a feature that is not supported, or to set a " @@ -173,54 +172,54 @@ msgid "" "applications and extensions may use this class for similar purposes." msgstr "" -#: ../../library/xml.sax.rst:145 +#: ../../library/xml.sax.rst:144 msgid "`SAX: The Simple API for XML `_" msgstr "" -#: ../../library/xml.sax.rst:146 +#: ../../library/xml.sax.rst:145 msgid "" "This site is the focal point for the definition of the SAX API. It provides " "a Java implementation and online documentation. Links to implementations " "and historical information are also available." msgstr "" -#: ../../library/xml.sax.rst:150 +#: ../../library/xml.sax.rst:149 msgid "Module :mod:`xml.sax.handler`" msgstr ":mod:`xml.sax.handler` 模組" -#: ../../library/xml.sax.rst:151 +#: ../../library/xml.sax.rst:150 msgid "Definitions of the interfaces for application-provided objects." msgstr "" -#: ../../library/xml.sax.rst:153 +#: ../../library/xml.sax.rst:152 msgid "Module :mod:`xml.sax.saxutils`" msgstr ":mod:`xml.sax.saxutils` 模組" -#: ../../library/xml.sax.rst:154 +#: ../../library/xml.sax.rst:153 msgid "Convenience functions for use in SAX applications." msgstr "" -#: ../../library/xml.sax.rst:156 +#: ../../library/xml.sax.rst:155 msgid "Module :mod:`xml.sax.xmlreader`" msgstr ":mod:`xml.sax.xmlreader` 模組" -#: ../../library/xml.sax.rst:157 +#: ../../library/xml.sax.rst:156 msgid "Definitions of the interfaces for parser-provided objects." msgstr "" -#: ../../library/xml.sax.rst:163 +#: ../../library/xml.sax.rst:162 msgid "SAXException Objects" msgstr "SAXException 物件" -#: ../../library/xml.sax.rst:165 +#: ../../library/xml.sax.rst:164 msgid "" "The :class:`SAXException` exception class supports the following methods:" msgstr "" -#: ../../library/xml.sax.rst:170 +#: ../../library/xml.sax.rst:169 msgid "Return a human-readable message describing the error condition." msgstr "" -#: ../../library/xml.sax.rst:175 +#: ../../library/xml.sax.rst:174 msgid "Return an encapsulated exception object, or ``None``." msgstr "" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 9835d74f1c..c68ea2436e 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-04 00:14+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,8 +37,8 @@ msgstr "" #: ../../library/xmlrpc.client.rst:26 msgid "" "The :mod:`xmlrpc.client` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." +"constructed data. If you need to parse untrusted or unauthenticated data, " +"see :ref:`xml-security`." msgstr "" #: ../../library/xmlrpc.client.rst:32 diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 7a0eb729b9..3db9476c5d 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,8 +37,8 @@ msgstr "" #: ../../library/xmlrpc.server.rst:22 msgid "" "The :mod:`xmlrpc.server` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." +"constructed data. If you need to parse untrusted or unauthenticated data, " +"see :ref:`xml-security`." msgstr "" #: ../../includes/wasm-notavail.rst:3 diff --git a/library/zipapp.po b/library/zipapp.po index 02fc69d0ea..d8c15093bb 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -1,7 +1,8 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" @@ -57,7 +58,7 @@ msgstr "" #: ../../library/zipapp.rst:40 msgid "Command-Line Interface" -msgstr "命令執行列介面" +msgstr "命令列介面" #: ../../library/zipapp.rst:42 msgid "" diff --git a/library/zipimport.po b/library/zipimport.po index f338c8d147..45836ce278 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -164,7 +164,7 @@ msgstr "" #: ../../library/zipimport.rst:118 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr ":exc:`IOError` 曾經被引發,現在它是一個 :exc:`OSError` 的別名。" #: ../../library/zipimport.rst:124 msgid "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 0d12d8d64e..2be2bb9af4 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-07-07 10:49+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgstr "Łukasz Langa" #: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see " -"the :ref:`changelog `." +"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " "月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" @@ -109,19 +109,19 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" -"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" -"_functools`, :mod:`!_json`, :mod:`!" -"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" -"_weakref`) now use multiphase initialization as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" +"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" +"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" +"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " +"as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!" -"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" -"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " -"are now using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" +"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" +"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " +"using the stable ABI defined by PEP 384." msgstr "" #: ../../whatsnew/3.9.rst:94 @@ -182,9 +182,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes ` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias " -"to :class:`collections.abc.Mapping`, are kept for one last release for " -"backward compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" +"class:`collections.abc.Mapping`, are kept for one last release for backward " +"compatibility. They will be removed from Python 3.10." msgstr "" #: ../../whatsnew/3.9.rst:131 @@ -210,8 +210,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-" -"in :class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-in :" +"class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" @@ -237,8 +237,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher " -"in :issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" +"issue:`36144`.)" msgstr "" #: ../../whatsnew/3.9.rst:162 @@ -247,12 +247,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)` " -"and :meth:`str.removesuffix(suffix)` have been added to " -"easily remove an unneeded prefix or a suffix from a string. Corresponding " -"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " -"been added. See :pep:`616` for a full description. (Contributed by Dennis " -"Sweeney in :issue:`39939`.)" +":meth:`str.removeprefix(prefix)` and :meth:`str." +"removesuffix(suffix)` have been added to easily remove an " +"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " +"``bytearray``, and ``collections.UserString`` methods have also been added. " +"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" +"issue:`39939`.)" msgstr "" #: ../../whatsnew/3.9.rst:172 @@ -329,28 +329,28 @@ msgstr "其他語言更動" #: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead " -"of :exc:`ValueError`, which used to occur when a relative import went past " -"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead of :exc:" +"`ValueError`, which used to occur when a relative import went past its top-" +"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " -"the :mod:`__main__` module became an absolute path, rather than a relative " -"path. These paths now remain valid after the current directory is changed " -"by :func:`os.chdir`. As a side effect, the traceback also displays the " -"absolute path for :mod:`__main__` module frames in this case. (Contributed " -"by Victor Stinner in :issue:`20443`.)" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" +"mod:`__main__` module became an absolute path, rather than a relative path. " +"These paths now remain valid after the current directory is changed by :func:" +"`os.chdir`. As a side effect, the traceback also displays the absolute path " +"for :mod:`__main__` module frames in this case. (Contributed by Victor " +"Stinner in :issue:`20443`.)" msgstr "" #: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode ` and in :ref:`debug build " "`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. " -"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." +"encode` and :meth:`bytes.decode`." msgstr "" #: ../../whatsnew/3.9.rst:236 @@ -386,26 +386,25 @@ msgstr "" #: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running " -"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " -"prohibited, and ``ag_running`` now reflects the actual running status of the " -"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" +"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" +"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " +"running status of the async generator. (Contributed by Yury Selivanov in :" +"issue:`30773`.)" msgstr "" #: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and " -"functions :func:`~operator.contains`, :func:`~operator.indexOf` " -"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " -"Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." +"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" +"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" msgstr "" #: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. " -"See :issue:`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. See :issue:" +"`41848` and :issue:`43755` for details." msgstr "" #: ../../whatsnew/3.9.rst:273 @@ -419,9 +418,8 @@ msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " -"concrete :class:`datetime.tzinfo` implementation backed by the system's time " -"zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" +"`datetime.tzinfo` implementation backed by the system's time zone data." msgstr "" #: ../../whatsnew/3.9.rst:284 @@ -467,10 +465,10 @@ msgstr "graphlib" #: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains " -"the :class:`graphlib.TopologicalSorter` class to offer functionality to " -"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " -"Peters and Larry Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." +"TopologicalSorter` class to offer functionality to perform topological " +"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " +"Hastings in :issue:`17005`.)" msgstr "" #: ../../whatsnew/3.9.rst:322 @@ -484,8 +482,8 @@ msgstr "ast" #: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka " -"in :issue:`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" +"`37995`.)" msgstr "" #: ../../whatsnew/3.9.rst:331 @@ -508,22 +506,21 @@ msgstr "asyncio" #: ../../whatsnew/3.9.rst:342 msgid "" -"Due to significant security concerns, the *reuse_address* parameter " -"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " -"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " -"UDP. For more details, see the documentation for " -"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " -"Pitrou, and Yury Selivanov in :issue:`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter of :meth:" +"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " +"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " +"more details, see the documentation for ``loop.create_datagram_endpoint()``. " +"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" +"`37228`.)" msgstr "" #: ../../whatsnew/3.9.rst:349 msgid "" -"Added a " -"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " -"schedules a shutdown for the default executor that waits on " -"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " -"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " -"(Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a new :term:`coroutine` :meth:`~asyncio.loop." +"shutdown_default_executor` that schedules a shutdown for the default " +"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " +"to finish closing. Also, :func:`asyncio.run` has been updated to use the " +"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:355 @@ -536,10 +533,9 @@ msgstr "" msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version " -"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " -"arguments. (Contributed by Kyle Stanley and Yury Selivanov " -"in :issue:`32309`.)" +"event loop, and essentially works as a high-level version of :meth:`~asyncio." +"loop.run_in_executor` that can directly take keyword arguments. (Contributed " +"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" msgstr "" #: ../../whatsnew/3.9.rst:364 @@ -553,8 +549,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " -"in :issue:`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" +"`37404`.)" msgstr "" #: ../../whatsnew/3.9.rst:374 @@ -573,8 +569,8 @@ msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " -"in :issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" +"issue:`38112`.)" msgstr "" #: ../../whatsnew/3.9.rst:384 @@ -583,11 +579,10 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter " -"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " -"futures which have not started running, instead of waiting for them to " -"complete before shutting down the executor. (Contributed by Kyle Stanley " -"in :issue:`39349`.)" +"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." +"shutdown` that cancels all pending futures which have not started running, " +"instead of waiting for them to complete before shutting down the executor. " +"(Contributed by Kyle Stanley in :issue:`39349`.)" msgstr "" #: ../../whatsnew/3.9.rst:392 @@ -612,9 +607,9 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " -"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " -"in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" +"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " +"by Anthony Sottile in :issue:`38312`.)" msgstr "" #: ../../whatsnew/3.9.rst:410 @@ -623,10 +618,10 @@ msgstr "datetime" #: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " -"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " -"methods now returns a :func:`~collections.namedtuple` instead of " -"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" +"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " +"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " +"(Contributed by Donghee Na in :issue:`24416`.)" msgstr "" #: ../../whatsnew/3.9.rst:417 @@ -646,9 +641,9 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" -"Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " -"in :issue:`38602`.)" +"Added constants :const:`!fcntl.F_OFD_GETLK`, :const:`!fcntl.F_OFD_SETLK` " +"and :const:`!fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" +"`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 @@ -657,10 +652,10 @@ msgstr "ftplib" #: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " -"a :class:`ValueError` if the given timeout for their constructor is zero to " -"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " -"in :issue:`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" +"`ValueError` if the given timeout for their constructor is zero to prevent " +"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" +"`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:438 @@ -672,15 +667,15 @@ msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " -"in :issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" +"issue:`38379`.)" msgstr "" #: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo " -"in :issue:`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" +"`39322`.)" msgstr "" #: ../../whatsnew/3.9.rst:450 @@ -718,8 +713,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " -"in :issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" +"issue:`4603`.)" msgstr "" #: ../../whatsnew/3.9.rst:475 @@ -741,8 +736,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton " -"in :issue:`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" +"`43008`.)" msgstr "" #: ../../whatsnew/3.9.rst:487 @@ -754,10 +749,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy " -"in :issue:`40468`.) Move the indent space setting from the Font tab to the " -"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " -"in :issue:`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" +"issue:`40468`.) Move the indent space setting from the Font tab to the new " +"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" +"`33962`.)" msgstr "" #: ../../whatsnew/3.9.rst:497 @@ -773,11 +768,11 @@ msgstr "imaplib" #: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, " -"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " -"parameter with this change. The overridden methods " -"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " -"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" +"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." +"open` method now has an optional *timeout* parameter with this change. The " +"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." +"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" +"issue:`38615`.)" msgstr "" #: ../../whatsnew/3.9.rst:510 @@ -796,10 +791,10 @@ msgstr "importlib" #: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import " -"statements, :func:`importlib.util.resolve_name` now " -"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " -"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" +"To improve consistency with import statements, :func:`importlib.util." +"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " +"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" +"`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:525 @@ -828,8 +823,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` " -"and :issue:`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" +"`39775`.)" msgstr "" #: ../../whatsnew/3.9.rst:543 @@ -845,16 +840,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through " -"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " -"Oleksandr Pavliuk in :issue:`34788`.)" +"present, scope zone ID is available through the :attr:`~ipaddress." +"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" +"`34788`.)" msgstr "" #: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " -"in :issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" +"issue:`36384`)." msgstr "" #: ../../whatsnew/3.9.rst:556 @@ -893,9 +888,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a " -"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " -"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" +"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " +"(Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" #: ../../whatsnew/3.9.rst:583 @@ -921,9 +916,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " -"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " -"descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" +"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." msgstr "" #: ../../whatsnew/3.9.rst:599 @@ -950,8 +944,8 @@ msgstr "pathlib" #: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly " -"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." +"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" #: ../../whatsnew/3.9.rst:618 @@ -970,10 +964,10 @@ msgstr "poplib" #: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " -"a :class:`ValueError` if the given timeout for their constructor is zero to " -"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " -"in :issue:`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" +"`ValueError` if the given timeout for their constructor is zero to prevent " +"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" +"`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:631 @@ -1003,7 +997,7 @@ msgstr "random" #: ../../whatsnew/3.9.rst:647 msgid "" -"Added a new :attr:`random.Random.randbytes` method: generate random bytes. " +"Added a new :meth:`random.Random.randbytes` method: generate random bytes. " "(Contributed by Victor Stinner in :issue:`40286`.)" msgstr "" @@ -1014,8 +1008,8 @@ msgstr "signal" #: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. " -"(:issue:`38712`)" +"signals to a process using a file descriptor instead of a pid. (:issue:" +"`38712`)" msgstr "" #: ../../whatsnew/3.9.rst:657 @@ -1024,10 +1018,10 @@ msgstr "smtplib" #: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " -"a :class:`ValueError` if the given timeout for their constructor is zero to " -"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " -"in :issue:`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" +"`ValueError` if the given timeout for their constructor is zero to prevent " +"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" +"`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:663 @@ -1042,9 +1036,9 @@ msgstr "socket" #: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports " -"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " -"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports the :const:`~socket." +"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " +"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" #: ../../whatsnew/3.9.rst:673 @@ -1055,9 +1049,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` " -"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " -"Shinya Okano and Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` and :func:`socket." +"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " +"Victor Stinner in :issue:`28724`.)" msgstr "" #: ../../whatsnew/3.9.rst:682 @@ -1145,11 +1139,10 @@ msgstr "xml" #: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when " -"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " -"normalized to \"\\n\". This is the result of discussion about how to " -"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " -"in :issue:`39011`.)" +"White space characters within attributes are now preserved when serializing :" +"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " +"\"\\n\". This is the result of discussion about how to interpret section " +"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" msgstr "" #: ../../whatsnew/3.9.rst:743 @@ -1189,8 +1182,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner " -"in :issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner in :" +"issue:`40010`.)" msgstr "" #: ../../whatsnew/3.9.rst:766 @@ -1208,16 +1201,15 @@ msgstr "" #: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins " -"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " -"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " -"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " -"in :issue:`37207`.)" +"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" +"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" +"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " +"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" msgstr "" #: ../../whatsnew/3.9.rst:779 msgid "" -"Optimized :func:`~set.difference_update` for the case when the other set is " +"Optimized :meth:`!set.difference_update` for the case when the other set is " "much larger than the base set. (Suggested by Evgeny Kapun with code " "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" @@ -1403,10 +1395,10 @@ msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor `_ running " -"the macOS 64-bit builds found at `python.org `_." +"i7-4960HQ processor `_ running the macOS 64-bit builds found at `python.org `_." msgstr "" #: ../../whatsnew/3.9.rst:853 @@ -1416,8 +1408,8 @@ msgstr "已棄用" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade " -"in :issue:`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" +"`39586`.)" msgstr "" #: ../../whatsnew/3.9.rst:859 @@ -1439,9 +1431,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!" -"PyParser_SimpleParseStringFlags`, :c:func:`!" -"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" +"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" @@ -1459,9 +1450,8 @@ msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds " -"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " -"and :class:`bytearray`." +"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" +"`bytes`, and :class:`bytearray`." msgstr "" #: ../../whatsnew/3.9.rst:887 @@ -1469,8 +1459,8 @@ msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka " -"in :issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" +"issue:`28286`.)" msgstr "" #: ../../whatsnew/3.9.rst:893 @@ -1519,17 +1509,17 @@ msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " -"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" +"`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" #: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. " -"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " -"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " -"Victor Stinner in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. Calling :c:" +"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " +"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " +"in :issue:`39877`.)" msgstr "" #: ../../whatsnew/3.9.rst:929 @@ -1541,8 +1531,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin " -"in :issue:`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" +"`35800`.)" msgstr "" #: ../../whatsnew/3.9.rst:935 @@ -1576,8 +1566,8 @@ msgid "" "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na " -"in :issue:`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" +"`39366`.)" msgstr "" #: ../../whatsnew/3.9.rst:963 @@ -1598,9 +1588,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. " -"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " -"(Contributed by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. Use :func:`sys." +"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " +"by Victor Stinner in :issue:`37392`.)" msgstr "" #: ../../whatsnew/3.9.rst:978 @@ -1634,23 +1624,21 @@ msgstr "" #: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of " -"classes :class:`~xml.etree.ElementTree.ElementTree` " -"and :class:`~xml.etree.ElementTree.Element` in " -"the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " -"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " -"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." +"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " +"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." +"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." +"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" #: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use " -"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " -"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " -"parameter was removed, standard :class:`bytes` objects are always used " -"instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" +"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " +"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " +"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" #: ../../whatsnew/3.9.rst:1010 @@ -1664,9 +1652,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` " -"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " -"in :issue:`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" +"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" +"`39351`.)" msgstr "" #: ../../whatsnew/3.9.rst:1020 @@ -1687,9 +1675,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted " -"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " -"in :issue:`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" +"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" +"`39377`)" msgstr "" #: ../../whatsnew/3.9.rst:1034 @@ -1703,18 +1691,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C " -"structure :c:type:`PyConfig` have been removed. They required a special " -"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " -"Stinner in :issue:`39489`.)" +"option and the ``show_alloc_count`` field of the C structure :c:type:" +"`PyConfig` have been removed. They required a special Python build by " +"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" +"`39489`.)" msgstr "" #: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " -"in :issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" +"issue:`40182`.)" msgstr "" #: ../../whatsnew/3.9.rst:1050 @@ -1727,8 +1715,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can " -"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can use :" +"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" @@ -1756,11 +1744,10 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now " -"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " -"Callers catching the specific exception type and supporting both Python 3.9 " -"and earlier versions will need to catch both using ``except (ImportError, " -"ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" +"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " +"the specific exception type and supporting both Python 3.9 and earlier " +"versions will need to catch both using ``except (ImportError, ValueError):``." msgstr "" #: ../../whatsnew/3.9.rst:1080 @@ -1771,9 +1758,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores " -"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " -"in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores the :const:" +"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" msgstr "" #: ../../whatsnew/3.9.rst:1087 @@ -1807,10 +1793,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added " -"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " -"inherit from it should have this method defined. (Contributed by Kyle " -"Stanley in :issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" +"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " +"from it should have this method defined. (Contributed by Kyle Stanley in :" +"issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:1110 @@ -1834,19 +1820,18 @@ msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using " -"``logging.getLogger(__name__)`` in some top-level module called " -"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" +"root logger named ``'root'``, or instantiates a logger using ``logging." +"getLogger(__name__)`` in some top-level module called ``'root.py'``. " +"(Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" #: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now " -"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " -"passed something other than an instance of ``str`` " -"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " -"don't inherit from those mentioned types. (Contributed by Roger Aiudi " -"in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now returns :data:" +"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " +"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " +"allows creating compatible classes that don't inherit from those mentioned " +"types. (Contributed by Roger Aiudi in :issue:`34775`)." msgstr "" #: ../../whatsnew/3.9.rst:1133 @@ -1861,11 +1846,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:1141 msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way " -"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " -"also converts the name to lower case. For example, ``\"latex+latin1\"`` " -"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " -"Jordon Xu in :issue:`37751`.)" +":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" +"`!encodings.normalize_encoding`, except that :func:`codecs.lookup` also " +"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " +"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " +"in :issue:`37751`.)" msgstr "" #: ../../whatsnew/3.9.rst:1149 @@ -1878,10 +1863,9 @@ msgid "" "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a " -"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " -"custom ``tp_traverse`` functions of heap-allocated types visit the object's " -"type." +"effect but for types that have a custom :c:member:`~PyTypeObject." +"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " +"heap-allocated types visit the object's type." msgstr "" #: ../../whatsnew/3.9.rst:1161 @@ -1936,8 +1920,8 @@ msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details " -"in :issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" +"issue:`29548`.)" msgstr "" #: ../../whatsnew/3.9.rst:1204 @@ -1946,9 +1930,9 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.9.rst:1206 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling " -"the :keyword:`assert` statement. Previously, the assert statement would not " -"work correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" +"keyword:`assert` statement. Previously, the assert statement would not work " +"correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" @@ -1985,10 +1969,10 @@ msgstr "建置變更" #: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the " -"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " -"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " -"Stratakis and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the new :data:`sys." +"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " +"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " +"and Victor Stinner in :issue:`1294959`.)" msgstr "" #: ../../whatsnew/3.9.rst:1231 @@ -2051,16 +2035,16 @@ msgstr "C API 變更" msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` " -"and :c:macro:`METH_METHOD` to allow a method to access the class it was " -"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" +"`METH_METHOD` to allow a method to access the class it was defined in. " +"(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" #: ../../whatsnew/3.9.rst:1280 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. " -"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " -"(Contributed by Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" +"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " +"Victor Stinner in :issue:`40421`.)" msgstr "" #: ../../whatsnew/3.9.rst:1284 @@ -2071,12 +2055,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:1287 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` " -"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " -"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " -"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " -"unique identifier of a Python thread state. (Contributed by Victor Stinner " -"in :issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" +"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" +"`PyThreadState_GetFrame` function to get the current frame of a Python " +"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " +"identifier of a Python thread state. (Contributed by Victor Stinner in :" +"issue:`39947`.)" msgstr "" #: ../../whatsnew/3.9.rst:1295 @@ -2118,18 +2102,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1317 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` " -"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " -"Python objects are being currently tracked or have been already finalized by " -"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " -"in :issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" +"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " +"objects are being currently tracked or have been already finalized by the " +"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" +"issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer " -"in :issue:`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" +"`37645`.)" msgstr "" #: ../../whatsnew/3.9.rst:1327 @@ -2141,21 +2125,20 @@ msgstr "" #: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " -"in :issue:`38500`.)" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" +"issue:`38500`.)" msgstr "" #: ../../whatsnew/3.9.rst:1339 msgid "" -"Extension " -"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " -"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " -"no longer called if the module state was requested but is not allocated yet. " -"This is the case immediately after the module is created and before the " -"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " -"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " -"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " -"``NULL``." +"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" +"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" +"type:`PyModuleDef` are no longer called if the module state was requested " +"but is not allocated yet. This is the case immediately after the module is " +"created and before the module is executed (:c:data:`Py_mod_exec` function). " +"More precisely, these functions are not called if :c:member:`~PyModuleDef." +"m_size` is greater than 0 and the module state (as returned by :c:func:" +"`PyModule_GetState`) is ``NULL``." msgstr "" #: ../../whatsnew/3.9.rst:1348 @@ -2189,26 +2172,25 @@ msgstr "" #: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " -"in :issue:`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" +"`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1369 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " -"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" -"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" -"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " -"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " -"in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" +"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " +"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " +"marked as deprecated in C. They have been deprecated by :pep:`393` since " +"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" #: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " -"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " -"in :issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner in :" +"issue:`39882`.)" msgstr "" #: ../../whatsnew/3.9.rst:1381 @@ -2228,10 +2210,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1388 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to " -"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " -"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " -"access directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" +"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " +"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " +"directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" #: ../../whatsnew/3.9.rst:1393 @@ -2261,8 +2243,8 @@ msgstr "(更多資訊請見 :issue:`40170`。)" #: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " -"in :issue:`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" +"`38835`.)" msgstr "" #: ../../whatsnew/3.9.rst:1413 @@ -2279,8 +2261,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1422 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " -"in :issue:`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" +"`37878`.)" msgstr "" #: ../../whatsnew/3.9.rst:1424 @@ -2437,8 +2419,8 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " -"in :issue:`39372`.)" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" +"`39372`.)" msgstr "" #: ../../whatsnew/3.9.rst:1490 @@ -2447,9 +2429,8 @@ msgstr "Python 3.9.1 中顯著的變更" #: ../../whatsnew/3.9.rst:1495 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform " -"with :pep:`586` and to match the behavior of static type checkers specified " -"in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform with :pep:" +"`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" #: ../../whatsnew/3.9.rst:1498 @@ -2532,14 +2513,13 @@ msgid "" "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting " -"the :class:`collections.abc.Callable` type. Code which accesses the " -"arguments via :func:`typing.get_args` or ``__args__`` need to account for " -"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " -"of parameterizing :class:`collections.abc.Callable` which may have passed " -"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " -"a :exc:`TypeError` in Python 3.10. (Contributed by Ken Jin " -"in :issue:`42195`.)" +"subclass will be returned when subscripting the :class:`collections.abc." +"Callable` type. Code which accesses the arguments via :func:`typing." +"get_args` or ``__args__`` need to account for this change. A :exc:" +"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" +"class:`collections.abc.Callable` which may have passed silently in Python " +"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " +"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" #: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 @@ -2549,14 +2529,13 @@ msgstr "urllib.parse" #: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` " -"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " -"conform with newer W3C recommendations, this has been changed to allow only " -"a single separator key, with ``&`` as the default. This change also " -"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " -"affected functions internally. For more details, please see their respective " -"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " -"in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." +"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " +"recommendations, this has been changed to allow only a single separator key, " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " +"For more details, please see their respective documentation. (Contributed by " +"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.9.rst:1565 @@ -2579,12 +2558,11 @@ msgstr "Python 3.9.5 中顯著的變更" #: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that " -"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " -"characters are stripped from the URL by the parser in :mod:`urllib.parse` " -"preventing such attacks. The removal characters are controlled by a new " -"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " -"(See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that updates :rfc:" +"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " +"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " +"attacks. The removal characters are controlled by a new module level " +"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.9.rst:1587