Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
keejon committed Aug 16, 2024
1 parent 802535b commit 2892b47
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions karapace/protobuf/protopace/protopace.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
from dataclasses import dataclass, field
from functools import cached_property
from karapace.errors import InvalidSchema
from typing import List
from typing import Dict, List

import ctypes
import glob
import importlib.util
import timeit

tmp = glob.glob("build/*/protopacelib*.so")
if not tmp:
spec = importlib.util.find_spec("protopacelib")
if not spec:
raise FileNotFoundError("Unable to find protopace shared library")

lib_file = tmp[0]
lib_file = spec.origin
lib = ctypes.CDLL(lib_file)

lib.FormatSchema.argtypes = [
ctypes.c_char_p,
ctypes.c_char_p,
ctypes.Array[ctypes.c_char_p],
ctypes.Array[ctypes.c_char_p],
ctypes.Array,
ctypes.Array,
ctypes.c_int,
]
lib.FormatSchema.restype = ctypes.c_void_p
Expand All @@ -45,7 +45,7 @@ class Proto:

@cached_property
def all_dependencies(self) -> List["Proto"]:
dependencies = {}
dependencies: Dict[str, "Proto"] = {}
for dep in self.dependencies:
if dep.dependencies:
dependencies.update([(d.name, d) for d in dep.all_dependencies])
Expand Down
4 changes: 2 additions & 2 deletions karapace/schema_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from karapace.schema_type import SchemaType
from karapace.typing import JsonObject, SchemaId, Subject, Version, VersionTag
from karapace.utils import assert_never, json_decode, json_encode, JSONDecodeError
from typing import Any, cast, Dict, Final, final, Mapping, Sequence
from typing import Any, cast, Collection, Dict, Final, final, Mapping, Sequence

import hashlib
import logging
Expand Down Expand Up @@ -59,7 +59,7 @@ def parse_jsonschema_definition(schema_definition: str) -> Draft7Validator:
return Draft7Validator(schema) # type: ignore[arg-type]


def _format_protobuf(schema: str, dependencies: list[Dependency], name: str = "schema.proto") -> str:
def _format_protobuf(schema: str, dependencies: Collection[Dependency], name: str = "schema.proto") -> str:
deps = [dep.to_proto() for dep in dependencies]
proto = protopace.Proto(name, schema, deps)
return protopace.format_proto(proto)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ async def fixture_registry_cluster(
yield RegistryDescription(endpoint, "_schemas")
return
user_config = request.param.get("config", {}) if hasattr(request, "param") else {}
config = {"bootstrap_uri": kafka_servers.bootstrap_servers} | user_config
config = {"bootstrap_uri": kafka_servers.bootstrap_servers}
config.update(user_config)
async with start_schema_registry_cluster(
config_templates=[config],
data_dir=session_logdir / _clear_test_name(request.node.name),
Expand Down

0 comments on commit 2892b47

Please sign in to comment.