Skip to content

Commit 7bc1df2

Browse files
committed
fix!: restrict exported names with __all__
1 parent f00bc89 commit 7bc1df2

File tree

8 files changed

+51
-0
lines changed

8 files changed

+51
-0
lines changed

openfeature/api.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
from openfeature.provider.metadata import Metadata
1414
from openfeature.provider.registry import ProviderRegistry
1515

16+
__all__ = [
17+
"get_client",
18+
"set_provider",
19+
"clear_providers",
20+
"get_provider_metadata",
21+
"get_evaluation_context",
22+
"set_evaluation_context",
23+
"add_hooks",
24+
"clear_hooks",
25+
"get_hooks",
26+
"shutdown",
27+
"add_handler",
28+
"remove_handler",
29+
]
30+
1631
_evaluation_context = EvaluationContext()
1732

1833
_hooks: typing.List[Hook] = []

openfeature/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
)
3030
from openfeature.provider import FeatureProvider, ProviderStatus
3131

32+
__all__ = [
33+
"ClientMetadata",
34+
"OpenFeatureClient",
35+
]
36+
3237
logger = logging.getLogger("openfeature")
3338

3439
GetDetailCallable = typing.Union[

openfeature/evaluation_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import typing
22
from dataclasses import dataclass, field
33

4+
__all__ = ["EvaluationContext"]
5+
46

57
@dataclass
68
class EvaluationContext:

openfeature/event.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from openfeature.exception import ErrorCode
88
from openfeature.provider import ProviderStatus
99

10+
__all__ = ["ProviderEvent", "ProviderEventDetails", "EventDetails", "EventHandler"]
11+
1012

1113
class ProviderEvent(Enum):
1214
PROVIDER_READY = "PROVIDER_READY"

openfeature/exception.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44
from collections.abc import Mapping
55
from enum import Enum
66

7+
__all__ = [
8+
"OpenFeatureError",
9+
"ProviderNotReadyError",
10+
"ProviderFatalError",
11+
"FlagNotFoundError",
12+
"GeneralError",
13+
"ParseError",
14+
"TypeMismatchError",
15+
"TargetingKeyMissingError",
16+
"InvalidContextError",
17+
"ErrorCode",
18+
]
19+
720

821
class OpenFeatureError(Exception):
922
"""

openfeature/flag_evaluation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
from openfeature.hook import Hook, HookHints
1212

1313

14+
__all__ = [
15+
"FlagType",
16+
"Reason",
17+
"FlagMetadata",
18+
"FlagEvaluationDetails",
19+
"FlagEvaluationOptions",
20+
"FlagResolutionDetails",
21+
]
22+
23+
1424
class FlagType(StrEnum):
1525
BOOLEAN = "BOOLEAN"
1626
STRING = "STRING"

openfeature/hook/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from openfeature.client import ClientMetadata
1313
from openfeature.provider.metadata import Metadata
1414

15+
__all__ = ["HookType", "HookContext", "HookHints", "Hook"]
16+
1517

1618
class HookType(Enum):
1719
BEFORE = "before"

openfeature/provider/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
from .metadata import Metadata
99

10+
__all__ = ["ProviderStatus", "FeatureProvider", "Metadata"]
11+
1012

1113
class ProviderStatus(Enum):
1214
NOT_READY = "NOT_READY"

0 commit comments

Comments
 (0)