当前位置: 首页>>代码示例>>Python>>正文


Python util.HashMap方法代码示例

本文整理汇总了Python中java.util.HashMap方法的典型用法代码示例。如果您正苦于以下问题:Python util.HashMap方法的具体用法?Python util.HashMap怎么用?Python util.HashMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util的用法示例。


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

示例1: setRequestScopedParameters

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def setRequestScopedParameters(self, identity, step):
        downloadMap = HashMap()
        if self.registrationUri != None:
            identity.setWorkingParameter("external_registration_uri", self.registrationUri)

        if self.androidUrl!= None and step == 1:
            downloadMap.put("android", self.androidUrl)

        if self.IOSUrl  != None and step == 1:
            downloadMap.put("ios", self.IOSUrl)

        if self.customLabel != None:
            identity.setWorkingParameter("super_gluu_label", self.customLabel)

        identity.setWorkingParameter("download_url",downloadMap)
        identity.setWorkingParameter("super_gluu_qr_options", self.customQrOptions) 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:18,代码来源:casa-external_super_gluu.py

示例2: setRequestScopedParameters

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def setRequestScopedParameters(self, identity, step):
        downloadMap = HashMap()
        if self.registrationUri != None:
            identity.setWorkingParameter("external_registration_uri", self.registrationUri)

        if self.androidUrl!= None and step == 1:
            downloadMap.put("android", self.androidUrl)

        if self.IOSUrl  != None and step == 1:
            downloadMap.put("ios", self.IOSUrl)
            
        if self.customLabel != None:
            identity.setWorkingParameter("super_gluu_label", self.customLabel)
            
        identity.setWorkingParameter("download_url", downloadMap)
        identity.setWorkingParameter("super_gluu_qr_options", self.customQrOptions) 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:18,代码来源:SuperGluuExternalAuthenticator.py

示例3: createNewAuthenticatedSession

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def createNewAuthenticatedSession(self, context, customParameters={}):
        sessionIdService = CdiUtil.bean(SessionIdService)

        user = context.getUser()
        client = CdiUtil.bean(Identity).getSessionClient().getClient()

        # Add mandatory session parameters
        sessionAttributes = HashMap()
        sessionAttributes.put(Constants.AUTHENTICATED_USER, user.getUserId())
        sessionAttributes.put(AuthorizeRequestParam.CLIENT_ID, client.getClientId())
        sessionAttributes.put(AuthorizeRequestParam.PROMPT, "")

        # Add custom session parameters
        for key, value in customParameters.iteritems():
            if StringHelper.isNotEmpty(value):
                sessionAttributes.put(key, value)

        # Generate authenticated session
        sessionId = sessionIdService.generateAuthenticatedSessionId(context.getHttpRequest(), user.getDn(), sessionAttributes)

        print "ROPC script. Generated session id. DN: '%s'" % sessionId.getDn()

        return sessionId 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:25,代码来源:resource_owner_password_credentials_custom_params.py

示例4: getConfigurationAttributes

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def getConfigurationAttributes(self, acr, scriptsList):

        configMap = HashMap()
        for customScript in scriptsList:
            if customScript.getName() == acr and customScript.isEnabled():
                for prop in customScript.getConfigurationProperties():
                    configMap.put(prop.getValue1(), SimpleCustomProperty(prop.getValue1(), prop.getValue2()))

        print "Casa. getConfigurationAttributes. %d configuration properties were found for %s" % (configMap.size(), acr)
        return configMap 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:12,代码来源:Casa.py

示例5: new_unauthenticated_session

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def new_unauthenticated_session(self,user,client):
        sessionIdService = CdiUtil.bean(SessionIdService)
        authDate = Date()
        sid_attrs = HashMap()
        sid_attrs.put(Constants.AUTHENTICATED_USER,user.getUserId())
        sid_attrs.put(self.clientIdSessionParamName,client.getClientId())
        sessionId = sessionIdService.generateUnauthenticatedSessionId(user.getDn(),authDate,SessionIdState.UNAUTHENTICATED,sid_attrs,True)
        print "Super-Gluu-RO. Generated session id. DN: '%s'" % sessionId.getDn()
        return sessionId 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:11,代码来源:super_gluu_ro.py

