Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions | Private Attributes
mailbox._ProxyFile Class Reference
Inheritance diagram for mailbox._ProxyFile:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def read
def read1
def readline
def readlines
def __iter__
def tell
def seek
def close
def __enter__
def __exit__
def readable
def writable
def seekable
def flush
def closed

Private Member Functions

def _read

Private Attributes

 _file
 _pos

Detailed Description

A read-only wrapper of a file.

Definition at line 1871 of file mailbox.py.


Constructor & Destructor Documentation

def mailbox._ProxyFile.__init__ (   self,
  f,
  pos = None 
)
Initialize a _ProxyFile.

Definition at line 1874 of file mailbox.py.

01874 
01875     def __init__(self, f, pos=None):
01876         """Initialize a _ProxyFile."""
01877         self._file = f
01878         if pos is None:
01879             self._pos = f.tell()
01880         else:
01881             self._pos = pos

Here is the caller graph for this function:


Member Function Documentation

Context manager protocol support.

Definition at line 1940 of file mailbox.py.

01940 
01941     def __enter__(self):
01942         """Context manager protocol support."""
01943         return self

def mailbox._ProxyFile.__exit__ (   self,
  exc 
)

Definition at line 1944 of file mailbox.py.

01944 
01945     def __exit__(self, *exc):
01946         self.close()

Here is the caller graph for this function:

Iterate over lines.

Definition at line 1905 of file mailbox.py.

01905 
01906     def __iter__(self):
01907         """Iterate over lines."""
01908         while True:
01909             line = self.readline()
01910             if not line:
01911                 raise StopIteration
01912             yield line

Here is the call graph for this function:

def mailbox._ProxyFile._read (   self,
  size,
  read_method 
) [private]
Read size bytes using read_method.

Reimplemented in mailbox._PartialFile.

Definition at line 1931 of file mailbox.py.

01931 
01932     def _read(self, size, read_method):
01933         """Read size bytes using read_method."""
01934         if size is None:
01935             size = -1
01936         self._file.seek(self._pos)
01937         result = read_method(size)
01938         self._pos = self._file.tell()
01939         return result

Here is the caller graph for this function:

def mailbox._ProxyFile.close (   self)
Close the file.

Reimplemented in mailbox._PartialFile.

Definition at line 1924 of file mailbox.py.

01924 
01925     def close(self):
01926         """Close the file."""
01927         if hasattr(self, '_file'):
01928             if hasattr(self._file, 'close'):
01929                 self._file.close()
01930             del self._file

Here is the caller graph for this function:

def mailbox._ProxyFile.closed (   self)

Definition at line 1960 of file mailbox.py.

01960 
01961     def closed(self):
01962         if not hasattr(self, '_file'):
01963             return True
01964         if not hasattr(self._file, 'closed'):
01965             return False
01966         return self._file.closed
01967 

Here is the caller graph for this function:

def mailbox._ProxyFile.flush (   self)

Definition at line 1956 of file mailbox.py.

01956 
01957     def flush(self):
01958         return self._file.flush()

Here is the caller graph for this function:

def mailbox._ProxyFile.read (   self,
  size = None 
)
Read bytes.

Definition at line 1882 of file mailbox.py.

01882 
01883     def read(self, size=None):
01884         """Read bytes."""
01885         return self._read(size, self._file.read)

Here is the call graph for this function:

Here is the caller graph for this function:

def mailbox._ProxyFile.read1 (   self,
  size = None 
)
Read bytes.

Definition at line 1886 of file mailbox.py.

01886 
01887     def read1(self, size=None):
01888         """Read bytes."""
01889         return self._read(size, self._file.read1)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1947 of file mailbox.py.

01947 
01948     def readable(self):
01949         return self._file.readable()

def mailbox._ProxyFile.readline (   self,
  size = None 
)
Read a line.

Definition at line 1890 of file mailbox.py.

01890 
01891     def readline(self, size=None):
01892         """Read a line."""
01893         return self._read(size, self._file.readline)

Here is the call graph for this function:

Here is the caller graph for this function:

def mailbox._ProxyFile.readlines (   self,
  sizehint = None 
)
Read multiple lines.

Definition at line 1894 of file mailbox.py.

01894 
01895     def readlines(self, sizehint=None):
01896         """Read multiple lines."""
01897         result = []
01898         for line in self:
01899             result.append(line)
01900             if sizehint is not None:
01901                 sizehint -= len(line)
01902                 if sizehint <= 0:
01903                     break
01904         return result

def mailbox._ProxyFile.seek (   self,
  offset,
  whence = 0 
)
Change position.

Reimplemented in mailbox._PartialFile.

Definition at line 1917 of file mailbox.py.

01917 
01918     def seek(self, offset, whence=0):
01919         """Change position."""
01920         if whence == 1:
01921             self._file.seek(self._pos)
01922         self._file.seek(offset, whence)
01923         self._pos = self._file.tell()

Here is the caller graph for this function:

Definition at line 1953 of file mailbox.py.

01953 
01954     def seekable(self):
01955         return self._file.seekable()

def mailbox._ProxyFile.tell (   self)
Return the position.

Reimplemented in mailbox._PartialFile.

Definition at line 1913 of file mailbox.py.

01913 
01914     def tell(self):
01915         """Return the position."""
01916         return self._pos

Definition at line 1950 of file mailbox.py.

01950 
01951     def writable(self):
01952         return self._file.writable()


Member Data Documentation

Definition at line 1876 of file mailbox.py.

Reimplemented in mailbox._PartialFile.

Definition at line 1878 of file mailbox.py.


The documentation for this class was generated from the following file: