Type Interfaces
vuer.types#
Here are the basic types for events, html and three.js elements, and others.
- vuer.types.namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)#
Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22)
- class vuer.types.NamedTuple#
Bases:
objectTyped version of namedtuple.
Usage in Python versions >= 3.6:
class Employee(NamedTuple): name: str id: int
This is equivalent to:
Employee = collections.namedtuple('Employee', ['name', 'id'])
The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:
Employee = NamedTuple('Employee', name=str, id=int)
In Python versions <= 3.5 use:
Employee = NamedTuple('Employee', [('name', str), ('id', int)])
- static __new__(cls, typename, fields=None, /, **kwargs)#
- class vuer.types.UUID#
Bases:
objectInstances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. Converting a UUID to a string with str() yields something in the form ‘12345678-1234-1234-1234-123456789abc’. The UUID constructor accepts five possible forms: a similar string of hexadecimal digits, or a tuple of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively) as an argument named ‘fields’, or a string of 16 bytes (with all the integer fields in big-endian order) as an argument named ‘bytes’, or a string of 16 bytes (with the first three fields in little-endian order) as an argument named ‘bytes_le’, or a single 128-bit integer as an argument named ‘int’.
UUIDs have these read-only attributes:
- bytes the UUID as a 16-byte string (containing the six
integer fields in big-endian byte order)
- bytes_le the UUID as a 16-byte string (with time_low, time_mid,
and time_hi_version in little-endian byte order)
- fields a tuple of the six integer fields of the UUID,
which are also available as six individual attributes and two derived attributes:
time_low the first 32 bits of the UUID time_mid the next 16 bits of the UUID time_hi_version the next 16 bits of the UUID clock_seq_hi_variant the next 8 bits of the UUID clock_seq_low the next 8 bits of the UUID node the last 48 bits of the UUID
time the 60-bit timestamp clock_seq the 14-bit sequence number
hex the UUID as a 32-character hexadecimal string
int the UUID as a 128-bit integer
urn the UUID as a URN as specified in RFC 4122
- variant the UUID variant (one of the constants RESERVED_NCS,
RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
- version the UUID version number (1 through 5, meaningful only
when the variant is RFC_4122)
- is_safe An enum indicating whether the UUID has been generated in
a way that is safe for multiprocessing applications, via uuid_generate_time_safe(3).
- property bytes#
- property bytes_le#
- property fields#
- property time_low#
- property time_mid#
- property time_hi_version#
- property clock_seq_hi_variant#
- property clock_seq_low#
- property time#
- property clock_seq#
- property node#
- property hex#
- property urn#
- property variant#
- property version#
- int#
- is_safe#
- class vuer.types.Event#
Bases:
objectAn event is a message sent from the server to the client.
- class vuer.types.ServerEvent#
Bases:
Event- serialize()#
Serialize the event to a dictionary for sending over the websocket. :return: A dictionary representing the event.
- class vuer.types.Vector3#
Bases:
tupleVector3(x, y, z)
- static __new__(_cls, x, y, z)#
Create new instance of Vector3(x, y, z)
- x#
Alias for field number 0
- y#
Alias for field number 1
- z#
Alias for field number 2
- class vuer.types.Euler#
Bases:
tupleEuler(x, y, z, order)
- x: int#
Alias for field number 0
- y: int#
Alias for field number 1
- z: int#
Alias for field number 2
- order: str#
Alias for field number 3
- static __new__(_cls, x: int, y: int, z: int, order: str = 'XYZ')#
Create new instance of Euler(x, y, z, order)
- Parameters:
x (int) –
y (int) –
z (int) –
order (str) –
- class vuer.types.Body#
Bases:
tupleBody(position, rotation, scale)
- scale: float#
Alias for field number 2
- class vuer.types.RenderNode#
Bases:
object