Package pyffi :: Module spells :: Class SpellGroupBase
[hide private]
[frames] | no frames]

Class SpellGroupBase

source code

object --+    
         |    
     Spell --+
             |
            SpellGroupBase
Known Subclasses:

Base class for grouping spells. This implements all the spell grouping functions that fall outside of the actual recursing (__init__, toastentry, _datainspect, datainspect, and toastexit).
Instance Methods [hide private]
 
__init__(self, toaster=None, data=None, stream=None)
Initialize the spell data for all given spells.
source code
bool
datainspect(self)
Inspect every spell with L{Spell.datainspect} and keep those spells that must be cast.
source code

Inherited from Spell: branchentry, branchexit, branchinspect, dataentry, dataexit, recurse

Inherited from Spell (private): _branchinspect, _datainspect

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
bool
toastentry(cls, toaster)
Called just before the toaster starts processing all files.
source code
 
toastexit(cls, toaster)
Called when the toaster has finished processing all files.
source code

Inherited from Spell: get_toast_stream

Class Variables [hide private]
  SPELLCLASSES = []
List of Spells of this group (not instantiated).
  ACTIVESPELLCLASSES = []
List of active spells of this group (not instantiated).
  spells = []
List of active spell instances.

Inherited from Spell: READONLY, SPELLNAME, changed, data, stream, toaster

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, toaster=None, data=None, stream=None)
(Constructor)

source code 
Initialize the spell data for all given spells.
Parameters:
Overrides: object.__init__

datainspect(self)

source code 
Inspect every spell with L{Spell.datainspect} and keep those spells that must be cast.
Returns: bool
True if the file must be processed, False otherwise.
Overrides: Spell.datainspect

toastentry(cls, toaster)
Class Method

source code 

Called just before the toaster starts processing all files. If it returns False, then the spell is not used. The default implementation simply returns True.

For example, if the spell only acts on a particular block type, but that block type is excluded, then you can use this function to flag that this spell can be skipped. You can also use this function to initialize statistics data to be aggregated from files, to initialize a log file, and so.

Parameters:
  • toaster - The toaster this spell is called from.
Returns: bool
True if the spell applies, False otherwise.
Overrides: Spell.toastentry
(inherited documentation)

toastexit(cls, toaster)
Class Method

source code 
Called when the toaster has finished processing all files.
Parameters:
  • toaster - The toaster this spell is called from.
Overrides: Spell.toastexit
(inherited documentation)

Class Variable Details [hide private]

ACTIVESPELLCLASSES

List of active spells of this group (not instantiated). This list is automatically built when toastentry is called.
Value:
[]