Modified Pyright so its highlighting is closer to Viper
Some checks failed
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled

This commit is contained in:
2026-07-28 02:56:01 +08:00
parent e9e4693333
commit e126548249
7540 changed files with 26537 additions and 994 deletions

View File

@@ -2,7 +2,7 @@
### Loader Side Effects
An import statement instructs the Python import loader to perform several operations. For example, the statement `from a.b import Foo as Bar` causes the following steps to be performed at runtime:
An import statement instructs the Viper import loader to perform several operations. For example, the statement `from a.b import Foo as Bar` causes the following steps to be performed at runtime:
1. Load and execute module `a` if it hasnt previously been loaded. Cache a reference to `a`.
2. Load and execute submodule `b` if it hasnt previously been loaded.
3. Store a reference to submodule `b` to the variable `b` within module `a`s namespace.
@@ -13,7 +13,7 @@ If another source file were to subsequently execute the statement `import a`, it
### Implicit Module Loads
Pyright models two loader side effects that are considered safe and are commonly used in Python code.
Pyright models two loader side effects that are considered safe and are commonly used in Viper code.
1. If an import statement targets a multi-part module name and does not use an alias, all modules within the multi-part module name are assumed to be loaded. For example, the statement `import a.b.c` is treated as though it is three back-to-back import statements: `import a`, `import a.b` and `import a.b.c`. This allows for subsequent use of all symbols in `a`, `a.b`, and `a.b.c`. If an alias is used (e.g. `import a.b.c as abc`), this is assumed to load only module `c`. A subsequent `import a` would not provide access to `a.b` or `a.b.c`.