Skip to content

Commit

Permalink
fix E721 errors in linting (#1978)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Sep 10, 2024
1 parent 1ccc56a commit 2868dda
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions samplesheets/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _get_zip_path(cls, inv_path, file_path):
@classmethod
def _get_study(cls, o):
"""Return study for a potentially unknown type of object"""
if type(o) == Study:
if isinstance(o, Study):
return o
elif hasattr(o, 'study'):
return o.study
Expand Down Expand Up @@ -329,7 +329,7 @@ def _import_comments(cls, comments):
@classmethod
def _import_tuple_list(cls, tuples):
"""Get list of dicts from tuples for JSONField"""
if type(tuples) == dict:
if isinstance(tuples, dict):
return [cls._import_multi_val(v) for v in tuples.values()]
elif type(tuples) in [tuple, list]:
return [cls._import_multi_val(v) for v in tuples]
Expand Down Expand Up @@ -407,7 +407,7 @@ def _import_materials(cls, materials, db_parent, obj_lookup):
'study': study,
'headers': m.headers,
}
if type(db_parent) == Assay:
if isinstance(db_parent, Assay):
values['assay'] = db_parent
# NOTE: Extract label stored as JSON since altamISA 0.1 update
if m.extract_label:
Expand Down Expand Up @@ -462,7 +462,7 @@ def _import_processes(
'unique_name': p.unique_name,
'name_type': p.name_type,
'protocol': protocol,
'assay': db_parent if type(db_parent) == Assay else None,
'assay': db_parent if isinstance(db_parent, Assay) else None,
'study': study,
'performer': p.performer,
'perform_date': p.date if p.date else None,
Expand Down
8 changes: 4 additions & 4 deletions samplesheets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ def get_study(self):
return self.assay.study
elif hasattr(self, 'study') and self.study:
return self.study
elif type(self) == Study:
elif isinstance(self, Study):
return self

def get_project(self):
"""Return associated project"""
if type(self) == Investigation:
if isinstance(self, Investigation):
return self.project
elif type(self) == Study:
elif isinstance(self, Study):
return self.investigation.project
elif type(self) == Protocol:
elif isinstance(self, Protocol):
return self.study.investigation.project
elif type(self) in [Assay, GenericMaterial, Process]:
if self.study:
Expand Down
2 changes: 1 addition & 1 deletion samplesheets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_isa_field_name(field):
:param field: Field of an ISA Django model
:return: String
"""
if type(field) == dict:
if isinstance(field, dict):
return field['name']
return field

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
max-line-length = 80
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs_manual,
node_modules,src/*,config/*,versioneer.py,env/*,.venv,_version.py
ignore = E203, E266, E501, F405, W503, W504, C901, E721
ignore = E203, E266, E501, F405, W503, W504, C901
max-complexity = 18
select = B,C,E,F,W,T4,B9

Expand Down

0 comments on commit 2868dda

Please sign in to comment.