From 77d04dee4afc77a9a19b105ac1e4ff2ca3420791 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 1 Apr 2024 19:20:21 +0200 Subject: [PATCH] feat: Markdown documentation generator (#963) Closes #663 ### Summary of Changes * Add a service to generate Markdown documentation for Safe-DS files * Add the `document` CLI command to invoke this generator * Create Markdown documentation for the builtin stubs --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> --- docs/development/generation-testing.md | 42 +- docs/javascript/mathjax.js | 3 + docs/language/stub-language/annotations.md | 11 +- docs/mkdocs.yml | 10 +- docs/poetry.lock | 35 +- docs/pyproject.toml | 2 + docs/stdlib/README.md | 7 - docs/stdlib/SUMMARY.md | 73 + .../safeds/data/image/containers/Image.md | 765 +++++++ .../safeds/data/tabular/containers/Column.md | 773 +++++++ .../safeds/data/tabular/containers/Row.md | 281 +++ .../safeds/data/tabular/containers/Table.md | 2017 +++++++++++++++++ .../data/tabular/containers/TaggedTable.md | 940 ++++++++ .../data/tabular/containers/TimeSeries.md | 1002 ++++++++ .../tabular/transformation/Discretizer.md | 66 + .../data/tabular/transformation/Imputer.md | 140 ++ .../InvertibleTableTransformer.md | 95 + .../tabular/transformation/LabelEncoder.md | 56 + .../tabular/transformation/OneHotEncoder.md | 79 + .../tabular/transformation/RangeScaler.md | 66 + .../tabular/transformation/StandardScaler.md | 56 + .../transformation/TableTransformer.md | 250 ++ .../safeds/data/tabular/typing/ColumnType.md | 63 + .../safeds/data/tabular/typing/Schema.md | 182 ++ docs/stdlib/safeds/lang/AnnotationTarget.md | 118 + docs/stdlib/safeds/lang/Any.md | 35 + docs/stdlib/safeds/lang/Boolean.md | 9 + docs/stdlib/safeds/lang/Deprecated.md | 35 + docs/stdlib/safeds/lang/Experimental.md | 21 + docs/stdlib/safeds/lang/Expert.md | 13 + docs/stdlib/safeds/lang/Float.md | 11 + docs/stdlib/safeds/lang/Impure.md | 19 + docs/stdlib/safeds/lang/ImpurityReason.md | 104 + docs/stdlib/safeds/lang/Int.md | 11 + docs/stdlib/safeds/lang/List.md | 41 + docs/stdlib/safeds/lang/Map.md | 92 + docs/stdlib/safeds/lang/Nothing.md | 9 + docs/stdlib/safeds/lang/Number.md | 9 + docs/stdlib/safeds/lang/Pure.md | 17 + docs/stdlib/safeds/lang/PythonCall.md | 26 + docs/stdlib/safeds/lang/PythonModule.md | 21 + docs/stdlib/safeds/lang/PythonName.md | 28 + docs/stdlib/safeds/lang/Repeatable.md | 13 + docs/stdlib/safeds/lang/String.md | 9 + docs/stdlib/safeds/lang/Target.md | 21 + .../classification/AdaBoostClassifier.md | 98 + .../ml/classical/classification/Classifier.md | 279 +++ .../classification/DecisionTreeClassifier.md | 52 + .../GradientBoostingClassifier.md | 86 + .../KNearestNeighborsClassifier.md | 73 + .../LogisticRegressionClassifier.md | 52 + .../classification/RandomForestClassifier.md | 73 + .../SupportVectorMachineClassifier.md | 166 ++ .../classical/regression/AdaBoostRegressor.md | 98 + .../regression/DecisionTreeRegressor.md | 52 + .../regression/ElasticNetRegressor.md | 87 + .../regression/GradientBoostingRegressor.md | 86 + .../regression/KNearestNeighborsRegressor.md | 73 + .../ml/classical/regression/LassoRegressor.md | 73 + .../regression/LinearRegressionRegressor.md | 52 + .../regression/RandomForestRegressor.md | 73 + .../ml/classical/regression/Regressor.md | 192 ++ .../ml/classical/regression/RidgeRegressor.md | 73 + .../SupportVectorMachineRegressor.md | 166 ++ docs/stdlib/safeds/ml/nn/FNNLayer.md | 28 + .../safeds/ml/nn/NeuralNetworkClassifier.md | 130 ++ .../safeds/ml/nn/NeuralNetworkRegressor.md | 130 ++ docs/stdlib/safeds_lang.md | 290 --- docs/stylesheets/extra.css | 9 + packages/safe-ds-cli/src/cli/document.ts | 39 + packages/safe-ds-cli/src/cli/main.ts | 9 + packages/safe-ds-cli/tests/cli/main.test.ts | 76 +- .../document/contains errors.sdstest | 3 + .../tests/resources/document/correct.sdstest | 3 + .../tests/resources/document/not safe-ds.txt | 3 + .../document/references builtins.sdstest | 3 + .../safe-ds-lang/src/helpers/collections.ts | 19 + packages/safe-ds-lang/src/helpers/strings.ts | 21 + .../language/builtins/safe-ds-annotations.ts | 25 + .../safe-ds-documentation-provider.ts | 113 +- .../generation/safe-ds-markdown-generator.ts | 634 ++++++ .../generation/safe-ds-python-generator.ts | 8 +- .../src/language/helpers/nodeProperties.ts | 4 + .../src/language/safe-ds-module.ts | 6 + .../data/image/containers/image.sdsstub | 8 + .../data/tabular/containers/column.sdsstub | 2 +- .../data/tabular/containers/table.sdsstub | 14 +- .../transformation/table_transformer.sdsstub | 2 +- .../classification/ada_boost.sdsstub | 2 +- .../classification/decision_tree.sdsstub | 2 +- .../classification/gradient_boosting.sdsstub | 2 +- .../k_nearest_neighbors.sdsstub | 2 +- .../classification/random_forest.sdsstub | 2 +- .../support_vector_machine.sdsstub | 2 +- .../tests/helpers/collections.test.ts | 16 + .../tests/helpers/strings.test.ts | 41 +- .../safe-ds-documentation-provider.test.ts | 507 +++-- .../safe-ds-markdown-generator/creator.ts | 97 + .../safe-ds-markdown-generator.test.ts | 43 + .../{ => safe-ds-python-generator}/creator.ts | 24 +- .../safe-ds-python-generator.test.ts | 8 +- .../tests/language/scoping/scoping.test.ts | 16 +- .../deprecated/generated/SUMMARY.md | 6 + .../annotations/deprecated/MyAnnotation1.md | 26 + .../annotations/deprecated/main.sdsstub | 4 + .../documented/generated/SUMMARY.md | 9 + .../annotations/documented/MyAnnotation1.md | 24 + .../annotations/documented/MyAnnotation2.md | 31 + .../annotations/documented/MyAnnotation3.md | 9 + .../annotations/documented/MyEnum1.md | 7 + .../annotations/documented/main.sdsstub | 22 + .../experimental/generated/SUMMARY.md | 6 + .../annotations/experimental/MyAnnotation1.md | 22 + .../annotations/experimental/main.sdsstub | 4 + .../undocumented/generated/SUMMARY.md | 8 + .../annotations/undocumented/MyAnnotation1.md | 22 + .../annotations/undocumented/MyAnnotation2.md | 29 + .../annotations/undocumented/MyAnnotation3.md | 7 + .../annotations/undocumented/main.sdsstub | 8 + .../classes/deprecated/generated/SUMMARY.md | 6 + .../markdown/classes/deprecated/MyClass1.md | 11 + .../markdown/classes/deprecated/main.sdsstub | 4 + .../classes/documented/generated/SUMMARY.md | 11 + .../markdown/classes/documented/MyClass1.md | 9 + .../markdown/classes/documented/MyClass2.md | 9 + .../markdown/classes/documented/MyClass3.md | 17 + .../markdown/classes/documented/MyClass4.md | 16 + .../markdown/classes/documented/MyClass5.md | 11 + .../markdown/classes/documented/MyClass6.md | 119 + .../markdown/classes/documented/main.sdsstub | 75 + .../classes/experimental/generated/SUMMARY.md | 6 + .../markdown/classes/experimental/MyClass1.md | 7 + .../classes/experimental/main.sdsstub | 4 + .../classes/undocumented/generated/SUMMARY.md | 11 + .../markdown/classes/undocumented/MyClass1.md | 7 + .../markdown/classes/undocumented/MyClass2.md | 7 + .../markdown/classes/undocumented/MyClass3.md | 15 + .../markdown/classes/undocumented/MyClass4.md | 14 + .../markdown/classes/undocumented/MyClass5.md | 9 + .../markdown/classes/undocumented/MyClass6.md | 56 + .../classes/undocumented/main.sdsstub | 22 + .../markdown/deprecated/generated/SUMMARY.md | 10 + .../markdown/deprecated/MySchema1.md | 11 + .../markdown/deprecated/MySchema2.md | 13 + .../markdown/deprecated/MySchema3.md | 13 + .../markdown/deprecated/MySchema4.md | 11 + .../markdown/deprecated/MySchema5.md | 11 + .../markdown/deprecated/MySchema6.md | 14 + .../markdown/deprecated/main.sdsstub | 32 + .../enums/deprecated/generated/SUMMARY.md | 6 + .../markdown/enums/deprecated/MyEnum1.md | 11 + .../markdown/enums/deprecated/main.sdsstub | 4 + .../enums/documented/generated/SUMMARY.md | 8 + .../markdown/enums/documented/MyClass1.md | 7 + .../markdown/enums/documented/MyEnum1.md | 9 + .../markdown/enums/documented/MyEnum2.md | 37 + .../markdown/enums/documented/main.sdsstub | 26 + .../enums/experimental/generated/SUMMARY.md | 6 + .../markdown/enums/experimental/MyEnum1.md | 7 + .../markdown/enums/experimental/main.sdsstub | 4 + .../enums/undocumented/generated/SUMMARY.md | 7 + .../markdown/enums/undocumented/MyEnum1.md | 7 + .../markdown/enums/undocumented/MyEnum2.md | 21 + .../markdown/enums/undocumented/main.sdsstub | 8 + .../functions/deprecated/generated/SUMMARY.md | 6 + .../functions/deprecated/myFunction1.md | 11 + .../functions/deprecated/main.sdsstub | 5 + .../functions/documented/generated/SUMMARY.md | 10 + .../markdown/functions/documented/MyClass1.md | 7 + .../functions/documented/myFunction1.md | 9 + .../functions/documented/myFunction2.md | 29 + .../functions/documented/myFunction3.md | 16 + .../functions/documented/myFunction4.md | 16 + .../functions/documented/main.sdsstub | 41 + .../experimental/generated/SUMMARY.md | 6 + .../functions/experimental/myFunction1.md | 7 + .../functions/experimental/main.sdsstub | 5 + .../undocumented/generated/SUMMARY.md | 9 + .../functions/undocumented/myFunction1.md | 7 + .../functions/undocumented/myFunction2.md | 27 + .../functions/undocumented/myFunction3.md | 14 + .../functions/undocumented/myFunction4.md | 14 + .../functions/undocumented/main.sdsstub | 17 + .../markdown/link tag/generated/SUMMARY.md | 6 + .../generation/markdown/linkTag/MyClass1.md | 17 + .../generation/markdown/linkTag/MyClass2.md | 7 + .../generation/markdown/link tag/main.sdsstub | 12 + .../markdown/multiline/generated/SUMMARY.md | 6 + .../generation/markdown/multiline/MyClass1.md | 13 + .../generation/markdown/multiline/MyClass2.md | 16 + .../markdown/multiline/main.sdsstub | 26 + .../markdown/pipelines/generated/SUMMARY.md | 5 + .../markdown/pipelines/mySegment1.md | 7 + .../markdown/pipelines/main.sdspipe | 6 + .../schemas/deprecated/generated/SUMMARY.md | 6 + .../markdown/schemas/deprecated/MySchema1.md | 11 + .../markdown/schemas/deprecated/main.sdsstub | 4 + .../schemas/documented/generated/SUMMARY.md | 8 + .../markdown/schemas/documented/MyClass.md | 7 + .../markdown/schemas/documented/MySchema1.md | 9 + .../markdown/schemas/documented/MySchema2.md | 19 + .../markdown/schemas/documented/main.sdsstub | 18 + .../schemas/experimental/generated/SUMMARY.md | 6 + .../schemas/experimental/MySchema1.md | 7 + .../schemas/experimental/main.sdsstub | 4 + .../schemas/undocumented/generated/SUMMARY.md | 7 + .../schemas/undocumented/MySchema1.md | 7 + .../schemas/undocumented/MySchema2.md | 17 + .../schemas/undocumented/main.sdsstub | 8 + .../segments/deprecated/generated/SUMMARY.md | 6 + .../segments/deprecated/mySegment1.md | 11 + .../markdown/segments/deprecated/main.sdspipe | 4 + .../segments/documented/generated/SUMMARY.md | 10 + .../markdown/segments/documented/MyClass1.md | 7 + .../segments/documented/mySegment1.md | 9 + .../segments/documented/mySegment3.md | 9 + .../segments/documented/mySegment4.md | 16 + .../segments/documented/mySegment5.md | 19 + .../markdown/segments/documented/main.sdspipe | 35 + .../segments/documented/resources.sdsstub | 3 + .../experimental/generated/SUMMARY.md | 6 + .../segments/experimental/mySegment1.md | 7 + .../segments/experimental/main.sdspipe | 4 + .../undocumented/generated/SUMMARY.md | 9 + .../segments/undocumented/mySegment1.md | 7 + .../segments/undocumented/mySegment3.md | 7 + .../segments/undocumented/mySegment4.md | 14 + .../segments/undocumented/mySegment5.md | 17 + .../segments/undocumented/main.sdspipe | 14 + .../markdown/summary/generated/SUMMARY.md | 12 + .../markdown/summary/package1/MyClass1.md | 7 + .../markdown/summary/package1/MyClass2.md | 7 + .../markdown/summary/package1/MyClass3.md | 7 + .../summary/package1/subpackage/MyClass5.md | 7 + .../markdown/summary/package2/MyClass4.md | 7 + .../markdown/summary/package1_module1.sdsstub | 5 + .../markdown/summary/package1_module2.sdsstub | 3 + .../markdown/summary/package2.sdsstub | 3 + .../markdown/summary/package3.sdsstub | 3 + .../generator/emptyPipeline/gen_input.py | 0 .../generator/emptyPipeline/gen_input.py.map | 0 .../generator/emptyPipeline/gen_input_test.py | 0 .../declarations/empty pipeline/input.sdstest | 0 .../tests/generator/emptySegment/gen_input.py | 0 .../generator/emptySegment/gen_input.py.map | 0 .../declarations/empty segment/input.sdstest | 0 .../parameterWithPythonName/gen_input.py | 0 .../parameterWithPythonName/gen_input.py.map | 0 .../parameter with python name/input.sdstest | 0 .../pipelineWithPythonName/gen_input.py | 0 .../pipelineWithPythonName/gen_input.py.map | 0 .../gen_input_test_pipeline.py | 0 .../pipeline with python name/input.sdstest | 0 .../segmentWithPythonName/gen_input.py | 0 .../segmentWithPythonName/gen_input.py.map | 0 .../segment with python name/input.sdstest | 0 .../tests/generator/twoPipelines/gen_input.py | 0 .../generator/twoPipelines/gen_input.py.map | 0 .../generator/twoPipelines/gen_input_test1.py | 0 .../generator/twoPipelines/gen_input_test2.py | 0 .../declarations/two pipelines/input.sdstest | 0 .../tests/generator/twoSegments/gen_input.py | 0 .../generator/twoSegments/gen_input.py.map | 0 .../declarations/two segments/input.sdstest | 0 .../generator/blockLambdaResult/gen_input.py | 0 .../blockLambdaResult/gen_input.py.map | 0 .../blockLambdaResult/gen_input_test.py | 0 .../block lambda result/input.sdstest | 0 .../tests/generator/blockLambda/gen_input.py | 0 .../generator/blockLambda/gen_input.py.map | 0 .../generator/blockLambda/gen_input_test.py | 0 .../expressions/block lambda/input.sdstest | 0 .../tests/generator/call/gen_input.py | 0 .../tests/generator/call/gen_input.py.map | 0 .../tests/generator/call/gen_input_test.py | 0 .../expressions/call/input.sdstest | 0 .../tests/generator/constant/gen_input.py | 0 .../tests/generator/constant/gen_input.py.map | 0 .../generator/constant/gen_input_test.py | 0 .../expressions/constant/input.sdstest | 0 .../generator/enumVariantCall/gen_input.py | 0 .../enumVariantCall/gen_input.py.map | 0 .../enumVariantCall/gen_input_test.py | 0 .../enum variant call/input.sdstest | 0 .../generator/expressionLambda/gen_input.py | 0 .../expressionLambda/gen_input.py.map | 0 .../expressionLambda/gen_input_test.py | 0 .../expression lambda/input.sdstest | 0 .../generator/indexedAccess/gen_input.py | 0 .../generator/indexedAccess/gen_input.py.map | 0 .../expressions/indexed access/input.sdstest | 0 .../generator/infixOperation/gen_input.py | 0 .../generator/infixOperation/gen_input.py.map | 0 .../infixOperation/gen_input_test.py | 0 .../expressions/infix operation/input.sdstest | 0 .../tests/generator/lists/gen_input.py | 0 .../tests/generator/lists/gen_input.py.map | 0 .../tests/generator/lists/gen_input_test.py | 0 .../expressions/lists/input.sdstest | 0 .../tests/generator/literals/gen_input.py | 0 .../tests/generator/literals/gen_input.py.map | 0 .../generator/literals/gen_input_test.py | 0 .../expressions/literals/input.sdstest | 0 .../tests/generator/maps/gen_input.py | 0 .../tests/generator/maps/gen_input.py.map | 0 .../tests/generator/maps/gen_input_test.py | 0 .../expressions/maps/input.sdstest | 0 .../tests/generator/memberAccess/gen_input.py | 0 .../generator/memberAccess/gen_input.py.map | 0 .../generator/memberAccess/gen_input_test.py | 0 .../expressions/member access/input.sdstest | 0 .../parenthesizedExpression/gen_input.py | 0 .../parenthesizedExpression/gen_input.py.map | 0 .../parenthesizedExpression/gen_input_test.py | 0 .../parenthesized expression/input.sdstest | 0 .../generator/prefixOperation/gen_input.py | 0 .../prefixOperation/gen_input.py.map | 0 .../prefixOperation/gen_input_test.py | 0 .../prefix operation/input.sdstest | 0 .../tests/generator/reference/gen_input.py | 0 .../generator/reference/gen_input.py.map | 0 .../generator/reference/gen_input_test.py | 0 .../expressions/reference/input.sdstest | 0 .../tests/generator/sideEffects/gen_input.py | 0 .../generator/sideEffects/gen_input.py.map | 0 .../generator/sideEffects/gen_input_test.py | 0 .../expressions/side effects/input.sdstest | 0 .../generator/templateString/gen_input.py | 0 .../generator/templateString/gen_input.py.map | 0 .../templateString/gen_input_test.py | 0 .../expressions/template string/input.sdstest | 0 .../general/context different package.sdsstub | 0 ...context package with python module.sdsstub | 0 .../general/context same package.sdstest | 0 .../imports/gen_context_same_package.py | 0 .../imports/gen_context_same_package.py.map | 0 .../tests/generator/imports/gen_input.py | 0 .../tests/generator/imports/gen_input.py.map | 0 .../tests/generator/imports/gen_input_test.py | 0 .../imports/general/input.sdstest | 0 .../context different package.sdsstub | 0 ...context package with python module.sdsstub | 0 .../tests/generator/wildcard/gen_input.py | 0 .../tests/generator/wildcard/gen_input.py.map | 0 .../generator/wildcard/gen_input_test.py | 0 .../imports/wildcard/input.sdstest | 0 .../gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../input.sdstest | 0 .../gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../input.sdstest | 0 .../partialImpureDependency/gen_input.py | 0 .../partialImpureDependency/gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../partial/impure dependency/input.sdstest | 0 .../partialPureDependency/gen_input.py | 0 .../partialPureDependency/gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../partial/pure dependency/input.sdstest | 0 .../partialRedundantImpurity/gen_input.py | 0 .../partialRedundantImpurity/gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../partial/redundant impurity/input.sdstest | 0 .../generated/special_module/gen_input.py | 0 .../generated/special_module/gen_input.py.map | 0 .../{ => python}/python module/input.sdstest | 0 .../callWithRunnerIntegration/gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_test.py | 0 .../expressions/call/input.sdstest | 0 .../gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_test.py | 0 .../expressions/member access/input.sdstest | 0 .../general/context different package.sdsstub | 0 ...context package with python module.sdsstub | 0 .../general/context same package.sdstest | 0 .../gen_context_same_package.py | 0 .../gen_context_same_package.py.map | 0 .../importsWithRunnerIntegration/gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_test.py | 0 .../imports/general/input.sdstest | 0 .../context different package.sdsstub | 0 ...context package with python module.sdsstub | 0 .../gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_test.py | 0 .../imports/wildcard/input.sdstest | 0 .../gen_input.py | 0 .../gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../statements/assignment/input.sdstest | 0 .../tests/generator/assignment/gen_input.py | 0 .../generator/assignment/gen_input.py.map | 0 .../assignment/gen_input_testPipeline.py | 0 .../statements/assignment/input.sdstest | 0 .../expressionStatement/gen_input.py | 0 .../expressionStatement/gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../expression statement/input.sdstest | 0 .../statementWithoutEffect/gen_input.py | 0 .../statementWithoutEffect/gen_input.py.map | 0 .../gen_input_testPipeline.py | 0 .../statement without effect/input.sdstest | 0 408 files changed, 13118 insertions(+), 568 deletions(-) delete mode 100644 docs/stdlib/README.md create mode 100644 docs/stdlib/SUMMARY.md create mode 100644 docs/stdlib/safeds/data/image/containers/Image.md create mode 100644 docs/stdlib/safeds/data/tabular/containers/Column.md create mode 100644 docs/stdlib/safeds/data/tabular/containers/Row.md create mode 100644 docs/stdlib/safeds/data/tabular/containers/Table.md create mode 100644 docs/stdlib/safeds/data/tabular/containers/TaggedTable.md create mode 100644 docs/stdlib/safeds/data/tabular/containers/TimeSeries.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/Discretizer.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/Imputer.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/InvertibleTableTransformer.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/LabelEncoder.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/OneHotEncoder.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/RangeScaler.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/StandardScaler.md create mode 100644 docs/stdlib/safeds/data/tabular/transformation/TableTransformer.md create mode 100644 docs/stdlib/safeds/data/tabular/typing/ColumnType.md create mode 100644 docs/stdlib/safeds/data/tabular/typing/Schema.md create mode 100644 docs/stdlib/safeds/lang/AnnotationTarget.md create mode 100644 docs/stdlib/safeds/lang/Any.md create mode 100644 docs/stdlib/safeds/lang/Boolean.md create mode 100644 docs/stdlib/safeds/lang/Deprecated.md create mode 100644 docs/stdlib/safeds/lang/Experimental.md create mode 100644 docs/stdlib/safeds/lang/Expert.md create mode 100644 docs/stdlib/safeds/lang/Float.md create mode 100644 docs/stdlib/safeds/lang/Impure.md create mode 100644 docs/stdlib/safeds/lang/ImpurityReason.md create mode 100644 docs/stdlib/safeds/lang/Int.md create mode 100644 docs/stdlib/safeds/lang/List.md create mode 100644 docs/stdlib/safeds/lang/Map.md create mode 100644 docs/stdlib/safeds/lang/Nothing.md create mode 100644 docs/stdlib/safeds/lang/Number.md create mode 100644 docs/stdlib/safeds/lang/Pure.md create mode 100644 docs/stdlib/safeds/lang/PythonCall.md create mode 100644 docs/stdlib/safeds/lang/PythonModule.md create mode 100644 docs/stdlib/safeds/lang/PythonName.md create mode 100644 docs/stdlib/safeds/lang/Repeatable.md create mode 100644 docs/stdlib/safeds/lang/String.md create mode 100644 docs/stdlib/safeds/lang/Target.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/AdaBoostClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/Classifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/DecisionTreeClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/GradientBoostingClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/KNearestNeighborsClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/LogisticRegressionClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/RandomForestClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/classification/SupportVectorMachineClassifier.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/AdaBoostRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/DecisionTreeRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/ElasticNetRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/GradientBoostingRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/KNearestNeighborsRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/LassoRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/LinearRegressionRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/RandomForestRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/Regressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/RidgeRegressor.md create mode 100644 docs/stdlib/safeds/ml/classical/regression/SupportVectorMachineRegressor.md create mode 100644 docs/stdlib/safeds/ml/nn/FNNLayer.md create mode 100644 docs/stdlib/safeds/ml/nn/NeuralNetworkClassifier.md create mode 100644 docs/stdlib/safeds/ml/nn/NeuralNetworkRegressor.md delete mode 100644 docs/stdlib/safeds_lang.md create mode 100644 docs/stylesheets/extra.css create mode 100644 packages/safe-ds-cli/src/cli/document.ts create mode 100644 packages/safe-ds-cli/tests/resources/document/contains errors.sdstest create mode 100644 packages/safe-ds-cli/tests/resources/document/correct.sdstest create mode 100644 packages/safe-ds-cli/tests/resources/document/not safe-ds.txt create mode 100644 packages/safe-ds-cli/tests/resources/document/references builtins.sdstest create mode 100644 packages/safe-ds-lang/src/language/generation/safe-ds-markdown-generator.ts create mode 100644 packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/creator.ts create mode 100644 packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/safe-ds-markdown-generator.test.ts rename packages/safe-ds-lang/tests/language/generation/{ => safe-ds-python-generator}/creator.ts (86%) rename packages/safe-ds-lang/tests/language/generation/{ => safe-ds-python-generator}/safe-ds-python-generator.test.ts (89%) create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/tests/generation/markdown/annotations/deprecated/MyAnnotation1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyEnum1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/tests/generation/markdown/annotations/experimental/MyAnnotation1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/tests/generation/markdown/classes/deprecated/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass6.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/tests/generation/markdown/classes/experimental/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass6.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema6.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/tests/generation/markdown/enums/deprecated/MyEnum1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/tests/generation/markdown/enums/experimental/MyEnum1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/tests/generation/markdown/functions/deprecated/myFunction1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/tests/generation/markdown/functions/experimental/myFunction1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/link tag/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/multiline/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/tests/generation/markdown/pipelines/mySegment1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/main.sdspipe create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/tests/generation/markdown/schemas/deprecated/MySchema1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MyClass.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/tests/generation/markdown/schemas/experimental/MySchema1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/main.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/tests/generation/markdown/segments/deprecated/mySegment1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/main.sdspipe create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/main.sdspipe create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/resources.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/tests/generation/markdown/segments/experimental/mySegment1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/main.sdspipe create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/main.sdspipe create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/SUMMARY.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass1.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass2.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass3.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/subpackage/MyClass5.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package2/MyClass4.md create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module1.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module2.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/package2.sdsstub create mode 100644 packages/safe-ds-lang/tests/resources/generation/markdown/summary/package3.sdsstub rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty pipeline/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/empty segment/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/parameter with python name/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/pipeline with python name/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/segment with python name/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test1.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test2.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two pipelines/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/declarations/two segments/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda result/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda/generated/tests/generator/blockLambda/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/block lambda/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/call/generated/tests/generator/call/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/call/generated/tests/generator/call/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/call/generated/tests/generator/call/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/call/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/constant/generated/tests/generator/constant/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/constant/generated/tests/generator/constant/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/constant/generated/tests/generator/constant/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/constant/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/enum variant call/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/expression lambda/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/indexed access/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/infix operation/generated/tests/generator/infixOperation/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/infix operation/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/lists/generated/tests/generator/lists/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/lists/generated/tests/generator/lists/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/lists/generated/tests/generator/lists/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/lists/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/literals/generated/tests/generator/literals/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/literals/generated/tests/generator/literals/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/literals/generated/tests/generator/literals/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/literals/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/maps/generated/tests/generator/maps/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/maps/generated/tests/generator/maps/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/maps/generated/tests/generator/maps/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/maps/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/member access/generated/tests/generator/memberAccess/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/member access/generated/tests/generator/memberAccess/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/member access/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/parenthesized expression/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/prefix operation/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/reference/generated/tests/generator/reference/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/reference/generated/tests/generator/reference/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/reference/generated/tests/generator/reference/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/reference/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/side effects/generated/tests/generator/sideEffects/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/side effects/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/template string/generated/tests/generator/templateString/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/template string/generated/tests/generator/templateString/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/template string/generated/tests/generator/templateString/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/expressions/template string/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/context different package.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/context package with python module.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/context same package.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/generated/tests/generator/imports/gen_context_same_package.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/generated/tests/generator/imports/gen_context_same_package.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/generated/tests/generator/imports/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/generated/tests/generator/imports/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/generated/tests/generator/imports/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/general/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/context different package.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/context package with python module.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/generated/tests/generator/wildcard/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/generated/tests/generator/wildcard/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/generated/tests/generator/wildcard/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/imports/wildcard/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file constant/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency file parameter/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/impure dependency/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/pure dependency/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/partial/redundant impurity/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/python module/generated/special_module/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/python module/generated/special_module/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/python module/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/call/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/expressions/member access/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/context different package.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/context package with python module.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/context same package.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/general/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/context different package.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/context package with python module.sdsstub (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input_test.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/imports/wildcard/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/runner integration/statements/assignment/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/assignment/generated/tests/generator/assignment/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/assignment/generated/tests/generator/assignment/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/assignment/generated/tests/generator/assignment/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/assignment/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/expression statement/generated/tests/generator/expressionStatement/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/expression statement/input.sdstest (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py.map (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input_testPipeline.py (100%) rename packages/safe-ds-lang/tests/resources/generation/{ => python}/statements/statement without effect/input.sdstest (100%) diff --git a/docs/development/generation-testing.md b/docs/development/generation-testing.md index 6d5fa0706..848e670c4 100644 --- a/docs/development/generation-testing.md +++ b/docs/development/generation-testing.md @@ -1,14 +1,17 @@ # Generation Testing -Generation tests are data-driven instead of being specified explicitly. This document explains how to add a new -generation test. +Safe-DS has two generation targets, [Python](#python-generation) (for execution) and [Markdown](#markdown-generation) +(for documentation). In either case, the generation tests are data-driven instead of being specified explicitly. This +document explains how to add a new generation test. -## Adding a generation test +## Python Generation -1. Create a new **folder** (not just a file!) in the `tests/resources/generation` directory or any subdirectory. Give - the folder a descriptive name, since the folder name becomes part of the test name. By default, the runner +### Adding a generation test + +1. Create a new **folder** (not just a file!) in the `tests/resources/generation/python` directory or any subdirectory. + Give the folder a descriptive name, since the folder name becomes part of the test name. By default, the runner integration is disabled. If you want to test the runner integration, place the folder in - `tests/resources/generation/runner integration` or any subdirectory instead. + `tests/resources/generation/python/runner integration` or any subdirectory instead. !!! tip "Skipping a test" @@ -30,6 +33,31 @@ generation test. and the contents of the Python files will be compared to the actual generation output. 6. Run the tests. The test runner will automatically pick up the new test. -## Updating the expected output +### Updating the expected output + +To quickly update the expected output after changes to the code generator, run `vitest` with the `--update` flag. + +## Markdown Generation + +### Adding a generation test + +1. Create a new **folder** (not just a file!) in the `tests/resources/generation/markdown` directory or any + subdirectory. Give the folder a descriptive name, since the folder name becomes part of the test name. + + !!! tip "Skipping a test" + + If you want to skip a test, add the prefix `skip-` to the folder name. + +2. Add files with the extension `.sdstest`, `.sdspipe`, or `.sdsstub` **directly inside the folder**. All files in a + folder will be loaded into the same workspace, so they can reference each other. Files in different folders are + loaded into different workspaces, so they cannot reference each other. Generation will be triggered for all files in + the folder. +3. Add the Safe-DS code that you want to test to the files. +4. Add another folder called `generated` inside the folder that you created in step 1. Place folders and Python files + inside the `generated` folder to specify the expected output of the program. The relative paths to the Python files + and the contents of the Python files will be compared to the actual generation output. +5. Run the tests. The test runner will automatically pick up the new test. + +### Updating the expected output To quickly update the expected output after changes to the code generator, run `vitest` with the `--update` flag. diff --git a/docs/javascript/mathjax.js b/docs/javascript/mathjax.js index 5da38f792..6b16b5bf8 100644 --- a/docs/javascript/mathjax.js +++ b/docs/javascript/mathjax.js @@ -12,5 +12,8 @@ window.MathJax = { }; document$.subscribe(() => { + MathJax.startup.output.clearCache(); + MathJax.typesetClear(); + MathJax.texReset(); MathJax.typesetPromise(); }); diff --git a/docs/language/stub-language/annotations.md b/docs/language/stub-language/annotations.md index 46c1a3b45..8b5d0aef8 100644 --- a/docs/language/stub-language/annotations.md +++ b/docs/language/stub-language/annotations.md @@ -53,7 +53,7 @@ To attach metainformation to a declaration, the annotation must be called on tha - [Type parameters][type-parameters] - [Pipelines][pipelines] -The valid targets of an annotation can be restricted with the [`Target`][safeds-lang-target] annotation. By default all targets are allowed. Likewise, an annotation can only be called once on the same declaration by default, unless the annotation is marked as[Repeatable][safeds-lang-repeatable]. +The valid targets of an annotation can be restricted with the [`Target`][safeds.lang.Target] annotation. By default all targets are allowed. Likewise, an annotation can only be called once on the same declaration by default, unless the annotation is marked as[Repeatable][safeds.lang.Repeatable]. Annotation calls are always located right in front of their target. Exception: In the case of compilations units they are located at the very top of the file. Here is an example that demonstrates how to call the annotation `#!sds OnlyForExperts` that we defined above on a [class][classes]: @@ -87,10 +87,10 @@ The same [restrictions to arguments][argument-restrictions] as for [calls][calls ## Built-in Annotations -The package `#!sds safeds.lang` contains several annotations that are processed by Safe-DS. Refer to the [API documentation][safeds-lang] for more details. Particularly important are the annotations +The package `#!sds safeds.lang` contains several annotations that are processed by Safe-DS. Particularly important are the annotations -- [`Target`][safeds-lang-target], which can restrict the possible targets of an annotation, and -- [`Repeatable`][safeds-lang-repeatable], which allows an annotation to be called multiple times on the same declaration. +- [`Target`][safeds.lang.Target], which can restrict the possible targets of an annotation, and +- [`Repeatable`][safeds.lang.Repeatable], which allows an annotation to be called multiple times on the same declaration. [parameters]: ../common/parameters.md [types]: ../common/types.md @@ -104,8 +104,5 @@ The package `#!sds safeds.lang` contains several annotations that are processed [segments]: ../pipeline-language/segments.md [type-parameters]: type-parameters.md [pipelines]: ../pipeline-language/pipelines.md -[safeds-lang]: ../../stdlib/safeds_lang.md -[safeds-lang-repeatable]: ../../stdlib/safeds_lang.md#annotation-repeatable -[safeds-lang-target]: ../../stdlib/safeds_lang.md#annotation-target [calls]: ../pipeline-language/expressions.md#calls [argument-restrictions]: ../pipeline-language/expressions.md#restrictions-for-arguments diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7503045dd..cabbe4823 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -36,9 +36,7 @@ nav: - Enumerations: language/stub-language/enumerations.md - Annotations: language/stub-language/annotations.md - Type Parameters: language/stub-language/type-parameters.md - - Standard Library: - - stdlib/README.md - - safeds.lang: stdlib/safeds_lang.md + - Standard Library: stdlib/ - Development: - Call Graph Testing: development/call-graph-testing.md - Formatting Testing: development/formatting-testing.md @@ -80,6 +78,9 @@ theme: - navigation.top plugins: + - literate-nav: + nav_file: SUMMARY.md + - autorefs - glightbox - same-dir - search @@ -130,6 +131,9 @@ markdown_extensions: - toc: permalink: true +extra_css: + - stylesheets/extra.css + extra_javascript: - javascript/mathjax.js - https://polyfill.io/v3/polyfill.min.js?features=es6 diff --git a/docs/poetry.lock b/docs/poetry.lock index 8f256d652..5d57b6d6b 100644 --- a/docs/poetry.lock +++ b/docs/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "babel" @@ -319,6 +319,22 @@ watchdog = ">=2.0" i18n = ["babel (>=2.9.0)"] min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.3)", "jinja2 (==2.11.1)", "markdown (==3.2.1)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "packaging (==20.5)", "pathspec (==0.11.1)", "platformdirs (==2.2.0)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "typing-extensions (==3.10)", "watchdog (==2.0)"] +[[package]] +name = "mkdocs-autorefs" +version = "1.0.1" +description = "Automatically link across pages in MkDocs." +optional = false +python-versions = ">=3.8" +files = [ + {file = "mkdocs_autorefs-1.0.1-py3-none-any.whl", hash = "sha256:aacdfae1ab197780fb7a2dac92ad8a3d8f7ca8049a9cbe56a4218cd52e8da570"}, + {file = "mkdocs_autorefs-1.0.1.tar.gz", hash = "sha256:f684edf847eced40b570b57846b15f0bf57fb93ac2c510450775dcf16accb971"}, +] + +[package.dependencies] +Markdown = ">=3.3" +markupsafe = ">=2.0.1" +mkdocs = ">=1.1" + [[package]] name = "mkdocs-glightbox" version = "0.3.7" @@ -330,6 +346,20 @@ files = [ {file = "mkdocs_glightbox-0.3.7-py3-none-any.whl", hash = "sha256:9659631a9829d93d8fb0ce3a20a10261c258605ba4dc87a3b7b5d847b93a276d"}, ] +[[package]] +name = "mkdocs-literate-nav" +version = "0.6.1" +description = "MkDocs plugin to specify the navigation in Markdown instead of YAML" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mkdocs_literate_nav-0.6.1-py3-none-any.whl", hash = "sha256:e70bdc4a07050d32da79c0b697bd88e9a104cf3294282e9cb20eec94c6b0f401"}, + {file = "mkdocs_literate_nav-0.6.1.tar.gz", hash = "sha256:78a7ab6d878371728acb0cdc6235c9b0ffc6e83c997b037f4a5c6ff7cef7d759"}, +] + +[package.dependencies] +mkdocs = ">=1.0.3" + [[package]] name = "mkdocs-material" version = "9.5.12" @@ -503,7 +533,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -740,4 +769,4 @@ watchmedo = ["PyYAML (>=3.10)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "d63b013ee441697c3f9b40036e27719678f110084f618fb009c25a1fbb7e279e" +content-hash = "f055fe30e8300d02fd68d2815b1c481fc2475ce83dc61e42ce74401dc2d1a653" diff --git a/docs/pyproject.toml b/docs/pyproject.toml index 949e91c07..2dc5385fe 100644 --- a/docs/pyproject.toml +++ b/docs/pyproject.toml @@ -12,9 +12,11 @@ packages = [ python = "^3.11" mkdocs = "^1.5.3" mkdocs-glightbox = "^0.3.7" +mkdocs-literate-nav = "^0.6.1" mkdocs-material = "^9.5.12" mkdocs-same-dir = "^0.1.3" pygments = "^2.17.2" +mkdocs-autorefs = "^1.0.1" [tool.poetry.plugins."pygments.lexers"] sds = "safe_ds_lexer:SafeDsLexer" diff --git a/docs/stdlib/README.md b/docs/stdlib/README.md deleted file mode 100644 index c3c2398c8..000000000 --- a/docs/stdlib/README.md +++ /dev/null @@ -1,7 +0,0 @@ - - -# Safe-DS API Documentation - -## Packages - -* [safeds.lang](./safeds_lang.md) diff --git a/docs/stdlib/SUMMARY.md b/docs/stdlib/SUMMARY.md new file mode 100644 index 000000000..d3efcdd3a --- /dev/null +++ b/docs/stdlib/SUMMARY.md @@ -0,0 +1,73 @@ +- safeds + - data + - image + - containers + - [Image](safeds/data/image/containers/Image.md) + - tabular + - containers + - [Column](safeds/data/tabular/containers/Column.md) + - [Row](safeds/data/tabular/containers/Row.md) + - [Table](safeds/data/tabular/containers/Table.md) + - [TaggedTable](safeds/data/tabular/containers/TaggedTable.md) + - [TimeSeries](safeds/data/tabular/containers/TimeSeries.md) + - transformation + - [Discretizer](safeds/data/tabular/transformation/Discretizer.md) + - [Imputer](safeds/data/tabular/transformation/Imputer.md) + - [InvertibleTableTransformer](safeds/data/tabular/transformation/InvertibleTableTransformer.md) + - [LabelEncoder](safeds/data/tabular/transformation/LabelEncoder.md) + - [OneHotEncoder](safeds/data/tabular/transformation/OneHotEncoder.md) + - [RangeScaler](safeds/data/tabular/transformation/RangeScaler.md) + - [StandardScaler](safeds/data/tabular/transformation/StandardScaler.md) + - [TableTransformer](safeds/data/tabular/transformation/TableTransformer.md) + - typing + - [ColumnType](safeds/data/tabular/typing/ColumnType.md) + - [Schema](safeds/data/tabular/typing/Schema.md) + - lang + - [AnnotationTarget](safeds/lang/AnnotationTarget.md) + - [Any](safeds/lang/Any.md) + - [Boolean](safeds/lang/Boolean.md) + - [Deprecated](safeds/lang/Deprecated.md) + - [Experimental](safeds/lang/Experimental.md) + - [Expert](safeds/lang/Expert.md) + - [Float](safeds/lang/Float.md) + - [Impure](safeds/lang/Impure.md) + - [ImpurityReason](safeds/lang/ImpurityReason.md) + - [Int](safeds/lang/Int.md) + - [List](safeds/lang/List.md) + - [Map](safeds/lang/Map.md) + - [Nothing](safeds/lang/Nothing.md) + - [Number](safeds/lang/Number.md) + - [Pure](safeds/lang/Pure.md) + - [PythonCall](safeds/lang/PythonCall.md) + - [PythonModule](safeds/lang/PythonModule.md) + - [PythonName](safeds/lang/PythonName.md) + - [Repeatable](safeds/lang/Repeatable.md) + - [String](safeds/lang/String.md) + - [Target](safeds/lang/Target.md) + - ml + - classical + - classification + - [AdaBoostClassifier](safeds/ml/classical/classification/AdaBoostClassifier.md) + - [Classifier](safeds/ml/classical/classification/Classifier.md) + - [DecisionTreeClassifier](safeds/ml/classical/classification/DecisionTreeClassifier.md) + - [GradientBoostingClassifier](safeds/ml/classical/classification/GradientBoostingClassifier.md) + - [KNearestNeighborsClassifier](safeds/ml/classical/classification/KNearestNeighborsClassifier.md) + - [LogisticRegressionClassifier](safeds/ml/classical/classification/LogisticRegressionClassifier.md) + - [RandomForestClassifier](safeds/ml/classical/classification/RandomForestClassifier.md) + - [SupportVectorMachineClassifier](safeds/ml/classical/classification/SupportVectorMachineClassifier.md) + - regression + - [AdaBoostRegressor](safeds/ml/classical/regression/AdaBoostRegressor.md) + - [DecisionTreeRegressor](safeds/ml/classical/regression/DecisionTreeRegressor.md) + - [ElasticNetRegressor](safeds/ml/classical/regression/ElasticNetRegressor.md) + - [GradientBoostingRegressor](safeds/ml/classical/regression/GradientBoostingRegressor.md) + - [KNearestNeighborsRegressor](safeds/ml/classical/regression/KNearestNeighborsRegressor.md) + - [LassoRegressor](safeds/ml/classical/regression/LassoRegressor.md) + - [LinearRegressionRegressor](safeds/ml/classical/regression/LinearRegressionRegressor.md) + - [RandomForestRegressor](safeds/ml/classical/regression/RandomForestRegressor.md) + - [Regressor](safeds/ml/classical/regression/Regressor.md) + - [RidgeRegressor](safeds/ml/classical/regression/RidgeRegressor.md) + - [SupportVectorMachineRegressor](safeds/ml/classical/regression/SupportVectorMachineRegressor.md) + - nn + - [FNNLayer](safeds/ml/nn/FNNLayer.md) + - [NeuralNetworkClassifier](safeds/ml/nn/NeuralNetworkClassifier.md) + - [NeuralNetworkRegressor](safeds/ml/nn/NeuralNetworkRegressor.md) diff --git a/docs/stdlib/safeds/data/image/containers/Image.md b/docs/stdlib/safeds/data/image/containers/Image.md new file mode 100644 index 000000000..d776e1a78 --- /dev/null +++ b/docs/stdlib/safeds/data/image/containers/Image.md @@ -0,0 +1,765 @@ +# `#!sds abstract class` Image {#safeds.data.image.containers.Image data-toc-label='Image'} + +A container for image data. + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="6" + class Image { + /** + * Get the width of the image in pixels. + */ + attr width: Int + /** + * Get the height of the image in pixels. + */ + attr height: Int + /** + * Get the number of channels of the image. + */ + attr channel: Int + + /** + * Create an image from a file. + * + * @param path The path to the image file. + * @param device The device where the tensor will be saved on. Defaults to the default device + * + * @result result1 The image. + */ + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_file") + static fun fromFile( + path: String + ) -> result1: Image + + /** + * Save the image as a JPEG file. + * + * @param path The path to the JPEG file. + */ + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_jpeg_file") + fun toJpegFile( + path: String + ) + + /** + * Save the image as a PNG file. + * + * @param path The path to the PNG file. + */ + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_png_file") + fun toPngFile( + path: String + ) + + /** + * Return a new `Image` that has been resized to a given size. + * + * The original image is not modified. + * + * @param newWidth The new width of the image. + * @param newHeight The new height of the image. + * + * @result result1 The image with the given width and height. + */ + @Pure + fun resize( + @PythonName("new_width") const newWidth: Int, + @PythonName("new_height") const newHeight: Int + ) -> result1: Image where { + newWidth >= 0, + newHeight >= 0 + } + + /** + * Return a new `Image` that is converted to grayscale. + * + * The original image is not modified. + * + * @result result1 The grayscale image. + */ + @Pure + @PythonName("convert_to_grayscale") + fun convertToGrayscale() -> result1: Image + + /** + * Return a new `Image` that has been cropped to a given bounding rectangle. + * + * The original image is not modified. + * + * @param x The x coordinate of the top-left corner of the bounding rectangle. + * @param y The y coordinate of the top-left corner of the bounding rectangle. + * @param width The width of the bounding rectangle. + * @param height The height of the bounding rectangle. + * + * @result result1 The cropped image. + */ + @Pure + fun crop( + const x: Int, + const y: Int, + const width: Int, + const height: Int + ) -> result1: Image where { + x >= 0, + y >= 0, + width >= 0, + height >= 0 + } + + /** + * Return a new `Image` that is flipped vertically (horizontal axis, flips up-down and vice versa). + * + * The original image is not modified. + * + * @result result1 The flipped image. + */ + @Pure + @PythonName("flip_vertically") + fun flipVertically() -> result1: Image + + /** + * Return a new `Image` that is flipped horizontally (vertical axis, flips left-right and vice versa). + * + * The original image is not modified. + * + * @result result1 The flipped image. + */ + @Pure + @PythonName("flip_horizontally") + fun flipHorizontally() -> result1: Image + + /** + * Return a new `Image` with an adjusted brightness. + * + * The original image is not modified. + * + * @param factor The brightness factor. + * 1.0 will not change the brightness. + * Below 1.0 will result in a darker image. + * Above 1.0 will resolut in a brighter image. + * Has to be bigger than or equal to 0 (black). + * + * @result result1 The Image with adjusted brightness. + */ + @Pure + @PythonName("adjust_brightness") + fun adjustBrightness( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + + /** + * Return a new `Image` with noise added to the image. + * + * The original image is not modified. + * + * @param standardDeviation The standard deviation of the normal distribution. Has to be bigger than or equal to 0. + * + * @result result1 The image with added noise. + */ + @Pure + @PythonName("add_noise") + fun addNoise( + @PythonName("standard_deviation") const standardDeviation: Float + ) -> result1: Image where { + standardDeviation >= 0.0 + } + + /** + * Return a new `Image` with adjusted contrast. + * + * The original image is not modified. + * + * @param factor If factor > 1, increase contrast of image. + * If factor = 1, no changes will be made. + * If factor < 1, make image greyer. + * Has to be bigger than or equal to 0 (gray). + * + * @result result1 New image with adjusted contrast. + */ + @Pure + @PythonName("adjust_contrast") + fun adjustContrast( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + + /** + * Return a new `Image` with adjusted color balance. + * + * The original image is not modified. + * + * @param factor Has to be bigger than or equal to 0. + * If 0 <= factor < 1, make image greyer. + * If factor = 1, no changes will be made. + * If factor > 1, increase color balance of image. + * + * @result result1 The new, adjusted image. + */ + @Pure + @PythonName("adjust_color_balance") + fun adjustColorBalance( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + + /** + * Return a blurred version of the image. + * + * The original image is not modified. + * + * @param radius Radius is directly proportional to the blur value. The radius is equal to the amount of pixels united in + * each direction. A radius of 1 will result in a united box of 9 pixels. + * + * @result result1 The blurred image. + */ + @Pure + fun blur( + const radius: Int + ) -> result1: Image where { + radius >= 0 + } + + /** + * Return a sharpened version of the image. + * + * The original image is not modified. + * + * @param factor If factor > 1, increase the sharpness of the image. + * If factor = 1, no changes will be made. + * If factor < 1, blur the image. + * Has to be bigger than or equal to 0 (blurred). + * + * @result result1 The image sharpened by the given factor. + */ + @Pure + fun sharpen( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + + /** + * Return a new `Image` with colors inverted. + * + * The original image is not modified. + * + * @result result1 The image with inverted colors. + */ + @Pure + @PythonName("invert_colors") + fun invertColors() -> result1: Image + + /** + * Return a new `Image` that is rotated 90 degrees clockwise. + * + * The original image is not modified. + * + * @result result1 The image rotated 90 degrees clockwise. + */ + @Pure + @PythonName("rotate_right") + fun rotateRight() -> result1: Image + + /** + * Return a new `Image` that is rotated 90 degrees counter-clockwise. + * + * The original image is not modified. + * + * @result result1 The image rotated 90 degrees counter-clockwise. + */ + @Pure + @PythonName("rotate_left") + fun rotateLeft() -> result1: Image + + /** + * Return a grayscale version of the image with the edges highlighted. + * + * The original image is not modified. + * + * @result result1 The image with edges found. + */ + @Pure + @PythonName("find_edges") + fun findEdges() -> result1: Image + } + ``` + +## `#!sds attr` channel {#safeds.data.image.containers.Image.channel data-toc-label='channel'} + +Get the number of channels of the image. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` height {#safeds.data.image.containers.Image.height data-toc-label='height'} + +Get the height of the image in pixels. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` width {#safeds.data.image.containers.Image.width data-toc-label='width'} + +Get the width of the image in pixels. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` addNoise {#safeds.data.image.containers.Image.addNoise data-toc-label='addNoise'} + +Return a new `Image` with noise added to the image. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `standardDeviation` | [`Float`][safeds.lang.Float] | The standard deviation of the normal distribution. Has to be bigger than or equal to 0. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image with added noise. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="163" + @Pure + @PythonName("add_noise") + fun addNoise( + @PythonName("standard_deviation") const standardDeviation: Float + ) -> result1: Image where { + standardDeviation >= 0.0 + } + ``` + +## `#!sds fun` adjustBrightness {#safeds.data.image.containers.Image.adjustBrightness data-toc-label='adjustBrightness'} + +Return a new `Image` with an adjusted brightness. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `factor` | [`Float`][safeds.lang.Float] | The brightness factor. 1.0 will not change the brightness. Below 1.0 will result in a darker image. Above 1.0 will resolut in a brighter image. Has to be bigger than or equal to 0 (black). | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The Image with adjusted brightness. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="146" + @Pure + @PythonName("adjust_brightness") + fun adjustBrightness( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + ``` + +## `#!sds fun` adjustColorBalance {#safeds.data.image.containers.Image.adjustColorBalance data-toc-label='adjustColorBalance'} + +Return a new `Image` with adjusted color balance. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `factor` | [`Float`][safeds.lang.Float] | Has to be bigger than or equal to 0. If 0 <= factor < 1, make image greyer. If factor = 1, no changes will be made. If factor > 1, increase color balance of image. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The new, adjusted image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="203" + @Pure + @PythonName("adjust_color_balance") + fun adjustColorBalance( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + ``` + +## `#!sds fun` adjustContrast {#safeds.data.image.containers.Image.adjustContrast data-toc-label='adjustContrast'} + +Return a new `Image` with adjusted contrast. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `factor` | [`Float`][safeds.lang.Float] | If factor > 1, increase contrast of image. If factor = 1, no changes will be made. If factor < 1, make image greyer. Has to be bigger than or equal to 0 (gray). | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | New image with adjusted contrast. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="183" + @Pure + @PythonName("adjust_contrast") + fun adjustContrast( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + ``` + +## `#!sds fun` blur {#safeds.data.image.containers.Image.blur data-toc-label='blur'} + +Return a blurred version of the image. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `radius` | [`Int`][safeds.lang.Int] | Radius is directly proportional to the blur value. The radius is equal to the amount of pixels united in each direction. A radius of 1 will result in a united box of 9 pixels. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The blurred image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="221" + @Pure + fun blur( + const radius: Int + ) -> result1: Image where { + radius >= 0 + } + ``` + +## `#!sds fun` convertToGrayscale {#safeds.data.image.containers.Image.convertToGrayscale data-toc-label='convertToGrayscale'} + +Return a new `Image` that is converted to grayscale. + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The grayscale image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="82" + @Pure + @PythonName("convert_to_grayscale") + fun convertToGrayscale() -> result1: Image + ``` + +## `#!sds fun` crop {#safeds.data.image.containers.Image.crop data-toc-label='crop'} + +Return a new `Image` that has been cropped to a given bounding rectangle. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `x` | [`Int`][safeds.lang.Int] | The x coordinate of the top-left corner of the bounding rectangle. | - | +| `y` | [`Int`][safeds.lang.Int] | The y coordinate of the top-left corner of the bounding rectangle. | - | +| `width` | [`Int`][safeds.lang.Int] | The width of the bounding rectangle. | - | +| `height` | [`Int`][safeds.lang.Int] | The height of the bounding rectangle. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The cropped image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="98" + @Pure + fun crop( + const x: Int, + const y: Int, + const width: Int, + const height: Int + ) -> result1: Image where { + x >= 0, + y >= 0, + width >= 0, + height >= 0 + } + ``` + +## `#!sds fun` findEdges {#safeds.data.image.containers.Image.findEdges data-toc-label='findEdges'} + +Return a grayscale version of the image with the edges highlighted. + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image with edges found. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="287" + @Pure + @PythonName("find_edges") + fun findEdges() -> result1: Image + ``` + +## `#!sds fun` flipHorizontally {#safeds.data.image.containers.Image.flipHorizontally data-toc-label='flipHorizontally'} + +Return a new `Image` that is flipped horizontally (vertical axis, flips left-right and vice versa). + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The flipped image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="129" + @Pure + @PythonName("flip_horizontally") + fun flipHorizontally() -> result1: Image + ``` + +## `#!sds fun` flipVertically {#safeds.data.image.containers.Image.flipVertically data-toc-label='flipVertically'} + +Return a new `Image` that is flipped vertically (horizontal axis, flips up-down and vice versa). + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The flipped image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="118" + @Pure + @PythonName("flip_vertically") + fun flipVertically() -> result1: Image + ``` + +## `#!sds fun` invertColors {#safeds.data.image.containers.Image.invertColors data-toc-label='invertColors'} + +Return a new `Image` with colors inverted. + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image with inverted colors. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="254" + @Pure + @PythonName("invert_colors") + fun invertColors() -> result1: Image + ``` + +## `#!sds fun` resize {#safeds.data.image.containers.Image.resize data-toc-label='resize'} + +Return a new `Image` that has been resized to a given size. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `newWidth` | [`Int`][safeds.lang.Int] | The new width of the image. | - | +| `newHeight` | [`Int`][safeds.lang.Int] | The new height of the image. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image with the given width and height. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="66" + @Pure + fun resize( + @PythonName("new_width") const newWidth: Int, + @PythonName("new_height") const newHeight: Int + ) -> result1: Image where { + newWidth >= 0, + newHeight >= 0 + } + ``` + +## `#!sds fun` rotateLeft {#safeds.data.image.containers.Image.rotateLeft data-toc-label='rotateLeft'} + +Return a new `Image` that is rotated 90 degrees counter-clockwise. + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image rotated 90 degrees counter-clockwise. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="276" + @Pure + @PythonName("rotate_left") + fun rotateLeft() -> result1: Image + ``` + +## `#!sds fun` rotateRight {#safeds.data.image.containers.Image.rotateRight data-toc-label='rotateRight'} + +Return a new `Image` that is rotated 90 degrees clockwise. + +The original image is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image rotated 90 degrees clockwise. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="265" + @Pure + @PythonName("rotate_right") + fun rotateRight() -> result1: Image + ``` + +## `#!sds fun` sharpen {#safeds.data.image.containers.Image.sharpen data-toc-label='sharpen'} + +Return a sharpened version of the image. + +The original image is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `factor` | [`Float`][safeds.lang.Float] | If factor > 1, increase the sharpness of the image. If factor = 1, no changes will be made. If factor < 1, blur the image. Has to be bigger than or equal to 0 (blurred). | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image sharpened by the given factor. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="240" + @Pure + fun sharpen( + const factor: Float + ) -> result1: Image where { + factor >= 0.0 + } + ``` + +## `#!sds fun` toJpegFile {#safeds.data.image.containers.Image.toJpegFile data-toc-label='toJpegFile'} + +Save the image as a JPEG file. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the JPEG file. | - | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="39" + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_jpeg_file") + fun toJpegFile( + path: String + ) + ``` + +## `#!sds fun` toPngFile {#safeds.data.image.containers.Image.toPngFile data-toc-label='toPngFile'} + +Save the image as a PNG file. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the PNG file. | - | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="50" + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_png_file") + fun toPngFile( + path: String + ) + ``` + +## `#!sds static fun` fromFile {#safeds.data.image.containers.Image.fromFile data-toc-label='fromFile'} + +Create an image from a file. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the image file. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The image. | + +??? quote "Source code in `image.sdsstub`" + + ```sds linenums="28" + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_file") + static fun fromFile( + path: String + ) -> result1: Image + ``` diff --git a/docs/stdlib/safeds/data/tabular/containers/Column.md b/docs/stdlib/safeds/data/tabular/containers/Column.md new file mode 100644 index 000000000..993eac289 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/containers/Column.md @@ -0,0 +1,773 @@ +# `#!sds class` Column {#safeds.data.tabular.containers.Column data-toc-label='Column'} + +A column is a named collection of values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `name` | [`String`][safeds.lang.String] | The name of the column. | - | +| `data` | [`List`][safeds.lang.List] | The data. | `#!sds []` | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `T` | [`Any?`][safeds.lang.Any] | - | [`Any?`][safeds.lang.Any] | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="12" + class Column( + name: String, + data: List = [] + ) { + /** + * Return the name of the column. + */ + attr name: String + /** + * Return the number of elements in the column. + */ + @PythonName("number_of_rows") attr numberOfRows: Int + /** + * Return the type of the column. + */ + attr type: ColumnType + + /** + * Return a list of all unique values in the column. + * + * @result result1 List of unique values in the column. + */ + @Pure + @PythonName("get_unique_values") + fun getUniqueValues() -> result1: List + + /** + * Return column value at specified index, starting at 0. + * + * @param index Index of requested element. + * + * @result result1 Value at index in column. + */ + @Pure + @PythonName("get_value") + fun getValue( + index: Int + ) -> result1: T + + /** + * Check if all values have a given property. + * + * @param predicate Callable that is used to find matches. + * + * @result result1 True if all match. + */ + @Pure + fun all( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + + /** + * Check if any value has a given property. + * + * @param predicate Callable that is used to find matches. + * + * @result result1 True if any match. + */ + @Pure + fun any( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + + /** + * Check if no values has a given property. + * + * @param predicate Callable that is used to find matches. + * + * @result result1 True if none match. + */ + @Pure + fun none( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + + /** + * Return whether the column has missing values. + * + * @result result1 True if missing values exist. + */ + @Pure + @PythonName("has_missing_values") + fun hasMissingValues() -> result1: Boolean + + /** + * Return a new column with a new name. + * + * The original column is not modified. + * + * @param newName The new name of the column. + * + * @result result1 A new column with the new name. + */ + @Pure + fun rename( + @PythonName("new_name") newName: String + ) -> result1: Column + + /** + * Apply a transform method to every data point. + * + * The original column is not modified. + * + * @param transformer Function that will be applied to all data points. + * + * @result result1 The transformed column. + */ + @Pure + fun transform( + transformer: (param1: T) -> param2: R + ) -> result1: Column + + /** + * Calculate Pearson correlation between this and another column. Both columns have to be numerical. + * + * @result result1 Correlation between the two columns. + */ + @Pure + @PythonName("correlation_with") + fun correlationWith( + @PythonName("other_column") otherColumn: Column + ) -> result1: Float + + /** + * Calculate the idness of this column. + * + * We define the idness as follows: + * + * $$ + * \frac{\text{number of different values}}{\text{number of rows}} + * $$ + * + * @result result1 The idness of the column. + */ + @Pure + fun idness() -> result1: Float + + /** + * Return the maximum value of the column. The column has to be numerical. + * + * @result result1 The maximum value. + */ + @Pure + fun maximum() -> result1: Float + + /** + * Return the mean value of the column. The column has to be numerical. + * + * @result result1 The mean value. + */ + @Pure + fun mean() -> result1: Float + + /** + * Return the median value of the column. The column has to be numerical. + * + * @result result1 The median value. + */ + @Pure + fun median() -> result1: Float + + /** + * Return the minimum value of the column. The column has to be numerical. + * + * @result result1 The minimum value. + */ + @Pure + fun minimum() -> result1: Float + + /** + * Return the ratio of missing values to the total number of elements in the column. + * + * @result result1 The ratio of missing values to the total number of elements in the column. + */ + @Pure + @PythonName("missing_value_ratio") + fun missingValueRatio() -> result1: Float + + /** + * Return the mode of the column. + * + * @result result1 Returns a list with the most common values. + */ + @Pure + fun mode() -> result1: List + + /** + * Calculate the stability of this column. + * + * We define the stability as follows: + * + * $$ + * \frac{\text{number of occurrences of most common non-null value}}{\text{number of non-null values}} + * $$ + * + * The stability is not defined for a column with only null values. + * + * @result result1 The stability of the column. + */ + @Pure + fun stability() -> result1: Float + + /** + * Return the standard deviation of the column. The column has to be numerical. + * + * @result result1 The standard deviation of all values. + */ + @Pure + @PythonName("standard_deviation") + fun standardDeviation() -> result1: Float + + /** + * Return the sum of the column. The column has to be numerical. + * + * @result result1 The sum of all values. + */ + @Pure + fun sum() -> result1: Float + + /** + * Return the variance of the column. The column has to be numerical. + * + * @result result1 The variance of all values. + */ + @Pure + fun variance() -> result1: Float + + /** + * Plot this column in a boxplot. This function can only plot real numerical data. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_boxplot") + fun plotBoxplot() -> result1: Image + + /** + * Plot a column in a histogram. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_histogram") + fun plotHistogram() -> result1: Image + + /** + * Return an HTML representation of the column. + * + * @result result1 The generated HTML. + */ + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + } + ``` + +## `#!sds attr` name {#safeds.data.tabular.containers.Column.name data-toc-label='name'} + +Return the name of the column. + +**Type:** [`String`][safeds.lang.String] + +## `#!sds attr` numberOfRows {#safeds.data.tabular.containers.Column.numberOfRows data-toc-label='numberOfRows'} + +Return the number of elements in the column. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` type {#safeds.data.tabular.containers.Column.type data-toc-label='type'} + +Return the type of the column. + +**Type:** [`ColumnType`][safeds.data.tabular.typing.ColumnType] + +## `#!sds fun` all {#safeds.data.tabular.containers.Column.all data-toc-label='all'} + +Check if all values have a given property. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `predicate` | `#!sds (param1: T) -> (param2: Boolean)` | Callable that is used to find matches. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if all match. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="58" + @Pure + fun all( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + ``` + +## `#!sds fun` any {#safeds.data.tabular.containers.Column.any data-toc-label='any'} + +Check if any value has a given property. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `predicate` | `#!sds (param1: T) -> (param2: Boolean)` | Callable that is used to find matches. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if any match. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="70" + @Pure + fun any( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + ``` + +## `#!sds fun` correlationWith {#safeds.data.tabular.containers.Column.correlationWith data-toc-label='correlationWith'} + +Calculate Pearson correlation between this and another column. Both columns have to be numerical. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `otherColumn` | [`Column`][safeds.data.tabular.containers.Column] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | Correlation between the two columns. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="129" + @Pure + @PythonName("correlation_with") + fun correlationWith( + @PythonName("other_column") otherColumn: Column + ) -> result1: Float + ``` + +## `#!sds fun` getUniqueValues {#safeds.data.tabular.containers.Column.getUniqueValues data-toc-label='getUniqueValues'} + +Return a list of all unique values in the column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | List of unique values in the column. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="34" + @Pure + @PythonName("get_unique_values") + fun getUniqueValues() -> result1: List + ``` + +## `#!sds fun` getValue {#safeds.data.tabular.containers.Column.getValue data-toc-label='getValue'} + +Return column value at specified index, starting at 0. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `index` | [`Int`][safeds.lang.Int] | Index of requested element. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | `#!sds T` | Value at index in column. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="45" + @Pure + @PythonName("get_value") + fun getValue( + index: Int + ) -> result1: T + ``` + +## `#!sds fun` hasMissingValues {#safeds.data.tabular.containers.Column.hasMissingValues data-toc-label='hasMissingValues'} + +Return whether the column has missing values. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if missing values exist. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="92" + @Pure + @PythonName("has_missing_values") + fun hasMissingValues() -> result1: Boolean + ``` + +## `#!sds fun` idness {#safeds.data.tabular.containers.Column.idness data-toc-label='idness'} + +Calculate the idness of this column. + +We define the idness as follows: + +$$ +\frac{\text{number of different values}}{\text{number of rows}} +$$ + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The idness of the column. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="146" + @Pure + fun idness() -> result1: Float + ``` + +## `#!sds fun` maximum {#safeds.data.tabular.containers.Column.maximum data-toc-label='maximum'} + +Return the maximum value of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The maximum value. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="154" + @Pure + fun maximum() -> result1: Float + ``` + +## `#!sds fun` mean {#safeds.data.tabular.containers.Column.mean data-toc-label='mean'} + +Return the mean value of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The mean value. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="162" + @Pure + fun mean() -> result1: Float + ``` + +## `#!sds fun` median {#safeds.data.tabular.containers.Column.median data-toc-label='median'} + +Return the median value of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The median value. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="170" + @Pure + fun median() -> result1: Float + ``` + +## `#!sds fun` minimum {#safeds.data.tabular.containers.Column.minimum data-toc-label='minimum'} + +Return the minimum value of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The minimum value. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="178" + @Pure + fun minimum() -> result1: Float + ``` + +## `#!sds fun` missingValueRatio {#safeds.data.tabular.containers.Column.missingValueRatio data-toc-label='missingValueRatio'} + +Return the ratio of missing values to the total number of elements in the column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The ratio of missing values to the total number of elements in the column. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="186" + @Pure + @PythonName("missing_value_ratio") + fun missingValueRatio() -> result1: Float + ``` + +## `#!sds fun` mode {#safeds.data.tabular.containers.Column.mode data-toc-label='mode'} + +Return the mode of the column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | Returns a list with the most common values. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="195" + @Pure + fun mode() -> result1: List + ``` + +## `#!sds fun` none {#safeds.data.tabular.containers.Column.none data-toc-label='none'} + +Check if no values has a given property. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `predicate` | `#!sds (param1: T) -> (param2: Boolean)` | Callable that is used to find matches. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if none match. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="82" + @Pure + fun none( + predicate: (param1: T) -> param2: Boolean + ) -> result1: Boolean + ``` + +## `#!sds fun` plotBoxplot {#safeds.data.tabular.containers.Column.plotBoxplot data-toc-label='plotBoxplot'} + +Plot this column in a boxplot. This function can only plot real numerical data. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="244" + @Pure + @PythonName("plot_boxplot") + fun plotBoxplot() -> result1: Image + ``` + +## `#!sds fun` plotHistogram {#safeds.data.tabular.containers.Column.plotHistogram data-toc-label='plotHistogram'} + +Plot a column in a histogram. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="253" + @Pure + @PythonName("plot_histogram") + fun plotHistogram() -> result1: Image + ``` + +## `#!sds fun` rename {#safeds.data.tabular.containers.Column.rename data-toc-label='rename'} + +Return a new column with a new name. + +The original column is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `newName` | [`String`][safeds.lang.String] | The new name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Column`][safeds.data.tabular.containers.Column] | A new column with the new name. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="105" + @Pure + fun rename( + @PythonName("new_name") newName: String + ) -> result1: Column + ``` + +## `#!sds fun` stability {#safeds.data.tabular.containers.Column.stability data-toc-label='stability'} + +Calculate the stability of this column. + +We define the stability as follows: + +$$ +\frac{\text{number of occurrences of most common non-null value}}{\text{number of non-null values}} +$$ + +The stability is not defined for a column with only null values. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The stability of the column. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="211" + @Pure + fun stability() -> result1: Float + ``` + +## `#!sds fun` standardDeviation {#safeds.data.tabular.containers.Column.standardDeviation data-toc-label='standardDeviation'} + +Return the standard deviation of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The standard deviation of all values. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="219" + @Pure + @PythonName("standard_deviation") + fun standardDeviation() -> result1: Float + ``` + +## `#!sds fun` sum {#safeds.data.tabular.containers.Column.sum data-toc-label='sum'} + +Return the sum of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The sum of all values. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="228" + @Pure + fun sum() -> result1: Float + ``` + +## `#!sds fun` toHtml {#safeds.data.tabular.containers.Column.toHtml data-toc-label='toHtml'} + +Return an HTML representation of the column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`String`][safeds.lang.String] | The generated HTML. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="262" + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + ``` + +## `#!sds fun` transform {#safeds.data.tabular.containers.Column.transform data-toc-label='transform'} + +Apply a transform method to every data point. + +The original column is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `transformer` | `#!sds (param1: T) -> (param2: R)` | Function that will be applied to all data points. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Column`][safeds.data.tabular.containers.Column] | The transformed column. | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `R` | [`Any?`][safeds.lang.Any] | - | - | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="119" + @Pure + fun transform( + transformer: (param1: T) -> param2: R + ) -> result1: Column + ``` + +## `#!sds fun` variance {#safeds.data.tabular.containers.Column.variance data-toc-label='variance'} + +Return the variance of the column. The column has to be numerical. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Float`][safeds.lang.Float] | The variance of all values. | + +??? quote "Source code in `column.sdsstub`" + + ```sds linenums="236" + @Pure + fun variance() -> result1: Float + ``` diff --git a/docs/stdlib/safeds/data/tabular/containers/Row.md b/docs/stdlib/safeds/data/tabular/containers/Row.md new file mode 100644 index 000000000..6d133a40b --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/containers/Row.md @@ -0,0 +1,281 @@ +# `#!sds class` Row {#safeds.data.tabular.containers.Row data-toc-label='Row'} + +A row is a collection of named values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map>?`][safeds.lang.Map] | The data. If None, an empty row is created. | `#!sds null` | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="10" + class Row( + data: Map>? = null // TODO: update default value to empty map + ) { + /** + * Return a list of all column names in the row. + */ + @PythonName("column_names") attr columnNames: List + /** + * Return the number of columns in this row. + */ + @PythonName("number_of_column") attr numberOfColumn: Int + /** + * Return the schema of the row. + */ + attr `schema`: Schema + + /** + * Create a row from a dictionary that maps column names to column values. + * + * @param data The data. + * + * @result result1 The created row. + */ + @Pure + @PythonName("from_dict") + static fun fromDict( + data: Map + ) -> result1: Row + + /** + * Return the value of a specified column. + * + * @param columnName The column name. + * + * @result result1 The column value. + */ + @Pure + @PythonName("get_value") + fun getValue( + @PythonName("column_name") columnName: String + ) -> result1: Any + + /** + * Check whether the row contains a given column. + * + * @param columnName The column name. + * + * @result result1 True, if the row contains the column, False otherwise. + */ + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + + /** + * Return the type of the specified column. + * + * @param columnName The column name. + * + * @result result1 The type of the column. + */ + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + + // // TODO Safe-DS does not support tuple types. + // /** + // * Sort the columns of a `Row` with the given comparator and return a new `Row`. + // * + // * The original row is not modified. The comparator is a function that takes two tuples of (ColumnName, + // * Value) `col1` and `col2` and returns an integer: + // * + // * * If `col1` should be ordered before `col2`, the function should return a negative number. + // * * If `col1` should be ordered after `col2`, the function should return a positive number. + // * * If the original order of `col1` and `col2` should be kept, the function should return 0. + // * + // * If no comparator is given, the columns will be sorted alphabetically by their name. + // * + // * @param comparator The function used to compare two tuples of (ColumnName, Value). + // * + // * @result result1 A new row with sorted columns. + // */ + // @Pure + // @PythonName("sort_columns") + // fun sortColumns( + // comparator: (param1: Tuple, param2: Tuple) -> param3: Int + // ) -> result1: Row + + /** + * Return a dictionary that maps column names to column values. + * + * @result result1 Dictionary representation of the row. + */ + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map + + /** + * Return an HTML representation of the row. + * + * @result result1 The generated HTML. + */ + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + } + ``` + +## `#!sds attr` columnNames {#safeds.data.tabular.containers.Row.columnNames data-toc-label='columnNames'} + +Return a list of all column names in the row. + +**Type:** [`List`][safeds.lang.List] + +## `#!sds attr` numberOfColumn {#safeds.data.tabular.containers.Row.numberOfColumn data-toc-label='numberOfColumn'} + +Return the number of columns in this row. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` schema {#safeds.data.tabular.containers.Row.schema data-toc-label='schema'} + +Return the schema of the row. + +**Type:** [`Schema`][safeds.data.tabular.typing.Schema] + +## `#!sds fun` getColumnType {#safeds.data.tabular.containers.Row.getColumnType data-toc-label='getColumnType'} + +Return the type of the specified column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The column name. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`ColumnType`][safeds.data.tabular.typing.ColumnType] | The type of the column. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="72" + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + ``` + +## `#!sds fun` getValue {#safeds.data.tabular.containers.Row.getValue data-toc-label='getValue'} + +Return the value of a specified column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The column name. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Any`][safeds.lang.Any] | The column value. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="46" + @Pure + @PythonName("get_value") + fun getValue( + @PythonName("column_name") columnName: String + ) -> result1: Any + ``` + +## `#!sds fun` hasColumn {#safeds.data.tabular.containers.Row.hasColumn data-toc-label='hasColumn'} + +Check whether the row contains a given column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The column name. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True, if the row contains the column, False otherwise. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="59" + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + ``` + +## `#!sds fun` toDict {#safeds.data.tabular.containers.Row.toDict data-toc-label='toDict'} + +Return a dictionary that maps column names to column values. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Map`][safeds.lang.Map] | Dictionary representation of the row. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="106" + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map + ``` + +## `#!sds fun` toHtml {#safeds.data.tabular.containers.Row.toHtml data-toc-label='toHtml'} + +Return an HTML representation of the row. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`String`][safeds.lang.String] | The generated HTML. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="115" + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + ``` + +## `#!sds static fun` fromDict {#safeds.data.tabular.containers.Row.fromDict data-toc-label='fromDict'} + +Create a row from a dictionary that maps column names to column values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map`][safeds.lang.Map] | The data. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Row`][safeds.data.tabular.containers.Row] | The created row. | + +??? quote "Source code in `row.sdsstub`" + + ```sds linenums="33" + @Pure + @PythonName("from_dict") + static fun fromDict( + data: Map + ) -> result1: Row + ``` diff --git a/docs/stdlib/safeds/data/tabular/containers/Table.md b/docs/stdlib/safeds/data/tabular/containers/Table.md new file mode 100644 index 000000000..ace37de2d --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/containers/Table.md @@ -0,0 +1,2017 @@ +# `#!sds class` Table {#safeds.data.tabular.containers.Table data-toc-label='Table'} + +A table is a two-dimensional collection of data. It can either be seen as a list of rows or as a list of columns. + +To create a `Table` call the constructor or use one of the following static methods: + +| Method | Description | +| ------------------------------------------------------------------| -------------------------------------- | +| [fromCsvFile][safeds.data.tabular.containers.Table.fromCsvFile] | Create a table from a CSV file. | +| [fromJsonFile][safeds.data.tabular.containers.Table.fromJsonFile] | Create a table from a JSON file. | +| [fromDict][safeds.data.tabular.containers.Table.fromDict] | Create a table from a dictionary. | +| [fromColumns][safeds.data.tabular.containers.Table.fromColumns] | Create a table from a list of columns. | +| [fromRows][safeds.data.tabular.containers.Table.fromRows] | Create a table from a list of rows. | + +Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map>?`][safeds.lang.Map] | The data. If None, an empty table is created. | `#!sds null` | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="25" + class Table( + data: Map>? = null // TODO: update default value to empty map + ) { + /** + * Return a list of all column names in this table. + * + * Alias for self.schema.column_names -> list[str]. + */ + @PythonName("column_names") attr columnNames: List + /** + * Return the number of columns. + */ + @PythonName("number_of_columns") attr numberOfColumns: Int + /** + * Return the number of rows. + */ + @PythonName("number_of_rows") attr numberOfRows: Int + /** + * Return the schema of the table. + */ + attr `schema`: Schema + + /** + * Read data from a CSV file into a table. + * + * @param path The path to the CSV file. + * + * @result result1 The table created from the CSV file. + */ + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_csv_file") + static fun fromCsvFile( + path: String + ) -> result1: Table + + /** + * Read data from an Excel file into a table. + * + * Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`. + * + * @param path The path to the Excel file. + * + * @result result1 The table created from the Excel file. + */ + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_excel_file") + static fun fromExcelFile( + path: String + ) -> result1: Table + + /** + * Read data from a JSON file into a table. + * + * @param path The path to the JSON file. + * + * @result result1 The table created from the JSON file. + */ + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_json_file") + static fun fromJsonFile( + path: String + ) -> result1: Table + + /** + * Create a table from a dictionary that maps column names to column values. + * + * @param data The data. + * + * @result result1 The generated table. + */ + @Pure + @PythonName("from_dict") + static fun fromDict( + data: Map> + ) -> result1: Table + + /** + * Return a table created from a list of columns. + * + * @param columns The columns to be combined. They need to have the same size. + * + * @result result1 The generated table. + */ + @Pure + @PythonName("from_columns") + static fun fromColumns( + columns: List + ) -> result1: Table + + /** + * Return a table created from a list of rows. + * + * @param rows The rows to be combined. They need to have a matching schema. + * + * @result result1 The generated table. + */ + @Pure + @PythonName("from_rows") + static fun fromRows( + rows: List + ) -> result1: Table + + /** + * Return a column with the data of the specified column. + * + * @param columnName The name of the column. + * + * @result result1 The column. + */ + @Pure + @PythonName("get_column") + fun getColumn( + @PythonName("column_name") columnName: String + ) -> result1: Column + + /** + * Return whether the table contains a given column. + * + * Alias for self.schema.hasColumn(column_name: str) -> bool. + * + * @param columnName The name of the column. + * + * @result result1 True if the column exists. + */ + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + + /** + * Return the type of the given column. + * + * Alias for self.schema.get_type_of_column(column_name: str) -> ColumnType. + * + * @param columnName The name of the column to be queried. + * + * @result result1 The type of the column. + */ + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + + /** + * Return the row at a specified index. + * + * @param index The index. + * + * @result result1 The row of the table at the index. + */ + @Pure + @PythonName("get_row") + fun getRow( + index: Int + ) -> result1: Row + + /** + * Return a table with a number of statistical key values. + * + * The original table is not modified. + * + * @result result1 The table with statistics. + */ + @Pure + @PythonName("summarize_statistics") + fun summarizeStatistics() -> result1: Table + + /** + * Return a new table with the provided column attached at the end. + * + * The original table is not modified. + * + * @result result1 The table with the column attached. + */ + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: Table + + /** + * Return a new `Table` with multiple added columns. + * + * The original table is not modified. + * + * @param columns The columns to be added. + * + * @result result1 A new table combining the original table and the given columns. + */ + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: Table + + /** + * Return a new `Table` with an added Row attached. + * + * If the table happens to be empty beforehand, respective columns will be added automatically. + * + * The order of columns of the new row will be adjusted to the order of columns in the table. + * The new table will contain the merged schema. + * + * The original table is not modified. + * + * @param row The row to be added. + * + * @result result1 A new table with the added row at the end. + */ + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: Table + + /** + * Return a new `Table` with multiple added Rows attached. + * + * The order of columns of the new rows will be adjusted to the order of columns in the table. + * The new table will contain the merged schema. + * + * The original table is not modified. + * + * @param rows The rows to be added. + * + * @result result1 A new table which combines the original table and the given rows. + */ + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: Table + + /** + * Return a new table with rows filtered by Callable (e.g. lambda function). + * + * The original table is not modified. + * + * @param query A Callable that is applied to all rows. + * + * @result result1 A table containing only the rows filtered by the query. + */ + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: Table + + /** + * Return a dictionary with copies of the output tables as values and the keys from the key_selector. + * + * The original table is not modified. + * + * @param keySelector A Callable that is applied to all rows and returns the key of the group. + * + * @result result1 A dictionary containing the new tables as values and the selected keys as keys. + */ + @Pure + @PythonName("group_rows_by") + fun groupRowsBy( + @PythonName("key_selector") keySelector: (param1: Row) -> param2: T + ) -> result1: Map + + /** + * Return a new table with only the given column(s). + * + * The original table is not modified. + * + * Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + * + * @param columnNames A list containing only the columns to be kept. + * + * @result result1 A table containing only the given column(s). + */ + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: Table + + /** + * Return a new table without the given column(s). + * + * The original table is not modified. + * + * Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + * + * @param columnNames A list containing all columns to be dropped. + * + * @result result1 A table without the given columns. + */ + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: Table + + /** + * Return a new table without the columns that contain missing values. + * + * The original table is not modified. + * + * Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + * + * @result result1 A table without the columns that contain missing values. + */ + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: Table + + /** + * Return a new table without the columns that contain non-numerical values. + * + * The original table is not modified. + * + * Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + * + * @result result1 A table without the columns that contain non-numerical values. + */ + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: Table + + /** + * Return a new table with every duplicate row removed. + * + * The original table is not modified. + * + * @result result1 The table with the duplicate rows removed. + */ + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: Table + + /** + * Return a new table without the rows that contain missing values. + * + * The original table is not modified. + * + * @result result1 A table without the rows that contain missing values. + */ + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: Table + + /** + * Return a new table without those rows that contain at least one outlier. + * + * We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. + * Missing values are not considered outliers. They are also ignored during the calculation of the standard + * deviation. + * + * The original table is not modified. + * + * @result result1 A new table without rows containing outliers. + */ + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: Table + + /** + * Return a new `Table` with a single column renamed. + * + * The original table is not modified. + * + * @param oldName The old name of the target column. + * @param newName The new name of the target column. + * + * @result result1 The Table with the renamed column. + */ + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: Table + + /** + * Return a new table with the specified old column replaced by a list of new columns. + * + * The order of columns is kept. + * + * The original table is not modified. + * + * @param oldColumnName The name of the column to be replaced. + * @param newColumns The list of new columns replacing the old column. + * + * @result result1 A table with the old column replaced by the new columns. + */ + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: Table + + /** + * Return a new `Table` with randomly shuffled rows of this `Table`. + * + * The original table is not modified. + * + * @result result1 The shuffled Table. + */ + @Pure + @PythonName("shuffle_rows") + fun shuffleRows() -> result1: Table + + /** + * Slice a part of the table into a new table. + * + * The original table is not modified. + * + * @param start The first index of the range to be copied into a new table, None by default. + * @param end The last index of the range to be copied into a new table, None by default. + * @param step The step size used to iterate through the table, 1 by default. + * + * @result result1 The resulting table. + */ + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: Table + + /** + * Sort the columns of a `Table` with the given comparator and return a new `Table`. + * + * The comparator is a function that takes two columns `col1` and `col2` and + * returns an integer: + * + * * If `col1` should be ordered before `col2`, the function should return a negative number. + * * If `col1` should be ordered after `col2`, the function should return a positive number. + * * If the original order of `col1` and `col2` should be kept, the function should return 0. + * + * If no comparator is given, the columns will be sorted alphabetically by their name. + * + * The original table is not modified. + * + * @param comparator The function used to compare two columns. + * + * @result result1 A new table with sorted columns. + */ + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: Table + + /** + * Sort the rows of a `Table` with the given comparator and return a new `Table`. + * + * The comparator is a function that takes two rows `row1` and `row2` and + * returns an integer: + * + * * If `row1` should be ordered before `row2`, the function should return a negative number. + * * If `row1` should be ordered after `row2`, the function should return a positive number. + * * If the original order of `row1` and `row2` should be kept, the function should return 0. + * + * The original table is not modified. + * + * @param comparator The function used to compare two rows. + * + * @result result1 A new table with sorted rows. + */ + @Pure + @PythonName("sort_rows") + fun sortRows( + comparator: (param1: Row, param2: Row) -> param3: Int + ) -> result1: Table + + /** + * Split the table into two new tables. + * + * The original table is not modified. + * + * @param percentageInFirst The desired size of the first table in percentage to the given table; must be between 0 and 1. + * + * @result result1 A tuple containing the two resulting tables. The first table has the specified size, the second table + * contains the rest of the data. + * @result result2 A tuple containing the two resulting tables. The first table has the specified size, the second table + * contains the rest of the data. + */ + @Pure + @PythonName("split_rows") + fun splitRows( + @PythonName("percentage_in_first") percentageInFirst: Float + ) -> (result1: Table, result2: Table) + + /** + * Return a new `TaggedTable` with columns marked as a target column or feature columns. + * + * The original table is not modified. + * + * @param targetName Name of the target column. + * @param featureNames Names of the feature columns. If None, all columns except the target column are used. + * + * @result result1 A new tagged table with the given target and feature names. + */ + @Pure + @PythonName("tag_columns") + fun tagColumns( + @PythonName("target_name") targetName: String, + @PythonName("feature_names") featureNames: List? = null + ) -> result1: TaggedTable + + /** + * Return a new `TimeSeries` with columns marked as a target and time column or feature columns. + * + * The original table is not modified. + * + * @param targetName Name of the target column. + * @param timeName Name of the time column. + * @param featureNames Names of the feature columns. If None, all columns except the target and time columns are used. + * + * @result result1 A new time series with the given target, time and feature names. + */ + @Pure + @PythonName("time_columns") + fun timeColumns( + @PythonName("target_name") targetName: String, + @PythonName("time_name") timeName: String, + @PythonName("feature_names") featureNames: List? = null + ) -> result1: TimeSeries + + /** + * Return a new `Table` with the provided column transformed by calling the provided transformer. + * + * The original table is not modified. + * + * @result result1 The table with the transformed column. + */ + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: Table + + /** + * Return a new `Table` with a learned transformation applied to this table. + * + * The original table is not modified. + * + * @param transformer The transformer which transforms the given table. + * + * @result result1 The transformed table. + */ + @Pure + @PythonName("transform_table") + fun transformTable( + transformer: TableTransformer + ) -> result1: Table + + /** + * Return a new `Table` with the inverted transformation applied by the given transformer. + * + * The original table is not modified. + * + * @param transformer A transformer that was fitted with columns, which are all present in the table. + * + * @result result1 The original table. + */ + @Pure + @PythonName("inverse_transform_table") + fun inverseTransformTable( + transformer: InvertibleTableTransformer + ) -> result1: Table + + /** + * Plot a correlation heatmap for all numerical columns of this `Table`. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_correlation_heatmap") + fun plotCorrelationHeatmap() -> result1: Image + + /** + * Plot two columns against each other in a lineplot. + * + * If there are multiple x-values for a y-value, the resulting plot will consist of a line representing the mean + * and the lower-transparency area around the line representing the 95% confidence interval. + * + * @param xColumnName The column name of the column to be plotted on the x-Axis. + * @param yColumnName The column name of the column to be plotted on the y-Axis. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_lineplot") + fun plotLineplot( + @PythonName("x_column_name") xColumnName: String, + @PythonName("y_column_name") yColumnName: String + ) -> result1: Image + + /** + * Plot two columns against each other in a scatterplot. + * + * @param xColumnName The column name of the column to be plotted on the x-Axis. + * @param yColumnName The column name of the column to be plotted on the y-Axis. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_scatterplot") + fun plotScatterplot( + @PythonName("x_column_name") xColumnName: String, + @PythonName("y_column_name") yColumnName: String + ) -> result1: Image + + /** + * Plot a boxplot for every numerical column. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_boxplots") + fun plotBoxplots() -> result1: Image + + /** + * Plot a histogram for every column. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_histograms") + fun plotHistograms() -> result1: Image + + /** + * Write the data from the table into a CSV file. + * + * If the file and/or the directories do not exist they will be created. If the file already exists it will be + * overwritten. + * + * @param path The path to the output file. + */ + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_csv_file") + fun toCsvFile( + path: String + ) + + /** + * Write the data from the table into an Excel file. + * + * Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`. + * If the file and/or the directories do not exist, they will be created. If the file already exists, it will be + * overwritten. + * + * @param path The path to the output file. + */ + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_excel_file") + fun toExcelFile( + path: String + ) + + /** + * Write the data from the table into a JSON file. + * + * If the file and/or the directories do not exist, they will be created. If the file already exists it will be + * overwritten. + * + * @param path The path to the output file. + */ + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_json_file") + fun toJsonFile( + path: String + ) + + /** + * Return a dictionary that maps column names to column values. + * + * @result result1 Dictionary representation of the table. + */ + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map> + + /** + * Return an HTML representation of the table. + * + * @result result1 The generated HTML. + */ + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + + /** + * Return a list of the columns. + * + * @result result1 List of columns. + */ + @Pure + @PythonName("to_columns") + fun toColumns() -> result1: List + + /** + * Return a list of the rows. + * + * @result result1 List of rows. + */ + @Pure + @PythonName("to_rows") + fun toRows() -> result1: List + } + ``` + +## `#!sds attr` columnNames {#safeds.data.tabular.containers.Table.columnNames data-toc-label='columnNames'} + +Return a list of all column names in this table. + +Alias for self.schema.column_names -> list[str]. + +**Type:** [`List`][safeds.lang.List] + +## `#!sds attr` numberOfColumns {#safeds.data.tabular.containers.Table.numberOfColumns data-toc-label='numberOfColumns'} + +Return the number of columns. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` numberOfRows {#safeds.data.tabular.containers.Table.numberOfRows data-toc-label='numberOfRows'} + +Return the number of rows. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds attr` schema {#safeds.data.tabular.containers.Table.schema data-toc-label='schema'} + +Return the schema of the table. + +**Type:** [`Schema`][safeds.data.tabular.typing.Schema] + +## `#!sds fun` addColumn {#safeds.data.tabular.containers.Table.addColumn data-toc-label='addColumn'} + +Return a new table with the provided column attached at the end. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `column` | [`Column`][safeds.data.tabular.containers.Column] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table with the column attached. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="201" + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: Table + ``` + +## `#!sds fun` addColumns {#safeds.data.tabular.containers.Table.addColumns data-toc-label='addColumns'} + +Return a new `Table` with multiple added columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | `#!sds union>, Table>` | The columns to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table combining the original table and the given columns. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="216" + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: Table + ``` + +## `#!sds fun` addRow {#safeds.data.tabular.containers.Table.addRow data-toc-label='addRow'} + +Return a new `Table` with an added Row attached. + +If the table happens to be empty beforehand, respective columns will be added automatically. + +The order of columns of the new row will be adjusted to the order of columns in the table. +The new table will contain the merged schema. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `row` | [`Row`][safeds.data.tabular.containers.Row] | The row to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table with the added row at the end. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="236" + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: Table + ``` + +## `#!sds fun` addRows {#safeds.data.tabular.containers.Table.addRows data-toc-label='addRows'} + +Return a new `Table` with multiple added Rows attached. + +The order of columns of the new rows will be adjusted to the order of columns in the table. +The new table will contain the merged schema. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `rows` | `#!sds union, Table>` | The rows to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table which combines the original table and the given rows. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="254" + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: Table + ``` + +## `#!sds fun` filterRows {#safeds.data.tabular.containers.Table.filterRows data-toc-label='filterRows'} + +Return a new table with rows filtered by Callable (e.g. lambda function). + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `query` | `#!sds (param1: Row) -> (param2: Boolean)` | A Callable that is applied to all rows. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table containing only the rows filtered by the query. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="269" + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: Table + ``` + +## `#!sds fun` getColumn {#safeds.data.tabular.containers.Table.getColumn data-toc-label='getColumn'} + +Return a column with the data of the specified column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Column`][safeds.data.tabular.containers.Column] | The column. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="134" + @Pure + @PythonName("get_column") + fun getColumn( + @PythonName("column_name") columnName: String + ) -> result1: Column + ``` + +## `#!sds fun` getColumnType {#safeds.data.tabular.containers.Table.getColumnType data-toc-label='getColumnType'} + +Return the type of the given column. + +Alias for self.schema.get_type_of_column(column_name: str) -> ColumnType. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The name of the column to be queried. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`ColumnType`][safeds.data.tabular.typing.ColumnType] | The type of the column. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="164" + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + ``` + +## `#!sds fun` getRow {#safeds.data.tabular.containers.Table.getRow data-toc-label='getRow'} + +Return the row at a specified index. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `index` | [`Int`][safeds.lang.Int] | The index. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Row`][safeds.data.tabular.containers.Row] | The row of the table at the index. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="177" + @Pure + @PythonName("get_row") + fun getRow( + index: Int + ) -> result1: Row + ``` + +## `#!sds fun` groupRowsBy {#safeds.data.tabular.containers.Table.groupRowsBy data-toc-label='groupRowsBy'} + +Return a dictionary with copies of the output tables as values and the keys from the key_selector. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `keySelector` | `#!sds (param1: Row) -> (param2: T)` | A Callable that is applied to all rows and returns the key of the group. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Map`][safeds.lang.Map] | A dictionary containing the new tables as values and the selected keys as keys. | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `T` | [`Any?`][safeds.lang.Any] | - | - | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="284" + @Pure + @PythonName("group_rows_by") + fun groupRowsBy( + @PythonName("key_selector") keySelector: (param1: Row) -> param2: T + ) -> result1: Map + ``` + +## `#!sds fun` hasColumn {#safeds.data.tabular.containers.Table.hasColumn data-toc-label='hasColumn'} + +Return whether the table contains a given column. + +Alias for self.schema.hasColumn(column_name: str) -> bool. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if the column exists. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="149" + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + ``` + +## `#!sds fun` inverseTransformTable {#safeds.data.tabular.containers.Table.inverseTransformTable data-toc-label='inverseTransformTable'} + +Return a new `Table` with the inverted transformation applied by the given transformer. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `transformer` | [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] | A transformer that was fitted with columns, which are all present in the table. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The original table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="591" + @Pure + @PythonName("inverse_transform_table") + fun inverseTransformTable( + transformer: InvertibleTableTransformer + ) -> result1: Table + ``` + +## `#!sds fun` keepOnlyColumns {#safeds.data.tabular.containers.Table.keepOnlyColumns data-toc-label='keepOnlyColumns'} + +Return a new table with only the given column(s). + +The original table is not modified. + +Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | A list containing only the columns to be kept. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table containing only the given column(s). | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="301" + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: Table + ``` + +## `#!sds fun` plotBoxplots {#safeds.data.tabular.containers.Table.plotBoxplots data-toc-label='plotBoxplots'} + +Plot a boxplot for every numerical column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="644" + @Pure + @PythonName("plot_boxplots") + fun plotBoxplots() -> result1: Image + ``` + +## `#!sds fun` plotCorrelationHeatmap {#safeds.data.tabular.containers.Table.plotCorrelationHeatmap data-toc-label='plotCorrelationHeatmap'} + +Plot a correlation heatmap for all numerical columns of this `Table`. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="602" + @Pure + @PythonName("plot_correlation_heatmap") + fun plotCorrelationHeatmap() -> result1: Image + ``` + +## `#!sds fun` plotHistograms {#safeds.data.tabular.containers.Table.plotHistograms data-toc-label='plotHistograms'} + +Plot a histogram for every column. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="653" + @Pure + @PythonName("plot_histograms") + fun plotHistograms() -> result1: Image + ``` + +## `#!sds fun` plotLineplot {#safeds.data.tabular.containers.Table.plotLineplot data-toc-label='plotLineplot'} + +Plot two columns against each other in a lineplot. + +If there are multiple x-values for a y-value, the resulting plot will consist of a line representing the mean +and the lower-transparency area around the line representing the 95% confidence interval. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `xColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis. | - | +| `yColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="617" + @Pure + @PythonName("plot_lineplot") + fun plotLineplot( + @PythonName("x_column_name") xColumnName: String, + @PythonName("y_column_name") yColumnName: String + ) -> result1: Image + ``` + +## `#!sds fun` plotScatterplot {#safeds.data.tabular.containers.Table.plotScatterplot data-toc-label='plotScatterplot'} + +Plot two columns against each other in a scatterplot. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `xColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis. | - | +| `yColumnName` | [`String`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="632" + @Pure + @PythonName("plot_scatterplot") + fun plotScatterplot( + @PythonName("x_column_name") xColumnName: String, + @PythonName("y_column_name") yColumnName: String + ) -> result1: Image + ``` + +## `#!sds fun` removeColumns {#safeds.data.tabular.containers.Table.removeColumns data-toc-label='removeColumns'} + +Return a new table without the given column(s). + +The original table is not modified. + +Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | A list containing all columns to be dropped. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table without the given columns. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="318" + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: Table + ``` + +## `#!sds fun` removeColumnsWithMissingValues {#safeds.data.tabular.containers.Table.removeColumnsWithMissingValues data-toc-label='removeColumnsWithMissingValues'} + +Return a new table without the columns that contain missing values. + +The original table is not modified. + +Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table without the columns that contain missing values. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="333" + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: Table + ``` + +## `#!sds fun` removeColumnsWithNonNumericalValues {#safeds.data.tabular.containers.Table.removeColumnsWithNonNumericalValues data-toc-label='removeColumnsWithNonNumericalValues'} + +Return a new table without the columns that contain non-numerical values. + +The original table is not modified. + +Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table without the columns that contain non-numerical values. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="346" + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: Table + ``` + +## `#!sds fun` removeDuplicateRows {#safeds.data.tabular.containers.Table.removeDuplicateRows data-toc-label='removeDuplicateRows'} + +Return a new table with every duplicate row removed. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table with the duplicate rows removed. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="357" + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: Table + ``` + +## `#!sds fun` removeRowsWithMissingValues {#safeds.data.tabular.containers.Table.removeRowsWithMissingValues data-toc-label='removeRowsWithMissingValues'} + +Return a new table without the rows that contain missing values. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table without the rows that contain missing values. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="368" + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: Table + ``` + +## `#!sds fun` removeRowsWithOutliers {#safeds.data.tabular.containers.Table.removeRowsWithOutliers data-toc-label='removeRowsWithOutliers'} + +Return a new table without those rows that contain at least one outlier. + +We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. +Missing values are not considered outliers. They are also ignored during the calculation of the standard +deviation. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table without rows containing outliers. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="383" + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: Table + ``` + +## `#!sds fun` renameColumn {#safeds.data.tabular.containers.Table.renameColumn data-toc-label='renameColumn'} + +Return a new `Table` with a single column renamed. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldName` | [`String`][safeds.lang.String] | The old name of the target column. | - | +| `newName` | [`String`][safeds.lang.String] | The new name of the target column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The Table with the renamed column. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="397" + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: Table + ``` + +## `#!sds fun` replaceColumn {#safeds.data.tabular.containers.Table.replaceColumn data-toc-label='replaceColumn'} + +Return a new table with the specified old column replaced by a list of new columns. + +The order of columns is kept. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldColumnName` | [`String`][safeds.lang.String] | The name of the column to be replaced. | - | +| `newColumns` | [`List>`][safeds.lang.List] | The list of new columns replacing the old column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A table with the old column replaced by the new columns. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="416" + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: Table + ``` + +## `#!sds fun` shuffleRows {#safeds.data.tabular.containers.Table.shuffleRows data-toc-label='shuffleRows'} + +Return a new `Table` with randomly shuffled rows of this `Table`. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The shuffled Table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="430" + @Pure + @PythonName("shuffle_rows") + fun shuffleRows() -> result1: Table + ``` + +## `#!sds fun` sliceRows {#safeds.data.tabular.containers.Table.sliceRows data-toc-label='sliceRows'} + +Slice a part of the table into a new table. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `start` | [`Int?`][safeds.lang.Int] | The first index of the range to be copied into a new table, None by default. | `#!sds null` | +| `end` | [`Int?`][safeds.lang.Int] | The last index of the range to be copied into a new table, None by default. | `#!sds null` | +| `step` | [`Int`][safeds.lang.Int] | The step size used to iterate through the table, 1 by default. | `#!sds 1` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The resulting table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="445" + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: Table + ``` + +## `#!sds fun` sortColumns {#safeds.data.tabular.containers.Table.sortColumns data-toc-label='sortColumns'} + +Sort the columns of a `Table` with the given comparator and return a new `Table`. + +The comparator is a function that takes two columns `col1` and `col2` and +returns an integer: + +* If `col1` should be ordered before `col2`, the function should return a negative number. +* If `col1` should be ordered after `col2`, the function should return a positive number. +* If the original order of `col1` and `col2` should be kept, the function should return 0. + +If no comparator is given, the columns will be sorted alphabetically by their name. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (param1: Column, param2: Column) -> (param3: Int)` | The function used to compare two columns. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table with sorted columns. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="471" + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: Table + ``` + +## `#!sds fun` sortRows {#safeds.data.tabular.containers.Table.sortRows data-toc-label='sortRows'} + +Sort the rows of a `Table` with the given comparator and return a new `Table`. + +The comparator is a function that takes two rows `row1` and `row2` and +returns an integer: + +* If `row1` should be ordered before `row2`, the function should return a negative number. +* If `row1` should be ordered after `row2`, the function should return a positive number. +* If the original order of `row1` and `row2` should be kept, the function should return 0. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (param1: Row, param2: Row) -> (param3: Int)` | The function used to compare two rows. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A new table with sorted rows. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="493" + @Pure + @PythonName("sort_rows") + fun sortRows( + comparator: (param1: Row, param2: Row) -> param3: Int + ) -> result1: Table + ``` + +## `#!sds fun` splitRows {#safeds.data.tabular.containers.Table.splitRows data-toc-label='splitRows'} + +Split the table into two new tables. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `percentageInFirst` | [`Float`][safeds.lang.Float] | The desired size of the first table in percentage to the given table; must be between 0 and 1. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | A tuple containing the two resulting tables. The first table has the specified size, the second table contains the rest of the data. | +| `result2` | [`Table`][safeds.data.tabular.containers.Table] | A tuple containing the two resulting tables. The first table has the specified size, the second table contains the rest of the data. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="511" + @Pure + @PythonName("split_rows") + fun splitRows( + @PythonName("percentage_in_first") percentageInFirst: Float + ) -> (result1: Table, result2: Table) + ``` + +## `#!sds fun` summarizeStatistics {#safeds.data.tabular.containers.Table.summarizeStatistics data-toc-label='summarizeStatistics'} + +Return a table with a number of statistical key values. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table with statistics. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="190" + @Pure + @PythonName("summarize_statistics") + fun summarizeStatistics() -> result1: Table + ``` + +## `#!sds fun` tagColumns {#safeds.data.tabular.containers.Table.tagColumns data-toc-label='tagColumns'} + +Return a new `TaggedTable` with columns marked as a target column or feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. | `#!sds null` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the given target and feature names. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="527" + @Pure + @PythonName("tag_columns") + fun tagColumns( + @PythonName("target_name") targetName: String, + @PythonName("feature_names") featureNames: List? = null + ) -> result1: TaggedTable + ``` + +## `#!sds fun` timeColumns {#safeds.data.tabular.containers.Table.timeColumns data-toc-label='timeColumns'} + +Return a new `TimeSeries` with columns marked as a target and time column or feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `timeName` | [`String`][safeds.lang.String] | Name of the time column. | - | +| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target and time columns are used. | `#!sds null` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series with the given target, time and feature names. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="545" + @Pure + @PythonName("time_columns") + fun timeColumns( + @PythonName("target_name") targetName: String, + @PythonName("time_name") timeName: String, + @PythonName("feature_names") featureNames: List? = null + ) -> result1: TimeSeries + ``` + +## `#!sds fun` toColumns {#safeds.data.tabular.containers.Table.toColumns data-toc-label='toColumns'} + +Return a list of the columns. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List>`][safeds.lang.List] | List of columns. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="723" + @Pure + @PythonName("to_columns") + fun toColumns() -> result1: List + ``` + +## `#!sds fun` toCsvFile {#safeds.data.tabular.containers.Table.toCsvFile data-toc-label='toCsvFile'} + +Write the data from the table into a CSV file. + +If the file and/or the directories do not exist they will be created. If the file already exists it will be +overwritten. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="665" + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_csv_file") + fun toCsvFile( + path: String + ) + ``` + +## `#!sds fun` toDict {#safeds.data.tabular.containers.Table.toDict data-toc-label='toDict'} + +Return a dictionary that maps column names to column values. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Map>`][safeds.lang.Map] | Dictionary representation of the table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="705" + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map> + ``` + +## `#!sds fun` toExcelFile {#safeds.data.tabular.containers.Table.toExcelFile data-toc-label='toExcelFile'} + +Write the data from the table into an Excel file. + +Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`. +If the file and/or the directories do not exist, they will be created. If the file already exists, it will be +overwritten. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="680" + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_excel_file") + fun toExcelFile( + path: String + ) + ``` + +## `#!sds fun` toHtml {#safeds.data.tabular.containers.Table.toHtml data-toc-label='toHtml'} + +Return an HTML representation of the table. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`String`][safeds.lang.String] | The generated HTML. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="714" + @Pure + @PythonName("to_html") + fun toHtml() -> result1: String + ``` + +## `#!sds fun` toJsonFile {#safeds.data.tabular.containers.Table.toJsonFile data-toc-label='toJsonFile'} + +Write the data from the table into a JSON file. + +If the file and/or the directories do not exist, they will be created. If the file already exists it will be +overwritten. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the output file. | - | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="694" + @Impure([ImpurityReason.FileWriteToParameterizedPath("path")]) + @PythonName("to_json_file") + fun toJsonFile( + path: String + ) + ``` + +## `#!sds fun` toRows {#safeds.data.tabular.containers.Table.toRows data-toc-label='toRows'} + +Return a list of the rows. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | List of rows. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="732" + @Pure + @PythonName("to_rows") + fun toRows() -> result1: List + ``` + +## `#!sds fun` transformColumn {#safeds.data.tabular.containers.Table.transformColumn data-toc-label='transformColumn'} + +Return a new `Table` with the provided column transformed by calling the provided transformer. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `name` | [`String`][safeds.lang.String] | - | - | +| `transformer` | `#!sds (param1: Row) -> (param2: Any)` | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table with the transformed column. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="560" + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: Table + ``` + +## `#!sds fun` transformTable {#safeds.data.tabular.containers.Table.transformTable data-toc-label='transformTable'} + +Return a new `Table` with a learned transformation applied to this table. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `transformer` | [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] | The transformer which transforms the given table. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The transformed table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="576" + @Pure + @PythonName("transform_table") + fun transformTable( + transformer: TableTransformer + ) -> result1: Table + ``` + +## `#!sds static fun` fromColumns {#safeds.data.tabular.containers.Table.fromColumns data-toc-label='fromColumns'} + +Return a table created from a list of columns. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | [`List>`][safeds.lang.List] | The columns to be combined. They need to have the same size. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The generated table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="108" + @Pure + @PythonName("from_columns") + static fun fromColumns( + columns: List + ) -> result1: Table + ``` + +## `#!sds static fun` fromCsvFile {#safeds.data.tabular.containers.Table.fromCsvFile data-toc-label='fromCsvFile'} + +Read data from a CSV file into a table. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the CSV file. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table created from the CSV file. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="54" + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_csv_file") + static fun fromCsvFile( + path: String + ) -> result1: Table + ``` + +## `#!sds static fun` fromDict {#safeds.data.tabular.containers.Table.fromDict data-toc-label='fromDict'} + +Create a table from a dictionary that maps column names to column values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map>`][safeds.lang.Map] | The data. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The generated table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="95" + @Pure + @PythonName("from_dict") + static fun fromDict( + data: Map> + ) -> result1: Table + ``` + +## `#!sds static fun` fromExcelFile {#safeds.data.tabular.containers.Table.fromExcelFile data-toc-label='fromExcelFile'} + +Read data from an Excel file into a table. + +Valid file extensions are `.xls`, '.xlsx', `.xlsm`, `.xlsb`, `.odf`, `.ods` and `.odt`. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the Excel file. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table created from the Excel file. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="69" + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_excel_file") + static fun fromExcelFile( + path: String + ) -> result1: Table + ``` + +## `#!sds static fun` fromJsonFile {#safeds.data.tabular.containers.Table.fromJsonFile data-toc-label='fromJsonFile'} + +Read data from a JSON file into a table. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path to the JSON file. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The table created from the JSON file. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="82" + @Impure([ImpurityReason.FileReadFromParameterizedPath("path")]) + @PythonName("from_json_file") + static fun fromJsonFile( + path: String + ) -> result1: Table + ``` + +## `#!sds static fun` fromRows {#safeds.data.tabular.containers.Table.fromRows data-toc-label='fromRows'} + +Return a table created from a list of rows. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `rows` | [`List`][safeds.lang.List] | The rows to be combined. They need to have a matching schema. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The generated table. | + +??? quote "Source code in `table.sdsstub`" + + ```sds linenums="121" + @Pure + @PythonName("from_rows") + static fun fromRows( + rows: List + ) -> result1: Table + ``` diff --git a/docs/stdlib/safeds/data/tabular/containers/TaggedTable.md b/docs/stdlib/safeds/data/tabular/containers/TaggedTable.md new file mode 100644 index 000000000..64747f894 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/containers/TaggedTable.md @@ -0,0 +1,940 @@ +# `#!sds class` TaggedTable {#safeds.data.tabular.containers.TaggedTable data-toc-label='TaggedTable'} + +A tagged table is a table that additionally knows which columns are features and which are the target to predict. + +**Parent type:** [`Table`][safeds.data.tabular.containers.Table] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map>`][safeds.lang.Map] | The data. | - | +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target column are used. | `#!sds null` | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="12" + class TaggedTable( + data: Map>, + @PythonName("target_name") targetName: String, + @PythonName("feature_names") featureNames: List? = null + ) sub Table { + /** + * Get the feature columns of the tagged table. + */ + attr features: Table + /** + * Get the target column of the tagged table. + */ + attr target: Column + + /** + * Return a new table with the provided column attached at the end, as a feature column. + * + * the original table is not modified. + * + * @param column The column to be added. + * + * @result result1 The table with the attached feature column. + */ + @Pure + @PythonName("add_column_as_feature") + fun addColumnAsFeature( + column: Column + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with the provided columns attached at the end, as feature columns. + * + * The original table is not modified. + * + * @param columns The columns to be added as features. + * + * @result result1 The table with the attached feature columns. + */ + @Pure + @PythonName("add_columns_as_features") + fun addColumnsAsFeatures( + columns: union, Table> + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with the provided column attached at the end, as neither target nor feature column. + * + * The original table is not modified. + * + * @param column The column to be added. + * + * @result result1 The table with the column attached as neither target nor feature column. + */ + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with multiple added columns, as neither target nor feature columns. + * + * The original table is not modified. + * + * @param columns The columns to be added. + * + * @result result1 A new table combining the original table and the given columns as neither target nor feature columns. + */ + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with an added Row attached. + * + * The original table is not modified. + * + * @param row The row to be added. + * + * @result result1 A new tagged table with the added row at the end. + */ + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with multiple added Rows attached. + * + * The original table is not modified. + * + * @param rows The rows to be added. + * + * @result result1 A new tagged table which combines the original table and the given rows. + */ + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` containing only rows that match the given Callable (e.g. lambda function). + * + * The original tagged table is not modified. + * + * @param query A Callable that is applied to all rows. + * + * @result result1 A new tagged table containing only the rows to match the query. + */ + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with only the given column(s). + * + * The original table is not modified. + * + * @param columnNames A list containing only the columns to be kept. + * + * @result result1 A table containing only the given column(s). + */ + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with the given column(s) removed from the table. + * + * The original table is not modified. + * + * @param columnNames The names of all columns to be dropped. + * + * @result result1 A table without the given columns. + */ + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with every column that misses values removed. + * + * The original table is not modified. + * + * @result result1 A table without the columns that contain missing values. + */ + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with every column that contains non-numerical values removed. + * + * The original table is not modified. + * + * @result result1 A table without the columns that contain non-numerical values. + */ + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with all row duplicates removed. + * + * The original table is not modified. + * + * @result result1 The table with the duplicate rows removed. + */ + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: TaggedTable + + /** + * Return a new `TaggedTable` without the rows that contain missing values. + * + * The original table is not modified. + * + * @result result1 A table without the rows that contain missing values. + */ + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with all rows that contain at least one outlier removed. + * + * We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. + * Missing values are not considered outliers. They are also ignored during the calculation of the standard + * deviation. + * + * The original table is not modified. + * + * @result result1 A new table without rows containing outliers. + */ + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with a single column renamed. + * + * The original table is not modified. + * + * @param oldName The old name of the target column. + * @param newName The new name of the target column. + * + * @result result1 The Table with the renamed column. + */ + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with the specified old column replaced by a list of new columns. + * + * If the column to be replaced is the target column, it must be replaced by exactly one column. That column + * becomes the new target column. If the column to be replaced is a feature column, the new columns that replace it + * all become feature columns. + * + * The order of columns is kept. The original table is not modified. + * + * @param oldColumnName The name of the column to be replaced. + * @param newColumns The new columns replacing the old column. + * + * @result result1 A table with the old column replaced by the new column. + */ + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with randomly shuffled rows of this table. + * + * The original table is not modified. + * + * @result result1 The shuffled Table. + */ + @Pure + @PythonName("shuffle_rows") + fun shuffleRows() -> result1: TaggedTable + + /** + * Slice a part of the table into a new `TaggedTable`. + * + * The original table is not modified. + * + * @param start The first index of the range to be copied into a new table, None by default. + * @param end The last index of the range to be copied into a new table, None by default. + * @param step The step size used to iterate through the table, 1 by default. + * + * @result result1 The resulting table. + */ + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: TaggedTable + + /** + * Sort the columns of a `TaggedTable` with the given comparator and return a new `TaggedTable`. + * + * The comparator is a function that takes two columns `col1` and `col2` and + * returns an integer: + * + * * If the function returns a negative number, `col1` will be ordered before `col2`. + * * If the function returns a positive number, `col1` will be ordered after `col2`. + * * If the function returns 0, the original order of `col1` and `col2` will be kept. + * + * If no comparator is given, the columns will be sorted alphabetically by their name. + * + * The original table is not modified. + * + * @param comparator The function used to compare two columns. + * + * @result result1 A new table with sorted columns. + */ + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: TaggedTable + + /** + * Sort the rows of a `TaggedTable` with the given comparator and return a new `TaggedTable`. + * + * The comparator is a function that takes two rows `row1` and `row2` and + * returns an integer: + * + * * If the function returns a negative number, `row1` will be ordered before `row2`. + * * If the function returns a positive number, `row1` will be ordered after `row2`. + * * If the function returns 0, the original order of `row1` and `row2` will be kept. + * + * The original table is not modified. + * + * @param comparator The function used to compare two rows. + * + * @result result1 A new table with sorted rows. + */ + @Pure + @PythonName("sort_rows") + fun sortRows( + comparator: (param1: Row, param2: Row) -> param3: Int + ) -> result1: TaggedTable + + /** + * Return a new `TaggedTable` with the provided column transformed by calling the provided transformer. + * + * The original table is not modified. + * + * @result result1 The table with the transformed column. + */ + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: TaggedTable + } + ``` + +## `#!sds attr` features {#safeds.data.tabular.containers.TaggedTable.features data-toc-label='features'} + +Get the feature columns of the tagged table. + +**Type:** [`Table`][safeds.data.tabular.containers.Table] + +## `#!sds attr` target {#safeds.data.tabular.containers.TaggedTable.target data-toc-label='target'} + +Get the target column of the tagged table. + +**Type:** [`Column`][safeds.data.tabular.containers.Column] + +## `#!sds fun` addColumn {#safeds.data.tabular.containers.TaggedTable.addColumn data-toc-label='addColumn'} + +Return a new `TaggedTable` with the provided column attached at the end, as neither target nor feature column. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the column attached as neither target nor feature column. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="65" + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: TaggedTable + ``` + +## `#!sds fun` addColumnAsFeature {#safeds.data.tabular.containers.TaggedTable.addColumnAsFeature data-toc-label='addColumnAsFeature'} + +Return a new table with the provided column attached at the end, as a feature column. + +the original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the attached feature column. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="35" + @Pure + @PythonName("add_column_as_feature") + fun addColumnAsFeature( + column: Column + ) -> result1: TaggedTable + ``` + +## `#!sds fun` addColumns {#safeds.data.tabular.containers.TaggedTable.addColumns data-toc-label='addColumns'} + +Return a new `TaggedTable` with multiple added columns, as neither target nor feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | `#!sds union>, Table>` | The columns to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table combining the original table and the given columns as neither target nor feature columns. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="80" + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: TaggedTable + ``` + +## `#!sds fun` addColumnsAsFeatures {#safeds.data.tabular.containers.TaggedTable.addColumnsAsFeatures data-toc-label='addColumnsAsFeatures'} + +Return a new `TaggedTable` with the provided columns attached at the end, as feature columns. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | `#!sds union>, Table>` | The columns to be added as features. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the attached feature columns. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="50" + @Pure + @PythonName("add_columns_as_features") + fun addColumnsAsFeatures( + columns: union, Table> + ) -> result1: TaggedTable + ``` + +## `#!sds fun` addRow {#safeds.data.tabular.containers.TaggedTable.addRow data-toc-label='addRow'} + +Return a new `TaggedTable` with an added Row attached. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `row` | [`Row`][safeds.data.tabular.containers.Row] | The row to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table with the added row at the end. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="95" + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: TaggedTable + ``` + +## `#!sds fun` addRows {#safeds.data.tabular.containers.TaggedTable.addRows data-toc-label='addRows'} + +Return a new `TaggedTable` with multiple added Rows attached. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `rows` | `#!sds union, Table>` | The rows to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table which combines the original table and the given rows. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="110" + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: TaggedTable + ``` + +## `#!sds fun` filterRows {#safeds.data.tabular.containers.TaggedTable.filterRows data-toc-label='filterRows'} + +Return a new `TaggedTable` containing only rows that match the given Callable (e.g. lambda function). + +The original tagged table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `query` | `#!sds (param1: Row) -> (param2: Boolean)` | A Callable that is applied to all rows. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new tagged table containing only the rows to match the query. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="125" + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: TaggedTable + ``` + +## `#!sds fun` keepOnlyColumns {#safeds.data.tabular.containers.TaggedTable.keepOnlyColumns data-toc-label='keepOnlyColumns'} + +Return a new `TaggedTable` with only the given column(s). + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | A list containing only the columns to be kept. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table containing only the given column(s). | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="140" + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TaggedTable + ``` + +## `#!sds fun` removeColumns {#safeds.data.tabular.containers.TaggedTable.removeColumns data-toc-label='removeColumns'} + +Return a new `TaggedTable` with the given column(s) removed from the table. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | The names of all columns to be dropped. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the given columns. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="155" + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TaggedTable + ``` + +## `#!sds fun` removeColumnsWithMissingValues {#safeds.data.tabular.containers.TaggedTable.removeColumnsWithMissingValues data-toc-label='removeColumnsWithMissingValues'} + +Return a new `TaggedTable` with every column that misses values removed. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the columns that contain missing values. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="168" + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: TaggedTable + ``` + +## `#!sds fun` removeColumnsWithNonNumericalValues {#safeds.data.tabular.containers.TaggedTable.removeColumnsWithNonNumericalValues data-toc-label='removeColumnsWithNonNumericalValues'} + +Return a new `TaggedTable` with every column that contains non-numerical values removed. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the columns that contain non-numerical values. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="179" + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: TaggedTable + ``` + +## `#!sds fun` removeDuplicateRows {#safeds.data.tabular.containers.TaggedTable.removeDuplicateRows data-toc-label='removeDuplicateRows'} + +Return a new `TaggedTable` with all row duplicates removed. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the duplicate rows removed. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="190" + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: TaggedTable + ``` + +## `#!sds fun` removeRowsWithMissingValues {#safeds.data.tabular.containers.TaggedTable.removeRowsWithMissingValues data-toc-label='removeRowsWithMissingValues'} + +Return a new `TaggedTable` without the rows that contain missing values. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table without the rows that contain missing values. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="201" + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: TaggedTable + ``` + +## `#!sds fun` removeRowsWithOutliers {#safeds.data.tabular.containers.TaggedTable.removeRowsWithOutliers data-toc-label='removeRowsWithOutliers'} + +Return a new `TaggedTable` with all rows that contain at least one outlier removed. + +We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. +Missing values are not considered outliers. They are also ignored during the calculation of the standard +deviation. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table without rows containing outliers. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="216" + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: TaggedTable + ``` + +## `#!sds fun` renameColumn {#safeds.data.tabular.containers.TaggedTable.renameColumn data-toc-label='renameColumn'} + +Return a new `TaggedTable` with a single column renamed. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldName` | [`String`][safeds.lang.String] | The old name of the target column. | - | +| `newName` | [`String`][safeds.lang.String] | The new name of the target column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The Table with the renamed column. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="230" + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: TaggedTable + ``` + +## `#!sds fun` replaceColumn {#safeds.data.tabular.containers.TaggedTable.replaceColumn data-toc-label='replaceColumn'} + +Return a new `TaggedTable` with the specified old column replaced by a list of new columns. + +If the column to be replaced is the target column, it must be replaced by exactly one column. That column +becomes the new target column. If the column to be replaced is a feature column, the new columns that replace it +all become feature columns. + +The order of columns is kept. The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldColumnName` | [`String`][safeds.lang.String] | The name of the column to be replaced. | - | +| `newColumns` | [`List>`][safeds.lang.List] | The new columns replacing the old column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A table with the old column replaced by the new column. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="251" + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: TaggedTable + ``` + +## `#!sds fun` shuffleRows {#safeds.data.tabular.containers.TaggedTable.shuffleRows data-toc-label='shuffleRows'} + +Return a new `TaggedTable` with randomly shuffled rows of this table. + +The original table is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The shuffled Table. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="265" + @Pure + @PythonName("shuffle_rows") + fun shuffleRows() -> result1: TaggedTable + ``` + +## `#!sds fun` sliceRows {#safeds.data.tabular.containers.TaggedTable.sliceRows data-toc-label='sliceRows'} + +Slice a part of the table into a new `TaggedTable`. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `start` | [`Int?`][safeds.lang.Int] | The first index of the range to be copied into a new table, None by default. | `#!sds null` | +| `end` | [`Int?`][safeds.lang.Int] | The last index of the range to be copied into a new table, None by default. | `#!sds null` | +| `step` | [`Int`][safeds.lang.Int] | The step size used to iterate through the table, 1 by default. | `#!sds 1` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The resulting table. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="280" + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: TaggedTable + ``` + +## `#!sds fun` sortColumns {#safeds.data.tabular.containers.TaggedTable.sortColumns data-toc-label='sortColumns'} + +Sort the columns of a `TaggedTable` with the given comparator and return a new `TaggedTable`. + +The comparator is a function that takes two columns `col1` and `col2` and +returns an integer: + +* If the function returns a negative number, `col1` will be ordered before `col2`. +* If the function returns a positive number, `col1` will be ordered after `col2`. +* If the function returns 0, the original order of `col1` and `col2` will be kept. + +If no comparator is given, the columns will be sorted alphabetically by their name. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (param1: Column, param2: Column) -> (param3: Int)` | The function used to compare two columns. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table with sorted columns. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="306" + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: TaggedTable + ``` + +## `#!sds fun` sortRows {#safeds.data.tabular.containers.TaggedTable.sortRows data-toc-label='sortRows'} + +Sort the rows of a `TaggedTable` with the given comparator and return a new `TaggedTable`. + +The comparator is a function that takes two rows `row1` and `row2` and +returns an integer: + +* If the function returns a negative number, `row1` will be ordered before `row2`. +* If the function returns a positive number, `row1` will be ordered after `row2`. +* If the function returns 0, the original order of `row1` and `row2` will be kept. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (param1: Row, param2: Row) -> (param3: Int)` | The function used to compare two rows. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A new table with sorted rows. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="328" + @Pure + @PythonName("sort_rows") + fun sortRows( + comparator: (param1: Row, param2: Row) -> param3: Int + ) -> result1: TaggedTable + ``` + +## `#!sds fun` transformColumn {#safeds.data.tabular.containers.TaggedTable.transformColumn data-toc-label='transformColumn'} + +Return a new `TaggedTable` with the provided column transformed by calling the provided transformer. + +The original table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `name` | [`String`][safeds.lang.String] | - | - | +| `transformer` | `#!sds (param1: Row) -> (param2: Any)` | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The table with the transformed column. | + +??? quote "Source code in `tagged_table.sdsstub`" + + ```sds linenums="341" + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: TaggedTable + ``` diff --git a/docs/stdlib/safeds/data/tabular/containers/TimeSeries.md b/docs/stdlib/safeds/data/tabular/containers/TimeSeries.md new file mode 100644 index 000000000..eff4e1d34 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/containers/TimeSeries.md @@ -0,0 +1,1002 @@ +# `#!sds class` TimeSeries {#safeds.data.tabular.containers.TimeSeries data-toc-label='TimeSeries'} + +**Parent type:** [`Table`][safeds.data.tabular.containers.Table] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `data` | [`Map>`][safeds.lang.Map] | The data. | - | +| `targetName` | [`String`][safeds.lang.String] | Name of the target column. | - | +| `timeName` | [`String`][safeds.lang.String] | Name of the time column | - | +| `featureNames` | [`List?`][safeds.lang.List] | Names of the feature columns. If None, all columns except the target and time columns are used. | `#!sds null` | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="12" + class TimeSeries( + data: Map>, + @PythonName("target_name") targetName: String, + @PythonName("time_name") timeName: String, + @PythonName("feature_names") featureNames: List? = null + ) sub Table { + /** + * Get the target column of the tagged table. + */ + attr target: Column + /** + * Get the feature columns of the tagged table. + */ + attr features: Table + /** + * Get the time column of the time series. + */ + attr time: Column + + /** + * Return a new `TimeSeries` with the provided column attached at the end, as neither target nor feature column. + * + * The original time series is not modified. + * + * @param column The column to be added. + * + * @result result1 The time series with the column attached as neither target nor feature column. + */ + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with the provided column attached at the end, as a feature column. + * + * the original time series is not modified. + * + * @param column The column to be added. + * + * @result result1 The time series with the attached feature column. + */ + @Pure + @PythonName("add_column_as_feature") + fun addColumnAsFeature( + column: Column + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with the provided columns attached at the end, as feature columns. + * + * The original time series is not modified. + * + * @param columns The columns to be added as features. + * + * @result result1 The time series with the attached feature columns. + */ + @Pure + @PythonName("add_columns_as_features") + fun addColumnsAsFeatures( + columns: union, Table> + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with multiple added columns, as neither target nor feature columns. + * + * The original time series is not modified. + * + * @param columns The columns to be added. + * + * @result result1 A new time series combining the original table and the given columns as neither target nor feature columns. + */ + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with an extra Row attached. + * + * The original time series is not modified. + * + * @param row The row to be added. + * + * @result result1 A new time series with the added row at the end. + */ + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with multiple extra Rows attached. + * + * The original time series is not modified. + * + * @param rows The rows to be added. + * + * @result result1 A new time series which combines the original time series and the given rows. + */ + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` containing only rows that match the given Callable (e.g. lambda function). + * + * The original time series is not modified. + * + * @param query A Callable that is applied to all rows. + * + * @result result1 A time series containing only the rows to match the query. + */ + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with only the given column(s). + * + * The original time series is not modified. + * + * @param columnNames A list containing the columns to be kept. + * + * @result result1 A time series containing only the given column(s). + */ + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with the given column(s) removed from the time series. + * + * The original time series is not modified. + * + * @param columnNames The names of all columns to be dropped. + * + * @result result1 A time series without the given columns. + */ + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with every column that misses values removed. + * + * The original time series is not modified. + * + * @result result1 A time series without the columns that contain missing values. + */ + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with every column that contains non-numerical values removed. + * + * The original time series is not modified. + * + * @result result1 A time series without the columns that contain non-numerical values. + */ + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with all row duplicates removed. + * + * The original time series is not modified. + * + * @result result1 The time series with the duplicate rows removed. + */ + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: TimeSeries + + /** + * Return a new `TimeSeries` without the rows that contain missing values. + * + * The original time series is not modified. + * + * @result result1 A time series without the rows that contain missing values. + */ + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with all rows that contain at least one outlier removed. + * + * We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. + * Missing values are not considered outliers. They are also ignored during the calculation of the standard + * deviation. + * + * The original time series is not modified. + * + * @result result1 A new time series without rows containing outliers. + */ + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with a single column renamed. + * + * The original time series is not modified. + * + * @param oldName The old name of the column. + * @param newName The new name of the column. + * + * @result result1 The time series with the renamed column. + */ + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with the specified old column replaced by a list of new columns. + * + * If the column to be replaced is the target or time column, it must be replaced by exactly one column. That column + * becomes the new target or time column. If the column to be replaced is a feature column, the new columns that replace it + * all become feature columns. + * + * The order of columns is kept. The original time series is not modified. + * + * @param oldColumnName The name of the column to be replaced. + * @param newColumns The new columns replacing the old column. + * + * @result result1 A time series with the old column replaced by the new columns. + */ + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: TimeSeries + + /** + * Slice a part of the table into a new `TimeSeries`. + * + * The original time series is not modified. + * + * @param start The first index of the range to be copied into a new time series, None by default. + * @param end The last index of the range to be copied into a new time series, None by default. + * @param step The step size used to iterate through the time series, 1 by default. + * + * @result result1 The resulting time series. + */ + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: TimeSeries + + /** + * Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. + * + * The comparator is a function that takes two columns `col1` and `col2` and + * returns an integer: + * + * * If the function returns a negative number, `col1` will be ordered before `col2`. + * * If the function returns a positive number, `col1` will be ordered after `col2`. + * * If the function returns 0, the original order of `col1` and `col2` will be kept. + * + * If no comparator is given, the columns will be sorted alphabetically by their name. + * + * The original time series is not modified. + * + * @param comparator The function used to compare two columns. + * + * @result result1 A new time series with sorted columns. + */ + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: TimeSeries + + /** + * Return a new `TimeSeries` with the provided column transformed by calling the provided transformer. + * + * The original time series is not modified. + * + * @param name The name of the column to be transformed. + * @param transformer The transformer to the given column + * + * @result result1 The time series with the transformed column. + */ + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: TimeSeries + + /** + * Plot a lagplot for the target column. + * + * @param lag The amount of lag used to plot + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_lagplot") + fun plotLagplot( + lag: Int + ) -> result1: Image + + /** + * Plot the time series target or the given column(s) as line plot. + * + * The function will take the time column as the default value for y_column_name and the target column as the + * default value for x_column_name. + * + * @param xColumnName The column name of the column to be plotted on the x-Axis, default is the time column. + * @param yColumnName The column name of the column to be plotted on the y-Axis, default is the target column. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_lineplot") + fun plotLineplot( + @PythonName("x_column_name") xColumnName: String? = null, + @PythonName("y_column_name") yColumnName: String? = null + ) -> result1: Image + + /** + * Plot the time series target or the given column(s) as scatter plot. + * + * The function will take the time column as the default value for x_column_name and the target column as the + * default value for y_column_name. + * + * @param xColumnName The column name of the column to be plotted on the x-Axis. + * @param yColumnName The column name of the column to be plotted on the y-Axis. + * + * @result result1 The plot as an image. + */ + @Pure + @PythonName("plot_scatterplot") + fun plotScatterplot( + @PythonName("x_column_name") xColumnName: String? = null, + @PythonName("y_column_name") yColumnName: String? = null + ) -> result1: Image + } + ``` + +## `#!sds attr` features {#safeds.data.tabular.containers.TimeSeries.features data-toc-label='features'} + +Get the feature columns of the tagged table. + +**Type:** [`Table`][safeds.data.tabular.containers.Table] + +## `#!sds attr` target {#safeds.data.tabular.containers.TimeSeries.target data-toc-label='target'} + +Get the target column of the tagged table. + +**Type:** [`Column`][safeds.data.tabular.containers.Column] + +## `#!sds attr` time {#safeds.data.tabular.containers.TimeSeries.time data-toc-label='time'} + +Get the time column of the time series. + +**Type:** [`Column`][safeds.data.tabular.containers.Column] + +## `#!sds fun` addColumn {#safeds.data.tabular.containers.TimeSeries.addColumn data-toc-label='addColumn'} + +Return a new `TimeSeries` with the provided column attached at the end, as neither target nor feature column. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the column attached as neither target nor feature column. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="40" + @Pure + @PythonName("add_column") + fun addColumn( + column: Column + ) -> result1: TimeSeries + ``` + +## `#!sds fun` addColumnAsFeature {#safeds.data.tabular.containers.TimeSeries.addColumnAsFeature data-toc-label='addColumnAsFeature'} + +Return a new `TimeSeries` with the provided column attached at the end, as a feature column. + +the original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `column` | [`Column`][safeds.data.tabular.containers.Column] | The column to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the attached feature column. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="55" + @Pure + @PythonName("add_column_as_feature") + fun addColumnAsFeature( + column: Column + ) -> result1: TimeSeries + ``` + +## `#!sds fun` addColumns {#safeds.data.tabular.containers.TimeSeries.addColumns data-toc-label='addColumns'} + +Return a new `TimeSeries` with multiple added columns, as neither target nor feature columns. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | `#!sds union>, Table>` | The columns to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series combining the original table and the given columns as neither target nor feature columns. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="85" + @Pure + @PythonName("add_columns") + fun addColumns( + columns: union, Table> + ) -> result1: TimeSeries + ``` + +## `#!sds fun` addColumnsAsFeatures {#safeds.data.tabular.containers.TimeSeries.addColumnsAsFeatures data-toc-label='addColumnsAsFeatures'} + +Return a new `TimeSeries` with the provided columns attached at the end, as feature columns. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columns` | `#!sds union>, Table>` | The columns to be added as features. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the attached feature columns. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="70" + @Pure + @PythonName("add_columns_as_features") + fun addColumnsAsFeatures( + columns: union, Table> + ) -> result1: TimeSeries + ``` + +## `#!sds fun` addRow {#safeds.data.tabular.containers.TimeSeries.addRow data-toc-label='addRow'} + +Return a new `TimeSeries` with an extra Row attached. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `row` | [`Row`][safeds.data.tabular.containers.Row] | The row to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series with the added row at the end. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="100" + @Pure + @PythonName("add_row") + fun addRow( + row: Row + ) -> result1: TimeSeries + ``` + +## `#!sds fun` addRows {#safeds.data.tabular.containers.TimeSeries.addRows data-toc-label='addRows'} + +Return a new `TimeSeries` with multiple extra Rows attached. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `rows` | `#!sds union, Table>` | The rows to be added. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series which combines the original time series and the given rows. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="115" + @Pure + @PythonName("add_rows") + fun addRows( + rows: union, Table> + ) -> result1: TimeSeries + ``` + +## `#!sds fun` filterRows {#safeds.data.tabular.containers.TimeSeries.filterRows data-toc-label='filterRows'} + +Return a new `TimeSeries` containing only rows that match the given Callable (e.g. lambda function). + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `query` | `#!sds (param1: Row) -> (param2: Boolean)` | A Callable that is applied to all rows. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series containing only the rows to match the query. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="130" + @Pure + @PythonName("filter_rows") + fun filterRows( + query: (param1: Row) -> param2: Boolean + ) -> result1: TimeSeries + ``` + +## `#!sds fun` keepOnlyColumns {#safeds.data.tabular.containers.TimeSeries.keepOnlyColumns data-toc-label='keepOnlyColumns'} + +Return a new `TimeSeries` with only the given column(s). + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | A list containing the columns to be kept. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series containing only the given column(s). | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="145" + @Pure + @PythonName("keep_only_columns") + fun keepOnlyColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TimeSeries + ``` + +## `#!sds fun` plotLagplot {#safeds.data.tabular.containers.TimeSeries.plotLagplot data-toc-label='plotLagplot'} + +Plot a lagplot for the target column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `lag` | [`Int`][safeds.lang.Int] | The amount of lag used to plot | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="330" + @Pure + @PythonName("plot_lagplot") + fun plotLagplot( + lag: Int + ) -> result1: Image + ``` + +## `#!sds fun` plotLineplot {#safeds.data.tabular.containers.TimeSeries.plotLineplot data-toc-label='plotLineplot'} + +Plot the time series target or the given column(s) as line plot. + +The function will take the time column as the default value for y_column_name and the target column as the +default value for x_column_name. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `xColumnName` | [`String?`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis, default is the time column. | `#!sds null` | +| `yColumnName` | [`String?`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis, default is the target column. | `#!sds null` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="347" + @Pure + @PythonName("plot_lineplot") + fun plotLineplot( + @PythonName("x_column_name") xColumnName: String? = null, + @PythonName("y_column_name") yColumnName: String? = null + ) -> result1: Image + ``` + +## `#!sds fun` plotScatterplot {#safeds.data.tabular.containers.TimeSeries.plotScatterplot data-toc-label='plotScatterplot'} + +Plot the time series target or the given column(s) as scatter plot. + +The function will take the time column as the default value for x_column_name and the target column as the +default value for y_column_name. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `xColumnName` | [`String?`][safeds.lang.String] | The column name of the column to be plotted on the x-Axis. | `#!sds null` | +| `yColumnName` | [`String?`][safeds.lang.String] | The column name of the column to be plotted on the y-Axis. | `#!sds null` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Image`][safeds.data.image.containers.Image] | The plot as an image. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="365" + @Pure + @PythonName("plot_scatterplot") + fun plotScatterplot( + @PythonName("x_column_name") xColumnName: String? = null, + @PythonName("y_column_name") yColumnName: String? = null + ) -> result1: Image + ``` + +## `#!sds fun` removeColumns {#safeds.data.tabular.containers.TimeSeries.removeColumns data-toc-label='removeColumns'} + +Return a new `TimeSeries` with the given column(s) removed from the time series. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnNames` | [`List`][safeds.lang.List] | The names of all columns to be dropped. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series without the given columns. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="160" + @Pure + @PythonName("remove_columns") + fun removeColumns( + @PythonName("column_names") columnNames: List + ) -> result1: TimeSeries + ``` + +## `#!sds fun` removeColumnsWithMissingValues {#safeds.data.tabular.containers.TimeSeries.removeColumnsWithMissingValues data-toc-label='removeColumnsWithMissingValues'} + +Return a new `TimeSeries` with every column that misses values removed. + +The original time series is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series without the columns that contain missing values. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="173" + @Pure + @PythonName("remove_columns_with_missing_values") + fun removeColumnsWithMissingValues() -> result1: TimeSeries + ``` + +## `#!sds fun` removeColumnsWithNonNumericalValues {#safeds.data.tabular.containers.TimeSeries.removeColumnsWithNonNumericalValues data-toc-label='removeColumnsWithNonNumericalValues'} + +Return a new `TimeSeries` with every column that contains non-numerical values removed. + +The original time series is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series without the columns that contain non-numerical values. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="184" + @Pure + @PythonName("remove_columns_with_non_numerical_values") + fun removeColumnsWithNonNumericalValues() -> result1: TimeSeries + ``` + +## `#!sds fun` removeDuplicateRows {#safeds.data.tabular.containers.TimeSeries.removeDuplicateRows data-toc-label='removeDuplicateRows'} + +Return a new `TimeSeries` with all row duplicates removed. + +The original time series is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the duplicate rows removed. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="195" + @Pure + @PythonName("remove_duplicate_rows") + fun removeDuplicateRows() -> result1: TimeSeries + ``` + +## `#!sds fun` removeRowsWithMissingValues {#safeds.data.tabular.containers.TimeSeries.removeRowsWithMissingValues data-toc-label='removeRowsWithMissingValues'} + +Return a new `TimeSeries` without the rows that contain missing values. + +The original time series is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series without the rows that contain missing values. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="206" + @Pure + @PythonName("remove_rows_with_missing_values") + fun removeRowsWithMissingValues() -> result1: TimeSeries + ``` + +## `#!sds fun` removeRowsWithOutliers {#safeds.data.tabular.containers.TimeSeries.removeRowsWithOutliers data-toc-label='removeRowsWithOutliers'} + +Return a new `TimeSeries` with all rows that contain at least one outlier removed. + +We define an outlier as a value that has a distance of more than 3 standard deviations from the column mean. +Missing values are not considered outliers. They are also ignored during the calculation of the standard +deviation. + +The original time series is not modified. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series without rows containing outliers. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="221" + @Pure + @PythonName("remove_rows_with_outliers") + fun removeRowsWithOutliers() -> result1: TimeSeries + ``` + +## `#!sds fun` renameColumn {#safeds.data.tabular.containers.TimeSeries.renameColumn data-toc-label='renameColumn'} + +Return a new `TimeSeries` with a single column renamed. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldName` | [`String`][safeds.lang.String] | The old name of the column. | - | +| `newName` | [`String`][safeds.lang.String] | The new name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the renamed column. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="235" + @Pure + @PythonName("rename_column") + fun renameColumn( + @PythonName("old_name") oldName: String, + @PythonName("new_name") newName: String + ) -> result1: TimeSeries + ``` + +## `#!sds fun` replaceColumn {#safeds.data.tabular.containers.TimeSeries.replaceColumn data-toc-label='replaceColumn'} + +Return a new `TimeSeries` with the specified old column replaced by a list of new columns. + +If the column to be replaced is the target or time column, it must be replaced by exactly one column. That column +becomes the new target or time column. If the column to be replaced is a feature column, the new columns that replace it +all become feature columns. + +The order of columns is kept. The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `oldColumnName` | [`String`][safeds.lang.String] | The name of the column to be replaced. | - | +| `newColumns` | [`List>`][safeds.lang.List] | The new columns replacing the old column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A time series with the old column replaced by the new columns. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="256" + @Pure + @PythonName("replace_column") + fun replaceColumn( + @PythonName("old_column_name") oldColumnName: String, + @PythonName("new_columns") newColumns: List + ) -> result1: TimeSeries + ``` + +## `#!sds fun` sliceRows {#safeds.data.tabular.containers.TimeSeries.sliceRows data-toc-label='sliceRows'} + +Slice a part of the table into a new `TimeSeries`. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `start` | [`Int?`][safeds.lang.Int] | The first index of the range to be copied into a new time series, None by default. | `#!sds null` | +| `end` | [`Int?`][safeds.lang.Int] | The last index of the range to be copied into a new time series, None by default. | `#!sds null` | +| `step` | [`Int`][safeds.lang.Int] | The step size used to iterate through the time series, 1 by default. | `#!sds 1` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The resulting time series. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="274" + @Pure + @PythonName("slice_rows") + fun sliceRows( + start: Int? = null, + end: Int? = null, + step: Int = 1 + ) -> result1: TimeSeries + ``` + +## `#!sds fun` sortColumns {#safeds.data.tabular.containers.TimeSeries.sortColumns data-toc-label='sortColumns'} + +Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. + +The comparator is a function that takes two columns `col1` and `col2` and +returns an integer: + +* If the function returns a negative number, `col1` will be ordered before `col2`. +* If the function returns a positive number, `col1` will be ordered after `col2`. +* If the function returns 0, the original order of `col1` and `col2` will be kept. + +If no comparator is given, the columns will be sorted alphabetically by their name. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `comparator` | `#!sds (param1: Column, param2: Column) -> (param3: Int)` | The function used to compare two columns. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | A new time series with sorted columns. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="300" + @Pure + @PythonName("sort_columns") + fun sortColumns( + comparator: (param1: Column, param2: Column) -> param3: Int + ) -> result1: TimeSeries + ``` + +## `#!sds fun` transformColumn {#safeds.data.tabular.containers.TimeSeries.transformColumn data-toc-label='transformColumn'} + +Return a new `TimeSeries` with the provided column transformed by calling the provided transformer. + +The original time series is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `name` | [`String`][safeds.lang.String] | The name of the column to be transformed. | - | +| `transformer` | `#!sds (param1: Row) -> (param2: Any)` | The transformer to the given column | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TimeSeries`][safeds.data.tabular.containers.TimeSeries] | The time series with the transformed column. | + +??? quote "Source code in `time_series.sdsstub`" + + ```sds linenums="316" + @Pure + @PythonName("transform_column") + fun transformColumn( + name: String, + transformer: (param1: Row) -> param2: Any + ) -> result1: TimeSeries + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/Discretizer.md b/docs/stdlib/safeds/data/tabular/transformation/Discretizer.md new file mode 100644 index 000000000..8a481bc54 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/Discretizer.md @@ -0,0 +1,66 @@ +# `#!sds class` Discretizer {#safeds.data.tabular.transformation.Discretizer data-toc-label='Discretizer'} + +The Discretizer bins continuous data into intervals. + +**Parent type:** [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfBins` | [`Int`][safeds.lang.Int] | The number of bins to be created. | `#!sds 5` | + +??? quote "Source code in `discretizer.sdsstub`" + + ```sds linenums="11" + class Discretizer( + @PythonName("number_of_bins") const numberOfBins: Int = 5 + ) sub TableTransformer where { + numberOfBins >= 2 + } { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: Discretizer + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.Discretizer.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Discretizer`][safeds.data.tabular.transformation.Discretizer] | The fitted transformer. | + +??? quote "Source code in `discretizer.sdsstub`" + + ```sds linenums="26" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: Discretizer + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/Imputer.md b/docs/stdlib/safeds/data/tabular/transformation/Imputer.md new file mode 100644 index 000000000..b443ae7c0 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/Imputer.md @@ -0,0 +1,140 @@ +# `#!sds class` Imputer {#safeds.data.tabular.transformation.Imputer data-toc-label='Imputer'} + +Replace missing values with the given strategy. + +**Parent type:** [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `strategy` | [`Strategy`][safeds.data.tabular.transformation.Imputer.Strategy] | The strategy used to impute missing values. Use the classes nested inside `Imputer.Strategy` to specify it. | - | + +??? quote "Source code in `imputer.sdsstub`" + + ```sds linenums="11" + class Imputer( + strategy: Imputer.Strategy + ) sub TableTransformer { + enum Strategy { + /** + * An imputation strategy for imputing missing data with given constant values. + * + * @param value The given value to impute missing values. + */ + Constant(value: Any) + + /** + * An imputation strategy for imputing missing data with mean values. + */ + Mean + + /** + * An imputation strategy for imputing missing data with median values. + */ + Median + + /** + * An imputation strategy for imputing missing data with mode values. The lowest value will be used if there are multiple values with the same highest count. + */ + Mode + } + + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: Imputer + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.Imputer.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Imputer`][safeds.data.tabular.transformation.Imputer] | The fitted transformer. | + +??? quote "Source code in `imputer.sdsstub`" + + ```sds linenums="48" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: Imputer + ``` + +## `#!sds enum` Strategy {#safeds.data.tabular.transformation.Imputer.Strategy data-toc-label='Strategy'} + +??? quote "Source code in `imputer.sdsstub`" + + ```sds linenums="14" + enum Strategy { + /** + * An imputation strategy for imputing missing data with given constant values. + * + * @param value The given value to impute missing values. + */ + Constant(value: Any) + + /** + * An imputation strategy for imputing missing data with mean values. + */ + Mean + + /** + * An imputation strategy for imputing missing data with median values. + */ + Median + + /** + * An imputation strategy for imputing missing data with mode values. The lowest value will be used if there are multiple values with the same highest count. + */ + Mode + } + ``` + +### Constant {#safeds.data.tabular.transformation.Imputer.Strategy.Constant data-toc-label='Constant'} + +An imputation strategy for imputing missing data with given constant values. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `value` | [`Any`][safeds.lang.Any] | The given value to impute missing values. | - | + +### Mean {#safeds.data.tabular.transformation.Imputer.Strategy.Mean data-toc-label='Mean'} + +An imputation strategy for imputing missing data with mean values. + +### Median {#safeds.data.tabular.transformation.Imputer.Strategy.Median data-toc-label='Median'} + +An imputation strategy for imputing missing data with median values. + +### Mode {#safeds.data.tabular.transformation.Imputer.Strategy.Mode data-toc-label='Mode'} + +An imputation strategy for imputing missing data with mode values. The lowest value will be used if there are multiple values with the same highest count. diff --git a/docs/stdlib/safeds/data/tabular/transformation/InvertibleTableTransformer.md b/docs/stdlib/safeds/data/tabular/transformation/InvertibleTableTransformer.md new file mode 100644 index 000000000..9d50033e6 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/InvertibleTableTransformer.md @@ -0,0 +1,95 @@ +# `#!sds abstract class` InvertibleTableTransformer {#safeds.data.tabular.transformation.InvertibleTableTransformer data-toc-label='InvertibleTableTransformer'} + +A `TableTransformer` that can also undo the learned transformation after it has been applied. + +**Parent type:** [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="96" + class InvertibleTableTransformer sub TableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: InvertibleTableTransformer + + /** + * Undo the learned transformation. + * + * The table is not modified. + * + * @param transformedTable The table to be transformed back to the original version. + * + * @result result1 The original table. + */ + @Pure + @PythonName("inverse_transform") + fun inverseTransform( + @PythonName("transformed_table") transformedTable: Table + ) -> result1: Table + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.InvertibleTableTransformer.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] | The fitted transformer. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="105" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: InvertibleTableTransformer + ``` + +## `#!sds fun` inverseTransform {#safeds.data.tabular.transformation.InvertibleTableTransformer.inverseTransform data-toc-label='inverseTransform'} + +Undo the learned transformation. + +The table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `transformedTable` | [`Table`][safeds.data.tabular.containers.Table] | The table to be transformed back to the original version. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The original table. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="120" + @Pure + @PythonName("inverse_transform") + fun inverseTransform( + @PythonName("transformed_table") transformedTable: Table + ) -> result1: Table + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/LabelEncoder.md b/docs/stdlib/safeds/data/tabular/transformation/LabelEncoder.md new file mode 100644 index 000000000..e38af9923 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/LabelEncoder.md @@ -0,0 +1,56 @@ +# `#!sds class` LabelEncoder {#safeds.data.tabular.transformation.LabelEncoder data-toc-label='LabelEncoder'} + +The LabelEncoder encodes one or more given columns into labels. + +**Parent type:** [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] + +??? quote "Source code in `label_encoder.sdsstub`" + + ```sds linenums="9" + class LabelEncoder() sub InvertibleTableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: LabelEncoder + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.LabelEncoder.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`LabelEncoder`][safeds.data.tabular.transformation.LabelEncoder] | The fitted transformer. | + +??? quote "Source code in `label_encoder.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: LabelEncoder + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/OneHotEncoder.md b/docs/stdlib/safeds/data/tabular/transformation/OneHotEncoder.md new file mode 100644 index 000000000..e819e6e82 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/OneHotEncoder.md @@ -0,0 +1,79 @@ +# `#!sds class` OneHotEncoder {#safeds.data.tabular.transformation.OneHotEncoder data-toc-label='OneHotEncoder'} + +A way to deal with categorical features that is particularly useful for unordered (i.e. nominal) data. + +It replaces a column with a set of columns, each representing a unique value in the original column. The value of +each new column is 1 if the original column had that value, and 0 otherwise. Take the following table as an +example: + +| col1 | +|------| +| "a" | +| "b" | +| "c" | +| "a" | + +The one-hot encoding of this table is: + +| col1__a | col1__b | col1__c | +|---------|---------|---------| +| 1 | 0 | 0 | +| 0 | 1 | 0 | +| 0 | 0 | 1 | +| 1 | 0 | 0 | + +The name "one-hot" comes from the fact that each row has exactly one 1 in it, and the rest of the values are 0s. +One-hot encoding is closely related to dummy variable / indicator variables, which are used in statistics. + +**Parent type:** [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] + +??? quote "Source code in `one_hot_encoder.sdsstub`" + + ```sds linenums="32" + class OneHotEncoder() sub InvertibleTableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: OneHotEncoder + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.OneHotEncoder.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`OneHotEncoder`][safeds.data.tabular.transformation.OneHotEncoder] | The fitted transformer. | + +??? quote "Source code in `one_hot_encoder.sdsstub`" + + ```sds linenums="43" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: OneHotEncoder + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/RangeScaler.md b/docs/stdlib/safeds/data/tabular/transformation/RangeScaler.md new file mode 100644 index 000000000..4f845113a --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/RangeScaler.md @@ -0,0 +1,66 @@ +# `#!sds class` RangeScaler {#safeds.data.tabular.transformation.RangeScaler data-toc-label='RangeScaler'} + +The RangeScaler transforms column values by scaling each value to a given range. + +**Parent type:** [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `minimum` | [`Float`][safeds.lang.Float] | The minimum of the new range after the transformation | `#!sds 0.0` | +| `maximum` | [`Float`][safeds.lang.Float] | The maximum of the new range after the transformation | `#!sds 1.0` | + +??? quote "Source code in `range_scaler.sdsstub`" + + ```sds linenums="12" + class RangeScaler( + const minimum: Float = 0.0, + const maximum: Float = 1.0 + ) sub InvertibleTableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: RangeScaler + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.RangeScaler.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`RangeScaler`][safeds.data.tabular.transformation.RangeScaler] | The fitted transformer. | + +??? quote "Source code in `range_scaler.sdsstub`" + + ```sds linenums="26" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: RangeScaler + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/StandardScaler.md b/docs/stdlib/safeds/data/tabular/transformation/StandardScaler.md new file mode 100644 index 000000000..c7f6eb093 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/StandardScaler.md @@ -0,0 +1,56 @@ +# `#!sds class` StandardScaler {#safeds.data.tabular.transformation.StandardScaler data-toc-label='StandardScaler'} + +The StandardScaler transforms column values to a range by removing the mean and scaling to unit variance. + +**Parent type:** [`InvertibleTableTransformer`][safeds.data.tabular.transformation.InvertibleTableTransformer] + +??? quote "Source code in `standard_scaler.sdsstub`" + + ```sds linenums="9" + class StandardScaler() sub InvertibleTableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: StandardScaler + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.StandardScaler.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`StandardScaler`][safeds.data.tabular.transformation.StandardScaler] | The fitted transformer. | + +??? quote "Source code in `standard_scaler.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: StandardScaler + ``` diff --git a/docs/stdlib/safeds/data/tabular/transformation/TableTransformer.md b/docs/stdlib/safeds/data/tabular/transformation/TableTransformer.md new file mode 100644 index 000000000..776603f0b --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/transformation/TableTransformer.md @@ -0,0 +1,250 @@ +# `#!sds abstract class` TableTransformer {#safeds.data.tabular.transformation.TableTransformer data-toc-label='TableTransformer'} + +Learn a transformation for a set of columns in a `Table` and transform another `Table` with the same columns. + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="8" + class TableTransformer { + /** + * Learn a transformation for a set of columns in a table. + * + * This transformer is not modified. + * + * @param table The table used to fit the transformer. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The fitted transformer. + */ + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: TableTransformer + + /** + * Apply the learned transformation to a table. + * + * The table is not modified. + * + * @param table The table to which the learned transformation is applied. + * + * @result result1 The transformed table. + */ + @Pure + fun transform( + table: Table + ) -> result1: Table + + /** + * Get the names of all new columns that have been added by the transformer. + * + * @result result1 A list of names of the added columns, ordered as they will appear in the table. + */ + @Pure + @PythonName("get_names_of_added_columns") + fun getNamesOfAddedColumns() -> result1: List + + /** + * Get the names of all columns that have been changed by the transformer. + * + * @result result1 A list of names of changed columns, ordered as they appear in the table. + */ + @Pure + @PythonName("get_names_of_changed_columns") + fun getNamesOfChangedColumns() -> result1: List + + /** + * Get the names of all columns that have been removed by the transformer. + * + * @result result1 A list of names of the removed columns, ordered as they appear in the table the transformer was fitted on. + */ + @Pure + @PythonName("get_names_of_removed_columns") + fun getNamesOfRemovedColumns() -> result1: List + + /** + * Check if the transformer is fitted. + * + * @result result1 Whether the transformer is fitted. + */ + @Pure + @PythonName("is_fitted") + fun isFitted() -> result1: Boolean + + /** + * Learn a transformation for a set of columns in a table and apply the learned transformation to the same table. + * + * The table is not modified. If you also need the fitted transformer, use `fit` and `transform` separately. + * + * @param table The table used to fit the transformer. The transformer is then applied to this table. + * @param columnNames The list of columns from the table used to fit the transformer. If `None`, all columns are used. + * + * @result result1 The transformed table. + */ + @Pure + @PythonName("fit_and_transform") + fun fitAndTransform( + table: Table, + @PythonName("column_names") columnNames: List? = null + ) -> result1: Table + } + ``` + +## `#!sds fun` fit {#safeds.data.tabular.transformation.TableTransformer.fit data-toc-label='fit'} + +Learn a transformation for a set of columns in a table. + +This transformer is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TableTransformer`][safeds.data.tabular.transformation.TableTransformer] | The fitted transformer. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="19" + @Pure + fun fit( + table: Table, + @PythonName("column_names") columnNames: List? + ) -> result1: TableTransformer + ``` + +## `#!sds fun` fitAndTransform {#safeds.data.tabular.transformation.TableTransformer.fitAndTransform data-toc-label='fitAndTransform'} + +Learn a transformation for a set of columns in a table and apply the learned transformation to the same table. + +The table is not modified. If you also need the fitted transformer, use `fit` and `transform` separately. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table used to fit the transformer. The transformer is then applied to this table. | - | +| `columnNames` | [`List?`][safeds.lang.List] | The list of columns from the table used to fit the transformer. If `None`, all columns are used. | `#!sds null` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The transformed table. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="85" + @Pure + @PythonName("fit_and_transform") + fun fitAndTransform( + table: Table, + @PythonName("column_names") columnNames: List? = null + ) -> result1: Table + ``` + +## `#!sds fun` getNamesOfAddedColumns {#safeds.data.tabular.transformation.TableTransformer.getNamesOfAddedColumns data-toc-label='getNamesOfAddedColumns'} + +Get the names of all new columns that have been added by the transformer. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | A list of names of the added columns, ordered as they will appear in the table. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="44" + @Pure + @PythonName("get_names_of_added_columns") + fun getNamesOfAddedColumns() -> result1: List + ``` + +## `#!sds fun` getNamesOfChangedColumns {#safeds.data.tabular.transformation.TableTransformer.getNamesOfChangedColumns data-toc-label='getNamesOfChangedColumns'} + +Get the names of all columns that have been changed by the transformer. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | A list of names of changed columns, ordered as they appear in the table. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="53" + @Pure + @PythonName("get_names_of_changed_columns") + fun getNamesOfChangedColumns() -> result1: List + ``` + +## `#!sds fun` getNamesOfRemovedColumns {#safeds.data.tabular.transformation.TableTransformer.getNamesOfRemovedColumns data-toc-label='getNamesOfRemovedColumns'} + +Get the names of all columns that have been removed by the transformer. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`List`][safeds.lang.List] | A list of names of the removed columns, ordered as they appear in the table the transformer was fitted on. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="62" + @Pure + @PythonName("get_names_of_removed_columns") + fun getNamesOfRemovedColumns() -> result1: List + ``` + +## `#!sds fun` isFitted {#safeds.data.tabular.transformation.TableTransformer.isFitted data-toc-label='isFitted'} + +Check if the transformer is fitted. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | Whether the transformer is fitted. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="71" + @Pure + @PythonName("is_fitted") + fun isFitted() -> result1: Boolean + ``` + +## `#!sds fun` transform {#safeds.data.tabular.transformation.TableTransformer.transform data-toc-label='transform'} + +Apply the learned transformation to a table. + +The table is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `table` | [`Table`][safeds.data.tabular.containers.Table] | The table to which the learned transformation is applied. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Table`][safeds.data.tabular.containers.Table] | The transformed table. | + +??? quote "Source code in `table_transformer.sdsstub`" + + ```sds linenums="34" + @Pure + fun transform( + table: Table + ) -> result1: Table + ``` diff --git a/docs/stdlib/safeds/data/tabular/typing/ColumnType.md b/docs/stdlib/safeds/data/tabular/typing/ColumnType.md new file mode 100644 index 000000000..91dff7428 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/typing/ColumnType.md @@ -0,0 +1,63 @@ +# `#!sds abstract class` ColumnType {#safeds.data.tabular.typing.ColumnType data-toc-label='ColumnType'} + +Abstract base class for column types. + +??? quote "Source code in `column_type.sdsstub`" + + ```sds linenums="8" + class ColumnType { + /** + * Return whether the given column type is nullable. + * + * @result result1 True if the column is nullable. + */ + @Pure + @PythonName("is_nullable") + fun isNullable() -> result1: Boolean + + /** + * Return whether the given column type is numeric. + * + * @result result1 True if the column is numeric. + */ + @Pure + @PythonName("is_numeric") + fun isNumeric() -> result1: Boolean + } + ``` + +## `#!sds fun` isNullable {#safeds.data.tabular.typing.ColumnType.isNullable data-toc-label='isNullable'} + +Return whether the given column type is nullable. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if the column is nullable. | + +??? quote "Source code in `column_type.sdsstub`" + + ```sds linenums="14" + @Pure + @PythonName("is_nullable") + fun isNullable() -> result1: Boolean + ``` + +## `#!sds fun` isNumeric {#safeds.data.tabular.typing.ColumnType.isNumeric data-toc-label='isNumeric'} + +Return whether the given column type is numeric. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if the column is numeric. | + +??? quote "Source code in `column_type.sdsstub`" + + ```sds linenums="23" + @Pure + @PythonName("is_numeric") + fun isNumeric() -> result1: Boolean + ``` diff --git a/docs/stdlib/safeds/data/tabular/typing/Schema.md b/docs/stdlib/safeds/data/tabular/typing/Schema.md new file mode 100644 index 000000000..29c112457 --- /dev/null +++ b/docs/stdlib/safeds/data/tabular/typing/Schema.md @@ -0,0 +1,182 @@ +# `#!sds abstract class` Schema {#safeds.data.tabular.typing.Schema data-toc-label='Schema'} + +Store column names and corresponding data types for a `Table` or `Row`. + +??? quote "Source code in `schema.sdsstub`" + + ```sds linenums="10" + class Schema { + /** + * Return a list of all column names saved in this schema. + */ + @PythonName("column_names") attr columnNames: List + + /** + * Return whether the schema contains a given column. + * + * @param columnName The name of the column. + * + * @result result1 True if the schema contains the column. + */ + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + + /** + * Return the type of the given column. + * + * @param columnName The name of the column. + * + * @result result1 The type of the column. + */ + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + + /** + * Return a dictionary that maps column names to column types. + * + * @result result1 Dictionary representation of the schema. + */ + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map + + /** + * Merge multiple schemas into one. + * + * For each type missmatch the new schema will have the least common supertype. + * + * The type hierarchy is as follows: + * * Anything + * * RealNumber + * * Integer + * * Boolean + * * String + * + * @param schemas the list of schemas you want to merge + * + * @result result1 the new merged schema + */ + @Pure + @PythonName("merge_multiple_schemas") + static fun mergeMultipleSchemas( + schemas: List + ) -> result1: Schema + } + ``` + +## `#!sds attr` columnNames {#safeds.data.tabular.typing.Schema.columnNames data-toc-label='columnNames'} + +Return a list of all column names saved in this schema. + +**Type:** [`List`][safeds.lang.List] + +## `#!sds fun` getColumnType {#safeds.data.tabular.typing.Schema.getColumnType data-toc-label='getColumnType'} + +Return the type of the given column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`ColumnType`][safeds.data.tabular.typing.ColumnType] | The type of the column. | + +??? quote "Source code in `schema.sdsstub`" + + ```sds linenums="36" + @Pure + @PythonName("get_column_type") + fun getColumnType( + @PythonName("column_name") columnName: String + ) -> result1: ColumnType + ``` + +## `#!sds fun` hasColumn {#safeds.data.tabular.typing.Schema.hasColumn data-toc-label='hasColumn'} + +Return whether the schema contains a given column. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `columnName` | [`String`][safeds.lang.String] | The name of the column. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Boolean`][safeds.lang.Boolean] | True if the schema contains the column. | + +??? quote "Source code in `schema.sdsstub`" + + ```sds linenums="23" + @Pure + @PythonName("has_column") + fun hasColumn( + @PythonName("column_name") columnName: String + ) -> result1: Boolean + ``` + +## `#!sds fun` toDict {#safeds.data.tabular.typing.Schema.toDict data-toc-label='toDict'} + +Return a dictionary that maps column names to column types. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Map`][safeds.lang.Map] | Dictionary representation of the schema. | + +??? quote "Source code in `schema.sdsstub`" + + ```sds linenums="47" + @Pure + @PythonName("to_dict") + fun toDict() -> result1: Map + ``` + +## `#!sds static fun` mergeMultipleSchemas {#safeds.data.tabular.typing.Schema.mergeMultipleSchemas data-toc-label='mergeMultipleSchemas'} + +Merge multiple schemas into one. + +For each type missmatch the new schema will have the least common supertype. + +The type hierarchy is as follows: +* Anything + * RealNumber + * Integer + * Boolean + * String + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `schemas` | [`List`][safeds.lang.List] | the list of schemas you want to merge | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`Schema`][safeds.data.tabular.typing.Schema] | the new merged schema | + +??? quote "Source code in `schema.sdsstub`" + + ```sds linenums="67" + @Pure + @PythonName("merge_multiple_schemas") + static fun mergeMultipleSchemas( + schemas: List + ) -> result1: Schema + ``` diff --git a/docs/stdlib/safeds/lang/AnnotationTarget.md b/docs/stdlib/safeds/lang/AnnotationTarget.md new file mode 100644 index 000000000..9101f4f15 --- /dev/null +++ b/docs/stdlib/safeds/lang/AnnotationTarget.md @@ -0,0 +1,118 @@ +# `#!sds enum` AnnotationTarget {#safeds.lang.AnnotationTarget data-toc-label='AnnotationTarget'} + +The declaration types that can be targeted by annotations. + +??? quote "Source code in `annotationUsage.sdsstub`" + + ```sds linenums="16" + enum AnnotationTarget { + + /** + * The annotation can be called on annotations. + */ + Annotation + + /** + * The annotation can be called on attributes. + */ + Attribute + + /** + * The annotation can be called on classes. + */ + Class + + /** + * The annotation can be called on enums. + */ + Enum + + /** + * The annotation can be called on enum variants. + */ + EnumVariant + + /** + * The annotation can be called on functions. + */ + Function + + /** + * The annotation can be called on modules (i.e. files). + */ + Module + + /** + * The annotation can be called on parameters. + */ + Parameter + + /** + * The annotation can be called on pipelines. + */ + Pipeline + + /** + * The annotation can be called on results. + */ + Result + + /** + * The annotation can be called on segments. + */ + Segment + + /** + * The annotation can be called on type parameters. + */ + TypeParameter + } + ``` + +## Annotation {#safeds.lang.AnnotationTarget.Annotation data-toc-label='Annotation'} + +The annotation can be called on annotations. + +## Attribute {#safeds.lang.AnnotationTarget.Attribute data-toc-label='Attribute'} + +The annotation can be called on attributes. + +## Class {#safeds.lang.AnnotationTarget.Class data-toc-label='Class'} + +The annotation can be called on classes. + +## Enum {#safeds.lang.AnnotationTarget.Enum data-toc-label='Enum'} + +The annotation can be called on enums. + +## EnumVariant {#safeds.lang.AnnotationTarget.EnumVariant data-toc-label='EnumVariant'} + +The annotation can be called on enum variants. + +## Function {#safeds.lang.AnnotationTarget.Function data-toc-label='Function'} + +The annotation can be called on functions. + +## Module {#safeds.lang.AnnotationTarget.Module data-toc-label='Module'} + +The annotation can be called on modules (i.e. files). + +## Parameter {#safeds.lang.AnnotationTarget.Parameter data-toc-label='Parameter'} + +The annotation can be called on parameters. + +## Pipeline {#safeds.lang.AnnotationTarget.Pipeline data-toc-label='Pipeline'} + +The annotation can be called on pipelines. + +## Result {#safeds.lang.AnnotationTarget.Result data-toc-label='Result'} + +The annotation can be called on results. + +## Segment {#safeds.lang.AnnotationTarget.Segment data-toc-label='Segment'} + +The annotation can be called on segments. + +## TypeParameter {#safeds.lang.AnnotationTarget.TypeParameter data-toc-label='TypeParameter'} + +The annotation can be called on type parameters. diff --git a/docs/stdlib/safeds/lang/Any.md b/docs/stdlib/safeds/lang/Any.md new file mode 100644 index 000000000..02fe57132 --- /dev/null +++ b/docs/stdlib/safeds/lang/Any.md @@ -0,0 +1,35 @@ +# `#!sds abstract class` Any {#safeds.lang.Any data-toc-label='Any'} + +The common superclass of all classes. + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="6" + class Any { + + /** + * Returns a string representation of the object. + */ + @Pure + @PythonCall("str($this)") + fun toString() -> s: String + } + ``` + +## `#!sds fun` toString {#safeds.lang.Any.toString data-toc-label='toString'} + +Returns a string representation of the object. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `s` | [`String`][safeds.lang.String] | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="11" + @Pure + @PythonCall("str($this)") + fun toString() -> s: String + ``` diff --git a/docs/stdlib/safeds/lang/Boolean.md b/docs/stdlib/safeds/lang/Boolean.md new file mode 100644 index 000000000..4f981bc4e --- /dev/null +++ b/docs/stdlib/safeds/lang/Boolean.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` Boolean {#safeds.lang.Boolean data-toc-label='Boolean'} + +A truth value. + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="24" + class Boolean + ``` diff --git a/docs/stdlib/safeds/lang/Deprecated.md b/docs/stdlib/safeds/lang/Deprecated.md new file mode 100644 index 000000000..02aa8e7fe --- /dev/null +++ b/docs/stdlib/safeds/lang/Deprecated.md @@ -0,0 +1,35 @@ +# `#!sds annotation` Deprecated {#safeds.lang.Deprecated data-toc-label='Deprecated'} + +The declaration should no longer be used. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `alternative` | [`String?`][safeds.lang.String] | What to use instead. | `#!sds null` | +| `reason` | [`String?`][safeds.lang.String] | Why the declaration was deprecated. | `#!sds null` | +| `sinceVersion` | [`String?`][safeds.lang.String] | When the declaration was deprecated. | `#!sds null` | +| `removalVersion` | [`String?`][safeds.lang.String] | When the declaration will be removed. | `#!sds null` | + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Parameter` +- `Result` +- `Segment` + +??? quote "Source code in `maturity.sdsstub`" + + ```sds linenums="22" + annotation Deprecated( + alternative: String? = null, + reason: String? = null, + sinceVersion: String? = null, + removalVersion: String? = null, + ) + ``` diff --git a/docs/stdlib/safeds/lang/Experimental.md b/docs/stdlib/safeds/lang/Experimental.md new file mode 100644 index 000000000..3e80f2827 --- /dev/null +++ b/docs/stdlib/safeds/lang/Experimental.md @@ -0,0 +1,21 @@ +# `#!sds annotation` Experimental {#safeds.lang.Experimental data-toc-label='Experimental'} + +The declaration might change without a major version bump. + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Parameter` +- `Result` +- `Segment` + +??? quote "Source code in `maturity.sdsstub`" + + ```sds linenums="43" + annotation Experimental + ``` diff --git a/docs/stdlib/safeds/lang/Expert.md b/docs/stdlib/safeds/lang/Expert.md new file mode 100644 index 000000000..32117c8b8 --- /dev/null +++ b/docs/stdlib/safeds/lang/Expert.md @@ -0,0 +1,13 @@ +# :test_tube:{ title="Experimental" } `#!sds annotation` Expert {#safeds.lang.Expert data-toc-label='Expert'} + +This parameter should only be used by expert users. + +**Targets:** + +- `Parameter` + +??? quote "Source code in `ideIntegration.sdsstub`" + + ```sds linenums="8" + annotation Expert + ``` diff --git a/docs/stdlib/safeds/lang/Float.md b/docs/stdlib/safeds/lang/Float.md new file mode 100644 index 000000000..471b63a25 --- /dev/null +++ b/docs/stdlib/safeds/lang/Float.md @@ -0,0 +1,11 @@ +# `#!sds abstract class` Float {#safeds.lang.Float data-toc-label='Float'} + +A floating-point number. + +**Parent type:** [`Number`][safeds.lang.Number] + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="39" + class Float sub Number + ``` diff --git a/docs/stdlib/safeds/lang/Impure.md b/docs/stdlib/safeds/lang/Impure.md new file mode 100644 index 000000000..4629d29fb --- /dev/null +++ b/docs/stdlib/safeds/lang/Impure.md @@ -0,0 +1,19 @@ +# :test_tube:{ title="Experimental" } `#!sds annotation` Impure {#safeds.lang.Impure data-toc-label='Impure'} + +Indicates that the function has side effects and/or does not always return the same results given the same arguments. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `allReasons` | [`List`][safeds.lang.List] | A list of **all** reasons why the function is impure. If no specific [ImpurityReason][safeds.lang.ImpurityReason] applies, include `ImpurityReason.Other`. | - | + +**Targets:** + +- `Function` + +??? quote "Source code in `purity.sdsstub`" + + ```sds linenums="22" + annotation Impure(allReasons: List) + ``` diff --git a/docs/stdlib/safeds/lang/ImpurityReason.md b/docs/stdlib/safeds/lang/ImpurityReason.md new file mode 100644 index 000000000..a688e4606 --- /dev/null +++ b/docs/stdlib/safeds/lang/ImpurityReason.md @@ -0,0 +1,104 @@ +# `#!sds enum` ImpurityReason {#safeds.lang.ImpurityReason data-toc-label='ImpurityReason'} + +A reason why a function is impure. + +??? quote "Source code in `purity.sdsstub`" + + ```sds linenums="27" + enum ImpurityReason { + + /** + * The function reads from a file and the file path is a constant. + * + * @param path The path of the file. + */ + FileReadFromConstantPath(path: String) + + /** + * The function reads from a file and the file path is given by a parameter. + * + * @param parameterName The name of the parameter that specifies the file path. + */ + FileReadFromParameterizedPath(parameterName: String) + + /** + * The function writes to a file and the file path is a constant. + * + * @param path The path of the file. + */ + FileWriteToConstantPath(path: String) + + /** + * The function writes to a file and the file path is given by a parameter. + * + * @param parameterName The name of the parameter that specifies the file path. + */ + FileWriteToParameterizedPath(parameterName: String) + + /** + * The function calls another, potentially impure function that gets passed as a parameter. + * + * @param parameterName The name of the parameter that accepts the function. + */ + PotentiallyImpureParameterCall(parameterName: String) + + /** + * The function is impure for some other reason. If possible, use a more specific reason. + */ + Other + } + ``` + +## FileReadFromConstantPath {#safeds.lang.ImpurityReason.FileReadFromConstantPath data-toc-label='FileReadFromConstantPath'} + +The function reads from a file and the file path is a constant. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path of the file. | - | + +## FileReadFromParameterizedPath {#safeds.lang.ImpurityReason.FileReadFromParameterizedPath data-toc-label='FileReadFromParameterizedPath'} + +The function reads from a file and the file path is given by a parameter. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `parameterName` | [`String`][safeds.lang.String] | The name of the parameter that specifies the file path. | - | + +## FileWriteToConstantPath {#safeds.lang.ImpurityReason.FileWriteToConstantPath data-toc-label='FileWriteToConstantPath'} + +The function writes to a file and the file path is a constant. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `path` | [`String`][safeds.lang.String] | The path of the file. | - | + +## FileWriteToParameterizedPath {#safeds.lang.ImpurityReason.FileWriteToParameterizedPath data-toc-label='FileWriteToParameterizedPath'} + +The function writes to a file and the file path is given by a parameter. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `parameterName` | [`String`][safeds.lang.String] | The name of the parameter that specifies the file path. | - | + +## Other {#safeds.lang.ImpurityReason.Other data-toc-label='Other'} + +The function is impure for some other reason. If possible, use a more specific reason. + +## PotentiallyImpureParameterCall {#safeds.lang.ImpurityReason.PotentiallyImpureParameterCall data-toc-label='PotentiallyImpureParameterCall'} + +The function calls another, potentially impure function that gets passed as a parameter. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `parameterName` | [`String`][safeds.lang.String] | The name of the parameter that accepts the function. | - | diff --git a/docs/stdlib/safeds/lang/Int.md b/docs/stdlib/safeds/lang/Int.md new file mode 100644 index 000000000..464667f10 --- /dev/null +++ b/docs/stdlib/safeds/lang/Int.md @@ -0,0 +1,11 @@ +# `#!sds abstract class` Int {#safeds.lang.Int data-toc-label='Int'} + +An integer. + +**Parent type:** [`Number`][safeds.lang.Number] + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="34" + class Int sub Number + ``` diff --git a/docs/stdlib/safeds/lang/List.md b/docs/stdlib/safeds/lang/List.md new file mode 100644 index 000000000..89169047f --- /dev/null +++ b/docs/stdlib/safeds/lang/List.md @@ -0,0 +1,41 @@ +# `#!sds abstract class` List {#safeds.lang.List data-toc-label='List'} + +A list of elements. + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `E` | [`Any?`][safeds.lang.Any] | - | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="44" + class List { + + /** + * Returns the number of elements in the list. + */ + @Pure + @PythonCall("len($this)") + fun size() -> size: Int + } + ``` + +## `#!sds fun` size {#safeds.lang.List.size data-toc-label='size'} + +Returns the number of elements in the list. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `size` | [`Int`][safeds.lang.Int] | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="49" + @Pure + @PythonCall("len($this)") + fun size() -> size: Int + ``` diff --git a/docs/stdlib/safeds/lang/Map.md b/docs/stdlib/safeds/lang/Map.md new file mode 100644 index 000000000..96f43256b --- /dev/null +++ b/docs/stdlib/safeds/lang/Map.md @@ -0,0 +1,92 @@ +# `#!sds abstract class` Map {#safeds.lang.Map data-toc-label='Map'} + +A map of keys to values. + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `K` | [`Any?`][safeds.lang.Any] | - | - | +| `V` | [`Any?`][safeds.lang.Any] | - | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="57" + class Map { + + /** + * Returns the number of entries in the map. + */ + @Pure + @PythonCall("len($this)") + fun size() -> size: Int + + /** + * Returns the keys of the map. + */ + @Pure + @PythonCall("list($this.keys())") + fun keys() -> keys: List + + /** + * Returns the values of the map. + */ + @Pure + @PythonCall("list($this.values())") + fun values() -> values: List + } + ``` + +## `#!sds fun` keys {#safeds.lang.Map.keys data-toc-label='keys'} + +Returns the keys of the map. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `keys` | [`List`][safeds.lang.List] | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="69" + @Pure + @PythonCall("list($this.keys())") + fun keys() -> keys: List + ``` + +## `#!sds fun` size {#safeds.lang.Map.size data-toc-label='size'} + +Returns the number of entries in the map. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `size` | [`Int`][safeds.lang.Int] | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="62" + @Pure + @PythonCall("len($this)") + fun size() -> size: Int + ``` + +## `#!sds fun` values {#safeds.lang.Map.values data-toc-label='values'} + +Returns the values of the map. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `values` | [`List`][safeds.lang.List] | - | + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="76" + @Pure + @PythonCall("list($this.values())") + fun values() -> values: List + ``` diff --git a/docs/stdlib/safeds/lang/Nothing.md b/docs/stdlib/safeds/lang/Nothing.md new file mode 100644 index 000000000..bf8faccdd --- /dev/null +++ b/docs/stdlib/safeds/lang/Nothing.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` Nothing {#safeds.lang.Nothing data-toc-label='Nothing'} + +The common subclass of all classes. + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="19" + class Nothing + ``` diff --git a/docs/stdlib/safeds/lang/Number.md b/docs/stdlib/safeds/lang/Number.md new file mode 100644 index 000000000..79341252c --- /dev/null +++ b/docs/stdlib/safeds/lang/Number.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` Number {#safeds.lang.Number data-toc-label='Number'} + +A number. + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="29" + class Number + ``` diff --git a/docs/stdlib/safeds/lang/Pure.md b/docs/stdlib/safeds/lang/Pure.md new file mode 100644 index 000000000..791ddb955 --- /dev/null +++ b/docs/stdlib/safeds/lang/Pure.md @@ -0,0 +1,17 @@ +# :test_tube:{ title="Experimental" } `#!sds annotation` Pure {#safeds.lang.Pure data-toc-label='Pure'} + +Indicates that the function has no side effects and always returns the same results given the same arguments. + +Calls to such a function may be eliminated, if its results are not used. Moreover, the function can be memoized, i.e. +we can remember its results for a set of arguments. Finally, a pure function can be called at any time, allowing +reordering of calls or parallelization. + +**Targets:** + +- `Function` + +??? quote "Source code in `purity.sdsstub`" + + ```sds linenums="12" + annotation Pure + ``` diff --git a/docs/stdlib/safeds/lang/PythonCall.md b/docs/stdlib/safeds/lang/PythonCall.md new file mode 100644 index 000000000..bc0087af9 --- /dev/null +++ b/docs/stdlib/safeds/lang/PythonCall.md @@ -0,0 +1,26 @@ +# :test_tube:{ title="Experimental" } `#!sds annotation` PythonCall {#safeds.lang.PythonCall data-toc-label='PythonCall'} + +The specification of a corresponding function call in Python. By default, the function is called as specified in the +stub. + +The specification can contain template expressions, which are replaced by the corresponding arguments of the function +call. `$this` is replaced by the receiver of the call. `$param` is replaced by the value of the parameter called +`param`. Otherwise, the string is used as-is. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `callSpecification` | [`String`][safeds.lang.String] | - | - | + +**Targets:** + +- `Function` + +??? quote "Source code in `codeGeneration.sdsstub`" + + ```sds linenums="13" + annotation PythonCall( + callSpecification: String + ) + ``` diff --git a/docs/stdlib/safeds/lang/PythonModule.md b/docs/stdlib/safeds/lang/PythonModule.md new file mode 100644 index 000000000..8919c1e5f --- /dev/null +++ b/docs/stdlib/safeds/lang/PythonModule.md @@ -0,0 +1,21 @@ +# `#!sds annotation` PythonModule {#safeds.lang.PythonModule data-toc-label='PythonModule'} + +The qualified name of the corresponding Python module. By default, this is the qualified name of the package. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `qualifiedName` | [`String`][safeds.lang.String] | - | - | + +**Targets:** + +- `Module` + +??? quote "Source code in `codeGeneration.sdsstub`" + + ```sds linenums="21" + annotation PythonModule( + qualifiedName: String + ) + ``` diff --git a/docs/stdlib/safeds/lang/PythonName.md b/docs/stdlib/safeds/lang/PythonName.md new file mode 100644 index 000000000..94e7ea965 --- /dev/null +++ b/docs/stdlib/safeds/lang/PythonName.md @@ -0,0 +1,28 @@ +# `#!sds annotation` PythonName {#safeds.lang.PythonName data-toc-label='PythonName'} + +The name of the corresponding API element in Python. By default, this is the name of the declaration in the stubs. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `name` | [`String`][safeds.lang.String] | - | - | + +**Targets:** + +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Parameter` +- `Pipeline` +- `Segment` + +??? quote "Source code in `codeGeneration.sdsstub`" + + ```sds linenums="38" + annotation PythonName( + name: String + ) + ``` diff --git a/docs/stdlib/safeds/lang/Repeatable.md b/docs/stdlib/safeds/lang/Repeatable.md new file mode 100644 index 000000000..41dcb2c0a --- /dev/null +++ b/docs/stdlib/safeds/lang/Repeatable.md @@ -0,0 +1,13 @@ +# `#!sds annotation` Repeatable {#safeds.lang.Repeatable data-toc-label='Repeatable'} + +The annotation can be called multiple times for the same declaration. + +**Targets:** + +- `Annotation` + +??? quote "Source code in `annotationUsage.sdsstub`" + + ```sds linenums="83" + annotation Repeatable + ``` diff --git a/docs/stdlib/safeds/lang/String.md b/docs/stdlib/safeds/lang/String.md new file mode 100644 index 000000000..e95eda4b6 --- /dev/null +++ b/docs/stdlib/safeds/lang/String.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` String {#safeds.lang.String data-toc-label='String'} + +Some text. + +??? quote "Source code in `coreClasses.sdsstub`" + + ```sds linenums="84" + class String + ``` diff --git a/docs/stdlib/safeds/lang/Target.md b/docs/stdlib/safeds/lang/Target.md new file mode 100644 index 000000000..5bcc3599f --- /dev/null +++ b/docs/stdlib/safeds/lang/Target.md @@ -0,0 +1,21 @@ +# `#!sds annotation` Target {#safeds.lang.Target data-toc-label='Target'} + +The annotation must target only the specified declaration types. By default, any declaration type can be targeted. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `targets` | [`List`][safeds.lang.List] | An exhaustive list of the valid targets. | - | + +**Targets:** + +- `Annotation` + +??? quote "Source code in `annotationUsage.sdsstub`" + + ```sds linenums="9" + annotation Target( + targets: List + ) + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/AdaBoostClassifier.md b/docs/stdlib/safeds/ml/classical/classification/AdaBoostClassifier.md new file mode 100644 index 000000000..1cccc8fc8 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/AdaBoostClassifier.md @@ -0,0 +1,98 @@ +# `#!sds class` AdaBoostClassifier {#safeds.ml.classical.classification.AdaBoostClassifier data-toc-label='AdaBoostClassifier'} + +Ada Boost classification. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `learner` | [`Classifier`][safeds.ml.classical.classification.Classifier] | The learner from which the boosted ensemble is built. | `#!sds DecisionTreeClassifier()` | +| `maximumNumberOfLearners` | [`Int`][safeds.lang.Int] | The maximum number of learners at which boosting is terminated. In case of perfect fit, the learning procedure is stopped early. Has to be greater than 0. | `#!sds 50` | +| `learningRate` | [`Float`][safeds.lang.Float] | Weight applied to each classifier at each boosting iteration. A higher learning rate increases the contribution of each classifier. Has to be greater than 0. | `#!sds 1.0` | + +??? quote "Source code in `ada_boost.sdsstub`" + + ```sds linenums="16" + class AdaBoostClassifier( + learner: Classifier = DecisionTreeClassifier(), + @PythonName("maximum_number_of_learners") const maximumNumberOfLearners: Int = 50, + @PythonName("learning_rate") const learningRate: Float = 1.0 + ) sub Classifier where { + maximumNumberOfLearners >= 1, + learningRate > 0.0 + } { + /** + * Get the base learner used for training the ensemble. + */ + attr learner: Classifier + /** + * Get the maximum number of learners in the ensemble. + */ + @PythonName("maximum_number_of_learners") attr maximumNumberOfLearners: Int + /** + * Get the learning rate. + */ + @PythonName("learning_rate") attr learningRate: Float + + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: AdaBoostClassifier + } + ``` + +## `#!sds attr` learner {#safeds.ml.classical.classification.AdaBoostClassifier.learner data-toc-label='learner'} + +Get the base learner used for training the ensemble. + +**Type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +## `#!sds attr` learningRate {#safeds.ml.classical.classification.AdaBoostClassifier.learningRate data-toc-label='learningRate'} + +Get the learning rate. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` maximumNumberOfLearners {#safeds.ml.classical.classification.AdaBoostClassifier.maximumNumberOfLearners data-toc-label='maximumNumberOfLearners'} + +Get the maximum number of learners in the ensemble. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.classification.AdaBoostClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`AdaBoostClassifier`][safeds.ml.classical.classification.AdaBoostClassifier] | The fitted classifier. | + +??? quote "Source code in `ada_boost.sdsstub`" + + ```sds linenums="46" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: AdaBoostClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/Classifier.md b/docs/stdlib/safeds/ml/classical/classification/Classifier.md new file mode 100644 index 000000000..ab315a517 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/Classifier.md @@ -0,0 +1,279 @@ +# `#!sds abstract class` Classifier {#safeds.ml.classical.classification.Classifier data-toc-label='Classifier'} + +Abstract base class for all classifiers. + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="8" + class Classifier { + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: Classifier + + /** + * Predict a target vector using a dataset containing feature vectors. The model has to be trained first. + * + * @param dataset The dataset containing the feature vectors. + * + * @result prediction A dataset containing the given feature vectors and the predicted target vector. + */ + @Pure + fun predict( + dataset: Table + ) -> prediction: TaggedTable + + /** + * Check if the classifier is fitted. + * + * @result isFitted Whether the classifier is fitted. + */ + @Pure + @PythonName("is_fitted") + fun isFitted() -> isFitted: Boolean + + /** + * Compute the accuracy of the classifier on the given data. + * + * @param validationOrTestSet The validation or test set. + * + * @result accuracy The calculated accuracy score, i.e. the percentage of equal data. + */ + @Pure + fun accuracy( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> accuracy: Float + + /** + * Compute the classifier's precision on the given data. + * + * @param validationOrTestSet The validation or test set. + * @param positiveClass The class to be considered positive. All other classes are considered negative. + * + * @result precision The calculated precision score, i.e. the ratio of correctly predicted positives to all predicted positives. + * Return 1 if no positive predictions are made. + */ + @Pure + fun precision( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> precision: Float + + /** + * Compute the classifier's recall on the given data. + * + * @param validationOrTestSet The validation or test set. + * @param positiveClass The class to be considered positive. All other classes are considered negative. + * + * @result recall The calculated recall score, i.e. the ratio of correctly predicted positives to all expected positives. + * Return 1 if there are no positive expectations. + */ + @Pure + fun recall( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> recall: Float + + /** + * Compute the classifier's $F_1$-score on the given data. + * + * @param validationOrTestSet The validation or test set. + * @param positiveClass The class to be considered positive. All other classes are considered negative. + * + * @result f1Score The calculated $F_1$-score, i.e. the harmonic mean between precision and recall. + * Return 1 if there are no positive expectations and predictions. + */ + @Pure + @PythonName("f1_score") + fun f1Score( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> f1Score: Float + } + ``` + +## `#!sds fun` accuracy {#safeds.ml.classical.classification.Classifier.accuracy data-toc-label='accuracy'} + +Compute the accuracy of the classifier on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `accuracy` | [`Float`][safeds.lang.Float] | The calculated accuracy score, i.e. the percentage of equal data. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="51" + @Pure + fun accuracy( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> accuracy: Float + ``` + +## `#!sds fun` f1Score {#safeds.ml.classical.classification.Classifier.f1Score data-toc-label='f1Score'} + +Compute the classifier's $F_1$-score on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `f1Score` | [`Float`][safeds.lang.Float] | The calculated $F_1$-score, i.e. the harmonic mean between precision and recall. Return 1 if there are no positive expectations and predictions. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="95" + @Pure + @PythonName("f1_score") + fun f1Score( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> f1Score: Float + ``` + +## `#!sds fun` fit {#safeds.ml.classical.classification.Classifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`Classifier`][safeds.ml.classical.classification.Classifier] | The fitted classifier. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="18" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: Classifier + ``` + +## `#!sds fun` isFitted {#safeds.ml.classical.classification.Classifier.isFitted data-toc-label='isFitted'} + +Check if the classifier is fitted. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the classifier is fitted. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="40" + @Pure + @PythonName("is_fitted") + fun isFitted() -> isFitted: Boolean + ``` + +## `#!sds fun` precision {#safeds.ml.classical.classification.Classifier.precision data-toc-label='precision'} + +Compute the classifier's precision on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `precision` | [`Float`][safeds.lang.Float] | The calculated precision score, i.e. the ratio of correctly predicted positives to all predicted positives. Return 1 if no positive predictions are made. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="65" + @Pure + fun precision( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> precision: Float + ``` + +## `#!sds fun` predict {#safeds.ml.classical.classification.Classifier.predict data-toc-label='predict'} + +Predict a target vector using a dataset containing feature vectors. The model has to be trained first. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `dataset` | [`Table`][safeds.data.tabular.containers.Table] | The dataset containing the feature vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="30" + @Pure + fun predict( + dataset: Table + ) -> prediction: TaggedTable + ``` + +## `#!sds fun` recall {#safeds.ml.classical.classification.Classifier.recall data-toc-label='recall'} + +Compute the classifier's recall on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | +| `positiveClass` | [`Any`][safeds.lang.Any] | The class to be considered positive. All other classes are considered negative. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `recall` | [`Float`][safeds.lang.Float] | The calculated recall score, i.e. the ratio of correctly predicted positives to all expected positives. Return 1 if there are no positive expectations. | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="80" + @Pure + fun recall( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable, + @PythonName("positive_class") positiveClass: Any + ) -> recall: Float + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/DecisionTreeClassifier.md b/docs/stdlib/safeds/ml/classical/classification/DecisionTreeClassifier.md new file mode 100644 index 000000000..f9986675b --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/DecisionTreeClassifier.md @@ -0,0 +1,52 @@ +# `#!sds class` DecisionTreeClassifier {#safeds.ml.classical.classification.DecisionTreeClassifier data-toc-label='DecisionTreeClassifier'} + +Decision tree classification. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +??? quote "Source code in `decision_tree.sdsstub`" + + ```sds linenums="10" + class DecisionTreeClassifier() sub Classifier { + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: DecisionTreeClassifier + } + ``` + +## `#!sds fun` fit {#safeds.ml.classical.classification.DecisionTreeClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`DecisionTreeClassifier`][safeds.ml.classical.classification.DecisionTreeClassifier] | The fitted classifier. | + +??? quote "Source code in `decision_tree.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: DecisionTreeClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/GradientBoostingClassifier.md b/docs/stdlib/safeds/ml/classical/classification/GradientBoostingClassifier.md new file mode 100644 index 000000000..7e5ea6990 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/GradientBoostingClassifier.md @@ -0,0 +1,86 @@ +# `#!sds class` GradientBoostingClassifier {#safeds.ml.classical.classification.GradientBoostingClassifier data-toc-label='GradientBoostingClassifier'} + +Gradient boosting classification. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfTrees` | [`Int`][safeds.lang.Int] | The number of boosting stages to perform. Gradient boosting is fairly robust to over-fitting so a large number usually results in better performance. | `#!sds 100` | +| `learningRate` | [`Float`][safeds.lang.Float] | The larger the value, the more the model is influenced by each additional tree. If the learning rate is too low, the model might underfit. If the learning rate is too high, the model might overfit. | `#!sds 0.1` | + +??? quote "Source code in `gradient_boosting.sdsstub`" + + ```sds linenums="15" + class GradientBoostingClassifier( + @PythonName("number_of_trees") const numberOfTrees: Int = 100, + @PythonName("learning_rate") const learningRate: Float = 0.1 + ) sub Classifier where { + numberOfTrees >= 1, + learningRate > 0.0 + } { + /** + * Get the number of trees (estimators) in the ensemble. + */ + @PythonName("number_of_trees") attr numberOfTrees: Int + /** + * Get the learning rate. + */ + @PythonName("learning_rate") attr learningRate: Float + + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: GradientBoostingClassifier + } + ``` + +## `#!sds attr` learningRate {#safeds.ml.classical.classification.GradientBoostingClassifier.learningRate data-toc-label='learningRate'} + +Get the learning rate. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` numberOfTrees {#safeds.ml.classical.classification.GradientBoostingClassifier.numberOfTrees data-toc-label='numberOfTrees'} + +Get the number of trees (estimators) in the ensemble. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.classification.GradientBoostingClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`GradientBoostingClassifier`][safeds.ml.classical.classification.GradientBoostingClassifier] | The fitted classifier. | + +??? quote "Source code in `gradient_boosting.sdsstub`" + + ```sds linenums="40" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: GradientBoostingClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/KNearestNeighborsClassifier.md b/docs/stdlib/safeds/ml/classical/classification/KNearestNeighborsClassifier.md new file mode 100644 index 000000000..4b7492126 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/KNearestNeighborsClassifier.md @@ -0,0 +1,73 @@ +# `#!sds class` KNearestNeighborsClassifier {#safeds.ml.classical.classification.KNearestNeighborsClassifier data-toc-label='KNearestNeighborsClassifier'} + +K-nearest-neighbors classification. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfNeighbors` | [`Int`][safeds.lang.Int] | The number of neighbors to use for interpolation. Has to be greater than 0 (validated in the constructor) and less than or equal to the sample size (validated when calling `fit`). | - | + +??? quote "Source code in `k_nearest_neighbors.sdsstub`" + + ```sds linenums="13" + class KNearestNeighborsClassifier( + @PythonName("number_of_neighbors") const numberOfNeighbors: Int + ) sub Classifier where { + numberOfNeighbors >= 1 + } { + /** + * Get the number of neighbors used for interpolation. + */ + @PythonName("number_of_neighbors") attr numberOfNeighbors: Int + + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: KNearestNeighborsClassifier + } + ``` + +## `#!sds attr` numberOfNeighbors {#safeds.ml.classical.classification.KNearestNeighborsClassifier.numberOfNeighbors data-toc-label='numberOfNeighbors'} + +Get the number of neighbors used for interpolation. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.classification.KNearestNeighborsClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`KNearestNeighborsClassifier`][safeds.ml.classical.classification.KNearestNeighborsClassifier] | The fitted classifier. | + +??? quote "Source code in `k_nearest_neighbors.sdsstub`" + + ```sds linenums="32" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: KNearestNeighborsClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/LogisticRegressionClassifier.md b/docs/stdlib/safeds/ml/classical/classification/LogisticRegressionClassifier.md new file mode 100644 index 000000000..f72f8b6a2 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/LogisticRegressionClassifier.md @@ -0,0 +1,52 @@ +# `#!sds class` LogisticRegressionClassifier {#safeds.ml.classical.classification.LogisticRegressionClassifier data-toc-label='LogisticRegressionClassifier'} + +Regularized logistic regression. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +??? quote "Source code in `logistic_regression.sdsstub`" + + ```sds linenums="10" + class LogisticRegressionClassifier() sub Classifier { + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: LogisticRegressionClassifier + } + ``` + +## `#!sds fun` fit {#safeds.ml.classical.classification.LogisticRegressionClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`LogisticRegressionClassifier`][safeds.ml.classical.classification.LogisticRegressionClassifier] | The fitted classifier. | + +??? quote "Source code in `logistic_regression.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: LogisticRegressionClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/RandomForestClassifier.md b/docs/stdlib/safeds/ml/classical/classification/RandomForestClassifier.md new file mode 100644 index 000000000..16646b85a --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/RandomForestClassifier.md @@ -0,0 +1,73 @@ +# `#!sds class` RandomForestClassifier {#safeds.ml.classical.classification.RandomForestClassifier data-toc-label='RandomForestClassifier'} + +Random forest classification. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfTrees` | [`Int`][safeds.lang.Int] | The number of trees to be used in the random forest. Has to be greater than 0. | `#!sds 100` | + +??? quote "Source code in `random_forest.sdsstub`" + + ```sds linenums="12" + class RandomForestClassifier( + @PythonName("number_of_trees") const numberOfTrees: Int = 100 + ) sub Classifier where { + numberOfTrees >= 1 + } { + /** + * Get the number of trees used in the random forest. + */ + @PythonName("number_of_trees") attr numberOfTrees: Int + + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: RandomForestClassifier + } + ``` + +## `#!sds attr` numberOfTrees {#safeds.ml.classical.classification.RandomForestClassifier.numberOfTrees data-toc-label='numberOfTrees'} + +Get the number of trees used in the random forest. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.classification.RandomForestClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`RandomForestClassifier`][safeds.ml.classical.classification.RandomForestClassifier] | The fitted classifier. | + +??? quote "Source code in `random_forest.sdsstub`" + + ```sds linenums="31" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: RandomForestClassifier + ``` diff --git a/docs/stdlib/safeds/ml/classical/classification/SupportVectorMachineClassifier.md b/docs/stdlib/safeds/ml/classical/classification/SupportVectorMachineClassifier.md new file mode 100644 index 000000000..f2afbfe77 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/classification/SupportVectorMachineClassifier.md @@ -0,0 +1,166 @@ +# `#!sds class` SupportVectorMachineClassifier {#safeds.ml.classical.classification.SupportVectorMachineClassifier data-toc-label='SupportVectorMachineClassifier'} + +Support vector machine. + +**Parent type:** [`Classifier`][safeds.ml.classical.classification.Classifier] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `c` | [`Float`][safeds.lang.Float] | The strength of regularization. Must be strictly positive. | `#!sds 1.0` | +| `kernel` | [`Kernel`][safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel] | The type of kernel to be used. Defaults to None. | `#!sds SupportVectorMachineClassifier.Kernel.RadialBasisFunction` | + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="13" + class SupportVectorMachineClassifier( + const c: Float = 1.0, + kernel: SupportVectorMachineClassifier.Kernel = SupportVectorMachineClassifier.Kernel.RadialBasisFunction + ) sub Classifier where { + c > 0.0 + } { + /** + * The kernel functions that can be used in the support vector machine. + */ + enum Kernel { + /** + * A linear kernel. + */ + Linear + + /** + * A polynomial kernel. + * + * @param degree The degree of the polynomial. + */ + Polynomial(degree: Int) + + /** + * A sigmoid kernel. + */ + Sigmoid + + /** + * A radial basis function kernel. + */ + RadialBasisFunction + } + + /** + * Get the regularization strength. + */ + attr c: Float + /** + * Get the type of kernel used. + */ + attr kernel: SupportVectorMachineClassifier.Kernel + + /** + * Create a copy of this classifier and fit it with the given training data. + * + * This classifier is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedClassifier The fitted classifier. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: SupportVectorMachineClassifier + } + ``` + +## `#!sds attr` c {#safeds.ml.classical.classification.SupportVectorMachineClassifier.c data-toc-label='c'} + +Get the regularization strength. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` kernel {#safeds.ml.classical.classification.SupportVectorMachineClassifier.kernel data-toc-label='kernel'} + +Get the type of kernel used. + +**Type:** [`Kernel`][safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel] + +## `#!sds fun` fit {#safeds.ml.classical.classification.SupportVectorMachineClassifier.fit data-toc-label='fit'} + +Create a copy of this classifier and fit it with the given training data. + +This classifier is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`SupportVectorMachineClassifier`][safeds.ml.classical.classification.SupportVectorMachineClassifier] | The fitted classifier. | + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="64" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedClassifier: SupportVectorMachineClassifier + ``` + +## `#!sds enum` Kernel {#safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel data-toc-label='Kernel'} + +The kernel functions that can be used in the support vector machine. + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="22" + enum Kernel { + /** + * A linear kernel. + */ + Linear + + /** + * A polynomial kernel. + * + * @param degree The degree of the polynomial. + */ + Polynomial(degree: Int) + + /** + * A sigmoid kernel. + */ + Sigmoid + + /** + * A radial basis function kernel. + */ + RadialBasisFunction + } + ``` + +### Linear {#safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel.Linear data-toc-label='Linear'} + +A linear kernel. + +### Polynomial {#safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel.Polynomial data-toc-label='Polynomial'} + +A polynomial kernel. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `degree` | [`Int`][safeds.lang.Int] | The degree of the polynomial. | - | + +### RadialBasisFunction {#safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel.RadialBasisFunction data-toc-label='RadialBasisFunction'} + +A radial basis function kernel. + +### Sigmoid {#safeds.ml.classical.classification.SupportVectorMachineClassifier.Kernel.Sigmoid data-toc-label='Sigmoid'} + +A sigmoid kernel. diff --git a/docs/stdlib/safeds/ml/classical/regression/AdaBoostRegressor.md b/docs/stdlib/safeds/ml/classical/regression/AdaBoostRegressor.md new file mode 100644 index 000000000..87ace8f02 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/AdaBoostRegressor.md @@ -0,0 +1,98 @@ +# `#!sds class` AdaBoostRegressor {#safeds.ml.classical.regression.AdaBoostRegressor data-toc-label='AdaBoostRegressor'} + +Ada Boost regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `learner` | [`Regressor`][safeds.ml.classical.regression.Regressor] | The learner from which the boosted ensemble is built. | `#!sds DecisionTreeRegressor()` | +| `maximumNumberOfLearners` | [`Int`][safeds.lang.Int] | The maximum number of learners at which boosting is terminated. In case of perfect fit, the learning procedure is stopped early. Has to be greater than 0. | `#!sds 50` | +| `learningRate` | [`Float`][safeds.lang.Float] | Weight applied to each regressor at each boosting iteration. A higher learning rate increases the contribution of each regressor. Has to be greater than 0. | `#!sds 1.0` | + +??? quote "Source code in `ada_boost.sdsstub`" + + ```sds linenums="16" + class AdaBoostRegressor( + learner: Regressor = DecisionTreeRegressor(), + @PythonName("maximum_number_of_learners") const maximumNumberOfLearners: Int = 50, + @PythonName("learning_rate") const learningRate: Float = 1.0 + ) sub Regressor where { + maximumNumberOfLearners >= 1, + learningRate > 0.0 + } { + /** + * Get the base learner used for training the ensemble. + */ + attr learner: Regressor + /** + * Get the maximum number of learners in the ensemble. + */ + @PythonName("maximum_number_of_learners") attr maximumNumberOfLearners: Int + /** + * Get the learning rate. + */ + @PythonName("learning_rate") attr learningRate: Float + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: AdaBoostRegressor + } + ``` + +## `#!sds attr` learner {#safeds.ml.classical.regression.AdaBoostRegressor.learner data-toc-label='learner'} + +Get the base learner used for training the ensemble. + +**Type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +## `#!sds attr` learningRate {#safeds.ml.classical.regression.AdaBoostRegressor.learningRate data-toc-label='learningRate'} + +Get the learning rate. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` maximumNumberOfLearners {#safeds.ml.classical.regression.AdaBoostRegressor.maximumNumberOfLearners data-toc-label='maximumNumberOfLearners'} + +Get the maximum number of learners in the ensemble. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.regression.AdaBoostRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`AdaBoostRegressor`][safeds.ml.classical.regression.AdaBoostRegressor] | The fitted regressor. | + +??? quote "Source code in `ada_boost.sdsstub`" + + ```sds linenums="46" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: AdaBoostRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/DecisionTreeRegressor.md b/docs/stdlib/safeds/ml/classical/regression/DecisionTreeRegressor.md new file mode 100644 index 000000000..4429d0b1a --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/DecisionTreeRegressor.md @@ -0,0 +1,52 @@ +# `#!sds class` DecisionTreeRegressor {#safeds.ml.classical.regression.DecisionTreeRegressor data-toc-label='DecisionTreeRegressor'} + +Decision tree regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +??? quote "Source code in `decision_tree.sdsstub`" + + ```sds linenums="10" + class DecisionTreeRegressor() sub Regressor { + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: DecisionTreeRegressor + } + ``` + +## `#!sds fun` fit {#safeds.ml.classical.regression.DecisionTreeRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`DecisionTreeRegressor`][safeds.ml.classical.regression.DecisionTreeRegressor] | The fitted regressor. | + +??? quote "Source code in `decision_tree.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: DecisionTreeRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/ElasticNetRegressor.md b/docs/stdlib/safeds/ml/classical/regression/ElasticNetRegressor.md new file mode 100644 index 000000000..16f025ecd --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/ElasticNetRegressor.md @@ -0,0 +1,87 @@ +# `#!sds class` ElasticNetRegressor {#safeds.ml.classical.regression.ElasticNetRegressor data-toc-label='ElasticNetRegressor'} + +Elastic net regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `alpha` | [`Float`][safeds.lang.Float] | Controls the regularization of the model. The higher the value, the more regularized it becomes. | `#!sds 1.0` | +| `lassoRatio` | [`Float`][safeds.lang.Float] | Number between 0 and 1 that controls the ratio between Lasso and Ridge regularization. If 0, only Ridge regularization is used. If 1, only Lasso regularization is used. | `#!sds 0.5` | + +??? quote "Source code in `elastic_net_regression.sdsstub`" + + ```sds linenums="14" + class ElasticNetRegressor( + const alpha: Float = 1.0, + @PythonName("lasso_ratio") const lassoRatio: Float = 0.5 + ) sub Regressor where { + alpha >= 0.0, + lassoRatio >= 0.0, + lassoRatio <= 1.0 + } { + /** + * Get the regularization of the model. + */ + attr alpha: Float + /** + * Get the ratio between Lasso and Ridge regularization. + */ + @PythonName("lasso_ratio") attr lassoRatio: Float + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: ElasticNetRegressor + } + ``` + +## `#!sds attr` alpha {#safeds.ml.classical.regression.ElasticNetRegressor.alpha data-toc-label='alpha'} + +Get the regularization of the model. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` lassoRatio {#safeds.ml.classical.regression.ElasticNetRegressor.lassoRatio data-toc-label='lassoRatio'} + +Get the ratio between Lasso and Ridge regularization. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds fun` fit {#safeds.ml.classical.regression.ElasticNetRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`ElasticNetRegressor`][safeds.ml.classical.regression.ElasticNetRegressor] | The fitted regressor. | + +??? quote "Source code in `elastic_net_regression.sdsstub`" + + ```sds linenums="40" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: ElasticNetRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/GradientBoostingRegressor.md b/docs/stdlib/safeds/ml/classical/regression/GradientBoostingRegressor.md new file mode 100644 index 000000000..49213cb07 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/GradientBoostingRegressor.md @@ -0,0 +1,86 @@ +# `#!sds class` GradientBoostingRegressor {#safeds.ml.classical.regression.GradientBoostingRegressor data-toc-label='GradientBoostingRegressor'} + +Gradient boosting regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfTrees` | [`Int`][safeds.lang.Int] | The number of boosting stages to perform. Gradient boosting is fairly robust to over-fitting so a large number usually results in better performance. | `#!sds 100` | +| `learningRate` | [`Float`][safeds.lang.Float] | The larger the value, the more the model is influenced by each additional tree. If the learning rate is too low, the model might underfit. If the learning rate is too high, the model might overfit. | `#!sds 0.1` | + +??? quote "Source code in `gradient_boosting.sdsstub`" + + ```sds linenums="15" + class GradientBoostingRegressor( + @PythonName("number_of_trees") const numberOfTrees: Int = 100, + @PythonName("learning_rate") const learningRate: Float = 0.1 + ) sub Regressor where { + numberOfTrees >= 1, + learningRate > 0.0 + } { + /** + * Get the number of trees (estimators) in the ensemble. + */ + @PythonName("number_of_trees") attr numberOfTrees: Int + /** + * Get the learning rate. + */ + @PythonName("learning_rate") attr learningRate: Float + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: GradientBoostingRegressor + } + ``` + +## `#!sds attr` learningRate {#safeds.ml.classical.regression.GradientBoostingRegressor.learningRate data-toc-label='learningRate'} + +Get the learning rate. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` numberOfTrees {#safeds.ml.classical.regression.GradientBoostingRegressor.numberOfTrees data-toc-label='numberOfTrees'} + +Get the number of trees (estimators) in the ensemble. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.regression.GradientBoostingRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`GradientBoostingRegressor`][safeds.ml.classical.regression.GradientBoostingRegressor] | The fitted regressor. | + +??? quote "Source code in `gradient_boosting.sdsstub`" + + ```sds linenums="40" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: GradientBoostingRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/KNearestNeighborsRegressor.md b/docs/stdlib/safeds/ml/classical/regression/KNearestNeighborsRegressor.md new file mode 100644 index 000000000..fe4890886 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/KNearestNeighborsRegressor.md @@ -0,0 +1,73 @@ +# `#!sds class` KNearestNeighborsRegressor {#safeds.ml.classical.regression.KNearestNeighborsRegressor data-toc-label='KNearestNeighborsRegressor'} + +K-nearest-neighbors regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfNeighbors` | [`Int`][safeds.lang.Int] | The number of neighbors to use for interpolation. Has to be greater than 0 (validated in the constructor) and less than or equal to the sample size (validated when calling `fit`). | - | + +??? quote "Source code in `k_nearest_neighbors.sdsstub`" + + ```sds linenums="13" + class KNearestNeighborsRegressor( + @PythonName("number_of_neighbors") const numberOfNeighbors: Int + ) sub Regressor where { + numberOfNeighbors >= 1 + } { + /** + * Get the number of neighbors used for interpolation. + */ + @PythonName("number_of_neighbors") attr numberOfNeighbors: Int + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: KNearestNeighborsRegressor + } + ``` + +## `#!sds attr` numberOfNeighbors {#safeds.ml.classical.regression.KNearestNeighborsRegressor.numberOfNeighbors data-toc-label='numberOfNeighbors'} + +Get the number of neighbors used for interpolation. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.regression.KNearestNeighborsRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`KNearestNeighborsRegressor`][safeds.ml.classical.regression.KNearestNeighborsRegressor] | The fitted regressor. | + +??? quote "Source code in `k_nearest_neighbors.sdsstub`" + + ```sds linenums="32" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: KNearestNeighborsRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/LassoRegressor.md b/docs/stdlib/safeds/ml/classical/regression/LassoRegressor.md new file mode 100644 index 000000000..4454d91db --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/LassoRegressor.md @@ -0,0 +1,73 @@ +# `#!sds class` LassoRegressor {#safeds.ml.classical.regression.LassoRegressor data-toc-label='LassoRegressor'} + +Lasso regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `alpha` | [`Float`][safeds.lang.Float] | Controls the regularization of the model. The higher the value, the more regularized it becomes. | `#!sds 1.0` | + +??? quote "Source code in `lasso_regression.sdsstub`" + + ```sds linenums="12" + class LassoRegressor( + const alpha: Float = 1.0 + ) sub Regressor where { + alpha >= 0.0 + } { + /** + * Get the regularization of the model. + */ + attr alpha: Float + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: LassoRegressor + } + ``` + +## `#!sds attr` alpha {#safeds.ml.classical.regression.LassoRegressor.alpha data-toc-label='alpha'} + +Get the regularization of the model. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds fun` fit {#safeds.ml.classical.regression.LassoRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`LassoRegressor`][safeds.ml.classical.regression.LassoRegressor] | The fitted regressor. | + +??? quote "Source code in `lasso_regression.sdsstub`" + + ```sds linenums="31" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: LassoRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/LinearRegressionRegressor.md b/docs/stdlib/safeds/ml/classical/regression/LinearRegressionRegressor.md new file mode 100644 index 000000000..e25c09a53 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/LinearRegressionRegressor.md @@ -0,0 +1,52 @@ +# `#!sds class` LinearRegressionRegressor {#safeds.ml.classical.regression.LinearRegressionRegressor data-toc-label='LinearRegressionRegressor'} + +Linear regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +??? quote "Source code in `linear_regression.sdsstub`" + + ```sds linenums="10" + class LinearRegressionRegressor() sub Regressor { + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: LinearRegressionRegressor + } + ``` + +## `#!sds fun` fit {#safeds.ml.classical.regression.LinearRegressionRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`LinearRegressionRegressor`][safeds.ml.classical.regression.LinearRegressionRegressor] | The fitted regressor. | + +??? quote "Source code in `linear_regression.sdsstub`" + + ```sds linenums="20" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: LinearRegressionRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/RandomForestRegressor.md b/docs/stdlib/safeds/ml/classical/regression/RandomForestRegressor.md new file mode 100644 index 000000000..4de421cdc --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/RandomForestRegressor.md @@ -0,0 +1,73 @@ +# `#!sds class` RandomForestRegressor {#safeds.ml.classical.regression.RandomForestRegressor data-toc-label='RandomForestRegressor'} + +Random forest regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `numberOfTrees` | [`Int`][safeds.lang.Int] | The number of trees to be used in the random forest. Has to be greater than 0. | `#!sds 100` | + +??? quote "Source code in `random_forest.sdsstub`" + + ```sds linenums="12" + class RandomForestRegressor( + @PythonName("number_of_trees") const numberOfTrees: Int = 100 + ) sub Regressor where { + numberOfTrees >= 1 + } { + /** + * Get the number of trees used in the random forest. + */ + @PythonName("number_of_trees") attr numberOfTrees: Int + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: RandomForestRegressor + } + ``` + +## `#!sds attr` numberOfTrees {#safeds.ml.classical.regression.RandomForestRegressor.numberOfTrees data-toc-label='numberOfTrees'} + +Get the number of trees used in the random forest. + +**Type:** [`Int`][safeds.lang.Int] + +## `#!sds fun` fit {#safeds.ml.classical.regression.RandomForestRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`RandomForestRegressor`][safeds.ml.classical.regression.RandomForestRegressor] | The fitted regressor. | + +??? quote "Source code in `random_forest.sdsstub`" + + ```sds linenums="31" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: RandomForestRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/Regressor.md b/docs/stdlib/safeds/ml/classical/regression/Regressor.md new file mode 100644 index 000000000..1ff6d3961 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/Regressor.md @@ -0,0 +1,192 @@ +# `#!sds abstract class` Regressor {#safeds.ml.classical.regression.Regressor data-toc-label='Regressor'} + +Abstract base class for all regressors. + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="8" + class Regressor { + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: Regressor + + /** + * Predict a target vector using a dataset containing feature vectors. The model has to be trained first. + * + * @param dataset The dataset containing the feature vectors. + * + * @result prediction A dataset containing the given feature vectors and the predicted target vector. + */ + @Pure + fun predict( + dataset: Table + ) -> prediction: TaggedTable + + /** + * Check if the classifier is fitted. + * + * @result isFitted Whether the regressor is fitted. + */ + @Pure + @PythonName("is_fitted") + fun isFitted() -> isFitted: Boolean + + /** + * Compute the mean squared error (MSE) on the given data. + * + * @param validationOrTestSet The validation or test set. + * + * @result meanSquaredError The calculated mean squared error (the average of the distance of each individual row squared). + */ + @Pure + @PythonName("mean_squared_error") + fun meanSquaredError( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> meanSquaredError: Float + + /** + * Compute the mean absolute error (MAE) of the regressor on the given data. + * + * @param validationOrTestSet The validation or test set. + * + * @result meanAbsoluteError The calculated mean absolute error (the average of the distance of each individual row). + */ + @Pure + @PythonName("mean_absolute_error") + fun meanAbsoluteError( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> meanAbsoluteError: Float + } + ``` + +## `#!sds fun` fit {#safeds.ml.classical.regression.Regressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`Regressor`][safeds.ml.classical.regression.Regressor] | The fitted regressor. | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="18" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: Regressor + ``` + +## `#!sds fun` isFitted {#safeds.ml.classical.regression.Regressor.isFitted data-toc-label='isFitted'} + +Check if the classifier is fitted. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `isFitted` | [`Boolean`][safeds.lang.Boolean] | Whether the regressor is fitted. | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="40" + @Pure + @PythonName("is_fitted") + fun isFitted() -> isFitted: Boolean + ``` + +## `#!sds fun` meanAbsoluteError {#safeds.ml.classical.regression.Regressor.meanAbsoluteError data-toc-label='meanAbsoluteError'} + +Compute the mean absolute error (MAE) of the regressor on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `meanAbsoluteError` | [`Float`][safeds.lang.Float] | The calculated mean absolute error (the average of the distance of each individual row). | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="64" + @Pure + @PythonName("mean_absolute_error") + fun meanAbsoluteError( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> meanAbsoluteError: Float + ``` + +## `#!sds fun` meanSquaredError {#safeds.ml.classical.regression.Regressor.meanSquaredError data-toc-label='meanSquaredError'} + +Compute the mean squared error (MSE) on the given data. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `validationOrTestSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The validation or test set. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `meanSquaredError` | [`Float`][safeds.lang.Float] | The calculated mean squared error (the average of the distance of each individual row squared). | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="51" + @Pure + @PythonName("mean_squared_error") + fun meanSquaredError( + @PythonName("validation_or_test_set") validationOrTestSet: TaggedTable + ) -> meanSquaredError: Float + ``` + +## `#!sds fun` predict {#safeds.ml.classical.regression.Regressor.predict data-toc-label='predict'} + +Predict a target vector using a dataset containing feature vectors. The model has to be trained first. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `dataset` | [`Table`][safeds.data.tabular.containers.Table] | The dataset containing the feature vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | A dataset containing the given feature vectors and the predicted target vector. | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="30" + @Pure + fun predict( + dataset: Table + ) -> prediction: TaggedTable + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/RidgeRegressor.md b/docs/stdlib/safeds/ml/classical/regression/RidgeRegressor.md new file mode 100644 index 000000000..1b11544fc --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/RidgeRegressor.md @@ -0,0 +1,73 @@ +# `#!sds class` RidgeRegressor {#safeds.ml.classical.regression.RidgeRegressor data-toc-label='RidgeRegressor'} + +Ridge regression. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `alpha` | [`Float`][safeds.lang.Float] | Controls the regularization of the model. The higher the value, the more regularized it becomes. | `#!sds 1.0` | + +??? quote "Source code in `ridge_regression.sdsstub`" + + ```sds linenums="12" + class RidgeRegressor( + const alpha: Float = 1.0 + ) sub Regressor where { + alpha >= 0.0 + } { + /** + * Get the regularization of the model. + */ + attr alpha: Float + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: RidgeRegressor + } + ``` + +## `#!sds attr` alpha {#safeds.ml.classical.regression.RidgeRegressor.alpha data-toc-label='alpha'} + +Get the regularization of the model. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds fun` fit {#safeds.ml.classical.regression.RidgeRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`RidgeRegressor`][safeds.ml.classical.regression.RidgeRegressor] | The fitted regressor. | + +??? quote "Source code in `ridge_regression.sdsstub`" + + ```sds linenums="31" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: RidgeRegressor + ``` diff --git a/docs/stdlib/safeds/ml/classical/regression/SupportVectorMachineRegressor.md b/docs/stdlib/safeds/ml/classical/regression/SupportVectorMachineRegressor.md new file mode 100644 index 000000000..f6f861a14 --- /dev/null +++ b/docs/stdlib/safeds/ml/classical/regression/SupportVectorMachineRegressor.md @@ -0,0 +1,166 @@ +# `#!sds class` SupportVectorMachineRegressor {#safeds.ml.classical.regression.SupportVectorMachineRegressor data-toc-label='SupportVectorMachineRegressor'} + +Support vector machine. + +**Parent type:** [`Regressor`][safeds.ml.classical.regression.Regressor] + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `c` | [`Float`][safeds.lang.Float] | The strength of regularization. Must be strictly positive. | `#!sds 1.0` | +| `kernel` | [`Kernel`][safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel] | The type of kernel to be used. Defaults to None. | `#!sds SupportVectorMachineRegressor.Kernel.RadialBasisFunction` | + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="13" + class SupportVectorMachineRegressor( + const c: Float = 1.0, + kernel: SupportVectorMachineRegressor.Kernel = SupportVectorMachineRegressor.Kernel.RadialBasisFunction + ) sub Regressor where { + c > 0.0 + } { + /** + * The kernel functions that can be used in the support vector machine. + */ + enum Kernel { + /** + * A linear kernel. + */ + Linear + + /** + * A polynomial kernel. + * + * @param degree The degree of the polynomial. + */ + Polynomial(degree: Int) + + /** + * A sigmoid kernel. + */ + Sigmoid + + /** + * A radial basis function kernel. + */ + RadialBasisFunction + } + + /** + * Get the regularization strength. + */ + attr c: Float + /** + * Get the type of kernel used. + */ + attr kernel: SupportVectorMachineRegressor.Kernel + + /** + * Create a copy of this regressor and fit it with the given training data. + * + * This regressor is not modified. + * + * @param trainingSet The training data containing the feature and target vectors. + * + * @result fittedRegressor The fitted regressor. + */ + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: SupportVectorMachineRegressor + } + ``` + +## `#!sds attr` c {#safeds.ml.classical.regression.SupportVectorMachineRegressor.c data-toc-label='c'} + +Get the regularization strength. + +**Type:** [`Float`][safeds.lang.Float] + +## `#!sds attr` kernel {#safeds.ml.classical.regression.SupportVectorMachineRegressor.kernel data-toc-label='kernel'} + +Get the type of kernel used. + +**Type:** [`Kernel`][safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel] + +## `#!sds fun` fit {#safeds.ml.classical.regression.SupportVectorMachineRegressor.fit data-toc-label='fit'} + +Create a copy of this regressor and fit it with the given training data. + +This regressor is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainingSet` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The training data containing the feature and target vectors. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedRegressor` | [`SupportVectorMachineRegressor`][safeds.ml.classical.regression.SupportVectorMachineRegressor] | The fitted regressor. | + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="64" + @Pure + fun fit( + @PythonName("training_set") trainingSet: TaggedTable + ) -> fittedRegressor: SupportVectorMachineRegressor + ``` + +## `#!sds enum` Kernel {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel data-toc-label='Kernel'} + +The kernel functions that can be used in the support vector machine. + +??? quote "Source code in `support_vector_machine.sdsstub`" + + ```sds linenums="22" + enum Kernel { + /** + * A linear kernel. + */ + Linear + + /** + * A polynomial kernel. + * + * @param degree The degree of the polynomial. + */ + Polynomial(degree: Int) + + /** + * A sigmoid kernel. + */ + Sigmoid + + /** + * A radial basis function kernel. + */ + RadialBasisFunction + } + ``` + +### Linear {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel.Linear data-toc-label='Linear'} + +A linear kernel. + +### Polynomial {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel.Polynomial data-toc-label='Polynomial'} + +A polynomial kernel. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `degree` | [`Int`][safeds.lang.Int] | The degree of the polynomial. | - | + +### RadialBasisFunction {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel.RadialBasisFunction data-toc-label='RadialBasisFunction'} + +A radial basis function kernel. + +### Sigmoid {#safeds.ml.classical.regression.SupportVectorMachineRegressor.Kernel.Sigmoid data-toc-label='Sigmoid'} + +A sigmoid kernel. diff --git a/docs/stdlib/safeds/ml/nn/FNNLayer.md b/docs/stdlib/safeds/ml/nn/FNNLayer.md new file mode 100644 index 000000000..3d7827b4d --- /dev/null +++ b/docs/stdlib/safeds/ml/nn/FNNLayer.md @@ -0,0 +1,28 @@ +# `#!sds class` FNNLayer {#safeds.ml.nn.FNNLayer data-toc-label='FNNLayer'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `outputSize` | [`Int`][safeds.lang.Int] | The number of neurons in this layer | - | +| `inputSize` | [`Int?`][safeds.lang.Int] | The number of neurons in the previous layer | `#!sds null` | + +??? quote "Source code in `layer.sdsstub`" + + ```sds linenums="7" + class FNNLayer( + @PythonName("output_size") outputSize: Int, + @PythonName("input_size") inputSize: Int? = null + ) { + /** + * Get the output_size of this layer. + */ + @PythonName("output_size") attr outputSize: Int + } + ``` + +## `#!sds attr` outputSize {#safeds.ml.nn.FNNLayer.outputSize data-toc-label='outputSize'} + +Get the output_size of this layer. + +**Type:** [`Int`][safeds.lang.Int] diff --git a/docs/stdlib/safeds/ml/nn/NeuralNetworkClassifier.md b/docs/stdlib/safeds/ml/nn/NeuralNetworkClassifier.md new file mode 100644 index 000000000..e8ab9bf99 --- /dev/null +++ b/docs/stdlib/safeds/ml/nn/NeuralNetworkClassifier.md @@ -0,0 +1,130 @@ +# `#!sds class` NeuralNetworkClassifier {#safeds.ml.nn.NeuralNetworkClassifier data-toc-label='NeuralNetworkClassifier'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `layers` | [`List`][safeds.lang.List] | - | - | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="7" + class NeuralNetworkClassifier( + layers: List + ) { + /** + * Check if the model is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + + /** + * Train the neural network with given training data. + * + * The original model is not modified. + * + * @param trainData The data the network should be trained on. + * @param epochSize The number of times the training cycle should be done. + * @param batchSize The size of data batches that should be loaded at one time. + * @param callbackOnBatchCompletion Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. + * @param callbackOnEpochCompletion Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. + * + * @result fittedClassifier The trained Model + */ + @Pure + fun fit( + @PythonName("train_data") trainData: TaggedTable, + @PythonName("epoch_size") const epochSize: Int = 25, + @PythonName("batch_size") const batchSize: Int = 1, + @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, + @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} + ) -> fittedClassifier: NeuralNetworkClassifier where { + epochSize >= 1, + batchSize >= 1 + } + + /** + * Make a prediction for the given test data. + * + * The original Model is not modified. + * + * @param testData The data the network should predict. + * + * @result result1 The given test_data with an added "prediction" column at the end + */ + @Pure + fun predict( + @PythonName("test_data") testData: Table + ) -> result1: TaggedTable + } + ``` + +## `#!sds attr` isFitted {#safeds.ml.nn.NeuralNetworkClassifier.isFitted data-toc-label='isFitted'} + +Check if the model is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + +## `#!sds fun` fit {#safeds.ml.nn.NeuralNetworkClassifier.fit data-toc-label='fit'} + +Train the neural network with given training data. + +The original model is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainData` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The data the network should be trained on. | - | +| `epochSize` | [`Int`][safeds.lang.Int] | The number of times the training cycle should be done. | `#!sds 25` | +| `batchSize` | [`Int`][safeds.lang.Int] | The size of data batches that should be loaded at one time. | `#!sds 1` | +| `callbackOnBatchCompletion` | `#!sds (param1: Int, param2: Float) -> ()` | Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. | `#!sds (param1, param2) {}` | +| `callbackOnEpochCompletion` | `#!sds (param1: Int, param2: Float) -> ()` | Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. | `#!sds (param1, param2) {}` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `fittedClassifier` | [`NeuralNetworkClassifier`][safeds.ml.nn.NeuralNetworkClassifier] | The trained Model | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="28" + @Pure + fun fit( + @PythonName("train_data") trainData: TaggedTable, + @PythonName("epoch_size") const epochSize: Int = 25, + @PythonName("batch_size") const batchSize: Int = 1, + @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, + @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} + ) -> fittedClassifier: NeuralNetworkClassifier where { + epochSize >= 1, + batchSize >= 1 + } + ``` + +## `#!sds fun` predict {#safeds.ml.nn.NeuralNetworkClassifier.predict data-toc-label='predict'} + +Make a prediction for the given test data. + +The original Model is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `testData` | [`Table`][safeds.data.tabular.containers.Table] | The data the network should predict. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The given test_data with an added "prediction" column at the end | + +??? quote "Source code in `classifier.sdsstub`" + + ```sds linenums="49" + @Pure + fun predict( + @PythonName("test_data") testData: Table + ) -> result1: TaggedTable + ``` diff --git a/docs/stdlib/safeds/ml/nn/NeuralNetworkRegressor.md b/docs/stdlib/safeds/ml/nn/NeuralNetworkRegressor.md new file mode 100644 index 000000000..b2e1e4aa2 --- /dev/null +++ b/docs/stdlib/safeds/ml/nn/NeuralNetworkRegressor.md @@ -0,0 +1,130 @@ +# `#!sds class` NeuralNetworkRegressor {#safeds.ml.nn.NeuralNetworkRegressor data-toc-label='NeuralNetworkRegressor'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `layers` | [`List`][safeds.lang.List] | - | - | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="7" + class NeuralNetworkRegressor( + layers: List + ) { + /** + * Check if the model is fitted. + */ + @PythonName("is_fitted") attr isFitted: Boolean + + /** + * Train the neural network with given training data. + * + * The original model is not modified. + * + * @param trainData The data the network should be trained on. + * @param epochSize The number of times the training cycle should be done. + * @param batchSize The size of data batches that should be loaded at one time. + * @param callbackOnBatchCompletion Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. + * @param callbackOnEpochCompletion Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. + * + * @result trainedRegressor The trained Model + */ + @Pure + fun fit( + @PythonName("train_data") trainData: TaggedTable, + @PythonName("epoch_size") const epochSize: Int = 25, + @PythonName("batch_size") const batchSize: Int = 1, + @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, + @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} + ) -> trainedRegressor: NeuralNetworkRegressor where { + epochSize >= 1, + batchSize >= 1 + } + + /** + * Make a prediction for the given test data. + * + * The original Model is not modified. + * + * @param testData The data the network should predict. + * + * @result prediction The given test_data with an added "prediction" column at the end + */ + @Pure + fun predict( + @PythonName("test_data") testData: Table + ) -> prediction: TaggedTable + } + ``` + +## `#!sds attr` isFitted {#safeds.ml.nn.NeuralNetworkRegressor.isFitted data-toc-label='isFitted'} + +Check if the model is fitted. + +**Type:** [`Boolean`][safeds.lang.Boolean] + +## `#!sds fun` fit {#safeds.ml.nn.NeuralNetworkRegressor.fit data-toc-label='fit'} + +Train the neural network with given training data. + +The original model is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `trainData` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The data the network should be trained on. | - | +| `epochSize` | [`Int`][safeds.lang.Int] | The number of times the training cycle should be done. | `#!sds 25` | +| `batchSize` | [`Int`][safeds.lang.Int] | The size of data batches that should be loaded at one time. | `#!sds 1` | +| `callbackOnBatchCompletion` | `#!sds (param1: Int, param2: Float) -> ()` | Function used to view metrics while training. Gets called after a batch is completed with the index of the last batch and the overall loss average. | `#!sds (param1, param2) {}` | +| `callbackOnEpochCompletion` | `#!sds (param1: Int, param2: Float) -> ()` | Function used to view metrics while training. Gets called after an epoch is completed with the index of the last epoch and the overall loss average. | `#!sds (param1, param2) {}` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `trainedRegressor` | [`NeuralNetworkRegressor`][safeds.ml.nn.NeuralNetworkRegressor] | The trained Model | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="28" + @Pure + fun fit( + @PythonName("train_data") trainData: TaggedTable, + @PythonName("epoch_size") const epochSize: Int = 25, + @PythonName("batch_size") const batchSize: Int = 1, + @PythonName("callback_on_batch_completion") callbackOnBatchCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {}, + @PythonName("callback_on_epoch_completion") callbackOnEpochCompletion: (param1: Int, param2: Float) -> () = (param1, param2) {} + ) -> trainedRegressor: NeuralNetworkRegressor where { + epochSize >= 1, + batchSize >= 1 + } + ``` + +## `#!sds fun` predict {#safeds.ml.nn.NeuralNetworkRegressor.predict data-toc-label='predict'} + +Make a prediction for the given test data. + +The original Model is not modified. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `testData` | [`Table`][safeds.data.tabular.containers.Table] | The data the network should predict. | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `prediction` | [`TaggedTable`][safeds.data.tabular.containers.TaggedTable] | The given test_data with an added "prediction" column at the end | + +??? quote "Source code in `regressor.sdsstub`" + + ```sds linenums="49" + @Pure + fun predict( + @PythonName("test_data") testData: Table + ) -> prediction: TaggedTable + ``` diff --git a/docs/stdlib/safeds_lang.md b/docs/stdlib/safeds_lang.md deleted file mode 100644 index 3856130d2..000000000 --- a/docs/stdlib/safeds_lang.md +++ /dev/null @@ -1,290 +0,0 @@ - - -# Package `safeds.lang` - -## Class `Any` -The common superclass of all classes. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `Boolean` -A truth value. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `Float` -A floating-point number. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `Int` -An integer. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `Nothing` -The common subclass of all classes. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `Number` -A number. - -**Constructor:** _Class has no constructor._ - - ----------- - -## Class `String` -Some text. - -**Constructor:** _Class has no constructor._ - - -## Enum `AnnotationTarget` -The declaration types that can be targeted by annotations. -### Enum Variant `Annotation` -The annotation can be called on annotations. - -**Parameters:** _None expected._ - - -### Enum Variant `Attribute` -The annotation can be called on attributes. - -**Parameters:** _None expected._ - - -### Enum Variant `Class` -The annotation can be called on classes. - -**Parameters:** _None expected._ - - -### Enum Variant `CompilationUnit` -The annotation can be called on compilation units (i.e. files). - -**Parameters:** _None expected._ - - -### Enum Variant `Enum` -The annotation can be called on enums. - -**Parameters:** _None expected._ - - -### Enum Variant `EnumVariant` -The annotation can be called on enum variants. - -**Parameters:** _None expected._ - - -### Enum Variant `Function` -The annotation can be called on functions. - -**Parameters:** _None expected._ - - -### Enum Variant `Parameter` -The annotation can be called on parameters. - -**Parameters:** _None expected._ - - -### Enum Variant `Pipeline` -The annotation can be called on pipelines. - -**Parameters:** _None expected._ - - -### Enum Variant `Result` -The annotation can be called on results. - -**Parameters:** _None expected._ - - -### Enum Variant `Segment` -The annotation can be called on segments. - -**Parameters:** _None expected._ - - -### Enum Variant `TypeParameter` -The annotation can be called on type parameters. - -**Parameters:** _None expected._ - - - -## Annotation `Constant` -Values assigned to this parameter must be constant. - -**Valid targets:** - -* Parameter - -## Annotation `Deprecated` -The declaration should no longer be used. - -**Parameters:** - -* `alternative: String? = null` - What to use instead. -* `reason: String? = null` - Why the declaration was deprecated. -* `sinceVersion: String? = null` - When the declaration was deprecated. -* `removalVersion: String? = null` - When the declaration will be removed. - -**Valid targets:** - -* Annotation -* Attribute -* Class -* Enum -* EnumVariant -* Function -* Parameter -* Result -* Segment -* TypeParameter - -## Annotation `Description` -The purpose of a declaration. - -**Parameters:** - -* `description: String` - The purpose of a declaration. - -**Valid targets:** - -* Annotation -* Attribute -* Class -* CompilationUnit -* Enum -* EnumVariant -* Function -* Parameter -* Pipeline -* Result -* Segment -* TypeParameter - -## Annotation `Experimental` -The declaration might change without a major version bump. - -**Valid targets:** - -* Annotation -* Attribute -* Class -* Enum -* EnumVariant -* Function -* Parameter -* Result -* Segment -* TypeParameter - -## Annotation `Expert` -This parameter should only be used by expert users. - -**Valid targets:** - -* Parameter - -## Annotation `NoSideEffects` -The function has no side effects. - -**Valid targets:** - -* Function - -## Annotation `Pure` -The function has no side effects and returns the same results for the same arguments. - -**Valid targets:** - -* Function - -## Annotation `PythonModule` -The qualified name of the corresponding Python module (default is the qualified name of the package). - -**Parameters:** - -* `qualifiedName: String` - The qualified name of the corresponding Python module. - -**Valid targets:** - -* CompilationUnit - -## Annotation `PythonName` -The name of the corresponding API element in Python (default is the name of the declaration in the stubs). - -**Parameters:** - -* `name: String` - The name of the corresponding API element in Python. - -**Valid targets:** - -* Attribute -* Class -* Enum -* EnumVariant -* Function -* Parameter -* Pipeline -* Segment - -## Annotation `Repeatable` -The annotation can be called multiple times for the same declaration. - -**Valid targets:** - -* Annotation - -## Annotation `Since` -The version in which a declaration was added. - -**Parameters:** - -* `version: String` - The version in which a declaration was added. - -**Valid targets:** - -* Annotation -* Attribute -* Class -* CompilationUnit -* Enum -* EnumVariant -* Function -* Parameter -* Pipeline -* Result -* Segment -* TypeParameter - -## Annotation `Target` -The annotation can target these declaration types. If the @Target annotation is not used any declaration type can be targeted. - -**Parameters:** - -* `targets: List` - The valid targets. - -**Valid targets:** - -* Annotation diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css new file mode 100644 index 000000000..23e9d7117 --- /dev/null +++ b/docs/stylesheets/extra.css @@ -0,0 +1,9 @@ +.md-typeset__table, +.md-typeset__table table { + display: table !important; + width: 100%; +} + +.md-typeset__table td code { + word-break: normal !important; +} diff --git a/packages/safe-ds-cli/src/cli/document.ts b/packages/safe-ds-cli/src/cli/document.ts new file mode 100644 index 000000000..1dc15ebd2 --- /dev/null +++ b/packages/safe-ds-cli/src/cli/document.ts @@ -0,0 +1,39 @@ +import { createSafeDsServices } from '@safe-ds/lang'; +import chalk from 'chalk'; +import { URI } from 'langium'; +import { NodeFileSystem } from 'langium/node'; +import fs from 'node:fs'; +import path from 'node:path'; +import { extractDocuments } from '../helpers/documents.js'; +import { makeParentDirectoriesSync } from '../helpers/files.js'; +import { exitIfDocumentHasErrors } from '../helpers/diagnostics.js'; + +export const doDocument = async (fsPaths: string[], options: DocumentOptions): Promise => { + const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; + const documents = await extractDocuments(services, fsPaths); + + // Exit if any document has errors before generating code + for (const document of documents) { + exitIfDocumentHasErrors(document); + } + + // Generate code + const generatedFiles = services.generation.MarkdownGenerator.generate(documents, { + destination: URI.file(path.resolve(options.out)), + }); + + for (const file of generatedFiles) { + const fsPath = URI.parse(file.uri).fsPath; + makeParentDirectoriesSync(fsPath); + fs.writeFileSync(fsPath, file.getText()); + } + + console.log(chalk.green(`Markdown documentation generated successfully.`)); +}; + +/** + * Command line options for the `document` command. + */ +export interface DocumentOptions { + out: string; +} diff --git a/packages/safe-ds-cli/src/cli/main.ts b/packages/safe-ds-cli/src/cli/main.ts index 1a443f256..f49980728 100644 --- a/packages/safe-ds-cli/src/cli/main.ts +++ b/packages/safe-ds-cli/src/cli/main.ts @@ -4,6 +4,7 @@ import { fileURLToPath } from 'node:url'; import { generate } from './generate.js'; import { check } from './check.js'; import { format } from './format.js'; +import { doDocument } from './document.js'; const program = new Command(); @@ -20,6 +21,14 @@ program .description('check Safe-DS code') .action(check); +// Document command +program + .command('document') + .argument('', `list of files or directories to generate Markdown documentation for`) + .option('-o, --out ', 'destination directory for generation', 'generated') + .description('generate Markdown documentation') + .action(doDocument); + // Format command program .command('format') diff --git a/packages/safe-ds-cli/tests/cli/main.test.ts b/packages/safe-ds-cli/tests/cli/main.test.ts index 2e8832c50..f21fcdc36 100644 --- a/packages/safe-ds-cli/tests/cli/main.test.ts +++ b/packages/safe-ds-cli/tests/cli/main.test.ts @@ -93,6 +93,69 @@ describe('safe-ds', () => { }); }); + describe('document', () => { + const testResourcesRoot = new URL('../resources/document/', import.meta.url); + const out = new URL('generated', testResourcesRoot); + const spawnDocumentProcess = (additionalArguments: string[], paths: string[]) => { + const fsPaths = paths.map((p) => fileURLToPath(new URL(p, testResourcesRoot))); + return spawnSync( + 'node', + ['./bin/cli', 'document', '-o', fileURLToPath(out), ...additionalArguments, ...fsPaths], + { + cwd: projectRoot, + }, + ); + }; + + afterAll(() => { + fs.rmSync(out, { recursive: true, force: true }); + }); + + it('should show an error if no paths are passed', () => { + const process = spawnDocumentProcess([], []); + expect(process.stderr.toString()).toContain("error: missing required argument 'paths'"); + expect(process.status).not.toBe(ExitCode.Success); + }); + + it('should show usage on stdout if -h flag is passed', () => { + const process = spawnDocumentProcess(['-h'], []); + expect(process.stdout.toString()).toContain('Usage: cli document'); + expect(process.status).toBe(ExitCode.Success); + }); + + it('should generate Markdown documentation', () => { + const process = spawnDocumentProcess([], ['correct.sdstest']); + expect(process.stdout.toString()).toContain('Markdown documentation generated successfully.'); + expect(process.status).toBe(ExitCode.Success); + }); + + it('should generate Markdown documentation (Safe-DS code references builtins)', () => { + const process = spawnDocumentProcess([], ['references builtins.sdstest']); + expect(process.stdout.toString()).toContain('Markdown documentation generated successfully.'); + expect(process.status).toBe(ExitCode.Success); + }); + + it('should show an error if the file does not exist', () => { + const process = spawnDocumentProcess([], ['missing.sdstest']); + expect(process.stderr.toString()).toMatch(/Path .* does not exist./u); + expect(process.status).toBe(ExitCode.MissingPath); + }); + + it('should show an error if the file has the wrong extension', () => { + const process = spawnDocumentProcess([], ['not safe-ds.txt']); + expect(process.stderr.toString()).toContain('does not have a Safe-DS extension'); + expect(process.status).toBe(ExitCode.FileWithoutSafeDsExtension); + }); + + it('should show an error if a Safe-DS file has errors', () => { + const process = spawnDocumentProcess([], ['.']); + expect(process.stderr.toString()).toContain( + "Could not resolve reference to SdsNamedTypeDeclaration named 'Unresolved'", + ); + expect(process.status).toBe(ExitCode.FileHasErrors); + }); + }); + describe('format', () => { const testResourcesRoot = new URL('../resources/format/', import.meta.url); const spawnFormatProcess = (additionalArguments: string[], paths: string[]) => { @@ -141,15 +204,20 @@ describe('safe-ds', () => { describe('generate', () => { const testResourcesRoot = new URL('../resources/generate/', import.meta.url); + const out = new URL('generated', testResourcesRoot); const spawnGenerateProcess = (additionalArguments: string[], paths: string[]) => { const fsPaths = paths.map((p) => fileURLToPath(new URL(p, testResourcesRoot))); - return spawnSync('node', ['./bin/cli', 'generate', ...additionalArguments, ...fsPaths], { - cwd: projectRoot, - }); + return spawnSync( + 'node', + ['./bin/cli', 'generate', '-o', fileURLToPath(out), ...additionalArguments, ...fsPaths], + { + cwd: projectRoot, + }, + ); }; afterAll(() => { - fs.rmSync(new URL('generated', testResourcesRoot), { recursive: true, force: true }); + fs.rmSync(out, { recursive: true, force: true }); }); it('should show an error if no paths are passed', () => { diff --git a/packages/safe-ds-cli/tests/resources/document/contains errors.sdstest b/packages/safe-ds-cli/tests/resources/document/contains errors.sdstest new file mode 100644 index 000000000..e91dfdc2d --- /dev/null +++ b/packages/safe-ds-cli/tests/resources/document/contains errors.sdstest @@ -0,0 +1,3 @@ +package test + +segment mySegment(p: Unresolved) {} diff --git a/packages/safe-ds-cli/tests/resources/document/correct.sdstest b/packages/safe-ds-cli/tests/resources/document/correct.sdstest new file mode 100644 index 000000000..3e7427394 --- /dev/null +++ b/packages/safe-ds-cli/tests/resources/document/correct.sdstest @@ -0,0 +1,3 @@ +package test + +pipeline myPipeline {} diff --git a/packages/safe-ds-cli/tests/resources/document/not safe-ds.txt b/packages/safe-ds-cli/tests/resources/document/not safe-ds.txt new file mode 100644 index 000000000..e91dfdc2d --- /dev/null +++ b/packages/safe-ds-cli/tests/resources/document/not safe-ds.txt @@ -0,0 +1,3 @@ +package test + +segment mySegment(p: Unresolved) {} diff --git a/packages/safe-ds-cli/tests/resources/document/references builtins.sdstest b/packages/safe-ds-cli/tests/resources/document/references builtins.sdstest new file mode 100644 index 000000000..3a15ef494 --- /dev/null +++ b/packages/safe-ds-cli/tests/resources/document/references builtins.sdstest @@ -0,0 +1,3 @@ +package test + +segment mySegment(a: Int) {} diff --git a/packages/safe-ds-lang/src/helpers/collections.ts b/packages/safe-ds-lang/src/helpers/collections.ts index 413df381d..8988c6bfa 100644 --- a/packages/safe-ds-lang/src/helpers/collections.ts +++ b/packages/safe-ds-lang/src/helpers/collections.ts @@ -55,6 +55,25 @@ export const groupBy = (iterable: Iterable, labeler: (element: T) => K return stream(groups.entries()); }; +/** + * Partitions the iterable into two arrays based on the predicate. The first array contains the values for which the + * predicate returned `true`, the second array the values for which it returned `false`. + */ +export const partitionBy = (iterable: Iterable, predicate: (element: T) => boolean): [T[], T[]] => { + const truthy: T[] = []; + const falsy: T[] = []; + + for (const value of iterable) { + if (predicate(value)) { + truthy.push(value); + } else { + falsy.push(value); + } + } + + return [truthy, falsy]; +}; + /** * Returns whether the iterable has no values. */ diff --git a/packages/safe-ds-lang/src/helpers/strings.ts b/packages/safe-ds-lang/src/helpers/strings.ts index 660a4dcd1..b9005d5ce 100644 --- a/packages/safe-ds-lang/src/helpers/strings.ts +++ b/packages/safe-ds-lang/src/helpers/strings.ts @@ -14,3 +14,24 @@ export const normalizeLineBreaks = (text: string | undefined): string => { export const pluralize = (count: number, singular: string, plural: string = `${singular}s`): string => { return count === 1 ? singular : plural; }; + +/** + * Prepends each line of the given text with the given prefix. + */ +export const addLinePrefix = (text: string, prefix: string): string => { + return text + .trim() + .split('\n') + .map((line) => `${prefix}${line}`) + .join('\n'); +}; + +/** + * Removes the given prefix from each line of the given text. + */ +export const removeLinePrefix = (text: string, prefix: string): string => { + return text + .split('\n') + .map((line) => (line.startsWith(prefix) ? line.slice(prefix.length) : line)) + .join('\n'); +}; diff --git a/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts b/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts index 255686623..58133cac4 100644 --- a/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts +++ b/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts @@ -46,6 +46,24 @@ export class SafeDsAnnotations extends SafeDsModuleMembers { return hasAnnotationCallOf(node, this.Deprecated); } + getDeprecationInfo(node: SdsAnnotatedObject | undefined): DeprecationInfo | undefined { + if (!this.callsDeprecated(node)) { + return undefined; + } + + const alternative = this.getParameterValue(node, this.Deprecated, 'alternative'); + const reason = this.getParameterValue(node, this.Deprecated, 'reason'); + const sinceVersion = this.getParameterValue(node, this.Deprecated, 'sinceVersion'); + const removalVersion = this.getParameterValue(node, this.Deprecated, 'removalVersion'); + + return { + alternative: alternative instanceof StringConstant ? alternative.value : undefined, + reason: reason instanceof StringConstant ? reason.value : undefined, + sinceVersion: sinceVersion instanceof StringConstant ? sinceVersion.value : undefined, + removalVersion: removalVersion instanceof StringConstant ? removalVersion.value : undefined, + }; + } + private get Deprecated(): SdsAnnotation | undefined { return this.getAnnotation(MATURITY_URI, 'Deprecated'); } @@ -184,3 +202,10 @@ export class SafeDsAnnotations extends SafeDsModuleMembers { return this.partialEvaluator.evaluate(parameterValue); } } + +interface DeprecationInfo { + alternative?: string; + reason?: string; + sinceVersion?: string; + removalVersion?: string; +} diff --git a/packages/safe-ds-lang/src/language/documentation/safe-ds-documentation-provider.ts b/packages/safe-ds-lang/src/language/documentation/safe-ds-documentation-provider.ts index 778aee1fb..caf78fe9f 100644 --- a/packages/safe-ds-lang/src/language/documentation/safe-ds-documentation-provider.ts +++ b/packages/safe-ds-lang/src/language/documentation/safe-ds-documentation-provider.ts @@ -4,56 +4,98 @@ import { isJSDoc, JSDocComment, JSDocDocumentationProvider, + JSDocElement, JSDocRenderOptions, type JSDocTag, parseJSDoc, } from 'langium'; import { isSdsCallable, + isSdsDeclaration, isSdsParameter, isSdsResult, isSdsTypeParameter, + SdsDeclaration, SdsParameter, SdsResult, SdsTypeParameter, } from '../generated/ast.js'; +import { isEmpty } from '../../helpers/collections.js'; const PARAM_TAG = 'param'; const RESULT_TAG = 'result'; +const SINCE_TAG = 'since'; const TYPE_PARAM_TAG = 'typeParam'; export class SafeDsDocumentationProvider extends JSDocDocumentationProvider { - override getDocumentation(node: AstNode): string | undefined { + /** + * Returns the documentation of the given node as a Markdown string. + */ + override getDocumentation(node: AstNode, linkRenderer?: LinkRenderer): string | undefined { if (isSdsParameter(node) || isSdsResult(node) || isSdsTypeParameter(node)) { const containingCallable = AstUtils.getContainerOfType(node, isSdsCallable); - /* c8 ignore start */ if (!containingCallable) { + /* c8 ignore next 2 */ return undefined; } - /* c8 ignore stop */ const comment = this.getJSDocComment(containingCallable); if (!comment) { return undefined; } - return this.getMatchingTagContent(comment, node); + return this.getMatchingTagContent(comment, node, linkRenderer)?.trim(); } else { const comment = this.getJSDocComment(node); - return comment?.toMarkdown(this.createJSDocRenderOptions(node)); + return comment?.toMarkdown(this.createRenderOptions(node, linkRenderer))?.trim(); } } - protected override documentationTagRenderer(node: AstNode, tag: JSDocTag): string | undefined { - if (tag.name === PARAM_TAG || tag.name === RESULT_TAG || tag.name === TYPE_PARAM_TAG) { - const contentMd = tag.content.toMarkdown(); - const [paramName, description] = contentMd.split(/\s(.*)/su); - return `**@${tag.name}** *${paramName}* — ${(description ?? '').trim()}`; + /** + * Returns the description of the given node as a Markdown string, which is the documentation without tags. + * + * Compared to {@link getDocumentation}, this method also removes a single leading space from each line, if all + * lines have one. Moreover, inline link tags are rendered differently. + */ + getDescription(node: AstNode, linkRenderer?: LinkRenderer): string | undefined { + if (isSdsParameter(node) || isSdsResult(node) || isSdsTypeParameter(node)) { + return this.getDocumentation(node, linkRenderer); } else { - return super.documentationTagRenderer(node, tag); + const comment = this.getJSDocComment(node); + if (!comment) { + return undefined; + } + + // Remove all elements starting from the first block tag + const firstBlockTag = comment.elements.findIndex(isBlockTag); + if (firstBlockTag > -1) { + comment.elements.splice(firstBlockTag); + } + + // Remove a single leading space from each line + const [first, ...rest] = comment + .toMarkdown(this.createRenderOptions(node, linkRenderer)) + .split('\n') + .map((it) => it.trimEnd()); + + if (rest.every((it) => isEmpty(it) || it.startsWith(' '))) { + return [first, ...rest.map((it) => it.slice(1))].join('\n'); + } else { + return [first, ...rest].join('\n'); + } } } + /** + * Returns the value of the first `@since` tag of the given node. If the tag is not present, `undefined` is + * returned. + */ + getSince(node: AstNode): string | undefined { + const comment = this.getJSDocComment(node); + const sinceTag = comment?.getTag(SINCE_TAG); + return sinceTag?.content.toMarkdown(this.createRenderOptions(node)).trim(); + } + private getJSDocComment(node: AstNode): JSDocComment | undefined { const comment = this.commentProvider.getComment(node); if (comment && isJSDoc(comment)) { @@ -65,22 +107,23 @@ export class SafeDsDocumentationProvider extends JSDocDocumentationProvider { private getMatchingTagContent( comment: JSDocComment, node: SdsParameter | SdsResult | SdsTypeParameter, + linkRenderer?: LinkRenderer, ): string | undefined { const name = node.name; - /* c8 ignore start */ if (!name) { + /* c8 ignore next 2 */ return undefined; } - /* c8 ignore stop */ const tagName = this.getTagName(node); - const matchRegex = new RegExp(`^${name}\\s+(?.*)`, 'u'); + const matchRegex = new RegExp(`^${name}\\s+(?[\\s\\S]*)`, 'u'); return comment .getTags(tagName) - .map((it) => it.content.toMarkdown(this.createJSDocRenderOptions(node))) + .map((it) => it.content.toMarkdown(this.createRenderOptions(node, linkRenderer))) .find((it) => matchRegex.test(it)) - ?.match(matchRegex)?.groups?.content; + ?.match(matchRegex) + ?.groups?.content?.replaceAll(/\s+/gu, ' '); } private getTagName(node: SdsParameter | SdsResult | SdsTypeParameter): string { @@ -93,15 +136,43 @@ export class SafeDsDocumentationProvider extends JSDocDocumentationProvider { } } - private createJSDocRenderOptions(node: AstNode): JSDocRenderOptions { + private createRenderOptions(node: AstNode, linkRenderer?: LinkRenderer): JSDocRenderOptions { return { - renderLink: (link, display) => { - return this.documentationLinkRenderer(node, link, display); - }, tag: 'bold', renderTag: (tag: JSDocTag) => { - return this.documentationTagRenderer(node, tag); + if (tag.name === PARAM_TAG || tag.name === RESULT_TAG || tag.name === TYPE_PARAM_TAG) { + const contentMd = tag.content.toMarkdown(); + const [name, description] = contentMd.split(/\s(.*)/su); + return `**@${tag.name}** *${name}* — ${(description ?? '').trim()}`; + } else { + return super.documentationTagRenderer(node, tag); + } + }, + renderLink: (name, display) => { + if (!linkRenderer) { + return super.documentationLinkRenderer(node, name, display); + } + + const description = + this.findNameInPrecomputedScopes(node, name) ?? this.findNameInGlobalScope(node, name); + const target = description?.node; + + if (isSdsDeclaration(target)) { + return linkRenderer(target, display); + } else { + return linkRenderer(undefined, display); + } }, }; } } + +const isBlockTag = (element: JSDocElement): element is JSDocTag => { + return isTag(element) && !element.inline; +}; + +const isTag = (element: JSDocElement): element is JSDocTag => { + return 'name' in element; +}; + +type LinkRenderer = (target: SdsDeclaration | undefined, display: string) => string | undefined; diff --git a/packages/safe-ds-lang/src/language/generation/safe-ds-markdown-generator.ts b/packages/safe-ds-lang/src/language/generation/safe-ds-markdown-generator.ts new file mode 100644 index 000000000..1f9547ef9 --- /dev/null +++ b/packages/safe-ds-lang/src/language/generation/safe-ds-markdown-generator.ts @@ -0,0 +1,634 @@ +import { SafeDsServices } from '../safe-ds-module.js'; +import { AstUtils, LangiumDocument, URI, UriUtils } from 'langium'; +import { TextDocument } from 'vscode-languageserver-textdocument'; +import { + isSdsAnnotation, + isSdsAttribute, + isSdsClass, + isSdsEnum, + isSdsFunction, + isSdsModule, + isSdsPipeline, + isSdsSchema, + isSdsSegment, + SdsAnnotation, + SdsAttribute, + SdsClass, + SdsClassMember, + SdsDeclaration, + SdsEnum, + SdsEnumVariant, + SdsFunction, + SdsModuleMember, + SdsParameter, + SdsResult, + SdsSchema, + SdsSegment, + SdsTypeParameter, +} from '../generated/ast.js'; +import { + getClassMembers, + getColumns, + getEnumVariants, + getModuleMembers, + getPackageName, + getParameters, + getParentTypes, + getQualifiedName, + getResults, + getTypeParameters, + isInternal, + isPrivate, + isStatic, +} from '../helpers/nodeProperties.js'; +import { SafeDsDocumentationProvider } from '../documentation/safe-ds-documentation-provider.js'; +import { SafeDsAnnotations } from '../builtins/safe-ds-annotations.js'; +import { isEmpty } from '../../helpers/collections.js'; +import { SafeDsTypeComputer } from '../typing/safe-ds-type-computer.js'; +import { NamedType, Type, TypeParameterType } from '../typing/model.js'; +import path from 'path'; +import { addLinePrefix, removeLinePrefix } from '../../helpers/strings.js'; + +const INDENTATION = ' '; +const LIB = path.join('packages', 'safe-ds-lang', 'lib', 'resources'); +const SRC = path.join('packages', 'safe-ds-lang', 'src', 'resources'); + +export class SafeDsMarkdownGenerator { + private readonly builtinAnnotations: SafeDsAnnotations; + private readonly documentationProvider: SafeDsDocumentationProvider; + private readonly typeComputer: SafeDsTypeComputer; + + constructor(services: SafeDsServices) { + this.builtinAnnotations = services.builtins.Annotations; + this.documentationProvider = services.documentation.DocumentationProvider; + this.typeComputer = services.types.TypeComputer; + } + + generate(documents: LangiumDocument[], options: GenerateOptions): TextDocument[] { + const knownPaths = new Set(documents.map((document) => document.uri.fsPath)); + const details = documents.flatMap((document) => this.generateDetailsForDocument(document, knownPaths, options)); + const summary = this.generateSummary(details, options); + + return [...details, summary]; + } + + private generateDetailsForDocument( + document: LangiumDocument, + knownPaths: Set, + options: GenerateOptions, + ): TextDocument[] { + const root = document.parseResult.value; + if (!isSdsModule(root)) { + /* c8 ignore next 2 */ + return []; + } + + return getModuleMembers(root).flatMap((member) => + this.generateDetailsForModuleMember(member, knownPaths, options), + ); + } + + private generateDetailsForModuleMember( + node: SdsModuleMember, + knownPaths: Set, + options: GenerateOptions, + ): TextDocument[] { + const content = this.describeModuleMember(node, knownPaths); + if (content === undefined) { + return []; + } + + const uri = this.uriForModuleMember(node, options).toString(); + return [TextDocument.create(uri, 'md', 0, content)]; + } + + /** + * Returns a Markdown description for the given module member. If the member should not be documented, `undefined` + * is returned. + */ + private describeModuleMember(node: SdsModuleMember, knownPaths: Set): string | undefined { + if (isPrivate(node)) { + // Private declarations cannot be used outside their module, so they are not documented + return undefined; + } + + const level = 1; + + if (isSdsAnnotation(node)) { + return this.describeAnnotation(node, level, knownPaths); + } else if (isSdsClass(node)) { + return this.describeClass(node, level, knownPaths); + } else if (isSdsEnum(node)) { + return this.describeEnum(node, level, knownPaths); + } else if (isSdsFunction(node)) { + return this.describeFunction(node, level, knownPaths); + } else if (isSdsPipeline(node)) { + // Pipelines cannot be called, so they are not documented + return undefined; + } else if (isSdsSchema(node)) { + return this.describeSchema(node, level, knownPaths); + } else if (isSdsSegment(node)) { + return this.describeSegment(node, level, knownPaths); + } else { + /* c8 ignore next 2 */ + throw new Error(`Unsupported module member type: ${node.$type}`); + } + } + + /** + * Returns a Markdown description for the given class member. If the member should not be documented, `undefined` + * is returned. + */ + private describeClassMember(node: SdsClassMember, level: number, knownPaths: Set): string | undefined { + if (isSdsAttribute(node)) { + return this.describeAttribute(node, level, knownPaths); + } else if (isSdsClass(node)) { + return this.describeClass(node, level, knownPaths); + } else if (isSdsEnum(node)) { + return this.describeEnum(node, level, knownPaths); + } else if (isSdsFunction(node)) { + return this.describeFunction(node, level, knownPaths); + } else { + /* c8 ignore next 2 */ + throw new Error(`Unsupported class member type: ${node.$type}`); + } + } + + private describeAnnotation(node: SdsAnnotation, level: number, knownPaths: Set): string { + let result = this.renderPreamble(node, level, 'annotation'); + + // Parameters + const parameters = this.renderParameters(getParameters(node), knownPaths); + if (parameters) { + result += `\n**Parameters:**\n\n${parameters}`; + } + + // Targets + const targets = this.builtinAnnotations + .streamValidTargets(node) + .map((it) => it.name) + .toArray() + .sort(); + + if (!isEmpty(targets)) { + result += '\n**Targets:**\n\n'; + targets.forEach((target) => { + result += `- \`${target}\`\n`; + }); + } + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + return result; + } + + private describeAttribute(node: SdsAttribute, level: number, knownPaths: Set): string { + const keyword = isStatic(node) ? 'static attr' : 'attr'; + let result = this.renderPreamble(node, level, 'attribute', keyword); + + // Type + const type = this.typeComputer.computeType(node.type); + result += `\n**Type:** ${this.renderType(type, knownPaths)}\n`; + + return result; + } + + private describeClass(node: SdsClass, level: number, knownPaths: Set): string { + const keyword = node.parameterList ? 'class' : 'abstract class'; + let result = this.renderPreamble(node, level, 'class', keyword); + + // Parent type + const parentTypes = getParentTypes(node); + if (!isEmpty(parentTypes)) { + const firstParentType = this.renderType(this.typeComputer.computeType(parentTypes[0]), knownPaths); + result += `\n**Parent type:** ${firstParentType}\n`; + } + + // Parameters + const parameters = this.renderParameters(getParameters(node), knownPaths); + if (parameters) { + result += `\n**Parameters:**\n\n${parameters}`; + } + + // Type parameters + const typeParameters = this.renderTypeParameters(getTypeParameters(node), knownPaths); + if (typeParameters) { + result += `\n**Type parameters:**\n\n${typeParameters}`; + } + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + // Members + const members = getClassMembers(node).sort((a, b) => a.name.localeCompare(b.name)); + [ + // Instance members + ...members.filter((it) => !isStatic(it) && isSdsAttribute(it)), + ...members.filter((it) => !isStatic(it) && isSdsFunction(it)), + + // Static members + ...members.filter((it) => isStatic(it) && isSdsAttribute(it)), + ...members.filter((it) => isStatic(it) && isSdsFunction(it)), + ...members.filter((it) => isSdsClass(it)), + ...members.filter((it) => isSdsEnum(it)), + ].forEach((member) => { + result += `\n${this.describeClassMember(member, level + 1, knownPaths)}`; + }); + + return result; + } + + private describeEnum(node: SdsEnum, level: number, knownPaths: Set): string { + let result = this.renderPreamble(node, level, 'enum'); + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + // Enum variants + getEnumVariants(node) + .sort((a, b) => a.name.localeCompare(b.name)) + .forEach((variant) => { + result += `\n${this.describeEnumVariant(variant, level + 1, knownPaths)}`; + }); + + return result; + } + + private describeEnumVariant(node: SdsEnumVariant, level: number, knownPaths: Set): string { + let result = this.renderPreamble(node, level, 'enum variant', ''); + + // Parameters + const parameters = this.renderParameters(getParameters(node), knownPaths); + if (parameters) { + result += `\n**Parameters:**\n\n${parameters}`; + } + + return result; + } + + private describeFunction(node: SdsFunction, level: number, knownPaths: Set): string { + const keyword = isStatic(node) ? 'static fun' : 'fun'; + let result = this.renderPreamble(node, level, 'function', keyword); + + // Parameters + const parameters = this.renderParameters(getParameters(node), knownPaths); + if (parameters) { + result += `\n**Parameters:**\n\n${parameters}`; + } + + // Results + const results = this.renderResults(getResults(node.resultList), knownPaths); + if (results) { + result += `\n**Results:**\n\n${results}`; + } + + // Type parameters + const typeParameters = this.renderTypeParameters(getTypeParameters(node), knownPaths); + if (typeParameters) { + result += `\n**Type parameters:**\n\n${typeParameters}`; + } + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + return result; + } + + private describeSchema(node: SdsSchema, level: number, knownPaths: Set): string { + let result = this.renderPreamble(node, level, 'schema'); + + // Columns + const columns = getColumns(node); + if (!isEmpty(columns)) { + result += '\n**Columns:**\n\n'; + result += '| Name | Type |\n'; + result += '|------|------|\n'; + + for (const column of columns) { + const name = column.columnName.value; + const type = this.typeComputer.computeType(column.columnType); + + result += `| \`${name}\` | ${this.renderType(type, knownPaths)} |\n`; + } + } + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + return result; + } + + private describeSegment(node: SdsSegment, level: number, knownPaths: Set): string { + const keyword = isInternal(node) ? 'internal segment' : 'segment'; + let result = this.renderPreamble(node, level, 'segment', keyword); + + // Parameters + const parameters = this.renderParameters(getParameters(node), knownPaths); + if (parameters) { + result += `\n**Parameters:**\n\n${parameters}`; + } + + // Results + const results = this.renderResults(getResults(node.resultList), knownPaths); + if (results) { + result += `\n**Results:**\n\n${results}`; + } + + // Source code + const sourceCode = this.renderSourceCode(node); + if (sourceCode) { + result += `\n${sourceCode}`; + } + + return result; + } + + private renderPreamble(node: SdsDeclaration, level: number, kind: string, keyword: string = kind): string { + let result = this.renderHeading(node, level, keyword) + '\n'; + + const deprecationWarning = this.renderDeprecationWarning(node, kind); + if (deprecationWarning) { + result += `\n${deprecationWarning}\n`; + } + const description = this.renderDescription(node); + if (description) { + result += `\n${description}\n`; + } + + return result; + } + + private renderHeading(node: SdsDeclaration, level: number, keyword: string): string { + let result = '#'.repeat(Math.min(level, 6)); + result += this.renderMaturity(node); + + if (keyword) { + result += ` \`#!sds ${keyword}\``; + } + + result += ` ${node.name}`; + result += ` {#${getQualifiedName(node)} data-toc-label='${node.name}'}`; + return result; + } + + private renderMaturity(node: SdsDeclaration): string { + if (this.builtinAnnotations.callsDeprecated(node)) { + return ' :warning:{ title="Deprecated" }'; + } else if (this.builtinAnnotations.callsExperimental(node)) { + return ' :test_tube:{ title="Experimental" }'; + } else { + return ''; + } + } + + private renderDeprecationWarning(node: SdsDeclaration, keyword: string): string { + const deprecationInfo = this.builtinAnnotations.getDeprecationInfo(node); + if (!deprecationInfo) { + return ''; + } + + let result = '!!! warning "Deprecated"\n\n'; + result += ` This ${keyword} is deprecated`; + + if (deprecationInfo.sinceVersion) { + result += ` since version **${deprecationInfo.sinceVersion}**`; + } + if (deprecationInfo.removalVersion) { + result += ` and will be removed in version **${deprecationInfo.removalVersion}**`; + } + result += '.\n\n'; + + if (deprecationInfo.alternative) { + result += indent(`- **Alternative:** ${deprecationInfo.alternative}`) + `\n`; + } + if (deprecationInfo.reason) { + result += indent(`- **Reason:** ${deprecationInfo.reason}`) + `\n`; + } + + return result.trimEnd(); + } + + private renderDescription(node: SdsDeclaration) { + return this.documentationProvider.getDescription(node, (target, display) => { + if (target) { + return `[${display}][${getQualifiedName(target)}]`; + } else { + return display; + } + }); + } + + private renderParameters(nodes: SdsParameter[], knownPaths: Set): string { + if (isEmpty(nodes)) { + return ''; + } + + let result = '| Name | Type | Description | Default |\n'; + result += '|------|------|-------------|---------|\n'; + + for (const parameter of nodes) { + const name = `\`${parameter.name}\``; + const type = this.renderType(this.typeComputer.computeType(parameter.type), knownPaths); + const description = this.renderDescription(parameter) ?? '-'; + const defaultValue = parameter.defaultValue?.$cstNode + ? `\`#!sds ${parameter.defaultValue.$cstNode.text}\`` + : '-'; + + result += `| ${name} | ${type} | ${description} | ${defaultValue} |\n`; + } + + return result; + } + + private renderResults(nodes: SdsResult[], knownPaths: Set): string { + if (isEmpty(nodes)) { + return ''; + } + + let result = '| Name | Type | Description |\n'; + result += '|------|------|-------------|\n'; + + for (const node of nodes) { + const name = `\`${node.name}\``; + const type = this.renderType(this.typeComputer.computeType(node.type), knownPaths); + const description = this.renderDescription(node) ?? '-'; + + result += `| ${name} | ${type} | ${description} |\n`; + } + + return result; + } + + private renderTypeParameters(nodes: SdsTypeParameter[], knownPaths: Set): string { + if (isEmpty(nodes)) { + return ''; + } + + let result = '| Name | Upper Bound | Description | Default |\n'; + result += '|------|-------------|-------------|---------|\n'; + + for (const node of nodes) { + const name = `\`${node.name}\``; + const upperBound = this.renderType(this.typeComputer.computeUpperBound(node), knownPaths); + const description = this.renderDescription(node) ?? '-'; + const defaultValue = node.defaultValue + ? this.renderType(this.typeComputer.computeType(node.defaultValue), knownPaths) + : '-'; + + result += `| ${name} | ${upperBound} | ${description} | ${defaultValue} |\n`; + } + + return result; + } + + private renderType(type: Type, knownPaths: Set): string { + if (type instanceof NamedType && !(type instanceof TypeParameterType)) { + const realPath = AstUtils.getDocument(type.declaration).uri.fsPath; + // When generating documentation for the standard library declarations in the `src` folder, references are + // resolved to the `lib` folder. To still create links, we also check this augmented path. + const srcPath = realPath.replace(LIB, SRC); + + if (knownPaths.has(realPath) || knownPaths.has(srcPath)) { + return `[\`${type}\`][${getQualifiedName(type.declaration)}]`; + } + } + + return `\`#!sds ${type}\``; + } + + private renderSourceCode(node: SdsDeclaration): string { + const cstNode = node.$cstNode; + if (!cstNode) { + /* c8 ignore next 2 */ + return ''; + } + + const startLine = cstNode.range.start.line; + const firstLineIndent = AstUtils.getDocument(node).textDocument.getText({ + start: { line: startLine, character: 0 }, + end: cstNode.range.start, + }); + const text = removeLinePrefix(cstNode.text, firstLineIndent); + + const fileName = AstUtils.getDocument(node).uri.path.split('/').pop(); + + let result = `??? quote "Source code in \`${fileName}\`"\n\n`; + result += indent(`\`\`\`sds linenums="${startLine + 1}"\n${text}\n\`\`\``); + + return result + '\n'; + } + + private uriForModuleMember(node: SdsModuleMember, options: GenerateOptions): URI { + const packageName = getPackageName(node) ?? ''; + const name = node.name; + + return UriUtils.joinPath(options.destination, packageName.replaceAll(/\./gu, '/'), `${name}.md`); + } + + private generateSummary(details: TextDocument[], options: GenerateOptions): TextDocument { + const uri = UriUtils.joinPath(options.destination, 'SUMMARY.md').toString(); + + const summary = this.buildSummary( + options.destination, + details.map((document) => URI.parse(document.uri)), + ); + const content = this.describeSummary('', summary); + + return TextDocument.create(uri, 'md', 0, content); + } + + private buildSummary(root: URI, uris: URI[]): Summary { + const rootPath = root.fsPath; + const result: Summary = { children: new Map(), leaves: [] }; + + for (const uri of uris) { + // `URIUtils.relative` has trouble with different capitalization of drive letters on Windows, so we use + // `path.relative` instead. + + const uriPath = uri.fsPath; + const segments = path.relative(rootPath, uriPath).replace(/\.md$/u, '').split(/[/\\]/u); + + let current = result; + for (let i = 0; i < segments.length; i++) { + const segment = segments[i]!; + + if (i === segments.length - 1) { + current.leaves.push(segment); + } else { + if (!current.children.has(segment)) { + current.children.set(segment, { children: new Map(), leaves: [] }); + } + current = current.children.get(segment)!; + } + } + } + + return result; + } + + private describeSummary(root: string, summary: Summary): string { + let result = ''; + + // Describe inner nodes + Array.from(summary.children) + .sort(([key1], [key2]) => key1.localeCompare(key2)) + .forEach(([key, value]) => { + let newRoot: string; + if (root === '') { + newRoot = key; + } else { + newRoot = `${root}/${key}`; + } + + result += `- ${key}\n`; + result += indent(this.describeSummary(newRoot, value)); + result += '\n'; + }); + + // Describe leaves + summary.leaves + .sort((name1, name2) => name1.localeCompare(name2)) + .forEach((leaf) => { + let href: string; + if (root === '') { + /* c8 ignore next 2 */ + href = `${leaf}.md`; + } else { + href = `${root}/${leaf}.md`; + } + + result += `- [${leaf}](${href})\n`; + }); + + return result; + } +} + +export interface GenerateOptions { + destination: URI; +} + +interface Summary { + children: Map; + leaves: string[]; +} + +const indent = (text: string): string => { + return addLinePrefix(text, INDENTATION); +}; diff --git a/packages/safe-ds-lang/src/language/generation/safe-ds-python-generator.ts b/packages/safe-ds-lang/src/language/generation/safe-ds-python-generator.ts index 774b4364d..c28d38adf 100644 --- a/packages/safe-ds-lang/src/language/generation/safe-ds-python-generator.ts +++ b/packages/safe-ds-lang/src/language/generation/safe-ds-python-generator.ts @@ -182,7 +182,7 @@ export class SafeDsPythonGenerator { this.purityComputer = services.purity.PurityComputer; } - generate(document: LangiumDocument, generateOptions: GenerateOptions): TextDocument[] { + generate(document: LangiumDocument, options: GenerateOptions): TextDocument[] { const node = document.parseResult.value; // Do not generate stub files @@ -193,13 +193,13 @@ export class SafeDsPythonGenerator { const name = path.parse(document.uri.fsPath).name; const pythonModuleName = this.builtinAnnotations.getPythonModule(node); const packagePath = pythonModuleName === undefined ? node.name.split('.') : [pythonModuleName]; - const parentDirectoryPath = path.join(generateOptions.destination!.fsPath, ...packagePath); + const parentDirectoryPath = path.join(options.destination!.fsPath, ...packagePath); const generatedFiles = new Map(); - const generatedModule = this.generateModule(node, generateOptions); + const generatedModule = this.generateModule(node, options); const { text, trace } = toStringAndTrace(generatedModule); const pythonOutputPath = `${path.join(parentDirectoryPath, this.formatGeneratedFileName(name))}.py`; - if (generateOptions.createSourceMaps) { + if (options.createSourceMaps) { generatedFiles.set( `${pythonOutputPath}.map`, this.generateSourceMap(document, text, trace, this.formatGeneratedFileName(name)), diff --git a/packages/safe-ds-lang/src/language/helpers/nodeProperties.ts b/packages/safe-ds-lang/src/language/helpers/nodeProperties.ts index f1be44922..80b31ddd3 100644 --- a/packages/safe-ds-lang/src/language/helpers/nodeProperties.ts +++ b/packages/safe-ds-lang/src/language/helpers/nodeProperties.ts @@ -87,6 +87,10 @@ export const isInternal = (node: SdsDeclaration | undefined): boolean => { return isSdsSegment(node) && node.visibility === 'internal'; }; +export const isPrivate = (node: SdsDeclaration | undefined): boolean => { + return isSdsSegment(node) && node.visibility === 'private'; +}; + export namespace Argument { export const isNamed = (node: SdsArgument | undefined): boolean => { return Boolean(node?.parameter); diff --git a/packages/safe-ds-lang/src/language/safe-ds-module.ts b/packages/safe-ds-lang/src/language/safe-ds-module.ts index c45d65f9d..cd7a9941c 100644 --- a/packages/safe-ds-lang/src/language/safe-ds-module.ts +++ b/packages/safe-ds-lang/src/language/safe-ds-module.ts @@ -42,6 +42,7 @@ import { SafeDsSettingsProvider } from './workspace/safe-ds-settings-provider.js import { SafeDsRenameProvider } from './lsp/safe-ds-rename-provider.js'; import { SafeDsRunner } from './runner/safe-ds-runner.js'; import { SafeDsTypeFactory } from './typing/safe-ds-type-factory.js'; +import { SafeDsMarkdownGenerator } from './generation/safe-ds-markdown-generator.js'; /** * Declaration of custom services - add your own service classes here. @@ -53,6 +54,9 @@ export type SafeDsAddedServices = { Enums: SafeDsEnums; ImpurityReasons: SafeDsImpurityReasons; }; + documentation: { + DocumentationProvider: SafeDsDocumentationProvider; + }; evaluation: { PartialEvaluator: SafeDsPartialEvaluator; }; @@ -60,6 +64,7 @@ export type SafeDsAddedServices = { CallGraphComputer: SafeDsCallGraphComputer; }; generation: { + MarkdownGenerator: SafeDsMarkdownGenerator; PythonGenerator: SafeDsPythonGenerator; }; helpers: { @@ -116,6 +121,7 @@ export const SafeDsModule: Module new SafeDsCallGraphComputer(services), }, generation: { + MarkdownGenerator: (services) => new SafeDsMarkdownGenerator(services), PythonGenerator: (services) => new SafeDsPythonGenerator(services), }, helpers: { diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/image/containers/image.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/image/containers/image.sdsstub index 3158da24c..2309efd01 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/image/containers/image.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/image/containers/image.sdsstub @@ -58,6 +58,9 @@ class Image { * * The original image is not modified. * + * @param newWidth The new width of the image. + * @param newHeight The new height of the image. + * * @result result1 The image with the given width and height. */ @Pure @@ -85,6 +88,11 @@ class Image { * * The original image is not modified. * + * @param x The x coordinate of the top-left corner of the bounding rectangle. + * @param y The y coordinate of the top-left corner of the bounding rectangle. + * @param width The width of the bounding rectangle. + * @param height The height of the bounding rectangle. + * * @result result1 The cropped image. */ @Pure diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub index 5022616b4..3b0c72fb7 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/column.sdsstub @@ -204,7 +204,7 @@ class Column( * \frac{\text{number of occurrences of most common non-null value}}{\text{number of non-null values}} * $$ * - * The stability is not definded for a column with only null values. + * The stability is not defined for a column with only null values. * * @result result1 The stability of the column. */ diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub index f52b2f834..30b865301 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/containers/table.sdsstub @@ -10,13 +10,13 @@ from safeds.data.tabular.typing import ColumnType, Schema * * To create a `Table` call the constructor or use one of the following static methods: * - * | Method | Description | - * | ---------------------------------------------------------------------------- | -------------------------------------- | - * | [from_csv_file][safeds.data.tabular.containers._table.Table.from_csv_file] | Create a table from a CSV file. | - * | [from_json_file][safeds.data.tabular.containers._table.Table.from_json_file] | Create a table from a JSON file. | - * | [from_dict][safeds.data.tabular.containers._table.Table.from_dict] | Create a table from a dictionary. | - * | [from_columns][safeds.data.tabular.containers._table.Table.from_columns] | Create a table from a list of columns. | - * | [from_rows][safeds.data.tabular.containers._table.Table.from_rows] | Create a table from a list of rows. | + * | Method | Description | + * | ------------------------------------------------------------------| -------------------------------------- | + * | [fromCsvFile][safeds.data.tabular.containers.Table.fromCsvFile] | Create a table from a CSV file. | + * | [fromJsonFile][safeds.data.tabular.containers.Table.fromJsonFile] | Create a table from a JSON file. | + * | [fromDict][safeds.data.tabular.containers.Table.fromDict] | Create a table from a dictionary. | + * | [fromColumns][safeds.data.tabular.containers.Table.fromColumns] | Create a table from a list of columns. | + * | [fromRows][safeds.data.tabular.containers.Table.fromRows] | Create a table from a list of rows. | * * Note: When removing the last column of the table, the `number_of_columns` property will be set to 0. * diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub index edf337a5a..fb673e737 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/data/tabular/transformation/table_transformer.sdsstub @@ -93,7 +93,7 @@ class TableTransformer { /** * A `TableTransformer` that can also undo the learned transformation after it has been applied. */ -class InvertibleTableTransformer() sub TableTransformer { +class InvertibleTableTransformer sub TableTransformer { /** * Learn a transformation for a set of columns in a table. * diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub index c9b7b93fe..052211d05 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/ada_boost.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub index cc88c824d..c68106cf2 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/decision_tree.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub index e44429c60..1ee1aab9b 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/gradient_boosting.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub index 770bab0b4..206d9b5b0 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/k_nearest_neighbors.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub index b1997ffab..45824bbf5 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/random_forest.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub index 2ce4c7f15..3d697df26 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/ml/classical/classification/support_vector_machine.sdsstub @@ -1,4 +1,4 @@ -package safeds.ml.classical.regression +package safeds.ml.classical.classification from safeds.data.tabular.containers import Table, TaggedTable from safeds.ml.classical.classification import Classifier diff --git a/packages/safe-ds-lang/tests/helpers/collections.test.ts b/packages/safe-ds-lang/tests/helpers/collections.test.ts index 1a1a0eb2d..a234c81c5 100644 --- a/packages/safe-ds-lang/tests/helpers/collections.test.ts +++ b/packages/safe-ds-lang/tests/helpers/collections.test.ts @@ -6,6 +6,7 @@ import { isEqualSet, isSubset, last, + partitionBy, uniqueOrUndefined, } from '../../src/helpers/collections.js'; @@ -80,6 +81,21 @@ describe('groupBy', () => { }); }); +describe('partitionBy', () => { + const isEven = (element: number) => element % 2 === 0; + + it('should return empty lists given an empty iterable', () => { + expect(partitionBy([], isEven)).toStrictEqual([[], []]); + }); + + it('should group values together that get the same label', () => { + expect(partitionBy([1, 2, 3, 4, 2], isEven)).toStrictEqual([ + [2, 4, 2], + [1, 3], + ]); + }); +}); + describe('last', () => { it('should return undefined if the array is empty', () => { expect(last([])).toBeUndefined(); diff --git a/packages/safe-ds-lang/tests/helpers/strings.test.ts b/packages/safe-ds-lang/tests/helpers/strings.test.ts index 062de0e89..bf0616aa8 100644 --- a/packages/safe-ds-lang/tests/helpers/strings.test.ts +++ b/packages/safe-ds-lang/tests/helpers/strings.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { normalizeLineBreaks, pluralize } from '../../src/helpers/strings.js'; +import { addLinePrefix, normalizeLineBreaks, pluralize, removeLinePrefix } from '../../src/helpers/strings.js'; describe('normalizeLineBreaks', () => { it.each([ @@ -67,3 +67,42 @@ describe('pluralize', () => { expect(pluralize(count, singular, plural)).toBe(expected); }); }); + +describe('addLinePrefix', () => { + it.each([ + { + text: '', + prefix: 'baz', + expected: 'baz', + }, + { + text: 'foo\nbar', + prefix: 'baz', + expected: 'bazfoo\nbazbar', + }, + ])(`should prepend each line with the given prefix (%#)`, ({ text, prefix, expected }) => { + expect(addLinePrefix(text, prefix)).toBe(expected); + }); +}); + +describe('removeLinePrefix', () => { + it.each([ + { + text: '', + prefix: 'baz', + expected: '', + }, + { + text: 'bazfoo\nbar', + prefix: 'baz', + expected: 'foo\nbar', + }, + { + text: 'bazfoo\nbazbar', + prefix: 'baz', + expected: 'foo\nbar', + }, + ])(`should remove the given prefix from each line (%#)`, ({ text, prefix, expected }) => { + expect(removeLinePrefix(text, prefix)).toBe(expected); + }); +}); diff --git a/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts b/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts index bf8343c2c..1e3321744 100644 --- a/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts +++ b/packages/safe-ds-lang/tests/language/documentation/safe-ds-documentation-provider.test.ts @@ -17,192 +17,341 @@ const documentationProvider = services.documentation.DocumentationProvider; const testDocumentation = 'Lorem ipsum.'; describe('SafeDsDocumentationProvider', () => { - const testCases: DocumentationProviderTest[] = [ - { - testName: 'module member', - code: ` - /** - * ${testDocumentation} - */ - annotation MyAnnotation - `, - predicate: isSdsAnnotation, - expectedDocumentation: testDocumentation, - }, - { - testName: 'documented parameter', - code: ` - /** - * @param param ${testDocumentation} - */ - fun myFunction(param: String) - `, - predicate: isSdsParameter, - expectedDocumentation: testDocumentation, - }, - { - testName: 'documented parameter (duplicate)', - code: ` - /** - * @param param ${testDocumentation} - * @param param bla - */ - fun myFunction(param: String) - `, - predicate: isSdsParameter, - expectedDocumentation: testDocumentation, - }, - { - testName: 'undocumented parameter', - code: ` - /** - * @param param ${testDocumentation} - */ - fun myFunction(param2: String) - `, - predicate: isSdsParameter, - expectedDocumentation: undefined, - }, - { - testName: 'parameter (no documentation on containing callable)', - code: ` - fun myFunction(p: Int) - `, - predicate: isSdsParameter, - expectedDocumentation: undefined, - }, - { - testName: 'documented result', - code: ` - /** - * @result res ${testDocumentation} - */ - fun myFunction() -> (res: String) - `, - predicate: isSdsResult, - expectedDocumentation: testDocumentation, - }, - { - testName: 'documented result (duplicate)', - code: ` - /** - * @result res ${testDocumentation} - * @result res bla - */ - fun myFunction() -> (res: String) - `, - predicate: isSdsResult, - expectedDocumentation: testDocumentation, - }, - { - testName: 'undocumented result', - code: ` - /** - * @result res ${testDocumentation} - */ - fun myFunction() -> (res2: String) - `, - predicate: isSdsResult, - expectedDocumentation: undefined, - }, - { - testName: 'result (no documentation on containing callable)', - code: ` - fun myFunction() -> r: Int - `, - predicate: isSdsResult, - expectedDocumentation: undefined, - }, - { - testName: 'documented type parameter', - code: ` - /** - * @typeParam T - * ${testDocumentation} - */ - class MyClass - `, - predicate: isSdsTypeParameter, - expectedDocumentation: testDocumentation, - }, - { - testName: 'documented type parameter (duplicate)', - code: ` - /** - * @typeParam T ${testDocumentation} - * @typeParam T bla - */ - class MyClass - `, - predicate: isSdsTypeParameter, - expectedDocumentation: testDocumentation, - }, - { - testName: 'undocumented type parameter', - code: ` - /** - * @typeParam T - * ${testDocumentation} - */ - class MyClass - `, - predicate: isSdsTypeParameter, - expectedDocumentation: undefined, - }, - { - testName: 'type parameter (no documentation on containing callable)', - code: ` - fun myFunction() - `, - predicate: isSdsTypeParameter, - expectedDocumentation: undefined, - }, - { - testName: 'custom tag rendering', - code: ` - /** - * ${testDocumentation} - * - * @param param ${testDocumentation} - * @result result ${testDocumentation} - * @typeParam T ${testDocumentation} - * @since 1.0.0 - */ - fun myFunction(param: String) -> result: String - `, - predicate: isSdsFunction, - expectedDocumentation: expandToString` - Lorem ipsum. + describe('getDocumentation', () => { + const testCases: DocumentationProviderTest[] = [ + { + testName: 'module member', + code: ` + /** + * ${testDocumentation} + */ + annotation MyAnnotation + `, + predicate: isSdsAnnotation, + expectedDocumentation: testDocumentation, + }, + { + testName: 'documented parameter', + code: ` + /** + * @param param ${testDocumentation} + */ + fun myFunction(param: String) + `, + predicate: isSdsParameter, + expectedDocumentation: testDocumentation, + }, + { + testName: 'documented parameter (duplicate)', + code: ` + /** + * @param param ${testDocumentation} + * @param param bla + */ + fun myFunction(param: String) + `, + predicate: isSdsParameter, + expectedDocumentation: testDocumentation, + }, + { + testName: 'undocumented parameter', + code: ` + /** + * @param param ${testDocumentation} + */ + fun myFunction(param2: String) + `, + predicate: isSdsParameter, + expectedDocumentation: undefined, + }, + { + testName: 'parameter (no documentation on containing callable)', + code: ` + fun myFunction(p: Int) + `, + predicate: isSdsParameter, + expectedDocumentation: undefined, + }, + { + testName: 'documented result', + code: ` + /** + * @result res ${testDocumentation} + */ + fun myFunction() -> (res: String) + `, + predicate: isSdsResult, + expectedDocumentation: testDocumentation, + }, + { + testName: 'documented result (duplicate)', + code: ` + /** + * @result res ${testDocumentation} + * @result res bla + */ + fun myFunction() -> (res: String) + `, + predicate: isSdsResult, + expectedDocumentation: testDocumentation, + }, + { + testName: 'undocumented result', + code: ` + /** + * @result res ${testDocumentation} + */ + fun myFunction() -> (res2: String) + `, + predicate: isSdsResult, + expectedDocumentation: undefined, + }, + { + testName: 'result (no documentation on containing callable)', + code: ` + fun myFunction() -> r: Int + `, + predicate: isSdsResult, + expectedDocumentation: undefined, + }, + { + testName: 'documented type parameter', + code: ` + /** + * @typeParam T + * ${testDocumentation} + */ + class MyClass + `, + predicate: isSdsTypeParameter, + expectedDocumentation: testDocumentation, + }, + { + testName: 'documented type parameter (duplicate)', + code: ` + /** + * @typeParam T ${testDocumentation} + * @typeParam T bla + */ + class MyClass + `, + predicate: isSdsTypeParameter, + expectedDocumentation: testDocumentation, + }, + { + testName: 'undocumented type parameter', + code: ` + /** + * @typeParam T + * ${testDocumentation} + */ + class MyClass + `, + predicate: isSdsTypeParameter, + expectedDocumentation: undefined, + }, + { + testName: 'type parameter (no documentation on containing callable)', + code: ` + fun myFunction() + `, + predicate: isSdsTypeParameter, + expectedDocumentation: undefined, + }, + { + testName: 'custom tag rendering', + code: ` + /** + * ${testDocumentation} + * + * @param param ${testDocumentation} + * @result result ${testDocumentation} + * @typeParam T ${testDocumentation} + * @since 1.0.0 + */ + fun myFunction(param: String) -> result: String + `, + predicate: isSdsFunction, + expectedDocumentation: expandToString` + Lorem ipsum. + + **@param** *param* — Lorem ipsum. - **@param** *param* — Lorem ipsum. + **@result** *result* — Lorem ipsum. - **@result** *result* — Lorem ipsum. + **@typeParam** *T* — Lorem ipsum. - **@typeParam** *T* — Lorem ipsum. + **@since** — 1.0.0 + `, + }, + { + testName: 'multiline tag', + code: ` + /** + * @param param ${testDocumentation} + * ${testDocumentation} + */ + fun myFunction(param: String) + `, + predicate: isSdsParameter, + expectedDocumentation: `${testDocumentation} ${testDocumentation}`, + }, + ]; - **@since** — 1.0.0 - `, - }, - ]; + it.each(testCases)('$testName', async ({ code, predicate, expectedDocumentation }) => { + const node = await getNodeOfType(services, code, predicate); + const normalizedActual = normalizeLineBreaks(documentationProvider.getDocumentation(node)); + const normalizedExpected = normalizeLineBreaks(expectedDocumentation); + expect(normalizedActual).toStrictEqual(normalizedExpected); + }); - it.each(testCases)('$testName', async ({ code, predicate, expectedDocumentation }) => { - const node = await getNodeOfType(services, code, predicate); - const normalizedActual = normalizeLineBreaks(documentationProvider.getDocumentation(node)); - const normalizedExpected = normalizeLineBreaks(expectedDocumentation); - expect(normalizedActual).toStrictEqual(normalizedExpected); + it('should resolve links', async () => { + const code = ` + /** + * {@link myFunction2} + */ + fun myFunction1() + + fun myFunction2() + `; + const node = await getNodeOfType(services, code, isSdsFunction); + expect(documentationProvider.getDocumentation(node)).toMatch(/\[myFunction2\]\(.*\)/u); + }); }); - it('should resolve links', async () => { - const code = ` - /** - * {@link myFunction2} - */ - fun myFunction1() - - fun myFunction2() - `; - const node = await getNodeOfType(services, code, isSdsFunction); - expect(documentationProvider.getDocumentation(node)).toMatch(/\[myFunction2\]\(.*\)/u); + describe('getDescription', () => { + const testCases: DocumentationProviderTest[] = [ + { + testName: 'text and tags', + code: ` + /** + * ${testDocumentation} + * + * @param param ${testDocumentation} + * @result result ${testDocumentation} + * @typeParam T ${testDocumentation} + * @since 1.0.0 + */ + fun myFunction(param: String) -> result: String + `, + predicate: isSdsFunction, + expectedDocumentation: testDocumentation, + }, + { + testName: 'text, tags, and more text', + code: ` + /** + * ${testDocumentation} + * + * @param param ${testDocumentation} + * @result result ${testDocumentation} + * @typeParam T ${testDocumentation} + * @since 1.0.0 + * + * ${testDocumentation} + */ + fun myFunction(param: String) -> result: String + `, + predicate: isSdsFunction, + expectedDocumentation: testDocumentation, + }, + { + testName: 'text with inline tags', + code: ` + /** + * ${testDocumentation} {@link myFunction2} ${testDocumentation} + */ + fun myFunction(param: String) -> result: String + `, + predicate: isSdsFunction, + expectedDocumentation: `${testDocumentation} myFunction2 ${testDocumentation}`, + }, + { + testName: 'multiline text (consistent indentation)', + code: ` + /** + * ${testDocumentation} + * + * ${testDocumentation} + */ + fun myFunction() + `, + predicate: isSdsFunction, + expectedDocumentation: `${testDocumentation}\n\n${testDocumentation}`, + }, + { + testName: 'multiline text (mixed indentation)', + code: ` + /** + * ${testDocumentation} + * ${testDocumentation} + *${testDocumentation} + */ + fun myFunction() + `, + predicate: isSdsFunction, + expectedDocumentation: `${testDocumentation}\n ${testDocumentation}\n${testDocumentation}`, + }, + ]; + + it.each(testCases)('$testName', async ({ code, predicate, expectedDocumentation }) => { + const node = await getNodeOfType(services, code, predicate); + const normalizedActual = normalizeLineBreaks(documentationProvider.getDescription(node)); + const normalizedExpected = normalizeLineBreaks(expectedDocumentation); + expect(normalizedActual).toStrictEqual(normalizedExpected); + }); + }); + + describe('getSince', () => { + const testCases: DocumentationProviderTest[] = [ + { + testName: 'no since tag', + code: ` + /** + * ${testDocumentation} + */ + fun myFunction() + `, + predicate: isSdsFunction, + expectedDocumentation: undefined, + }, + { + testName: 'one since tag', + code: ` + /** + * ${testDocumentation} + * + * @since 1.0.0 + * + * ${testDocumentation} + */ + fun myFunction() + `, + predicate: isSdsFunction, + expectedDocumentation: '1.0.0', + }, + { + testName: 'multiple since tags', + code: ` + /** + * ${testDocumentation} + * + * @since 1.0.0 + * @since 2.0.0 + */ + fun myFunction() + `, + predicate: isSdsFunction, + expectedDocumentation: '1.0.0', + }, + ]; + + it.each(testCases)('$testName', async ({ code, predicate, expectedDocumentation }) => { + const node = await getNodeOfType(services, code, predicate); + const normalizedActual = normalizeLineBreaks(documentationProvider.getSince(node)); + const normalizedExpected = normalizeLineBreaks(expectedDocumentation); + expect(normalizedActual).toStrictEqual(normalizedExpected); + }); }); }); diff --git a/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/creator.ts b/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/creator.ts new file mode 100644 index 000000000..a786c4c00 --- /dev/null +++ b/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/creator.ts @@ -0,0 +1,97 @@ +import { + listTestFilesWithExtensions, + listTestSafeDsFilesGroupedByParentDirectory, + loadDocuments, + uriToShortenedTestResourceName, +} from '../../../helpers/testResources.js'; +import path from 'path'; +import { ErrorsInCodeError, getErrorsAtURI } from '../../../helpers/diagnostics.js'; +import { NodeFileSystem } from 'langium/node'; +import { TestDescription, TestDescriptionError } from '../../../helpers/testDescription.js'; +import { URI } from 'langium'; +import { createSafeDsServices } from '../../../../src/language/index.js'; + +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; + +const rootResourceName = 'generation/markdown'; + +export const createMarkdownGenerationTests = async (): Promise => { + const filesGroupedByParentDirectory = listTestSafeDsFilesGroupedByParentDirectory(rootResourceName); + const testCases = filesGroupedByParentDirectory.map((entry) => createMarkdownGenerationTest(...entry)); + + return Promise.all(testCases); +}; + +const createMarkdownGenerationTest = async ( + parentDirectory: URI, + inputUris: URI[], +): Promise => { + const outputRoot = URI.file(path.join(parentDirectory.fsPath, 'generated')); + const expectedOutputUris = listExpectedOutputFiles(outputRoot); + + // Load all files, so they get linked + await loadDocuments(services, inputUris, { validation: true }); + + for (const uri of inputUris) { + // File must not contain any errors + const errors = getErrorsAtURI(services, uri); + if (errors.length > 0) { + return invalidTest('FILE', new ErrorsInCodeError(errors, uri)); + } + } + + const shortenedResourceName = uriToShortenedTestResourceName(parentDirectory, rootResourceName); + return { + testName: `[${shortenedResourceName}]`, + inputUris, + outputRoot, + expectedOutputUris, + }; +}; + +/** + * List all expected output files. + * + * @param outputRoot The directory, where output files are located. + */ +const listExpectedOutputFiles = (outputRoot: URI): URI[] => { + return listTestFilesWithExtensions(uriToShortenedTestResourceName(outputRoot), ['md']); +}; + +/** + * Report a test that has errors. + * + * @param level Whether a test file or a test suite is invalid. + * @param error The error that occurred. + */ +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): MarkdownGenerationTest => { + const shortenedResourceName = uriToShortenedTestResourceName(error.uri, rootResourceName); + const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; + return { + testName, + inputUris: [], + outputRoot: URI.file(''), + expectedOutputUris: [], + error, + }; +}; + +/** + * A description of a generation test. + */ +interface MarkdownGenerationTest extends TestDescription { + /** + * The original code. + */ + inputUris: URI[]; + + /** + * The directory, where output files are located. + */ + outputRoot: URI; + + /** + * The expected output files. + */ + expectedOutputUris: URI[]; +} diff --git a/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/safe-ds-markdown-generator.test.ts b/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/safe-ds-markdown-generator.test.ts new file mode 100644 index 000000000..4d63ff0d7 --- /dev/null +++ b/packages/safe-ds-lang/tests/language/generation/safe-ds-markdown-generator/safe-ds-markdown-generator.test.ts @@ -0,0 +1,43 @@ +import { describe, expect, it } from 'vitest'; +import { NodeFileSystem } from 'langium/node'; +import { createMarkdownGenerationTests } from './creator.js'; +import { loadDocuments } from '../../../helpers/testResources.js'; +import { URI } from 'langium'; +import { createSafeDsServices } from '../../../../src/language/index.js'; + +const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; +const markdownGenerator = services.generation.MarkdownGenerator; + +const generationTests = createMarkdownGenerationTests(); + +describe('generation', async () => { + it.each(await generationTests)('$testName', async (test) => { + // Test is invalid + if (test.error) { + throw test.error; + } + + // Load all documents + const documents = await loadDocuments(services, test.inputUris); + + // Generate code for all documents + const actualOutputs = new Map( + markdownGenerator + .generate(documents, { + destination: test.outputRoot, + }) + .map((textDocument) => [textDocument.uri, textDocument.getText()]), + ); + + // File contents must match + for (const [uriString, code] of actualOutputs) { + const fsPath = URI.parse(uriString).fsPath; + await expect(code).toMatchFileSnapshot(fsPath); + } + + // File paths must match + const actualOutputPaths = Array.from(actualOutputs.keys()).sort(); + const expectedOutputPaths = test.expectedOutputUris.map((uri) => uri.toString()).sort(); + expect(actualOutputPaths).toStrictEqual(expectedOutputPaths); + }); +}); diff --git a/packages/safe-ds-lang/tests/language/generation/creator.ts b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/creator.ts similarity index 86% rename from packages/safe-ds-lang/tests/language/generation/creator.ts rename to packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/creator.ts index bbb626a56..b194e8277 100644 --- a/packages/safe-ds-lang/tests/language/generation/creator.ts +++ b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/creator.ts @@ -3,31 +3,31 @@ import { listTestSafeDsFilesGroupedByParentDirectory, loadDocuments, uriToShortenedTestResourceName, -} from '../../helpers/testResources.js'; +} from '../../../helpers/testResources.js'; import path from 'path'; -import { ErrorsInCodeError, getErrorsAtURI } from '../../helpers/diagnostics.js'; -import { findTestChecks } from '../../helpers/testChecks.js'; +import { ErrorsInCodeError, getErrorsAtURI } from '../../../helpers/diagnostics.js'; +import { findTestChecks } from '../../../helpers/testChecks.js'; import { Location } from 'vscode-languageserver'; import { NodeFileSystem } from 'langium/node'; -import { TestDescription, TestDescriptionError } from '../../helpers/testDescription.js'; -import { locationToString } from '../../../src/helpers/locations.js'; +import { TestDescription, TestDescriptionError } from '../../../helpers/testDescription.js'; +import { locationToString } from '../../../../src/helpers/locations.js'; import { URI } from 'langium'; -import { createSafeDsServices } from '../../../src/language/index.js'; +import { createSafeDsServices } from '../../../../src/language/index.js'; const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; -const rootResourceName = 'generation'; +const rootResourceName = 'generation/python'; const runnerIntegration = 'runner integration'; -export const createGenerationTests = async (): Promise => { +export const createPythonGenerationTests = async (): Promise => { const filesGroupedByParentDirectory = listTestSafeDsFilesGroupedByParentDirectory(rootResourceName); - const testCases = filesGroupedByParentDirectory.map((entry) => createGenerationTest(...entry)); + const testCases = filesGroupedByParentDirectory.map((entry) => createPythonGenerationTest(...entry)); return Promise.all(testCases); }; -const createGenerationTest = async (parentDirectory: URI, inputUris: URI[]): Promise => { +const createPythonGenerationTest = async (parentDirectory: URI, inputUris: URI[]): Promise => { const outputRoot = URI.file(path.join(parentDirectory.fsPath, 'generated')); const expectedOutputUris = listExpectedOutputFiles(outputRoot); let runUntil: Location | undefined; @@ -102,7 +102,7 @@ const listExpectedOutputFiles = (outputRoot: URI): URI[] => { * @param level Whether a test file or a test suite is invalid. * @param error The error that occurred. */ -const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): GenerationTest => { +const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): PythonGenerationTest => { const shortenedResourceName = uriToShortenedTestResourceName(error.uri, rootResourceName); const testName = `INVALID TEST ${level} [${shortenedResourceName}]`; return { @@ -118,7 +118,7 @@ const invalidTest = (level: 'FILE' | 'SUITE', error: TestDescriptionError): Gene /** * A description of a generation test. */ -interface GenerationTest extends TestDescription { +interface PythonGenerationTest extends TestDescription { /** * The original code. */ diff --git a/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/safe-ds-python-generator.test.ts similarity index 89% rename from packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts rename to packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/safe-ds-python-generator.test.ts index 242c5f323..238f57e6d 100644 --- a/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts +++ b/packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator/safe-ds-python-generator.test.ts @@ -1,15 +1,15 @@ import { describe, expect, it } from 'vitest'; import { NodeFileSystem } from 'langium/node'; -import { createGenerationTests } from './creator.js'; -import { loadDocuments } from '../../helpers/testResources.js'; +import { createPythonGenerationTests } from './creator.js'; +import { loadDocuments } from '../../../helpers/testResources.js'; import { stream, URI } from 'langium'; -import { createSafeDsServices } from '../../../src/language/index.js'; +import { createSafeDsServices } from '../../../../src/language/index.js'; const services = (await createSafeDsServices(NodeFileSystem)).SafeDs; const langiumDocuments = services.shared.workspace.LangiumDocuments; const pythonGenerator = services.generation.PythonGenerator; -const generationTests = createGenerationTests(); +const generationTests = createPythonGenerationTests(); describe('generation', async () => { it.each(await generationTests)('$testName', async (test) => { diff --git a/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts b/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts index 8abe06e58..9b360b728 100644 --- a/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts +++ b/packages/safe-ds-lang/tests/language/scoping/scoping.test.ts @@ -2,7 +2,7 @@ import { AssertionError } from 'assert'; import { AstNode, AstUtils, DocumentValidator, LangiumDocument, Reference, URI } from 'langium'; import { NodeFileSystem } from 'langium/node'; import { clearDocuments, isRangeEqual, validationHelper } from 'langium/test'; -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { describe, expect, it } from 'vitest'; import { Location } from 'vscode-languageserver'; import { createSafeDsServices } from '../../../src/language/index.js'; import { isLocationEqual, locationToString } from '../../../src/helpers/locations.js'; @@ -18,15 +18,6 @@ const builtinClasses = services.builtins.Classes; const langiumDocuments = services.shared.workspace.LangiumDocuments; describe('scoping', async () => { - beforeEach(async () => { - // Load the builtin library - await services.shared.workspace.WorkspaceManager.initializeWorkspace([]); - }); - - afterEach(async () => { - await clearDocuments(services); - }); - it.each(await createScopingTests())('$testName', async (test) => { // Test is invalid if (test.error) { @@ -34,7 +25,7 @@ describe('scoping', async () => { } // Load all documents - await loadDocuments(services, test.uris); + const documents = await loadDocuments(services, test.uris); // Ensure all expected references match for (const expectedReference of test.expectedReferences) { @@ -73,6 +64,9 @@ describe('scoping', async () => { } } } + + // Clear documents + await clearDocuments(services, documents); }); it('should not replace core declarations (annotation call)', async () => { diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..bcaa5397c --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - annotations + - deprecated + - [MyAnnotation1](tests/generation/markdown/annotations/deprecated/MyAnnotation1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/tests/generation/markdown/annotations/deprecated/MyAnnotation1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/tests/generation/markdown/annotations/deprecated/MyAnnotation1.md new file mode 100644 index 000000000..bddf35499 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/generated/tests/generation/markdown/annotations/deprecated/MyAnnotation1.md @@ -0,0 +1,26 @@ +# :warning:{ title="Deprecated" } `#!sds annotation` MyAnnotation1 {#tests.generation.markdown.annotations.deprecated.MyAnnotation1 data-toc-label='MyAnnotation1'} + +!!! warning "Deprecated" + + This annotation is deprecated. + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + annotation MyAnnotation1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/main.sdsstub new file mode 100644 index 000000000..84fd8d1b1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/deprecated/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.annotations.deprecated + +@Deprecated +annotation MyAnnotation1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/SUMMARY.md new file mode 100644 index 000000000..9ac83ba17 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/SUMMARY.md @@ -0,0 +1,9 @@ +- tests + - generation + - markdown + - annotations + - documented + - [MyAnnotation1](tests/generation/markdown/annotations/documented/MyAnnotation1.md) + - [MyAnnotation2](tests/generation/markdown/annotations/documented/MyAnnotation2.md) + - [MyAnnotation3](tests/generation/markdown/annotations/documented/MyAnnotation3.md) + - [MyEnum1](tests/generation/markdown/annotations/documented/MyEnum1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation1.md new file mode 100644 index 000000000..eeda9abc0 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation1.md @@ -0,0 +1,24 @@ +# `#!sds annotation` MyAnnotation1 {#tests.generation.markdown.annotations.documented.MyAnnotation1 data-toc-label='MyAnnotation1'} + +Description of MyAnnotation1. + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="6" + annotation MyAnnotation1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation2.md new file mode 100644 index 000000000..4d81fe2a0 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation2.md @@ -0,0 +1,31 @@ +# `#!sds annotation` MyAnnotation2 {#tests.generation.markdown.annotations.documented.MyAnnotation2 data-toc-label='MyAnnotation2'} + +Description of MyAnnotation2. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | [`MyEnum1`][tests.generation.markdown.annotations.documented.MyEnum1] | Description of param1. | - | +| `param2` | `#!sds Float` | Description of param2. | `#!sds 1.0` | + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="14" + annotation MyAnnotation2(param1: MyEnum1, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation3.md new file mode 100644 index 000000000..b99d6fd5c --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyAnnotation3.md @@ -0,0 +1,9 @@ +# `#!sds annotation` MyAnnotation3 {#tests.generation.markdown.annotations.documented.MyAnnotation3 data-toc-label='MyAnnotation3'} + +Description of MyAnnotation3. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="20" + annotation MyAnnotation3 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyEnum1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyEnum1.md new file mode 100644 index 000000000..9b68be44f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/generated/tests/generation/markdown/annotations/documented/MyEnum1.md @@ -0,0 +1,7 @@ +# `#!sds enum` MyEnum1 {#tests.generation.markdown.annotations.documented.MyEnum1 data-toc-label='MyEnum1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="22" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/main.sdsstub new file mode 100644 index 000000000..58ad6c7b1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/documented/main.sdsstub @@ -0,0 +1,22 @@ +package tests.generation.markdown.annotations.documented + +/** + * Description of MyAnnotation1. + */ +annotation MyAnnotation1 + +/** + * Description of MyAnnotation2. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ +annotation MyAnnotation2(param1: MyEnum1, param2: Float = 1.0) + +/** + * Description of MyAnnotation3. + */ +@Target(AnnotationTarget.Annotation) +annotation MyAnnotation3 + +enum MyEnum1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..72fd3740b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - annotations + - experimental + - [MyAnnotation1](tests/generation/markdown/annotations/experimental/MyAnnotation1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/tests/generation/markdown/annotations/experimental/MyAnnotation1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/tests/generation/markdown/annotations/experimental/MyAnnotation1.md new file mode 100644 index 000000000..782a2b2e0 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/generated/tests/generation/markdown/annotations/experimental/MyAnnotation1.md @@ -0,0 +1,22 @@ +# :test_tube:{ title="Experimental" } `#!sds annotation` MyAnnotation1 {#tests.generation.markdown.annotations.experimental.MyAnnotation1 data-toc-label='MyAnnotation1'} + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + annotation MyAnnotation1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/main.sdsstub new file mode 100644 index 000000000..fa2d6d4ee --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/experimental/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.annotations.experimental + +@Experimental +annotation MyAnnotation1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..52b11cce3 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/SUMMARY.md @@ -0,0 +1,8 @@ +- tests + - generation + - markdown + - annotations + - undocumented + - [MyAnnotation1](tests/generation/markdown/annotations/undocumented/MyAnnotation1.md) + - [MyAnnotation2](tests/generation/markdown/annotations/undocumented/MyAnnotation2.md) + - [MyAnnotation3](tests/generation/markdown/annotations/undocumented/MyAnnotation3.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation1.md new file mode 100644 index 000000000..2916d8b69 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation1.md @@ -0,0 +1,22 @@ +# `#!sds annotation` MyAnnotation1 {#tests.generation.markdown.annotations.undocumented.MyAnnotation1 data-toc-label='MyAnnotation1'} + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="3" + annotation MyAnnotation1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation2.md new file mode 100644 index 000000000..697b12137 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation2.md @@ -0,0 +1,29 @@ +# `#!sds annotation` MyAnnotation2 {#tests.generation.markdown.annotations.undocumented.MyAnnotation2 data-toc-label='MyAnnotation2'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | - | - | +| `param2` | `#!sds Float` | - | `#!sds 1.0` | + +**Targets:** + +- `Annotation` +- `Attribute` +- `Class` +- `Enum` +- `EnumVariant` +- `Function` +- `Module` +- `Parameter` +- `Pipeline` +- `Result` +- `Segment` +- `TypeParameter` + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + annotation MyAnnotation2(param1: Int, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation3.md new file mode 100644 index 000000000..a54dc40cf --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/generated/tests/generation/markdown/annotations/undocumented/MyAnnotation3.md @@ -0,0 +1,7 @@ +# `#!sds annotation` MyAnnotation3 {#tests.generation.markdown.annotations.undocumented.MyAnnotation3 data-toc-label='MyAnnotation3'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="8" + annotation MyAnnotation3 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/main.sdsstub new file mode 100644 index 000000000..c489cfd1b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/annotations/undocumented/main.sdsstub @@ -0,0 +1,8 @@ +package tests.generation.markdown.annotations.undocumented + +annotation MyAnnotation1 + +annotation MyAnnotation2(param1: Int, param2: Float = 1.0) + +@Target(AnnotationTarget.Annotation) +annotation MyAnnotation3 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..7ff094aca --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - classes + - deprecated + - [MyClass1](tests/generation/markdown/classes/deprecated/MyClass1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/tests/generation/markdown/classes/deprecated/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/tests/generation/markdown/classes/deprecated/MyClass1.md new file mode 100644 index 000000000..d7d771efe --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/generated/tests/generation/markdown/classes/deprecated/MyClass1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds abstract class` MyClass1 {#tests.generation.markdown.classes.deprecated.MyClass1 data-toc-label='MyClass1'} + +!!! warning "Deprecated" + + This class is deprecated. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/main.sdsstub new file mode 100644 index 000000000..13a49e8e7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/deprecated/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.classes.deprecated + +@Deprecated +class MyClass1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/SUMMARY.md new file mode 100644 index 000000000..fe38df52a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/SUMMARY.md @@ -0,0 +1,11 @@ +- tests + - generation + - markdown + - classes + - documented + - [MyClass1](tests/generation/markdown/classes/documented/MyClass1.md) + - [MyClass2](tests/generation/markdown/classes/documented/MyClass2.md) + - [MyClass3](tests/generation/markdown/classes/documented/MyClass3.md) + - [MyClass4](tests/generation/markdown/classes/documented/MyClass4.md) + - [MyClass5](tests/generation/markdown/classes/documented/MyClass5.md) + - [MyClass6](tests/generation/markdown/classes/documented/MyClass6.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass1.md new file mode 100644 index 000000000..b2c8f0712 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass1.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.classes.documented.MyClass1 data-toc-label='MyClass1'} + +Description of MyClass1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="6" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass2.md new file mode 100644 index 000000000..b239158b5 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass2.md @@ -0,0 +1,9 @@ +# `#!sds class` MyClass2 {#tests.generation.markdown.classes.documented.MyClass2 data-toc-label='MyClass2'} + +Description of MyClass2. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="11" + class MyClass2() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass3.md new file mode 100644 index 000000000..6fc4570eb --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass3.md @@ -0,0 +1,17 @@ +# `#!sds abstract class` MyClass3 {#tests.generation.markdown.classes.documented.MyClass3 data-toc-label='MyClass3'} + +Description of MyClass3. + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `TypeParam1` | `#!sds Any?` | Description of TypeParam1. | - | +| `TypeParam2` | [`MyClass1`][tests.generation.markdown.classes.documented.MyClass1] | Description of TypeParam2. | - | +| `TypeParam3` | `#!sds Any?` | Description of TypeParam3. | [`MyClass1`][tests.generation.markdown.classes.documented.MyClass1] | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="20" + class MyClass3 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass4.md new file mode 100644 index 000000000..5ab7ee231 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass4.md @@ -0,0 +1,16 @@ +# `#!sds class` MyClass4 {#tests.generation.markdown.classes.documented.MyClass4 data-toc-label='MyClass4'} + +Description of MyClass4. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | [`MyClass1`][tests.generation.markdown.classes.documented.MyClass1] | Description of param1. | - | +| `param2` | `#!sds Float` | Description of param2. | `#!sds 1.0` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="28" + class MyClass4(param1: MyClass1, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass5.md new file mode 100644 index 000000000..21b1b9808 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass5.md @@ -0,0 +1,11 @@ +# `#!sds abstract class` MyClass5 {#tests.generation.markdown.classes.documented.MyClass5 data-toc-label='MyClass5'} + +Description of MyClass5. + +**Parent type:** [`MyClass1`][tests.generation.markdown.classes.documented.MyClass1] + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="33" + class MyClass5 sub MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass6.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass6.md new file mode 100644 index 000000000..45e5ff9d3 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/generated/tests/generation/markdown/classes/documented/MyClass6.md @@ -0,0 +1,119 @@ +# `#!sds abstract class` MyClass6 {#tests.generation.markdown.classes.documented.MyClass6 data-toc-label='MyClass6'} + +Description of MyClass6. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="38" + class MyClass6 { + /** + * Description of MyClass7. + */ + class MyClass7 { + /** + * Description of myAttribute4. + */ + attr myAttribut4: Int + /** + * Description of myAttribute3. + */ + attr myAttribute3: Int + } + + /** + * Description of MyEnum1. + */ + enum MyEnum1 + + /** + * Description of myFunction1. + */ + @Pure fun myFunction1() + /** + * Description of myFunction2. + */ + @Pure static fun myFunction2() + + /** + * Description of myAttribute1. + */ + attr myAttribute1: MyClass1 + /** + * Description of myAttribute2. + */ + static attr myAttribute2: Float + } + ``` + +## `#!sds attr` myAttribute1 {#tests.generation.markdown.classes.documented.MyClass6.myAttribute1 data-toc-label='myAttribute1'} + +Description of myAttribute1. + +**Type:** [`MyClass1`][tests.generation.markdown.classes.documented.MyClass1] + +## `#!sds fun` myFunction1 {#tests.generation.markdown.classes.documented.MyClass6.myFunction1 data-toc-label='myFunction1'} + +Description of myFunction1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="61" + @Pure fun myFunction1() + ``` + +## `#!sds static attr` myAttribute2 {#tests.generation.markdown.classes.documented.MyClass6.myAttribute2 data-toc-label='myAttribute2'} + +Description of myAttribute2. + +**Type:** `#!sds Float` + +## `#!sds static fun` myFunction2 {#tests.generation.markdown.classes.documented.MyClass6.myFunction2 data-toc-label='myFunction2'} + +Description of myFunction2. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="65" + @Pure static fun myFunction2() + ``` + +## `#!sds abstract class` MyClass7 {#tests.generation.markdown.classes.documented.MyClass6.MyClass7 data-toc-label='MyClass7'} + +Description of MyClass7. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="42" + class MyClass7 { + /** + * Description of myAttribute4. + */ + attr myAttribut4: Int + /** + * Description of myAttribute3. + */ + attr myAttribute3: Int + } + ``` + +### `#!sds attr` myAttribut4 {#tests.generation.markdown.classes.documented.MyClass6.MyClass7.myAttribut4 data-toc-label='myAttribut4'} + +Description of myAttribute4. + +**Type:** `#!sds Int` + +### `#!sds attr` myAttribute3 {#tests.generation.markdown.classes.documented.MyClass6.MyClass7.myAttribute3 data-toc-label='myAttribute3'} + +Description of myAttribute3. + +**Type:** `#!sds Int` + +## `#!sds enum` MyEnum1 {#tests.generation.markdown.classes.documented.MyClass6.MyEnum1 data-toc-label='MyEnum1'} + +Description of MyEnum1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="56" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/main.sdsstub new file mode 100644 index 000000000..deb4ab1ef --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/documented/main.sdsstub @@ -0,0 +1,75 @@ +package tests.generation.markdown.classes.documented + +/** + * Description of MyClass1. + */ +class MyClass1 + +/** + * Description of MyClass2. + */ +class MyClass2() + +/** + * Description of MyClass3. + * + * @typeParam TypeParam1 Description of TypeParam1. + * @typeParam TypeParam2 Description of TypeParam2. + * @typeParam TypeParam3 Description of TypeParam3. + */ +class MyClass3 + +/** + * Description of MyClass4. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ +class MyClass4(param1: MyClass1, param2: Float = 1.0) + +/** + * Description of MyClass5. + */ +class MyClass5 sub MyClass1 + +/** + * Description of MyClass6. + */ +class MyClass6 { + /** + * Description of MyClass7. + */ + class MyClass7 { + /** + * Description of myAttribute4. + */ + attr myAttribut4: Int + /** + * Description of myAttribute3. + */ + attr myAttribute3: Int + } + + /** + * Description of MyEnum1. + */ + enum MyEnum1 + + /** + * Description of myFunction1. + */ + @Pure fun myFunction1() + /** + * Description of myFunction2. + */ + @Pure static fun myFunction2() + + /** + * Description of myAttribute1. + */ + attr myAttribute1: MyClass1 + /** + * Description of myAttribute2. + */ + static attr myAttribute2: Float +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..0d62eb709 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - classes + - experimental + - [MyClass1](tests/generation/markdown/classes/experimental/MyClass1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/tests/generation/markdown/classes/experimental/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/tests/generation/markdown/classes/experimental/MyClass1.md new file mode 100644 index 000000000..d2e72ff9f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/generated/tests/generation/markdown/classes/experimental/MyClass1.md @@ -0,0 +1,7 @@ +# :test_tube:{ title="Experimental" } `#!sds abstract class` MyClass1 {#tests.generation.markdown.classes.experimental.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/main.sdsstub new file mode 100644 index 000000000..ed433dc29 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/experimental/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.classes.experimental + +@Experimental +class MyClass1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..8858df31b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/SUMMARY.md @@ -0,0 +1,11 @@ +- tests + - generation + - markdown + - classes + - undocumented + - [MyClass1](tests/generation/markdown/classes/undocumented/MyClass1.md) + - [MyClass2](tests/generation/markdown/classes/undocumented/MyClass2.md) + - [MyClass3](tests/generation/markdown/classes/undocumented/MyClass3.md) + - [MyClass4](tests/generation/markdown/classes/undocumented/MyClass4.md) + - [MyClass5](tests/generation/markdown/classes/undocumented/MyClass5.md) + - [MyClass6](tests/generation/markdown/classes/undocumented/MyClass6.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass1.md new file mode 100644 index 000000000..88c850e6e --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass1.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.classes.undocumented.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="3" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass2.md new file mode 100644 index 000000000..c800165d2 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass2.md @@ -0,0 +1,7 @@ +# `#!sds class` MyClass2 {#tests.generation.markdown.classes.undocumented.MyClass2 data-toc-label='MyClass2'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + class MyClass2() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass3.md new file mode 100644 index 000000000..b1c5a35c4 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass3.md @@ -0,0 +1,15 @@ +# `#!sds abstract class` MyClass3 {#tests.generation.markdown.classes.undocumented.MyClass3 data-toc-label='MyClass3'} + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `TypeParam1` | `#!sds Any?` | - | - | +| `TypeParam2` | `#!sds Int` | - | - | +| `TypeParam3` | `#!sds Any?` | - | `#!sds Int` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="7" + class MyClass3 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass4.md new file mode 100644 index 000000000..e0a90ae47 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass4.md @@ -0,0 +1,14 @@ +# `#!sds class` MyClass4 {#tests.generation.markdown.classes.undocumented.MyClass4 data-toc-label='MyClass4'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | - | - | +| `param2` | `#!sds Float` | - | `#!sds 1.0` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="9" + class MyClass4(param1: Int, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass5.md new file mode 100644 index 000000000..6c3db204f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass5.md @@ -0,0 +1,9 @@ +# `#!sds abstract class` MyClass5 {#tests.generation.markdown.classes.undocumented.MyClass5 data-toc-label='MyClass5'} + +**Parent type:** [`MyClass1`][tests.generation.markdown.classes.undocumented.MyClass1] + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="11" + class MyClass5 sub MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass6.md b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass6.md new file mode 100644 index 000000000..167ece78e --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/generated/tests/generation/markdown/classes/undocumented/MyClass6.md @@ -0,0 +1,56 @@ +# `#!sds abstract class` MyClass6 {#tests.generation.markdown.classes.undocumented.MyClass6 data-toc-label='MyClass6'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="13" + class MyClass6 { + attr myAttribute1: Int + static attr myAttribute2: Float + + @Pure fun myFunction1() + @Pure static fun myFunction2() + + class MyClass7 + enum MyEnum1 + } + ``` + +## `#!sds attr` myAttribute1 {#tests.generation.markdown.classes.undocumented.MyClass6.myAttribute1 data-toc-label='myAttribute1'} + +**Type:** `#!sds Int` + +## `#!sds fun` myFunction1 {#tests.generation.markdown.classes.undocumented.MyClass6.myFunction1 data-toc-label='myFunction1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="17" + @Pure fun myFunction1() + ``` + +## `#!sds static attr` myAttribute2 {#tests.generation.markdown.classes.undocumented.MyClass6.myAttribute2 data-toc-label='myAttribute2'} + +**Type:** `#!sds Float` + +## `#!sds static fun` myFunction2 {#tests.generation.markdown.classes.undocumented.MyClass6.myFunction2 data-toc-label='myFunction2'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="18" + @Pure static fun myFunction2() + ``` + +## `#!sds abstract class` MyClass7 {#tests.generation.markdown.classes.undocumented.MyClass6.MyClass7 data-toc-label='MyClass7'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="20" + class MyClass7 + ``` + +## `#!sds enum` MyEnum1 {#tests.generation.markdown.classes.undocumented.MyClass6.MyEnum1 data-toc-label='MyEnum1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="21" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/main.sdsstub new file mode 100644 index 000000000..583c4d243 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/classes/undocumented/main.sdsstub @@ -0,0 +1,22 @@ +package tests.generation.markdown.classes.undocumented + +class MyClass1 + +class MyClass2() + +class MyClass3 + +class MyClass4(param1: Int, param2: Float = 1.0) + +class MyClass5 sub MyClass1 + +class MyClass6 { + attr myAttribute1: Int + static attr myAttribute2: Float + + @Pure fun myFunction1() + @Pure static fun myFunction2() + + class MyClass7 + enum MyEnum1 +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..3152060fa --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/SUMMARY.md @@ -0,0 +1,10 @@ +- tests + - generation + - markdown + - deprecated + - [MySchema1](tests/generation/markdown/deprecated/MySchema1.md) + - [MySchema2](tests/generation/markdown/deprecated/MySchema2.md) + - [MySchema3](tests/generation/markdown/deprecated/MySchema3.md) + - [MySchema4](tests/generation/markdown/deprecated/MySchema4.md) + - [MySchema5](tests/generation/markdown/deprecated/MySchema5.md) + - [MySchema6](tests/generation/markdown/deprecated/MySchema6.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema1.md new file mode 100644 index 000000000..0a562a03d --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema1 {#tests.generation.markdown.deprecated.MySchema1 data-toc-label='MySchema1'} + +!!! warning "Deprecated" + + This schema is deprecated. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + schema MySchema1 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema2.md new file mode 100644 index 000000000..5f41fc4b5 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema2.md @@ -0,0 +1,13 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema2 {#tests.generation.markdown.deprecated.MySchema2 data-toc-label='MySchema2'} + +!!! warning "Deprecated" + + This schema is deprecated. + + - **Alternative:** Something else + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="9" + schema MySchema2 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema3.md new file mode 100644 index 000000000..4d32af84a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema3.md @@ -0,0 +1,13 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema3 {#tests.generation.markdown.deprecated.MySchema3 data-toc-label='MySchema3'} + +!!! warning "Deprecated" + + This schema is deprecated. + + - **Reason:** To annoy you + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="14" + schema MySchema3 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema4.md new file mode 100644 index 000000000..dc69d462a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema4.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema4 {#tests.generation.markdown.deprecated.MySchema4 data-toc-label='MySchema4'} + +!!! warning "Deprecated" + + This schema is deprecated since version **1.0.0**. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="19" + schema MySchema4 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema5.md new file mode 100644 index 000000000..b2503a820 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema5.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema5 {#tests.generation.markdown.deprecated.MySchema5 data-toc-label='MySchema5'} + +!!! warning "Deprecated" + + This schema is deprecated and will be removed in version **2.0.0**. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="24" + schema MySchema5 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema6.md b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema6.md new file mode 100644 index 000000000..1c8d56bbc --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/generated/tests/generation/markdown/deprecated/MySchema6.md @@ -0,0 +1,14 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema6 {#tests.generation.markdown.deprecated.MySchema6 data-toc-label='MySchema6'} + +!!! warning "Deprecated" + + This schema is deprecated since version **1.0.0** and will be removed in version **2.0.0**. + + - **Alternative:** Something else + - **Reason:** To annoy you + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="32" + schema MySchema6 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/main.sdsstub new file mode 100644 index 000000000..8ec5a9ba7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/deprecated/main.sdsstub @@ -0,0 +1,32 @@ +package tests.generation.markdown.deprecated + +@Deprecated +schema MySchema1 {} + +@Deprecated( + alternative = "Something else", +) +schema MySchema2 {} + +@Deprecated( + reason = "To annoy you", +) +schema MySchema3 {} + +@Deprecated( + sinceVersion = "1.0.0" +) +schema MySchema4 {} + +@Deprecated( + removalVersion = "2.0.0", +) +schema MySchema5 {} + +@Deprecated( + alternative = "Something else", + reason = "To annoy you", + sinceVersion = "1.0.0", + removalVersion = "2.0.0", +) +schema MySchema6 {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..d5ed30e70 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - enums + - deprecated + - [MyEnum1](tests/generation/markdown/enums/deprecated/MyEnum1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/tests/generation/markdown/enums/deprecated/MyEnum1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/tests/generation/markdown/enums/deprecated/MyEnum1.md new file mode 100644 index 000000000..cb21e8d03 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/generated/tests/generation/markdown/enums/deprecated/MyEnum1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds enum` MyEnum1 {#tests.generation.markdown.enums.deprecated.MyEnum1 data-toc-label='MyEnum1'} + +!!! warning "Deprecated" + + This enum is deprecated. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/main.sdsstub new file mode 100644 index 000000000..369108158 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/deprecated/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.enums.deprecated + +@Deprecated +enum MyEnum1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/SUMMARY.md new file mode 100644 index 000000000..e94e85a05 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/SUMMARY.md @@ -0,0 +1,8 @@ +- tests + - generation + - markdown + - enums + - documented + - [MyClass1](tests/generation/markdown/enums/documented/MyClass1.md) + - [MyEnum1](tests/generation/markdown/enums/documented/MyEnum1.md) + - [MyEnum2](tests/generation/markdown/enums/documented/MyEnum2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyClass1.md new file mode 100644 index 000000000..1247a708d --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyClass1.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.enums.documented.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="26" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum1.md new file mode 100644 index 000000000..d35fba1b5 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum1.md @@ -0,0 +1,9 @@ +# `#!sds enum` MyEnum1 {#tests.generation.markdown.enums.documented.MyEnum1 data-toc-label='MyEnum1'} + +Description of MyEnum1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="6" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum2.md new file mode 100644 index 000000000..42be67960 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/generated/tests/generation/markdown/enums/documented/MyEnum2.md @@ -0,0 +1,37 @@ +# `#!sds enum` MyEnum2 {#tests.generation.markdown.enums.documented.MyEnum2 data-toc-label='MyEnum2'} + +Description of MyEnum2. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="11" + enum MyEnum2 { + /** + * Description of MyVariant2. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ + MyVariant2(param1: MyClass1, param2: Float = 1.0) + + /** + * Description of MyVariant1. + */ + MyVariant1 + } + ``` + +## MyVariant1 {#tests.generation.markdown.enums.documented.MyEnum2.MyVariant1 data-toc-label='MyVariant1'} + +Description of MyVariant1. + +## MyVariant2 {#tests.generation.markdown.enums.documented.MyEnum2.MyVariant2 data-toc-label='MyVariant2'} + +Description of MyVariant2. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | [`MyClass1`][tests.generation.markdown.enums.documented.MyClass1] | Description of param1. | - | +| `param2` | `#!sds Float` | Description of param2. | `#!sds 1.0` | diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/main.sdsstub new file mode 100644 index 000000000..24c381a94 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/documented/main.sdsstub @@ -0,0 +1,26 @@ +package tests.generation.markdown.enums.documented + +/** + * Description of MyEnum1. + */ +enum MyEnum1 + +/** + * Description of MyEnum2. + */ +enum MyEnum2 { + /** + * Description of MyVariant2. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ + MyVariant2(param1: MyClass1, param2: Float = 1.0) + + /** + * Description of MyVariant1. + */ + MyVariant1 +} + +class MyClass1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..25595e5d7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - enums + - experimental + - [MyEnum1](tests/generation/markdown/enums/experimental/MyEnum1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/tests/generation/markdown/enums/experimental/MyEnum1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/tests/generation/markdown/enums/experimental/MyEnum1.md new file mode 100644 index 000000000..f13d5157a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/generated/tests/generation/markdown/enums/experimental/MyEnum1.md @@ -0,0 +1,7 @@ +# :test_tube:{ title="Experimental" } `#!sds enum` MyEnum1 {#tests.generation.markdown.enums.experimental.MyEnum1 data-toc-label='MyEnum1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/main.sdsstub new file mode 100644 index 000000000..654447b38 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/experimental/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.enums.experimental + +@Experimental +enum MyEnum1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..dd6360a62 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/SUMMARY.md @@ -0,0 +1,7 @@ +- tests + - generation + - markdown + - enums + - undocumented + - [MyEnum1](tests/generation/markdown/enums/undocumented/MyEnum1.md) + - [MyEnum2](tests/generation/markdown/enums/undocumented/MyEnum2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum1.md new file mode 100644 index 000000000..eb8c85333 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum1.md @@ -0,0 +1,7 @@ +# `#!sds enum` MyEnum1 {#tests.generation.markdown.enums.undocumented.MyEnum1 data-toc-label='MyEnum1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="3" + enum MyEnum1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum2.md new file mode 100644 index 000000000..7e5581497 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/generated/tests/generation/markdown/enums/undocumented/MyEnum2.md @@ -0,0 +1,21 @@ +# `#!sds enum` MyEnum2 {#tests.generation.markdown.enums.undocumented.MyEnum2 data-toc-label='MyEnum2'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + enum MyEnum2 { + MyVariant2(param1: Int, param2: Float = 1.0) + MyVariant1 + } + ``` + +## MyVariant1 {#tests.generation.markdown.enums.undocumented.MyEnum2.MyVariant1 data-toc-label='MyVariant1'} + +## MyVariant2 {#tests.generation.markdown.enums.undocumented.MyEnum2.MyVariant2 data-toc-label='MyVariant2'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | - | - | +| `param2` | `#!sds Float` | - | `#!sds 1.0` | diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/main.sdsstub new file mode 100644 index 000000000..f8221bf18 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/enums/undocumented/main.sdsstub @@ -0,0 +1,8 @@ +package tests.generation.markdown.enums.undocumented + +enum MyEnum1 + +enum MyEnum2 { + MyVariant2(param1: Int, param2: Float = 1.0) + MyVariant1 +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..e5486e156 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - functions + - deprecated + - [myFunction1](tests/generation/markdown/functions/deprecated/myFunction1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/tests/generation/markdown/functions/deprecated/myFunction1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/tests/generation/markdown/functions/deprecated/myFunction1.md new file mode 100644 index 000000000..18d4b49a7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/generated/tests/generation/markdown/functions/deprecated/myFunction1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds fun` myFunction1 {#tests.generation.markdown.functions.deprecated.myFunction1 data-toc-label='myFunction1'} + +!!! warning "Deprecated" + + This function is deprecated. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + fun myFunction1() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/main.sdsstub new file mode 100644 index 000000000..71062a4dc --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/deprecated/main.sdsstub @@ -0,0 +1,5 @@ +package tests.generation.markdown.functions.deprecated + +@Deprecated +@Pure +fun myFunction1() diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/SUMMARY.md new file mode 100644 index 000000000..f48d3ef03 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/SUMMARY.md @@ -0,0 +1,10 @@ +- tests + - generation + - markdown + - functions + - documented + - [MyClass1](tests/generation/markdown/functions/documented/MyClass1.md) + - [myFunction1](tests/generation/markdown/functions/documented/myFunction1.md) + - [myFunction2](tests/generation/markdown/functions/documented/myFunction2.md) + - [myFunction3](tests/generation/markdown/functions/documented/myFunction3.md) + - [myFunction4](tests/generation/markdown/functions/documented/myFunction4.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/MyClass1.md new file mode 100644 index 000000000..8a07479f8 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/MyClass1.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.functions.documented.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="41" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction1.md new file mode 100644 index 000000000..abda30a29 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction1.md @@ -0,0 +1,9 @@ +# `#!sds fun` myFunction1 {#tests.generation.markdown.functions.documented.myFunction1 data-toc-label='myFunction1'} + +Description of myFunction1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="7" + fun myFunction1() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction2.md new file mode 100644 index 000000000..d11f154e4 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction2.md @@ -0,0 +1,29 @@ +# `#!sds fun` myFunction2 {#tests.generation.markdown.functions.documented.myFunction2 data-toc-label='myFunction2'} + +Description of myFunction2. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds TypeParam1` | - | - | +| `param2` | `#!sds TypeParam2` | - | - | +| `param3` | `#!sds TypeParam3` | - | - | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `TypeParam1` | `#!sds Any?` | Description of TypeParam1. | - | +| `TypeParam2` | [`MyClass1`][tests.generation.markdown.functions.documented.MyClass1] | Description of TypeParam2. | - | +| `TypeParam3` | `#!sds Any?` | Description of TypeParam3. | [`MyClass1`][tests.generation.markdown.functions.documented.MyClass1] | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="17" + fun myFunction2( + param1: TypeParam1, + param2: TypeParam2, + param3: TypeParam3, + ) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction3.md new file mode 100644 index 000000000..e535a7f67 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction3.md @@ -0,0 +1,16 @@ +# `#!sds fun` myFunction3 {#tests.generation.markdown.functions.documented.myFunction3 data-toc-label='myFunction3'} + +Description of myFunction3. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | [`MyClass1`][tests.generation.markdown.functions.documented.MyClass1] | Description of param1. | - | +| `param2` | `#!sds Float` | Description of param2. | `#!sds 1.0` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="30" + fun myFunction3(param1: MyClass1, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction4.md new file mode 100644 index 000000000..b6c807220 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/generated/tests/generation/markdown/functions/documented/myFunction4.md @@ -0,0 +1,16 @@ +# `#!sds fun` myFunction4 {#tests.generation.markdown.functions.documented.myFunction4 data-toc-label='myFunction4'} + +Description of myFunction4. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`MyClass1`][tests.generation.markdown.functions.documented.MyClass1] | Description of result1. | +| `result2` | `#!sds Float` | Description of result2. | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="39" + fun myFunction4() -> (result1: MyClass1, result2: Float) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/main.sdsstub new file mode 100644 index 000000000..a99c19a16 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/documented/main.sdsstub @@ -0,0 +1,41 @@ +package tests.generation.markdown.functions.documented + +/** + * Description of myFunction1. + */ +@Pure +fun myFunction1() + +/** + * Description of myFunction2. + * + * @typeParam TypeParam1 Description of TypeParam1. + * @typeParam TypeParam2 Description of TypeParam2. + * @typeParam TypeParam3 Description of TypeParam3. + */ +@Pure +fun myFunction2( + param1: TypeParam1, + param2: TypeParam2, + param3: TypeParam3, +) + +/** + * Description of myFunction3. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ +@Pure +fun myFunction3(param1: MyClass1, param2: Float = 1.0) + +/** + * Description of myFunction4. + * + * @result result1 Description of result1. + * @result result2 Description of result2. + */ +@Pure +fun myFunction4() -> (result1: MyClass1, result2: Float) + +class MyClass1 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..799866f4b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - functions + - experimental + - [myFunction1](tests/generation/markdown/functions/experimental/myFunction1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/tests/generation/markdown/functions/experimental/myFunction1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/tests/generation/markdown/functions/experimental/myFunction1.md new file mode 100644 index 000000000..1a94ea99f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/generated/tests/generation/markdown/functions/experimental/myFunction1.md @@ -0,0 +1,7 @@ +# :test_tube:{ title="Experimental" } `#!sds fun` myFunction1 {#tests.generation.markdown.functions.experimental.myFunction1 data-toc-label='myFunction1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + fun myFunction1() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/main.sdsstub new file mode 100644 index 000000000..0287fff32 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/experimental/main.sdsstub @@ -0,0 +1,5 @@ +package tests.generation.markdown.functions.experimental + +@Experimental +@Pure +fun myFunction1() diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..9fe4b6007 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/SUMMARY.md @@ -0,0 +1,9 @@ +- tests + - generation + - markdown + - functions + - undocumented + - [myFunction1](tests/generation/markdown/functions/undocumented/myFunction1.md) + - [myFunction2](tests/generation/markdown/functions/undocumented/myFunction2.md) + - [myFunction3](tests/generation/markdown/functions/undocumented/myFunction3.md) + - [myFunction4](tests/generation/markdown/functions/undocumented/myFunction4.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction1.md new file mode 100644 index 000000000..00dd468a7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction1.md @@ -0,0 +1,7 @@ +# `#!sds fun` myFunction1 {#tests.generation.markdown.functions.undocumented.myFunction1 data-toc-label='myFunction1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + fun myFunction1() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction2.md new file mode 100644 index 000000000..465fe85a3 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction2.md @@ -0,0 +1,27 @@ +# `#!sds fun` myFunction2 {#tests.generation.markdown.functions.undocumented.myFunction2 data-toc-label='myFunction2'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds TypeParam1` | - | - | +| `param2` | `#!sds TypeParam2` | - | - | +| `param3` | `#!sds TypeParam3` | - | - | + +**Type parameters:** + +| Name | Upper Bound | Description | Default | +|------|-------------|-------------|---------| +| `TypeParam1` | `#!sds Any?` | - | - | +| `TypeParam2` | `#!sds Int` | - | - | +| `TypeParam3` | `#!sds Any?` | - | `#!sds Int` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="7" + fun myFunction2( + param1: TypeParam1, + param2: TypeParam2, + param3: TypeParam3, + ) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction3.md new file mode 100644 index 000000000..26b3fcacc --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction3.md @@ -0,0 +1,14 @@ +# `#!sds fun` myFunction3 {#tests.generation.markdown.functions.undocumented.myFunction3 data-toc-label='myFunction3'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | - | - | +| `param2` | `#!sds Float` | - | `#!sds 1.0` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="14" + fun myFunction3(param1: Int, param2: Float = 1.0) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction4.md new file mode 100644 index 000000000..94d18d52d --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/generated/tests/generation/markdown/functions/undocumented/myFunction4.md @@ -0,0 +1,14 @@ +# `#!sds fun` myFunction4 {#tests.generation.markdown.functions.undocumented.myFunction4 data-toc-label='myFunction4'} + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | `#!sds Int` | - | +| `result2` | `#!sds Float` | - | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="17" + fun myFunction4() -> (result1: Int, result2: Float) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/main.sdsstub new file mode 100644 index 000000000..23eccda89 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/functions/undocumented/main.sdsstub @@ -0,0 +1,17 @@ +package tests.generation.markdown.functions.undocumented + +@Pure +fun myFunction1() + +@Pure +fun myFunction2( + param1: TypeParam1, + param2: TypeParam2, + param3: TypeParam3, +) + +@Pure +fun myFunction3(param1: Int, param2: Float = 1.0) + +@Pure +fun myFunction4() -> (result1: Int, result2: Float) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/SUMMARY.md new file mode 100644 index 000000000..b0735de32 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - linkTag + - [MyClass1](tests/generation/markdown/linkTag/MyClass1.md) + - [MyClass2](tests/generation/markdown/linkTag/MyClass2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass1.md new file mode 100644 index 000000000..44d23c830 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass1.md @@ -0,0 +1,17 @@ +# `#!sds class` MyClass1 {#tests.generation.markdown.linkTag.MyClass1 data-toc-label='MyClass1'} + +Description of MyClass1. +[MyClass2][tests.generation.markdown.linkTag.MyClass2]. +Broken. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | Description of param1. [MyClass2][tests.generation.markdown.linkTag.MyClass2]. | - | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="10" + class MyClass1(param1: Int) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass2.md new file mode 100644 index 000000000..285cde045 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/generated/tests/generation/markdown/linkTag/MyClass2.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass2 {#tests.generation.markdown.linkTag.MyClass2 data-toc-label='MyClass2'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="12" + class MyClass2 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/main.sdsstub new file mode 100644 index 000000000..7a6eca848 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/link tag/main.sdsstub @@ -0,0 +1,12 @@ +package tests.generation.markdown.linkTag + +/** + * Description of MyClass1. + * {@link MyClass2}. + * {@link Broken}. + * + * @param param1 Description of param1. {@link MyClass2}. + */ +class MyClass1(param1: Int) + +class MyClass2 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/SUMMARY.md new file mode 100644 index 000000000..f4efa8aac --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - multiline + - [MyClass1](tests/generation/markdown/multiline/MyClass1.md) + - [MyClass2](tests/generation/markdown/multiline/MyClass2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass1.md new file mode 100644 index 000000000..564f32bd7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass1.md @@ -0,0 +1,13 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.multiline.MyClass1 data-toc-label='MyClass1'} + +Description of MyClass1. + +$$ +n +$$ + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="10" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass2.md new file mode 100644 index 000000000..e0426f29f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/generated/tests/generation/markdown/multiline/MyClass2.md @@ -0,0 +1,16 @@ +# `#!sds class` MyClass2 {#tests.generation.markdown.multiline.MyClass2 data-toc-label='MyClass2'} + +Description of MyClass2. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | Description of param1. That spans multiple lines. | - | +| `param2` | `#!sds Int` | Description of param2. That spans multiple lines. | - | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="26" + class MyClass2(param1: Int, param2: Int) + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/main.sdsstub new file mode 100644 index 000000000..6f3c3d22f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/multiline/main.sdsstub @@ -0,0 +1,26 @@ +package tests.generation.markdown.multiline + +/** + * Description of MyClass1. + * + * $$ + * n + * $$ + */ +class MyClass1 + +/** + * Description of MyClass2. + * + * @param param1 Description of param1. + * That spans + * multiple lines. + * + * @param param2 + * Description of param2. + * That spans + * multiple lines. + * + * Some additional text. + */ +class MyClass2(param1: Int, param2: Int) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/SUMMARY.md new file mode 100644 index 000000000..f585680b7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/SUMMARY.md @@ -0,0 +1,5 @@ +- tests + - generation + - markdown + - pipelines + - [mySegment1](tests/generation/markdown/pipelines/mySegment1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/tests/generation/markdown/pipelines/mySegment1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/tests/generation/markdown/pipelines/mySegment1.md new file mode 100644 index 000000000..f917e5129 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/generated/tests/generation/markdown/pipelines/mySegment1.md @@ -0,0 +1,7 @@ +# `#!sds segment` mySegment1 {#tests.generation.markdown.pipelines.mySegment1 data-toc-label='mySegment1'} + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="6" + segment mySegment1() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/main.sdspipe b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/main.sdspipe new file mode 100644 index 000000000..3000de1e1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/pipelines/main.sdspipe @@ -0,0 +1,6 @@ +package tests.generation.markdown.pipelines + +pipeline myPipeline1 {} + +// The snapshot test does not work for an empty SUMMARY file in CI, so we add this dummy. +segment mySegment1() {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..784f99466 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - schemas + - deprecated + - [MySchema1](tests/generation/markdown/schemas/deprecated/MySchema1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/tests/generation/markdown/schemas/deprecated/MySchema1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/tests/generation/markdown/schemas/deprecated/MySchema1.md new file mode 100644 index 000000000..b188a258e --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/generated/tests/generation/markdown/schemas/deprecated/MySchema1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds schema` MySchema1 {#tests.generation.markdown.schemas.deprecated.MySchema1 data-toc-label='MySchema1'} + +!!! warning "Deprecated" + + This schema is deprecated. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + schema MySchema1 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/main.sdsstub new file mode 100644 index 000000000..0e63b5dbd --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/deprecated/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.schemas.deprecated + +@Deprecated +schema MySchema1 {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/SUMMARY.md new file mode 100644 index 000000000..115863e0c --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/SUMMARY.md @@ -0,0 +1,8 @@ +- tests + - generation + - markdown + - schemas + - documented + - [MyClass](tests/generation/markdown/schemas/documented/MyClass.md) + - [MySchema1](tests/generation/markdown/schemas/documented/MySchema1.md) + - [MySchema2](tests/generation/markdown/schemas/documented/MySchema2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MyClass.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MyClass.md new file mode 100644 index 000000000..ad1dca6e1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MyClass.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass {#tests.generation.markdown.schemas.documented.MyClass data-toc-label='MyClass'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="18" + class MyClass + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema1.md new file mode 100644 index 000000000..d500f35f3 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema1.md @@ -0,0 +1,9 @@ +# `#!sds schema` MySchema1 {#tests.generation.markdown.schemas.documented.MySchema1 data-toc-label='MySchema1'} + +Description of MySchema1. + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="8" + schema MySchema1 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema2.md new file mode 100644 index 000000000..307011b5a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/generated/tests/generation/markdown/schemas/documented/MySchema2.md @@ -0,0 +1,19 @@ +# `#!sds schema` MySchema2 {#tests.generation.markdown.schemas.documented.MySchema2 data-toc-label='MySchema2'} + +Description of MySchema2. + +**Columns:** + +| Name | Type | +|------|------| +| `column1` | [`MyClass`][tests.generation.markdown.schemas.documented.MyClass] | +| `column2` | `#!sds Int` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="13" + schema MySchema2 { + "column1": MyClass, + "column2": Int, + } + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/main.sdsstub new file mode 100644 index 000000000..c7d53464b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/documented/main.sdsstub @@ -0,0 +1,18 @@ +package tests.generation.markdown.schemas.documented + +/** + * Description of MySchema1. + * + * @since 1.0.0 + */ +schema MySchema1 {} + +/** + * Description of MySchema2. + */ +schema MySchema2 { + "column1": MyClass, + "column2": Int, +} + +class MyClass diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..c45ad1a7a --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - schemas + - experimental + - [MySchema1](tests/generation/markdown/schemas/experimental/MySchema1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/tests/generation/markdown/schemas/experimental/MySchema1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/tests/generation/markdown/schemas/experimental/MySchema1.md new file mode 100644 index 000000000..c86d1a290 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/generated/tests/generation/markdown/schemas/experimental/MySchema1.md @@ -0,0 +1,7 @@ +# :test_tube:{ title="Experimental" } `#!sds schema` MySchema1 {#tests.generation.markdown.schemas.experimental.MySchema1 data-toc-label='MySchema1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="4" + schema MySchema1 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/main.sdsstub new file mode 100644 index 000000000..d6d6700d6 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/experimental/main.sdsstub @@ -0,0 +1,4 @@ +package tests.generation.markdown.schemas.experimental + +@Experimental +schema MySchema1 {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..86305c0f1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/SUMMARY.md @@ -0,0 +1,7 @@ +- tests + - generation + - markdown + - schemas + - undocumented + - [MySchema1](tests/generation/markdown/schemas/undocumented/MySchema1.md) + - [MySchema2](tests/generation/markdown/schemas/undocumented/MySchema2.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema1.md new file mode 100644 index 000000000..bf0a30ec4 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema1.md @@ -0,0 +1,7 @@ +# `#!sds schema` MySchema1 {#tests.generation.markdown.schemas.undocumented.MySchema1 data-toc-label='MySchema1'} + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="3" + schema MySchema1 {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema2.md new file mode 100644 index 000000000..c4eff1ed5 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/generated/tests/generation/markdown/schemas/undocumented/MySchema2.md @@ -0,0 +1,17 @@ +# `#!sds schema` MySchema2 {#tests.generation.markdown.schemas.undocumented.MySchema2 data-toc-label='MySchema2'} + +**Columns:** + +| Name | Type | +|------|------| +| `column1` | `#!sds String` | +| `column2` | `#!sds Int` | + +??? quote "Source code in `main.sdsstub`" + + ```sds linenums="5" + schema MySchema2 { + "column1": String, + "column2": Int + } + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/main.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/main.sdsstub new file mode 100644 index 000000000..51e66b94b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/schemas/undocumented/main.sdsstub @@ -0,0 +1,8 @@ +package tests.generation.markdown.schemas.undocumented + +schema MySchema1 {} + +schema MySchema2 { + "column1": String, + "column2": Int +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/SUMMARY.md new file mode 100644 index 000000000..b5e0ef903 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - segments + - deprecated + - [mySegment1](tests/generation/markdown/segments/deprecated/mySegment1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/tests/generation/markdown/segments/deprecated/mySegment1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/tests/generation/markdown/segments/deprecated/mySegment1.md new file mode 100644 index 000000000..4da5c33b6 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/generated/tests/generation/markdown/segments/deprecated/mySegment1.md @@ -0,0 +1,11 @@ +# :warning:{ title="Deprecated" } `#!sds segment` mySegment1 {#tests.generation.markdown.segments.deprecated.mySegment1 data-toc-label='mySegment1'} + +!!! warning "Deprecated" + + This segment is deprecated. + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="4" + segment mySegment1() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/main.sdspipe b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/main.sdspipe new file mode 100644 index 000000000..310a4c89f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/deprecated/main.sdspipe @@ -0,0 +1,4 @@ +package tests.generation.markdown.segments.deprecated + +@Deprecated +segment mySegment1() {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/SUMMARY.md new file mode 100644 index 000000000..01e7655cc --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/SUMMARY.md @@ -0,0 +1,10 @@ +- tests + - generation + - markdown + - segments + - documented + - [MyClass1](tests/generation/markdown/segments/documented/MyClass1.md) + - [mySegment1](tests/generation/markdown/segments/documented/mySegment1.md) + - [mySegment3](tests/generation/markdown/segments/documented/mySegment3.md) + - [mySegment4](tests/generation/markdown/segments/documented/mySegment4.md) + - [mySegment5](tests/generation/markdown/segments/documented/mySegment5.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/MyClass1.md new file mode 100644 index 000000000..b2cfa3953 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/MyClass1.md @@ -0,0 +1,7 @@ +# `#!sds class` MyClass1 {#tests.generation.markdown.segments.documented.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `resources.sdsstub`" + + ```sds linenums="3" + class MyClass1() + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment1.md new file mode 100644 index 000000000..8e4f44ea5 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment1.md @@ -0,0 +1,9 @@ +# `#!sds segment` mySegment1 {#tests.generation.markdown.segments.documented.mySegment1 data-toc-label='mySegment1'} + +Description of mySegment1. + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="6" + segment mySegment1() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment3.md new file mode 100644 index 000000000..9b8dc46a0 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment3.md @@ -0,0 +1,9 @@ +# `#!sds internal segment` mySegment3 {#tests.generation.markdown.segments.documented.mySegment3 data-toc-label='mySegment3'} + +Description of mySegment3. + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="16" + internal segment mySegment3() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment4.md new file mode 100644 index 000000000..5676dce55 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment4.md @@ -0,0 +1,16 @@ +# `#!sds segment` mySegment4 {#tests.generation.markdown.segments.documented.mySegment4 data-toc-label='mySegment4'} + +Description of mySegment3. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | [`MyClass1`][tests.generation.markdown.segments.documented.MyClass1] | Description of param1. | - | +| `param2` | `#!sds Float` | Description of param2. | `#!sds 1.0` | + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="24" + segment mySegment4(param1: MyClass1, param2: Float = 1.0) {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment5.md new file mode 100644 index 000000000..80859c5ea --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/generated/tests/generation/markdown/segments/documented/mySegment5.md @@ -0,0 +1,19 @@ +# `#!sds segment` mySegment5 {#tests.generation.markdown.segments.documented.mySegment5 data-toc-label='mySegment5'} + +Description of mySegment4. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | [`MyClass1`][tests.generation.markdown.segments.documented.MyClass1] | Description of result1. | +| `result2` | `#!sds Float` | Description of result2. | + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="32" + segment mySegment5() -> (result1: MyClass1, result2: Float) { + yield result1 = MyClass1(); + yield result2 = 2.0; + } + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/main.sdspipe b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/main.sdspipe new file mode 100644 index 000000000..01ad7796e --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/main.sdspipe @@ -0,0 +1,35 @@ +package tests.generation.markdown.segments.documented + +/** + * Description of mySegment1. + */ +segment mySegment1() {} + +/** + * Description of mySegment2. + */ +private segment mySegment2() {} + +/** + * Description of mySegment3. + */ +internal segment mySegment3() {} + +/** + * Description of mySegment3. + * + * @param param1 Description of param1. + * @param param2 Description of param2. + */ +segment mySegment4(param1: MyClass1, param2: Float = 1.0) {} + +/** + * Description of mySegment4. + * + * @result result1 Description of result1. + * @result result2 Description of result2. + */ +segment mySegment5() -> (result1: MyClass1, result2: Float) { + yield result1 = MyClass1(); + yield result2 = 2.0; +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/resources.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/resources.sdsstub new file mode 100644 index 000000000..304da9844 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/documented/resources.sdsstub @@ -0,0 +1,3 @@ +package tests.generation.markdown.segments.documented + +class MyClass1() diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/SUMMARY.md new file mode 100644 index 000000000..57ae508e2 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/SUMMARY.md @@ -0,0 +1,6 @@ +- tests + - generation + - markdown + - segments + - experimental + - [mySegment1](tests/generation/markdown/segments/experimental/mySegment1.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/tests/generation/markdown/segments/experimental/mySegment1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/tests/generation/markdown/segments/experimental/mySegment1.md new file mode 100644 index 000000000..7204cd239 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/generated/tests/generation/markdown/segments/experimental/mySegment1.md @@ -0,0 +1,7 @@ +# :test_tube:{ title="Experimental" } `#!sds segment` mySegment1 {#tests.generation.markdown.segments.experimental.mySegment1 data-toc-label='mySegment1'} + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="4" + segment mySegment1() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/main.sdspipe b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/main.sdspipe new file mode 100644 index 000000000..96c8f001c --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/experimental/main.sdspipe @@ -0,0 +1,4 @@ +package tests.generation.markdown.segments.experimental + +@Experimental +segment mySegment1() {} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/SUMMARY.md new file mode 100644 index 000000000..40a3080d2 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/SUMMARY.md @@ -0,0 +1,9 @@ +- tests + - generation + - markdown + - segments + - undocumented + - [mySegment1](tests/generation/markdown/segments/undocumented/mySegment1.md) + - [mySegment3](tests/generation/markdown/segments/undocumented/mySegment3.md) + - [mySegment4](tests/generation/markdown/segments/undocumented/mySegment4.md) + - [mySegment5](tests/generation/markdown/segments/undocumented/mySegment5.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment1.md new file mode 100644 index 000000000..b4d7b353c --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment1.md @@ -0,0 +1,7 @@ +# `#!sds segment` mySegment1 {#tests.generation.markdown.segments.undocumented.mySegment1 data-toc-label='mySegment1'} + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="3" + segment mySegment1() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment3.md new file mode 100644 index 000000000..c36cf7dbe --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment3.md @@ -0,0 +1,7 @@ +# `#!sds internal segment` mySegment3 {#tests.generation.markdown.segments.undocumented.mySegment3 data-toc-label='mySegment3'} + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="7" + internal segment mySegment3() {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment4.md new file mode 100644 index 000000000..c12f57506 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment4.md @@ -0,0 +1,14 @@ +# `#!sds segment` mySegment4 {#tests.generation.markdown.segments.undocumented.mySegment4 data-toc-label='mySegment4'} + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `param1` | `#!sds Int` | - | - | +| `param2` | `#!sds Float` | - | `#!sds 1.0` | + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="9" + segment mySegment4(param1: Int, param2: Float = 1.0) {} + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment5.md new file mode 100644 index 000000000..411cf4f51 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/generated/tests/generation/markdown/segments/undocumented/mySegment5.md @@ -0,0 +1,17 @@ +# `#!sds segment` mySegment5 {#tests.generation.markdown.segments.undocumented.mySegment5 data-toc-label='mySegment5'} + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `result1` | `#!sds Int` | - | +| `result2` | `#!sds Float` | - | + +??? quote "Source code in `main.sdspipe`" + + ```sds linenums="11" + segment mySegment5() -> (result1: Int, result2: Float) { + yield result1 = 1; + yield result2 = 2.0; + } + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/main.sdspipe b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/main.sdspipe new file mode 100644 index 000000000..89cc9eb96 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/segments/undocumented/main.sdspipe @@ -0,0 +1,14 @@ +package tests.generation.markdown.segments.undocumented + +segment mySegment1() {} + +private segment mySegment2() {} + +internal segment mySegment3() {} + +segment mySegment4(param1: Int, param2: Float = 1.0) {} + +segment mySegment5() -> (result1: Int, result2: Float) { + yield result1 = 1; + yield result2 = 2.0; +} diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/SUMMARY.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/SUMMARY.md new file mode 100644 index 000000000..449a3de27 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/SUMMARY.md @@ -0,0 +1,12 @@ +- tests + - generation + - markdown + - summary + - package1 + - subpackage + - [MyClass5](tests/generation/markdown/summary/package1/subpackage/MyClass5.md) + - [MyClass1](tests/generation/markdown/summary/package1/MyClass1.md) + - [MyClass2](tests/generation/markdown/summary/package1/MyClass2.md) + - [MyClass3](tests/generation/markdown/summary/package1/MyClass3.md) + - package2 + - [MyClass4](tests/generation/markdown/summary/package2/MyClass4.md) diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass1.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass1.md new file mode 100644 index 000000000..1fda326c7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass1.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass1 {#tests.generation.markdown.summary.package1.MyClass1 data-toc-label='MyClass1'} + +??? quote "Source code in `package1_module1.sdsstub`" + + ```sds linenums="3" + class MyClass1 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass2.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass2.md new file mode 100644 index 000000000..4e67185b7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass2.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass2 {#tests.generation.markdown.summary.package1.MyClass2 data-toc-label='MyClass2'} + +??? quote "Source code in `package1_module1.sdsstub`" + + ```sds linenums="5" + class MyClass2 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass3.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass3.md new file mode 100644 index 000000000..9ae872fd1 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/MyClass3.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass3 {#tests.generation.markdown.summary.package1.MyClass3 data-toc-label='MyClass3'} + +??? quote "Source code in `package1_module2.sdsstub`" + + ```sds linenums="3" + class MyClass3 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/subpackage/MyClass5.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/subpackage/MyClass5.md new file mode 100644 index 000000000..66bb769fd --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package1/subpackage/MyClass5.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass5 {#tests.generation.markdown.summary.package1.subpackage.MyClass5 data-toc-label='MyClass5'} + +??? quote "Source code in `package3.sdsstub`" + + ```sds linenums="3" + class MyClass5 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package2/MyClass4.md b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package2/MyClass4.md new file mode 100644 index 000000000..c027b648f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/generated/tests/generation/markdown/summary/package2/MyClass4.md @@ -0,0 +1,7 @@ +# `#!sds abstract class` MyClass4 {#tests.generation.markdown.summary.package2.MyClass4 data-toc-label='MyClass4'} + +??? quote "Source code in `package2.sdsstub`" + + ```sds linenums="3" + class MyClass4 + ``` diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module1.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module1.sdsstub new file mode 100644 index 000000000..9f4b38d6e --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module1.sdsstub @@ -0,0 +1,5 @@ +package tests.generation.markdown.summary.package1 + +class MyClass1 + +class MyClass2 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module2.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module2.sdsstub new file mode 100644 index 000000000..f286c201b --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package1_module2.sdsstub @@ -0,0 +1,3 @@ +package tests.generation.markdown.summary.package1 + +class MyClass3 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package2.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package2.sdsstub new file mode 100644 index 000000000..26306e586 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package2.sdsstub @@ -0,0 +1,3 @@ +package tests.generation.markdown.summary.package2 + +class MyClass4 diff --git a/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package3.sdsstub b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package3.sdsstub new file mode 100644 index 000000000..3038d9da2 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/markdown/summary/package3.sdsstub @@ -0,0 +1,3 @@ +package tests.generation.markdown.summary.package1.subpackage + +class MyClass5 diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/generated/tests/generator/emptyPipeline/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty pipeline/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty pipeline/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/generated/tests/generator/emptySegment/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/empty segment/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/empty segment/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/generated/tests/generator/parameterWithPythonName/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/parameter with python name/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/parameter with python name/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/generated/tests/generator/pipelineWithPythonName/gen_input_test_pipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/pipeline with python name/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/pipeline with python name/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/generated/tests/generator/segmentWithPythonName/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/segment with python name/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/segment with python name/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test1.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test1.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test1.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test1.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test2.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test2.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test2.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/generated/tests/generator/twoPipelines/gen_input_test2.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two pipelines/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two pipelines/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/generated/tests/generator/twoSegments/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/declarations/two segments/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/declarations/two segments/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/declarations/two segments/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/generated/tests/generator/blockLambdaResult/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda result/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda result/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/generated/tests/generator/blockLambda/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/block lambda/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/call/generated/tests/generator/call/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/call/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/call/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/constant/generated/tests/generator/constant/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/generated/tests/generator/constant/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/constant/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/constant/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/constant/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/generated/tests/generator/enumVariantCall/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/enum variant call/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/enum variant call/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/generated/tests/generator/expressionLambda/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/expression lambda/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/expression lambda/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/generated/tests/generator/indexedAccess/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/indexed access/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/indexed access/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/generated/tests/generator/infixOperation/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/generated/tests/generator/infixOperation/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/infix operation/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/infix operation/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/lists/generated/tests/generator/lists/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/generated/tests/generator/lists/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/lists/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/lists/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/lists/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/literals/generated/tests/generator/literals/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/generated/tests/generator/literals/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/literals/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/literals/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/literals/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/maps/generated/tests/generator/maps/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/generated/tests/generator/maps/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/maps/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/maps/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/maps/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/member access/generated/tests/generator/memberAccess/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/member access/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/member access/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/generated/tests/generator/parenthesizedExpression/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/parenthesized expression/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/parenthesized expression/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/generated/tests/generator/prefixOperation/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/prefix operation/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/prefix operation/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/reference/generated/tests/generator/reference/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/generated/tests/generator/reference/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/reference/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/reference/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/reference/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/side effects/generated/tests/generator/sideEffects/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/generated/tests/generator/sideEffects/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/side effects/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/side effects/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/side effects/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/template string/generated/tests/generator/templateString/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/generated/tests/generator/templateString/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/expressions/template string/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/expressions/template string/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/expressions/template string/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/context different package.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/context different package.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/context different package.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/context different package.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/context package with python module.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/context package with python module.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/context package with python module.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/context package with python module.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/context same package.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/context same package.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/context same package.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/context same package.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_context_same_package.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_context_same_package.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_context_same_package.py rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_context_same_package.py diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_context_same_package.py.map b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_context_same_package.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_context_same_package.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_context_same_package.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/generated/tests/generator/imports/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/generated/tests/generator/imports/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/general/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/imports/general/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/general/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/imports/general/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/context different package.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/context different package.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/context different package.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/context different package.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/context package with python module.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/context package with python module.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/context package with python module.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/context package with python module.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/generated/tests/generator/wildcard/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/generated/tests/generator/wildcard/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/imports/wildcard/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/imports/wildcard/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/imports/wildcard/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file constant/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency file parameter/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/impure dependency/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/pure dependency/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/partial/redundant impurity/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/python module/generated/special_module/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/python module/generated/special_module/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/python module/generated/special_module/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/python module/generated/special_module/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/python module/generated/special_module/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/python module/generated/special_module/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/python module/generated/special_module/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/python module/generated/special_module/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/python module/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/python module/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/python module/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/python module/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/generated/tests/generator/callWithRunnerIntegration/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/call/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/call/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/expressions/member access/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context different package.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context different package.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context different package.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context different package.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context package with python module.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context package with python module.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context package with python module.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context package with python module.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context same package.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context same package.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/context same package.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/context same package.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_context_same_package.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/generated/tests/generator/importsWithRunnerIntegration/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/general/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/general/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/context different package.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/context different package.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/context different package.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/context different package.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/context package with python module.sdsstub b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/context package with python module.sdsstub similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/context package with python module.sdsstub rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/context package with python module.sdsstub diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input_test.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input_test.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input_test.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/generated/tests/generator/wildcardWithRunnerIntegration/gen_input_test.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/imports/wildcard/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/imports/wildcard/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/runner integration/statements/assignment/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/assignment/generated/tests/generator/assignment/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/generated/tests/generator/assignment/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/assignment/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/assignment/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/statements/assignment/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/expression statement/generated/tests/generator/expressionStatement/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/generated/tests/generator/expressionStatement/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/expression statement/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/expression statement/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/statements/expression statement/input.sdstest diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py.map similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py.map rename to packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input.py.map diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input_testPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input_testPipeline.py similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input_testPipeline.py rename to packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/generated/tests/generator/statementWithoutEffect/gen_input_testPipeline.py diff --git a/packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/input.sdstest b/packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/input.sdstest similarity index 100% rename from packages/safe-ds-lang/tests/resources/generation/statements/statement without effect/input.sdstest rename to packages/safe-ds-lang/tests/resources/generation/python/statements/statement without effect/input.sdstest