utils Package

stop_criteria Module

Created on Mar 4, 2014

author: jakeret

class ivy.utils.stop_criteria.RangeStopCriteria(maxIter)[source]

Bases: ivy.utils.stop_criteria.StopCriteria

Stopping criteria which stops after maxIter iterations

isStop()[source]
class ivy.utils.stop_criteria.SimpleStopCriteria[source]

Bases: ivy.utils.stop_criteria.RangeStopCriteria

Simple implementation of a stopping criteria. Stops after one iteration

class ivy.utils.stop_criteria.StopCriteria[source]

Bases: object

Abstract implementation of stopping criteria

isStop()[source]
parent = None

struct Module

Created on Mar 4, 2014

author: jakeret

class ivy.utils.struct.ImmutableStruct(initializer=None, **extra_args)[source]

Bases: ivy.utils.struct._Base

A dict-like object, whose keys can be accessed with the usual ‘[…]’ lookup syntax, or with the ‘.’ get attribute syntax.

Examples:

>>> a = Struct()
>>> a['x'] = 1
>>> a.x
1
>>> a.y = 2
>>> a['y']
2

Values can also be initially set by specifying them as keyword arguments to the constructor:

>>> a = Struct(z=3)
>>> a['z']
3
>>> a.z
3

Like dict instances, Struct`s have a `copy method to get a shallow copy of the instance:

>>> b = a.copy()
>>> b.z
3
copy()[source]

Return a (shallow) copy of this Struct instance.

iter()
keys()[source]
class ivy.utils.struct.Struct(initializer=None, **extra_args)[source]

Bases: ivy.utils.struct.ImmutableStruct

Mutable implementation of a Struct

copy()[source]

Return a (shallow) copy of this Struct instance.

class ivy.utils.struct.WorkflowStruct(initializer=None, **extra_args)[source]

Bases: ivy.utils.struct.ImmutableStruct

Struct representing the internal state of a workflow loop

exit()[source]
increment()[source]
iter = 0
reset()[source]
resume()[source]
state = 'RUN'
stop()[source]

utils Module

Created on Mar 5, 2014

author: jakeret

class ivy.utils.utils.Enum[source]

Bases: frozenset

A generic enumeration class. Inspired by: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python/2182437#2182437 with some more syntactic sugar added.

An Enum class must be instanciated with a list of strings, that make the enumeration “label”:

>>> Animal = Enum('CAT', 'DOG')

Each label is available as an instance attribute, evaluating to itself:

>>> Animal.DOG
'DOG'

>>> Animal.CAT == 'CAT'
True

As a consequence, you can test for presence of an enumeration label by string value:

>>> 'DOG' in Animal
True

Finally, enumeration labels can also be iterated upon:

>>> for a in Animal: print a
DOG
CAT
class ivy.utils.utils.ListIter(list)[source]

Bases: object

Simple list iterator which can be pickled

Parameters:list – the list over which should be iterated
next()
ivy.utils.utils.boolify(s)[source]
ivy.utils.utils.inferType(var)[source]

guesses the str representation of the variables type

ivy.utils.utils.listify(s)[source]