Skip to content

Commit b3b5aac

Browse files
Translation sync. (#73)
This incorporates the changes for MicroPython 2.1.0 final release.
1 parent c748e12 commit b3b5aac

File tree

28 files changed

+397
-217
lines changed

28 files changed

+397
-217
lines changed

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Pines, imágenes, sonidos, temperatura y volumen."""
2-
from typing import Any, Callable, List, Optional, Tuple, overload
2+
from typing import Any, Callable, List, Optional, Tuple, Union, overload
33
from _typeshed import ReadableBuffer
44
from . import accelerometer as accelerometer
55
from . import audio as audio
@@ -55,14 +55,39 @@ Requires restart."""
5555
def reset() -> None:
5656
"""Reiniciar la placa. (restablecer)"""
5757

58+
@overload
59+
def scale(value: float, from_: Tuple[float, float], to: Tuple[int, int]) -> int:
60+
"""Converts a value from a range to an integer range.
61+
62+
Example: ``volume = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))``
63+
64+
For example, to convert an accelerometer X value to a speaker volume.
65+
66+
If one of the numbers in the ``to`` parameter is a floating point
67+
(i.e a decimal number like ``10.0``), this function will return a
68+
floating point number.
69+
70+
temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))
71+
72+
:param value: (valor) A number to convert.
73+
:param from_: A tuple to define the range to convert from.
74+
:param to: A tuple to define the range to convert to.
75+
:return: The ``value`` converted to the ``to`` range."""
76+
77+
@overload
5878
def scale(value: float, from_: Tuple[float, float], to: Tuple[float, float]) -> float:
59-
"""Converts a value from a range to another range.
79+
"""Converts a value from a range to a floating point range.
80+
81+
Example: ``temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))``
6082
61-
Example: ``temp_fahrenheit = scale(30, from_=(0, 100), to=(32, 212))``
83+
For example, to convert temperature from a Celsius scale to Fahrenheit.
6284
63-
This can be useful to convert values between inputs and outputs, for example an accelerometer X value to a speaker volume.
85+
If one of the numbers in the ``to`` parameter is a floating point
86+
(i.e a decimal number like ``10.0``), this function will return a
87+
floating point number.
88+
If they are both integers (i.e ``10``), it will return an integer::
6489
65-
Negative scaling is also supported, for example ``scale(25, from_=(0, 100), to=(0, -200))`` will return ``-50``.
90+
returns_int = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))
6691
6792
:param value: (valor) A number to convert.
6893
:param from_: A tuple to define the range to convert from.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Crear y reproducir melodías. (música)"""
2-
from typing import Tuple, Union, List
2+
from typing import Optional, Tuple, Union, List
33
from .microbit import MicroBitDigitalPin, pin0
44
DADADADUM: Tuple[str, ...]
55
"""Melodía: apertura de la "Sinfonía n.º 5 en do menor" de Beethoven."""
@@ -79,7 +79,7 @@ Example: ``ticks, beats = music.get_tempo()``
7979
:return: The temp as a tuple with two integer values, the ticks then the beats per minute."""
8080
...
8181

82-
def play(music: Union[str, List[str], Tuple[str, ...]], pin: Union[MicroBitDigitalPin, None]=pin0, wait: bool=True, loop: bool=False) -> None:
82+
def play(music: Union[str, List[str], Tuple[str, ...]], pin: Optional[MicroBitDigitalPin]=pin0, wait: bool=True, loop: bool=False) -> None:
8383
"""Reproduce música. (reproducir)
8484
8585
Example: ``music.play(music.NYAN)``
@@ -92,7 +92,7 @@ Example: ``music.play(music.NYAN)``
9292
Many built-in melodies are defined in this module."""
9393
...
9494

95-
def pitch(frequency: int, duration: int=-1, pin: MicroBitDigitalPin=pin0, wait: bool=True) -> None:
95+
def pitch(frequency: int, duration: int=-1, pin: Optional[MicroBitDigitalPin]=pin0, wait: bool=True) -> None:
9696
"""Reproduce una nota. (tono)
9797
9898
Example: ``music.pitch(185, 1000)``
@@ -108,7 +108,7 @@ For example, if the frequency is set to 440 and the length to
108108
You can only play one pitch on one pin at any one time."""
109109
...
110110

