root/galaxy-central/eggs/twill-0.9-py2.6.egg/twill/namespaces.py @ 3

リビジョン 3, 1.2 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1"""
2Global and local dictionaries, + initialization/utility functions.
3"""
4
5global_dict = {}
6
7def init_global_dict():
8    """
9    Initialize global dictionary with twill commands.
10
11    This must be done after all the other modules are loaded, so that all
12    of the commands are already defined.
13    """
14    exec "from twill.commands import *" in global_dict
15    import twill.commands
16    command_list = twill.commands.__all__
17   
18    import twill.parse
19    twill.parse.command_list.extend(command_list)
20
21# local dictionaries.
22_local_dict_stack = []
23
24###
25
26# local dictionary management functions.
27
28def new_local_dict():
29    """
30    Initialize a new local dictionary & push it onto the stack.
31    """
32    d = {}
33    _local_dict_stack.append(d)
34
35    return d
36
37def pop_local_dict():
38    """
39    Get rid of the current local dictionary.
40    """
41    _local_dict_stack.pop()
42
43###
44
45def get_twill_glocals():
46    """
47    Return global dict & current local dictionary.
48    """
49    global global_dict, _local_dict_stack
50    assert global_dict is not None, "must initialize global namespace first!"
51
52    if len(_local_dict_stack) == 0:
53        new_local_dict()
54
55    return global_dict, _local_dict_stack[-1]
56
57###
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。