Package ms (source)

Module ms.concurrency (source)

Utilities for threads, processes et al.

Classes

class Popen(Popen): 1

ended(self): 2

Returns True if the process ended, False otherwise.

killprocess(self, signal=15): 3

Functions

locked(func): 4

delayed(delay): 5

Factory of decorators converting functions into delayed functions. Delayed functions return the thread they are running in. The function result is stored in the thread .result attribute, which springs to life only at the end of the computation. The delayed functions have independent dictionaries.

nonblocking(not_avail=<function <lambda> at 0xb7cac33c>): 6

Factory of decorators converting functions into single-threaded functions. Single-threaded means that, at any given time, there can be at most ONE active thread. A single-threaded function returns a message - by default "Not Available" - while the original function has not yet returned; then, it returns the result of the computation.

Example:

>>> import time    
>>> @nonblocking(lambda f: "Please wait ...")
... def read_data():
...     time.sleep(3)
...     return "Done"
>>> print "0", read_data()
0 Please wait ...
>>> time.sleep(1)  
>>> print "1", read_data()
1 Please wait ...
>>> time.sleep(1)
>>> print "2", read_data()
2 Please wait ...
>>> time.sleep(1)
>>> print "3", read_data()
3 Done

killprocess: already documented

Module ms.debug_utils (source)

Classes

class LogFile(file): 7

Open a file for append.

reset(self): 8

Erase the log file.

display(self, *ls): 9

Use 'less' to display the log file in a separate xterm.

Functions

prettydict(dic, indent=''): 10

Utility to pretty print nested dictionaries.

check_if_we_are_overriding_names_in(cls): 11

Prints a message if we are overriding a name in cls. Useful for beginners that don't know by heart all Zope attribute.

objcontent(obj, all=True): 12

classify_attrs(obj): 13

Useless, always AcquirerWrapper.

MRO(cls): 14

get_type(obj): 15

Useless, always AcquirerWrapper.

print_shelve(name): 16

printerr(msg): 17

attributes(obj, *args): 18

Returns the attributes of obj as a list, removing trivial ones.

Module ms.decorator (source)

Classes

class decorator(object): 19

General purpose decorator factory: takes a caller function as input and returns a decorator. A caller function is any function like this:

def caller(func, *args, **kw):
    # do something
    return func(*args, **kw)

Here is an example of usage:

>>> @decorator
... def chatty(f, *args, **kw):
...     print "Calling %r" % f.__name__
...     return f(*args, **kw)
>>> @chatty
... def f(): pass
...
>>> f()
Calling 'f'

__call__(self, func): 20

__init__(self, caller): 21

Functions

getinfo(func): 22

Return an info dictionary containing: - name (the name of the function : str) - argnames (the names of the arguments : list) - defarg (the values of the default arguments : list) - fullsign (the full signature : str) - shortsign (the short signature : str) - arg0 ... argn (shortcuts for the names of the arguments)

>>> def f(self, x=1, y=2): pass
>>> info = getinfo(f)
>>> info["name"]
'f'
>>> info["argnames"]
['self', 'x', 'y']
>>> info["defarg"]
(1, 2)
>>> info["shortsign"]
'self, x, y'
>>> info["fullsign"]
'self, x = defarg[0], y = defarg[1]'
>>> info["arg0"], info["arg1"], info["arg2"]
('self', 'x', 'y')

copyfunc(func): 23

Creates an independent copy of a function.

_signature_gen(func, short=False): 24

Given a function, returns its full signature and its short signature. For instance,

>>> def f(x, y=1, z=2, *args, **kw): pass
>>> list(_signature_gen(f))
['x', 'y = defarg[0]', 'z = defarg[1]', '*args', '**kw']
>>> list(_signature_gen(f, short=True))
['x', 'y', 'z', '*args', '**kw']

_decorate(func, caller): 25

Takes a function and a caller and returns the function decorated with that caller. The decorated function is obtained by evaluating a lambda function with the correct signature.

Module ms.doct24 (source)

Run doctest on text files. Example of usage:

$ doct doc1.txt -v doc2.txt doc3.txt

This runs the tests in doc1.txt and doc3.txt in silent mode and the tests in doc2.txt in verbose mode.

Functions

runtest(testrunner, fname, txt): 26

main(args=['ms', '-Hia']): 27

extractscript(txt): 28

runsuite(testrunner, fname, doc): 29

Converts doctests to unittests.

doct(run, testrunner, fname='', txt=''): 30

Module ms.exc_debugger (source)

Put me in your Python path and import me with "import exc_debugger". If your script ever raises an uncaught exception, I will automagically start the debugger. You will love me;)

Functions

info(type, value, tb): 31

Module ms.exper_utils (source)

Metaclasses

metaclass Singleton(supertype): 32

__call__(cls, *args, **kw): 33

__init__(cls, name, bases, dic): 34

metaclass Memoize(supertype): 35

Module ms.file_utils (source)

Utilities to manage files, pathnames, walking through directories, etc.

Classes

class ConfigObj(object): 36

keys(self): 37

items(self): 38

values(self): 39

__init__(self, config_str_or_file): 40

class lockedfile(file): 41

A locked file can be accessed by many readers but only by a single writer. By default, it works by blocking; however, if the blocking flag is set to False, an IOError is raised if two write actions are attempted at the same time.

close(self): 42

__init__(self, name, mode='r', blocking=True, buffering=0): 43

Functions

_do(action, factory, name, mode, *args, **kw): 44

Internally used by reader and writer.

get_image_fnames(dir): 45

Returns the absolute path of image files.

endswith(fname, *exts): 46

writer(action, factory, name, *args, **kw): 47

Examples: writer(save_data, file, "f.txt")

writer: already documented

ifiles(root, cond=<function <lambda> at 0xb7c0e1b4>, abs_path=True): 48

Returns an iterator over the files contained into the dir tree; if abs_path is true returns the absolute pathnames, else the relative pathnames. It is possible to pass a filter function selecting on the absolute pathname.

getparentdir(fname, level=1): 49

Given a file name, returns the absolute path of its parent directory. If level = 2, returns the grand-parent directory. If level = 3, returns the grand-grand-parent directory, and so on. If level = 0, returns the absolute pathname of the original file.

reader(action, factory, name, *args, **kw): 50

Example: reader(read_data, file, "f.txt")

getabspath(name): 51

Search for name in the Python path and returns the full pathname. Works for pure source filenames .py, not for packages or for .pyc.

extension(fname): 52

Returns the extension of a filename or the empty string.

idirs(root, cond=<function <lambda> at 0xb7c0e224>, abs_path=True): 53

Returns an iterator over the subdirectories contained into the dir tree; if abs_path is true returns the absolute pathnames. It is possible to pass a filter function selecting on the absolute pathname.

Module ms.hier_utils (source)

Parses hierarchical expressions written in XML or in a custom format.

Classes

class Folder(object): 54

A Folder is a named container of named objects which are also accessible as attributes. It is possible to pass un-named objects to the constructor; they are collected into a data list. Here is an example:

>>> h = Folder("top",
...           Folder("id", "0023"),
...           Folder("Europe",
...                 "France",
...                 "Italy"))
...             
>>> h.Europe._data
['France', 'Italy']

Notice: folders can be repeated and

Folder("top", Folder("user", "michele"), Folder("user", "roberto"))

is just a more verbose (XML-like) version of

Folder("top", Folder("user", "michele", "roberto"))

__getitem__(self, i): 55

get(self, i=0): 56

__str__(self): 57

__setitem__(self, i, v): 58

getdata(self): 59

getnames(self): 60

append(self, arg): 61

__delitem__(self, i): 62

__iter__(self): 63

__init__(self, name, *args): 64

class XML2CodeParser(object): 65

Takes an XML string and returns a hierarchical Python expression with the same content.

attr2folder(self, attr): 66

EndElementHandler(self, tagname): 67

output(self): 68

