-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Stubs are created for referenced declarations in other packages (…
…#70) Closes #66 ### Summary of Changes Now limited stubs are created for imported classes from other packages. --------- Co-authored-by: megalinter-bot <[email protected]>
- Loading branch information
1 parent
78df1cd
commit 522f38d
Showing
28 changed files
with
488 additions
and
220 deletions.
There are no files selected for viewing
367 changes: 225 additions & 142 deletions
367
src/safeds_stubgen/stubs_generator/_generate_stubs.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
|
||
class AnotherClass: | ||
pass | ||
|
||
|
||
class yetAnotherClass: | ||
def another_function(self) -> str: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...pshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[_module_3].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package.file_creation._module_3") | ||
package variousModulesPackage.fileCreation.Module3 | ||
|
||
class Reexported() |
7 changes: 7 additions & 0 deletions
7
...pshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[_module_6].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@PythonModule("various_modules_package.file_creation._module_6") | ||
package variousModulesPackage.fileCreation.Module6 | ||
|
||
// TODO Result type information missing. | ||
@Pure | ||
@PythonName("public_reexported") | ||
fun publicReexported() |
4 changes: 4 additions & 0 deletions
4
...test_generate_stubs/TestStubFileGeneration.test_stub_creation[_reexport_module_1].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package._reexport_module_1") | ||
package variousModulesPackage.ReexportModule1 | ||
|
||
class ReexportClass() |
9 changes: 9 additions & 0 deletions
9
...test_generate_stubs/TestStubFileGeneration.test_stub_creation[_reexport_module_2].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@PythonModule("various_modules_package._reexport_module_2") | ||
package variousModulesPackage.ReexportModule2 | ||
|
||
// TODO Result type information missing. | ||
@Pure | ||
@PythonName("reexported_function_2") | ||
fun reexportedFunction2() | ||
|
||
class AnotherReexportClass() |
4 changes: 4 additions & 0 deletions
4
...test_generate_stubs/TestStubFileGeneration.test_stub_creation[_reexport_module_4].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package._reexport_module_4") | ||
package variousModulesPackage.ReexportModule4 | ||
|
||
class FourthReexportClass() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...s__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[another_module].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package.another_path.another_module") | ||
package variousModulesPackage.anotherPath.anotherModule | ||
|
||
class AnotherClass() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
..._/test_generate_stubs/TestStubFileGeneration.test_stub_creation[docstring_module].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
@PythonModule("various_modules_package.docstring_module") | ||
package variousModulesPackage.docstringModule | ||
|
||
class EpydocDocstringClass( | ||
@PythonName("param_1") param1: String | ||
) { | ||
@PythonName("attr_1") | ||
static attr attr1: String | ||
|
||
@Pure | ||
@PythonName("epydoc_docstring_func") | ||
fun epydocDocstringFunc( | ||
x: Int, | ||
y: Int | ||
) -> result1: Boolean | ||
} | ||
|
||
class RestDocstringClass( | ||
@PythonName("param_1") param1: String | ||
) { | ||
@PythonName("attr_1") | ||
static attr attr1: String | ||
|
||
@Pure | ||
@PythonName("rest_docstring_func") | ||
fun restDocstringFunc( | ||
x: Int, | ||
y: Int | ||
) -> result1: Boolean | ||
} | ||
|
||
class NumpyDocstringClass( | ||
@PythonName("param_1") param1: String | ||
) { | ||
@PythonName("attr_1") | ||
static attr attr1: String | ||
|
||
@Pure | ||
@PythonName("numpy_docstring_func") | ||
fun numpyDocstringFunc( | ||
x: Int, | ||
y: Int | ||
) -> result1: Boolean | ||
} | ||
|
||
class GoogleDocstringClass( | ||
@PythonName("param_1") param1: String | ||
) { | ||
@PythonName("attr_1") | ||
static attr attr1: String | ||
|
||
@Pure | ||
@PythonName("google_docstring_func") | ||
fun googleDocstringFunc( | ||
x: Int, | ||
y: Int | ||
) -> result1: Boolean | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...apshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[module_1].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package.file_creation.module_1") | ||
package variousModulesPackage.fileCreation.module1 | ||
|
||
class C() |
4 changes: 4 additions & 0 deletions
4
...apshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[module_5].sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PythonModule("various_modules_package.file_creation.package_1.module_5") | ||
package variousModulesPackage.fileCreation.package1.module5 | ||
|
||
class C() |
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
..._snapshots__/test_generate_stubs/test_file_creation_limited_stubs_outside_package.sdsstub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@PythonModule("tests.data.main_package.another_path.another_module") | ||
package tests.data.mainPackage.anotherPath.anotherModule | ||
|
||
class AnotherClass | ||
|
||
@PythonName("yetAnotherClass") | ||
class YetAnotherClass |
Oops, something went wrong.