Skip to content

Commit

Permalink
Test for equality to None with 'is' instead of '==' (ros#355)
Browse files Browse the repository at this point in the history
* Test for falsehood instead of '=='
  • Loading branch information
daniel-s-ingram authored and tfoote committed Jan 23, 2019
1 parent 6223549 commit d714a65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tf2_ros/src/tf2_ros/buffer_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def __process_goal(self, goal):
return self.__process_result(self.client.get_result())

def __process_result(self, result):
if result == None:
if not result:
raise tf2.TransformException("The BufferServer returned None for result! Something is likely wrong with the server.")
if result.error == None:
if not result.error:
raise tf2.TransformException("The BufferServer returned None for result.error! Something is likely wrong with the server.")
if result.error.error != result.error.NO_ERROR:
if result.error.error == result.error.LOOKUP_ERROR:
Expand Down
4 changes: 2 additions & 2 deletions tf2_ros/src/tf2_ros/buffer_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def transform(self, object_stamped, target_frame, timeout=rospy.Duration(0.0), n
do_transform = self.registration.get(type(object_stamped))
res = do_transform(object_stamped, self.lookup_transform(target_frame, object_stamped.header.frame_id,
object_stamped.header.stamp, timeout))
if new_type == None:
if not new_type:
return res

return convert(res, new_type)
Expand Down Expand Up @@ -95,7 +95,7 @@ def transform_full(self, object_stamped, target_frame, target_time, fixed_frame,
res = do_transform(object_stamped, self.lookup_transform_full(target_frame, target_time,
object_stamped.header.frame_id, object_stamped.header.stamp,
fixed_frame, timeout))
if new_type == None:
if not new_type:
return res

return convert(res, new_type)
Expand Down

0 comments on commit d714a65

Please sign in to comment.