| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 335b14c commit 6542869
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,19 +4,19 @@ | |||
| 4 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
| 5 | 5 | # | |
| 6 | 6 | # Translators: | |
| 7 | - # tomo, 2021 | ||
| 8 | 7 | # Osamu NAKAMURA, 2021 | |
| 9 | 8 | # Arihiro TAKASE, 2023 | |
| 10 | 9 | # 石井明久, 2024 | |
| 10 | + # tomo, 2024 | ||
| 11 | 11 | # | |
| 12 | 12 | #, fuzzy | |
| 13 | 13 | msgid "" | |
| 14 | 14 | msgstr "" | |
| 15 | 15 | "Project-Id-Version: Python 3.13\n" | |
| 16 | 16 | "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" | ||
| 18 | 18 | "PO-Revision-Date: 2021-06-28 00:57+0000\n" | |
| 19 | - "Last-Translator: 石井明久, 2024\n" | ||
| 19 | + "Last-Translator: tomo, 2024\n" | ||
| 20 | 20 | "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" | |
| 21 | 21 | "ja/)\n" | |
| 22 | 22 | "MIME-Version: 1.0\n" | |
@@ -248,93 +248,125 @@ msgstr "" | |||
| 248 | 248 | ||
| 249 | 249 | #: ../../library/contextvars.rst:147 | |
| 250 | 250 | msgid "" | |
| 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*." | ||
| 255 | 255 | msgstr "" | |
| 256 | 256 | ||
| 257 | 257 | #: ../../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." | ||
| 259 | 262 | msgstr "" | |
| 260 | - "Context は、 :class:`collections.abc.Mapping` インターフェースを実装します。" | ||
| 261 | 263 | ||
| 262 | 264 | #: ../../library/contextvars.rst:156 | |
| 263 | 265 | msgid "" | |
| 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." | ||
| 267 | 270 | msgstr "" | |
| 268 | - "``callable(*args, **kwargs)`` を *run* メソッドが呼ばれたコンテキストオブジェ" | ||
| 269 | - "クトの中で実行します。実行した結果を返すか、例外が発生した場合はその例外を伝" | ||
| 270 | - "播します。" | ||
| 271 | 271 | ||
| 272 | - #: ../../library/contextvars.rst:160 | ||
| 272 | + #: ../../library/contextvars.rst:161 | ||
| 273 | 273 | msgid "" | |
| 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." | ||
| 276 | 277 | msgstr "" | |
| 277 | - "*callable* が行ったコンテキスト変数へのいかなる変更も、コンテキストオブジェク" | ||
| 278 | - "トに格納されます::" | ||
| 279 | 278 | ||
| 280 | - #: ../../library/contextvars.rst:163 | ||
| 279 | + #: ../../library/contextvars.rst:165 | ||
| 281 | 280 | msgid "" | |
| 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" | ||
| 283 | 320 | "var.set('spam')\n" | |
| 321 | + "print(var.get()) # 'spam'\n" | ||
| 322 | + "\n" | ||
| 323 | + "ctx = contextvars.copy_context()\n" | ||
| 284 | 324 | "\n" | |
| 285 | 325 | "def main():\n" | |
| 286 | 326 | " # 'var' was set to 'spam' before\n" | |
| 287 | 327 | " # 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" | ||
| 289 | 330 | "\n" | |
| 290 | 331 | " var.set('ham')\n" | |
| 291 | 332 | "\n" | |
| 292 | 333 | " # 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" | ||
| 296 | 336 | "\n" | |
| 297 | 337 | "# Any changes that the 'main' function makes to 'var'\n" | |
| 298 | 338 | "# will be contained in 'ctx'.\n" | |
| 299 | 339 | "ctx.run(main)\n" | |
| 300 | 340 | "\n" | |
| 301 | 341 | "# The 'main()' function was run in the 'ctx' context,\n" | |
| 302 | 342 | "# so changes to 'var' are contained in it:\n" | |
| 303 | - "# ctx[var] == 'ham'\n" | ||
| 343 | + "print(ctx[var]) # 'ham'\n" | ||
| 304 | 344 | "\n" | |
| 305 | 345 | "# 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'" | ||
| 313 | 347 | msgstr "" | |
| 314 | - "2つ以上の OS スレッドから同一のコンテキストオブジェクトを呼び出すか、再帰的に" | ||
| 315 | - "呼び出したとき、メソッドは :exc:`RuntimeError` を送出します。" | ||
| 316 | 348 | ||
| 317 | - #: ../../library/contextvars.rst:195 | ||
| 349 | + #: ../../library/contextvars.rst:233 | ||
| 318 | 350 | msgid "Return a shallow copy of the context object." | |
| 319 | 351 | msgstr "コンテキストオブジェクトの浅いコピーを返します。" | |
| 320 | 352 | ||
| 321 | - #: ../../library/contextvars.rst:199 | ||
| 353 | + #: ../../library/contextvars.rst:237 | ||
| 322 | 354 | msgid "" | |
| 323 | 355 | "Return ``True`` if the *context* has a value for *var* set; return ``False`` " | |
| 324 | 356 | "otherwise." | |
| 325 | 357 | msgstr "" | |
| 326 | 358 | "*context* に *var* の値が設定されていた場合 ``True`` を返します; そうでない場" | |
| 327 | 359 | "合は ``False`` を返します。" | |
| 328 | 360 | ||
| 329 | - #: ../../library/contextvars.rst:204 | ||
| 361 | + #: ../../library/contextvars.rst:242 | ||
| 330 | 362 | msgid "" | |
| 331 | 363 | "Return the value of the *var* :class:`ContextVar` variable. If the variable " | |
| 332 | 364 | "is not set in the context object, a :exc:`KeyError` is raised." | |
| 333 | 365 | msgstr "" | |
| 334 | 366 | ":class:`ContextVar` *var* の値を返します。コンテキストオブジェクト内で変数が" | |
| 335 | 367 | "設定されていない場合は、:exc:`KeyError` を送出します。" | |
| 336 | 368 | ||
| 337 | - #: ../../library/contextvars.rst:210 | ||
| 369 | + #: ../../library/contextvars.rst:248 | ||
| 338 | 370 | msgid "" | |
| 339 | 371 | "Return the value for *var* if *var* has the value in the context object. " | |
| 340 | 372 | "Return *default* otherwise. If *default* is not given, return ``None``." | |
@@ -343,35 +375,35 @@ msgstr "" | |||
| 343 | 375 | "れば、*default* を返します。*default* を指定していなければ、``None`` を返しま" | |
| 344 | 376 | "す。" | |
| 345 | 377 | ||
| 346 | - #: ../../library/contextvars.rst:216 | ||
| 378 | + #: ../../library/contextvars.rst:254 | ||
| 347 | 379 | msgid "Return an iterator over the variables stored in the context object." | |
| 348 | 380 | msgstr "コンテキストオブジェクトに格納されている変数群のイテレータを返します。" | |
| 349 | 381 | ||
| 350 | - #: ../../library/contextvars.rst:221 | ||
| 382 | + #: ../../library/contextvars.rst:259 | ||
| 351 | 383 | msgid "Return the number of variables set in the context object." | |
| 352 | 384 | msgstr "コンテキストオブジェクトに格納されている変数の数を返します。" | |
| 353 | 385 | ||
| 354 | - #: ../../library/contextvars.rst:225 | ||
| 386 | + #: ../../library/contextvars.rst:263 | ||
| 355 | 387 | msgid "Return a list of all variables in the context object." | |
| 356 | 388 | msgstr "コンテキストオブジェクト中のすべての変数のリストを返します。" | |
| 357 | 389 | ||
| 358 | - #: ../../library/contextvars.rst:229 | ||
| 390 | + #: ../../library/contextvars.rst:267 | ||
| 359 | 391 | msgid "Return a list of all variables' values in the context object." | |
| 360 | 392 | msgstr "コンテキストオブジェクト中のすべての変数の値のリストを返します。" | |
| 361 | 393 | ||
| 362 | - #: ../../library/contextvars.rst:234 | ||
| 394 | + #: ../../library/contextvars.rst:272 | ||
| 363 | 395 | msgid "" | |
| 364 | 396 | "Return a list of 2-tuples containing all variables and their values in the " | |
| 365 | 397 | "context object." | |
| 366 | 398 | msgstr "" | |
| 367 | 399 | "コンテキストオブジェクト中のすべての変数について、変数とその値からなる2要素の" | |
| 368 | 400 | "タプルのリストを返します。" | |
| 369 | 401 | ||
| 370 | - #: ../../library/contextvars.rst:239 | ||
| 402 | + #: ../../library/contextvars.rst:277 | ||
| 371 | 403 | msgid "asyncio support" | |
| 372 | 404 | msgstr "asyncio サポート" | |
| 373 | 405 | ||
| 374 | - #: ../../library/contextvars.rst:241 | ||
| 406 | + #: ../../library/contextvars.rst:279 | ||
| 375 | 407 | msgid "" | |
| 376 | 408 | "Context variables are natively supported in :mod:`asyncio` and are ready to " | |
| 377 | 409 | "be used without any extra configuration. For example, here is a simple echo " | |
@@ -382,7 +414,7 @@ msgstr "" | |||
| 382 | 414 | "ば、次の単純なechoサーバーは、クライアントを扱う Task の中でリモートクライア" | |
| 383 | 415 | "ントのアドレスが利用できるように、コンテキスト変数を利用します::" | |
| 384 | 416 | ||
| 385 | - #: ../../library/contextvars.rst:247 | ||
| 417 | + #: ../../library/contextvars.rst:285 | ||
| 386 | 418 | msgid "" | |
| 387 | 419 | "import asyncio\n" | |
| 388 | 420 | "import contextvars\n" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments