Package yagdoc :: Module common
[show private | hide private]
[frames | no frames]

Module yagdoc.common

Miscellaneous utilities, possibly will be merged into other modules.
Classes
FileTimes  

Exceptions
DataError A recoverable error in input data.

Function Summary
  form_soup(tokens, start, end)
Return the token soup corresponding to a postion or range.
  form_text(tokens, start, end)
Return the joined text corresponding to a range of tokens.
  indexable(whatever)
Returns something dict.fromkeys() or set() can be applied to.
  run_as_main(func)
Auxiliary method to run a function on all file arguments.
  section_symbol(name)
Form symbol name used as declarations key for section documentation.
  update_file(filename, text, backupext)
Update and backup a file if the new contents differs from the current.
  _join_tokens(tokens)
Join the text of a sequence of tokens.

Function Details

form_soup(tokens, start=0, end=None)

Return the token soup corresponding to a postion or range.

Arguments start and end are token positions, in slice notation. If start is not given, it defaults to zero. If end is not given, it defaults to len(tokens).

form_text(tokens, start=0, end=None)

Return the joined text corresponding to a range of tokens.

Arguments start and end are token positions, in slice notation. If start is not given, it defaults to zero. If end is not given, it defaults to len(tokens).

indexable(whatever)

Returns something dict.fromkeys() or set() can be applied to.

run_as_main(func)

Auxiliary method to run a function on all file arguments.

Will probably go away.

section_symbol(name)

Form symbol name used as declarations key for section documentation.
Parameters:
name - Section name.
           (type=str)

update_file(filename, text, backupext='~')

Update and backup a file if the new contents differs from the current.

Empty files are not backed up though.
Parameters:
filename - Name of the file to write.
           (type=string)
text - New contents.
           (type=string)
backupext - Backup extension to use. Normally does not needs to be specified.
           (type=string)

_join_tokens(tokens)

Join the text of a sequence of tokens.

Where they do not touch, a single space is inserted between them. This condition currently only actually works on original tokens, the touching is not properly detected after a transform.

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