Skip to content

Commit cc22bde

Browse files
committed
Increase coverage and type hint annotations
1 parent f625002 commit cc22bde

File tree

9 files changed

+616
-148
lines changed

9 files changed

+616
-148
lines changed

relenv/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# Copyright 2025 Broadcom.
22
# SPDX-License-Identifier: Apache-2
3+
from __future__ import annotations
4+
35
import sys
46

5-
if sys.version_info < (3, 10):
7+
from relenv.common import __version__
8+
9+
MIN_SUPPORTED_PYTHON = (3, 10)
10+
11+
if sys.version_info < MIN_SUPPORTED_PYTHON:
612
raise RuntimeError("Relenv requires Python 3.10 or newer.")
713

8-
from relenv.common import __version__
14+
15+
__all__ = ["__version__"]

relenv/build/__init__.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33
"""
44
The ``relenv build`` command.
55
"""
6-
import sys
7-
import random
6+
from __future__ import annotations
7+
8+
import argparse
89
import codecs
10+
import random
911
import signal
12+
import sys
13+
from types import ModuleType
1014

11-
from . import linux, darwin, windows
12-
from .common import builds, CHECK_VERSIONS_SUPPORT
13-
14-
from ..pyversions import python_versions, Version
15-
16-
from ..common import build_arch, DEFAULT_PYTHON
15+
from . import darwin, linux, windows
16+
from .common import CHECK_VERSIONS_SUPPORT, builds
17+
from ..common import DEFAULT_PYTHON, build_arch
18+
from ..pyversions import Version, python_versions
1719

1820

19-
def platform_module():
21+
def platform_module() -> ModuleType:
2022
"""
2123
Return the right module based on `sys.platform`.
2224
"""
@@ -26,9 +28,12 @@ def platform_module():
2628
return linux
2729
elif sys.platform == "win32":
2830
return windows
31+
raise RuntimeError(f"Unsupported platform: {sys.platform}")
2932

3033

31-
def setup_parser(subparsers):
34+
def setup_parser(
35+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
36+
) -> None:
3237
"""
3338
Setup the subparser for the ``build`` command.
3439
@@ -124,7 +129,7 @@ def setup_parser(subparsers):
124129
)
125130

126131

127-
def main(args):
132+
def main(args: argparse.Namespace) -> None:
128133
"""
129134
The entrypoint to the ``build`` command.
130135

0 commit comments

Comments
 (0)