Package yagdoc :: Module sectionizer :: Class Rule
[show private | hide private]
[frames | no frames]

Type Rule

object --+
         |
        Rule


Signle sectionizer rule.
Method Summary
  __init__(self, filename, symbol, section_template)
Create a new sectionizing Rule.
  __str__(self)
str expand(self)
Expand references in section name.
bool match(self, filename, symbol)
Attempt symbol and file name match.
  _expand_one(self, m)
  _rectify_pattern(klass, pattern)
(Class method)
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Instance Variable Summary
re match object file_match: The result of last file name matching, None if it did not match
compiled re object filename: Regular expression matching file names.
str section: Target section name (possibly with references to filename and symbol).
compiled re object symbol: Regular expression matching symbol names.
re match object symbol_match: The result of last symbol name matching, None if it did not match

Class Variable Summary
list __slots__ = ['filename', 'symbol', 'section', 'file_matc...
SRE_Pattern _expansion = <(file|symbol)(:\w*|)>
frozenset _metachars = frozenset(['$', ')', '(', '+', '*', ']', '....

Instance Method Details

__init__(self, filename='', symbol='', section_template='')
(Constructor)

Create a new sectionizing Rule.

File and symbol name patterns are regular expressions. However, if they contain no metacharacters, they match only on equal strings, i.e. substring match is not performed. Should you even want a substring match, there are many ways to express it using metacharacters (e.g. (substring)). If either pattern is unspecified or evaluates to False, the default r'.*' is substituted.
Parameters:
filename - File name pattern.
           (type=str)
symbol - Symbol name pattern.
           (type=str)
section_template - Section name template. References to file and section matches have the form <file:group> and <symbol:group>, where group is the group name or index (it can be omitted, including the colon, if the full match is to be substituted). If evaluates to False, the default '<file>' is used.
           (type=str)
Overrides:
__builtin__.object.__init__

expand(self)

Expand references in section name.

Can be called only after a successful match.
Returns:
section with references to file and symbol names matches expanded.
           (type=str)

match(self, filename, symbol)

Attempt symbol and file name match.
Parameters:
filename - File name to match.
           (type=str)
symbol - Symbol name to match.
           (type=str)
Returns:
True if rule matched.
           (type=bool)

Instance Variable Details

file_match

The result of last file name matching, None if it did not match
Type:
re match object
Value:
<member 'file_match' of 'Rule' objects>                                

filename

Regular expression matching file names.
Type:
compiled re object
Value:
<member 'filename' of 'Rule' objects>                                  

section

Target section name (possibly with references to filename and symbol).
Type:
str
Value:
<member 'section' of 'Rule' objects>                                   

symbol

Regular expression matching symbol names.
Type:
compiled re object
Value:
<member 'symbol' of 'Rule' objects>                                    

symbol_match

The result of last symbol name matching, None if it did not match
Type:
re match object
Value:
<member 'symbol_match' of 'Rule' objects>                              

Class Variable Details

__slots__

Type:
list
Value:
['filename', 'symbol', 'section', 'file_match', 'symbol_match']        

_expansion

Type:
SRE_Pattern
Value:
<(file|symbol)(:\w*|)>                                                 

_metachars

Type:
frozenset
Value:
frozenset(['$', ')', '(', '+', '*', ']', '.', '\\', '[', '^', '}', '{'\
, '?', '|'])                                                           

Generated by Epydoc 2.1 on Fri Oct 5 00:36:53 2007 http://epydoc.sf.net