summaryrefslogtreecommitdiff
path: root/checkers/design_analysis.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-07-17 12:08:02 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-07-17 12:08:02 +0200
commitcf74f295ec39224c36d20422d52051e4544e0eb8 (patch)
treeceb46d962624a02ff4e5065da8ac53f8d385fdf9 /checkers/design_analysis.py
parentf1b2a96fc423abb5d5bb48626300231e143c61cf (diff)
downloadpylint-cf74f295ec39224c36d20422d52051e4544e0eb8.tar.gz
[design analysis] fix badly implemented protocol for read-only containers like tuple. Close #25
Diffstat (limited to 'checkers/design_analysis.py')
-rw-r--r--checkers/design_analysis.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/checkers/design_analysis.py b/checkers/design_analysis.py
index 5e60ccb..f3b5882 100644
--- a/checkers/design_analysis.py
+++ b/checkers/design_analysis.py
@@ -29,10 +29,9 @@ IGNORED_ARGUMENT_NAMES = re.compile('_.*')
SPECIAL_METHODS = [('Context manager', set(('__enter__',
'__exit__',))),
('Container', set(('__len__',
- '__getitem__',
- '__setitem__',
- '__delitem__',))),
- ('Callable', set(('__call__',))),
+ '__getitem__',))),
+ ('Mutable container', set(('__setitem__',
+ '__delitem__',))),
]
class SpecialMethodChecker(object):
@@ -56,8 +55,8 @@ class SpecialMethodChecker(object):
required_methods_found = methods_required & self.methods_found
if required_methods_found == methods_required:
return True
- if required_methods_found != set():
- required_methods_missing = methods_required - self.methods_found
+ if required_methods_found:
+ required_methods_missing = methods_required - self.methods_found
self.on_error((protocol,
', '.join(sorted(required_methods_found)),
', '.join(sorted(required_methods_missing))))