It's quite hard to find this repository if you don't know about it being split from mypy - so I think it'd be better to link to this repository rather than the mypy website.
I shuffled the code so that we only override `__module__` when TypedDict is instantiated (and not when it's subclassed).
And I tested that `__module__` is correct with both syntaxes.
Currently there is no way to define generic type aliases that do not
depend on their type arguments or that are just directly a type
variable.
`FlexibleAlias[T, typ]` creates a type that depends on `T` but that is
expanded to `typ` during type alias expansion.
One target use case for this is in creating conditionally defined type
aliases that depend on their argument under certain configurations but
not under others, for example:
```
if BOGUS:
Bogus = FlexibleAlias[T, Any]
else:
Bogus = FlexibleAlias[T, T]
```
* Basic support for TypedDicts with missing keys (total=False)
Only the functional syntax is supported.
* Support get(key, {}) and fix construction of partial typed dict
* Fix subtyping of non-total typed dicts
* Fix join with non-total typed dict
* Fix meet with non-total typed dicts
* Add serialization test case
* Support TypedDict total keyword argument with class syntax
* Attempt to fix Python 3.3
* Add minimal runtime `total` support to mypy_extensions
There is no support for introspection of `total` yet.
* Fix tests on pre-3.6 Python and improve introspection
Make TypedDict `total` introspectable.
* Fix lint
* Fix problems caused by merge
* Allow td['key'] even if td is not total
* Fix lint
* Add test case
* Address review feedback
* Update comment
Implements an experimental feature to allow Callable to have any kind of signature an actual function definition does.
This should enable better typing of callbacks &c.
Initial discussion: python/typing#239
Proposal, v. similar to this impl: python/typing#264
Relevant typeshed PR: python/typeshed#793
This change is a step towards removing `runtests.py` (see #1673).
The exclusion list in the flake8 configuration in `setup.cfg` has been updated
to enable running the linter from the root of the project by simply invoking
`flake8`. This enables it to leverage its own file discovery and its own
multiprocessing queue without excessive subprocessing for linting every file.
This gives a minor speed up in local test runs. Before:
total time in lint: 130.914682
After:
total time in lint: 20.379915
There's an additional speedup on Travis because linting is now only performed
on Python 3.6.
More importantly, this means flake8 is now running over all files unless
explicitly excluded in `setup.cfg`. This will help avoiding unintentional
omissions in the future (see comments on #2637).
Note: running `flake8` as a single lazy subprocess in `runtests.py` doesn't
sacrifice any parallelism because the linter has its own process pool.
Minimal whitespace changes were required to `mypy_extensions.py` but in return
flake8 will check it now exactly like it checks the rest of the `mypy/*`
codebase. Those are also done on #2637 but that hasn't landed yet.
Finally, flake8-bugbear and flake8-pyi were added to test requirements to make
the linter configuration consistent with typeshed. I hope the additional
checks will speed up future pull requests by automating bigger parts of the
code review. The pyi plugin enables forward reference support when linting
.pyi files. That means it's now possible to run `flake8` inside the typeshed
submodule or on arbitrary .pyi files during development (which your editor
could do for you), for example on fixtures. See discussion on #2629 on checks
that are disabled and why.