-
Notifications
You must be signed in to change notification settings - Fork 71
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
Improve type definition of Mocker.__call__
#244
Improve type definition of Mocker.__call__
#244
Conversation
Responding to comment. I looked this over, there's a few bits I just need to figure out:
Anyway, that's my very late night rambling to do list, but it's probably fine. Still if there's a real functional change in their that you're waiting on I'd just submit that as something contained and reviewable on its own. That's a lot easier to review than something that rewrites a lot of syntax for no obvious benefit. |
Yes sorry would have probably been easier in separate commits.
The only functional change can be looked up here.
Do you want me to make a separate PR for it?
When writing stub files, you can usually make use of new typing features (in this case, the new union style syntax and builtins supporting subscripting:
It could be merged back into the source files indeed. However, the library seems to be doing a lot of magic, so it might be tricky in some places (whereas type stubs can express anything, even if it's not written the same way in the source). I'll investigate on that, and could make a PR with the types merged back if you are open to it (as it might take some review effort) |
Yea, please extract the functional bit, that looks pretty trivial and i can just merge it straight away. For the rest, sure, but it'll just kind of be on the todo list as i don't see a user impact that has any urgency. |
b74886d
to
51d0a73
Compare
Mocker.__call__
I've merged all the python2 removal code. If you rebase it now the tests should work. |
51d0a73
to
8f5dac3
Compare
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [requests-mock](https://requests-mock.readthedocs.io/) ([source](https://togithub.com/jamielennox/requests-mock)) | `==1.11.0` -> `==1.12.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/requests-mock/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/requests-mock/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/requests-mock/1.11.0/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/requests-mock/1.11.0/1.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>jamielennox/requests-mock (requests-mock)</summary> ### [`v1.12.0`](https://togithub.com/jamielennox/requests-mock/releases/tag/1.12.0) [Compare Source](https://togithub.com/jamielennox/requests-mock/compare/1.11.0...1.12.0) #### What's Changed - Update copyright year by [@​KrishanBhasin](https://togithub.com/KrishanBhasin) in [https://github.com/jamielennox/requests-mock/pull/239](https://togithub.com/jamielennox/requests-mock/pull/239) - Remove py2 by [@​jamielennox](https://togithub.com/jamielennox) in [https://github.com/jamielennox/requests-mock/pull/248](https://togithub.com/jamielennox/requests-mock/pull/248) - Allow `raw` parameter to accept callable like body elements by [@​jamielennox](https://togithub.com/jamielennox) in [https://github.com/jamielennox/requests-mock/pull/249](https://togithub.com/jamielennox/requests-mock/pull/249) - Improve type definition of `Mocker.__call__` by [@​Viicos](https://togithub.com/Viicos) in [https://github.com/jamielennox/requests-mock/pull/244](https://togithub.com/jamielennox/requests-mock/pull/244) - Drop PBR Support by [@​jamielennox](https://togithub.com/jamielennox) in [https://github.com/jamielennox/requests-mock/pull/250](https://togithub.com/jamielennox/requests-mock/pull/250) - fix(mocker.pyi): fix Mocker class type hints by [@​pavellos21](https://togithub.com/pavellos21) in [https://github.com/jamielennox/requests-mock/pull/251](https://togithub.com/jamielennox/requests-mock/pull/251) - Remove unused `six` dependency by [@​Viicos](https://togithub.com/Viicos) in [https://github.com/jamielennox/requests-mock/pull/252](https://togithub.com/jamielennox/requests-mock/pull/252) #### New Contributors - [@​KrishanBhasin](https://togithub.com/KrishanBhasin) made their first contribution in [https://github.com/jamielennox/requests-mock/pull/239](https://togithub.com/jamielennox/requests-mock/pull/239) - [@​Viicos](https://togithub.com/Viicos) made their first contribution in [https://github.com/jamielennox/requests-mock/pull/244](https://togithub.com/jamielennox/requests-mock/pull/244) - [@​pavellos21](https://togithub.com/pavellos21) made their first contribution in [https://github.com/jamielennox/requests-mock/pull/251](https://togithub.com/jamielennox/requests-mock/pull/251) **Full Changelog**: jamielennox/requests-mock@1.11.0...1.12.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/pyrainbird). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Mocker.__call__
, with basic support 1.pyi
files in a special way).Footnotes
ParamSpec
andConcatenate
can't be used to add them
parameter (for two reasons: there's no way to concatenate to kwargs, and even ifkw
is not set on theMocker
instance, concatenating a posarg is only possible if it is added first (i.e.Concatenate[P, Mocker]
is not possible)) ↩