Skip to content

Commit

Permalink
Use 'None' as argument default
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed May 22, 2024
1 parent 596949e commit d7b09f9
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 12 deletions.
4 changes: 3 additions & 1 deletion colcon_core/argument_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ def decorate_argument_parser(self, *, parser):
raise NotImplementedError()


def get_argument_parser_extensions(*, group_name=__name__):
def get_argument_parser_extensions(*, group_name=None):
"""
Get the available argument parser extensions.
The extensions are ordered by their priority and entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.ARGUMENT_PARSER_DECORATOR_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/environment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ def create_environment_hooks(self, prefix_path, pkg_name):
raise NotImplementedError()


def get_environment_extensions(*, group_name=__name__):
def get_environment_extensions(*, group_name=None):
"""
Get the available environment extensions.
The extensions are ordered by their priority and entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name in list(extensions.keys()):
extension = extensions[name]
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/event_handler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def __call__(self, event):
raise NotImplementedError()


def get_event_handler_extensions(*, context, group_name=__name__):
def get_event_handler_extensions(*, context, group_name=None):
"""
Get the available event handler extensions.
The extensions are ordered by their priority and entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.EVENT_HANDLER_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _flush(self):
self._event_controller.flush()


def get_executor_extensions(*, group_name=__name__):
def get_executor_extensions(*, group_name=None):
"""
Get the available executor extensions.
Expand All @@ -206,6 +206,8 @@ def get_executor_extensions(*, group_name=__name__):
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.EXECUTOR_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/package_augmentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ def augment_package(
raise NotImplementedError()


def get_package_augmentation_extensions(*, group_name=__name__):
def get_package_augmentation_extensions(*, group_name=None):
"""
Get the available package augmentation extensions.
The extensions are ordered by their priority and entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.PACKAGE_AUGMENTATION_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/package_discovery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ def discover(self, *, args, identification_extensions):
raise NotImplementedError()


def get_package_discovery_extensions(*, group_name=__name__):
def get_package_discovery_extensions(*, group_name=None):
"""
Get the available package discovery extensions.
The extensions are ordered by their priority and entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.PACKAGE_DISCOVERY_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/package_identification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def identify(self, desc: PackageDescriptor):
raise NotImplementedError()


def get_package_identification_extensions(*, group_name=__name__):
def get_package_identification_extensions(*, group_name=None):
"""
Get the available package identification extensions.
Expand All @@ -73,6 +73,8 @@ def get_package_identification_extensions(*, group_name=__name__):
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.PACKAGE_IDENTIFICATION_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/package_selection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ def add_arguments(parser):
_add_package_selection_arguments(parser)


def get_package_selection_extensions(*, group_name=__name__):
def get_package_selection_extensions(*, group_name=None):
"""
Get the available package selection extensions.
The extensions are ordered by their entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.PACKAGE_SELECTION_NAME = name
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/prefix_path/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def extend_prefix_path(self, paths):
raise NotImplementedError()


def get_prefix_path_extensions(*, group_name=__name__):
def get_prefix_path_extensions(*, group_name=None):
"""
Get the available prefix path extensions.
Expand All @@ -49,6 +49,8 @@ def get_prefix_path_extensions(*, group_name=__name__):
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.PREFIX_PATH_NAME = name
Expand Down
8 changes: 6 additions & 2 deletions colcon_core/shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async def generate_command_environment(
raise NotImplementedError()


def get_shell_extensions(*, group_name=__name__):
def get_shell_extensions(*, group_name=None):
"""
Get the available shell extensions.
Expand All @@ -282,6 +282,8 @@ def get_shell_extensions(*, group_name=__name__):
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.SHELL_NAME = name
Expand Down Expand Up @@ -593,7 +595,7 @@ def find_installed_packages(self, install_base: Path):
raise NotImplementedError()


def get_find_installed_packages_extensions(*, group_name=__name__):
def get_find_installed_packages_extensions(*, group_name=None):
"""
Get the available package identification extensions.
Expand All @@ -602,6 +604,8 @@ def get_find_installed_packages_extensions(*, group_name=__name__):
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(
group_name + '.find_installed_packages')
for name, extension in extensions.items():
Expand Down
4 changes: 3 additions & 1 deletion colcon_core/verb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ def main(self, *, context):
raise NotImplementedError()


def get_verb_extensions(*, group_name=__name__):
def get_verb_extensions(*, group_name=None):
"""
Get the available verb extensions.
The extensions are ordered by their entry point name.
:rtype: OrderedDict
"""
if group_name is None:
group_name = __name__
extensions = instantiate_extensions(group_name)
for name, extension in extensions.items():
extension.VERB_NAME = name
Expand Down

0 comments on commit d7b09f9

Please sign in to comment.