vmcp.osc.typing
typing
module of osc
package.
1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# SPDX-License-Identifier: AGPL-3.0-or-later 4 5"""``typing`` module of ``osc`` package.""" 6 7from dataclasses import dataclass 8from typing import ( 9 TypeVar, 10 Any 11) 12from abc import ( 13 ABCMeta, 14 abstractmethod 15) 16 17 18@dataclass(frozen=True, slots=True) 19class ArgumentsScheme: 20 """Arguments scheme.""" 21 22 scheme: tuple[str, ...] 23 """tuple[str, ...]: Scheme.""" 24 25 def __add__( 26 self, 27 other: 'ArgumentsScheme' 28 ) -> 'ArgumentsScheme': 29 """Combine with another arguments scheme and return it. 30 31 Args: 32 other (ArgumentsScheme): 33 Another arguments scheme. 34 35 Returns: 36 ArgumentsScheme: 37 Combined arguments scheme. 38 39 """ 40 return ArgumentsScheme(self.scheme + other.scheme) 41 42 43TimeTagClass = TypeVar( 44 "TimeTagClass", 45 bound="TimeTagType" 46) 47 48 49class TimeTagType(metaclass=ABCMeta): # pylint: disable=too-few-public-methods 50 """Time tag interface.""" 51 52 @classmethod 53 @abstractmethod 54 def from_unixtime( 55 cls: type[TimeTagClass], 56 time: float 57 ) -> TimeTagClass: 58 """Create ``TimeTag`` from UNIX epoch time. 59 60 Args: 61 time (float): UNIX epoch time (seconds since 1/1/1970). 62 63 Returns: 64 TimeTag: Seconds since 1/1/1900 (based on NTP timestamps). 65 66 """ 67 68 69@dataclass(frozen=True, slots=True) 70class Message: 71 """Message.""" 72 73 address: str 74 """str: OSC address pattern (beginng with '/').""" 75 76 typetags: str 77 """str: OSC type tag string (beginning with ',').""" 78 79 arguments: Any 80 """Any: OSC arguments."""
@dataclass(frozen=True, slots=True)
class
ArgumentsScheme:
19@dataclass(frozen=True, slots=True) 20class ArgumentsScheme: 21 """Arguments scheme.""" 22 23 scheme: tuple[str, ...] 24 """tuple[str, ...]: Scheme.""" 25 26 def __add__( 27 self, 28 other: 'ArgumentsScheme' 29 ) -> 'ArgumentsScheme': 30 """Combine with another arguments scheme and return it. 31 32 Args: 33 other (ArgumentsScheme): 34 Another arguments scheme. 35 36 Returns: 37 ArgumentsScheme: 38 Combined arguments scheme. 39 40 """ 41 return ArgumentsScheme(self.scheme + other.scheme)
Arguments scheme.
class
TimeTagType:
50class TimeTagType(metaclass=ABCMeta): # pylint: disable=too-few-public-methods 51 """Time tag interface.""" 52 53 @classmethod 54 @abstractmethod 55 def from_unixtime( 56 cls: type[TimeTagClass], 57 time: float 58 ) -> TimeTagClass: 59 """Create ``TimeTag`` from UNIX epoch time. 60 61 Args: 62 time (float): UNIX epoch time (seconds since 1/1/1970). 63 64 Returns: 65 TimeTag: Seconds since 1/1/1900 (based on NTP timestamps). 66 67 """
Time tag interface.
@classmethod
@abstractmethod
def
from_unixtime(cls: type[~TimeTagClass], time: float) -> ~TimeTagClass:
53 @classmethod 54 @abstractmethod 55 def from_unixtime( 56 cls: type[TimeTagClass], 57 time: float 58 ) -> TimeTagClass: 59 """Create ``TimeTag`` from UNIX epoch time. 60 61 Args: 62 time (float): UNIX epoch time (seconds since 1/1/1970). 63 64 Returns: 65 TimeTag: Seconds since 1/1/1900 (based on NTP timestamps). 66 67 """
Create TimeTag
from UNIX epoch time.
Args: time (float): UNIX epoch time (seconds since 1/1/1970).
Returns: TimeTag: Seconds since 1/1/1900 (based on NTP timestamps).
@dataclass(frozen=True, slots=True)
class
Message:
70@dataclass(frozen=True, slots=True) 71class Message: 72 """Message.""" 73 74 address: str 75 """str: OSC address pattern (beginng with '/').""" 76 77 typetags: str 78 """str: OSC type tag string (beginning with ',').""" 79 80 arguments: Any 81 """Any: OSC arguments."""
Message.