Skip to content

Commit cc1e715

Browse files
authored
[RSDK-4561] Remove unused check (#624)
1 parent e03c710 commit cc1e715

File tree

6 files changed

+24
-34
lines changed

6 files changed

+24
-34
lines changed

src/viam/robot/client.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import viam
1111
from viam import logging
1212
from viam.components.component_base import ComponentBase
13-
from viam.components.movement_sensor import MovementSensor
14-
from viam.components.sensor import Sensor
1513
from viam.errors import ResourceNotFoundError
1614
from viam.proto.common import LogEntry, PoseInFrame, ResourceName, Transform
1715
from viam.proto.robot import (
@@ -305,10 +303,6 @@ async def refresh(self):
305303
if rname.subtype == "remote":
306304
continue
307305

308-
# If the resource is a MovementSensor, DO NOT include Sensor as well (it will get added via MovementSensor)
309-
if rname.subtype == Sensor.SUBTYPE.resource_subtype and MovementSensor.get_resource_name(rname.name) in resource_names:
310-
continue
311-
312306
await self._create_or_reset_client(rname)
313307

314308
for rname in self.resource_names:

src/viam/services/vision/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from viam.services.vision.service import VisionRPCService
33

44
from .client import Classification, Detection, VisionClient
5-
from .vision import Vision, CaptureAllResult
5+
from .vision import CaptureAllResult, Vision
66

77
__all__ = [
88
"CaptureAllResult",

src/viam/services/vision/client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
2828
from viam.utils import ValueTypes, dict_to_struct, struct_to_dict
2929

30-
from .vision import Vision, CaptureAllResult
30+
from .vision import CaptureAllResult, Vision
3131

3232

3333
class VisionClient(Vision, ReconfigurableResourceRPCClientBase):
@@ -57,14 +57,14 @@ async def capture_all_from_camera(
5757
if extra is None:
5858
extra = {}
5959
request = CaptureAllFromCameraRequest(
60-
name=self.name,
61-
camera_name=camera_name,
62-
return_image=return_image,
63-
return_classifications=return_classifications,
64-
return_detections=return_detections,
65-
return_object_point_clouds=return_object_point_clouds,
66-
extra=dict_to_struct(extra),
67-
)
60+
name=self.name,
61+
camera_name=camera_name,
62+
return_image=return_image,
63+
return_classifications=return_classifications,
64+
return_detections=return_detections,
65+
return_object_point_clouds=return_object_point_clouds,
66+
extra=dict_to_struct(extra),
67+
)
6868
response: CaptureAllFromCameraResponse = await self.client.CaptureAllFromCamera(request, timeout=timeout)
6969
result = CaptureAllResult()
7070
result.extra = struct_to_dict(response.extra)
@@ -188,7 +188,7 @@ async def get_properties(
188188
name=self.name,
189189
extra=dict_to_struct(extra),
190190
)
191-
response : GetPropertiesResponse = await self.client.GetProperties(request, timeout=timeout)
191+
response: GetPropertiesResponse = await self.client.GetProperties(request, timeout=timeout)
192192
return response
193193

194194
async def do_command(

src/viam/services/vision/vision.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class CaptureAllResult:
2424
"there was no request for the classifier/detector to return a result" vs.
2525
"the classifier/detector was requested, but there were no results".
2626
"""
27+
2728
def __init__(self, image=None, classifications=None, detections=None, objects=None, extra={}):
2829
"""
2930
Args:
@@ -51,6 +52,7 @@ class Vision(ServiceBase):
5152
vision implementations. This cannot be used on its own. If the ``__init__()`` function is
5253
overridden, it must call the ``super().__init__()`` function.
5354
"""
55+
5456
SUBTYPE: Final = Subtype( # pyright: ignore [reportIncompatibleVariableOverride]
5557
RESOURCE_NAMESPACE_RDK, RESOURCE_TYPE_SERVICE, "vision"
5658
)
@@ -283,10 +285,10 @@ async def get_object_point_clouds(
283285

284286
@abc.abstractmethod
285287
async def get_properties(
286-
self,
287-
*,
288-
extra: Optional[Mapping[str, Any]] = None,
289-
timeout: Optional[float] = None,
288+
self,
289+
*,
290+
extra: Optional[Mapping[str, Any]] = None,
291+
timeout: Optional[float] = None,
290292
) -> Properties:
291293
"""
292294
Get info about what vision methods the vision service provides. Currently returns boolean values that

tests/mocks/services.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
from viam.services.mlmodel.utils import flat_tensors_to_ndarrays, ndarrays_to_flat_tensors
331331
from viam.services.navigation import Navigation
332332
from viam.services.slam import SLAM
333-
from viam.services.vision import Vision, CaptureAllResult
333+
from viam.services.vision import CaptureAllResult, Vision
334334
from viam.utils import ValueTypes, datetime_to_timestamp, dict_to_struct, struct_to_dict
335335

336336

@@ -360,7 +360,10 @@ def __init__(
360360
super().__init__(name)
361361

362362
async def get_properties(
363-
self, *, extra: Optional[Mapping[str, Any]] = None, timeout: Optional[float] = None,
363+
self,
364+
*,
365+
extra: Optional[Mapping[str, Any]] = None,
366+
timeout: Optional[float] = None,
364367
) -> Vision.Properties:
365368
self.extra = extra
366369
self.timeout = timeout

tests/test_vision_service.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
VisionServiceStub,
3535
)
3636
from viam.resource.manager import ResourceManager
37-
from viam.services.vision import (
38-
Classification,
39-
Detection,
40-
Vision,
41-
VisionClient,
42-
)
37+
from viam.services.vision import Classification, Detection, Vision, VisionClient
4338
from viam.services.vision.service import VisionRPCService
4439
from viam.utils import dict_to_struct, struct_to_dict
4540

@@ -215,11 +210,7 @@ async def test_capture_all_from_camera(self, vision: MockVision, service: Vision
215210
client = VisionServiceStub(channel)
216211
extra = {"foo": "capture_all_from_camera"}
217212
request = CaptureAllFromCameraRequest(
218-
name=vision.name,
219-
camera_name="fake-camera",
220-
return_image=True,
221-
return_classifications=True,
222-
extra=dict_to_struct(extra)
213+
name=vision.name, camera_name="fake-camera", return_image=True, return_classifications=True, extra=dict_to_struct(extra)
223214
)
224215
response: CaptureAllFromCameraResponse = await client.CaptureAllFromCamera(request)
225216
assert response.image.image == VISION_IMAGE.data

0 commit comments

Comments
 (0)