77import os
88import ast
99from typing import Any
10+ from ..tools import get_files
1011
1112empty_list = ast .parse ("[]" ).body [0 ].value
1213
@@ -236,13 +237,6 @@ def replace_read_group_signature(logger, filename):
236237 file .write (new_all )
237238
238239
239- def _get_files (module_path , reformat_file_ext ):
240- """Get files to be reformatted."""
241- file_paths = list ()
242- if not module_path .is_dir ():
243- raise Exception (f"'{ module_path } ' is not a directory" )
244- file_paths .extend (module_path .rglob ("*" + reformat_file_ext ))
245- return file_paths
246240
247241
248242def _check_open_form_view (logger , file_path : Path ):
@@ -264,8 +258,8 @@ def _check_open_form_view(logger, file_path: Path):
264258def _check_open_form (
265259 logger , module_path , module_name , manifest_path , migration_steps , tools
266260):
267- reformat_file_ext = ".xml"
268- file_paths = _get_files (module_path , reformat_file_ext )
261+ reformat_file_ext = ( ".xml" )
262+ file_paths = get_files (module_path , reformat_file_ext )
269263 logger .debug (f"{ reformat_file_ext } files found:\n " f"{ list (map (str , file_paths ))} " )
270264
271265 for file_path in file_paths :
@@ -277,8 +271,8 @@ def _reformat_read_group(
277271):
278272 """Reformat read_group method in py files."""
279273
280- reformat_file_ext = ".py"
281- file_paths = _get_files (module_path , reformat_file_ext )
274+ reformat_file_ext = ( ".py" )
275+ file_paths = get_files (module_path , reformat_file_ext )
282276 logger .debug (f"{ reformat_file_ext } files found:\n " f"{ list (map (str , file_paths ))} " )
283277
284278 reformatted_files = list ()
0 commit comments