33# This file is distributed under the same license as the Python package.
44# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
55#
6- #, fuzzy
76msgid ""
87msgstr ""
98"Project-Id-Version : Python 3.7\n "
@@ -18,9 +17,8 @@ msgstr ""
1817"Generated-By : Babel 2.17.0\n "
1918
2019#: ../../library/contextvars.rst:2
21- #, fuzzy
2220msgid ":mod:`!contextvars` --- Context Variables"
23- msgstr ":mod:`contextvars` --- 컨텍스트 변수"
21+ msgstr ":mod:`! contextvars` --- 컨텍스트 변수"
2422
2523#: ../../library/contextvars.rst:11
2624msgid ""
@@ -36,14 +34,13 @@ msgstr ""
3634"비동기 프레임워크에서 현재 컨텍스트를 관리하는 데 사용해야 합니다."
3735
3836#: ../../library/contextvars.rst:17
39- #, fuzzy
4037msgid ""
4138"Context managers that have state should use Context Variables instead of "
4239":func:`threading.local` to prevent their state from bleeding to other "
4340"code unexpectedly, when used in concurrent code."
4441msgstr ""
4542"상태가 있는 컨텍스트 관리자는 동시성 코드에서 상태가 예기치 않게 다른 코드로 유출되는 것을 방지하기 위해 "
46- ":func:`threading.local() ` 대신 컨텍스트 변수를 사용해야 합니다."
43+ ":func:`threading.local` 대신 컨텍스트 변수를 사용해야 합니다."
4744
4845#: ../../library/contextvars.rst:21
4946msgid "See also :pep:`567` for additional details."
@@ -59,7 +56,7 @@ msgstr "이 클래스는 새로운 컨텍스트 변수를 선언하는 데 사
5956
6057#: ../../library/contextvars.rst:33
6158msgid "var: ContextVar[int] = ContextVar('var', default=42)"
62- msgstr ""
59+ msgstr "var: ContextVar[int] = ContextVar('var', default=42) "
6360
6461#: ../../library/contextvars.rst:35
6562msgid ""
@@ -153,6 +150,14 @@ msgid ""
153150"# After the reset call the var has no value again, so\n"
154151"# var.get() would raise a LookupError."
155152msgstr ""
153+ "var = ContextVar('var')\n"
154+ "\n"
155+ "token = var.set('new value')\n"
156+ "# 'var'를 사용하는 코드; var.get() 은 'new value'를 반환합니다.\n"
157+ "var.reset(token)\n"
158+ "\n"
159+ "# reset 호출 후에 var에는 값이 다시 없으므로, var.get() 은\n"
160+ "# LookupError를 발생시킵니다."
156161
157162#: ../../library/contextvars.rst:99
158163msgid ""
@@ -170,14 +175,13 @@ msgid ""
170175msgstr "읽기 전용 프로퍼티. 토큰을 생성 한 :class:`ContextVar` 객체를 가리 킵니다."
171176
172177#: ../../library/contextvars.rst:111
173- #, fuzzy
174178msgid ""
175179"A read-only property. Set to the value the variable had before the "
176180":meth:`ContextVar.set` method call that created the token. It points to "
177181":attr:`Token.MISSING` if the variable was not set before the call."
178182msgstr ""
179- "읽기 전용 프로퍼티. 토큰을 생성 한 :meth:`ContextVar.set` 메서드 호출 전 변수의 값으로 설정됩니다. "
180- ":attr:`Token.MISSING` 은 호출 전에 변수가 설정되지 않았음을 나타냅니다 ."
183+ "읽기 전용 프로퍼티. 토큰을 생성 한 :meth:`ContextVar.set` 메서드 호출 전 변수의 값으로 설정됩니다. 호출 전에 "
184+ " 변수가 설정되지 않았으면 :attr:`Token.MISSING`\\ 을 가리킵니다 ."
181185
182186#: ../../library/contextvars.rst:118
183187msgid "A marker object used by :attr:`Token.old_value`."
@@ -202,16 +206,17 @@ msgid ""
202206"ctx: Context = copy_context()\n"
203207"print(list(ctx.items()))"
204208msgstr ""
209+ "ctx: Context = copy_context()\n"
210+ "print(list(ctx.items()))"
205211
206212#: ../../library/contextvars.rst:134
207- #, fuzzy
208213msgid ""
209214"The function has an *O*\\ (1) complexity, i.e. works equally fast for "
210215"contexts with a few context variables and for contexts that have a lot of"
211216" them."
212217msgstr ""
213- "이 함수는 O (1) 복잡도를 갖고 있습니다. 즉, 몇 가지 컨텍스트 변수가 있는 컨텍스트와 컨텍스트 변수가 잔뜩 있는 컨텍스트에 "
214- "대해 똑같이 빠르게 작동합니다."
218+ "이 함수는 *O* \\ (1) 복잡도를 갖고 있습니다. 즉, 몇 가지 컨텍스트 변수가 있는 컨텍스트와 컨텍스트 변수가 잔뜩 있는 "
219+ "컨텍스트에 대해 똑같이 빠르게 작동합니다."
215220
216221#: ../../library/contextvars.rst:141
217222msgid "A mapping of :class:`ContextVars <ContextVar>` to their values."
@@ -281,19 +286,17 @@ msgid "Context implements the :class:`collections.abc.Mapping` interface."
281286msgstr "Context는 :class:`collections.abc.Mapping` 인터페이스를 구현합니다."
282287
283288#: ../../library/contextvars.rst:181
284- #, fuzzy
285289msgid ""
286290"Enters the Context, executes ``callable(*args, **kwargs)``, then exits "
287291"the Context. Returns *callable*'s return value, or propagates an "
288292"exception if one occurred."
289293msgstr ""
290- "*run* 메서드가 호출된 컨텍스트 객체에서 ``callable(*args, **kwargs)`` 코드를 실행합니다. 실행 결과를 "
291- "반환하거나 예외가 발생하면 예외를 전파합니다."
294+ "컨텍스트에 진입하고, ``callable(*args, **kwargs)``\\ 를 실행한 다음, 컨텍스트에서 빠져나옵니다. "
295+ "*callable* \\ 의 반환값을 반환하거나, 예외가 발생하면 예외를 전파합니다."
292296
293297#: ../../library/contextvars.rst:185
294- #, fuzzy
295298msgid "Example:"
296- msgstr "예를 들면: :"
299+ msgstr "예제 :"
297300
298301#: ../../library/contextvars.rst:187
299302msgid ""
@@ -328,6 +331,35 @@ msgid ""
328331"# However, outside of 'ctx', 'var' is still set to 'spam':\n"
329332"print(var.get()) # 'spam'"
330333msgstr ""
334+ "import contextvars\n"
335+ "\n"
336+ "var = contextvars.ContextVar('var')\n"
337+ "var.set('spam')\n"
338+ "print(var.get()) # 'spam'\n"
339+ "\n"
340+ "ctx = contextvars.copy_context()\n"
341+ "\n"
342+ "def main():\n"
343+ " # 'var' 는 'copy_context()' 와 'ctx.run(main)' 을\n"
344+ " # 호출하기 전에 'spam' 으로 설정되었습니다. 그래서:\n"
345+ " print(var.get()) # 'spam'\n"
346+ " print(ctx[var]) # 'spam'\n"
347+ "\n"
348+ " var.set('ham')\n"
349+ "\n"
350+ " # 이제, 'var' 를 'ham' 으로 설정한 후에:\n"
351+ " print(var.get()) # 'ham'\n"
352+ " print(ctx[var]) # 'ham'\n"
353+ "\n"
354+ "# 'main' 함수가 'var' 에 적용한 모든 변경은 'ctx' 에 포함됩니다.\n"
355+ "ctx.run(main)\n"
356+ "\n"
357+ "# 'main()' 함수는 'ctx' 컨텍스트에서 실행되었으므로,\n"
358+ "# 'var' 에 대한 변경은 'ctx' 에 포함되어 있습니다:\n"
359+ "print(ctx[var]) # 'ham'\n"
360+ "\n"
361+ "# 그러나, 'ctx' 외부에서, 'var' 는 여전히 'spam' 으로 설정되어있습니다:\n"
362+ "print(var.get()) # 'spam'"
331363
332364#: ../../library/contextvars.rst:233
333365msgid "Return a shallow copy of the context object."
@@ -439,6 +471,48 @@ msgid ""
439471"# telnet 127.0.0.1 8081\n"
440472"# curl 127.0.0.1:8081"
441473msgstr ""
474+ "import asyncio\n"
475+ "import contextvars\n"
476+ "\n"
477+ "client_addr_var = contextvars.ContextVar('client_addr')\n"
478+ "\n"
479+ "def render_goodbye():\n"
480+ " # 현재 처리중인 클라이언트의 주소를 이 함수에 명시 적으로 전달하지 않고도\n"
481+ " # 액세스 할 수 있습니다.\n"
482+ "\n"
483+ " client_addr = client_addr_var.get()\n"
484+ " return f'Good bye, client @ {client_addr}\\ r\\ n'.encode()\n"
485+ "\n"
486+ "async def handle_request(reader, writer):\n"
487+ " addr = writer.transport.get_extra_info('socket').getpeername()\n"
488+ " client_addr_var.set(addr)\n"
489+ "\n"
490+ " # 우리가 호출하는 모든 코드에서 이제 'client_addr_var.get()' 을\n"
491+ " # 호출하여 클라이언트의 주소를 가져올 수 있습니다.\n"
492+ "\n"
493+ " while True:\n"
494+ " line = await reader.readline()\n"
495+ " print(line)\n"
496+ " if not line.strip():\n"
497+ " break\n"
498+ "\n"
499+ " writer.write(b'HTTP/1.1 200 OK\\ r\\ n') # status line\n"
500+ " writer.write(b'\\ r\\ n') # headers\n"
501+ " writer.write(render_goodbye()) # body\n"
502+ " writer.close()\n"
503+ "\n"
504+ "async def main():\n"
505+ " srv = await asyncio.start_server(\n"
506+ " handle_request, '127.0.0.1', 8081)\n"
507+ "\n"
508+ " async with srv:\n"
509+ " await srv.serve_forever()\n"
510+ "\n"
511+ "asyncio.run(main())\n"
512+ "\n"
513+ "# 테스트하려면 telnet이나 curl을 사용할 수 있습니다:\n"
514+ "# telnet 127.0.0.1 8081\n"
515+ "# curl 127.0.0.1:8081"
442516
443517#~ msgid ""
444518#~ "Any changes to any context variables "
0 commit comments