Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions launch/launch/frontend/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Module for Entity class."""

from typing import List
from typing import Literal
from typing import Optional
from typing import overload
from typing import Text
Expand Down Expand Up @@ -51,14 +50,9 @@ def children(self) -> List['Entity']:
# - If no data type is passed, the return type is str. Similar to the above, it has two
# possibilities: present or not present.
# => 6 overloads to cover every combination
@overload
def get_attr(self, name: Text, *, data_type: Type[TargetType],
optional: Literal[False], can_be_str: bool = True) -> TargetType:
...

@overload
def get_attr(self, name: Text, *, data_type: Type[TargetType], # noqa: F811
optional: Literal[True], can_be_str: bool = True) -> Optional[TargetType]:
optional: bool, can_be_str: bool = True) -> Optional[TargetType]:
...

@overload
Expand All @@ -67,12 +61,7 @@ def get_attr(self, name: Text, *, data_type: Type[TargetType], # noqa: F811
...

@overload
def get_attr(self, name: Text, *, optional: Literal[False], # noqa: F811
can_be_str: bool = True) -> str:
...

@overload
def get_attr(self, name: Text, *, optional: Literal[True], # noqa: F811
def get_attr(self, name: Text, *, optional: bool, # noqa: F811
can_be_str: bool = True) -> Optional[str]:
...

Expand Down