Skip to content

Commit 54428d9

Browse files
committed
chore(flagd): Fix var names, type checking, and linting
Signed-off-by: Maks Osowski <[email protected]>
1 parent 0257fc7 commit 54428d9

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import dataclasses
2-
import grpc
32
import os
43
import typing
54
from enum import Enum
65

6+
import grpc
7+
78

89
class ResolverType(Enum):
910
RPC = "rpc"
@@ -235,11 +236,15 @@ def __init__( # noqa: PLR0913
235236
)
236237

237238
self.provider_id = (
238-
env_or_default(ENV_VAR_PROVIDER_ID, None) if provider_id is None else provider_id
239+
env_or_default(ENV_VAR_PROVIDER_ID, None)
240+
if provider_id is None
241+
else provider_id
239242
)
240243

241244
self.default_authority = (
242-
env_or_default(ENV_VAR_DEFAULT_AUTHORITY, None) if default_authority is None else default_authority
245+
env_or_default(ENV_VAR_DEFAULT_AUTHORITY, None)
246+
if default_authority is None
247+
else default_authority
243248
)
244249

245250
self.channel_credentials = channel_credentials

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
# provider.initialise(schema="https",endpoint="example.com",port=1234,timeout=10)
2222
"""
2323

24-
import grpc
2524
import typing
2625
import warnings
2726

27+
import grpc
28+
2829
from openfeature.evaluation_context import EvaluationContext
2930
from openfeature.flag_evaluation import FlagResolutionDetails
3031
from openfeature.provider import AbstractProvider
@@ -59,7 +60,7 @@ def __init__( # noqa: PLR0913
5960
retry_grace_period: typing.Optional[int] = None,
6061
cert_path: typing.Optional[str] = None,
6162
default_authority: typing.Optional[str] = None,
62-
grpc_credentials: typing.Optional[grpc.ChannelCredentials] = None,
63+
channel_credentials: typing.Optional[grpc.ChannelCredentials] = None,
6364
):
6465
"""
6566
Create an instance of the FlagdProvider
@@ -101,7 +102,7 @@ def __init__( # noqa: PLR0913
101102
max_cache_size=max_cache_size,
102103
cert_path=cert_path,
103104
default_authority=default_authority,
104-
channel_credentials=grpc_credentials,
105+
channel_credentials=channel_credentials,
105106
)
106107

107108
self.resolver = self.setup_resolver()

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
def _generate_channel(self, config: Config) -> grpc.Channel:
5656
target = f"{config.host}:{config.port}"
5757
# Create the channel with the service config
58-
options = [
58+
options: list[tuple[str, typing.Any]] = [
5959
("grpc.keepalive_time_ms", config.keep_alive_time),
6060
("grpc.initial_reconnect_backoff_ms", config.retry_backoff_ms),
6161
("grpc.max_reconnect_backoff_ms", config.retry_backoff_max_ms),

0 commit comments

Comments
 (0)