예제 #1
0
 def make_printable_keywords(self, keywords, lineno):
     keywords = [(i.arg, simple_expression_guard(self.to_source(i.value)),
         i.value.lineno) for i in keywords if not (isinstance(
         i.value, ast.Name) and (
         (i.arg == 'id' and i.value.id.startswith('_')) or
         (i.arg == 'scope' and i.value.id == '_scope')))]
     # Sort the keywords according to what line they belong on
     # The first element always exists for the line the block starts on,
     # even if there's no keywords that go on it
     keywords_by_line = []
     current_line = []
     for i in keywords:
         if i[2] > lineno:
             keywords_by_line.append((lineno, ' '.join(current_line)))
             lineno = i[2]
             current_line = []
         current_line.extend(i[:2])
     keywords_by_line.append((lineno, ' '.join(current_line)))
     return keywords_by_line
예제 #2
0
 def make_printable_keywords(self, keywords, lineno):
     keywords = [(i.arg, simple_expression_guard(self.to_source(i.value)),
                  i.value.lineno) for i in keywords
                 if not (isinstance(i.value, ast.Name) and (
                     (i.arg == 'id' and i.value.id.startswith('_')) or
                     (i.arg == 'scope' and i.value.id == '_scope')))]
     # Sort the keywords according to what line they belong on
     # The first element always exists for the line the block starts on,
     # even if there's no keywords that go on it
     keywords_by_line = []
     current_line = []
     for i in keywords:
         if i[2] > lineno:
             keywords_by_line.append((lineno, ' '.join(current_line)))
             lineno = i[2]
             current_line = []
         current_line.extend(i[:2])
     keywords_by_line.append((lineno, ' '.join(current_line)))
     return keywords_by_line
예제 #3
0
 def print_args(self, node):
     if node.args:
         self.write(" " + " ".join([simple_expression_guard(
             self.to_source(i)) for i in node.args]))
예제 #4
0
 def print_args(self, node):
     if node.args:
         self.write(" " + " ".join([
             simple_expression_guard(self.to_source(i)) for i in node.args
         ]))