Skip to content

Commit 01b39dc

Browse files
committed
feat(batch_process.py): only consider main tex files in paper path
1 parent 864cc79 commit 01b39dc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

batch_process.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,21 @@ def process_one_file(file_name) -> None:
131131
os.chdir(cwd)
132132

133133

134-
def filter_tex_files(tex_files: List[str]) -> List[str]:
135-
"""extract all MAIN.tex files for processing
134+
def filter_tex_files(tex_files: List[str], main_path: str = None) -> List[str]:
135+
"""extract all MAIN.tex files for processing, if main_path is not None, then
136+
only extract MAIN.tex files in the main_path (not recursive)
136137
137138
Args:
138139
tex_files (List[str]): list of tex files
140+
main_path (str, optional): path to main directory. Defaults to None.
139141
140142
Returns:
141143
List[str]: list of tex files that are compiable.
142144
"""
143145
result = []
144146
for tex_file in tex_files:
147+
if main_path and os.path.dirname(os.path.dirname(tex_file)) != main_path:
148+
continue
145149
# prevent processing previous generated files
146150
if os.path.basename(tex_file).startswith("paper_"):
147151
log.debug(f"{tex_file} should be deleted.")
@@ -164,7 +168,7 @@ def process_one_category(path, cpu_count, category):
164168
log.info(f"path to raw data: {category_path}")
165169
log.info(f"Using cpu counts: {cpu_count}")
166170
tex_files = utils.extract_all_tex_files(category_path)
167-
tex_files = filter_tex_files(tex_files)
171+
tex_files = filter_tex_files(tex_files, category_path)
168172
log.info(f"Found {len(tex_files)} tex files")
169173

170174
try:

0 commit comments

Comments
 (0)