diff --git a/src/safeds_stubgen/stubs_generator/_generate_stubs.py b/src/safeds_stubgen/stubs_generator/_generate_stubs.py index 56f04186..3423c31d 100644 --- a/src/safeds_stubgen/stubs_generator/_generate_stubs.py +++ b/src/safeds_stubgen/stubs_generator/_generate_stubs.py @@ -23,6 +23,9 @@ from safeds_stubgen.docstring_parsing import AttributeDocstring, ClassDocstring, FunctionDocstring +INDENTATION = " " + + class NamingConvention(IntEnum): PYTHON = 1 SAFE_DS = 2 @@ -239,7 +242,7 @@ def _create_imports_string(self) -> str: return f"\n{import_string}\n" def _create_class_string(self, class_: Class, class_indentation: str = "") -> str: - inner_indentations = class_indentation + "\t" + inner_indentations = class_indentation + INDENTATION # Constructor parameter if class_.is_abstract: @@ -633,7 +636,7 @@ def _create_parameter_string( f"{name_annotation}{camel_case_name}{type_string}{param_value}", ) - inner_indentations = indentations + "\t" + inner_indentations = indentations + INDENTATION if parameters_data: inner_param_data = f",\n{inner_indentations}".join(parameters_data) return f"\n{inner_indentations}{inner_param_data}\n{indentations}" @@ -664,7 +667,7 @@ def _create_enum_string(self, enum_data: Enum) -> str: # Check if the name is a Safe-DS keyword and escape it camel_case_name = _replace_if_safeds_keyword(camel_case_name) - enum_text += f"\t{annotation}{camel_case_name}\n" + enum_text += f"{INDENTATION}{annotation}{camel_case_name}\n" return f"{enum_signature} {{{enum_text}}}" return enum_signature diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[abstract_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[abstract_module].sdsstub index 2678b679..9135ced1 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[abstract_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[abstract_module].sdsstub @@ -2,30 +2,30 @@ package tests.data.variousModulesPackage.abstractModule class AbstractModuleClass { - @PythonName("abstract_property_method") attr abstractPropertyMethod: union + @PythonName("abstract_property_method") attr abstractPropertyMethod: union - // TODO Result type information missing. - @Pure - @PythonName("abstract_method") - fun abstractMethod() + // TODO Result type information missing. + @Pure + @PythonName("abstract_method") + fun abstractMethod() - // TODO List type has to many type arguments. - @Pure - @PythonName("abstract_method_params") - fun abstractMethodParams( - @PythonName("param_1") param1: Int, - @PythonName("param_2") param2: Boolean = false, - @PythonName("param_3") param3: Boolean = true - ) -> result1: List + // TODO List type has to many type arguments. + @Pure + @PythonName("abstract_method_params") + fun abstractMethodParams( + @PythonName("param_1") param1: Int, + @PythonName("param_2") param2: Boolean = false, + @PythonName("param_3") param3: Boolean = true + ) -> result1: List - // TODO Result type information missing. - @Pure - @PythonName("abstract_static_method") - static fun abstractStaticMethod() + // TODO Result type information missing. + @Pure + @PythonName("abstract_static_method") + static fun abstractStaticMethod() - @Pure - @PythonName("abstract_static_method_params") - static fun abstractStaticMethodParams( - param: Float - ) -> result1: Boolean + @Pure + @PythonName("abstract_static_method_params") + static fun abstractStaticMethodParams( + param: Float + ) -> result1: Boolean } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_1].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_1].sdsstub index e17ad1ff..cd9c6a53 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_1].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_1].sdsstub @@ -7,20 +7,20 @@ from tests.data.variousModulesPackage.aliasing.aliasingModule3 import ImportMeAl class AliasingModuleClassB() class AliasingModuleClassC() { - @PythonName("typed_alias_attr") - static attr typedAliasAttr: AliasingModuleClassB - // TODO An internal class must not be used as a type in a public class. - @PythonName("infer_alias_attr") - static attr inferAliasAttr: _AliasingModuleClassA - @PythonName("typed_alias_attr2") - static attr typedAliasAttr2: AliasingModule2ClassA - @PythonName("infer_alias_attr2") - static attr inferAliasAttr2: AliasingModule2ClassA - // TODO Attribute has no type information. - @PythonName("infer_alias_attr3") - static attr inferAliasAttr3 - // TODO An internal class must not be used as a type in a public class. - // TODO List type has to many type arguments. - @PythonName("alias_list") - static attr aliasList: List, AliasingModule2ClassA, ImportMeAliasingModuleClass> + @PythonName("typed_alias_attr") + static attr typedAliasAttr: AliasingModuleClassB + // TODO An internal class must not be used as a type in a public class. + @PythonName("infer_alias_attr") + static attr inferAliasAttr: _AliasingModuleClassA + @PythonName("typed_alias_attr2") + static attr typedAliasAttr2: AliasingModule2ClassA + @PythonName("infer_alias_attr2") + static attr inferAliasAttr2: AliasingModule2ClassA + // TODO Attribute has no type information. + @PythonName("infer_alias_attr3") + static attr inferAliasAttr3 + // TODO An internal class must not be used as a type in a public class. + // TODO List type has to many type arguments. + @PythonName("alias_list") + static attr aliasList: List, AliasingModule2ClassA, ImportMeAliasingModuleClass> } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_2].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_2].sdsstub index 831cbcc1..55a43ac9 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_2].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_2].sdsstub @@ -10,11 +10,11 @@ class AliasingModuleClassB() class ImportMeAliasingModuleClass() class AliasingModuleClassC() { - @PythonName("typed_alias_attr") - static attr typedAliasAttr: AliasingModuleClassB - @PythonName("typed_alias_infer") - static attr typedAliasInfer: AliasingModuleClassC - // TODO List type has to many type arguments. - @PythonName("alias_list") - static attr aliasList: List, ImportMeAliasingModuleClass> + @PythonName("typed_alias_attr") + static attr typedAliasAttr: AliasingModuleClassB + @PythonName("typed_alias_infer") + static attr typedAliasInfer: AliasingModuleClassC + // TODO List type has to many type arguments. + @PythonName("alias_list") + static attr aliasList: List, ImportMeAliasingModuleClass> } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_3].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_3].sdsstub index df5f6a1f..feceb92f 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_3].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[aliasing_module_3].sdsstub @@ -4,9 +4,9 @@ package tests.data.variousModulesPackage.aliasing.aliasingModule3 from tests.data.variousModulesPackage.aliasing.aliasingModule2 import ImportMeAliasingModuleClass class ImportMeAliasingModuleClass() { - @PythonName("import_alias_attr") - static attr importAliasAttr: ImportMeAliasingModuleClass - // TODO List type has to many type arguments. - @PythonName("alias_list") - static attr aliasList: List + @PythonName("import_alias_attr") + static attr importAliasAttr: ImportMeAliasingModuleClass + // TODO List type has to many type arguments. + @PythonName("alias_list") + static attr aliasList: List } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[attribute_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[attribute_module].sdsstub index eec870ab..e39e7027 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[attribute_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[attribute_module].sdsstub @@ -6,99 +6,99 @@ from tests.data.mainPackage.anotherPath.anotherModule import AnotherClass class AttributesClassA() class AttributesClassB() { - @PythonName("type_hint_public") - static attr typeHintPublic: Int - @PythonName("no_type_hint_public") - static attr noTypeHintPublic: Int - @PythonName("object_attr") - static attr objectAttr: AttributesClassA - // TODO Attribute has no type information. - @PythonName("callexpr_attr_class") - static attr callexprAttrClass - // TODO Attribute has no type information. - @PythonName("callexpr_attr_function") - static attr callexprAttrFunction - // TODO Safe-DS does not support tuple types. - @PythonName("tuple_attr_1") - static attr tupleAttr1: Tuple - // TODO Safe-DS does not support tuple types. - @PythonName("tuple_attr_2") - static attr tupleAttr2: Tuple> - // TODO Safe-DS does not support tuple types. - @PythonName("tuple_attr_3") - static attr tupleAttr3: Tuple - @PythonName("defined_three_times") - static attr definedThreeTimes: Int - @PythonName("list_attr_1") - static attr listAttr1: List - @PythonName("list_attr_2") - static attr listAttr2: List> - // TODO List type has to many type arguments. - @PythonName("list_attr_3") - static attr listAttr3: List - // TODO List type has to many type arguments. - @PythonName("list_attr_4") - static attr listAttr4: List> - // TODO Safe-DS does not support set types. - @PythonName("set_attr_1") - static attr setAttr1: Set - // TODO Safe-DS does not support set types. - @PythonName("set_attr_2") - static attr setAttr2: Set> - // TODO Safe-DS does not support set types. - // TODO Set type has to many type arguments. - @PythonName("set_attr_3") - static attr setAttr3: Set - // TODO Safe-DS does not support set types. - // TODO Set type has to many type arguments. - @PythonName("set_attr_4") - static attr setAttr4: Set> - @PythonName("dict_attr_1") - static attr dictAttr1: Map - @PythonName("dict_attr_2") - static attr dictAttr2: Map - @PythonName("dict_attr_3") - static attr dictAttr3: Map, AttributesClassA?> - @PythonName("bool_attr") - static attr boolAttr: Boolean - @PythonName("none_attr") - static attr noneAttr: Nothing? - @PythonName("flaot_attr") - static attr flaotAttr: Float - @PythonName("int_or_bool_attr") - static attr intOrBoolAttr: union - @PythonName("str_attr_with_none_value") - static attr strAttrWithNoneValue: String - static attr optional: Int? - static attr final: String - static attr finals: union - @PythonName("final_union") - static attr finalUnion: union - static attr `literal`: literal<"Some String"> - @PythonName("multiple_literals") - static attr multipleLiterals: literal<"Literal_1", "Literal_2", 3, true> - @PythonName("mixed_literal_union") - static attr mixedLiteralUnion: union> - @PythonName("multi_attr_1") - static attr multiAttr1: Int - @PythonName("multi_attr_3") - static attr multiAttr3: List - @PythonName("multi_attr_5") - static attr multiAttr5: String - @PythonName("multi_attr_6") - static attr multiAttr6: String - @PythonName("multi_attr_7") - static attr multiAttr7: String - @PythonName("multi_attr_8") - static attr multiAttr8: String - @PythonName("attr_type_from_outside_package") - static attr attrTypeFromOutsidePackage: AnotherClass - @PythonName("attr_default_value_from_outside_package") - static attr attrDefaultValueFromOutsidePackage: AnotherClass - @PythonName("init_attr") - attr initAttr: Boolean + @PythonName("type_hint_public") + static attr typeHintPublic: Int + @PythonName("no_type_hint_public") + static attr noTypeHintPublic: Int + @PythonName("object_attr") + static attr objectAttr: AttributesClassA + // TODO Attribute has no type information. + @PythonName("callexpr_attr_class") + static attr callexprAttrClass + // TODO Attribute has no type information. + @PythonName("callexpr_attr_function") + static attr callexprAttrFunction + // TODO Safe-DS does not support tuple types. + @PythonName("tuple_attr_1") + static attr tupleAttr1: Tuple + // TODO Safe-DS does not support tuple types. + @PythonName("tuple_attr_2") + static attr tupleAttr2: Tuple> + // TODO Safe-DS does not support tuple types. + @PythonName("tuple_attr_3") + static attr tupleAttr3: Tuple + @PythonName("defined_three_times") + static attr definedThreeTimes: Int + @PythonName("list_attr_1") + static attr listAttr1: List + @PythonName("list_attr_2") + static attr listAttr2: List> + // TODO List type has to many type arguments. + @PythonName("list_attr_3") + static attr listAttr3: List + // TODO List type has to many type arguments. + @PythonName("list_attr_4") + static attr listAttr4: List> + // TODO Safe-DS does not support set types. + @PythonName("set_attr_1") + static attr setAttr1: Set + // TODO Safe-DS does not support set types. + @PythonName("set_attr_2") + static attr setAttr2: Set> + // TODO Safe-DS does not support set types. + // TODO Set type has to many type arguments. + @PythonName("set_attr_3") + static attr setAttr3: Set + // TODO Safe-DS does not support set types. + // TODO Set type has to many type arguments. + @PythonName("set_attr_4") + static attr setAttr4: Set> + @PythonName("dict_attr_1") + static attr dictAttr1: Map + @PythonName("dict_attr_2") + static attr dictAttr2: Map + @PythonName("dict_attr_3") + static attr dictAttr3: Map, AttributesClassA?> + @PythonName("bool_attr") + static attr boolAttr: Boolean + @PythonName("none_attr") + static attr noneAttr: Nothing? + @PythonName("flaot_attr") + static attr flaotAttr: Float + @PythonName("int_or_bool_attr") + static attr intOrBoolAttr: union + @PythonName("str_attr_with_none_value") + static attr strAttrWithNoneValue: String + static attr optional: Int? + static attr final: String + static attr finals: union + @PythonName("final_union") + static attr finalUnion: union + static attr `literal`: literal<"Some String"> + @PythonName("multiple_literals") + static attr multipleLiterals: literal<"Literal_1", "Literal_2", 3, true> + @PythonName("mixed_literal_union") + static attr mixedLiteralUnion: union> + @PythonName("multi_attr_1") + static attr multiAttr1: Int + @PythonName("multi_attr_3") + static attr multiAttr3: List + @PythonName("multi_attr_5") + static attr multiAttr5: String + @PythonName("multi_attr_6") + static attr multiAttr6: String + @PythonName("multi_attr_7") + static attr multiAttr7: String + @PythonName("multi_attr_8") + static attr multiAttr8: String + @PythonName("attr_type_from_outside_package") + static attr attrTypeFromOutsidePackage: AnotherClass + @PythonName("attr_default_value_from_outside_package") + static attr attrDefaultValueFromOutsidePackage: AnotherClass + @PythonName("init_attr") + attr initAttr: Boolean - @Pure - @PythonName("some_func") - static fun someFunc() -> result1: Boolean + @Pure + @PythonName("some_func") + static fun someFunc() -> result1: Boolean } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[class_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[class_module].sdsstub index 8c7fc201..7461b6ce 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[class_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[class_module].sdsstub @@ -6,37 +6,37 @@ from tests.data.mainPackage.anotherPath.anotherModule import yetAnotherClass class ClassModuleEmptyClassA() class ClassModuleClassB( - a: Int, - b: ClassModuleEmptyClassA? + a: Int, + b: ClassModuleEmptyClassA? ) sub ClassModuleEmptyClassA { - // TODO Result type information missing. - @Pure - fun f() + // TODO Result type information missing. + @Pure + fun f() } // TODO Safe-DS does not support multiple inheritance. class ClassModuleClassC() sub ClassModuleEmptyClassA, ClassModuleClassB, yetAnotherClass { - @PythonName("attr_1") - static attr attr1: Int - @PythonName("attr_2") - static attr attr2: Int - - // TODO Result type information missing. - @Pure - fun f1() + @PythonName("attr_1") + static attr attr1: Int + @PythonName("attr_2") + static attr attr2: Int + + // TODO Result type information missing. + @Pure + fun f1() } class ClassModuleClassD() { - class ClassModuleNestedClassE() { - @PythonName("nested_attr_1") - static attr nestedAttr1: Nothing? - - @PythonName("_ClassModulePrivateDoubleNestedClassF") - class ClassModulePrivateDoubleNestedClassF() - - // TODO Result type information missing. - @Pure - @PythonName("class_e_func") - fun classEFunc() - } + class ClassModuleNestedClassE() { + @PythonName("nested_attr_1") + static attr nestedAttr1: Nothing? + + @PythonName("_ClassModulePrivateDoubleNestedClassF") + class ClassModulePrivateDoubleNestedClassF() + + // TODO Result type information missing. + @Pure + @PythonName("class_e_func") + fun classEFunc() + } } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[docstring_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[docstring_module].sdsstub index 6662fcf9..ee2ae90d 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[docstring_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[docstring_module].sdsstub @@ -16,28 +16,28 @@ package tests.data.variousModulesPackage.docstringModule * :type param_1: str */ class RestDocstringClass( - @PythonName("param_1") param1: String + @PythonName("param_1") param1: String ) { - @PythonName("attr_1") - static attr attr1: String + @PythonName("attr_1") + static attr attr1: String - /** - * This function checks if the sum of x and y is less than the value 10 - * and returns True if it is. (ReST). - * - * :param x: First integer value for the calculation. (ReST) - * :type x: int - * :param y: Second integer value for the calculation. (ReST) - * :type y: int - * :returns: Checks if the sum of x and y is greater than 10. (ReST) - * :rtype: bool - */ - @Pure - @PythonName("rest_docstring_func") - fun restDocstringFunc( - x: Int, - y: Int - ) -> result1: Boolean + /** + * This function checks if the sum of x and y is less than the value 10 + * and returns True if it is. (ReST). + * + * :param x: First integer value for the calculation. (ReST) + * :type x: int + * :param y: Second integer value for the calculation. (ReST) + * :type y: int + * :returns: Checks if the sum of x and y is greater than 10. (ReST) + * :rtype: bool + */ + @Pure + @PythonName("rest_docstring_func") + fun restDocstringFunc( + x: Int, + y: Int + ) -> result1: Boolean } /** @@ -56,34 +56,34 @@ class RestDocstringClass( * Parameter of the calculator. (Numpy) */ class NumpyDocstringClass( - @PythonName("param_1") param1: String + @PythonName("param_1") param1: String ) { - @PythonName("attr_1") - static attr attr1: String + @PythonName("attr_1") + static attr attr1: String - /** - * Checks if the sum of two variables is over the value of 10. (Numpy). - * - * This function checks if the sum of `x` and `y` is less than the value 10 and returns True if it is. (Numpy) - * - * Parameters - * ---------- - * x : int - * First integer value for the calculation. (Numpy) - * y : int - * Second integer value for the calculation. (Numpy) - * - * Returns - * ------- - * bool - * Checks if the sum of `x` and `y` is greater than 10. (Numpy) - */ - @Pure - @PythonName("numpy_docstring_func") - fun numpyDocstringFunc( - x: Int, - y: Int - ) -> result1: Boolean + /** + * Checks if the sum of two variables is over the value of 10. (Numpy). + * + * This function checks if the sum of `x` and `y` is less than the value 10 and returns True if it is. (Numpy) + * + * Parameters + * ---------- + * x : int + * First integer value for the calculation. (Numpy) + * y : int + * Second integer value for the calculation. (Numpy) + * + * Returns + * ------- + * bool + * Checks if the sum of `x` and `y` is greater than 10. (Numpy) + */ + @Pure + @PythonName("numpy_docstring_func") + fun numpyDocstringFunc( + x: Int, + y: Int + ) -> result1: Boolean } /** @@ -98,29 +98,29 @@ class NumpyDocstringClass( * param_1 (str): Parameter of the calculator. (Google Style) */ class GoogleDocstringClass( - @PythonName("param_1") param1: String + @PythonName("param_1") param1: String ) { - @PythonName("attr_1") - static attr attr1: String + @PythonName("attr_1") + static attr attr1: String - /** - * Checks if the sum of two variables is over the value of 10. (Google Style). - * - * This function checks if the sum of x and y is less than the value 10 - * and returns True if it is. (Google Style) - * - * Args: - * x (int): First integer value for the calculation. (Google Style) - * y (int): Second integer value for the calculation. (Google Style) - * - * Returns: - * bool: Checks if the sum of x and y is greater than 10 and returns - * a boolean value. (Google Style) - */ - @Pure - @PythonName("google_docstring_func") - fun googleDocstringFunc( - x: Int, - y: Int - ) -> result1: Boolean + /** + * Checks if the sum of two variables is over the value of 10. (Google Style). + * + * This function checks if the sum of x and y is less than the value 10 + * and returns True if it is. (Google Style) + * + * Args: + * x (int): First integer value for the calculation. (Google Style) + * y (int): Second integer value for the calculation. (Google Style) + * + * Returns: + * bool: Checks if the sum of x and y is greater than 10 and returns + * a boolean value. (Google Style) + */ + @Pure + @PythonName("google_docstring_func") + fun googleDocstringFunc( + x: Int, + y: Int + ) -> result1: Boolean } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[enum_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[enum_module].sdsstub index 6814a858..c02f9c36 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[enum_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[enum_module].sdsstub @@ -12,23 +12,23 @@ enum _ReexportedEmptyEnum * Full Docstring Description */ enum EnumTest { - ONE - TWO - THREE - FOUR - FIVE - SIX - SEVEN - EIGHT - NINE + ONE + TWO + THREE + FOUR + FIVE + SIX + SEVEN + EIGHT + NINE } enum EnumTest2 { - TEN + TEN } enum EnumTest3 { - @PythonName("ele_ven") eleVen + @PythonName("ele_ven") eleVen } enum EmptyEnum diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub index 9183f24b..4595d81c 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub @@ -14,23 +14,23 @@ fun publicNoParamsNoResult() // TODO Some parameter have no type information. @Pure fun params( - integer: Int, - boolean: Boolean, - @PythonName("float_") float: Float, - none: Nothing?, - string: String, - obj: FunctionModuleClassA, - callexpr, - `union`: union, - @PythonName("union_with_none_1") unionWithNone1: Int?, - @PythonName("union_with_none_2") unionWithNone2: Int?, - @PythonName("list_") list: List, - dictionary: Map>, - @PythonName("set_") set: Set, - optional: Int?, - @PythonName("tuple_") tuple: Tuple, - `literal`: literal<"Some String">, - @PythonName("any_") any: Any + integer: Int, + boolean: Boolean, + @PythonName("float_") float: Float, + none: Nothing?, + string: String, + obj: FunctionModuleClassA, + callexpr, + `union`: union, + @PythonName("union_with_none_1") unionWithNone1: Int?, + @PythonName("union_with_none_2") unionWithNone2: Int?, + @PythonName("list_") list: List, + dictionary: Map>, + @PythonName("set_") set: Set, + optional: Int?, + @PythonName("tuple_") tuple: Tuple, + `literal`: literal<"Some String">, + @PythonName("any_") any: Any ) // TODO Result type information missing. @@ -40,23 +40,23 @@ fun params( @Pure @PythonName("params_with_default_value") fun paramsWithDefaultValue( - integer: Int = 3, - boolean: Boolean = true, - @PythonName("float_") float: Float = 1.2, - none: Nothing? = null, - string: String = "Some String", - obj: FunctionModuleClassA, - callexpr, - `union`: union = 2, - @PythonName("union_with_none_1") unionWithNone1: Int? = 2, - @PythonName("union_with_none_2") unionWithNone2: Int? = 3, - @PythonName("list_") list: List, - dictionary: Map>, - @PythonName("set_") set: Set, - optional: Int? = null, - @PythonName("tuple_") tuple: Tuple, - `literal`: literal<"Some String"> = "Some String", - @PythonName("any_") any: Any = false + integer: Int = 3, + boolean: Boolean = true, + @PythonName("float_") float: Float = 1.2, + none: Nothing? = null, + string: String = "Some String", + obj: FunctionModuleClassA, + callexpr, + `union`: union = 2, + @PythonName("union_with_none_1") unionWithNone1: Int? = 2, + @PythonName("union_with_none_2") unionWithNone2: Int? = 3, + @PythonName("list_") list: List, + dictionary: Map>, + @PythonName("set_") set: Set, + optional: Int? = null, + @PythonName("tuple_") tuple: Tuple, + `literal`: literal<"Some String"> = "Some String", + @PythonName("any_") any: Any = false ) // TODO List type has to many type arguments. @@ -65,26 +65,26 @@ fun paramsWithDefaultValue( @Pure @PythonName("illegal_params") fun illegalParams( - lst: List, - @PythonName("lst_2") lst2: List, - tpl: Tuple, - dct: Map, - `_`: Int = "String" + lst: List, + @PythonName("lst_2") lst2: List, + tpl: Tuple, + dct: Map, + `_`: Int = "String" ) // TODO Result type information missing. @Pure @PythonName("special_params") fun specialParams( - @PythonName("none_union") noneUnion: Nothing?, - @PythonName("none_bool_union") noneBoolUnion: Boolean?, - @PythonName("bool_none_union") boolNoneUnion: Boolean?, - @PythonName("bool_none_str") boolNoneStr: String?, - @PythonName("none_bool_none_union") noneBoolNoneUnion: Boolean?, - @PythonName("none_bool_int_union") noneBoolIntUnion: union, - @PythonName("none_none_bool_none_union") noneNoneBoolNoneUnion: Boolean?, - @PythonName("none_list_union_none_none") noneListUnionNoneNone: List?, - none: Nothing? + @PythonName("none_union") noneUnion: Nothing?, + @PythonName("none_bool_union") noneBoolUnion: Boolean?, + @PythonName("bool_none_union") boolNoneUnion: Boolean?, + @PythonName("bool_none_str") boolNoneStr: String?, + @PythonName("none_bool_none_union") noneBoolNoneUnion: Boolean?, + @PythonName("none_bool_int_union") noneBoolIntUnion: union, + @PythonName("none_none_bool_none_union") noneNoneBoolNoneUnion: Boolean?, + @PythonName("none_list_union_none_none") noneListUnionNoneNone: List?, + none: Nothing? ) // TODO Result type information missing. @@ -93,12 +93,12 @@ fun specialParams( @Pure @PythonName("param_position") fun paramPosition( - self, - a, - b: Boolean, - c, - d, - e: Int = 1 + self, + a, + b: Boolean, + c, + d, + e: Int = 1 ) // TODO Result type information missing. @@ -107,8 +107,8 @@ fun paramPosition( @Pure @PythonName("opt_pos_only") fun optPosOnly( - required, - optional: Int = 1 + required, + optional: Int = 1 ) // TODO Result type information missing. @@ -117,8 +117,8 @@ fun optPosOnly( @Pure @PythonName("req_name_only") fun reqNameOnly( - required, - optional: Int = 1 + required, + optional: Int = 1 ) // TODO Result type information missing. @@ -126,8 +126,8 @@ fun reqNameOnly( // TODO Some parameter have no type information. @Pure fun arg( - args: List, - kwargs: Map + args: List, + kwargs: Map ) // TODO Result type information missing. @@ -135,8 +135,8 @@ fun arg( @Pure @PythonName("args_type") fun argsType( - args: List, - kwargs: Map + args: List, + kwargs: Map ) @Pure @@ -233,7 +233,7 @@ fun anyResults() -> result1: Any @Pure @PythonName("callable_type") fun callableType( - param: (param1: String) -> (result1: Int, result2: String) + param: (param1: String) -> (result1: Int, result2: String) ) -> result1: (param1: Int, param2: Int) -> result1: Int // TODO Result type information missing. @@ -241,8 +241,8 @@ fun callableType( @Pure @PythonName("param_from_outside_the_package") fun paramFromOutsideThePackage( - @PythonName("param_type") paramType: AnotherClass, - @PythonName("param_value") paramValue + @PythonName("param_type") paramType: AnotherClass, + @PythonName("param_value") paramValue ) @Pure @@ -257,52 +257,52 @@ class FunctionModuleClassA() // TODO Some parameter have no type information. class FunctionModuleClassB( - @PythonName("init_param") initParam + @PythonName("init_param") initParam ) { - class FunctionModuleClassC() { - class FunctionModuleClassD() - - @Pure - @PythonName("nested_class_function") - fun nestedClassFunction( - param1: Int - ) -> result1: Boolean - } - - @Pure - @PythonName("instance_method") - fun instanceMethod( - a: FunctionModuleClassA - ) -> result1: FunctionModuleClassA - - // TODO Result type information missing. - @Pure - @PythonName("static_method") - static fun staticMethod() - - // TODO Result type information missing. - @Pure - @PythonName("static_method_params") - static fun staticMethodParams( - @PythonName("param_1") param1: Int - ) - - // TODO Result type information missing. - // TODO Safe-DS does not support class methods. - @Pure - @PythonName("class_method") - static fun classMethod() - - // TODO Safe-DS does not support class methods. - @Pure - @PythonName("class_method_params") - static fun classMethodParams( - @PythonName("param_1") param1: Int - ) -> result1: Boolean + class FunctionModuleClassC() { + class FunctionModuleClassD() + + @Pure + @PythonName("nested_class_function") + fun nestedClassFunction( + param1: Int + ) -> result1: Boolean + } + + @Pure + @PythonName("instance_method") + fun instanceMethod( + a: FunctionModuleClassA + ) -> result1: FunctionModuleClassA + + // TODO Result type information missing. + @Pure + @PythonName("static_method") + static fun staticMethod() + + // TODO Result type information missing. + @Pure + @PythonName("static_method_params") + static fun staticMethodParams( + @PythonName("param_1") param1: Int + ) + + // TODO Result type information missing. + // TODO Safe-DS does not support class methods. + @Pure + @PythonName("class_method") + static fun classMethod() + + // TODO Safe-DS does not support class methods. + @Pure + @PythonName("class_method_params") + static fun classMethodParams( + @PythonName("param_1") param1: Int + ) -> result1: Boolean } class FunctionModulePropertiesClass() { - @PythonName("property_function") attr propertyFunction - @PythonName("property_function_params") attr propertyFunctionParams: String - @PythonName("property_function_infer") attr propertyFunctionInfer: String + @PythonName("property_function") attr propertyFunction + @PythonName("property_function_params") attr propertyFunctionParams: String + @PythonName("property_function_infer") attr propertyFunctionInfer: String } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[import_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[import_module].sdsstub index 3f5a8a82..60fb7937 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[import_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[import_module].sdsstub @@ -8,14 +8,14 @@ from tests.data.variousModulesPackage.classModule import ClassModuleClassD from tests.data.variousModulesPackage.classModule import ClassModuleEmptyClassA class ImportClass() sub AnotherClass { - @PythonName("typed_import_attr") - static attr typedImportAttr: ClassModuleClassD - @PythonName("default_import_attr") - static attr defaultImportAttr: ClassModuleEmptyClassA + @PythonName("typed_import_attr") + static attr typedImportAttr: ClassModuleClassD + @PythonName("default_import_attr") + static attr defaultImportAttr: ClassModuleEmptyClassA - @Pure - @PythonName("import_function") - fun importFunction( - @PythonName("import_param") importParam: ClassModuleClassB - ) -> result1: ClassModuleClassC + @Pure + @PythonName("import_function") + fun importFunction( + @PythonName("import_param") importParam: ClassModuleClassB + ) -> result1: ClassModuleClassC } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub index 7d89d8fa..7a3f0640 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub @@ -8,67 +8,67 @@ class InferMe2() class InferMe3() class InferMyTypes( - @PythonName("init_param") initParam: Int = 1 + @PythonName("init_param") initParam: Int = 1 ) { - @PythonName("infer_int") - static attr inferInt: Int - @PythonName("infer_float") - static attr inferFloat: Float - @PythonName("infer_bool") - static attr inferBool: Boolean - @PythonName("infer_str") - static attr inferStr: String - @PythonName("infer_none") - static attr inferNone: Nothing? - @PythonName("infer_call_expr") - static attr inferCallExpr: InferMe - // TODO Attribute has no type information. - @PythonName("uninferable_callable") - static attr uninferableCallable - // TODO Attribute has no type information. - @PythonName("init_infer") - attr initInfer + @PythonName("infer_int") + static attr inferInt: Int + @PythonName("infer_float") + static attr inferFloat: Float + @PythonName("infer_bool") + static attr inferBool: Boolean + @PythonName("infer_str") + static attr inferStr: String + @PythonName("infer_none") + static attr inferNone: Nothing? + @PythonName("infer_call_expr") + static attr inferCallExpr: InferMe + // TODO Attribute has no type information. + @PythonName("uninferable_callable") + static attr uninferableCallable + // TODO Attribute has no type information. + @PythonName("init_infer") + attr initInfer - // TODO Result type information missing. - // TODO Some parameter have no type information. - @Pure - @PythonName("infer_param_types") - static fun inferParamTypes( - integer: Int = 3, - boolean: Boolean = true, - @PythonName("float_") float: Float = 1.2, - none: Nothing? = null, - string: String = "Some String", - callexpr, - @PythonName("int_list") intList, - dictionary, - @PythonName("string_set") stringSet, - @PythonName("tuple_") tuple - ) + // TODO Result type information missing. + // TODO Some parameter have no type information. + @Pure + @PythonName("infer_param_types") + static fun inferParamTypes( + integer: Int = 3, + boolean: Boolean = true, + @PythonName("float_") float: Float = 1.2, + none: Nothing? = null, + string: String = "Some String", + callexpr, + @PythonName("int_list") intList, + dictionary, + @PythonName("string_set") stringSet, + @PythonName("tuple_") tuple + ) - @Pure - @PythonName("infer_function") - static fun inferFunction( - @PythonName("infer_param") inferParam: Int = 1, - @PythonName("infer_param_2") inferParam2: Int = "Something" - ) -> (result1: union, result2: union, result3: Float) + @Pure + @PythonName("infer_function") + static fun inferFunction( + @PythonName("infer_param") inferParam: Int = 1, + @PythonName("infer_param_2") inferParam2: Int = "Something" + ) -> (result1: union, result2: union, result3: Float) - /** - * Test for inferring results with just one possible result, and not a tuple of results. - */ - @Pure - @PythonName("infer_function_2") - static fun inferFunction2( - i: Int = 2 - ) -> result1: union + /** + * Test for inferring results with just one possible result, and not a tuple of results. + */ + @Pure + @PythonName("infer_function_2") + static fun inferFunction2( + i: Int = 2 + ) -> result1: union - // TODO Result type information missing. - @Pure - @PythonName("infer_call_result_1") - fun inferCallResult1() + // TODO Result type information missing. + @Pure + @PythonName("infer_call_result_1") + fun inferCallResult1() - // TODO Result type information missing. - @Pure - @PythonName("infer_call_result_2") - fun inferCallResult2() + // TODO Result type information missing. + @Pure + @PythonName("infer_call_result_2") + fun inferCallResult2() } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[inheritance_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[inheritance_module].sdsstub index 9e206d07..b697b343 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[inheritance_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[inheritance_module].sdsstub @@ -2,37 +2,37 @@ package tests.data.variousModulesPackage.inheritanceModule class PublicSuperClass() { - @Pure - @PythonName("public_superclass_method") - fun publicSuperclassMethod() -> result1: String + @Pure + @PythonName("public_superclass_method") + fun publicSuperclassMethod() -> result1: String } class PublicSubClass() sub PublicSuperClass class PublicSubClass2() { - @Pure - @PythonName("public_internal_class_method") - fun publicInternalClassMethod( - a: Int - ) -> result1: String + @Pure + @PythonName("public_internal_class_method") + fun publicInternalClassMethod( + a: Int + ) -> result1: String - @Pure - @PythonName("public_subclass_method") - fun publicSubclassMethod() -> result1: String + @Pure + @PythonName("public_subclass_method") + fun publicSubclassMethod() -> result1: String } class PublicSubClassFromNested() { - @Pure - @PythonName("public_internal_nested_class_method") - fun publicInternalNestedClassMethod( - a: Nothing? - ) -> result1: Boolean + @Pure + @PythonName("public_internal_nested_class_method") + fun publicInternalNestedClassMethod( + a: Nothing? + ) -> result1: Boolean } class InheritTransitively() { - @Pure - @PythonName("transitive_class_fun") - fun transitiveClassFun( - c: List - ) -> result1: List + @Pure + @PythonName("transitive_class_fun") + fun transitiveClassFun( + c: List + ) -> result1: List } diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub index 1936dc8d..6a9d4568 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub @@ -4,84 +4,84 @@ package tests.data.variousModulesPackage.typeVarModule @Pure @PythonName("type_var_func") fun typeVarFunc( - a: List + a: List ) -> result1: List @Pure @PythonName("multiple_type_var") fun multipleTypeVar( - a: typeVar1, - b: typeVar2 + a: typeVar1, + b: typeVar2 ) -> result1: List> @Pure @PythonName("type_var_fun_invariance_with_bound") fun typeVarFunInvarianceWithBound( - a: List + a: List ) -> result1: TIn class GenericTypeVar( - items: List + items: List ) { - @Pure - @PythonName("type_var_class_method") - fun typeVarClassMethod( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method") + fun typeVarClassMethod( + a: T + ) -> result1: T } class GenericTypeVar2() { - @Pure - @PythonName("type_var_class_method2") - fun typeVarClassMethod2( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method2") + fun typeVarClassMethod2( + a: T + ) -> result1: T } class SequenceTypeVar( - items: List + items: List ) { - @Pure - @PythonName("type_var_class_method") - fun typeVarClassMethod( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method") + fun typeVarClassMethod( + a: T + ) -> result1: T } class SequenceTypeVar2() { - @Pure - @PythonName("type_var_class_method2") - fun typeVarClassMethod2( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method2") + fun typeVarClassMethod2( + a: T + ) -> result1: T } class CollectionTypeVar( - items: List + items: List ) { - @Pure - @PythonName("type_var_class_method") - fun typeVarClassMethod( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method") + fun typeVarClassMethod( + a: T + ) -> result1: T } class CollectionTypeVar2() { - @Pure - @PythonName("type_var_class_method2") - fun typeVarClassMethod2( - a: T - ) -> result1: T + @Pure + @PythonName("type_var_class_method2") + fun typeVarClassMethod2( + a: T + ) -> result1: T } class MappingTypeVar( - data: Map? = null + data: Map? = null ) class MappingTypeVar2( - data: Map> + data: Map> ) class MappingTypeVar3( - data: Map>? + data: Map>? ) diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[googledoc-GOOGLE].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[googledoc-GOOGLE].sdsstub index d80e61f1..f69f4240 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[googledoc-GOOGLE].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[googledoc-GOOGLE].sdsstub @@ -44,12 +44,12 @@ fun functionWithoutDocumentation() @Pure @PythonName("function_with_parameters") fun functionWithParameters( - @PythonName("no_type_no_default") noTypeNoDefault, - @PythonName("optional_type") optionalType, - @PythonName("type_no_default") typeNoDefault, - @PythonName("with_default") withDefault, - args: List, - kwargs: Map + @PythonName("no_type_no_default") noTypeNoDefault, + @PythonName("optional_type") optionalType, + @PythonName("type_no_default") typeNoDefault, + @PythonName("with_default") withDefault, + args: List, + kwargs: Map ) // TODO Result type information missing. @@ -64,7 +64,7 @@ fun functionWithParameters( @Pure @PythonName("function_with_attributes_and_parameters") fun functionWithAttributesAndParameters( - q + q ) /** @@ -118,7 +118,7 @@ class ClassWithoutDocumentation() */ // TODO Some parameter have no type information. class ClassWithParameters( - p + p ) /** @@ -127,125 +127,125 @@ class ClassWithParameters( * Dolor sit amet. */ class ClassWithAttributes() { - /** - * foo. Defaults to 1. - */ - static attr p: Int - /** - * foo. Defaults to 1. - */ - static attr q: Int - /** - * foo. - */ - @PythonName("optional_unknown_default") - static attr optionalUnknownDefault: Nothing? + /** + * foo. Defaults to 1. + */ + static attr p: Int + /** + * foo. Defaults to 1. + */ + static attr q: Int + /** + * foo. + */ + @PythonName("optional_unknown_default") + static attr optionalUnknownDefault: Nothing? } class ClassWithMethod() { - /** - * property_method_with_docstring. - * - * Dolor sit amet. - */ - @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean + /** + * property_method_with_docstring. + * + * Dolor sit amet. + */ + @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean - // TODO Some parameter have no type information. - /** - * method_with_docstring. - * - * Dolor sit amet. - * - * @param a foo - * - * @result result1 this will be the return value. - */ - @Pure - @PythonName("method_with_docstring") - fun methodWithDocstring( - a - ) -> result1: Boolean + // TODO Some parameter have no type information. + /** + * method_with_docstring. + * + * Dolor sit amet. + * + * @param a foo + * + * @result result1 this will be the return value. + */ + @Pure + @PythonName("method_with_docstring") + fun methodWithDocstring( + a + ) -> result1: Boolean } // TODO Some parameter have no type information. class ClassWithVariousParameterTypes( - @PythonName("no_type") noType, - @PythonName("optional_type") optionalType, - @PythonName("none_type") noneType, - @PythonName("int_type") intType, - @PythonName("bool_type") boolType, - @PythonName("str_type") strType, - @PythonName("float_type") floatType, - @PythonName("multiple_types") multipleTypes, - @PythonName("list_type_1") listType1, - @PythonName("list_type_2") listType2, - @PythonName("list_type_3") listType3, - @PythonName("list_type_4") listType4, - @PythonName("list_type_5") listType5, - @PythonName("set_type_1") setType1, - @PythonName("set_type_2") setType2, - @PythonName("set_type_3") setType3, - @PythonName("set_type_4") setType4, - @PythonName("set_type_5") setType5, - @PythonName("tuple_type_1") tupleType1, - @PythonName("tuple_type_2") tupleType2, - @PythonName("tuple_type_3") tupleType3, - @PythonName("tuple_type_4") tupleType4, - @PythonName("any_type") anyType: Any, - @PythonName("optional_type_2") optionalType2: Int?, - @PythonName("class_type") classType, - @PythonName("imported_type") importedType + @PythonName("no_type") noType, + @PythonName("optional_type") optionalType, + @PythonName("none_type") noneType, + @PythonName("int_type") intType, + @PythonName("bool_type") boolType, + @PythonName("str_type") strType, + @PythonName("float_type") floatType, + @PythonName("multiple_types") multipleTypes, + @PythonName("list_type_1") listType1, + @PythonName("list_type_2") listType2, + @PythonName("list_type_3") listType3, + @PythonName("list_type_4") listType4, + @PythonName("list_type_5") listType5, + @PythonName("set_type_1") setType1, + @PythonName("set_type_2") setType2, + @PythonName("set_type_3") setType3, + @PythonName("set_type_4") setType4, + @PythonName("set_type_5") setType5, + @PythonName("tuple_type_1") tupleType1, + @PythonName("tuple_type_2") tupleType2, + @PythonName("tuple_type_3") tupleType3, + @PythonName("tuple_type_4") tupleType4, + @PythonName("any_type") anyType: Any, + @PythonName("optional_type_2") optionalType2: Int?, + @PythonName("class_type") classType, + @PythonName("imported_type") importedType ) class ClassWithVariousAttributeTypes() { - @PythonName("no_type") - static attr noType: String - @PythonName("optional_type") - static attr optionalType: String - @PythonName("none_type") - static attr noneType: String - @PythonName("int_type") - static attr intType: String - @PythonName("bool_type") - static attr boolType: String - @PythonName("str_type") - static attr strType: String - @PythonName("float_type") - static attr floatType: String - @PythonName("multiple_types") - static attr multipleTypes: String - @PythonName("list_type_1") - static attr listType1: String - @PythonName("list_type_2") - static attr listType2: String - @PythonName("list_type_3") - static attr listType3: String - @PythonName("list_type_4") - static attr listType4: String - @PythonName("set_type_1") - static attr setType1: String - @PythonName("set_type_2") - static attr setType2: String - @PythonName("set_type_3") - static attr setType3: String - @PythonName("set_type_4") - static attr setType4: String - @PythonName("tuple_type_1") - static attr tupleType1: String - @PythonName("tuple_type_2") - static attr tupleType2: String - @PythonName("tuple_type_3") - static attr tupleType3: String - @PythonName("tuple_type_4") - static attr tupleType4: String - @PythonName("any_type") - static attr anyType: Any - @PythonName("optional_type_2") - static attr optionalType2: Int? - @PythonName("class_type") - static attr classType: ClassWithAttributes - @PythonName("imported_type") - static attr importedType: AnotherClass + @PythonName("no_type") + static attr noType: String + @PythonName("optional_type") + static attr optionalType: String + @PythonName("none_type") + static attr noneType: String + @PythonName("int_type") + static attr intType: String + @PythonName("bool_type") + static attr boolType: String + @PythonName("str_type") + static attr strType: String + @PythonName("float_type") + static attr floatType: String + @PythonName("multiple_types") + static attr multipleTypes: String + @PythonName("list_type_1") + static attr listType1: String + @PythonName("list_type_2") + static attr listType2: String + @PythonName("list_type_3") + static attr listType3: String + @PythonName("list_type_4") + static attr listType4: String + @PythonName("set_type_1") + static attr setType1: String + @PythonName("set_type_2") + static attr setType2: String + @PythonName("set_type_3") + static attr setType3: String + @PythonName("set_type_4") + static attr setType4: String + @PythonName("tuple_type_1") + static attr tupleType1: String + @PythonName("tuple_type_2") + static attr tupleType2: String + @PythonName("tuple_type_3") + static attr tupleType3: String + @PythonName("tuple_type_4") + static attr tupleType4: String + @PythonName("any_type") + static attr anyType: Any + @PythonName("optional_type_2") + static attr optionalType2: Int? + @PythonName("class_type") + static attr classType: ClassWithAttributes + @PythonName("imported_type") + static attr importedType: AnotherClass } /** diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub index bae98940..90037523 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[numpydoc-NUMPYDOC].sdsstub @@ -50,16 +50,16 @@ fun functionWithoutDocumentation() @Pure @PythonName("function_with_parameters") fun functionWithParameters( - @PythonName("no_type_no_default") noTypeNoDefault, - @PythonName("type_no_default") typeNoDefault, - @PythonName("optional_unknown_default") optionalUnknownDefault, - @PythonName("with_default_syntax_1") withDefaultSyntax1, - @PythonName("with_default_syntax_2") withDefaultSyntax2, - @PythonName("with_default_syntax_3") withDefaultSyntax3, - @PythonName("grouped_parameter_1") groupedParameter1, - @PythonName("grouped_parameter_2") groupedParameter2, - args: List, - kwargs: Map + @PythonName("no_type_no_default") noTypeNoDefault, + @PythonName("type_no_default") typeNoDefault, + @PythonName("optional_unknown_default") optionalUnknownDefault, + @PythonName("with_default_syntax_1") withDefaultSyntax1, + @PythonName("with_default_syntax_2") withDefaultSyntax2, + @PythonName("with_default_syntax_3") withDefaultSyntax3, + @PythonName("grouped_parameter_1") groupedParameter1, + @PythonName("grouped_parameter_2") groupedParameter2, + args: List, + kwargs: Map ) /** @@ -116,9 +116,9 @@ class ClassWithoutDocumentation() */ // TODO Some parameter have no type information. class ClassWithParameters( - p, - @PythonName("grouped_parameter_1") groupedParameter1, - @PythonName("grouped_parameter_2") groupedParameter2 + p, + @PythonName("grouped_parameter_1") groupedParameter1, + @PythonName("grouped_parameter_2") groupedParameter2 ) /** @@ -132,9 +132,9 @@ class ClassWithParameters( */ // TODO Some parameter have no type information. class ClassAndConstructorWithParameters( - x, - y, - z + x, + y, + z ) /** @@ -143,18 +143,18 @@ class ClassAndConstructorWithParameters( * Dolor sit amet. */ class ClassAndConstructorWithAttributes() { - /** - * Lorem ipsum 1. - */ - static attr x: String - /** - * Lorem ipsum 3. - */ - static attr z: Int - /** - * Lorem ipsum 2. - */ - static attr y: String + /** + * Lorem ipsum 1. + */ + static attr x: String + /** + * Lorem ipsum 3. + */ + static attr z: Int + /** + * Lorem ipsum 2. + */ + static attr y: String } /** @@ -166,16 +166,16 @@ class ClassAndConstructorWithAttributes() { */ // TODO Some parameter have no type information. class ClassWithParametersAndAttributes( - x + x ) { - /** - * foo - */ - static attr p: Int - /** - * foo - */ - static attr q: Int + /** + * foo + */ + static attr p: Int + /** + * foo + */ + static attr q: Int } /** @@ -184,146 +184,146 @@ class ClassWithParametersAndAttributes( * Dolor sit amet. */ class ClassWithAttributes() { - /** - * foo: no_type_no_default. Code:: - * - * pass - */ - @PythonName("no_type_no_default") - static attr noTypeNoDefault: String - /** - * foo: type_no_default - */ - @PythonName("type_no_default") - static attr typeNoDefault: Int - /** - * foo: optional_unknown_default - */ - @PythonName("optional_unknown_default") - static attr optionalUnknownDefault: Int? - /** - * foo: with_default_syntax_1 - */ - @PythonName("with_default_syntax_1") - static attr withDefaultSyntax1: Int - /** - * foo: with_default_syntax_2 - */ - @PythonName("with_default_syntax_2") - static attr withDefaultSyntax2: Int - /** - * foo: with_default_syntax_3 - */ - @PythonName("with_default_syntax_3") - static attr withDefaultSyntax3: Int - @PythonName("grouped_attribute_1") - static attr groupedAttribute1: Int - @PythonName("grouped_attribute_2") - static attr groupedAttribute2: Int + /** + * foo: no_type_no_default. Code:: + * + * pass + */ + @PythonName("no_type_no_default") + static attr noTypeNoDefault: String + /** + * foo: type_no_default + */ + @PythonName("type_no_default") + static attr typeNoDefault: Int + /** + * foo: optional_unknown_default + */ + @PythonName("optional_unknown_default") + static attr optionalUnknownDefault: Int? + /** + * foo: with_default_syntax_1 + */ + @PythonName("with_default_syntax_1") + static attr withDefaultSyntax1: Int + /** + * foo: with_default_syntax_2 + */ + @PythonName("with_default_syntax_2") + static attr withDefaultSyntax2: Int + /** + * foo: with_default_syntax_3 + */ + @PythonName("with_default_syntax_3") + static attr withDefaultSyntax3: Int + @PythonName("grouped_attribute_1") + static attr groupedAttribute1: Int + @PythonName("grouped_attribute_2") + static attr groupedAttribute2: Int } class ClassWithMethod() { - /** - * property_method_with_docstring. - * - * Dolor sit amet. - */ - @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean + /** + * property_method_with_docstring. + * + * Dolor sit amet. + */ + @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean - // TODO Some parameter have no type information. - /** - * method_with_docstring. - * - * Dolor sit amet. - * - * @result result1 this will be the return value - */ - @Pure - @PythonName("method_with_docstring") - fun methodWithDocstring( - a - ) -> result1: Boolean + // TODO Some parameter have no type information. + /** + * method_with_docstring. + * + * Dolor sit amet. + * + * @result result1 this will be the return value + */ + @Pure + @PythonName("method_with_docstring") + fun methodWithDocstring( + a + ) -> result1: Boolean } // TODO Some parameter have no type information. class ClassWithVariousParameterTypes( - @PythonName("no_type") noType, - @PythonName("optional_type") optionalType, - @PythonName("none_type") noneType, - @PythonName("int_type") intType, - @PythonName("bool_type") boolType, - @PythonName("str_type") strType, - @PythonName("float_type") floatType, - @PythonName("multiple_types") multipleTypes, - @PythonName("list_type_1") listType1, - @PythonName("list_type_2") listType2, - @PythonName("list_type_3") listType3, - @PythonName("list_type_4") listType4, - @PythonName("list_type_5") listType5, - @PythonName("set_type_1") setType1, - @PythonName("set_type_2") setType2, - @PythonName("set_type_3") setType3, - @PythonName("set_type_4") setType4, - @PythonName("set_type_5") setType5, - @PythonName("tuple_type_1") tupleType1, - @PythonName("tuple_type_2") tupleType2, - @PythonName("tuple_type_3") tupleType3, - @PythonName("tuple_type_4") tupleType4, - @PythonName("any_type") anyType: Any, - @PythonName("optional_type_2") optionalType2: Int?, - @PythonName("class_type") classType, - @PythonName("imported_type") importedType + @PythonName("no_type") noType, + @PythonName("optional_type") optionalType, + @PythonName("none_type") noneType, + @PythonName("int_type") intType, + @PythonName("bool_type") boolType, + @PythonName("str_type") strType, + @PythonName("float_type") floatType, + @PythonName("multiple_types") multipleTypes, + @PythonName("list_type_1") listType1, + @PythonName("list_type_2") listType2, + @PythonName("list_type_3") listType3, + @PythonName("list_type_4") listType4, + @PythonName("list_type_5") listType5, + @PythonName("set_type_1") setType1, + @PythonName("set_type_2") setType2, + @PythonName("set_type_3") setType3, + @PythonName("set_type_4") setType4, + @PythonName("set_type_5") setType5, + @PythonName("tuple_type_1") tupleType1, + @PythonName("tuple_type_2") tupleType2, + @PythonName("tuple_type_3") tupleType3, + @PythonName("tuple_type_4") tupleType4, + @PythonName("any_type") anyType: Any, + @PythonName("optional_type_2") optionalType2: Int?, + @PythonName("class_type") classType, + @PythonName("imported_type") importedType ) class ClassWithVariousAttributeTypes() { - @PythonName("no_type") - static attr noType: String - @PythonName("optional_type") - static attr optionalType: String - @PythonName("none_type") - static attr noneType: String - @PythonName("int_type") - static attr intType: String - @PythonName("bool_type") - static attr boolType: String - @PythonName("str_type") - static attr strType: String - @PythonName("float_type") - static attr floatType: String - @PythonName("multiple_types") - static attr multipleTypes: String - @PythonName("list_type_1") - static attr listType1: String - @PythonName("list_type_2") - static attr listType2: String - @PythonName("list_type_3") - static attr listType3: String - @PythonName("list_type_4") - static attr listType4: String - @PythonName("set_type_1") - static attr setType1: String - @PythonName("set_type_2") - static attr setType2: String - @PythonName("set_type_3") - static attr setType3: String - @PythonName("set_type_4") - static attr setType4: String - @PythonName("tuple_type_1") - static attr tupleType1: String - @PythonName("tuple_type_2") - static attr tupleType2: String - @PythonName("tuple_type_3") - static attr tupleType3: String - @PythonName("tuple_type_4") - static attr tupleType4: String - @PythonName("any_type") - static attr anyType: Any - @PythonName("optional_type_2") - static attr optionalType2: Int? - @PythonName("class_type") - static attr classType: ClassWithAttributes - @PythonName("imported_type") - static attr importedType: AnotherClass + @PythonName("no_type") + static attr noType: String + @PythonName("optional_type") + static attr optionalType: String + @PythonName("none_type") + static attr noneType: String + @PythonName("int_type") + static attr intType: String + @PythonName("bool_type") + static attr boolType: String + @PythonName("str_type") + static attr strType: String + @PythonName("float_type") + static attr floatType: String + @PythonName("multiple_types") + static attr multipleTypes: String + @PythonName("list_type_1") + static attr listType1: String + @PythonName("list_type_2") + static attr listType2: String + @PythonName("list_type_3") + static attr listType3: String + @PythonName("list_type_4") + static attr listType4: String + @PythonName("set_type_1") + static attr setType1: String + @PythonName("set_type_2") + static attr setType2: String + @PythonName("set_type_3") + static attr setType3: String + @PythonName("set_type_4") + static attr setType4: String + @PythonName("tuple_type_1") + static attr tupleType1: String + @PythonName("tuple_type_2") + static attr tupleType2: String + @PythonName("tuple_type_3") + static attr tupleType3: String + @PythonName("tuple_type_4") + static attr tupleType4: String + @PythonName("any_type") + static attr anyType: Any + @PythonName("optional_type_2") + static attr optionalType2: Int? + @PythonName("class_type") + static attr classType: ClassWithAttributes + @PythonName("imported_type") + static attr importedType: AnotherClass } /** diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[plaintext-PLAINTEXT].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[plaintext-PLAINTEXT].sdsstub index 05a59f10..aa855be4 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[plaintext-PLAINTEXT].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[plaintext-PLAINTEXT].sdsstub @@ -16,14 +16,14 @@ package tests.data.docstringParserPackage.plaintext @Pure @PythonName("function_with_documentation") fun functionWithDocumentation( - p: Int + p: Int ) // TODO Result type information missing. @Pure @PythonName("function_without_documentation") fun functionWithoutDocumentation( - p: Int + p: Int ) /** @@ -32,7 +32,7 @@ fun functionWithoutDocumentation( * Dolor sit amet. */ class ClassWithDocumentation( - p: Int + p: Int ) class ClassWithoutDocumentation() diff --git a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[restdoc-REST].sdsstub b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[restdoc-REST].sdsstub index e66faf52..6a696b08 100644 --- a/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[restdoc-REST].sdsstub +++ b/tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/test_stub_docstring_creation[restdoc-REST].sdsstub @@ -42,12 +42,12 @@ fun functionWithoutDocumentation() @Pure @PythonName("function_with_parameters") fun functionWithParameters( - @PythonName("no_type_no_default") noTypeNoDefault, - @PythonName("optional_unknown_default") optionalUnknownDefault, - @PythonName("type_no_default") typeNoDefault, - @PythonName("with_default") withDefault, - args: List, - kwargs: Map + @PythonName("no_type_no_default") noTypeNoDefault, + @PythonName("optional_unknown_default") optionalUnknownDefault, + @PythonName("type_no_default") typeNoDefault, + @PythonName("with_default") withDefault, + args: List, + kwargs: Map ) /** @@ -101,62 +101,62 @@ class ClassWithoutDocumentation() */ // TODO Some parameter have no type information. class ClassWithParameters( - p + p ) class ClassWithMethod() { - /** - * property_method_with_docstring. - * - * Dolor sit amet. - */ - @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean + /** + * property_method_with_docstring. + * + * Dolor sit amet. + */ + @PythonName("property_method_with_docstring") attr propertyMethodWithDocstring: Boolean - // TODO Some parameter have no type information. - /** - * method_with_docstring. - * - * Dolor sit amet. - * - * @param a type but no default - * - * @result result1 return value - */ - @Pure - @PythonName("method_with_docstring") - fun methodWithDocstring( - a - ) -> result1: Boolean + // TODO Some parameter have no type information. + /** + * method_with_docstring. + * + * Dolor sit amet. + * + * @param a type but no default + * + * @result result1 return value + */ + @Pure + @PythonName("method_with_docstring") + fun methodWithDocstring( + a + ) -> result1: Boolean } // TODO Some parameter have no type information. class ClassWithVariousParameterTypes( - @PythonName("no_type") noType, - @PythonName("optional_type") optionalType, - @PythonName("none_type") noneType, - @PythonName("int_type") intType, - @PythonName("bool_type") boolType, - @PythonName("str_type") strType, - @PythonName("float_type") floatType, - @PythonName("multiple_types") multipleTypes, - @PythonName("list_type_1") listType1, - @PythonName("list_type_2") listType2, - @PythonName("list_type_3") listType3, - @PythonName("list_type_4") listType4, - @PythonName("list_type_5") listType5, - @PythonName("set_type_1") setType1, - @PythonName("set_type_2") setType2, - @PythonName("set_type_3") setType3, - @PythonName("set_type_4") setType4, - @PythonName("set_type_5") setType5, - @PythonName("tuple_type_1") tupleType1, - @PythonName("tuple_type_2") tupleType2, - @PythonName("tuple_type_3") tupleType3, - @PythonName("tuple_type_4") tupleType4, - @PythonName("any_type") anyType: Any, - @PythonName("optional_type_2") optionalType2: Int?, - @PythonName("class_type") classType, - @PythonName("imported_type") importedType + @PythonName("no_type") noType, + @PythonName("optional_type") optionalType, + @PythonName("none_type") noneType, + @PythonName("int_type") intType, + @PythonName("bool_type") boolType, + @PythonName("str_type") strType, + @PythonName("float_type") floatType, + @PythonName("multiple_types") multipleTypes, + @PythonName("list_type_1") listType1, + @PythonName("list_type_2") listType2, + @PythonName("list_type_3") listType3, + @PythonName("list_type_4") listType4, + @PythonName("list_type_5") listType5, + @PythonName("set_type_1") setType1, + @PythonName("set_type_2") setType2, + @PythonName("set_type_3") setType3, + @PythonName("set_type_4") setType4, + @PythonName("set_type_5") setType5, + @PythonName("tuple_type_1") tupleType1, + @PythonName("tuple_type_2") tupleType2, + @PythonName("tuple_type_3") tupleType3, + @PythonName("tuple_type_4") tupleType4, + @PythonName("any_type") anyType: Any, + @PythonName("optional_type_2") optionalType2: Int?, + @PythonName("class_type") classType, + @PythonName("imported_type") importedType ) /**