Skip to content

Commit

Permalink
Fix Unpack erros by removing kwargs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
  • Loading branch information
InvincibleRMC committed Sep 28, 2024
1 parent 4fef19e commit 5017663
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
18 changes: 8 additions & 10 deletions rosidl_cli/rosidl_cli/command/generate/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@
# limitations under the License.

from pathlib import Path
from typing import cast, List, TYPE_CHECKING
from typing import cast, List, Optional

from rosidl_cli.extensions import Extension
from rosidl_cli.extensions import load_extensions


if TYPE_CHECKING:
from rosidl_cli.extensions import LoadExtensionsArg
from typing_extensions import Unpack


class GenerateCommandExtension(Extension):
"""
The extension point for source code generation.
Expand Down Expand Up @@ -56,14 +51,17 @@ def generate(
raise NotImplementedError()


def load_type_extensions(**kwargs: 'Unpack[LoadExtensionsArg]') -> List[GenerateCommandExtension]:
def load_type_extensions(*, specs: Optional[List[str]],
strict: bool) -> List[GenerateCommandExtension]:
"""Load extensions for type representation source code generation."""
extensions = load_extensions('rosidl_cli.command.generate.type_extensions', **kwargs)
extensions = load_extensions('rosidl_cli.command.generate.type_extensions', specs=specs,
strict=strict)
return cast(List[GenerateCommandExtension], extensions)


def load_typesupport_extensions(**kwargs: 'Unpack[LoadExtensionsArg]'
def load_typesupport_extensions(*, specs: Optional[List[str]], strict: bool
) -> List[GenerateCommandExtension]:
"""Load extensions for type support source code generation."""
extensions = load_extensions('rosidl_cli.command.generate.typesupport_extensions', **kwargs)
extensions = load_extensions('rosidl_cli.command.generate.typesupport_extensions',
specs=specs, strict=strict)
return cast(List[GenerateCommandExtension], extensions)
11 changes: 3 additions & 8 deletions rosidl_cli/rosidl_cli/command/translate/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from pathlib import Path
from typing import cast, ClassVar, List, TYPE_CHECKING
from typing import cast, ClassVar, List, Optional

from rosidl_cli.extensions import Extension
from rosidl_cli.extensions import load_extensions


if TYPE_CHECKING:
from rosidl_cli.extensions import LoadExtensionsArg
from typing_extensions import Unpack


class TranslateCommandExtension(Extension):
"""
The extension point for interface definition translation.
Expand Down Expand Up @@ -67,10 +62,10 @@ def translate(
raise NotImplementedError()


def load_translate_extensions(**kwargs: 'Unpack[LoadExtensionsArg]'
def load_translate_extensions(*, specs: Optional[List[str]], strict: bool
) -> List[TranslateCommandExtension]:
"""Load extensions for interface definition translation."""
extensions = load_extensions(
'rosidl_cli.command.translate.extensions', **kwargs
'rosidl_cli.command.translate.extensions', specs=specs, strict=strict
)
return cast(List[TranslateCommandExtension], extensions)
14 changes: 4 additions & 10 deletions rosidl_cli/rosidl_cli/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@
import importlib.metadata as importlib_metadata
import logging
import sys
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from typing import Any, Dict, List, Optional, Union

if TYPE_CHECKING:
from typing import TypedDict
from typing_extensions import Unpack, NotRequired

class LoadEntryPointsArgs(TypedDict):
specs: NotRequired[Optional[List[str]]]

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -71,8 +65,8 @@ def get_entry_points(group_name: str, *, specs: Optional[List[str]] = None, stri
return entry_points


def load_entry_points(group_name: str, *, strict: bool = False,
**kwargs: 'Unpack[LoadEntryPointsArgs]'
def load_entry_points(group_name: str, *, specs: Optional[List[str]],
strict: bool = False,
) -> Dict[str, Any]:
"""
Load entry points for a specific group.
Expand All @@ -86,7 +80,7 @@ def load_entry_points(group_name: str, *, strict: bool = False,
"""
loaded_entry_points: Dict[str, Any] = {}
for name, entry_point in get_entry_points(
group_name, strict=strict, **kwargs
group_name, strict=strict, specs=specs
).items():
try:
loaded_entry_points[name] = entry_point.load()
Expand Down

0 comments on commit 5017663

Please sign in to comment.