Skip to content

Commit d757fc0

Browse files
committed
Resolve additional review comments
1 parent 8c6c41b commit d757fc0

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

crates/red_knot_python_semantic/resources/mdtest/import/conventions.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ found in the global scope. The `builtins.pyi` file, that will be used to resolve
1313
builtins scope, contains multiple symbols from other modules (e.g., `typing`) but those are not
1414
re-exported.
1515

16-
As per [PEP 484](https://peps.python.org/pep-0484/#stub-files):
17-
18-
> Modules and variables imported into the stub are not considered exported from the stub unless the
19-
> import uses the `import ... as ...` form or the equivalent `from ... import ... as ...` form.
20-
2116
```py
2217
# These symbols are being imported in `builtins.pyi` but shouldn't be considered as being
2318
# available in the builtins scope.
@@ -31,8 +26,8 @@ reveal_type(sys) # revealed: Unknown
3126

3227
## Builtins import
3328

34-
Similarly, trying to import the symbols from the builtins module which aren't re-exported
35-
should also raise an error.
29+
Similarly, trying to import the symbols from the builtins module which aren't re-exported should
30+
also raise an error.
3631

3732
```py
3833
# error: "Module `builtins` has no member `Literal`"
@@ -51,8 +46,8 @@ reveal_type(Iterable) # revealed: Unknown
5146

5247
## Explicitly re-exported symbols in stub files
5348

54-
When a symbol is re-exported, imporing it should not raise an error.
55-
This tests both `import ...` and `from ... import ...` forms.
49+
When a symbol is re-exported, imporing it should not raise an error. This tests both `import ...`
50+
and `from ... import ...` forms.
5651

5752
Note: Submodule imports in `import ...` form doesn't work because it's a syntax error. For example,
5853
in `import os.path as os.path` the `os.path` is not a valid identifier.
@@ -216,15 +211,15 @@ from a import Foo
216211
`a.pyi`:
217212

218213
```pyi
219-
from b import AnyFoo as Foo
214+
from b import Foo
220215

221216
__all__ = ['Foo']
222217
```
223218

224219
`b.pyi`:
225220

226221
```pyi
227-
class AnyFoo: ...
222+
class Foo: ...
228223
```
229224

230225
## Runtime files
@@ -334,8 +329,8 @@ class Foo: ...
334329

335330
## Re-exports in `__init__.pyi`
336331

337-
Similarly, for an `__init__.pyi` (stub) file, importing a non-exported name should raise an error but the
338-
inference would be `Unknown`.
332+
Similarly, for an `__init__.pyi` (stub) file, importing a non-exported name should raise an error
333+
but the inference would be `Unknown`.
339334

340335
```py
341336
# error: 15 "Module `a` has no member `Foo`"

0 commit comments

Comments
 (0)