• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python core.Observable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中meresco.core.Observable的典型用法代码示例。如果您正苦于以下问题:Python Observable类的具体用法?Python Observable怎么用?Python Observable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Observable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, count, field, allowOverrideField=False, maximumCount=None, suggestMode=None):
     Observable.__init__(self)
     self._count = count
     self._field = field
     self._suggestMode = suggestMode
     self._allowOverrideField = allowOverrideField
     self._maximumCount = maximumCount
开发者ID:seecr,项目名称:meresco-components,代码行数:7,代码来源:suggestion.py


示例2: __init__

 def __init__(self, name, settings, host=None, port=None, readonly=False, **kwargs):
     Observable.__init__(self, name=name)
     self._host, self._port = host, port
     self.settings = settings
     self._fieldRegistry = settings.fieldRegistry
     self._name = name
     self._readonly = readonly
开发者ID:seecr,项目名称:meresco-lucene,代码行数:7,代码来源:_lucene.py


示例3: testProvenance

    def testProvenance(self):
        observable = Observable()
        provenance = OaiProvenance(
            nsMap = {'oai_dc': "http://www.openarchives.org/OAI/2.0/"},
            baseURL = ('meta', '/meta/repository/baseurl/text()'),
            harvestDate = ('meta', '/meta/repository/harvestDate/text()'),
            metadataNamespace = ('meta', '/meta/repository/metadataNamespace/text()'),
            identifier = ('header','/oai_dc:header/oai_dc:identifier/text()'),
            datestamp = ('header', '/oai_dc:header/oai_dc:datestamp/text()')
        )
        observable.addObserver(provenance)
        observer = MockStorage()
        provenance.addObserver(observer)

        result = asString(observable.any.provenance("recordId"))
        self.assertEqualsWS("""<provenance xmlns="http://www.openarchives.org/OAI/2.0/provenance"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/provenance
                      http://www.openarchives.org/OAI/2.0/provenance.xsd">

<originDescription harvestDate="HARVESTDATE" altered="true">
  <baseURL>BASEURL</baseURL>
  <identifier>recordId</identifier>
  <datestamp>DATESTAMP</datestamp>
  <metadataNamespace>METADATANAMESPACE</metadataNamespace>
</originDescription>
</provenance>""", result)
开发者ID:seecr,项目名称:meresco-oai,代码行数:27,代码来源:oaiprovenancetest.py


示例4: __init__

 def __init__(self, reactor, conversion=None, **kwargs):
     Observable.__init__(self, **kwargs)
     self._conversion = Conversion() if conversion is None else conversion
     self._dynamicHtml = DynamicHtml([dynamicPath],
             reactor=reactor,
             notFoundPage='notFound',
             additionalGlobals={
                 'VERSION': version,
                 'allCoreInfo': self._allCoreInfo,
                 'parseCql': parseString,
                 'cqlToExpression': cqlToExpression,
                 'cql2string': cql2string,
                 'dumps': dumps,
             }
         )
     self._internalTree = be((Observable(),
         (PathFilter('/', excluding=['/static', '/version']),
             (self._dynamicHtml,)
         ),
         (PathFilter('/static'),
             (PathRename(lambda path: path[len('/static'):]),
                 (FileServer(staticPath),)
             )
         ),
         (PathFilter('/version'),
             (StringServer("Meresco Lucene version %s" % version, ContentTypePlainText),)
         ),
     ))
开发者ID:seecr,项目名称:meresco-lucene,代码行数:28,代码来源:_service.py


示例5: testOne

    def testOne(self):
        observable = Observable()
        bitMatrixRow = CallTrace('BitMatrixRow')
        multi = MultiLevelDrilldown(
            {'date':[('datelevel1', 10, False)]}
        )
        drilldown = CallTrace('Drilldown')
        def dd(*args, **kwargs):
            raise StopIteration(iter([('datelevel1', iter([('2008',13),('2007',10)]))]))
            yield
        drilldown.methods['drilldown'] = dd
        multi.addObserver(drilldown)
        observable.addObserver(multi)

        result = list(compose(observable.call.multiLevelDrilldown(bitMatrixRow, ['date'])))

        self.assertEquals(1, len(drilldown.calledMethods))
        drilldownMethod = drilldown.calledMethods[0]
        self.assertEquals('drilldown', drilldownMethod.name)
        self.assertEquals((bitMatrixRow, [('datelevel1', 10, False)]), drilldownMethod.args)
        self.assertEquals(1, len(result))
        (inputFieldName, realFieldName), termCounts = result[0]
        self.assertEquals('date', inputFieldName)
        self.assertEquals('datelevel1', realFieldName)
        self.assertEquals([('2008',13),('2007',10)], list(termCounts))
开发者ID:seecr,项目名称:meresco-components,代码行数:25,代码来源:multileveldrilldowntest.py


