|
0
|
1 |
class FileProxyMixin(object): |
|
|
2 |
""" |
|
|
3 |
A mixin class used to forward file methods to an underlaying file |
|
|
4 |
object. The internal file object has to be called "file":: |
|
|
5 |
|
|
|
6 |
class FileProxy(FileProxyMixin): |
|
|
7 |
def __init__(self, file): |
|
|
8 |
self.file = file |
|
|
9 |
""" |
|
|
10 |
|
|
|
11 |
encoding = property(lambda self: self.file.encoding) |
|
|
12 |
fileno = property(lambda self: self.file.fileno) |
|
|
13 |
flush = property(lambda self: self.file.flush) |
|
|
14 |
isatty = property(lambda self: self.file.isatty) |
|
|
15 |
newlines = property(lambda self: self.file.newlines) |
|
|
16 |
read = property(lambda self: self.file.read) |
|
|
17 |
readinto = property(lambda self: self.file.readinto) |
|
|
18 |
readline = property(lambda self: self.file.readline) |
|
|
19 |
readlines = property(lambda self: self.file.readlines) |
|
|
20 |
seek = property(lambda self: self.file.seek) |
|
|
21 |
softspace = property(lambda self: self.file.softspace) |
|
|
22 |
tell = property(lambda self: self.file.tell) |
|
|
23 |
truncate = property(lambda self: self.file.truncate) |
|
|
24 |
write = property(lambda self: self.file.write) |
|
|
25 |
writelines = property(lambda self: self.file.writelines) |
|
|
26 |
xreadlines = property(lambda self: self.file.xreadlines) |
|
|
27 |
|
|
|
28 |
def __iter__(self): |
|
|
29 |
return iter(self.file) |