Skip to content

Commit 5ff6437

Browse files
committed
explicit str
1 parent be7b465 commit 5ff6437

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/opengeodeweb_viewer/rpc/mesh/points/mesh_points_protocols.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class VtkMeshPointsView(VtkMeshView):
2323
def __init__(self) -> None:
2424
super().__init__()
2525

26-
@exportRpc(mesh_points_prefix + mesh_points_schemas_dict["visibility"]["rpc"])
26+
@exportRpc(mesh_points_prefix + str(mesh_points_schemas_dict["visibility"]["rpc"]))
2727
def setMeshPointsVisibility(self, params: RpcParams) -> None:
2828
validate_schema(
2929
params, self.mesh_points_schemas_dict["visibility"], self.mesh_points_prefix
3030
)
3131
id, visibility = params["id"], params["visibility"]
3232
self.SetPointsVisibility(id, visibility)
3333

34-
@exportRpc(mesh_points_prefix + mesh_points_schemas_dict["color"]["rpc"])
34+
@exportRpc(mesh_points_prefix + str(mesh_points_schemas_dict["color"]["rpc"]))
3535
def setMeshPointsColor(self, params: RpcParamsWithColor) -> None:
3636
validate_schema(
3737
params, self.mesh_points_schemas_dict["color"], self.mesh_points_prefix
@@ -44,15 +44,17 @@ def setMeshPointsColor(self, params: RpcParamsWithColor) -> None:
4444
)
4545
self.SetPointsColor(id, red, green, blue)
4646

47-
@exportRpc(mesh_points_prefix + mesh_points_schemas_dict["size"]["rpc"])
47+
@exportRpc(mesh_points_prefix + str(mesh_points_schemas_dict["size"]["rpc"]))
4848
def setMeshPointsSize(self, params: RpcParams) -> None:
4949
validate_schema(
5050
params, self.mesh_points_schemas_dict["size"], self.mesh_points_prefix
5151
)
5252
id, size = params["id"], params["size"]
5353
self.SetPointsSize(id, size)
5454

55-
@exportRpc(mesh_points_prefix + mesh_points_schemas_dict["vertex_attribute"]["rpc"])
55+
@exportRpc(
56+
mesh_points_prefix + str(mesh_points_schemas_dict["vertex_attribute"]["rpc"])
57+
)
5658
def setMeshPointsVertexAttribute(self, params: RpcParams) -> None:
5759
validate_schema(
5860
params,

src/opengeodeweb_viewer/utils_functions.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
type RpcParamsWithColor = dict[str, JsonPrimitive | ColorDict]
1515
type RpcParamsWithList = dict[str, JsonPrimitive | list[str]]
1616

17+
type SchemaDict = dict[str, JsonValue]
18+
type SchemasDict = dict[str, SchemaDict]
1719

18-
def get_schemas_dict(path: str) -> dict[str, dict[str, JsonValue]]:
20+
21+
def get_schemas_dict(path: str) -> SchemasDict:
1922
json_files = os.listdir(path)
20-
schemas_dict: dict[str, dict[str, JsonValue]] = {}
23+
schemas_dict: SchemasDict = {}
2124
for json_file in json_files:
2225
last_point = json_file.rfind(".")
2326
filename = json_file[: -len(json_file) + last_point]
@@ -27,9 +30,7 @@ def get_schemas_dict(path: str) -> dict[str, dict[str, JsonValue]]:
2730
return schemas_dict
2831

2932

30-
def validate_schema(
31-
params: RpcParams, schema: dict[str, JsonValue], prefix: str = ""
32-
) -> None:
33+
def validate_schema(params: RpcParams, schema: SchemaDict, prefix: str = "") -> None:
3334
print(f"{prefix}{schema['rpc']}", f"{params=}", flush=True)
3435
try:
3536
validate = fastjsonschema.compile(schema)

0 commit comments

Comments
 (0)