CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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__
 
def __exit__
 
def __init__
 
def __nonzero__
 
def wouldbevalid
 

Public Attributes

 bool
 
 f
 
 fd
 
 filename
 
 pwd
 

Private Member Functions

def __open
 

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

Definition at line 89 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.bool, hippyaddtobaddatafiles.cd(), hippyaddtobaddatafiles.KeepWhileOpenFile.f, hippyaddtobaddatafiles.KeepWhileOpenFile.fd, hippyaddtobaddatafiles.KeepWhileOpenFile.filename, dataset.DataFile.filename, and hippyaddtobaddatafiles.KeepWhileOpenFile.pwd.

89 
90  def __exit__(self, *args):
91  if self:
92  try:
93  with cd(self.pwd):
94  os.remove(self.filename)
95  except OSError:
96  pass #ignore it
97  self.fd = self.f = None
98  self.bool = False
def hippyaddtobaddatafiles.KeepWhileOpenFile.__nonzero__ (   self)

Definition at line 99 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.bool.

Referenced by Types.int32.__bool__(), Types.uint32.__bool__(), Types.bool.__bool__(), and Types.string.__bool__().

99 
100  def __nonzero__(self):
101  return self.bool
def hippyaddtobaddatafiles.KeepWhileOpenFile.__open (   self)
private

Definition at line 65 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.fd, hippyaddtobaddatafiles.KeepWhileOpenFile.filename, and dataset.DataFile.filename.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__().

65 
66  def __open(self):
67  self.fd = os.open(self.filename, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
def hippyaddtobaddatafiles.KeepWhileOpenFile.wouldbevalid (   self)

Definition at line 60 of file hippyaddtobaddatafiles.py.

References hippyaddtobaddatafiles.KeepWhileOpenFile.bool.

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

Member Data Documentation

hippyaddtobaddatafiles.KeepWhileOpenFile.__message
private

Definition at line 54 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__().

hippyaddtobaddatafiles.KeepWhileOpenFile.bool

Definition at line 57 of file hippyaddtobaddatafiles.py.

Referenced by runEdmFileComparison.EdmObject.__bool__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__nonzero__(), and hippyaddtobaddatafiles.KeepWhileOpenFile.wouldbevalid().

hippyaddtobaddatafiles.KeepWhileOpenFile.f

Definition at line 56 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), svgfig.Curve.__repr__(), svgfig.Ticks.__repr__(), svgfig.CurveAxis.__repr__(), ztail.Decoder.initial_synchronize(), svgfig.Ticks.orient_tickmark(), svgfig.Curve.Path(), svgfig.Curve.sample(), svgfig.Curve.subsample(), and svgfig.LineAxis.SVG().

hippyaddtobaddatafiles.KeepWhileOpenFile.fd

Definition at line 56 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__open(), and progressbar.ProgressBar._handle_resize().

hippyaddtobaddatafiles.KeepWhileOpenFile.filename

Definition at line 53 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__(), hippyaddtobaddatafiles.KeepWhileOpenFile.__open(), python.rootplot.rootmath.Target.__repr__(), and utils.unpickler.run().

hippyaddtobaddatafiles.KeepWhileOpenFile.pwd

Definition at line 55 of file hippyaddtobaddatafiles.py.

Referenced by hippyaddtobaddatafiles.KeepWhileOpenFile.__enter__(), and hippyaddtobaddatafiles.KeepWhileOpenFile.__exit__().