示例6: __init__

 def __init__(self, host=None, port=None, core=None):
     Observable.__init__(self)
     self._host = host
     self._port = port
     self._core = core
     if core is not None:
         self.observable_name = lambda: core
开发者ID:seecr,项目名称:meresco-solr,代码行数:7,代码来源:solrinterface.py


示例7: testRemoteExecuteQuery

    def testRemoteExecuteQuery(self):
        http = CallTrace('http')
        def httppost(*args, **kwargs):
            raise StopIteration('HTTP/1.0 200 Ok\r\n\r\n%s' % LuceneResponse(total=5, hits=[Hit("1"), Hit("2"), Hit("3", duplicateCount=2), Hit("4"), Hit("5")]).asJson())
            yield
        http.methods['httppost'] = httppost
        remote = LuceneRemote(host='host', port=1234, path='/path')
        observable = Observable()
        observable.addObserver(remote)
        remote._httppost = http.httppost

        cq = ComposedQuery('coreA')
        cq.setCoreQuery(
                core='coreA',
                query=parseString('query AND  field=value'),
                filterQueries=[parseString('query=fiets')],
                facets=[{'fieldname': 'field', 'maxTerms':5}],
            )
        cq.setCoreQuery(core='coreB', query=parseString('query=test'))
        cq.addMatch(dict(core='coreA', uniqueKey='keyA'), dict(core='coreB', key='keyB'))
        result = returnValueFromGenerator(observable.any.executeComposedQuery(query=cq))
        self.assertEquals(5, result.total)
        self.assertEquals([Hit("1"), Hit("2"), Hit("3", duplicateCount=2), Hit("4"), Hit("5")], result.hits)

        self.assertEquals(['httppost'], http.calledMethodNames())
        m = http.calledMethods[0]
        self.assertEquals('host', m.kwargs['host'])
        self.assertEquals(1234, m.kwargs['port'])
        self.assertEquals('/path/__lucene_remote__', m.kwargs['request'])
        self.assertEquals('application/json', m.kwargs['headers']['Content-Type'])
        message, kwargs = Conversion().jsonLoadMessage(m.kwargs['body'])
        query = kwargs['query']
        self.assertEquals('executeComposedQuery', message)
        self.assertEquals('coreA', query.resultsFrom)
        self.assertEquals([{'fieldname': 'field', 'maxTerms':5}], query.facetsFor('coreA'))
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:35,代码来源:luceneremotetest.py


示例8: __init__

 def __init__(self, host=None, port=None, path=None, name=None, conversion=None):
     Observable.__init__(self, name=name)
     self._host = host
     self._port = port
     self._path = '' if path is None else path
     self._path += '/__lucene_remote__'
     self._conversion = Conversion() if conversion is None else conversion
开发者ID:FashtimeDotCom,项目名称:meresco-lucene,代码行数:7,代码来源:_remote.py


示例9: __init__

 def __init__(self, searchApiBaseUrl='https://api.histograph.io/search', **kwargs):
     Observable.__init__(self, **kwargs)
     parsedUrl = parseAbsoluteUrl(searchApiBaseUrl)
     self._host = parsedUrl.host
     self._port = parsedUrl.port
     self._path = parsedUrl.path
     self._ssl = (parsedUrl.scheme == 'https')
开发者ID:seecr,项目名称:dc-erfgeo-enrich,代码行数:7,代码来源:erfgeoquery.py


示例10: __init__

 def __init__(self, reactor, host=None, port=None, period=None, verbose=None, prio=None, name=None, err=None, autoStart=True, schedule=None, retryAfterErrorTime=30, compress=True):
     Observable.__init__(self, name=name)
     self._reactor = reactor
     self._host = host
     self._port = port
     self._schedule = schedule
     if schedule is None:
         if period is None:
             period = 1
         else:
             warn("Please use schedule instead of period.", DeprecationWarning) # since 2013-02-20
         self._schedule = Schedule(period=period)
     elif not period is None:
         raise ValueError("Using both schedule and period is invalid")
     self._prio = prio
     self._err = err or sys.stderr
     self._paused = not autoStart
     self._currentTimer = None
     self._currentProcess = None
     self._sok = None
     self._errorState = None
     self._retryAfterErrorTime = retryAfterErrorTime
     self._compress = compress
     if autoStart and (not self._host or not self._port):
         raise ValueError("Unless autoStart is set to False host and port need to be specified.")
     if verbose in [True, False]:
         warn('Verbose flag is deprecated', DeprecationWarning)
开发者ID:seecr,项目名称:meresco-components,代码行数:27,代码来源:periodicdownload.py


示例11: __init__

 def __init__(self, partName, namespace=None):
     Observable.__init__(self)
     if not correctNameRe.match(partName):
         raise Fields2XmlException('Invalid name: "%s"' % partName)
     self._identifier = None
     self._partName = partName
     self._namespace = namespace
