@@ -165,13 +165,15 @@ def format_statement(self, problem: Problem) -> List[str]:
165165 statement .extend (comments )
166166 return statement
167167
168- def create_project (self , project_path : str , problems : List [Problem ], site : str ) -> None :
168+ def create_project (self , project_path : str , problems : List [Problem ], site : str , debug : bool = False ) -> None :
169169 r"""Create the folder for the project and generate code and supporting files.
170170
171171 :param project_path: Path to the project folder.
172172 :param problems: List of problem descriptions to generate code for.
173173 :param site: The LeetCode site where problems are crawled. Different sites may have slightly different syntax
174174 (or language-dependent markings).
175+ :param debug: If ``True``, exceptions will not be caught. This is probably only useful when the ``--debug``
176+ flag is set, in which case the Python debugger is hooked to handle exceptions.
175177 """
176178 if not os .path .exists (project_path ):
177179 os .makedirs (project_path )
@@ -194,7 +196,9 @@ def create_project(self, project_path: str, problems: List[Problem], site: str)
194196 problem_code = self .replace_section (problem_code , {"STATEMENT" : statement }, ignore_errors = True )
195197 code_path = os .path .join (project_path , self .get_problem_file_name (idx , problem ))
196198 self .write_and_backup (code_path , "\n " .join (problem_code ) + "\n " )
197- except Exception as e :
199+ except Exception :
200+ if debug :
201+ raise
198202 traceback .print_exc ()
199203 log (f"Exception occurred while processing \" { problem .name } \" " , "error" )
200204
0 commit comments