MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / _compile

Method _compile

21-async/mojifinder/bottle.py:394–404  ·  view source on GitHub ↗
(self, method)

Source from the content-addressed store, hash-verified

392 self._compile(method)
393
394 def _compile(self, method):
395 all_rules = self.dyna_routes[method]
396 comborules = self.dyna_regexes[method] = []
397 maxgroups = self._MAX_GROUPS_PER_PATTERN
398 for x in range(0, len(all_rules), maxgroups):
399 some = all_rules[x:x+maxgroups]
400 combined = (flatpat for (_, flatpat, _, _) in some)
401 combined = '|'.join('(^%s$)' % flatpat for flatpat in combined)
402 combined = re.compile(combined).match
403 rules = [(target, getargs) for (_, _, target, getargs) in some]
404 comborules.append((combined, rules))
405
406 def build(self, _name, *anons, **query):
407 ''' Build an URL by filling the wildcards in a rule. '''

Callers 1

addMethod · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected