Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Finish adding types to rosidl_parser #832

Open
wants to merge 24 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 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
1 change: 1 addition & 0 deletions rosidl_parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ament_python_install_package(${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_mypy REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
1 change: 1 addition & 0 deletions rosidl_parser/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<exec_depend>python3-lark-parser</exec_depend>
<exec_depend>rosidl_adapter</exec_depend> <!-- TODO(dirk-thomas) only for backward compatibilty -->

<test_depend>ament_cmake_mypy</test_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
9 changes: 5 additions & 4 deletions rosidl_parser/rosidl_parser/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing import Final
from typing import Iterable
from typing import List
from typing import Literal
from typing import Optional
from typing import Set
from typing import Tuple
Expand Down Expand Up @@ -95,7 +96,7 @@
)

if TYPE_CHECKING:
from typing import Literal, TypeAlias
from typing_extensions import TypeAlias
SignedNonexplicitIntegerTypeValues = Literal['short', 'long', 'long long']
UnsignedNonexplicitIntegerTypeValues = Literal['unsigned short', 'unsigned long',
'unsigned long long']
Expand All @@ -108,7 +109,7 @@
BooleanValue = Literal['boolean']
OctetValue = Literal['octet']

SignedExplicitIntegerTypeValues = Literal['int8', 'int16', 'int32' 'int64']
SignedExplicitIntegerTypeValues = Literal['int8', 'int16', 'int32', 'int64']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaky! Nice catch

UnsignedExplicitIntegerTypeValues = Literal['uint8', 'uint16', 'uint32', 'uint64']

ExplicitIntegerTypeValues = Union[SignedExplicitIntegerTypeValues,
Expand Down Expand Up @@ -299,7 +300,7 @@ class BoundedWString(AbstractWString):

__slots__ = ('maximum_size', )

def __init__(self, maximum_size: int) -> None:
def __init__(self, maximum_size: Union[int, str]) -> None:
"""
Create a BoundedWString.

Expand Down Expand Up @@ -803,7 +804,7 @@ class IdlLocator:

__slots__ = ('basepath', 'relative_path')

def __init__(self, basepath: str, relative_path: str) -> None:
def __init__(self, basepath: pathlib.Path, relative_path: pathlib.Path) -> None:
"""
Create an IdlLocator.

Expand Down
Loading
Loading