Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 #395

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
default_stages: [commit]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.0
hooks:
- id: ruff
args: [--fix]
Expand Down
20 changes: 10 additions & 10 deletions openfeature/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
)

__all__ = [
"get_client",
"set_provider",
"add_handler",
"add_hooks",
"clear_hooks",
"clear_providers",
"get_provider_metadata",
"get_client",
"get_evaluation_context",
"set_evaluation_context",
"set_transaction_context_propagator",
"get_hooks",
"get_provider_metadata",
"get_transaction_context",
"remove_handler",
"set_evaluation_context",
"set_provider",
"set_transaction_context",
"add_hooks",
"clear_hooks",
"get_hooks",
"set_transaction_context_propagator",
"shutdown",
"add_handler",
"remove_handler",
]

_evaluation_context = EvaluationContext()
Expand Down
2 changes: 1 addition & 1 deletion openfeature/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from openfeature.exception import ErrorCode

__all__ = ["ProviderEvent", "ProviderEventDetails", "EventDetails", "EventHandler"]
__all__ = ["EventDetails", "EventHandler", "ProviderEvent", "ProviderEventDetails"]


class ProviderEvent(Enum):
Expand Down
12 changes: 6 additions & 6 deletions openfeature/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
from enum import Enum

__all__ = [
"OpenFeatureError",
"ProviderNotReadyError",
"ProviderFatalError",
"ErrorCode",
"FlagNotFoundError",
"GeneralError",
"InvalidContextError",
"OpenFeatureError",
"ParseError",
"TypeMismatchError",
"ProviderFatalError",
"ProviderNotReadyError",
"TargetingKeyMissingError",
"InvalidContextError",
"ErrorCode",
"TypeMismatchError",
]


Expand Down
6 changes: 3 additions & 3 deletions openfeature/flag_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@


__all__ = [
"FlagType",
"Reason",
"FlagMetadata",
"FlagEvaluationDetails",
"FlagEvaluationOptions",
"FlagMetadata",
"FlagResolutionDetails",
"FlagType",
"Reason",
]


Expand Down
2 changes: 1 addition & 1 deletion openfeature/hook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from openfeature.client import ClientMetadata
from openfeature.provider.metadata import Metadata

__all__ = ["HookType", "HookContext", "HookHints", "Hook"]
__all__ = ["Hook", "HookContext", "HookHints", "HookType"]


class HookType(Enum):
Expand Down
2 changes: 1 addition & 1 deletion openfeature/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .metadata import Metadata

__all__ = ["AbstractProvider", "ProviderStatus", "FeatureProvider", "Metadata"]
__all__ = ["AbstractProvider", "FeatureProvider", "Metadata", "ProviderStatus"]


class ProviderStatus(Enum):
Expand Down
2 changes: 1 addition & 1 deletion openfeature/transaction_context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
)

__all__ = [
"TransactionContextPropagator",
"ContextVarsTransactionContextPropagator",
"TransactionContextPropagator",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextvars import ContextVar
from typing import Optional

from openfeature.evaluation_context import EvaluationContext
from openfeature.transaction_context.transaction_context_propagator import (
Expand All @@ -7,12 +8,17 @@


class ContextVarsTransactionContextPropagator(TransactionContextPropagator):
_transaction_context_var: ContextVar[EvaluationContext] = ContextVar(
"transaction_context", default=EvaluationContext()
_transaction_context_var: ContextVar[Optional[EvaluationContext]] = ContextVar(
"transaction_context", default=None
)

def get_transaction_context(self) -> EvaluationContext:
return self._transaction_context_var.get()
context = self._transaction_context_var.get()
if context is None:
context = EvaluationContext()
self._transaction_context_var.set(context)

return context

def set_transaction_context(self, transaction_context: EvaluationContext) -> None:
self._transaction_context_var.set(transaction_context)