Rename Red Knot (#17820)

This commit is contained in:
Micha Reiser 2025-05-03 19:49:15 +02:00 committed by GitHub
parent e6a798b962
commit b51c4f82ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1564 changed files with 1598 additions and 1578 deletions

View file

@ -0,0 +1,17 @@
# Declarations in stubs
Unlike regular Python modules, stub files often declare module-global variables without initializing
them. If these symbols are then used in the same stub, applying regular logic would lead to an
undefined variable access error.
However, from the perspective of the type checker, we should treat something like `symbol: type` the
same as `symbol: type = ...`. In other words, assume these are bindings too.
```pyi
from typing import Literal
CONSTANT: Literal[42]
# No error here, even though the variable is not initialized.
uses_constant: int = CONSTANT
```