StartElementHandler(self, tagname, attr): 69

__init__(self, clsname, encoding='ISO-8859-1'): 70

CharacterDataHandler(self, value): 71

Functions

walk(folder, ancestors=None): 72

Walks in the folder; returns subfolders with their ancestors.

indented_tree(obj, indent='   ', to_str=<function <lambda> at 0xb7c0ee9c>): 73

Works for generic (possibly iterable) named objects.

process(source, HL): 74

Generates Python source reading char-by-char.

Module ms.html_utils (source)

Classes

class htmlpage(object): 75

Decorator factory. Any instance of htmlpage is a decorator converting thunks into web pages, i.e. HTML-valued thunks. Those decorators can also be used directly as html converters, thanks to their 'render' method:

>>> text2html = htmlpage(title="example").render
>>> print text2html("this is an example")
<html>
<head>
<meta  />
<style type="text/css">
</style>
<title>example</title>
</head>
<body>
this is an example
</body>
</html>

Functions decorated by htmlpage decorators will have a reference to the decorator:

>>> @htmlpage()
... def hello(): return "hello"
...
>>> print hello.htmlpage #doctest: +ELLIPSIS
<ms.html_utils.htmlpage object at 0x...>

In this way it is possible to change the page attributes, thus modifying the rendering on-the-fly. It is also possible to go back to the original function: >>> print hello.undecorated #doctest: +ELLIPSIS <function hello at 0x...>

render(self, arg, *args, **kw): 76

The argument can be: 1. a function to be called to get the body of the page; 2. an iterable to be joined to get the body of the page; 3. a text to be converted into unicode to get the body. This method adds the correct body attribute to self and returns the corresponding page. Already converted texts are returned unchanged.

__call__(self, func): 77

__init__(self, title='', css='', meta=''): 78

class TableList(list): 79

A table is a list of lists/tuple of the same length. A table has methods to display itself as plain text and as HTML.

to_text(self): 80

__str__(self): 81

to_html(self, header=False): 82

Generates an HTML table.

_gen_html(self): 83

Returns an HTML table as an iterator.

class template(object): 84

__call__(self, gen): 85

__init__(self): 86

class XMLTag(object): 87

__getattr__(self, name): 88

class XMLShortTag(object): 89

__getattr__(self, name): 90

Functions

testTable(): 91

kw2query(d): 92

Converts a keyword dictionary to a html query; for instance

>>> print kw2query(dict(id="a", title="An example"))
id='a'&title='An example'

dump(url): 93

Converts a HTML page in plain text using lynx.

show(html, id='x'): 94

tidy(html, option_str=''): 95

Returns the content of stdout and stderr. Use as in this example: ind_html, err_msg = tidy(html, '-i').

cgiform(entryform, exitform): 96

Display the entry and exit form templates. They must be valid cgi pages.

makelink(ln, txt=None): 97

activetext(): 98

xml_attr(dict_or_list_of_pairs): 99

query2kw(q): 100

Converts a html query into a keyword dictionary.

>>> print query2kw("id=a&title=An+example")
{'id': 'a', 'title': 'An example'}

simplepage(body, title='', css='', meta=''): 101

printpage(body, title='', css='', meta=''): 102

html_indent(html, fname='x.html'): 103

html_form(content): 104

converter(text): 105

unicode_converter(codecname): 106

getscriptname(): 107

Returns the name of the script.

Module ms.http_utils (source)

Client side utilities for dealing with the HTTP protocol. Based upon urllib and urllib2.

Classes

class ClientUploader(object): 108

Uploads one or more files by reading their content in memory and sending it to a remote uploader, located at some url and implemented as a multipart form with keys and filenames.

upload(self, key, filename, content): 109

Upload a single file.

upload_many(self, files): 110

files is a sequence of tuples of the form (key, filename, content).

__init__(self, uploader_url, verbose=False, username=None, password=None): 111

Functions

encode_multipart_formdata(fields, files): 112

Encodes fields and files for uploading. fields is a sequence of (name, value) elements for regular form fields - or a dictionary. files is a sequence of (name, filename, value) elements for data to be uploaded as files. Returns (content_type, body) ready for urllib2.Request instance. You can optionally pass in a boundary string to use or we'll let mimetools provide one.

urlopen(url, data=()): 113

urlopen(url,data=()) which can be used to retrieve cookie-enabled Web pages and to post Web forms. Data is a list, tuple or dictionary containing the parameters of the form.

Module ms.iter_utils (source)

General utilities involving iterables.

Classes

class EmptyIteratorError(Exception): 114

class PackedList(list): 115

Take a list with repetitions and pack it in the form

PackedList([elements ..]) --> [(number_of_repetitions, element) ...]

Gives a nice printing representation. Usage: PackedList(<list>, <string-repr-method> = str) It is possible to specify a custom string representation for the list elements.

__str__(self): 116

Returns a table <number of repetions>: <element>

__init__(self, ls, to_str=<type 'str'>): 117

pack(self, lst): 118

Recursive packer. At each call removes an element from ls and adds it to self.packedls. Returns when ls is fully depleted.

class Cycle(object): 119

__getitem__(self, i): 120

__iter__(self): 121

next(self): 122

__setitem__(self, i, v): 123

__len__(self): 124

__call__(self): 125

prev(self): 126

__init__(self, seq): 127

Functions

skip_redundant(iterable, skipset=None): 128

Redundant items are repeated items or items in the original skipset.

first_duplicate_ls(it): 129

Returns None or a list with the duplicated element.

check(it): 130

Checks if an iterator is empty. Returns a copy of the original iterator.

>>> it = check(iter([1]))
>>> if it: it.next()
1

chop(iterable, batchsize): 131

Chop an iterable. For instance

>>> list(chop([1,2,3,4], 2))
[[1, 2], [3, 4]]
>>> list(chop([1,2,3,4,5,6,7],3))
[[1, 2, 3], [4, 5, 6], [7]]

It trunks the remainder elements, if the iterable is not divisible by batchsize.

Module ms.lang_utils (source)

Metaclasses

metaclass MetaSuper(safetype): 132

__init__(cls, name, bases, dic): 133

metaclass MetaWrapper(safetype): 134

A factory of metaclasses wrapping methods trough a given decorator. It must be subclassed to be used. MetaWrappers make a copy of the functions they wrap and add a "__cls__" attribute, so they know the class they belong (in the sense were defined in). It is possible to pass a condition cond(name, func). It also works for methods added after the class definition. Example:

>>> @decorator
... def chatty(func, *args, **kw):
...    print "calling %s" % func.__name__
...    return func(*args, **kw)
>>> class C:
...    __metaclass__ = MetaWrapper.using(chatty)
...    def __init__(self):
...        pass
>>> C.f = lambda self : None
>>> c = C()
calling __init__
>>> c.f()
calling <lambda>

metaclass __metaclass__(type): 135

using(mcl, dec, cond=<function <lambda> at 0xb7cc0bfc>): 136

Returns a submetaclass associated to the given decorator.

__init__(cls, name, bases, dic): 137

__setattr__(cls, name, attr): 138

metaclass supertype(safetype): 139

MetaSuper: already documented

metaclass Memoize(safetype): 140

This is very complex, with respect to overriding __call__, but it has the advantages that it works even when the constructor is called with keyword arguments.

__init__(cls, name, bases, dic): 141

metaclass Singleton(safetype): 142

__call__(cls, *args, **kw): 143

__init__(cls, name, bases, dic): 144

Classes

class superobject(object): 145

MetaSuper: already documented

class Super(object): 146

__init__(self, cls): 147

__get__(self, obj, objtype): 148

class AttributeDescriptor(object): 149

Base descriptor class. You are supposed to override get_from_class and get_from_obj, to implement __set__ and __delete__ if needed, and not to touch __get__.

get_from_class(self, cls): 150

get_from_obj(self, obj): 151

__get__(self, obj, cls=None): 152

Functions

getattr_(obj, name, default): 153

