Skip to content

Commit

Permalink
ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Jan 15, 2025
1 parent 8d320d5 commit 2d76098
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 21 deletions.
12 changes: 6 additions & 6 deletions src/traffic/algorithms/cpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def combinations(
continue

clipped = t_.query(
f'x >= {flight.min("x")} - {lateral_separation} and '
f'x <= {flight.max("x")} + {lateral_separation} and '
f'y >= {flight.min("y")} - {lateral_separation} and '
f'y <= {flight.max("y")} + {lateral_separation} and '
f'altitude >= {flight.min("altitude")} - {vertical_separation} and '
f'altitude <= {flight.max("altitude")} + {vertical_separation} and '
f"x >= {flight.min('x')} - {lateral_separation} and "
f"x <= {flight.max('x')} + {lateral_separation} and "
f"y >= {flight.min('y')} - {lateral_separation} and "
f"y <= {flight.max('y')} + {lateral_separation} and "
f"altitude >= {flight.min('altitude')} - {vertical_separation} and "
f"altitude <= {flight.max('altitude')} + {vertical_separation} and "
f'timestamp <= "{flight.stop}" and '
f'timestamp >= "{flight.start}" '
)
Expand Down
6 changes: 3 additions & 3 deletions src/traffic/algorithms/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ def build_traffic(
return Traffic(df).compute_latlon_from_xy(projection)
# df = compute_latlon_from_xy(df, projection=projection)
if set(["track", "groundspeed"]).issubset(set(self.features)):
assert (
coordinates is not None
), "coordinates attribute shouldn't be None"
assert coordinates is not None, (
"coordinates attribute shouldn't be None"
)
# integrate lat/lon in df
df = compute_latlon_from_trackgs(
df, n_samples, n_obs, coordinates, forward=forward
Expand Down
2 changes: 1 addition & 1 deletion src/traffic/core/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def guess_airport(

if warning_distance is not None and airport.distance > warning_distance:
_log.warning(
f"Closest airport is more than {warning_distance*1e-3}km away "
f"Closest airport is more than {warning_distance * 1e-3}km away "
f" (distance={airport.distance})"
)
return airport
3 changes: 1 addition & 2 deletions src/traffic/core/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2776,8 +2776,7 @@ def fail_silent() -> Flight:
else:
df = data if isinstance(data, pd.DataFrame) else data.data
df = df.query(
"icao24 == @self.icao24 and "
"@self.start < mintime < @self.stop"
"icao24 == @self.icao24 and @self.start < mintime < @self.stop"
)

if df is None or df.shape[0] == 0:
Expand Down
2 changes: 1 addition & 1 deletion src/traffic/core/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def flight_iterator(
msg = (
"The @flight_iterator decorator can only be set on methods "
' annotated with an Iterator["Flight"] return type.'
f' Got {fun.__annotations__["return"]}'
f" Got {fun.__annotations__['return']}"
)
if not (
fun.__annotations__["return"] == Iterator["Flight"]
Expand Down
4 changes: 2 additions & 2 deletions src/traffic/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def __rich_repr__(self) -> rich.repr.Result:
yield "description", self.description
yield (
"frequency",
f"{self.frequency}{'kHz' if self.type=='NDB' else 'MHz'}",
f"{self.frequency}{'kHz' if self.type == 'NDB' else 'MHz'}",
)

def __repr__(self) -> str:
Expand All @@ -326,7 +326,7 @@ def __repr__(self) -> str:
f"{self.name} ({self.type}): {self.latitude} {self.longitude}"
f" {self.altitude:.0f} "
f"{self.description if self.description is not None else ''}"
f" {self.frequency}{'kHz' if self.type=='NDB' else 'MHz'}"
f" {self.frequency}{'kHz' if self.type == 'NDB' else 'MHz'}"
)


Expand Down
3 changes: 1 addition & 2 deletions src/traffic/core/traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,7 @@ def agg_latlon(
See how to make `flight density heatmaps </scenarios/heatmaps.html>`_
"""
warnings.warn(
"agg_latlon will disappear in future versions. "
"Use agg_xy instead",
"agg_latlon will disappear in future versions. Use agg_xy instead",
DeprecationWarning,
)

Expand Down
6 changes: 2 additions & 4 deletions src/traffic/data/eurocontrol/aixm/navpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def parse_data(self) -> None:
}

extension = point.find(
"aixm:timeSlice/aixm:DesignatedPointTimeSlice/"
"aixm:extension",
"aixm:timeSlice/aixm:DesignatedPointTimeSlice/aixm:extension",
ns,
)
if extension is not None:
Expand Down Expand Up @@ -231,8 +230,7 @@ def parse_data(self) -> None:
}

extension = point.find(
"aixm:timeSlice/aixm:DesignatedPointTimeSlice/"
"aixm:extension",
"aixm:timeSlice/aixm:DesignatedPointTimeSlice/aixm:extension",
ns,
)
if extension is not None:
Expand Down

0 comments on commit 2d76098

Please sign in to comment.