Skip to content

Commit

Permalink
add black instead of ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
marinegor committed Oct 25, 2024
1 parent b7ada7c commit e80632c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package/MDAnalysis/coordinates/MMCIF.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
logger = logging.getLogger("MDAnalysis.coordinates.MMCIF")


def get_coordinates(model: 'gemmi.Model') -> np.ndarray:
def get_coordinates(model: "gemmi.Model") -> np.ndarray:
"""Get coordinates of all atoms in the `gemmi.Model` object.
Parameters
Expand Down
14 changes: 10 additions & 4 deletions package/MDAnalysis/topology/MMCIFParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ def _into_idx(arr: list) -> list[int]:
.. versionadded:: 2.8.0
"""
return [idx for idx, (_, group) in enumerate(itertools.groupby(arr)) for _ in group]
return [
idx
for idx, (_, group) in enumerate(itertools.groupby(arr))
for _ in group
]


def get_Atomattrs(model: 'gemmi.Model') -> tuple[list[AtomAttr], np.ndarray]:
def get_Atomattrs(model: "gemmi.Model") -> tuple[list[AtomAttr], np.ndarray]:
"""Extract all attributes that are subclasses of :class:`..core.topologyattrs.AtomAttr` from a ``gemmi.Model`` object,
and a `residx` index with indices of all atoms in residues.
Expand Down Expand Up @@ -165,7 +169,9 @@ def get_Atomattrs(model: 'gemmi.Model') -> tuple[list[AtomAttr], np.ndarray]:
return attrs, residx


def get_Residueattrs(model: 'gemmi.Model') -> tuple[list[ResidueAttr], np.ndarray]:
def get_Residueattrs(
model: "gemmi.Model",
) -> tuple[list[ResidueAttr], np.ndarray]:
"""Extract all attributes that are subclasses of :class:`..core.topologyattrs.ResidueAttr` from a ``gemmi.Model`` object,
and a `segidx` index witn indices of all residues in segments.
Expand Down Expand Up @@ -214,7 +220,7 @@ def get_Residueattrs(model: 'gemmi.Model') -> tuple[list[ResidueAttr], np.ndarra
return attrs, segidx


def get_Segmentattrs(model: 'gemmi.Model') -> SegmentAttr:
def get_Segmentattrs(model: "gemmi.Model") -> SegmentAttr:
"""Extract all attributes that are subclasses of :class:`..core.topologyattrs.SegmentAttr` from a ``gemmi.Model`` object.
Parameters
Expand Down
8 changes: 6 additions & 2 deletions testsuite/MDAnalysisTests/topology/test_mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def test_chains(mmcif_filename, n_chains):
@pytest.mark.parametrize(
"mmcif_filename,sequence",
[
(f"{MMCIF_FOLDER}/1YJP.cif", ["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"]),
(
f"{MMCIF_FOLDER}/1YJP.cif",
["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"],
),
(
f"{MMCIF_FOLDER}/1YJP.cif.gz",
["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"],
Expand All @@ -47,6 +50,7 @@ def test_chains(mmcif_filename, n_chains):
def test_sequence(mmcif_filename, sequence):
u = mda.Universe(mmcif_filename)
in_structure = [
str(res.resname) for res in u.select_atoms("protein and chainid A").residues
str(res.resname)
for res in u.select_atoms("protein and chainid A").residues
]
assert in_structure == sequence, ":".join(in_structure)

0 comments on commit e80632c

Please sign in to comment.