Skip to content

Commit

Permalink
feat: trigger a calculated property on mutation
Browse files Browse the repository at this point in the history
* chore: review
  • Loading branch information
FabienArcellier committed Aug 1, 2024
1 parent 712389c commit 005b082
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/writer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import types
import urllib.request
from abc import ABCMeta
from functools import partial, wraps
from multiprocessing.process import BaseProcess
from types import ModuleType
from typing import (
Expand Down Expand Up @@ -92,7 +91,7 @@ def import_failure(rvalue: Any = None):
:param rvalue: the value to return
"""
def decorator(func):
@wraps(func)
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
Expand Down Expand Up @@ -567,7 +566,7 @@ def __init__(self, raw_state: Dict[str, Any] = {}):
self._state_proxy: StateProxy = StateProxy(raw_state)
self.ingest(raw_state)

# Cette étape enregistre les propriétés associés à l'instance
# This step saves the properties associated with the instance
for attribute in calculated_properties_per_state_type.get(self.__class__, []):
getattr(self, attribute)

Expand Down Expand Up @@ -704,7 +703,7 @@ def subscribe_mutation(self, path: Union[str, List[str]], handler: Callable[['St
for p in path_list:
state_proxy = self._state_proxy
path_parts = p.split(".")
final_handler = partial(handler, self)
final_handler = functools.partial(handler, self)
for i, path_part in enumerate(path_parts):
if i == len(path_parts) - 1:
local_mutation = MutationSubscription(path_parts[-1], final_handler)
Expand Down

0 comments on commit 005b082

Please sign in to comment.