def lookup(name): """ Static method that looks up a process by name. The *name* parameter is specified as a tuple of (prefix, localName): >>> p = Process.lookup(('gs', 'Snap')) >>> p.description Snap to the nearest feature *name* may also be specified as a colon delimited string: >>> p = Process.lookup('gs:Snap') >>> p.description Snap to the nearest feature """ n = Name(*name) if isinstance(name,(tuple,list)) else Name(*name.split(':')) pf = Processors.createProcessFactory(n) if pf: p = Process(pf.create(n)) p.name = name p.title = pf.getTitle(n) p.description = pf.getDescription(n) params = pf.getParameterInfo(n) p._params = params p.inputs = _params(params) p.outputs = _params(pf.getResultInfo(n, params)) return p
def lookup(name): """ Static method that looks up a process by name. The *name* parameter is specified as a tuple of (prefix, localName): >>> p = Process.lookup(('geo', 'splitPolygon')) >>> p.description Splits a polygon by a linestring *name* may also be specified as a colon delimited string: >>> p = Process.lookup('geo:splitPolygon') >>> p.description Splits a polygon by a linestring """ n = Name(*name) if isinstance(name,(tuple,list)) else Name(*name.split(':')) pf = Processors.createProcessFactory(n) if pf: p = Process(pf.create(n)) p.name = name p.title = pf.getTitle(n) p.description = pf.getDescription(n) params = pf.getParameterInfo(n) p._params = params p.inputs = _params(params) p.outputs = _params(pf.getResultInfo(n, params)) return p
def list(): """ Static method that returns a generator over the list of known process names. Each element is returned as a tuple of (prefix, localName). """ for pf in Processors.getProcessFactories(): for n in pf.getNames(): yield (n.namespaceURI, n.localPart)