Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Expose required/non-required keys for mixed TypedDict or TypedDict base class, in runtime #7
Comments
|
Probably related: |
Potential fix for python#7. The name for the attribute comes from PEP 560. It's not clear if it's the intended use for it.
|
On one hand, this is pretty niche, but on the other hand, if you have a simple addition to the private |
MyPy documentation mentions it's possible to mix required and non-required items in TypedDict:
https://mypy.readthedocs.io/en/latest/more_types.html#mixing-required-and-non-required-items
Unfortunately, I couldn't find how to see which of
Moviekeys are required, in runtime. I can only get a list of all fields (__annotations__) and the factMovieis non-total (__total__).Alternatively I could poke into original base classes to find out which keys are required, but I it doesn't work:
I'm trying to write a function that checks if data matches its
TypedDicttype, in runtime. I can't implement it without knowing which keys are required.