Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
site._Printer Class Reference
Inheritance diagram for site._Printer:
Inheritance graph
[legend]
Collaboration diagram for site._Printer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def __call__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

int MAXLINES = 23

Private Member Functions

def __setup

Private Attributes

 __name
 __data
 __files
 __dirs
 __lines
 __linecnt

Detailed Description

interactive prompt objects for printing the license text, a list of
contributors and the copyright notice.

Definition at line 367 of file site.py.


Constructor & Destructor Documentation

def site._Printer.__init__ (   self,
  name,
  data,
  files = (),
  dirs = () 
)

Definition at line 373 of file site.py.

00373 
00374     def __init__(self, name, data, files=(), dirs=()):
00375         self.__name = name
00376         self.__data = data
00377         self.__files = files
00378         self.__dirs = dirs
00379         self.__lines = None

Here is the caller graph for this function:


Member Function Documentation

def site._Printer.__call__ (   self)

Definition at line 408 of file site.py.

00408 
00409     def __call__(self):
00410         self.__setup()
00411         prompt = 'Hit Return for more, or q (and Return) to quit: '
00412         lineno = 0
00413         while 1:
00414             try:
00415                 for i in range(lineno, lineno + self.MAXLINES):
00416                     print(self.__lines[i])
00417             except IndexError:
00418                 break
00419             else:
00420                 lineno += self.MAXLINES
00421                 key = None
00422                 while key is None:
00423                     key = input(prompt)
00424                     if key not in ('', 'q'):
00425                         key = None
00426                 if key == 'q':
00427                     break

Here is the call graph for this function:

def site._Printer.__repr__ (   self)

Definition at line 401 of file site.py.

00401 
00402     def __repr__(self):
00403         self.__setup()
00404         if len(self.__lines) <= self.MAXLINES:
00405             return "\n".join(self.__lines)
00406         else:
00407             return "Type %s() to see the full %s text" % ((self.__name,)*2)

Here is the call graph for this function:

def site._Printer.__setup (   self) [private]

Definition at line 380 of file site.py.

00380 
00381     def __setup(self):
00382         if self.__lines:
00383             return
00384         data = None
00385         for dir in self.__dirs:
00386             for filename in self.__files:
00387                 filename = os.path.join(dir, filename)
00388                 try:
00389                     fp = open(filename, "rU")
00390                     data = fp.read()
00391                     fp.close()
00392                     break
00393                 except IOError:
00394                     pass
00395             if data:
00396                 break
00397         if not data:
00398             data = self.__data
00399         self.__lines = data.split('\n')
00400         self.__linecnt = len(self.__lines)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 375 of file site.py.

Definition at line 377 of file site.py.

Definition at line 376 of file site.py.

Definition at line 399 of file site.py.

Definition at line 378 of file site.py.

Definition at line 374 of file site.py.

int site._Printer.MAXLINES = 23 [static]

Definition at line 371 of file site.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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