@@ -50,10 +50,10 @@ def __lt__(self, other):
5050
5151
5252def run_request_for_module (module_name : str ):
53- log .info ("Start processing %r " , module_name )
53+ log .info ("Start processing %s " , module_name )
5454
5555 module_full_name = "." .join ((SNIPPETS_DIR , module_name ))
56- log .debug ("import module %s" , module_full_name )
56+ log .debug ("Import module %s" , module_full_name )
5757 module = importlib .import_module (module_full_name )
5858
5959 log .info ("Process module %s" , module )
@@ -68,15 +68,11 @@ def run_request_for_module(module_name: str):
6868
6969 http_response_text .append (
7070 # "HTTP/1.1 201 Created"
71- "{} {} {}" .format (
72- "HTTP/1.1" ,
73- response .status_code ,
74- response_reason ,
75- )
71+ f"HTTP/1.1 { response .status_code } { response .status_code } "
7672 )
7773
7874 if ct := response .headers .get ("content-type" ):
79- http_response_text .append ("{}: {}" . format ( " Content-Type" , ct ) )
75+ http_response_text .append (f" Content-Type: { ct } " )
8076 http_response_text .append ("" )
8177
8278 if response .content :
@@ -96,9 +92,9 @@ def run_request_for_module(module_name: str):
9692 result_file_name = "/" .join ((SNIPPETS_DIR , module_name + SNIPPET_RESULT_POSTFIX ))
9793 with open (result_file_name , "w" ) as f :
9894 res = f .write (result_text )
99- log .info ("Wrote text (%s) to %r " , res , result_file_name )
95+ log .info ("Wrote text (%s) to %s " , res , result_file_name )
10096
101- log .info ("Processed %r " , module_name )
97+ log .info ("Processed %s " , module_name )
10298
10399
104100def add_help_lines (lines : list , module_name : str ) -> None :
@@ -145,13 +141,13 @@ def main():
145141 log .warning ("Starting" )
146142
147143 available_modules = os .listdir (SNIPPETS_DIR )
148- log .debug ("all available snippets: %s" , available_modules )
144+ log .debug ("All available snippets: %s" , available_modules )
149145 modules_to_process = list (
150146 # exclude unknown
151147 filter (lambda name : name .startswith (args .prefix ), available_modules )
152148 )
153149 modules_to_process .sort (key = StrOrderCRUD )
154- log .warning ("modules to process (with order): %s" , modules_to_process )
150+ log .warning ("Modules to process (with order): %s" , modules_to_process )
155151
156152 result_help_text = []
157153 result_help_text .append ("=" * 30 )
@@ -162,7 +158,7 @@ def main():
162158 try :
163159 run_request_for_module (module_name )
164160 except Exception :
165- log .exception ("Could not process module %r , skipping" , module_file )
161+ log .exception ("Could not process module %s , skipping" , module_file )
166162 else :
167163 if REMOVE_PYTHON_SNIPPET :
168164 os .unlink ("/" .join ((SNIPPETS_DIR , module_file )))
0 commit comments