Skip to content

Commit

Permalink
Fix python .get
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored Jul 23, 2024
1 parent 015378c commit c7adfd1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imjoy-rpc",
"version": "0.5.57",
"version": "0.5.58",
"description": "Remote procedure calls for ImJoy.",
"module": "index.js",
"types": "index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion python/imjoy_rpc/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.5.57"
"version": "0.5.58"
}
9 changes: 6 additions & 3 deletions python/imjoy_rpc/hypha/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ def add_service(self, api, overwrite=False):
}
)
# For class instance, we need set a default id
api["id"] = api.get("id", "default")
if "id" not in api or not api["id"]:
api["id"] = "default"
else:
raise Exception("Invalid service object type: {}".format(type(api)))

Expand Down Expand Up @@ -563,11 +564,13 @@ async def register_service(self, api, overwrite=False, notify=True, context=None
{"service_id": service["id"], "api": service, "type": "add"},
)
await self._notify_service_update()
if "description" not in service:
service["description"] = ""
return {
"id": f'{self._client_id}:{service["id"]}',
"type": service["type"],
"name": service["name"],
"description": service.get("description", ""),
"description": service["description"],
"config": service["config"],
}

Expand All @@ -576,7 +579,7 @@ async def unregister_service(self, service, notify=True):
if isinstance(service, str):
service = self._services.get(service)
if service["id"] not in self._services:
raise Exception(f"Service not found: {service.get('id')}")
raise Exception(f"Service not found: {service['id']}")
del self._services[service["id"]]
if notify:
self._fire(
Expand Down

0 comments on commit c7adfd1

Please sign in to comment.