From afcaa89cf0768782c05e8d6aef747b480236ea6d Mon Sep 17 00:00:00 2001 From: Laurens Van Houtven <_@lvh.cc> Date: Wed, 10 Jul 2013 19:00:11 +0200 Subject: [PATCH] Use isinstance instead of unary type --- jedi/builtin.py | 2 +- jedi/dynamic.py | 2 +- jedi/evaluate_representation.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jedi/builtin.py b/jedi/builtin.py index de25d36b..e75ee6b5 100644 --- a/jedi/builtin.py +++ b/jedi/builtin.py @@ -321,7 +321,7 @@ def _generate_code(scope, mixin_funcs={}, depth=0): file_type = io.TextIOWrapper else: file_type = types.FileType - if type(value) == file_type: + if isinstance(value, file_type): value = 'open()' elif name == 'None': value = '' diff --git a/jedi/dynamic.py b/jedi/dynamic.py index 217932f8..92c95dfb 100644 --- a/jedi/dynamic.py +++ b/jedi/dynamic.py @@ -526,7 +526,7 @@ def check_statement_information(stmt, search_name): # this might be removed if we analyze and, etc assert len(commands) == 1 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) # isinstance check diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index 0459a5b2..d6fb946a 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -643,7 +643,7 @@ class Execution(Executable): call = key_stmt.get_commands()[0] if isinstance(call, pr.Name): yield call, value_stmt - elif type(call) == pr.Call: + elif isinstance(call, pr.Call): yield call.name, value_stmt # Normal arguments (including key arguments). else: