Skip to content

Commit c4c072c

Browse files
committed
Merge remote-tracking branch 'upstream/3.9' into traduccion-random
2 parents fea3639 + 3ad4acf commit c4c072c

File tree

4 files changed

+99
-42
lines changed

4 files changed

+99
-42
lines changed

dictionaries/library_profile.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
Ghz
21
sublista
32
lineno
43
filename
5-
Czotter
4+
Czotter
5+
formatearse
6+
profile
7+
stats
8+
vs

library/profile.po

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ msgstr ""
1111
"Project-Id-Version: Python 3.8\n"
1212
"Report-Msgid-Bugs-To: \n"
1313
"POT-Creation-Date: 2021-03-19 11:16+0100\n"
14-
"PO-Revision-Date: 2020-07-10 22:47-0500\n"
15-
"Last-Translator: Juan Alegría <juanszalegria@gmail.com>\n"
14+
"PO-Revision-Date: 2021-08-29 09:51+0800\n"
15+
"Last-Translator: Rodrigo Tobar <rtobarc@gmail.com>\n"
1616
"Language: es_CO\n"
1717
"Language-Team: python-doc-es\n"
18-
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
1919
"MIME-Version: 1.0\n"
2020
"Content-Type: text/plain; charset=utf-8\n"
2121
"Content-Transfer-Encoding: 8bit\n"
2222
"Generated-By: Babel 2.8.0\n"
23+
"X-Generator: Poedit 2.4.2\n"
2324

2425
#: ../Doc/library/profile.rst:5
2526
msgid "The Python Profilers"
@@ -1012,12 +1013,19 @@ msgid ""
10121013
"instance holds information related to the function's profile such as how "
10131014
"long the function took to run, how many times it was called, etc..."
10141015
msgstr ""
1016+
"Este método retorna una instancia de StatsProfile, la cual contiene un mapeo "
1017+
"de nombres de función a instancias de FunctionProfile. Cada instancia de "
1018+
"FunctionProfile mantiene información relacionada al perfil de la función, "
1019+
"como cuánto demoró la función en ejecutarse, cuantas veces fue llamada, "
1020+
"etc..."
10151021

10161022
#: ../Doc/library/profile.rst:535
10171023
msgid ""
10181024
"Added the following dataclasses: StatsProfile, FunctionProfile. Added the "
10191025
"following function: get_stats_profile."
10201026
msgstr ""
1027+
"Añadidas las siguientes clases de datos: StatsProfile, FunctionProfile. "
1028+
"Añadida la siguiente función: get_stats_profile."
10211029

10221030
#: ../Doc/library/profile.rst:542
10231031
msgid "What Is Deterministic Profiling?"
@@ -1190,7 +1198,7 @@ msgstr ""
11901198
"directamente y nuevamente bajo el generador de perfiles, midiendo el tiempo "
11911199
"para ambas. Luego calcula la sobrecarga oculta por evento del generador de "
11921200
"perfiles y la retorna como flotante. Por ejemplo, en un Intel Core i5 de "
1193-
"1.8Ghz con Mac OS X y usando time.process_time() de Python como "
1201+
"1.8GHz con Mac OS X y usando time.process_time() de Python como "
11941202
"temporizador, el número mágico es aproximadamente 4.04e-6."
11951203

11961204
#: ../Doc/library/profile.rst:628

library/tracemalloc.po

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
# Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to get
77
# the list of volunteers
88
#
9-
#, fuzzy
109
msgid ""
1110
msgstr ""
1211
"Project-Id-Version: Python 3.8\n"
1312
"Report-Msgid-Bugs-To: \n"
1413
"POT-Creation-Date: 2021-03-19 11:16+0100\n"
15-
"PO-Revision-Date: 2020-10-03 21:38-0300\n"
16-
"Last-Translator: \n"
14+
"PO-Revision-Date: 2021-08-30 21:01+0800\n"
15+
"Last-Translator: Rodrigo Tobar <rtobarc@gmail.com>\n"
1716
"Language: es\n"
1817
"Language-Team: python-doc-es\n"
19-
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
2019
"MIME-Version: 1.0\n"
2120
"Content-Type: text/plain; charset=utf-8\n"
2221
"Content-Transfer-Encoding: 8bit\n"
2322
"Generated-By: Babel 2.8.0\n"
23+
"X-Generator: Poedit 2.4.2\n"
2424

2525
#: ../Doc/library/tracemalloc.rst:2
2626
msgid ":mod:`tracemalloc` --- Trace memory allocations"
@@ -201,6 +201,7 @@ msgstr ""
201201
#: ../Doc/library/tracemalloc.rst:253
202202
msgid "Record the current and peak size of all traced memory blocks"
203203
msgstr ""
204+
"Graba los tamaños actual y máximo de todos los bloques de memoria rastreados"
204205

205206
#: ../Doc/library/tracemalloc.rst:255
206207
msgid ""
@@ -210,6 +211,11 @@ msgid ""
210211
"observe the small memory usage after the sum is computed as well as the peak "
211212
"memory usage during the computations::"
212213
msgstr ""
214+
"El siguiente código calcula dos sumas como ``0 + 1 + 2 + ...`` de forma "
215+
"ineficiente, creando una lista con estos números. Esta lista consume mucha "
216+
"memoria de forma temporal. Podemos usar :func:`get_traced_memory` y :func:"
217+
"`reset_peak` para observar el pequeño uso de memoria después de que la suma "
218+
"es calculada, así como también el uso máximo de memoria durante el cálculo:"
213219

214220
#: ../Doc/library/tracemalloc.rst:280 ../Doc/library/tracemalloc.rst:759
215221
msgid "Output::"
@@ -226,6 +232,14 @@ msgid ""
226232
"we could optimise (by removing the unnecessary call to :class:`list`, and "
227233
"writing ``sum(range(...))``)."
228234
msgstr ""
235+
"El uso de :func:`reset_peak` asegura que podemos registrar precisamente el "
236+
"uso máximo de memoria durante el cálculo de ``small_sum``, incluso si es "
237+
"mucho menor al máximo total desde la llamada a :func:`start`. Sin la llamada "
238+
"a :func:`reset_peak`, ``second_peak`` seguiría siendo el uso máximo de "
239+
"memoria del cálculo de ``large_sum`` (es decir, igual a ``first_peak``). En "
240+
"este caso ambos máximos son mucho mayores al uso final de memoria, lo que "
241+
"sugiere que podemos optimizar (removiendo la llamada innecesaria a :class:"
242+
"`list`, y escribiendo ``sum(range(...))``)."
229243

230244
#: ../Doc/library/tracemalloc.rst:295
231245
msgid "API"
@@ -249,7 +263,7 @@ msgid ""
249263
"class:`Traceback` instance, or ``None`` if the :mod:`tracemalloc` module is "
250264
"not tracing memory allocations or did not trace the allocation of the object."
251265
msgstr ""
252-
"Obtén el rastreo de donde el objeto de Python fue asignado. Retorna una "
266+
"Obtiene el rastreo de donde el objeto de Python fue asignado. Retorna una "
253267
"instancia :class:`Traceback` o ``None`` si el módulo :mod:`tracemalloc` no "
254268
"esta rastreando ninguna asignación de memoria o no rastreó la asignación del "
255269
"objeto."
@@ -262,7 +276,7 @@ msgstr ""
262276
#: ../Doc/library/tracemalloc.rst:319
263277
msgid "Get the maximum number of frames stored in the traceback of a trace."
264278
msgstr ""
265-
"Obtén el número máximo de cuadros guardados en el seguimiento de un rastro."
279+
"Obtiene el número máximo de cuadros guardados en el seguimiento de un rastro."
266280

267281
#: ../Doc/library/tracemalloc.rst:321
268282
msgid ""
@@ -281,28 +295,25 @@ msgid ""
281295
"Get the current size and peak size of memory blocks traced by the :mod:"
282296
"`tracemalloc` module as a tuple: ``(current: int, peak: int)``."
283297
msgstr ""
284-
"Obtén el tamaño actual y tamaño pico de los bloques de memorias rastreados "
298+
"Obtiene el tamaño actual y tamaño pico de los bloques de memorias rastreados "
285299
"por el módulo :mod:`tracemalloc` como una tupla: ``(current: int, peak: "
286300
"int)``."
287301

