diff --git a/src/micropython/main/typeshed.en.json b/src/micropython/main/typeshed.en.json index bc1ca4af5..83ba08b01 100644 --- a/src/micropython/main/typeshed.en.json +++ b/src/micropython/main/typeshed.en.json @@ -43,7 +43,7 @@ "/typeshed/stdlib/microbit/i2c.pyi": "\"\"\"Communicate with devices using the I\u00b2C bus protocol.\n\"\"\"\n\nfrom _typeshed import ReadableBuffer\nfrom ..microbit import MicroBitDigitalPin, pin19, pin20\nfrom typing import List\n\ndef init(\n freq: int = 100000, sda: MicroBitDigitalPin = pin20, scl: MicroBitDigitalPin = pin19\n) -> None:\n \"\"\"Re-initialize a peripheral.\n\n Example: ``i2c.init()``\n\n :param freq: clock frequency\n :param sda: ``sda`` pin (default 20)\n :param scl: ``scl`` pin (default 19)\n\n On a micro:bit V1 board, changing the I\u00b2C pins from defaults will make\n the accelerometer and compass stop working, as they are connected\n internally to those pins. This warning does not apply to the **V2**\n revision of the micro:bit as this has `separate I\u00b2C lines `_\n for the motion sensors and the edge connector.\n \"\"\"\n ...\n\ndef scan() -> List[int]:\n \"\"\"Scan the bus for devices.\n\n Example: ``i2c.scan()``\n\n :return: A list of 7-bit addresses corresponding to those devices that responded to the scan.\n \"\"\"\n ...\n\ndef read(addr: int, n: int, repeat: bool = False) -> bytes:\n \"\"\"Read bytes from a device.\n\n Example: ``i2c.read(0x50, 64)``\n\n :param addr: The 7-bit address of the device\n :param n: The number of bytes to read\n :param repeat: If ``True``, no stop bit will be sent\n :return: The bytes read\n \"\"\"\n ...\n\ndef write(addr: int, buf: ReadableBuffer, repeat: bool = False) -> None:\n \"\"\"Write bytes to a device.\n\n Example: ``i2c.write(0x50, bytes([1, 2, 3]))``\n\n :param addr: The 7-bit address of the device\n :param buf: A buffer containing the bytes to write\n :param repeat: If ``True``, no stop bit will be sent\n \"\"\"\n ...\n", "/typeshed/stdlib/microbit/microphone.pyi": "\"\"\"Respond to sound using the built-in microphone (V2 only).\n\"\"\"\n\nfrom typing import Optional, Tuple\nfrom ..microbit import SoundEvent\n\ndef current_event() -> Optional[SoundEvent]:\n \"\"\"Get the last recorded sound event\n\n Example: ``microphone.current_event()``\n\n :return: The event, ``SoundEvent('loud')`` or ``SoundEvent('quiet')``.\n \"\"\"\n ...\n\ndef was_event(event: SoundEvent) -> bool:\n \"\"\"Check if a sound was heard at least once since the last call.\n\n Example: ``microphone.was_event(SoundEvent.LOUD)``\n\n This call clears the sound history before returning.\n\n :param event: The event to check for, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``\n :return: ``True`` if sound was heard at least once since the last call, otherwise ``False``.\n \"\"\"\n ...\n\ndef is_event(event: SoundEvent) -> bool:\n \"\"\"Check the most recent sound event detected.\n\n Example: ``microphone.is_event(SoundEvent.LOUD)``\n\n This call does not clear the sound event history.\n\n :param event: The event to check for, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``\n :return: ``True`` if sound was the most recent heard, ``False`` otherwise.\n \"\"\"\n ...\n\ndef get_events() -> Tuple[SoundEvent, ...]:\n \"\"\"Get the sound event history as a tuple.\n\n Example: ``microphone.get_events()``\n\n This call clears the sound history before returning.\n\n :return: A tuple of the event history with the most recent event last.\n \"\"\"\n ...\n\ndef set_threshold(event: SoundEvent, value: int) -> None:\n \"\"\"Set the threshold for a sound event.\n\n Example: ``microphone.set_threshold(SoundEvent.LOUD, 250)``\n\n A high threshold means the event will only trigger if the sound is very loud (>= 250 in the example).\n\n :param event: A sound event, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``.\n :param value: The threshold level in the range 0-255.\n \"\"\"\n ...\n\ndef sound_level() -> int:\n \"\"\"Get the sound pressure level.\n\n Example: ``microphone.sound_level()``\n\n :return: A representation of the sound pressure level in the range 0 to 255.\n \"\"\"\n ...\n", "/typeshed/stdlib/microbit/speaker.pyi": "\"\"\"Control the built-in speaker (V2 only).\n\"\"\"\n\ndef off() -> None:\n \"\"\"Turn the speaker off.\n\n Example: ``speaker.off()``\n\n This does not disable sound output to an edge connector pin.\n \"\"\"\n ...\n\ndef on() -> None:\n \"\"\"Turn the speaker on.\n\n Example: ``speaker.on()``\n \"\"\"\n ...\n", - "/typeshed/stdlib/microbit/spi.pyi": "\"\"\"Communicate with devices using the serial peripheral interface (SPI) bus.\n\"\"\"\n\nfrom _typeshed import ReadableBuffer, WriteableBuffer\nfrom ..microbit import pin13, pin14, pin15, MicroBitDigitalPin\n\ndef init(\n baudrate: int = 1000000,\n bits: int = 8,\n mode: int = 0,\n sclk: MicroBitDigitalPin = pin13,\n mosi: MicroBitDigitalPin = pin15,\n miso: MicroBitDigitalPin = pin14,\n) -> None:\n \"\"\"Initialize SPI communication.\n\n Example: ``spi.init()``\n\n For correct communication, the parameters have to be the same on both communicating devices.\n\n :param baudrate: The speed of communication.\n :param bits: The width in bits of each transfer. Currently only ``bits=8`` is supported. However, this may change in the future.\n :param mode: Determines the combination of clock polarity and phase - `see online table `_.\n :param sclk: sclk pin (default 13)\n :param mosi: mosi pin (default 15)\n :param miso: miso pin (default 14)\n \"\"\"\n ...\n\ndef read(nbytes: int) -> bytes:\n \"\"\"Read bytes.\n\n Example: ``spi.read(64)``\n\n :param nbytes: Maximum number of bytes to read.\n :return: The bytes read.\n \"\"\"\n ...\n\ndef write(buffer: ReadableBuffer) -> None:\n \"\"\"Write bytes to the bus.\n\n Example: ``spi.write(bytes([1, 2, 3]))``\n\n :param buffer: A buffer to read data from.\n \"\"\"\n ...\n\ndef write_readinto(out: WriteableBuffer, in_: ReadableBuffer) -> None:\n \"\"\"Write the ``out`` buffer to the bus and read any response into the ``in_`` buffer.\n\n Example: ``spi.write_readinto(out_buffer, in_buffer)``\n\n The length of the buffers should be the same. The buffers can be the same object.\n\n :param out: The buffer to write any response to.\n :param in_: The buffer to read data from.\n \"\"\"\n ...\n", + "/typeshed/stdlib/microbit/spi.pyi": "\"\"\"Communicate with devices using the serial peripheral interface (SPI) bus.\n\"\"\"\n\nfrom _typeshed import ReadableBuffer, WriteableBuffer\nfrom ..microbit import pin13, pin14, pin15, MicroBitDigitalPin\n\ndef init(\n baudrate: int = 1000000,\n bits: int = 8,\n mode: int = 0,\n sclk: MicroBitDigitalPin = pin13,\n mosi: MicroBitDigitalPin = pin15,\n miso: MicroBitDigitalPin = pin14,\n) -> None:\n \"\"\"Initialize SPI communication.\n\n Example: ``spi.init()``\n\n For correct communication, the parameters have to be the same on both communicating devices.\n\n :param baudrate: The speed of communication.\n :param bits: The width in bits of each transfer. Currently only ``bits=8`` is supported. However, this may change in the future.\n :param mode: Determines the combination of clock polarity and phase - `see online table `_.\n :param sclk: sclk pin (default 13)\n :param mosi: mosi pin (default 15)\n :param miso: miso pin (default 14)\n \"\"\"\n ...\n\ndef read(nbytes: int, out: int = 0) -> bytes:\n \"\"\"Read at most ``nbytes`` while continuously writing the single byte given by ``out``.\n\n Example: ``spi.read(64)``\n\n :param nbytes: Maximum number of bytes to read.\n :param out: The byte value to write (default 0).\n :return: The bytes read.\n \"\"\"\n ...\n\ndef write(buffer: ReadableBuffer) -> None:\n \"\"\"Write bytes to the bus.\n\n Example: ``spi.write(bytes([1, 2, 3]))``\n\n :param buffer: A buffer to read data from.\n \"\"\"\n ...\n\ndef write_readinto(out: WriteableBuffer, in_: ReadableBuffer) -> None:\n \"\"\"Write the ``out`` buffer to the bus and read any response into the ``in_`` buffer.\n\n Example: ``spi.write_readinto(out_buffer, in_buffer)``\n\n The length of the buffers should be the same. The buffers can be the same object.\n\n :param out: The buffer to write any response to.\n :param in_: The buffer to read data from.\n \"\"\"\n ...\n", "/typeshed/stdlib/microbit/uart.pyi": "\"\"\"Communicate with a device using a serial interface.\n\"\"\"\n\nfrom _typeshed import WriteableBuffer\nfrom ..microbit import MicroBitDigitalPin\nfrom typing import Optional, Union\n\nODD: int\n\"\"\"Odd parity\"\"\"\n\nEVEN: int\n\"\"\"Even parity\"\"\"\n\ndef init(\n baudrate: int = 9600,\n bits: int = 8,\n parity: Optional[int] = None,\n stop: int = 1,\n tx: Optional[MicroBitDigitalPin] = None,\n rx: Optional[MicroBitDigitalPin] = None,\n) -> None:\n \"\"\"Initialize serial communication.\n\n Example: ``uart.init(115200, tx=pin0, rx=pin1)``\n\n :param baudrate: The speed of communication.\n :param bits: The size of bytes being transmitted. micro:bit only supports 8.\n :param parity: How parity is checked, ``None``, ``uart.ODD`` or ``uart.EVEN``.\n :param stop: The number of stop bits, has to be 1 for micro:bit.\n :param tx: Transmitting pin.\n :param rx: Receiving pin.\n\n Initializing the UART on external pins will cause the Python console on\n USB to become unaccessible, as it uses the same hardware. To bring the\n console back you must reinitialize the UART without passing anything for\n ``tx`` or ``rx`` (or passing ``None`` to these arguments). This means\n that calling ``uart.init(115200)`` is enough to restore the Python console.\n\n For more details see `the online documentation `_.\n \"\"\"\n ...\n\ndef any() -> bool:\n \"\"\"Check if any data is waiting.\n\n Example: ``uart.any()``\n\n :return: ``True`` if any data is waiting, else ``False``.\n \"\"\"\n ...\n\ndef read(nbytes: Optional[int] = None) -> Optional[bytes]:\n \"\"\"Read bytes.\n\n Example: ``uart.read()``\n\n :param nbytes: If ``nbytes`` is specified then read at most that many bytes, otherwise read as many bytes as possible\n :return: A bytes object or ``None`` on timeout\n \"\"\"\n ...\n\ndef readinto(buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[int]:\n \"\"\"Read bytes into the ``buf``.\n\n Example: ``uart.readinto(input_buffer)``\n\n :param buf: The buffer to write to.\n :param nbytes: If ``nbytes`` is specified then read at most that many bytes, otherwise read ``len(buf)`` bytes.\n :return: number of bytes read and stored into ``buf`` or ``None`` on timeout.\n \"\"\"\n ...\n\ndef readline() -> Optional[bytes]:\n \"\"\"Read a line, ending in a newline character.\n\n Example: ``uart.readline()``\n\n :return: The line read or ``None`` on timeout. The newline character is included in the returned bytes.\n \"\"\"\n ...\n\ndef write(buf: Union[bytes, str]) -> Optional[int]:\n \"\"\"Write a buffer to the bus.\n\n Example: ``uart.write('hello world')``\n\n :param buf: A bytes object or a string.\n :return: The number of bytes written, or ``None`` on timeout.\n\n Examples::\n\n uart.write('hello world')\n uart.write(b'hello world')\n uart.write(bytes([1, 2, 3]))\n \"\"\"\n ...\n", "/typeshed/stdlib/collections/__init__.pyi": "import sys\nfrom typing import (\n Any,\n Dict,\n Generic,\n ItemsView,\n Iterable,\n Iterator,\n KeysView,\n Optional,\n Reversible,\n Tuple,\n Type,\n TypeVar,\n Union,\n ValuesView,\n)\n\n_S = TypeVar(\"_S\")\n_T = TypeVar(\"_T\")\n_KT = TypeVar(\"_KT\")\n_VT = TypeVar(\"_VT\")\n\nif sys.version_info >= (3, 7):\n def namedtuple(\n typename: str,\n field_names: Union[str, Iterable[str]],\n *,\n rename: bool = ...,\n module: Optional[str] = ...,\n defaults: Optional[Iterable[Any]] = ...,\n ) -> Type[Tuple[Any, ...]]: ...\n\nelse:\n def namedtuple(\n typename: str,\n field_names: Union[str, Iterable[str]],\n *,\n verbose: bool = ...,\n rename: bool = ...,\n module: Optional[str] = ...,\n ) -> Type[Tuple[Any, ...]]: ...\n\nclass _OrderedDictKeysView(KeysView[_KT], Reversible[_KT]):\n def __reversed__(self) -> Iterator[_KT]: ...\n\nclass _OrderedDictItemsView(ItemsView[_KT, _VT], Reversible[Tuple[_KT, _VT]]):\n def __reversed__(self) -> Iterator[Tuple[_KT, _VT]]: ...\n\nclass _OrderedDictValuesView(ValuesView[_VT], Reversible[_VT]):\n def __reversed__(self) -> Iterator[_VT]: ...\n\nclass OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):\n def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...\n def move_to_end(self, key: _KT, last: bool = ...) -> None: ...\n def copy(self: _S) -> _S: ...\n def __reversed__(self) -> Iterator[_KT]: ...\n def keys(self) -> _OrderedDictKeysView[_KT]: ...\n def items(self) -> _OrderedDictItemsView[_KT, _VT]: ...\n def values(self) -> _OrderedDictValuesView[_VT]: ...\n", "/src/pyrightconfig.json": "{ \n \"pythonVersion\": \"3.6\",\n \"pythonPlatform\": \"Linux\",\n \"typeCheckingMode\": \"basic\",\n \"typeshedPath\": \"/typeshed/\",\n \"reportMissingModuleSource\": false,\n \"reportWildcardImportFromLibrary\": false,\n \"verboseOutput\": true\n }\n"