-
Notifications
You must be signed in to change notification settings - Fork 32
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 Python type annotation transformation options #79
Conversation
I'm not sure what makes sense as far as defaults for all of these options. |
7efd151
to
91160f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're using sphinx-jinja
, we could probably throw in some docs about domain-specific parameter object types from
DEFAULT_OBJECT_DESCRIPTION_OPTIONS: List[Tuple[str, dict]] = [ |
The booleans make sense. In a perfect world, I think that I can't think of any objections to any of this. Let me give it a spin on my CirPy_nRF24 project... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot that I have avoided using typing
in my CirPy_nRF24 lib because CircuitPython doesn't have the a ported variant of CPython's typing
module (due to limited memory resources). The good news is that nothing is broken.
What do you think about the |
I actually like that change. I think there was a recent PEP that now prefers the I guess some square brackets would help differentiate from other data in the signature (like default values). Since python uses the |
An example where concise literals are ambiguous is the following: class Foo:
pass
def foo(t: Literal[Foo]):
pass
foo(Foo) With the concise literals transform, this would be documented as: foo(t: Foo) which is incorrect. |
Is there a case when a Really like these additions, by the way!! 🔥 |
Probably the 1-argument Literal would only be used as part of a larger type, e.g. There is still an ambiguity: class Foo: pass
class Bar: pass
def foo(t: Literal[Foo, Bar]): pass Here foo(t: Foo | Bar) |
91160f9
to
34cb7cf
Compare
I added an additional restriction to only use the concise syntax for constants. That avoids the ambiguity. |
No description provided.