Skip to content

Add type annotations to metrics.py#99

Open
arpitjain099 wants to merge 1 commit into
dbetchkal:mainfrom
arpitjain099:chore/type-hints-metrics
Open

Add type annotations to metrics.py#99
arpitjain099 wants to merge 1 commit into
dbetchkal:mainfrom
arpitjain099:chore/type-hints-metrics

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

Adds type annotations to all 18 functions (and the Quantile helper class)
in metrics.py, which previously had zero annotation coverage. Uses
from __future__ import annotations for native 3.12+ syntax.

Changes:

  • Parameter and return type annotations for all public functions:
    get_obs_periods, clip_events_to_time_period, get_noise_events,
    get_all_geo_stats, calculate_spatial_stats, clip_srcid_to_time_period,
    get_all_srcid_stats, plot_events, circular_sliding_avg,
    find_circular_peaks, endpoints_around_active, identify_stereotypical_tracks
  • Internal helpers annotated too: _split_events, _time_binned_df,
    _agg_conf_intervals, _split_interval_by_hour
  • Quantile class methods annotated with init -> None and call -> float
  • Added Iterator import from collections.abc for the generator function

Similar in style to #98 (computation.py) and #91 (layered_active_space.py).
No runtime behavior changes.

Annotate all 18 functions (plus the Quantile helper class) with
parameter and return types. Uses `from __future__ import annotations`
for native Python 3.12+ syntax (tuple, list, X | None). Also adds
`Iterator` from collections.abc for the _split_interval_by_hour
generator.

Functions covered: get_obs_periods, clip_events_to_time_period,
get_noise_events, _split_events, _time_binned_df, _agg_conf_intervals,
get_all_geo_stats, calculate_spatial_stats, clip_srcid_to_time_period,
get_all_srcid_stats, _split_interval_by_hour, plot_events,
circular_sliding_avg, find_circular_peaks, endpoints_around_active,
identify_stereotypical_tracks.

Signed-off-by: arpitjain099 <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant