-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement type hinting for 3.11, support simple Protocols, clean up internals and document (rev2) #6
Merged
autumnjolitz
merged 16 commits into
master
from
bugfix/master/relax-restrictions-backport
Jun 18, 2024
Merged
Implement type hinting for 3.11, support simple Protocols, clean up internals and document (rev2) #6
autumnjolitz
merged 16 commits into
master
from
bugfix/master/relax-restrictions-backport
Jun 18, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autumnjolitz
force-pushed
the
bugfix/master/relax-restrictions-backport
branch
from
June 17, 2024 23:47
65ac67e
to
a3363fe
Compare
autumnjolitz
force-pushed
the
bugfix/master/relax-restrictions-backport
branch
from
June 18, 2024 00:20
45a89d3
to
f716e85
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rename
Atomic
toAtomicMeta
to signify that it is a metaclassType[T]
Add
BaseAtomic
into the types produced byAtomicMeta
which allows for a fastisinstance()
checks and representing in a type hinter!BaseAtomic
fields that actually are on the metaclass to further the type checker fiction/inability to handle metaclass representation.Make
about.py
contain a parsed version tuple using thepackaging
project and a pre-processing phase in setuptoolsabout.py
-writing to a function so only the act of aattr: callable
would trigger itAdd doctests to pytest discovery
Remove
to_json
everywhere except on the actual type-class instance (non-inheritable to class instances)__json__
is a lot less invasive, obvious to override and won’t occupy a public variable name unliketo_json
Enhance
asjson
to handle instruct's exception typesAdd
__json__
outputs forTypeError
,ValueError
respectivelythe result type object of
parse_typedef(List[Union[str, int]]) -> Type[List[Union[str, int]]]
now can be instantiated and it will attempt to best effort intercept incorrect types (i.e. whenappend
ing a value to aList[T]
or setting a key on a Mapping).for
.add`parse_typedef(Literal[1,2])
returns a single type now 😌 (used to be each literal value had its own unique types 😰)SimpleBase._create_invalid_type
now extends the list of allowed types in the error message forLiteral[…]
valuesTODO: allow
parse_typedef
to work on a class that inherits Protocol