Analogous to .setdefault in dictionaries.

_doctestAttributeDescriptor(): 154

>>> from ms.lang_utils import AttributeDescriptor as AD
>>> class C(object):
...     a = AD()
>>> C.a #doctest: +ELLIPSIS
Getting <ms.lang_utils.AttributeDescriptor object at ...> from <class '...C'>
>>> C().a #doctest: +ELLIPSIS
Getting <ms.lang_utils.AttributeDescriptor object at ...> from <...C object at ...>

compose(*decorators): 155

addmethod(meth, instance): 156

Add a method to a specific instance. Works by changing the class of the instance to a newly generated subclass of the original class.

>>> class C(object): pass
>>> c1 = C(); c2 = C()
>>> def __str__(self): return "works!"
>>> addmethod(__str__, c1)
>>> print c1
works!
>>> print c2 #doctest: +ELLIPSIS
<...C object at ...>

attrs(**kw): 157

Example of usage: >>> @attrs(creator="M.S.", date="2005-04-06") ... def f(): pass ...

Module ms.mail_utils (source)

Defines the utilities classes

Classes

class NullFile(object): 158

write(self, arg): 159

close(self): 160

class HTMLNotifier(object): 161

Use this class when you want to send emails to the different destinations from the same address. Usage: s = HTMLNotifier(fromaddr); s.sendmsg(toaddr, msg, subject)

make_msg(self, to_lst, txt, subj, date='', html_txt=''): 162

Internal method to generate a message from a text.

quit(self): 163

notify(self, toaddrs, txt, subject='<no subject>'): 164

notify: already documented

__init__(self, fromaddr, logfile=None, smtpserver='localhost', log_only=False, **kw): 165

HTMLNotifier: already documented

class SendingTo(object): 166

Use this class when you want to send emails to the same destination from different adresses. Useful for testing purposes (emulates different users). Usage: s = Send2(dest); s.send_from(fromaddr, msg)

NOTICE: if fromaddr starts with "test", the message will NOT be sent; instead it will be written in the log file "/tmp/x.log"

send_from(self, fromaddr, subject): 167

__init__(self, toaddr, smtpserver='localhost'): 168

class NullServer(object): 169

quit(self): 170

sendmail(self, *args): 171

__init__(self, *args): 172

HTMLNotifier: already documented

Module ms.minidoc (source)

minidoc: a minimal documentation utility.

Minidoc automatically extracts documentation from a Python module or package. The module/package has to be in the current PYTHONPATH. All the features are encoded in the Document class, which can be imported in other modules and fully exploited. Alternatively, minidoc can be used as a command line tool. Here is the usage:

usage: %prog modulename [options]
-H,--html: generate HTML
-t, --tex: generate LaTeX
-p, --pdf: generate PDF
-r, --rst: generate reST 
-l, --less: view reST with less
-n, --silent: silent mode (no output shown)
-i, --index: generate an index
-a, --all: documents more stuff

With no options minidoc prints the documentation in reST format on stdout.

A few examples:

Classes

class Document(object): 173

Creates the documentation from the docstrings of a metaobject (module or class or function). It works recursively and nicely indent the rst output.

description(self, obj): 174

Returns a correctly indented description of the given object.

footnoteindex(self): 175

Increments the footnote index and returns an rst link.

__str__(self): 176

Printing a Document() instance prints its reST documentation

makedoc(self, metaobjdic): 177

Creates the documentation in reST format, starting from a pre-built dictionary of metaobjects defined in the current module.

metaobjdic(self): 178

Returns a dictionary of lists of metaclasses, classes and functions.

__init__(self, metaobj, title='', indent='', makeindex=False): 179

Documents the metaobjects contained in metaobj. Calls makedoc.

class DocutilsWrite(object): 180

Creates writer objects generating output files using docutils.

write(self, format): 181

Save the documentation in rst, html, latex or pdf format

__init__(self, name, doc): 182

Functions

body(dotname): 183

example: body ("first.second.third")="first.second"

isprivate(obj): 184

Determine if a metaobject is private from the underscores in its name.

DSU(ls): 185

Sort the analytical index using the DSU idiom.

getdocfrom_module(m, makeindex): 186

tail(dotname): 187

example: tail("first.second.third")="second.third"

get_definition(obj): 188

main(): 189

Parse the command line arguments and do the right thing.

quote(s): 190

When implemented, should quote rst syntax. Seems difficult to do.

import_(name): 191

A custom import routine. Returns modules or packages. name is the name of the Python package/module (as opposed to its pathname).

getdocfrom_package(p, makeindex): 192

Generator returning the documentation for each module or subpackage in the package.

makeindex(footnotes): 193

Generate an index from the list of names.

getdocfrom_module_or_package(name, makeindex): 194

Given a module/package Python name, returns the documentation relative to it. If the module/package cannot be imported, prints an error message. Returns the empty string if there is not enough available documentation.

Module ms.misc_utils (source)

Classes

class kwdict(dict): 195

A typing shortcut used in place of a keyword dictionary. It also has two useful 'fromfile' and 'fromstring' constructors

__setattr__(self, name, value): 196

__getattr__(self, name): 197

class Dispatcher(object): 198

This is a non-instantiable base class.

metaclass __metaclass__(type): 199

Converts functions into static methods and keep a dictionary of them.

__init__(cls, name, bases, dic): 200

class DictWrapper(object): 201

__init__(self, **kw): 202

class NonInstantiableError(Exception): 203

class Chainmap(DictMixin): 204

Combine multiple mappings for sequential lookup. Raymond Hettinger, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305268

__getitem__(self, key): 205

__init__(self, *maps): 206

Functions

import_(mod_or_pkg_name): 207

An user-friendly version of _import___.

interp(text, repldic=None, safe_substitute=True): 208

merge(*dictionaries): 209

Merge from right (i.e. the rightmost dictionary has the precedence).

Module ms.noconflict (source)

Deep, DEEP magic to remove metaclass conflicts.

noconflict provides the safetype metaclass, the mother of conflict-free metaclasses. The suggested import syntax for usage in other modules is

from safetype import safetype as type

If you override __new__ when you derive from safetype, you should do it cooperatively.

Metaclasses

metaclass safetype(type): 210

Overrides the __new__ method of the type metaclass, making the generation of classes conflict-proof.

Functions

get_noconflict_metaclass(bases, left_metas, right_metas): 211

Not intended to be used outside of this module, unless you know what you are doing.

remove_redundant(metaclasses): 212

classmaker(left_metas=(), right_metas=()): 213

Module ms.optionparse (source)

A much simplified interface to optparse. You should use optionparse in your scripts as follow. First, write a module level docstring containing something like this:

'''usage: %prog files [options]
-d, --delete: delete all files -e, --erase = ERASE: erase the given file'''

Then write a main program of this kind:

# sketch of a script to delete files
if __name__=='__main__':
    from ms.optionparse import OptionParser, exit
    option, args = OptionParser(__doc__).parse_args()
    if not args and not option: exit()
    elif option.delete: print "Delete all files"
    elif option.erase: print "Delete the given file"

Notice that optionparse parses the docstring by looking at the characters ",", ":", "=", "n", so be careful in using them. If the docstring is not correctly formatted you will get a SyntaxError.

Classes

class ParsingError(Exception): 214

class OptionParser(object): 215

parse_args(self, arglist=None): 216

get_flags(self): 217

get_option_args(self): 218

__init__(self, docstring): 219

Functions

nonzero(self): 220

True if options were given

parse(docstring, arglist=None): 221

exit(msg=''): 222

Module ms.plot_utils (source)

Draws a MRO diagrams with dot.

Classes

class Visitor(object): 223

visit(self, subc, cls): 224

__init__(self): 225

Functions

hier2skel(cls): 226

cls2skel(cls): 227

dotcode(cls): 228

getmro(cls): 229

display_mro(cls): 230

Module ms.quixote_utils (source)

Metaclasses

