The send_message method within the SimpleUDPClient class currently expects a value parameter of type ArgValue. However, the internal logic handles it as both a single argument and a list of arguments, leading to potential confusion and inconsistencies.
Proposed Improvement:
-
Change the type annotation for value to a union:
def send_message(self, address: str, value: Union[ArgValue, List[ArgValue]]) -> None:
-
Simplify the ArgValue:
ArgValue = Union[str, bytes, bool, int, float, osc_types.MidiPacket]
Additional Notes:
- This change would enhance code clarity and maintainability by explicitly expressing the intended usage of the
value parameter.
- It would also ensure consistent behavior, regardless of whether a single argument or a list of arguments is provided.