Skip to content

Commit

Permalink
Replace rclpyHandle with type stubs (#1326)
Browse files Browse the repository at this point in the history
* Replace rclpyHandle with stubs

Signed-off-by: Michael Carlstrom <[email protected]>

* Rerun CI

Signed-off-by: Michael Carlstrom <[email protected]>

* Rerun CI

Signed-off-by: Michael Carlstrom <[email protected]>

---------

Signed-off-by: Michael Carlstrom <[email protected]>
Co-authored-by: Shane Loretz <[email protected]>
  • Loading branch information
InvincibleRMC and sloretz authored Aug 8, 2024
1 parent 2949554 commit 1eb4208
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
22 changes: 22 additions & 0 deletions rclpy/rclpy/impl/_rclpy_pybind11.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Sequence


def rclpy_remove_ros_args(pycli_args: Sequence[str]) -> list[str]: ...
"""Remove ROS-specific arguments from argument vector."""

def rclpy_get_rmw_implementation_identifier() -> str: ...
"""Retrieve the identifier for the active RMW implementation."""
14 changes: 1 addition & 13 deletions rclpy/rclpy/impl/implementation_singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,7 @@
# ...
"""


from typing import List, Protocol, Sequence

from rpyutils import import_c_library
package = 'rclpy'

rclpy_implementation: 'rclpyHandle' = import_c_library('._rclpy_pybind11', package)


class rclpyHandle(Protocol):

def rclpy_remove_ros_args(self, pycli_args: Sequence[str]) -> List[str]:
...

def rclpy_get_rmw_implementation_identifier(self) -> str:
...
rclpy_implementation = import_c_library('._rclpy_pybind11', package)
18 changes: 18 additions & 0 deletions rclpy/rclpy/impl/implementation_singleton.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from rclpy.impl import _rclpy_pybind11

rclpy_implementation = _rclpy_pybind11

0 comments on commit 1eb4208

Please sign in to comment.