MCPcopy Index your code
hub / github.com/RustPython/RustPython / select_recursive_step

Method select_recursive_step

Lib/glob.py:482–509  ·  view source on GitHub ↗
(stack, match_pos)

Source from the content-addressed store, hash-verified

480 yield from select_recursive_step(stack, match_pos)
481
482 def select_recursive_step(stack, match_pos):
483 path = stack.pop()
484 try:
485 entries = self.scandir(path)
486 except OSError:
487 pass
488 else:
489 for entry, _entry_name, entry_path in entries:
490 is_dir = False
491 try:
492 if entry.is_dir(follow_symlinks=follow_symlinks):
493 is_dir = True
494 except OSError:
495 pass
496
497 if is_dir or not dir_only:
498 entry_path_str = str(entry_path)
499 if dir_only:
500 entry_path = self.concat_path(entry_path, self.sep)
501 if match is None or match(entry_path_str, match_pos):
502 if dir_only:
503 yield from select_next(entry_path, exists=True)
504 else:
505 # Optimization: directly yield the path if this is
506 # last pattern part.
507 yield entry_path
508 if is_dir:
509 stack.append(entry_path)
510
511 return select_recursive
512

Callers

nothing calls this directly

Calls 7

scandirMethod · 0.95
concat_pathMethod · 0.95
strFunction · 0.85
matchFunction · 0.85
popMethod · 0.45
is_dirMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected