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


Python Properties.store方法代码示例

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


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

示例1: _testParsePropertiesOutput

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
 def _testParsePropertiesOutput(self, stream):
   properties = Properties()
   properties.setProperty('Key00', 'Value00')
   properties.setProperty('Key01', 'Value01')
   properties.setProperty('Key02', 'Value02')
   properties.setProperty('Key03', 'Value03')
   properties.setProperty('Key04', 'Value04')
   properties.setProperty('Key05', 'Value05a, Value05b, Value05c')
   properties.setProperty('Key06', 'Value06a, Value06b, Value06c',)
   properties.setProperty('Key07', 'Value07b')
   properties.setProperty('Key08',
       'Value08a, Value08b, Value08c, Value08d, Value08e, Value08f')
   properties.setProperty('Key09',
       'Value09a, Value09b, Value09c, Value09d, Value09e, Value09f')
   properties.setProperty('Key10', 'Value10')
   properties.setProperty('Key11', '')
   properties.setProperty('Key12', 'Value12a, Value12b, Value12c')
   properties.setProperty('Key13', 'Value13 With Spaces')
   properties.setProperty('Key14', 'Value14 With Spaces')
   properties.setProperty('Key15', 'Value15 With Spaces')
   properties.setProperty('Key16 With Spaces', 'Value16')
   properties.setProperty('Key17 With Spaces', 'Value17')
   properties.setProperty('Key18', 'Value18 # Not a comment.')
   properties.setProperty('Key19', 'Value19 ! Not a comment.')
   properties.setProperty('Key20=WithEquals', 'Value20')
   properties.setProperty('Key21:WithColon', 'Value21')
   properties.setProperty('Key22', 'Value22')
   properties.store(stream)
开发者ID:Finntack,项目名称:pyjavaproperties,代码行数:30,代码来源:pyjavaproperties_test.py

示例2: write

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print 'Adium WARNING: "' + loadfile + '" does not exist! Reading from:'
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print '\t"' + loadfile + '"'

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.iteritems():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if 'x' in key:
                suffix2 = ''
                if '@' in key['name']:
                    suffix = re.sub('[^a-zA-Z0-9_]', '_', key['name'].split('@')[1])
                    if 'facebook' in key['name'].split('@')[1]:
                        protocolAcc = 'Facebook_'
                    elif 'gmail' in key['name'].split('@')[1]:
                        protocolAcc = 'Google_Talk_'
                        suffix2 = 'talk_google_com'
                    else:
                        protocolAcc = 'Jabber_'
                elif '@' not in key['name']:
                    if 'icq' in key['protocol']:
                        protocolAcc = 'ICQ_'
                        suffix = 'icq_com'
                    elif 'yahoo' in key['protocol']:
                        protocolAcc = 'Yahoo__'
                        suffix = 'yahoo_com'
                # Writing
                pubkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_' + suffix + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                           + '_' + suffix + '_privateKey')
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
		   
                if suffix2 != '':
                    pubkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                              + '_' + suffix2 + '_publicKey')
                    p.setProperty(pubkey, util.ExportDsaX509(key))
                    privkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_' + suffix2 + '_privateKey')
                    p.setProperty(privkey, util.ExportDsaPkcs8(key))	
		   		
        p.store(open(savefile, 'w'))
开发者ID:gitter-badger,项目名称:keysync,代码行数:60,代码来源:jitsi.py

示例3: write

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print 'Adium WARNING: "' + loadfile + '" does not exist! Reading from:'
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print '\t"' + loadfile + '"'

        propkey_base = "net.java.sip.communicator.plugin.otr."
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.iteritems():
            if "verification" in key and key["verification"] != "":
                verifiedkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey_verified"
                p[verifiedkey] = "true"
            if "y" in key:
                pubkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey"
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if "x" in key and "@" in key["name"]:
                pubkey = (
                    propkey_base
                    + "Jabber_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"].split("@")[1])
                    + "_publicKey"
                )
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (
                    propkey_base
                    + "Jabber_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"].split("@")[1])
                    + "_privateKey"
                )
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
        p.store(open(savefile, "w"))
开发者ID:rostendorf,项目名称:otrfileconverter,代码行数:43,代码来源:jitsi.py

