Skip to content

Commit 00c7c3c

Browse files
Fix variance issue by using Mapping for log.add (#75)
1 parent 679bb91 commit 00c7c3c

File tree

8 files changed

+22
-14
lines changed

8 files changed

+22
-14
lines changed

examples/data-logging/local.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import log
2+
from microbit import *
3+
4+
entry = {
5+
'temperature': temperature(),
6+
'light': display.read_light_level()
7+
}
8+
log.add(entry)

lang/en/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Log data to your micro:bit V2."""
22

3-
from typing import Literal, Optional, Union, overload
3+
from typing import Literal, Mapping, Optional, Union, overload
44

55
MILLISECONDS = 1
66
"""Milliseconds timestamp format."""
@@ -42,7 +42,7 @@ def set_labels(
4242

4343
@overload
4444
def add(
45-
data_dictionary: Optional[dict[str, Union[str, int, float]]],
45+
data_dictionary: Optional[Mapping[str, Union[str, int, float]]],
4646
) -> None:
4747
"""Add a data row to the log by passing a dictionary of headers and values.
4848

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Registra datos en el micro:bit V2. (registrar)"""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""Formato de marca temporal en milisegundos. (milisegundos)"""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""Añade una fila de datos al registro pasando un diccionario de cabeceras y valores. (añadir)
3737
3838
Example: ``log.add({ 'temp': temperature() })``

lang/fr/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Journalisez des données sur votre micro:bit V2."""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""Format d'horodatage en millisecondes."""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""Ajoute une ligne de données au journal en passant un dictionnaire d'en-têtes et de valeurs.
3737
3838
Example: ``log.add({ 'temp': temperature() })``

lang/ja/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""micro:bit V2のログにデータを記録します。"""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""ミリ秒単位の日時フォーマット。"""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""ヘッダーと値の辞書を渡すことにより、ログにデータ行を追加します。
3737
3838
Example: ``log.add({ 'temp': temperature() })``

lang/ko/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""micro:bit V2에 데이터를 기록합니다."""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""밀리초 타임스탬프 형식입니다."""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""헤더 및 값의 딕셔너리를 패스해 로그에 데이터 행을 추가합니다.
3737
3838
Example: ``log.add({ 'temp': temperature() })``

lang/zh-cn/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""将数据记录到您的 micro:bit V2。 (日志)"""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""毫秒时间戳格式。 (毫秒)"""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""通过传递包含标题和值的字典将数据行添加到日志中。
3737
3838
Example: ``log.add({ 'temp': temperature() })``

lang/zh-tw/typeshed/stdlib/log.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""將資料記錄到您的 micro:bit V2。"""
2-
from typing import Literal, Optional, Union, overload
2+
from typing import Literal, Mapping, Optional, Union, overload
33
MILLISECONDS = 1
44
"""毫秒時間戳記格式。"""
55
SECONDS = 10
@@ -32,7 +32,7 @@ unit can be selected via the timestamp argument.
3232
...
3333

3434
@overload
35-
def add(data_dictionary: Optional[dict[str, Union[str, int, float]]]) -> None:
35+
def add(data_dictionary: Optional[Mapping[str, Union[str, int, float]]]) -> None:
3636
"""透過傳遞包含標頭和數值的字典,將資料列新增至紀錄中。
3737
3838
Example: ``log.add({ 'temp': temperature() })``

0 commit comments

Comments
 (0)