示例6: event_generator

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def event_generator():
    global now
     for i in xrange(100):
         runtime.sendEvent(CurrentTimeEvent(int(now.total_seconds() * 1000)))
         evt = HashMap()
         evt.put("time", int(now.total_seconds() * 1000))
         evt.put("item", "TestItem")
         evt.put("state", "ON")
         yield evt, "UpdateEvent"
         now += timedelta(seconds=random * 0.4) 
开发者ID:openhab-scripters,项目名称:openhab-helper-libraries,代码行数:12,代码来源:example3.py

示例7: tick_generator

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def tick_generator():
    for i in xrange(10):
        tick = HashMap()
        tick.put("time", datetime.now())
        tick.put("price", 5.3 + random())
        tick.put("symbol", "AAPL")
        yield tick 
开发者ID:openhab-scripters,项目名称:openhab-helper-libraries,代码行数:9,代码来源:example2.py

示例8: test_map_delegation

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_map_delegation(self):
        m = HashMap()
        m["a"] = "b"
        self.assertTrue("a" in m)
        self.assertEquals("b", m["a"])
        n = 0
        for k in m:
            n += 1
            self.assertEquals("a", k)
        self.assertEquals(1, n)
        del m["a"]
        self.assertEquals(0, len(m)) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:14,代码来源:test_java_integration.py

示例9: get_doc_phrase_freq

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def get_doc_phrase_freq(self, phrase, field, slop, ordered):
        """
        Returns collection frequency for a given phrase and field.

        :param phrase: str
        :param field: field name
        :param slop: number of terms in between
        :param ordered: If true, term occurrences should be ordered
        :return: dictionary {doc: freq, ...}
        """
        # creates span near query
        span_near_query = self.get_span_query(phrase.split(" "), field, slop=slop, ordered=ordered)

        # extracts document frequency
        self.open_searcher()
        index_reader_context = self.searcher.getTopReaderContext()
        term_contexts = HashMap()
        terms = TreeSet()
        span_near_query.extractTerms(terms)
        for term in terms:
            term_contexts.put(term, TermContext.build(index_reader_context, term))
        leaves = index_reader_context.leaves()
        doc_phrase_freq = {}
        # iterates over all atomic readers
        for atomic_reader_context in leaves:
            bits = atomic_reader_context.reader().getLiveDocs()
            spans = span_near_query.getSpans(atomic_reader_context, bits, term_contexts)
            while spans.next():
                lucene_doc_id = spans.doc()
                doc_id = atomic_reader_context.reader().document(lucene_doc_id).get(self.FIELDNAME_ID)
                if doc_id not in doc_phrase_freq:
                    doc_phrase_freq[doc_id] = 1
                else:
                    doc_phrase_freq[doc_id] += 1
        return doc_phrase_freq 
开发者ID:hasibi,项目名称:EntityLinkingRetrieval-ELR,代码行数:37,代码来源:lucene_tools.py

示例10: test_dict_slot_subclass_java_hashmap

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_dict_slot_subclass_java_hashmap(self):
        C = self.make_class(HashMap, "__dict__")
        # has everything in a HashMap, including Python semantic equivalence
        c = C({"a": 1, "b": 2})
        self.assertTrue(c.containsKey("a"))
        self.assertEqual(sorted(c.iteritems()), [("a", 1), ("b", 2)])
        # but also has a __dict__ slot for further interesting ;) possibilities
        self.assertIn("__dict__", dir(c))
        self.assertIn("x", dir(c))
        self.assertIn("y", dir(c))
        self.assertEqual(c.__dict__.get("x"), 42)
        self.assertEqual(c.x, 42)
        self.assertEqual(c.y, 47)
        with self.assertRaisesRegexp(AttributeError, r"'C' object has no attribute 'z'"):
            c.z 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:17,代码来源:test_slots_jy.py

