Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warnings when using positional arguments in container constructors #1972

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

stephprince
Copy link
Contributor

@stephprince stephprince commented Oct 17, 2024

Motivation

Fix #1968. Add warnings to Container constructor methods when using positional arguments.

TODO

  • change PR target to merge into 3.0.0 branch for upcoming major release

How to test the behavior?

from pynwb import TimeSeries

TimeSeries('name', [10, 11, 12, 13], 'V', timestamps=[0, 1, 2, 3])

Output:

<stdin>:1: FutureWarning: TimeSeries.__init__: Using positional arguments for this method is discouraged and will be deprecated in a future major release. Please use keyword arguments to ensure future compatibility.

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running ruff check . && codespell from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release-3.0.0@56d783c). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-3.0.0    #1972   +/-   ##
================================================
  Coverage                 ?   91.86%           
================================================
  Files                    ?       27           
  Lines                    ?     2692           
  Branches                 ?      703           
================================================
  Hits                     ?     2473           
  Misses                   ?      145           
  Partials                 ?       74           
Flag Coverage Δ
integration 72.65% <83.33%> (?)
unit 83.32% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stephprince stephprince changed the base branch from dev to release-3.0.0 October 17, 2024 17:13
@stephprince stephprince marked this pull request as ready for review October 17, 2024 17:36
@stephprince stephprince requested a review from rly October 17, 2024 17:36
@stephprince stephprince merged commit b5e5629 into release-3.0.0 Oct 24, 2024
23 of 24 checks passed
@stephprince stephprince deleted the positional-arg-warnings branch October 24, 2024 00:41
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.

[Feature]: Warn when using positional arguments in container constructors
2 participants