Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make (GS,LS)Index an indexable type in runtime (#769)
Following 5426ed9, users found themselves having to write some rather unergonomic code to reconcile Python's and a type-checker's perspectives: if TYPE_CHECKING: _MyModelGSI = GlobalSecondaryIndex["MyModel"] else: _MyModelGSI = GlobalSecondaryIndex class MyModelUserIdGSI(_MyModelGSI): """A GSI for looking up by user ID.""" ... class MyModelEmailGSI(_MyModelGSI): """A GSI for looking up by email.""" ... This addresses it by allowing users to rewrite this as: class MyModelUserIdGSI(GlobalSecondaryIndex["MyModel"]): """A GSI for looking up by user ID.""" ... class MyModelEmailGSI(GlobalSecondaryIndex["MyModel"]): """A GSI for looking up by email.""" ... Since we maintain Python 2 compatibility, we cannot assume the typing module is available so we're making a mock Generic class instead.
- Loading branch information
Showing
4 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
""" | ||
__author__ = 'Jharrod LaFon' | ||
__license__ = 'MIT' | ||
__version__ = '4.3.1' | ||
__version__ = '4.3.2' |
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
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