/usr/lib/python2.7/dist-packages/pyramid/tests/test_scripts/dummy.py is in python-pyramid 1.4.5+dfsg-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | class DummyTweens(object):
def __init__(self, implicit, explicit):
self._implicit = implicit
self.explicit = explicit
self.name_to_alias = {}
def implicit(self):
return self._implicit
class Dummy:
pass
dummy_root = Dummy()
class DummyRegistry(object):
settings = {}
def queryUtility(self, iface, default=None, name=''):
return default
dummy_registry = DummyRegistry()
class DummyShell(object):
env = {}
help = ''
def __call__(self, env, help):
self.env = env
self.help = help
class DummyInteractor:
def __call__(self, banner, local):
self.banner = banner
self.local = local
class DummyBPythonShell:
def __call__(self, locals_, banner):
self.locals_ = locals_
self.banner = banner
class DummyIPShell(object):
IP = Dummy()
IP.BANNER = 'foo'
def set_banner(self, banner):
self.banner = banner
def __call__(self):
self.called = True
class DummyIPShellFactory(object):
def __call__(self, **kw):
self.kw = kw
self.shell = DummyIPShell()
return self.shell
class DummyApp:
def __init__(self):
self.registry = dummy_registry
class DummyMapper(object):
def __init__(self, *routes):
self.routes = routes
def get_routes(self):
return self.routes
class DummyRoute(object):
def __init__(self, name, pattern, factory=None,
matchdict=None, predicate=None):
self.name = name
self.path = pattern
self.pattern = pattern
self.factory = factory
self.matchdict = matchdict
self.predicates = []
if predicate is not None:
self.predicates = [predicate]
def match(self, route):
return self.matchdict
class DummyRequest:
application_url = 'http://example.com:5432'
script_name = ''
def __init__(self, environ):
self.environ = environ
self.matchdict = {}
class DummyView(object):
def __init__(self, **attrs):
self.__request_attrs__ = attrs
from zope.interface import implementer
from pyramid.interfaces import IMultiView
@implementer(IMultiView)
class DummyMultiView(object):
def __init__(self, *views, **attrs):
self.views = [(None, view, None) for view in views]
self.__request_attrs__ = attrs
class DummyConfigParser(object):
def __init__(self, result):
self.result = result
def read(self, filename):
self.filename = filename
def items(self, section):
self.section = section
if self.result is None:
from pyramid.compat import configparser
raise configparser.NoSectionError(section)
return self.result
class DummyConfigParserFactory(object):
items = None
def __call__(self):
self.parser = DummyConfigParser(self.items)
return self.parser
class DummyCloser(object):
def __call__(self):
self.called = True
class DummyBootstrap(object):
def __init__(self, app=None, registry=None, request=None, root=None,
root_factory=None, closer=None):
self.app = app or DummyApp()
if registry is None:
registry = DummyRegistry()
self.registry = registry
if request is None:
request = DummyRequest({})
self.request = request
if root is None:
root = Dummy()
self.root = root
if root_factory is None:
root_factory = Dummy()
self.root_factory = root_factory
if closer is None:
closer = DummyCloser()
self.closer = closer
def __call__(self, *a, **kw):
self.a = a
self.kw = kw
return {
'app': self.app,
'registry': self.registry,
'request': self.request,
'root': self.root,
'root_factory': self.root_factory,
'closer': self.closer,
}
|