metaclass RecognizeExports(type): 231

__setattr__(cls, name, value): 232

__init__(cls, name, bases, dic): 233

Classes

class RootDirectory(Directory): 234

RecognizeExports: already documented

_q_index(self): 235

publish_show(self, page='', browser='mozilla'): 236

publish(self): 237

set_default(self, server=<module 'quixote.server.simple_server' from '/usr/lib/python2.4/site-packages/quixote/server/simple_server.pyc'>, Publisher=<class quixote.publish.Publisher at 0xb7939f5c>, Session=<class quixote.session.Session at 0xb796c68c>, session_mapping=None, port=7080): 238

set_default: already documented

class private(object): 239

Redirect to the login page if the user is not logged in or if he does not have the right permissions.

__call__(self, method): 240

__init__(self, *groups_with_access): 241

class UnauthorizedError(AccessError): 242

The request requires user authentication.

This subclass of AccessError sends a 401 instead of a 403, hinting that the client should try again with authentication.

format(self): 243

__init__(self, realm='Protected', public_msg=None, private_msg=None): 244

class MultipageTable(object): 245

makerow(self, row, header=False): 246

render(self): 247

maketable(self): 248

__init__(self, body, header=[], maxsize=20): 249

class User(object): 250

__str__(self): 251

__init__(self, username, password): 252

permissions(self): 253

Returns the list of methods starting with 'can_'.

class old_private(object): 254

Redirect to the login page if the user is not logged in or if he does not have the right permissions.

__call__(self, method): 255

__init__(self, *groups_with_access): 256

Functions

old_public(f): 257

Append f.__name__ to the caller's _q_exports. If the caller has no _q_exports, creates it.

public(f): 258

Module ms.quixote_utils24 (source)

Example of usage:

from ms.quixote_utils24 import SimpleDirectory, Publish from quixote.server import twisted_server

class Root(SimpleDirectory):
def _q_index(self):
return "hello"

Publish(Root(), showpage="", server=twisted_server)

Metaclasses

metaclass AutoExport(type): 259

Attributes of instances of AutoExport with a "_q_exported" flag are automatically added to the class _q_exports list.

__init__(cls, name, bases, dic): 260

__setattr__(cls, name, value): 261

Classes

class Publish(object): 262

show(self): 263

publish(self): 264

make_publisher(self): 265

__init__(self, root, Publisher=<class quixote.publish.Publisher at 0xb7939f5c>, Session=<class quixote.session.Session at 0xb796c68c>, session_mapping=None, server=<module 'quixote.server.simple_server' from '/usr/lib/python2.4/site-packages/quixote/server/simple_server.pyc'>, showpage=None, browser='mozilla', host='', port=7080): 266

class UnauthorizedError(AccessError): 267

The request requires user authentication.

This subclass of AccessError sends a 401 instead of a 403, hinting that the client should try again with authentication.

format(self): 268

__init__(self, realm='Protected', public_msg=None, private_msg=None): 269

class SimpleDirectory(Directory): 270

AutoExport: already documented

_q_index(self): 271

class MultipageTable(object): 272

makerow(self, row, header=False): 273

render(self): 274

maketable(self): 275

__init__(self, body, header=[], maxsize=20): 276

class User(object): 277

__str__(self): 278

__init__(self, username=None, password=None): 279

permissions(self): 280

Returns the list of methods starting with 'can_'.

class WebDirectory(SimpleDirectory): 281

A simple directory plus a login form with a resume capability.

mainpage(self): 282

register(self): 283

mainpage: already documented

logout(root): 284

login(self, User=<class 'ms.quixote_utils24.User'>): 285

Subclassess are free to override the login form. This is an example of how to do it:

class MyWebDirectory(WebDirectory):

@public def login(self, User=MyUserClass):

System Message: ERROR/3 (/tmp/ms.rst, line 1957)

Unexpected indentation.
return super(MyWebDirectory, self).login(MyUserClass)

class private(object): 286

Redirect to the login page if the user is not logged in or if he does not have the right permissions.

__call__(self, method): 287

__init__(self, *groups_with_access): 288

Functions

un_pw_form(): 289

public(f): 290

Module ms.quixote_utils_exp (source)

