Skip to content

Commit 4206e68

Browse files
committed
linting
1 parent 17f4bc6 commit 4206e68

3 files changed

Lines changed: 11 additions & 19 deletions

File tree

stackinator/mirror.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Dict
1+
from typing import Optional, List, Dict
22
import base64
33
import io
44
import os
@@ -64,9 +64,7 @@ def _load_mirrors(self, cmdline_cache: Optional[pathlib.Path]) -> Dict[str, Dict
6464
buildcache = mirrors.get("buildcache")
6565
if buildcache and buildcache.get("enabled", True):
6666
if not buildcache.get("private_key"):
67-
raise MirrorError(
68-
"Mirror build cache config is missing a required 'private_key' path."
69-
)
67+
raise MirrorError("Mirror build cache config is missing a required 'private_key' path.")
7068
self.build_cache_mirror = "buildcache"
7169
enabled_mirrors["buildcache"] = buildcache
7270
else:
@@ -120,7 +118,7 @@ def _load_cmdline_cache(self, cache_config_path: pathlib.Path) -> Dict:
120118
"enabled": True,
121119
"mount_specific": True,
122120
"private_key": raw["key"],
123-
"cmdline": True
121+
"cmdline": True,
124122
}
125123

126124
self._logger.warning(
@@ -180,7 +178,7 @@ def _create_spack_mirrors_yaml(self, dest: pathlib.Path):
180178
url = mirror["url"]
181179

182180
# Make the mirror path specific to the mount point
183-
if(name=="buildcache"):
181+
if name == "buildcache":
184182
if mirror["mount_specific"] and self._mount_point is not None:
185183
url = url.rstrip("/") + "/" + self._mount_point.as_posix().lstrip("/")
186184

@@ -223,8 +221,8 @@ def _create_bootstrap_configs(self, config_root: pathlib.Path):
223221
"type": "install",
224222
"info": {
225223
"url": mirror["url"],
226-
}
227-
}
224+
},
225+
}
228226
with (bs_mirror_path / "metadata.yaml").open("w") as file:
229227
yaml.dump(bs_mirror_yaml, file, default_flow_style=False)
230228

@@ -271,8 +269,7 @@ def _load_key(self, key: str, dest: pathlib.Path, name: str):
271269
writer.write(binary_key)
272270

273271
self._keys.append(dest)
274-
275-
272+
276273
def _key_setup(self, key_store: pathlib.Path):
277274
"""Iterate through mirror keys and load + relocate each one to key_store"""
278275

stackinator/recipe.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ def __init__(self, args):
172172
# load the optional mirrors.yaml from system config, and add any additional
173173
# mirrors specified on the command line.
174174
self._logger.debug("Configuring mirrors.")
175-
self.mirrors = mirror.Mirrors(self.system_config_path,
176-
pathlib.Path(args.cache) if args.cache else None)
175+
self.mirrors = mirror.Mirrors(self.system_config_path, pathlib.Path(args.cache) if args.cache else None)
177176

178177
# optional post install hook
179178
if self.post_install_hook is not None:

unittests/test_mirrors.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ def test_mirror_init(systems_path):
3232
"mount_specific": False,
3333
"cmdline": False,
3434
},
35-
"mirror1": {
36-
"url": "https://github.com",
37-
"enabled": True,
38-
"public_key": "../../test-gpg-pub.asc"
39-
},
35+
"mirror1": {"url": "https://github.com", "enabled": True, "public_key": "../../test-gpg-pub.asc"},
4036
"mirror2": {
4137
"url": "https://github.com/spack",
4238
"enabled": True,
43-
}
39+
},
4440
}
4541

4642
with (systems_path / "../test-gpg-pub.asc").open("rb") as pub_key_file:
@@ -142,7 +138,7 @@ def test_create_bootstrap_configs(tmp_path, systems_path):
142138
"type": "install",
143139
"info": {
144140
"url": "https://mirror.spack.io",
145-
}
141+
},
146142
}
147143

148144
mirrors_obj = mirror.Mirrors(systems_path / "mirror-ok")

0 commit comments

Comments
 (0)