How to use the srsly.ruamel_yaml.constructor.Constructor function in srsly

To help you get started, we’ve selected a few srsly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
def set_python_instance_state(self, instance, state):
        raise ValueError("Unsafe constructor not implemented in this library")

    def construct_python_object(self, suffix, node):
        raise ValueError("Unsafe constructor not implemented in this library")

    def construct_python_object_apply(self, suffix, node, newobj=False):
        raise ValueError("Unsafe constructor not implemented in this library")

    def construct_python_object_new(self, suffix, node):
        raise ValueError("Unsafe constructor not implemented in this library")


Constructor.add_constructor(
    u"tag:yaml.org,2002:python/none", Constructor.construct_yaml_null
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/bool", Constructor.construct_yaml_bool
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/str", Constructor.construct_python_str
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/unicode", Constructor.construct_python_unicode
)

if PY3:
    Constructor.add_constructor(
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
Constructor.add_constructor(
    u"tag:yaml.org,2002:python/str", Constructor.construct_python_str
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/unicode", Constructor.construct_python_unicode
)

if PY3:
    Constructor.add_constructor(
        u"tag:yaml.org,2002:python/bytes", Constructor.construct_python_bytes
    )

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/int", Constructor.construct_yaml_int
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/long", Constructor.construct_python_long
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/tuple", Constructor.construct_python_tuple
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/dict", Constructor.construct_yaml_map
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/name:", Constructor.construct_python_name
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/module:", Constructor.construct_python_module
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object:", Constructor.construct_python_object
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object/apply:", Constructor.construct_python_object_apply
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
u"tag:yaml.org,2002:python/dict", Constructor.construct_yaml_map
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/name:", Constructor.construct_python_name
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/module:", Constructor.construct_python_module
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object:", Constructor.construct_python_object
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object/apply:", Constructor.construct_python_object_apply
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object/new:", Constructor.construct_python_object_new
)


class RoundTripConstructor(SafeConstructor):
    """need to store the comments on the node itself,
    as well as on the items
    """

    def construct_scalar(self, node):
        # type: (Any) -> Any
        if not isinstance(node, ScalarNode):
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
if PY3:
    Constructor.add_constructor(
        u"tag:yaml.org,2002:python/bytes", Constructor.construct_python_bytes
    )

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/int", Constructor.construct_yaml_int
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/long", Constructor.construct_python_long
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/tuple", Constructor.construct_python_tuple
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/dict", Constructor.construct_yaml_map
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/name:", Constructor.construct_python_name
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/module:", Constructor.construct_python_module
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object:", Constructor.construct_python_object
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object/apply:", Constructor.construct_python_object_apply
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object/new:", Constructor.construct_python_object_new
)


class RoundTripConstructor(SafeConstructor):
    """need to store the comments on the node itself,
    as well as on the items
    """

    def construct_scalar(self, node):
        # type: (Any) -> Any
        if not isinstance(node, ScalarNode):
            raise ConstructorError(
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/tuple", Constructor.construct_python_tuple
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/dict", Constructor.construct_yaml_map
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/name:", Constructor.construct_python_name
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/module:", Constructor.construct_python_module
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/object:", Constructor.construct_python_object
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
Constructor.add_constructor(
    u"tag:yaml.org,2002:python/unicode", Constructor.construct_python_unicode
)

if PY3:
    Constructor.add_constructor(
        u"tag:yaml.org,2002:python/bytes", Constructor.construct_python_bytes
    )

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/int", Constructor.construct_yaml_int
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/long", Constructor.construct_python_long
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/tuple", Constructor.construct_python_tuple
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
Constructor.add_constructor(
    u"tag:yaml.org,2002:python/bool", Constructor.construct_yaml_bool
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/str", Constructor.construct_python_str
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/unicode", Constructor.construct_python_unicode
)

if PY3:
    Constructor.add_constructor(
        u"tag:yaml.org,2002:python/bytes", Constructor.construct_python_bytes
    )

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/int", Constructor.construct_yaml_int
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/long", Constructor.construct_python_long
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
github explosion / srsly / srsly / ruamel_yaml / constructor.py View on Github external
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/long", Constructor.construct_python_long
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/float", Constructor.construct_yaml_float
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/complex", Constructor.construct_python_complex
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/list", Constructor.construct_yaml_seq
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/tuple", Constructor.construct_python_tuple
)

Constructor.add_constructor(
    u"tag:yaml.org,2002:python/dict", Constructor.construct_yaml_map
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/name:", Constructor.construct_python_name
)

Constructor.add_multi_constructor(
    u"tag:yaml.org,2002:python/module:", Constructor.construct_python_module