summaryrefslogtreecommitdiff
path: root/checkers/utils.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2012-06-07 14:54:03 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2012-06-07 14:54:03 +0200
commitfa23ddf35a4414fb270d3a184a538ecf80481494 (patch)
treef6a63ba974881eb9ff2d99857fe733f7c4cc30d9 /checkers/utils.py
parentba578113c9c1b88cbc57ef5a9f09ef0a5a5cde5f (diff)
downloadpylint-git-fa23ddf35a4414fb270d3a184a538ecf80481494.tar.gz
Doesn't check that overriden method signature match if it's a private method, closes #18772
Diffstat (limited to 'checkers/utils.py')
-rw-r--r--checkers/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index efaa7ada8..5c8fc8e76 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -18,6 +18,7 @@
"""some functions that may be useful for various checkers
"""
+import re
import string
from logilab import astng
from logilab.astng import scoped_nodes
@@ -46,8 +47,8 @@ def clobber_in_except(node):
return (True, (name, 'builtins'))
else:
scope, stmts = node.lookup(name)
- if (stmts and
- not isinstance(stmts[0].ass_type(),
+ if (stmts and
+ not isinstance(stmts[0].ass_type(),
(astng.Assign, astng.AugAssign, astng.ExceptHandler))):
return (True, (name, 'outer scope (line %i)' % (stmts[0].lineno,)))
return (False, None)
@@ -320,3 +321,10 @@ def parse_format_string(format_string):
num_args += 1
i += 1
return keys, num_args
+
+def is_attr_private(attrname):
+ """Check that attribute name is private (at least two leading underscores,
+ at most one trailing underscore)
+ """
+ regex = re.compile('^_{2,}.*[^_]+_?$')
+ return regex.match(attrname) \ No newline at end of file