MCPcopy Index your code
hub / github.com/python/cpython / select_recursive_step

Method select_recursive_step

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

Source from the content-addressed store, hash-verified

493 yield from select_recursive_step(stack, match_pos)
494
495 def select_recursive_step(stack, match_pos):
496 path = stack.pop()
497 try:
498 entries = self.scandir(path)
499 except OSError:
500 pass
501 else:
502 for entry, _entry_name, entry_path in entries:
503 is_dir = False
504 try:
505 if entry.is_dir(follow_symlinks=follow_symlinks):
506 is_dir = True
507 except OSError:
508 pass
509
510 if is_dir or not dir_only:
511 entry_path_str = self.stringify_path(entry_path)
512 if dir_only:
513 entry_path = self.concat_path(entry_path, self.sep)
514 if match is None or match(entry_path_str, match_pos):
515 if dir_only:
516 yield from select_next(entry_path, exists=True)
517 else:
518 # Optimization: directly yield the path if this is
519 # last pattern part.
520 yield entry_path
521 if is_dir:
522 stack.append(entry_path)
523
524 return select_recursive
525

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected