1010# Arihiro TAKASE, 2023
1111# tomo, 2023
1212# souma987, 2023
13- # Yosuke Miyashita, 2024
1413# Takuya Futatsugi, 2024
1514# righteous, 2024
15+ # Yosuke Miyashita, 2025
1616#
1717#, fuzzy
1818msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121"Report-Msgid-Bugs-To : \n "
2222"POT-Creation-Date : 2025-01-10 14:17+0000\n "
2323"PO-Revision-Date : 2021-06-28 01:16+0000\n "
24- "Last-Translator : righteous, 2024 \n "
24+ "Last-Translator : Yosuke Miyashita, 2025 \n "
2525"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
2626"ja/)\n "
2727"MIME-Version : 1.0\n "
@@ -44,20 +44,25 @@ msgid ""
4444"They can be used by third party tools such as :term:`type checkers <static "
4545"type checker>`, IDEs, linters, etc."
4646msgstr ""
47+ "Python ランタイムは、関数や変数の型アノテーションを強制しません。型アノテー"
48+ "ションは、 :term:`type checkers<static type checker>` や IDE、linterなどの"
49+ "サードパーティーツールで使われます。"
4750
4851#: ../../library/typing.rst:26
4952msgid "This module provides runtime support for type hints."
50- msgstr ""
53+ msgstr "このモジュールは型ヒントの実行時サポートを提供します。 "
5154
5255#: ../../library/typing.rst:28
5356msgid "Consider the function below::"
54- msgstr ""
57+ msgstr "以下の関数を例に考えてみます:: "
5558
5659#: ../../library/typing.rst:30
5760msgid ""
5861"def surface_area_of_cube(edge_length: float) -> str:\n"
5962" return f\" The surface area of the cube is {6 * edge_length ** 2}.\" "
6063msgstr ""
64+ "def surface_area_of_cube(edge_length: float) -> str:\n"
65+ " return f\" The surface area of the cube is {6 * edge_length ** 2}.\" "
6166
6267#: ../../library/typing.rst:33
6368msgid ""
@@ -148,6 +153,9 @@ msgid ""
148153"found at `\" Specification for the Python type system\" <https://typing."
149154"readthedocs.io/en/latest/spec/index.html>`_."
150155msgstr ""
156+ "Pythonの型システムについての公式で最新の仕様は、 `\" Specification for the "
157+ "Python type system\" <https://typing.readthedocs.io/en/latest/spec/index."
158+ "html>`_ で確認することができます。"
151159
152160#: ../../library/typing.rst:72
153161msgid "Type aliases"
@@ -160,7 +168,7 @@ msgid ""
160168"``list[float]`` will be treated equivalently by static type checkers::"
161169msgstr ""
162170"型エイリアスは :keyword:`type` 文を用いて定義され、 :class:`TypeAliasType` イ"
163- "ンスタンスが生成されます。 この例では、静的型検査器は ``Vector`` と "
171+ "ンスタンスが生成されます。 この例では、静的型チェッカーは ``Vector`` と "
164172"``list[float]`` を等しいものとして扱います"
165173
166174#: ../../library/typing.rst:79
@@ -173,6 +181,13 @@ msgid ""
173181"# passes type checking; a list of floats qualifies as a Vector.\n"
174182"new_vector = scale(2.0, [1.0, -4.2, 5.4])"
175183msgstr ""
184+ "type Vector = list[float]\n"
185+ "\n"
186+ "def scale(scalar: float, vector: Vector) -> Vector:\n"
187+ " return [scalar * num for num in vector]\n"
188+ "\n"
189+ "# floatのlistはVectorとして要件を満たすため、型チェックを通過する。\n"
190+ "new_vector = scale(2.0, [1.0, -4.2, 5.4])"
176191
177192#: ../../library/typing.rst:87
178193msgid ""
@@ -199,6 +214,22 @@ msgid ""
199214") -> None:\n"
200215" ..."
201216msgstr ""
217+ "from collections.abc import Sequence\n"
218+ "\n"
219+ "type ConnectionOptions = dict[str, str]\n"
220+ "type Address = tuple[str, int]\n"
221+ "type Server = tuple[Address, ConnectionOptions]\n"
222+ "\n"
223+ "def broadcast_message(message: str, servers: Sequence[Server]) -> None:\n"
224+ " ...\n"
225+ "\n"
226+ "# 静的型チェッカーでは、上記の型アノテーションと\n"
227+ "# 以下のアノテーションを同等のものとして扱う。\n"
228+ "def broadcast_message(\n"
229+ " message: str,\n"
230+ " servers: Sequence[tuple[tuple[str, int], dict[str, str]]]\n"
231+ ") -> None:\n"
232+ " ..."
202233
203234#: ../../library/typing.rst:106
204235msgid ""
@@ -210,7 +241,7 @@ msgstr ""
210241
211242#: ../../library/typing.rst:109
212243msgid "Vector = list[float]"
213- msgstr ""
244+ msgstr "Vector = list[float] "
214245
215246#: ../../library/typing.rst:111
216247msgid ""
@@ -226,6 +257,9 @@ msgid ""
226257"\n"
227258"Vector: TypeAlias = list[float]"
228259msgstr ""
260+ "from typing import TypeAlias\n"
261+ "\n"
262+ "Vector: TypeAlias = list[float]"
229263
230264#: ../../library/typing.rst:121
231265msgid "NewType"
@@ -242,14 +276,18 @@ msgid ""
242276"UserId = NewType('UserId', int)\n"
243277"some_id = UserId(524313)"
244278msgstr ""
279+ "from typing import NewType\n"
280+ "\n"
281+ "UserId = NewType('UserId', int)\n"
282+ "some_id = UserId(524313)"
245283
246284#: ../../library/typing.rst:130
247285msgid ""
248286"The static type checker will treat the new type as if it were a subclass of "
249287"the original type. This is useful in helping catch logical errors::"
250288msgstr ""
251- "静的型検査器は新しい型を元々の型のサブクラスのように扱います。この振る舞いは "
252- "論理的な誤りを見つける手助けとして役に立ちます 。"
289+ "静的型チェッカーは新しい型を元々の型のサブクラスのように扱います。この振る舞 "
290+ "いは論理的な誤りを見つける手助けとして役に立ちます 。"
253291
254292#: ../../library/typing.rst:133
255293msgid ""
@@ -262,6 +300,14 @@ msgid ""
262300"# fails type checking; an int is not a UserId\n"
263301"user_b = get_user_name(-1)"
264302msgstr ""
303+ "def get_user_name(user_id: UserId) -> str:\n"
304+ " ...\n"
305+ "\n"
306+ "# 型チェックを通過する\n"
307+ "user_a = get_user_name(UserId(42351))\n"
308+ "\n"
309+ "# 型チェックに失敗する。int型はUserId型ではないため。\n"
310+ "user_b = get_user_name(-1)"
265311
266312#: ../../library/typing.rst:142
267313msgid ""
@@ -280,6 +326,8 @@ msgid ""
280326"# 'output' is of type 'int', not 'UserId'\n"
281327"output = UserId(23413) + UserId(54341)"
282328msgstr ""
329+ "# 'output' は'int'型となる。'UserId'型にはならない。\n"
330+ "output = UserId(23413) + UserId(54341)"
283331
284332#: ../../library/typing.rst:150
285333msgid ""
@@ -289,8 +337,8 @@ msgid ""
289337"it. That means the expression ``Derived(some_value)`` does not create a new "
290338"class or introduce much overhead beyond that of a regular function call."
291339msgstr ""
292- "これらのチェックは静的型検査器のみによって強制されるということに注意してくだ "
293- "さい 。\n"
340+ "これらのチェックは静的型チェッカーのみによって強制されるということに注意して "
341+ "ください 。\n"
294342"実行時に ``Derived = NewType('Derived', Base)`` という文は渡された仮引数をた"
295343"だちに返す ``Derived`` callable を作ります。\n"
296344"つまり ``Derived(some_value)`` という式は新しいクラスを作ることはなく、通常の"
@@ -317,6 +365,12 @@ msgid ""
317365"# Fails at runtime and does not pass type checking\n"
318366"class AdminUserId(UserId): pass"
319367msgstr ""
368+ "from typing import NewType\n"
369+ "\n"
370+ "UserId = NewType('UserId', int)\n"
371+ "\n"
372+ "# 実行時にエラーとなり、型チェックも通らない\n"
373+ "class AdminUserId(UserId): pass"
320374
321375#: ../../library/typing.rst:168
322376msgid ""
@@ -398,6 +452,10 @@ msgid ""
398452"``Callable[[int], str]`` signifies a function that takes a single parameter "
399453"of type :class:`int` and returns a :class:`str`."
400454msgstr ""
455+ "関数、または他の :term:`callable` なオブジェクトは、 :class:`collections.abc."
456+ "Callable` または :data:`typing.Callable` を使ってアノテーションすることができ"
457+ "ます。 ``Callable[[int], str]`` は、 :class:`int` 型のパラメータを1つ受け取"
458+ "り、 :class:`str` を返す関数を意味します。"
401459
402460#: ../../library/typing.rst:215 ../../library/typing.rst:3128
403461#: ../../library/typing.rst:3308
@@ -440,9 +498,7 @@ msgid ""
440498"that a callable with any arbitrary parameter list would be acceptable:"
441499msgstr ""
442500"もしellipsisリテラル ``...`` が引数リストとして与えられた場合、それは任意のパ"
443- "ラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示します。\n"
444- "\n"
445- " "
501+ "ラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示します。"
446502
447503#: ../../library/typing.rst:241
448504msgid ""
@@ -453,6 +509,12 @@ msgid ""
453509"x = str # OK\n"
454510"x = concat # Also OK"
455511msgstr ""
512+ "def concat(x: str, y: str) -> str:\n"
513+ " return x + y\n"
514+ "\n"
515+ "x: Callable[..., str]\n"
516+ "x = str # OK\n"
517+ "x = concat # これもOK"
456518
457519#: ../../library/typing.rst:250
458520msgid ""
0 commit comments