示例4: write

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print('Jitsi NOTICE: "' + loadfile + '" does not exist! Reading from:')
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print('\t"' + loadfile + '"')

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.items():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if 'x' in key:
                protocol_id = 'UNKNOWN_'
                domain_id = 'unknown'
                servername = None
                if '@' in key['name']:
                    domainname = key['name'].split('@')[1]
                    domain_id = re.sub('[^a-zA-Z0-9_]', '_', domainname)
                    if domainname == 'chat.facebook.com':
                        protocol_id = 'Facebook_'
                    elif domainname == 'gmail.com' \
                            or domainname == 'google.com' \
                            or domainname == 'googlemail.com':
                        protocol_id = 'Google_Talk_'
                        servername = 'talk_google_com'
                    else:
                        protocol_id = 'Jabber_'
                else:
                    if key['protocol'] == 'prpl-icq':
                        protocol_id = 'ICQ_'
                        domain_id = 'icq_com'
                    elif key['protocol'] == 'prpl-yahoo':
                        protocol_id = 'Yahoo__'
                        domain_id = 'yahoo_com'
                # Writing
                pubkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_' + domain_id + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                           + '_' + domain_id + '_privateKey')
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
		   
                if servername:
                    pubkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                              + '_' + servername + '_publicKey')
                    p.setProperty(pubkey, util.ExportDsaX509(key))
                    privkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_' + servername + '_privateKey')
                    p.setProperty(privkey, util.ExportDsaPkcs8(key))	
		   		
        p.store(open(savefile, 'w'))
开发者ID:the-solipsist,项目名称:keysync,代码行数:65,代码来源:jitsi.py

示例5: len

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
import sys
import os

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print "Usage: python prop_util.py <path to runtime.properties> <mydomain replacement>"
        sys.exit(1)
    runtime_filepath = sys.argv[1]
    print "Updating %s" % runtime_filepath
    p = Properties()
    p.load(open(runtime_filepath))
    print "****Properties before****"
    p.list()
    #Add/replace environment variables that begin with v_
    for key, value in [(key[2:], os.environ[key]) for key in os.environ if key.startswith("v_")]:
        print "Adding key %s: %s" % (key, value)
        p[key] = value
    #Replace mydomain in any values
    newdomain = sys.argv[2]
    for key, value in [(key, value) for (key, value) in p.iteritems() if "mydomain.edu" in value]:
        new_value = value.replace("mydomain.edu", newdomain)
        print "Changing key %s from %s to %s" % (key, value, new_value)
        p[key] = new_value
    #Set DB values based on docker-provided environment variables
    p['VitroConnection.DataSource.url'] = "http://db:8111/v1/graphs/sparql"
    p['VitroConnection.DataSource.username'] = 'admin'
    p['VitroConnection.DataSource.password'] = 'admin'
    print "****Properties after****"
    p.list()
    p.store(open(runtime_filepath,'w'))
开发者ID:patrickmcelwee,项目名称:vivo-marklogic-docker,代码行数:32,代码来源:prop_util.py

示例6: write

# 需要导入模块: from pyjavaproperties import Properties [as 别名]
# 或者: from pyjavaproperties.Properties import store [as 别名]
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print('Jitsi NOTICE: "' + loadfile + '" does not exist! Reading from:')
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print('\t"' + loadfile + '"')

        propkey_base = "net.java.sip.communicator.plugin.otr."
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.items():
            if "verification" in key and key["verification"] != "":
                verifiedkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey_verified"
                p[verifiedkey] = "true"
            if "y" in key:
                pubkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey"
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
            if "x" in key:
                protocol_id = "UNKNOWN_"
                domain_id = "unknown"
                servername = None
                if "@" in key["name"]:
                    domainname = key["name"].split("@")[1]
                    domain_id = re.sub("[^a-zA-Z0-9_]", "_", domainname)
                    if domainname == "chat.facebook.com":
                        protocol_id = "Facebook_"
                    elif domainname == "gmail.com" or domainname == "google.com" or domainname == "googlemail.com":
                        protocol_id = "Google_Talk_"
                        servername = "talk_google_com"
                    else:
                        protocol_id = "Jabber_"
                else:
                    if key["protocol"] == "prpl-icq":
                        protocol_id = "ICQ_"
                        domain_id = "icq_com"
                    elif key["protocol"] == "prpl-yahoo":
                        protocol_id = "Yahoo__"
                        domain_id = "yahoo_com"
                # Writing
                pubkey = (
                    propkey_base
                    + protocol_id
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + domain_id
                    + "_publicKey"
                )
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                privkey = (
                    propkey_base
                    + protocol_id
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + domain_id
                    + "_privateKey"
                )
                p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

                if servername:
                    pubkey = (
                        propkey_base
                        + protocol_id
                        + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                        + "_"
                        + servername
                        + "_publicKey"
                    )
                    p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                    privkey = (
                        propkey_base
                        + protocol_id
                        + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                        + "_"
                        + servername
                        + "_privateKey"
                    )
                    p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

        p.store(open(savefile, "w"))
开发者ID:abeluck,项目名称:keysync,代码行数:85,代码来源:jitsi.py


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