开发者ID:seecr,项目名称:meresco-components,代码行数:7,代码来源:fields2xml.py


示例12: __init__

 def __init__(self, serviceIdentifier, periodicDownloadName, sourceServiceType, sourceServiceIdentifier=None, pollIntervalConfigSelector=None, name=None, **kwargs):
     Observable.__init__(self, name)
     self._serviceIdentifier = serviceIdentifier
     self._periodicDownloadName = periodicDownloadName
     self._pollIntervalConfigSelector = pollIntervalConfigSelector or oaiDownloadConfigSelector
     self._sourceServiceType = sourceServiceType
     self._sourceServiceIdentifier = sourceServiceIdentifier
     self._extraKwargs = kwargs
开发者ID:seecr,项目名称:meresco-distributed,代码行数:8,代码来源:updateperiodicdownload.py


示例13: __init__

 def __init__(self, allowed=None, disallowed=None, **kwargs):
     Observable.__init__(self, **kwargs)
     if allowed and not disallowed:
         self._allowedMessage = lambda message: message in allowed
     elif disallowed and not allowed:
         self._allowedMessage = lambda message: message not in disallowed
     else:
         raise ValueError('Use disallowed or allowed')
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:filtermessages.py


示例14: __init__

 def __init__(self, included=None, excluded=None):
     Observable.__init__(self)
     if included and excluded or not (included or excluded):
         raise ValueError("Use included OR excluded")
     if included:
         self._allowed = lambda name: name in included
     else:
         self._allowed = lambda name: not name in excluded
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:filterdatabyname.py


示例15: __init__

 def __init__(self, attributeXpaths=None, namespaceMap=None, sendAsList=False, namespaces=None):
     Observable.__init__(self)
     self._attributeXpaths = attributeXpaths or []
     self._sendAsList = sendAsList
     if namespaceMap:
         warn("Please use 'namespaces=...'", DeprecationWarning)
         namespaces=namespaceMap
     self.xpath = _namespaces.copyUpdate(namespaces or {}).xpath
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:xpath2field.py


示例16: __init__

 def __init__(self, should=None, could=None, namespaces=None, namespaceMap=None):
     Observable.__init__(self)
     if namespaceMap:
         warn("Please use 'namespaces=...'", DeprecationWarning)
         namespaces=namespaceMap
     self.xpath = _namespaces.copyUpdate(namespaces or {}).xpath
     self._should = _init(should)
     self._could = _init(could)
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:venturi.py


示例17: __init__

 def __init__(self, home="/", name=None):
     Observable.__init__(self, name=name)
     self._home = home
     self._actions = {
         'create': self.handleCreate,
         'update': self.handleUpdate,
         'delete': self.handleDelete,
     }
开发者ID:CatchPlus,项目名称:OAS-Open-Annotation-Service,代码行数:8,代码来源:dashboard.py


示例18: __init__

 def __init__(self, name=None, stderr=stderr, sendRecordData=True, logErrors=True, enableCollectLog=False):
     Observable.__init__(self, name=name)
     self._stderr = stderr
     self._logErrors = logErrors
     self._sendRecordData = sendRecordData
     self._collectLogForScope = lambda **kwargs: None
     if enableCollectLog:
         self._collectLogForScope = collectLogForScope
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:srurecordupdate.py


示例19: __init__

 def __init__(self, title, description, link, antiUnaryClause='', **sruArgs):
     Observable.__init__(self)
     self._title = title
     self._description = description
     self._link = link
     self._antiUnaryClause = antiUnaryClause
     self._sortKeys = sruArgs.get('sortKeys', None)
     self._maximumRecords = sruArgs.get('maximumRecords', 10)
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:rss.py


示例20: __init__

 def __init__(self, log=None, scopeNames=None, argumentsSelection=None, numberOfRecordsSelection=None, **kwargs):
     Observable.__init__(self, **kwargs)
     self._log = self.call if log is None else log
     self._scopeNames = () if scopeNames is None else scopeNames
     self._argumentSelectionScope = 'sru' if argumentsSelection is None else argumentsSelection['scope']
     self._argumentSelectionKey = 'arguments' if argumentsSelection is None else argumentsSelection['key']
     self._numberOfRecordsSelectionScope = 'sru' if numberOfRecordsSelection is None else numberOfRecordsSelection['scope']
     self._numberOfRecordsSelectionKey = 'numberOfRecords' if numberOfRecordsSelection is None else numberOfRecordsSelection['key']
开发者ID:seecr,项目名称:meresco-components,代码行数:8,代码来源:querylogwriter.py



注:本文中的meresco.core.Observable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python html.DynamicHtml类代码示例发布时间:2022-05-27
下一篇:
Python sru.SruHandler类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap