Skip to content

Commit

Permalink
flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Jul 31, 2023
1 parent 2901cea commit da00765
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyext/src/mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions pyext/src/plotting/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion pyext/src/restraints/saxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions pyext/src/topology/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit da00765

Please sign in to comment.