Skip to content

Commit

Permalink
feat: clone InMemoryProvider flag storage to prevent mutations
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Bond <federicobond@gmail.com>
  • Loading branch information
federicobond committed Jul 19, 2023
1 parent 77f43f9 commit 8288e26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions open_feature/provider/in_memory_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class InMemoryMetadata(Metadata):
T = typing.TypeVar("T", covariant=True)


@dataclass
@dataclass(frozen=True)
class InMemoryFlag(typing.Generic[T]):
flag_key: str
default_variant: str
Expand Down Expand Up @@ -58,7 +58,7 @@ class InMemoryProvider(AbstractProvider):
_flags: FlagStorage

def __init__(self, flags: FlagStorage):
self._flags = flags
self._flags = flags.copy()

def get_metadata(self) -> Metadata:
return InMemoryMetadata()
Expand Down

0 comments on commit 8288e26

Please sign in to comment.