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

Side by Side Diff: third_party/pylint/checkers/typecheck.py

Issue 876793002: pylint: upgrade to 1.4.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 10 months 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/pylint/checkers/stdlib.py ('k') | third_party/pylint/checkers/utils.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 (c) 2006-2013 LOGILAB S.A. (Paris, FRANCE). 1 # Copyright (c) 2006-2013 LOGILAB S.A. (Paris, FRANCE).
2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr
3 # 3 #
4 # This program is free software; you can redistribute it and/or modify it under 4 # This program is free software; you can redistribute it and/or modify it under
5 # the terms of the GNU General Public License as published by the Free Software 5 # the terms of the GNU General Public License as published by the Free Software
6 # Foundation; either version 2 of the License, or (at your option) any later 6 # Foundation; either version 2 of the License, or (at your option) any later
7 # version. 7 # version.
8 # 8 #
9 # This program is distributed in the hope that it will be useful, but WITHOUT 9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 attrs = klass._proxied.getattr(node.func.attrname) 337 attrs = klass._proxied.getattr(node.func.attrname)
338 except astroid.NotFoundError: 338 except astroid.NotFoundError:
339 return 339 return
340 340
341 for attr in attrs: 341 for attr in attrs:
342 if attr is astroid.YES: 342 if attr is astroid.YES:
343 continue 343 continue
344 if not isinstance(attr, astroid.Function): 344 if not isinstance(attr, astroid.Function):
345 continue 345 continue
346 346
347 # Decorated, see if it is decorated with a property 347 # Decorated, see if it is decorated with a property.
348 # Also, check the returns and see if they are callable.
348 if decorated_with_property(attr): 349 if decorated_with_property(attr):
349 self.add_message('not-callable', node=node, 350 if all(return_node.callable()
350 args=node.func.as_string()) 351 for return_node in attr.infer_call_result(node)):
351 break 352 continue
353 else:
354 self.add_message('not-callable', node=node,
355 args=node.func.as_string())
356 break
352 357
353 @check_messages(*(list(MSGS.keys()))) 358 @check_messages(*(list(MSGS.keys())))
354 def visit_callfunc(self, node): 359 def visit_callfunc(self, node):
355 """check that called functions/methods are inferred to callable objects, 360 """check that called functions/methods are inferred to callable objects,
356 and that the arguments passed to the function match the parameters in 361 and that the arguments passed to the function match the parameters in
357 the inferred function's definition 362 the inferred function's definition
358 """ 363 """
359 # Build the set of keyword arguments, checking for duplicate keywords, 364 # Build the set of keyword arguments, checking for duplicate keywords,
360 # and count the positional arguments. 365 # and count the positional arguments.
361 keyword_args = set() 366 keyword_args = set()
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return 618 return
614 except astroid.NotFoundError: 619 except astroid.NotFoundError:
615 pass 620 pass
616 621
617 # Anything else is an error 622 # Anything else is an error
618 self.add_message('invalid-slice-index', node=node) 623 self.add_message('invalid-slice-index', node=node)
619 624
620 def register(linter): 625 def register(linter):
621 """required method to auto register this checker """ 626 """required method to auto register this checker """
622 linter.register_checker(TypeChecker(linter)) 627 linter.register_checker(TypeChecker(linter))
OLDNEW
« no previous file with comments | « third_party/pylint/checkers/stdlib.py ('k') | third_party/pylint/checkers/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698