Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove lambda from Context #800

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading