Package lepl :: Package stream :: Module facade
[hide private]
[frames] | no frames]

Source Code for Module lepl.stream.facade

 1   
 2  # The contents of this file are subject to the Mozilla Public License 
 3  # (MPL) Version 1.1 (the "License"); you may not use this file except 
 4  # in compliance with the License. You may obtain a copy of the License 
 5  # at http://www.mozilla.org/MPL/ 
 6  # 
 7  # Software distributed under the License is distributed on an "AS IS" 
 8  # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
 9  # the License for the specific language governing rights and 
10  # limitations under the License. 
11  # 
12  # The Original Code is LEPL (http://www.acooke.org/lepl) 
13  # The Initial Developer of the Original Code is Andrew Cooke. 
14  # Portions created by the Initial Developer are Copyright (C) 2009-2010 
15  # Andrew Cooke (andrew@acooke.org). All Rights Reserved. 
16  # 
17  # Alternatively, the contents of this file may be used under the terms 
18  # of the LGPL license (the GNU Lesser General Public License, 
19  # http://www.gnu.org/licenses/lgpl.html), in which case the provisions 
20  # of the LGPL License are applicable instead of those above. 
21  # 
22  # If you wish to allow use of your version of this file only under the 
23  # terms of the LGPL License and not to allow others to use your version 
24  # of this file under the MPL, indicate your decision by deleting the 
25  # provisions above and replace them with the notice and other provisions 
26  # required by the LGPL License.  If you do not delete the provisions 
27  # above, a recipient may use your version of this file under either the 
28  # MPL or the LGPL License. 
29   
30  ''' 
31  A facade that delegates all methods to an embedded instance. 
32  ''' 
33   
34  from lepl.stream.core import StreamHelper 
35   
36   
37 -class HelperFacade(StreamHelper):
38 ''' 39 A facade that delegates all calls to the underlying delegate stream. 40 ''' 41
42 - def __init__(self, delegate):
43 self._delegate = delegate
44
45 - def __repr__(self):
46 return repr(self._delegate)
47
48 - def __eq__(self, other):
49 return self._delegate == other
50
51 - def __hash__(self):
52 return hash(self._delegate)
53
54 - def key(self, state, other):
55 return self._delegate.key(state, other)
56
57 - def kargs(self, state, prefix='', kargs=None):
58 return self._delegate.kargs(state, prefix=prefix, kargs=kargs)
59
60 - def fmt(self, state, template, prefix='', kargs=None):
61 return self._delegate.fmt(state, template, prefix=prefix, kargs=kargs)
62
63 - def debug(self, state):
64 return self._delegate.debug(state)
65
66 - def next(self, state, count=1):
67 return self._delegate.next(state, count=count)
68
69 - def join(self, state, *values):
70 return self._delegate.join(state, *values)
71
72 - def empty(self, state):
73 return self._delegate.empty(state)
74
75 - def line(self, state, empty_ok):
76 return self._delegate.line(state, empty_ok)
77
78 - def len(self, state):
79 return self._delegate.len(state)
80
81 - def stream(self, state, value, id_=None):
82 return self._delegate.stream(state, value, id_)
83
84 - def deepest(self):
85 return self._delegate.deepest()
86
87 - def delta(self, state):
88 return self._delegate.delta(state)
89
90 - def eq(self, state1, state2):
91 return self._delegate.eq(state1, state2)
92
93 - def new_max(self, state):
94 return self._delegate.new_max(state)
95
96 - def cacheable(self):
97 return self._delegate.cacheable()
98