Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Stub generation testing and fixing of miscellaneous bugs #76

Merged
merged 84 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3250351
Added tests for generating stubs for public methods from inherited in…
Masara Feb 28, 2024
90f2d93
Added stubs generation for public methods of inherited intern classes
Masara Feb 28, 2024
f2ddff8
style: apply automated linter fixes
megalinter-bot Feb 28, 2024
efd55c6
style: apply automated linter fixes
megalinter-bot Feb 28, 2024
0156096
Merge branch 'main' into 64-stubs-for-public-methods
Masara Mar 1, 2024
c97c653
Merge branch 'main' into 64-stubs-for-public-methods
Masara Mar 1, 2024
1520720
Refactoring
Masara Mar 2, 2024
dfab52a
Merge branch 'main' into 64-stubs-for-public-methods
Masara Mar 3, 2024
dd4bc25
Test snapshot update after merge with main
Masara Mar 3, 2024
52c6288
Added an is_internal function, refactoring how internal superclasses …
Masara Mar 3, 2024
bc9309c
Internal superclasses are now also searched transitively for methods
Masara Mar 3, 2024
a4f61e8
Changed and fixed how mypy finds the python files of the package we w…
Masara Mar 3, 2024
b4db31c
Changed how imports are found in modules, previously, imports couldn'…
Masara Mar 3, 2024
48b13da
upped the code coverage
Masara Mar 3, 2024
54b7076
Added generated stub files from the "Library" project
Masara Mar 3, 2024
3c85366
Changed the way "package" information and imports are generated for s…
Masara Mar 4, 2024
29f7c99
Removed a redundant directory creation
Masara Mar 4, 2024
9498723
Updated Library-Stubs data
Masara Mar 4, 2024
217ef56
Updated Library-Stubs data - Added too much data by mistake in the la…
Masara Mar 4, 2024
97e05b7
fixed file creation test
Masara Mar 4, 2024
9f4405c
changed the get_api test for the modules, it now checks all existing …
Masara Mar 4, 2024
9d428e0
test fix for Python3.11
Masara Mar 4, 2024
83ebdcf
small change which could fix ubuntu tests (?)
Masara Mar 4, 2024
637450b
linter fixes
Masara Mar 4, 2024
71a311a
linter fixes
Masara Mar 4, 2024
8f2c6ac
style: apply automated linter fixes
megalinter-bot Mar 4, 2024
646a110
style: apply automated linter fixes
megalinter-bot Mar 4, 2024
4f0adce
Fixing a bug where stubs with "Nothing??" as type would be generated
Masara Mar 4, 2024
b943748
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 4, 2024
5d16778
Library-Stubs update
Masara Mar 4, 2024
547952c
added test data for code coverage
Masara Mar 4, 2024
24052c3
changed test data for code coverage
Masara Mar 4, 2024
ccf5a12
Intern classes won't be displayed as superclasses in stub files
Masara Mar 4, 2024
083dce7
style: apply automated linter fixes
megalinter-bot Mar 4, 2024
2c626eb
style: apply automated linter fixes
megalinter-bot Mar 4, 2024
1fa3b5f
Merge branch '64-stubs-for-public-methods' into stubs-testing-and-fixing
Masara Mar 4, 2024
0e80f83
Merge branch 'main' into stubs-testing-and-fixing
Masara Mar 4, 2024
8e4eec6
removed Boolean, Nothing and String from the sds keyword function; No…
Masara Mar 5, 2024
6086367
Removed superclasses for stubs if the superclasses inherit directly o…
Masara Mar 5, 2024
9f29421
style: apply automated linter fixes
megalinter-bot Mar 5, 2024
35ad11c
updated Library Stub files
Masara Mar 5, 2024
ba6a7ce
style: apply automated linter fixes
megalinter-bot Mar 5, 2024
78bc870
(WIP) creating stubs for reexported modules was bugged until now, now…
Masara Mar 5, 2024
7a0aa19
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 5, 2024
d81c548
refactoring and linter fixes
Masara Mar 5, 2024
a47091c
style: apply automated linter fixes
megalinter-bot Mar 5, 2024
b4c4ff1
style: apply automated linter fixes
megalinter-bot Mar 5, 2024
a83dcff
Added more test cases for reexporting classes and functions
Masara Mar 5, 2024
9f4a9c0
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 5, 2024
73fe169
Added more test cases for reexporting classes and functions
Masara Mar 5, 2024
fa21477
Omit classes in Safe-DS that import directly or transitively from Exc…
Masara Mar 6, 2024
df007b0
Added test cases for Mapping
Masara Mar 6, 2024
6a3d430
Mapping, Sequence and Collection types for classes can now be correct…
Masara Mar 6, 2024
30d16a5
Refactoring
Masara Mar 6, 2024
28da90b
Further expanding the "reexported" checks and adding test cases
Masara Mar 7, 2024
2aec8fb
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
249d42d
Refactoring
Masara Mar 7, 2024
15a63c5
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 7, 2024
9cef7c6
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
021e84e
Refactoring
Masara Mar 7, 2024
c91bd73
Reexports from other packages are now recognized as well for the stub…
Masara Mar 7, 2024
7ef3e1e
Refactoring
Masara Mar 7, 2024
b4986e1
linter fix
Masara Mar 7, 2024
ca53f19
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
b119ef5
removed todos
Masara Mar 7, 2024
a28f1e1
Fixed package names: Now the shortest public "reexport" is being used…
Masara Mar 7, 2024
28569c2
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
e5e8355
Fixed a bug with in the ast walker and updated Library-Stub files
Masara Mar 7, 2024
d150697
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
0b66c06
code cov fix
Masara Mar 7, 2024
562a2f4
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 7, 2024
88911c0
Fixed a bug where the is_public check for classes, attr and functions…
Masara Mar 7, 2024
9ca0282
style: apply automated linter fixes
megalinter-bot Mar 7, 2024
ce2108a
Added test data for code cov
Masara Mar 8, 2024
3728c01
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 8, 2024
815b228
Fixed package names (part 2): Now the shortest public "reexport" is b…
Masara Mar 11, 2024
da9f97f
style: apply automated linter fixes
megalinter-bot Mar 11, 2024
d934d35
Refactoring and adding test data
Masara Mar 11, 2024
779a8f3
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 11, 2024
ae73a21
Inferring types (attributes): Callable classes are removed
Masara Mar 11, 2024
f123596
style: apply automated linter fixes
megalinter-bot Mar 11, 2024
5397183
Fixed package names (part 3): fixed paths, which where missing elemen…
Masara Mar 12, 2024
32a2d16
Merge remote-tracking branch 'origin/stubs-testing-and-fixing' into s…
Masara Mar 12, 2024
faadddd
chore: remove library stubs
lars-reimann Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35,682 changes: 35,682 additions & 0 deletions Library-Stubs/Library__api.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Library-Stubs/pathlib/pathlib.sdsstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package pathlib

class Path
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@PythonModule("reference.generate_reference_pages")
package reference.generateReferencePages

@Pure
@PythonName("list_class_and_function_names_in_module")
fun listClassAndFunctionNamesInModule(
@PythonName("module_name") moduleName: String
) -> result1: List<String>
120 changes: 120 additions & 0 deletions Library-Stubs/safeds/data/image/containers/_image/_image.sdsstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
@PythonModule("safeds.data.image.containers._image")
package safeds.data.image.containers.Image

from pathlib import Path
from torch import Tensor
from torch.types import Device

class Image(
@PythonName("image_tensor") imageTensor: Tensor,
device: Device
) {
attr width: Int
attr height: Int
attr channel: Int
attr device: Device

@Pure
@PythonName("from_file")
static fun fromFile(
path: union<Path, String>,
device: Device
) -> result1: Image

@Pure
@PythonName("from_bytes")
static fun fromBytes(
data: bytes,
device: Device
) -> result1: Image

// TODO Result type information missing.
@Pure
@PythonName("to_jpeg_file")
fun toJpegFile(
path: union<Path, String>
)

// TODO Result type information missing.
@Pure
@PythonName("to_png_file")
fun toPngFile(
path: union<Path, String>
)

@Pure
fun resize(
@PythonName("new_width") newWidth: Int,
@PythonName("new_height") newHeight: Int
) -> result1: Image

@Pure
@PythonName("convert_to_grayscale")
fun convertToGrayscale() -> result1: Image

@Pure
fun crop(
x: Int,
y: Int,
width: Int,
height: Int
) -> result1: Image

@Pure
@PythonName("flip_vertically")
fun flipVertically() -> result1: Image

@Pure
@PythonName("flip_horizontally")
fun flipHorizontally() -> result1: Image

@Pure
@PythonName("adjust_brightness")
fun adjustBrightness(
factor: Float
) -> result1: Image

@Pure
@PythonName("add_noise")
fun addNoise(
@PythonName("standard_deviation") standardDeviation: Float
) -> result1: Image

@Pure
@PythonName("adjust_contrast")
fun adjustContrast(
factor: Float
) -> result1: Image

@Pure
@PythonName("adjust_color_balance")
fun adjustColorBalance(
factor: Float
) -> result1: Image

@Pure
fun blur(
radius: Int
) -> result1: Image

@Pure
fun sharpen(
factor: Float
) -> result1: Image

@Pure
@PythonName("invert_colors")
fun invertColors() -> result1: Image

@Pure
@PythonName("rotate_right")
fun rotateRight() -> result1: Image

@Pure
@PythonName("rotate_left")
fun rotateLeft() -> result1: Image

@Pure
@PythonName("find_edges")
fun findEdges() -> result1: Image
}
106 changes: 106 additions & 0 deletions Library-Stubs/safeds/data/tabular/containers/_column/_column.sdsstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
@PythonModule("safeds.data.tabular.containers._column")
package safeds.data.tabular.containers.Column

