-
Notifications
You must be signed in to change notification settings - Fork 6
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 ability to use kwargs
for use with decorator
#11
base: master
Are you sure you want to change the base?
Conversation
- Use both `args_dict` and `kwargs` for `_merge_args(...)` - Remove 'used' kwargs so that they don't collide with httpx/requests
Codecov Report
@@ Coverage Diff @@
## master #11 +/- ##
==========================================
- Coverage 94.08% 93.89% -0.19%
==========================================
Files 16 16
Lines 930 934 +4
==========================================
+ Hits 875 877 +2
- Misses 55 57 +2
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
@sukram230799 Thanks for the PR - again :-) The code looks ok, could you please add a test case for this for instance by duplicating these test cases with kwargs parameters in the calls, you can call it for instance One without typing enabled: and also this one to make sure it also works for clients with typing: These test cases hopefully should cover args coming from both |
- Without typing - With typing
Okay I have not considered the in path case. So that fails... @GET('user/{username}')
def get_user(self, username):
"""Get user by user name.""" With the testcase res = client.get_user(username='swagger') I'll have a look in the code on how to fix that |
I have found an even bigger flaw. What if we use a kwarg multiple times. I don't know what the use-case would be - but it would be valid code. As I currently delete the used kwargs we would run into a problem. Back to the drawing board |
- Remove python 3.6 - Add python 3.11
Hello @bkryza
I have noticed that I'm unable to use keyword args for the decorators. I hope the examples provide an insight in what I want to achieve.
Ordered Parameters: works
I think this is one/the "decorest" way: works
But I would like to use keyword arguments: doesn't work
I have submitted a possible fix for it. But I would consider it more of a workaround, as it manipulates a pass by reference array (kwargs). But I have submitted it anyway as a point to start a discussion.
Additionally I would like to add some test cases. Where should I put them?
Thanks
Markus
args_dict
andkwargs
for_merge_args(...)