Created
July 2, 2010 07:16
-
-
Save bolthar/461046 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CLF(object): | |
#snip | |
def handle_cl(self): | |
#snip | |
if params and params[0]: | |
self.__input_stream = FileStream(params[0], 'r') | |
else: | |
self.__input_stream = IOStream(sys.stdin) | |
if self.outfile: | |
self.__output_stream = FileStream(self.outfile, self.output_mode) | |
else: | |
self.__output_stream = IOStream(sys.stdout) | |
#snip | |
def setup(self): | |
#snip | |
self.infile = self.__input_stream.get_stream() | |
self.outfile = self.__output_stream.get_stream() | |
class FileStream(object): | |
def __init__(self, filename, mode): | |
self.__filename = filename | |
self.__mode = mode | |
def get_stream(self): | |
return open(self.__filename, self.__mode) | |
class IOStream(object): | |
def __init__(self, stream): | |
self.__stream = stream | |
def get_stream(self): | |
return self.__stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment