Skip to content

# `typerig.core.func.collection`

## typerig.core.func.collection (version 0.26.1)

    # MODULE: TypeRig / Core / Collection (Functions)
    # -----------------------------------------------------------
    # (C) Vassil Kateliev, 2017-2020        (http://www.kateliev.com)
    # (C) Karandash Type Foundry            (http://www.karandash.eu)
    #------------------------------------------------------------
    # www.typerig.com

### Functions

combineReccuringItems(listItems)

      Combines recurring items in [listItems] and returns a list containing sets of grouped items

enumerateWithStart(sequence, start=0)

      Performs [enumerate] of a [sequence] with added [start] functionality (available in Python 2.6)

groupConsecutives(listItems, step=1)

      Build a list of lists containig consecutive numbers from [listItems] (number list) within [step]

mergeDicts(d1, d2, merge=<function <lambda>>)

      Merges two dictionaries [d1, d2], combining values on duplicate keys as defined by the optional [merge] function.
      --------
      Example: merge(d1, d2, lambda x,y: x+y) -> {'a': 2, 'c': 6, 'b': 4}

unpack(listItems)

      Unpacks all items form [listItems] containing other lists, sets and etc.

## `mergeDicts`

typerig.core.func.collection.mergeDicts = mergeDicts(d1, d2, merge=<function <lambda>>)

      Merges two dictionaries [d1, d2], combining values on duplicate keys as defined by the optional [merge] function.
      --------
      Example: merge(d1, d2, lambda x,y: x+y) -> {'a': 2, 'c': 6, 'b': 4}

## `unpack`

typerig.core.func.collection.unpack = unpack(listItems)

      Unpacks all items form [listItems] containing other lists, sets and etc.

## `enumerateWithStart`

typerig.core.func.collection.enumerateWithStart = enumerateWithStart(sequence, start=0)

      Performs [enumerate] of a [sequence] with added [start] functionality (available in Python 2.6)

## `combineReccuringItems`

typerig.core.func.collection.combineReccuringItems = combineReccuringItems(listItems)

      Combines recurring items in [listItems] and returns a list containing sets of grouped items

## `groupConsecutives`

typerig.core.func.collection.groupConsecutives = groupConsecutives(listItems, step=1)

      Build a list of lists containig consecutive numbers from [listItems] (number list) within [step]