MCPcopy
hub / github.com/r1chardj0n3s/parse / parse

Method parse

parse/__init__.py:497–509  ·  view source on GitHub ↗

Match my format to the string exactly. Return a Result or Match instance or None if there's no match.

(self, string, evaluate_result=True)

Source from the content-addressed store, hash-verified

495 return self._format
496
497 def parse(self, string, evaluate_result=True):
498 """Match my format to the string exactly.
499
500 Return a Result or Match instance or None if there's no match.
501 """
502 m = self._match_re.match(string)
503 if m is None:
504 return None
505
506 if evaluate_result:
507 return self.evaluate_result(m)
508 else:
509 return Match(self, m)
510
511 def search(self, string, pos=0, endpos=None, evaluate_result=True):
512 """Search the string for my format.

Calls 2

evaluate_resultMethod · 0.95
MatchClass · 0.85