Skip to content

Commit 905935e

Browse files
Null translations of new 2.1 beta 3 content. (#71)
1 parent 8484691 commit 905935e

File tree

38 files changed

+1313
-309
lines changed

38 files changed

+1313
-309
lines changed

lang/es-es/typeshed/stdlib/audio.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ from .microbit.audio import (
77
play as play,
88
stop as stop,
99
AudioFrame as AudioFrame,
10+
SoundEffect as SoundEffect,
1011
)

lang/es-es/typeshed/stdlib/log.pyi

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,42 @@ HOURS = 36000
1111
DAYS = 864000
1212
"""Formato de marca temporal en días. (días)"""
1313

14-
def set_labels(*args: str, timestamp: Optional[Literal[1, 10, 36000, 864000]]=SECONDS) -> None:
14+
def set_labels(*labels: str, timestamp: Optional[Literal[1, 10, 36000, 864000]]=SECONDS) -> None:
1515
"""Configura la cabecera del archivo de registro. (configurar etiquetas)
1616
17-
Example: ``log.set_labels('x', 'y', 'z', timestamp=log.MINUTES)``
17+
Example: ``log.set_labels('X', 'Y', 'Z', timestamp=log.MINUTES)``
1818
19-
Each call to this function with positional arguments will generate a new
20-
header entry into the log file.
19+
Ideally this function should be called a single time, before any data is
20+
logged, to configure the data table header once.
2121
22-
If the program starts and a log file already exists it will compare the
23-
labels set up by this function call to the last headers declared in the
24-
file. If the headers are different it will add a new header entry at the
25-
end of the file.
22+
If a log file already exists when the program starts, or if this function
23+
is called multiple times, it will check the labels already defined in the
24+
log file. If this function call contains any new labels not already
25+
present, it will generate a new header row with the additional columns.
2626
27-
:param *args: Un argumento posicional para cada cabecera de registro.
28-
:param timestamp: (marca de tiempo) La unidad de marca temporal que se añadirá automáticamente como la primera columna en cada fila.
29-
Establecer este argumento a ``None`` desactiva la marca temporal. Se le pueden pasar los valores ``log.MILLISECONDS``, ``log.SECONDS``, ``log.MINUTES``, ``log.HOURS`` o ``log.DAYS`` definidos en este módulo. Un valor no válido lanzará una excepción."""
27+
By default the first column contains a timestamp for each row. The time
28+
unit can be selected via the timestamp argument.
29+
30+
:param *labels: Any number of positional arguments, each corresponding to an entry in the log header.
31+
:param timestamp: (marca de tiempo) Select the timestamp unit that will be automatically added as the first column in every row. Timestamp values can be one of ``log.MILLISECONDS``, ``log.SECONDS``, ``log.MINUTES``, ``log.HOURS``, ``log.DAYS`` or ``None`` to disable the timestamp. The default value is ``log.SECONDS``."""
3032
...
3133

3234
@overload
33-
def add(log_data: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
3436
"""Añade una fila de datos al registro pasando un diccionario de cabeceras y valores. (añadir)
3537
3638
Example: ``log.add({ 'temp': temperature() })``
3739
3840
Each call to this function adds a row to the log.
3941
40-
Dictionary keys not already specified via the ``set_labels`` function,
41-
or by a previous call to this function, will trigger a new header
42-
entry to be added to the log with the extra label.
42+
New labels not previously specified via the set_labels function, or by a
43+
previous call to this function, will trigger a new header entry to be added
44+
to the log with the extra labels.
4345
44-
Labels previously specified and not present in this function call will be
45-
skipped with an empty value in the log row.
46+
Labels previously specified and not present in a call to this function will
47+
be skipped with an empty value in the log row.
4648
47-
:param log_data: (registrar datos) Los datos a registrar como un diccionario con una clave para cada cabecera."""
49+
:param data_dictionary: The data to log as a dictionary with a key for each header."""
4850
...
4951

5052
@overload
@@ -55,32 +57,33 @@ Example: ``log.add(temp=temperature())``
5557
5658
Each call to this function adds a row to the log.
5759
58-
Keyword arguments not already specified via the ``set_labels`` function,
59-
or by a previous call to this function, will trigger a new header entry
60-
to be added to the log with the extra label.
60+
New labels not previously specified via the set_labels function, or by a
61+
previous call to this function, will trigger a new header entry to be added
62+
to the log with the extra labels.
6163
62-
Labels previously specified and not present in this function call will be
63-
skipped with an empty value in the log row."""
64+
Labels previously specified and not present in a call to this function will
65+
be skipped with an empty value in the log row."""
6466
...
6567

6668
def delete(full=False):
6769
"""Elimina el contenido del registro, incluyendo las cabeceras. (eliminar)
6870
6971
Example: ``log.delete()``
7072
71-
To add the log headers the ``set_labels`` function has to be called again
72-
after this.
73+
To add the log headers again the ``set_labels`` function should to be called after this function.
74+
75+
There are two erase modes; “full” completely removes the data from the physical storage,
76+
and “fast” invalidates the data without removing it.
7377
74-
:param full: (completo) Selecciona un formato de borrado "completo" que elimina los datos del almacenamiento flash.
75-
Si se pone a ``False`` (falso), usa un método "rápido" que invalida los datos en lugar de realizar un borrado completo más lento."""
78+
:param full: (completo) ``True`` selects a “full” erase and ``False`` selects the “fast” erase method."""
7679
...
7780

7881
def set_mirroring(serial: bool):
79-
"""Replica la actividad del registro de datos en la salida serie. (configurar replicación)
82+
"""Configure mirroring of the data logging activity to the serial output. (configurar replicación)
8083
8184
Example: ``log.set_mirroring(True)``
8285
83-
Mirroring is disabled by default.
86+
Serial mirroring is disabled by default. When enabled, it will print to serial each row logged into the log file.
8487
85-
:param serial: (serie) Si se le pasa ``True`` (verdadero), replicará la actividad del registro de datos en la salida serie; si se le pasa ``False`` (falso), se desactivará la replicación."""
88+
:param serial: (serie) ``True`` enables mirroring data to the serial output."""
8689
...

lang/es-es/typeshed/stdlib/microbit/__init__.pyi

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
11
"""Pines, imágenes, sonidos, temperatura y volumen."""
2+
from typing import Any, Callable, List, Optional, Tuple, overload
23
from _typeshed import ReadableBuffer
3-
from typing import Any, Callable, List, Optional, overload
44
from . import accelerometer as accelerometer
5+
from . import audio as audio
56
from . import compass as compass
67
from . import display as display
78
from . import i2c as i2c
89
from . import microphone as microphone
910
from . import speaker as speaker
1011
from . import spi as spi
1112
from . import uart as uart
12-
from . import audio as audio
1313

1414
def run_every(callback: Optional[Callable[[], None]]=None, days: int=0, h: int=0, min: int=0, s: int=0, ms: int=0) -> Callable[[Callable[[], None]], Callable[[], None]]:
15-
"""Programa una función para llamarla en un intervalo dado **solo V2**. (ejecutar cada)
15+
"""Schedule to run a function at the interval specified by the time arguments **V2 only**. (ejecutar cada)
1616
1717
Example: ``run_every(my_logging, min=5)``
1818
19-
This function can be passed a callback::
20-
21-
run_every(your_function, h=1, min=20, s=30, ms=50)
19+
``run_every`` can be used in two ways:
2220
23-
or used as a decorator::
21+
As a Decorator - placed on top of the function to schedule. For example::
2422
2523
@run_every(h=1, min=20, s=30, ms=50)
26-
def your_function():
27-
pass
24+
def my_function():
25+
# Do something here
26+
27+
As a Function - passing the callback as a positional argument. For example::
28+
29+
def my_function():
30+
# Do something here
31+
run_every(my_function, s=30)
32+
33+
Each argument corresponds to a different time unit and they are additive.
34+
So ``run_every(min=1, s=30)`` schedules the callback every minute and a half.
2835
29-
Arguments with different time units are additive.
36+
When an exception is thrown inside the callback function it deschedules the
37+
function. To avoid this you can catch exceptions with ``try/except``.
3038
31-
:param callback: La función "callback" (devolución de llamada) que se llama; omitir si se usa en un patrón "Decorator"
32-
:param days: (días) El intervalo en días.
33-
:param h: El intervalo en horas.
34-
:param min: El intervalo en minutos.
35-
:param s: El intervalo en segundos.
36-
:param ms: El intervalo en milisegundos."""
39+
:param callback: Function to call at the provided interval. Omit when using as a decorator.
40+
:param days: (días) Sets the day mark for the scheduling.
41+
:param h: Sets the hour mark for the scheduling.
42+
:param min: Sets the minute mark for the scheduling.
43+
:param s: Sets the second mark for the scheduling.
44+
:param ms: Sets the millisecond mark for the scheduling."""
3745

3846
def panic(n: int) -> None:
3947
"""Entra en modo pánico (pánico)
@@ -47,6 +55,20 @@ Requires restart."""
4755
def reset() -> None:
4856
"""Reiniciar la placa. (restablecer)"""
4957

58+
def scale(value: float, from_: Tuple[float, float], to: Tuple[float, float]) -> float:
59+
"""Converts a value from a range to another range.
60+
61+
Example: ``temp_fahrenheit = scale(30, from_=(0, 100), to=(32, 212))``
62+
63+
This can be useful to convert values between inputs and outputs, for example an accelerometer X value to a speaker volume.
64+
65+
Negative scaling is also supported, for example ``scale(25, from_=(0, 100), to=(0, -200))`` will return ``-50``.
66+
67+
:param value: (valor) A number to convert.
68+
:param from_: A tuple to define the range to convert from.
69+
:param to: A tuple to define the range to convert to.
70+
:return: The ``value`` converted to the ``to`` range."""
71+
5072
def sleep(n: float) -> None:
5173
"""Espera ``n`` milisegundos. (dormir)
5274
@@ -412,6 +434,8 @@ Given an image object it's possible to display it via the ``display`` API::
412434
"""Imagen de un paraguas. (paraguas)"""
413435
SNAKE: Image
414436
"""Imagen de una serpiente. (serpiente)"""
437+
SCISSORS: Image
438+
"""Scissors image."""
415439
ALL_CLOCKS: List[Image]
416440
"""Una lista que contiene todas las imágenes CLOCK_ en secuencia. (todos los relojes)"""
417441
ALL_ARROWS: List[Image]

lang/es-es/typeshed/stdlib/microbit/accelerometer.pyi

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ Example: ``x, y, z = accelerometer.get_values()``
3333
:return: a three-element tuple of integers ordered as X, Y, Z, each value a positive or negative integer depending on direction in the range +/- 2000mg"""
3434
...
3535

36+
def get_strength() -> int:
37+
"""Get the acceleration measurement of all axes combined, as a positive integer. This is the Pythagorean sum of the X, Y and Z axes.
38+
39+
Example: ``accelerometer.get_strength()``
40+
41+
:return: The combined acceleration strength of all the axes, in milli-g."""
42+
...
43+
3644
def current_gesture() -> str:
3745
"""Obtiene el nombre del gesto actual. (gesto actual)
3846
@@ -85,4 +93,11 @@ calls to some accelerometer method to do the gesture detection. Usually
8593
gestures can be detected using a loop with a small :func:`microbit.sleep` delay.
8694
8795
:return: The history as a tuple, most recent last."""
88-
...
96+
...
97+
98+
def set_range(value: int) -> None:
99+
"""Set the accelerometer sensitivity range, in g (standard gravity), to the closest values supported by the hardware, so it rounds to either ``2``, ``4``, or ``8`` g.
100+
101+
Example: ``accelerometer.set_range(8)``
102+
103+
:param value: (valor) New range for the accelerometer, an integer in ``g``."""

lang/es-es/typeshed/stdlib/microbit/audio.pyi

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""Reproducir sonidos usando el micro:bit (importar ``audio`` para compatibilidad con V1)."""
22
from ..microbit import MicroBitDigitalPin, Sound, pin0
3-
from typing import Iterable, Union
3+
from typing import ClassVar, Iterable, Union
44

5-
def play(source: Union[Iterable[AudioFrame], Sound], wait: bool=True, pin: MicroBitDigitalPin=pin0, return_pin: Union[MicroBitDigitalPin, None]=None) -> None:
6-
"""Reproduce un sonido predefinido o pistas de audio personalizadas. (reproducir)
5+
def play(source: Union[Iterable[AudioFrame], Sound, SoundEffect], wait: bool=True, pin: MicroBitDigitalPin=pin0, return_pin: Union[MicroBitDigitalPin, None]=None) -> None:
6+
"""Play a built-in sound, sound effect or custom audio frames. (reproducir)
77
88
Example: ``audio.play(Sound.GIGGLE)``
99
10-
:param source: (origen) Un ``Sound`` predefinido como ``Sound.GIGGLE`` o datos de muestra como un iterable de objetos ``AudioFrame``.
10+
:param source: (origen) A built-in ``Sound`` such as ``Sound.GIGGLE``, a ``SoundEffect`` or sample data as an iterable of ``AudioFrame`` objects.
1111
:param wait: (esperar) Si ``wait`` es ``True`` (verdadero), la función se bloqueará hasta que el sonido finalice.
1212
:param pin: Se puede usar un argumento opcional para especificar el pin de salida, reemplazando el valor predeterminado de ``pin0``. Si no queremos que se reproduzca ningún sonido, podemos usar ``pin=None``.
1313
:param return_pin: (devolver pin) Especifica un pin de conector de borde diferencial para conectarse a un altavoz externo en lugar de tierra. Esto se ignora para la revisión **V2**."""
@@ -26,6 +26,75 @@ def stop() -> None:
2626
Example: ``audio.stop()``"""
2727
...
2828

29+
class SoundEffect:
30+
"""A sound effect, composed by a set of parameters configured via the constructor or attributes."""
31+
WAVEFORM_SINE: ClassVar[int]
32+
"""Sine wave option used for the ``waveform`` parameter."""
33+
WAVEFORM_SAWTOOTH: ClassVar[int]
34+
"""Sawtooth wave option used for the ``waveform`` parameter."""
35+
WAVEFORM_TRIANGLE: ClassVar[int]
36+
"""Triangle wave option used for the ``waveform`` parameter."""
37+
WAVEFORM_SQUARE: ClassVar[int]
38+
"""Square wave option used for the ``waveform`` parameter."""
39+
WAVEFORM_NOISE: ClassVar[int]
40+
"""Noise option used for the ``waveform`` parameter."""
41+
SHAPE_LINEAR: ClassVar[int]
42+
"""Linear interpolation option used for the ``shape`` parameter."""
43+
SHAPE_CURVE: ClassVar[int]
44+
"""Curve interpolation option used for the ``shape`` parameter."""
45+
SHAPE_LOG: ClassVar[int]
46+
"""Logarithmic interpolation option used for the ``shape`` parameter."""
47+
FX_NONE: ClassVar[int]
48+
"""No effect option used for the ``fx`` parameter."""
49+
FX_TREMOLO: ClassVar[int]
50+
"""Tremelo effect option used for the ``fx`` parameter."""
51+
FX_VIBRATO: ClassVar[int]
52+
"""Vibrato effect option used for the ``fx`` parameter."""
53+
FX_WARBLE: ClassVar[int]
54+
"""Warble effect option used for the ``fx`` parameter."""
55+
freq_start: int
56+
"""Start frequency in Hertz (Hz), a number between ``0`` and ``9999``"""
57+
freq_end: int
58+
"""End frequency in Hertz (Hz), a number between ``0`` and ``9999``"""
59+
duration: int
60+
"""Duration of the sound in milliseconds, a number between ``0`` and ``9999`` (duración)"""
61+
vol_start: int
62+
"""Start volume value, a number between ``0`` and ``255``"""
63+
vol_end: int
64+
"""End volume value, a number between ``0`` and ``255``"""
65+
waveform: int
66+
"""Type of waveform shape, one of these values: ``WAVEFORM_SINE``, ``WAVEFORM_SAWTOOTH``, ``WAVEFORM_TRIANGLE``, ``WAVEFORM_SQUARE``, ``WAVEFORM_NOISE`` (randomly generated noise)"""
67+
fx: int
68+
"""Effect to add on the sound, one of the following values: ``FX_TREMOLO``, ``FX_VIBRATO``, ``FX_WARBLE``, or ``FX_NONE``"""
69+
shape: int
70+
"""The type of the interpolation curve between the start and end frequencies, different wave shapes have different rates of change in frequency. One of the following values: ``SHAPE_LINEAR``, ``SHAPE_CURVE``, ``SHAPE_LOG``"""
71+
72+
def __init__(self, freq_start: int=500, freq_end: int=2500, duration: int=500, vol_start: int=255, vol_end: int=0, waveform: int=WAVEFORM_SQUARE, fx: int=FX_NONE, shape: int=SHAPE_LOG):
73+
"""Create a new sound effect.
74+
75+
Example: ``my_effect = SoundEffect(duration=1000)``
76+
77+
All the parameters are optional, with default values as shown above, and
78+
they can all be modified via attributes of the same name. For example, we
79+
can first create an effect ``my_effect = SoundEffect(duration=1000)``,
80+
and then change its attributes ``my_effect.duration = 500``.
81+
82+
:param freq_start: Start frequency in Hertz (Hz), a number between ``0`` and ``9999``.
83+
:param freq_end: End frequency in Hertz (Hz), a number between ``0`` and ``9999``.
84+
:param duration: (duración) Duration of the sound in milliseconds, a number between ``0`` and ``9999``.
85+
:param vol_start: Start volume value, a number between ``0`` and ``255``.
86+
:param vol_end: End volume value, a number between ``0`` and ``255``.
87+
:param waveform: Type of waveform shape, one of these values: ``WAVEFORM_SINE``, ``WAVEFORM_SAWTOOTH``, ``WAVEFORM_TRIANGLE``, ``WAVEFORM_SQUARE``, ``WAVEFORM_NOISE`` (randomly generated noise).
88+
:param fx: Effect to add on the sound, one of the following values: ``FX_TREMOLO``, ``FX_VIBRATO``, ``FX_WARBLE``, or ``FX_NONE``.
89+
:param shape: The type of the interpolation curve between the start and end frequencies, different wave shapes have different rates of change in frequency. One of the following values: ``SHAPE_LINEAR``, ``SHAPE_CURVE``, ``SHAPE_LOG``."""
90+
91+
def copy(self) -> SoundEffect:
92+
"""Create a copy of this ``SoundEffect``. (copiar)
93+
94+
Example: ``sound_2 = sound_1.copy()``
95+
96+
:return: A copy of the SoundEffect."""
97+
2998
class AudioFrame:
3099
"""Un objeto ``AudioFrame`` es una lista de 32 muestras, cada una de las cuales es un byte
31100
sin signo (número entero entre 0 y 255).
@@ -38,6 +107,13 @@ Example::
38107
for i in range(len(frame)):
39108
frame[i] = 252 - i * 8"""
40109

110+
def copyfrom(self, other: AudioFrame) -> None:
111+
"""Overwrite the data in this ``AudioFrame`` with the data from another ``AudioFrame`` instance.
112+
113+
Example: ``my_frame.copyfrom(source_frame)``
114+
115+
:param other: (otro) ``AudioFrame`` instance from which to copy the data."""
116+
41117
def __len__(self) -> int:
42118
...
43119

lang/es-es/typeshed/stdlib/power.pyi

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"""Manage the power modes of the micro:bit (V2 only).
2+
"""
3+
4+
from microbit import MicroBitDigitalPin, Button
5+
from typing import Optional, Tuple, Union
6+
7+
def off() -> None:
8+
"""Power down the board to the lowest possible power mode.
9+
10+
Example: ``power.off()``
11+
12+
This is the equivalent to pressing the reset button for a few seconds,
13+
to set the board in "Off mode".
14+
15+
The micro:bit will only wake up if the reset button is pressed or,
16+
if on battery power, when a USB cable is connected.
17+
18+
When the board wakes up it will start for a reset state, so your program
19+
will start running from the beginning.
20+
"""
21+
...
22+
23+
def deep_sleep(
24+
ms: Optional[int] = None,
25+
wake_on: Optional[
26+
Union[MicroBitDigitalPin, Button] | Tuple[MicroBitDigitalPin | Button, ...]
27+
] = None,
28+
run_every: bool = True,
29+
) -> None:
30+
"""Set the micro:bit into a low power mode where it can wake up and continue operation.
31+
32+
Example: ``power.deep_sleep(wake_on=(button_a, button_b))``
33+
34+
The program state is preserved and when it wakes up it will resume operation where it left off.
35+
36+
Deep Sleep mode will consume more battery power than Off mode.
37+
38+
The wake up sources are configured via arguments.
39+
40+
If no wake up sources have been configured it will sleep until the reset button is pressed (which resets the Target MCU) or, in battery power, when the USB cable is inserted.
41+
42+
When the ``run_every`` parameter is set to ``True`` (the default), any function scheduled with ``microbit.run_every`` will still run while the board sleeps. When the scheduled time is reached the micro:bit will momentarily wake up to run the scheduled function and then automatically go back to sleep.
43+
44+
:param ms: A time in milliseconds to wait before it wakes up.
45+
:param wake_on: A single instance or a tuple of pins and/or buttons to wake up the board, e.g. ``deep_sleep(wake_on=button_a)`` or ``deep_sleep(wake_on=(pin0, pin2, button_b))``.
46+
:param run_every: A boolean to configure if the functions scheduled with ``microbit.run_every`` will continue to run while it sleeps.
47+
"""
48+
...

0 commit comments

Comments
 (0)