示例11: test_weakref_slot

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_weakref_slot(self):
        self.assertNotIn("__weakref__", dir(object()))
        self.assertIn("__weakref__", dir(self.make_class(object, "__weakref__")()))
        class B(object):
            pass
        self.assertIn("__weakref__", dir(B()))
        self.assertIn("__weakref__", dir(self.make_class(B, "__weakref__")()))
        self.assertNotIn("__weakref__", dir("abc"))
        self.assertIn("__weakref__", dir(self.make_class(str, "__weakref__")()))
        self.assertNotIn("__weakref__", dir(HashMap()))
        self.assertIn("__weakref__", dir(self.make_class(HashMap, "__weakref__")())) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:13,代码来源:test_slots_jy.py

示例12: test_hashmap

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_hashmap(self):
        x = HashMap()
        x.put('a', 1)
        x.put('b', 2)
        x.put('c', 3)
        x.put((1,2), "xyz")
        y = dict(x)
        self.assertEqual(set(y.items()), set([('a', 1), ('b', 2), ('c', 3), ((1,2), "xyz")])) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:10,代码来源:test_dict_jy.py

示例13: test_hashmap_builtin_pymethods

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_hashmap_builtin_pymethods(self):
        x = HashMap()
        x['a'] = 1
        x[(1, 2)] = 'xyz'
        self.assertEqual({tup for tup in x.iteritems()}, {('a', 1), ((1, 2), 'xyz')})
        self.assertEqual({tup for tup in x.itervalues()}, {1, 'xyz'})
        self.assertEqual({tup for tup in x.iterkeys()}, {'a', (1, 2)})
        self.assertEqual(str(x), repr(x))
        self.assertEqual(type(str(x)), type(repr(x))) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:11,代码来源:test_dict_jy.py

示例14: test_hashtable_equal

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def test_hashtable_equal(self):
        for d in ({}, {1:2}):
            x = Hashtable(d)
            self.assertEqual(x, d)
            self.assertEqual(d, x)
            self.assertEqual(x, HashMap(d)) 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:8,代码来源:test_dict_jy.py

示例15: __init__

# 需要导入模块: from java import util [as 别名]
# 或者: from java.util import HashMap [as 别名]
def __init__(self,
                 index_dir,
                 search_fields=['canonical_url', 'title', 'meta', 'content'],
                 unique_field='uq_id_str',
                 boost=dict(
                     canonical_url=4.0, title=8.0, meta=2.0, content=1.0),
                 date_format='%Y-%m-%dT%H:%M:%S'):
        """Constructor of Searcher.

        Parameters
        ----------
        index_dir : string
            The location of lucene index.
        search_fields : list
            A list of field names indicating fields to search on.
        unique_field : string
            The field name, on which the duplication should avoid.
        boost : dict
            This dict control the weight when computing score.
        date_format : string
            Convert the string into datetime. Should consistent with the
            index part.
        """
        self.index_dir = index_dir
        self.search_fields = search_fields
        self.sort_by_recent = Sort(
            SortField('date_published', SortField.Type.STRING, True))
        self.store = FSDirectory.open(Paths.get(index_dir))
        self.reader = DirectoryReader.open(self.store)
        self.isearcher = IndexSearcher(self.reader)
        self.analyzer = StandardAnalyzer()
        self.boost_map = HashMap()
        for k, v in boost.items():
            self.boost_map.put(k, Float(v))
        self.mul_parser = MultiFieldQueryParser(search_fields, self.analyzer,
                                                self.boost_map)
        self.date_format = date_format 
开发者ID:IUNetSci,项目名称:hoaxy-backend,代码行数:39,代码来源:search.py


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