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

Method literal_selector

Lib/glob.py:414–431  ·  view source on GitHub ↗

Returns a function that selects a literal descendant of a path.

(self, part, parts)

Source from the content-addressed store, hash-verified

412 return select_special
413
414 def literal_selector(self, part, parts):
415 """Returns a function that selects a literal descendant of a path.
416 """
417
418 # Optimization: consume and join any subsequent literal parts here,
419 # rather than leaving them for the next selector. This reduces the
420 # number of string concatenation operations.
421 while parts and magic_check.search(parts[-1]) is None:
422 part += self.sep + parts.pop()
423 if parts:
424 part += self.sep
425
426 select_next = self.selector(parts)
427
428 def select_literal(path, exists=False):
429 path = self.concat_path(path, part)
430 return select_next(path, exists=False)
431 return select_literal
432
433 def wildcard_selector(self, part, parts):
434 """Returns a function that selects direct children of a given path,

Callers

nothing calls this directly

Calls 3

selectorMethod · 0.95
searchMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected