Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently use the _FunctionType constants #105

Merged
merged 1 commit into from Jan 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pep8ext_naming.py
Expand Up @@ -281,7 +281,8 @@ def visit_functiondef(self, node, parents, ignore=None):
return
if name.lower() != name:
yield self.err(node, 'N802', name=name)
if function_type == 'function' and '__' in (name[:2], name[-2:]):
if (function_type == _FunctionType.FUNCTION
and '__' in (name[:2], name[-2:])):
yield self.err(node, 'N807', name=name)

visit_asyncfunctiondef = visit_functiondef
Expand Down Expand Up @@ -316,7 +317,7 @@ def arg_name(arg):
if not arg_name_tuples:
return
arg0, name0 = arg_name_tuples[0]
function_type = getattr(node, 'function_type', 'function')
function_type = getattr(node, 'function_type', _FunctionType.FUNCTION)

if function_type == _FunctionType.METHOD:
if name0 != 'self':
Expand Down