Tools and utilities

Miscellaneous diagram-unrelated tools for ADG.

class adg.tools.UniqueID[source]

Bases: object

Counter making sure of generating a unique ID number for diagrams.

current

The unique identifier to be attributedto a diagram.

Type

int

get()[source]

Iterate on counter value and return current value.

Returns

A unique identifier for the diagram.

Return type

int

adg.tools.reversed_enumerate(data)[source]

Return the index and item of the data in reversed order.

Parameters

data (iterable data structure) – The data to be used..

Returns

Index and item.

Return type

tuple

>>> list(reversed_enumerate(['A', 'B', 'C']))
[(2, 'C'), (1, 'B'), (0, 'A')]