Peach :: group :: Group :: Class Group
[hide private]

Class Group

source code

Groups allow for performing a next() call on a specific set of Generators allowing for more complex Fuzzing setups. This default group object will iterate an infinit amount of times.

Group objects implement the iterator protocol.

Instance Methods [hide private]
 
__init__(self, name=None)
Create a new Group object.
source code
string
getName(self)
Get current name of Group.
source code
 
setName(self, name)
Set name of Group.
source code
 
addGenerator(self, gen)
Add Generator to Group.
source code
 
addGenerators(self, gens)
Add Generators to Group.
source code
 
removeGenerator(self, gen)
Remove Generator from Group.
source code
Array
getAllGenerators(self)
Returns list of all generators in Group.
source code
 
__iter__(self) source code
 
next(self)
Iterate all Generators to next value.
source code
 
reset(self)
Resets all Generators to there initial state.
source code
Class Variables [hide private]
  _name = None
  _generators = []
  _identity = ""
Method Details [hide private]

__init__(self, name=None)
(Constructor)

source code 

Create a new Group object.

Parameters:
  • name (string) - Name of Group object. Not currently used.

getName(self)

source code 

Get current name of Group. Not currently used.

Returns: string
name of Group

setName(self, name)

source code 

Set name of Group. Not currently used.

Parameters:
  • name (string) - Name of Group

addGenerator(self, gen)

source code 

Add Generator to Group. This should almost never be called directly. Generators will call this when you set there Group. However, you can do some crazy stuff by adding a Generator into multiple Groups so they iterate themselves in strange ways.

Parameters:
  • gen (Generator) - Generator to add

addGenerators(self, gens)

source code 

Add Generators to Group. This should almost never be called directly. Generators will call this when you set there Group. However, you can do some crazy stuff by adding a Generator into multiple Groups so they iterate themselves in strange ways.

Parameters:
  • gens (Array of Generators) - Generatorsto add

removeGenerator(self, gen)

source code 

Remove Generator from Group.

Parameters:
  • gen (Generator) - Generator to remove

getAllGenerators(self)

source code 

Returns list of all generators in Group. This is a reference to our internal list so any changes will also affect the Group.

Returns: Array
Returns Array of strings

next(self)

source code 

Iterate all Generators to next value.

From Python docs on next():

The intention of the protocol is that once an iterator's next() method raises StopIteration, it will continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken. (This constraint was added in Python 2.3; in Python 2.2, various iterators are broken according to this rule.)

For Groups, please use the GroupCompleted exception instead of StopIteration (its a subclass).