From 5bbca5f1fc3741a0f75925af3fa9f27b9c181bf3 Mon Sep 17 00:00:00 2001 From: pgbarletta Date: Mon, 4 Sep 2023 21:35:12 -0300 Subject: [PATCH] Fix formatting --- package/MDAnalysis/topology/tpr/utils.py | 35 ++++++++++++------- .../topology/test_tprparser.py | 19 +++++++--- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/package/MDAnalysis/topology/tpr/utils.py b/package/MDAnalysis/topology/tpr/utils.py index f585933b9a..4e26dbfa56 100644 --- a/package/MDAnalysis/topology/tpr/utils.py +++ b/package/MDAnalysis/topology/tpr/utils.py @@ -376,15 +376,13 @@ def do_mtop(data, fver, tpr_resid_from_one=False): (new_resnames, new_moltypes, new_molnums, - perres_segids, - perres_chainIDs + perres_segids ) ) = squash_by(resids, resnames, moltypes, molnums, - segids, - chainIDs) + segids) residueids = Resids(new_resids) residuenames = Resnames(new_resnames) residue_moltypes = Moltypes(new_moltypes) @@ -394,15 +392,26 @@ def do_mtop(data, fver, tpr_resid_from_one=False): segids = Segids(perseg_segids) chainIDs = ChainIDs(chainIDs) - - top = Topology(len(atomids), len(new_resids), len(perseg_segids), - attrs=[atomids, atomnames, atomtypes, - charges, masses, - residueids, residuenames, - residue_moltypes, residue_molnums, - segids, chainIDs], - atom_resindex=residx, - residue_segindex=segidx) + top = Topology( + len(atomids), + len(new_resids), + len(perseg_segids), + attrs=[ + atomids, + atomnames, + atomtypes, + charges, + masses, + residueids, + residuenames, + residue_moltypes, + residue_molnums, + segids, + chainIDs, + ], + atom_resindex=residx, + residue_segindex=segidx, + ) top.add_TopologyAttr(Bonds([bond for bond in bonds if bond])) top.add_TopologyAttr(Angles([angle for angle in angles if angle])) top.add_TopologyAttr(Dihedrals([dihedral for dihedral in dihedrals diff --git a/testsuite/MDAnalysisTests/topology/test_tprparser.py b/testsuite/MDAnalysisTests/topology/test_tprparser.py index eb42a47447..c18629c7eb 100644 --- a/testsuite/MDAnalysisTests/topology/test_tprparser.py +++ b/testsuite/MDAnalysisTests/topology/test_tprparser.py @@ -69,10 +69,21 @@ class TPRAttrs(ParserBase): parser = MDAnalysis.topology.TPRParser.TPRParser - expected_attrs = ['ids', 'names', 'elements', - 'resids', 'resnames', 'chainIDs', - 'moltypes', 'molnums', 'charges', - 'bonds', 'angles', 'dihedrals', 'impropers'] + expected_attrs = [ + "ids", + "names", + "elements", + "resids", + "resnames", + "chainIDs", + "moltypes", + "molnums", + "charges", + "bonds", + "angles", + "dihedrals", + "impropers", + ] def test_moltypes(self, top): moltypes = top.moltypes.values