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


Python Configuration.load方法代码示例

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


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

示例1: _generateArtifactList

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
def _generateArtifactList(options):
    # load configuration
    logging.info("Loading configuration...")
    config = Configuration()
    config.load(options)

    # build list
    logging.info("Building artifact list...")
    listBuilder = ArtifactListBuilder(config)
    artifactList = listBuilder.buildList()

    logging.debug("Generated list contents:")
    for gat in artifactList:
        priorityList = artifactList[gat]
        for priority in priorityList:
            versionList = priorityList[priority]
            for version in versionList:
                logging.debug("  %s:%s", gat, version)

    #filter list
    logging.info("Filtering artifact list...")
    listFilter = Filter(config)
    artifactList = listFilter.filter(artifactList)

    logging.debug("Filtered list contents:")
    for gat in artifactList:
        priorityList = artifactList[gat]
        for priority in priorityList:
            versionList = priorityList[priority]
            for version in versionList:
                logging.debug("  %s:%s", gat, version)

    logging.info("Artifact list generation done")
    return artifactList
开发者ID:pgier,项目名称:maven-repository-builder,代码行数:36,代码来源:artifact_list_generator.py

示例2: Kobol

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
class Kobol(object):

  def __init__(self, directory = None):
    self.home = os.path.normpath(directory or os.getcwd()) + os.sep
    self.config = Configuration()
    self.config['home'] = self.home
    self.site = Site()
    self.site.config(self.config)

  def scaffold(self, **kwargs):
    if os.path.isfile(self.home + '/.kobol'):
      return False
    elif kwargs.get('dry') != True:
      skel = os.path.dirname(os.path.abspath(__file__)) + '/skel/'
      os.system("cp -R %s* %s.kobol %s" % (skel, skel, self.home))
    return True

  def load_config_files(self, files):
    self.config.load(files)
    self.site.config(self.config)



  def main(self):
    self.scaffold()
开发者ID:Version2beta,项目名称:kobol,代码行数:27,代码来源:kobol.py

示例3: main

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
def main():
    """
       As per Main method, defines sequence of program.
    """
    try:
        format = ['%(asctime)s  %(message)s', '%Y-%m-%d %H:%M:%S']
        resultfiles = []
        pas = 0
        total = 0

        create_logger(format)
        opts, args = getopt.getopt(sys.argv[1:], "hc:", ["help", "config="])
        source = str()

        if not opts:
            usage()

        for opt, arg in opts:
            if opt in ("-h", "--help"): 
                usage()
            elif opt in  ("-c", "--config"):
                source = arg

        # Configurations init
        Configuration.load(source, format)

        logging.info("="*100)
        logging.info("Regression started")
        logging.info("="*100)
        

        start_time = time.clock()

        # Execute Scripts
        resultfiles = execute()

        
        logging.info("="*100)
        logging.info("Results")
        logging.info("="*100)
        

        # Dispatch results
        pas, total = dispatch(resultfiles)

        total_time = time.clock() - start_time

        
        logging.info("="*100)
        logging.info("%d passed out of %d" %(pas, total))
        logging.info("Total elapsed time(secs) %.2f" %(total_time))
        logging.info("="*100)

    except (getopt.GetoptError, Exception) as e:
        logging.info("Exception %s" %str(e))
    except:
        logging.info("Fatal error occured.")
开发者ID:J33ran,项目名称:Regression,代码行数:59,代码来源:regression.py

示例4: testItems

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
 def testItems(self):
     c = Configuration("src/test/resources/test_param.json")
     c.load()
     config = c.getItems()
     self.assertEqual(len(config),2)
     self.assertEquals(config[0].getName(),"Echo foo")
     self.assertEquals(config[0].getPollInterval(),5)
     self.assertEquals(config[0].getCommand(),["echo","$HOME"])
     self.assertEquals(config[1].getName(),"Echo bar")
     self.assertEquals(config[1].getPollInterval(),20)
     self.assertEquals(config[1].getCommand(),["echo","$PATH"])
开发者ID:jdgwartney,项目名称:boundary-plugin-shell,代码行数:13,代码来源:configuration_test.py

示例5: __init__

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
class Plugin:
    
    def __init__(self,path):
        self.config = Configuration(path)
        self.dispatcher = Dispatcher()
        
    def initialize(self):
        self.config.load()
        self.dispatcher.setConfig(self.config)
    
    def run(self):
        self.dispatcher.run()
            
开发者ID:jdgwartney,项目名称:boundary-plugin-shell,代码行数:14,代码来源:plugin.py

示例6: main

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
def main():
    config = Configuration()
    config.load("config/config.json")

    emailFiles = listEmailFiles(config.gmailRoot)
    stats = Statistics()

    progress = ProgressBar(
        widgets=["Parsing Mail: ", Percentage(), " ", Bar(), " ", ETA()], maxval=len(emailFiles)
    ).start()

    for filename in emailFiles:
        progress.update(progress.currval + 1)
        updateStatistics(stats, config, filename)

    progress.finish()

    stats.save()
开发者ID:hortont424,项目名称:email-stats,代码行数:20,代码来源:main.py

