Skip to content

Commit 2efb839

Browse files
committed
style: applied black formatting
Signed-off-by: Tom Carrio <[email protected]>
1 parent 4853e16 commit 2efb839

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

open_feature/immutable_dict/mapping_proxy_type.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ class MappingProxyType(dict):
1313
to:
1414
`from types import MappingProxyType`
1515
"""
16+
1617
def __hash__(self):
1718
return id(self)
1819

1920
def _immutable(self, *args, **kws):
20-
raise TypeError('immutable instance of dictionary')
21+
raise TypeError("immutable instance of dictionary")
2122

2223
__setitem__ = _immutable
2324
__delitem__ = _immutable
24-
clear = _immutable
25-
update = _immutable
26-
setdefault = _immutable
27-
pop = _immutable
28-
popitem = _immutable
25+
clear = _immutable
26+
update = _immutable
27+
setdefault = _immutable
28+
pop = _immutable
29+
popitem = _immutable

open_feature/open_feature_client.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ def evaluate_flag_details(
183183
if evaluation_context is None:
184184
evaluation_context = EvaluationContext()
185185

186-
evaluation_hooks, hook_hints = self.__extract_evaluation_options(flag_evaluation_options)
186+
evaluation_hooks, hook_hints = self.__extract_evaluation_options(
187+
flag_evaluation_options
188+
)
187189

188190
hook_context = HookContext(
189191
flag_key=flag_key,
@@ -284,15 +286,23 @@ def create_provider_evaluation(
284286

285287
return get_details_callable(*args)
286288

287-
def __extract_evaluation_options(self, flag_evaluation_options: typing.Any) -> typing.Tuple(typing.List[Hook], MappingProxyType):
289+
def __extract_evaluation_options(
290+
self, flag_evaluation_options: typing.Any
291+
) -> typing.Tuple(typing.List[Hook], MappingProxyType):
288292
evaluation_hooks: typing.List[Hook] = []
289293
hook_hints: dict = {}
290294

291295
if flag_evaluation_options is dict:
292-
if 'hook_hints' in flag_evaluation_options and flag_evaluation_options['hook_hints'] is dict:
293-
hook_hints = dict(flag_evaluation_options['hook_hints'])
294-
295-
if 'hooks' in flag_evaluation_options and flag_evaluation_options['hooks'] is list:
296-
evaluation_hooks = flag_evaluation_options['hooks']
297-
298-
return (evaluation_hooks, MappingProxyType(hook_hints))
296+
if (
297+
"hook_hints" in flag_evaluation_options
298+
and flag_evaluation_options["hook_hints"] is dict
299+
):
300+
hook_hints = dict(flag_evaluation_options["hook_hints"])
301+
302+
if (
303+
"hooks" in flag_evaluation_options
304+
and flag_evaluation_options["hooks"] is list
305+
):
306+
evaluation_hooks = flag_evaluation_options["hooks"]
307+
308+
return (evaluation_hooks, MappingProxyType(hook_hints))

tests/hooks/test_hook_support.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def test_after_hooks_run_after_method(mock_hook):
4848
# Then
4949
mock_hook.supports_flag_value_type.assert_called_once()
5050
mock_hook.after.assert_called_once()
51-
mock_hook.error.assert_called_with(hook_context, flag_evaluation_details, hook_hints)
51+
mock_hook.error.assert_called_with(
52+
hook_context, flag_evaluation_details, hook_hints
53+
)
5254

5355

5456
def test_finally_after_hooks_run_finally_after_method(mock_hook):

0 commit comments

Comments
 (0)