Skip to content

Commit fe20a67

Browse files
committed
linting
1 parent 57d0685 commit fe20a67

3 files changed

Lines changed: 11 additions & 22 deletions

File tree

stackinator/mirror.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
from typing import Optional, Dict
1+
from typing import Optional, List, Dict
22
import base64
33
import io
44
import os
55
import pathlib
6-
import shutil
7-
import urllib.error
8-
import urllib.request
96
import requests
107
import yaml
118

@@ -67,9 +64,7 @@ def _load_mirrors(self, cmdline_cache: Optional[pathlib.Path]) -> Dict[str, Dict
6764
buildcache = mirrors.get("buildcache")
6865
if buildcache and buildcache.get("enabled", True):
6966
if not buildcache.get("private_key"):
70-
raise MirrorError(
71-
"Mirror build cache config is missing a required 'private_key' path."
72-
)
67+
raise MirrorError("Mirror build cache config is missing a required 'private_key' path.")
7368
self.build_cache_mirror = "buildcache"
7469
enabled_mirrors["buildcache"] = buildcache
7570
else:
@@ -123,7 +118,7 @@ def _load_cmdline_cache(self, cache_config_path: pathlib.Path) -> Dict:
123118
"enabled": True,
124119
"mount_specific": True,
125120
"private_key": raw["key"],
126-
"cmdline": True
121+
"cmdline": True,
127122
}
128123

129124
self._logger.warning(
@@ -183,7 +178,7 @@ def _create_spack_mirrors_yaml(self, dest: pathlib.Path):
183178
url = mirror["url"]
184179

185180
# Make the mirror path specific to the mount point
186-
if(name=="buildcache"):
181+
if name == "buildcache":
187182
if mirror["mount_specific"] and self._mount_point is not None:
188183
url = url.rstrip("/") + "/" + self._mount_point.as_posix().lstrip("/")
189184

@@ -226,8 +221,8 @@ def _create_bootstrap_configs(self, config_root: pathlib.Path):
226221
"type": "install",
227222
"info": {
228223
"url": mirror["url"],
229-
}
230-
}
224+
},
225+
}
231226
with (bs_mirror_path / "metadata.yaml").open("w") as file:
232227
yaml.dump(bs_mirror_yaml, file, default_flow_style=False)
233228

@@ -274,8 +269,7 @@ def _load_key(self, key: str, dest: pathlib.Path, name: str):
274269
writer.write(binary_key)
275270

276271
self._keys.append(dest)
277-
278-
272+
279273
def _key_setup(self, key_store: pathlib.Path):
280274
"""Iterate through mirror keys and load + relocate each one to key_store"""
281275

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)