-
Notifications
You must be signed in to change notification settings - Fork 96
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
#601 Creation of print_utils.py #716
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Pedro Rangel <[email protected]>
Added a new python file called print_utils.py to replace cli_step_base.py and all of the click imports in other files.
Changed the implementation of click in all electionguard_cli files that import click and only use echo/secho, to a new file called print_utils.py. print_utils.py has functions print_message, print_header, print_error, and print_warning that utilizes click.secho and click.echo to replace the click.echo and click.secho functions in other files.
….com> Co-authored-by: Antonio Lopez Jr <[email protected]>
This pull request introduces 10 alerts when merging 45a01f8 into 670b007 - view on LGTM.com new alerts:
|
Finished print_utils.py, and updated cli_step_base.py to incorporate it.
This pull request introduces 9 alerts when merging 9ed7a11 into 670b007 - view on LGTM.com new alerts:
|
@JKnight777 Thanks for the submission. The first things that you need to do is to please sign the CLA. |
@@ -1,5 +1,5 @@ | |||
from typing import Any, Optional | |||
import click | |||
import print_utils |
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.
You can remove the header_color and other colors that are unused in this file
@@ -1,5 +1,5 @@ | |||
from typing import List | |||
import click | |||
#import click |
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.
For a polished PR, delete commented out code
@@ -16,7 +15,7 @@ | |||
_T = TypeVar("_T") | |||
|
|||
|
|||
class InputRetrievalStepBase(CliStepBase): | |||
class InputRetrievalStepBase("""CliStepBase"""): |
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'd like to understand why clickstepbase has triple quotes here...
def print_message(text: str, color="white", underlined=False, bolded=False) -> None: | ||
click.secho(f"{text}", fg=color, underline=underlined, bold=bolded) | ||
|
||
def print_warning(text: str, warning_color="bright_red") -> 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.
can you confirm that the warning color and error color are the same?
This pull request introduces 1 alert when merging bf7d69f into 46dbc34 - view on LGTM.com new alerts:
|
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.
Looks good to me. Please add proof that it still works with screenshots, or describe your testing.
This pull request introduces 1 alert when merging df050d7 into 0dabe5e - view on LGTM.com new alerts:
|
Issue 601
Fixes #601
Description
Created a new file called print_utils.py that will help reduce the amount of click.echos in electionguard_cli, while also providing more useful functions that can potentially replace cli_base_step, such as print_header, print_error, print_warning, and print_message.