-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathcontextlib.po
233 lines (211 loc) · 12 KB
/
contextlib.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 1990-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Python 2.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 01:01+0900\n"
"PO-Revision-Date: 2019-09-01 05:18+0000\n"
"Last-Translator: tomo\n"
"Language-Team: Japanese (http://www.transifex.com/python-doc/python-27/"
"language/ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/contextlib.rst:2
msgid ""
":mod:`contextlib` --- Utilities for :keyword:`with`\\ -statement contexts"
msgstr ":mod:`contextlib` --- :keyword:`with` 文コンテキスト用ユーティリティ"
#: ../../library/contextlib.rst:10
msgid "**Source code:** :source:`Lib/contextlib.py`"
msgstr "**ソースコード:** :source:`Lib/contextlib.py`"
#: ../../library/contextlib.rst:14
msgid ""
"This module provides utilities for common tasks involving the :keyword:"
"`with` statement. For more information see also :ref:`typecontextmanager` "
"and :ref:`context-managers`."
msgstr ""
"このモジュールは :keyword:`with` 文に関わる一般的なタスクのためのユーティリ"
"ティを提供します。詳しい情報は、 :ref:`typecontextmanager` と :ref:`context-"
"managers` を参照してください。"
#: ../../library/contextlib.rst:18
msgid "Functions provided:"
msgstr "提供されている関数:"
#: ../../library/contextlib.rst:23
msgid ""
"This function is a :term:`decorator` that can be used to define a factory "
"function for :keyword:`with` statement context managers, without needing to "
"create a class or separate :meth:`__enter__` and :meth:`__exit__` methods."
msgstr ""
"この関数は :keyword:`with` 文コンテキストマネージャのファクトリ関数を定義する"
"ために利用できる :term:`デコレータ <decorator>` です。新しいクラスや :meth:"
"`__enter__` と :meth:`__exit__` メソッドを別々に定義しなくても、ファクトリ関"
"数を定義することができます。"
#: ../../library/contextlib.rst:27
msgid ""
"While many objects natively support use in with statements, sometimes a "
"resource needs to be managed that isn't a context manager in its own right, "
"and doesn't implement a ``close()`` method for use with ``contextlib."
"closing``"
msgstr ""
#: ../../library/contextlib.rst:31
msgid ""
"An abstract example would be the following to ensure correct resource "
"management::"
msgstr ""
#: ../../library/contextlib.rst:50
msgid ""
"The function being decorated must return a :term:`generator`-iterator when "
"called. This iterator must yield exactly one value, which will be bound to "
"the targets in the :keyword:`with` statement's :keyword:`as` clause, if any."
msgstr ""
"デコレート対象の関数は呼び出されたときに :term:`ジェネレータ <generator>`-イ"
"テレータを返す必要があります。このイテレータは必ず値を1つ yield しなければな"
"りません。 :keyword:`with` 文の :keyword:`as` 節が存在するなら、その値は as "
"節のターゲットへ束縛されることになります。"
#: ../../library/contextlib.rst:54
msgid ""
"At the point where the generator yields, the block nested in the :keyword:"
"`with` statement is executed. The generator is then resumed after the block "
"is exited. If an unhandled exception occurs in the block, it is reraised "
"inside the generator at the point where the yield occurred. Thus, you can "
"use a :keyword:`try`...\\ :keyword:`except`...\\ :keyword:`finally` "
"statement to trap the error (if any), or ensure that some cleanup takes "
"place. If an exception is trapped merely in order to log it or to perform "
"some action (rather than to suppress it entirely), the generator must "
"reraise that exception. Otherwise the generator context manager will "
"indicate to the :keyword:`with` statement that the exception has been "
"handled, and execution will resume with the statement immediately following "
"the :keyword:`with` statement."
msgstr ""
"ジェネレータが yield を実行した箇所で :keyword:`with` 文のネストされたブロッ"
"クが実行されます。ブロックから抜けた後でジェネレータは再開されます。ブロック"
"内で処理されない例外が発生した場合は、ジェネレータ内部の yield を実行した箇所"
"で例外が再送出されます。なので、(もしあれば) エラーを捕捉したり、クリーンアッ"
"プ処理を確実に実行したりするために、:keyword:`try`...\\ :keyword:`except`..."
"\\ :keyword:`finally` 構文を使用できます。例外を捕捉する目的が、(完全に例外を"
"抑制してしまうのではなく) 単に例外のログをとるため、もしくはあるアクションを"
"実行するためなら、ジェネレータはその例外を再送出しなければなりません。例外を"
"再送出しない場合、ジェネレータのコンテキストマネージャは :keyword:`with` 文に"
"対して例外が処理されたことを示し、:keyword:`with` 文の直後の文から実行を再開"
"します。"
#: ../../library/contextlib.rst:69
msgid "Combine multiple context managers into a single nested context manager."
msgstr ""
"複数のコンテキストマネージャを一つのネストされたコンテキストマネージャへ結合"
"します。"
#: ../../library/contextlib.rst:71
msgid ""
"This function has been deprecated in favour of the multiple manager form of "
"the :keyword:`with` statement."
msgstr ""
"この関数は、 :keyword:`with` 文にマルチマネージャー形式ができたために非推奨に"
"なりました。"
#: ../../library/contextlib.rst:74
msgid ""
"The one advantage of this function over the multiple manager form of the :"
"keyword:`with` statement is that argument unpacking allows it to be used "
"with a variable number of context managers as follows::"
msgstr ""
"この関数の :keyword:`with` 文のマルチマネージャー形式に対する唯一の利点は、引"
"数のアンパックによって、次の例のように可変数個のコンテキストマネージャーを扱"
"えることです。 ::"
#: ../../library/contextlib.rst:83
msgid ""
"Note that if the :meth:`__exit__` method of one of the nested context "
"managers indicates an exception should be suppressed, no exception "
"information will be passed to any remaining outer context managers. "
"Similarly, if the :meth:`__exit__` method of one of the nested managers "
"raises an exception, any previous exception state will be lost; the new "
"exception will be passed to the :meth:`__exit__` methods of any remaining "
"outer context managers. In general, :meth:`__exit__` methods should avoid "
"raising exceptions, and in particular they should not re-raise a passed-in "
"exception."
msgstr ""
"ネストされたコンテキストマネージャのうちのいずれかの :meth:`__exit__` メソッ"
"ドが例外を抑制すべきと判断した場合、外側にある残りのすべてのコンテキストマ"
"ネージャに例外情報が渡されないということに注意してください。同様に、ネストさ"
"れたコンテキストマネージャのうちのいずれかの :meth:`__exit__` メソッドが例外"
"を送出したならば、それ以前の例外状態は失われ、新しい例外が外側にある残りのす"
"べてのコンテキストマネージャの :meth:`__exit__` メソッドに渡されます。一般的"
"に :meth:`__exit__` メソッドが例外を送出することは避けるべきであり、特に渡さ"
"れた例外を再送出すべきではありません。"
#: ../../library/contextlib.rst:92
msgid ""
"This function has two major quirks that have led to it being deprecated. "
"Firstly, as the context managers are all constructed before the function is "
"invoked, the :meth:`__new__` and :meth:`__init__` methods of the inner "
"context managers are not actually covered by the scope of the outer context "
"managers. That means, for example, that using :func:`nested` to open two "
"files is a programming error as the first file will not be closed promptly "
"if an exception is thrown when opening the second file."
msgstr ""
"この関数が非推奨になった理由に、2つの大きな問題があります。 1つ目は、全てのコ"
"ンテキストマネージャーが関数が呼び出される前に構築されることです。内側のコン"
"テキストマネージャーの :meth:`__new__` と :meth:`__init__` メソッドは外側のコ"
"ンテキストマネージャーの内側に入っていません。つまり、例えば :func:`nested` "
"を2つのファイルを開くために利用した場合、 2つめのファイルを開くのに失敗すると"
"1つめのファイルが正しく close されないというプログラムエラーになります。"
#: ../../library/contextlib.rst:100
msgid ""
"Secondly, if the :meth:`__enter__` method of one of the inner context "
"managers raises an exception that is caught and suppressed by the :meth:"
"`__exit__` method of one of the outer context managers, this construct will "
"raise :exc:`RuntimeError` rather than skipping the body of the :keyword:"
"`with` statement."
msgstr ""
"2つ目の問題は、内側のコンテキストマネージャーの1つの :meth:`__enter__` メソッ"
"ドが例外を発生させたときに、外側のコンテキストマネージャーの :meth:"
"`__exit__` メソッドがその例外を捕まえて抑制させてしまうことで、この場合に :"
"keyword:`with` の body 部分の実行がスキップされるのではなく :exc:"
"`RuntimeError` が発生する恐れがあります。"
#: ../../library/contextlib.rst:106
msgid ""
"Developers that need to support nesting of a variable number of context "
"managers can either use the :mod:`warnings` module to suppress the "
"DeprecationWarning raised by this function or else use this function as a "
"model for an application specific implementation."
msgstr ""
"可変数個のコンテキストマネージャーのネストをサポートしなければならない場"
"合、 :mod:`warnings` モジュールを利用してこの関数が発生させる "
"DeprecationWarning を抑制するか、この関数を参考にしてアプリケーション独自の実"
"装をすることができます。"
#: ../../library/contextlib.rst:111
msgid ""
"The with-statement now supports this functionality directly (without the "
"confusing error prone quirks)."
msgstr ""
"with 文がこの関数の機能を(この関数と違って奇妙なエラーを発生させることなし"
"に) 直接サポートしました。"
#: ../../library/contextlib.rst:117
msgid ""
"Return a context manager that closes *thing* upon completion of the block. "
"This is basically equivalent to::"
msgstr ""
"ブロックの完了時に *thing* を close するコンテキストマネージャを返します。こ"
"れは基本的に以下と等価です::"
#: ../../library/contextlib.rst:129
msgid "And lets you write code like this::"
msgstr ""
"そして、明示的に ``page`` を close する必要なしに、次のように書くことができま"
"す::"
#: ../../library/contextlib.rst:138
msgid ""
"without needing to explicitly close ``page``. Even if an error occurs, "
"``page.close()`` will be called when the :keyword:`with` block is exited."
msgstr ""
"``page`` を明示的に close する必要は無く、エラーが発生した場合でも、 :"
"keyword:`with` ブロックを出るときに ``page.close()`` が呼ばれます。"
#: ../../library/contextlib.rst:145
msgid ":pep:`343` - The \"with\" statement"
msgstr ":pep:`343` - \"with\" ステートメント"
#: ../../library/contextlib.rst:145
msgid ""
"The specification, background, and examples for the Python :keyword:`with` "
"statement."
msgstr "仕様、背景、および、Python :keyword:`with` 文の例。"