Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
All Data Structures Namespaces Files Functions Variables
PrettyPrinter Class Reference

Public Member Functions

def __init__
 
def pprint
 
def pformat
 
def isrecursive
 
def isreadable
 

Detailed Description

Definition at line 77 of file pprint.py.

Constructor & Destructor Documentation

def __init__ (   self,
  indent = 1,
  width = 80,
  depth = None,
  stream = None 
)
Handle pretty printing operations onto a stream using a set of
configured parameters.

indent
    Number of spaces to indent for each level of nesting.

width
    Attempted maximum number of columns in the output.

depth
    The maximum depth to print out nested structures.

stream
    The desired output stream.  If omitted (or false), the standard
    output stream available at construction will be used.

Definition at line 78 of file pprint.py.

References PrettyPrinter.__depth, PrettyPrinter.__indent_per_level, PrettyPrinter.__stream, and PrettyPrinter.__width.

78 
79  def __init__(self, indent=1, width=80, depth=None, stream=None):
80  """Handle pretty printing operations onto a stream using a set of
81  configured parameters.
82 
83  indent
84  Number of spaces to indent for each level of nesting.
85 
86  width
87  Attempted maximum number of columns in the output.
88 
89  depth
90  The maximum depth to print out nested structures.
91 
92  stream
93  The desired output stream. If omitted (or false), the standard
94  output stream available at construction will be used.
95 
96  """
97  indent = int(indent)
98  width = int(width)
99  assert indent >= 0
100  assert depth is None or depth > 0, "depth must be > 0"
101  assert width
102  self.__depth = depth
103  self.__indent_per_level = indent
104  self.__width = width
105  if stream:
106  self.__stream = stream
107  else:
108  self.__stream = sys.stdout

Member Function Documentation

def isreadable (   self,
  object 
)
def isrecursive (   self,
  object 
)

Definition at line 117 of file pprint.py.

References PrettyPrinter.__recursive, and PrettyPrinter.__repr().

118  def isrecursive(self, object):
119  self.__recursive = 0
120  self.__repr(object, {}, 0)
121  return self.__recursive
def pformat (   self,
  object 
)

Definition at line 112 of file pprint.py.

References PrettyPrinter.__format().

113  def pformat(self, object):
114  sio = StringIO()
115  self.__format(object, sio, 0, 0, {}, 0)
116  return sio.getvalue()
def pprint (   self,
  object 
)

Definition at line 109 of file pprint.py.

References PrettyPrinter.pformat().

110  def pprint(self, object):
111  self.__stream.write(self.pformat(object) + "\n")

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