A set of utilities to simplify your life with Quixote applications. We hide from the user the Publisher, SessionManager and Directory classes. We also hide the session mapping, using a persistent shelve by default. We expose instead a SessionObject (intended for subclassing) and Website class (that 99% of times you don't need to subclass). Website has a commodity method returning publisher factories. Publisher factories also know how to run the publisher and how to show the published web site on your local browser.

Moreover, we provide a few classes useful for UI building: htmlstream, FormPage, MultipageTable

Classes

class FormFactory(object): 291

Returns form-valued callable objects. Forms are computed from a configuration file or from a text. options separated by "|" are converted into a list.

__init__(self, form_config): 292

class private(object): 293

Redirect to the login page if the user is not logged in or if he does not have the right permissions. The link to the login page is given in the error message. By default, it points to 'login'.

__call__(self, page): 294

__init__(self, *groups_with_access, **kw): 295

class MultipageTable(object): 296

makerow(self, row, header=False): 297

render(self): 298

maketable(self): 299

__init__(self, body, header=[], maxsize=20): 300

class UnauthorizedError(AccessError): 301

The request requires user authentication.

This subclass of AccessError sends a 401 instead of a 403, hinting that the client should try again with authentication.

format(self): 302

__init__(self, realm='Protected', public_msg=None, private_msg=None): 303

class FormPage(object): 304

Base class for pages containing a form. Children should override one or more of entrypage, exitpage, errorpage, checker and possibly formfactory. If you override __init__, you must override it cooperatively. formfactory has to be a thunk returning a form.

checker(self): 305

Sets self.form.set_error. By default does nothing.

__call__(self): 306

__init__(self, name, formfactory=None, **attrs): 307

Sets __name__ and other attributes; determine the formfactory to use.

class Url(object): 308

newlink(self, page, text=None): 309

show(self): 310

Show the current page.

new(self, page): 311

Create a new URL for page.

__str__(self): 312

__init__(self, repository='repository.shelve'): 313

class User(object): 314

is_anonymous(self): 315

__str__(self): 316

__init__(self, username=None, password=None): 317

permissions(self): 318

Returns the list of methods starting with 'can_'.

class _ShelveSessionManager(SessionManager, object): 319

The user should not need to subclass this.

new_session(self, id): 320

Sets a default anonymous user.

__init__(self, session_class, dbfile): 321

commit_changes(self, session): 322

Synchronize the shelve database. Called at the end of every successful request.

class _PublisherFactory(object): 323

The user should not need to subclass this.

__call__(self): 324

run_show(self, host='localhost', port=7080, page='', browser='mozilla'): 325

Starts the simple server as well as a browser process on the local machine. This is a commodity method for development.

run_debug(self, host='localhost', port=7080): 326

Run the simple server on localhost in debug mode. This automatically adds a 'stop_server' page to the published Website.

__init__(self, site, logger, session_manager, config, **kw): 327

class Website(Directory): 328

Minimal example of usage: from ms.quixote_utils_exp import Website Website(_q_index=lambda : "hello!").publisher().run_show()

publisher(self, logger=None, session_class=<class 'ms.quixote_utils_exp.SessionObject'>, config=None, **kw): 329

add_attr(self, **attrs): 330

add(self, obj, attr_name=None): 331

Can also be used as a decorator.

__init__(self, *named_callables, **attrs): 332

class SessionObject(Session, object): 333

You may safely subclass it, or set the storage attribute.

_debug(self): 334

Returns the content of the current session. Useful for debugging.

__str__(self): 335

class htmlstream(htmlpage): 336

Factory of decorators converting generators into functions returning Quixote html streams. Example:

@htmlstream()
def longcomputation():
    yield "Begin .. </br>"
    # display progress of the computation
    yield "End."

Quixote streams work with most browsers (even elinks, but not lynx). BEWARE: exceptions raised in the generator will not be handled gracefully.

render_iter(self, html_iter): 337

render(self, gen, *args, **kw): 338

Functions

getname(obj): 339

Returns the name of the object or None.

un_pw_form(): 340

get_site(): 341

Returns the currently published site.

Module ms.subprocess (source)

subprocess - Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several other, older modules and functions, like:

os.system os.spawn* os.popen* popen2.* commands.*

Information about how the subprocess module can be used to replace these modules and functions can be found below.

Using the subprocess module

This module defines one class called Popen:

class Popen(args, bufsize=0, executable=None,
stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0):

Arguments are:

args should be a string, or a sequence of program arguments. The program to execute is normally the first item in the args sequence or string, but can be explicitly set by using the executable argument.

On UNIX, with shell=False (default): In this case, the Popen class uses os.execvp() to execute the child program. args should normally be a sequence. A string will be treated as a sequence with the string as the only item (the program to execute).

On UNIX, with shell=True: If args is a string, it specifies the command string to execute through the shell. If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional shell arguments.

On Windows: the Popen class uses CreateProcess() to execute the child program, which operates on strings. If args is a sequence, it will be converted to a string using the list2cmdline method. Please note that not all MS Windows applications interpret the command line the same way: The list2cmdline is designed for applications using the same rules as the MS C runtime.

bufsize, if given, has the same meaning as the corresponding argument to the built-in open() function: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size. A negative bufsize means to use the system default, which usually means fully buffered. The default value for bufsize is 0 (unbuffered).

stdin, stdout and stderr specify the executed programs' standard input, standard output and standard error file handles, respectively. Valid values are PIPE, an existing file descriptor (a positive integer), an existing file object, and None. PIPE indicates that a new pipe to the child should be created. With None, no redirection will occur; the child's file handles will be inherited from the parent. Additionally, stderr can be STDOUT, which indicates that the stderr data from the applications should be captured into the same file handle as for stdout.

If preexec_fn is set to a callable object, this object will be called in the child process just before the child is executed.

If close_fds is true, all file descriptors except 0, 1 and 2 will be closed before the child process is executed.

if shell is true, the specified command will be executed through the shell.

If cwd is not None, the current directory will be changed to cwd before the child is executed.

If env is not None, it defines the environment variables for the new process.

If universal_newlines is true, the file objects stdout and stderr are opened as a text files, but lines may be terminated by any of 'n', the Unix end-of-line convention, 'r', the Macintosh convention or 'rn', the Windows convention. All of these external representations are seen as 'n' by the Python program. Note: This feature is only available if Python is built with universal newline support (the default). Also, the newlines attribute of the file objects stdout, stdin and stderr are not updated by the communicate() method.

The startupinfo and creationflags, if given, will be passed to the underlying CreateProcess() function. They can specify things such as appearance of the main window and priority for the new process. (Windows only)

This module also defines two shortcut functions:

call(*args, **kwargs):

System Message: WARNING/2 (/tmp/ms.rst, line 2377); backlink

Inline emphasis start-string without end-string.

System Message: WARNING/2 (/tmp/ms.rst, line 2377); backlink

Inline strong start-string without end-string.

Run command with arguments. Wait for command to complete, then return the returncode attribute.

The arguments are the same as for the Popen constructor. Example:

retcode = call(["ls", "-l"])

Exceptions

Exceptions raised in the child process, before the new program has started to execute, will be re-raised in the parent. Additionally, the exception object will have one extra attribute called 'child_traceback', which is a string containing traceback information from the childs point of view.

The most common exception raised is OSError. This occurs, for example, when trying to execute a non-existent file. Applications should prepare for OSErrors.

A ValueError will be raised if Popen is called with invalid arguments.

Security

Unlike some other popen functions, this implementation will never call /bin/sh implicitly. This means that all characters, including shell metacharacters, can safely be passed to child processes.

Popen objects

Instances of the Popen class have the following methods:

poll()
Check if child process has terminated. Returns returncode attribute.
wait()
Wait for child process to terminate. Returns returncode attribute.
communicate(input=None)

Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional stdin argument should be a string to be sent to the child process, or None, if no data should be sent to the child.

communicate() returns a tuple (stdout, stderr).

Note: The data read is buffered in memory, so do not use this method if the data size is large or unlimited.

The following attributes are also available:

stdin
If the stdin argument is PIPE, this attribute is a file object that provides input to the child process. Otherwise, it is None.
stdout
If the stdout argument is PIPE, this attribute is a file object that provides output from the child process. Otherwise, it is None.
stderr
If the stderr argument is PIPE, this attribute is file object that provides error output from the child process. Otherwise, it is None.
pid
The process ID of the child process.
returncode
The child return code. A None value indicates that the process hasn't terminated yet. A negative value -N indicates that the child was terminated by signal N (UNIX only).

Replacing older functions with the subprocess module

In this section, "a ==> b" means that b can be used as a replacement for a.

Note: All functions in this section fail (more or less) silently if the executed program cannot be found; this module raises an OSError exception.

In the following examples, we assume that the subprocess module is imported with "from subprocess import *".

System Message: WARNING/2 (/tmp/ms.rst, line 2458); backlink

Inline emphasis start-string without end-string.

Replacing /bin/sh shell backquote

output=`mycmd myarg` ==> output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]

Replacing shell pipe line

output=`dmesg | grep hda` ==> p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) output = p2.communicate()[0]

Replacing os.system()

sts = os.system("mycmd" + " myarg") ==> p = Popen("mycmd" + " myarg", shell=True) sts = os.waitpid(p.pid, 0)

Note:

A more real-world example would look like this:

try:

retcode = call("mycmd" + " myarg", shell=True) if retcode < 0:

System Message: ERROR/3 (/tmp/ms.rst, line 2497)

Unexpected indentation.
print >>sys.stderr, "Child was terminated by signal", -retcode

System Message: WARNING/2 (/tmp/ms.rst, line 2498)

Block quote ends without a blank line; unexpected unindent.
else:
print >>sys.stderr, "Child returned", retcode
except OSError, e:
print >>sys.stderr, "Execution failed:", e

Replacing os.spawn*

P_NOWAIT example:

pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg") ==> pid = Popen(["/bin/mycmd", "myarg"]).pid

P_WAIT example:

retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg") ==> retcode = call(["/bin/mycmd", "myarg"])

Vector example:

os.spawnvp(os.P_NOWAIT, path, args) ==> Popen([path] + args[1:])

Environment example:

os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env) ==> Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})

Replacing os.popen*

pipe = os.popen(cmd, mode='r', bufsize) ==> pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout

pipe = os.popen(cmd, mode='w', bufsize) ==> pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin

(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize) ==> p = Popen(cmd, shell=True, bufsize=bufsize,

System Message: ERROR/3 (/tmp/ms.rst, line 2548)

Unexpected indentation.
stdin=PIPE, stdout=PIPE, close_fds=True)

System Message: WARNING/2 (/tmp/ms.rst, line 2549)

Block quote ends without a blank line; unexpected unindent.

(child_stdin, child_stdout) = (p.stdin, p.stdout)

(child_stdin,
child_stdout, child_stderr) = os.popen3(cmd, mode, bufsize)

System Message: WARNING/2 (/tmp/ms.rst, line 2555)

Definition list ends without a blank line; unexpected unindent.

==> p = Popen(cmd, shell=True, bufsize=bufsize,

System Message: ERROR/3 (/tmp/ms.rst, line 2557)

Unexpected indentation.
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)

System Message: WARNING/2 (/tmp/ms.rst, line 2558)

Block quote ends without a blank line; unexpected unindent.
(child_stdin,
child_stdout, child_stderr) = (p.stdin, p.stdout, p.stderr)

(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize) ==> p = Popen(cmd, shell=True, bufsize=bufsize,

System Message: ERROR/3 (/tmp/ms.rst, line 2566)

Unexpected indentation.
stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)

