diff --git a/library/copyreg.po b/library/copyreg.po index a7ae7fd835..e32de96fda 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-01-19 00:09+0000\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,8 +52,8 @@ msgstr "" msgid "" "The optional *constructor* parameter, if provided, is a callable object " "which can be used to reconstruct the object when called with the tuple of " -"arguments returned by *function* at pickling time. :exc:`TypeError` will be " -"raised if *object* is a class or *constructor* is not callable." +"arguments returned by *function* at pickling time. A :exc:`TypeError` is " +"raised if the *constructor* is not callable." msgstr "" #: ../../library/copyreg.rst:39 diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 97e78e3d07..1ea8a423b7 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-27 00:19+0000\n" +"POT-Creation-Date: 2022-01-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -144,7 +144,7 @@ msgid "" "pipes." msgstr "" -#: ../../library/multiprocessing.rst:130 ../../library/multiprocessing.rst:1037 +#: ../../library/multiprocessing.rst:130 ../../library/multiprocessing.rst:1044 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " @@ -543,65 +543,78 @@ msgstr "" #: ../../library/multiprocessing.rst:571 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " -"terminated. A negative value *-N* indicates that the child was terminated " -"by signal *N*." +"terminated." +msgstr "" + +#: ../../library/multiprocessing.rst:574 +msgid "" +"If the child's :meth:`run` method returned normally, the exit code will be " +"0. If it terminated via :func:`sys.exit` with an integer argument *N*, the " +"exit code will be *N*." +msgstr "" + +#: ../../library/multiprocessing.rst:578 +msgid "" +"If the child terminated due to an exception not caught within :meth:`run`, " +"the exit code will be 1. If it was terminated by signal *N*, the exit code " +"will be the negative value *-N*." msgstr "" -#: ../../library/multiprocessing.rst:577 +#: ../../library/multiprocessing.rst:584 msgid "The process's authentication key (a byte string)." msgstr "" -#: ../../library/multiprocessing.rst:579 +#: ../../library/multiprocessing.rst:586 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:582 +#: ../../library/multiprocessing.rst:589 msgid "" "When a :class:`Process` object is created, it will inherit the " "authentication key of its parent process, although this may be changed by " "setting :attr:`authkey` to another byte string." msgstr "" -#: ../../library/multiprocessing.rst:586 +#: ../../library/multiprocessing.rst:593 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "參閱 :ref:`multiprocessing-auth-keys`\\ 。" -#: ../../library/multiprocessing.rst:590 +#: ../../library/multiprocessing.rst:597 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: ../../library/multiprocessing.rst:593 +#: ../../library/multiprocessing.rst:600 msgid "" "You can use this value if you want to wait on several events at once using :" "func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join()` is " "simpler." msgstr "" -#: ../../library/multiprocessing.rst:597 +#: ../../library/multiprocessing.rst:604 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On Unix, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: ../../library/multiprocessing.rst:605 +#: ../../library/multiprocessing.rst:612 msgid "" "Terminate the process. On Unix this is done using the ``SIGTERM`` signal; " "on Windows :c:func:`TerminateProcess` is used. Note that exit handlers and " "finally clauses, etc., will not be executed." msgstr "" -#: ../../library/multiprocessing.rst:609 +#: ../../library/multiprocessing.rst:616 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: ../../library/multiprocessing.rst:614 +#: ../../library/multiprocessing.rst:621 msgid "" "If this method is used when the associated process is using a pipe or queue " "then the pipe or queue is liable to become corrupted and may become unusable " @@ -610,11 +623,11 @@ msgid "" "deadlock." msgstr "" -#: ../../library/multiprocessing.rst:622 +#: ../../library/multiprocessing.rst:629 msgid "Same as :meth:`terminate()` but using the ``SIGKILL`` signal on Unix." msgstr "" -#: ../../library/multiprocessing.rst:628 +#: ../../library/multiprocessing.rst:635 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -622,59 +635,59 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: ../../library/multiprocessing.rst:636 +#: ../../library/multiprocessing.rst:643 msgid "" "Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:" "`terminate` and :attr:`exitcode` methods should only be called by the " "process that created the process object." msgstr "" -#: ../../library/multiprocessing.rst:640 +#: ../../library/multiprocessing.rst:647 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: ../../library/multiprocessing.rst:661 +#: ../../library/multiprocessing.rst:668 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: ../../library/multiprocessing.rst:665 +#: ../../library/multiprocessing.rst:672 msgid "" "Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied " "buffer object is too small for the message read." msgstr "" -#: ../../library/multiprocessing.rst:668 +#: ../../library/multiprocessing.rst:675 msgid "" "If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will " "give the message as a byte string." msgstr "" -#: ../../library/multiprocessing.rst:673 +#: ../../library/multiprocessing.rst:680 msgid "Raised when there is an authentication error." msgstr "" -#: ../../library/multiprocessing.rst:677 +#: ../../library/multiprocessing.rst:684 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: ../../library/multiprocessing.rst:680 +#: ../../library/multiprocessing.rst:687 msgid "Pipes and Queues" msgstr "" -#: ../../library/multiprocessing.rst:682 +#: ../../library/multiprocessing.rst:689 msgid "" "When using multiple processes, one generally uses message passing for " "communication between processes and avoids having to use any synchronization " "primitives like locks." msgstr "" -#: ../../library/multiprocessing.rst:686 +#: ../../library/multiprocessing.rst:693 msgid "" "For passing messages one can use :func:`Pipe` (for a connection between two " "processes) or a queue (which allows multiple producers and consumers)." msgstr "" -#: ../../library/multiprocessing.rst:689 +#: ../../library/multiprocessing.rst:696 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " @@ -684,7 +697,7 @@ msgid "" "Queue` class." msgstr "" -#: ../../library/multiprocessing.rst:696 +#: ../../library/multiprocessing.rst:703 msgid "" "If you use :class:`JoinableQueue` then you **must** call :meth:" "`JoinableQueue.task_done` for each task removed from the queue or else the " @@ -692,20 +705,20 @@ msgid "" "overflow, raising an exception." msgstr "" -#: ../../library/multiprocessing.rst:701 +#: ../../library/multiprocessing.rst:708 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:706 +#: ../../library/multiprocessing.rst:713 msgid "" ":mod:`multiprocessing` uses the usual :exc:`queue.Empty` and :exc:`queue." "Full` exceptions to signal a timeout. They are not available in the :mod:" "`multiprocessing` namespace so you need to import them from :mod:`queue`." msgstr "" -#: ../../library/multiprocessing.rst:713 +#: ../../library/multiprocessing.rst:720 msgid "" "When an object is put on a queue, the object is pickled and a background " "thread later flushes the pickled data to an underlying pipe. This has some " @@ -714,14 +727,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: ../../library/multiprocessing.rst:720 +#: ../../library/multiprocessing.rst:727 msgid "" "After putting an object on an empty queue there may be an infinitesimal " "delay before the queue's :meth:`~Queue.empty` method returns :const:`False` " "and :meth:`~Queue.get_nowait` can return without raising :exc:`queue.Empty`." msgstr "" -#: ../../library/multiprocessing.rst:725 +#: ../../library/multiprocessing.rst:732 msgid "" "If multiple processes are enqueuing objects, it is possible for the objects " "to be received at the other end out-of-order. However, objects enqueued by " @@ -729,7 +742,7 @@ msgid "" "other." msgstr "" -#: ../../library/multiprocessing.rst:732 +#: ../../library/multiprocessing.rst:739 msgid "" "If a process is killed using :meth:`Process.terminate` or :func:`os.kill` " "while it is trying to use a :class:`Queue`, then the data in the queue is " @@ -737,7 +750,7 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: ../../library/multiprocessing.rst:739 +#: ../../library/multiprocessing.rst:746 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " "not used :meth:`JoinableQueue.cancel_join_thread ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1091 +#: ../../library/multiprocessing.rst:1098 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1094 +#: ../../library/multiprocessing.rst:1101 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1099 +#: ../../library/multiprocessing.rst:1106 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1106 +#: ../../library/multiprocessing.rst:1113 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1110 +#: ../../library/multiprocessing.rst:1117 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1112 +#: ../../library/multiprocessing.rst:1119 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1116 +#: ../../library/multiprocessing.rst:1123 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1118 +#: ../../library/multiprocessing.rst:1125 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1122 +#: ../../library/multiprocessing.rst:1129 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1127 +#: ../../library/multiprocessing.rst:1134 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1129 +#: ../../library/multiprocessing.rst:1136 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1215,7 +1228,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1136 +#: ../../library/multiprocessing.rst:1143 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1223,19 +1236,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1141 +#: ../../library/multiprocessing.rst:1148 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1145 +#: ../../library/multiprocessing.rst:1152 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1152 +#: ../../library/multiprocessing.rst:1159 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1243,45 +1256,45 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1158 +#: ../../library/multiprocessing.rst:1165 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1163 +#: ../../library/multiprocessing.rst:1170 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1167 +#: ../../library/multiprocessing.rst:1174 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1171 +#: ../../library/multiprocessing.rst:1178 msgid "" "Connection objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1176 +#: ../../library/multiprocessing.rst:1183 msgid "For example:" msgstr "" -#: ../../library/multiprocessing.rst:1201 +#: ../../library/multiprocessing.rst:1208 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1205 +#: ../../library/multiprocessing.rst:1212 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1289,73 +1302,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1212 +#: ../../library/multiprocessing.rst:1219 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1218 +#: ../../library/multiprocessing.rst:1225 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1222 +#: ../../library/multiprocessing.rst:1229 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1226 +#: ../../library/multiprocessing.rst:1233 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1231 +#: ../../library/multiprocessing.rst:1238 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1237 +#: ../../library/multiprocessing.rst:1244 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1240 -#: ../../library/multiprocessing.rst:1378 +#: ../../library/multiprocessing.rst:1247 +#: ../../library/multiprocessing.rst:1385 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1244 +#: ../../library/multiprocessing.rst:1251 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1249 +#: ../../library/multiprocessing.rst:1256 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1251 +#: ../../library/multiprocessing.rst:1258 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1254 -#: ../../library/multiprocessing.rst:1788 +#: ../../library/multiprocessing.rst:1261 +#: ../../library/multiprocessing.rst:1795 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1259 +#: ../../library/multiprocessing.rst:1266 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1264 +#: ../../library/multiprocessing.rst:1271 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -1366,25 +1379,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1272 +#: ../../library/multiprocessing.rst:1279 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1276 +#: ../../library/multiprocessing.rst:1283 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1281 -#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1288 +#: ../../library/multiprocessing.rst:1339 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1283 +#: ../../library/multiprocessing.rst:1290 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -1392,14 +1405,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1288 +#: ../../library/multiprocessing.rst:1295 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1292 +#: ../../library/multiprocessing.rst:1299 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -1413,19 +1426,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1307 +#: ../../library/multiprocessing.rst:1314 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1310 +#: ../../library/multiprocessing.rst:1317 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1316 +#: ../../library/multiprocessing.rst:1323 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -1434,20 +1447,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1322 +#: ../../library/multiprocessing.rst:1329 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1326 +#: ../../library/multiprocessing.rst:1333 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1334 +#: ../../library/multiprocessing.rst:1341 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -1460,7 +1473,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1344 +#: ../../library/multiprocessing.rst:1351 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -1471,14 +1484,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1352 +#: ../../library/multiprocessing.rst:1359 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1359 +#: ../../library/multiprocessing.rst:1366 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -1488,7 +1501,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1367 +#: ../../library/multiprocessing.rst:1374 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -1497,17 +1510,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1376 +#: ../../library/multiprocessing.rst:1383 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1383 +#: ../../library/multiprocessing.rst:1390 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1388 +#: ../../library/multiprocessing.rst:1395 msgid "" "If the SIGINT signal generated by :kbd:`Ctrl-C` arrives while the main " "thread is blocked by a call to :meth:`BoundedSemaphore.acquire`, :meth:`Lock." @@ -1516,13 +1529,13 @@ msgid "" "interrupted and :exc:`KeyboardInterrupt` will be raised." msgstr "" -#: ../../library/multiprocessing.rst:1394 +#: ../../library/multiprocessing.rst:1401 msgid "" "This differs from the behaviour of :mod:`threading` where SIGINT will be " "ignored while the equivalent blocking calls are in progress." msgstr "" -#: ../../library/multiprocessing.rst:1399 +#: ../../library/multiprocessing.rst:1406 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -1531,32 +1544,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1407 +#: ../../library/multiprocessing.rst:1414 msgid "Shared :mod:`ctypes` Objects" msgstr "" -#: ../../library/multiprocessing.rst:1409 +#: ../../library/multiprocessing.rst:1416 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1414 +#: ../../library/multiprocessing.rst:1421 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1418 -#: ../../library/multiprocessing.rst:1505 +#: ../../library/multiprocessing.rst:1425 +#: ../../library/multiprocessing.rst:1512 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1422 +#: ../../library/multiprocessing.rst:1429 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -1566,32 +1579,32 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1429 +#: ../../library/multiprocessing.rst:1436 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1435 +#: ../../library/multiprocessing.rst:1442 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1441 -#: ../../library/multiprocessing.rst:1531 -#: ../../library/multiprocessing.rst:1546 +#: ../../library/multiprocessing.rst:1448 +#: ../../library/multiprocessing.rst:1538 +#: ../../library/multiprocessing.rst:1553 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1445 +#: ../../library/multiprocessing.rst:1452 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1448 +#: ../../library/multiprocessing.rst:1455 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1601,7 +1614,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1455 +#: ../../library/multiprocessing.rst:1462 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -1611,28 +1624,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1462 +#: ../../library/multiprocessing.rst:1469 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1464 +#: ../../library/multiprocessing.rst:1471 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1469 +#: ../../library/multiprocessing.rst:1476 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr "" -#: ../../library/multiprocessing.rst:1474 +#: ../../library/multiprocessing.rst:1481 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1480 +#: ../../library/multiprocessing.rst:1487 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -1641,11 +1654,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1488 +#: ../../library/multiprocessing.rst:1495 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1490 +#: ../../library/multiprocessing.rst:1497 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1655,40 +1668,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1497 +#: ../../library/multiprocessing.rst:1504 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1503 +#: ../../library/multiprocessing.rst:1510 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1509 +#: ../../library/multiprocessing.rst:1516 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1513 +#: ../../library/multiprocessing.rst:1520 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1519 +#: ../../library/multiprocessing.rst:1526 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1523 -#: ../../library/multiprocessing.rst:1539 +#: ../../library/multiprocessing.rst:1530 +#: ../../library/multiprocessing.rst:1546 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -1698,121 +1711,121 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1535 +#: ../../library/multiprocessing.rst:1542 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1550 +#: ../../library/multiprocessing.rst:1557 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1555 +#: ../../library/multiprocessing.rst:1562 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1559 +#: ../../library/multiprocessing.rst:1566 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1563 +#: ../../library/multiprocessing.rst:1570 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1566 +#: ../../library/multiprocessing.rst:1573 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1570 +#: ../../library/multiprocessing.rst:1577 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1582 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1582 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1582 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1584 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1584 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1584 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1578 +#: ../../library/multiprocessing.rst:1585 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1578 +#: ../../library/multiprocessing.rst:1585 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1579 +#: ../../library/multiprocessing.rst:1586 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1579 +#: ../../library/multiprocessing.rst:1586 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1579 +#: ../../library/multiprocessing.rst:1586 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1580 +#: ../../library/multiprocessing.rst:1587 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1580 +#: ../../library/multiprocessing.rst:1587 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1580 +#: ../../library/multiprocessing.rst:1587 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1584 +#: ../../library/multiprocessing.rst:1591 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1622 +#: ../../library/multiprocessing.rst:1629 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1642 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1637 +#: ../../library/multiprocessing.rst:1644 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -1821,7 +1834,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1645 +#: ../../library/multiprocessing.rst:1652 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -1829,31 +1842,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1653 +#: ../../library/multiprocessing.rst:1660 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1666 msgid "Create a BaseManager object." msgstr "" -#: ../../library/multiprocessing.rst:1661 +#: ../../library/multiprocessing.rst:1668 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1664 +#: ../../library/multiprocessing.rst:1671 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1667 +#: ../../library/multiprocessing.rst:1674 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -1861,50 +1874,50 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1674 +#: ../../library/multiprocessing.rst:1681 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1679 +#: ../../library/multiprocessing.rst:1686 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1688 +#: ../../library/multiprocessing.rst:1695 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1692 +#: ../../library/multiprocessing.rst:1699 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1700 +#: ../../library/multiprocessing.rst:1707 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1703 +#: ../../library/multiprocessing.rst:1710 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1714 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1710 +#: ../../library/multiprocessing.rst:1717 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1713 +#: ../../library/multiprocessing.rst:1720 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -1912,14 +1925,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1719 +#: ../../library/multiprocessing.rst:1726 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1723 +#: ../../library/multiprocessing.rst:1730 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -1930,7 +1943,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1732 +#: ../../library/multiprocessing.rst:1739 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -1940,22 +1953,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1739 +#: ../../library/multiprocessing.rst:1746 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1743 +#: ../../library/multiprocessing.rst:1750 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1747 +#: ../../library/multiprocessing.rst:1754 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1749 +#: ../../library/multiprocessing.rst:1756 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -1963,173 +1976,173 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1755 +#: ../../library/multiprocessing.rst:1762 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1760 +#: ../../library/multiprocessing.rst:1767 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1764 +#: ../../library/multiprocessing.rst:1771 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1770 +#: ../../library/multiprocessing.rst:1777 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1777 +#: ../../library/multiprocessing.rst:1784 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1782 +#: ../../library/multiprocessing.rst:1789 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1785 +#: ../../library/multiprocessing.rst:1792 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1793 +#: ../../library/multiprocessing.rst:1800 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1804 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1801 +#: ../../library/multiprocessing.rst:1808 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1805 +#: ../../library/multiprocessing.rst:1812 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1809 +#: ../../library/multiprocessing.rst:1816 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1813 +#: ../../library/multiprocessing.rst:1820 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1818 +#: ../../library/multiprocessing.rst:1825 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1822 +#: ../../library/multiprocessing.rst:1829 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1829 +#: ../../library/multiprocessing.rst:1836 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1834 +#: ../../library/multiprocessing.rst:1841 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1836 +#: ../../library/multiprocessing.rst:1843 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1843 +#: ../../library/multiprocessing.rst:1850 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1845 +#: ../../library/multiprocessing.rst:1852 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1848 +#: ../../library/multiprocessing.rst:1855 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1864 +#: ../../library/multiprocessing.rst:1871 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1866 +#: ../../library/multiprocessing.rst:1873 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1891 +#: ../../library/multiprocessing.rst:1898 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1893 +#: ../../library/multiprocessing.rst:1900 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1896 +#: ../../library/multiprocessing.rst:1903 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1908 +#: ../../library/multiprocessing.rst:1915 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:1918 +#: ../../library/multiprocessing.rst:1925 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:1929 +#: ../../library/multiprocessing.rst:1936 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:1954 +#: ../../library/multiprocessing.rst:1961 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:1956 +#: ../../library/multiprocessing.rst:1963 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:1960 +#: ../../library/multiprocessing.rst:1967 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -2137,14 +2150,14 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:1978 +#: ../../library/multiprocessing.rst:1985 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:1982 +#: ../../library/multiprocessing.rst:1989 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -2152,11 +2165,11 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:1998 +#: ../../library/multiprocessing.rst:2005 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2011 +#: ../../library/multiprocessing.rst:2018 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -2167,53 +2180,53 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2030 +#: ../../library/multiprocessing.rst:2037 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2036 +#: ../../library/multiprocessing.rst:2043 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2044 +#: ../../library/multiprocessing.rst:2051 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2048 +#: ../../library/multiprocessing.rst:2055 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2052 +#: ../../library/multiprocessing.rst:2059 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2054 +#: ../../library/multiprocessing.rst:2061 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2058 +#: ../../library/multiprocessing.rst:2065 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2062 +#: ../../library/multiprocessing.rst:2069 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2064 +#: ../../library/multiprocessing.rst:2071 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2068 +#: ../../library/multiprocessing.rst:2075 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -2221,79 +2234,79 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2073 +#: ../../library/multiprocessing.rst:2080 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2076 +#: ../../library/multiprocessing.rst:2083 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2092 +#: ../../library/multiprocessing.rst:2099 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2094 +#: ../../library/multiprocessing.rst:2101 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2098 +#: ../../library/multiprocessing.rst:2105 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2102 +#: ../../library/multiprocessing.rst:2109 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2106 +#: ../../library/multiprocessing.rst:2113 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2108 +#: ../../library/multiprocessing.rst:2115 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2111 +#: ../../library/multiprocessing.rst:2118 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2116 +#: ../../library/multiprocessing.rst:2123 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2121 +#: ../../library/multiprocessing.rst:2128 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2126 +#: ../../library/multiprocessing.rst:2133 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2130 +#: ../../library/multiprocessing.rst:2137 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2133 -#: ../../library/multiprocessing.rst:2694 +#: ../../library/multiprocessing.rst:2140 +#: ../../library/multiprocessing.rst:2701 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2136 +#: ../../library/multiprocessing.rst:2143 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -2301,7 +2314,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2141 +#: ../../library/multiprocessing.rst:2148 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -2309,13 +2322,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2147 +#: ../../library/multiprocessing.rst:2154 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2151 +#: ../../library/multiprocessing.rst:2158 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -2323,22 +2336,22 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2156 +#: ../../library/multiprocessing.rst:2163 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2160 +#: ../../library/multiprocessing.rst:2167 msgid "*maxtasksperchild*" msgstr "" -#: ../../library/multiprocessing.rst:2163 +#: ../../library/multiprocessing.rst:2170 msgid "*context*" msgstr "" -#: ../../library/multiprocessing.rst:2168 +#: ../../library/multiprocessing.rst:2175 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -2349,7 +2362,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2178 +#: ../../library/multiprocessing.rst:2185 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -2357,14 +2370,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2185 +#: ../../library/multiprocessing.rst:2192 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2188 -#: ../../library/multiprocessing.rst:2219 +#: ../../library/multiprocessing.rst:2195 +#: ../../library/multiprocessing.rst:2226 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -2372,60 +2385,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2193 -#: ../../library/multiprocessing.rst:2224 +#: ../../library/multiprocessing.rst:2200 +#: ../../library/multiprocessing.rst:2231 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2197 -#: ../../library/multiprocessing.rst:2228 +#: ../../library/multiprocessing.rst:2204 +#: ../../library/multiprocessing.rst:2235 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2202 +#: ../../library/multiprocessing.rst:2209 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2213 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2210 +#: ../../library/multiprocessing.rst:2217 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2216 +#: ../../library/multiprocessing.rst:2223 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2233 +#: ../../library/multiprocessing.rst:2240 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2235 +#: ../../library/multiprocessing.rst:2242 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2240 +#: ../../library/multiprocessing.rst:2247 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -2433,65 +2446,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2247 +#: ../../library/multiprocessing.rst:2254 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2253 +#: ../../library/multiprocessing.rst:2260 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2257 +#: ../../library/multiprocessing.rst:2264 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2264 +#: ../../library/multiprocessing.rst:2271 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2272 +#: ../../library/multiprocessing.rst:2279 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2277 +#: ../../library/multiprocessing.rst:2284 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2283 +#: ../../library/multiprocessing.rst:2290 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2286 +#: ../../library/multiprocessing.rst:2293 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2294 +#: ../../library/multiprocessing.rst:2301 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2299 +#: ../../library/multiprocessing.rst:2306 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -2499,41 +2512,41 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2306 +#: ../../library/multiprocessing.rst:2313 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2310 +#: ../../library/multiprocessing.rst:2317 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2314 +#: ../../library/multiprocessing.rst:2321 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2317 +#: ../../library/multiprocessing.rst:2324 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2321 +#: ../../library/multiprocessing.rst:2328 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2348 +#: ../../library/multiprocessing.rst:2355 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2353 +#: ../../library/multiprocessing.rst:2360 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2357 +#: ../../library/multiprocessing.rst:2364 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -2542,46 +2555,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2366 +#: ../../library/multiprocessing.rst:2373 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2369 +#: ../../library/multiprocessing.rst:2376 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2375 +#: ../../library/multiprocessing.rst:2382 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2378 +#: ../../library/multiprocessing.rst:2385 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2383 +#: ../../library/multiprocessing.rst:2390 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2386 +#: ../../library/multiprocessing.rst:2393 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2390 -#: ../../library/multiprocessing.rst:2425 +#: ../../library/multiprocessing.rst:2397 +#: ../../library/multiprocessing.rst:2432 msgid "" "If *authkey* is given and not None, it should be a byte string and will be " "used as the secret key for an HMAC-based authentication challenge. No " @@ -2590,26 +2603,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2398 +#: ../../library/multiprocessing.rst:2405 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2401 +#: ../../library/multiprocessing.rst:2408 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2406 +#: ../../library/multiprocessing.rst:2413 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2410 +#: ../../library/multiprocessing.rst:2417 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -2623,49 +2636,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2421 +#: ../../library/multiprocessing.rst:2428 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2433 +#: ../../library/multiprocessing.rst:2440 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2440 +#: ../../library/multiprocessing.rst:2447 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2444 +#: ../../library/multiprocessing.rst:2451 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2448 +#: ../../library/multiprocessing.rst:2455 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2452 +#: ../../library/multiprocessing.rst:2459 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2455 +#: ../../library/multiprocessing.rst:2462 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2462 +#: ../../library/multiprocessing.rst:2469 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -2674,32 +2687,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2468 +#: ../../library/multiprocessing.rst:2475 msgid "" "For both Unix and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2471 +#: ../../library/multiprocessing.rst:2478 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2472 +#: ../../library/multiprocessing.rst:2479 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2473 +#: ../../library/multiprocessing.rst:2480 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2476 +#: ../../library/multiprocessing.rst:2483 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2479 +#: ../../library/multiprocessing.rst:2486 msgid "" "**Unix**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -2707,7 +2720,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2485 +#: ../../library/multiprocessing.rst:2492 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -2716,46 +2729,46 @@ msgid "" "that pipe handles and socket handles are **not** waitable handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2495 +#: ../../library/multiprocessing.rst:2502 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2497 +#: ../../library/multiprocessing.rst:2504 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2516 +#: ../../library/multiprocessing.rst:2523 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2533 +#: ../../library/multiprocessing.rst:2540 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2572 +#: ../../library/multiprocessing.rst:2579 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2574 +#: ../../library/multiprocessing.rst:2581 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2577 +#: ../../library/multiprocessing.rst:2584 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2580 +#: ../../library/multiprocessing.rst:2587 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\.\\\\pipe\\" "\\{PipeName}'`. To use :func:`Client` to connect to a named pipe on a " @@ -2763,17 +2776,17 @@ msgid "" "samp:`r'\\\\\\\\{ServerName}\\\\pipe\\\\{PipeName}'` instead." msgstr "" -#: ../../library/multiprocessing.rst:2585 +#: ../../library/multiprocessing.rst:2592 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2592 +#: ../../library/multiprocessing.rst:2599 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2594 +#: ../../library/multiprocessing.rst:2601 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -2781,7 +2794,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2600 +#: ../../library/multiprocessing.rst:2607 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -2789,7 +2802,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2606 +#: ../../library/multiprocessing.rst:2613 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -2800,17 +2813,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2614 +#: ../../library/multiprocessing.rst:2621 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2618 +#: ../../library/multiprocessing.rst:2625 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2620 +#: ../../library/multiprocessing.rst:2627 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -2818,27 +2831,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2627 +#: ../../library/multiprocessing.rst:2634 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2630 +#: ../../library/multiprocessing.rst:2637 msgid "" "When first created the logger has level :data:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2634 +#: ../../library/multiprocessing.rst:2641 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2641 +#: ../../library/multiprocessing.rst:2648 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -2847,25 +2860,25 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2647 +#: ../../library/multiprocessing.rst:2654 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2662 +#: ../../library/multiprocessing.rst:2669 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2666 +#: ../../library/multiprocessing.rst:2673 msgid "The :mod:`multiprocessing.dummy` module" msgstr "" -#: ../../library/multiprocessing.rst:2671 +#: ../../library/multiprocessing.rst:2678 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2676 +#: ../../library/multiprocessing.rst:2683 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -2873,7 +2886,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2684 +#: ../../library/multiprocessing.rst:2691 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -2883,18 +2896,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2691 +#: ../../library/multiprocessing.rst:2698 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2697 +#: ../../library/multiprocessing.rst:2704 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2701 +#: ../../library/multiprocessing.rst:2708 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -2904,7 +2917,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2708 +#: ../../library/multiprocessing.rst:2715 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -2913,69 +2926,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2718 +#: ../../library/multiprocessing.rst:2725 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2720 +#: ../../library/multiprocessing.rst:2727 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2725 +#: ../../library/multiprocessing.rst:2732 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2727 +#: ../../library/multiprocessing.rst:2734 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2729 +#: ../../library/multiprocessing.rst:2736 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2731 +#: ../../library/multiprocessing.rst:2738 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2734 +#: ../../library/multiprocessing.rst:2741 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2738 +#: ../../library/multiprocessing.rst:2745 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2740 +#: ../../library/multiprocessing.rst:2747 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2742 +#: ../../library/multiprocessing.rst:2749 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2744 +#: ../../library/multiprocessing.rst:2751 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2747 +#: ../../library/multiprocessing.rst:2754 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2749 +#: ../../library/multiprocessing.rst:2756 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2751 +#: ../../library/multiprocessing.rst:2758 msgid "" "On Unix when a process finishes but has not been joined it becomes a zombie. " "There should never be very many because each time a new process starts (or :" @@ -2986,11 +2999,11 @@ msgid "" "all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2759 +#: ../../library/multiprocessing.rst:2766 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2761 +#: ../../library/multiprocessing.rst:2768 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -3000,11 +3013,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2769 +#: ../../library/multiprocessing.rst:2776 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2771 +#: ../../library/multiprocessing.rst:2778 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -3012,18 +3025,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2777 +#: ../../library/multiprocessing.rst:2784 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2781 +#: ../../library/multiprocessing.rst:2788 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2783 +#: ../../library/multiprocessing.rst:2790 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -3032,7 +3045,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2789 +#: ../../library/multiprocessing.rst:2796 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -3041,21 +3054,21 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2795 +#: ../../library/multiprocessing.rst:2802 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2809 +#: ../../library/multiprocessing.rst:2816 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2812 +#: ../../library/multiprocessing.rst:2819 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2814 +#: ../../library/multiprocessing.rst:2821 msgid "" "On Unix using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -3063,7 +3076,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2819 +#: ../../library/multiprocessing.rst:2826 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -3072,29 +3085,29 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2826 +#: ../../library/multiprocessing.rst:2833 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2838 +#: ../../library/multiprocessing.rst:2845 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2850 +#: ../../library/multiprocessing.rst:2857 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2852 +#: ../../library/multiprocessing.rst:2859 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2856 +#: ../../library/multiprocessing.rst:2863 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2862 +#: ../../library/multiprocessing.rst:2869 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -3104,33 +3117,33 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2876 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2881 +#: ../../library/multiprocessing.rst:2888 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2884 +#: ../../library/multiprocessing.rst:2891 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2886 +#: ../../library/multiprocessing.rst:2893 msgid "" "There are a few extra restriction which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2889 +#: ../../library/multiprocessing.rst:2896 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2891 +#: ../../library/multiprocessing.rst:2898 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -3138,11 +3151,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2896 +#: ../../library/multiprocessing.rst:2903 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2898 +#: ../../library/multiprocessing.rst:2905 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -3150,66 +3163,66 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:2903 +#: ../../library/multiprocessing.rst:2910 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:2906 +#: ../../library/multiprocessing.rst:2913 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:2908 +#: ../../library/multiprocessing.rst:2915 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such a starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:2912 +#: ../../library/multiprocessing.rst:2919 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:2924 +#: ../../library/multiprocessing.rst:2931 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2938 +#: ../../library/multiprocessing.rst:2945 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:2941 +#: ../../library/multiprocessing.rst:2948 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:2944 +#: ../../library/multiprocessing.rst:2951 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:2951 +#: ../../library/multiprocessing.rst:2958 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:2953 +#: ../../library/multiprocessing.rst:2960 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:2959 +#: ../../library/multiprocessing.rst:2966 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "" -#: ../../library/multiprocessing.rst:2965 +#: ../../library/multiprocessing.rst:2972 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" diff --git a/library/sqlite3.po b/library/sqlite3.po index 0df6044423..7ffdea90b6 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-09 00:10+0000\n" +"POT-Creation-Date: 2022-01-19 00:09+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -298,44 +298,46 @@ msgstr "" #: ../../library/sqlite3.rst:258 msgid "" -"If *uri* is true, *database* is interpreted as a URI. This allows you to " -"specify options. For example, to open a database in read-only mode you can " -"use::" +"If *uri* is :const:`True`, *database* is interpreted as a :abbr:`URI " +"(Uniform Resource Identifier)` with a file path and an optional query " +"string. The scheme part *must* be ``\"file:\"``. The path can be a " +"relative or absolute file path. The query string allows us to pass " +"parameters to SQLite. Some useful URI tricks include::" msgstr "" -#: ../../library/sqlite3.rst:264 +#: ../../library/sqlite3.rst:277 msgid "" -"More information about this feature, including a list of recognized options, " -"can be found in the `SQLite URI documentation `_." +"More information about this feature, including a list of recognized " +"parameters, can be found in the `SQLite URI documentation `_." msgstr "" -#: ../../library/sqlite3.rst:267 +#: ../../library/sqlite3.rst:281 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -#: ../../library/sqlite3.rst:268 +#: ../../library/sqlite3.rst:282 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" -#: ../../library/sqlite3.rst:270 +#: ../../library/sqlite3.rst:284 msgid "Added the *uri* parameter." msgstr "新增 *uri* 參數。" -#: ../../library/sqlite3.rst:273 +#: ../../library/sqlite3.rst:287 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:276 +#: ../../library/sqlite3.rst:290 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:282 +#: ../../library/sqlite3.rst:296 msgid "" "Registers a callable to convert a bytestring from the database into a custom " "Python type. The callable will be invoked for all database values that are " @@ -345,7 +347,7 @@ msgid "" "manner." msgstr "" -#: ../../library/sqlite3.rst:291 +#: ../../library/sqlite3.rst:305 msgid "" "Registers a callable to convert the custom Python type *type* into one of " "SQLite's supported types. The callable *callable* accepts as single " @@ -353,7 +355,7 @@ msgid "" "int, float, str or bytes." msgstr "" -#: ../../library/sqlite3.rst:299 +#: ../../library/sqlite3.rst:313 msgid "" "Returns :const:`True` if the string *sql* contains one or more complete SQL " "statements terminated by semicolons. It does not verify that the SQL is " @@ -361,12 +363,12 @@ msgid "" "the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:304 +#: ../../library/sqlite3.rst:318 msgid "" "This can be used to build a shell for SQLite, as in the following example:" msgstr "" -#: ../../library/sqlite3.rst:312 +#: ../../library/sqlite3.rst:326 msgid "" "By default you will not get any tracebacks in user-defined functions, " "aggregates, converters, authorizer callbacks etc. If you want to debug them, " @@ -375,35 +377,35 @@ msgid "" "disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:322 +#: ../../library/sqlite3.rst:336 msgid "Connection Objects" msgstr "" -#: ../../library/sqlite3.rst:326 +#: ../../library/sqlite3.rst:340 msgid "A SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:330 +#: ../../library/sqlite3.rst:344 msgid "" "Get or set the current default isolation level. :const:`None` for autocommit " "mode or one of \"DEFERRED\", \"IMMEDIATE\" or \"EXCLUSIVE\". See section :" "ref:`sqlite3-controlling-transactions` for a more detailed explanation." msgstr "" -#: ../../library/sqlite3.rst:336 +#: ../../library/sqlite3.rst:350 msgid "" ":const:`True` if a transaction is active (there are uncommitted changes), :" "const:`False` otherwise. Read-only attribute." msgstr "" -#: ../../library/sqlite3.rst:343 +#: ../../library/sqlite3.rst:357 msgid "" "The cursor method accepts a single optional parameter *factory*. If " "supplied, this must be a callable returning an instance of :class:`Cursor` " "or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:349 +#: ../../library/sqlite3.rst:363 msgid "" "This method commits the current transaction. If you don't call this method, " "anything you did since the last call to ``commit()`` is not visible from " @@ -411,41 +413,41 @@ msgid "" "written to the database, please check you didn't forget to call this method." msgstr "" -#: ../../library/sqlite3.rst:356 +#: ../../library/sqlite3.rst:370 msgid "" "This method rolls back any changes to the database since the last call to :" "meth:`commit`." msgstr "" -#: ../../library/sqlite3.rst:361 +#: ../../library/sqlite3.rst:375 msgid "" "This closes the database connection. Note that this does not automatically " "call :meth:`commit`. If you just close your database connection without " "calling :meth:`commit` first, your changes will be lost!" msgstr "" -#: ../../library/sqlite3.rst:367 +#: ../../library/sqlite3.rst:381 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor.execute` " "method with the *parameters* given, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:374 +#: ../../library/sqlite3.rst:388 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor." "executemany` method with the *parameters* given, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:381 +#: ../../library/sqlite3.rst:395 msgid "" "This is a nonstandard shortcut that creates a cursor object by calling the :" "meth:`~Connection.cursor` method, calls the cursor's :meth:`~Cursor." "executescript` method with the given *sql_script*, and returns the cursor." msgstr "" -#: ../../library/sqlite3.rst:388 +#: ../../library/sqlite3.rst:402 msgid "" "Creates a user-defined function that you can later use from within SQL " "statements under the function name *name*. *num_params* is the number of " @@ -458,26 +460,26 @@ msgid "" "older versions." msgstr "" -#: ../../library/sqlite3.rst:398 +#: ../../library/sqlite3.rst:412 msgid "" "The function can return any of the types supported by SQLite: bytes, str, " "int, float and ``None``." msgstr "" -#: ../../library/sqlite3.rst:401 +#: ../../library/sqlite3.rst:415 msgid "The *deterministic* parameter was added." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:404 ../../library/sqlite3.rst:421 -#: ../../library/sqlite3.rst:553 ../../library/sqlite3.rst:704 +#: ../../library/sqlite3.rst:418 ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:567 ../../library/sqlite3.rst:718 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:411 +#: ../../library/sqlite3.rst:425 msgid "Creates a user-defined aggregate function." msgstr "" -#: ../../library/sqlite3.rst:413 +#: ../../library/sqlite3.rst:427 msgid "" "The aggregate class must implement a ``step`` method, which accepts the " "number of parameters *num_params* (if *num_params* is -1, the function may " @@ -485,13 +487,13 @@ msgid "" "the final result of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:418 +#: ../../library/sqlite3.rst:432 msgid "" "The ``finalize`` method can return any of the types supported by SQLite: " "bytes, str, int, float and ``None``." msgstr "" -#: ../../library/sqlite3.rst:428 +#: ../../library/sqlite3.rst:442 msgid "" "Creates a collation with the specified *name* and *callable*. The callable " "will be passed two string arguments. It should return -1 if the first is " @@ -500,30 +502,30 @@ msgid "" "(ORDER BY in SQL) so your comparisons don't affect other SQL operations." msgstr "" -#: ../../library/sqlite3.rst:434 +#: ../../library/sqlite3.rst:448 msgid "" "Note that the callable will get its parameters as Python bytestrings, which " "will normally be encoded in UTF-8." msgstr "" -#: ../../library/sqlite3.rst:437 +#: ../../library/sqlite3.rst:451 msgid "" "The following example shows a custom collation that sorts \"the wrong way\":" msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:455 msgid "" "To remove a collation, call ``create_collation`` with ``None`` as callable::" msgstr "" -#: ../../library/sqlite3.rst:448 +#: ../../library/sqlite3.rst:462 msgid "" "You can call this method from a different thread to abort any queries that " "might be executing on the connection. The query will then abort and the " "caller will get an exception." msgstr "" -#: ../../library/sqlite3.rst:455 +#: ../../library/sqlite3.rst:469 msgid "" "This routine registers a callback. The callback is invoked for each attempt " "to access a column of a table in the database. The callback should return :" @@ -533,7 +535,7 @@ msgid "" "in the :mod:`sqlite3` module." msgstr "" -#: ../../library/sqlite3.rst:462 +#: ../../library/sqlite3.rst:476 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or :const:`None` " @@ -544,7 +546,7 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:469 +#: ../../library/sqlite3.rst:483 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -552,7 +554,7 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:476 +#: ../../library/sqlite3.rst:490 msgid "" "This routine registers a callback. The callback is invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -560,26 +562,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:481 +#: ../../library/sqlite3.rst:495 msgid "" "If you want to clear any previously installed progress handler, call the " "method with :const:`None` for *handler*." msgstr "" -#: ../../library/sqlite3.rst:484 +#: ../../library/sqlite3.rst:498 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise an :exc:`OperationalError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:491 +#: ../../library/sqlite3.rst:505 msgid "" "Registers *trace_callback* to be called for each SQL statement that is " "actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:494 +#: ../../library/sqlite3.rst:508 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -589,19 +591,19 @@ msgid "" "of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:502 +#: ../../library/sqlite3.rst:516 msgid "" "Passing :const:`None` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:505 +#: ../../library/sqlite3.rst:519 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:515 +#: ../../library/sqlite3.rst:529 msgid "" "This routine allows/disallows the SQLite engine to load SQLite extensions " "from shared libraries. SQLite extensions can define new functions, " @@ -609,38 +611,38 @@ msgid "" "extension is the fulltext-search extension distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:520 ../../library/sqlite3.rst:537 +#: ../../library/sqlite3.rst:534 ../../library/sqlite3.rst:551 msgid "Loadable extensions are disabled by default. See [#f1]_." msgstr "" -#: ../../library/sqlite3.rst:522 +#: ../../library/sqlite3.rst:536 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:540 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:533 +#: ../../library/sqlite3.rst:547 msgid "" "This routine loads a SQLite extension from a shared library. You have to " "enable extension loading with :meth:`enable_load_extension` before you can " "use this routine." msgstr "" -#: ../../library/sqlite3.rst:539 +#: ../../library/sqlite3.rst:553 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:543 +#: ../../library/sqlite3.rst:557 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:548 +#: ../../library/sqlite3.rst:562 msgid "" "You can change this attribute to a callable that accepts the cursor and the " "original row as a tuple and will return the real result row. This way, you " @@ -648,7 +650,7 @@ msgid "" "object that can also access columns by name." msgstr "" -#: ../../library/sqlite3.rst:557 +#: ../../library/sqlite3.rst:571 msgid "" "If returning a tuple doesn't suffice and you want name-based access to " "columns, you should consider setting :attr:`row_factory` to the highly-" @@ -658,7 +660,7 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:569 +#: ../../library/sqlite3.rst:583 msgid "" "Using this attribute you can control what objects are returned for the " "``TEXT`` data type. By default, this attribute is set to :class:`str` and " @@ -666,23 +668,23 @@ msgid "" "you want to return :class:`bytes` instead, you can set it to :class:`bytes`." msgstr "" -#: ../../library/sqlite3.rst:574 +#: ../../library/sqlite3.rst:588 msgid "" "You can also set it to any other callable that accepts a single bytestring " "parameter and returns the resulting object." msgstr "" -#: ../../library/sqlite3.rst:577 +#: ../../library/sqlite3.rst:591 msgid "See the following example code for illustration:" msgstr "" -#: ../../library/sqlite3.rst:584 +#: ../../library/sqlite3.rst:598 msgid "" "Returns the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:590 +#: ../../library/sqlite3.rst:604 msgid "" "Returns an iterator to dump the database in an SQL text format. Useful when " "saving an in-memory database for later restoration. This function provides " @@ -690,14 +692,14 @@ msgid "" "shell." msgstr "" -#: ../../library/sqlite3.rst:595 +#: ../../library/sqlite3.rst:609 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/sqlite3.rst:609 +#: ../../library/sqlite3.rst:623 msgid "" "This method makes a backup of a SQLite database even while it's being " "accessed by other clients, or concurrently by the same connection. The copy " @@ -705,14 +707,14 @@ msgid "" "class:`Connection` instance." msgstr "" -#: ../../library/sqlite3.rst:614 +#: ../../library/sqlite3.rst:628 msgid "" "By default, or when *pages* is either ``0`` or a negative integer, the " "entire database is copied in a single step; otherwise the method performs a " "loop copying up to *pages* pages at a time." msgstr "" -#: ../../library/sqlite3.rst:618 +#: ../../library/sqlite3.rst:632 msgid "" "If *progress* is specified, it must either be ``None`` or a callable object " "that will be executed at each iteration with three integer arguments, " @@ -720,7 +722,7 @@ msgid "" "pages still to be copied and the *total* number of pages." msgstr "" -#: ../../library/sqlite3.rst:623 +#: ../../library/sqlite3.rst:637 msgid "" "The *name* argument specifies the database name that will be copied: it must " "be a string containing either ``\"main\"``, the default, to indicate the " @@ -729,36 +731,36 @@ msgid "" "an attached database." msgstr "" -#: ../../library/sqlite3.rst:629 +#: ../../library/sqlite3.rst:643 msgid "" "The *sleep* argument specifies the number of seconds to sleep by between " "successive attempts to backup remaining pages, can be specified either as an " "integer or a floating point value." msgstr "" -#: ../../library/sqlite3.rst:633 +#: ../../library/sqlite3.rst:647 msgid "Example 1, copy an existing database into another::" msgstr "" -#: ../../library/sqlite3.rst:647 +#: ../../library/sqlite3.rst:661 msgid "Example 2, copy an existing database into a transient copy::" msgstr "" -#: ../../library/sqlite3.rst:661 +#: ../../library/sqlite3.rst:675 msgid "Cursor Objects" msgstr "" -#: ../../library/sqlite3.rst:665 +#: ../../library/sqlite3.rst:679 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:672 +#: ../../library/sqlite3.rst:686 msgid "" "Executes an SQL statement. Values may be bound to the statement using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:675 +#: ../../library/sqlite3.rst:689 msgid "" ":meth:`execute` will only execute a single SQL statement. If you try to " "execute more than one statement with it, it will raise a :exc:`.Warning`. " @@ -766,7 +768,7 @@ msgid "" "with one call." msgstr "" -#: ../../library/sqlite3.rst:683 +#: ../../library/sqlite3.rst:697 msgid "" "Executes a :ref:`parameterized ` SQL command against " "all parameter sequences or mappings found in the sequence " @@ -774,11 +776,11 @@ msgid "" "`iterator` yielding parameters instead of a sequence." msgstr "" -#: ../../library/sqlite3.rst:690 +#: ../../library/sqlite3.rst:704 msgid "Here's a shorter example using a :term:`generator`:" msgstr "" -#: ../../library/sqlite3.rst:697 +#: ../../library/sqlite3.rst:711 msgid "" "This is a nonstandard convenience method for executing multiple SQL " "statements at once. It issues a ``COMMIT`` statement first, then executes " @@ -786,23 +788,23 @@ msgid "" "`isolation_level`; any transaction control must be added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:702 +#: ../../library/sqlite3.rst:716 msgid "*sql_script* can be an instance of :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:711 +#: ../../library/sqlite3.rst:725 msgid "" "Fetches the next row of a query result set, returning a single sequence, or :" "const:`None` when no more data is available." msgstr "" -#: ../../library/sqlite3.rst:717 +#: ../../library/sqlite3.rst:731 msgid "" "Fetches the next set of rows of a query result, returning a list. An empty " "list is returned when no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:720 +#: ../../library/sqlite3.rst:734 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If it is not given, the cursor's arraysize determines the number of rows to " @@ -811,7 +813,7 @@ msgid "" "not being available, fewer rows may be returned." msgstr "" -#: ../../library/sqlite3.rst:726 +#: ../../library/sqlite3.rst:740 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -819,42 +821,42 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:733 +#: ../../library/sqlite3.rst:747 msgid "" "Fetches all (remaining) rows of a query result, returning a list. Note that " "the cursor's arraysize attribute can affect the performance of this " "operation. An empty list is returned when no rows are available." msgstr "" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:753 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:741 +#: ../../library/sqlite3.rst:755 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:746 ../../library/sqlite3.rst:750 +#: ../../library/sqlite3.rst:760 ../../library/sqlite3.rst:764 msgid "Required by the DB-API. Is a no-op in :mod:`sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:754 +#: ../../library/sqlite3.rst:768 msgid "" "Although the :class:`Cursor` class of the :mod:`sqlite3` module implements " "this attribute, the database engine's own support for the determination of " "\"rows affected\"/\"rows selected\" is quirky." msgstr "" -#: ../../library/sqlite3.rst:758 +#: ../../library/sqlite3.rst:772 msgid "" "For :meth:`executemany` statements, the number of modifications are summed " "up into :attr:`rowcount`." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:775 msgid "" "As required by the Python DB API Spec, the :attr:`rowcount` attribute \"is " "-1 in case no ``executeXX()`` has been performed on the cursor or the " @@ -863,7 +865,7 @@ msgid "" "rows a query produced until all rows were fetched." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:783 msgid "" "This read-only attribute provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -873,33 +875,33 @@ msgid "" "const:`None`." msgstr "" -#: ../../library/sqlite3.rst:777 +#: ../../library/sqlite3.rst:791 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:779 +#: ../../library/sqlite3.rst:793 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:784 +#: ../../library/sqlite3.rst:798 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:789 +#: ../../library/sqlite3.rst:803 msgid "" "This read-only attribute provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are :const:`None`." msgstr "" -#: ../../library/sqlite3.rst:793 +#: ../../library/sqlite3.rst:807 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:797 +#: ../../library/sqlite3.rst:811 msgid "" "This read-only attribute provides the SQLite database :class:`Connection` " "used by the :class:`Cursor` object. A :class:`Cursor` object created by " @@ -907,79 +909,79 @@ msgid "" "`connection` attribute that refers to *con*::" msgstr "" -#: ../../library/sqlite3.rst:810 +#: ../../library/sqlite3.rst:824 msgid "Row Objects" msgstr "" -#: ../../library/sqlite3.rst:814 +#: ../../library/sqlite3.rst:828 msgid "" "A :class:`Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It tries to mimic a tuple in " "most of its features." msgstr "" -#: ../../library/sqlite3.rst:818 +#: ../../library/sqlite3.rst:832 msgid "" "It supports mapping access by column name and index, iteration, " "representation, equality testing and :func:`len`." msgstr "" -#: ../../library/sqlite3.rst:821 +#: ../../library/sqlite3.rst:835 msgid "" "If two :class:`Row` objects have exactly the same columns and their members " "are equal, they compare equal." msgstr "" -#: ../../library/sqlite3.rst:826 +#: ../../library/sqlite3.rst:840 msgid "" "This method returns a list of column names. Immediately after a query, it is " "the first member of each tuple in :attr:`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:829 +#: ../../library/sqlite3.rst:843 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:846 msgid "Let's assume we initialize a table as in the example given above::" msgstr "" -#: ../../library/sqlite3.rst:844 +#: ../../library/sqlite3.rst:858 msgid "Now we plug :class:`Row` in::" msgstr "" -#: ../../library/sqlite3.rst:876 +#: ../../library/sqlite3.rst:890 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:880 +#: ../../library/sqlite3.rst:894 msgid "A subclass of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:884 +#: ../../library/sqlite3.rst:898 msgid "" "The base class of the other exceptions in this module. It is a subclass of :" "exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:889 +#: ../../library/sqlite3.rst:903 msgid "Exception raised for errors that are related to the database." msgstr "" -#: ../../library/sqlite3.rst:893 +#: ../../library/sqlite3.rst:907 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:898 +#: ../../library/sqlite3.rst:912 msgid "" "Exception raised for programming errors, e.g. table not found or already " "exists, syntax error in the SQL statement, wrong number of parameters " "specified, etc. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:904 +#: ../../library/sqlite3.rst:918 msgid "" "Exception raised for errors that are related to the database's operation and " "not necessarily under the control of the programmer, e.g. an unexpected " @@ -987,7 +989,7 @@ msgid "" "not be processed, etc. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:911 +#: ../../library/sqlite3.rst:925 msgid "" "Exception raised in case a method or database API was used which is not " "supported by the database, e.g. calling the :meth:`~Connection.rollback` " @@ -995,82 +997,82 @@ msgid "" "turned off. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:920 +#: ../../library/sqlite3.rst:934 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:924 +#: ../../library/sqlite3.rst:938 msgid "Introduction" msgstr "簡介" -#: ../../library/sqlite3.rst:926 +#: ../../library/sqlite3.rst:940 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:929 +#: ../../library/sqlite3.rst:943 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:932 ../../library/sqlite3.rst:949 +#: ../../library/sqlite3.rst:946 ../../library/sqlite3.rst:963 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:932 ../../library/sqlite3.rst:949 +#: ../../library/sqlite3.rst:946 ../../library/sqlite3.rst:963 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:934 ../../library/sqlite3.rst:951 +#: ../../library/sqlite3.rst:948 ../../library/sqlite3.rst:965 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/sqlite3.rst:934 ../../library/sqlite3.rst:951 +#: ../../library/sqlite3.rst:948 ../../library/sqlite3.rst:965 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:936 ../../library/sqlite3.rst:953 +#: ../../library/sqlite3.rst:950 ../../library/sqlite3.rst:967 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:936 ../../library/sqlite3.rst:953 +#: ../../library/sqlite3.rst:950 ../../library/sqlite3.rst:967 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:938 ../../library/sqlite3.rst:955 +#: ../../library/sqlite3.rst:952 ../../library/sqlite3.rst:969 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:938 ../../library/sqlite3.rst:955 +#: ../../library/sqlite3.rst:952 ../../library/sqlite3.rst:969 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:940 +#: ../../library/sqlite3.rst:954 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:940 ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:954 ../../library/sqlite3.rst:971 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:942 ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:956 ../../library/sqlite3.rst:974 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:942 ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:956 ../../library/sqlite3.rst:974 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:946 +#: ../../library/sqlite3.rst:960 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:971 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:963 +#: ../../library/sqlite3.rst:977 msgid "" "The type system of the :mod:`sqlite3` module is extensible in two ways: you " "can store additional Python types in a SQLite database via object " @@ -1078,11 +1080,11 @@ msgid "" "to different Python types via converters." msgstr "" -#: ../../library/sqlite3.rst:970 +#: ../../library/sqlite3.rst:984 msgid "Using adapters to store additional Python types in SQLite databases" msgstr "" -#: ../../library/sqlite3.rst:972 +#: ../../library/sqlite3.rst:986 msgid "" "As described before, SQLite supports only a limited set of types natively. " "To use other Python types with SQLite, you must **adapt** them to one of the " @@ -1090,23 +1092,23 @@ msgid "" "str, bytes." msgstr "" -#: ../../library/sqlite3.rst:977 +#: ../../library/sqlite3.rst:991 msgid "" "There are two ways to enable the :mod:`sqlite3` module to adapt a custom " "Python type to one of the supported ones." msgstr "" -#: ../../library/sqlite3.rst:982 +#: ../../library/sqlite3.rst:996 msgid "Letting your object adapt itself" msgstr "" -#: ../../library/sqlite3.rst:984 +#: ../../library/sqlite3.rst:998 msgid "" "This is a good approach if you write the class yourself. Let's suppose you " "have a class like this::" msgstr "" -#: ../../library/sqlite3.rst:991 +#: ../../library/sqlite3.rst:1005 msgid "" "Now you want to store the point in a single SQLite column. First you'll " "have to choose one of the supported types to be used for representing the " @@ -1116,18 +1118,18 @@ msgid "" "class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1001 +#: ../../library/sqlite3.rst:1015 msgid "Registering an adapter callable" msgstr "" -#: ../../library/sqlite3.rst:1003 +#: ../../library/sqlite3.rst:1017 msgid "" "The other possibility is to create a function that converts the type to the " "string representation and register the function with :meth:" "`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1008 +#: ../../library/sqlite3.rst:1022 msgid "" "The :mod:`sqlite3` module has two default adapters for Python's built-in :" "class:`datetime.date` and :class:`datetime.datetime` types. Now let's " @@ -1135,100 +1137,100 @@ msgid "" "representation, but as a Unix timestamp." msgstr "" -#: ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1031 msgid "Converting SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1019 +#: ../../library/sqlite3.rst:1033 msgid "" "Writing an adapter lets you send custom Python types to SQLite. But to make " "it really useful we need to make the Python to SQLite to Python roundtrip " "work." msgstr "" -#: ../../library/sqlite3.rst:1022 +#: ../../library/sqlite3.rst:1036 msgid "Enter converters." msgstr "" -#: ../../library/sqlite3.rst:1024 +#: ../../library/sqlite3.rst:1038 msgid "" "Let's go back to the :class:`Point` class. We stored the x and y coordinates " "separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1041 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:1032 +#: ../../library/sqlite3.rst:1046 msgid "" "Converter functions **always** get called with a :class:`bytes` object, no " "matter under which data type you sent the value to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1041 +#: ../../library/sqlite3.rst:1055 msgid "" "Now you need to make the :mod:`sqlite3` module know that what you select " "from the database is actually a point. There are two ways of doing this:" msgstr "" -#: ../../library/sqlite3.rst:1044 +#: ../../library/sqlite3.rst:1058 msgid "Implicitly via the declared type" msgstr "" -#: ../../library/sqlite3.rst:1046 +#: ../../library/sqlite3.rst:1060 msgid "Explicitly via the column name" msgstr "" -#: ../../library/sqlite3.rst:1048 +#: ../../library/sqlite3.rst:1062 msgid "" "Both ways are described in section :ref:`sqlite3-module-contents`, in the " "entries for the constants :const:`PARSE_DECLTYPES` and :const:" "`PARSE_COLNAMES`." msgstr "" -#: ../../library/sqlite3.rst:1051 +#: ../../library/sqlite3.rst:1065 msgid "The following example illustrates both approaches." msgstr "" -#: ../../library/sqlite3.rst:1057 +#: ../../library/sqlite3.rst:1071 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1059 +#: ../../library/sqlite3.rst:1073 msgid "" "There are default adapters for the date and datetime types in the datetime " "module. They will be sent as ISO dates/ISO timestamps to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1062 +#: ../../library/sqlite3.rst:1076 msgid "" "The default converters are registered under the name \"date\" for :class:" "`datetime.date` and under the name \"timestamp\" for :class:`datetime." "datetime`." msgstr "" -#: ../../library/sqlite3.rst:1066 +#: ../../library/sqlite3.rst:1080 msgid "" "This way, you can use date/timestamps from Python without any additional " "fiddling in most cases. The format of the adapters is also compatible with " "the experimental SQLite date/time functions." msgstr "" -#: ../../library/sqlite3.rst:1070 +#: ../../library/sqlite3.rst:1084 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1074 +#: ../../library/sqlite3.rst:1088 msgid "" "If a timestamp stored in SQLite has a fractional part longer than 6 numbers, " "its value will be truncated to microsecond precision by the timestamp " "converter." msgstr "" -#: ../../library/sqlite3.rst:1080 +#: ../../library/sqlite3.rst:1094 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1236,17 +1238,17 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1088 +#: ../../library/sqlite3.rst:1102 msgid "Controlling Transactions" msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1104 msgid "" "The underlying ``sqlite3`` library operates in ``autocommit`` mode by " "default, but the Python :mod:`sqlite3` module by default does not." msgstr "" -#: ../../library/sqlite3.rst:1093 +#: ../../library/sqlite3.rst:1107 msgid "" "``autocommit`` mode means that statements that modify the database take " "effect immediately. A ``BEGIN`` or ``SAVEPOINT`` statement disables " @@ -1254,14 +1256,14 @@ msgid "" "ends the outermost transaction, turns ``autocommit`` mode back on." msgstr "" -#: ../../library/sqlite3.rst:1098 +#: ../../library/sqlite3.rst:1112 msgid "" "The Python :mod:`sqlite3` module by default issues a ``BEGIN`` statement " "implicitly before a Data Modification Language (DML) statement (i.e. " "``INSERT``/``UPDATE``/``DELETE``/``REPLACE``)." msgstr "" -#: ../../library/sqlite3.rst:1102 +#: ../../library/sqlite3.rst:1116 msgid "" "You can control which kind of ``BEGIN`` statements :mod:`sqlite3` implicitly " "executes via the *isolation_level* parameter to the :func:`connect` call, or " @@ -1271,7 +1273,7 @@ msgid "" "``EXCLUSIVE``." msgstr "" -#: ../../library/sqlite3.rst:1109 +#: ../../library/sqlite3.rst:1123 msgid "" "You can disable the :mod:`sqlite3` module's implicit transaction management " "by setting :attr:`isolation_level` to ``None``. This will leave the " @@ -1281,27 +1283,27 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:1115 +#: ../../library/sqlite3.rst:1129 msgid "" "Note that :meth:`~Cursor.executescript` disregards :attr:`isolation_level`; " "any transaction control must be added explicitly." msgstr "" -#: ../../library/sqlite3.rst:1118 +#: ../../library/sqlite3.rst:1132 msgid "" ":mod:`sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1124 +#: ../../library/sqlite3.rst:1138 msgid "Using :mod:`sqlite3` efficiently" msgstr "" -#: ../../library/sqlite3.rst:1128 +#: ../../library/sqlite3.rst:1142 msgid "Using shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1130 +#: ../../library/sqlite3.rst:1144 msgid "" "Using the nonstandard :meth:`execute`, :meth:`executemany` and :meth:" "`executescript` methods of the :class:`Connection` object, your code can be " @@ -1313,38 +1315,38 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:1142 +#: ../../library/sqlite3.rst:1156 msgid "Accessing columns by name instead of by index" msgstr "" -#: ../../library/sqlite3.rst:1144 +#: ../../library/sqlite3.rst:1158 msgid "" "One useful feature of the :mod:`sqlite3` module is the built-in :class:" "`sqlite3.Row` class designed to be used as a row factory." msgstr "" -#: ../../library/sqlite3.rst:1147 +#: ../../library/sqlite3.rst:1161 msgid "" "Rows wrapped with this class can be accessed both by index (like tuples) and " "case-insensitively by name:" msgstr "" -#: ../../library/sqlite3.rst:1154 +#: ../../library/sqlite3.rst:1168 msgid "Using the connection as a context manager" msgstr "" -#: ../../library/sqlite3.rst:1156 +#: ../../library/sqlite3.rst:1170 msgid "" "Connection objects can be used as context managers that automatically commit " "or rollback transactions. In the event of an exception, the transaction is " "rolled back; otherwise, the transaction is committed:" msgstr "" -#: ../../library/sqlite3.rst:1165 +#: ../../library/sqlite3.rst:1179 msgid "Footnotes" msgstr "註解" -#: ../../library/sqlite3.rst:1166 +#: ../../library/sqlite3.rst:1180 msgid "" "The sqlite3 module is not built with loadable extension support by default, " "because some platforms (notably macOS) have SQLite libraries which are " diff --git a/library/time.po b/library/time.po index 8d2ce0cf10..c885c06df7 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-01-15 00:10+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -672,7 +672,7 @@ msgstr "``%z``" msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " -"represents decimal minute digits [-23:59, +23:59]." +"represents decimal minute digits [-23:59, +23:59]. [1]_" msgstr "" #: ../../library/time.rst:461 @@ -680,7 +680,7 @@ msgid "``%Z``" msgstr "``%Z``" #: ../../library/time.rst:461 -msgid "Time zone name (no characters if no time zone exists)." +msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "" #: ../../library/time.rst:464 @@ -718,7 +718,7 @@ msgstr "" #: ../../library/time.rst:482 msgid "" "Here is an example, a format for dates compatible with that specified in " -"the :rfc:`2822` Internet email standard. [#]_ ::" +"the :rfc:`2822` Internet email standard. [1]_ ::" msgstr "" #: ../../library/time.rst:489 @@ -1319,10 +1319,10 @@ msgstr "註解" #: ../../library/time.rst:911 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " -"the preferred hour/minute offset is not supported by all ANSI C libraries. " +"the preferred hour/minute offset is not supported by all ANSI C libraries. " "Also, a strict reading of the original 1982 :rfc:`822` standard calls for a " -"two-digit year (%y rather than %Y), but practice moved to 4-digit years long " -"before the year 2000. After that, :rfc:`822` became obsolete and the 4-" -"digit year has been first recommended by :rfc:`1123` and then mandated by :" -"rfc:`2822`." +"two-digit year (``%y`` rather than ``%Y``), but practice moved to 4-digit " +"years long before the year 2000. After that, :rfc:`822` became obsolete and " +"the 4-digit year has been first recommended by :rfc:`1123` and then mandated " +"by :rfc:`2822`." msgstr "" diff --git a/library/timeit.po b/library/timeit.po index bca82b2ca3..b1b209e8f1 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-01-15 00:10+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -302,24 +302,34 @@ msgid "" "the beginning:" msgstr "" -#: ../../library/timeit.rst:293 +#: ../../library/timeit.rst:285 +msgid "" +"In the output, there are three fields. The loop count, which tells you how " +"many times the statement body was run per timing loop repetition. The " +"repetition count ('best of 5') which tells you how many times the timing " +"loop was repeated, and finally the time the statement body took on average " +"within the best repetition of the timing loop. That is, the time the fastest " +"repetition took divided by the loop count." +msgstr "" + +#: ../../library/timeit.rst:300 msgid "The same can be done using the :class:`Timer` class and its methods::" msgstr "" -#: ../../library/timeit.rst:303 +#: ../../library/timeit.rst:310 msgid "" "The following examples show how to time expressions that contain multiple " "lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:" "keyword:`except` to test for missing and present object attributes:" msgstr "" -#: ../../library/timeit.rst:349 +#: ../../library/timeit.rst:356 msgid "" "To give the :mod:`timeit` module access to functions you define, you can " "pass a *setup* parameter which contains an import statement::" msgstr "" -#: ../../library/timeit.rst:360 +#: ../../library/timeit.rst:367 msgid "" "Another option is to pass :func:`globals` to the *globals* parameter, which " "will cause the code to be executed within your current global namespace. "