Skip to content

Commit 31b2ed9

Browse files
authored
chore(deps-dev): fix typing issues found by updated version of mypy (#1000)
Signed-off-by: behnazh-w <[email protected]>
1 parent fb8cd06 commit 31b2ed9

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
# https://flit.pypa.io/en/latest/pyproject_toml.html
@@ -68,7 +68,7 @@ actions = [
6868
]
6969
dev = [
7070
"flit >=3.2.0,<4.0.0",
71-
"mypy >=1.0.0,<1.14",
71+
"mypy >=1.0.0,<1.16",
7272
"types-pyyaml >=6.0.4,<7.0.0",
7373
"types-requests >=2.25.6,<3.0.0",
7474
"types-jsonschema >=4.22.0,<5.0.0",

src/macaron/database/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def __init__(self, name: str):
3434
self.name = name
3535

3636

37-
@compiler.compiles(CreateView) # type: ignore
38-
def _create_view(element, comp, **kw):
37+
@compiler.compiles(CreateView)
38+
def _create_view(element, comp, **kw): # type: ignore
3939
return f"CREATE VIEW {element.name} AS {comp.sql_compiler.process(element.selectable, literal_binds=True)}"
4040

4141

42-
@compiler.compiles(DropView) # type: ignore
43-
def _drop_view(element, comp, **kw):
42+
@compiler.compiles(DropView)
43+
def _drop_view(element, comp, **kw): # type: ignore
4444
return "DROP VIEW %s" % (element.name)
4545

4646

src/macaron/malware_analyzer/pypi_heuristics/metadata/anomalous_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def _load_defaults(self) -> tuple[int, int, int]:
8080
if defaults.has_section(section_name):
8181
section = defaults[section_name]
8282
return (
83-
section.getint("major_threshold"),
84-
section.getint("epoch_threshold"),
85-
section.getint("day_publish_error"),
83+
section.getint("major_threshold", 20),
84+
section.getint("epoch_threshold", 3),
85+
section.getint("day_publish_error", 4),
8686
)
8787
return 20, 3, 4
8888

src/macaron/malware_analyzer/pypi_heuristics/metadata/closer_release_join_date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _load_defaults(self) -> int:
3030
section_name = "heuristic.pypi"
3131
if defaults.has_section(section_name):
3232
section = defaults[section_name]
33-
return section.getint("timedelta_threshold_of_join_release")
33+
return section.getint("timedelta_threshold_of_join_release", 5)
3434
return 5
3535

3636
def _get_maintainers_join_date(self, pypi_registry: PyPIRegistry, package_name: str) -> list[datetime] | None:

src/macaron/malware_analyzer/pypi_heuristics/metadata/high_release_frequency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _load_defaults(self) -> int:
3232
section_name = "heuristic.pypi"
3333
if defaults.has_section(section_name):
3434
section = defaults[section_name]
35-
return section.getint("releases_frequency_threshold")
35+
return section.getint("releases_frequency_threshold", 2)
3636
return 2
3737

3838
def analyze(self, pypi_package_json: PyPIPackageJsonAsset) -> tuple[HeuristicResult, dict[str, JsonType]]:

src/macaron/slsa_analyzer/package_registry/jfrog_maven_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ def load_defaults(self) -> None:
141141
return
142142
section = defaults[section_name]
143143

144-
self.hostname = section.get("hostname")
144+
self.hostname = section.get("hostname", "")
145145
if not self.hostname:
146146
raise ConfigurationError(
147147
f'The "hostname" key is missing in section [{section_name}] of the .ini configuration file.'
148148
)
149149

150-
self.repo = section.get("repo")
150+
self.repo = section.get("repo", "")
151151
if not self.repo:
152152
raise ConfigurationError(
153153
f'The "repo" key is missing in section [{section_name}] of the .ini configuration file.'

src/macaron/slsa_analyzer/package_registry/maven_central_registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ def load_defaults(self) -> None:
123123
return
124124
section = defaults[section_name]
125125

126-
self.search_netloc = section.get("search_netloc")
126+
self.search_netloc = section.get("search_netloc", "")
127127
if not self.search_netloc:
128128
raise ConfigurationError(
129129
f'The "search_netloc" key is missing in section [{section_name}] of the .ini configuration file.'
130130
)
131131

132132
self.search_scheme = section.get("search_scheme", "https")
133-
self.search_endpoint = section.get("search_endpoint")
133+
self.search_endpoint = section.get("search_endpoint", "")
134134
if not self.search_endpoint:
135135
raise ConfigurationError(
136136
f'The "search_endpoint" key is missing in section [{section_name}] of the .ini configuration file.'
137137
)
138138

139-
self.registry_url_netloc = section.get("registry_url_netloc")
139+
self.registry_url_netloc = section.get("registry_url_netloc", "")
140140
if not self.registry_url_netloc:
141141
raise ConfigurationError(
142142
f'The "registry_url_netloc" key is missing in section [{section_name}] of the .ini configuration file.'

src/macaron/slsa_analyzer/package_registry/npm_registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 - 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2023 - 2025, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
"""The module provides abstractions for the npm package registry."""
@@ -74,13 +74,13 @@ def load_defaults(self) -> None:
7474
logger.debug("npm registry is disabled in section [%s] of the .ini configuration file.", section_name)
7575
return
7676

77-
self.hostname = section.get("hostname")
77+
self.hostname = section.get("hostname", "")
7878
if not self.hostname:
7979
raise ConfigurationError(
8080
f'The "hostname" key is missing in section [{section_name}] of the .ini configuration file.'
8181
)
8282

83-
self.attestation_endpoint = section.get("attestation_endpoint")
83+
self.attestation_endpoint = section.get("attestation_endpoint", "")
8484

8585
if not self.attestation_endpoint:
8686
raise ConfigurationError(

src/macaron/slsa_analyzer/package_registry/pypi_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def load_defaults(self) -> None:
9090
return
9191
section = defaults[section_name]
9292

93-
self.registry_url_netloc = section.get("registry_url_netloc")
93+
self.registry_url_netloc = section.get("registry_url_netloc", "")
9494
if not self.registry_url_netloc:
9595
raise ConfigurationError(
9696
f'The "registry_url_netloc" key is missing in section [{section_name}] of the .ini configuration file.'
@@ -105,7 +105,7 @@ def load_defaults(self) -> None:
105105
fragment="",
106106
).geturl()
107107

108-
fileserver_url_netloc = section.get("fileserver_url_netloc")
108+
fileserver_url_netloc = section.get("fileserver_url_netloc", "")
109109
if not fileserver_url_netloc:
110110
raise ConfigurationError(
111111
f'The "fileserver_url_netloc" key is missing in section [{section_name}] of the .ini configuration file.'

0 commit comments

Comments
 (0)