當前位置: 首頁>>代碼示例>>Python>>正文


Python Properties.items方法代碼示例

本文整理匯總了Python中pyjavaproperties.Properties.items方法的典型用法代碼示例。如果您正苦於以下問題:Python Properties.items方法的具體用法?Python Properties.items怎麽用?Python Properties.items使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyjavaproperties.Properties的用法示例。


在下文中一共展示了Properties.items方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse

# 需要導入模塊: from pyjavaproperties import Properties [as 別名]
# 或者: from pyjavaproperties.Properties import items [as 別名]
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = JitsiProperties.path
        p = Properties()
        p.load(open(os.path.join(settingsdir, JitsiProperties.propertiesfile)))
        keydict = dict()
        for item in p.items():
            propkey = item[0]
            name = ""
            if re.match("net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc[0-9]+\.ACCOUNT_UID", propkey):
                name = JitsiProperties._parse_account_uid(item[1])
                if name in keydict:
                    key = keydict[name]
                else:
                    key = dict()
                    key["name"] = name
                    key["protocol"] = "prpl-jabber"
                    keydict[name] = key

                propkey_base = "net.java.sip.communicator.plugin.otr." + re.sub("[^a-zA-Z0-9_]", "_", item[1])
                private_key = p.getProperty(propkey_base + "_privateKey").strip()
                public_key = p.getProperty(propkey_base + "_publicKey").strip()
                numdict = util.ParsePkcs8(private_key)
                key["x"] = numdict["x"]
                numdict = util.ParseX509(public_key)
                for num in ("y", "g", "p", "q"):
                    key[num] = numdict[num]
                key["fingerprint"] = util.fingerprint((key["y"], key["g"], key["p"], key["q"]))
                verifiedkey = (
                    "net.java.sip.communicator.plugin.otr."
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_publicKey_verified"
                )
                if p.getProperty(verifiedkey).strip() == "true":
                    key["verification"] = "verified"
            elif re.match("net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey_verified", propkey):
                name, protocol = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name != None:
                    if name not in keydict:
                        key = dict()
                        key["name"] = name
                        keydict[name] = key
                    if protocol and "protocol" not in keydict[name]:
                        keydict[name]["protocol"] = protocol
                    keydict[name]["verification"] = "verified"
            # if the protocol name is included in the property name, its a local account with private key
            elif re.match("net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey", propkey) and not re.match(
                "net\.java\.sip\.communicator\.plugin\.otr\.(Jabber_|Google_Talk_)", propkey
            ):
                name, ignored = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name not in keydict:
                    key = dict()
                    key["name"] = name
                    key["protocol"] = "prpl-jabber"
                    keydict[name] = key
                numdict = util.ParseX509(item[1])
                for num in ("y", "g", "p", "q"):
                    key[num] = numdict[num]
                key["fingerprint"] = util.fingerprint((key["y"], key["g"], key["p"], key["q"]))
        return keydict
開發者ID:rostendorf,項目名稱:otrfileconverter,代碼行數:62,代碼來源:jitsi.py

示例2: _testParsePropertiesInput

