diff --git a/howto/functional.po b/howto/functional.po index 043ffea200..43e8526a9c 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-11-02 00:20+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-" @@ -1047,10 +1047,10 @@ msgstr "" #: ../../howto/functional.rst:997 msgid "" -"The :mod:`functools` module in Python 2.5 contains some higher-order " -"functions. A **higher-order function** takes one or more functions as input " -"and returns a new function. The most useful tool in this module is the :" -"func:`functools.partial` function." +"The :mod:`functools` module contains some higher-order functions. A **higher-" +"order function** takes one or more functions as input and returns a new " +"function. The most useful tool in this module is the :func:`functools." +"partial` function." msgstr "" #: ../../howto/functional.rst:1002 diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 72ceee2c09..55f800175c 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-31 08:13+0000\n" +"POT-Creation-Date: 2022-11-02 00:20+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-" @@ -366,21 +366,154 @@ msgstr "" msgid "Running a logging socket listener in production" msgstr "" -#: ../../howto/logging-cookbook.rst:768 +#: ../../howto/logging-cookbook.rst:770 msgid "" "To run a logging listener in production, you may need to use a process-" -"management tool such as `Supervisor `_. `Here " -"`_ is a " -"Gist which provides the bare-bones files to run the above functionality " -"using Supervisor: you will need to change the ``/path/to/`` parts in the " -"Gist to reflect the actual paths you want to use." +"management tool such as `Supervisor `_. `Here is a " +"Gist `__ which provides the bare-bones files to run " +"the above functionality using Supervisor. It consists of the following files:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:777 +msgid "File" +msgstr "" + +#: ../../howto/logging-cookbook.rst:777 +msgid "Purpose" +msgstr "" + +#: ../../howto/logging-cookbook.rst:779 +msgid ":file:`prepare.sh`" msgstr "" #: ../../howto/logging-cookbook.rst:779 +msgid "A Bash script to prepare the environment for testing" +msgstr "" + +#: ../../howto/logging-cookbook.rst:782 +msgid ":file:`supervisor.conf`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:782 +msgid "" +"The Supervisor configuration file, which has entries for the listener and a " +"multi-process web application" +msgstr "" + +#: ../../howto/logging-cookbook.rst:786 +msgid ":file:`ensure_app.sh`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:786 +msgid "" +"A Bash script to ensure that Supervisor is running with the above " +"configuration" +msgstr "" + +#: ../../howto/logging-cookbook.rst:789 +msgid ":file:`log_listener.py`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:789 +msgid "" +"The socket listener program which receives log events and records them to a " +"file" +msgstr "" + +#: ../../howto/logging-cookbook.rst:792 +msgid ":file:`main.py`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:792 +msgid "" +"A simple web application which performs logging via a socket connected to " +"the listener" +msgstr "" + +#: ../../howto/logging-cookbook.rst:795 +msgid ":file:`webapp.json`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:795 +msgid "A JSON configuration file for the web application" +msgstr "" + +#: ../../howto/logging-cookbook.rst:797 +msgid ":file:`client.py`" +msgstr "" + +#: ../../howto/logging-cookbook.rst:797 +msgid "A Python script to exercise the web application" +msgstr "" + +#: ../../howto/logging-cookbook.rst:800 +msgid "" +"The web application uses `Gunicorn `_, which is a " +"popular web application server that starts multiple worker processes to " +"handle requests. This example setup shows how the workers can write to the " +"same log file without conflicting with one another --- they all go through " +"the socket listener." +msgstr "" + +#: ../../howto/logging-cookbook.rst:805 +msgid "To test these files, do the following in a POSIX environment:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:807 +msgid "" +"Download `the Gist `__ as a ZIP archive using the :" +"guilabel:`Download ZIP` button." +msgstr "" + +#: ../../howto/logging-cookbook.rst:810 +msgid "Unzip the above files from the archive into a scratch directory." +msgstr "" + +#: ../../howto/logging-cookbook.rst:812 +msgid "" +"In the scratch directory, run ``bash prepare.sh`` to get things ready. This " +"creates a :file:`run` subdirectory to contain Supervisor-related and log " +"files, and a :file:`venv` subdirectory to contain a virtual environment into " +"which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." +msgstr "" + +#: ../../howto/logging-cookbook.rst:817 +msgid "" +"Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the " +"above configuration." +msgstr "" + +#: ../../howto/logging-cookbook.rst:820 +msgid "" +"Run ``venv/bin/python client.py`` to exercise the web application, which " +"will lead to records being written to the log." +msgstr "" + +#: ../../howto/logging-cookbook.rst:823 +msgid "" +"Inspect the log files in the :file:`run` subdirectory. You should see the " +"most recent log lines in files matching the pattern :file:`app.log*`. They " +"won't be in any particular order, since they have been handled concurrently " +"by different worker processes in a non-deterministic way." +msgstr "" + +#: ../../howto/logging-cookbook.rst:828 +msgid "" +"You can shut down the listener and the web application by running ``venv/bin/" +"supervisorctl -c supervisor.conf shutdown``." +msgstr "" + +#: ../../howto/logging-cookbook.rst:831 +msgid "" +"You may need to tweak the configuration files in the unlikely event that the " +"configured ports clash with something else in your test environment." +msgstr "" + +#: ../../howto/logging-cookbook.rst:837 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:781 +#: ../../howto/logging-cookbook.rst:839 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -396,11 +529,11 @@ msgid "" "`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:796 +#: ../../howto/logging-cookbook.rst:854 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:798 +#: ../../howto/logging-cookbook.rst:856 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. " @@ -411,7 +544,7 @@ msgid "" "types of instances interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:806 +#: ../../howto/logging-cookbook.rst:864 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 " @@ -422,7 +555,7 @@ msgid "" "of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:822 +#: ../../howto/logging-cookbook.rst:880 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -435,7 +568,7 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:831 +#: ../../howto/logging-cookbook.rst:889 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " @@ -446,21 +579,21 @@ msgid "" "`~LoggerAdapter.process` to do what you need. Here is a simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:847 +#: ../../howto/logging-cookbook.rst:905 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:852 +#: ../../howto/logging-cookbook.rst:910 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:856 +#: ../../howto/logging-cookbook.rst:914 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:858 +#: ../../howto/logging-cookbook.rst:916 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -469,11 +602,11 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:867 +#: ../../howto/logging-cookbook.rst:925 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:869 +#: ../../howto/logging-cookbook.rst:927 msgid "" "You can also add contextual information to log output using a user-defined :" "class:`Filter`. ``Filter`` instances are allowed to modify the " @@ -482,7 +615,7 @@ msgid "" "class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:874 +#: ../../howto/logging-cookbook.rst:932 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:" @@ -494,15 +627,15 @@ msgid "" "an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:920 +#: ../../howto/logging-cookbook.rst:978 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:938 +#: ../../howto/logging-cookbook.rst:996 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:940 +#: ../../howto/logging-cookbook.rst:998 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -512,7 +645,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:946 +#: ../../howto/logging-cookbook.rst:1004 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -523,18 +656,18 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:953 +#: ../../howto/logging-cookbook.rst:1011 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:969 +#: ../../howto/logging-cookbook.rst:1027 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:1113 +#: ../../howto/logging-cookbook.rst:1171 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -545,11 +678,11 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:1160 +#: ../../howto/logging-cookbook.rst:1218 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:1162 +#: ../../howto/logging-cookbook.rst:1220 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -557,11 +690,11 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:1189 +#: ../../howto/logging-cookbook.rst:1247 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:1191 +#: ../../howto/logging-cookbook.rst:1249 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -577,7 +710,7 @@ msgid "" "you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1204 +#: ../../howto/logging-cookbook.rst:1262 msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " @@ -588,7 +721,7 @@ msgid "" "platforms (see https://bugs.python.org/issue3770)." msgstr "" -#: ../../howto/logging-cookbook.rst:1214 +#: ../../howto/logging-cookbook.rst:1272 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -603,13 +736,13 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1330 +#: ../../howto/logging-cookbook.rst:1388 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1425 +#: ../../howto/logging-cookbook.rst:1483 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -619,34 +752,34 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1432 +#: ../../howto/logging-cookbook.rst:1490 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "" -#: ../../howto/logging-cookbook.rst:1434 +#: ../../howto/logging-cookbook.rst:1492 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1442 +#: ../../howto/logging-cookbook.rst:1500 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1448 +#: ../../howto/logging-cookbook.rst:1506 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1459 +#: ../../howto/logging-cookbook.rst:1517 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1466 +#: ../../howto/logging-cookbook.rst:1524 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1468 +#: ../../howto/logging-cookbook.rst:1526 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -658,11 +791,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1478 +#: ../../howto/logging-cookbook.rst:1536 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1483 +#: ../../howto/logging-cookbook.rst:1541 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -672,13 +805,13 @@ msgid "" "RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1515 +#: ../../howto/logging-cookbook.rst:1573 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1527 +#: ../../howto/logging-cookbook.rst:1585 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -686,17 +819,17 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1532 +#: ../../howto/logging-cookbook.rst:1590 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1538 +#: ../../howto/logging-cookbook.rst:1596 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1540 +#: ../../howto/logging-cookbook.rst:1598 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " @@ -705,7 +838,7 @@ msgid "" "Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1546 +#: ../../howto/logging-cookbook.rst:1604 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -718,14 +851,14 @@ msgid "" "session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1580 +#: ../../howto/logging-cookbook.rst:1638 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1588 +#: ../../howto/logging-cookbook.rst:1646 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -741,7 +874,7 @@ msgid "" "strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1659 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -750,7 +883,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1625 +#: ../../howto/logging-cookbook.rst:1683 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -761,21 +894,21 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1633 +#: ../../howto/logging-cookbook.rst:1691 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1655 +#: ../../howto/logging-cookbook.rst:1713 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1659 +#: ../../howto/logging-cookbook.rst:1717 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -786,23 +919,23 @@ msgid "" "sugar for a constructor call to one of the XXXMessage classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1667 +#: ../../howto/logging-cookbook.rst:1725 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1698 +#: ../../howto/logging-cookbook.rst:1756 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.2 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1707 +#: ../../howto/logging-cookbook.rst:1765 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1709 +#: ../../howto/logging-cookbook.rst:1767 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:" @@ -813,13 +946,13 @@ msgid "" "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1716 +#: ../../howto/logging-cookbook.rst:1774 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1719 +#: ../../howto/logging-cookbook.rst:1777 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " @@ -828,27 +961,27 @@ msgid "" "`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1725 +#: ../../howto/logging-cookbook.rst:1783 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." msgstr "" -#: ../../howto/logging-cookbook.rst:1728 +#: ../../howto/logging-cookbook.rst:1786 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." msgstr "" -#: ../../howto/logging-cookbook.rst:1731 +#: ../../howto/logging-cookbook.rst:1789 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1735 +#: ../../howto/logging-cookbook.rst:1793 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -856,7 +989,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1740 +#: ../../howto/logging-cookbook.rst:1798 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -865,7 +998,7 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1748 +#: ../../howto/logging-cookbook.rst:1806 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -875,7 +1008,7 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1754 +#: ../../howto/logging-cookbook.rst:1812 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 " @@ -885,7 +1018,7 @@ msgid "" "`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1761 +#: ../../howto/logging-cookbook.rst:1819 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -893,7 +1026,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1774 +#: ../../howto/logging-cookbook.rst:1832 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -903,70 +1036,70 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1785 +#: ../../howto/logging-cookbook.rst:1843 msgid "Subclassing QueueHandler - a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1787 +#: ../../howto/logging-cookbook.rst:1845 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1806 +#: ../../howto/logging-cookbook.rst:1864 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1824 +#: ../../howto/logging-cookbook.rst:1882 msgid "Subclassing QueueListener - a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1826 +#: ../../howto/logging-cookbook.rst:1884 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1845 ../../howto/logging-cookbook.rst:3865 +#: ../../howto/logging-cookbook.rst:1903 ../../howto/logging-cookbook.rst:3923 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:1845 ../../howto/logging-cookbook.rst:3865 +#: ../../howto/logging-cookbook.rst:1903 ../../howto/logging-cookbook.rst:3923 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1848 ../../howto/logging-cookbook.rst:3868 +#: ../../howto/logging-cookbook.rst:1906 ../../howto/logging-cookbook.rst:3926 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:1848 ../../howto/logging-cookbook.rst:3868 +#: ../../howto/logging-cookbook.rst:1906 ../../howto/logging-cookbook.rst:3926 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1851 ../../howto/logging-cookbook.rst:3871 +#: ../../howto/logging-cookbook.rst:1909 ../../howto/logging-cookbook.rst:3929 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:1851 ../../howto/logging-cookbook.rst:3871 +#: ../../howto/logging-cookbook.rst:1909 ../../howto/logging-cookbook.rst:3929 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:1853 +#: ../../howto/logging-cookbook.rst:1911 msgid ":ref:`A basic logging tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:1855 +#: ../../howto/logging-cookbook.rst:1913 msgid ":ref:`A more advanced logging tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:1859 +#: ../../howto/logging-cookbook.rst:1917 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:1861 +#: ../../howto/logging-cookbook.rst:1919 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:1924 +#: ../../howto/logging-cookbook.rst:1982 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:1926 +#: ../../howto/logging-cookbook.rst:1984 msgid "" "An example of how you can define a namer and rotator is given in the " "following snippet, which shows zlib-based compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:1944 +#: ../../howto/logging-cookbook.rst:2002 msgid "" "These are not \"true\" .gz files, as they are bare compressed data, with no " "\"container\" such as you’d find in an actual gzip file. This snippet is " "just for illustration purposes." msgstr "" -#: ../../howto/logging-cookbook.rst:1949 +#: ../../howto/logging-cookbook.rst:2007 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:1951 +#: ../../howto/logging-cookbook.rst:2009 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -1010,7 +1143,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:1956 +#: ../../howto/logging-cookbook.rst:2014 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -1023,17 +1156,17 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:1966 +#: ../../howto/logging-cookbook.rst:2024 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2178 +#: ../../howto/logging-cookbook.rst:2236 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2180 +#: ../../howto/logging-cookbook.rst:2238 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -1042,7 +1175,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2186 +#: ../../howto/logging-cookbook.rst:2244 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -1050,7 +1183,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2192 +#: ../../howto/logging-cookbook.rst:2250 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -1059,33 +1192,33 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2198 +#: ../../howto/logging-cookbook.rst:2256 msgid "" "Attach a :class:`~logging.Formatter` instance to your :class:`~logging." "handlers.SysLogHandler` instance, with a format string such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2204 +#: ../../howto/logging-cookbook.rst:2262 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2207 +#: ../../howto/logging-cookbook.rst:2265 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2211 +#: ../../howto/logging-cookbook.rst:2269 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2215 +#: ../../howto/logging-cookbook.rst:2273 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -1094,11 +1227,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2222 +#: ../../howto/logging-cookbook.rst:2280 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2224 +#: ../../howto/logging-cookbook.rst:2282 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -1110,31 +1243,31 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2248 +#: ../../howto/logging-cookbook.rst:2306 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2254 ../../howto/logging-cookbook.rst:2296 +#: ../../howto/logging-cookbook.rst:2312 ../../howto/logging-cookbook.rst:2354 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2257 +#: ../../howto/logging-cookbook.rst:2315 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2290 +#: ../../howto/logging-cookbook.rst:2348 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2305 +#: ../../howto/logging-cookbook.rst:2363 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2307 +#: ../../howto/logging-cookbook.rst:2365 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -1144,24 +1277,24 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2321 +#: ../../howto/logging-cookbook.rst:2379 msgid "" "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:2354 +#: ../../howto/logging-cookbook.rst:2412 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2401 +#: ../../howto/logging-cookbook.rst:2459 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2411 +#: ../../howto/logging-cookbook.rst:2469 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 " @@ -1170,17 +1303,17 @@ msgid "" "change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2417 +#: ../../howto/logging-cookbook.rst:2475 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2422 +#: ../../howto/logging-cookbook.rst:2480 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2426 +#: ../../howto/logging-cookbook.rst:2484 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -1188,25 +1321,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2431 +#: ../../howto/logging-cookbook.rst:2489 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2435 +#: ../../howto/logging-cookbook.rst:2493 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2445 +#: ../../howto/logging-cookbook.rst:2503 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2447 +#: ../../howto/logging-cookbook.rst:2505 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -1217,7 +1350,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2454 +#: ../../howto/logging-cookbook.rst:2512 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -1232,7 +1365,7 @@ msgid "" "calls which are out there in existing code will be using %-format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2466 +#: ../../howto/logging-cookbook.rst:2524 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -1240,7 +1373,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2470 +#: ../../howto/logging-cookbook.rst:2528 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -1248,11 +1381,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2477 +#: ../../howto/logging-cookbook.rst:2535 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2479 +#: ../../howto/logging-cookbook.rst:2537 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -1267,17 +1400,17 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2490 +#: ../../howto/logging-cookbook.rst:2548 msgid "" "Refer to the reference documentation on :func:`setLogRecordFactory` and :" "class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2495 +#: ../../howto/logging-cookbook.rst:2553 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2497 +#: ../../howto/logging-cookbook.rst:2555 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " "to construct your individual log messages. You may recall (from :ref:" @@ -1287,7 +1420,7 @@ msgid "" "following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2522 +#: ../../howto/logging-cookbook.rst:2580 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -1298,17 +1431,17 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2530 +#: ../../howto/logging-cookbook.rst:2588 msgid "" "Examples of this approach are given below. Firstly, formatting with :meth:" "`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2544 +#: ../../howto/logging-cookbook.rst:2602 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2551 +#: ../../howto/logging-cookbook.rst:2609 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -1320,11 +1453,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2565 +#: ../../howto/logging-cookbook.rst:2623 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2567 +#: ../../howto/logging-cookbook.rst:2625 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -1339,22 +1472,22 @@ msgid "" "complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2620 +#: ../../howto/logging-cookbook.rst:2678 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2628 +#: ../../howto/logging-cookbook.rst:2686 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2630 +#: ../../howto/logging-cookbook.rst:2688 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2632 +#: ../../howto/logging-cookbook.rst:2690 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -1364,7 +1497,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2639 +#: ../../howto/logging-cookbook.rst:2697 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -1373,11 +1506,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2648 +#: ../../howto/logging-cookbook.rst:2706 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2650 +#: ../../howto/logging-cookbook.rst:2708 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -1385,22 +1518,22 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2691 +#: ../../howto/logging-cookbook.rst:2749 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2698 +#: ../../howto/logging-cookbook.rst:2756 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2705 +#: ../../howto/logging-cookbook.rst:2763 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2707 +#: ../../howto/logging-cookbook.rst:2765 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -1417,24 +1550,24 @@ msgid "" "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2749 +#: ../../howto/logging-cookbook.rst:2807 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:2751 +#: ../../howto/logging-cookbook.rst:2809 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:2759 +#: ../../howto/logging-cookbook.rst:2817 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:2761 +#: ../../howto/logging-cookbook.rst:2819 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -1444,7 +1577,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:2768 +#: ../../howto/logging-cookbook.rst:2826 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -1457,7 +1590,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:2778 +#: ../../howto/logging-cookbook.rst:2836 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -1466,7 +1599,7 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:2784 +#: ../../howto/logging-cookbook.rst:2842 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " @@ -1478,30 +1611,30 @@ msgid "" "respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:2792 +#: ../../howto/logging-cookbook.rst:2850 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:2855 +#: ../../howto/logging-cookbook.rst:2913 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2885 +#: ../../howto/logging-cookbook.rst:2943 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:2889 +#: ../../howto/logging-cookbook.rst:2947 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2899 +#: ../../howto/logging-cookbook.rst:2957 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:2901 +#: ../../howto/logging-cookbook.rst:2959 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." @@ -1512,7 +1645,7 @@ msgid "" "argument to see the required and optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2973 +#: ../../howto/logging-cookbook.rst:3031 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -1520,17 +1653,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:2981 +#: ../../howto/logging-cookbook.rst:3039 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2983 +#: ../../howto/logging-cookbook.rst:3041 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:2992 +#: ../../howto/logging-cookbook.rst:3050 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 " @@ -1538,21 +1671,21 @@ msgid "" "the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3035 +#: ../../howto/logging-cookbook.rst:3093 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3042 +#: ../../howto/logging-cookbook.rst:3100 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3049 +#: ../../howto/logging-cookbook.rst:3107 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3051 +#: ../../howto/logging-cookbook.rst:3109 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -1562,7 +1695,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3084 +#: ../../howto/logging-cookbook.rst:3142 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -1571,13 +1704,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3090 +#: ../../howto/logging-cookbook.rst:3148 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3108 +#: ../../howto/logging-cookbook.rst:3166 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -1590,56 +1723,56 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3118 +#: ../../howto/logging-cookbook.rst:3176 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3129 +#: ../../howto/logging-cookbook.rst:3187 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3137 +#: ../../howto/logging-cookbook.rst:3195 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3147 +#: ../../howto/logging-cookbook.rst:3205 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3149 +#: ../../howto/logging-cookbook.rst:3207 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3157 +#: ../../howto/logging-cookbook.rst:3215 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3159 +#: ../../howto/logging-cookbook.rst:3217 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3161 +#: ../../howto/logging-cookbook.rst:3219 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3162 +#: ../../howto/logging-cookbook.rst:3220 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3164 +#: ../../howto/logging-cookbook.rst:3222 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3166 +#: ../../howto/logging-cookbook.rst:3224 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 " @@ -1650,53 +1783,53 @@ msgid "" "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3215 +#: ../../howto/logging-cookbook.rst:3273 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3228 +#: ../../howto/logging-cookbook.rst:3286 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3249 +#: ../../howto/logging-cookbook.rst:3307 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3270 +#: ../../howto/logging-cookbook.rst:3328 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3283 +#: ../../howto/logging-cookbook.rst:3341 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3286 +#: ../../howto/logging-cookbook.rst:3344 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3303 +#: ../../howto/logging-cookbook.rst:3361 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3311 +#: ../../howto/logging-cookbook.rst:3369 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3317 +#: ../../howto/logging-cookbook.rst:3375 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3319 +#: ../../howto/logging-cookbook.rst:3377 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-" @@ -1704,7 +1837,7 @@ msgid "" "project/PySide2/>`_ or `PyQt5 `_ libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3325 +#: ../../howto/logging-cookbook.rst:3383 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -1714,14 +1847,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3332 +#: ../../howto/logging-cookbook.rst:3390 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3336 +#: ../../howto/logging-cookbook.rst:3394 msgid "" "The code should work with recent releases of either ``PySide2`` or " "``PyQt5``. You should be able to adapt the approach to earlier versions of " @@ -1729,11 +1862,11 @@ msgid "" "information." msgstr "" -#: ../../howto/logging-cookbook.rst:3550 +#: ../../howto/logging-cookbook.rst:3608 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3552 +#: ../../howto/logging-cookbook.rst:3610 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "detault to use the older :rfc:`3164`, which hails from 2001. When " @@ -1743,14 +1876,14 @@ msgid "" "handlers.SysLogHandler` functionality has not been updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3559 +#: ../../howto/logging-cookbook.rst:3617 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3625 +#: ../../howto/logging-cookbook.rst:3683 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -1759,11 +1892,11 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3639 +#: ../../howto/logging-cookbook.rst:3697 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3641 +#: ../../howto/logging-cookbook.rst:3699 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -1771,17 +1904,17 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3681 +#: ../../howto/logging-cookbook.rst:3739 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3688 +#: ../../howto/logging-cookbook.rst:3746 msgid "" "You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." "stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3698 +#: ../../howto/logging-cookbook.rst:3756 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." @@ -1789,25 +1922,25 @@ msgid "" "Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3711 +#: ../../howto/logging-cookbook.rst:3769 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." msgstr "" -#: ../../howto/logging-cookbook.rst:3715 +#: ../../howto/logging-cookbook.rst:3773 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3724 +#: ../../howto/logging-cookbook.rst:3782 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:3742 +#: ../../howto/logging-cookbook.rst:3800 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes mutiple writes, each of which results " @@ -1817,17 +1950,17 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3767 +#: ../../howto/logging-cookbook.rst:3825 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:3783 +#: ../../howto/logging-cookbook.rst:3841 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:3785 +#: ../../howto/logging-cookbook.rst:3843 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 " @@ -1835,11 +1968,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:3791 +#: ../../howto/logging-cookbook.rst:3849 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:3793 +#: ../../howto/logging-cookbook.rst:3851 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. " @@ -1847,32 +1980,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:3798 +#: ../../howto/logging-cookbook.rst:3856 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:3801 +#: ../../howto/logging-cookbook.rst:3859 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:3804 +#: ../../howto/logging-cookbook.rst:3862 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:3808 +#: ../../howto/logging-cookbook.rst:3866 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:3811 +#: ../../howto/logging-cookbook.rst:3869 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 " @@ -1881,7 +2014,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:3817 +#: ../../howto/logging-cookbook.rst:3875 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 " @@ -1891,17 +2024,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:3824 +#: ../../howto/logging-cookbook.rst:3882 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:3828 +#: ../../howto/logging-cookbook.rst:3886 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:3830 +#: ../../howto/logging-cookbook.rst:3888 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 " @@ -1912,12 +2045,12 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:3839 +#: ../../howto/logging-cookbook.rst:3897 msgid "" "Adding handlers other than :class:`NullHandler` to a logger in a library" msgstr "" -#: ../../howto/logging-cookbook.rst:3841 +#: ../../howto/logging-cookbook.rst:3899 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -1925,11 +2058,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:3847 +#: ../../howto/logging-cookbook.rst:3905 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:3849 +#: ../../howto/logging-cookbook.rst:3907 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. " @@ -1940,14 +2073,14 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:3860 +#: ../../howto/logging-cookbook.rst:3918 msgid "Other resources" msgstr "" -#: ../../howto/logging-cookbook.rst:3873 +#: ../../howto/logging-cookbook.rst:3931 msgid ":ref:`Basic Tutorial `" msgstr "" -#: ../../howto/logging-cookbook.rst:3875 +#: ../../howto/logging-cookbook.rst:3933 msgid ":ref:`Advanced Tutorial `" msgstr "" diff --git a/library/enum.po b/library/enum.po index 744c6f41a4..d7d2a29d27 100644 --- a/library/enum.po +++ b/library/enum.po @@ -259,7 +259,7 @@ msgstr "" #: ../../library/enum.rst:147 msgid ":func:`show_flag_values`" -msgstr "" +msgstr ":func:`show_flag_values`" #: ../../library/enum.rst:149 msgid "Return a list of all power-of-two integers contained in a flag." diff --git a/library/io.po b/library/io.po index fbf75a0122..b46f38074c 100644 --- a/library/io.po +++ b/library/io.po @@ -173,7 +173,7 @@ msgstr "" #: ../../library/io.rst:135 msgid ":ref:`utf8-mode`" -msgstr "" +msgstr ":ref:`utf8-mode`" #: ../../library/io.rst:134 msgid "" @@ -183,7 +183,7 @@ msgstr "" #: ../../library/io.rst:137 msgid ":pep:`686`" -msgstr "" +msgstr ":pep:`686`" #: ../../library/io.rst:138 msgid "Python 3.15 will make :ref:`utf8-mode` default." diff --git a/library/itertools.po b/library/itertools.po index 48bf1a0182..2db798417e 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-31 08:13+0000\n" +"POT-Creation-Date: 2022-11-01 00:23+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -826,8 +826,8 @@ msgid "" "show various ways of thinking about individual tools — for example, that " "``chain.from_iterable`` is related to the concept of flattening. The " "recipes also give ideas about ways that the tools can be combined — for " -"example, how `compress()` and `range()` can work together. The recipes also " -"show patterns for using itertools with the :mod:`operator` and :mod:" +"example, how ``compress()`` and ``range()`` can work together. The recipes " +"also show patterns for using itertools with the :mod:`operator` and :mod:" "`collections` modules as well as with the built-in itertools such as " "``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" diff --git a/library/sqlite3.po b/library/sqlite3.po index 08ecd36d74..af1e027fa4 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -226,19 +226,19 @@ msgstr "" #: ../../library/sqlite3.rst:238 msgid ":ref:`sqlite3-placeholders`" -msgstr "" +msgstr ":ref:`sqlite3-placeholders`" #: ../../library/sqlite3.rst:239 msgid ":ref:`sqlite3-adapters`" -msgstr "" +msgstr ":ref:`sqlite3-adapters`" #: ../../library/sqlite3.rst:240 msgid ":ref:`sqlite3-converters`" -msgstr "" +msgstr ":ref:`sqlite3-converters`" #: ../../library/sqlite3.rst:241 ../../library/sqlite3.rst:556 msgid ":ref:`sqlite3-connection-context-manager`" -msgstr "" +msgstr ":ref:`sqlite3-connection-context-manager`" #: ../../library/sqlite3.rst:243 msgid "" @@ -259,7 +259,7 @@ msgstr "" #: ../../library/sqlite3.rst:0 msgid "Parameters" -msgstr "" +msgstr "參數" #: ../../library/sqlite3.rst:265 msgid "" @@ -536,11 +536,11 @@ msgstr "" #: ../../library/sqlite3.rst:511 msgid "`threadsafety`_" -msgstr "" +msgstr "`threadsafety`_" #: ../../library/sqlite3.rst:511 msgid "`SQLITE_THREADSAFE`_" -msgstr "" +msgstr "`SQLITE_THREADSAFE`_" #: ../../library/sqlite3.rst:511 msgid "DB-API 2.0 meaning" @@ -552,7 +552,7 @@ msgstr "" #: ../../library/sqlite3.rst:514 msgid "0" -msgstr "" +msgstr "0" #: ../../library/sqlite3.rst:514 msgid "Threads may not share the module" @@ -564,11 +564,11 @@ msgstr "" #: ../../library/sqlite3.rst:517 ../../library/sqlite3.rst:520 msgid "1" -msgstr "" +msgstr "1" #: ../../library/sqlite3.rst:517 msgid "2" -msgstr "" +msgstr "2" #: ../../library/sqlite3.rst:517 msgid "Threads may share the module, but not connections" @@ -580,7 +580,7 @@ msgstr "" #: ../../library/sqlite3.rst:520 msgid "3" -msgstr "" +msgstr "3" #: ../../library/sqlite3.rst:520 msgid "Threads may share the module, connections and cursors" @@ -615,7 +615,7 @@ msgstr "" #: ../../library/sqlite3.rst:555 msgid ":ref:`sqlite3-connection-shortcuts`" -msgstr "" +msgstr ":ref:`sqlite3-connection-shortcuts`" #: ../../library/sqlite3.rst:558 msgid "An SQLite database connection has the following attributes and methods:" @@ -1626,7 +1626,7 @@ msgstr "" #: ../../library/sqlite3.rst:1747 ../../library/sqlite3.rst:1764 msgid "``None``" -msgstr "" +msgstr "``None``" #: ../../library/sqlite3.rst:1747 ../../library/sqlite3.rst:1764 msgid "``NULL``" diff --git a/library/subprocess.po b/library/subprocess.po index d7d96b75fb..63072f61c0 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -1803,8 +1803,8 @@ msgstr "" #: ../../library/subprocess.rst:1584 msgid "``_USE_POSIX_SPAWN``" -msgstr "" +msgstr "``_USE_POSIX_SPAWN``" #: ../../library/subprocess.rst:1585 msgid "``_USE_VFORK``" -msgstr "" +msgstr "``_USE_VFORK``" diff --git a/library/typing.po b/library/typing.po index a707db6ec4..369d7eee70 100644 --- a/library/typing.po +++ b/library/typing.po @@ -2770,15 +2770,15 @@ msgstr "" #: ../../library/typing.rst:2865 msgid "3.8" -msgstr "" +msgstr "3.8" #: ../../library/typing.rst:2865 msgid "3.12" -msgstr "" +msgstr "3.12" #: ../../library/typing.rst:2865 msgid ":issue:`38291`" -msgstr "" +msgstr ":issue:`38291`" #: ../../library/typing.rst:2868 msgid "``typing`` versions of standard collections" @@ -2786,7 +2786,7 @@ msgstr "" #: ../../library/typing.rst:2868 msgid "3.9" -msgstr "" +msgstr "3.9" #: ../../library/typing.rst:2868 ../../library/typing.rst:2871 msgid "Undecided" @@ -2794,16 +2794,16 @@ msgstr "" #: ../../library/typing.rst:2868 msgid ":pep:`585`" -msgstr "" +msgstr ":pep:`585`" #: ../../library/typing.rst:2871 msgid "``typing.Text``" -msgstr "" +msgstr "``typing.Text``" #: ../../library/typing.rst:2871 msgid "3.11" -msgstr "" +msgstr "3.11" #: ../../library/typing.rst:2871 msgid ":gh:`92332`" -msgstr "" +msgstr ":gh:`92332`" diff --git a/reference/expressions.po b/reference/expressions.po index edf034dd54..706afbbcec 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -1702,11 +1702,11 @@ msgstr "" #: ../../reference/expressions.rst:1597 msgid "``x > y and y > z`` implies ``x > z``" -msgstr "" +msgstr "``x > y and y > z`` 暗示了 ``x > z``" #: ../../reference/expressions.rst:1599 msgid "``x < y and y <= z`` implies ``x < z``" -msgstr "" +msgstr "``x < y and y <= z`` 暗示了 ``x < z``" #: ../../reference/expressions.rst:1601 msgid "" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index bbb7b820d3..8836f54955 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-11-02 00:20+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -990,17 +990,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:848 +#: ../../tutorial/controlflow.rst:849 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:853 +#: ../../tutorial/controlflow.rst:854 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:855 +#: ../../tutorial/controlflow.rst:856 msgid "" "The use case will determine which parameters to use in the function " "definition::" @@ -1009,11 +1009,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:859 +#: ../../tutorial/controlflow.rst:860 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:861 +#: ../../tutorial/controlflow.rst:862 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1025,7 +1025,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:866 +#: ../../tutorial/controlflow.rst:867 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1034,7 +1034,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:869 +#: ../../tutorial/controlflow.rst:870 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1042,11 +1042,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:875 +#: ../../tutorial/controlflow.rst:876 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:880 +#: ../../tutorial/controlflow.rst:881 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1059,7 +1059,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:889 +#: ../../tutorial/controlflow.rst:890 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1073,11 +1073,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:906 +#: ../../tutorial/controlflow.rst:907 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:908 +#: ../../tutorial/controlflow.rst:909 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1093,7 +1093,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:924 +#: ../../tutorial/controlflow.rst:925 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" @@ -1102,11 +1102,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:940 +#: ../../tutorial/controlflow.rst:941 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:942 +#: ../../tutorial/controlflow.rst:943 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1123,7 +1123,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:959 +#: ../../tutorial/controlflow.rst:960 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1133,17 +1133,17 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:971 +#: ../../tutorial/controlflow.rst:972 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:978 +#: ../../tutorial/controlflow.rst:979 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:981 +#: ../../tutorial/controlflow.rst:982 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1155,7 +1155,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:987 +#: ../../tutorial/controlflow.rst:988 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1165,7 +1165,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:992 +#: ../../tutorial/controlflow.rst:993 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1187,18 +1187,18 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1004 +#: ../../tutorial/controlflow.rst:1005 msgid "Here is an example of a multi-line docstring::" msgstr "" "下面是多行說明字串的一個範例:\n" "\n" "::" -#: ../../tutorial/controlflow.rst:1022 +#: ../../tutorial/controlflow.rst:1023 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1030 +#: ../../tutorial/controlflow.rst:1031 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -1207,7 +1207,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1034 +#: ../../tutorial/controlflow.rst:1035 msgid "" ":term:`Annotations ` are stored in the :attr:" "`__annotations__` attribute of the function as a dictionary and have no " @@ -1227,11 +1227,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:1056 +#: ../../tutorial/controlflow.rst:1057 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1061 +#: ../../tutorial/controlflow.rst:1062 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -1244,7 +1244,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1067 +#: ../../tutorial/controlflow.rst:1068 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -1254,11 +1254,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1072 +#: ../../tutorial/controlflow.rst:1073 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1075 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -1267,11 +1267,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1078 +#: ../../tutorial/controlflow.rst:1079 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1080 +#: ../../tutorial/controlflow.rst:1081 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -1279,21 +1279,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1083 +#: ../../tutorial/controlflow.rst:1084 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1086 +#: ../../tutorial/controlflow.rst:1087 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1088 +#: ../../tutorial/controlflow.rst:1089 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1090 +#: ../../tutorial/controlflow.rst:1091 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -1301,7 +1301,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:\\ ``a = f(1, 2) + g(3, " "4)``\\ 。" -#: ../../tutorial/controlflow.rst:1093 +#: ../../tutorial/controlflow.rst:1094 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -1313,7 +1313,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1098 +#: ../../tutorial/controlflow.rst:1099 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -1322,7 +1322,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1102 +#: ../../tutorial/controlflow.rst:1103 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -1331,11 +1331,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1108 +#: ../../tutorial/controlflow.rst:1109 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1109 +#: ../../tutorial/controlflow.rst:1110 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 8c86617d7d..b48175fa8c 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2022-11-02 00:20+0000\n" "PO-Revision-Date: 2022-10-16 05:53+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -148,11 +148,11 @@ msgstr "" msgid "" "You might have noticed that methods like ``insert``, ``remove`` or ``sort`` " "that only modify the list have no return value printed -- they return the " -"default ``None``. [1]_ This is a design principle for all mutable data " +"default ``None``. [#]_ This is a design principle for all mutable data " "structures in Python." msgstr "" "你可能會注意到一些方法,像是 ``insert``、``remove`` 或者是 ``sort``,並沒有印" -"出回傳值,事實上,他們回傳預設值 ``None`` [1]_。這是一個用於 Python 中所有可" +"出回傳值,事實上,他們回傳預設值 ``None`` [#]_。這是一個用於 Python 中所有可" "變資料結構的設計法則。" #: ../../tutorial/datastructures.rst:128 diff --git a/using/cmdline.po b/using/cmdline.po index 5d6b1ed37c..845166583c 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -20,7 +20,7 @@ msgstr "" #: ../../using/cmdline.rst:9 msgid "Command line and environment" -msgstr "" +msgstr "命令列與環境" #: ../../using/cmdline.rst:11 msgid "" @@ -36,7 +36,7 @@ msgstr "" #: ../../using/cmdline.rst:23 msgid "Command line" -msgstr "" +msgstr "命令列" #: ../../using/cmdline.rst:25 msgid "When invoking Python, you may specify any of these options::" @@ -730,23 +730,23 @@ msgstr "" #: ../../using/cmdline.rst:542 msgid "The :option:`-X` option was added." -msgstr "" +msgstr "新增 :option:`-X` 選項。" #: ../../using/cmdline.rst:545 msgid "The ``-X faulthandler`` option." -msgstr "" +msgstr "``-X faulthandler`` 選項。" #: ../../using/cmdline.rst:548 msgid "The ``-X showrefcount`` and ``-X tracemalloc`` options." -msgstr "" +msgstr "``-X showrefcount`` 和 ``-X tracemalloc`` 選項。" #: ../../using/cmdline.rst:551 msgid "The ``-X showalloccount`` option." -msgstr "" +msgstr "``-X showalloccount`` 選項。" #: ../../using/cmdline.rst:554 msgid "The ``-X importtime``, ``-X dev`` and ``-X utf8`` options." -msgstr "" +msgstr "``-X importtime``、``-X dev`` 和 ``-X utf8`` 選項。" #: ../../using/cmdline.rst:557 msgid "" @@ -762,31 +762,31 @@ msgstr "" #: ../../using/cmdline.rst:565 msgid "The ``-X showalloccount`` option has been removed." -msgstr "" +msgstr "``-X showalloccount`` 選項已被移除。" #: ../../using/cmdline.rst:567 msgid "The ``-X warn_default_encoding`` option." -msgstr "" +msgstr "``-X warn_default_encoding`` 選項。" #: ../../using/cmdline.rst:572 msgid "The ``-X oldparser`` option." -msgstr "" +msgstr "``-X oldparser`` 選項。" #: ../../using/cmdline.rst:573 msgid "The ``-X no_debug_ranges`` option." -msgstr "" +msgstr "``-X no_debug_ranges`` 選項。" #: ../../using/cmdline.rst:576 msgid "The ``-X frozen_modules`` option." -msgstr "" +msgstr "``-X frozen_modules`` 選項。" #: ../../using/cmdline.rst:579 msgid "The ``-X int_max_str_digits`` option." -msgstr "" +msgstr "``-X int_max_str_digits`` 選項。" #: ../../using/cmdline.rst:584 msgid "Options you shouldn't use" -msgstr "" +msgstr "你不該使用的選項" #: ../../using/cmdline.rst:588 msgid "Reserved for use by Jython_." @@ -794,7 +794,7 @@ msgstr "" #: ../../using/cmdline.rst:596 msgid "Environment variables" -msgstr "" +msgstr "環境變數" #: ../../using/cmdline.rst:598 msgid "" @@ -1265,11 +1265,11 @@ msgstr "" #: ../../using/cmdline.rst:1006 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." -msgstr "" +msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode `。" #: ../../using/cmdline.rst:1008 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." -msgstr "" +msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode `。" #: ../../using/cmdline.rst:1010 msgid "" @@ -1298,7 +1298,7 @@ msgstr "" #: ../../using/cmdline.rst:1037 msgid "Debug-mode variables" -msgstr "" +msgstr "除錯模式變數" #: ../../using/cmdline.rst:1041 msgid "If set, Python will print threading debug info into stdout." diff --git a/using/configure.po b/using/configure.po index 020a88e3d3..2ccd28c09c 100644 --- a/using/configure.po +++ b/using/configure.po @@ -670,19 +670,19 @@ msgstr "" #: ../../using/configure.rst:483 msgid "``md5``;" -msgstr "" +msgstr "``md5``;" #: ../../using/configure.rst:484 msgid "``sha1``;" -msgstr "" +msgstr "``sha1``;" #: ../../using/configure.rst:485 msgid "``sha256``;" -msgstr "" +msgstr "``sha256``;" #: ../../using/configure.rst:486 msgid "``sha512``;" -msgstr "" +msgstr "``sha512``;" #: ../../using/configure.rst:487 msgid "``sha3`` (with shake);" @@ -690,7 +690,7 @@ msgstr "" #: ../../using/configure.rst:488 msgid "``blake2``." -msgstr "" +msgstr "``blake2``。" #: ../../using/configure.rst:494 msgid "Override the OpenSSL default cipher suites string:" @@ -750,35 +750,35 @@ msgstr "" #: ../../using/configure.rst:533 msgid "``universal2``;" -msgstr "" +msgstr "``universal2``;" #: ../../using/configure.rst:534 msgid "``32-bit``;" -msgstr "" +msgstr "``32-bit``;" #: ../../using/configure.rst:535 msgid "``64-bit``;" -msgstr "" +msgstr "``64-bit``;" #: ../../using/configure.rst:536 msgid "``3-way``;" -msgstr "" +msgstr "``3-way``;" #: ../../using/configure.rst:537 msgid "``intel``;" -msgstr "" +msgstr "``intel``;" #: ../../using/configure.rst:538 msgid "``intel-32``;" -msgstr "" +msgstr "``intel-32``;" #: ../../using/configure.rst:539 msgid "``intel-64``;" -msgstr "" +msgstr "``intel-64``;" #: ../../using/configure.rst:540 msgid "``all``." -msgstr "" +msgstr "``all``。" #: ../../using/configure.rst:544 msgid "" diff --git a/using/editors.po b/using/editors.po index ef7ea44a86..47ddd4a2e7 100644 --- a/using/editors.po +++ b/using/editors.po @@ -20,7 +20,7 @@ msgstr "" #: ../../using/editors.rst:7 msgid "Editors and IDEs" -msgstr "" +msgstr "編輯器與 IDE" #: ../../using/editors.rst:9 msgid "" diff --git a/using/windows.po b/using/windows.po index 5d67585cb3..8aba9bd2e9 100644 --- a/using/windows.po +++ b/using/windows.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-31 08:13+0000\n" +"POT-Creation-Date: 2022-11-01 00:23+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -245,11 +245,11 @@ msgid "" "list of available options is shown below." msgstr "" -#: ../../using/windows.rst:140 ../../using/windows.rst:1022 +#: ../../using/windows.rst:140 ../../using/windows.rst:1028 msgid "Name" msgstr "" -#: ../../using/windows.rst:140 ../../using/windows.rst:1022 +#: ../../using/windows.rst:140 ../../using/windows.rst:1028 msgid "Description" msgstr "描述" @@ -381,7 +381,7 @@ msgstr "" #: ../../using/windows.rst:182 msgid "Include_doc" -msgstr "" +msgstr "Include_doc" #: ../../using/windows.rst:182 msgid "Install Python manual" @@ -421,7 +421,7 @@ msgstr "Include_launcher" #: ../../using/windows.rst:194 msgid "Install :ref:`launcher`." -msgstr "" +msgstr "安裝 :ref:`launcher`。" #: ../../using/windows.rst:196 msgid "InstallLauncherAllUsers" @@ -740,7 +740,7 @@ msgstr "" #: ../../using/windows.rst:390 msgid "The nuget.org packages" -msgstr "" +msgstr "nuget.org 套件" #: ../../using/windows.rst:394 msgid "" @@ -1111,7 +1111,7 @@ msgstr "" #: ../../using/windows.rst:649 msgid "UTF-8 mode" -msgstr "" +msgstr "UTF-8 模式" #: ../../using/windows.rst:653 msgid "" @@ -1244,6 +1244,9 @@ msgstr "" #: ../../using/windows.rst:743 msgid "The command::" msgstr "" +"指令:\n" +"\n" +"::" #: ../../using/windows.rst:747 msgid "displays the currently installed version(s) of Python." @@ -1392,7 +1395,7 @@ msgid "" "``-V:`` argument with the complete tag." msgstr "" -#: ../../using/windows.rst:857 +#: ../../using/windows.rst:856 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " @@ -1404,29 +1407,40 @@ msgid "" "may be set (to any value) to skip this additional search." msgstr "" -#: ../../using/windows.rst:868 +#: ../../using/windows.rst:865 +msgid "" +"Shebang lines that do not match any of these patterns are treated as " +"**Windows** paths that are absolute or relative to the directory containing " +"the script file. This is a convenience for Windows-only scripts, such as " +"those generated by an installer, since the behavior is not compatible with " +"Unix-style shells. These paths may be quoted, and may include multiple " +"arguments, after which the path to the script and any additional arguments " +"will be appended." +msgstr "" + +#: ../../using/windows.rst:874 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:870 +#: ../../using/windows.rst:876 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:877 +#: ../../using/windows.rst:883 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:880 +#: ../../using/windows.rst:886 msgid "Customization" msgstr "" -#: ../../using/windows.rst:883 +#: ../../using/windows.rst:889 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:885 +#: ../../using/windows.rst:891 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's \"application data\" directory (i.e. the directory returned by " @@ -1436,7 +1450,7 @@ msgid "" "launcher (i.e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:892 +#: ../../using/windows.rst:898 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -1444,11 +1458,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:897 +#: ../../using/windows.rst:903 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:899 +#: ../../using/windows.rst:905 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -1458,13 +1472,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:905 +#: ../../using/windows.rst:911 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:908 +#: ../../using/windows.rst:914 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " @@ -1474,7 +1488,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:915 +#: ../../using/windows.rst:921 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -1485,7 +1499,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:923 +#: ../../using/windows.rst:929 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -1499,30 +1513,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:934 +#: ../../using/windows.rst:940 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:936 +#: ../../using/windows.rst:942 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:940 +#: ../../using/windows.rst:946 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:943 +#: ../../using/windows.rst:949 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:946 +#: ../../using/windows.rst:952 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -1530,13 +1544,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:951 +#: ../../using/windows.rst:957 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:954 +#: ../../using/windows.rst:960 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -1546,25 +1560,25 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:961 +#: ../../using/windows.rst:967 msgid "For example:" msgstr "" -#: ../../using/windows.rst:963 +#: ../../using/windows.rst:969 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:970 +#: ../../using/windows.rst:976 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:980 +#: ../../using/windows.rst:986 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:982 +#: ../../using/windows.rst:988 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), " "the launcher will print diagnostic information to stderr (i.e. to the " @@ -1574,11 +1588,11 @@ msgid "" "the target Python. It is primarily intended for testing and debugging." msgstr "" -#: ../../using/windows.rst:990 +#: ../../using/windows.rst:996 msgid "Dry Run" msgstr "" -#: ../../using/windows.rst:992 +#: ../../using/windows.rst:998 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any " "value), the launcher will output the command it would have run, but will not " @@ -1588,11 +1602,11 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1000 +#: ../../using/windows.rst:1006 msgid "Install on demand" msgstr "安裝隨選" -#: ../../using/windows.rst:1002 +#: ../../using/windows.rst:1008 msgid "" "If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any " "value), and the requested Python version is not installed but is available " @@ -1601,7 +1615,7 @@ msgid "" "again." msgstr "" -#: ../../using/windows.rst:1007 +#: ../../using/windows.rst:1013 msgid "" "An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " @@ -1609,137 +1623,137 @@ msgid "" "`PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:1012 +#: ../../using/windows.rst:1018 msgid "Return codes" msgstr "" -#: ../../using/windows.rst:1014 +#: ../../using/windows.rst:1020 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" -#: ../../using/windows.rst:1017 +#: ../../using/windows.rst:1023 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" -#: ../../using/windows.rst:1022 +#: ../../using/windows.rst:1028 msgid "Value" msgstr "" -#: ../../using/windows.rst:1024 +#: ../../using/windows.rst:1030 msgid "RC_BAD_VENV_CFG" -msgstr "" +msgstr "RC_BAD_VENV_CFG" -#: ../../using/windows.rst:1024 +#: ../../using/windows.rst:1030 msgid "107" -msgstr "" +msgstr "107" -#: ../../using/windows.rst:1024 +#: ../../using/windows.rst:1030 msgid "A :file:`pyvenv.cfg` was found but is corrupt." msgstr "" -#: ../../using/windows.rst:1026 +#: ../../using/windows.rst:1032 msgid "RC_CREATE_PROCESS" -msgstr "" +msgstr "RC_CREATE_PROCESS" -#: ../../using/windows.rst:1026 +#: ../../using/windows.rst:1032 msgid "101" -msgstr "" +msgstr "101" -#: ../../using/windows.rst:1026 +#: ../../using/windows.rst:1032 msgid "Failed to launch Python." msgstr "" -#: ../../using/windows.rst:1028 +#: ../../using/windows.rst:1034 msgid "RC_INSTALLING" -msgstr "" +msgstr "RC_INSTALLING" -#: ../../using/windows.rst:1028 +#: ../../using/windows.rst:1034 msgid "111" -msgstr "" +msgstr "111" -#: ../../using/windows.rst:1028 +#: ../../using/windows.rst:1034 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" -#: ../../using/windows.rst:1031 +#: ../../using/windows.rst:1037 msgid "RC_INTERNAL_ERROR" -msgstr "" +msgstr "RC_INTERNAL_ERROR" -#: ../../using/windows.rst:1031 +#: ../../using/windows.rst:1037 msgid "109" -msgstr "" +msgstr "109" -#: ../../using/windows.rst:1031 +#: ../../using/windows.rst:1037 msgid "Unexpected error. Please report a bug." msgstr "" -#: ../../using/windows.rst:1033 +#: ../../using/windows.rst:1039 msgid "RC_NO_COMMANDLINE" -msgstr "" +msgstr "RC_NO_COMMANDLINE" -#: ../../using/windows.rst:1033 +#: ../../using/windows.rst:1039 msgid "108" -msgstr "" +msgstr "108" -#: ../../using/windows.rst:1033 +#: ../../using/windows.rst:1039 msgid "Unable to obtain command line from the operating system." msgstr "" -#: ../../using/windows.rst:1036 +#: ../../using/windows.rst:1042 msgid "RC_NO_PYTHON" -msgstr "" +msgstr "RC_NO_PYTHON" -#: ../../using/windows.rst:1036 +#: ../../using/windows.rst:1042 msgid "103" -msgstr "" +msgstr "103" -#: ../../using/windows.rst:1036 +#: ../../using/windows.rst:1042 msgid "Unable to locate the requested version." msgstr "" -#: ../../using/windows.rst:1038 +#: ../../using/windows.rst:1044 msgid "RC_NO_VENV_CFG" -msgstr "" +msgstr "RC_NO_VENV_CFG" -#: ../../using/windows.rst:1038 +#: ../../using/windows.rst:1044 msgid "106" -msgstr "" +msgstr "106" -#: ../../using/windows.rst:1038 +#: ../../using/windows.rst:1044 msgid "A :file:`pyvenv.cfg` was required but not found." msgstr "" -#: ../../using/windows.rst:1046 +#: ../../using/windows.rst:1052 msgid "Finding modules" msgstr "" -#: ../../using/windows.rst:1048 +#: ../../using/windows.rst:1054 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" -#: ../../using/windows.rst:1051 +#: ../../using/windows.rst:1057 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1054 +#: ../../using/windows.rst:1060 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1057 +#: ../../using/windows.rst:1063 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -1747,7 +1761,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1062 +#: ../../using/windows.rst:1068 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -1757,7 +1771,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1069 +#: ../../using/windows.rst:1075 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -1768,31 +1782,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1077 +#: ../../using/windows.rst:1083 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1081 +#: ../../using/windows.rst:1087 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1090 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1094 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1090 +#: ../../using/windows.rst:1096 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -1800,7 +1814,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1095 +#: ../../using/windows.rst:1101 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -1808,20 +1822,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1099 +#: ../../using/windows.rst:1105 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1103 +#: ../../using/windows.rst:1109 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1106 +#: ../../using/windows.rst:1112 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -1829,20 +1843,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1111 +#: ../../using/windows.rst:1117 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " "executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:" "`Py_SetProgramName` before :c:func:`Py_Initialize`." msgstr "" -#: ../../using/windows.rst:1115 +#: ../../using/windows.rst:1121 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1118 +#: ../../using/windows.rst:1124 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -1851,7 +1865,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1124 +#: ../../using/windows.rst:1130 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -1861,19 +1875,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1133 +#: ../../using/windows.rst:1139 msgid "" "Adds ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1135 +#: ../../using/windows.rst:1141 msgid "" "Adds ``pythonXX.zip`` as a potential landmark when directly adjacent to the " "executable." msgstr "" -#: ../../using/windows.rst:1141 +#: ../../using/windows.rst:1147 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -1881,88 +1895,88 @@ msgid "" "explicitly added to :attr:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1147 +#: ../../using/windows.rst:1153 msgid "Additional modules" msgstr "" -#: ../../using/windows.rst:1149 +#: ../../using/windows.rst:1155 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1153 +#: ../../using/windows.rst:1159 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1157 +#: ../../using/windows.rst:1163 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1159 +#: ../../using/windows.rst:1165 msgid "" "The `PyWin32 `_ module by Mark Hammond is " "a collection of modules for advanced Windows-specific support. This " "includes utilities for:" msgstr "" -#: ../../using/windows.rst:1163 +#: ../../using/windows.rst:1169 msgid "" "`Component Object Model `_ (COM)" msgstr "" -#: ../../using/windows.rst:1166 +#: ../../using/windows.rst:1172 msgid "Win32 API calls" -msgstr "" +msgstr "Win32 API 呼叫" -#: ../../using/windows.rst:1167 +#: ../../using/windows.rst:1173 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1168 +#: ../../using/windows.rst:1174 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1169 +#: ../../using/windows.rst:1175 msgid "" "`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1173 +#: ../../using/windows.rst:1179 msgid "" "`PythonWin `_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1180 +#: ../../using/windows.rst:1186 msgid "" "`Win32 How Do I...? `_" msgstr "" "`Win32 How Do I...? `_" -#: ../../using/windows.rst:1180 +#: ../../using/windows.rst:1186 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1182 +#: ../../using/windows.rst:1188 msgid "`Python and COM `_" msgstr "`Python and COM `_" -#: ../../using/windows.rst:1183 +#: ../../using/windows.rst:1189 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1187 +#: ../../using/windows.rst:1193 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1189 +#: ../../using/windows.rst:1195 msgid "" "`cx_Freeze `_ is a :mod:" "`distutils` extension (see :ref:`extending-distutils`) which wraps Python " @@ -1971,11 +1985,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1197 +#: ../../using/windows.rst:1203 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1199 +#: ../../using/windows.rst:1205 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source `_. You can download " @@ -1983,48 +1997,48 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1204 +#: ../../using/windows.rst:1210 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1208 +#: ../../using/windows.rst:1214 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1210 +#: ../../using/windows.rst:1216 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1214 +#: ../../using/windows.rst:1220 msgid "Other Platforms" msgstr "其他平台" -#: ../../using/windows.rst:1216 +#: ../../using/windows.rst:1222 msgid "" "With ongoing development of Python, some platforms that used to be supported " "earlier are no longer supported (due to the lack of users or developers). " "Check :pep:`11` for details on all unsupported platforms." msgstr "" -#: ../../using/windows.rst:1220 +#: ../../using/windows.rst:1226 msgid "" "`Windows CE `_ is `no longer supported " "`__ since Python 3 (if it " "ever was)." msgstr "" -#: ../../using/windows.rst:1223 +#: ../../using/windows.rst:1229 msgid "" "The `Cygwin `_ installer offers to install the `Python " "interpreter `__ as well" msgstr "" -#: ../../using/windows.rst:1227 +#: ../../using/windows.rst:1233 msgid "" "See `Python for Windows `_ for " "detailed information about platforms with pre-compiled installers."