fix!: restrict exported names with __all__ (#306)

* fix!: restrict exported names with __all__

Signed-off-by: Federico Bond <federicobond@gmail.com>

* restrict codecov upload to Python 3.11

Signed-off-by: gruebel <anton.gruebel@gmail.com>

* disable codecov ci fail on error

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>

---------

Signed-off-by: Federico Bond <federicobond@gmail.com>
Signed-off-by: gruebel <anton.gruebel@gmail.com>
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: gruebel <anton.gruebel@gmail.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
This commit is contained in:
Federico Bond 2024-04-09 12:15:30 +10:00 committed by GitHub
parent 9966c14e16
commit 34ac91c707
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 56 additions and 2 deletions

View File

@ -43,12 +43,13 @@ jobs:
- name: Run E2E tests with behave
run: hatch run e2e
- name: Upload coverage to Codecov
- if: matrix.python-version == '3.11'
name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests # optional
name: coverage # optional
fail_ci_if_error: true # optional (default = false)
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
lint:

View File

@ -13,6 +13,21 @@ from openfeature.provider import FeatureProvider
from openfeature.provider._registry import provider_registry
from openfeature.provider.metadata import Metadata
__all__ = [
"get_client",
"set_provider",
"clear_providers",
"get_provider_metadata",
"get_evaluation_context",
"set_evaluation_context",
"add_hooks",
"clear_hooks",
"get_hooks",
"shutdown",
"add_handler",
"remove_handler",
]
_evaluation_context = EvaluationContext()
_hooks: typing.List[Hook] = []

View File

@ -30,6 +30,11 @@ from openfeature.hook._hook_support import (
from openfeature.provider import FeatureProvider, ProviderStatus
from openfeature.provider._registry import provider_registry
__all__ = [
"ClientMetadata",
"OpenFeatureClient",
]
logger = logging.getLogger("openfeature")
GetDetailCallable = typing.Union[

View File

@ -1,6 +1,8 @@
import typing
from dataclasses import dataclass, field
__all__ = ["EvaluationContext"]
@dataclass
class EvaluationContext:

View File

@ -7,6 +7,8 @@ from typing import Callable, ClassVar, Dict, List, Optional, Union
from openfeature.exception import ErrorCode
from openfeature.provider import ProviderStatus
__all__ = ["ProviderEvent", "ProviderEventDetails", "EventDetails", "EventHandler"]
class ProviderEvent(Enum):
PROVIDER_READY = "PROVIDER_READY"

View File

@ -4,6 +4,19 @@ import typing
from collections.abc import Mapping
from enum import Enum
__all__ = [
"OpenFeatureError",
"ProviderNotReadyError",
"ProviderFatalError",
"FlagNotFoundError",
"GeneralError",
"ParseError",
"TypeMismatchError",
"TargetingKeyMissingError",
"InvalidContextError",
"ErrorCode",
]
class OpenFeatureError(Exception):
"""

View File

@ -11,6 +11,16 @@ if typing.TYPE_CHECKING: # pragma: no cover
from openfeature.hook import Hook, HookHints
__all__ = [
"FlagType",
"Reason",
"FlagMetadata",
"FlagEvaluationDetails",
"FlagEvaluationOptions",
"FlagResolutionDetails",
]
class FlagType(StrEnum):
BOOLEAN = "BOOLEAN"
STRING = "STRING"

View File

@ -12,6 +12,8 @@ if TYPE_CHECKING:
from openfeature.client import ClientMetadata
from openfeature.provider.metadata import Metadata
__all__ = ["HookType", "HookContext", "HookHints", "Hook"]
class HookType(Enum):
BEFORE = "before"

View File

@ -7,6 +7,8 @@ from openfeature.hook import Hook
from .metadata import Metadata
__all__ = ["ProviderStatus", "FeatureProvider", "Metadata"]
class ProviderStatus(Enum):
NOT_READY = "NOT_READY"

View File

@ -8,6 +8,8 @@ from openfeature.hook import Hook
from openfeature.provider import FeatureProvider
from openfeature.provider.metadata import Metadata
__all__ = ["AbstractProvider"]
class AbstractProvider(FeatureProvider):
def initialize(self, evaluation_context: EvaluationContext) -> None: