Skip to content

Commit c745e11

Browse files
committed
#703 - remove fuzzy flags
1 parent 5fca972 commit c745e11

File tree

1 file changed

+187
-10
lines changed

1 file changed

+187
-10
lines changed

tutorial/stdlib2.po

+187-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# This file is distributed under the same license as the Python package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
55
#
6-
#, fuzzy
76
msgid ""
87
msgstr ""
98
"Project-Id-Version: Python 3.6\n"
@@ -48,6 +47,9 @@ msgid ""
4847
">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n"
4948
"\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\""
5049
msgstr ""
50+
">>> import reprlib\n"
51+
">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n"
52+
"\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\""
5153

5254
#: ../../tutorial/stdlib2.rst:23
5355
msgid ""
@@ -74,6 +76,16 @@ msgid ""
7476
" [['magenta', 'yellow'],\n"
7577
" 'blue']]]"
7678
msgstr ""
79+
">>> import pprint\n"
80+
">>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n"
81+
"... 'yellow'], 'blue']]]\n"
82+
"...\n"
83+
">>> pprint.pprint(t, width=30)\n"
84+
"[[[['black', 'cyan'],\n"
85+
" 'white',\n"
86+
" ['green', 'red']],\n"
87+
" [['magenta', 'yellow'],\n"
88+
" 'blue']]]"
7789

7890
#: ../../tutorial/stdlib2.rst:39
7991
msgid ""
@@ -96,6 +108,18 @@ msgid ""
96108
"instead of one big string with newlines\n"
97109
"to separate the wrapped lines."
98110
msgstr ""
111+
">>> import textwrap\n"
112+
">>> doc = \"\"\"The wrap() method is just like fill() except that it "
113+
"returns\n"
114+
"... a list of strings instead of one big string with newlines to separate"
115+
"\n"
116+
"... the wrapped lines.\"\"\"\n"
117+
"...\n"
118+
">>> print(textwrap.fill(doc, width=40))\n"
119+
"The wrap() method is just like fill()\n"
120+
"except that it returns a list of strings\n"
121+
"instead of one big string with newlines\n"
122+
"to separate the wrapped lines."
99123

100124
#: ../../tutorial/stdlib2.rst:53
101125
msgid ""
@@ -120,6 +144,16 @@ msgid ""
120144
"... conv['frac_digits'], x), grouping=True)\n"
121145
"'$1,234,567.80'"
122146
msgstr ""
147+
">>> import locale\n"
148+
">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n"
149+
"'English_United States.1252'\n"
150+
">>> conv = locale.localeconv() # 관례의 매핑을 얻습니다\n"
151+
">>> x = 1234567.8\n"
152+
">>> locale.format_string(\"%d\", x, grouping=True)\n"
153+
"'1,234,567'\n"
154+
">>> locale.format_string(\"%s%.*f\", (conv['currency_symbol'],\n"
155+
"... conv['frac_digits'], x), grouping=True)\n"
156+
"'$1,234,567.80'"
123157

124158
#: ../../tutorial/stdlib2.rst:72
125159
msgid "Templating"
@@ -155,6 +189,10 @@ msgid ""
155189
">>> t.substitute(village='Nottingham', cause='the ditch fund')\n"
156190
"'Nottinghamfolk send $10 to the ditch fund.'"
157191
msgstr ""
192+
">>> from string import Template\n"
193+
">>> t = Template('${village}folk send $$10 to $cause.')\n"
194+
">>> t.substitute(village='Nottingham', cause='the ditch fund')\n"
195+
"'Nottinghamfolk send $10 to the ditch fund.'"
158196

159197
#: ../../tutorial/stdlib2.rst:88
160198
msgid ""
@@ -180,6 +218,14 @@ msgid ""
180218
">>> t.safe_substitute(d)\n"
181219
"'Return the unladen swallow to $owner.'"
182220
msgstr ""
221+
">>> t = Template('Return the $item to $owner.')\n"
222+
">>> d = dict(item='unladen swallow')\n"
223+
">>> t.substitute(d)\n"
224+
"Traceback (most recent call last):\n"
225+
" ...\n"
226+
"KeyError: 'owner'\n"
227+
">>> t.safe_substitute(d)\n"
228+
"'Return the unladen swallow to $owner.'"
183229

184230
#: ../../tutorial/stdlib2.rst:103
185231
msgid ""
@@ -213,6 +259,24 @@ msgid ""
213259
"img_1076.jpg --> Ashley_1.jpg\n"
214260
"img_1077.jpg --> Ashley_2.jpg"
215261
msgstr ""
262+
">>> import time, os.path\n"
263+
">>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']\n"
264+
">>> class BatchRename(Template):\n"
265+
"... delimiter = '%'\n"
266+
"...\n"
267+
">>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ')\n"
268+
"Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f\n"
269+
"\n"
270+
">>> t = BatchRename(fmt)\n"
271+
">>> date = time.strftime('%d%b%y')\n"
272+
">>> for i, filename in enumerate(photofiles):\n"
273+
"... base, ext = os.path.splitext(filename)\n"
274+
"... newname = t.substitute(d=date, n=i, f=ext)\n"
275+
"... print('{0} --> {1}'.format(filename, newname))\n"
276+
"\n"
277+
"img_1074.jpg --> Ashley_0.jpg\n"
278+
"img_1076.jpg --> Ashley_1.jpg\n"
279+
"img_1077.jpg --> Ashley_2.jpg"
216280

217281
#: ../../tutorial/stdlib2.rst:126
218282
msgid ""
@@ -264,6 +328,24 @@ msgid ""
264328
"\n"
265329
" start += extra_size + comp_size # skip to the next header"
266330
msgstr ""
331+
"import struct\n"
332+
"\n"
333+
"with open('myfile.zip', 'rb') as f:\n"
334+
" data = f.read()\n"
335+
"\n"
336+
"start = 0\n"
337+
"for i in range(3): # 처음 3개의 파일 헤더를 보여줍니다\n"
338+
" start += 14\n"
339+
" fields = struct.unpack('<IIIHH', data[start:start+16])\n"
340+
" crc32, comp_size, uncomp_size, filenamesize, extra_size = fields\n"
341+
"\n"
342+
" start += 16\n"
343+
" filename = data[start:start+filenamesize]\n"
344+
" start += filenamesize\n"
345+
" extra = data[start:start+extra_size]\n"
346+
" print(filename, hex(crc32), comp_size, uncomp_size)\n"
347+
"\n"
348+
" start += extra_size + comp_size # 다음 헤더로 건너뜁니다"
267349

268350
#: ../../tutorial/stdlib2.rst:167
269351
msgid "Multi-threading"
@@ -312,6 +394,26 @@ msgid ""
312394
"background.join() # Wait for the background task to finish\n"
313395
"print('Main program waited until background was done.')"
314396
msgstr ""
397+
"import threading, zipfile\n"
398+
"\n"
399+
"class AsyncZip(threading.Thread):\n"
400+
" def __init__(self, infile, outfile):\n"
401+
" threading.Thread.__init__(self)\n"
402+
" self.infile = infile\n"
403+
" self.outfile = outfile\n"
404+
"\n"
405+
" def run(self):\n"
406+
" f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)\n"
407+
" f.write(self.infile)\n"
408+
" f.close()\n"
409+
" print('Finished background zip of:', self.infile)\n"
410+
"\n"
411+
"background = AsyncZip('mydata.txt', 'myarchive.zip')\n"
412+
"background.start()\n"
413+
"print('The main program continues to run in foreground.')\n"
414+
"\n"
415+
"background.join() # 백그라운드 작업이 끝날 때까지 기다립니다\n"
416+
"print('Main program waited until background was done.')"
315417

316418
#: ../../tutorial/stdlib2.rst:198
317419
msgid ""
@@ -361,6 +463,12 @@ msgid ""
361463
"logging.error('Error occurred')\n"
362464
"logging.critical('Critical error -- shutting down')"
363465
msgstr ""
466+
"import logging\n"
467+
"logging.debug('Debugging information')\n"
468+
"logging.info('Informational message')\n"
469+
"logging.warning('Warning:config file %s not found', 'server.conf')\n"
470+
"logging.error('Error occurred')\n"
471+
"logging.critical('Critical error -- shutting down')"
364472

365473
#: ../../tutorial/stdlib2.rst:226
366474
msgid "This produces the following output:"
@@ -372,6 +480,9 @@ msgid ""
372480
"ERROR:root:Error occurred\n"
373481
"CRITICAL:root:Critical error -- shutting down"
374482
msgstr ""
483+
"WARNING:root:Warning:config file server.conf not found\n"
484+
"ERROR:root:Error occurred\n"
485+
"CRITICAL:root:Critical error -- shutting down"
375486