System Message: WARNING/2 (/tmp/ms.rst, line 2567)

Block quote ends without a blank line; unexpected unindent.

(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)

Replacing popen2.*

Note: If the cmd argument to popen2 functions is a string, the command is executed through /bin/sh. If it is a list, the command is directly executed.

(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) ==> p = Popen(["somestring"], shell=True, bufsize=bufsize

System Message: ERROR/3 (/tmp/ms.rst, line 2579)

Unexpected indentation.
stdin=PIPE, stdout=PIPE, close_fds=True)

System Message: WARNING/2 (/tmp/ms.rst, line 2580)

Block quote ends without a blank line; unexpected unindent.

(child_stdout, child_stdin) = (p.stdout, p.stdin)

(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) ==> p = Popen(["mycmd", "myarg"], bufsize=bufsize,

System Message: ERROR/3 (/tmp/ms.rst, line 2586)

Unexpected indentation.
stdin=PIPE, stdout=PIPE, close_fds=True)

System Message: WARNING/2 (/tmp/ms.rst, line 2587)

Block quote ends without a blank line; unexpected unindent.

(child_stdout, child_stdin) = (p.stdout, p.stdin)

The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, except that:

Classes

class Popen(object): 342

_handle_exitstatus(self, sts): 343

_close_fds(self, but): 344

_set_cloexec_flag(self, fd): 345

_translate_newlines(self, data): 346

communicate(self, input=None): 347

Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.

communicate() returns a tuple (stdout, stderr).

_get_handles(self, stdin, stdout, stderr): 348

Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite

_execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): 349

Execute program (POSIX version)

poll(self): 350

Check if child process has terminated. Returns returncode attribute.

__init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0): 351

Create new Popen instance.

wait(self): 352

Wait for child process to terminate. Returns returncode attribute.

Functions

_demo_posix(): 353

_cleanup(): 354

call(*args, **kwargs): 355

Run command with arguments. Wait for command to complete, then return the returncode attribute.

The arguments are the same as for the Popen constructor. Example:

retcode = call(["ls", "-l"])

list2cmdline(seq): 356

Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime:

  1. Arguments are delimited by white space, which is either a space or a tab.
  2. A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument.
  3. A double quotation mark preceded by a backslash is interpreted as a literal double quotation mark.
  4. Backslashes are interpreted literally, unless they immediately precede a double quotation mark.
  5. If backslashes immediately precede a double quotation mark, every pair of backslashes is interpreted as a literal backslash. If the number of backslashes is odd, the last backslash escapes the next double quotation mark as described in rule 3.

_demo_windows(): 357

Module ms.test_utils (source)

usage: python %prog mod-or-pkg-names [options] -v, --verbose: print verbose information

Classes

class DocTester(object): 358

run(self): 359

_testpkg(self, pkg, verbose=False): 360

__init__(self, pkg_names, verbose=False): 361

class UnitDocTester(DocTester): 362

getsuite(self): 363

run(self): 364

Functions

summary(runtest, modules, verbose=False): 365

runtest is a callable running the doctests inside a module/package.

getcomponents(mod_or_pkg): 366

Imports and returns the components of a package, i.e. its modules and subpackages.

Module ms.time_utils (source)

A few routines to simplify your life with dates and times.

Classes

class UTCTime(datetime): 367

A subclass of datetime.datetime to simplify work with universal time. Here are a few examples of usage:

>> print UTCTime() # assuming now is Tue Sep 14 05:32:00 2004 Tue, 14 Sep 05:32:00 2004 UTC >> print UTCTime().plus(7) # plus 7 days Tue, 21 Sep 05:32:40 2004 UTC

plus has the signature (days, seconds). It is also possible to convert usual datetime objects into UTCTime objects, or to create UTCTime objects as follows:

>> print UTCTime(2004, 9, 14, 5, 32) Tue Sep 14 05:32:00 2004

__str__(self): 368

Use format in the RFC 2822 Internet email standard. 6.1 .

execute(self, shellcmd): 369

Execute a shell command at the given date. Here is an example:

UTCTime(2004,11,12,0,0,0).execute("python $HOME/code/lib/python/" "partecs_voting/via_email/end_vote.py ban_cars")

plus(self, days, seconds=0): 370

Add a time interval in days and/or seconds. Fractions of day, zero days, and negative numbers are valid inputs.

short_isoformat(self): 371

Return the current date in a short isoformat, i.e. 04-10-21.

minus(self, days, seconds=0): 372

Subtract a time interval in days and/or seconds. Fractions of day, zero days, and negative numbers are valid inputs.

localtime(self): 373

Returns a datetime object. Example: >> now = UTCTime() >> print now, now.localtime() Thu, 02 Dec 2004 13:10:38 UTC Thu, 02 Dec 2004 14:10:38 UTC

class Timed(object): 374

Wraps a function and executes it many times (default 100 times). The average time spent in one iteration, expressed in milliseconds, is stored in the attributes wrappedfunc.time and wrappedfunc.clocktime, and displayed into a log file which defaults to stdout.

__call__(self, func): 375

__init__(self, repeat=100, logfile=<open file '<stdout>', mode 'w' at 0xb7e30068>): 376

Functions

str2datetime(s): 377

Ex: "Sat Aug 28 18:24:41 2004" -> datetime.datetime(2004, 8, 28, 18, 24, 41)

execute_at(date, shellcmd): 378

Execute a shell command at the given date. Here is an example:

execute_at(datetime(2004,11,12,0,0,0), "python $HOME/code/lib/python/" "partecs_voting/via_email/end_vote.py ban_cars")

loop_overhead(N): 379

Computes the time spent in empty loop of N iterations.

timeit_(stmt, setup='from __main__ import *', n=1000): 380

at_format(date): 381

Returns the current date in a format suitable for the unix 'at' command. 'date' is a datetime object.

Module ms.utest (source)

Take a set of modules/packages, find the doctests in them, and run them as unit tests.

usage: python %prog mod-or-pkg-names [options] -v, --verbose: print verbose information

Module ms.webtester (source)

A module to perform stress tests of Web applications.

Classes

class LoggedUser(object): 382

retrieve(self, page, data=()): 383

__init__(self, user=None, pwd=None, baseurl='http://localhost:7080/', page='login'): 384

class Webtester(object): 385

A class to perform stress tests of Web applications. Example:

System Message: WARNING/2 (/tmp/ms.rst, line 2930)

Literal block expected; none found.

>> tester = Webtester(n_users=5000) >> tester.register_users() # the first time only >> tester.users_retrieve("hello")

users_retrieve(self, page): 386

register_users(self, page='register'): 387

print_msg(self, msg): 388

login(self, user, pwd): 389

__init__(self, baseurl='http://localhost:7080/', n_users=1000): 390

Functions

start_server(server_script, port=7080): 391

(Re)start the Quixote server on the given port.

stop_server(port=7080): 392

print_shelve(name): 393

Usage: >> from webtester import print_shelve; print_shelve("registered_users")

Module ms.wiki (source)

Upload and download files from Partecs Wiki.

usage: python %prog names [options]
-u, --upload: upload the given names -d, --download: download -f, --format=FORMAT: format (html, txt, rst)

Functions

upload(fname): 394

High level upload function. Magically infer the format from the file name extension. The filename should be a WikiName and only the basename part is used.

download(WikiName): 395

High level download function.

wiki_download(name): 396

Low level download function for wiki pages.

wiki_upload(name, txt, format): 397

Low level upload function.

Index