288302
#: ../Doc/library/tracemalloc.rst:335
289-
#, fuzzy
290303
msgid ""
291304
"Set the peak size of memory blocks traced by the :mod:`tracemalloc` module "
292305
"to the current size."
293306
msgstr ""
294-
"Obtén el tamaño actual y tamaño pico de los bloques de memorias rastreados "
295-
"por el módulo :mod:`tracemalloc` como una tupla: ``(current: int, peak: "
296-
"int)``."
307+
"Establece el tamaño máximo de los bloques de memorias rastreados por el "
308+
"módulo :mod:`tracemalloc` al tamaño actual."
297309

298310
#: ../Doc/library/tracemalloc.rst:338
299-
#, fuzzy
300311
msgid ""
301312
"Do nothing if the :mod:`tracemalloc` module is not tracing memory "
302313
"allocations."
303314
msgstr ""
304-
"Si el módulo :mod:`tracemalloc` esta rastreando asignaciones de memoria de "
305-
"Python retorna ``True`` sino retorna ``False``."
315+
"No realiza ninguna acción si el módulo :mod:`tracemalloc` no está rastreando "
316+
"asignaciones de memoria."
306317

307318
#: ../Doc/library/tracemalloc.rst:341
308319
msgid ""
@@ -311,19 +322,24 @@ msgid ""
311322
"`take_snapshot` before a call to :func:`reset_peak` can be meaningfully "
312323
"compared to snapshots taken after the call."
313324
msgstr ""
325+
"Esta función sólo modifica el valor guardado para el uso máximo de memoria, "
326+
"y no modifica o borra ningún rastreo, no como :func:`clear_traces`. "
327+
"Capturas tomadas con :func:`take_snapshot` antes de una llamada a :func:"
328+
"`reset_peak` pueden ser comparadas significativamente con capturas hechas "
329+
"después de la llamada."
314330

315331
#: ../Doc/library/tracemalloc.rst:346
316-
#, fuzzy
317332
msgid "See also :func:`get_traced_memory`."
318-
msgstr "Mira también la función :func:`stop`."
333+
msgstr "Mira también la función :func:`get_traced_memory`."
319334

320335
#: ../Doc/library/tracemalloc.rst:353
321336
msgid ""
322337
"Get the memory usage in bytes of the :mod:`tracemalloc` module used to store "
323338
"traces of memory blocks. Return an :class:`int`."
324339
msgstr ""
325-
"Obtén el uso de la memoria en bytes desde el modulo :mod:`tracemalloc` usado "
326-
"para guardar rastreos de bloques de memoria. Retorna una clase :class:`int`."
340+
"Obtiene el uso de la memoria en bytes desde el modulo :mod:`tracemalloc` "
341+
"usado para guardar rastreos de bloques de memoria. Retorna una clase :class:"
342+
"`int`."
327343

328344
#: ../Doc/library/tracemalloc.rst:360
329345
msgid ""
@@ -355,6 +371,8 @@ msgid ""
355371
"You can still read the original number of total frames that composed the "
356372
"traceback by looking at the :attr:`Traceback.total_nframe` attribute."
357373
msgstr ""
374+
"El número original de cuadros totales que componen el seguimiento observando "
375+
"el atributo :attr:`Traceback.total_nframe`."
358376

359377
#: ../Doc/library/tracemalloc.rst:376
360378
msgid ""
@@ -395,15 +413,14 @@ msgstr ""
395413
"`get_traceback_limit`."
396414

397415
#: ../Doc/library/tracemalloc.rst:394
398-
#, fuzzy
399416
msgid ""
400417
"Stop tracing Python memory allocations: uninstall hooks on Python memory "
401418
"allocators. Also clears all previously collected traces of memory blocks "
402419
"allocated by Python."
403420
msgstr ""
404-
"Detén el rastreo de las asignaciones de memoria de Python: desinstala los "
405-
"*hooks*. También limpia todos los rastros de memoria recolectados por los "
406-
"bloques de memoria asignados por Python."
421+
"Detiene el rastreo de las asignaciones de memoria de Python: desinstala los "
422+
"*hooks*. También limpia todos los rastros de memoria recolectados acerca de "
423+
"los bloques de memoria asignados por Python."
407424

