Skip to content

Commit

Permalink
chore: remove excluded ruff rules and fix issues (#32)
Browse files Browse the repository at this point in the history
remove excluded ruff rules and fix issues

Signed-off-by: gruebel <anton.gruebel@gmail.com>
  • Loading branch information
gruebel authored Jan 10, 2024
1 parent bb717b9 commit b4d6995
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion openfeature/contrib/hooks/otel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json

from opentelemetry import trace

from openfeature.flag_evaluation import FlagEvaluationDetails
from openfeature.hook import Hook, HookContext
from opentelemetry import trace

OTEL_EVENT_NAME = "feature_flag"

Expand Down
2 changes: 1 addition & 1 deletion openfeature/contrib/providers/flagd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .provider import FlagdProvider

FlagdProvider
__all__ = ["FlagdProvider"]
9 changes: 5 additions & 4 deletions openfeature/contrib/providers/flagd/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import grpc
from google.protobuf.struct_pb2 import Struct

from openfeature.evaluation_context import EvaluationContext
from openfeature.exception import (
FlagNotFoundError,
Expand Down Expand Up @@ -173,12 +174,12 @@ def _resolve(
message = f"received grpc status code {code}"

if code == grpc.StatusCode.NOT_FOUND:
raise FlagNotFoundError(message)
raise FlagNotFoundError(message) from e
elif code == grpc.StatusCode.INVALID_ARGUMENT:
raise TypeMismatchError(message)
raise TypeMismatchError(message) from e
elif code == grpc.StatusCode.DATA_LOSS:
raise ParseError(message)
raise GeneralError(message)
raise ParseError(message) from e
raise GeneralError(message) from e

# Got a valid flag and valid type. Return it.
return FlagEvaluationDetails(
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ select = [
]
ignore = [
"E501", # the formatter will handle any too long line
# all following rules will be removed in the next PR
"I001",
"B018",
"B904",
]
preview = true

Expand Down
6 changes: 3 additions & 3 deletions tests/hooks/test_otel.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from unittest.mock import Mock

import pytest
from openfeature.evaluation_context import EvaluationContext
from openfeature.flag_evaluation import FlagEvaluationDetails, FlagType
from openfeature.hook import HookContext
from opentelemetry import trace
from opentelemetry.trace import Span

from openfeature.contrib.hooks.otel import TracingHook
from openfeature.evaluation_context import EvaluationContext
from openfeature.flag_evaluation import FlagEvaluationDetails, FlagType
from openfeature.hook import HookContext


@pytest.fixture
Expand Down

0 comments on commit b4d6995

Please sign in to comment.