[149]AttributeDescriptor (ms.lang_utils)
[259]AutoExport (ms.quixote_utils24)
[204]Chainmap (ms.misc_utils)
[71]CharacterDataHandler (XML2CodeParser)
[108]ClientUploader (ms.http_utils)
[36]ConfigObj (ms.file_utils)
[119]Cycle (ms.iter_utils)
[185]DSU (ms.minidoc)
[201]DictWrapper (ms.misc_utils)
[198]Dispatcher (ms.misc_utils)
[358]DocTester (ms.test_utils)
[173]Document (ms.minidoc)
[180]DocutilsWrite (ms.minidoc)
[114]EmptyIteratorError (ms.iter_utils)
[67]EndElementHandler (XML2CodeParser)
[54]Folder (ms.hier_utils)
[291]FormFactory (ms.quixote_utils_exp)
[304]FormPage (ms.quixote_utils_exp)
[161]HTMLNotifier (ms.mail_utils)
[7]LogFile (ms.debug_utils)
[382]LoggedUser (ms.webtester)
[14]MRO (ms.debug_utils)
[35]Memoize (ms.exper_utils)
[140]Memoize (ms.lang_utils)
[132]MetaSuper (ms.lang_utils)
[134]MetaWrapper (ms.lang_utils)
[245]MultipageTable (ms.quixote_utils)
[272]MultipageTable (ms.quixote_utils24)
[296]MultipageTable (ms.quixote_utils_exp)
[203]NonInstantiableError (ms.misc_utils)
[158]NullFile (ms.mail_utils)
[169]NullServer (ms.mail_utils)
[215]OptionParser (ms.optionparse)
[115]PackedList (ms.iter_utils)
[214]ParsingError (ms.optionparse)
[1]Popen (ms.concurrency)
[342]Popen (ms.subprocess)
[262]Publish (ms.quixote_utils24)
[231]RecognizeExports (ms.quixote_utils)
[234]RootDirectory (ms.quixote_utils)
[166]SendingTo (ms.mail_utils)
[333]SessionObject (ms.quixote_utils_exp)
[270]SimpleDirectory (ms.quixote_utils24)
[32]Singleton (ms.exper_utils)
[142]Singleton (ms.lang_utils)
[69]StartElementHandler (XML2CodeParser)
[146]Super (ms.lang_utils)
[79]TableList (ms.html_utils)
[374]Timed (ms.time_utils)
[367]UTCTime (ms.time_utils)
[242]UnauthorizedError (ms.quixote_utils)
[267]UnauthorizedError (ms.quixote_utils24)
[301]UnauthorizedError (ms.quixote_utils_exp)
[362]UnitDocTester (ms.test_utils)
[308]Url (ms.quixote_utils_exp)
[250]User (ms.quixote_utils)
[277]User (ms.quixote_utils24)
[314]User (ms.quixote_utils_exp)
[223]Visitor (ms.plot_utils)
[281]WebDirectory (ms.quixote_utils24)
[328]Website (ms.quixote_utils_exp)
[385]Webtester (ms.webtester)
[65]XML2CodeParser (ms.hier_utils)
[89]XMLShortTag (ms.html_utils)
[87]XMLTag (ms.html_utils)
[323]_PublisherFactory (ms.quixote_utils_exp)
[319]_ShelveSessionManager (ms.quixote_utils_exp)
[125]__call__ (Cycle)
[306]__call__ (FormPage)
[33]__call__ (Singleton)
[143]__call__ (Singleton)
[375]__call__ (Timed)
[324]__call__ (_PublisherFactory)
[20]__call__ (decorator)
[77]__call__ (htmlpage)
[255]__call__ (old_private)
[240]__call__ (private)
[287]__call__ (private)
[294]__call__ (private)
[85]__call__ (template)
[62]__delitem__ (Folder)
[152]__get__ (AttributeDescriptor)
[148]__get__ (Super)
[90]__getattr__ (XMLShortTag)
[88]__getattr__ (XMLTag)
[197]__getattr__ (kwdict)
[205]__getitem__ (Chainmap)
[120]__getitem__ (Cycle)
[55]__getitem__ (Folder)
[260]__init__ (AutoExport)
[206]__init__ (Chainmap)
[111]__init__ (ClientUploader)
[40]__init__ (ConfigObj)
[127]__init__ (Cycle)
[202]__init__ (DictWrapper)
[361]__init__ (DocTester)
[179]__init__ (Document)
[182]__init__ (DocutilsWrite)
[64]__init__ (Folder)
[292]__init__ (FormFactory)
[307]__init__ (FormPage)
[165]__init__ (HTMLNotifier)
[384]__init__ (LoggedUser)
[141]__init__ (Memoize)
[133]__init__ (MetaSuper)
[137]__init__ (MetaWrapper)
[249]__init__ (MultipageTable)
[276]__init__ (MultipageTable)
[300]__init__ (MultipageTable)
[172]__init__ (NullServer)
[219]__init__ (OptionParser)
[117]__init__ (PackedList)
[351]__init__ (Popen)
[266]__init__ (Publish)
[233]__init__ (RecognizeExports)
[168]__init__ (SendingTo)
[34]__init__ (Singleton)
[144]__init__ (Singleton)
[147]__init__ (Super)
[376]__init__ (Timed)
[244]__init__ (UnauthorizedError)
[269]__init__ (UnauthorizedError)
[303]__init__ (UnauthorizedError)
[313]__init__ (Url)
[252]__init__ (User)
[279]__init__ (User)
[317]__init__ (User)
[225]__init__ (Visitor)
[332]__init__ (Website)
[390]__init__ (Webtester)
[70]__init__ (XML2CodeParser)
[327]__init__ (_PublisherFactory)
[321]__init__ (_ShelveSessionManager)
[200]__init__ (__metaclass__)
[21]__init__ (decorator)
[78]__init__ (htmlpage)
[43]__init__ (lockedfile)
[256]__init__ (old_private)
[241]__init__ (private)
[288]__init__ (private)
[295]__init__ (private)
[86]__init__ (template)
[121]__iter__ (Cycle)
[63]__iter__ (Folder)
[124]__len__ (Cycle)
[199]__metaclass__ (Dispatcher)
[135]__metaclass__ (MetaWrapper)
[261]__setattr__ (AutoExport)
[138]__setattr__ (MetaWrapper)
[232]__setattr__ (RecognizeExports)
[196]__setattr__ (kwdict)
[123]__setitem__ (Cycle)
[58]__setitem__ (Folder)
[176]__str__ (Document)
[57]__str__ (Folder)
[116]__str__ (PackedList)
[335]__str__ (SessionObject)
[81]__str__ (TableList)
[368]__str__ (UTCTime)
[312]__str__ (Url)
[251]__str__ (User)
[278]__str__ (User)
[316]__str__ (User)
[354]_cleanup (ms.subprocess)
[344]_close_fds (Popen)
[334]_debug (SessionObject)
[25]_decorate (ms.decorator)
[353]_demo_posix (ms.subprocess)
[357]_demo_windows (ms.subprocess)
[44]_do (ms.file_utils)
[154]_doctestAttributeDescriptor (ms.lang_utils)
[349]_execute_child (Popen)
[83]_gen_html (TableList)
[348]_get_handles (Popen)
[343]_handle_exitstatus (Popen)
[235]_q_index (RootDirectory)
[271]_q_index (SimpleDirectory)
[345]_set_cloexec_flag (Popen)
[24]_signature_gen (ms.decorator)
[360]_testpkg (DocTester)
[346]_translate_newlines (Popen)
[98]activetext (ms.html_utils)
[331]add (Website)
[330]add_attr (Website)
[156]addmethod (ms.lang_utils)
[61]append (Folder)
[381]at_format (ms.time_utils)
[66]attr2folder (XML2CodeParser)
[18]attributes (ms.debug_utils)
[157]attrs (ms.lang_utils)
[183]body (ms.minidoc)
[355]call (ms.subprocess)
[96]cgiform (ms.html_utils)
[130]check (ms.iter_utils)
[11]check_if_we_are_overriding_names_in (ms.debug_utils)
[305]checker (FormPage)
[131]chop (ms.iter_utils)
[13]classify_attrs (ms.debug_utils)
[213]classmaker (ms.noconflict)
[160]close (NullFile)
[42]close (lockedfile)
[227]cls2skel (ms.plot_utils)
[322]commit_changes (_ShelveSessionManager)
[347]communicate (Popen)
[155]compose (ms.lang_utils)
[105]converter (ms.html_utils)
[23]copyfunc (ms.decorator)
[19]decorator (ms.decorator)
[5]delayed (ms.concurrency)
[174]description (Document)
[9]display (LogFile)
[230]display_mro (ms.plot_utils)
[30]doct (ms.doct24)
[228]dotcode (ms.plot_utils)
[395]download (ms.wiki)
[93]dump (ms.html_utils)
[112]encode_multipart_formdata (ms.http_utils)
[2]ended (Popen)
[46]endswith (ms.file_utils)
[369]execute (UTCTime)
[378]execute_at (ms.time_utils)
[222]exit (ms.optionparse)
[52]extension (ms.file_utils)
[28]extractscript (ms.doct24)
[129]first_duplicate_ls (ms.iter_utils)
[175]footnoteindex (Document)
[243]format (UnauthorizedError)
[268]format (UnauthorizedError)
[302]format (UnauthorizedError)
[56]get (Folder)
[188]get_definition (ms.minidoc)
[217]get_flags (OptionParser)
[150]get_from_class (AttributeDescriptor)
[151]get_from_obj (AttributeDescriptor)
[45]get_image_fnames (ms.file_utils)
[211]get_noconflict_metaclass (ms.noconflict)
[218]get_option_args (OptionParser)
[341]get_site (ms.quixote_utils_exp)
[15]get_type (ms.debug_utils)
[51]getabspath (ms.file_utils)
[153]getattr_ (ms.lang_utils)
[366]getcomponents (ms.test_utils)
[59]getdata (Folder)
[186]getdocfrom_module (ms.minidoc)
[194]getdocfrom_module_or_package (ms.minidoc)
[192]getdocfrom_package (ms.minidoc)
[22]getinfo (ms.decorator)
[229]getmro (ms.plot_utils)
[339]getname (ms.quixote_utils_exp)
[60]getnames (Folder)
[49]getparentdir (ms.file_utils)
[107]getscriptname (ms.html_utils)
[363]getsuite (UnitDocTester)
[226]hier2skel (ms.plot_utils)
[104]html_form (ms.html_utils)
[103]html_indent (ms.html_utils)
[75]htmlpage (ms.html_utils)
[336]htmlstream (ms.quixote_utils_exp)
[53]idirs (ms.file_utils)
[48]ifiles (ms.file_utils)
[191]import_ (ms.minidoc)
[207]import_ (ms.misc_utils)
[73]indented_tree (ms.hier_utils)
[31]info (ms.exc_debugger)
[208]interp (ms.misc_utils)
[315]is_anonymous (User)
[184]isprivate (ms.minidoc)
[38]items (ConfigObj)
[37]keys (ConfigObj)
[3]killprocess (Popen)
[92]kw2query (ms.html_utils)
[195]kwdict (ms.misc_utils)
[356]list2cmdline (ms.subprocess)
[373]localtime (UTCTime)
[4]locked (ms.concurrency)
[41]lockedfile (ms.file_utils)
[285]login (WebDirectory)
[389]login (Webtester)
[284]logout (WebDirectory)
[379]loop_overhead (ms.time_utils)
[27]main (ms.doct24)
[189]main (ms.minidoc)
[282]mainpage (WebDirectory)
[162]make_msg (HTMLNotifier)
[265]make_publisher (Publish)
[177]makedoc (Document)
[193]makeindex (ms.minidoc)
[97]makelink (ms.html_utils)
[246]makerow (MultipageTable)
[273]makerow (MultipageTable)
[297]makerow (MultipageTable)
[248]maketable (MultipageTable)
[275]maketable (MultipageTable)
[299]maketable (MultipageTable)
[209]merge (ms.misc_utils)
[178]metaobjdic (Document)
[372]minus (UTCTime)
[311]new (Url)
[320]new_session (_ShelveSessionManager)
[309]newlink (Url)
[122]next (Cycle)
[6]nonblocking (ms.concurrency)
[220]nonzero (ms.optionparse)
[164]notify (HTMLNotifier)
[12]objcontent (ms.debug_utils)
[254]old_private (ms.quixote_utils)
[257]old_public (ms.quixote_utils)
[68]output (XML2CodeParser)
[118]pack (PackedList)
[221]parse (ms.optionparse)
[216]parse_args (OptionParser)
[253]permissions (User)
[280]permissions (User)
[318]permissions (User)
[370]plus (UTCTime)
[350]poll (Popen)
[10]prettydict (ms.debug_utils)
[126]prev (Cycle)
[388]print_msg (Webtester)
[16]print_shelve (ms.debug_utils)
[393]print_shelve (ms.webtester)
[17]printerr (ms.debug_utils)
[102]printpage (ms.html_utils)
[239]private (ms.quixote_utils)
[286]private (ms.quixote_utils24)
[293]private (ms.quixote_utils_exp)
[74]process (ms.hier_utils)
[258]public (ms.quixote_utils)
[290]public (ms.quixote_utils24)
[264]publish (Publish)
[237]publish (RootDirectory)
[236]publish_show (RootDirectory)
[329]publisher (Website)
[100]query2kw (ms.html_utils)
[163]quit (HTMLNotifier)
[170]quit (NullServer)
[190]quote (ms.minidoc)
[50]reader (ms.file_utils)
[283]register (WebDirectory)
[387]register_users (Webtester)
[212]remove_redundant (ms.noconflict)
[247]render (MultipageTable)
[274]render (MultipageTable)
[298]render (MultipageTable)
[76]render (htmlpage)
[338]render (htmlstream)
[337]render_iter (htmlstream)
[8]reset (LogFile)
[383]retrieve (LoggedUser)
[359]run (DocTester)
[364]run (UnitDocTester)
[326]run_debug (_PublisherFactory)
[325]run_show (_PublisherFactory)
[29]runsuite (ms.doct24)
[26]runtest (ms.doct24)
[210]safetype (ms.noconflict)
[167]send_from (SendingTo)
[171]sendmail (NullServer)
[238]set_default (RootDirectory)
[371]short_isoformat (UTCTime)
[263]show (Publish)
[310]show (Url)
[94]show (ms.html_utils)
[101]simplepage (ms.html_utils)
[128]skip_redundant (ms.iter_utils)
[391]start_server (ms.webtester)
[392]stop_server (ms.webtester)
[377]str2datetime (ms.time_utils)
[365]summary (ms.test_utils)
[145]superobject (ms.lang_utils)
[139]supertype (ms.lang_utils)
[187]tail (ms.minidoc)
[84]template (ms.html_utils)
[91]testTable (ms.html_utils)
[95]tidy (ms.html_utils)
[380]timeit_ (ms.time_utils)
[82]to_html (TableList)
[80]to_text (TableList)
[289]un_pw_form (ms.quixote_utils24)
[340]un_pw_form (ms.quixote_utils_exp)
[106]unicode_converter (ms.html_utils)
[109]upload (ClientUploader)
[394]upload (ms.wiki)
[110]upload_many (ClientUploader)
[113]urlopen (ms.http_utils)
[386]users_retrieve (Webtester)
[136]using (__metaclass__)
[39]values (ConfigObj)
[224]visit (Visitor)
[352]wait (Popen)
[72]walk (ms.hier_utils)
[396]wiki_download (ms.wiki)
[397]wiki_upload (ms.wiki)
[181]write (DocutilsWrite)
[159]write (NullFile)
[47]writer (ms.file_utils)
[99]xml_attr (ms.html_utils)

Docutils System Messages

System Message: ERROR/3 (/tmp/ms.rst, line 1778); backlink

Unknown target name: "can".

System Message: ERROR/3 (/tmp/ms.rst, line 1927); backlink

Unknown target name: "can".

System Message: ERROR/3 (/tmp/ms.rst, line 2137); backlink

Unknown target name: "can".