-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py] implementation of new feature-12760, setting service_args through getters/setters
#12767
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
Changes from 9 commits
70ed717
9cce058
935fdec
d96756e
89af175
3ae9054
e765368
d257645
8702e03
093e3df
b5d8ba5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,10 +40,12 @@ def __init__( | |
| env: typing.Optional[typing.Mapping[str, str]] = None, | ||
| **kwargs, | ||
| ) -> None: | ||
| self.service_args = service_args or [] | ||
| if service_args is None: | ||
| service_args = [] | ||
| self._service_args = service_args | ||
|
|
||
| if isinstance(log_output, str): | ||
| self.service_args.append(f"--log-path={log_output}") | ||
| self._service_args.append(f"--log-path={log_output}") | ||
| self.log_output = None | ||
| else: | ||
| self.log_output = log_output | ||
|
|
@@ -56,5 +58,15 @@ def __init__( | |
| **kwargs, | ||
| ) | ||
|
|
||
| @property | ||
| def service_args(self): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be nice to add typing to things we are adding, feel free to ignore tho as theres plenty of general typing work to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @symonk thanks for your review comments. I have updated the code. |
||
| return self._service_args | ||
|
|
||
| @service_args.setter | ||
| def service_args(self, value): | ||
| if not isinstance(value, list): | ||
sandeepsuryaprasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| raise TypeError("service args must be a list") | ||
| self._service_args.extend(value) | ||
sandeepsuryaprasad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| def command_line_args(self) -> typing.List[str]: | ||
| return [f"--port={self.port}"] + self.service_args | ||
| return [f"--port={self.port}"] + self._service_args | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,20 +42,30 @@ def __init__( | |
| reuse_service=False, | ||
| **kwargs, | ||
| ) -> None: | ||
| self.service_args = service_args or [] | ||
| if service_args is None: | ||
| service_args = [] | ||
| self._service_args = service_args | ||
|
|
||
| if quiet is not None: | ||
| warnings.warn("quiet is no longer needed to supress output", DeprecationWarning, stacklevel=2) | ||
| self.reuse_service = reuse_service | ||
|
|
||
| self._reuse_service = reuse_service | ||
| super().__init__( | ||
| executable=executable_path, | ||
| port=port, | ||
| env=env, | ||
| **kwargs, | ||
| ) | ||
|
|
||
| def command_line_args(self) -> typing.List[str]: | ||
| return ["-p", f"{self.port}"] + self.service_args | ||
| @property | ||
| def service_args(self): | ||
| return self._service_args | ||
|
|
||
| @service_args.setter | ||
| def service_args(self, value): | ||
| if not isinstance(value, list): | ||
| raise TypeError("service args must be a list") | ||
| self._service_args.extend(value) | ||
|
||
|
|
||
| @property | ||
| def service_url(self) -> str: | ||
|
|
@@ -71,3 +81,6 @@ def reuse_service(self, reuse: bool) -> None: | |
| if not isinstance(reuse, bool): | ||
| raise TypeError("reuse must be a boolean") | ||
| self._reuse_service = reuse | ||
|
|
||
| def command_line_args(self) -> typing.List[str]: | ||
| return ["-p", f"{self.port}"] + self._service_args | ||
Uh oh!
There was an error while loading. Please reload this page.