111-
def stop(pin: MicroBitDigitalPin=pin0) -> None:
111+
def stop(pin: Optional[MicroBitDigitalPin]=pin0) -> None:
112112
"""Detiene la reproducción de toda la música en el altavoz integrado y en cualquier pin que esté emitiendo sonido. (detener)
113113
114114
Example: ``music.stop()``

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,20 @@ def deep_sleep(
3131
3232
Example: ``power.deep_sleep(wake_on=(button_a, button_b))``
3333
34-
The program state is preserved and when it wakes up it will resume operation where it left off.
34+
The program state is preserved and when it wakes up it will resume
35+
operation where it left off.
3536
3637
Deep Sleep mode will consume more battery power than Off mode.
3738
3839
The wake up sources are configured via arguments.
3940
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+
The board will always wake up when receiving UART data, when the reset
42+
button is pressed (which resets the board) or, in battery power,
43+
when the USB cable is inserted.
4144
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.
45+
When the ``run_every`` parameter is set to ``True`` (the default), any
46+
function scheduled with ``run_every`` will momentarily wake up the board
47+
to run and when it finishes it will go back to sleep.
4348
4449
:param ms: A time in milliseconds to wait before it wakes up.
4550
: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))``.

lang/fr/typeshed/stdlib/microbit/__init__.pyi

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Broches, images, sons, température et volume"""
2-
from typing import Any, Callable, List, Optional, Tuple, overload
2+
from typing import Any, Callable, List, Optional, Tuple, Union, overload
33
from _typeshed import ReadableBuffer
44
from . import accelerometer as accelerometer
55
from . import audio as audio
@@ -55,14 +55,39 @@ Requires restart."""
5555
def reset() -> None:
5656
"""Redémarrer la carte."""
5757

58+
@overload
59+
def scale(value: float, from_: Tuple[float, float], to: Tuple[int, int]) -> int:
60+
"""Converts a value from a range to an integer range.
61+
62+
Example: ``volume = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))``
63+
64+
For example, to convert an accelerometer X value to a speaker volume.
65+
66+
If one of the numbers in the ``to`` parameter is a floating point
67+
(i.e a decimal number like ``10.0``), this function will return a
68+
floating point number.
69+
70+
temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))
71+
72+
:param value: A number to convert.
73+
:param from_: A tuple to define the range to convert from.
74+
:param to: A tuple to define the range to convert to.
75+
:return: The ``value`` converted to the ``to`` range."""
76+
77+
@overload
5878
def scale(value: float, from_: Tuple[float, float], to: Tuple[float, float]) -> float:
59-
"""Converts a value from a range to another range.
79+
"""Converts a value from a range to a floating point range.
80+
81+
Example: ``temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))``
6082
61-
Example: ``temp_fahrenheit = scale(30, from_=(0, 100), to=(32, 212))``
83+
For example, to convert temperature from a Celsius scale to Fahrenheit.
6284
63-
This can be useful to convert values between inputs and outputs, for example an accelerometer X value to a speaker volume.
85+
If one of the numbers in the ``to`` parameter is a floating point
86+
(i.e a decimal number like ``10.0``), this function will return a
87+
floating point number.
88+
If they are both integers (i.e ``10``), it will return an integer::
6489
65-
Negative scaling is also supported, for example ``scale(25, from_=(0, 100), to=(0, -200))`` will return ``-50``.
90+
returns_int = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))
6691
6792
:param value: A number to convert.
6893
:param from_: A tuple to define the range to convert from.

lang/fr/typeshed/stdlib/music.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Créer et jouer des mélodies."""
2-
from typing import Tuple, Union, List
2+
from typing import Optional, Tuple, Union, List
33
from .microbit import MicroBitDigitalPin, pin0
44
DADADADUM: Tuple[str, ...]
55
"""Mélodie : l'ouverture de la 5e symphonie en do mineur de Beethoven."""
@@ -79,7 +79,7 @@ Example: ``ticks, beats = music.get_tempo()``
7979
:return: The temp as a tuple with two integer values, the ticks then the beats per minute."""
8080
...
8181

82-
def play(music: Union[str, List[str], Tuple[str, ...]], pin: Union[MicroBitDigitalPin, None]=pin0, wait: bool=True, loop: bool=False) -> None:
82+
def play(music: Union[str, List[str], Tuple[str, ...]], pin: Optional[MicroBitDigitalPin]=pin0, wait: bool=True, loop: bool=False) -> None:
8383
"""Jouer de la musique.
8484
8585
Example: ``music.play(music.NYAN)``
@@ -92,7 +92,7 @@ Example: ``music.play(music.NYAN)``
9292
Many built-in melodies are defined in this module."""
9393
...
9494

95-
def pitch(frequency: int, duration: int=-1, pin: MicroBitDigitalPin=pin0, wait: bool=True) -> None:
95+
def pitch(frequency: int, duration: int=-1, pin: Optional[MicroBitDigitalPin]=pin0, wait: bool=True) -> None:
9696
"""Jouer une note. (tangage)
9797
9898
Example: ``music.pitch(185, 1000)``
@@ -108,7 +108,7 @@ For example, if the frequency is set to 440 and the length to
108108
You can only play one pitch on one pin at any one time."""
109109
...
110110

111-
def stop(pin: MicroBitDigitalPin=pin0) -> None:
111+
def stop(pin: Optional[MicroBitDigitalPin]=pin0) -> None:
112112
"""Met fin à toute lecture de musique sur le haut-parleur intégré et à tout son en sortie sur la broche.
113113
114114
Example: ``music.stop()``

