Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Nov 2, 2024
1 parent 2d942f4 commit 4fbf326
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/traffic/plugins/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def to_bluesky(
"""Generates a Bluesky scenario file."""

if minimum_time is not None:
traffic = traffic.after(minimum_time)
traffic = traffic.after(minimum_time) # type: ignore

if isinstance(filename, str):
filename = Path(filename)
Expand Down
10 changes: 4 additions & 6 deletions tests/test_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ def predict(self, X: Any) -> None:

def test_clustering() -> None:
switzerland = cast(Traffic, get_sample(collections, "switzerland"))
between = switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")

smaller = cast(
Traffic,
switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")
.assign_id()
.eval(max_workers=4),
)
assert between is not None

smaller = cast(Traffic, between.assign_id().eval(max_workers=4))

t_clustering = smaller.clustering(
nb_samples=15,
Expand Down
8 changes: 3 additions & 5 deletions tests/test_cpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
def test_cpa() -> None:
switzerland = cast(Traffic, get_sample(collections, "switzerland"))

smaller = (
switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")
.assign_id()
.eval()
)
between = switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")
assert between is not None
smaller = between.assign_id().eval()
assert smaller is not None

cpa = smaller.closest_point_of_approach(
Expand Down
5 changes: 3 additions & 2 deletions tests/test_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def test_generation() -> None:
def compute_timedelta(df: pd.DataFrame) -> pd.Series:
return (df.timestamp - df.timestamp.min()).dt.total_seconds()

between = switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")
assert between is not None
smaller = (
switzerland.between("2018-08-01 12:00", "2018-08-01 14:00")
.assign_id()
between.assign_id()
.resample(10)
.compute_xy(projection=EuroPP())
.assign(timedelta=compute_timedelta)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def test_chaining_with_lambda() -> None:

def test_none() -> None:
assert switzerland.query("altitude > 60000") is None
assert switzerland.after("2018-08-01").before("2018-08-01") is None
after = switzerland.after("2018-08-01")
assert after is not None
assert after.before("2018-08-01") is None
assert switzerland.iterate_lazy().query("altitude > 60000").eval() is None


Expand Down

0 comments on commit 4fbf326

Please sign in to comment.