Module scute.data_types

Various data types used in NBT.

Expand source code Browse git
"""
Various data types used in NBT.
"""
from typing import TypeVar, Union


class _NumberType:
    letter = None
    int = False

    def __init__(self, number):
        if self.int:
            self.number = int(number)
        else:
            self.number = number

    def __str__(self):
        return str(self.number) + self.letter

    def getNbt(self):
        return str(self.number) + self.letter


class Byte(_NumberType):
    letter = "b"
    int = True


class Long(_NumberType):
    letter = "l"
    int = True


class Short(_NumberType):
    letter = "s"
    int = True


class Float(_NumberType):
    letter = "f"


class Double(_NumberType):
    letter = "d"


_NumberTypeVar = TypeVar("_NumberTypeVar", bound=_NumberType)
_NbtValue = Union[_NumberTypeVar, int, str, float, dict]

Classes

class Byte (number)
Expand source code Browse git
class Byte(_NumberType):
    letter = "b"
    int = True

Ancestors

  • scute.data_types._NumberType

Class variables

var int
var letter
class Double (number)
Expand source code Browse git
class Double(_NumberType):
    letter = "d"

Ancestors

  • scute.data_types._NumberType

Class variables

var letter
class Float (number)
Expand source code Browse git
class Float(_NumberType):
    letter = "f"

Ancestors

  • scute.data_types._NumberType

Class variables

var letter
class Long (number)
Expand source code Browse git
class Long(_NumberType):
    letter = "l"
    int = True

Ancestors

  • scute.data_types._NumberType

Class variables

var int
var letter
class Short (number)
Expand source code Browse git
class Short(_NumberType):
    letter = "s"
    int = True

Ancestors

  • scute.data_types._NumberType

Class variables

var int
var letter