6.13.1. Source Drivers Subpackage

This subpackage contains components to read lines from various sources. Note that an interscript line is not terminated by a newline, and it never ends in spaces. Control characters are not permitted in lines.

It should be noted that it is the responsibility of the driver to translate the underlying file into a source of whole lines according to these requirements.

Source drivers supply the following standard python methods:

read(size=None)
Return the whole file as a single string with lines terminated by newline characters. Whitespace is stripped from the end of each line before the newline is appended. At least one line will be returned, and there will always be a newline at the end of the string. The optional size argument is ignored. This method throws an eof exception if there are no lines in the file. An exception is thrown if the file is has been closed.
readline(sizehint=None)
Read a up to the end of a line, return the read data with a newline appended. Whitespace is stripped from the end of the line before the newline is appended. This method throws an eof exception if there are no lines in the file. An exception is thrown if the file is has been closed.
readlines(sizehint=None)
Read to the end of the file, returning a list of lines, each of which has had trailing whitespace stripped and a newline character appended. An empty list is returned if there are no lines in the file. An exception is thrown if the file is has been closed.
flush()
May flush input device.

In addition, the following methods are provided:

raw_readline()
Return next line. The line has trailing whitespace stripped, no newline character is appended. Throws an exception if there are no lines left in the file.
raw_readlines()
Return a list of all lines to the end of the file, with trailing whitespace stripped and no newlines added. Returns an empty list if there are no lines in the file. This routine is intended to be supplied by derivers of subclasses of the standard base.


6.13.1.1. Source Drivers Module
6.13.1.2. Source Base
6.13.1.3. Disk File Input
6.13.1.4. URL input
6.13.1.5. FTP input
6.13.1.6. HTTP input
6.13.1.7. Standard Input
6.13.1.8. Cache