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

Method selector

Lib/glob.py:385–400  ·  view source on GitHub ↗

Returns a function that selects from a given path, walking and filtering according to the glob-style pattern parts in *parts*.

(self, parts)

Source from the content-addressed store, hash-verified

383 return _compile_pattern(pat, seps, self.case_sensitive, self.recursive)
384
385 def selector(self, parts):
386 """Returns a function that selects from a given path, walking and
387 filtering according to the glob-style pattern parts in *parts*.
388 """
389 if not parts:
390 return self.select_exists
391 part = parts.pop()
392 if self.recursive and part == '**':
393 selector = self.recursive_selector
394 elif part in _special_parts:
395 selector = self.special_selector
396 elif not self.case_pedantic and magic_check.search(part) is None:
397 selector = self.literal_selector
398 else:
399 selector = self.wildcard_selector
400 return selector(part, parts)
401
402 def special_selector(self, part, parts):
403 """Returns a function that selects special children of the given path.

Callers 6

special_selectorMethod · 0.95
literal_selectorMethod · 0.95
wildcard_selectorMethod · 0.95
recursive_selectorMethod · 0.95
globMethod · 0.80
globMethod · 0.80

Calls 2

popMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected