rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
evt.Skip()
def OnKeyDown(self, evt): if evt.KeyCode() != wx.WXK_RETURN or evt.ControlDown(): evt.Skip() return
self.SetCellBackgroundColour(row, col, "WhiteSmoke")
self.SetCellBackgroundColour(row, col, wx.Colour(245, 245, 245))
def RefreshLedger(self, focusEntry=None, sync=True, sort=True): col = None if sort: col = self.sortByCol self.GetTable().RefreshLedger(focusEntry=focusEntry, sync=sync, sortByCol=col) for row in xrange(self.GetNumberRows()): for col in xrange(self.GetNumberCols()): if row % 2: self.SetCellBackgroundColour(row, col, "Wh...
'<div class="document">\n<p>This is the Foo interface</p>'
u'<div class="document">\n<p>This is the Foo interface</p>'
def getDoc(self): r"""Return the main documentation string of the interface.
def __init__(self, context, request): self.context = context self.request = request
def __init__(self, context, request): self.context = context self.request = request
Note that you should only expect one type at a time."""
Note that you should only expect one type at a time. Example:: >>> import pprint >>> pprint = pprint.PrettyPrinter(width=69).pprint >>> from tests import getInterfaceDetails >>> from zope.interface import Interface, directlyProvides >>> class IType(Interface): ... pass >>> details = getInterfaceDetails() >>> det...
def getTypes(self): """Return a list of interface types that are specified for this interface.
r
def getAttributes(self): """Return a list of attributes in the order they were specified.""" iface = removeAllProxies(self.context) attrs = [] for name in iface: attr = iface[name] if not IMethod.providedBy(attr) and not IField.providedBy(attr): attrs.append(attr) return [{'name': attr.getName(), 'doc': stx2html(attr.g...
r
def getMethods(self): """Return a list of methods in the order they were specified.""" methods = [] return [{'name': method.getName(), 'signature': method.getSignatureString(), 'doc': stx2html(method.getDoc() or '', 3)} for method in _get(self.context, IMethod).values()]
'default': field.default.__repr__,
'default': field.default.__repr__(),
def getFields(self): """Return a list of fields in the order they were specified.""" fields = map(lambda x: x[1], _getInOrder(self.context, IField)) return [{'name': field.getName(), 'iface': _getFieldInterface(field), 'required': _getRequired(field), 'default': field.default.__repr__, 'description': field.description ...
'factory': getPythonPath(adapter[4][0])
'factory': path, 'factory_url': url
def getRequiredAdapters(self): """Get adapters where this interface is required.""" service = zapi.getService(self.context, 'Adapters') context = removeAllProxies(self.context) adapters = [] for adapter in service.getRegisteredMatching(required=context): adapters.append({ 'provided': getPythonPath(adapter[1]), 'require...
'factory': getPythonPath(adapter[4][0])
'factory': path, 'factory_url': url
def getProvidedAdapters(self): """Get adapters where this interface is provided.""" service = zapi.getService(self.context, 'Adapters') context = removeAllProxies(self.context) adapters = [] for adapter in service.getRegisteredMatching(provided=context): adapters.append({ 'required': [getPythonPath(iface) for iface in ...
interface."""
interface. Example:: >>> from tests import getInterfaceDetails >>> details = getInterfaceDetails() >>> factories = details.getFactories() >>> factories = [f.items() for f in factories] >>> factories = [f for f in factories if f.sort() is None] >>> factories.sort() >>> factories [[('name', 'FooFactory'), ('title', 'F...
def getFactories(self): """Return the factories, who will provide objects implementing this interface.""" iface = removeAllProxies(self.context) return [{'name': n, 'factory': f, 'title': f.title} \ for n, f in zapi.queryUtilitiesFor(IFactory, ()) \ if ISource in tuple(f.getInterfaces)]
return [{'name': n, 'factory': f, 'title': f.title} \ for n, f in zapi.queryUtilitiesFor(IFactory, ()) \ if ISource in tuple(f.getInterfaces)]
return [{'name': n, 'title': f.title} \ for n, f in zapi.getFactoriesFor(self.context, iface) \ if iface in tuple(f.getInterfaces())]
def getFactories(self): """Return the factories, who will provide objects implementing this interface.""" iface = removeAllProxies(self.context) return [{'name': n, 'factory': f, 'title': f.title} \ for n, f in zapi.queryUtilitiesFor(IFactory, ()) \ if ISource in tuple(f.getInterfaces)]
return [{'name': util[0], 'path': getPythonPath(util[1].__class__)} for util in utils]
info = [] for name, util in utils: if type(util) in (ClassType, TypeType): klass = util else: klass = util.__class__ path = getPythonPath(klass) info.append({'name': name, 'path': path, 'url': path.replace('.', '/')}) return info
def getUtilities(self): """Return all utilities that provide this interface.""" service = zapi.getService(self.context, 'Utilities') utils = service.getUtilitiesFor(removeAllProxies(self.context)) return [{'name': util[0], 'path': getPythonPath(util[1].__class__)} for util in utils]
elif factory.__module__.startswith('zope.app.publisher.browser.viewmeta'):
elif factory.__module__ is not None and \ factory.__module__.startswith('zope.app.publisher.browser.viewmeta'):
def getViewFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'url': None, 'template': None, 'resource': None, 'referencable': True} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): # In the case of a SimpleView, the base is re...
info['path'] = getPythonPath(factory)
info['path'] = getPythonPath(getattr(factory, 'factory', factory))
def getViewFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'url': None, 'template': None, 'resource': None, 'referencable': True} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): # In the case of a SimpleView, the base is re...
path = getPythonPath(cls)
unwrapped_cls = removeAllProxies(cls) path = getPythonPath(unwrapped_cls)
def _listClasses(self, classes): """Prepare a list of classes for presentation.
if reg.required[0] is not None and iface not in reg.required:
if reg.required and reg.required[0] is not None and iface not in reg.required:
def getRequiredAdapters(self): """Get adapters where this interface is required.
sm = zope.component.getSiteManager()
smlist = [zope.component.getSiteManager()] seen = []
def items(self): sm = zope.component.getSiteManager() ifaces = {} while sm is not None: for reg in sm.registeredUtilities(): path = getPythonPath(reg.provided) ifaces[path] = UtilityInterface(self, path, reg.provided) sm = queryNextSiteManager(sm)
while sm is not None:
while smlist: sm = smlist.pop() if sm in seen: continue seen.append(sm) smlist += list(sm.__bases__)
def items(self): sm = zope.component.getSiteManager() ifaces = {} while sm is not None: for reg in sm.registeredUtilities(): path = getPythonPath(reg.provided) ifaces[path] = UtilityInterface(self, path, reg.provided) sm = queryNextSiteManager(sm)
sm = queryNextSiteManager(sm)
def items(self): sm = zope.component.getSiteManager() ifaces = {} while sm is not None: for reg in sm.registeredUtilities(): path = getPythonPath(reg.provided) ifaces[path] = UtilityInterface(self, path, reg.provided) sm = queryNextSiteManager(sm)
'<div class="apihead">Zope 3 API Docs</div>') > 0)
'<a href="contents.html" target="main">Zope 3 API Docs</a>') > 0)
def testModuleListView(self): response = self.publish('/++apidoc++/modulelist.html', basic='mgr:mgrpw') self.assertEqual(response.getStatus(), 200) body = response.getBody() self.assert_(body.find( '<div class="apihead">Zope 3 API Docs</div>') > 0) self.checkForBrokenLinks(body, '/++apidoc++/modulelist.html', basic='mg...
context = removeSecurityProxy(self.context) ns, name = context.name ns = ns.replace(':', '_co_') ns = ns.replace('/', '_sl_')
directive = removeSecurityProxy(self.context) subDirective = None parent = zapi.getParent(directive) if not (IRootDirective.providedBy(parent) or IRootDirective.providedBy(directive)): subDirective = directive directive = parent ns, name = directive.name ns = quoteNS(ns)
def url(self): context = removeSecurityProxy(self.context) ns, name = context.name ns = ns.replace(':', '_co_') ns = ns.replace('/', '_sl_') zcml = zapi.getUtility(IDocumentationModule, 'ZCML') if name not in zcml[ns]: ns = 'ALL' return '%s/../ZCML/%s/%s/index.html' %( zapi.absoluteURL(findDocModule(self), self.request...
return '%s/../ZCML/%s/%s/index.html' %(
link = '%s/../ZCML/%s/%s/index.html' %(
def url(self): context = removeSecurityProxy(self.context) ns, name = context.name ns = ns.replace(':', '_co_') ns = ns.replace('/', '_sl_') zcml = zapi.getUtility(IDocumentationModule, 'ZCML') if name not in zcml[ns]: ns = 'ALL' return '%s/../ZCML/%s/%s/index.html' %( zapi.absoluteURL(findDocModule(self), self.request...
for name, attr, iface in self.context.getAttributes():
klass = removeAllProxies(self.context) for name, attr, iface in klass.getAttributes():
def getAttributes(self): """Get all attributes of this class.
checker = removeAllProxies(self.context.getSecurityChecker())
checker = removeAllProxies(klass.getSecurityChecker())
def getAttributes(self): """Get all attributes of this class.
for name, attr, iface in self.context.getMethods(): if inspect.ismethod(attr): entry = {'name': name, 'signature': getFunctionSignature(attr), 'doc': stx2html(attr.__doc__ or ''), 'interface': getPythonPath(iface)} entry.update(getPermissionIds( name, self.context.getSecurityChecker())) methods.append(entry)
klass = removeAllProxies(self.context) for name, attr, iface in klass.getMethods(): entry = {'name': name, 'signature': getFunctionSignature(attr), 'doc': stx2html(attr.__doc__ or ''), 'interface': getPythonPath(iface)} entry.update(getPermissionIds(name, klass.getSecurityChecker())) methods.append(entry)
def getMethods(self): """Get all methods of this class.
elif hasattr(factory, '__class__') and \ factory.__class__.__name__ == 'ProxyView': factory = factory.factory info['path'] = factory.__module__ + '.' + factory.__name__
def getViewFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'url': None, 'template': None, 'resource': None, 'referencable': True} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): # In the case of a SimpleView, the base is re...
elif isinstance(factory, FunctionType): info['path'] = getPythonPath(getattr(factory, 'factory', factory))
def getViewFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'url': None, 'template': None, 'resource': None, 'referencable': True} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): # In the case of a SimpleView, the base is re...
if iface.isOrExtends(required_iface):
if required_iface is None or iface.isOrExtends(required_iface):
def getViews(iface, type=IRequest): """Get all view registrations for a particular interface.""" gsm = zapi.getGlobalSiteManager() for reg in gsm.registrations(): if (isinstance(reg, AdapterRegistration) and len(reg.required) > 0 and reg.required[-1] is not None and reg.required[-1].isOrExtends(type)): for required_if...
if type(factory) in (types.ClassType, types.TypeType): klass = factory else: klass = factory.__class__ path = getPythonPath(klass)
callable = factory if IFactory.providedBy(factory): callable = factory._callable elif hasattr(callable, '__class__'): callable = callable.__class__ path = getPythonPath(callable)
def getFactoryInfoDictionary(reg): """Return a PT-friendly info dictionary for a factory.""" factory = reg.component if type(factory) in (types.ClassType, types.TypeType): klass = factory else: klass = factory.__class__ path = getPythonPath(klass) return {'name': reg.name or '<i>no name</i>', 'title': getattr(factory,...
module=klass.__module__),
module=callable.__module__),
def getFactoryInfoDictionary(reg): """Return a PT-friendly info dictionary for a factory.""" factory = reg.component if type(factory) in (types.ClassType, types.TypeType): klass = factory else: klass = factory.__class__ path = getPythonPath(klass) return {'name': reg.name or '<i>no name</i>', 'title': getattr(factory,...
return InterfaceDetails(schema, self.request)
details = InterfaceDetails() details.context = schema details.request = self.request return details
def getInterface(self): """Return the interface the utility provides.""" schema = LocationProxy(self.context.interface, self.context, getPythonPath(self.context.interface)) return InterfaceDetails(schema, self.request)
if isinstance(self.context.component, (unicode, str)): return None return getPythonPath(self.context.component.__class__)
"""Return the python path of the implementation class.
def getComponent(self): """Return the python path of the implementation class.""" if isinstance(self.context.component, (unicode, str)): return None #self.context.component return getPythonPath(self.context.component.__class__)
class Menu:
Examples:: >>> from zope.app.apidoc.utilitymodule import Utility >>> from zope.app.apidoc.tests import pprintDict >>> class Foo(object): ... pass >>> class Bar: ... pass >>> details = UtilityDetails() >>> details.context = Utility(None, '', None, Foo()) >>> pprintDict(details.getComponent()) [('path', 'zope...
def getComponent(self): """Return the python path of the implementation class.""" if isinstance(self.context.component, (unicode, str)): return None #self.context.component return getPythonPath(self.context.component.__class__)
return {'module': iface.__module__, 'name': iface.getName()}
return {'module': getattr(iface, '__module__', '<unknown>'), 'name': getattr(iface, '__name__', '<unknown>')}
def getInterfaceInfoDictionary(iface): """Return a PT-friendly info dictionary for an interface.""" if iface is None: return None return {'module': iface.__module__, 'name': iface.getName()}
if self.options.use_publisher: self.browser = PublisherBrowser()
def start(self): """Start the retrieval of the apidoc.""" t0 = time.time()
elif self.options.use_publisher: self.sendMessage("PublisherBrowser is broken. Please use OnlineBrowser instead.") return
def start(self): """Start the retrieval of the apidoc.""" t0 = time.time()
self.browser._links_factory.urltags = urltags
self.browser._links_factory = mechanize.LinksFactory(urltags=urltags)
def start(self): """Start the retrieval of the apidoc.""" t0 = time.time()
from ClientCookie._Util import response_seek_wrapper
from mechanize import response_seek_wrapper
def processLink(self, link): """Process a link.""" url = link.absoluteURL
zope.app.security.interfaces.IPermission
zope.security.interfaces.IPermission
def items(self): """See zope.app.container.interfaces.IReadContainer""" service = zapi.getService(Utilities) items = [(reg.name or NONAME, Utility(self, reg)) for reg in service.registrations() if self.interface == reg.provided] items.sort() return items
if type(attr) in (ClassType, TypeType):
if type(attr) in (ClassType, TypeType) and \ attr.__name__ == name:
def __setup(self): """Setup the module sub-tree.""" # Detect packages if hasattr(self.__module, '__file__') and \ (self.__module.__file__.endswith('__init__.py') or self.__module.__file__.endswith('__init__.pyc')): dir = os.path.split(self.__module.__file__)[0] for file in os.listdir(dir): if file in IGNORE_FILES: cont...
'url': relativizePath(info.file)[10:],
'url': relativizePath(info.file)[10:].replace('\\\\', '/'),
def getParserInfoInfoDictionary(info): """Return a PT-friendly info dictionary for a parser info object.""" return {'file': relativizePath(info.file), 'url': relativizePath(info.file)[10:], 'line': info.line, 'eline': info.eline, 'column': info.column, 'ecolumn': info.ecolumn}
if not isinstance(reg, AdapterRegistration):
if not isinstance(reg, (AdapterRegistration, SubscriptionRegistration)):
def getRequiredAdapters(iface, withViews=False): """Get adapter registrations where the specified interface is required.""" gsm = zapi.getGlobalSiteManager() for reg in gsm.registrations(): # Only get adapters if not isinstance(reg, AdapterRegistration): continue # Ignore views if not withViews and reg.required[-1] and...
if not isinstance(reg, AdapterRegistration):
if not isinstance(reg, (AdapterRegistration, SubscriptionRegistration)):
def getProvidedAdapters(iface, withViews=False): """Get adapter registrations where this interface is provided.""" gsm = zapi.getGlobalSiteManager() for reg in gsm.registrations(): # Only get adapters if not isinstance(reg, AdapterRegistration): continue # Ignore views if not withViews and reg.required[-1] and \ reg.re...
if not reg.provided.isOrExtends(iface):
if reg.provided is None or not reg.provided.isOrExtends(iface):
def getProvidedAdapters(iface, withViews=False): """Get adapter registrations where this interface is provided.""" gsm = zapi.getGlobalSiteManager() for reg in gsm.registrations(): # Only get adapters if not isinstance(reg, AdapterRegistration): continue # Ignore views if not withViews and reg.required[-1] and \ reg.re...
'name': getattr(reg, 'name', None),
'name': getattr(reg, 'name', '<subscription>'),
def getAdapterInfoDictionary(reg): """Return a PT-friendly info dictionary for an adapter registration.""" factory = getRealFactory(reg.value) path = getPythonPath(factory) if isinstance(factory, types.MethodType): url = None else: url = path.replace('.', '/') if isinstance(reg.doc, (str, unicode)): doc = reg.doc zcml ...
[('path', 'zope.app.pagetemplate.simpleviewclass.SimpleViewClass'), ('referencable', False), ('resource', None), ('template', '/opt/zope/Zope3/Zope3-Fresh/src/zope/app/apidoc/viewmodule/index.pt'), ('url', None)]
[('path', 'zope.app.pagetemplate.simpleviewclass.simple'), ('referencable', True), ('resource', None), ('template', 'Zope3/src/zope/app/apidoc/viewmodule/index.pt'), ('url', 'zope/app/pagetemplate/simpleviewclass/simple')]
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
'referencable': False}
'referencable': True}
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
info['path'] = factory.__module__ + '.SimpleViewClass' info['template'] = factory.index.filename
base = factory.__bases__[0] info['path'] = base.__module__ + '.' + base.__name__ info['template'] = factory.index.filename.replace(BASEDIR, 'Zope3')
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
pass
info['referencable'] = False
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
info['referencable'] = True
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
info['path'] = factory.__module__ + '.proxyView'
if hasattr(factory, 'factory'): factory = factory.factory info['path'] = factory.__module__ + '.' + factory.__name__
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from tests import pprintDict The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info = _getFacto...
entry = {'name' : name,
entry = {'name' : name or '<i>no name</i>',
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.
'factory' : _getFactoryData(factory)
'factory' : _getFactoryData(factory), 'provided' : getPythonPath(provided)
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.
info['path'] = getPythonPath(factory.factory)
info['path'] = getPythonPath(factory)
def getViewFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'url': None, 'template': None, 'resource': None, 'referencable': True} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): # In the case of a SimpleView, the base is re...
name = self.__realname__ if name != 'ALL' and not name.startswith('http://namespaces.zope.org/'): name = 'http://namespaces.zope.org/' + name return name
return self.__realname__
def getFullName(self): """Get the full name of the namespace.""" name = self.__realname__ if name != 'ALL' and not name.startswith('http://namespaces.zope.org/'): name = 'http://namespaces.zope.org/' + name return name
if not (key == 'ALL' or key.startswith('http://namespaces.zope.org/')): key = 'http://namespaces.zope.org/' + key if not namespaces.has_key(key): return default return Namespace(self, key)
if namespaces.has_key(key): return Namespace(self, key) full_key = 'http://namespaces.zope.org/' + key if namespaces.has_key(full_key): return Namespace(self, full_key) return default
def get(self, key, default=None): """See zope.app.container.interfaces.IReadContainer
interface service.""" ids = searchInterfaceIds()
interface service. Example:: >>> import pprint >>> pprint = pprint.PrettyPrinter(width=69).pprint >>> menu = Menu() >>> menu.getInterfaceIds() ['IBrowserRequest', 'IFoo'] """ ids = searchInterfaceIds(self)
def getInterfaceIds(self): """Get a list of the ids of all interfaces registered with the interface service.""" ids = searchInterfaceIds() ids.sort() return ids
class SkinLayerUsage: """View for skins, layers and usages.""" def getSkins(self): return [{'name': skin, 'layers': layers}
class SkinLayer(object): """View for skins and layers.""" def getSkins(self, columns=True): """Get all skins and their layers. Example:: >>> import pprint >>> pprint = pprint.PrettyPrinter(width=69).pprint >>> from zope.app.apidoc.viewmodule import ViewModule >>> view = SkinLayer() >>> view.context = ViewModule() >>...
def getInterfaceIds(self): """Get a list of the ids of all interfaces registered with the interface service.""" ids = searchInterfaceIds() ids.sort() return ids
info = {'path': None, 'template': None, 'resource': None,
info = {'path': None, 'url': None, 'template': None, 'resource': None,
def _getFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'template': None, 'resource': None, 'referencable': False} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): info['path'] = factory.__module__ + '.SimpleViewClass' info[...
class ViewsDetails:
class ViewsDetails(object):
def _getFactoryData(factory): """Squeeze some useful information out of the view factory""" info = {'path': None, 'template': None, 'resource': None, 'referencable': False} if hasattr(factory, '__name__') and \ factory.__name__.startswith('SimpleViewClass'): info['path'] = factory.__module__ + '.SimpleViewClass' info[...
self.iface = getInterface(request['iface']) self.type = getInterface(request['type']) service = zapi.getService(context, 'Presentation')
self.iface = getInterface(self.context, request['iface']) self.type = getInterface(self.context, request['type']) service = zapi.getService(None, 'Presentation')
def __init__(self, context, request): self.context = context self.request = request
views."""
views. Example:: >>> import pprint >>> pprint = pprint.PrettyPrinter(width=69).pprint >>> from zope.publisher.browser import TestRequest >>> form ={'iface': 'IFoo', ... 'type': 'IBrowserRequest'} >>> view = ViewsDetails(None, TestRequest(form=form)) >>> layer = view.getViewsByLayers()[0] >>> layer['name'] 'de...
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.""" result = [] for layer, views in self.views.items(): entries = [] for required, provided, more_req, name, factories in views: if self.show_all or \ not (required is None or required is Interface): entry = {'name' : na...
for required, provided, more_req, name, factories in views:
for required, provided, more_req, name, factory in views:
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.""" result = [] for layer, views in self.views.items(): entries = [] for required, provided, more_req, name, factories in views: if self.show_all or \ not (required is None or required is Interface): entry = {'name' : na...
'factory' : _getFactoryData(factories[-1])
'factory' : _getFactoryData(factory)
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.""" result = [] for layer, views in self.views.items(): entries = [] for required, provided, more_req, name, factories in views: if self.show_all or \ not (required is None or required is Interface): entry = {'name' : na...
klass=factories[-1]))
klass=factory))
def getViewsByLayers(self): """Generate the data structure that is used to create the list of views.""" result = [] for layer, views in self.views.items(): entries = [] for required, provided, more_req, name, factories in views: if self.show_all or \ not (required is None or required is Interface): entry = {'name' : na...
args, varargs, varkw, default = inspect.getargspec(func)
args, varargs, varkw, defaults = inspect.getargspec(func)
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
if default is not None: default = (placeholder,)*(len(args)-len(default)) + default
if defaults is not None: defaults = (placeholder,)*(len(args)-len(defaults)) + defaults
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
default = (placeholder,)*len(args)
defaults = (placeholder,)*len(args)
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
for i in range(len(args)):
for name, default in zip(args, defaults):
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
if args[i] == 'self' and type(func) == types.MethodType:
if name == 'self' and type(func) == types.MethodType:
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
if default[i] is placeholder: str_args.append(args[i])
if isinstance(name, (tuple, list)): name = '(' + ', '.join(name) + ')' elif not isinstance(name, str): name = repr(name) if default is placeholder: str_args.append(name)
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
str_args.append(args[i] + '=' + repr(default[i]))
str_args.append(name + '=' + repr(default))
def getFunctionSignature(func): """Return the signature of a function or method.""" if not isinstance(func, (types.FunctionType, types.MethodType)): raise TypeError("func must be a function or method") args, varargs, varkw, default = inspect.getargspec(func) placeholder = object() sig = '(' # By filling up the default...
elif hasattr(factory, '__name__') and factory.__name__ == 'proxyView': if hasattr(factory, 'factory'): factory = factory.factory
elif hasattr(factory, '__class__') and \ factory.__class__.__name__ == 'ProxyView': factory = factory.factory
def _getFactoryData(factory): """Squeeze some useful information out of the view factory Examples:: >>> from zope.app.apidoc.tests import pprint The factory is a SimpleViewClass for a Page Template: >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass >>> view = SimpleViewClass('index.pt') >>> info...
else: attrs.append(attr)
try: getattr(obj, attr) except AttributeError: continue attrs.append(attr)
def getPublicAttributes(obj): """Return a list of public attribute names.""" attrs = [] for attr in dir(obj): if attr.startswith('_'): continue else: attrs.append(attr) return attrs
parser = optparse.OptionParser("Usage: %prog [options] TARGET_DIR")
parser = optparse.OptionParser("%prog [options] TARGET_DIR")
def processLink(self, link): """Process a link.""" url = link.absoluteURL
precond = ILUKPreconditionerFactory(ilukParams) solver = GMRESSolver(tsfSolverParams, precond)
solver = readSolver("../../../tests-std-framework/Problem/aztec-ml.xml");
def main(): """Poisson example code""" vecType = EpetraVectorType() nProc = getNProc() mesher = PartitionedLineMesher(0.0, 1.0, 10*nProc); mesh = mesher.getMesh(); basis = Lagrange(2) u = UnknownFunction(basis, "u"); v = TestFunction(basis, "v"); x = CoordExpr(0); dx = Derivative(0); quad = GaussianQuadrature(2) in...
pass
return True
def mkdir(self, name): pass
pass
return True
def chdir(self, name): pass
self.chdir(self.base_folder)
self.makedirs(self.base_folder)
def init(self): log("connecting to %s@%s" % (self.login,self.ip)) try: self.session = ftplib.FTP(self.ip,self.login,self.password) self.chdir(self.base_folder) except ftplib.all_errors, details: print str(details) raise ExtractError(_("<b>Cannot connect to xbox:\n"+details[1]+"</b>\n\nIs the xbox FTP server running?\nV...
print str(details) raise ExtractError(_("<b>Cannot connect to xbox:\n"+details[1]+"</b>\n\nIs the xbox FTP server running?\nVerify address, login and password."))
if details.__class__ == socket.error: details = details[1] raise ExtractError(_("<b>Cannot connect to xbox:\n</b>\n"+str(details)))
def init(self): log("connecting to %s@%s" % (self.login,self.ip)) try: self.session = ftplib.FTP(self.ip,self.login,self.password) self.chdir(self.base_folder) except ftplib.all_errors, details: print str(details) raise ExtractError(_("<b>Cannot connect to xbox:\n"+details[1]+"</b>\n\nIs the xbox FTP server running?\nV...
self.writer.chdir(filename)
if not self.writer.chdir(filename): raise ExtractError("<b>Cannot change to directory !</b>%s"%filename)
def browse_file(self, sector, offset=0): if self.canceled: return # jump to sector self.iso.seek(sector*2048+offset, SEEK_SET) # read file header ltable, rtable, newsector, filesize, attributes, filename_size \ = read_unpack(self.iso, "<HHLLBB") # read file name filename = self.iso.read(filename_size) self.files =...
if xiso.write_position == previous_position: time_inactive += 0.1 else: time_inactive = 0 if time_inactive > 5.0: xiso.error = _("<b>Transfer timeout</b>\nThe xbox is not responding") xiso.active = False previous_position = xiso.write_position
def extract_xiso(self): # get infos from ui drives = ["/c/","/e/","/f/","/g/"] filename = self.ui_entry_xiso.get_text() local_folder = self.ui_entry_folder.get_text() ftp_folder = drives[self.ui_combobox_xbox_drive.get_active()] + \ self.ui_entry_xbox_folder.get_text()
name = self.create_tmp_folder(ftp_ip,ftp_login,ftp_password,ftp_folder)
try: name = self.create_tmp_folder(ftp_ip,ftp_login,ftp_password,ftp_folder) except ExtractError, error: show_error(error.message) return
def extract_xiso(self): self.extracted_filename = None
fraction = float(xiso.write_position)/float(:xiso.iso.size)
fraction = float(xiso.write_position)/float(xiso.iso.size)
def extract_xiso(self): self.extracted_filename = None
print patterns
def on_button_xiso_browse_clicked(self, widget): patterns = [] for p in readers: patterns.extend( ["*"+i.lower() for i in p.patterns] ) patterns.extend( ["*"+i.upper() for i in p.patterns] ) print patterns dialog = CreateFileChooser(_("Open Xbox Iso"), patterns) dialog.show_all() result = dialog.run() dialog.hide_all()...
if filename == "default.xbe":
if filename.lower() == "default.xbe":
def write_file_parse(self,filename,size,sector): # do nothing but try to read name of main xbe if filename == "default.xbe": # search xbe real name self.parse_xbe(sector)
newname = self.xboxify_filename(xiso.xbe_name)
newname = xboxify_filename(xiso.xbe_name)
def extract_xiso(self): self.extracted_filename = None
gtk.glade.textdomain("gxiso") gettext.install("gxiso")
name = "gxiso" gtk.glade.bindtextdomain(name) gtk.glade.textdomain(name) gettext.install(name, unicode=1)
def find_data_dir(): # search for our data :) dir = "." # current folder if os.path.exists(os.path.join(dir,"gxiso.glade")): return dir # executable folder dir, t = os.path.split(os.path.abspath(sys.argv[0])) if os.path.exists(os.path.join(dir,"gxiso.glade")): return dir # or system folder h, t = os.path.split(dir)...
self.iso = open(iso_name, 'rb');
self.iso = file(iso_name, "rb");
def parse_internal(self,iso_name): # internal parser
if time_inactive > 5.0:
if time_inactive > 5.0 and not xiso.paused:
def extract_xiso(self): # get infos from ui drives = ["/c/","/e/","/f/","/g/"] filename = self.ui_entry_xiso.get_text() local_folder = self.ui_entry_folder.get_text() ftp_folder = drives[self.ui_combobox_xbox_drive.get_active()] + \ self.ui_entry_xbox_folder.get_text()
log( "done! (%.2f MiB/s)" % (total_size/(time.time()-progress.starttime)/(1024*1024)))
log( "done! (in %ds, %.2f MiB/s)" % (time.time()-progress.starttime,total_size/(time.time()-progress.starttime)/(1024*1024)))
def extract_xiso(self): # get infos from ui drives = ["/c/","/e/","/f/","/g/"] filename = self.ui_entry_xiso.get_text() local_folder = self.ui_entry_folder.get_text() ftp_folder = drives[self.ui_combobox_xbox_drive.get_active()] + \ self.ui_entry_xbox_folder.get_text()
def ftp_create_tmp_folder(self, ip, login, password, folder):
def ftp_create_tmp_folder(ip, login, password, folder):
def ftp_create_tmp_folder(self, ip, login, password, folder): writer = FTPWriter(ip, login, password, folder) writer.init() for i in range(1000): name = "gxiso%03d" % i if writer.mkdir(name): break; writer.close() return name
def xboxify_filename(self, filename):
def xboxify_filename(filename):
def xboxify_filename(self, filename): name = "" for c in filename: if c.isalnum(): name += c elif name[-1] != " ": name += " " name = name[:40] return name
name = self.create_tmp_folder(ftp_ip,ftp_login,ftp_password,ftp_folder)
name = ftp_create_tmp_folder(ftp_ip,ftp_login,ftp_password,ftp_folder) ftp_base_folder = ftp_folder
def extract_iso(filename, dest): filename = os.path.abspath(filename) rename = None url = urlparse(dest) if not url[0]: try: os.makedirs(url[2]) except OSError: pass writer = FileWriter(dest) else: if url[0] == "ftp": tmp, ftp_ip = url[1].split("@") ftp_login, ftp_password = tmp.split(":") ftp_folder = url[2] if ftp_...
print "'%s' '%s' '%s' '%s'" % (username, password, hostname, folder)
def extract_iso(filename, dest): filename = os.path.abspath(filename) rename = None url = urlparse(dest) if not url[0]: try: os.makedirs(url[2]) except OSError: pass writer = FileWriter(dest) else: if url[0] == "ftp": tmp, ftp_ip = url[1].split("@") ftp_login, ftp_password = tmp.split(":") ftp_folder = url[2] if ftp_...
newname = self.xboxify_filename(xiso.xbe_name)
newname = xboxify_filename(xiso.xbe_name)
def extract_iso(filename, dest): filename = os.path.abspath(filename) rename = None url = urlparse(dest) if not url[0]: try: os.makedirs(url[2]) except OSError: pass writer = FileWriter(dest) else: if url[0] == "ftp": tmp, ftp_ip = url[1].split("@") ftp_login, ftp_password = tmp.split(":") ftp_folder = url[2] if ftp_...
show_error( _("Cannot rename <i>%s</i> to <i>%s</i>") \
print "error:", ( "Cannot rename <i>%s</i> to <i>%s</i>" \
def extract_iso(filename, dest): filename = os.path.abspath(filename) rename = None url = urlparse(dest) if not url[0]: try: os.makedirs(url[2]) except OSError: pass writer = FileWriter(dest) else: if url[0] == "ftp": tmp, ftp_ip = url[1].split("@") ftp_login, ftp_password = tmp.split(":") ftp_folder = url[2] if ftp_...
show_error(error.message)
print "error:", error.message
def extract_iso(filename, dest): filename = os.path.abspath(filename) rename = None url = urlparse(dest) if not url[0]: try: os.makedirs(url[2]) except OSError: pass writer = FileWriter(dest) else: if url[0] == "ftp": tmp, ftp_ip = url[1].split("@") ftp_login, ftp_password = tmp.split(":") ftp_folder = url[2] if ftp_...
gtk.main_iteration(gtk.FALSE)
gtk.main_iteration(False)
def gtk_iteration(): # allow GTK to process events outside mainloop while gtk.events_pending(): gtk.main_iteration(gtk.FALSE)