Fix some static analysis tests like attribute errors and normal arguments.

This commit is contained in:
Dave Halter
2016-12-14 01:04:57 +01:00
parent 03525bbef5
commit 4074ca1e84
2 changed files with 44 additions and 34 deletions

View File

@@ -77,17 +77,16 @@ class Warning(Error):
pass
def add(context, name, jedi_name, message=None, typ=Error, payload=None):
return
def add(context, error_name, node, message=None, typ=Error, payload=None):
from jedi.evaluate import Evaluator
if isinstance(context, Evaluator):
raise 1
exception = CODES[name][1]
if _check_for_exception_catch(context, jedi_name, exception, payload):
exception = CODES[error_name][1]
if _check_for_exception_catch(context, node, exception, payload):
return
module_path = jedi_name.get_root_node().path
instance = typ(name, module_path, jedi_name.start_pos, message)
module_path = node.get_root_node().path
instance = typ(error_name, module_path, node.start_pos, message)
debug.warning(str(instance), format=False)
context.evaluator.analysis.append(instance)