Skip to content

Commit 49768d4

Browse files
committed
🔥 convert old style formatter to f-strings
1 parent 1996191 commit 49768d4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

moban/main.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ def moban_exit(exit_code_toggle_flag, exit_code):
8282

8383

8484
def create_parser():
85-
"""
86-
construct the program options
87-
"""
8885
parser = argparse.ArgumentParser(
8986
prog=constants.PROGRAM_NAME, description=constants.PROGRAM_DESCRIPTION
9087
)
@@ -109,13 +106,13 @@ def create_parser():
109106
)
110107
advanced.add_argument(
111108
"-td",
112-
"--%s" % constants.LABEL_TMPL_DIRS,
109+
f"--{constants.LABEL_TMPL_DIRS}",
113110
nargs="*",
114111
help="add more directories for template file lookup",
115112
)
116113
advanced.add_argument(
117114
"-cd",
118-
"--%s" % constants.LABEL_CONFIG_DIR,
115+
f"--{constants.LABEL_CONFIG_DIR}",
119116
help="the directory for configuration file lookup",
120117
)
121118
advanced.add_argument(
@@ -125,12 +122,12 @@ def create_parser():
125122
"-g", "--%s" % constants.LABEL_GROUP, help="a subset of targets"
126123
)
127124
advanced.add_argument(
128-
"--%s" % constants.LABEL_TEMPLATE_TYPE.replace("_", "-"),
125+
f"--{constants.LABEL_TEMPLATE_TYPE.replace('_', '-')}",
129126
help="the template type, default is jinja2",
130127
)
131128
advanced.add_argument(
132129
"-d",
133-
"--%s" % constants.LABEL_DEFINE,
130+
f"--{constants.LABEL_DEFINE}",
134131
nargs="+",
135132
help=(
136133
"to supply additional or override predefined variables,"
@@ -139,7 +136,7 @@ def create_parser():
139136
)
140137
advanced.add_argument(
141138
"-e",
142-
"--%s" % constants.LABEL_EXTENSION,
139+
f"--{constants.LABEL_EXTENSION}",
143140
nargs="+",
144141
help="to to TEMPLATE_TYPE=EXTENSION_NAME",
145142
)
@@ -154,15 +151,15 @@ def create_parser():
154151
"Developer options", "For debugging and development"
155152
)
156153
developer.add_argument(
157-
"--%s" % constants.LABEL_EXIT_CODE,
154+
f"--{constants.LABEL_EXIT_CODE}",
158155
action="store_true",
159156
dest=constants.LABEL_EXIT_CODE,
160157
default=False,
161158
help="tell moban to change exit code",
162159
)
163160
developer.add_argument(
164161
"-V",
165-
"--%s" % constants.LABEL_VERSION,
162+
f"--{constants.LABEL_VERSION}",
166163
action="version",
167164
version="%(prog)s {v}".format(v=__version__),
168165
)

0 commit comments

Comments
 (0)