408425
#: ../Doc/library/tracemalloc.rst:398
409426
msgid ""
@@ -950,6 +967,11 @@ msgid ""
950967
"total_nframe` attribute. That allows to know if a traceback has been "
951968
"truncated by the traceback limit."
952969
msgstr ""
970+
"Cuando se toma una captura, los seguimientos de los rastreos se limitan a :"
971+
"func:`get_traceback_limit` cuadros. Ver la función :func:`take_snapshot`. "
972+
"El número original de cuadros del seguimiento se guarda en el atributo :attr:"
973+
"`Traceback.total_nframe`. Esto permite saber si un seguimiento fue truncado "
974+
"por el límite de seguimientos."
953975

954976
#: ../Doc/library/tracemalloc.rst:726
955977
msgid ""
@@ -972,10 +994,12 @@ msgid ""
972994
"Total number of frames that composed the traceback before truncation. This "
973995
"attribute can be set to ``None`` if the information is not available."
974996
msgstr ""
997+
"Número total de cuadros que componen el seguimiento antes de ser truncado. "
998+
"Este atributo puede ser ``None`` si no hay información disponible."
975999

9761000
#: ../Doc/library/tracemalloc.rst:738
9771001
msgid "The :attr:`Traceback.total_nframe` attribute was added."
978-
msgstr ""
1002+
msgstr "El atributo :attr:`Traceback.total_nframe` fue añadido."
9791003

9801004
#: ../Doc/library/tracemalloc.rst:743
9811005
msgid ""

scripts/find_in_po.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
import functools
45
from glob import glob
6+
import multiprocessing
57
import os
68
from textwrap import fill
79

@@ -10,26 +12,46 @@
1012
from tabulate import tabulate # fades
1113

1214

15+
REVERSE = '\033[7m'
16+
NORMAL = '\033[m'
17+
18+
def _get_file_entries(pattern, width, filename):
19+
entries = []
20+
for entry in (entry for entry in polib.pofile(filename) if entry.msgstr):
21+
match = pattern.search(entry.msgid)
22+
if match:
23+
add_str = entry.msgid + " ·filename: " + filename + "·"
24+
entries.append(
25+
[
26+
fill(add_str, width=width),
27+
fill(entry.msgstr, width=width),
28+
]
29+
)
30+
return entries
31+
1332
def find_in_po(pattern):
14-
table = []
33+
pattern = regex.compile(pattern)
1534
try:
1635
_, columns = os.popen("stty size", "r").read().split()
1736
available_width = int(columns) // 2 - 3
1837
except:
1938
available_width = 80 // 2 - 3
2039

21-
for file in glob("**/*.po"):
22-
pofile = polib.pofile(file)
23-
for entry in pofile:
24-
if entry.msgstr and regex.search(pattern, entry.msgid):
25-
add_str = entry.msgid + " ·filename: " + file + "·"
26-
table.append(
27-
[
28-
fill(add_str, width=available_width),
29-
fill(entry.msgstr, width=available_width),
30-
]
31-
)
32-
print(tabulate(table, tablefmt="fancy_grid"))
40+
# Find entries in parallel
41+
get_file_entries = functools.partial(_get_file_entries, pattern, available_width)
42+
pool = multiprocessing.Pool()
43+
all_entries = pool.map(get_file_entries, glob("**/*.po"))
44+
table = [entry for file_entries in all_entries for entry in file_entries]
45+
46+
# Create table and highlight results
47+
table = tabulate(table, tablefmt="fancy_grid")
48+
for line in table.splitlines():
49+
match = pattern.search(line)
50+
if match:
51+
span = match.span()
52+
line = (line[:span[0]] + REVERSE + line[span[0]:span[1]] + NORMAL +
53+
line[span[1]:])
54+
print(line)
3355

3456

3557
def parse_args():

0 commit comments

Comments
 (0)