Module superconfig.utilities.dtypes

Expand source code
class CallableConverter(type):
    def __call__(cls, val):
        return cls.convert(val)


class ANY(metaclass=CallableConverter):
    @staticmethod
    def convert(value):
        return value


class STR(ANY):
    @staticmethod
    def convert(value):
        return str(value)


class INT(STR):
    @staticmethod
    def convert(value):
        return int(value)


class FLOAT(STR):
    @staticmethod
    def convert(value):
        return float(value)


class BOOL(STR):
    @staticmethod
    def convert(value):
        return bool(value)

Classes

class ANY (val)
Expand source code
class ANY(metaclass=CallableConverter):
    @staticmethod
    def convert(value):
        return value

Subclasses

Static methods

def convert(value)
Expand source code
@staticmethod
def convert(value):
    return value
class BOOL (val)
Expand source code
class BOOL(STR):
    @staticmethod
    def convert(value):
        return bool(value)

Ancestors

Static methods

def convert(value)
Expand source code
@staticmethod
def convert(value):
    return bool(value)
class CallableConverter (*args, **kwargs)

type(object_or_name, bases, dict) type(object) -> the object's type type(name, bases, dict) -> a new type

Expand source code
class CallableConverter(type):
    def __call__(cls, val):
        return cls.convert(val)

Ancestors

  • builtins.type
class FLOAT (val)
Expand source code
class FLOAT(STR):
    @staticmethod
    def convert(value):
        return float(value)

Ancestors

Static methods

def convert(value)
Expand source code
@staticmethod
def convert(value):
    return float(value)
class INT (val)
Expand source code
class INT(STR):
    @staticmethod
    def convert(value):
        return int(value)

Ancestors

Static methods

def convert(value)
Expand source code
@staticmethod
def convert(value):
    return int(value)
class STR (val)
Expand source code
class STR(ANY):
    @staticmethod
    def convert(value):
        return str(value)

Ancestors

Subclasses

Static methods

def convert(value)
Expand source code
@staticmethod
def convert(value):
    return str(value)