Skip to content

Commit 928f064

Browse files
committed
fixup: changing to mypy-protobuf
Signed-off-by: Simon Schrottner <[email protected]>
1 parent 914d9e0 commit 928f064

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

providers/openfeature-provider-flagd/pyproject.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ cov = [
5555
]
5656

5757
[tool.hatch.build.hooks.protobuf]
58-
dependencies = ["hatch-protobuf"]
59-
paths = ["schemas/protobuf/schema/v1/schema.proto", "schemas/protobuf/sync/v1/sync_service.proto"]
60-
output_path = "src"
58+
dependencies = [
59+
"hatch-protobuf"
60+
]
61+
proto_paths = [
62+
"schemas/protobuf/flagd/evaluation/v1",
63+
"schemas/protobuf/flagd/sync/v1",
64+
]
65+
output_path = "src/openfeature/contrib/provider/flagd/proto"
6166

6267
[tool.hatch.build.targets.sdist]
6368
exclude = [

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
import grpc
44
from google.protobuf.json_format import MessageToDict
55
from google.protobuf.struct_pb2 import Struct
6-
from schemas.protobuf.flagd.evaluation.v1 import ( # type:ignore[import-not-found]
7-
evaluation_pb2,
8-
evaluation_pb2_grpc,
9-
)
106

117
from openfeature.evaluation_context import EvaluationContext
128
from openfeature.exception import (
@@ -20,6 +16,10 @@
2016

2117
from ..config import Config
2218
from ..flag_type import FlagType
19+
from ..proto import (
20+
evaluation_pb2,
21+
evaluation_pb2_grpc,
22+
)
2323

2424
T = typing.TypeVar("T")
2525

@@ -86,6 +86,13 @@ def _resolve( # noqa: PLR0915
8686
context = self._convert_context(evaluation_context)
8787
call_args = {"timeout": self.config.timeout}
8888
try:
89+
request: typing.Union[
90+
evaluation_pb2.ResolveBooleanRequest,
91+
evaluation_pb2.ResolveIntRequest,
92+
evaluation_pb2.ResolveStringRequest,
93+
evaluation_pb2.ResolveObjectRequest,
94+
evaluation_pb2.ResolveFloatRequest,
95+
]
8996
if flag_type == FlagType.BOOLEAN:
9097
request = evaluation_pb2.ResolveBooleanRequest(
9198
flag_key=flag_key, context=context

0 commit comments

Comments
 (0)