Skip to content

Commit 6dcc5ab

Browse files
Corrections
1 parent 3826bce commit 6dcc5ab

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

lang/en/typeshed/stdlib/microbit/audio.pyi

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33

44
from ..microbit import MicroBitDigitalPin, Sound, pin0
5-
from typing import ClassVar, Iterable, Optional, Union
5+
from typing import ClassVar, Iterable, Optional, Union, overload
66

77
def play(
88
source: Union[AudioFrame, Iterable[AudioFrame], Sound, SoundEffect],
@@ -262,10 +262,27 @@ class AudioTrack:
262262
:return: The configured sample rate.
263263
"""
264264

265+
def copyfrom(self, other: Union[bytearray, AudioRecording, AudioTrack]) -> None:
266+
"""Overwrite the data in this ``AudioTrack`` with the data from another
267+
``AudioTrack``, ``AudioRecording``, or buffer-like object like a
268+
``bytearray`` instance.
269+
270+
If the input buffer is smaller than the available space in this
271+
instance, the rest of the data is left untouched.
272+
If it is larger, it will stop copying once this instance is filled.
273+
274+
:param other: Buffer-like instance from which to copy the data.
275+
"""
265276

266277
def __len__(self) -> int: ...
267-
def __setitem__(self, key: int, value: int) -> None: ...
268-
def __getitem__(self, key: int) -> int: ...
278+
279+
280+
@overload
281+
def __getitem__(self, i: int) -> int: ...
282+
@overload
283+
def __getitem__(self, s: slice) -> AudioTrack: ...
284+
def __setitem__(self, i: int, x: int) -> None: ...
285+
269286
def __add__(self, v: AudioTrack) -> AudioTrack: ...
270287
def __iadd__(self, v: AudioTrack) -> AudioTrack: ...
271288
def __sub__(self, v: AudioTrack) -> AudioTrack: ...

0 commit comments

Comments
 (0)