Skip to content

Commit

Permalink
linting: target: use isinstance() rather than type() for typecheck
Browse files Browse the repository at this point in the history
See pylint error messag C0123.

Signed-off-by: Bastian Stender <[email protected]>
  • Loading branch information
Bastian-Krause committed Jun 4, 2018
1 parent 933232a commit 0e12f84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions labgrid/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_resource(self, cls, *, name=None, await=True):
"""
found = []
other_names = []
if type(cls) is str:
if isinstance(cls, str):
cls = self._class_from_string(cls)

for res in self.resources:
Expand Down Expand Up @@ -142,7 +142,7 @@ def _get_driver(self, cls, *, name=None, activate=True, active=False):

found = []
other_names = []
if type(cls) is str:
if isinstance(cls, str):
cls = self._class_from_string(cls)

for drv in self.drivers:
Expand Down Expand Up @@ -231,7 +231,7 @@ def __getitem__(self, key):
cls = key
elif len(key) == 2:
cls, name = key
if type(cls) is str:
if isinstance(cls, str):
cls = self._class_from_string(cls)
if not issubclass(cls, (Driver, abc.ABC)): # all Protocols derive from ABC
raise NoDriverFoundError(
Expand Down Expand Up @@ -422,7 +422,7 @@ def deactivate(self, client):
This is needed to ensure that no client has an inactive supplier.
"""
if type(client) is str:
if isinstance(client, str):
client = self._class_from_string(client)

if client.state is BindingState.bound:
Expand Down

0 comments on commit 0e12f84

Please sign in to comment.