-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
enhancement 💡New feature or requestNew feature or request
Description
Is your feature request related to a problem?
Attributes, parameters and results in stubs, which are generated from python code, currently have no type information if the python code did not have type hints. Example:
# Python Code
class A:
attr1: int
attr2 = 2
def my_func(a = 1):
return a// Safe-DS stubs
class A() {
attr1: Int
attr2
fun myFunc(a = 1) -> result1: Any
}
Furthermore, currently, if a function has no return type specified, the API will generate "Any" as the return type. This value has to be removed and the type has to be either inferred with mypy or left empty.
Desired solution
The API Class has to be adjusted to also infer type information with mypy if no type hints are given.
Then the following should be done:
- Try to infer the type from the assigned value if mypy offers this functionality.
// Safe-DS stubs
class A() {
attr1: Int
attr2: Int
fun myFunc(a: Int = 1) -> result1: Int
}
- If this is not possible (in general or for a specific case) add a TODO.
// Safe-DS stubs
class A() {
attr1: Int
// TODO Attribute has no type information.
attr2
// TODO Parameter has no type information.
// TODO Result has no type information.
fun myFunc(a) -> result1
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancement 💡New feature or requestNew feature or request
Type
Projects
Status
✔️ Done