Skip to content

Commit be5ad5d

Browse files
committed
Try to increase coverage.
1 parent 04c0979 commit be5ad5d

File tree

8 files changed

+451
-34
lines changed

8 files changed

+451
-34
lines changed

PyFunceble/checker/availability/base.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,35 +1034,36 @@ def try_to_query_status_from_platform(self) -> "AvailabilityCheckerBase":
10341034
data = self.platform_query_tool.pull(self.idna_subject)
10351035

10361036
if data and "status" in data:
1037-
if (
1038-
self.platform_query_tool.preferred_status_origin == "frequent"
1039-
and data["status"]["availability"]["frequent"]
1040-
):
1041-
self.status.status = data["status"]["availability"]["frequent"]
1042-
self.status.status_source = "PLATFORM"
1043-
elif (
1044-
self.platform_query_tool.preferred_status_origin == "latest"
1045-
and data["status"]["availability"]["latest"]
1046-
):
1047-
try:
1048-
# legacy
1049-
self.status.status = data["status"]["availability"]["latest"][
1050-
"status"
1051-
]
1052-
except KeyError:
1053-
self.status.status = data["status"]["availability"]["latest"]
1054-
self.status.status_source = "PLATFORM"
1055-
elif (
1056-
self.platform_query_tool.preferred_status_origin == "recommended"
1057-
and data["status"]["availability"]["recommended"]
1058-
):
1059-
self.status.status = data["status"]["availability"]["recommended"]
1060-
self.status.status_source = "PLATFORM"
1061-
1062-
PyFunceble.facility.Logger.info(
1063-
"Could define the status of %r from: Platform Lookup",
1064-
self.status.idna_subject,
1065-
)
1037+
try:
1038+
if (
1039+
self.platform_query_tool.preferred_status_origin == "frequent"
1040+
and data["status"]["availability"]["frequent"]
1041+
):
1042+
self.status.status = data["status"]["availability"]["frequent"]
1043+
self.status.status_source = "PLATFORM"
1044+
elif (
1045+
self.platform_query_tool.preferred_status_origin == "latest"
1046+
and data["status"]["availability"]["latest"]
1047+
):
1048+
try:
1049+
# legacy
1050+
self.status.status = data["status"]["availability"]["latest"][
1051+
"status"
1052+
]
1053+
except (KeyError, TypeError):
1054+
self.status.status = data["status"]["availability"]["latest"]
1055+
self.status.status_source = "PLATFORM"
1056+
elif (
1057+
self.platform_query_tool.preferred_status_origin == "recommended"
1058+
and data["status"]["availability"]["recommended"]
1059+
):
1060+
self.status.status = data["status"]["availability"]["recommended"]
1061+
self.status.status_source = "PLATFORM"
1062+
except (KeyError, TypeError):
1063+
PyFunceble.facility.Logger.info(
1064+
"Could define the status of %r from: Platform Lookup",
1065+
self.status.idna_subject,
1066+
)
10661067

10671068
PyFunceble.facility.Logger.info(
10681069
"Finished to try to query the status of %r from: Platform Lookup",

PyFunceble/checker/availability/extras/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, status: Optional[AvailabilityCheckerStatus] = None) -> None:
8989
self.regex_helper = RegexHelper()
9090

9191
def ensure_status_is_given(
92-
func: Callable[..., "ExtraRuleHandlerBase"]
92+
func: Callable[..., "ExtraRuleHandlerBase"],
9393
): # pylint: disable=no-self-argument
9494
"""
9595
Ensures that the status is given before running the decorated method.
@@ -111,7 +111,7 @@ def wrapper(self, *args, **kwargs): # pragma: no cover ## Safety!
111111
return wrapper
112112

113113
def setup_status_before(
114-
func: Callable[..., "ExtraRuleHandlerBase"]
114+
func: Callable[..., "ExtraRuleHandlerBase"],
115115
): # pylint: disable=no-self-argument
116116
"""
117117
Ensures that the status is given before running the decorated method.
@@ -130,7 +130,7 @@ def wrapper(self, *args, **kwargs): # pragma: no cover ## Safety!
130130
return wrapper
131131

132132
def setup_status_after(
133-
func: Callable[..., "ExtraRuleHandlerBase"]
133+
func: Callable[..., "ExtraRuleHandlerBase"],
134134
): # pylint: disable=no-self-argument
135135
"""
136136
Ensures that the status is given before running the decorated method.

PyFunceble/cli/entry_points/pyfunceble/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def get_default_group_data() -> List[Tuple[List[str], dict]]:
12481248

12491249

12501250
def platform_parser(
1251-
parser: Union[argparse.ArgumentParser, argparse._SubParsersAction]
1251+
parser: Union[argparse.ArgumentParser, argparse._SubParsersAction],
12521252
) -> None:
12531253
"""
12541254
Adds the platform group to the given parser.

PyFunceble/cli/system/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(self, args: Optional[argparse.Namespace] = None) -> None:
7575
self.args = args
7676

7777
def ensure_args_is_given(
78-
func: Callable[["SystemBase"], "SystemBase"]
78+
func: Callable[["SystemBase"], "SystemBase"],
7979
): # pylint: disable=no-self-argument
8080
"""
8181
Ensures that the :code:`self.args` attribute is given before launching

0 commit comments

Comments
 (0)