Ecosyste.ms: OpenCollective
An open API service for software projects hosted on Open Collective.
github.com/python/mypy
Optional static typing for Python
https://github.com/python/mypy
Use lazy initialization to avoid method calls in `__init__`. This allows
mypyc to infer more al...
This makes mypy a bit faster and the implementation seems a little
cleaner as well.
(Various...
45bed9c994b1082a050e26958c1847b53ad82357 authored about 2 years agoThese errors are already reported by the (new) semantic analyzer.
I've discovered this while...
20e9733e32ddff6ecbaddb7be61ae36b6c4978d0 authored about 2 years ago
This one would occur because we set the errors module with global
options, instead of per-modul...
Enums are exploded into Union of Literal when narrowed.
Conditional branches on enum values c...
1f8621c483baf4641c317ad755f814bcb9e41296 authored about 2 years agoI want to get rid of all the bogus types eventually.
61a21baf7e37069b829f19bd74416c01f1b84404 authored about 2 years agoResolves the following warning:
![image](https://user-images.githubusercontent.com/1350584/20...
632304f90923ba38483d94de3cf58d486966f4f0 authored about 2 years ago
This helps with await-related errors introduced in #12958, in
particular, which are expensive t...
This makes the implementation of hasattr() checks faster (introduced in
#13544).
In particul...
01a1bf6bf4615e548b195b657756f9c57f8631a4 authored about 2 years agoc246a527008c28cf4970b28b85f7ccb5ce6ba285 authored about 2 years ago
Stubtest currently has both false-positives and false-negatives when it
comes to verifying cons...
The docs build is currently failing on `master`: see e.g.
https://github.com/python/mypy/action...
The script compiles some mypy commits in parallel and then measures how
long each version takes...
Mypyc can't optimize context managers yet, so it's best to avoid them in
hot code paths.
Thi...
87335997808207a138125a2f52fb8f4dc5a69fa3 authored about 2 years ago
This helps mypyc, since accessing mutable attributes of singleton
instances is faster than acce...
I measured a 1% performance improvement in self check.
2d5108b343ad11f5e2087e9e8ed55202cbd3237c authored about 2 years agoSwitch :py:func:type to py:class:type in type_narrowing.rst. The former does not render properly...
cb1d1a0baba37f35268cb605b7345726f257f960 authored about 2 years agoThis reverts commit dbcbb3f5c3ef791c98088da0bd1dfa6cbf51f301.
The indentation in generated co...
f7ed65b0ff3b1bb82ff5e305129bfc251dfeec1d authored about 2 years ago
`in` could narrow unions of TypeDicts, e.g.
```python
class A(TypedDict)
foo: int
@fina...
41574e0cc521987376dc8c149095b3483aff80ff authored about 2 years agoUse a faster type query visitor and reuse visitor across calls.
This should speed up type che...
7ed4f5ef3cff221505a54851a23fd80fa0a412c6 authored about 2 years ago
Mypyc isn't good at compiling nested functions, and this one was in one
of the hottest code pat...
Avoid the use of a nested function, which are a bit slow when compiled
with mypyc. Also avoid a...
Only perform type variable freshening if it's needed, i.e. there is a
nested generic callable, ...
The implementation copied lots of callable types even when not using
the new feature, which was...
Removals from `stubinfo.py`:
- `atomicwrites` is archived and deprecated at runtime; stubs were...
Enable the `--debug-serialize` option to help catch issues during
serialization which would nor...
Currently, `mypy_primer` sets `--cache-dir=/dev/null` which disables
cache generation. This can...
This PR only adds the existing `TypeVar` support for the
`typing_extensions` variant.
I.e. it ...
In particular, ran into an issue with an `if TYPE_CHECKING` case, so I
added a test for that.
A similar case was addressed in #14176 but I missed the part where it
doesn't need to be define...
This adds support for try/except/finally/else check.
The implementation ended up pretty compl...
96ac8b3e71c743b02ea4e3c84da0248659e40f82 authored about 2 years ago
Now mypy can figure out the values of final variables even if the
initializer has some operatio...
Source commit:
https://github.com/python/typeshed/commit/9bddd3a3f1abfaf6335c2139a77ff1ff69eb...
369525071a548c03ddea1c428207c8801e73192f authored about 2 years agod62be28cc85efd759d808b983e1cf55242c2d71a authored about 2 years ago
Fixed #13103
Adds a check to class attribute access to ensure it isn't a defined
slot.
`#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7`
For example, this is true for Python 3.7...
42dc1c431ed252de41f96d65367623ebac9e1bb8 authored about 2 years agoThis came up in https://github.com/python/typeshed/pull/9347
b0003aff931c12298fb462aa4cece18610ee4d05 authored about 2 years ago
Rename `partially-defined` to `possibly-undefined` and `use-before-def`
to `used-before-def`.
...
Last time i checked it wasn't the 1960's. So I think the CI could be
colorized.
Configured p...
695ea3017fee084c9d2ec17d9b28f8af905e3b63 authored about 2 years ago
Now that the fallback is available, we can construct TupleTypes instead
of TypeLists which will...
A tuple such as `tuple[i64, i64]` can't have a dedicated error value, so
use overlapping error ...
A quick patch to enable the following scenario:
```python
@define
class C:
a: Final[in...
Now these two samples are identical:
```ini
[mypy]
enable_error_code =
truthy-bool,
r...
Now that daemon is more mature and stable I think we can attract some
more attention to it.
Several issues that I have seen recently could be fixed by
enabling/disabling an error code. I ...
Ref #13685
cc @Michael0x2a @JukkaL @hauntsaninja
Co-authored-by: Alex Waygood <Alex.Waygo...
7785b6035e919180593f027305171e4a844a947b authored about 2 years agoSee https://github.com/lbolla/emacs-flycheck-mypy#readme
734a0b96b79f20b3290ca5fee97c749ccb2e308f authored about 2 years agob8c03ab6809aab56928f3cd865edb44944a600a2 authored about 2 years ago
Closes https://github.com/mypyc/mypyc/issues/911
Like the title says, this PR adds support fo...
d5e96e381f72ad3fafaae8707b688b3da320587d authored about 2 years ago
Previously --fast-exit would actually disable the fast_exit option. Now
it behaves as expected ...
ceb976f1b9bc4c3ae7cd07a5222ec076f6c7ab72 authored about 2 years ago
We want to eventually decomission the use of TypeList for
constraints/expanded values of TypeVa...
Fixes #14223
3c71548c0bc7955c462211985859c273bd9224bc authored about 2 years agoSync typeshed
Source commit:
https://github.com/python/typeshed/commit/87d2683ef974ef6d6d8...
6e9227a8cedf268799d2f0442ec855db46414778 authored about 2 years ago
The goal of partially-defined check is to detect variables that could be
undefined but semantic...
This is a workaround until we implement better handling for variables
undefined in global scope...
We have multiple of these in `typeshed`:
https://github.com/python/typeshed/search?q=__warningr...
Previously, we would ignore any class definitions and would fail to
detect undefined classes an...
Fix typo - remove an unneeded period
https://mypy.readthedocs.io/en/stable/running_mypy.htm...
8ab0ef1bbcbae730ce94d59b19f024e968cab1dc authored about 2 years ago
Most types can be considered as callables, constructing the type itself.
When a constraint was ...
Fixes #14199
This is straightforward, just use the same logic as for regular (user
defined)...
Ref #14201
00ee7d5137854f9ae09060f834a6e988ee04e342 authored about 2 years ago
We should not check untyped functions unless --check-untyped-defs is
set.
This is part of th...
71288c749f1507feab0b2ffcc312f1fb7c33cc46 authored about 2 years ago
In order to know to use `partially-defined` code vs `use-before-def`, we
had to check if a vari...
`else` in loops is executed if the loop didn't exit via a raise, return,
or a break. Therefore,...
This was incorrect for a few callsites. I refactored the code to make it
harder to make a mista...
Helps with python/typeshed#8988.
a9c62c5f82f34a923b8117a5394983aefce37b63 authored about 2 years agoThese are the issues that I've found using mypy-primer.
You should be able to review this PR ...
d58a851463fca5f2512c66e3db7ecee0d26d1eae authored about 2 years ago
We previously used `use-before-def` code here but this commit switched
it to use `partially-def...
Fixes #6715
Fix is straightforward, currently we assume that if we have a variable
in MRO, ...
Fix type aliases like these:
```
T = tuple[int, str]
```
Type applications involving fixed-l...
Fix aliases like this and other aliases involving new-style unions:
```
A = type[int] | str
`...
Fixes #6730
Currently `expand_type()` is inherently recursive, going through
`expand_type` -...
Fixes #11855
Fixes #7084
Fixes #10445
Should fix #4987
After thinking about this for some...
13bd201586e837962239dbdca8eda1f9966ebfc2 authored about 2 years ago
This should help with the investigation of tricky performance
regressions like https://github.c...
This gives around 1% speed-up on self check, and may give even more for
code that is heavy on o...
Windows wheels for Python 3.11 are not included in the release, and
`cibuildwheels` cannot buil...
This implements a check when a variable is defined before use. Something
like:
```python
def ...
This adds support for unreachable blocks in `partially-defined` check.
Currently, this only s...
8fb482ff72f94b1f16e6c63746d4cb9cd111c76c authored about 2 years ago
Fixes #4805
Fixes #13936
It is known that mypy can overuse outer type context sometimes
(es...
Fixes #5865
Looks quite easy and safe, unless I am missing something. Most changes
in the d...
c660354846688ff8158d0f0178eb298171b74f5b authored about 2 years ago
While working on another PR I noticed that current behavior of
`has_recursive_types()` is incon...
Fixes #14137
Fix is trivial, I just forgot to call `super()` in one of my previous
PRs.
Fixes #14139
56e9396e681d779cbb593d82d21c1fae76c6f430 authored about 2 years agoSee https://github.com/python/mypy/pull/14130 for context.
Btw it looks like these `Any` repo...
6cd8e007923acef7a2899e85378bc4822472b848 authored about 2 years ago
- Added missing cast import
- Changed revealed type
Co-authored-by: Shantanu <12621235+haunt...
a2477ff0d0cb751f27a2b38d27ce6572ead03451 authored about 2 years ago
Fixes #12483
Fixes https://github.com/python/typeshed/issues/7564
Ref #12841
The fix is str...
05a3f7d8d61bc298809e5363d3a23aa16fe776d2 authored about 2 years ago1cc4a7d38daac2aa641c9355a27820beba3542e1 authored about 2 years ago
Ref #12840
a206096050d87db65aa8fcd3ab3f3d0dc2302036 authored about 2 years agoFixes #14098
Having invalid statements in a NamedTuple is almost like a syntax error,
we ca...
Easy crash to repro: `mypy --any-exprs-report=out -c 'pass' --show-traceback`
b650d9633d508005fc030e5e80097d74c3d24d0d authored about 2 years ago
Since the plugin provides superior type checking:
https://github.com/python/mypy/pull/13987#iss...
Source commit:
https://github.com/python/typeshed/commit/263427f438aa7d3f0bd570f671ecba9299c1...
6e70826f94a8e9018ad1f3e975570ef1a14f2fc4 authored about 2 years agoCloses #14059
abb5a809e3ec387f46898817c15a2d3137aee819 authored about 2 years agoFixes #10482
This is not very principled, but should work except people will want to
explic...
Fixes #14108
This fixes both new and old style of working with self types. After all
I fixe...
Fixes #13903
The fix is straightforward, the formal to actual map needs to be
refreshed twi...
This requires handling more cases in the various places that we
previously modified to support ...
Addresses the non-crash part of #10244 (and similar situations).
The `freshen_function_type_v...
48c4a47c457b03caf00be2e2dacd91c3635cdc90 authored about 2 years ago