MCPcopy Create free account
hub / github.com/modelscope/modelscope / _traversal_files

Method _traversal_files

modelscope/utils/ast_utils.py:455–469  ·  view source on GitHub ↗
(self, path, include_init=False)

Source from the content-addressed store, hash-verified

453 self._traversal_files(sub_dir, include_init=include_init)
454
455 def _traversal_files(self, path, include_init=False):
456 dir_list = os.scandir(path)
457 for item in dir_list:
458 if item.name == '__init__.py' and not include_init:
459 continue
460 elif (item.name.startswith('__')
461 and item.name != '__init__.py') or item.name.endswith(
462 '.json') or item.name.endswith('.md'):
463 continue
464 if item.is_dir():
465 self._traversal_files(item.path, include_init=include_init)
466 elif item.is_file() and item.name.endswith('.py'):
467 self.file_dirs.append(item.path)
468 elif item.is_file() and 'requirement' in item.name:
469 self.requirement_dirs.append(item.path)
470
471 def _get_single_file_scan_result(self, file):
472 try:

Callers 1

traversal_filesMethod · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected