HWRF  trunk@4391
Public Member Functions | Public Attributes | List of all members
produtil.prog.FileOpener Class Reference

This is part of the internal implementation of Runner, used to convert it to a produtil.pipeline.Pipeline for execution. More...

Detailed Description

This is part of the internal implementation of Runner, used to convert it to a produtil.pipeline.Pipeline for execution.

It represents stdin, stdout or stderr being connected to an open file. It instructs the Runner to open the file before starting the process.

Definition at line 134 of file prog.py.

Inheritance diagram for produtil.prog.FileOpener:
produtil.prog.StreamGenerator

Public Member Functions

def __init__
 FileOpener constructor. More...
 
def copy (self)
 Creates a shallow copy of this object. More...
 
def to_shell (self)
 Creates a POSIX sh representation of the part of the command that requests redirection. More...
 
def intmode (self)
 Returns an integer version of mode suitable for os.open.
 
def __repr__ (self)
 Returns a string representation of this object as valid Python code. More...
 
def repr_for_in (self)
 Part of the implementation of Runner.__repr__, this returns the filename and ",string=False". More...
 
def repr_for_out (self)
 Part of the implementation of Runner.__repr__, this returns the filename and ",string=False". More...
 
def repr_for_err (self)
 Same as repr_for_out. More...
 
- Public Member Functions inherited from produtil.prog.StreamGenerator
def for_input (self)
 Has no effect. More...
 
def for_output (self)
 Has no effect. More...
 
def repr_for_err (self)
 Returns the stderr value. More...
 

Public Attributes

 filename
 the name of the file being opened
 
 mode
 how the file is being opened
 
 err
 If True, this is for stderr. More...
 

Constructor & Destructor Documentation

def produtil.prog.FileOpener.__init__ (   self,
  filename,
  mode,
  err = False 
)

FileOpener constructor.

Parameters
filenamethe name of the file being opened
modehow it is being opened
errif True, this is for stderr

Definition at line 140 of file prog.py.

Member Function Documentation

def produtil.prog.FileOpener.__repr__ (   self)

Returns a string representation of this object as valid Python code.

Definition at line 188 of file prog.py.

Referenced by produtil.prog.Runner.__str__().

def produtil.prog.FileOpener.copy (   self)

Creates a shallow copy of this object.

Definition at line 157 of file prog.py.

Referenced by produtil.prog.ImmutableRunner.runner().

def produtil.prog.FileOpener.repr_for_err (   self)

Same as repr_for_out.

Definition at line 201 of file prog.py.

def produtil.prog.FileOpener.repr_for_in (   self)

Part of the implementation of Runner.__repr__, this returns the filename and ",string=False".

Definition at line 192 of file prog.py.

def produtil.prog.FileOpener.repr_for_out (   self)

Part of the implementation of Runner.__repr__, this returns the filename and ",string=False".

It also appends ",append=X" where X is the true/false flag for appending to the file.

Definition at line 196 of file prog.py.

Referenced by produtil.prog.StreamGenerator.repr_for_err(), and produtil.prog.FileOpener.repr_for_err().

def produtil.prog.FileOpener.to_shell (   self)

Creates a POSIX sh representation of the part of the command that requests redirection.

Definition at line 160 of file prog.py.

Member Data Documentation

produtil.prog.FileOpener.err

If True, this is for stderr.

Definition at line 147 of file prog.py.

Referenced by produtil.prog.Runner.__init__(), produtil.prog.FileOpener.copy(), and produtil.prog.FileOpener.to_shell().


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