Skip to content

Commit

Permalink
remove lambda from Context
Browse files Browse the repository at this point in the history
#799 it teems like some runtimes do not like lambda attributes in pickle.dumps
  • Loading branch information
frederik-uni authored Dec 22, 2024
1 parent 3b4e4ad commit 027c966
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions manga_translator/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@

# Adapted from argparse.Namespace
class Context(dict):
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__

def __init__(self, **kwargs):
for name in kwargs:
setattr(self, name, kwargs[name])

def __getattr__(self, item):
return self.get(item)

def __delattr__(self, key) -> None:
return self.__delitem__(key)

def __setattr__(self, key, value):
return self.__setitem__(key, value)

def __eq__(self, other):
if not isinstance(other, Context):
Expand Down

0 comments on commit 027c966

Please sign in to comment.