Skip to content

Commit e80d893

Browse files
Fix variance issue by using Mapping for log.add.
Tests will fail due to translations. I'll have a think about how best to deal with this.
1 parent 4bc7096 commit e80d893

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
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

0 commit comments

Comments
 (0)