Function represent_sequence

Synopsis

def represent_sequence(self, tag, sequence, flow_style=None)

Description

No description yet.

Mentioned in

Source

Lines 85-102 in lib3/yaml/representer.py.

def represent_sequence(self, tag, sequence, flow_style=None):
    value = []
    node = SequenceNode(tag, value, flow_style=flow_style)
    if self.alias_key is not None:
        self.represented_objects[self.alias_key] = node
    best_style = True
    for item in sequence:
        node_item = self.represent_data(item)
        if not (isinstance(node_item, ScalarNode) and not node_item.style):
            best_style = False
        value.append(node_item)
    if flow_style is None:
        if self.default_flow_style is not None:
            node.flow_style = self.default_flow_style
        else:
            node.flow_style = best_style
    return node





Add Discussion as Guest

Log in