arguments Module¶
Argument Class¶
-
class
oscpython.arguments.Argument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
objectBase class for OSC arguments
-
value: Optional[Any] = None¶ The argument value
-
index: int = -1¶ The argument index within its parent
oscpython.messages.Message
-
classmethod
get_argument_for_value(value: Any) → oscpython.arguments.Argument[source]¶ Get an
Argumentsubclass to handle the given value- Raises
ArgumentTypeError – If the given type is not supported
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
validate_value()[source]¶ Perform value checks (used by subclasses)
- Raises
ArgumentValueError – If the
valueis invalid
-
get_struct_fmt() → str[source]¶ Return the format string for
struct.pack()matching the currentvalueThis should normally be
struct_fmt, but certain types (like str) must be able to override with the appropriate length
-
pack() → oscpython.common.StructPacking[source]¶ Create a
StructPackingfor the argument
-
get_pack_value() → Optional[Tuple[Any]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
Int32Argument Class¶
-
class
oscpython.arguments.Int32Argument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument16-bit integer argument
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
validate_value()[source]¶ Perform value checks (used by subclasses)
- Raises
ArgumentValueError – If the
valueis invalid
-
classmethod
Float32Argument Class¶
-
class
oscpython.arguments.Float32Argument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument32-bit float argument
StringArgument Class¶
-
class
oscpython.arguments.StringArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentString argument
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[str]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
get_struct_fmt() → str[source]¶ Return the format string for
struct.pack()matching the currentvalueThis should normally be
struct_fmt, but certain types (like str) must be able to override with the appropriate length
-
classmethod
BlobArgument Class¶
-
class
oscpython.arguments.BlobArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentBlob (
bytes) argument-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
validate_value()[source]¶ Perform value checks (used by subclasses)
- Raises
ArgumentValueError – If the
valueis invalid
-
get_pack_value() → Optional[Tuple[int, bytes]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
get_struct_fmt() → str[source]¶ Return the format string for
struct.pack()matching the currentvalueThis should normally be
struct_fmt, but certain types (like str) must be able to override with the appropriate length
-
classmethod
Int64Argument Class¶
-
class
oscpython.arguments.Int64Argument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Int32Argument64-bit integer argument
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
validate_value()[source]¶ Perform value checks (used by subclasses)
- Raises
ArgumentValueError – If the
valueis invalid
-
classmethod
TimeTagArgument Class¶
-
class
oscpython.arguments.TimeTagArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentTimeTag argument (see
TimeTag)-
py_type¶ alias of
oscpython.common.TimeTag
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[int]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
Float64Argument Class¶
-
class
oscpython.arguments.Float64Argument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Float32Argument64-bit float argument
CharArgument Class¶
-
class
oscpython.arguments.CharArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentChar argument (a single ascii character)
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[bytes]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
validate_value()[source]¶ Perform value checks (used by subclasses)
- Raises
ArgumentValueError – If the
valueis invalid
-
classmethod
RGBArgument Class¶
-
class
oscpython.arguments.RGBArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentRGBA color argument (see
ColorRGBA)-
py_type¶ alias of
oscpython.common.ColorRGBA
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[int]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
MidiArgument Class¶
-
class
oscpython.arguments.MidiArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentA 4-byte MIDI message
-
py_type¶ alias of
oscpython.common.MidiMessage
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[int]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
TrueArgument Class¶
FalseArgument Class¶
NilArgument Class¶
-
class
oscpython.arguments.NilArgument(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.ArgumentNil (
None) argument-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[Any]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
classmethod
InfinitumArgument Class¶
-
class
oscpython.arguments.InfinitumArgument(value: Optional[Any] = <factory>, index: int = -1)[source]¶ Bases:
oscpython.arguments.ArgumentInfinitum argument (see
Infinitum)-
py_type¶ alias of
oscpython.common.Infinitum
-
classmethod
works_for_value(value: Any) → bool[source]¶ Return
Trueif the class is able to handle the given value and its type
-
get_pack_value() → Optional[Tuple[Any]][source]¶ Get the value(s) to be packed using
struct.pack()Returns
Noneif no value is associated with the argument, otherwise a tuple (even if there is only one item)
-
Exceptions¶
-
class
oscpython.arguments.ArgumentError(value: Any, msg: Optional[str] = None)[source]¶ Bases:
Exception