Skip to content

Commit

Permalink
Merge pull request #105 from jparise/function-type
Browse files Browse the repository at this point in the history
Consistently use the _FunctionType constants
  • Loading branch information
jparise committed Jan 30, 2019
2 parents 9596c43 + 67294f0 commit 3b10510
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 3b10510

Please sign in to comment.