dolor.types.numeric

Types for numbers.

class Boolean[source]

Bases: dolor.types.misc.StructType

A boolean that corresponds to a single byte.

fmt = '?'
class Byte[source]

Bases: dolor.types.misc.StructType

A signed 8-bit integer.

fmt = 'b'
class UnsignedByte[source]

Bases: dolor.types.misc.StructType

An unsigned 8-bit integer.

fmt = 'B'
class Short[source]

Bases: dolor.types.misc.StructType

A signed 16-bit integer.

fmt = 'h'
class UnsignedShort[source]

Bases: dolor.types.misc.StructType

An unsigned 8-bit integer.

fmt = 'H'
class Int[source]

Bases: dolor.types.misc.StructType

A signed 32-bit integer.

fmt = 'i'
class UnsignedInt[source]

Bases: dolor.types.misc.StructType

An unsigned 32-bit integer.

fmt = 'I'
class Long[source]

Bases: dolor.types.misc.StructType

A signed 64-bit integer.

fmt = 'q'
class UnsignedLong[source]

Bases: dolor.types.misc.StructType

An unsigned 64-bit integer.

fmt = 'Q'
class Float[source]

Bases: dolor.types.misc.StructType

A 32-bit floating point value.

fmt = 'f'
class Double[source]

Bases: dolor.types.misc.StructType

A 64-bit floating point value.

fmt = 'd'
class VarNum[source]

Bases: dolor.types.type.Type

A signed, variable-length integer.

To read the value, a byte is read, where the bottom 7 bits are a portion of the value, and the top bit indicates whether to read another byte and repeat the process.

If the bytes read would exceed the number of bytes needed to get the necessary bits (as specified with the bits attribute), then a ValueError will be raised. This is done to prevent a DOS attack that sends bytes that always have the top bit set, leading to an infinite amount of bytes being read.

bits

The maximum amount of bits before a ValueError is raised.

Type

int

class VarInt[source]

Bases: dolor.types.numeric.VarNum

A signed, variable-length 32-bit integer.

class VarLong[source]

Bases: dolor.types.numeric.VarNum

A signed, variable-length 64-bit integer.

class Angle[source]

Bases: dolor.types.type.Type

Represents an angle.

The value is in radians.