Package tdi :: Module factory :: Class Loader
[frames] | no frames]

Class Loader

source code

object --+
         |
        Loader

Template loader
Instance Methods
 
__init__(self, parser, builder, encoder, decoder, eventfilters=None, streamfilters=None, default_eventfilter_list=None, default_streamfilter_list=None, default_eventfilters=True, default_streamfilters=True, chunksize=None)
Initialization
source code
callable
persist(self, filename, encoding, opener)
Persist loader
source code
tdi.nodetree.Root
__call__(self, stream, filename, encoding)
Actually load the template and build the tree
source code

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

Properties
dict args
The initialization arguments

Inherited from object: __class__

Method Details

__init__(self, parser, builder, encoder, decoder, eventfilters=None, streamfilters=None, default_eventfilter_list=None, default_streamfilter_list=None, default_eventfilters=True, default_streamfilters=True, chunksize=None)
(Constructor)

source code 
Initialization
Parameters:
  • parser (callable) - Parser factory (takes a builder instance and the decoder, returns ParserInterface)
  • builder (callable) - Tree builder factory (takes the encoder and the decoder)
  • encoder (callable) - Encoder factory (takes the target encoding)
  • decoder (callable) - Decoder factory (takes the source encoding)
  • eventfilters (iterable) - List of event filter factories ((BuildingListenerInterface, ...))
  • streamfilters (iterable) - List of stream filter factories ((file, ...))
  • default_eventfilter_list (list) - Default eventfilter list
  • default_streamfilter_list (list) - Default streamfilter list
  • default_eventfilters (bool) - Apply default eventfilters (before this list)?
  • default_streamfilters (bool) - Apply default streamfilters (before this list)?
  • chunksize (int) - Chunk size when reading templates
Overrides: object.__init__

persist(self, filename, encoding, opener)

source code 
Persist loader
Parameters:
  • filename (str) - Filename in question
  • encoding (str) - Initial template encoding
  • opener (callable) - Stream opener, returns stream and mtime
Returns: callable
persisted loader (takes stream and optional mtime)

__call__(self, stream, filename, encoding)
(Call operator)

source code 
Actually load the template and build the tree
Parameters:
  • stream (file) - The stream to read from
  • filename (str) - The template filename
  • encoding (str) - Initial template encoding
Returns: tdi.nodetree.Root
The tree

Property Details

args

The initialization arguments
Get Method:
unreachable.fget(self)
Type:
dict