Skip to content

Commit

Permalink
Fix: typing. Iterable doesn't have __getitem__ (#393)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthijs van der Burgh <[email protected]>
  • Loading branch information
MatthijsBurgh authored Mar 6, 2024
1 parent b3ab729 commit d71c7a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions launch_ros/launch_ros/substitutions/executable_in_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""Module for the ExecutableInPackage substitution."""

import os
from typing import Iterable
from typing import List
from typing import Sequence
from typing import Text

from launch.frontend import expose_substitution
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self, executable: SomeSubstitutionsType, package: SomeSubstitutions
self.__executable = normalize_to_list_of_substitutions(executable)

@classmethod
def parse(cls, data: Iterable[SomeSubstitutionsType]):
def parse(cls, data: Sequence[SomeSubstitutionsType]):
"""Parse a ExecutableInPackage substitution."""
if not data or len(data) != 2:
raise AttributeError('exec-in-package substitution expects 2 arguments')
Expand Down
4 changes: 2 additions & 2 deletions launch_ros/launch_ros/substitutions/find_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Module for the FindPackage substitution."""

from typing import Iterable
from typing import List
from typing import Sequence
from typing import Text

from ament_index_python.packages import get_package_prefix
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(
self.__package = normalize_to_list_of_substitutions(package)

@classmethod
def parse(cls, data: Iterable[SomeSubstitutionsType]):
def parse(cls, data: Sequence[SomeSubstitutionsType]):
"""Parse a FindPackage substitution."""
if not data or len(data) != 1:
raise AttributeError('find package substitutions expect 1 argument')
Expand Down
3 changes: 2 additions & 1 deletion launch_ros/launch_ros/substitutions/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from typing import Iterable
from typing import List
from typing import Optional
from typing import Sequence
from typing import Text
from typing import Union

Expand Down Expand Up @@ -68,7 +69,7 @@ def __init__(
normalize_to_list_of_substitutions(str_normalized_default)

@classmethod
def parse(cls, data: Iterable[SomeSubstitutionsType]):
def parse(cls, data: Sequence[SomeSubstitutionsType]):
"""Parse a Parameter substitution."""
if len(data) < 1 or len(data) > 2:
raise TypeError('param substitution expects 1 or 2 arguments')
Expand Down

0 comments on commit d71c7a9

Please sign in to comment.