示例7: Pay4BytesCore

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
class Pay4BytesCore(Service):
    IReactorTimeProvider = reactor
    updateInterval = 1
    menuItems = (
                    ('Quit', lambda widget: reactor.stop()),
                )
    def __init__(self):
        self.statusIcon = StatusIcon(self.menuItems)
        self.configuration = Configuration()
        self.connectionRegistry = None
        self.timer = LoopingCall(self.updateStatistics)
        self.timer.clock = self.IReactorTimeProvider

    def startService(self):
        Service.startService(self)
        self.configuration.load()
        self.connectionRegistry = \
            ConnectionRegistry( self.createConfiguredDeviceMap())
        self.timer.start(self.updateInterval).addErrback(log.err)
        self.statusIcon.show()

    def stopService(self):
        self.statusIcon.hide()
        # HACK: the timer should always be running and there's no need for this
        #        check; however, during development the service might be
        #        uncleanly with the timer not running, and then we'd rather
        #        avoid 'trying to stop a timer which isn't running' exception
        if self.timer.running:
            self.timer.stop()
        self.connectionRegistry.updateConfiguration()
        self.configuration.save()
        Service.stopService(self)

    def updateStatistics(self):
        statisticsMap = readNetworkDevicesStatisticsMap()
        self.connectionRegistry.updateConnections(statisticsMap)
        self.statusIcon.updateTooltip(self.connectionRegistry)

    def createConfiguredDeviceMap(self):
        result = {}
        for configuredDevice in self.configuration:
            pattern = re.compile(configuredDevice.get(DEVICE_NAME_PATTERN))
            result[pattern] = configuredDevice
        return result
开发者ID:yaniv-aknin,项目名称:pay4bytes,代码行数:46,代码来源:core.py

示例8: cr

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
def cr(ctx):
	try:
		if (not Configuration.exists()):
			Utils.print_encoded("Please inform your TFS' information\n")
			ctx.invoke(configure, url=click.prompt("Url"), username=click.prompt("Username"), password=click.prompt("Password"))
			ctx.exit()
		repo = git.Repo('.')
		ctx.obj = Repository(repo, RepositoryUtils(repo), Tfs(Configuration.load()))
	except git.exc.InvalidGitRepositoryError:
		Error.abort("You're not on a valid git repository")
开发者ID:yuriclaure,项目名称:tfs-pullrequest,代码行数:12,代码来源:main.py

示例9: _generateArtifactList

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
def _generateArtifactList(options, args):

    config = Configuration()
    if options.config or not args:
        # load configuration
        logging.info("Loading configuration...")
        config.load(options)
    else:
        # create configuration
        logging.info("Creating configuration...")
        config.create(options, args)

    # build list
    logging.info("Building artifact list...")
    listBuilder = ArtifactListBuilder(config)
    artifactList = listBuilder.buildList()

    logging.debug("Generated list contents:")
    _logAL(artifactList)

    #filter list
    logging.info("Filtering artifact list...")
    listFilter = Filter(config)
    artifactList = listFilter.filter(artifactList, options.threadnum)

    logging.debug("Filtered list contents:")
    _logAL(artifactList)

    logging.info("Artifact list generation done")

    if options.reportdir:
        logging.info("Generating repository analysis report")
        if hasattr(options, "reportname"):
            reporter.generate_report(options.reportdir, config, artifactList, options.reportname)
        else:
            reporter.generate_report(options.reportdir, config, artifactList, None)
        logging.info("Report has been generated")

    return artifactList
开发者ID:jboss-eap,项目名称:maven-repository-builder,代码行数:41,代码来源:artifact_list_generator.py

示例10:

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
import animations.rainbow
import animations.radar
import animations.fadetoblack
import animations.bouncer
import animations.heartbeat

# Try to load Twitter animations
try:
    import animations.tweet
except ImportError:
    print "Please install twitter module from http://pypi.python.org/pypi/twitter/"
    animations.tweet = None

if __name__ == '__main__':
    # Load configuration
    configuration = Configuration.load('configuration.json')

    # Create display and animator

    display = None
    try:
        import leddisplay
        display = leddisplay.Display(
            port = configuration.leddisplay.port.required().encode(),
            speed = configuration.leddisplay.speed.required(),
            threaded = True
        )
    except leddisplay.serial.SerialException, e:
        print "Could not connect to serial port, launching display emulator"
        print "\t%s"%e
    except:
开发者ID:rumpl,项目名称:led_display,代码行数:33,代码来源:main.py

示例11: Configuration

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
from flask import Flask, Response, request
import redis


from configuration import ConfigSource, Configuration
config = Configuration()
if not config.load():
    print("No configuration")
    exit(-1)

app = Flask(__name__)

@app.route('/', defaults={'app_url': ''})
@app.route('/<app_url>')
def lightning(app_url):

    index_key = request.args.get('index_key', None)

    if config.lightning_app_automatic:
        app_name = app_url
        redis_key = None

    elif config.lightning_app_map.get(app_url, False):
        app_name = config.lightning_app_map.get(app_url)['app_name']
        redis_key = config.lightning_app_map.get(app_url).get('redis_key', None)

    else:
        return "No such Application Configured", 404

    if redis_key is None:
        redis_key = config.redis_prefix+app_name+config.redis_suffix
开发者ID:angelosarto,项目名称:ember-lightning-flask,代码行数:33,代码来源:elf.py

示例12: testEntryCount

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import load [as 别名]
 def testEntryCount(self):
     c = Configuration("src/test/resources/test_param.json")
     c.load()
     self.assertEquals(c.getEntryCount(),2,"Entry count does not match")
开发者ID:jdgwartney,项目名称:boundary-plugin-shell,代码行数:6,代码来源:configuration_test.py


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