clique

clique.DIGITS_PATTERN = '(?P<index>(?P<padding>0*)\\d+)'

Pattern for matching an index with optional padding.

clique.PATTERNS = {'frames': '\\.(?P<index>(?P<padding>0*)\\d+)\\.\\D+\\d?$', 'versions': 'v(?P<index>(?P<padding>0*)\\d+)'}

Common patterns that can be passed to assemble().

clique.assemble(iterable, patterns=None, minimum_items=2)[source]

Assemble items in iterable into discreet collections.

patterns may be specified as a list of regular expressions to limit the returned collection possibilities. Use this when interested in collections that only match specific patterns. Each pattern must contain the expression from DIGITS_PATTERN exactly once.

A selection of common expressions are available in PATTERNS.

Note

If a pattern is supplied as a string it will be automatically compiled to a re.RegexObject instance for convenience.

When patterns is not specified, collections are formed by examining all possible groupings of the items in iterable based around common numerical components.

minimum_items dictates the minimum number of items a collection must have in order to be included in the result. The default is 2, filtering out single item collections.

Return list of assembled Collection instances.

Project Versions

Previous topic

Reference

Next topic

collection

This Page