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

Side by Side Diff: third_party/logilab/astroid/brain/py2stdlib.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, 11 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
OLDNEW
1
1 """Astroid hooks for the Python 2 standard library. 2 """Astroid hooks for the Python 2 standard library.
2 3
3 Currently help understanding of : 4 Currently help understanding of :
4 5
5 * hashlib.md5 and hashlib.sha1 6 * hashlib.md5 and hashlib.sha1
6 """ 7 """
7 8
8 import sys 9 import sys
10 from functools import partial
9 from textwrap import dedent 11 from textwrap import dedent
10 12
11 from astroid import ( 13 from astroid import (
12 MANAGER, AsStringRegexpPredicate, 14 MANAGER, AsStringRegexpPredicate,
13 UseInferenceDefault, inference_tip, 15 UseInferenceDefault, inference_tip,
14 YES, InferenceError, register_module_extender) 16 YES, InferenceError, register_module_extender)
15 from astroid import exceptions 17 from astroid import exceptions
16 from astroid import nodes 18 from astroid import nodes
17 from astroid.builder import AstroidBuilder 19 from astroid.builder import AstroidBuilder
18 20
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 def digest(self): 99 def digest(self):
98 return %(digest)s 100 return %(digest)s
99 def copy(self): 101 def copy(self):
100 return self 102 return self
101 def update(self, value): pass 103 def update(self, value): pass
102 def hexdigest(self): 104 def hexdigest(self):
103 return '' 105 return ''
104 @property 106 @property
105 def name(self): 107 def name(self):
106 return %(name)r 108 return %(name)r
109 @property
110 def block_size(self):
111 return 1
112 @property
113 def digest_size(self):
114 return 1
107 ''' 115 '''
108 algorithms = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') 116 algorithms = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
109 classes = "".join( 117 classes = "".join(
110 template % {'name': hashfunc, 'digest': 'b""' if PY3K else '""'} 118 template % {'name': hashfunc, 'digest': 'b""' if PY3K else '""'}
111 for hashfunc in algorithms) 119 for hashfunc in algorithms)
112 return AstroidBuilder(MANAGER).string_build(classes) 120 return AstroidBuilder(MANAGER).string_build(classes)
113 121
114 122
115 def collections_transform(): 123 def collections_transform():
116 return AstroidBuilder(MANAGER).string_build(''' 124 return AstroidBuilder(MANAGER).string_build('''
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return node 323 return node
316 324
317 325
318 MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_named_tuple), 326 MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_named_tuple),
319 looks_like_namedtuple) 327 looks_like_namedtuple)
320 MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_enum), 328 MANAGER.register_transform(nodes.CallFunc, inference_tip(infer_enum),
321 AsStringRegexpPredicate('Enum', 'func')) 329 AsStringRegexpPredicate('Enum', 'func'))
322 MANAGER.register_transform(nodes.Class, infer_enum_class) 330 MANAGER.register_transform(nodes.Class, infer_enum_class)
323 register_module_extender(MANAGER, 'hashlib', hashlib_transform) 331 register_module_extender(MANAGER, 'hashlib', hashlib_transform)
324 register_module_extender(MANAGER, 'collections', collections_transform) 332 register_module_extender(MANAGER, 'collections', collections_transform)
325 register_module_extender(MANAGER, 'pkg_resourcds', pkg_resources_transform) 333 register_module_extender(MANAGER, 'pkg_resources', pkg_resources_transform)
326 register_module_extender(MANAGER, 'subprocess', subprocess_transform) 334 register_module_extender(MANAGER, 'subprocess', subprocess_transform)
OLDNEW
« no previous file with comments | « third_party/logilab/astroid/brain/builtin_inference.py ('k') | third_party/logilab/astroid/brain/pynose.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698