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

fix(typing): improve decorator type hinting (Sourcery refactored) #653

Closed
wants to merge 3 commits into from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Nov 15, 2023

Pull Request #646 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/pytest-dev/pytest-bdd pull/646/head
    git merge --ff-only FETCH_HEAD
    git push

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Help us improve this pull request!

The type hinting for the most commonly used decorators were incomplete,
resulting in decorated functions being obscured.

This makes use of the special type variable `ParamSpec` which allows the
type hinting a view into the parameters of a function. As ``ParamSpec`
was introduced in Python 3.10, `ParamSpec` is imported from the
`typing_extensions` module instead of the standard library.

I have also taken the opportunity to fix other instances of `Callable`
type hints missing their arguments.

Signed-off-by: JP-Ellis <[email protected]>
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5707669) 95.45% compared to head (ebd76f5) 96.21%.
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #653      +/-   ##
==========================================
+ Coverage   95.45%   96.21%   +0.75%     
==========================================
  Files          49       49              
  Lines        1783     1874      +91     
  Branches      195      250      +55     
==========================================
+ Hits         1702     1803     +101     
+ Misses         53       49       -4     
+ Partials       28       22       -6     

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

Comment on lines +248 to 251
if contexts := list(templated_scenario.examples.as_contexts()):
return [pytest.param(context, id="-".join(context.values())) for context in contexts]
else:
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall having changed this, and I think this is an auto-fix by Ruff. Let me know if you want me to revert this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something Sourcery did, I'll first merge your PR once comments are addressed, then review this one with the correct diff

@sourcery-ai sourcery-ai bot closed this Dec 2, 2023
@sourcery-ai sourcery-ai bot deleted the sourcery/pull-646 branch December 2, 2023 21:07
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