Skip to content

Fix utils.signal_index() under pandas>=3.0#200

Merged
hagenw merged 3 commits into
mainfrom
fix-signal-index-pandas-3.0
May 21, 2026
Merged

Fix utils.signal_index() under pandas>=3.0#200
hagenw merged 3 commits into
mainfrom
fix-signal-index-pandas-3.0

Conversation

@hagenw
Copy link
Copy Markdown
Member

@hagenw hagenw commented May 21, 2026

Ensures we use ns time resolution in audinterface.utils.signal_index() and in tests to work under pandas >=3.0.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 21, 2026

Reviewer's Guide

Normalizes time handling to nanosecond resolution in utils.signal_index() and related tests to ensure compatibility with pandas>=3.0, while simplifying several test expectations to rely on existing table structures and centralizing index construction through signal_index().

File-Level Changes

Change Details Files
Normalize signal index construction and duration handling to nanosecond Timedelta resolution for pandas>=3.0.
  • Wrap TimedeltaIndex creation for signal starts and ends with .as_unit('ns') in signal_index().
  • Ensure pd.Timedelta inputs in duration_in_seconds() are normalized via .as_unit('ns').
  • Apply .as_unit('ns') to pd.to_timedelta() outputs in duration_in_seconds() to keep consistent nanosecond precision.
audinterface/core/utils.py
Update tests to expect nanosecond-resolution timedelta indexes and to reuse existing table dataframes instead of reconstructing them manually.
  • Replace manually constructed DataFrame expectations with copies of table_df.get() whose index is overridden with the expected MultiIndex.
  • Adjust read_audio tests to construct expected MultiIndex levels using TimedeltaIndex(...).as_unit('ns') to match new nanosecond resolution.
  • Refactor segment-with-feature tests to build indexes via audinterface.utils.signal_index() instead of pd.MultiIndex.from_tuples().
  • Update process() helper in tests to compute duration with audinterface.utils.to_timedelta() and reuse that when calling signal_index().
tests/test_segment.py
tests/test_utils.py
tests/test_segment_with_feature.py
tests/test_process.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]

This comment was marked as resolved.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (72d48c8) to head (76059cd).

Additional details and impacted files
Files with missing lines Coverage Δ
audinterface/core/utils.py 100.0% <100.0%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hagenw hagenw self-assigned this May 21, 2026
@hagenw hagenw requested a review from audeerington May 21, 2026 08:51
@hagenw hagenw merged commit ca26a71 into main May 21, 2026
17 checks passed
@hagenw hagenw deleted the fix-signal-index-pandas-3.0 branch May 21, 2026 09:48
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.

2 participants