@@ -132,13 +132,10 @@ def register_message_type(cls) -> None:
132132 ### These must be inserted with more specific masks first
133133 insert_idx = len (MIDIMessage ._statusandmask_to_class )
134134 for idx , m_type in enumerate (MIDIMessage ._statusandmask_to_class ):
135- assert cls ._STATUSMASK is not None
136135 if cls ._STATUSMASK > m_type [0 ][1 ]:
137136 insert_idx = idx
138137 break
139138
140- assert cls ._STATUS is not None
141- assert cls ._STATUSMASK is not None
142139 MIDIMessage ._statusandmask_to_class .insert (
143140 insert_idx , ((cls ._STATUS , cls ._STATUSMASK ), cls )
144141 )
@@ -147,8 +144,8 @@ def register_message_type(cls) -> None:
147144 @classmethod
148145 def _search_eom_status (
149146 cls ,
150- buf : Dict [ int , bool ] ,
151- eom_status : bool ,
147+ buf : bytearray ,
148+ eom_status : Optional [ int ] ,
152149 msgstartidx : int ,
153150 msgendidxplusone : int ,
154151 endidx : int ,
@@ -177,15 +174,14 @@ def _search_eom_status(
177174 @classmethod
178175 def _match_message_status (
179176 cls , buf : bytearray , msgstartidx : int , msgendidxplusone : int , endidx : int
180- ) -> Tuple [Optional [Any ], bool , bool , bool , bool , int ]:
177+ ) -> Tuple [Optional [Any ], int , bool , bool , bool , int ]:
181178 msgclass = None
182179 status = buf [msgstartidx ]
183180 known_msg = False
184181 complete_msg = False
185182 bad_termination = False
186183
187184 # Rummage through our list looking for a status match
188- assert msgclass is not None
189185 for status_mask , msgclass in MIDIMessage ._statusandmask_to_class :
190186 masked_status = status & status_mask [1 ]
191187 if status_mask [0 ] == masked_status :
@@ -265,7 +261,6 @@ def from_message_bytes(
265261 channel_match_orna = True
266262 if complete_message and not bad_termination :
267263 try :
268- assert msgclass is not None
269264 msg = msgclass .from_bytes (midibytes [msgstartidx :msgendidxplusone ])
270265 if msg .channel is not None :
271266 channel_match_orna = channel_filter (msg .channel , channel_in )
@@ -299,7 +294,6 @@ def from_message_bytes(
299294 def __bytes__ (self ) -> bytes :
300295 """Return the ``bytes`` wire protocol representation of the object
301296 with channel number applied where appropriate."""
302- assert self ._STATUS is not None
303297 return bytes ([self ._STATUS ])
304298
305299 # databytes value present to keep interface uniform but unused
@@ -312,7 +306,7 @@ def from_bytes(cls, msg_bytes: bytes) -> "MIDIMessage":
312306 representation of the MIDI message."""
313307 return cls ()
314308
315- def __str__ (self ):
309+ def __str__ (self ) -> str :
316310 """Print an instance"""
317311 cls = self .__class__
318312 if slots := getattr (cls , "_message_slots" , None ):
0 commit comments