Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/logilab/astroid/as_string.py

Issue 753543006: pylint: upgrade to 1.4.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/logilab/astroid/__pkginfo__.py ('k') | third_party/logilab/astroid/bases.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. 1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3 # 3 #
4 # This file is part of astroid. 4 # This file is part of astroid.
5 # 5 #
6 # astroid is free software: you can redistribute it and/or modify it 6 # astroid is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU Lesser General Public License as published by the 7 # under the terms of the GNU Lesser General Public License as published by the
8 # Free Software Foundation, either version 2.1 of the License, or (at your 8 # Free Software Foundation, either version 2.1 of the License, or (at your
9 # option) any later version. 9 # option) any later version.
10 # 10 #
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return '%s(%s)' % (expr_str, ', '.join(args)) 141 return '%s(%s)' % (expr_str, ', '.join(args))
142 142
143 def visit_class(self, node): 143 def visit_class(self, node):
144 """return an astroid.Class node as string""" 144 """return an astroid.Class node as string"""
145 decorate = node.decorators and node.decorators.accept(self) or '' 145 decorate = node.decorators and node.decorators.accept(self) or ''
146 bases = ', '.join([n.accept(self) for n in node.bases]) 146 bases = ', '.join([n.accept(self) for n in node.bases])
147 if sys.version_info[0] == 2: 147 if sys.version_info[0] == 2:
148 bases = bases and '(%s)' % bases or '' 148 bases = bases and '(%s)' % bases or ''
149 else: 149 else:
150 metaclass = node.metaclass() 150 metaclass = node.metaclass()
151 if metaclass: 151 if metaclass and not node.has_metaclass_hack():
152 if bases: 152 if bases:
153 bases = '(%s, metaclass=%s)' % (bases, metaclass.name) 153 bases = '(%s, metaclass=%s)' % (bases, metaclass.name)
154 else: 154 else:
155 bases = '(metaclass=%s)' % metaclass.name 155 bases = '(metaclass=%s)' % metaclass.name
156 else: 156 else:
157 bases = bases and '(%s)' % bases or '' 157 bases = bases and '(%s)' % bases or ''
158 docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or '' 158 docs = node.doc and '\n%s"""%s"""' % (INDENT, node.doc) or ''
159 return '\n\n%sclass %s%s:%s\n%s\n' % (decorate, node.name, bases, docs, 159 return '\n\n%sclass %s%s:%s\n%s\n' % (decorate, node.name, bases, docs,
160 self._stmt_list(node.body)) 160 self._stmt_list(node.body))
161 161
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 _names.append(name) 490 _names.append(name)
491 return ', '.join(_names) 491 return ', '.join(_names)
492 492
493 493
494 if sys.version_info >= (3, 0): 494 if sys.version_info >= (3, 0):
495 AsStringVisitor = AsStringVisitor3k 495 AsStringVisitor = AsStringVisitor3k
496 496
497 # this visitor is stateless, thus it can be reused 497 # this visitor is stateless, thus it can be reused
498 to_code = AsStringVisitor() 498 to_code = AsStringVisitor()
499 499
OLDNEW
« no previous file with comments | « third_party/logilab/astroid/__pkginfo__.py ('k') | third_party/logilab/astroid/bases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698