10
10
# Arihiro TAKASE, 2023
11
11
# tomo, 2023
12
12
# souma987, 2023
13
- # Yosuke Miyashita, 2024
14
13
# Takuya Futatsugi, 2024
15
14
# righteous, 2024
15
+ # Yosuke Miyashita, 2025
16
16
#
17
17
#, fuzzy
18
18
msgid ""
@@ -21,7 +21,7 @@ msgstr ""
21
21
"Report-Msgid-Bugs-To : \n "
22
22
"POT-Creation-Date : 2025-01-10 14:17+0000\n "
23
23
"PO-Revision-Date : 2021-06-28 01:16+0000\n "
24
- "Last-Translator : righteous, 2024 \n "
24
+ "Last-Translator : Yosuke Miyashita, 2025 \n "
25
25
"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
26
26
"ja/)\n "
27
27
"MIME-Version : 1.0\n "
@@ -44,20 +44,25 @@ msgid ""
44
44
"They can be used by third party tools such as :term:`type checkers <static "
45
45
"type checker>`, IDEs, linters, etc."
46
46
msgstr ""
47
+ "Python ランタイムは、関数や変数の型アノテーションを強制しません。型アノテー"
48
+ "ションは、 :term:`type checkers<static type checker>` や IDE、linterなどの"
49
+ "サードパーティーツールで使われます。"
47
50
48
51
#: ../../library/typing.rst:26
49
52
msgid "This module provides runtime support for type hints."
50
- msgstr ""
53
+ msgstr "このモジュールは型ヒントの実行時サポートを提供します。 "
51
54
52
55
#: ../../library/typing.rst:28
53
56
msgid "Consider the function below::"
54
- msgstr ""
57
+ msgstr "以下の関数を例に考えてみます:: "
55
58
56
59
#: ../../library/typing.rst:30
57
60
msgid ""
58
61
"def surface_area_of_cube(edge_length: float) -> str:\n"
59
62
" return f\" The surface area of the cube is {6 * edge_length ** 2}.\" "
60
63
msgstr ""
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}.\" "
61
66
62
67
#: ../../library/typing.rst:33
63
68
msgid ""
@@ -148,6 +153,9 @@ msgid ""
148
153
"found at `\" Specification for the Python type system\" <https://typing."
149
154
"readthedocs.io/en/latest/spec/index.html>`_."
150
155
msgstr ""
156
+ "Pythonの型システムについての公式で最新の仕様は、 `\" Specification for the "
157
+ "Python type system\" <https://typing.readthedocs.io/en/latest/spec/index."
158
+ "html>`_ で確認することができます。"
151
159
152
160
#: ../../library/typing.rst:72
153
161
msgid "Type aliases"
@@ -160,7 +168,7 @@ msgid ""
160
168
"``list[float]`` will be treated equivalently by static type checkers::"
161
169
msgstr ""
162
170
"型エイリアスは :keyword:`type` 文を用いて定義され、 :class:`TypeAliasType` イ"
163
- "ンスタンスが生成されます。 この例では、静的型検査器は ``Vector`` と "
171
+ "ンスタンスが生成されます。 この例では、静的型チェッカーは ``Vector`` と "
164
172
"``list[float]`` を等しいものとして扱います"
165
173
166
174
#: ../../library/typing.rst:79
@@ -173,6 +181,13 @@ msgid ""
173
181
"# passes type checking; a list of floats qualifies as a Vector.\n"
174
182
"new_vector = scale(2.0, [1.0, -4.2, 5.4])"
175
183
msgstr ""
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])"
176
191
177
192
#: ../../library/typing.rst:87
178
193
msgid ""
@@ -199,6 +214,22 @@ msgid ""
199
214
") -> None:\n"
200
215
" ..."
201
216
msgstr ""
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
+ " ..."
202
233
203
234
#: ../../library/typing.rst:106
204
235
msgid ""
@@ -210,7 +241,7 @@ msgstr ""
210
241
211
242
#: ../../library/typing.rst:109
212
243
msgid "Vector = list[float]"
213
- msgstr ""
244
+ msgstr "Vector = list[float] "
214
245
215
246
#: ../../library/typing.rst:111
216
247
msgid ""
@@ -226,6 +257,9 @@ msgid ""
226
257
"\n"
227
258
"Vector: TypeAlias = list[float]"
228
259
msgstr ""
260
+ "from typing import TypeAlias\n"
261
+ "\n"
262
+ "Vector: TypeAlias = list[float]"
229
263
230
264
#: ../../library/typing.rst:121
231
265
msgid "NewType"
@@ -242,14 +276,18 @@ msgid ""
242
276
"UserId = NewType('UserId', int)\n"
243
277
"some_id = UserId(524313)"
244
278
msgstr ""
279
+ "from typing import NewType\n"
280
+ "\n"
281
+ "UserId = NewType('UserId', int)\n"
282
+ "some_id = UserId(524313)"
245
283
246
284
#: ../../library/typing.rst:130
247
285
msgid ""
248
286
"The static type checker will treat the new type as if it were a subclass of "
249
287
"the original type. This is useful in helping catch logical errors::"
250
288
msgstr ""
251
- "静的型検査器は新しい型を元々の型のサブクラスのように扱います。この振る舞いは "
252
- "論理的な誤りを見つける手助けとして役に立ちます 。"
289
+ "静的型チェッカーは新しい型を元々の型のサブクラスのように扱います。この振る舞 "
290
+ "いは論理的な誤りを見つける手助けとして役に立ちます 。"
253
291
254
292
#: ../../library/typing.rst:133
255
293
msgid ""
@@ -262,6 +300,14 @@ msgid ""
262
300
"# fails type checking; an int is not a UserId\n"
263
301
"user_b = get_user_name(-1)"
264
302
msgstr ""
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)"
265
311
266
312
#: ../../library/typing.rst:142
267
313
msgid ""
@@ -280,6 +326,8 @@ msgid ""
280
326
"# 'output' is of type 'int', not 'UserId'\n"
281
327
"output = UserId(23413) + UserId(54341)"
282
328
msgstr ""
329
+ "# 'output' は'int'型となる。'UserId'型にはならない。\n"
330
+ "output = UserId(23413) + UserId(54341)"
283
331
284
332
#: ../../library/typing.rst:150
285
333
msgid ""
@@ -289,8 +337,8 @@ msgid ""
289
337
"it. That means the expression ``Derived(some_value)`` does not create a new "
290
338
"class or introduce much overhead beyond that of a regular function call."
291
339
msgstr ""
292
- "これらのチェックは静的型検査器のみによって強制されるということに注意してくだ "
293
- "さい 。\n"
340
+ "これらのチェックは静的型チェッカーのみによって強制されるということに注意して "
341
+ "ください 。\n"
294
342
"実行時に ``Derived = NewType('Derived', Base)`` という文は渡された仮引数をた"
295
343
"だちに返す ``Derived`` callable を作ります。\n"
296
344
"つまり ``Derived(some_value)`` という式は新しいクラスを作ることはなく、通常の"
@@ -317,6 +365,12 @@ msgid ""
317
365
"# Fails at runtime and does not pass type checking\n"
318
366
"class AdminUserId(UserId): pass"
319
367
msgstr ""
368
+ "from typing import NewType\n"
369
+ "\n"
370
+ "UserId = NewType('UserId', int)\n"
371
+ "\n"
372
+ "# 実行時にエラーとなり、型チェックも通らない\n"
373
+ "class AdminUserId(UserId): pass"
320
374
321
375
#: ../../library/typing.rst:168
322
376
msgid ""
@@ -398,6 +452,10 @@ msgid ""
398
452
"``Callable[[int], str]`` signifies a function that takes a single parameter "
399
453
"of type :class:`int` and returns a :class:`str`."
400
454
msgstr ""
455
+ "関数、または他の :term:`callable` なオブジェクトは、 :class:`collections.abc."
456
+ "Callable` または :data:`typing.Callable` を使ってアノテーションすることができ"
457
+ "ます。 ``Callable[[int], str]`` は、 :class:`int` 型のパラメータを1つ受け取"
458
+ "り、 :class:`str` を返す関数を意味します。"
401
459
402
460
#: ../../library/typing.rst:215 ../../library/typing.rst:3128
403
461
#: ../../library/typing.rst:3308
@@ -440,9 +498,7 @@ msgid ""
440
498
"that a callable with any arbitrary parameter list would be acceptable:"
441
499
msgstr ""
442
500
"もしellipsisリテラル ``...`` が引数リストとして与えられた場合、それは任意のパ"
443
- "ラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示します。\n"
444
- "\n"
445
- " "
501
+ "ラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示します。"
446
502
447
503
#: ../../library/typing.rst:241
448
504
msgid ""
@@ -453,6 +509,12 @@ msgid ""
453
509
"x = str # OK\n"
454
510
"x = concat # Also OK"
455
511
msgstr ""
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"
456
518
457
519
#: ../../library/typing.rst:250
458
520
msgid ""
0 commit comments