CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
hippyaddtobaddatafiles.KeepWhileOpenFile Class Reference
Inheritance diagram for hippyaddtobaddatafiles.KeepWhileOpenFile:
hippyaddtobaddatafiles.OneAtATime

Public Member Functions

def __enter__ (self)
 
def __exit__ (self, args)
 
def __init__ (self, name, message=None)
 
def __nonzero__ (self)
 
def wouldbevalid (self)
 

Public Attributes

 bool
 
 f
 
 fd
 
 filename
 
 pwd
 

Private Member Functions

def __open (self)
 

Private Attributes

 __message
 

Detailed Description

Definition at line 51 of file hippyaddtobaddatafiles.py.

Constructor & Destructor Documentation

def hippyaddtobaddatafiles.KeepWhileOpenFile.__init__ (   self,
  name,
  message = None 
)

Member Function Documentation

def hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__ (   self)

Definition at line 68 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.__message, hippyaddtobaddatafiles.KeepWhileOpenFile.__open(), hippyaddtobaddatafiles.KeepWhileOpenFile.bool, hippyaddtobaddatafiles.cd(), hippyaddtobaddatafiles.KeepWhileOpenFile.f, hippyaddtobaddatafiles.KeepWhileOpenFile.fd, and hippyaddtobaddatafiles.KeepWhileOpenFile.pwd.

68  def __enter__(self):
69  with cd(self.pwd):
70  try:
71  self.__open()
72  except OSError:
73  return None
74 
75  self.f = os.fdopen(self.fd, 'w')
76 
77  try:
78  if self.__message is not None:
79  self.f.write(self.__message+"\n")
80  except IOError:
81  pass
82  try:
83  self.f.close()
84  except IOError:
85  pass
86  self.bool = True
87  return True
88 
def hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__ (   self,
  args 
)
def hippyaddtobaddatafiles.KeepWhileOpenFile.__nonzero__ (   self)
def hippyaddtobaddatafiles.KeepWhileOpenFile.__open (   self)
private
def hippyaddtobaddatafiles.KeepWhileOpenFile.wouldbevalid (   self)

Definition at line 60 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.bool.

60  def wouldbevalid(self):
61  if self: return True
62  with self:
63  return bool(self)
64 

Member Data Documentation

hippyaddtobaddatafiles.KeepWhileOpenFile.__message
private
hippyaddtobaddatafiles.KeepWhileOpenFile.bool
hippyaddtobaddatafiles.KeepWhileOpenFile.f
hippyaddtobaddatafiles.KeepWhileOpenFile.fd
hippyaddtobaddatafiles.KeepWhileOpenFile.filename
hippyaddtobaddatafiles.KeepWhileOpenFile.pwd