python-osc icon indicating copy to clipboard operation
python-osc copied to clipboard

SimpleUDPClient.send_message -> Type of parameter "value" is partially unknown

Open BlackDereker opened this issue 2 years ago • 0 comments

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:

  1. Change the type annotation for value to a union:

    def send_message(self, address: str, value: Union[ArgValue, List[ArgValue]]) -> None:
    
  2. 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.

BlackDereker avatar Feb 15 '24 16:02 BlackDereker