5 leaftypes = (int, float, complex)
7 if 'long' in builtins.__dict__:
8 leaftypes = leaftypes + (builtins.__dict__[
'long'],)
9 if 'buffer' in builtins.__dict__:
10 leaftypes = leaftypes + (builtins.__dict__[
'buffer'],)
12 raise Exception (
"Use treereader() rather than creating Treereader directly.")
14 def real_init (self, tree, parent = None, subpattern = None):
30 ret = getattr (self.
_tree, lname)
31 if (isinstance (ret, Treereader.leaftypes)
or
32 str(
type(ret)) ==
"<type 'buffer'>"):
33 def getter (self, tree = self._tree, lname = lname):
34 return getattr (tree, lname)
35 setattr (self.__class__, attr, property (getter))
37 setattr (self, attr, ret)
41 newdict = {
'_tree' : self.
_tree,
45 if isinstance (v, Treereader):
55 sub = treereader (self.
_tree, self, subpattern)
61 return self.
_tree.GetEntry (i)
66 def __init__ (self, tree, subpattern = None):
67 Treereader.real_init (self, tree, parent, subpattern)
69 return Treereader_Specific (tree, subpattern)