def _line_key(line_elements): """ Given a sequence of elements comprising a single line, returns an orderable value to use in ordering lines. """ for e in line_elements: if isinstance(e, TokenElement) and tokens.is_string(e.first_token): return e.primitive_value return 'z' * 10 # Metadata lines should be at the end
def multiline_equivalent(element): if isinstance(element, AtomicElement) and tokens.is_string(element.first_token): return element_factory.create_multiline_string(element.value, MAXIMUM_LINE_LENGTH) elif isinstance(element, ArrayElement): element.turn_into_multiline() return element else: return element
def multiline_equivalent(element): if isinstance(element, AtomicElement) and tokens.is_string( element.first_token): return element_factory.create_multiline_string( element.value, MAXIMUM_LINE_LENGTH) elif isinstance(element, ArrayElement): element.turn_into_multiline() return element else: return element