Skip to content

Commit

Permalink
Fixes all linter issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
hidmic committed Jan 11, 2019
1 parent 234ce1a commit 161faf0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ if(NOT rosidl_generate_action_interfaces_SKIP_INSTALL)
if(NOT _action_package_dir STREQUAL "")
install(FILES ${_generated_action_py_files}
DESTINATION "${PYTHON_INSTALL_DIR}/${PROJECT_NAME}/${_action_package_dir}"
)
)
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion rosidl_generator_py/resource/_action.py.em
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Metaclass(type):
'Failed to import needed modules for type support:\n' + traceback.format_exc())
else:
cls._TYPE_SUPPORT = module.type_support_action__@(subfolder)_@(module_name)

@{
preffix = '_' + convert_camel_case_to_lower_case_underscore(spec.action_name) + '__'
suffixes = ['feedback', 'goal', 'result']
Expand All @@ -48,6 +47,7 @@ print('%sif %s.Metaclass._TYPE_SUPPORT is None:' % (' ' * 4 * 3, '_cancel_goal')
print('%s%s.Metaclass.__import_type_support__()' % (' ' * 4 * 4, '_cancel_goal'))
}@


class @(spec.action_name)(metaclass=Metaclass):
from action_msgs.srv._cancel_goal import CancelGoal as CancelGoalService
from action_msgs.msg._goal_status_array import GoalStatusArray as GoalStatusMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,16 @@
static_includes = set([
'#include <rosidl_generator_c/visibility_control.h>',
])

if message_specs:
static_includes.add('#include <rosidl_generator_c/message_type_support_struct.h>')

if service_specs:
static_includes.add('#include <rosidl_generator_c/service_type_support_struct.h>')

if action_specs:
static_includes.add('#include <rosidl_generator_c/action_type_support_struct.h>')
}@
@[for value in sorted(static_includes)]@
@(value)
@[end for]@

@{
includes = {}
for spec, subfolder in message_specs:
Expand All @@ -57,7 +53,7 @@ for spec, subfolder in service_specs:
@[for v in sorted(includes.values())]@
@(v)
@[end for]@

@
@[for spec, subfolder in message_specs]@
@{
pkg_name = spec.base_type.pkg_name
Expand Down Expand Up @@ -141,6 +137,7 @@ _register_msg_type__@(subfolder)__@(type_name)(PyObject * pymodule)
return 0;
}
@[end for]@
@
@[for spec, subfolder in service_specs]@
@{
type_name = convert_camel_case_to_lower_case_underscore(spec.srv_name)
Expand Down Expand Up @@ -176,7 +173,7 @@ _register_srv_type__@(subfolder)__@(type_name)(PyObject * pymodule)
return 0;
}
@[end for]@

@
@[for spec, subfolder in action_specs]@
@{
type_name = convert_camel_case_to_lower_case_underscore(spec.action_name)
Expand Down
13 changes: 6 additions & 7 deletions rosidl_generator_py/rosidl_generator_py/generate_py_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def generate_py(generator_arguments_file, typesupport_impls):

path_to_module = os.path.join(args['output_dir'], subfolder, '__init__.py')

content = ""
content = ''
if os.path.isfile(path_to_module):
with open(path_to_module, 'r') as f:
content = f.read()
Expand All @@ -129,17 +129,16 @@ def generate_py(generator_arguments_file, typesupport_impls):
if action_specs:
block_name += '_action'
content = re.sub(
r"# BEGIN %s$.*^# END %s" % (block_name, block_name),
r'# BEGIN %s$.*^# END %s' % (block_name, block_name),
'', content, 0, re.M | re.S
)
content = re.sub(r"^\s*$", '', content, 0, re.M)
content += ''.join(
content = re.sub(r'^\s*$', '', content, 0, re.M)
content = ''.join(
['# BEGIN %s\n' % block_name] +
sorted(import_list.values()) + # import_line
sorted(import_list.values()) + # import_line
sorted(import_list.keys()) + # noqa_line
['# END %s\n' % block_name]
)
print(content)
) + content
f.write(content)

for template_file, generated_filenames in mapping_msg_pkg_extension.items():
Expand Down

0 comments on commit 161faf0

Please sign in to comment.