-
Notifications
You must be signed in to change notification settings - Fork 7
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
Agent spawner configurations should be accessible #154
Conversation
... as attributes. Signed-off-by: Siteshwar Vashisht <[email protected]>
# expects configurations to be attributes rather than key/value pairs. | ||
# This class works around this requirement. | ||
# Thanks to https://stackoverflow.com/a/14620633 | ||
class AttrDict(dict): |
Check warning
Code scanning / vcs-diff-lint
get_config.AttrDict: Missing class docstring Warning
# Thanks to https://stackoverflow.com/a/14620633 | ||
class AttrDict(dict): | ||
def __init__(self, *args, **kwargs): | ||
super(AttrDict, self).__init__(*args, **kwargs) |
Check warning
Code scanning / vcs-diff-lint
get_config.AttrDict.init: Consider using Python 3 style super() without arguments Warning
The check like: if hasattr(opts, "redis_port"): kwargs["port"] = opts.redis_port Can not work with dict() objects. The hasattr() actually doesn't work this way. See: praiskup/resalloc#154
Very good catch, thank you! I think we should do fedora-copr/copr#3186 instead, to make copr-common accept dictionary objects. OTOH, I don't see any potential problems if this patch is merged; at least if we are in hurry for the fix. |
The check like: if hasattr(opts, "redis_port"): kwargs["port"] = opts.redis_port Can not work with dict() objects. The hasattr() actually doesn't work this way. See: praiskup/resalloc#154
... as attributes.