Returns a function that selects a literal descendant of a path.
(self, part, parts)
| 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, |