@@ -1,10 +1,9 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # Copyright (C) 2001-2023, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw <adrianliaw2000@gmail.com>, 2018 # Matt Wang <mattwang44@gmail.com>, 2021-2022 # Matt Wang <mattwang44@gmail.com>, 2021-2023 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" Expand Down Expand Up @@ -74,11 +73,12 @@ msgid "" "rely on a temporary file created using this function having or not having a " "visible name in the file system." msgstr "" "回傳一個可當作臨時儲存區域的 :term:`file-like object`。建立該檔案使用了與 :" "func:`mkstemp` 相同的安全規則。它將在關閉(包括當物件被垃圾回收 (garbage " "collect) 時的隱式關閉)後立即銷毀。在 Unix 下,該檔案所在的目錄可能根本不被建" "立、或者在建立檔案後立即就被刪除,其他平臺不支援此功能;你的程式不應依賴使用" "此功能建立的臨時檔案名稱,因為它在檔案系統中的名稱有可能是不可見的。" "回傳一個可當作臨時儲存區域的\\ :term:`類檔案物件 <file-like object>`。建立該" "檔案使用了與 :func:`mkstemp` 相同的安全規則。它將在關閉(包括當物件被垃圾回" "收 (garbage collect) 時的隱式關閉)後立即銷毀。在 Unix 下,該檔案所在的目錄可" "能根本不被建立、或者在建立檔案後立即就被刪除,其他平臺不支援此功能;你的程式" "不應依賴使用此功能建立的臨時檔案名稱,因為它在檔案系統中的名稱有可能是不可見" "的。" #: ../../library/tempfile.rst:44 msgid "" Expand Down Expand Up @@ -156,20 +156,22 @@ msgstr "新增 *errors* 參數。" msgid "" "This function operates exactly as :func:`TemporaryFile` does, except the " "following differences:" msgstr "" msgstr "此函式的操作與 :func:`TemporaryFile` 完全相同,但存在以下差異: " #: ../../library/tempfile.rst:83 msgid "" "This function returns a file that is guaranteed to have a visible name in " "the file system." msgstr "" msgstr "此函式回傳一個保證在檔案系統中具有可見名稱的檔案。 " #: ../../library/tempfile.rst:85 msgid "" "To manage the named file, it extends the parameters of :func:`TemporaryFile` " "with *delete* and *delete_on_close* parameters that determine whether and " "how the named file should be automatically deleted." msgstr "" "為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴充 :func:" "`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" #: ../../library/tempfile.rst:89 msgid "" Expand All @@ -181,6 +183,11 @@ msgid "" "`TemporaryFile`, the directory entry does not get unlinked immediately after " "the file creation." msgstr "" "回傳的物件始終是一個\\ :term:`類檔案物件 <file-like object>`,其 :attr:`!" "file` 屬性是底層的真實檔案物件。這個\\ :term:`類檔案物件 <file-like " "object>`\\ 可以在 :keyword:`with` 陳述式中使用,就像普通檔案一樣。臨時檔案的" "名稱可以從回傳的類檔案物件的 :attr:`name` 屬性中取得。在 Unix 上則與 :func:" "`TemporaryFile` 不同,目錄條目不會在檔案建立後立即被取消鏈接 (unlink)。" #: ../../library/tempfile.rst:97 msgid "" Expand All @@ -191,6 +198,12 @@ msgid "" "not always guaranteed in this case (see :meth:`object.__del__`). If *delete* " "is false, the value of *delete_on_close* is ignored." msgstr "" "如果 *delete* 為 true(預設值)並且 *delete_on_close* 為 true(預設值),則檔" "案在關閉後會立即被刪除。如果 *delete* 為 true 並且 *delete_on_close* 為 " "false,則僅在情境管理器退出時刪除檔案,或者在\\ :term:`類檔案物件 <file-like " "object>`\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參閱 :" "meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " "*delete_on_close* 的值。" #: ../../library/tempfile.rst:104 msgid "" Expand All @@ -201,32 +214,38 @@ msgid "" "false. The latter approach is recommended as it provides assistance in " "automatic cleaning of the temporary file upon the context manager exit." msgstr "" "因此,要在關閉檔案後使用臨時檔案的名稱重新打開檔案,請確保在關閉時不刪除檔案" "(將 *delete* 參數設定為 false),或者如果臨時檔案是以 :keyword:`with` 陳述式" "建立,要將 *delete_on_close* 參數設定為 false。建議使用後者,因為它有助於在情" "境管理器退出時自動清理臨時檔案。" #: ../../library/tempfile.rst:111 msgid "" "Opening the temporary file again by its name while it is still open works as " "follows:" msgstr "" msgstr "在臨時檔案仍處於打開狀態時再次按其名稱打開它,其作用方式如下: " #: ../../library/tempfile.rst:114 msgid "On POSIX the file can always be opened again." msgstr "" msgstr "在 POSIX 上,檔案始終可以再次打開。 " #: ../../library/tempfile.rst:115 msgid "" "On Windows, make sure that at least one of the following conditions are " "fulfilled:" msgstr "" msgstr "在 Windows 上,確保至少滿足以下條件之一: " #: ../../library/tempfile.rst:118 msgid "*delete* is false" msgstr "" msgstr "*delete* 為 false " #: ../../library/tempfile.rst:119 msgid "" "additional open shares delete access (e.g. by calling :func:`os.open` with " "the flag ``O_TEMPORARY``)" msgstr "" "額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼叫 :" "func:`os.open`\\ )" #: ../../library/tempfile.rst:121 msgid "" Expand All @@ -236,6 +255,10 @@ msgid "" "func:`os.unlink` call on context manager exit will fail with a :exc:" "`PermissionError`." msgstr "" "*delete* 為 true 但 *delete_on_close* 為 false。請注意,在這種情況下不共享刪" "除存取權限的其他 open(例如透過內建的 :func:`open` 建立)必須在退出情境管理器" "之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出現 :exc:" "`PermissionError`。" #: ../../library/tempfile.rst:127 msgid "" Expand All @@ -246,12 +269,18 @@ msgid "" "requested by the open, which fails immediately if the requested access is " "not granted." msgstr "" "在 Windows 上,如果 *delete_on_close* 為 false,並且檔案是在使用者缺乏刪除存" "取權限的目錄中建立的,則情境管理器退出時的 :func:`os.unlink` 呼叫將失敗,並引" "發 :exc:`PermissionError`。當 *delete_on_close* 為 true 時,不會發生這種情" "況,因為刪除存取權限是由 open 來要求的,如果未授予存取權限則會立即失敗。" #: ../../library/tempfile.rst:134 msgid "" "On POSIX (only), a process that is terminated abruptly with SIGKILL cannot " "automatically delete any NamedTemporaryFiles it created." msgstr "" "(僅)在 POSIX 上,因使用 SIGKILL 而被終止的行程無法自動刪除它建立的任何 " "NamedTemporaryFiles。" #: ../../library/tempfile.rst:142 msgid "Added *delete_on_close* parameter." Expand Down Expand Up @@ -299,6 +328,8 @@ msgid "" "abstract base classes (depending on whether binary or text *mode* was " "specified)." msgstr "" "完全實作 :class:`io.BufferedIOBase` 和 :class:`io.TextIOBase` 抽象基底類別" "(取決於指定的是二進位還是文本 *mode*\\ )。" #: ../../library/tempfile.rst:178 msgid "" Expand Down Expand Up @@ -349,6 +380,9 @@ msgid "" "during debugging or when you need your cleanup behavior to be conditional " "based on other logic." msgstr "" "*delete* 參數可以停用在退出情境時對目錄樹的清理,雖然停用情境管理器在退出情境" "時所採取的操作似乎不常見,但它在除錯期間或當你需要基於其他邏輯的清理行為時會" "非常有用。" #: ../../library/tempfile.rst:204 ../../library/tempfile.rst:284 msgid "" Expand Down Expand Up @@ -494,13 +528,13 @@ msgstr "" #: ../../library/tempfile.rst:282 msgid ":func:`mkdtemp` returns the absolute pathname of the new directory." msgstr "" msgstr ":func:`mkdtemp` 回傳新目錄的絕對路徑名稱。 " #: ../../library/tempfile.rst:295 msgid "" ":func:`mkdtemp` now always returns an absolute path, even if *dir* is " "relative." msgstr "" msgstr ":func:`mkdtemp` 現在都會回傳絕對路徑,即使 *dir* 是相對路徑。 " #: ../../library/tempfile.rst:301 msgid "" Expand Down