-
Notifications
You must be signed in to change notification settings - Fork 6
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
Force kw_only for all config classes #21
Conversation
@@ -56,7 +56,9 @@ def client_create( | |||
if out is None and ClientConfig.exists(name): | |||
raise click.ClickException(f"A client with the name '{name}' already exists.") | |||
|
|||
config = ClientConfig(name, endpoint, token, drivers=ClientConfigDrivers(allow.split(","), unsafe)) | |||
config = ClientConfig( | |||
name=name, endpoint=endpoint, token=token, drivers=ClientConfigDrivers(allow=allow.split(","), unsafe=unsafe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe in some others cases it's much better, in this case it makes the code too verbose. ':D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news is that this is internal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true :)
|
||
def load_or_create() -> Self: | ||
"""Check if a user config exists, otherwise create an empty one.""" | ||
if UserConfig.exists() is False: | ||
if os.path.exists(UserConfig.BASE_CONFIG_PATH) is False: | ||
os.makedirs(UserConfig.BASE_CONFIG_PATH) | ||
config = UserConfig(None) | ||
config = UserConfig(current_client=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep it in cases like this, but without enforcing it may be. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm just worried if we get more properties it'll get confusing.
ClientConfig, | ||
"load", | ||
return_value=ClientConfig( | ||
name="testclient", endpoint="abc", token="123", drivers=ClientConfigDrivers(allow=[], unsafe=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helps here... ':D :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes it look a lot more like the resulting YAML :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with it, and let's re-analyze if it got too annoying, as you said, this is internal.
@@ -56,7 +56,9 @@ def client_create( | |||
if out is None and ClientConfig.exists(name): | |||
raise click.ClickException(f"A client with the name '{name}' already exists.") | |||
|
|||
config = ClientConfig(name, endpoint, token, drivers=ClientConfigDrivers(allow.split(","), unsafe)) | |||
config = ClientConfig( | |||
name=name, endpoint=endpoint, token=token, drivers=ClientConfigDrivers(allow=allow.split(","), unsafe=unsafe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true :)
Improve config code style to prevent confusion with different arguments.