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

Method __init__

21-async/mojifinder/bottle.py:280–294  ·  view source on GitHub ↗
(self, strict=False)

Source from the content-addressed store, hash-verified

278 _MAX_GROUPS_PER_PATTERN = 99
279
280 def __init__(self, strict=False):
281 self.rules = [] # All rules in order
282 self._groups = {} # index of regexes to find them in dyna_routes
283 self.builder = {} # Data structure for the url builder
284 self.static = {} # Search structure for static routes
285 self.dyna_routes = {}
286 self.dyna_regexes = {} # Search structure for dynamic routes
287 #: If true, static routes are no longer checked first.
288 self.strict_order = strict
289 self.filters = {
290 're': lambda conf:
291 (_re_flatten(conf or self.default_pattern), None, None),
292 'int': lambda conf: (r'-?\d+', int, lambda x: str(int(x))),
293 'float': lambda conf: (r'-?[\d.]+', float, lambda x: str(float(x))),
294 'path': lambda conf: (r'.+?', None, None)}
295
296 def add_filter(self, name, func):
297 ''' Add a filter. The provided function is called with the configuration

Callers

nothing calls this directly

Calls 1

_re_flattenFunction · 0.85

Tested by

no test coverage detected