Files
termidi/typings/mido/tokenizer.pyi
T
NCBM 9009a7c5bc Add type stubs for mido MIDI library
- Created type stubs for various modules in the mido library including messages, midifiles, parser, ports, sockets, syx, tokenizer, and version.
- Implemented type hints for functions and classes to improve type checking and code clarity.
- Added support for MIDI over TCP/IP in sockets module.
- Included methods for reading and writing SYX files in syx module.
- Enhanced the parser functionality with a dedicated Parser class for MIDI byte streams.
- Established a structure for MIDI file handling with MidiFile and MidiTrack classes.
2026-04-26 00:51:40 +08:00

27 lines
735 B
Python

from collections.abc import Generator, Iterable
from numbers import Integral
from typing import Any
class Tokenizer:
"""
Splits a MIDI byte stream into messages.
"""
def __init__(self, data: Iterable[int] | None = ...) -> None:
"""Create a new decoder."""
def feed_byte(self, byte: int | Integral) -> None:
"""Feed MIDI byte to the decoder.
Takes an int in range [0..255].
"""
def feed(self, data: Iterable[int]) -> None:
"""Feed MIDI bytes to the decoder.
Takes an iterable of ints in in range [0..255].
"""
def __len__(self) -> int: ...
def __iter__(self) -> Generator[Any, Any]:
"""Yield messages that have been parsed so far."""