1
0
forked from VimPlug/jedi

Use isinstance instead of unary type

This commit is contained in:
Laurens Van Houtven
2013-07-10 19:00:11 +02:00
parent 18c105b055
commit afcaa89cf0
3 changed files with 3 additions and 3 deletions

View File

@@ -321,7 +321,7 @@ def _generate_code(scope, mixin_funcs={}, depth=0):
file_type = io.TextIOWrapper file_type = io.TextIOWrapper
else: else:
file_type = types.FileType file_type = types.FileType
if type(value) == file_type: if isinstance(value, file_type):
value = 'open()' value = 'open()'
elif name == 'None': elif name == 'None':
value = '' value = ''

View File

@@ -526,7 +526,7 @@ def check_statement_information(stmt, search_name):
# this might be removed if we analyze and, etc # this might be removed if we analyze and, etc
assert len(commands) == 1 assert len(commands) == 1
call = commands[0] call = commands[0]
assert type(call) == pr.Call and str(call.name) == 'isinstance' assert isinstance(call, pr.Call) and str(call.name) == 'isinstance'
assert bool(call.execution) assert bool(call.execution)
# isinstance check # isinstance check

View File

@@ -643,7 +643,7 @@ class Execution(Executable):
call = key_stmt.get_commands()[0] call = key_stmt.get_commands()[0]
if isinstance(call, pr.Name): if isinstance(call, pr.Name):
yield call, value_stmt yield call, value_stmt
elif type(call) == pr.Call: elif isinstance(call, pr.Call):
yield call.name, value_stmt yield call.name, value_stmt
# Normal arguments (including key arguments). # Normal arguments (including key arguments).
else: else: