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

Add types to qos.py #1255

Merged
merged 15 commits into from
Aug 7, 2024
6 changes: 3 additions & 3 deletions rclpy/rclpy/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy


class DurationType(Protocol):
class DurationHandle(Protocol):
InvincibleRMC marked this conversation as resolved.
Show resolved Hide resolved
"""Type alias of _rclpy.rcl_duration_t."""

nanoseconds: int
Expand All @@ -41,7 +41,7 @@ def __init__(self, *, seconds: Union[int, float] = 0, nanoseconds: int = 0):
# pybind11 would raise TypeError, but we want OverflowError
raise OverflowError(
'Total nanoseconds value is too large to store in C duration.')
self._duration_handle: DurationType = _rclpy.rcl_duration_t(total_nanoseconds)
self._duration_handle: DurationHandle = _rclpy.rcl_duration_t(total_nanoseconds)

@property
def nanoseconds(self) -> int:
Expand Down Expand Up @@ -106,7 +106,7 @@ def from_msg(cls, msg: builtin_interfaces.msg.Duration) -> 'Duration':
raise TypeError('Must pass a builtin_interfaces.msg.Duration object')
return cls(seconds=msg.sec, nanoseconds=msg.nanosec)

def get_c_duration(self) -> DurationType:
def get_c_duration(self) -> DurationHandle:
return self._duration_handle


Expand Down
Loading