44# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55#
66# Translators:
7- # tomo, 2021
87# Osamu NAKAMURA, 2021
98# Arihiro TAKASE, 2023
109# 石井明久, 2024
10+ # tomo, 2024
1111#
1212#, fuzzy
1313msgid ""
1414msgstr ""
1515"Project-Id-Version : Python 3.13\n "
1616"Report-Msgid-Bugs-To : \n "
17- "POT-Creation-Date : 2024-10-11 14:17+0000\n "
17+ "POT-Creation-Date : 2024-11-01 14:17+0000\n "
1818"PO-Revision-Date : 2021-06-28 00:57+0000\n "
19- "Last-Translator : 石井明久 , 2024\n "
19+ "Last-Translator : tomo , 2024\n "
2020"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
2121"ja/)\n "
2222"MIME-Version : 1.0\n "
@@ -248,93 +248,125 @@ msgstr ""
248248
249249#: ../../library/contextvars.rst:147
250250msgid ""
251- "Every thread will have a different top-level :class:`~contextvars. Context` "
252- "object. This means that a :class:`ContextVar ` object behaves in a similar "
253- "fashion to :func:`threading.local` when values are assigned in different "
254- "threads ."
251+ "Each thread has its own effective stack of :class:`! Context` objects. The : "
252+ "term:`current context` is the :class:`!Context ` object at the top of the "
253+ "current thread's stack. All :class:`!Context` objects in the stacks are "
254+ "considered to be *entered* ."
255255msgstr ""
256256
257257#: ../../library/contextvars.rst:152
258- msgid "Context implements the :class:`collections.abc.Mapping` interface."
258+ msgid ""
259+ "*Entering* a context, which can be done by calling its :meth:`~Context.run` "
260+ "method, makes the context the current context by pushing it onto the top of "
261+ "the current thread's context stack."
259262msgstr ""
260- "Context は、 :class:`collections.abc.Mapping` インターフェースを実装します。"
261263
262264#: ../../library/contextvars.rst:156
263265msgid ""
264- "Execute ``callable(*args, **kwargs)`` code in the context object the *run* "
265- "method is called on. Return the result of the execution or propagate an "
266- "exception if one occurred."
266+ "*Exiting* from the current context, which can be done by returning from the "
267+ "callback passed to the :meth:`~Context.run` method, restores the current "
268+ "context to what it was before the context was entered by popping the context "
269+ "off the top of the context stack."
267270msgstr ""
268- "``callable(*args, **kwargs)`` を *run* メソッドが呼ばれたコンテキストオブジェ"
269- "クトの中で実行します。実行した結果を返すか、例外が発生した場合はその例外を伝"
270- "播します。"
271271
272- #: ../../library/contextvars.rst:160
272+ #: ../../library/contextvars.rst:161
273273msgid ""
274- "Any changes to any context variables that *callable* makes will be contained "
275- "in the context object::"
274+ "Since each thread has its own context stack, :class:`ContextVar` objects "
275+ "behave in a similar fashion to :func:`threading.local` when values are "
276+ "assigned in different threads."
276277msgstr ""
277- "*callable* が行ったコンテキスト変数へのいかなる変更も、コンテキストオブジェク"
278- "トに格納されます::"
279278
280- #: ../../library/contextvars.rst:163
279+ #: ../../library/contextvars.rst:165
281280msgid ""
282- "var = ContextVar('var')\n"
281+ "Attempting to enter an already entered context, including contexts entered "
282+ "in other threads, raises a :exc:`RuntimeError`."
283+ msgstr ""
284+
285+ #: ../../library/contextvars.rst:168
286+ msgid "After exiting a context, it can later be re-entered (from any thread)."
287+ msgstr ""
288+
289+ #: ../../library/contextvars.rst:170
290+ msgid ""
291+ "Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` "
292+ "method are recorded in the current context. The :meth:`ContextVar.get` "
293+ "method returns the value associated with the current context. Exiting a "
294+ "context effectively reverts any changes made to context variables while the "
295+ "context was entered (if needed, the values can be restored by re-entering "
296+ "the context)."
297+ msgstr ""
298+
299+ #: ../../library/contextvars.rst:177
300+ msgid "Context implements the :class:`collections.abc.Mapping` interface."
301+ msgstr ""
302+ "Context は、 :class:`collections.abc.Mapping` インターフェースを実装します。"
303+
304+ #: ../../library/contextvars.rst:181
305+ msgid ""
306+ "Enters the Context, executes ``callable(*args, **kwargs)``, then exits the "
307+ "Context. Returns *callable*'s return value, or propagates an exception if "
308+ "one occurred."
309+ msgstr ""
310+
311+ #: ../../library/contextvars.rst:185
312+ msgid "Example:"
313+ msgstr "例:"
314+
315+ #: ../../library/contextvars.rst:187
316+ msgid ""
317+ "import contextvars\n"
318+ "\n"
319+ "var = contextvars.ContextVar('var')\n"
283320"var.set('spam')\n"
321+ "print(var.get()) # 'spam'\n"
322+ "\n"
323+ "ctx = contextvars.copy_context()\n"
284324"\n"
285325"def main():\n"
286326" # 'var' was set to 'spam' before\n"
287327" # calling 'copy_context()' and 'ctx.run(main)', so:\n"
288- " # var.get() == ctx[var] == 'spam'\n"
328+ " print(var.get()) # 'spam'\n"
329+ " print(ctx[var]) # 'spam'\n"
289330"\n"
290331" var.set('ham')\n"
291332"\n"
292333" # Now, after setting 'var' to 'ham':\n"
293- " # var.get() == ctx[var] == 'ham'\n"
294- "\n"
295- "ctx = copy_context()\n"
334+ " print(var.get()) # 'ham'\n"
335+ " print(ctx[var]) # 'ham'\n"
296336"\n"
297337"# Any changes that the 'main' function makes to 'var'\n"
298338"# will be contained in 'ctx'.\n"
299339"ctx.run(main)\n"
300340"\n"
301341"# The 'main()' function was run in the 'ctx' context,\n"
302342"# so changes to 'var' are contained in it:\n"
303- "# ctx[var] == 'ham'\n"
343+ "print( ctx[var]) # 'ham'\n"
304344"\n"
305345"# However, outside of 'ctx', 'var' is still set to 'spam':\n"
306- "# var.get() == 'spam'"
307- msgstr ""
308-
309- #: ../../library/contextvars.rst:189
310- msgid ""
311- "The method raises a :exc:`RuntimeError` when called on the same context "
312- "object from more than one OS thread, or when called recursively."
346+ "print(var.get()) # 'spam'"
313347msgstr ""
314- "2つ以上の OS スレッドから同一のコンテキストオブジェクトを呼び出すか、再帰的に"
315- "呼び出したとき、メソッドは :exc:`RuntimeError` を送出します。"
316348
317- #: ../../library/contextvars.rst:195
349+ #: ../../library/contextvars.rst:233
318350msgid "Return a shallow copy of the context object."
319351msgstr "コンテキストオブジェクトの浅いコピーを返します。"
320352
321- #: ../../library/contextvars.rst:199
353+ #: ../../library/contextvars.rst:237
322354msgid ""
323355"Return ``True`` if the *context* has a value for *var* set; return ``False`` "
324356"otherwise."
325357msgstr ""
326358"*context* に *var* の値が設定されていた場合 ``True`` を返します; そうでない場"
327359"合は ``False`` を返します。"
328360
329- #: ../../library/contextvars.rst:204
361+ #: ../../library/contextvars.rst:242
330362msgid ""
331363"Return the value of the *var* :class:`ContextVar` variable. If the variable "
332364"is not set in the context object, a :exc:`KeyError` is raised."
333365msgstr ""
334366":class:`ContextVar` *var* の値を返します。コンテキストオブジェクト内で変数が"
335367"設定されていない場合は、:exc:`KeyError` を送出します。"
336368
337- #: ../../library/contextvars.rst:210
369+ #: ../../library/contextvars.rst:248
338370msgid ""
339371"Return the value for *var* if *var* has the value in the context object. "
340372"Return *default* otherwise. If *default* is not given, return ``None``."
@@ -343,35 +375,35 @@ msgstr ""
343375"れば、*default* を返します。*default* を指定していなければ、``None`` を返しま"
344376"す。"
345377
346- #: ../../library/contextvars.rst:216
378+ #: ../../library/contextvars.rst:254
347379msgid "Return an iterator over the variables stored in the context object."
348380msgstr "コンテキストオブジェクトに格納されている変数群のイテレータを返します。"
349381
350- #: ../../library/contextvars.rst:221
382+ #: ../../library/contextvars.rst:259
351383msgid "Return the number of variables set in the context object."
352384msgstr "コンテキストオブジェクトに格納されている変数の数を返します。"
353385
354- #: ../../library/contextvars.rst:225
386+ #: ../../library/contextvars.rst:263
355387msgid "Return a list of all variables in the context object."
356388msgstr "コンテキストオブジェクト中のすべての変数のリストを返します。"
357389
358- #: ../../library/contextvars.rst:229
390+ #: ../../library/contextvars.rst:267
359391msgid "Return a list of all variables' values in the context object."
360392msgstr "コンテキストオブジェクト中のすべての変数の値のリストを返します。"
361393
362- #: ../../library/contextvars.rst:234
394+ #: ../../library/contextvars.rst:272
363395msgid ""
364396"Return a list of 2-tuples containing all variables and their values in the "
365397"context object."
366398msgstr ""
367399"コンテキストオブジェクト中のすべての変数について、変数とその値からなる2要素の"
368400"タプルのリストを返します。"
369401
370- #: ../../library/contextvars.rst:239
402+ #: ../../library/contextvars.rst:277
371403msgid "asyncio support"
372404msgstr "asyncio サポート"
373405
374- #: ../../library/contextvars.rst:241
406+ #: ../../library/contextvars.rst:279
375407msgid ""
376408"Context variables are natively supported in :mod:`asyncio` and are ready to "
377409"be used without any extra configuration. For example, here is a simple echo "
@@ -382,7 +414,7 @@ msgstr ""
382414"ば、次の単純なechoサーバーは、クライアントを扱う Task の中でリモートクライア"
383415"ントのアドレスが利用できるように、コンテキスト変数を利用します::"
384416
385- #: ../../library/contextvars.rst:247
417+ #: ../../library/contextvars.rst:285
386418msgid ""
387419"import asyncio\n"
388420"import contextvars\n"
0 commit comments