Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Sep 26, 2024
1 parent 0bf9175 commit 014b685
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ build-backend = "poetry_dynamic_versioning.backend"

[tool.ruff]
line-length = 80
target-version = "py39"
target-version = "py310"

[tool.ruff.lint]
select = [
Expand All @@ -147,7 +147,7 @@ select = [
known-first-party = ["numpy", "pandas", "pyproj", "shapely"]

[tool.mypy]
python_version = 3.9
python_version = "3.10"
platform = "posix"

color_output = true
Expand Down
2 changes: 1 addition & 1 deletion src/traffic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
ep: Iterable[EntryPoint]
try:
# https://docs.python.org/3/library/importlib.metadata.html#entry-points
ep = entry_points(group="traffic.plugins") # type: ignore
ep = entry_points(group="traffic.plugins")
except TypeError:
ep = entry_points().get("traffic.plugins", [])
for entry_point in ep:
Expand Down
12 changes: 10 additions & 2 deletions src/traffic/algorithms/clustering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
from typing import TYPE_CHECKING, Any, List, Optional, Protocol, Union
from typing import (
TYPE_CHECKING,
Any,
List,
Optional,
Protocol,
TypeAlias,
Union,
)

import numpy as np
import numpy.typing as npt
Expand All @@ -10,7 +18,7 @@

from ..core import Flight, Traffic

Numeric = npt.NDArray[np.float64]
Numeric: TypeAlias = npt.NDArray[np.float64]


class TransformerProtocol(Protocol):
Expand Down
6 changes: 3 additions & 3 deletions src/traffic/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def import_submodules(package: Any, recursive: bool = True) -> Dict[str, Any]:
results.update(import_submodules(full_name))
try:
# https://docs.python.org/3/library/importlib.metadata.html#entry-points
ep = entry_points(group="traffic.console") # type: ignore
ep = entry_points(group="traffic.console")
except TypeError:
ep = {
m.name: m # type: ignore
for m in entry_points().get("traffic.console", [])
}
for entry_point in ep:
handle = entry_point.load() # type: ignore
results[entry_point.name] = handle # type: ignore
handle = entry_point.load()
results[entry_point.name] = handle
return results


Expand Down
4 changes: 2 additions & 2 deletions src/traffic/core/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2968,9 +2968,9 @@ def chart(self, *features: str) -> "alt.Chart": # coverage: ignore
if len(features) > 0:
base = base.transform_fold(
list(features), as_=["variable", "value"]
).encode(alt.Y("value:Q"), alt.Color("variable:N")) # type: ignore
).encode(alt.Y("value:Q"), alt.Color("variable:N"))

return base.mark_line() # type: ignore
return base.mark_line()

# -- Visualize with Leaflet --

Expand Down
4 changes: 2 additions & 2 deletions src/traffic/core/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def geoencode(self, **kwargs: Any) -> "alt.Chart": # coverage: ignore
"""
import altair as alt

return ( # type: ignore
return (
alt.Chart(
self.data.query(
"latitude == latitude and longitude == longitude"
Expand Down Expand Up @@ -870,7 +870,7 @@ def geoencode(self, **kwargs: Any) -> "alt.Chart": # coverage: ignore
"""
import altair as alt

return ( # type: ignore
return (
alt.Chart(self.data)
.mark_circle(**kwargs)
.encode(
Expand Down
2 changes: 1 addition & 1 deletion src/traffic/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def geoencode(
) -> "alt.LayerChart": # coverage: ignore
import altair as alt

base = alt.Chart(self).mark_geoshape()
base = alt.Chart(self).mark_geoshape() # type: ignore
cumul = []
if footprint:
params: Dict[str, Dict[str, Any]] = dict(
Expand Down

0 comments on commit 014b685

Please sign in to comment.