Skip to content

Commit

Permalink
Update python code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Purg committed Dec 1, 2023
1 parent 3238d17 commit 32f4b8c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ptg_eval_step = "angel_system.ptg_eval.step_completion.evaluate_step:main"

[tool.black]
line-length = 88
target-version = ['py38']
target-version = ['py310']
# 'extend-exclude' excludes files or directories in addition to the defaults
extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories
Expand All @@ -113,7 +113,6 @@ extend-exclude = '''
| ^/angel_system/fasterrcnn
| ^/python-tpl
| ^/ros/(ROS-TCP-Endpoint|rosbag2)
| ^/src/(ROS-TCP-Endpoint|rosbag2) # alternative for within docker container
| ^/hl2ss
| ^/install # container-environment location derivative to source tree
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self):
("inference_img_size", 1280), # inference size (pixels)
("det_conf_threshold", 0.7), # object confidence threshold
("iou_threshold", 0.45), # IOU threshold for NMS
("cuda_device_id", 0, DYNAMIC_TYPE), # cuda device, i.e. 0 or 0,1,2,3 or cpu
("cuda_device_id", 0, DYNAMIC_TYPE), # cuda device: ID int or CPU
("no_trace", True), # don`t trace model
("agnostic_nms", False), # class-agnostic NMS
# Runtime thread checkin heartbeat interval in seconds.
Expand All @@ -77,7 +77,9 @@ def __init__(self):
# Model
self.model: Union[yolov7.models.yolo.Model, TracedModel]
if not self._model_ckpt_fp.is_file():
raise ValueError(f"Model checkpoint file did not exist: {self._model_ckpt_fp}")
raise ValueError(
f"Model checkpoint file did not exist: {self._model_ckpt_fp}"
)
(self.device, self.model, self.stride, self.imgsz) = load_model(
str(self._cuda_device_id), self._model_ckpt_fp, self._inference_img_size
)
Expand Down
15 changes: 8 additions & 7 deletions ros/angel_utils/python/angel_utils/node_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@

def declare_and_get_parameters(
node: rclpy.node.Node,
name_default_tuples: Sequence[Union[
Tuple[str],
Tuple[str, rclpy.node.Parameter.Type],
Tuple[str, Any, rclpy.node.ParameterDescriptor],
]],
name_default_tuples: Sequence[
Union[
Tuple[str],
Tuple[str, rclpy.node.Parameter.Type],
Tuple[str, Any, rclpy.node.ParameterDescriptor],
]
],
namespace="",
) -> Dict[str, Any]:
"""
Expand Down Expand Up @@ -95,8 +97,7 @@ def declare_and_get_parameters(
# default value to deduce that typing from. If nothing is given, we
# declare dynamic typing in a description object.
parameters=(
t if len(t) > 1 else (t[0], None, DYNAMIC_TYPE)
for t in name_default_tuples
t if len(t) > 1 else (t[0], None, DYNAMIC_TYPE) for t in name_default_tuples
),
)
# Check for not-set parameters
Expand Down

0 comments on commit 32f4b8c

Please sign in to comment.