diff --git a/library/2to3.po b/library/2to3.po index 86092d2e06..27595b2a6d 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-12-14 00:10+0000\n" +"POT-Creation-Date: 2022-07-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,8 +20,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/2to3.rst:4 -msgid "2to3 - Automated Python 2 to 3 code translation" -msgstr "2to3 - 自動將 Python 2的程式碼轉成 Python 3" +msgid "2to3 --- Automated Python 2 to 3 code translation" +msgstr "2to3 --- 自動將 Python 2的程式碼轉成 Python 3" #: ../../library/2to3.rst:8 msgid "" @@ -613,7 +613,7 @@ msgid "" msgstr "" #: ../../library/2to3.rst:455 -msgid ":mod:`lib2to3` - 2to3's library" +msgid ":mod:`lib2to3` --- 2to3's library" msgstr "" #: ../../library/2to3.rst:464 diff --git a/library/sqlite3.po b/library/sqlite3.po index 38bc541c52..9b9b0b6208 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-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-07-08 03:52+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-" @@ -220,124 +220,109 @@ msgid "" "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:223 -msgid "" -"Opens a connection to the SQLite database file *database*. By default " -"returns a :class:`Connection` object, unless a custom *factory* is given." +#: ../../library/sqlite3.rst:224 +msgid "Open a connection to an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:226 -msgid "" -"*database* is a :term:`path-like object` giving the pathname (absolute or " -"relative to the current working directory) of the database file to be " -"opened. You can use ``\":memory:\"`` to open a database connection to a " -"database that resides in RAM instead of on disk." +#: ../../library/sqlite3.rst:0 +msgid "Parameters" msgstr "" -#: ../../library/sqlite3.rst:231 +#: ../../library/sqlite3.rst:226 msgid "" -"When a database is accessed by multiple connections, and one of the " -"processes modifies the database, the SQLite database is locked until that " -"transaction is committed. The *timeout* parameter specifies how long the " -"connection should wait for the lock to go away until raising an exception. " -"The default for the timeout parameter is 5.0 (five seconds)." +"The path to the database file to be opened. Pass ``\":memory:\"`` to open a " +"connection to a database that is in RAM instead of on disk." msgstr "" -#: ../../library/sqlite3.rst:237 +#: ../../library/sqlite3.rst:232 msgid "" -"For the *isolation_level* parameter, please see the :attr:`~Connection." -"isolation_level` property of :class:`Connection` objects." +"How many seconds the connection should wait before raising an exception, if " +"the database is locked by another connection. If another connection opens a " +"transaction to modify the database, it will be locked until that transaction " +"is committed. Default five seconds." msgstr "" #: ../../library/sqlite3.rst:240 msgid "" -"SQLite natively supports only the types TEXT, INTEGER, REAL, BLOB and NULL. " -"If you want to use other types you must add support for them yourself. The " -"*detect_types* parameter and using custom **converters** registered with the " -"module-level :func:`register_converter` function allow you to easily do that." -msgstr "" - -#: ../../library/sqlite3.rst:245 -msgid "" -"*detect_types* defaults to 0 (type detection disabled). Set it to any " +"Control whether and how data types not :ref:`natively supported by SQLite " +"` are looked up to be converted to Python types, using the " +"converters registered with :func:`register_converter`. Set it to any " "combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" -"`PARSE_COLNAMES` to enable type detection. Column names takes precedence " -"over declared types if both flags are set. Types cannot be detected for " -"generated fields (for example ``max(data)``), even when the *detect_types* " -"parameter is set. In such cases, the returned type is :class:`str`." +"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " +"types if both flags are set. Types cannot be detected for generated fields " +"(for example ``max(data)``), even when the *detect_types* parameter is set; :" +"class:`str` will be returned instead. By default (``0``), type detection is " +"disabled." msgstr "" -#: ../../library/sqlite3.rst:254 +#: ../../library/sqlite3.rst:255 msgid "" -"By default, *check_same_thread* is :const:`True` and only the creating " -"thread may use the connection. If set :const:`False`, the returned " -"connection may be shared across multiple threads. When using multiple " -"threads with the same connection writing operations should be serialized by " -"the user to avoid data corruption." +"The :attr:`~Connection.isolation_level` of the connection, controlling " +"whether and how transactions are implicitly opened. Can be ``\"DEFERRED\"`` " +"(default), ``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or :const:`None` to " +"disable opening transactions implicitly. See :ref:`sqlite3-controlling-" +"transactions` for more." msgstr "" -#: ../../library/sqlite3.rst:259 +#: ../../library/sqlite3.rst:263 msgid "" -"By default, the :mod:`sqlite3` module uses its :class:`Connection` class for " -"the connect call. You can, however, subclass the :class:`Connection` class " -"and make :func:`connect` use your class instead by providing your class for " -"the *factory* parameter." +"If :const:`True` (default), only the creating thread may use the connection. " +"If :const:`False`, the connection may be shared across multiple threads; if " +"so, write operations should be serialized by the user to avoid data " +"corruption." msgstr "" -#: ../../library/sqlite3.rst:264 -msgid "Consult the section :ref:`sqlite3-types` of this manual for details." +#: ../../library/sqlite3.rst:270 +msgid "" +"A custom subclass of :class:`Connection` to create the connection with, if " +"not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:266 +#: ../../library/sqlite3.rst:275 msgid "" -"The :mod:`sqlite3` module internally uses a statement cache to avoid SQL " -"parsing overhead. If you want to explicitly set the number of statements " -"that are cached for the connection, you can set the *cached_statements* " -"parameter. The currently implemented default is to cache 100 statements." +"The number of statements that ``sqlite3`` should internally cache for this " +"connection, to avoid parsing overhead. By default, 100 statements." msgstr "" -#: ../../library/sqlite3.rst:271 +#: ../../library/sqlite3.rst:281 msgid "" -"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::" +"If set to :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:\"``, and the path can be relative or " +"absolute. The query string allows passing parameters to SQLite, enabling " +"various :ref:`sqlite3-uri-tricks`." msgstr "" -#: ../../library/sqlite3.rst:290 -msgid "" -"More information about this feature, including a list of recognized " -"parameters, can be found in the `SQLite URI documentation `_." +#: ../../library/sqlite3.rst:0 +msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:294 +#: ../../library/sqlite3.rst:293 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -#: ../../library/sqlite3.rst:295 +#: ../../library/sqlite3.rst:294 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" -#: ../../library/sqlite3.rst:297 -msgid "Added the *uri* parameter." -msgstr "新增 *uri* 參數。" +#: ../../library/sqlite3.rst:296 +msgid "The *uri* parameter." +msgstr "*uri* 參數。" -#: ../../library/sqlite3.rst:300 +#: ../../library/sqlite3.rst:299 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:303 -msgid "Added the ``sqlite3.connect/handle`` auditing event." +#: ../../library/sqlite3.rst:302 +msgid "The ``sqlite3.connect/handle`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:309 +#: ../../library/sqlite3.rst:308 msgid "" "Register the *converter* callable to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -347,13 +332,13 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:317 +#: ../../library/sqlite3.rst:316 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:323 +#: ../../library/sqlite3.rst:322 msgid "" "Register an *adapter* callable to adapt the Python type *type* into an " "SQLite type. The adapter is called with a Python object of type *type* as " @@ -361,7 +346,7 @@ msgid "" "natively understands`." msgstr "" -#: ../../library/sqlite3.rst:332 +#: ../../library/sqlite3.rst:331 msgid "" "Returns :const:`True` if the string *statement* contains one or more " "complete SQL statements terminated by semicolons. It does not verify that " @@ -369,12 +354,12 @@ msgid "" "literals and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:337 +#: ../../library/sqlite3.rst:336 msgid "" "This can be used to build a shell for SQLite, as in the following example:" msgstr "" -#: ../../library/sqlite3.rst:345 +#: ../../library/sqlite3.rst:344 msgid "" "By default you will not get any tracebacks in user-defined functions, " "aggregates, converters, authorizer callbacks etc. If you want to debug them, " @@ -383,72 +368,87 @@ msgid "" "disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:355 +#: ../../library/sqlite3.rst:354 msgid "Connection Objects" msgstr "" -#: ../../library/sqlite3.rst:359 +#: ../../library/sqlite3.rst:358 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:363 +#: ../../library/sqlite3.rst:362 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." +"This attribute controls the :ref:`transaction handling ` performed by ``sqlite3``. If set to :const:`None`, " +"transactions are never implicitly opened. If set to one of ``\"DEFERRED\"``, " +"``\"IMMEDIATE\"``, or ``\"EXCLUSIVE\"``, corresponding to the underlying " +"`SQLite transaction behaviour`_, implicit :ref:`transaction management " +"` is performed." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:370 +msgid "" +"If not overridden by the *isolation_level* parameter of :func:`connect`, the " +"default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." +msgstr "" + +#: ../../library/sqlite3.rst:375 +msgid "" +"This read-only attribute corresponds to the low-level SQLite `autocommit " +"mode`_." +msgstr "" + +#: ../../library/sqlite3.rst:378 msgid "" ":const:`True` if a transaction is active (there are uncommitted changes), :" -"const:`False` otherwise. Read-only attribute." +"const:`False` otherwise." msgstr "" -#: ../../library/sqlite3.rst:376 +#: ../../library/sqlite3.rst:385 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:382 +#: ../../library/sqlite3.rst:391 msgid "" "Commit any pending transaction to the database. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:387 +#: ../../library/sqlite3.rst:396 msgid "" "Roll back to the start of any pending transaction. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:392 +#: ../../library/sqlite3.rst:401 msgid "" "Close the database connection. Any pending transaction is not committed " "implicitly; make sure to :meth:`commit` before closing to avoid losing " "pending changes." msgstr "" -#: ../../library/sqlite3.rst:399 +#: ../../library/sqlite3.rst:408 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:405 +#: ../../library/sqlite3.rst:414 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:411 +#: ../../library/sqlite3.rst:420 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:417 +#: ../../library/sqlite3.rst:426 msgid "" "Creates a user-defined function that you can later use from within SQL " "statements under the function name *name*. *narg* is the number of " @@ -461,26 +461,26 @@ msgid "" "versions." msgstr "" -#: ../../library/sqlite3.rst:427 +#: ../../library/sqlite3.rst:436 msgid "" -"The function can return any of the types supported by SQLite: bytes, str, " -"int, float and ``None``." +"The function can return any of :ref:`the types natively supported by SQLite " +"`." msgstr "" -#: ../../library/sqlite3.rst:430 +#: ../../library/sqlite3.rst:439 msgid "The *deterministic* parameter was added." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:433 ../../library/sqlite3.rst:450 -#: ../../library/sqlite3.rst:579 ../../library/sqlite3.rst:730 +#: ../../library/sqlite3.rst:442 ../../library/sqlite3.rst:459 +#: ../../library/sqlite3.rst:588 ../../library/sqlite3.rst:746 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:440 +#: ../../library/sqlite3.rst:449 msgid "Creates a user-defined aggregate function." msgstr "" -#: ../../library/sqlite3.rst:442 +#: ../../library/sqlite3.rst:451 msgid "" "The aggregate class must implement a ``step`` method, which accepts the " "number of parameters *n_arg* (if *n_arg* is -1, the function may take any " @@ -488,47 +488,47 @@ msgid "" "result of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:447 +#: ../../library/sqlite3.rst:456 msgid "" -"The ``finalize`` method can return any of the types supported by SQLite: " -"bytes, str, int, float and ``None``." +"The ``finalize`` method can return any of :ref:`the types natively supported " +"by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:457 +#: ../../library/sqlite3.rst:466 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:461 +#: ../../library/sqlite3.rst:470 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:462 +#: ../../library/sqlite3.rst:471 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:463 +#: ../../library/sqlite3.rst:472 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:465 +#: ../../library/sqlite3.rst:474 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:469 +#: ../../library/sqlite3.rst:478 msgid "Remove a collation function by setting *callable* to :const:`None`." msgstr "" -#: ../../library/sqlite3.rst:474 +#: ../../library/sqlite3.rst:483 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:481 +#: ../../library/sqlite3.rst:490 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 :" @@ -538,7 +538,7 @@ msgid "" "in the :mod:`sqlite3` module." msgstr "" -#: ../../library/sqlite3.rst:488 +#: ../../library/sqlite3.rst:497 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` " @@ -549,7 +549,7 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:495 +#: ../../library/sqlite3.rst:504 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 " @@ -557,7 +557,7 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:502 +#: ../../library/sqlite3.rst:511 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 " @@ -565,26 +565,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:507 +#: ../../library/sqlite3.rst:516 msgid "" "If you want to clear any previously installed progress handler, call the " "method with :const:`None` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:510 +#: ../../library/sqlite3.rst:519 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:517 +#: ../../library/sqlite3.rst:526 msgid "" "Registers *trace_callback* to be called for each SQL statement that is " "actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:520 +#: ../../library/sqlite3.rst:529 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 " @@ -594,19 +594,19 @@ msgid "" "of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:528 +#: ../../library/sqlite3.rst:537 msgid "" "Passing :const:`None` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:531 +#: ../../library/sqlite3.rst:540 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:541 +#: ../../library/sqlite3.rst:550 msgid "" "This routine allows/disallows the SQLite engine to load SQLite extensions " "from shared libraries. SQLite extensions can define new functions, " @@ -614,38 +614,38 @@ msgid "" "extension is the fulltext-search extension distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:546 ../../library/sqlite3.rst:563 +#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:572 msgid "Loadable extensions are disabled by default. See [#f1]_." msgstr "" -#: ../../library/sqlite3.rst:548 +#: ../../library/sqlite3.rst:557 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:552 +#: ../../library/sqlite3.rst:561 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:559 +#: ../../library/sqlite3.rst:568 msgid "" "This routine loads an 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:565 +#: ../../library/sqlite3.rst:574 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:569 +#: ../../library/sqlite3.rst:578 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:574 +#: ../../library/sqlite3.rst:583 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 " @@ -653,7 +653,7 @@ msgid "" "object that can also access columns by name." msgstr "" -#: ../../library/sqlite3.rst:583 +#: ../../library/sqlite3.rst:592 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 " @@ -663,7 +663,7 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:595 +#: ../../library/sqlite3.rst:604 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 " @@ -671,23 +671,23 @@ msgid "" "you want to return :class:`bytes` instead, you can set it to :class:`bytes`." msgstr "" -#: ../../library/sqlite3.rst:600 +#: ../../library/sqlite3.rst:609 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:603 +#: ../../library/sqlite3.rst:612 msgid "See the following example code for illustration:" msgstr "" -#: ../../library/sqlite3.rst:610 +#: ../../library/sqlite3.rst:619 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:616 +#: ../../library/sqlite3.rst:625 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 " @@ -695,14 +695,14 @@ msgid "" "shell." msgstr "" -#: ../../library/sqlite3.rst:621 +#: ../../library/sqlite3.rst:630 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/sqlite3.rst:635 +#: ../../library/sqlite3.rst:644 msgid "" "This method makes a backup of an SQLite database even while it's being " "accessed by other clients, or concurrently by the same connection. The copy " @@ -710,14 +710,14 @@ msgid "" "class:`Connection` instance." msgstr "" -#: ../../library/sqlite3.rst:640 +#: ../../library/sqlite3.rst:649 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:644 +#: ../../library/sqlite3.rst:653 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, " @@ -725,7 +725,7 @@ msgid "" "pages still to be copied and the *total* number of pages." msgstr "" -#: ../../library/sqlite3.rst:649 +#: ../../library/sqlite3.rst:658 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 " @@ -734,36 +734,36 @@ msgid "" "an attached database." msgstr "" -#: ../../library/sqlite3.rst:655 +#: ../../library/sqlite3.rst:664 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:659 +#: ../../library/sqlite3.rst:668 msgid "Example 1, copy an existing database into another::" msgstr "" -#: ../../library/sqlite3.rst:673 +#: ../../library/sqlite3.rst:682 msgid "Example 2, copy an existing database into a transient copy::" msgstr "" -#: ../../library/sqlite3.rst:687 +#: ../../library/sqlite3.rst:696 msgid "Cursor Objects" msgstr "" -#: ../../library/sqlite3.rst:691 +#: ../../library/sqlite3.rst:700 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:698 +#: ../../library/sqlite3.rst:707 msgid "" -"Executes an SQL statement. Values may be bound to the statement using :ref:" +"Execute an SQL statement. Values may be bound to the statement using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:710 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`. " @@ -771,43 +771,52 @@ msgid "" "with one call." msgstr "" -#: ../../library/sqlite3.rst:709 +#: ../../library/sqlite3.rst:715 msgid "" -"Executes a :ref:`parameterized ` SQL command against " +"If :attr:`~Connection.isolation_level` is not :const:`None`, *sql* is an " +"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " +"no open transaction, a transaction is implicitly opened before executing " +"*sql*." +msgstr "" + +#: ../../library/sqlite3.rst:723 +msgid "" +"Execute a :ref:`parameterized ` SQL command against " "all parameter sequences or mappings found in the sequence " -"*seq_of_parameters*. The :mod:`sqlite3` module also allows using an :term:" -"`iterator` yielding parameters instead of a sequence." +"*seq_of_parameters*. It is also possible to use an :term:`iterator` " +"yielding parameters instead of a sequence. Uses the same implicit " +"transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:716 +#: ../../library/sqlite3.rst:731 msgid "Here's a shorter example using a :term:`generator`:" msgstr "" -#: ../../library/sqlite3.rst:723 +#: ../../library/sqlite3.rst:738 msgid "" -"This is a nonstandard convenience method for executing multiple SQL " -"statements at once. It issues a ``COMMIT`` statement first, then executes " -"the SQL script it gets as a parameter. This method disregards :attr:" -"`isolation_level`; any transaction control must be added to *sql_script*." +"Execute multiple SQL statements at once. If there is a pending transaciton, " +"an implicit ``COMMIT`` statement is executed first. No other implicit " +"transaction control is performed; any transaction control must be added to " +"*sql_script*." msgstr "" -#: ../../library/sqlite3.rst:728 -msgid "*sql_script* can be an instance of :class:`str`." +#: ../../library/sqlite3.rst:744 +msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:737 +#: ../../library/sqlite3.rst:753 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:743 +#: ../../library/sqlite3.rst:759 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:746 +#: ../../library/sqlite3.rst:762 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 " @@ -816,7 +825,7 @@ msgid "" "not being available, fewer rows may be returned." msgstr "" -#: ../../library/sqlite3.rst:752 +#: ../../library/sqlite3.rst:768 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -824,42 +833,42 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:775 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:765 +#: ../../library/sqlite3.rst:781 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:767 +#: ../../library/sqlite3.rst:783 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:772 ../../library/sqlite3.rst:776 +#: ../../library/sqlite3.rst:788 ../../library/sqlite3.rst:792 msgid "Required by the DB-API. Does nothing in :mod:`sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:780 +#: ../../library/sqlite3.rst:796 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:784 +#: ../../library/sqlite3.rst:800 msgid "" "For :meth:`executemany` statements, the number of modifications are summed " "up into :attr:`rowcount`." msgstr "" -#: ../../library/sqlite3.rst:787 +#: ../../library/sqlite3.rst:803 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 " @@ -868,7 +877,7 @@ msgid "" "rows a query produced until all rows were fetched." msgstr "" -#: ../../library/sqlite3.rst:795 +#: ../../library/sqlite3.rst:811 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 " @@ -878,33 +887,33 @@ msgid "" "const:`None`." msgstr "" -#: ../../library/sqlite3.rst:803 +#: ../../library/sqlite3.rst:819 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:805 +#: ../../library/sqlite3.rst:821 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:810 +#: ../../library/sqlite3.rst:826 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:815 +#: ../../library/sqlite3.rst:831 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:819 +#: ../../library/sqlite3.rst:835 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:839 msgid "" "This read-only attribute provides the SQLite database :class:`Connection` " "used by the :class:`Cursor` object. A :class:`Cursor` object created by " @@ -912,56 +921,67 @@ msgid "" "`connection` attribute that refers to *con*::" msgstr "" -#: ../../library/sqlite3.rst:836 +#: ../../library/sqlite3.rst:852 msgid "Row Objects" msgstr "" -#: ../../library/sqlite3.rst:840 +#: ../../library/sqlite3.rst:856 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:844 +#: ../../library/sqlite3.rst:860 msgid "" "It supports mapping access by column name and index, iteration, " "representation, equality testing and :func:`len`." msgstr "" -#: ../../library/sqlite3.rst:847 +#: ../../library/sqlite3.rst:863 msgid "" "If two :class:`Row` objects have exactly the same columns and their members " "are equal, they compare equal." msgstr "" -#: ../../library/sqlite3.rst:852 +#: ../../library/sqlite3.rst:868 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:855 +#: ../../library/sqlite3.rst:871 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:858 +#: ../../library/sqlite3.rst:874 msgid "Let's assume we initialize a table as in the example given above::" msgstr "" -#: ../../library/sqlite3.rst:870 +#: ../../library/sqlite3.rst:886 msgid "Now we plug :class:`Row` in::" msgstr "" -#: ../../library/sqlite3.rst:902 +#: ../../library/sqlite3.rst:916 +msgid "PrepareProtocol Objects" +msgstr "" + +#: ../../library/sqlite3.rst:920 +msgid "" +"The PrepareProtocol type's single purpose is to act as a :pep:`246` style " +"adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." +msgstr "" + +#: ../../library/sqlite3.rst:928 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:904 +#: ../../library/sqlite3.rst:930 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:908 +#: ../../library/sqlite3.rst:934 msgid "" "This exception is raised by ``sqlite3`` if an SQL query is not a :class:" "`string `, or if multiple statements are passed to :meth:`~Cursor." @@ -969,21 +989,21 @@ msgid "" "`Exception`." msgstr "" -#: ../../library/sqlite3.rst:915 +#: ../../library/sqlite3.rst:941 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:921 +#: ../../library/sqlite3.rst:947 msgid "" "This exception is raised by ``sqlite3`` for fetch across rollback, or if " "``sqlite3`` is unable to bind parameters. ``InterfaceError`` is a subclass " "of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:927 +#: ../../library/sqlite3.rst:953 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -991,14 +1011,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:934 +#: ../../library/sqlite3.rst:960 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:940 +#: ../../library/sqlite3.rst:966 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1006,20 +1026,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:974 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:953 +#: ../../library/sqlite3.rst:979 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:960 +#: ../../library/sqlite3.rst:986 msgid "" "Exception raised for ``sqlite3`` API programming errors, for example trying " "to operate on a closed :class:`Connection`, or trying to execute non-DML " @@ -1027,7 +1047,7 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:967 +#: ../../library/sqlite3.rst:993 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to :const:" @@ -1036,82 +1056,82 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:977 +#: ../../library/sqlite3.rst:1003 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:981 +#: ../../library/sqlite3.rst:1007 msgid "Introduction" msgstr "簡介" -#: ../../library/sqlite3.rst:983 +#: ../../library/sqlite3.rst:1009 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:986 +#: ../../library/sqlite3.rst:1012 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:989 ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1015 ../../library/sqlite3.rst:1032 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:989 ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1015 ../../library/sqlite3.rst:1032 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:991 ../../library/sqlite3.rst:1008 +#: ../../library/sqlite3.rst:1017 ../../library/sqlite3.rst:1034 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/sqlite3.rst:991 ../../library/sqlite3.rst:1008 +#: ../../library/sqlite3.rst:1017 ../../library/sqlite3.rst:1034 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:993 ../../library/sqlite3.rst:1010 +#: ../../library/sqlite3.rst:1019 ../../library/sqlite3.rst:1036 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:993 ../../library/sqlite3.rst:1010 +#: ../../library/sqlite3.rst:1019 ../../library/sqlite3.rst:1036 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:995 ../../library/sqlite3.rst:1012 +#: ../../library/sqlite3.rst:1021 ../../library/sqlite3.rst:1038 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:995 ../../library/sqlite3.rst:1012 +#: ../../library/sqlite3.rst:1021 ../../library/sqlite3.rst:1038 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:997 +#: ../../library/sqlite3.rst:1023 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:997 ../../library/sqlite3.rst:1014 +#: ../../library/sqlite3.rst:1023 ../../library/sqlite3.rst:1040 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:999 ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1025 ../../library/sqlite3.rst:1043 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:999 ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1025 ../../library/sqlite3.rst:1043 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1003 +#: ../../library/sqlite3.rst:1029 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1014 +#: ../../library/sqlite3.rst:1040 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1046 msgid "" "The type system of the :mod:`sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via object " @@ -1119,18 +1139,18 @@ msgid "" "to different Python types via converters." msgstr "" -#: ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1053 msgid "Using adapters to store custom Python types in SQLite databases" msgstr "" -#: ../../library/sqlite3.rst:1029 +#: ../../library/sqlite3.rst:1055 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands`." msgstr "" -#: ../../library/sqlite3.rst:1033 +#: ../../library/sqlite3.rst:1059 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -1140,11 +1160,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1043 +#: ../../library/sqlite3.rst:1071 msgid "Letting your object adapt itself" msgstr "" -#: ../../library/sqlite3.rst:1045 +#: ../../library/sqlite3.rst:1073 msgid "" "Suppose we have a ``Point`` class that represents a pair of coordinates, " "``x`` and ``y``, in a Cartesian coordinate system. The coordinate pair will " @@ -1154,107 +1174,107 @@ msgid "" "*protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1057 +#: ../../library/sqlite3.rst:1085 msgid "Registering an adapter callable" msgstr "" -#: ../../library/sqlite3.rst:1059 +#: ../../library/sqlite3.rst:1087 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1067 +#: ../../library/sqlite3.rst:1095 msgid "Converting SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1069 +#: ../../library/sqlite3.rst:1097 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:1074 +#: ../../library/sqlite3.rst:1102 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:1077 +#: ../../library/sqlite3.rst:1105 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:1082 +#: ../../library/sqlite3.rst:1110 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:1091 +#: ../../library/sqlite3.rst:1119 msgid "" "We now need to tell ``sqlite3`` when it should convert a given SQLite value. " "This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:1095 +#: ../../library/sqlite3.rst:1123 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:1096 +#: ../../library/sqlite3.rst:1124 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:1097 +#: ../../library/sqlite3.rst:1125 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Colum names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:1101 +#: ../../library/sqlite3.rst:1129 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:1107 +#: ../../library/sqlite3.rst:1135 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1109 +#: ../../library/sqlite3.rst:1137 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:1112 +#: ../../library/sqlite3.rst:1140 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:1116 +#: ../../library/sqlite3.rst:1144 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:1120 +#: ../../library/sqlite3.rst:1148 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1124 +#: ../../library/sqlite3.rst:1152 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:1130 +#: ../../library/sqlite3.rst:1158 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1262,80 +1282,97 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1139 +#: ../../library/sqlite3.rst:1167 msgid "Adapter and Converter Recipes" msgstr "" -#: ../../library/sqlite3.rst:1141 +#: ../../library/sqlite3.rst:1169 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:1184 +#: ../../library/sqlite3.rst:1212 msgid "Controlling Transactions" msgstr "" -#: ../../library/sqlite3.rst:1186 +#: ../../library/sqlite3.rst:1214 msgid "" -"The underlying ``sqlite3`` library operates in ``autocommit`` mode by " -"default, but the Python :mod:`sqlite3` module by default does not." +"The ``sqlite3`` module does not adhere to the transaction handling " +"recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:1189 +#: ../../library/sqlite3.rst:1217 msgid "" -"``autocommit`` mode means that statements that modify the database take " -"effect immediately. A ``BEGIN`` or ``SAVEPOINT`` statement disables " -"``autocommit`` mode, and a ``COMMIT``, a ``ROLLBACK``, or a ``RELEASE`` that " -"ends the outermost transaction, turns ``autocommit`` mode back on." +"If the connection attribute :attr:`~Connection.isolation_level` is not :" +"const:`None`, new transactions are implicitly opened before :meth:`~Cursor." +"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " +"``DELETE``, or ``REPLACE`` statements. Use the :meth:`~Connection.commit` " +"and :meth:`~Connection.rollback` methods to respectively commit and roll " +"back pending transactions. You can choose the underlying `SQLite transaction " +"behaviour`_ — that is, whether and what type of ``BEGIN`` statements " +"``sqlite3`` implicitly executes – via the :attr:`~Connection." +"isolation_level` attribute." msgstr "" -#: ../../library/sqlite3.rst:1194 +#: ../../library/sqlite3.rst:1229 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``)." +"If :attr:`~Connection.isolation_level` is set to :const:`None`, no " +"transactions are implicitly opened at all. This leaves the underlying SQLite " +"library in `autocommit mode`_, but also allows the user to perform their own " +"transaction handling using explicit SQL statements. The underlying SQLite " +"library autocommit mode can be queried using the :attr:`~Connection." +"in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:1198 +#: ../../library/sqlite3.rst:1237 msgid "" -"You can control which kind of ``BEGIN`` statements :mod:`sqlite3` implicitly " -"executes via the *isolation_level* parameter to the :func:`connect` call, or " -"via the :attr:`isolation_level` property of connections. If you specify no " -"*isolation_level*, a plain ``BEGIN`` is used, which is equivalent to " -"specifying ``DEFERRED``. Other possible values are ``IMMEDIATE`` and " -"``EXCLUSIVE``." +"The :meth:`~Cursor.executescript` method implicitly commits any pending " +"transaction before execution of the given SQL script, regardless of the " +"value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:1205 +#: ../../library/sqlite3.rst:1241 msgid "" -"You can disable the :mod:`sqlite3` module's implicit transaction management " -"by setting :attr:`isolation_level` to ``None``. This will leave the " -"underlying ``sqlite3`` library operating in ``autocommit`` mode. You can " -"then completely control the transaction state by explicitly issuing " -"``BEGIN``, ``ROLLBACK``, ``SAVEPOINT``, and ``RELEASE`` statements in your " -"code." +":mod:`sqlite3` used to implicitly commit an open transaction before DDL " +"statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1211 +#: ../../library/sqlite3.rst:1255 +msgid "SQLite URI tricks" +msgstr "" + +#: ../../library/sqlite3.rst:1257 +msgid "Some useful URI tricks include:" +msgstr "" + +#: ../../library/sqlite3.rst:1259 +msgid "Open a database in read-only mode::" +msgstr "" + +#: ../../library/sqlite3.rst:1263 msgid "" -"Note that :meth:`~Cursor.executescript` disregards :attr:`isolation_level`; " -"any transaction control must be added explicitly." +"Do not implicitly create a new database file if it does not already exist; " +"will raise :exc:`~sqlite3.OperationalError` if unable to create a new file::" msgstr "" -#: ../../library/sqlite3.rst:1214 +#: ../../library/sqlite3.rst:1268 +msgid "Create a shared named in-memory database::" +msgstr "" + +#: ../../library/sqlite3.rst:1277 msgid "" -":mod:`sqlite3` used to implicitly commit an open transaction before DDL " -"statements. This is no longer the case." +"More information about this feature, including a list of parameters, can be " +"found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:1220 +#: ../../library/sqlite3.rst:1283 msgid "Using :mod:`sqlite3` efficiently" msgstr "" -#: ../../library/sqlite3.rst:1224 +#: ../../library/sqlite3.rst:1287 msgid "Using shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1226 +#: ../../library/sqlite3.rst:1289 msgid "" "Using the nonstandard :meth:`execute`, :meth:`executemany` and :meth:" "`executescript` methods of the :class:`Connection` object, your code can be " @@ -1347,27 +1384,27 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:1238 +#: ../../library/sqlite3.rst:1301 msgid "Accessing columns by name instead of by index" msgstr "" -#: ../../library/sqlite3.rst:1240 +#: ../../library/sqlite3.rst:1303 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:1243 +#: ../../library/sqlite3.rst:1306 msgid "" "Rows wrapped with this class can be accessed both by index (like tuples) and " "case-insensitively by name:" msgstr "" -#: ../../library/sqlite3.rst:1252 +#: ../../library/sqlite3.rst:1315 msgid "Using the connection as a context manager" msgstr "" -#: ../../library/sqlite3.rst:1254 +#: ../../library/sqlite3.rst:1317 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1377,23 +1414,23 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1326 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:1268 +#: ../../library/sqlite3.rst:1331 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:1275 +#: ../../library/sqlite3.rst:1338 msgid "Footnotes" msgstr "註解" -#: ../../library/sqlite3.rst:1276 +#: ../../library/sqlite3.rst:1339 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/statistics.po b/library/statistics.po index 5553a9246b..6f232b2bf8 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-07-11 00:15+0000\n" "PO-Revision-Date: 2018-07-27 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,199 +54,210 @@ msgid "" "example: ``map(float, input_data)``." msgstr "" -#: ../../library/statistics.rst:39 +#: ../../library/statistics.rst:38 +msgid "" +"Some datasets use ``NaN`` (not a number) values to represent missing data. " +"Since NaNs have unusual comparison semantics, they cause surprising or " +"undefined behaviors in the statistics functions that sort data or that count " +"occurrences. The functions affected are ``median()``, ``median_low()``, " +"``median_high()``, ``median_grouped()``, ``mode()``, ``multimode()``, and " +"``quantiles()``. The ``NaN`` values should be stripped before calling these " +"functions::" +msgstr "" + +#: ../../library/statistics.rst:68 msgid "Averages and measures of central location" msgstr "平均值與中央位置量數" -#: ../../library/statistics.rst:41 +#: ../../library/statistics.rst:70 msgid "" "These functions calculate an average or typical value from a population or " "sample." msgstr "這些函式計算來自一個母體或樣本的平均值或代表值。" -#: ../../library/statistics.rst:45 +#: ../../library/statistics.rst:74 msgid ":func:`mean`" msgstr ":func:`mean`" -#: ../../library/statistics.rst:45 +#: ../../library/statistics.rst:74 msgid "Arithmetic mean (\"average\") of data." msgstr "數據的算術平均(平均值)。" -#: ../../library/statistics.rst:46 +#: ../../library/statistics.rst:75 msgid ":func:`fmean`" msgstr ":func:`fmean`" -#: ../../library/statistics.rst:46 +#: ../../library/statistics.rst:75 msgid "Fast, floating point arithmetic mean." msgstr "" -#: ../../library/statistics.rst:47 +#: ../../library/statistics.rst:76 msgid ":func:`geometric_mean`" msgstr ":func:`geometric_mean`" -#: ../../library/statistics.rst:47 +#: ../../library/statistics.rst:76 #, fuzzy msgid "Geometric mean of data." msgstr "數據中較小的中位數。" -#: ../../library/statistics.rst:48 +#: ../../library/statistics.rst:77 msgid ":func:`harmonic_mean`" msgstr ":func:`harmonic_mean`" -#: ../../library/statistics.rst:48 +#: ../../library/statistics.rst:77 msgid "Harmonic mean of data." msgstr "" -#: ../../library/statistics.rst:49 +#: ../../library/statistics.rst:78 msgid ":func:`median`" msgstr ":func:`median`" -#: ../../library/statistics.rst:49 +#: ../../library/statistics.rst:78 msgid "Median (middle value) of data." msgstr "數據的中位數(中間值)。" -#: ../../library/statistics.rst:50 +#: ../../library/statistics.rst:79 msgid ":func:`median_low`" msgstr ":func:`median_low`" -#: ../../library/statistics.rst:50 +#: ../../library/statistics.rst:79 msgid "Low median of data." msgstr "數據中較小的中位數。" -#: ../../library/statistics.rst:51 +#: ../../library/statistics.rst:80 msgid ":func:`median_high`" msgstr ":func:`median_high`" -#: ../../library/statistics.rst:51 +#: ../../library/statistics.rst:80 msgid "High median of data." msgstr "數據中較大的中位數。" -#: ../../library/statistics.rst:52 +#: ../../library/statistics.rst:81 msgid ":func:`median_grouped`" msgstr ":func:`median_grouped`" -#: ../../library/statistics.rst:52 +#: ../../library/statistics.rst:81 msgid "Median, or 50th percentile, of grouped data." msgstr "分組數據的中位數或50%處。" -#: ../../library/statistics.rst:53 +#: ../../library/statistics.rst:82 msgid ":func:`mode`" msgstr ":func:`mode`" -#: ../../library/statistics.rst:53 +#: ../../library/statistics.rst:82 #, fuzzy msgid "Single mode (most common value) of discrete or nominal data." msgstr "離散資料中的眾數(出現次數最多次)。" -#: ../../library/statistics.rst:54 +#: ../../library/statistics.rst:83 msgid ":func:`multimode`" msgstr ":func:`multimode`" -#: ../../library/statistics.rst:54 +#: ../../library/statistics.rst:83 #, fuzzy msgid "List of modes (most common values) of discrete or nominal data." msgstr "離散資料中的眾數(出現次數最多次)。" -#: ../../library/statistics.rst:55 +#: ../../library/statistics.rst:84 msgid ":func:`quantiles`" msgstr ":func:`quantiles`" -#: ../../library/statistics.rst:55 +#: ../../library/statistics.rst:84 msgid "Divide data into intervals with equal probability." msgstr "" -#: ../../library/statistics.rst:59 +#: ../../library/statistics.rst:88 msgid "Measures of spread" msgstr "離度 (spread) 的測量" -#: ../../library/statistics.rst:61 +#: ../../library/statistics.rst:90 msgid "" "These functions calculate a measure of how much the population or sample " "tends to deviate from the typical or average values." msgstr "這些函式計算母體或樣本偏離平均值的程度。" -#: ../../library/statistics.rst:65 +#: ../../library/statistics.rst:94 msgid ":func:`pstdev`" msgstr ":func:`pstdev`" -#: ../../library/statistics.rst:65 +#: ../../library/statistics.rst:94 msgid "Population standard deviation of data." msgstr "數據的母體標準差" -#: ../../library/statistics.rst:66 +#: ../../library/statistics.rst:95 msgid ":func:`pvariance`" msgstr ":func:`pvariance`" -#: ../../library/statistics.rst:66 +#: ../../library/statistics.rst:95 msgid "Population variance of data." msgstr "數據的母體變異數" -#: ../../library/statistics.rst:67 +#: ../../library/statistics.rst:96 msgid ":func:`stdev`" msgstr ":func:`stdev`" -#: ../../library/statistics.rst:67 +#: ../../library/statistics.rst:96 msgid "Sample standard deviation of data." msgstr "數據的樣本標準差" -#: ../../library/statistics.rst:68 +#: ../../library/statistics.rst:97 msgid ":func:`variance`" msgstr ":func:`variance`" -#: ../../library/statistics.rst:68 +#: ../../library/statistics.rst:97 msgid "Sample variance of data." msgstr "數據的樣本變異數" -#: ../../library/statistics.rst:72 +#: ../../library/statistics.rst:101 msgid "Statistics for relations between two inputs" msgstr "" -#: ../../library/statistics.rst:74 +#: ../../library/statistics.rst:103 msgid "" "These functions calculate statistics regarding relations between two inputs." msgstr "" -#: ../../library/statistics.rst:77 +#: ../../library/statistics.rst:106 msgid ":func:`covariance`" msgstr ":func:`covariance`" -#: ../../library/statistics.rst:77 +#: ../../library/statistics.rst:106 msgid "Sample covariance for two variables." msgstr "兩變數樣本的共變異數" -#: ../../library/statistics.rst:78 +#: ../../library/statistics.rst:107 msgid ":func:`correlation`" msgstr ":func:`correlation`" -#: ../../library/statistics.rst:78 +#: ../../library/statistics.rst:107 msgid "Pearson's correlation coefficient for two variables." msgstr "" -#: ../../library/statistics.rst:79 +#: ../../library/statistics.rst:108 msgid ":func:`linear_regression`" msgstr ":func:`linear_regression`" -#: ../../library/statistics.rst:79 +#: ../../library/statistics.rst:108 msgid "Slope and intercept for simple linear regression." msgstr "" -#: ../../library/statistics.rst:84 +#: ../../library/statistics.rst:113 msgid "Function details" msgstr "函式細節" -#: ../../library/statistics.rst:86 +#: ../../library/statistics.rst:115 msgid "" "Note: The functions do not require the data given to them to be sorted. " "However, for reading convenience, most of the examples show sorted sequences." msgstr "" -#: ../../library/statistics.rst:91 +#: ../../library/statistics.rst:120 msgid "" "Return the sample arithmetic mean of *data* which can be a sequence or " "iterable." msgstr "" -#: ../../library/statistics.rst:93 +#: ../../library/statistics.rst:122 msgid "" "The arithmetic mean is the sum of the data divided by the number of data " "points. It is commonly called \"the average\", although it is only one of " @@ -254,15 +265,15 @@ msgid "" "location of the data." msgstr "" -#: ../../library/statistics.rst:98 +#: ../../library/statistics.rst:127 msgid "If *data* is empty, :exc:`StatisticsError` will be raised." msgstr "" -#: ../../library/statistics.rst:100 +#: ../../library/statistics.rst:129 msgid "Some examples of use:" msgstr "" -#: ../../library/statistics.rst:119 +#: ../../library/statistics.rst:148 msgid "" "The mean is strongly affected by `outliers `_ and is not necessarily a typical example of the data points. For " @@ -270,7 +281,7 @@ msgid "" "`_, see :func:`median`." msgstr "" -#: ../../library/statistics.rst:125 +#: ../../library/statistics.rst:154 msgid "" "The sample mean gives an unbiased estimate of the true population mean, so " "that when taken on average over all the possible samples, ``mean(sample)`` " @@ -279,48 +290,48 @@ msgid "" "equivalent to calculating the true population mean μ." msgstr "" -#: ../../library/statistics.rst:134 +#: ../../library/statistics.rst:163 msgid "Convert *data* to floats and compute the arithmetic mean." msgstr "" -#: ../../library/statistics.rst:136 +#: ../../library/statistics.rst:165 msgid "" "This runs faster than the :func:`mean` function and it always returns a :" "class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" -#: ../../library/statistics.rst:150 +#: ../../library/statistics.rst:179 msgid "Convert *data* to floats and compute the geometric mean." msgstr "" -#: ../../library/statistics.rst:152 +#: ../../library/statistics.rst:181 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " "which uses their sum)." msgstr "" -#: ../../library/statistics.rst:156 +#: ../../library/statistics.rst:185 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " "sequence or iterable." msgstr "" -#: ../../library/statistics.rst:160 +#: ../../library/statistics.rst:189 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "" -#: ../../library/statistics.rst:173 +#: ../../library/statistics.rst:202 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " "numbers. If *weights* is omitted or *None*, then equal weighting is assumed." msgstr "" -#: ../../library/statistics.rst:177 +#: ../../library/statistics.rst:206 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -328,122 +339,122 @@ msgid "" "values is zero, the result will be zero." msgstr "" -#: ../../library/statistics.rst:182 +#: ../../library/statistics.rst:211 msgid "" "The harmonic mean is a type of average, a measure of the central location of " "the data. It is often appropriate when averaging ratios or rates, for " "example speeds." msgstr "" -#: ../../library/statistics.rst:186 +#: ../../library/statistics.rst:215 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" msgstr "" -#: ../../library/statistics.rst:194 +#: ../../library/statistics.rst:223 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " "speed?" msgstr "" -#: ../../library/statistics.rst:203 +#: ../../library/statistics.rst:232 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -#: ../../library/statistics.rst:206 +#: ../../library/statistics.rst:235 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " "(This behavior may change in the future.)" msgstr "" -#: ../../library/statistics.rst:212 +#: ../../library/statistics.rst:241 msgid "Added support for *weights*." msgstr "新增 *weights* 的支援。" -#: ../../library/statistics.rst:217 +#: ../../library/statistics.rst:246 msgid "" "Return the median (middle value) of numeric data, using the common \"mean of " "middle two\" method. If *data* is empty, :exc:`StatisticsError` is raised. " "*data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:221 +#: ../../library/statistics.rst:250 msgid "" "The median is a robust measure of central location and is less affected by " "the presence of outliers. When the number of data points is odd, the middle " "data point is returned:" msgstr "" -#: ../../library/statistics.rst:230 +#: ../../library/statistics.rst:259 msgid "" "When the number of data points is even, the median is interpolated by taking " "the average of the two middle values:" msgstr "" -#: ../../library/statistics.rst:238 +#: ../../library/statistics.rst:267 msgid "" "This is suited for when your data is discrete, and you don't mind that the " "median may not be an actual data point." msgstr "" -#: ../../library/statistics.rst:241 +#: ../../library/statistics.rst:270 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " "instead." msgstr "" -#: ../../library/statistics.rst:247 +#: ../../library/statistics.rst:276 msgid "" "Return the low median of numeric data. If *data* is empty, :exc:" "`StatisticsError` is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:250 +#: ../../library/statistics.rst:279 msgid "" "The low median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the smaller " "of the two middle values is returned." msgstr "" -#: ../../library/statistics.rst:261 +#: ../../library/statistics.rst:290 msgid "" "Use the low median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: ../../library/statistics.rst:267 +#: ../../library/statistics.rst:296 msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:270 +#: ../../library/statistics.rst:299 msgid "" "The high median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the larger of " "the two middle values is returned." msgstr "" -#: ../../library/statistics.rst:281 +#: ../../library/statistics.rst:310 msgid "" "Use the high median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: ../../library/statistics.rst:287 +#: ../../library/statistics.rst:316 msgid "" "Return the median of grouped continuous data, calculated as the 50th " "percentile, using interpolation. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -#: ../../library/statistics.rst:296 +#: ../../library/statistics.rst:325 msgid "" "In the following example, the data are rounded, so that each value " "represents the midpoint of data classes, e.g. 1 is the midpoint of the class " @@ -452,31 +463,31 @@ msgid "" "3.5--4.5, and interpolation is used to estimate it:" msgstr "" -#: ../../library/statistics.rst:307 +#: ../../library/statistics.rst:336 msgid "" "Optional argument *interval* represents the class interval, and defaults to " "1. Changing the class interval naturally will change the interpolation:" msgstr "" -#: ../../library/statistics.rst:317 +#: ../../library/statistics.rst:346 msgid "" "This function does not check whether the data points are at least *interval* " "apart." msgstr "" -#: ../../library/statistics.rst:322 +#: ../../library/statistics.rst:351 msgid "" "Under some circumstances, :func:`median_grouped` may coerce data points to " "floats. This behaviour is likely to change in the future." msgstr "" -#: ../../library/statistics.rst:327 +#: ../../library/statistics.rst:356 msgid "" "\"Statistics for the Behavioral Sciences\", Frederick J Gravetter and Larry " "B Wallnau (8th Edition)." msgstr "" -#: ../../library/statistics.rst:330 +#: ../../library/statistics.rst:359 msgid "" "The `SSMEDIAN `_ function in the Gnome Gnumeric " @@ -484,14 +495,14 @@ msgid "" "gnumeric-list/2011-April/msg00018.html>`_." msgstr "" -#: ../../library/statistics.rst:338 +#: ../../library/statistics.rst:367 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " "of central location." msgstr "" -#: ../../library/statistics.rst:342 +#: ../../library/statistics.rst:371 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " @@ -499,38 +510,38 @@ msgid "" "input *data* is empty, :exc:`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:347 +#: ../../library/statistics.rst:376 msgid "" "``mode`` assumes discrete data and returns a single value. This is the " "standard treatment of the mode as commonly taught in schools:" msgstr "" -#: ../../library/statistics.rst:355 +#: ../../library/statistics.rst:384 msgid "" "The mode is unique in that it is the only statistic in this package that " "also applies to nominal (non-numeric) data:" msgstr "" -#: ../../library/statistics.rst:363 +#: ../../library/statistics.rst:392 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." msgstr "" -#: ../../library/statistics.rst:371 +#: ../../library/statistics.rst:400 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " "are multiple modes or an empty list if the *data* is empty:" msgstr "" -#: ../../library/statistics.rst:387 +#: ../../library/statistics.rst:416 msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -#: ../../library/statistics.rst:398 +#: ../../library/statistics.rst:427 msgid "" "Return the population variance of *data*, a non-empty sequence or iterable " "of real-valued numbers. Variance, or second moment about the mean, is a " @@ -539,7 +550,7 @@ msgid "" "clustered closely around the mean." msgstr "" -#: ../../library/statistics.rst:404 +#: ../../library/statistics.rst:433 msgid "" "If the optional second argument *mu* is given, it is typically the mean of " "the *data*. It can also be used to compute the second moment around a point " @@ -547,40 +558,40 @@ msgid "" "arithmetic mean is automatically calculated." msgstr "" -#: ../../library/statistics.rst:409 +#: ../../library/statistics.rst:438 msgid "" "Use this function to calculate the variance from the entire population. To " "estimate the variance from a sample, the :func:`variance` function is " "usually a better choice." msgstr "" -#: ../../library/statistics.rst:413 +#: ../../library/statistics.rst:442 msgid "Raises :exc:`StatisticsError` if *data* is empty." msgstr "" -#: ../../library/statistics.rst:415 ../../library/statistics.rst:485 -#: ../../library/statistics.rst:589 ../../library/statistics.rst:617 +#: ../../library/statistics.rst:444 ../../library/statistics.rst:514 +#: ../../library/statistics.rst:618 ../../library/statistics.rst:646 msgid "Examples:" msgstr "範例:" -#: ../../library/statistics.rst:423 +#: ../../library/statistics.rst:452 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *mu* to avoid recalculation:" msgstr "" -#: ../../library/statistics.rst:432 +#: ../../library/statistics.rst:461 msgid "Decimals and Fractions are supported:" msgstr "" -#: ../../library/statistics.rst:446 +#: ../../library/statistics.rst:475 msgid "" "When called with the entire population, this gives the population variance " "σ². When called on a sample instead, this is the biased sample variance s², " "also known as variance with N degrees of freedom." msgstr "" -#: ../../library/statistics.rst:450 +#: ../../library/statistics.rst:479 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -589,13 +600,13 @@ msgid "" "variance." msgstr "" -#: ../../library/statistics.rst:459 +#: ../../library/statistics.rst:488 msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -#: ../../library/statistics.rst:470 +#: ../../library/statistics.rst:499 msgid "" "Return the sample variance of *data*, an iterable of at least two real-" "valued numbers. Variance, or second moment about the mean, is a measure of " @@ -604,41 +615,41 @@ msgid "" "closely around the mean." msgstr "" -#: ../../library/statistics.rst:476 +#: ../../library/statistics.rst:505 msgid "" "If the optional second argument *xbar* is given, it should be the mean of " "*data*. If it is missing or ``None`` (the default), the mean is " "automatically calculated." msgstr "" -#: ../../library/statistics.rst:480 +#: ../../library/statistics.rst:509 msgid "" "Use this function when your data is a sample from a population. To calculate " "the variance from the entire population, see :func:`pvariance`." msgstr "" -#: ../../library/statistics.rst:483 +#: ../../library/statistics.rst:512 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." msgstr "" -#: ../../library/statistics.rst:493 +#: ../../library/statistics.rst:522 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *xbar* to avoid recalculation:" msgstr "" -#: ../../library/statistics.rst:502 +#: ../../library/statistics.rst:531 msgid "" "This function does not attempt to verify that you have passed the actual " "mean as *xbar*. Using arbitrary values for *xbar* can lead to invalid or " "impossible results." msgstr "" -#: ../../library/statistics.rst:506 +#: ../../library/statistics.rst:535 msgid "Decimal and Fraction values are supported:" msgstr "" -#: ../../library/statistics.rst:520 +#: ../../library/statistics.rst:549 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " @@ -646,20 +657,20 @@ msgid "" "should be an unbiased estimate of the true population variance." msgstr "" -#: ../../library/statistics.rst:525 +#: ../../library/statistics.rst:554 msgid "" "If you somehow know the actual population mean μ you should pass it to the :" "func:`pvariance` function as the *mu* parameter to get the variance of a " "sample." msgstr "" -#: ../../library/statistics.rst:531 +#: ../../library/statistics.rst:560 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." msgstr "" -#: ../../library/statistics.rst:534 +#: ../../library/statistics.rst:563 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " @@ -667,28 +678,28 @@ msgid "" "not least 1." msgstr "" -#: ../../library/statistics.rst:539 +#: ../../library/statistics.rst:568 msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there are not at least two data points." msgstr "" -#: ../../library/statistics.rst:543 +#: ../../library/statistics.rst:572 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " "sample values, ``100`` and ``112``, the cut-point will evaluate to ``104``." msgstr "" -#: ../../library/statistics.rst:548 +#: ../../library/statistics.rst:577 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " "population." msgstr "" -#: ../../library/statistics.rst:552 +#: ../../library/statistics.rst:581 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -698,7 +709,7 @@ msgid "" "70%, 80%, 90%." msgstr "" -#: ../../library/statistics.rst:559 +#: ../../library/statistics.rst:588 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -710,19 +721,19 @@ msgid "" "80%, 90%, 100%." msgstr "" -#: ../../library/statistics.rst:583 +#: ../../library/statistics.rst:612 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." msgstr "" -#: ../../library/statistics.rst:586 +#: ../../library/statistics.rst:615 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:607 +#: ../../library/statistics.rst:636 msgid "" "Return the `Pearson's correlation coefficient `_ for two inputs. Pearson's correlation " @@ -732,13 +743,13 @@ msgid "" "linear relationship." msgstr "" -#: ../../library/statistics.rst:614 +#: ../../library/statistics.rst:643 msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:632 +#: ../../library/statistics.rst:661 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -747,11 +758,11 @@ msgid "" "this linear function:" msgstr "" -#: ../../library/statistics.rst:638 +#: ../../library/statistics.rst:667 msgid "*y = slope \\* x + intercept + noise*" msgstr "*y = slope \\* x + intercept + noise*" -#: ../../library/statistics.rst:640 +#: ../../library/statistics.rst:669 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " @@ -759,14 +770,14 @@ msgid "" "predicted and actual values of the dependent variable)." msgstr "" -#: ../../library/statistics.rst:646 +#: ../../library/statistics.rst:675 msgid "" "Both inputs must be of the same length (no less than two), and the " "independent variable *x* cannot be constant; otherwise a :exc:" "`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:650 +#: ../../library/statistics.rst:679 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " @@ -774,23 +785,23 @@ msgid "" "2019 assuming that they had kept the pace." msgstr "" -#: ../../library/statistics.rst:668 +#: ../../library/statistics.rst:697 msgid "Exceptions" msgstr "例外" -#: ../../library/statistics.rst:670 +#: ../../library/statistics.rst:699 msgid "A single exception is defined:" msgstr "" -#: ../../library/statistics.rst:674 +#: ../../library/statistics.rst:703 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." msgstr "" -#: ../../library/statistics.rst:678 +#: ../../library/statistics.rst:707 msgid ":class:`NormalDist` objects" msgstr ":class:`NormalDist` 物件" -#: ../../library/statistics.rst:680 +#: ../../library/statistics.rst:709 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_ and have a wide range of " "applications in statistics." msgstr "" -#: ../../library/statistics.rst:692 +#: ../../library/statistics.rst:721 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " "`standard deviation `_." msgstr "" -#: ../../library/statistics.rst:697 +#: ../../library/statistics.rst:726 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "" -#: ../../library/statistics.rst:701 +#: ../../library/statistics.rst:730 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:707 +#: ../../library/statistics.rst:736 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:713 +#: ../../library/statistics.rst:742 msgid "" "A read-only property for the `mode `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:719 +#: ../../library/statistics.rst:748 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." msgstr "" -#: ../../library/statistics.rst:725 +#: ../../library/statistics.rst:754 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " "deviation." msgstr "" -#: ../../library/statistics.rst:731 +#: ../../library/statistics.rst:760 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." msgstr "" -#: ../../library/statistics.rst:734 +#: ../../library/statistics.rst:763 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -862,20 +873,20 @@ msgid "" "dispersion." msgstr "" -#: ../../library/statistics.rst:742 +#: ../../library/statistics.rst:771 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -#: ../../library/statistics.rst:745 +#: ../../library/statistics.rst:774 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " "multi-threading context." msgstr "" -#: ../../library/statistics.rst:751 +#: ../../library/statistics.rst:780 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " @@ -883,7 +894,7 @@ msgid "" "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -#: ../../library/statistics.rst:757 +#: ../../library/statistics.rst:786 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word \"density" @@ -891,7 +902,7 @@ msgid "" "greater than `1.0`." msgstr "" -#: ../../library/statistics.rst:764 +#: ../../library/statistics.rst:793 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " @@ -899,7 +910,7 @@ msgid "" "is written ``P(X <= x)``." msgstr "" -#: ../../library/statistics.rst:771 +#: ../../library/statistics.rst:800 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -908,34 +919,34 @@ msgid "" "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" -#: ../../library/statistics.rst:777 +#: ../../library/statistics.rst:806 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " "probability *p*." msgstr "" -#: ../../library/statistics.rst:783 +#: ../../library/statistics.rst:812 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " "probability density functions `_." msgstr "" -#: ../../library/statistics.rst:790 +#: ../../library/statistics.rst:819 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." msgstr "" -#: ../../library/statistics.rst:794 +#: ../../library/statistics.rst:823 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " "normal distribution into 100 equal sized groups." msgstr "" -#: ../../library/statistics.rst:800 +#: ../../library/statistics.rst:829 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " @@ -943,20 +954,20 @@ msgid "" "mean) / stdev``." msgstr "" -#: ../../library/statistics.rst:808 +#: ../../library/statistics.rst:837 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " "translation and scaling. For example:" msgstr "" -#: ../../library/statistics.rst:818 +#: ../../library/statistics.rst:847 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" -#: ../../library/statistics.rst:821 +#: ../../library/statistics.rst:850 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -965,15 +976,15 @@ msgid "" "class:`NormalDist`. For example:" msgstr "" -#: ../../library/statistics.rst:841 +#: ../../library/statistics.rst:870 msgid ":class:`NormalDist` Examples and Recipes" msgstr "" -#: ../../library/statistics.rst:843 +#: ../../library/statistics.rst:872 msgid ":class:`NormalDist` readily solves classic probability problems." msgstr "" -#: ../../library/statistics.rst:845 +#: ../../library/statistics.rst:874 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -982,27 +993,27 @@ msgid "" "after rounding to the nearest whole number:" msgstr "" -#: ../../library/statistics.rst:858 +#: ../../library/statistics.rst:887 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" msgstr "" -#: ../../library/statistics.rst:868 +#: ../../library/statistics.rst:897 msgid "" "To estimate the distribution for a model than isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " "Carlo simulation `_:" msgstr "" -#: ../../library/statistics.rst:884 +#: ../../library/statistics.rst:913 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " "size is large and when the probability of a successful trial is near 50%." msgstr "" -#: ../../library/statistics.rst:889 +#: ../../library/statistics.rst:918 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1011,11 +1022,11 @@ msgid "" "probability that the Python room will stay within its capacity limits?" msgstr "" -#: ../../library/statistics.rst:920 +#: ../../library/statistics.rst:949 msgid "Normal distributions commonly arise in machine learning problems." msgstr "" -#: ../../library/statistics.rst:922 +#: ../../library/statistics.rst:951 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " @@ -1023,20 +1034,20 @@ msgid "" "distributed features including height, weight, and foot size." msgstr "" -#: ../../library/statistics.rst:927 +#: ../../library/statistics.rst:956 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " "data with :class:`NormalDist`:" msgstr "" -#: ../../library/statistics.rst:940 +#: ../../library/statistics.rst:969 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "" -#: ../../library/statistics.rst:949 +#: ../../library/statistics.rst:978 msgid "" "Starting with a 50% `prior probability `_ of being male or female, we compute the posterior as " @@ -1044,7 +1055,7 @@ msgid "" "given the gender:" msgstr "" -#: ../../library/statistics.rst:964 +#: ../../library/statistics.rst:993 msgid "" "The final prediction goes to the largest posterior. This is known as the " "`maximum a posteriori \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1113,7 +1113,7 @@ msgstr "" msgid "" "Bound type variables are particularly useful for annotating :func:" "`classmethods ` that serve as alternative constructors. In the " -"following example (© `Raymond Hettinger `_), the type variable ``C`` is bound to the ``Circle`` class " "through the use of a forward reference. Using this type variable to annotate " "the ``with_circumference`` classmethod, rather than hardcoding the return "