Skip to content

Commit 4866ee5

Browse files
committed
MyPy / Black fixes
1 parent 36fd7f7 commit 4866ee5

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/relic/sga/core/cli.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111
class RelicSgaCli(CliPluginGroup):
1212
GROUP = "relic.cli.sga"
1313

14-
def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser:
14+
def _create_parser(
15+
self, command_group: Optional[_SubParsersAction] = None
16+
) -> ArgumentParser:
1517
if command_group is None:
1618
return ArgumentParser("sga")
1719
else:
1820
return command_group.add_parser("sga")
1921

2022

2123
class RelicSgaUnpackCli(CliPlugin):
22-
23-
def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser:
24+
def _create_parser(
25+
self, command_group: Optional[_SubParsersAction] = None
26+
) -> ArgumentParser:
2427
parser: ArgumentParser
2528
if command_group is None:
2629
parser = ArgumentParser("unpack")
@@ -38,7 +41,7 @@ def command(self, ns: Namespace) -> Optional[int]:
3841

3942
print(f"Unpacking `{infile}`")
4043

41-
def _callback(_1: FS, srcfile: str, _2: FS, _3: str):
44+
def _callback(_1: FS, srcfile: str, _2: FS, _3: str) -> None:
4245
print(f"\t\tUnpacking File `{srcfile}`")
4346

4447
fs.copy.copy_fs(f"sga://{infile}", f"osfs://{outdir}", on_copy=_callback)
@@ -49,7 +52,9 @@ def _callback(_1: FS, srcfile: str, _2: FS, _3: str):
4952
class RelicSgaPackCli(CliPluginGroup):
5053
GROUP = "relic.cli.sga.pack"
5154

52-
def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> ArgumentParser:
55+
def _create_parser(
56+
self, command_group: Optional[_SubParsersAction] = None
57+
) -> ArgumentParser:
5358
parser: ArgumentParser
5459
if command_group is None:
5560
parser = ArgumentParser("pack")
@@ -59,4 +64,3 @@ def _create_parser(self, command_group: Optional[_SubParsersAction] = None) -> A
5964
# pack further delegates to version plugins
6065

6166
return parser
62-

tests/test_cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import io
22
import subprocess
3+
34
# Local testing requires running `pip install -e "."`
45
from contextlib import redirect_stdout
56
from typing import Sequence
@@ -19,6 +20,7 @@ def test_run(self, args: Sequence[str], output: str, exit_code: int):
1920

2021
def test_run_with(self, args: Sequence[str], output: str, exit_code: int):
2122
from relic.core.cli import cli_root
23+
2224
with io.StringIO() as f:
2325
with redirect_stdout(f):
2426
status = cli_root.run_with(*args)
@@ -34,7 +36,7 @@ def test_run_with(self, args: Sequence[str], output: str, exit_code: int):
3436
_SGA_UNPACK_HELP = ["sga", "unpack", "-h"], """usage: relic sga unpack [-h]""", 0
3537

3638
_TESTS = [_SGA_HELP, _SGA_PACK_HELP, _SGA_UNPACK_HELP]
37-
_TEST_IDS = [' '.join(_[0]) for _ in _TESTS]
39+
_TEST_IDS = [" ".join(_[0]) for _ in _TESTS]
3840

3941

4042
@pytest.mark.parametrize(["args", "output", "exit_code"], _TESTS, ids=_TEST_IDS)

0 commit comments

Comments
 (0)