from safeds.data.image.containers.Image import Image
from safeds.data.tabular.typing.ColumnType import ColumnType

class Column<T>(
name: String,
data: List<T>? = null
) {
attr name: String
@PythonName("number_of_rows") attr numberOfRows: Int
attr type: ColumnType

@Pure
@PythonName("get_unique_values")
fun getUniqueValues() -> result1: List<T>

@Pure
@PythonName("get_value")
fun getValue(
index: Int
) -> result1: T

@Pure
fun all(
predicate: (param1: T) -> param2: Boolean
) -> result1: Boolean

@Pure
fun any(
predicate: (param1: T) -> param2: Boolean
) -> result1: Boolean

@Pure
fun none(
predicate: (param1: T) -> param2: Boolean
) -> result1: Boolean

@Pure
@PythonName("has_missing_values")
fun hasMissingValues() -> result1: Boolean

@Pure
fun rename(
@PythonName("new_name") newName: String
) -> result1: Column

@Pure
fun transform<R>(
transformer: (param1: T) -> param2: R
) -> result1: Column

@Pure
@PythonName("correlation_with")
fun correlationWith(
@PythonName("other_column") otherColumn: Column
) -> result1: Float

@Pure
fun idness() -> result1: Float

@Pure
fun maximum() -> result1: Float

@Pure
fun mean() -> result1: Float

@Pure
fun median() -> result1: Float

@Pure
fun minimum() -> result1: Float

@Pure
@PythonName("missing_value_ratio")
fun missingValueRatio() -> result1: Float

@Pure
fun mode() -> result1: List<T>

@Pure
fun stability() -> result1: Float

@Pure
@PythonName("standard_deviation")
fun standardDeviation() -> result1: Float

@Pure
fun sum() -> result1: Float

@Pure
fun variance() -> result1: Float

@Pure
@PythonName("plot_boxplot")
fun plotBoxplot() -> result1: Image

@Pure
@PythonName("plot_histogram")
fun plotHistogram() -> result1: Image

@Pure
@PythonName("to_html")
fun toHtml() -> result1: String
}
52 changes: 52 additions & 0 deletions Library-Stubs/safeds/data/tabular/containers/_row/_row.sdsstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@PythonModule("safeds.data.tabular.containers._row")
package safeds.data.tabular.containers.Row

from safeds.data.tabular.typing.ColumnType import ColumnType
from safeds.data.tabular.typing.Schema import Schema

class Row(
data: Map<String, Any>? = null
) {
@PythonName("column_names") attr columnNames: List<String>
@PythonName("number_of_column") attr numberOfColumn: Int
attr `schema`: Schema

@Pure
@PythonName("from_dict")
static fun fromDict(
data: Map<String, Any>
) -> result1: Row

@Pure
@PythonName("get_value")
fun getValue(
@PythonName("column_name") columnName: String
) -> result1: Any

@Pure
@PythonName("has_column")
fun hasColumn(
@PythonName("column_name") columnName: String
) -> result1: Boolean

@Pure
@PythonName("get_column_type")
fun getColumnType(
@PythonName("column_name") columnName: String
) -> result1: ColumnType

// TODO Safe-DS does not support tuple types.
@Pure
@PythonName("sort_columns")
fun sortColumns(
comparator: (param1: Tuple<Any>, param2: Tuple<Any>) -> param3: Int
) -> result1: Row

@Pure
@PythonName("to_dict")
fun toDict() -> result1: Map<String, Any>

@Pure
@PythonName("to_html")
fun toHtml() -> result1: String
}
Loading