lang/fr/typeshed/stdlib/power.pyi

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,20 @@ def deep_sleep(
3131
3232
Example: ``power.deep_sleep(wake_on=(button_a, button_b))``
3333
34-
The program state is preserved and when it wakes up it will resume operation where it left off.
34+
The program state is preserved and when it wakes up it will resume
35+
operation where it left off.
3536
3637
Deep Sleep mode will consume more battery power than Off mode.
3738
3839
The wake up sources are configured via arguments.
3940
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+
The board will always wake up when receiving UART data, when the reset
42+
button is pressed (which resets the board) or, in battery power,
43+
when the USB cable is inserted.
4144
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.
45+
When the ``run_every`` parameter is set to ``True`` (the default), any
46+
function scheduled with ``run_every`` will momentarily wake up the board
47+
to run and when it finishes it will go back to sleep.
4348
4449
:param ms: A time in milliseconds to wait before it wakes up.
4550
: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))``.

lang/ja/typeshed/stdlib/log.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ present, it will generate a new header row with the additional columns.
2727
By default the first column contains a timestamp for each row. The time
2828
unit can be selected via the timestamp argument.
2929
30-
:param *labels: Any number of positional arguments, each corresponding to an entry in the log header.
31-
:param timestamp: 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``."""
30+
:param *labels: 任意の数の位置引数で。それぞれがログヘッダの見出しになります。
31+
:param timestamp: すべての行の最初の列として自動的に追加されるタイムスタンプの単位を選択します。タイムスタンプの値は ``log.MILLISECONDS`` ``log.SECONDS````log.MINUTES````log.HOURS````log.DAYS`` またはタイムスタンプを無効にする ``None`` のうちのいずれかである必要があります。デフォルト値は ``log.SECONDS`` です。"""
3232
...
3333

3434
@overload
@@ -46,7 +46,7 @@ to the log with the extra labels.
4646
Labels previously specified and not present in a call to this function will
4747
be skipped with an empty value in the log row.
4848
49-
:param data_dictionary: The data to log as a dictionary with a key for each header."""
49+
:param data_dictionary: (data dictionary とはデータ辞書の意味です) 記録するデータを辞書で指定します。辞書の各キーが見出しを表します。"""
5050
...
5151

5252
@overload
@@ -75,15 +75,15 @@ To add the log headers again the ``set_labels`` function should to be called aft
7575
There are two erase modes; “full” completely removes the data from the physical storage,
7676
and “fast” invalidates the data without removing it.
7777
78-
:param full: ``True`` selects a “full” erase and ``False`` selects the “fast” erase method."""
78+
:param full: ``True`` を指定すると「完全」消去になり、``False`` を指定すると「高速」消去になります。"""
7979
...
8080

8181
def set_mirroring(serial: bool):
82-
"""Configure mirroring of the data logging activity to the serial output.
82+
"""ログのデータ記録をシリアル出力にミラーリングするかを設定します。
8383
8484
Example: ``log.set_mirroring(True)``
8585
8686
Serial mirroring is disabled by default. When enabled, it will print to serial each row logged into the log file.
8787
88-
:param serial: ``True`` enables mirroring data to the serial output."""
88+
:param serial: ``True`` を指定するとシリアル出力にデータをミラーリングします。"""
8989
...

