Skip to content

Commit

Permalink
remove generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston committed May 31, 2024
1 parent a592b2c commit 9c1bcf5
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/examples/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from viam.proto.app import (
AddRoleRequest,
AddRoleResponse,
AppServiceBase,
ChangeRoleRequest,
ChangeRoleResponse,
CheckPermissionsRequest,
Expand Down Expand Up @@ -130,6 +129,7 @@
ShareLocationResponse,
TailRobotPartLogsRequest,
TailRobotPartLogsResponse,
UnimplementedAppServiceBase,
UnshareLocationRequest,
UnshareLocationResponse,
UpdateFragmentRequest,
Expand Down Expand Up @@ -337,7 +337,7 @@ async def StreamingDataCaptureUpload(
pass


class MockApp(AppServiceBase):
class MockApp(UnimplementedAppServiceBase):
def __init__(self):
self.organization = Organization(id="id", name="name", public_namespace="public_namespace", default_region="default_region")
self.locations = [Location()]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "viam-sdk"
version = "0.21.0"
version = "0.21.1"
description = "Viam Robotics Python SDK"
authors = [ "Naveed <[email protected]>" ]
license = "Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions src/viam/components/camera/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def GetProperties(self, stream: Stream[GetPropertiesRequest, GetProperties
supports_pcd=properties.supports_pcd,
intrinsic_parameters=properties.intrinsic_parameters,
distortion_parameters=properties.distortion_parameters,
mime_types=properties.mime_types,
)
await stream.send_message(response)

Expand Down
4 changes: 2 additions & 2 deletions src/viam/components/motor/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
IsMovingResponse,
IsPoweredRequest,
IsPoweredResponse,
MotorServiceBase,
ResetZeroPositionRequest,
ResetZeroPositionResponse,
SetPowerRequest,
Expand All @@ -23,14 +22,15 @@
SetRPMResponse,
StopRequest,
StopResponse,
UnimplementedMotorServiceBase,
)
from viam.resource.rpc_service_base import ResourceRPCServiceBase
from viam.utils import dict_to_struct, struct_to_dict

from .motor import Motor


class MotorRPCService(MotorServiceBase, ResourceRPCServiceBase[Motor]):
class MotorRPCService(UnimplementedMotorServiceBase, ResourceRPCServiceBase[Motor]):
"""
gRPC Service for a Motor
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

from PIL import Image

from viam.media.video import CameraMimeType, ViamImage

from ..viam_rgba_plugin import RGBA_FORMAT_LABEL
from ....media.video import CameraMimeType, ViamImage
from .viam_rgba_plugin import RGBA_FORMAT_LABEL

# Formats that are supported by PIL
LIBRARY_SUPPORTED_FORMATS = ["JPEG", "PNG", RGBA_FORMAT_LABEL]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
from PIL.ImageFile import ImageFile, PyDecoder, PyEncoder, _safe_read # type: ignore -- (njooma) this exists, manually checked
from PIL.ImageFile import _save as image_save # type: ignore -- (njooma) this exists, manually checked

# Viam uses a special header prepended to raw RGBA data. The header is composed of a
# 4-byte magic number followed by a 4-byte line of the width as a uint32 number
# and another for the height. Credit to Ben Zotto for inventing this formulation
# https://bzotto.medium.com/introducing-the-rgba-bitmap-file-format-4a8a94329e2c

RGBA_MAGIC_NUMBER = bytes("RGBA", "utf-8")

RGBA_FORMAT_LABEL = "VIAM_RGBA"

RGBA_HEADER_LENGTH = 12
from ...viam_rgba import RGBA_FORMAT_LABEL, RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER


def _accept(prefix: str):
Expand Down
10 changes: 10 additions & 0 deletions src/viam/media/viam_rgba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Viam uses a special header prepended to raw RGBA data. The header is composed of a
# 4-byte magic number followed by a 4-byte line of the width as a uint32 number
# and another for the height. Credit to Ben Zotto for inventing this formulation
# https://bzotto.medium.com/introducing-the-rgba-bitmap-file-format-4a8a94329e2c

RGBA_MAGIC_NUMBER = bytes("RGBA", "utf-8")

RGBA_FORMAT_LABEL = "VIAM_RGBA"

RGBA_HEADER_LENGTH = 12
5 changes: 1 addition & 4 deletions src/viam/media/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
from viam.errors import NotSupportedError
from viam.proto.component.camera import Format

from .viam_rgba_plugin import RGBA_FORMAT_LABEL, RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER

# Formats that are supported by PIL
LIBRARY_SUPPORTED_FORMATS = ["JPEG", "PNG", RGBA_FORMAT_LABEL]
from .viam_rgba import RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER


class CameraMimeType(str, Enum):
Expand Down
1 change: 1 addition & 0 deletions tests/mocks/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def __init__(self, name: str):
supports_pcd=False,
intrinsic_parameters=IntrinsicParameters(width_px=1, height_px=2, focal_x_px=3, focal_y_px=4, center_x_px=5, center_y_px=6),
distortion_parameters=DistortionParameters(model="no_distortion"),
mime_types=[CameraMimeType.PNG, CameraMimeType.JPEG],
)
self.timeout: Optional[float] = None
ts = Timestamp()
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
AddRoleRequest,
AddRoleResponse,
APIKeyWithAuthorizations,
AppServiceBase,
Authorization,
ChangeRoleRequest,
ChangeRoleResponse,
Expand Down Expand Up @@ -142,6 +141,7 @@
ShareLocationResponse,
TailRobotPartLogsRequest,
TailRobotPartLogsResponse,
UnimplementedAppServiceBase,
UnshareLocationRequest,
UnshareLocationResponse,
UpdateFragmentRequest,
Expand Down Expand Up @@ -1159,7 +1159,7 @@ async def GetOrgBillingInformation(self, stream: Stream[GetOrgBillingInformation
await stream.send_message(self.billing_info)


class MockApp(AppServiceBase):
class MockApp(UnimplementedAppServiceBase):
def __init__(
self,
organizations: List[Organization],
Expand Down
2 changes: 2 additions & 0 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def properties() -> Camera.Properties:
supports_pcd=False,
intrinsic_parameters=IntrinsicParameters(width_px=1, height_px=2, focal_x_px=3, focal_y_px=4, center_x_px=5, center_y_px=6),
distortion_parameters=DistortionParameters(model="no_distortion"),
mime_types=[CameraMimeType.PNG, CameraMimeType.JPEG],
)


Expand Down Expand Up @@ -200,6 +201,7 @@ async def test_get_properties(self, camera: MockCamera, service: CameraRPCServic
response: GetPropertiesResponse = await client.GetProperties(request, timeout=5.43)
assert response.supports_pcd == properties.supports_pcd
assert response.intrinsic_parameters == properties.intrinsic_parameters
assert response.mime_types == properties.mime_types
assert camera.timeout == loose_approx(5.43)

@pytest.mark.asyncio
Expand Down

0 comments on commit 9c1bcf5

Please sign in to comment.