# 需要導入模塊: from pyjavaproperties import Properties [as 別名]
# 或者: from pyjavaproperties.Properties import items [as 別名]
 def _testParsePropertiesInput(self, stream):
   properties = Properties()
   properties.load(stream)
   self.assertEquals(23, len(properties.items()))
   self.assertEquals('Value00', properties['Key00'])
   self.assertEquals('Value01', properties['Key01'])
   self.assertEquals('Value02', properties['Key02'])
   self.assertEquals('Value03', properties['Key03'])
   self.assertEquals('Value04', properties['Key04'])
   self.assertEquals('Value05a, Value05b, Value05c', properties['Key05'])
   self.assertEquals('Value06a, Value06b, Value06c', properties['Key06'])
   self.assertEquals('Value07b', properties['Key07'])
   self.assertEquals(
       'Value08a, Value08b, Value08c, Value08d, Value08e, Value08f',
       properties['Key08'])
   self.assertEquals(
       'Value09a, Value09b, Value09c, Value09d, Value09e, Value09f',
       properties['Key09'])
   self.assertEquals('Value10', properties['Key10'])
   self.assertEquals('', properties['Key11'])
   self.assertEquals('Value12a, Value12b, Value12c', properties['Key12'])
   self.assertEquals('Value13 With Spaces', properties['Key13'])
   self.assertEquals('Value14 With Spaces', properties['Key14'])
   self.assertEquals('Value15 With Spaces', properties['Key15'])
   self.assertEquals('Value16', properties['Key16 With Spaces'])
   self.assertEquals('Value17', properties['Key17 With Spaces'])
   self.assertEquals('Value18 # Not a comment.', properties['Key18'])
   self.assertEquals('Value19 ! Not a comment.', properties['Key19'])
   self.assertEquals('Value20', properties['Key20=WithEquals'])
   self.assertEquals('Value21', properties['Key21:WithColon'])
   self.assertEquals('Value22', properties['Key22'])
開發者ID:Finntack,項目名稱:pyjavaproperties,代碼行數:33,代碼來源:pyjavaproperties_test.py

示例3: parse

# 需要導入模塊: from pyjavaproperties import Properties [as 別名]
# 或者: from pyjavaproperties.Properties import items [as 別名]
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = JitsiProperties.path
        p = Properties()
        p.load(open(os.path.join(settingsdir, JitsiProperties.propertiesfile)))
        keydict = dict()
        for item in p.items():
            propkey = item[0]
            name = ''
            if re.match('net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc[0-9]+\.ACCOUNT_UID', propkey):
                name = JitsiProperties._parse_account_uid(item[1])
                if name in keydict:
                    key = keydict[name]
                else:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key

                propkey_base = ('net.java.sip.communicator.plugin.otr.'
                                + re.sub('[^a-zA-Z0-9_]', '_', item[1]))
                private_key = p.getProperty(propkey_base + '_privateKey').strip()
                public_key = p.getProperty(propkey_base + '_publicKey').strip()
                numdict = util.ParsePkcs8(private_key)
                key['x'] = numdict['x']
                numdict = util.ParseX509(public_key)
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint((key['y'], key['g'], key['p'], key['q']))
                verifiedkey = ('net.java.sip.communicator.plugin.otr.'
                               + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                if p.getProperty(verifiedkey).strip() == 'true':
                    key['verification'] = 'verified'
            elif (re.match('net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey_verified', propkey)):
                name, protocol = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name != None:
                    if name not in keydict:
                        key = dict()
                        key['name'] = name
                        keydict[name] = key
                    if protocol and 'protocol' not in keydict[name]:
                        keydict[name]['protocol'] = protocol
                    keydict[name]['verification'] = 'verified'
            # if the protocol name is included in the property name, its a local account with private key
            elif (re.match('net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey', propkey) and not
                  re.match('net\.java\.sip\.communicator\.plugin\.otr\.(Jabber_|Google_Talk_)', propkey)):
                name, ignored = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name not in keydict:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key
                numdict = util.ParseX509(item[1])
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint((key['y'], key['g'], key['p'], key['q']))
        return keydict
開發者ID:the-solipsist,項目名稱:keysync,代碼行數:60,代碼來源:jitsi.py

示例4: get_dependency_projects

# 需要導入模塊: from pyjavaproperties import Properties [as 別名]
# 或者: from pyjavaproperties.Properties import items [as 別名]
def get_dependency_projects():
    if os.path.exists(project_filename):
        with open(project_filename) as fsock:
            properties = Properties()
            properties.load(fsock)

            project  = re.compile(r'android.library.reference.\d+')
            return (value for key, value in properties.items() if project.match(key))
    else:
        return []
開發者ID:HuangWenhuan0,項目名稱:email-build,代碼行數:12,代碼來源:util.py


注:本文中的pyjavaproperties.Properties.items方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。