-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dependencies: Use a TypedDict for Dependency keyword arguments
There are a couple of annoyances around the way Python's TypedDicts work that we should get out of the way: 1) A TypedDict keeps it's `total` status, so you can't do something like: ```python from interpreter.type_checking import FuncDependency class DependencyKWs(FuncDependency, total=False): pass ``` All of the arguments from FuncDependency remain required. 2) The "functional" form of `TypedDict` requires a literal for it's arguments, so you can't do something like: ```python _VALUES = {...} FuncDependency = TypedDict('FuncDependency', _VALUES) DependencyKWs = TypedDict('DependencyKWs', _VALUES, total=False) And, there are some arguments `dependency()` that are not passed to the lower levels, but are interpreter constructs. Likewise, some of the Dependency classes take additional kwargs that are not part of the dependency() DSL API. So we have to have two different TypedDicts, which is unfortunate. Additionally, TypedDicts must define all allowed keys, there is no way to define "extra keys". This means that implementing this change as a series of small commits would would require hundreds of `# type: ignore` comments to be introduced and removed across the range. That kind of noise seems counterproductive to the purpose of having small commits, since there will end up being loads of churn introduced by such a series of commits.
- Loading branch information
Showing
24 changed files
with
188 additions
and
138 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
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
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
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
Oops, something went wrong.