当前位置: 首页>>代码示例>>Python>>正文


Python constructor.SafeConstructor类代码示例

本文整理汇总了Python中yaml.constructor.SafeConstructor的典型用法代码示例。如果您正苦于以下问题:Python SafeConstructor类的具体用法?Python SafeConstructor怎么用?Python SafeConstructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SafeConstructor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, stream):
     Reader.__init__(self, stream)
     Scanner.__init__(self)
     Parser.__init__(self)
     Composer.__init__(self)
     SafeConstructor.__init__(self)
     Resolver.__init__(self)
开发者ID:iModels,项目名称:simgen,代码行数:7,代码来源:marked_yaml.py

示例2: __init__

    def __init__(self, stream):
        Reader.__init__(self, stream)
        Scanner12.__init__(self)
        Parser.__init__(self)
        Composer.__init__(self)

# PKM2014 - uses SafeConstructor instead of Constructor. This should make no
# difference, because "Is it YAML?" only gets as far as the composition stage,
# but - well: it reduces the risk of something bad happening.

#        Constructor.__init__(self)
        SafeConstructor.__init__(self)
        Resolver.__init__(self)
开发者ID:peterkmurphy,项目名称:isityaml,代码行数:13,代码来源:views.py

示例3: __init__

    def __init__(self):
        self.add_multi_constructor("!vol/", self.__class__.vol_constructor)
        self.add_multi_constructor("!type/", self.__class__.type_constructor)
        self.add_constructor(
            "!include", self.__class__.include_file_constructor)
        self.add_constructor(
            "!include_merge", self.__class__.include_merge_constructor)
        self.add_constructor(
            "!include_dir_file_mapped",
            self.__class__.include_dir_file_mapped_constructor)
        self.add_constructor("!env_var", self.__class__.env_var_constructor)
        self.add_constructor("!path", self.__class__.path_constructor)

        SafeConstructor.__init__(self)
开发者ID:lennart-k,项目名称:HomeControl,代码行数:14,代码来源:yaml_loader.py

示例4: construct_yaml_map

    def construct_yaml_map(self, node):
        """
        Return a node class representing a line-marked dictionary.

        """
        obj, = SafeConstructor.construct_yaml_map(self, node)
        return DictNode(obj, node.start_mark, node.end_mark)
开发者ID:wtpayne,项目名称:hiai,代码行数:7,代码来源:marked_yaml.py

示例5: construct_yaml_seq

    def construct_yaml_seq(self, node):
        """
        Return a node class representing a line-marked sequence.

        """
        obj, = SafeConstructor.construct_yaml_seq(self, node)
        return ListNode(obj, node.start_mark, node.end_mark)
开发者ID:wtpayne,项目名称:hiai,代码行数:7,代码来源:marked_yaml.py

示例6: construct_yaml_str

    def construct_yaml_str(self, node):
        """
        Return a node class representing a line-marked string.

        """
        obj = SafeConstructor.construct_scalar(self, node)
        assert da.util.is_string(obj)
        return StringNode(obj, node.start_mark, node.end_mark)
开发者ID:wtpayne,项目名称:hiai,代码行数:8,代码来源:marked_yaml.py

示例7: construct_yaml_str

 def construct_yaml_str(self, node):
     obj = SafeConstructor.construct_yaml_str(self, node)
     try:
         obj = str(obj)
     except UnicodeEncodeError:
         raise DSLParsingInputTypeException(
             ERROR_INVALID_CHARS,
             'illegal characters in line: {0}, column: {1}. '
             'Only valid ascii chars are supported.'.format(
                 node.start_mark.line, node.start_mark.column))
     return self._holder(obj, node)
开发者ID:cloudify-cosmo,项目名称:cloudify-dsl-parser,代码行数:11,代码来源:yaml_loader.py

示例8: construct_mapping

 def construct_mapping(self, node, deep=False):
     if not isinstance(node, yaml.nodes.MappingNode):
         raise ConstructorError(
             None, None,
             "expected a mapping node, but found %s" % node.id,
             node.start_mark)
     keys = set([])
     for key_node, value_node in node.value:
         key = self.construct_object(key_node, deep=deep)
         if key in keys:
             raise ConstructorError(
                 "while constructing a mapping", node.start_mark,
                 "found duplicate key (%s)" % key, key_node.start_mark)
         keys.add(key)
     return SafeConstructor.construct_mapping(self, node, deep)
开发者ID:digitalsatori,项目名称:maestro-ng,代码行数:15,代码来源:loader.py

示例9: construct_yaml_float

 def construct_yaml_float(self, node):
     obj = SafeConstructor.construct_scalar(self, node)
     return float_node(obj, node.start_mark, node.end_mark)
开发者ID:opencord,项目名称:cord,代码行数:3,代码来源:markedyaml.py

示例10: construct_yaml_bool

 def construct_yaml_bool(self, node):
     obj = SafeConstructor.construct_yaml_bool(self, node)
     return int_node(obj, node.start_mark, node.end_mark)
开发者ID:opencord,项目名称:cord,代码行数:3,代码来源:markedyaml.py

示例11: construct_yaml_str

 def construct_yaml_str(self, node):
     obj = SafeConstructor.construct_scalar(self, node)
     assert isinstance(obj, unicode)
     return unicode_node(obj, node.start_mark, node.end_mark)
开发者ID:opencord,项目名称:cord,代码行数:4,代码来源:markedyaml.py

示例12: construct_yaml_seq

 def construct_yaml_seq(self, node):
     obj, = SafeConstructor.construct_yaml_seq(self, node)
     return list_node(obj, node.start_mark, node.end_mark)
开发者ID:opencord,项目名称:cord,代码行数:3,代码来源:markedyaml.py

示例13: construct_yaml_map

 def construct_yaml_map(self, node):
     obj, = SafeConstructor.construct_yaml_map(self, node)
     return self._holder(obj, node)
开发者ID:GigaSpaces-ProfessionalServices,项目名称:cloudify-dsl-parser,代码行数:3,代码来源:yaml_loader.py

示例14: construct_yaml_timestamp

 def construct_yaml_timestamp(self, node):
     obj = SafeConstructor.construct_yaml_timestamp(self, node)
     return self._holder(obj, node)
开发者ID:GigaSpaces-ProfessionalServices,项目名称:cloudify-dsl-parser,代码行数:3,代码来源:yaml_loader.py

示例15: construct_yaml_binary

 def construct_yaml_binary(self, node):
     obj = SafeConstructor.construct_yaml_binary(self, node)
     return self._holder(obj, node)
开发者ID:GigaSpaces-ProfessionalServices,项目名称:cloudify-dsl-parser,代码行数:3,代码来源:yaml_loader.py


注:本文中的yaml.constructor.SafeConstructor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。