Back to index

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

List of all members.

Public Member Functions

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

Private Member Functions

def _read

Private Attributes

 _start
 _stop
 _pos

Detailed Description

A read-only wrapper of part of a file.

Definition at line 1968 of file mailbox.py.


Constructor & Destructor Documentation

def mailbox._PartialFile.__init__ (   self,
  f,
  start = None,
  stop = None 
)
Initialize a _PartialFile.

Definition at line 1971 of file mailbox.py.

01971 
01972     def __init__(self, f, start=None, stop=None):
01973         """Initialize a _PartialFile."""
01974         _ProxyFile.__init__(self, f, start)
01975         self._start = start
01976         self._stop = stop

Here is the caller graph for this function:


Member Function Documentation

def mailbox._ProxyFile.__enter__ (   self) [inherited]
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 
) [inherited]

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:

def mailbox._ProxyFile.__iter__ (   self) [inherited]
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._PartialFile._read (   self,
  size,
  read_method 
) [private]
Read size bytes using read_method, honoring start and stop.

Reimplemented from mailbox._ProxyFile.

Definition at line 1991 of file mailbox.py.

01991 
01992     def _read(self, size, read_method):
01993         """Read size bytes using read_method, honoring start and stop."""
01994         remaining = self._stop - self._pos
01995         if remaining <= 0:
01996             return b''
01997         if size is None or size < 0 or size > remaining:
01998             size = remaining
01999         return _ProxyFile._read(self, size, read_method)

Here is the caller graph for this function:

Close the file.

Reimplemented from mailbox._ProxyFile.

Definition at line 2000 of file mailbox.py.

02000 
02001     def close(self):
02002         # do *not* close the underlying file object for partial files,
02003         # since it's global to the mailbox object
02004         if hasattr(self, '_file'):
02005             del self._file
02006 

Here is the caller graph for this function:

def mailbox._ProxyFile.closed (   self) [inherited]

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) [inherited]

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 
) [inherited]
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 
) [inherited]
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:

def mailbox._ProxyFile.readable (   self) [inherited]

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 
) [inherited]
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 
) [inherited]
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._PartialFile.seek (   self,
  offset,
  whence = 0 
)
Change position, possibly with respect to start or stop.

Reimplemented from mailbox._ProxyFile.

Definition at line 1981 of file mailbox.py.

01981 
01982     def seek(self, offset, whence=0):
01983         """Change position, possibly with respect to start or stop."""
01984         if whence == 0:
01985             self._pos = self._start
01986             whence = 1
01987         elif whence == 2:
01988             self._pos = self._stop
01989             whence = 1
01990         _ProxyFile.seek(self, offset, whence)

Here is the caller graph for this function:

def mailbox._ProxyFile.seekable (   self) [inherited]

Definition at line 1953 of file mailbox.py.

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

def mailbox._PartialFile.tell (   self)
Return the position with respect to start.

Reimplemented from mailbox._ProxyFile.

Definition at line 1977 of file mailbox.py.

01977 
01978     def tell(self):
01979         """Return the position with respect to start."""
01980         return _ProxyFile.tell(self) - self._start

def mailbox._ProxyFile.writable (   self) [inherited]

Definition at line 1950 of file mailbox.py.

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


Member Data Documentation

Reimplemented from mailbox._ProxyFile.

Definition at line 1984 of file mailbox.py.

Definition at line 1974 of file mailbox.py.

Definition at line 1975 of file mailbox.py.


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