Skip to content

Commit 37dd8c2

Browse files
committed
Generator linting erros
1 parent e30b179 commit 37dd8c2

File tree

15 files changed

+64
-59
lines changed

15 files changed

+64
-59
lines changed

clearpath_generator_common/clearpath_generator_common/bash/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
from clearpath_config.common.types.discovery import Discovery
3636
from clearpath_generator_common.bash.writer import BashWriter
37-
from clearpath_generator_common.common import BashFile, BaseGenerator
37+
from clearpath_generator_common.common import BaseGenerator, BashFile
3838

3939

4040
class BashGenerator(BaseGenerator):

clearpath_generator_common/clearpath_generator_common/common.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2626
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
# POSSIBILITY OF SUCH DAMAGE.
28-
29-
from typing import List
30-
3128
import getopt
3229
import os
3330
import sys
3431

32+
from typing import List
33+
3534
from ament_index_python.packages import get_package_share_directory
3635

36+
from clearpath_config.clearpath_config import ClearpathConfig
3737
from clearpath_config.common.utils.dictionary import flatten_dict
3838
from clearpath_config.common.utils.yaml import read_yaml
39-
from clearpath_config.clearpath_config import ClearpathConfig
4039

4140

4241
class Package():
42+
4343
def __init__(self,
4444
name: str
4545
) -> None:
@@ -50,15 +50,17 @@ def get_name(self) -> str:
5050
return self.name
5151

5252
def find_package_share(self) -> str:
53-
return '{0} = FindPackageShare(\'{1}\')'.format(self.declaration, self.name)
53+
return "{0} = FindPackageShare('{1}')".format(self.declaration, self.name)
5454

5555

5656
class LaunchFile():
5757
class LaunchComponent():
58+
5859
def __init__(self, name: str) -> None:
5960
self.name = name
6061

6162
class Process(LaunchComponent):
63+
6264
def __init__(self,
6365
name: str,
6466
cmd: List[list] | List[str]) -> None:
@@ -67,17 +69,20 @@ def __init__(self,
6769
self.cmd = cmd
6870

6971
class LaunchArg(LaunchComponent):
72+
7073
def __init__(self, name: str, default_value: str = '', description: str = '') -> None:
7174
super().__init__(name)
7275
self.default_value = default_value
7376
self.description = description
7477
self.declaration = 'launch_arg_' + self.name
7578

7679
class Variable(LaunchComponent):
80+
7781
def __init__(self, name: str) -> None:
7882
super().__init__(name)
7983

8084
class Node(LaunchComponent):
85+
8186
def __init__(self,
8287
name: str,
8388
package: Package,
@@ -143,6 +148,7 @@ def get_full_path(self):
143148

144149

145150
class ParamFile():
151+
146152
def __init__(self,
147153
name: str,
148154
namespace: str = '',
@@ -193,6 +199,7 @@ def update(self, parameters: dict) -> None:
193199

194200

195201
class BashFile():
202+
196203
def __init__(self,
197204
filename: str,
198205
path: str,

clearpath_generator_common/clearpath_generator_common/description/attachments.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@
2929
# Redistribution and use in source and binary forms, with or without
3030
# modification, is not permitted without the express permission
3131
# of Clearpath Robotics.
32+
from typing import List
3233

3334
from clearpath_config.platform.attachments.a200 import A200Attachment
3435
from clearpath_config.platform.attachments.config import BaseAttachment
3536
from clearpath_config.platform.attachments.j100 import J100Attachment
3637
from clearpath_config.platform.attachments.w200 import W200Attachment
3738
from clearpath_config.platform.types.bumper import Bumper
3839

39-
from typing import List
40-
4140

4241
class AttachmentsDescription():
4342
class BaseDescription():

clearpath_generator_common/clearpath_generator_common/description/generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636

3737
from clearpath_config.common.types.package_path import PackagePath
3838
from clearpath_generator_common.common import BaseGenerator
39-
from clearpath_generator_common.description.writer import XacroWriter
39+
from clearpath_generator_common.description.attachments import AttachmentsDescription
40+
from clearpath_generator_common.description.links import LinkDescription
4041
from clearpath_generator_common.description.mounts import MountDescription
4142
from clearpath_generator_common.description.platform import PlatformDescription
42-
from clearpath_generator_common.description.links import LinkDescription
43-
from clearpath_generator_common.description.attachments import AttachmentsDescription
4443
from clearpath_generator_common.description.sensors import SensorDescription
44+
from clearpath_generator_common.description.writer import XacroWriter
4545

4646

4747
class DescriptionGenerator(BaseGenerator):

clearpath_generator_common/clearpath_generator_common/description/links.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
# of Clearpath Robotics.
3232
import os
3333

34+
from typing import List
35+
3436
from clearpath_config.common.types.file import File
3537
from clearpath_config.links.links import Link
36-
from clearpath_config.links.types.link import BaseLink
3738
from clearpath_config.links.types.box import Box
3839
from clearpath_config.links.types.cylinder import Cylinder
40+
from clearpath_config.links.types.link import BaseLink
3941
from clearpath_config.links.types.mesh import Mesh
4042
from clearpath_config.links.types.sphere import Sphere
4143

42-
from typing import List
43-
4444

4545
class LinkDescription():
4646
class BaseDescription():
@@ -104,12 +104,12 @@ def __init__(self, link: Mesh) -> None:
104104
super().__init__(link)
105105
if (link.visual.package):
106106
self.parameters.update({
107-
self.VISUAL: os.path.join("package://" + link.visual.package,
107+
self.VISUAL: os.path.join('package://' + link.visual.package,
108108
File.clean(link.visual.path, make_abs=False))
109109
})
110110
else:
111111
self.parameters.update({
112-
self.VISUAL: "file://" + File.clean(link.visual.path, make_abs=False)
112+
self.VISUAL: 'file://' + File.clean(link.visual.path, make_abs=False)
113113
})
114114

115115
MODEL = {

clearpath_generator_common/clearpath_generator_common/description/mounts.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@
2929
# Redistribution and use in source and binary forms, with or without
3030
# modification, is not permitted without the express permission
3131
# of Clearpath Robotics.
32+
from typing import List
3233

33-
from clearpath_config.mounts.types.mount import BaseMount
3434
from clearpath_config.mounts.types.fath_pivot import FathPivot
35+
from clearpath_config.mounts.types.mount import BaseMount
3536
from clearpath_config.mounts.types.pacs import PACS
3637
from clearpath_config.mounts.types.post import Post
3738
from clearpath_config.mounts.types.sick import SICKStand
3839

39-
from typing import List
40-
4140

4241
class MountDescription():
4342
class BaseDescription():

clearpath_generator_common/clearpath_generator_common/description/platform.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
# Redistribution and use in source and binary forms, with or without
3030
# modification, is not permitted without the express permission
3131
# of Clearpath Robotics.
32+
import os
3233

33-
from clearpath_config.common.types.platform import Platform
3434
from clearpath_config.clearpath_config import ClearpathConfig
35+
from clearpath_config.common.types.platform import Platform
3536
from clearpath_config.platform.platform import DescriptionPackagePath
36-
import os
3737

3838

3939
class PlatformDescription():
@@ -67,6 +67,7 @@ def __init__(self, config: ClearpathConfig) -> None:
6767
)
6868

6969
class GenericPlatform(BasePlatform):
70+
7071
def __init__(self, config: ClearpathConfig) -> None:
7172
description = config.platform.description
7273
package = description[DescriptionPackagePath.PACKAGE]
@@ -75,7 +76,7 @@ def __init__(self, config: ClearpathConfig) -> None:
7576
super().__init__(
7677
package=package,
7778
file=os.path.basename(path),
78-
path=os.path.dirname(path)+"/",
79+
path=os.path.dirname(path)+'/',
7980
macro=macro,
8081
parameters=None
8182
)

clearpath_generator_common/clearpath_generator_common/description/sensors.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@
2929
# Redistribution and use in source and binary forms, with or without
3030
# modification, is not permitted without the express permission
3131
# of Clearpath Robotics.
32+
from typing import List
3233

33-
from clearpath_config.sensors.types.sensor import BaseSensor
34-
from clearpath_config.sensors.types.lidars_2d import BaseLidar2D, HokuyoUST, SickLMS1XX
35-
from clearpath_config.sensors.types.lidars_3d import BaseLidar3D, VelodyneLidar
36-
from clearpath_config.sensors.types.cameras import BaseCamera, IntelRealsense, FlirBlackfly
34+
from clearpath_config.sensors.types.cameras import BaseCamera, FlirBlackfly, IntelRealsense
3735
from clearpath_config.sensors.types.imu import (
3836
BaseIMU,
3937
CHRoboticsUM6,
4038
Microstrain,
4139
RedshiftUM7
4240
)
43-
44-
from typing import List
41+
from clearpath_config.sensors.types.lidars_2d import BaseLidar2D, HokuyoUST, SickLMS1XX
42+
from clearpath_config.sensors.types.lidars_3d import BaseLidar3D, VelodyneLidar
43+
from clearpath_config.sensors.types.sensor import BaseSensor
4544

4645

4746
class SensorDescription():

clearpath_generator_common/clearpath_generator_common/launch/generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
# Redistribution and use in source and binary forms, with or without
3232
# modification, is not permitted without the express permission
3333
# of Clearpath Robotics.
34-
35-
from clearpath_generator_common.common import BaseGenerator, LaunchFile
36-
3734
import os
3835
import shutil
3936

37+
from clearpath_generator_common.common import BaseGenerator, LaunchFile
38+
4039

4140
class LaunchGenerator(BaseGenerator):
41+
4242
def __init__(self,
4343
setup_path: str = '/etc/clearpath/') -> None:
4444
super().__init__(setup_path)

clearpath_generator_common/clearpath_generator_common/launch/writer.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2626
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
# POSSIBILITY OF SUCH DAMAGE.
28+
import os
2829

2930
from typing import List
30-
import os
3131

3232
from clearpath_generator_common.common import LaunchFile, Package
3333

@@ -90,9 +90,9 @@ def write_obj(self, obj: object, indent_level=1):
9090

9191
def write_key_value_pair(self, key: str, value, indent_level=1):
9292
if isinstance(value, str):
93-
self.write('\'{0}\': \'{1}\''.format(key, value), indent_level)
93+
self.write("'{0}': '{1}'".format(key, value), indent_level)
9494
else:
95-
self.write('\'{0}\': {1}'.format(key, value), indent_level)
95+
self.write("'{0}': {1}".format(key, value), indent_level)
9696

9797
def write_dictionary(self, dictionary: dict, indent_level=1):
9898
self.write('{', indent_level)
@@ -121,7 +121,7 @@ def find_package(self, package: Package):
121121
self.included_packages.append(package)
122122

123123
def path_join_substitution(package, folder, file):
124-
return 'PathJoinSubstitution([{0}, \'{1}\', \'{2}\'])'.format(package, folder, file)
124+
return "PathJoinSubstitution([{0}, '{1}', '{2}'])".format(package, folder, file)
125125

126126
def add_launch_arg(self, launch_arg: LaunchFile.LaunchArg):
127127
if launch_arg not in self.declared_launch_args:
@@ -184,13 +184,13 @@ def generate_file(self):
184184
for arg in self.declared_launch_args:
185185
# Declare launch arg
186186
self.write('{0} = DeclareLaunchArgument('.format(arg.declaration))
187-
self.write('\'{0}\','.format(arg.name), indent_level=2)
188-
self.write('default_value=\'{0}\','.format(arg.default_value), indent_level=2)
189-
self.write('description=\'{0}\')'.format(arg.description), indent_level=2)
187+
self.write("'{0}',".format(arg.name), indent_level=2)
188+
self.write("default_value='{0}',".format(arg.default_value), indent_level=2)
189+
self.write("description='{0}')".format(arg.description), indent_level=2)
190190
self.write_newline()
191191

192192
# Launch configuration
193-
self.write('{0} = LaunchConfiguration(\'{0}\')'.format(arg.name))
193+
self.write("{0} = LaunchConfiguration('{0}')".format(arg.name))
194194
self.write_newline()
195195

196196
if len(self.included_launch_files) > 0:
@@ -204,12 +204,12 @@ def generate_file(self):
204204
self.write_comment('Declare launch files')
205205
for launch_file in self.included_launch_files:
206206
if launch_file.package is None:
207-
self.write('{0} = \'{1}\''.format(
207+
self.write("{0} = '{1}'".format(
208208
launch_file.declaration,
209209
os.path.join(launch_file.path, launch_file.file)))
210210
else:
211211
self.write('{0} = PathJoinSubstitution(['.format(launch_file.declaration))
212-
self.write('{0}, \'{1}\', \'{2}\'])'.format(
212+
self.write("{0}, '{1}', '{2}'])".format(
213213
launch_file.package.declaration,
214214
launch_file.path,
215215
launch_file.file), indent_level=2)
@@ -234,11 +234,11 @@ def generate_file(self):
234234
self.write_comment('Nodes')
235235
for node in self.nodes:
236236
self.write('{0} = Node('.format(node.declaration))
237-
self.write('name=\'{0}\','.format(node.name), indent_level=2)
238-
self.write('executable=\'{0}\','.format(node.executable), indent_level=2)
239-
self.write('package=\'{0}\','.format(node.package), indent_level=2)
240-
self.write('namespace=\'{0}\','.format(node.namespace), indent_level=2)
241-
self.write('output=\'screen\',', indent_level=2)
237+
self.write("name='{0}',".format(node.name), indent_level=2)
238+
self.write("executable='{0}',".format(node.executable), indent_level=2)
239+
self.write("package='{0}',".format(node.package), indent_level=2)
240+
self.write("namespace='{0}',".format(node.namespace), indent_level=2)
241+
self.write("output='screen',", indent_level=2)
242242
# Arguments
243243
if len(node.arguments) > 0:
244244
self.write('arguments=', indent_level=2)

0 commit comments

Comments
 (0)