Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
bkfile._BkFile Class Reference

List of all members.

Public Member Functions

def __init__
def close

Public Attributes

 closed
 fileno
 flush
 isatty
 mode
 name
 read
 readinto
 readline
 readlines
 seek
 tell
 truncate
 write
 writelines

Private Attributes

 __filename
 __backup
 __file

Detailed Description

Definition at line 3 of file bkfile.py.


Constructor & Destructor Documentation

def bkfile._BkFile.__init__ (   self,
  file,
  mode,
  bufsize 
)

Definition at line 4 of file bkfile.py.

00004 
00005     def __init__(self, file, mode, bufsize):
00006         import os
00007         self.__filename = file
00008         self.__backup = file + '~'
00009         try:
00010             os.unlink(self.__backup)
00011         except os.error:
00012             pass
00013         try:
00014             os.rename(file, self.__backup)
00015         except os.error:
00016             self.__backup = None
00017         self.__file = _orig_open(file, mode, bufsize)
00018         self.closed = self.__file.closed
00019         self.fileno = self.__file.fileno
00020         self.flush = self.__file.flush
00021         self.isatty = self.__file.isatty
00022         self.mode = self.__file.mode
00023         self.name = self.__file.name
00024         self.read = self.__file.read
00025         try:
00026             self.readinto = self.__file.readinto
00027         except AttributeError:
00028             pass
00029         self.readline = self.__file.readline
00030         self.readlines = self.__file.readlines
00031         self.seek = self.__file.seek
00032         self.tell = self.__file.tell
00033         self.truncate = self.__file.truncate
00034         self.write = self.__file.write
00035         self.writelines = self.__file.writelines

Here is the caller graph for this function:


Member Function Documentation

def bkfile._BkFile.close (   self)

Definition at line 36 of file bkfile.py.

00036 
00037     def close(self):
00038         self.__file.close()
00039         if self.__backup is None:
00040             return
00041         import filecmp
00042         if filecmp.cmp(self.__backup, self.__filename, shallow = 0):
00043             import os
00044             os.unlink(self.__filename)
00045             os.rename(self.__backup, self.__filename)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 7 of file bkfile.py.

Definition at line 16 of file bkfile.py.

Definition at line 6 of file bkfile.py.

Definition at line 17 of file bkfile.py.

Definition at line 18 of file bkfile.py.

Definition at line 19 of file bkfile.py.

Definition at line 20 of file bkfile.py.

Definition at line 21 of file bkfile.py.

Definition at line 22 of file bkfile.py.

Definition at line 23 of file bkfile.py.

Definition at line 25 of file bkfile.py.

Definition at line 28 of file bkfile.py.

Definition at line 29 of file bkfile.py.

Definition at line 30 of file bkfile.py.

Definition at line 31 of file bkfile.py.

Definition at line 32 of file bkfile.py.

Definition at line 33 of file bkfile.py.

Definition at line 34 of file bkfile.py.


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