arguments
Module¶
Argument Class¶
-
class
oscpython.arguments.
Argument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
object
Base 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
Argument
subclass to handle the given value- Raises
ArgumentTypeError – If the given type is not supported
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
value
is invalid
-
get_struct_fmt
() → str[source]¶ Return the format string for
struct.pack()
matching the currentvalue
This 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
StructPacking
for the argument
-
get_pack_value
() → Optional[Tuple[Any]][source]¶ Get the value(s) to be packed using
struct.pack()
Returns
None
if 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.Argument
16-bit integer argument
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
value
is invalid
-
classmethod
Float32Argument Class¶
-
class
oscpython.arguments.
Float32Argument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument
32-bit float argument
StringArgument Class¶
-
class
oscpython.arguments.
StringArgument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument
String argument
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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 currentvalue
This 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.Argument
Blob (
bytes
) argument-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
value
is invalid
-
get_pack_value
() → Optional[Tuple[int, bytes]][source]¶ Get the value(s) to be packed using
struct.pack()
Returns
None
if 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 currentvalue
This 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.Int32Argument
64-bit integer argument
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
value
is invalid
-
classmethod
TimeTagArgument Class¶
-
class
oscpython.arguments.
TimeTagArgument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument
TimeTag argument (see
TimeTag
)-
py_type
¶ alias of
oscpython.common.TimeTag
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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.Float32Argument
64-bit float argument
CharArgument Class¶
-
class
oscpython.arguments.
CharArgument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument
Char argument (a single ascii character)
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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
value
is invalid
-
classmethod
RGBArgument Class¶
-
class
oscpython.arguments.
RGBArgument
(value: Optional[Any] = None, index: int = - 1)[source]¶ Bases:
oscpython.arguments.Argument
RGBA color argument (see
ColorRGBA
)-
py_type
¶ alias of
oscpython.common.ColorRGBA
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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.Argument
A 4-byte MIDI message
-
py_type
¶ alias of
oscpython.common.MidiMessage
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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.Argument
Nil (
None
) argument-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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.Argument
Infinitum argument (see
Infinitum
)-
py_type
¶ alias of
oscpython.common.Infinitum
-
classmethod
works_for_value
(value: Any) → bool[source]¶ Return
True
if 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
None
if 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