Package lib :: Module io :: Class DummyFileObject
[hide private]
[frames] | no frames]

Class DummyFileObject

source code

Instance Methods [hide private]
 
__init__(self, mode='w')
Set up the dummy object to act as a file object.
source code
 
close(self)
A method for 'closing' this object.
source code
 
readable(self)
Mimic the Python 3 readable() method.
source code
list of str
readlines(self)
Mimic the file object readlines() method.
source code
 
writable(self)
Mimic the Python 3 writable() method.
source code
 
write(self, str)
Mimic the file object write() method so that this class can be used as a file object.
source code
Method Details [hide private]

__init__(self, mode='w')
(Constructor)

source code 

Set up the dummy object to act as a file object.

Parameters:
  • mode (str) - Set the read or write mode for object testing. This can be 'r' or 'w'.

readlines(self)

source code 

Mimic the file object readlines() method.

This method works even if this dummy file object is closed!

Returns: list of str
The contents of the file object separated by newline characters.

write(self, str)

source code 

Mimic the file object write() method so that this class can be used as a file object.

Parameters:
  • str (str) - The string to be written.