コード例 #1
0
ファイル: tableentrysort.py プロジェクト: Luoyufu/pipenv
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
コード例 #2
0
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
コード例 #3
0
ファイル: linelength.py プロジェクト: Luoyufu/pipenv
 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
コード例 #4
0
 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