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

Class SpellGroupSeriesBase

source code

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

Base class for running spells in series.
Instance Methods [hide private]
 
recurse(self, branch=None)
Recurse spells in series.
source code
bool
branchinspect(self, branch)
Like _branchinspect, but for customization: can be overridden to perform an extra inspection (the default implementation always returns True).
source code
bool
branchentry(self, branch)
Cast the spell on the given branch.
source code
bool
dataentry(self)
Called before all blocks are recursed.
source code
 
dataexit(self)
Called after all blocks have been processed, if dataentry returned True.
source code

Inherited from SpellGroupBase: __init__, datainspect

Inherited from Spell: branchexit

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]

Inherited from SpellGroupBase: toastentry, toastexit

Inherited from Spell: get_toast_stream

Class Variables [hide private]

Inherited from SpellGroupBase: ACTIVESPELLCLASSES, SPELLCLASSES, spells

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

Properties [hide private]
  changed
Whether the spell changed the data.

Inherited from object: __class__

Method Details [hide private]

recurse(self, branch=None)

source code 
Recurse spells in series.
Parameters:
  • branch - The branch to start the recursion from, or None to recurse the whole tree.
Overrides: Spell.recurse

branchinspect(self, branch)

source code 
Like _branchinspect, but for customization: can be overridden to perform an extra inspection (the default implementation always returns True).
Parameters:
  • branch - The branch to check.
Returns: bool
True if the branch must be processed, False otherwise.
Overrides: Spell.branchinspect
(inherited documentation)

branchentry(self, branch)

source code 

Cast the spell on the given branch. First called with branch equal to data's children, then the grandchildren, and so on. The default implementation simply returns True.

Typically, you will override this function to perform an operation on a particular block type and/or to stop recursion at particular block types.

Parameters:
  • branch - The branch to cast the spell on.
Returns: bool
True if the children must be processed, False otherwise.
Overrides: Spell.branchentry
(inherited documentation)

dataentry(self)

source code 

Called before all blocks are recursed. The default implementation simply returns True. You can access the data via data, and unlike in the datainspect method, the full file has been processed at this stage.

Typically, you will override this function to perform a global operation on the file data.

Returns: bool
True if the children must be processed, False otherwise.
Overrides: Spell.dataentry
(inherited documentation)

dataexit(self)

source code 

Called after all blocks have been processed, if dataentry returned True.

Typically, you will override this function to perform a final spell operation, such as writing back the file in a special way, or making a summary log.

Overrides: Spell.dataexit
(inherited documentation)

Property Details [hide private]

changed

Whether the spell changed the data. If True, the file will be written back, otherwise not.
Get Method:
unreachable.changed(self)