Skip to content

Commit 5c3a192

Browse files
committed
style: fix linting errors
I double checked that the dicts are identical to what they were before this change
1 parent 7842250 commit 5c3a192

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

deeprank2/tools/target.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ def add_target( # noqa: C901
3535
1ATN_xxx-3 0
3636
1ATN_xxx-4 0
3737
"""
38-
target_dict = {}
39-
4038
labels = np.loadtxt(target_list, delimiter=sep, usecols=[0], dtype=str)
4139
values = np.loadtxt(target_list, delimiter=sep, usecols=[1])
42-
for label, value in zip(labels, values, strict=True):
43-
target_dict[label] = value
40+
target_dict = dict(zip(labels, values, strict=False))
4441

4542
if os.path.isdir(graph_path):
4643
graphs = glob.glob(f"{graph_path}/*.hdf5")

deeprank2/utils/parsing/residue.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ def __init__(
1010
absent_atom_names: list[str],
1111
):
1212
self.class_name = class_name
13-
1413
self.amino_acid_names = amino_acid_names
15-
1614
self.present_atom_names = present_atom_names
1715
self.absent_atom_names = absent_atom_names
1816

@@ -26,11 +24,7 @@ def matches(self, amino_acid_name: str, atom_names: list[str]) -> bool:
2624
return False
2725

2826
# check the atom names that should be present
29-
if not all(atom_name in atom_names for atom_name in self.present_atom_names):
30-
return False
31-
32-
# all checks passed
33-
return True
27+
return all(atom_name in atom_names for atom_name in self.present_atom_names)
3428

3529

3630
class ResidueClassParser: # noqa: D101

tests/test_querycollection.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,11 @@ def test_querycollection_process_combine_output_true() -> None:
202202
_, output_directory_f, output_paths_f = _querycollection_tester(query_type, feature_modules=modules, combine_output=False, cpu_count=2)
203203
assert len(output_paths_t) == 1
204204

205-
keys_t = {}
206205
with h5py.File(output_paths_t[0], "r") as file_t:
207-
for key, value in file_t.items():
208-
keys_t[key] = value
209-
keys_f = {}
206+
keys_t = dict(file_t.items())
210207
for output_path in output_paths_f:
211208
with h5py.File(output_path, "r") as file_f:
212-
for key, value in file_f.items():
213-
keys_f[key] = value
209+
keys_f = dict(file_f.items())
214210
assert keys_t == keys_f
215211

216212
rmtree(output_directory_t)

0 commit comments

Comments
 (0)