lang/ja/typeshed/stdlib/microbit/__init__.pyi

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""端子、イメージ、サウンド、温度と音量。"""
2-
from typing import Any, Callable, List, Optional, Tuple, overload
2+
from typing import Any, Callable, List, Optional, Tuple, Union, overload
33
from _typeshed import ReadableBuffer
44
from . import accelerometer as accelerometer
55
from . import audio as audio
@@ -12,7 +12,7 @@ from . import spi as spi
1212
from . import uart as uart
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-
"""Schedule to run a function at the interval specified by the time arguments **V2 only**.
15+
"""time 引数で指定した間隔で関数を実行するようスケジュールします。 **V2** のみで使えます。
1616
1717
Example: ``run_every(my_logging, min=5)``
1818
@@ -36,12 +36,12 @@ So ``run_every(min=1, s=30)`` schedules the callback every minute and a half.
3636
When an exception is thrown inside the callback function it deschedules the
3737
function. To avoid this you can catch exceptions with ``try/except``.
3838
39-
:param callback: Function to call at the provided interval. Omit when using as a decorator.
40-
:param days: 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."""
39+
:param callback: 指定した間隔で呼び出す関数。デコレータとして使う場合は省略してください。
40+
:param days: スケジューリングのための日数を設定します。
41+
:param h: スケジューリングのための時間を設定します。
42+
:param min: スケジューリングのための分を設定します。
43+
:param s: スケジューリングのためのミリ秒を設定します。
44+
:param ms: スケジューリングのための秒を設定します。"""
4545

4646
def panic(n: int) -> None:
4747
"""パニックモードに入ります。
@@ -55,14 +55,39 @@ Requires restart."""
5555
def reset() -> None:
5656
"""ボードを再起動します。"""
5757

58+
@overload
59+
def scale(value: float, from_: Tuple[float, float], to: Tuple[int, int]) -> int:
60+
"""Converts a value from a range to an integer range.
61+
62+
Example: ``volume = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))``
63+
64+
For example, to convert an accelerometer X value to a speaker volume.
65+
66+
If one of the numbers in the ``to`` parameter is a floating point
67+
(i.e a decimal number like ``10.0``), this function will return a
68+
floating point number.
69+
70+
temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))
71+
72+
:param value: A number to convert.
73+
:param from_: A tuple to define the range to convert from.
74+
:param to: A tuple to define the range to convert to.
75+
:return: The ``value`` converted to the ``to`` range."""
76+
77+
@overload
5878
def scale(value: float, from_: Tuple[float, float], to: Tuple[float, float]) -> float:
59-
"""Converts a value from a range to another range.
79+
"""Converts a value from a range to a floating point range.
80+
81+
Example: ``temp_fahrenheit = scale(30, from_=(0.0, 100.0), to=(32.0, 212.0))``
6082
61-
Example: ``temp_fahrenheit = scale(30, from_=(0, 100), to=(32, 212))``
83+
For example, to convert temperature from a Celsius scale to Fahrenheit.
6284
63-
This can be useful to convert values between inputs and outputs, for example an accelerometer X value to a speaker volume.
85+
If one of the numbers in the ``to`` parameter is a floating point
86+
(i.e a decimal number like ``10.0``), this function will return a
87+
floating point number.
88+
If they are both integers (i.e ``10``), it will return an integer::
6489
65-
Negative scaling is also supported, for example ``scale(25, from_=(0, 100), to=(0, -200))`` will return ``-50``.
90+
returns_int = scale(accelerometer.get_x(), from_=(-2000, 2000), to=(0, 255))
6691
6792
:param value: A number to convert.
6893
:param from_: A tuple to define the range to convert from.
@@ -434,7 +459,7 @@ Given an image object it's possible to display it via the ``display`` API::
434459
SNAKE: Image
435460
"""「へび」イメージ。"""
436461
SCISSORS: Image
437-
"""Scissors image."""
462+
"""「はさみ」イメージ。"""
438463
ALL_CLOCKS: List[Image]
439464
"""すべての CLOCK_ イメージを順番に並べたリスト。"""
440465
ALL_ARROWS: List[Image]

lang/ja/typeshed/stdlib/microbit/accelerometer.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Example: ``x, y, z = accelerometer.get_values()``
3434
...
3535

3636
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.
37+
"""すべての軸を合成した加速度測定値を正の整数値で得ます。これは X軸、Y軸、Z軸のピタゴラス和になります。
3838
3939
Example: ``accelerometer.get_strength()``
4040
@@ -96,8 +96,8 @@ gestures can be detected using a loop with a small :func:`microbit.sleep` delay.
9696
...
9797

9898
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.
99+
"""加速度センサーの感度範囲を g (標準重力)で設定します。設定値は、ハードウェアがサポートする最も近い値、すなわち ``2````4````8`` g のいずれかに丸められます。
100100
101101
Example: ``accelerometer.set_range(8)``
102102
103-
:param value: New range for the accelerometer, an integer in ``g``."""
103+
:param value: 加速度センサーの新しい感度範囲。``g`` 単位の整数値で指定します。"""

0 commit comments

Comments
 (0)