-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Minor refactors and pylint fixes #478
Conversation
I'd like to finish this before releasing 6.0.0. There is a few other things I'd like to change. And there's stuff I'd like to double-check.
|
Unneeded because
I confirm it does. But towards an order consistent with the other parsers, so let's stick with this and do it in a major update. |
I'd like to merge this and release 6.0.0. Extension of typing to all the code can be done later. |
I agree with you about making pyramid consistent with the other parsers. I think we should add a changelog note about this though, since it's likely to otherwise be confusing. I've reviewed all of the changes and it all looks good. Will wait for your answer on the changelog before merging though. |
Sure, it deserves a CHANGELOG entry. I can include it in the PR before merging. BTW, I was convinced the pyramid parser could be refactored to avoid duplicating the core parser. Basically, the idea was that the arguments may vary but we could move the try/except logic into a |
I've been digging through Pyramid to try to figure out how it's making the decision (it must use I also see that they generate a view func with that signature if none is provided and you're using a renderer instead: So somehow the pyramid view inspection is broken by the layer of decoration, and the I'm still trying to see where this is deduced, in the hope that it makes it possible to somehow tell pyramid what we want. |
Okay! I found where One of those steps checks if it's a Popping open an interpreter really quick: >>> import inspect
>>> def foo(*args, **kwargs):
... pass
...
>>> inspect.getfullargspec(foo)
FullArgSpec(args=[], varargs='args', varkw='kwargs', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={}) And I don't know if we want to try to unify the pyramid parser with the core one in this branch. The thing which occurs to me is that we could -- because we know about pyramid's behavior -- do this: def takes_one_arg(func):
return len(inspect.getfullargspec(func).args) == 1
def parse_args(...):
...
if takes_one_arg(func):
@functools.wraps(func)
def wrapped(request, *args, **kwargs):
...
else
@functools.wraps(func)
def wrapped(*args, **kwargs):
...
return wrapped but that seems worse to me than the current way of supporting it (with a specialized version of |
Yeah, we can't do any better, I'm afraid. No big deal. Thanks for your help on this. I guess we can merge this and release, then. |
@lafrech, just so we're on the same page, this is merged but I'm not tagging/releasing things until/unless we have a conversation about it to confirm that I should. (I assume release procedure is just the same as the marshmallow one?) |
This is the right thing to do. I see nothing else to add so we can release. I assume @sloria would have told us if he wanted to postpone the release.
Exactly. I always refer to this file. You may do it or I'll do it when I get the time. Great ! |
🚢 🇮🇹 |
WIP