376487
#: ../../tutorial/stdlib2.rst:234
377488
msgid ""
@@ -453,6 +564,28 @@ msgid ""
453564
" o = self.data[key]()\n"
454565
"KeyError: 'primary'"
455566
msgstr ""
567+
">>> import weakref, gc\n"
568+
">>> class A:\n"
569+
"... def __init__(self, value):\n"
570+
"... self.value = value\n"
571+
"... def __repr__(self):\n"
572+
"... return str(self.value)\n"
573+
"...\n"
574+
">>> a = A(10) # 참조를 만듭니다\n"
575+
">>> d = weakref.WeakValueDictionary()\n"
576+
">>> d['primary'] = a # 참조를 만들지 않습니다\n"
577+
">>> d['primary'] # 객체가 아직 살아있다면 가져옵니다\n"
578+
"10\n"
579+
">>> del a # 참조 하나를 지웁니다\n"
580+
">>> gc.collect() # 당장 가비지 수집을 실행합니다\n"
581+
"0\n"
582+
">>> d['primary'] # 항목이 저절로 삭제되었습니다\n"
583+
"Traceback (most recent call last):\n"
584+
" File \"<stdin>\", line 1, in <module>\n"
585+
" d['primary'] # 항목이 저절로 삭제되었습니다\n"
586+
" File \"C:/python313/lib/weakref.py\", line 46, in __getitem__\n"
587+
" o = self.data[key]()\n"
588+
"KeyError: 'primary'"
456589

457590
#: ../../tutorial/stdlib2.rst:290
458591
msgid "Tools for Working with Lists"
@@ -468,16 +601,15 @@ msgstr ""
468601
" 수도 있습니다."
469602

470603
#: ../../tutorial/stdlib2.rst:296
471-
#, fuzzy
472604
msgid ""
473605
"The :mod:`array` module provides an :class:`~array.array` object that is "
474606
"like a list that stores only homogeneous data and stores it more "
475607
"compactly. The following example shows an array of numbers stored as two"
476608
" byte unsigned binary numbers (typecode ``\"H\"``) rather than the usual "
477609
"16 bytes per entry for regular lists of Python int objects::"
478610
msgstr ""
479-
":mod:`array` 모듈은 :class:`~array.array()` 객체를 제공합니다. 이 객체는 등질적인 데이터만을 저장하고"
480-
" 보다 조밀하게 저장하는 리스트와 같습니다. 다음 예제는 파이썬 int 객체의 일반 리스트의 경우처럼 항목당 16바이트를 사용하는 "
611+
":mod:`array` 모듈은 :class:`~array.array` 객체를 제공합니다. 이 객체는 등질적인 데이터만을 저장하고 "
612+
"보다 조밀하게 저장하는 리스트와 같습니다. 다음 예제는 파이썬 int 객체의 일반 리스트의 경우처럼 항목당 16바이트를 사용하는 "
481613
"대신에, 2바이트의 부호 없는 이진 숫자 (형 코드 ``\"H\"``)로 저장된 숫자 배열을 보여줍니다::"
482614

483615
#: ../../tutorial/stdlib2.rst:302
@@ -489,18 +621,23 @@ msgid ""
489621
">>> a[1:3]\n"
490622
"array('H', [10, 700])"
491623
msgstr ""
624+
">>> from array import array\n"
625+
">>> a = array('H', [4000, 10, 700, 22222])\n"
626+
">>> sum(a)\n"
627+
"26932\n"
628+
">>> a[1:3]\n"
629+
"array('H', [10, 700])"
492630

493631
#: ../../tutorial/stdlib2.rst:309
494-
#, fuzzy
495632
msgid ""
496633
"The :mod:`collections` module provides a :class:`~collections.deque` "
497634
"object that is like a list with faster appends and pops from the left "
498635
"side but slower lookups in the middle. These objects are well suited for "
499636
"implementing queues and breadth first tree searches::"
500637
msgstr ""
501-
":mod:`collections` 모듈은 :class:`~collections.deque()` 객체를 제공합니다. 이 객체는 "
502-
"왼쪽에서 더 빠르게 추가/팝하지만 중간에서의 조회는 더 느려진 리스트와 같습니다. 이 객체는 대기열 및 넓이 우선 트리 검색을 "
503-
"구현하는 데 적합합니다::"
638+
":mod:`collections` 모듈은 :class:`~collections.deque` 객체를 제공합니다. 이 객체는 왼쪽에서 "
639+
"더 빠르게 추가/팝하지만 중간에서의 조회는 더 느려진 리스트와 같습니다. 이 객체는 대기열 및 넓이 우선 트리 검색을 구현하는 데 "
640+
"적합합니다::"
504641

