diff --git a/pyext/src/mmcif.py b/pyext/src/mmcif.py index 3fe48767..3f73edf9 100644 --- a/pyext/src/mmcif.py +++ b/pyext/src/mmcif.py @@ -252,7 +252,7 @@ def __init__(self, state, component, start, end, count, hier, asym_unit): def combine(self, other): # todo: don't combine if one fragment is rigid and the other flexible - if (type(other) == type(self) and + if (type(other) == type(self) and # noqa: E721 other.asym_unit.seq_id_range[0] == self.asym_unit.seq_id_range[1] + 1): self.asym_unit.seq_id_range = (self.asym_unit.seq_id_range[0], diff --git a/pyext/src/plotting/topology.py b/pyext/src/plotting/topology.py index 1a73374b..f3697509 100644 --- a/pyext/src/plotting/topology.py +++ b/pyext/src/plotting/topology.py @@ -73,9 +73,9 @@ def add_rmf(self, rmf_fn, nframe): for component_name in self.selections: for seg in self.selections[component_name]: - if type(seg) == str: + if isinstance(seg, str): s = IMP.atom.Selection(hier, molecule=seg) - elif type(seg) == tuple: + elif isinstance(seg, tuple): s = IMP.atom.Selection( hier, molecule=seg[2], residue_indexes=range(seg[0], seg[1] + 1)) diff --git a/pyext/src/restraints/saxs.py b/pyext/src/restraints/saxs.py index 54bce717..0c2c35f9 100644 --- a/pyext/src/restraints/saxs.py +++ b/pyext/src/restraints/saxs.py @@ -64,7 +64,7 @@ def __init__(self, input_objects, saxs_datafile, weight=1.0, maxq = 0.4 else: maxq = 0.5 - elif type(maxq) == float: + elif isinstance(maxq, float): if maxq < 0.01 or maxq > 4.0: raise Exception( "SAXSRestraint: maxq must be set between 0.01 and 4.0") diff --git a/pyext/src/topology/__init__.py b/pyext/src/topology/__init__.py index 27ab5ec5..e1856f09 100644 --- a/pyext/src/topology/__init__.py +++ b/pyext/src/topology/__init__.py @@ -765,7 +765,7 @@ def add_representation(self, # unify formatting for extra breaks breaks = [] for b in bead_extra_breaks: - if type(b) == str: + if isinstance(b, str): breaks.append(int(b)-1) else: breaks.append(b) @@ -1223,7 +1223,8 @@ def __key(self): self.pdb_index, self.internal_index) def __eq__(self, other): - return type(other) == type(self) and self.__key() == other.__key() + return (type(other) == type(self) # noqa: E721 + and self.__key() == other.__key()) def __hash__(self): return hash(self.__key())