Skip to content

Commit d0f69ad

Browse files
committed
remove redundant reduce
Signed-off-by: gruebel <[email protected]>
1 parent 6f7ac50 commit d0f69ad

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

openfeature/client.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import typing
33
from collections.abc import Awaitable, Sequence
44
from dataclasses import dataclass
5-
from functools import reduce
65
from itertools import chain
76

87
from openfeature import _event_support
@@ -509,21 +508,9 @@ def _run_before_hooks_and_update_context(
509508
flag_type, merged_hooks_and_context, hook_hints
510509
)
511510

512-
if not merged_hooks_and_context:
513-
return evaluation_context.merge(before_hooks_context)
514-
515511
# The hook_context.evaluation_context already contains the merged context from
516512
# _establish_hooks_and_provider, so we just need to merge with the before hooks result
517-
merged_context = reduce(
518-
lambda a, b: a.merge(b),
519-
[
520-
hook_context.evaluation_context
521-
for (_, hook_context) in merged_hooks_and_context
522-
],
523-
)
524-
merged_context = merged_context.merge(before_hooks_context)
525-
526-
return merged_context
513+
return evaluation_context.merge(before_hooks_context)
527514

528515
@typing.overload
529516
async def evaluate_flag_details_async(

0 commit comments

Comments
 (0)