diff --git a/library/collections.po b/library/collections.po index 26ef916402..8be3839342 100644 --- a/library/collections.po +++ b/library/collections.po @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-20 00:14+0000\n" -"PO-Revision-Date: 2022-02-07 11:41+0800\n" +"POT-Creation-Date: 2022-02-26 00:11+0000\n" +"PO-Revision-Date: 2022-03-01 01:14+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -964,7 +964,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:764 ../../library/collections.rst:1163 +#: ../../library/collections.rst:764 ../../library/collections.rst:1180 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1340,21 +1340,27 @@ msgstr "" #: ../../library/collections.rst:1095 msgid "" -"Algorithmically, :class:`OrderedDict` can handle frequent reordering " -"operations better than :class:`dict`. This makes it suitable for tracking " -"recent accesses (for example in an `LRU cache `_)." +"The :class:`OrderedDict` algorithm can handle frequent reordering operations " +"better than :class:`dict`. As shown in the recipes below, this makes it " +"suitable for implementing various kinds of LRU caches." msgstr "" -"在演算法中,\\ :class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排" -"序操作,這讓它適合用於追蹤近期存取紀錄(例如用於 `LRU cache `_)。" +":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" +"方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1100 +#: ../../library/collections.rst:1099 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1102 +#: ../../library/collections.rst:1101 +msgid "" +"A regular :class:`dict` can emulate the order sensitive equality test with " +"``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." +msgstr "" +"一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " +"zip(p, q))`` 來效仿有檢查順序的相等性運算。" + +#: ../../library/collections.rst:1104 msgid "" "The :meth:`popitem` method of :class:`OrderedDict` has a different " "signature. It accepts an optional argument to specify which item is popped." @@ -1362,7 +1368,25 @@ msgstr "" ":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函數簽名 " "(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1105 +#: ../../library/collections.rst:1107 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " +"with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." +msgstr "" +"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." +"popitem(last=True)``\\ ,這保證會移除最右邊(最後一個)的元素。" + +#: ../../library/collections.rst:1110 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " +"with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " +"leftmost (first) item if it exists." +msgstr "" +"一個一般的 :class:`dict` 可以用 ``(k := next(iter(d)), d.pop(k))`` 來效仿 " +"OrderedDict 的 ``od.popitem(last=False)``\\ ,若最左邊(第一個)的元素存在," +"則將其回傳並移除。" + +#: ../../library/collections.rst:1114 msgid "" ":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " "reposition an element to an endpoint." @@ -1370,18 +1394,38 @@ msgstr "" ":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" "列到任一端。" -#: ../../library/collections.rst:1108 +#: ../../library/collections.rst:1117 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " +"last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " +"associated value to the rightmost (last) position." +msgstr "" +"一個一般的 :class:`dict` 可以用 ``d[k] = d.pop(k)`` 來效仿 OrderedDict 的 " +"``od.move_to_end(k, last=True)``\\ ,這會將該鍵與其對應到的值移動至最右(最後" +"面)的位置。" + +#: ../../library/collections.rst:1121 +msgid "" +"A regular :class:`dict` does not have an efficient equivalent for " +"OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " +"associated value to the leftmost (first) position." +msgstr "" +"一個一般的 :class:`dict` 沒有和 OrderedDict 的 ``od.move_to_end(k, " +"last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" +"的方法。" + +#: ../../library/collections.rst:1125 msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" -#: ../../library/collections.rst:1113 +#: ../../library/collections.rst:1130 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1120 +#: ../../library/collections.rst:1137 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1393,7 +1437,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1127 +#: ../../library/collections.rst:1144 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1403,7 +1447,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1144 +#: ../../library/collections.rst:1161 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1411,7 +1455,7 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1147 +#: ../../library/collections.rst:1164 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " @@ -1425,7 +1469,7 @@ msgstr "" "和其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不" "考慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。" -#: ../../library/collections.rst:1154 +#: ../../library/collections.rst:1171 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1433,7 +1477,7 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `" "\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1158 +#: ../../library/collections.rst:1175 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " "passed to the :class:`OrderedDict` constructor and its :meth:`update` method." @@ -1441,11 +1485,11 @@ msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1168 +#: ../../library/collections.rst:1185 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1170 +#: ../../library/collections.rst:1187 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1457,7 +1501,7 @@ msgstr "" "\n" "::" -#: ../../library/collections.rst:1182 +#: ../../library/collections.rst:1199 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1465,11 +1509,11 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1280 +#: ../../library/collections.rst:1297 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1282 +#: ../../library/collections.rst:1299 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -1480,7 +1524,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1290 +#: ../../library/collections.rst:1307 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -1492,23 +1536,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*\\ ,\\ :attr:`data` 屬性會被初" "始化為其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1296 +#: ../../library/collections.rst:1313 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,\\ :class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1301 +#: ../../library/collections.rst:1318 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1307 +#: ../../library/collections.rst:1324 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1309 +#: ../../library/collections.rst:1326 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -1519,7 +1563,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1314 +#: ../../library/collections.rst:1331 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -1528,7 +1572,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1320 +#: ../../library/collections.rst:1337 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -1541,21 +1585,21 @@ msgstr "" "list ``[]``。\\ *list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1326 +#: ../../library/collections.rst:1343 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "" "除了支援可變序列的方法與操作,\\ :class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1331 +#: ../../library/collections.rst:1348 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1334 +#: ../../library/collections.rst:1351 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -1569,7 +1613,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1341 +#: ../../library/collections.rst:1358 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -1579,11 +1623,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1347 +#: ../../library/collections.rst:1364 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1349 +#: ../../library/collections.rst:1366 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -1594,7 +1638,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1357 +#: ../../library/collections.rst:1374 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -1606,21 +1650,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,\\ *seq* 引數" "可以是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1364 +#: ../../library/collections.rst:1381 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,\\ :class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1369 +#: ../../library/collections.rst:1386 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1372 +#: ../../library/collections.rst:1389 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/subprocess.po b/library/subprocess.po index 308b7a85a3..c3734b843c 100644 --- a/library/subprocess.po +++ b/library/subprocess.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-02-26 00:11+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -161,7 +161,7 @@ msgid "" "that it ran successfully." msgstr "" -#: ../../library/subprocess.rst:127 ../../library/subprocess.rst:893 +#: ../../library/subprocess.rst:127 ../../library/subprocess.rst:895 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." @@ -289,16 +289,17 @@ msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " "values are :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a " -"positive integer), an existing file object, and ``None``. :data:`PIPE` " -"indicates that a new pipe to the child should be created. :data:`DEVNULL` " -"indicates that the special file :data:`os.devnull` will be used. With the " -"default settings of ``None``, no redirection will occur; the child's file " -"handles will be inherited from the parent. Additionally, *stderr* can be :" -"data:`STDOUT`, which indicates that the stderr data from the child process " -"should be captured into the same file handle as for *stdout*." +"positive integer), an existing file object with a valid file descriptor, and " +"``None``. :data:`PIPE` indicates that a new pipe to the child should be " +"created. :data:`DEVNULL` indicates that the special file :data:`os.devnull` " +"will be used. With the default settings of ``None``, no redirection will " +"occur; the child's file handles will be inherited from the parent. " +"Additionally, *stderr* can be :data:`STDOUT`, which indicates that the " +"stderr data from the child process should be captured into the same file " +"handle as for *stdout*." msgstr "" -#: ../../library/subprocess.rst:278 +#: ../../library/subprocess.rst:279 msgid "" "If *encoding* or *errors* are specified, or *text* (also known as " "*universal_newlines*) is true, the file objects *stdin*, *stdout* and " @@ -306,7 +307,7 @@ msgid "" "specified in the call or the defaults for :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/subprocess.rst:284 +#: ../../library/subprocess.rst:285 msgid "" "For *stdin*, line ending characters ``'\\n'`` in the input will be converted " "to the default line separator :data:`os.linesep`. For *stdout* and *stderr*, " @@ -315,28 +316,28 @@ msgid "" "when the *newline* argument to its constructor is ``None``." msgstr "" -#: ../../library/subprocess.rst:290 +#: ../../library/subprocess.rst:291 msgid "" "If text mode is not used, *stdin*, *stdout* and *stderr* will be opened as " "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: ../../library/subprocess.rst:293 +#: ../../library/subprocess.rst:294 msgid "Added *encoding* and *errors* parameters." msgstr "新增 *encoding* 與 *errors* 參數。" -#: ../../library/subprocess.rst:296 +#: ../../library/subprocess.rst:297 msgid "Added the *text* parameter as an alias for *universal_newlines*." msgstr "" -#: ../../library/subprocess.rst:301 +#: ../../library/subprocess.rst:302 msgid "" "The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." "stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." "communicate` method." msgstr "" -#: ../../library/subprocess.rst:305 +#: ../../library/subprocess.rst:306 msgid "" "If *shell* is ``True``, the specified command will be executed through the " "shell. This can be useful if you are using Python primarily for the " @@ -349,7 +350,7 @@ msgid "" "expanduser`, and :mod:`shutil`)." msgstr "" -#: ../../library/subprocess.rst:315 +#: ../../library/subprocess.rst:316 msgid "" "When *universal_newlines* is ``True``, the class uses the encoding :func:" "`locale.getpreferredencoding(False) ` instead " @@ -357,22 +358,22 @@ msgid "" "class for more information on this change." msgstr "" -#: ../../library/subprocess.rst:323 ../../library/subprocess.rst:443 +#: ../../library/subprocess.rst:324 ../../library/subprocess.rst:444 msgid "" "Read the `Security Considerations`_ section before using ``shell=True``." msgstr "" -#: ../../library/subprocess.rst:325 +#: ../../library/subprocess.rst:326 msgid "" "These options, along with all of the other options, are described in more " "detail in the :class:`Popen` constructor documentation." msgstr "" -#: ../../library/subprocess.rst:330 +#: ../../library/subprocess.rst:331 msgid "Popen Constructor" msgstr "" -#: ../../library/subprocess.rst:332 +#: ../../library/subprocess.rst:333 msgid "" "The underlying process creation and management in this module is handled by " "the :class:`Popen` class. It offers a lot of flexibility so that developers " @@ -380,7 +381,7 @@ msgid "" "functions." msgstr "" -#: ../../library/subprocess.rst:346 +#: ../../library/subprocess.rst:347 msgid "" "Execute a child program in a new process. On POSIX, the class uses :meth:" "`os.execvpe`-like behavior to execute the child program. On Windows, the " @@ -388,7 +389,7 @@ msgid "" "class:`Popen` are as follows." msgstr "" -#: ../../library/subprocess.rst:351 +#: ../../library/subprocess.rst:352 msgid "" "*args* should be a sequence of program arguments or else a single string or :" "term:`path-like object`. By default, the program to execute is the first " @@ -399,7 +400,7 @@ msgid "" "sequence." msgstr "" -#: ../../library/subprocess.rst:361 +#: ../../library/subprocess.rst:362 msgid "" "For maximum reliability, use a fully-qualified path for the executable. To " "search for an unqualified name on :envvar:`PATH`, use :meth:`shutil.which`. " @@ -408,7 +409,7 @@ msgid "" "format to launch an installed module." msgstr "" -#: ../../library/subprocess.rst:367 +#: ../../library/subprocess.rst:368 msgid "" "Resolving the path of *executable* (or the first item of *args*) is platform " "dependent. For POSIX, see :meth:`os.execvpe`, and note that when resolving " @@ -422,27 +423,27 @@ msgid "" "variations." msgstr "" -#: ../../library/subprocess.rst:378 +#: ../../library/subprocess.rst:379 msgid "" "An example of passing some arguments to an external program as a sequence " "is::" msgstr "" -#: ../../library/subprocess.rst:383 +#: ../../library/subprocess.rst:384 msgid "" "On POSIX, if *args* is a string, the string is interpreted as the name or " "path of the program to execute. However, this can only be done if not " "passing arguments to the program." msgstr "" -#: ../../library/subprocess.rst:389 +#: ../../library/subprocess.rst:390 msgid "" "It may not be obvious how to break a shell command into a sequence of " "arguments, especially in complex cases. :meth:`shlex.split` can illustrate " "how to determine the correct tokenization for *args*::" msgstr "" -#: ../../library/subprocess.rst:401 +#: ../../library/subprocess.rst:402 msgid "" "Note in particular that options (such as *-input*) and arguments (such as " "*eggs.txt*) that are separated by whitespace in the shell go in separate " @@ -451,33 +452,33 @@ msgid "" "shown above) are single list elements." msgstr "" -#: ../../library/subprocess.rst:407 +#: ../../library/subprocess.rst:408 msgid "" "On Windows, if *args* is a sequence, it will be converted to a string in a " "manner described in :ref:`converting-argument-sequence`. This is because " "the underlying ``CreateProcess()`` operates on strings." msgstr "" -#: ../../library/subprocess.rst:411 +#: ../../library/subprocess.rst:412 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing path-like objects on POSIX." msgstr "" -#: ../../library/subprocess.rst:415 +#: ../../library/subprocess.rst:416 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing bytes and path-like objects on Windows." msgstr "" -#: ../../library/subprocess.rst:420 +#: ../../library/subprocess.rst:421 msgid "" "The *shell* argument (which defaults to ``False``) specifies whether to use " "the shell as the program to execute. If *shell* is ``True``, it is " "recommended to pass *args* as a string rather than as a sequence." msgstr "" -#: ../../library/subprocess.rst:424 +#: ../../library/subprocess.rst:425 msgid "" "On POSIX with ``shell=True``, the shell defaults to :file:`/bin/sh`. If " "*args* is a string, the string specifies the command to execute through the " @@ -489,7 +490,7 @@ msgid "" "class:`Popen` does the equivalent of::" msgstr "" -#: ../../library/subprocess.rst:435 +#: ../../library/subprocess.rst:436 msgid "" "On Windows with ``shell=True``, the :envvar:`COMSPEC` environment variable " "specifies the default shell. The only time you need to specify " @@ -498,35 +499,35 @@ msgid "" "``shell=True`` to run a batch file or console-based executable." msgstr "" -#: ../../library/subprocess.rst:445 +#: ../../library/subprocess.rst:446 msgid "" "*bufsize* will be supplied as the corresponding argument to the :func:`open` " "function when creating the stdin/stdout/stderr pipe file objects:" msgstr "" -#: ../../library/subprocess.rst:449 +#: ../../library/subprocess.rst:450 msgid "" ":const:`0` means unbuffered (read and write are one system call and can " "return short)" msgstr "" -#: ../../library/subprocess.rst:451 +#: ../../library/subprocess.rst:452 msgid "" ":const:`1` means line buffered (only usable if ``universal_newlines=True`` i." "e., in a text mode)" msgstr "" -#: ../../library/subprocess.rst:453 +#: ../../library/subprocess.rst:454 msgid "any other positive value means use a buffer of approximately that size" msgstr "" -#: ../../library/subprocess.rst:455 +#: ../../library/subprocess.rst:456 msgid "" "negative bufsize (the default) means the system default of io." "DEFAULT_BUFFER_SIZE will be used." msgstr "" -#: ../../library/subprocess.rst:458 +#: ../../library/subprocess.rst:459 msgid "" "*bufsize* now defaults to -1 to enable buffering by default to match the " "behavior that most code expects. In versions prior to Python 3.2.4 and " @@ -535,7 +536,7 @@ msgid "" "of Python 2 as most code expected." msgstr "" -#: ../../library/subprocess.rst:465 +#: ../../library/subprocess.rst:466 msgid "" "The *executable* argument specifies a replacement program to execute. It " "is very seldom needed. When ``shell=False``, *executable* replaces the " @@ -548,37 +549,38 @@ msgid "" "default :file:`/bin/sh`." msgstr "" -#: ../../library/subprocess.rst:475 +#: ../../library/subprocess.rst:476 msgid "*executable* parameter accepts a :term:`path-like object` on POSIX." msgstr "" -#: ../../library/subprocess.rst:478 +#: ../../library/subprocess.rst:479 msgid "" "*executable* parameter accepts a bytes and :term:`path-like object` on " "Windows." msgstr "" -#: ../../library/subprocess.rst:482 +#: ../../library/subprocess.rst:483 msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " "values are :data:`PIPE`, :data:`DEVNULL`, an existing file descriptor (a " -"positive integer), an existing :term:`file object`, and ``None``. :data:" -"`PIPE` indicates that a new pipe to the child should be created. :data:" -"`DEVNULL` indicates that the special file :data:`os.devnull` will be used. " -"With the default settings of ``None``, no redirection will occur; the " -"child's file handles will be inherited from the parent. Additionally, " -"*stderr* can be :data:`STDOUT`, which indicates that the stderr data from " -"the applications should be captured into the same file handle as for stdout." +"positive integer), an existing :term:`file object` with a valid file " +"descriptor, and ``None``. :data:`PIPE` indicates that a new pipe to the " +"child should be created. :data:`DEVNULL` indicates that the special file :" +"data:`os.devnull` will be used. With the default settings of ``None``, no " +"redirection will occur; the child's file handles will be inherited from the " +"parent. Additionally, *stderr* can be :data:`STDOUT`, which indicates that " +"the stderr data from the applications should be captured into the same file " +"handle as for stdout." msgstr "" -#: ../../library/subprocess.rst:493 +#: ../../library/subprocess.rst:495 msgid "" "If *preexec_fn* is set to a callable object, this object will be called in " "the child process just before the child is executed. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:499 +#: ../../library/subprocess.rst:501 msgid "" "The *preexec_fn* parameter is not safe to use in the presence of threads in " "your application. The child process could deadlock before exec is called. " @@ -586,7 +588,7 @@ msgid "" "call into." msgstr "" -#: ../../library/subprocess.rst:507 +#: ../../library/subprocess.rst:509 msgid "" "If you need to modify the environment for the child use the *env* parameter " "rather than doing it in a *preexec_fn*. The *start_new_session* parameter " @@ -594,7 +596,7 @@ msgid "" "setsid() in the child." msgstr "" -#: ../../library/subprocess.rst:514 +#: ../../library/subprocess.rst:516 msgid "" "The *preexec_fn* parameter is no longer supported in subinterpreters. The " "use of the parameter in a subinterpreter raises :exc:`RuntimeError`. The new " @@ -602,7 +604,7 @@ msgid "" "and other embedded environments." msgstr "" -#: ../../library/subprocess.rst:519 +#: ../../library/subprocess.rst:521 msgid "" "If *close_fds* is true, all file descriptors except :const:`0`, :const:`1` " "and :const:`2` will be closed before the child process is executed. " @@ -610,38 +612,38 @@ msgid "" "flag as described in :ref:`fd_inheritance`." msgstr "" -#: ../../library/subprocess.rst:524 +#: ../../library/subprocess.rst:526 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " "child process unless explicitly passed in the ``handle_list`` element of :" "attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" -#: ../../library/subprocess.rst:528 +#: ../../library/subprocess.rst:530 msgid "" "The default for *close_fds* was changed from :const:`False` to what is " "described above." msgstr "" -#: ../../library/subprocess.rst:532 +#: ../../library/subprocess.rst:534 msgid "" "On Windows the default for *close_fds* was changed from :const:`False` to :" "const:`True` when redirecting the standard handles. It's now possible to set " "*close_fds* to :const:`True` when redirecting the standard handles." msgstr "" -#: ../../library/subprocess.rst:537 +#: ../../library/subprocess.rst:539 msgid "" "*pass_fds* is an optional sequence of file descriptors to keep open between " "the parent and child. Providing any *pass_fds* forces *close_fds* to be :" "const:`True`. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:541 +#: ../../library/subprocess.rst:543 msgid "The *pass_fds* parameter was added." msgstr "新增 *pass_fds* 參數。" -#: ../../library/subprocess.rst:544 +#: ../../library/subprocess.rst:546 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " "*cwd* before executing the child. *cwd* can be a string, bytes or :term:" @@ -650,40 +652,40 @@ msgid "" "executable path is a relative path." msgstr "" -#: ../../library/subprocess.rst:550 +#: ../../library/subprocess.rst:552 msgid "*cwd* parameter accepts a :term:`path-like object` on POSIX." msgstr "" -#: ../../library/subprocess.rst:553 +#: ../../library/subprocess.rst:555 msgid "*cwd* parameter accepts a :term:`path-like object` on Windows." msgstr "" -#: ../../library/subprocess.rst:556 +#: ../../library/subprocess.rst:558 msgid "*cwd* parameter accepts a bytes object on Windows." msgstr "" -#: ../../library/subprocess.rst:559 +#: ../../library/subprocess.rst:561 msgid "" "If *restore_signals* is true (the default) all signals that Python has set " "to SIG_IGN are restored to SIG_DFL in the child process before the exec. " "Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:564 +#: ../../library/subprocess.rst:566 msgid "*restore_signals* was added." msgstr "新增 *restore_signals*\\ 。" -#: ../../library/subprocess.rst:567 +#: ../../library/subprocess.rst:569 msgid "" "If *start_new_session* is true the setsid() system call will be made in the " "child process prior to the execution of the subprocess. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:570 +#: ../../library/subprocess.rst:572 msgid "*start_new_session* was added." msgstr "新增 *start_new_session*\\ 。" -#: ../../library/subprocess.rst:573 +#: ../../library/subprocess.rst:575 msgid "" "If *group* is not ``None``, the setregid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -692,12 +694,12 @@ msgid "" "passed verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:579 ../../library/subprocess.rst:588 -#: ../../library/subprocess.rst:597 ../../library/subprocess.rst:603 +#: ../../library/subprocess.rst:581 ../../library/subprocess.rst:590 +#: ../../library/subprocess.rst:599 ../../library/subprocess.rst:605 msgid ":ref:`Availability `: POSIX" msgstr ":ref:`適用 `:POSIX" -#: ../../library/subprocess.rst:582 +#: ../../library/subprocess.rst:584 msgid "" "If *extra_groups* is not ``None``, the setgroups() system call will be made " "in the child process prior to the execution of the subprocess. Strings " @@ -706,7 +708,7 @@ msgid "" "verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:591 +#: ../../library/subprocess.rst:593 msgid "" "If *user* is not ``None``, the setreuid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -715,27 +717,27 @@ msgid "" "passed verbatim. (POSIX only)" msgstr "" -#: ../../library/subprocess.rst:600 +#: ../../library/subprocess.rst:602 msgid "" "If *umask* is not negative, the umask() system call will be made in the " "child process prior to the execution of the subprocess." msgstr "" -#: ../../library/subprocess.rst:606 +#: ../../library/subprocess.rst:608 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " "behavior of inheriting the current process' environment." msgstr "" -#: ../../library/subprocess.rst:612 +#: ../../library/subprocess.rst:614 msgid "" "If specified, *env* must provide any variables required for the program to " "execute. On Windows, in order to run a `side-by-side assembly`_ the " "specified *env* **must** include a valid :envvar:`SystemRoot`." msgstr "" -#: ../../library/subprocess.rst:618 +#: ../../library/subprocess.rst:620 msgid "" "If *encoding* or *errors* are specified, or *text* is true, the file objects " "*stdin*, *stdout* and *stderr* are opened in text mode with the specified " @@ -745,70 +747,70 @@ msgid "" "in binary mode." msgstr "" -#: ../../library/subprocess.rst:624 +#: ../../library/subprocess.rst:626 msgid "*encoding* and *errors* were added." msgstr "新增 *encoding* 與 *errors*\\ 。" -#: ../../library/subprocess.rst:627 ../../library/subprocess.rst:1228 +#: ../../library/subprocess.rst:629 ../../library/subprocess.rst:1230 msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" -#: ../../library/subprocess.rst:630 +#: ../../library/subprocess.rst:632 msgid "" "If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is " "passed to the underlying ``CreateProcess`` function. *creationflags*, if " "given, can be one or more of the following flags:" msgstr "" -#: ../../library/subprocess.rst:634 +#: ../../library/subprocess.rst:636 msgid ":data:`CREATE_NEW_CONSOLE`" msgstr ":data:`CREATE_NEW_CONSOLE`" -#: ../../library/subprocess.rst:635 +#: ../../library/subprocess.rst:637 msgid ":data:`CREATE_NEW_PROCESS_GROUP`" msgstr ":data:`CREATE_NEW_PROCESS_GROUP`" -#: ../../library/subprocess.rst:636 +#: ../../library/subprocess.rst:638 msgid ":data:`ABOVE_NORMAL_PRIORITY_CLASS`" msgstr ":data:`ABOVE_NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:637 +#: ../../library/subprocess.rst:639 msgid ":data:`BELOW_NORMAL_PRIORITY_CLASS`" msgstr ":data:`BELOW_NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:638 +#: ../../library/subprocess.rst:640 msgid ":data:`HIGH_PRIORITY_CLASS`" msgstr ":data:`HIGH_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:639 +#: ../../library/subprocess.rst:641 msgid ":data:`IDLE_PRIORITY_CLASS`" msgstr ":data:`IDLE_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:640 +#: ../../library/subprocess.rst:642 msgid ":data:`NORMAL_PRIORITY_CLASS`" msgstr ":data:`NORMAL_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:641 +#: ../../library/subprocess.rst:643 msgid ":data:`REALTIME_PRIORITY_CLASS`" msgstr ":data:`REALTIME_PRIORITY_CLASS`" -#: ../../library/subprocess.rst:642 +#: ../../library/subprocess.rst:644 msgid ":data:`CREATE_NO_WINDOW`" msgstr ":data:`CREATE_NO_WINDOW`" -#: ../../library/subprocess.rst:643 +#: ../../library/subprocess.rst:645 msgid ":data:`DETACHED_PROCESS`" msgstr ":data:`DETACHED_PROCESS`" -#: ../../library/subprocess.rst:644 +#: ../../library/subprocess.rst:646 msgid ":data:`CREATE_DEFAULT_ERROR_MODE`" msgstr ":data:`CREATE_DEFAULT_ERROR_MODE`" -#: ../../library/subprocess.rst:645 +#: ../../library/subprocess.rst:647 msgid ":data:`CREATE_BREAKAWAY_FROM_JOB`" msgstr ":data:`CREATE_BREAKAWAY_FROM_JOB`" -#: ../../library/subprocess.rst:647 +#: ../../library/subprocess.rst:649 msgid "" "*pipesize* can be used to change the size of the pipe when :data:`PIPE` is " "used for *stdin*, *stdout* or *stderr*. The size of the pipe is only changed " @@ -816,24 +818,24 @@ msgid "" "platforms will ignore this parameter." msgstr "" -#: ../../library/subprocess.rst:652 +#: ../../library/subprocess.rst:654 msgid "The ``pipesize`` parameter was added." msgstr "新增 ``pipesize`` 參數。" -#: ../../library/subprocess.rst:655 +#: ../../library/subprocess.rst:657 msgid "" "Popen objects are supported as context managers via the :keyword:`with` " "statement: on exit, standard file descriptors are closed, and the process is " "waited for. ::" msgstr "" -#: ../../library/subprocess.rst:662 +#: ../../library/subprocess.rst:664 msgid "" "Raises an :ref:`auditing event ` ``subprocess.Popen`` with " "arguments ``executable``, ``args``, ``cwd``, ``env``." msgstr "" -#: ../../library/subprocess.rst:664 +#: ../../library/subprocess.rst:666 msgid "" "Popen and the other functions in this module that use it raise an :ref:" "`auditing event ` ``subprocess.Popen`` with arguments " @@ -841,17 +843,17 @@ msgid "" "be a single string or a list of strings, depending on platform." msgstr "" -#: ../../library/subprocess.rst:669 +#: ../../library/subprocess.rst:671 msgid "Added context manager support." msgstr "" -#: ../../library/subprocess.rst:672 +#: ../../library/subprocess.rst:674 msgid "" "Popen destructor now emits a :exc:`ResourceWarning` warning if the child " "process is still running." msgstr "" -#: ../../library/subprocess.rst:676 +#: ../../library/subprocess.rst:678 msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " @@ -860,17 +862,17 @@ msgid "" "returncode`." msgstr "" -#: ../../library/subprocess.rst:685 +#: ../../library/subprocess.rst:687 msgid "Exceptions" msgstr "例外" -#: ../../library/subprocess.rst:687 +#: ../../library/subprocess.rst:689 msgid "" "Exceptions raised in the child process, before the new program has started " "to execute, will be re-raised in the parent." msgstr "" -#: ../../library/subprocess.rst:690 +#: ../../library/subprocess.rst:692 msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " @@ -881,39 +883,39 @@ msgid "" "subprocess." msgstr "" -#: ../../library/subprocess.rst:697 +#: ../../library/subprocess.rst:699 msgid "" "A :exc:`ValueError` will be raised if :class:`Popen` is called with invalid " "arguments." msgstr "" -#: ../../library/subprocess.rst:700 +#: ../../library/subprocess.rst:702 msgid "" ":func:`check_call` and :func:`check_output` will raise :exc:" "`CalledProcessError` if the called process returns a non-zero return code." msgstr "" -#: ../../library/subprocess.rst:704 +#: ../../library/subprocess.rst:706 msgid "" "All of the functions and methods that accept a *timeout* parameter, such as :" "func:`call` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` " "if the timeout expires before the process exits." msgstr "" -#: ../../library/subprocess.rst:708 +#: ../../library/subprocess.rst:710 msgid "" "Exceptions defined in this module all inherit from :exc:`SubprocessError`." msgstr "" -#: ../../library/subprocess.rst:710 +#: ../../library/subprocess.rst:712 msgid "The :exc:`SubprocessError` base class was added." msgstr "" -#: ../../library/subprocess.rst:716 +#: ../../library/subprocess.rst:718 msgid "Security Considerations" msgstr "" -#: ../../library/subprocess.rst:718 +#: ../../library/subprocess.rst:720 msgid "" "Unlike some other popen functions, this implementation will never implicitly " "call a system shell. This means that all characters, including shell " @@ -926,34 +928,34 @@ msgid "" "escaping." msgstr "" -#: ../../library/subprocess.rst:730 +#: ../../library/subprocess.rst:732 msgid "Popen Objects" msgstr "" -#: ../../library/subprocess.rst:732 +#: ../../library/subprocess.rst:734 msgid "Instances of the :class:`Popen` class have the following methods:" msgstr "" -#: ../../library/subprocess.rst:737 +#: ../../library/subprocess.rst:739 msgid "" "Check if child process has terminated. Set and return :attr:`~Popen." "returncode` attribute. Otherwise, returns ``None``." msgstr "" -#: ../../library/subprocess.rst:743 +#: ../../library/subprocess.rst:745 msgid "" "Wait for child process to terminate. Set and return :attr:`~Popen." "returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:746 +#: ../../library/subprocess.rst:748 msgid "" "If the process does not terminate after *timeout* seconds, raise a :exc:" "`TimeoutExpired` exception. It is safe to catch this exception and retry " "the wait." msgstr "" -#: ../../library/subprocess.rst:752 +#: ../../library/subprocess.rst:754 msgid "" "This will deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and the " "child process generates enough output to a pipe such that it blocks waiting " @@ -961,20 +963,20 @@ msgid "" "when using pipes to avoid that." msgstr "" -#: ../../library/subprocess.rst:759 +#: ../../library/subprocess.rst:761 msgid "" "The function is implemented using a busy loop (non-blocking call and short " "sleeps). Use the :mod:`asyncio` module for an asynchronous wait: see :class:" "`asyncio.create_subprocess_exec`." msgstr "" -#: ../../library/subprocess.rst:763 ../../library/subprocess.rst:804 -#: ../../library/subprocess.rst:1141 ../../library/subprocess.rst:1173 -#: ../../library/subprocess.rst:1219 +#: ../../library/subprocess.rst:765 ../../library/subprocess.rst:806 +#: ../../library/subprocess.rst:1143 ../../library/subprocess.rst:1175 +#: ../../library/subprocess.rst:1221 msgid "*timeout* was added." msgstr "新增 *timeout*\\ 。" -#: ../../library/subprocess.rst:768 +#: ../../library/subprocess.rst:770 msgid "" "Interact with process: Send data to stdin. Read data from stdout and " "stderr, until end-of-file is reached. Wait for process to terminate and set " @@ -984,13 +986,13 @@ msgid "" "must be a string. Otherwise, it must be bytes." msgstr "" -#: ../../library/subprocess.rst:775 +#: ../../library/subprocess.rst:777 msgid "" ":meth:`communicate` returns a tuple ``(stdout_data, stderr_data)``. The data " "will be strings if streams were opened in text mode; otherwise, bytes." msgstr "" -#: ../../library/subprocess.rst:779 +#: ../../library/subprocess.rst:781 msgid "" "Note that if you want to send data to the process's stdin, you need to " "create the Popen object with ``stdin=PIPE``. Similarly, to get anything " @@ -998,65 +1000,65 @@ msgid "" "and/or ``stderr=PIPE`` too." msgstr "" -#: ../../library/subprocess.rst:784 +#: ../../library/subprocess.rst:786 msgid "" "If the process does not terminate after *timeout* seconds, a :exc:" "`TimeoutExpired` exception will be raised. Catching this exception and " "retrying communication will not lose any output." msgstr "" -#: ../../library/subprocess.rst:788 +#: ../../library/subprocess.rst:790 msgid "" "The child process is not killed if the timeout expires, so in order to " "cleanup properly a well-behaved application should kill the child process " "and finish communication::" msgstr "" -#: ../../library/subprocess.rst:801 +#: ../../library/subprocess.rst:803 msgid "" "The data read is buffered in memory, so do not use this method if the data " "size is large or unlimited." msgstr "" -#: ../../library/subprocess.rst:810 +#: ../../library/subprocess.rst:812 msgid "Sends the signal *signal* to the child." msgstr "" -#: ../../library/subprocess.rst:812 +#: ../../library/subprocess.rst:814 msgid "Do nothing if the process completed." msgstr "" -#: ../../library/subprocess.rst:816 +#: ../../library/subprocess.rst:818 msgid "" "On Windows, SIGTERM is an alias for :meth:`terminate`. CTRL_C_EVENT and " "CTRL_BREAK_EVENT can be sent to processes started with a *creationflags* " "parameter which includes `CREATE_NEW_PROCESS_GROUP`." msgstr "" -#: ../../library/subprocess.rst:823 +#: ../../library/subprocess.rst:825 msgid "" "Stop the child. On POSIX OSs the method sends SIGTERM to the child. On " "Windows the Win32 API function :c:func:`TerminateProcess` is called to stop " "the child." msgstr "" -#: ../../library/subprocess.rst:830 +#: ../../library/subprocess.rst:832 msgid "" "Kills the child. On POSIX OSs the function sends SIGKILL to the child. On " "Windows :meth:`kill` is an alias for :meth:`terminate`." msgstr "" -#: ../../library/subprocess.rst:834 +#: ../../library/subprocess.rst:836 msgid "The following attributes are also available:" msgstr "" -#: ../../library/subprocess.rst:838 +#: ../../library/subprocess.rst:840 msgid "" "The *args* argument as it was passed to :class:`Popen` -- a sequence of " "program arguments or else a single string." msgstr "" -#: ../../library/subprocess.rst:845 +#: ../../library/subprocess.rst:847 msgid "" "If the *stdin* argument was :data:`PIPE`, this attribute is a writeable " "stream object as returned by :func:`open`. If the *encoding* or *errors* " @@ -1065,7 +1067,7 @@ msgid "" "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:854 +#: ../../library/subprocess.rst:856 msgid "" "If the *stdout* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1075,7 +1077,7 @@ msgid "" "not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:864 +#: ../../library/subprocess.rst:866 msgid "" "If the *stderr* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1085,7 +1087,7 @@ msgid "" "was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: ../../library/subprocess.rst:873 +#: ../../library/subprocess.rst:875 msgid "" "Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read `__ structure is used for :class:`Popen` " @@ -1128,38 +1130,38 @@ msgid "" "only arguments." msgstr "" -#: ../../library/subprocess.rst:911 +#: ../../library/subprocess.rst:913 msgid "Keyword-only argument support was added." msgstr "" -#: ../../library/subprocess.rst:916 +#: ../../library/subprocess.rst:918 msgid "" "A bit field that determines whether certain :class:`STARTUPINFO` attributes " "are used when the process creates a window. ::" msgstr "" -#: ../../library/subprocess.rst:924 +#: ../../library/subprocess.rst:926 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` " "is not specified, the default for standard input is the keyboard buffer." msgstr "" -#: ../../library/subprocess.rst:931 +#: ../../library/subprocess.rst:933 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard output handle for the process. Otherwise, this attribute is " "ignored and the default for standard output is the console window's buffer." msgstr "" -#: ../../library/subprocess.rst:938 +#: ../../library/subprocess.rst:940 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard error handle for the process. Otherwise, this attribute is " "ignored and the default for standard error is the console window's buffer." msgstr "" -#: ../../library/subprocess.rst:944 +#: ../../library/subprocess.rst:946 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute " "can be any of the values that can be specified in the ``nCmdShow`` parameter " @@ -1168,34 +1170,34 @@ msgid "" "Otherwise, this attribute is ignored." msgstr "" -#: ../../library/subprocess.rst:951 +#: ../../library/subprocess.rst:953 msgid "" ":data:`SW_HIDE` is provided for this attribute. It is used when :class:" "`Popen` is called with ``shell=True``." msgstr "" -#: ../../library/subprocess.rst:956 +#: ../../library/subprocess.rst:958 msgid "" "A dictionary of additional attributes for process creation as given in " "``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" -#: ../../library/subprocess.rst:960 +#: ../../library/subprocess.rst:962 msgid "Supported attributes:" msgstr "" -#: ../../library/subprocess.rst:978 +#: ../../library/subprocess.rst:980 msgid "**handle_list**" msgstr "**handle_list**" -#: ../../library/subprocess.rst:963 +#: ../../library/subprocess.rst:965 msgid "" "Sequence of handles that will be inherited. *close_fds* must be true if non-" "empty." msgstr "" -#: ../../library/subprocess.rst:966 +#: ../../library/subprocess.rst:968 msgid "" "The handles must be temporarily made inheritable by :func:`os." "set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" @@ -1203,7 +1205,7 @@ msgid "" "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" -#: ../../library/subprocess.rst:973 +#: ../../library/subprocess.rst:975 msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " @@ -1212,97 +1214,97 @@ msgid "" "temporarily creates inheritable handles." msgstr "" -#: ../../library/subprocess.rst:983 +#: ../../library/subprocess.rst:985 msgid "Windows Constants" msgstr "" -#: ../../library/subprocess.rst:985 +#: ../../library/subprocess.rst:987 msgid "The :mod:`subprocess` module exposes the following constants." msgstr "" -#: ../../library/subprocess.rst:989 +#: ../../library/subprocess.rst:991 msgid "" "The standard input device. Initially, this is the console input buffer, " "``CONIN$``." msgstr "" -#: ../../library/subprocess.rst:994 +#: ../../library/subprocess.rst:996 msgid "" "The standard output device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: ../../library/subprocess.rst:999 +#: ../../library/subprocess.rst:1001 msgid "" "The standard error device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: ../../library/subprocess.rst:1004 +#: ../../library/subprocess.rst:1006 msgid "Hides the window. Another window will be activated." msgstr "" -#: ../../library/subprocess.rst:1008 +#: ../../library/subprocess.rst:1010 msgid "" "Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." "hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " "information." msgstr "" -#: ../../library/subprocess.rst:1014 +#: ../../library/subprocess.rst:1016 msgid "" "Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains " "additional information." msgstr "" -#: ../../library/subprocess.rst:1019 +#: ../../library/subprocess.rst:1021 msgid "" "The new process has a new console, instead of inheriting its parent's " "console (the default)." msgstr "" -#: ../../library/subprocess.rst:1024 +#: ../../library/subprocess.rst:1026 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "group will be created. This flag is necessary for using :func:`os.kill` on " "the subprocess." msgstr "" -#: ../../library/subprocess.rst:1028 +#: ../../library/subprocess.rst:1030 msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" -#: ../../library/subprocess.rst:1032 +#: ../../library/subprocess.rst:1034 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" -#: ../../library/subprocess.rst:1039 +#: ../../library/subprocess.rst:1041 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" -#: ../../library/subprocess.rst:1046 +#: ../../library/subprocess.rst:1048 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" -#: ../../library/subprocess.rst:1053 +#: ../../library/subprocess.rst:1055 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" -#: ../../library/subprocess.rst:1060 +#: ../../library/subprocess.rst:1062 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an normal priority. (default)" msgstr "" -#: ../../library/subprocess.rst:1067 +#: ../../library/subprocess.rst:1069 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1312,20 +1314,20 @@ msgid "" "perform brief tasks that should have limited interruptions." msgstr "" -#: ../../library/subprocess.rst:1078 +#: ../../library/subprocess.rst:1080 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" -#: ../../library/subprocess.rst:1085 +#: ../../library/subprocess.rst:1087 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" -#: ../../library/subprocess.rst:1093 +#: ../../library/subprocess.rst:1095 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " @@ -1333,39 +1335,39 @@ msgid "" "multithreaded shell applications that run with hard errors disabled." msgstr "" -#: ../../library/subprocess.rst:1103 +#: ../../library/subprocess.rst:1105 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" -#: ../../library/subprocess.rst:1111 +#: ../../library/subprocess.rst:1113 msgid "Older high-level API" msgstr "" -#: ../../library/subprocess.rst:1113 +#: ../../library/subprocess.rst:1115 msgid "" "Prior to Python 3.5, these three functions comprised the high level API to " "subprocess. You can now use :func:`run` in many cases, but lots of existing " "code calls these functions." msgstr "" -#: ../../library/subprocess.rst:1120 +#: ../../library/subprocess.rst:1122 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:1123 ../../library/subprocess.rst:1155 +#: ../../library/subprocess.rst:1125 ../../library/subprocess.rst:1157 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" -#: ../../library/subprocess.rst:1127 ../../library/subprocess.rst:1159 +#: ../../library/subprocess.rst:1129 ../../library/subprocess.rst:1161 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" -#: ../../library/subprocess.rst:1129 ../../library/subprocess.rst:1161 +#: ../../library/subprocess.rst:1131 ../../library/subprocess.rst:1163 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is the same as that of the :class:`Popen` constructor - this " @@ -1373,14 +1375,14 @@ msgid "" "to that interface." msgstr "" -#: ../../library/subprocess.rst:1136 ../../library/subprocess.rst:1168 +#: ../../library/subprocess.rst:1138 ../../library/subprocess.rst:1170 msgid "" "Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function. The child " "process will block if it generates enough output to a pipe to fill up the OS " "pipe buffer as the pipes are not being read from." msgstr "" -#: ../../library/subprocess.rst:1148 +#: ../../library/subprocess.rst:1150 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1389,11 +1391,11 @@ msgid "" "to start the process it will propagate the exception that was raised." msgstr "" -#: ../../library/subprocess.rst:1182 +#: ../../library/subprocess.rst:1184 msgid "Run command with arguments and return its output." msgstr "" -#: ../../library/subprocess.rst:1184 +#: ../../library/subprocess.rst:1186 msgid "" "If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" "exc:`CalledProcessError` object will have the return code in the :attr:" @@ -1401,11 +1403,11 @@ msgid "" "`~CalledProcessError.output` attribute." msgstr "" -#: ../../library/subprocess.rst:1189 +#: ../../library/subprocess.rst:1191 msgid "This is equivalent to::" msgstr "" -#: ../../library/subprocess.rst:1193 +#: ../../library/subprocess.rst:1195 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1415,52 +1417,52 @@ msgid "" "using the parent's standard input file handle." msgstr "" -#: ../../library/subprocess.rst:1200 +#: ../../library/subprocess.rst:1202 msgid "" "By default, this function will return the data as encoded bytes. The actual " "encoding of the output data may depend on the command being invoked, so the " "decoding to text will often need to be handled at the application level." msgstr "" -#: ../../library/subprocess.rst:1204 +#: ../../library/subprocess.rst:1206 msgid "" "This behaviour may be overridden by setting *text*, *encoding*, *errors*, or " "*universal_newlines* to ``True`` as described in :ref:`frequently-used-" "arguments` and :func:`run`." msgstr "" -#: ../../library/subprocess.rst:1208 +#: ../../library/subprocess.rst:1210 msgid "" "To also capture standard error in the result, use ``stderr=subprocess." "STDOUT``::" msgstr "" -#: ../../library/subprocess.rst:1222 +#: ../../library/subprocess.rst:1224 msgid "Support for the *input* keyword argument was added." msgstr "新增 *input* 關鍵字引數的支援。" -#: ../../library/subprocess.rst:1225 +#: ../../library/subprocess.rst:1227 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "新增 *encoding* 與 *errors*\\ 。細節請見 :func:`run`\\ 。" -#: ../../library/subprocess.rst:1235 +#: ../../library/subprocess.rst:1237 msgid "Replacing Older Functions with the :mod:`subprocess` Module" msgstr "" -#: ../../library/subprocess.rst:1237 +#: ../../library/subprocess.rst:1239 msgid "" "In this section, \"a becomes b\" means that b can be used as a replacement " "for a." msgstr "" -#: ../../library/subprocess.rst:1241 +#: ../../library/subprocess.rst:1243 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " "executed program cannot be found; the \"b\" replacements raise :exc:" "`OSError` instead." msgstr "" -#: ../../library/subprocess.rst:1245 +#: ../../library/subprocess.rst:1247 msgid "" "In addition, the replacements using :func:`check_output` will fail with a :" "exc:`CalledProcessError` if the requested operation produces a non-zero " @@ -1468,143 +1470,143 @@ msgid "" "output` attribute of the raised exception." msgstr "" -#: ../../library/subprocess.rst:1250 +#: ../../library/subprocess.rst:1252 msgid "" "In the following examples, we assume that the relevant functions have " "already been imported from the :mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1255 +#: ../../library/subprocess.rst:1257 msgid "Replacing :program:`/bin/sh` shell command substitution" msgstr "" -#: ../../library/subprocess.rst:1261 ../../library/subprocess.rst:1272 -#: ../../library/subprocess.rst:1289 +#: ../../library/subprocess.rst:1263 ../../library/subprocess.rst:1274 +#: ../../library/subprocess.rst:1291 msgid "becomes::" msgstr "" "變成:\n" "\n" "::" -#: ../../library/subprocess.rst:1266 +#: ../../library/subprocess.rst:1268 msgid "Replacing shell pipeline" msgstr "" -#: ../../library/subprocess.rst:1279 +#: ../../library/subprocess.rst:1281 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -#: ../../library/subprocess.rst:1282 +#: ../../library/subprocess.rst:1284 msgid "" "Alternatively, for trusted input, the shell's own pipeline support may still " "be used directly:" msgstr "" -#: ../../library/subprocess.rst:1295 +#: ../../library/subprocess.rst:1297 msgid "Replacing :func:`os.system`" msgstr "" -#: ../../library/subprocess.rst:1303 +#: ../../library/subprocess.rst:1305 msgid "Notes:" msgstr "註解:" -#: ../../library/subprocess.rst:1305 +#: ../../library/subprocess.rst:1307 msgid "Calling the program through the shell is usually not required." msgstr "" -#: ../../library/subprocess.rst:1306 +#: ../../library/subprocess.rst:1308 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" -#: ../../library/subprocess.rst:1309 +#: ../../library/subprocess.rst:1311 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " "command is running, but the caller must do this separately when using the :" "mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1313 +#: ../../library/subprocess.rst:1315 msgid "A more realistic example would look like this::" msgstr "" -#: ../../library/subprocess.rst:1326 +#: ../../library/subprocess.rst:1328 msgid "Replacing the :func:`os.spawn ` family" msgstr "" -#: ../../library/subprocess.rst:1328 +#: ../../library/subprocess.rst:1330 msgid "P_NOWAIT example::" msgstr "" "P_NOWAIT 範例:\n" "\n" "::" -#: ../../library/subprocess.rst:1334 +#: ../../library/subprocess.rst:1336 msgid "P_WAIT example::" msgstr "" "P_WAIT 範例:\n" "\n" "::" -#: ../../library/subprocess.rst:1340 +#: ../../library/subprocess.rst:1342 msgid "Vector example::" msgstr "" -#: ../../library/subprocess.rst:1346 +#: ../../library/subprocess.rst:1348 msgid "Environment example::" msgstr "" -#: ../../library/subprocess.rst:1355 +#: ../../library/subprocess.rst:1357 msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" msgstr "" -#: ../../library/subprocess.rst:1385 +#: ../../library/subprocess.rst:1387 msgid "Return code handling translates as follows::" msgstr "" -#: ../../library/subprocess.rst:1401 +#: ../../library/subprocess.rst:1403 msgid "Replacing functions from the :mod:`popen2` module" msgstr "" -#: ../../library/subprocess.rst:1405 +#: ../../library/subprocess.rst:1407 msgid "" "If the cmd argument to popen2 functions is a string, the command is executed " "through /bin/sh. If it is a list, the command is directly executed." msgstr "" -#: ../../library/subprocess.rst:1424 +#: ../../library/subprocess.rst:1426 msgid "" ":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" "`subprocess.Popen`, except that:" msgstr "" -#: ../../library/subprocess.rst:1427 +#: ../../library/subprocess.rst:1429 msgid ":class:`Popen` raises an exception if the execution fails." msgstr "" -#: ../../library/subprocess.rst:1429 +#: ../../library/subprocess.rst:1431 msgid "The *capturestderr* argument is replaced with the *stderr* argument." msgstr "" -#: ../../library/subprocess.rst:1431 +#: ../../library/subprocess.rst:1433 msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." msgstr "" -#: ../../library/subprocess.rst:1433 +#: ../../library/subprocess.rst:1435 msgid "" "popen2 closes all file descriptors by default, but you have to specify " "``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " "platforms or past Python versions." msgstr "" -#: ../../library/subprocess.rst:1439 +#: ../../library/subprocess.rst:1441 msgid "Legacy Shell Invocation Functions" msgstr "" -#: ../../library/subprocess.rst:1441 +#: ../../library/subprocess.rst:1443 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -1612,92 +1614,92 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: ../../library/subprocess.rst:1448 +#: ../../library/subprocess.rst:1450 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1450 +#: ../../library/subprocess.rst:1452 msgid "" "Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " "return a 2-tuple ``(exitcode, output)``. The locale encoding is used; see " "the notes on :ref:`frequently-used-arguments` for more details." msgstr "" -#: ../../library/subprocess.rst:1454 +#: ../../library/subprocess.rst:1456 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: ../../library/subprocess.rst:1468 ../../library/subprocess.rst:1488 +#: ../../library/subprocess.rst:1470 ../../library/subprocess.rst:1490 msgid ":ref:`Availability `: POSIX & Windows." msgstr ":ref:`適用 `:POSIX 和 Windows。" -#: ../../library/subprocess.rst:1469 +#: ../../library/subprocess.rst:1471 msgid "Windows support was added." msgstr "" -#: ../../library/subprocess.rst:1472 +#: ../../library/subprocess.rst:1474 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" -#: ../../library/subprocess.rst:1479 +#: ../../library/subprocess.rst:1481 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1481 +#: ../../library/subprocess.rst:1483 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: ../../library/subprocess.rst:1489 +#: ../../library/subprocess.rst:1491 msgid "Windows support added" msgstr "" -#: ../../library/subprocess.rst:1494 +#: ../../library/subprocess.rst:1496 msgid "Notes" msgstr "註解" -#: ../../library/subprocess.rst:1499 +#: ../../library/subprocess.rst:1501 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: ../../library/subprocess.rst:1501 +#: ../../library/subprocess.rst:1503 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1505 +#: ../../library/subprocess.rst:1507 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1508 +#: ../../library/subprocess.rst:1510 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1513 +#: ../../library/subprocess.rst:1515 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1516 +#: ../../library/subprocess.rst:1518 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1519 +#: ../../library/subprocess.rst:1521 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -1705,10 +1707,10 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1528 +#: ../../library/subprocess.rst:1530 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1529 +#: ../../library/subprocess.rst:1531 msgid "Module which provides function to parse and escape command lines." msgstr "" diff --git a/library/tempfile.po b/library/tempfile.po index 08c2a15c73..5332a8d1a5 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2022-02-25 12:56+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-" @@ -98,23 +98,29 @@ msgid "" "specific, requires Linux kernel 3.11 or later)." msgstr "" -#: ../../library/tempfile.rst:65 ../../library/tempfile.rst:90 -#: ../../library/tempfile.rst:194 +#: ../../library/tempfile.rst:65 +msgid "" +"On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias " +"for NamedTemporaryFile." +msgstr "" + +#: ../../library/tempfile.rst:68 ../../library/tempfile.rst:93 +#: ../../library/tempfile.rst:197 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkstemp`` with " "argument ``fullpath``." msgstr "" -#: ../../library/tempfile.rst:69 +#: ../../library/tempfile.rst:72 msgid "The :py:data:`os.O_TMPFILE` flag is now used if available." msgstr "" -#: ../../library/tempfile.rst:71 ../../library/tempfile.rst:92 -#: ../../library/tempfile.rst:117 +#: ../../library/tempfile.rst:74 ../../library/tempfile.rst:95 +#: ../../library/tempfile.rst:120 msgid "Added *errors* parameter." msgstr "新增 *errors* 參數。" -#: ../../library/tempfile.rst:77 +#: ../../library/tempfile.rst:80 msgid "" "This function operates exactly as :func:`TemporaryFile` does, except that " "the file is guaranteed to have a visible name in the file system (on Unix, " @@ -129,7 +135,7 @@ msgid "" "a normal file." msgstr "" -#: ../../library/tempfile.rst:98 +#: ../../library/tempfile.rst:101 msgid "" "This function operates exactly as :func:`TemporaryFile` does, except that " "data is spooled in memory until the file size exceeds *max_size*, or until " @@ -137,13 +143,13 @@ msgid "" "written to disk and operation proceeds as with :func:`TemporaryFile`." msgstr "" -#: ../../library/tempfile.rst:104 +#: ../../library/tempfile.rst:107 msgid "" "The resulting file has one additional method, :func:`rollover`, which causes " "the file to roll over to an on-disk file regardless of its size." msgstr "" -#: ../../library/tempfile.rst:107 +#: ../../library/tempfile.rst:110 msgid "" "The returned object is a file-like object whose :attr:`_file` attribute is " "either an :class:`io.BytesIO` or :class:`io.TextIOWrapper` object (depending " @@ -152,11 +158,11 @@ msgid "" "object can be used in a :keyword:`with` statement, just like a normal file." msgstr "" -#: ../../library/tempfile.rst:114 +#: ../../library/tempfile.rst:117 msgid "the truncate method now accepts a ``size`` argument." msgstr "" -#: ../../library/tempfile.rst:123 +#: ../../library/tempfile.rst:126 msgid "" "This function securely creates a temporary directory using the same rules " "as :func:`mkdtemp`. The resulting object can be used as a context manager " @@ -165,7 +171,7 @@ msgid "" "all its contents are removed from the filesystem." msgstr "" -#: ../../library/tempfile.rst:129 +#: ../../library/tempfile.rst:132 msgid "" "The directory name can be retrieved from the :attr:`name` attribute of the " "returned object. When the returned object is used as a context manager, " @@ -173,7 +179,7 @@ msgid "" "in the :keyword:`with` statement, if there is one." msgstr "" -#: ../../library/tempfile.rst:134 +#: ../../library/tempfile.rst:137 msgid "" "The directory can be explicitly cleaned up by calling the :func:`cleanup` " "method. If *ignore_cleanup_errors* is true, any unhandled exceptions during " @@ -185,17 +191,17 @@ msgid "" "shutdown)." msgstr "" -#: ../../library/tempfile.rst:143 ../../library/tempfile.rst:220 +#: ../../library/tempfile.rst:146 ../../library/tempfile.rst:223 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkdtemp`` with " "argument ``fullpath``." msgstr "" -#: ../../library/tempfile.rst:147 +#: ../../library/tempfile.rst:150 msgid "Added *ignore_cleanup_errors* parameter." msgstr "新增 *ignore_cleanup_errors* 參數。" -#: ../../library/tempfile.rst:153 +#: ../../library/tempfile.rst:156 msgid "" "Creates a temporary file in the most secure manner possible. There are no " "race conditions in the file's creation, assuming that the platform properly " @@ -206,13 +212,13 @@ msgid "" "processes." msgstr "" -#: ../../library/tempfile.rst:161 +#: ../../library/tempfile.rst:164 msgid "" "Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible for " "deleting the temporary file when done with it." msgstr "" -#: ../../library/tempfile.rst:164 +#: ../../library/tempfile.rst:167 msgid "" "If *suffix* is not ``None``, the file name will end with that suffix, " "otherwise there will be no suffix. :func:`mkstemp` does not put a dot " @@ -220,14 +226,14 @@ msgid "" "beginning of *suffix*." msgstr "" -#: ../../library/tempfile.rst:169 +#: ../../library/tempfile.rst:172 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " "otherwise, a default prefix is used. The default is the return value of :" "func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." msgstr "" -#: ../../library/tempfile.rst:173 +#: ../../library/tempfile.rst:176 msgid "" "If *dir* is not ``None``, the file will be created in that directory; " "otherwise, a default directory is used. The default directory is chosen " @@ -238,7 +244,7 @@ msgid "" "commands via ``os.popen()``." msgstr "" -#: ../../library/tempfile.rst:181 +#: ../../library/tempfile.rst:184 msgid "" "If any of *suffix*, *prefix*, and *dir* are not ``None``, they must be the " "same type. If they are bytes, the returned name will be bytes instead of " @@ -246,20 +252,20 @@ msgid "" "behavior, pass ``suffix=b''``." msgstr "" -#: ../../library/tempfile.rst:187 +#: ../../library/tempfile.rst:190 msgid "" "If *text* is specified and true, the file is opened in text mode. Otherwise, " "(the default) the file is opened in binary mode." msgstr "" -#: ../../library/tempfile.rst:190 +#: ../../library/tempfile.rst:193 msgid "" ":func:`mkstemp` returns a tuple containing an OS-level handle to an open " "file (as would be returned by :func:`os.open`) and the absolute pathname of " "that file, in that order." msgstr "" -#: ../../library/tempfile.rst:196 ../../library/tempfile.rst:222 +#: ../../library/tempfile.rst:199 ../../library/tempfile.rst:225 msgid "" "*suffix*, *prefix*, and *dir* may now be supplied in bytes in order to " "obtain a bytes return value. Prior to this, only str was allowed. *suffix* " @@ -267,104 +273,104 @@ msgid "" "default value to be used." msgstr "" -#: ../../library/tempfile.rst:202 ../../library/tempfile.rst:228 +#: ../../library/tempfile.rst:205 ../../library/tempfile.rst:231 msgid "The *dir* parameter now accepts a :term:`path-like object`." msgstr "" -#: ../../library/tempfile.rst:208 +#: ../../library/tempfile.rst:211 msgid "" "Creates a temporary directory in the most secure manner possible. There are " "no race conditions in the directory's creation. The directory is readable, " "writable, and searchable only by the creating user ID." msgstr "" -#: ../../library/tempfile.rst:212 +#: ../../library/tempfile.rst:215 msgid "" "The user of :func:`mkdtemp` is responsible for deleting the temporary " "directory and its contents when done with it." msgstr "" -#: ../../library/tempfile.rst:215 +#: ../../library/tempfile.rst:218 msgid "" "The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" "`mkstemp`." msgstr "" -#: ../../library/tempfile.rst:218 +#: ../../library/tempfile.rst:221 msgid ":func:`mkdtemp` returns the absolute pathname of the new directory." msgstr "" -#: ../../library/tempfile.rst:234 +#: ../../library/tempfile.rst:237 msgid "" "Return the name of the directory used for temporary files. This defines the " "default value for the *dir* argument to all functions in this module." msgstr "" -#: ../../library/tempfile.rst:238 +#: ../../library/tempfile.rst:241 msgid "" "Python searches a standard list of directories to find one which the calling " "user can create files in. The list is:" msgstr "" -#: ../../library/tempfile.rst:241 +#: ../../library/tempfile.rst:244 msgid "The directory named by the :envvar:`TMPDIR` environment variable." msgstr "" -#: ../../library/tempfile.rst:243 +#: ../../library/tempfile.rst:246 msgid "The directory named by the :envvar:`TEMP` environment variable." msgstr "" -#: ../../library/tempfile.rst:245 +#: ../../library/tempfile.rst:248 msgid "The directory named by the :envvar:`TMP` environment variable." msgstr "" -#: ../../library/tempfile.rst:247 +#: ../../library/tempfile.rst:250 msgid "A platform-specific location:" msgstr "" -#: ../../library/tempfile.rst:249 +#: ../../library/tempfile.rst:252 msgid "" "On Windows, the directories :file:`C:\\\\TEMP`, :file:`C:\\\\TMP`, :file:`\\" "\\TEMP`, and :file:`\\\\TMP`, in that order." msgstr "" -#: ../../library/tempfile.rst:252 +#: ../../library/tempfile.rst:255 msgid "" "On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" "file:`/usr/tmp`, in that order." msgstr "" -#: ../../library/tempfile.rst:255 +#: ../../library/tempfile.rst:258 msgid "As a last resort, the current working directory." msgstr "" -#: ../../library/tempfile.rst:257 +#: ../../library/tempfile.rst:260 msgid "" "The result of this search is cached, see the description of :data:`tempdir` " "below." msgstr "" -#: ../../library/tempfile.rst:262 +#: ../../library/tempfile.rst:265 msgid "" "Always returns a str. Previously it would return any :data:`tempdir` value " "regardless of type so long as it was not ``None``." msgstr "" -#: ../../library/tempfile.rst:267 +#: ../../library/tempfile.rst:270 msgid "Same as :func:`gettempdir` but the return value is in bytes." msgstr "" -#: ../../library/tempfile.rst:273 +#: ../../library/tempfile.rst:276 msgid "" "Return the filename prefix used to create temporary files. This does not " "contain the directory component." msgstr "" -#: ../../library/tempfile.rst:278 +#: ../../library/tempfile.rst:281 msgid "Same as :func:`gettempprefix` but the return value is in bytes." msgstr "" -#: ../../library/tempfile.rst:282 +#: ../../library/tempfile.rst:285 msgid "" "The module uses a global variable to store the name of the directory used " "for temporary files returned by :func:`gettempdir`. It can be set directly " @@ -374,21 +380,21 @@ msgid "" "unsuspecting code by changing global API behavior." msgstr "" -#: ../../library/tempfile.rst:291 +#: ../../library/tempfile.rst:294 msgid "" "When set to a value other than ``None``, this variable defines the default " "value for the *dir* argument to the functions defined in this module, " "including its type, bytes or str. It cannot be a :term:`path-like object`." msgstr "" -#: ../../library/tempfile.rst:296 +#: ../../library/tempfile.rst:299 msgid "" "If ``tempdir`` is ``None`` (the default) at any call to any of the above " "functions except :func:`gettempprefix` it is initialized following the " "algorithm described in :func:`gettempdir`." msgstr "" -#: ../../library/tempfile.rst:302 +#: ../../library/tempfile.rst:305 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " "effect: The global default return type of :func:`mkstemp` and :func:" @@ -398,23 +404,22 @@ msgid "" "compatibility with the historical implementation." msgstr "" -#: ../../library/tempfile.rst:313 +#: ../../library/tempfile.rst:316 msgid "Examples" msgstr "範例" -#: ../../library/tempfile.rst:315 +#: ../../library/tempfile.rst:318 msgid "Here are some examples of typical usage of the :mod:`tempfile` module::" msgstr "" "以下是 :mod:`tempfile` 模組的一些常見用法範例:\n" "\n" "::" - -#: ../../library/tempfile.rst:347 +#: ../../library/tempfile.rst:350 msgid "Deprecated functions and variables" msgstr "" -#: ../../library/tempfile.rst:349 +#: ../../library/tempfile.rst:352 msgid "" "A historical way to create temporary files was to first generate a file name " "with the :func:`mktemp` function and then create a file using this name. " @@ -425,11 +430,11 @@ msgid "" "used by :func:`mkstemp` and the other functions described above." msgstr "" -#: ../../library/tempfile.rst:360 +#: ../../library/tempfile.rst:363 msgid "Use :func:`mkstemp` instead." msgstr "" -#: ../../library/tempfile.rst:363 +#: ../../library/tempfile.rst:366 msgid "" "Return an absolute pathname of a file that did not exist at the time the " "call is made. The *prefix*, *suffix*, and *dir* arguments are similar to " @@ -437,7 +442,7 @@ msgid "" "``prefix=None`` are not supported." msgstr "" -#: ../../library/tempfile.rst:370 +#: ../../library/tempfile.rst:373 msgid "" "Use of this function may introduce a security hole in your program. By the " "time you get around to doing anything with the file name it returns, someone "