From 805a253d97c2ebfc747064be2d6dad252e2a2b78 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Wed, 8 Nov 2023 14:41:54 +0100 Subject: [PATCH 1/6] #91 - adds reproducible test cases and fixes --- .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 ++ .../src/foo/bar/baz/mod.py | 5 +++ .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 ++ .../src/foo/bar/baz/mod.py | 5 +++ .../src/importer.py | 6 ++++ .../src/long_importer.py | 3 ++ .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 ++ .../src/foo/bar/baz/mod.py | 5 +++ .../src/importer.py | 6 ++++ .../src/long_importer.py | 3 ++ .../input/nested_item__macos/src/__init__.py | 0 .../nested_item__macos/src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 ++ .../nested_item__macos/src/foo/bar/baz/mod.py | 5 +++ .../input/nested_item__macos/src/importer.py | 6 ++++ .../nested_item__macos/src/long_importer.py | 3 ++ .../src/__init__.py | 4 +++ .../src/foo/__init__.py | 4 +++ .../src/foo/bar/__init__.py | 14 ++++++++ .../src/foo/bar/baz/mod.py | 30 +++++++++++++++++ .../src/__init__.py | 4 +++ .../src/foo/__init__.py | 4 +++ .../src/foo/bar/__init__.py | 14 ++++++++ .../src/foo/bar/baz/mod.py | 30 +++++++++++++++++ .../src/importer.py | 33 +++++++++++++++++++ .../src/long_importer.py | 20 +++++++++++ .../src/__init__.py | 4 +++ .../src/foo/__init__.py | 4 +++ .../src/foo/bar/__init__.py | 14 ++++++++ .../src/foo/bar/baz/mod.py | 30 +++++++++++++++++ .../src/importer.py | 33 +++++++++++++++++++ .../src/long_importer.py | 21 ++++++++++++ .../output/nested_item__macos/src/__init__.py | 4 +++ .../nested_item__macos/src/foo/__init__.py | 4 +++ .../src/foo/bar/__init__.py | 14 ++++++++ .../nested_item__macos/src/foo/bar/baz/mod.py | 30 +++++++++++++++++ .../output/nested_item__macos/src/importer.py | 33 +++++++++++++++++++ .../nested_item__macos/src/long_importer.py | 21 ++++++++++++ 44 files changed, 424 insertions(+) create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py create mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py create mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py new file mode 100644 index 000000000..174374a28 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py @@ -0,0 +1,2 @@ +class InitClass: + init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..86ea18d7c --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py @@ -0,0 +1,5 @@ +class SuchNestedMuchWow: + class_item: int = 42 + +class AnotherNestedMuchWow: + other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py new file mode 100644 index 000000000..174374a28 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py @@ -0,0 +1,2 @@ +class InitClass: + init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..86ea18d7c --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py @@ -0,0 +1,5 @@ +class SuchNestedMuchWow: + class_item: int = 42 + +class AnotherNestedMuchWow: + other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py new file mode 100644 index 000000000..8e4212b17 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py @@ -0,0 +1,6 @@ +from src.foo.bar import InitClass +from src.foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow + +print(SuchNestedMuchWow().class_item) +print(AnotherNestedMuchWow().other_item) +print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py new file mode 100644 index 000000000..f5b2ee246 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py @@ -0,0 +1,3 @@ +import src.foo.bar.baz.mod + +print(src.foo.bar.baz.mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py new file mode 100644 index 000000000..174374a28 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py @@ -0,0 +1,2 @@ +class InitClass: + init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..86ea18d7c --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py @@ -0,0 +1,5 @@ +class SuchNestedMuchWow: + class_item: int = 42 + +class AnotherNestedMuchWow: + other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py new file mode 100644 index 000000000..51ce3b0dd --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py @@ -0,0 +1,6 @@ +from .foo.bar import InitClass +from .foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow + +print(SuchNestedMuchWow().class_item) +print(AnotherNestedMuchWow().other_item) +print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py new file mode 100644 index 000000000..a9d088ce2 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py @@ -0,0 +1,3 @@ +from .foo.bar.baz import mod + +print(mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py new file mode 100644 index 000000000..174374a28 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py @@ -0,0 +1,2 @@ +class InitClass: + init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..86ea18d7c --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py @@ -0,0 +1,5 @@ +class SuchNestedMuchWow: + class_item: int = 42 + +class AnotherNestedMuchWow: + other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py new file mode 100644 index 000000000..c43986f8c --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py @@ -0,0 +1,6 @@ +from foo.bar import InitClass +from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow + +print(SuchNestedMuchWow().class_item) +print(AnotherNestedMuchWow().other_item) +print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py new file mode 100644 index 000000000..bcfde5e76 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py @@ -0,0 +1,3 @@ +import foo.bar.baz.mod + +print(foo.bar.baz.mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py new file mode 100644 index 000000000..4cd70ced8 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 src/__init__: +#documentation (module) src + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py new file mode 100644 index 000000000..5f6716acd --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: +#documentation (module) src.foo + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py new file mode 100644 index 000000000..7b4b21e25 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py @@ -0,0 +1,14 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: +#documentation (module) src.foo.bar + +class InitClass: +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# +# documentation ```python +# > class InitClass: +# > ``` + init_item = 10 +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. +# documentation ```python +# > builtins.int +# > ``` + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..c0c2c66d5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py @@ -0,0 +1,30 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: +#documentation (module) src.foo.bar.baz.mod + +class SuchNestedMuchWow: +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# documentation ```python +# > class SuchNestedMuchWow: +# > ``` + class_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. +# documentation ```python +# > (variable) class_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# +# external documentation ```python +# > (class) int +# > ``` + +class AnotherNestedMuchWow: +# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# +# documentation ```python +# > class AnotherNestedMuchWow: +# > ``` + other_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. +# documentation ```python +# > (variable) other_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py new file mode 100644 index 000000000..4cd70ced8 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 src/__init__: +#documentation (module) src + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py new file mode 100644 index 000000000..5f6716acd --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: +#documentation (module) src.foo + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py new file mode 100644 index 000000000..7b4b21e25 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py @@ -0,0 +1,14 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: +#documentation (module) src.foo.bar + +class InitClass: +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# +# documentation ```python +# > class InitClass: +# > ``` + init_item = 10 +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. +# documentation ```python +# > builtins.int +# > ``` + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..c0c2c66d5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py @@ -0,0 +1,30 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: +#documentation (module) src.foo.bar.baz.mod + +class SuchNestedMuchWow: +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# documentation ```python +# > class SuchNestedMuchWow: +# > ``` + class_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. +# documentation ```python +# > (variable) class_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# +# external documentation ```python +# > (class) int +# > ``` + +class AnotherNestedMuchWow: +# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# +# documentation ```python +# > class AnotherNestedMuchWow: +# > ``` + other_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. +# documentation ```python +# > (variable) other_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py new file mode 100644 index 000000000..0b5161d6d --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py @@ -0,0 +1,33 @@ +# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: +#documentation (module) src.importer + +from src.foo.bar import InitClass +# ^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/__init__: +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# +from src.foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow +# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# + +print(SuchNestedMuchWow().class_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. +print(AnotherNestedMuchWow().other_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. +print(InitClass().init_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py new file mode 100644 index 000000000..d56d19be0 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py @@ -0,0 +1,20 @@ +# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: +#documentation (module) src.long_importer + +import src.foo.bar.baz.mod +# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: + +print(src.foo.bar.baz.mod.SuchNestedMuchWow) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py new file mode 100644 index 000000000..4cd70ced8 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 src/__init__: +#documentation (module) src + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py new file mode 100644 index 000000000..5f6716acd --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: +#documentation (module) src.foo + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py new file mode 100644 index 000000000..7b4b21e25 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py @@ -0,0 +1,14 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: +#documentation (module) src.foo.bar + +class InitClass: +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# +# documentation ```python +# > class InitClass: +# > ``` + init_item = 10 +# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. +# documentation ```python +# > builtins.int +# > ``` + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..c0c2c66d5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py @@ -0,0 +1,30 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: +#documentation (module) src.foo.bar.baz.mod + +class SuchNestedMuchWow: +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# documentation ```python +# > class SuchNestedMuchWow: +# > ``` + class_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. +# documentation ```python +# > (variable) class_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# +# external documentation ```python +# > (class) int +# > ``` + +class AnotherNestedMuchWow: +# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# +# documentation ```python +# > class AnotherNestedMuchWow: +# > ``` + other_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. +# documentation ```python +# > (variable) other_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py new file mode 100644 index 000000000..214e044b5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py @@ -0,0 +1,33 @@ +# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: +#documentation (module) src.importer + +from .foo.bar import InitClass +# ^^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# +from .foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow +# ^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# + +print(SuchNestedMuchWow().class_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. +print(AnotherNestedMuchWow().other_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. +print(InitClass().init_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# +# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. + diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py new file mode 100644 index 000000000..d25e06e38 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py @@ -0,0 +1,21 @@ +# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: +#documentation (module) src.long_importer + +from .foo.bar.baz import mod +# ^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz`/__init__: +# ^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: + +print(mod.SuchNestedMuchWow) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py new file mode 100644 index 000000000..4cd70ced8 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 src/__init__: +#documentation (module) src + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py new file mode 100644 index 000000000..47fa30af5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 /__init__: +#documentation (module) + + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py new file mode 100644 index 000000000..2d14f65c5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py @@ -0,0 +1,14 @@ +# < definition scip-python python snapshot-util 0.1 /__init__: +#documentation (module) + +class InitClass: +# ^^^^^^^^^ definition snapshot-util 0.1 /InitClass# +# documentation ```python +# > class InitClass: +# > ``` + init_item = 10 +# ^^^^^^^^^ definition snapshot-util 0.1 /InitClass#init_item. +# documentation ```python +# > builtins.int +# > ``` + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py new file mode 100644 index 000000000..ea645ec57 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py @@ -0,0 +1,30 @@ +# < definition scip-python python snapshot-util 0.1 /__init__: +#documentation (module) + +class SuchNestedMuchWow: +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 /SuchNestedMuchWow# +# documentation ```python +# > class SuchNestedMuchWow: +# > ``` + class_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 /SuchNestedMuchWow#class_item. +# documentation ```python +# > (variable) class_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# +# external documentation ```python +# > (class) int +# > ``` + +class AnotherNestedMuchWow: +# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 /AnotherNestedMuchWow# +# documentation ```python +# > class AnotherNestedMuchWow: +# > ``` + other_item: int = 42 +# ^^^^^^^^^^ definition snapshot-util 0.1 /AnotherNestedMuchWow#other_item. +# documentation ```python +# > (variable) other_item: Literal[42] +# > ``` +# ^^^ reference python-stdlib 3.11 builtins/int# + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py new file mode 100644 index 000000000..dc096661a --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py @@ -0,0 +1,33 @@ +# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: +#documentation (module) src.importer + +from foo.bar import InitClass +# ^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: +# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass# +from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow +# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow# + +print(SuchNestedMuchWow().class_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow#class_item. +print(AnotherNestedMuchWow().other_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow# +# ^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow#other_item. +print(InitClass().init_item) +#^^^^ reference python-stdlib 3.11 builtins/print(). +# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass# +# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass#init_item. + diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py new file mode 100644 index 000000000..e311b46b0 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py @@ -0,0 +1,21 @@ +# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: +#documentation (module) src.long_importer + +import foo.bar.baz.mod +# ^^^^^^^^^^^^^^^ reference local 0 +# documentation (module): foo.bar.baz.mod [unable to res... + +print(foo.bar.baz.mod.SuchNestedMuchWow) +#^^^^ reference python-stdlib 3.11 builtins/print(). +#external documentation ```python +# > (function) def print( +# > *values: object, +# > sep: str | None = " ", +# > end: str | None = "\n", +# > file: SupportsWrite[str] | None = No... +# > flush: Literal[False] = False +# > ) -> None +# > ``` +# ^^^ reference local 0 +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# + From 514bf16a719016ef82a06981242715340bc755d1 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Wed, 8 Nov 2023 16:30:03 +0100 Subject: [PATCH 2/6] #91 - adds nested resolution edge case --- .../relative_import_nested/src/__init__.py | 0 .../input/relative_import_nested/src/bar.py | 7 +++ .../input/relative_import_nested/src/foo.py | 13 ++++++ .../relative_import_nested/src/__init__.py | 4 ++ .../output/relative_import_nested/src/bar.py | 16 +++++++ .../output/relative_import_nested/src/foo.py | 45 +++++++++++++++++++ 6 files changed, 85 insertions(+) create mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py create mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py create mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py create mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py new file mode 100644 index 000000000..de5b84db4 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py @@ -0,0 +1,7 @@ +from .foo import exported_function +from .foo import this_class + +if True: + exported_function() + + this_class.exported_function() diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py new file mode 100644 index 000000000..43398d1ef --- /dev/null +++ b/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py @@ -0,0 +1,13 @@ +def exported_function(): + return "function" + +class MyClass: + """This is a class and it is cool""" + + def __init__(self): + pass + + def exported_function(self): + return "exported" + +this_class = MyClass() diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py new file mode 100644 index 000000000..4cd70ced8 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 src/__init__: +#documentation (module) src + + diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py new file mode 100644 index 000000000..17b3a47a0 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py @@ -0,0 +1,16 @@ +# < definition scip-python python snapshot-util 0.1 `src.bar`/__init__: +#documentation (module) src.bar + +from .foo import exported_function +# ^^^^ reference snapshot-util 0.1 foo/__init__: +from .foo import this_class +# ^^^^ reference snapshot-util 0.1 foo/__init__: + +if True: + exported_function() +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/exported_function(). + + this_class.exported_function() +# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/this_class. +# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/MyClass#exported_function(). + diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py new file mode 100644 index 000000000..66b425fe0 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py @@ -0,0 +1,45 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: +#documentation (module) src.foo + +def exported_function(): +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/exported_function(). +# documentation ```python +# > def exported_function(): # -> Literal['f... +# > ``` + return "function" + +class MyClass: +# ^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass# +# documentation ```python +# > class MyClass: +# > ``` +# documentation This is a class and it is cool + """This is a class and it is cool""" + + def __init__(self): +# ^^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#__init__(). +# documentation ```python +# > def __init__( +# > self +# > ) -> None: +# > ``` +# ^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#__init__().(self) + pass + + def exported_function(self): +# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#exported_function(). +# documentation ```python +# > def exported_function( +# > self +# > ): # -> Literal['exported']: +# > ``` +# ^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#exported_function().(self) + return "exported" + +this_class = MyClass() +#^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/this_class. +#documentation ```python +# > src.foo.MyClass +# > ``` +# ^^^^^^^ reference snapshot-util 0.1 `src.foo`/MyClass# + From 532c1b01c5be698eb0a858b451a7cec27b37ff57 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Fri, 24 Nov 2023 11:01:53 +0100 Subject: [PATCH 3/6] Casts paths to lowercase to prevent inconsistency on macOS --- packages/pyright-internal/src/analyzer/importResolver.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/pyright-internal/src/analyzer/importResolver.ts b/packages/pyright-internal/src/analyzer/importResolver.ts index 269407dd5..0b9e4408b 100644 --- a/packages/pyright-internal/src/analyzer/importResolver.ts +++ b/packages/pyright-internal/src/analyzer/importResolver.ts @@ -1284,6 +1284,13 @@ export class ImportResolver { filePath: string, stripTopContainerDir = false ): ModuleNameInfoFromPath | undefined { + /** + * TODO(https://github.com/sourcegraph/scip-python/issues/91) + * Both paths are casted to lowercase to make the comparison case-insensitive. This has been fixed upstream and should be removed on merge. + */ + containerPath = containerPath.toLowerCase(); + filePath = filePath.toLowerCase(); + containerPath = ensureTrailingDirectorySeparator(containerPath); let filePathWithoutExtension = stripFileExtension(filePath); From b2af910884fb45452c117fafe29cf99aeab47be6 Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Fri, 24 Nov 2023 11:03:33 +0100 Subject: [PATCH 4/6] Revert "#91 - adds nested resolution edge case" This reverts commit 514bf16a719016ef82a06981242715340bc755d1. --- .../relative_import_nested/src/__init__.py | 0 .../input/relative_import_nested/src/bar.py | 7 --- .../input/relative_import_nested/src/foo.py | 13 ------ .../relative_import_nested/src/__init__.py | 4 -- .../output/relative_import_nested/src/bar.py | 16 ------- .../output/relative_import_nested/src/foo.py | 45 ------------------- 6 files changed, 85 deletions(-) delete mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py delete mode 100644 packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py delete mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py delete mode 100644 packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py deleted file mode 100644 index de5b84db4..000000000 --- a/packages/pyright-scip/snapshots/input/relative_import_nested/src/bar.py +++ /dev/null @@ -1,7 +0,0 @@ -from .foo import exported_function -from .foo import this_class - -if True: - exported_function() - - this_class.exported_function() diff --git a/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py b/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py deleted file mode 100644 index 43398d1ef..000000000 --- a/packages/pyright-scip/snapshots/input/relative_import_nested/src/foo.py +++ /dev/null @@ -1,13 +0,0 @@ -def exported_function(): - return "function" - -class MyClass: - """This is a class and it is cool""" - - def __init__(self): - pass - - def exported_function(self): - return "exported" - -this_class = MyClass() diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py deleted file mode 100644 index 4cd70ced8..000000000 --- a/packages/pyright-scip/snapshots/output/relative_import_nested/src/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src - - diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py deleted file mode 100644 index 17b3a47a0..000000000 --- a/packages/pyright-scip/snapshots/output/relative_import_nested/src/bar.py +++ /dev/null @@ -1,16 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.bar`/__init__: -#documentation (module) src.bar - -from .foo import exported_function -# ^^^^ reference snapshot-util 0.1 foo/__init__: -from .foo import this_class -# ^^^^ reference snapshot-util 0.1 foo/__init__: - -if True: - exported_function() -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/exported_function(). - - this_class.exported_function() -# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/this_class. -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo`/MyClass#exported_function(). - diff --git a/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py b/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py deleted file mode 100644 index 66b425fe0..000000000 --- a/packages/pyright-scip/snapshots/output/relative_import_nested/src/foo.py +++ /dev/null @@ -1,45 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: -#documentation (module) src.foo - -def exported_function(): -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/exported_function(). -# documentation ```python -# > def exported_function(): # -> Literal['f... -# > ``` - return "function" - -class MyClass: -# ^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass# -# documentation ```python -# > class MyClass: -# > ``` -# documentation This is a class and it is cool - """This is a class and it is cool""" - - def __init__(self): -# ^^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#__init__(). -# documentation ```python -# > def __init__( -# > self -# > ) -> None: -# > ``` -# ^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#__init__().(self) - pass - - def exported_function(self): -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#exported_function(). -# documentation ```python -# > def exported_function( -# > self -# > ): # -> Literal['exported']: -# > ``` -# ^^^^ definition snapshot-util 0.1 `src.foo`/MyClass#exported_function().(self) - return "exported" - -this_class = MyClass() -#^^^^^^^^^ definition snapshot-util 0.1 `src.foo`/this_class. -#documentation ```python -# > src.foo.MyClass -# > ``` -# ^^^^^^^ reference snapshot-util 0.1 `src.foo`/MyClass# - From e45b593a4a13218ef049f4a2b5642a5b6d6b4d3b Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Fri, 24 Nov 2023 11:03:41 +0100 Subject: [PATCH 5/6] Revert "#91 - adds reproducible test cases and fixes" This reverts commit 805a253d97c2ebfc747064be2d6dad252e2a2b78. --- .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 -- .../src/foo/bar/baz/mod.py | 5 --- .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 -- .../src/foo/bar/baz/mod.py | 5 --- .../src/importer.py | 6 ---- .../src/long_importer.py | 3 -- .../src/__init__.py | 0 .../src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 -- .../src/foo/bar/baz/mod.py | 5 --- .../src/importer.py | 6 ---- .../src/long_importer.py | 3 -- .../input/nested_item__macos/src/__init__.py | 0 .../nested_item__macos/src/foo/__init__.py | 0 .../src/foo/bar/__init__.py | 2 -- .../nested_item__macos/src/foo/bar/baz/mod.py | 5 --- .../input/nested_item__macos/src/importer.py | 6 ---- .../nested_item__macos/src/long_importer.py | 3 -- .../src/__init__.py | 4 --- .../src/foo/__init__.py | 4 --- .../src/foo/bar/__init__.py | 14 -------- .../src/foo/bar/baz/mod.py | 30 ----------------- .../src/__init__.py | 4 --- .../src/foo/__init__.py | 4 --- .../src/foo/bar/__init__.py | 14 -------- .../src/foo/bar/baz/mod.py | 30 ----------------- .../src/importer.py | 33 ------------------- .../src/long_importer.py | 20 ----------- .../src/__init__.py | 4 --- .../src/foo/__init__.py | 4 --- .../src/foo/bar/__init__.py | 14 -------- .../src/foo/bar/baz/mod.py | 30 ----------------- .../src/importer.py | 33 ------------------- .../src/long_importer.py | 21 ------------ .../output/nested_item__macos/src/__init__.py | 4 --- .../nested_item__macos/src/foo/__init__.py | 4 --- .../src/foo/bar/__init__.py | 14 -------- .../nested_item__macos/src/foo/bar/baz/mod.py | 30 ----------------- .../output/nested_item__macos/src/importer.py | 33 ------------------- .../nested_item__macos/src/long_importer.py | 21 ------------ 44 files changed, 424 deletions(-) delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py delete mode 100644 packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py deleted file mode 100644 index 174374a28..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -class InitClass: - init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py deleted file mode 100644 index 86ea18d7c..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_no_import/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,5 +0,0 @@ -class SuchNestedMuchWow: - class_item: int = 42 - -class AnotherNestedMuchWow: - other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py deleted file mode 100644 index 174374a28..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -class InitClass: - init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py deleted file mode 100644 index 86ea18d7c..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,5 +0,0 @@ -class SuchNestedMuchWow: - class_item: int = 42 - -class AnotherNestedMuchWow: - other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py deleted file mode 100644 index 8e4212b17..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/importer.py +++ /dev/null @@ -1,6 +0,0 @@ -from src.foo.bar import InitClass -from src.foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow - -print(SuchNestedMuchWow().class_item) -print(AnotherNestedMuchWow().other_item) -print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py deleted file mode 100644 index f5b2ee246..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_qualified_imports/src/long_importer.py +++ /dev/null @@ -1,3 +0,0 @@ -import src.foo.bar.baz.mod - -print(src.foo.bar.baz.mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py deleted file mode 100644 index 174374a28..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -class InitClass: - init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py deleted file mode 100644 index 86ea18d7c..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,5 +0,0 @@ -class SuchNestedMuchWow: - class_item: int = 42 - -class AnotherNestedMuchWow: - other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py deleted file mode 100644 index 51ce3b0dd..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/importer.py +++ /dev/null @@ -1,6 +0,0 @@ -from .foo.bar import InitClass -from .foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow - -print(SuchNestedMuchWow().class_item) -print(AnotherNestedMuchWow().other_item) -print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py deleted file mode 100644 index a9d088ce2..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__fix_relative_imports/src/long_importer.py +++ /dev/null @@ -1,3 +0,0 @@ -from .foo.bar.baz import mod - -print(mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py deleted file mode 100644 index 174374a28..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -class InitClass: - init_item = 10 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py deleted file mode 100644 index 86ea18d7c..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__macos/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,5 +0,0 @@ -class SuchNestedMuchWow: - class_item: int = 42 - -class AnotherNestedMuchWow: - other_item: int = 42 diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py deleted file mode 100644 index c43986f8c..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__macos/src/importer.py +++ /dev/null @@ -1,6 +0,0 @@ -from foo.bar import InitClass -from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow - -print(SuchNestedMuchWow().class_item) -print(AnotherNestedMuchWow().other_item) -print(InitClass().init_item) diff --git a/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py b/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py deleted file mode 100644 index bcfde5e76..000000000 --- a/packages/pyright-scip/snapshots/input/nested_item__macos/src/long_importer.py +++ /dev/null @@ -1,3 +0,0 @@ -import foo.bar.baz.mod - -print(foo.bar.baz.mod.SuchNestedMuchWow) diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py deleted file mode 100644 index 4cd70ced8..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py deleted file mode 100644 index 5f6716acd..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: -#documentation (module) src.foo - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py deleted file mode 100644 index 7b4b21e25..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: -#documentation (module) src.foo.bar - -class InitClass: -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# -# documentation ```python -# > class InitClass: -# > ``` - init_item = 10 -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. -# documentation ```python -# > builtins.int -# > ``` - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py deleted file mode 100644 index c0c2c66d5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_no_import/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,30 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -#documentation (module) src.foo.bar.baz.mod - -class SuchNestedMuchWow: -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# documentation ```python -# > class SuchNestedMuchWow: -# > ``` - class_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -# documentation ```python -# > (variable) class_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` - -class AnotherNestedMuchWow: -# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# documentation ```python -# > class AnotherNestedMuchWow: -# > ``` - other_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -# documentation ```python -# > (variable) other_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py deleted file mode 100644 index 4cd70ced8..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py deleted file mode 100644 index 5f6716acd..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: -#documentation (module) src.foo - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py deleted file mode 100644 index 7b4b21e25..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: -#documentation (module) src.foo.bar - -class InitClass: -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# -# documentation ```python -# > class InitClass: -# > ``` - init_item = 10 -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. -# documentation ```python -# > builtins.int -# > ``` - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py deleted file mode 100644 index c0c2c66d5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,30 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -#documentation (module) src.foo.bar.baz.mod - -class SuchNestedMuchWow: -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# documentation ```python -# > class SuchNestedMuchWow: -# > ``` - class_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -# documentation ```python -# > (variable) class_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` - -class AnotherNestedMuchWow: -# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# documentation ```python -# > class AnotherNestedMuchWow: -# > ``` - other_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -# documentation ```python -# > (variable) other_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py deleted file mode 100644 index 0b5161d6d..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/importer.py +++ /dev/null @@ -1,33 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: -#documentation (module) src.importer - -from src.foo.bar import InitClass -# ^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/__init__: -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# -from src.foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow -# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# - -print(SuchNestedMuchWow().class_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -print(AnotherNestedMuchWow().other_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -print(InitClass().init_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py deleted file mode 100644 index d56d19be0..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_qualified_imports/src/long_importer.py +++ /dev/null @@ -1,20 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: -#documentation (module) src.long_importer - -import src.foo.bar.baz.mod -# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: - -print(src.foo.bar.baz.mod.SuchNestedMuchWow) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py deleted file mode 100644 index 4cd70ced8..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py deleted file mode 100644 index 5f6716acd..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: -#documentation (module) src.foo - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py deleted file mode 100644 index 7b4b21e25..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar`/__init__: -#documentation (module) src.foo.bar - -class InitClass: -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass# -# documentation ```python -# > class InitClass: -# > ``` - init_item = 10 -# ^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. -# documentation ```python -# > builtins.int -# > ``` - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py deleted file mode 100644 index c0c2c66d5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,30 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: -#documentation (module) src.foo.bar.baz.mod - -class SuchNestedMuchWow: -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# documentation ```python -# > class SuchNestedMuchWow: -# > ``` - class_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -# documentation ```python -# > (variable) class_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` - -class AnotherNestedMuchWow: -# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# documentation ```python -# > class AnotherNestedMuchWow: -# > ``` - other_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -# documentation ```python -# > (variable) other_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py deleted file mode 100644 index 214e044b5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/importer.py +++ /dev/null @@ -1,33 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: -#documentation (module) src.importer - -from .foo.bar import InitClass -# ^^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# -from .foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow -# ^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# - -print(SuchNestedMuchWow().class_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow#class_item. -print(AnotherNestedMuchWow().other_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow#other_item. -print(InitClass().init_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# -# ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass#init_item. - diff --git a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py deleted file mode 100644 index d25e06e38..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__fix_relative_imports/src/long_importer.py +++ /dev/null @@ -1,21 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: -#documentation (module) src.long_importer - -from .foo.bar.baz import mod -# ^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz`/__init__: -# ^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: - -print(mod.SuchNestedMuchWow) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py deleted file mode 100644 index 4cd70ced8..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 src/__init__: -#documentation (module) src - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py deleted file mode 100644 index 47fa30af5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 /__init__: -#documentation (module) - - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py deleted file mode 100644 index 2d14f65c5..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 /__init__: -#documentation (module) - -class InitClass: -# ^^^^^^^^^ definition snapshot-util 0.1 /InitClass# -# documentation ```python -# > class InitClass: -# > ``` - init_item = 10 -# ^^^^^^^^^ definition snapshot-util 0.1 /InitClass#init_item. -# documentation ```python -# > builtins.int -# > ``` - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py deleted file mode 100644 index ea645ec57..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/foo/bar/baz/mod.py +++ /dev/null @@ -1,30 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 /__init__: -#documentation (module) - -class SuchNestedMuchWow: -# ^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 /SuchNestedMuchWow# -# documentation ```python -# > class SuchNestedMuchWow: -# > ``` - class_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 /SuchNestedMuchWow#class_item. -# documentation ```python -# > (variable) class_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# -# external documentation ```python -# > (class) int -# > ``` - -class AnotherNestedMuchWow: -# ^^^^^^^^^^^^^^^^^^^^ definition snapshot-util 0.1 /AnotherNestedMuchWow# -# documentation ```python -# > class AnotherNestedMuchWow: -# > ``` - other_item: int = 42 -# ^^^^^^^^^^ definition snapshot-util 0.1 /AnotherNestedMuchWow#other_item. -# documentation ```python -# > (variable) other_item: Literal[42] -# > ``` -# ^^^ reference python-stdlib 3.11 builtins/int# - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py deleted file mode 100644 index dc096661a..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/importer.py +++ /dev/null @@ -1,33 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.importer`/__init__: -#documentation (module) src.importer - -from foo.bar import InitClass -# ^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: -# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass# -from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow -# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow# - -print(SuchNestedMuchWow().class_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow#class_item. -print(AnotherNestedMuchWow().other_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow# -# ^^^^^^^^^^ reference snapshot-util 0.1 /AnotherNestedMuchWow#other_item. -print(InitClass().init_item) -#^^^^ reference python-stdlib 3.11 builtins/print(). -# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass# -# ^^^^^^^^^ reference snapshot-util 0.1 /InitClass#init_item. - diff --git a/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py deleted file mode 100644 index e311b46b0..000000000 --- a/packages/pyright-scip/snapshots/output/nested_item__macos/src/long_importer.py +++ /dev/null @@ -1,21 +0,0 @@ -# < definition scip-python python snapshot-util 0.1 `src.long_importer`/__init__: -#documentation (module) src.long_importer - -import foo.bar.baz.mod -# ^^^^^^^^^^^^^^^ reference local 0 -# documentation (module): foo.bar.baz.mod [unable to res... - -print(foo.bar.baz.mod.SuchNestedMuchWow) -#^^^^ reference python-stdlib 3.11 builtins/print(). -#external documentation ```python -# > (function) def print( -# > *values: object, -# > sep: str | None = " ", -# > end: str | None = "\n", -# > file: SupportsWrite[str] | None = No... -# > flush: Literal[False] = False -# > ) -> None -# > ``` -# ^^^ reference local 0 -# ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 /SuchNestedMuchWow# - From 0ad4dd13d707618d72b0d69f4b43048211f6bf8b Mon Sep 17 00:00:00 2001 From: Titouan Launay Date: Fri, 24 Nov 2023 15:18:59 +0100 Subject: [PATCH 6/6] Uses resolved imports for module names --- .../snapshots/input/nested_import/__init__.py | 0 .../input/nested_import/src/bar/baz.py | 2 + .../input/nested_import/src/bar/mod.py | 2 + .../input/nested_import/src/bar/toc.py | 2 + .../snapshots/input/nested_import/src/foo.py | 7 ++++ .../output/nested_import/__init__.py | 4 ++ .../output/nested_import/src/bar/baz.py | 10 +++++ .../output/nested_import/src/bar/mod.py | 10 +++++ .../output/nested_import/src/bar/toc.py | 10 +++++ .../snapshots/output/nested_import/src/foo.py | 20 ++++++++++ .../output/nested_items/src/importer.py | 4 +- .../output/nested_items/src/long_importer.py | 2 +- packages/pyright-scip/src/treeVisitor.ts | 37 ++++++++++++++----- 13 files changed, 97 insertions(+), 13 deletions(-) create mode 100644 packages/pyright-scip/snapshots/input/nested_import/__init__.py create mode 100644 packages/pyright-scip/snapshots/input/nested_import/src/bar/baz.py create mode 100644 packages/pyright-scip/snapshots/input/nested_import/src/bar/mod.py create mode 100644 packages/pyright-scip/snapshots/input/nested_import/src/bar/toc.py create mode 100644 packages/pyright-scip/snapshots/input/nested_import/src/foo.py create mode 100644 packages/pyright-scip/snapshots/output/nested_import/__init__.py create mode 100644 packages/pyright-scip/snapshots/output/nested_import/src/bar/baz.py create mode 100644 packages/pyright-scip/snapshots/output/nested_import/src/bar/mod.py create mode 100644 packages/pyright-scip/snapshots/output/nested_import/src/bar/toc.py create mode 100644 packages/pyright-scip/snapshots/output/nested_import/src/foo.py diff --git a/packages/pyright-scip/snapshots/input/nested_import/__init__.py b/packages/pyright-scip/snapshots/input/nested_import/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/packages/pyright-scip/snapshots/input/nested_import/src/bar/baz.py b/packages/pyright-scip/snapshots/input/nested_import/src/bar/baz.py new file mode 100644 index 000000000..0b315f88a --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_import/src/bar/baz.py @@ -0,0 +1,2 @@ +def baz_function(): + pass diff --git a/packages/pyright-scip/snapshots/input/nested_import/src/bar/mod.py b/packages/pyright-scip/snapshots/input/nested_import/src/bar/mod.py new file mode 100644 index 000000000..861f1e52f --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_import/src/bar/mod.py @@ -0,0 +1,2 @@ +def mod_function(): + pass diff --git a/packages/pyright-scip/snapshots/input/nested_import/src/bar/toc.py b/packages/pyright-scip/snapshots/input/nested_import/src/bar/toc.py new file mode 100644 index 000000000..bc6260d6a --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_import/src/bar/toc.py @@ -0,0 +1,2 @@ +def toc_function(): + pass diff --git a/packages/pyright-scip/snapshots/input/nested_import/src/foo.py b/packages/pyright-scip/snapshots/input/nested_import/src/foo.py new file mode 100644 index 000000000..ea77d0fd0 --- /dev/null +++ b/packages/pyright-scip/snapshots/input/nested_import/src/foo.py @@ -0,0 +1,7 @@ +from .bar.baz import baz_function +from bar.mod import mod_function +from src.bar.toc import toc_function + +baz_function() +mod_function() +toc_function() diff --git a/packages/pyright-scip/snapshots/output/nested_import/__init__.py b/packages/pyright-scip/snapshots/output/nested_import/__init__.py new file mode 100644 index 000000000..47fa30af5 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_import/__init__.py @@ -0,0 +1,4 @@ +# < definition scip-python python snapshot-util 0.1 /__init__: +#documentation (module) + + diff --git a/packages/pyright-scip/snapshots/output/nested_import/src/bar/baz.py b/packages/pyright-scip/snapshots/output/nested_import/src/bar/baz.py new file mode 100644 index 000000000..0dacb203a --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_import/src/bar/baz.py @@ -0,0 +1,10 @@ +# < definition scip-python python snapshot-util 0.1 `src.bar.baz`/__init__: +#documentation (module) src.bar.baz + +def baz_function(): +# ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.bar.baz`/baz_function(). +# documentation ```python +# > def baz_function(): # -> None: +# > ``` + pass + diff --git a/packages/pyright-scip/snapshots/output/nested_import/src/bar/mod.py b/packages/pyright-scip/snapshots/output/nested_import/src/bar/mod.py new file mode 100644 index 000000000..898f7abe6 --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_import/src/bar/mod.py @@ -0,0 +1,10 @@ +# < definition scip-python python snapshot-util 0.1 `src.bar.mod`/__init__: +#documentation (module) src.bar.mod + +def mod_function(): +# ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.bar.mod`/mod_function(). +# documentation ```python +# > def mod_function(): # -> None: +# > ``` + pass + diff --git a/packages/pyright-scip/snapshots/output/nested_import/src/bar/toc.py b/packages/pyright-scip/snapshots/output/nested_import/src/bar/toc.py new file mode 100644 index 000000000..7f368f67b --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_import/src/bar/toc.py @@ -0,0 +1,10 @@ +# < definition scip-python python snapshot-util 0.1 `src.bar.toc`/__init__: +#documentation (module) src.bar.toc + +def toc_function(): +# ^^^^^^^^^^^^ definition snapshot-util 0.1 `src.bar.toc`/toc_function(). +# documentation ```python +# > def toc_function(): # -> None: +# > ``` + pass + diff --git a/packages/pyright-scip/snapshots/output/nested_import/src/foo.py b/packages/pyright-scip/snapshots/output/nested_import/src/foo.py new file mode 100644 index 000000000..070f8330f --- /dev/null +++ b/packages/pyright-scip/snapshots/output/nested_import/src/foo.py @@ -0,0 +1,20 @@ +# < definition scip-python python snapshot-util 0.1 `src.foo`/__init__: +#documentation (module) src.foo + +from .bar.baz import baz_function +# ^^^^^^^^ reference snapshot-util 0.1 `src.bar.baz`/__init__: +# ^^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.baz`/baz_function(). +from bar.mod import mod_function +# ^^^^^^^ reference snapshot-util 0.1 `src.bar.mod`/__init__: +# ^^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.mod`/mod_function(). +from src.bar.toc import toc_function +# ^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.toc`/__init__: +# ^^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.toc`/toc_function(). + +baz_function() +#^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.baz`/baz_function(). +mod_function() +#^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.mod`/mod_function(). +toc_function() +#^^^^^^^^^^^ reference snapshot-util 0.1 `src.bar.toc`/toc_function(). + diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/importer.py b/packages/pyright-scip/snapshots/output/nested_items/src/importer.py index cd90cbb8b..c18cedbe0 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/importer.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/importer.py @@ -2,10 +2,10 @@ #documentation (module) src.importer from foo.bar import InitClass -# ^^^^^^^ reference snapshot-util 0.1 `foo.bar`/__init__: +# ^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/__init__: # ^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar`/InitClass# from foo.bar.baz.mod import SuchNestedMuchWow, AnotherNestedMuchWow -# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: # ^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/SuchNestedMuchWow# # ^^^^^^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/AnotherNestedMuchWow# diff --git a/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py b/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py index bc76513e4..bf61c04ca 100644 --- a/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py +++ b/packages/pyright-scip/snapshots/output/nested_items/src/long_importer.py @@ -2,7 +2,7 @@ #documentation (module) src.long_importer import foo.bar.baz.mod -# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `foo.bar.baz.mod`/__init__: +# ^^^^^^^^^^^^^^^ reference snapshot-util 0.1 `src.foo.bar.baz.mod`/__init__: print(foo.bar.baz.mod.SuchNestedMuchWow) #^^^^ reference python-stdlib 3.11 builtins/print(). diff --git a/packages/pyright-scip/src/treeVisitor.ts b/packages/pyright-scip/src/treeVisitor.ts index 5bfcd9ea6..6d3c76145 100644 --- a/packages/pyright-scip/src/treeVisitor.ts +++ b/packages/pyright-scip/src/treeVisitor.ts @@ -202,7 +202,7 @@ export class TreeVisitor extends ParseTreeWalker { [] ); - this.cwd = path.resolve(process.cwd()); + this.cwd = path.resolve(process.cwd()).toLowerCase(); this._docstringWriter = new TypeStubExtendedWriter(this.config.sourceFile, this.evaluator); } @@ -498,13 +498,19 @@ export class TreeVisitor extends ParseTreeWalker { // ^^^^^^^ node.module (create new reference) // ^ node.alias (create new local definition) override visitImportAs(node: ImportAsNode): boolean { - const moduleName = _formatModuleName(node.module); + let moduleName = _formatModuleName(node.module); const importInfo = getImportInfo(node.module); if ( importInfo && - importInfo.resolvedPaths[0] && - path.resolve(importInfo.resolvedPaths[0]).startsWith(this.cwd) + importInfo.resolvedPaths[importInfo.resolvedPaths.length - 1] && + path + .resolve(importInfo.resolvedPaths[importInfo.resolvedPaths.length - 1]) + .toLowerCase() + .startsWith(this.cwd) ) { + moduleName = this.program._getImportNameForFile( + importInfo!.resolvedPaths[importInfo.resolvedPaths.length - 1] + ); const symbol = Symbols.makeModuleInit(this.projectPackage, moduleName); this.pushNewOccurrence(node.module, symbol); } else { @@ -1063,10 +1069,21 @@ export class TreeVisitor extends ParseTreeWalker { pythonPackage = this.stdlibPackage; } - return Symbols.makeModuleInit( - pythonPackage, - node.nameParts.map((namePart) => namePart.value).join('.') - ); + const importInfo = getImportInfo(node); + + let moduleName = node.nameParts.map((namePart) => namePart.value).join('.'); + + if ( + importInfo && + importInfo.resolvedPaths[importInfo.resolvedPaths.length - 1] && + importInfo.resolvedPaths[importInfo.resolvedPaths.length - 1].toLowerCase().startsWith(this.cwd) + ) { + moduleName = this.program._getImportNameForFile( + importInfo.resolvedPaths[importInfo.resolvedPaths.length - 1] + ); + } + + return Symbols.makeModuleInit(pythonPackage, moduleName); } case ParseNodeType.MemberAccess: { softAssert(false, 'Not supposed to get a member access'); @@ -1396,7 +1413,7 @@ export class TreeVisitor extends ParseTreeWalker { const nodeFilePath = path.resolve(nodeFileInfo.filePath); // TODO: Should use files from the package to determine this -- should be able to do that quite easily. - if (nodeFilePath.startsWith(this.cwd)) { + if (nodeFilePath.toLowerCase().startsWith(this.cwd.toLowerCase())) { return this.projectPackage; } @@ -1616,7 +1633,7 @@ export class TreeVisitor extends ParseTreeWalker { if (declPath && declPath.length !== 0) { const p = path.resolve(declPath); - if (p.startsWith(this.cwd)) { + if (p.toLowerCase().startsWith(this.cwd)) { return this.projectPackage; } }