505642
#: ../../tutorial/stdlib2.rst:314
506643
msgid ""
@@ -510,6 +647,11 @@ msgid ""
510647
">>> print(\"Handling\", d.popleft())\n"
511648
"Handling task1"
512649
msgstr ""
650+
">>> from collections import deque\n"
651+
">>> d = deque([\"task1\", \"task2\", \"task3\"])\n"
652+
">>> d.append(\"task4\")\n"
653+
">>> print(\"Handling\", d.popleft())\n"
654+
"Handling task1"
513655

514656
#: ../../tutorial/stdlib2.rst:322
515657
msgid ""
@@ -521,6 +663,13 @@ msgid ""
521663
" return m\n"
522664
" unsearched.append(m)"
523665
msgstr ""
666+
"unsearched = deque([starting_node])\n"
667+
"def breadth_first_search(unsearched):\n"
668+
" node = unsearched.popleft()\n"
669+
" for m in gen_moves(node):\n"
670+
" if is_goal(m):\n"
671+
" return m\n"
672+
" unsearched.append(m)"
524673

525674
#: ../../tutorial/stdlib2.rst:330
526675
msgid ""
@@ -541,6 +690,13 @@ msgid ""
541690
"[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, "
542691
"'python')]"
543692
msgstr ""
693+
">>> import bisect\n"
694+
">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]"
695+
"\n"
696+
">>> bisect.insort(scores, (300, 'ruby'))\n"
697+
">>> scores\n"
698+
"[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, "
699+
"'python')]"
544700

545701
#: ../../tutorial/stdlib2.rst:340
546702
msgid ""
@@ -563,14 +719,18 @@ msgid ""
563719
"\n"
564720
"[-5, 0, 1]"
565721
msgstr ""
722+
">>> from heapq import heapify, heappop, heappush\n"
723+
">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n"
724+
">>> heapify(data) # 리스트를 힙 순서로 재배치합니다\n"
725+
">>> heappush(data, -5) # 새 항목을 추가합니다\n"
726+
">>> [heappop(data) for i in range(3)] # 가장 작은 세 개의 항목을 가져옵니다\n"
727+
"[-5, 0, 1]"
566728

567729
#: ../../tutorial/stdlib2.rst:356
568-
#, fuzzy
569730
msgid "Decimal Floating-Point Arithmetic"
570731
msgstr "10진 부동 소수점 산술"
571732

572733
#: ../../tutorial/stdlib2.rst:358
573-
#, fuzzy
574734
msgid ""
575735
"The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for"
576736
" decimal floating-point arithmetic. Compared to the built-in "
@@ -622,6 +782,11 @@ msgid ""
622782
">>> round(.70 * 1.05, 2)\n"
623783
"0.73"
624784
msgstr ""
785+
">>> from decimal import *\n"
786+
">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n"
787+
"Decimal('0.74')\n"
788+
">>> round(.70 * 1.05, 2)\n"
789+
"0.73"
625790

626791
#: ../../tutorial/stdlib2.rst:380
627792
msgid ""
@@ -656,6 +821,15 @@ msgid ""
656821
">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n"
657822
"False"
658823
msgstr ""
824+
">>> Decimal('1.00') % Decimal('.10')\n"
825+
"Decimal('0.00')\n"
826+
">>> 1.00 % 0.10\n"
827+
"0.09999999999999995\n"
828+
"\n"
829+
">>> sum([Decimal('0.1')]*10) == Decimal('1.0')\n"
830+
"True\n"
831+
">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n"
832+
"False"
659833

660834
#: ../../tutorial/stdlib2.rst:400
661835
msgid ""
@@ -669,4 +843,7 @@ msgid ""
669843
">>> Decimal(1) / Decimal(7)\n"
670844
"Decimal('0.142857142857142857142857142857142857')"
671845
msgstr ""
846+
">>> getcontext().prec = 36\n"
847+
">>> Decimal(1) / Decimal(7)\n"
848+
"Decimal('0.142857142857142857142857142857142857')"
672849

0 commit comments

Comments
 (0)