Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
TextRepr Class Reference
Inheritance diagram for TextRepr:
Repr

Public Member Functions

def __init__
 
def repr1
 
def repr_string
 
def repr_instance
 
- Public Member Functions inherited from Repr
def __init__
 
def repr
 
def repr1
 
def repr_tuple
 
def repr_list
 
def repr_dict
 
def repr_str
 
def repr_long
 
def repr_instance
 

Data Fields

 maxlist
 
 maxtuple
 
 maxdict
 
 maxstring
 
 maxother
 
- Data Fields inherited from Repr
 maxlevel
 
 maxtuple
 
 maxlist
 
 maxdict
 
 maxstring
 
 maxlong
 
 maxother
 

Static Public Attributes

 repr_str = repr_string
 

Detailed Description

Class for safely making a text representation of a Python object.

Definition at line 842 of file pydoc.py.

Constructor & Destructor Documentation

def __init__ (   self)

Definition at line 844 of file pydoc.py.

845  def __init__(self):
846  Repr.__init__(self)
847  self.maxlist = self.maxtuple = 20
848  self.maxdict = 10
849  self.maxstring = self.maxother = 100

Member Function Documentation

def repr1 (   self,
  x,
  level 
)

Definition at line 850 of file pydoc.py.

References pydoc.cram(), dospath.join(), HTMLRepr.maxother, TextRepr.maxother, dospath.split(), and pydoc.stripid().

851  def repr1(self, x, level):
852  methodname = 'repr_' + join(split(type(x).__name__), '_')
853  if hasattr(self, methodname):
854  return getattr(self, methodname)(x, level)
855  else:
856  return cram(stripid(repr(x)), self.maxother)
def repr_instance (   self,
  x,
  level 
)

Definition at line 868 of file pydoc.py.

References pydoc.cram(), HTMLRepr.maxstring, TextRepr.maxstring, and pydoc.stripid().

869  def repr_instance(self, x, level):
870  try:
871  return cram(stripid(repr(x)), self.maxstring)
872  except:
873  return '<%s instance>' % x.__class__.__name__
def repr_string (   self,
  x,
  level 
)

Definition at line 857 of file pydoc.py.

References pydoc.cram(), HTMLRepr.maxstring, TextRepr.maxstring, and pydoc.replace().

858  def repr_string(self, x, level):
859  test = cram(x, self.maxstring)
860  testrepr = repr(test)
861  if '\\' in test and '\\' not in replace(testrepr, r'\\', ''):
862  # Backslashes are only literal in the string and are never
863  # needed to make any special characters, so show a raw string.
864  return 'r' + testrepr[0] + test + testrepr[0]
865  return testrepr

Field Documentation

maxdict

Definition at line 847 of file pydoc.py.

maxlist

Definition at line 846 of file pydoc.py.

maxother

Definition at line 848 of file pydoc.py.

maxstring

Definition at line 848 of file pydoc.py.

maxtuple

Definition at line 846 of file pydoc.py.

repr_str = repr_string
static

Definition at line 866 of file pydoc.py.


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