Lines Matching defs:file
1 """Extended file operations available in POSIX.
7 will create a posixfile object from a builtin file object
9 f.file()
10 will return the original builtin file object
13 will return a new file object based on a new filedescriptor
16 will return a new file object based on the given filedescriptor
60 """File wrapper class that provides extra POSIX file routines."""
68 file = self._file_
70 (self.states[file.closed], file.name, file.mode, \
80 def fileopen(self, file):
82 if repr(type(file)) != "<type 'file'>":
83 raise TypeError, 'posixfile.fileopen() arg must be file object'
84 self._file_ = file
85 # Copy basic file methods
86 for maybemethod in dir(file):
88 attr = getattr(file, maybemethod)
96 def file(self):
130 file = self._file_
133 cur_fl = fcntl.fcntl(file.fileno(), fcntl.F_GETFL, 0)
137 l_flags = fcntl.fcntl(file.fileno(), fcntl.F_SETFL, l_flags)
141 l_flags = fcntl.fcntl(file.fileno(), fcntl.F_SETFD, arg)
145 l_flags = fcntl.fcntl(file.fileno(), fcntl.F_GETFL, 0)
147 if fcntl.fcntl(file.fileno(), fcntl.F_GETFD, 0) & 1:
221 """Public routine to open a file as a posixfile object."""
224 def fileopen(file):
225 """Public routine to get a posixfile object from a Python file object."""
226 return _posixfile_().fileopen(file)