Skip to content

Commit

Permalink
Fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Flova committed Feb 6, 2025
1 parent 87da6fd commit 931ed7b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def dropEvent(self, e): # noqa: N802
# fmt: on
super().dropEvent(e)
items = []
for i in range(0, self.count()):
items.append(self.item(i).text())
for i in range(self.count()):
items.append(self.item(i).text()) # type: ignore[union-attr]
self.frame_order_callback(items)

# fmt: off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ def get_joint_values(self, used_joint_names, scaled=False):
def get_joint_state_msg(self):
js = JointState()
js.name = []
js.header.stamp = Time(seconds=int(self.time), nanoseconds=self.time % 1 * 1e9).to_msg()
js.header.stamp = Time(seconds=int(self.time), nanoseconds=int(self.time % 1 * 1e9)).to_msg()
js.position = []
js.effort = []
for joint_name in self.external_motor_names:
Expand All @@ -796,7 +796,7 @@ def publish_joint_states(self):

def get_imu_msg(self, head=False):
msg = Imu()
msg.header.stamp = Time(seconds=int(self.time), nanoseconds=self.time % 1 * 1e9).to_msg()
msg.header.stamp = Time(seconds=int(self.time), nanoseconds=int(self.time % 1 * 1e9)).to_msg()
if head:
msg.header.frame_id = self.head_imu_frame
else:
Expand Down Expand Up @@ -841,7 +841,7 @@ def publish_imu(self):

def publish_camera(self):
img_msg = Image()
img_msg.header.stamp = Time(seconds=int(self.time), nanoseconds=self.time % 1 * 1e9).to_msg()
img_msg.header.stamp = Time(seconds=int(self.time), nanoseconds=int(self.time % 1 * 1e9)).to_msg()
img_msg.header.frame_id = self.camera_optical_frame
img_msg.height = self.camera.getHeight()
img_msg.width = self.camera.getWidth()
Expand Down Expand Up @@ -917,7 +917,7 @@ def get_image(self):
return self.camera.getImage()

def get_pressure_message(self):
current_time = Time(seconds=int(self.time), nanoseconds=self.time % 1 * 1e9).to_msg()
current_time = Time(seconds=int(self.time), nanoseconds=int(self.time % 1 * 1e9)).to_msg()
if not self.foot_sensors_active or self.pressure_sensors is None:
cop_r = PointStamped()
cop_r.header.frame_id = self.r_sole_frame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def handle_gui(self):
return key

def publish_clock(self):
self.clock_msg.clock = Time(seconds=int(self.time), nanoseconds=self.time % 1 * 1e9).to_msg()
self.clock_msg.clock = Time(seconds=int(self.time), nanoseconds=int(self.time % 1 * 1e9)).to_msg()
self.clock_publisher.publish(self.clock_msg)

def set_gravity(self, active):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
[mypy]
check_untyped_defs = True
ignore_missing_imports = True
exclude = .*_pb2\.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def is_estimate_in_fov(self, header: Header) -> bool:
# Transform to camera frame
try:
ball_in_camera_optical_frame = self.tf_buffer.transform(
ball_pose, self.camera_info.header.frame_id, timeout=Duration(nanoseconds=0.5 * (10**9))
ball_pose, self.camera_info.header.frame_id, timeout=Duration(nanoseconds=int(0.5 * 1e9))
)
except (tf2.ConnectivityException, tf2.LookupException, tf2.ExtrapolationException) as e:
self.logger.warning(str(e))
Expand Down

0 comments on commit 931ed7b

Please sign in to comment.