-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add support for namedtuple methods (issue #1076) #1810
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
ecca142
namedtuple: add (shaky) support for _replace, _asdict + naive test
elazarg 8ef445f
namedtuple: add tests and refine types
elazarg 5e429cd
minor cleanup
elazarg 0214e3c
minor cleanup
elazarg fbb75c3
flake8-ing
elazarg 17d7f8b
fix type errors
elazarg 6dd370c
fix type errors
elazarg 1370fbf
Merge branch 'namedtuple' of https://github.com/elazarg/mypy into nam…
elazarg 560eb3e
_fields will not be supported
elazarg 2627511
slight refactoring
elazarg 46475d4
restore tests for _replace and _asdict
elazarg c1dc1c7
NamedTupleTypeInfo
elazarg 763e0c0
run both Replace and AsTuple
elazarg 4b10a35
fix most of the tests
elazarg ee047f8
complete support for _replace
elazarg 725d53c
flake8-ing
elazarg 044e640
Add partial support for calling '_replace' statically
elazarg eb6534e
fix method name
elazarg aa0d5da
namedtuple tests pass. list has problems
elazarg e12bd01
tests pass. OrderedDict unsupported. cleanup still required
elazarg dc9d8da
fix line endings
elazarg 158b068
flake8-ing
elazarg 90ffb08
s/self_type/with_fallback. Fix visitor type
elazarg 9a6e6cd
uniform copy_with. typechecks.
elazarg 76d709e
uniform copy_with. typechecks.
elazarg 20bf222
rename tests to startwith NamedTuple
elazarg a2696c2
Read-only attributes. Can't set new attributes in subclasses yet
elazarg 9e1b866
update semantic namedtuple repr name
elazarg f7b531f
support _fields
elazarg 67bdafe
support _source. test for unit namedtuple
elazarg 39bce74
support _asdict()->OrderedDict as an UnboundType
elazarg a2db6a0
minor cleanup
elazarg 8784ce0
support _make and _field_types
elazarg 191de7c
namedtuple: add (shaky) support for _replace, _asdict + naive test
elazarg 6d2d6d1
namedtuple: add tests and refine types
elazarg 8819af9
minor cleanup
elazarg 9fb5137
flake8-ing
elazarg 35c30a2
fix type errors
elazarg a642a7f
_fields will not be supported
elazarg c505cbc
slight refactoring
elazarg 9f96ca7
restore tests for _replace and _asdict
elazarg 5c2d3ac
NamedTupleTypeInfo
elazarg 41ed075
run both Replace and AsTuple
elazarg 6dd568f
fix most of the tests
elazarg b18fc25
complete support for _replace
elazarg d7dbd3f
flake8-ing
elazarg 2b67380
Add partial support for calling '_replace' statically
elazarg 525c081
fix method name
elazarg 15acfe0
namedtuple tests pass. list has problems
elazarg fb9ba7f
tests pass. OrderedDict unsupported. cleanup still required
elazarg 99635c5
fix line endings
elazarg 8f61c13
flake8-ing
elazarg ff21b0c
s/self_type/with_fallback. Fix visitor type
elazarg 4c1bfe4
uniform copy_with. typechecks.
elazarg b0d78ba
uniform copy_with. typechecks.
elazarg 87c804c
rename tests to startwith NamedTuple
elazarg 6adc2f9
Read-only attributes. Can't set new attributes in subclasses yet
elazarg 7ed7b0e
update semantic namedtuple repr name
elazarg c7dc9a7
support _fields
elazarg b39925b
support _source. test for unit namedtuple
elazarg 030307e
support _asdict()->OrderedDict as an UnboundType
elazarg 12d3407
minor cleanup
elazarg 1f944fc
support _make and _field_types
elazarg 7825f79
Merge branch 'namedtuple'
elazarg 8a0ce40
merge upstream
elazarg 7978357
merge fix except Awaitable lookup
elazarg badc3f9
merge fix
elazarg c051f3f
Merge remote
elazarg 44c124b
Merge branch 'master' into namedtuple
elazarg d067c9e
fix syntax error
elazarg 42342de
Merge branch 'master' into namedtuple
elazarg a5ccc50
join/meet namedtuples as namedtuple only if attrs are equal
elazarg eaf4b99
join/meet namedtuples as namedtuple only if attrs are equal. add tests.
elazarg 9829b25
Fix conflicts:
elazarg b1988f8
Merge branch 'master' into namedtuple
elazarg 8ced59e
Merge remote-tracking branch 'upstream/master' into namedtuple
elazarg 053ee56
remove NamedTupleType
elazarg 94bb8d0
Merge remote-tracking branch 'upstream/master' into namedtuple
elazarg 71f0d78
restore semanal test
elazarg 66a77fb
fix signatures
elazarg 922dd91
_asdict() -> Dict
elazarg 6460839
_asdict() -> OrderedDict
elazarg cd5b933
use buitlins.dict; rearrange build_namedtuple_typeinfo
elazarg 4b93761
Merge remote-tracking branch 'upstream/master' into namedtuple
elazarg 500a847
remove unneeded 'class dict' from proprty.pyi
elazarg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix method name
- Loading branch information
commit eb6534e434f41be68989b16af8a47a3bbee5ea64
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
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.
Reveal the type of x.
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.
It is not tested, since the return type is AnyType (imprecisely)
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.
That seems wrong. If x is an instance of some namedtuple class,
x._replace()
clearly returns an object with the same type asx
.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.
True. I just don't know how to implement that, and thought that
AnyType
is better than nothing.