コード例 #1
0
ファイル: mainwindow.py プロジェクト: dalinhuang/adapter-demo
	def __init__(self, parent = None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_mainwindow()
		self.ui.setupUi(self)
		self.createTrayIcon()
		self.isrunning = False
		config.loadConfig()
		self.loadConfig()
		
		self.ui.startButton.clicked.connect(self.start, QtCore.Qt.QueuedConnection)
		self.ui.hideButton.clicked.connect(self.hideWindow, QtCore.Qt.QueuedConnection)
		self.ui.sendFrequencyButton.clicked.connect(self.sendFreq, QtCore.Qt.QueuedConnection)
		self.ui.sendAirTempLimit.clicked.connect(self.sendAirTemp, QtCore.Qt.QueuedConnection)
		self.ui.sendMoistureLimit.clicked.connect(self.sendMoisture, QtCore.Qt.QueuedConnection)
		self.ui.sendEarthTempLimit.clicked.connect(self.sendEarthTemp, QtCore.Qt.QueuedConnection)
		self.ui.sendEarthMoistureLimit.clicked.connect(self.sendEarthMoisture, QtCore.Qt.QueuedConnection)
		self.ui.sendCO2Limit.clicked.connect(self.sendCO2, QtCore.Qt.QueuedConnection)
		self.ui.sendIllumLimit.clicked.connect(self.sendIllum, QtCore.Qt.QueuedConnection)
		self.ui.sendCommand.clicked.connect(self.sendCommand, QtCore.Qt.QueuedConnection)
		self.sendmsg[str, str].connect(self.message, QtCore.Qt.QueuedConnection)

		port = self.ui.serverPort.text().toInt()[0]
		self.v4server = CIPv4Server(self, port)
		self.v4server.sendmsg[str, str].connect(self.message, QtCore.Qt.QueuedConnection)
		self.v4server.start()

		self.v6server = CIPv6Server(self, port)
		self.v6server.sendmsg[str, str].connect(self.message, QtCore.Qt.QueuedConnection)
		self.v6server.start()
コード例 #2
0
def loadConfig():
    if config.configExists():
        config.loadConfig()
        challonge.set_credentials(config.config['challonge']['username'],
                                  config.config['challonge']['apiKey'])
    else:
        pass
コード例 #3
0
ファイル: bdl.py プロジェクト: thisismy-github/bdl
    def setupBDL(self, ui, window):
        self.ui = ui
        self.window = window
        self.ui.menuBar.hide(
        )  # TODO: qt designer can't add menus with a menubar???
        bdlWidgets.setBDLInstance(self)

        self.lastDir = '.'
        self.updateReady = False
        self.bdlAutoDetectIWADs = True
        self.bdlRejectBadIWADs = True
        config.loadConfig(self)

        self.connectWidgetSignals()
        update.checkUpdateSuccess(self)

        if self.updateReady:  # update is still queued from previous session
            self.ui.tabWidget.setTabText(3, 'bdl (!)')
            self.ui.bdlUpdateButton.setToolTip(
                'An update was found for you last session.')
            self.ui.bdlUpdateButton.setEnabled(True)
        else:  # no update queued -> if it's a new day check for updates
            try:
                if self.ui.bdlAutoUpdateCheck.isChecked():
                    lastCheck = datetime.strptime(
                        self.ui.bdlUpdateLastCheckLabel.text(),
                        'Last check: %m/%d/%y').date()
                    today = datetime.now().date()
                    if today > lastCheck:
                        update.checkUpdate(self)
            except:
                pass

        # Extra stuff
        self.ui.complevelCombo.setItemData(0, "-complevel 2", 3)
        self.ui.complevelCombo.setItemData(1, "-complevel 3", 3)
        self.ui.complevelCombo.setItemData(2, "-complevel 4", 3)
        self.ui.complevelCombo.setItemData(3, "-complevel 9", 3)
        self.ui.complevelCombo.setItemData(4, "-complevel 11", 3)

        self.autoRecording = False  # Not in config
        self.autoRecordTimer = QtCore.QTimer()
        self.autoRecordTimer.timeout.connect(self.autoRecordTimeout)
        self.autoRecordProcess = None
        self.autoRecordDemoAttempt = 1
        self.autoRecordDemoSession = 1

        self.ui.portRenameLineEdit.hide()
        self.ui.demoGroup.setMaximumHeight(
            80 if self.ui.demoGroup.isChecked() else 13)
        self.ui.warpGroup.setMaximumHeight(
            69 if self.ui.warpGroup.isChecked() else 13)
        self.ui.paramGroup.setMaximumHeight(
            16777215 if self.ui.paramGroup.isChecked() else 13)
        self.ui.demoRecordNameLineEdit.setTextMargins(0, 0, 8, 0)
        self.ui.bdlDownloadLabel.hide()
        self.ui.bdlDownloadProgress.hide()
        self.resetPWADsCheckable()
コード例 #4
0
def getWidgetWithData():
    w = EventShowWidget()
    data = DB.getEventByPage(1, 5)
    loadData(w, data)
    loadConfig('dataShowTable', w)
    w.resize(700, 350)
    w.ui.tableShowWidget.setHorizontalHeaderLabels(
        [u'描述', 'startTime', 'endTime', u'已完成', u'超时', u'放弃'])
    return w
コード例 #5
0
ファイル: bdl.py プロジェクト: thisismy-github/bdl
 def loadCustomConfig(self):
     file = QtWidgets.QFileDialog.getOpenFileName(
         caption="Select configuration to load",
         directory=self.lastDir,
         filter="BDL config files (*.ini);;"
         "Other config files (*.bdl *.cfg);;"
         "All files (*)")[0]
     try:
         self.lastDir = (os.sep).join(file.split("/")[:-1])
     except:
         pass
     config.loadConfig(self, file)
コード例 #6
0
def getWidgetWithData():
    w = EventShowWidget()
    data = DB.getEventByPage(1, 5)
    loadData(w, data)
    loadConfig('dataShowTable', w)
    w.resize(700, 350)
    w.ui.tableShowWidget.setHorizontalHeaderLabels(
            [u'描述',
                'startTime',
                'endTime',
                u'已完成',
                u'超时',
                u'放弃'])
    return w
コード例 #7
0
ファイル: main.py プロジェクト: BielStela/Auto137
def main():
    # Congifure logger
    logger = logging.getLogger('main')
    logger.setLevel(logging.DEBUG)
    fh = logging.FileHandler('auto137.log')
    fh.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s - %(levelname)s - %(name)s : %(message)s')
    fh.setFormatter(formatter)
    logger.addHandler(fh)

    # Parse config, fetch some data
    config.loadConfig("config.yaml")
    logger.info('Configuration loaded/')
    core.updateTLEs()

    # Create images folders
    for satellite in config.satellites:
        if not Path(config.output_dir + "/" + satellite.name).is_dir():
            os.makedirs(config.output_dir + "/" + satellite.name)
            logger.info('Data directories structure created.')

    # Init sheduler and start repeating tasks
    core.initScheduler()
    core.scheduler.add_job(core.updateTLEs,
                           "interval",
                           id="tle_refresh",
                           hours=config.tle_update_interval)
    core.scheduler.add_job(passutils.updatePass,
                           "interval",
                           id="passes_refresh",
                           hours=1)
    logger.info("Scheduler started!")

    # Start decoding thread
    decodingThread = Thread(target=passutils.processDecodeQueue)
    decodingThread.start()
    logger.info("Decoding thread started!")

    # Start RSS Server if enabled
    if config.rss_enabled:
        rss.startServer()

    # Schedule passes
    passutils.updatePass()

    # Wait forever
    while True:
        time.sleep(10)
コード例 #8
0
    def __init__(self, fastHome=DEFAULT_FAST_HOME):
        self.fastHome = fastHome
        self.config = self.getDefaultConfig()
        #config file should be in local path
        configfile=os.path.join(os.path.dirname(sys.argv[0]),CONFIG_FILENAME)                   
        config.loadConfig(configfile, self.config)

        self.clusterConfig = None                
        self.clusterName = None #String
        self.admin = None
        self.indexers = {} #Dictionary of ColumnID=Column
        self.queryServers = [] #List of QueryServer
        self.collections = []  #List of String
        self.hosts = []        
        self.buildCluster()
コード例 #9
0
 def getConfOfPluginArchive(self, fileName):
     try:
         rmtree(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)))
     except:
         pass
     try:
         tar = tarfile.open(fileName)
         tar.extractall(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)))
         tar.close()
     except:
         raise( piException(e_piPluginExtractFail, fileName) )
     try:
         install = loadConfig(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName), const.PLUGIN_INSTALL_CONFIG_FILE))
         mname = generateModuleName(install.plugin.name)
     except Exception as e:
         raise( piException(e_piPluginConfCorrupt, fileName) )
     try:
         rmtree(path.join(const.PLUGIN_DOWNLOAD_PATH, mname))           
     except:
         pass
     try:
         move(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)), path.join(const.PLUGIN_DOWNLOAD_PATH, mname))
         return(install)        
     except:
         raise( piException(e_piPluginExtractFail, path.join(const.PLUGIN_DOWNLOAD_PATH, mname)) )
コード例 #10
0
def main(args):
    # Read in the configuration file
    config = loadConfig(CONFIG_FILE)

    # Record some data and extract the bits on-the-fly
    bits = readRTL(int(config['duration']))

    # Read in the most recent state
    db = Archive()
    tLast, output = db.getData()

    # Find the packets and save the output
    output = parseBitStream(bits,
                            elevation=config['elevation'],
                            inputDataDict=output,
                            verbose=config['verbose'])

    # Save to the database
    db.writeData(time.time(), output)

    # Upload
    wuUploader(config['ID'],
               config['PASSWORD'],
               output,
               archive=db,
               includeIndoor=config['includeIndoor'],
               verbose=config['verbose'])
コード例 #11
0
def getPageNear():
    conf = config.loadConfig("../../conf/example_config.json")
    dataImpl = inject.inject.getDataImpl()
    sessionImpl = inject.inject.getSessionImpl()
    user = dataImpl.getPerson(
        1)  # todo: change with sessionImpl.getSession(cookie).getId()
    user_households = map(lambda x: dataImpl.getHousehold(x),
                          dataImpl.getHouseholdIdsFromPerson(1))
    user_household = user_households[0]
    households = dataImpl.getHouseholds()
    sorted_households = orderByDistance(user_household, households, 10)
    sorted_household_residents = []
    sorted_household_distances = []
    for i in range(0, len(sorted_households)):
        sorted_household_residents.append(
            map(
                lambda x: dataImpl.getPerson(x),
                dataImpl.getPersonIdsFromHousehold(
                    int(sorted_households[i]["id"]))))
        sorted_household_distances.append("{0:.2f}".format(
            lonLatDistance(float(sorted_households[i]["latitude"]),
                           float(sorted_households[i]["longitude"]),
                           float(user_household["latitude"]),
                           float(user_household["longitude"]))))
    carpools = []
    for i in range(0, len(sorted_households)):
        carpools.append((sorted_households[i], sorted_household_residents[i],
                         sorted_household_distances[i]))
    t = Templite(filename=path.join(conf["projectRoot"], "src", "html",
                                    "near.templite"))
    return t.render(user=user,
                    user_households=user_households,
                    user_household_selected=0,
                    carpools=carpools,
                    num_results=10)
コード例 #12
0
def storeData(table, value):
    db_init = loadConfig()
    try:
        conn = MySQLdb.connect(host=db_init.db_host,
                               charset='utf8',
                               user=db_init.db_user,
                               passwd=db_init.db_passwd,
                               port=db_init.db_port,
                               db=db_init.db)
        cur = conn.cursor()
        fields = '('
        s_fields = '('
        temp = []
        count = 0
        for key in value.keys():
            count += 1
            fields += key
            s_fields += '%s'
            if count == len(value):
                fields += ') values'
                s_fields += ')'
            else:
                fields += ','
                s_fields += ','
            temp.append(value[key])
        sql = 'insert into ' + table
        sql += fields
        sql += s_fields
        cur.execute(sql, temp)
        conn.commit()
        cur.close()
        conn.close()
    except:
        logging.debug("insert data failed......")
コード例 #13
0
ファイル: builder.py プロジェクト: Tesora/tesora-nodepool
 def _getAndValidateConfig(self):
     config = nodepool_config.loadConfig(self._config_path)
     if not config.zookeeper_servers.values():
         raise RuntimeError('No ZooKeeper servers specified in config.')
     if not config.imagesdir:
         raise RuntimeError('No images-dir specified in config.')
     return config
コード例 #14
0
ファイル: rtl_record.py プロジェクト: torgy2k/rtl_osv21
def main(args):
    # Parse the command line
    if len(args) != 2:
        raise RuntimeError(
            "Invalid number of arguments provided, expected a duration and a filename"
        )
    duration = float(args[0])
    filename = args[1]

    # Read in the configuration file
    config = loadConfig(CONFIG_FILE)

    # Make sure that we can safely write to the file
    if os.path.exists(filename):
        goAhead = raw_input('File already exists, overwrite? [y/n]')
        if goAhead in ('n', 'N', ''):
            sys.exit()

    # Record the data
    record433MHzData(filename,
                     duration,
                     rtlsdrPath=config['rtlsdr'],
                     useTimeout=config['useTimeout'])

    # Report
    print "Recorded %i bytes to '%s'" % (os.path.getsize(filename), filename)
コード例 #15
0
 def __init__(self):
     self.conf = config.loadConfig("../../conf/example_config.json")
     self.fernet = Fernet(str(self.conf["fernetSessionKey"]))
     self.tokenCheck = re.compile(
         r"^[0-9]+\|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\|[0-9]+$"
     )
     self.pipe = re.compile(r"\|")
コード例 #16
0
def main():

    appConfig = config.loadConfig("secrets.json")

    card = connect_notecard(appConfig)

    print(f"Version: {version.versionStr}")

    dfu.setVersion(card, version.versionStr)

    configure_notecard(card, appConfig)

    updateManager = update.UpdateManager(card, printStatus)
    updateManager.restart = reset

    updateAvailable = False
    updateTimer = 0

    while True:

        if updateAvailable:
            printStatus("Update is available")
            try:
                updateManager.migrateAndInstall(restart=True)
            finally:
                updateAvailable = False

        if isExpiredMS(updateTimer):
            printStatus(f"Current Version: {version.versionStr}")
            printStatus("Checking for update")
            updateTimer = setTimerMS(10000)
            updateAvailable = dfu.isUpdateAvailable(card)
コード例 #17
0
ファイル: meteor.py プロジェクト: weehowe-z/flask-weather
 def __init__(self, host=None, port=None, uri=None, **kwargs):
     init_logging()
     cnf = loadConfig()
     self.host = cnf.getHost()
     print self.host
     self.port = cnf.getPort()
     con = ''
     if kwargs:
         for key in kwargs:
             uriStr = ''
             uriStr = '&' + key + "=" + kwargs[key]
             con += uriStr
     self.uri = uri + con
     httpClient = None
     try:
         httpClient = httplib.HTTPConnection(
             self.host, self.port, timeout=30)
         httpClient.request('GET', self.uri)
         tmp = httpClient.getresponse().read()
         buf = json.loads(tmp)
         self.result = buf
     except:
         logging.debug('get data failed.....')
     finally:
         if httpClient:
             httpClient.close()
コード例 #18
0
ファイル: builder.py プロジェクト: kklimonda/nodepool
 def _getAndValidateConfig(self):
     config = nodepool_config.loadConfig(self._config_path)
     if not config.zookeeper_servers.values():
         raise RuntimeError('No ZooKeeper servers specified in config.')
     if not config.imagesdir:
         raise RuntimeError('No images-dir specified in config.')
     return config
コード例 #19
0
 def __init__(self, host=None, port=None, uri=None, **kwargs):
     init_logging()
     cnf = loadConfig()
     self.host = cnf.getHost()
     self.port = cnf.getPort()
     con = ''
     if kwargs:
         for key in kwargs:
             uriStr = ''
             uriStr = '&' + key + "=" + kwargs[key]
             con += uriStr
     self.uri = uri + con
     httpClient = None
     try:
         httpClient = httplib.HTTPConnection(self.host,
                                             self.port,
                                             timeout=30)
         httpClient.request('GET', self.uri)
         tmp = httpClient.getresponse().read()
         buf = json.loads(tmp)
         self.result = buf
     except:
         logging.debug('get data failed.....')
     finally:
         if httpClient:
             httpClient.close()
コード例 #20
0
ファイル: meteor.py プロジェクト: zhounanshu/flask-weather
def storeData(table, value):
    db_init = loadConfig()
    try:
        conn = MySQLdb.connect(host=db_init.db_host, charset='utf8',
                               user=db_init.db_user, passwd=db_init.db_passwd,
                               port=db_init.db_port, db=db_init.db)
        cur = conn.cursor()
        fields = '('
        s_fields = '('
        temp = []
        count = 0
        for key in value.keys():
            count += 1
            fields += key
            s_fields += '%s'
            if count == len(value):
                fields += ') values'
                s_fields += ')'
            else:
                fields += ','
                s_fields += ','
            temp.append(value[key])
        sql = 'insert into ' + table
        sql += fields
        sql += s_fields
        cur.execute(sql, temp)
        conn.commit()
        cur.close()
        conn.close()
    except:
        logging.debug("insert data failed......")
コード例 #21
0
    def test_read_default_config(self):
        test_file = ""
        expected = config.default_config

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = config.loadConfig("foo")
            self.assertEqual(output._sections, expected)
            self.assertEqual(output["managers"]["order"], "")
コード例 #22
0
 def install(self, indexmname):
     indexPlugin = self.index.get(indexmname)
     self.__downloadPlugin(indexmname, indexPlugin.source)
     install = loadConfig(path.join(const.PLUGIN_DOWNLOAD_PATH, indexmname, const.PLUGIN_INSTALL_CONFIG_FILE))
     self.__checkIntegrity(install, indexPlugin )
     install.addSelf(const.PLUGIN_CONF_INSTALL_OPT)
     install.install.mname = indexmname
     self.__install(install)
コード例 #23
0
 def __updateuconf(self, newConf, oldConf):
     new = loadConfig(newConf)
     old = loadConfig(oldConf)
     for section in new.vars():
         if section in old.vars():
             for data in vars(vars(new)[section]).keys():
                 if data in vars(vars(old)[section]).keys():
                     try:
                         if data in vars(vars(new)["overwrite"])[section]:
                             vars(vars(old)[section])[data] = vars(vars(new)[section])[data]
                     except:
                         pass
                 else:
                     vars(vars(old)[section])[data] = vars(vars(new)[section])[data]
         else:
             vars(old)[section] = vars(new)[section]
     return(old)
コード例 #24
0
ファイル: mainwindow.py プロジェクト: dalinhuang/edge-demo
	def __init__(self, parent = None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_mainWindow()
		self.ui.setupUi(self)
		self.createTrayIcon()
		config.loadConfig()
		self.isrunning = False
		self.cityID = []
		self.mkCityIDS()
		QtCore.QObject.connect(self.ui.startButton, QtCore.SIGNAL('clicked()'), self.start)
		QtCore.QObject.connect(self.ui.hideButton, QtCore.SIGNAL('clicked()'), self.hideWindow)
		QtCore.QObject.connect(self.ui.configButton, QtCore.SIGNAL('clicked()'), self.showConfigWindow)
		QtCore.QObject.connect(self.ui.airTempCheck, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
		QtCore.QObject.connect(self.ui.moistureCheck, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
		QtCore.QObject.connect(self.ui.earthTempCheck, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
		QtCore.QObject.connect(self.ui.earthMoistureCheck, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
		QtCore.QObject.connect(self.ui.co2Check, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
		QtCore.QObject.connect(self.ui.illumCheck, QtCore.SIGNAL('stateChanged(int)'), self.stateChanged)
コード例 #25
0
ファイル: __main__.py プロジェクト: H1N1theI/AutoCBuild
def main():
    filelist = list()
    
    configPath = "build.json"
    
    validate = False;
    
    configParsed = None
    
    clean = False
    
    exit = False
    
    if len(sys.argv) > 1:
        if sys.argv[1] == "rebuild":
            clean = True
            if len(sys.argv) > 2:
                configPath = sys.argv[2] + ".json"
        elif sys.argv[1] == "clean":
            clean = True
            exit = True
        else:
            configPath = sys.argv[1] + ".json"
            
    configParsed = config.loadConfig(configPath)
        
    if clean:
        buildfiles.clean(configParsed)
        if exit:
            sys.exit(0)
    
    
    #Creates folders if not already present.
    buildfiles.createDirs(configParsed)
    
    dirtree = os.walk("./" + configParsed["build"]["srcdir"])
    
    #Construct the full directory tree
    for dirname, dirnames, filenames in dirtree:
        for filename in filenames:
            filelist.append(os.path.join(dirname, filename))
    
    #Creates the build metafile
    metafile = None
    if not os.path.exists(".buildmeta"):
        metabuild.createMetaFile();
    if os.path.exists(".buildmeta"):
        metafile = open(".buildmeta", "r+")
    
    metajson = None
    #Clears the metafile if it's invalid.
    try:
        metajson = json.load(metafile)
    except ValueError, e:
        metabuild.createMetaFile()
        metajson = json.load(metafile)
コード例 #26
0
 def config(self,configFileName):
   configFileName=os.path.abspath(configFileName)
   
   self._request = loadConfig(configFileName)
   self._request['config']=configFileName
   self._request['templateHeader']=self._request['header']
   
   self._request['path']=os.path.dirname(configFileName)+"/"
   
   self._bn=gum.loadBN(self._request['path']+self._request['bayesnet'])
コード例 #27
0
    def test_alternate_manager_order(self):
        test_file = """[managers]
order=
    brew
    cask"""
        expected = config.default_config

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = config.loadConfig("foo")
            self.assertEqual(output["managers"]["order"], "\nbrew\ncask")
コード例 #28
0
def main():
    filelist = list()

    configPath = "build.json"

    validate = False

    configParsed = None

    clean = False

    exit = False

    if len(sys.argv) > 1:
        if sys.argv[1] == "rebuild":
            clean = True
            if len(sys.argv) > 2:
                configPath = sys.argv[2] + ".json"
        elif sys.argv[1] == "clean":
            clean = True
            exit = True
        else:
            configPath = sys.argv[1] + ".json"

    configParsed = config.loadConfig(configPath)

    if clean:
        buildfiles.clean(configParsed)
        if exit:
            sys.exit(0)

    #Creates folders if not already present.
    buildfiles.createDirs(configParsed)

    dirtree = os.walk("./" + configParsed["build"]["srcdir"])

    #Construct the full directory tree
    for dirname, dirnames, filenames in dirtree:
        for filename in filenames:
            filelist.append(os.path.join(dirname, filename))

    #Creates the build metafile
    metafile = None
    if not os.path.exists(".buildmeta"):
        metabuild.createMetaFile()
    if os.path.exists(".buildmeta"):
        metafile = open(".buildmeta", "r+")

    metajson = None
    #Clears the metafile if it's invalid.
    try:
        metajson = json.load(metafile)
    except ValueError, e:
        metabuild.createMetaFile()
        metajson = json.load(metafile)
コード例 #29
0
    def config(self, configFileName):
        configFileName = os.path.abspath(configFileName)

        self._request = loadConfig(configFileName)
        self._request['config'] = configFileName
        self._request['templateHeader'] = self._request['header']

        self._request['path'] = os.path.dirname(configFileName) + "/"

        self._bn = gum.loadBN(self._request['path'] +
                              self._request['bayesnet'])
コード例 #30
0
ファイル: builder.py プロジェクト: Tesora/tesora-nodepool
    def _reloadConfig(self):
        '''
        Reload the nodepool configuration file.
        '''
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        provider_manager.ProviderManager.reconfigure(self._config, new_config,
                                                     use_taskmanager=False)
        self._config = new_config
コード例 #31
0
def run_all():
    config = loadConfig('settings.conf')
    LOCAL_DIRECTORY = config.get('ATTACHMENTS', 'LOCAL_DIRECTORY')
    EXECUTABLE = config.get('EXECUTION', 'EXECUTABLE')

    solutions = os.listdir(LOCAL_DIRECTORY)

    results = []

    for solution in solutions:
        print('Running {}'.format(term.blue(solution)))
        path = os.path.join(LOCAL_DIRECTORY, solution)
        try:
            check_bandit(path)

            venv_path = create_virtualenv(path)
            install_requirements(venv_path, path)

            start_time = datetime.now()
            for test in TEST_TRIANGLES:
                failure_message = check_triangle(
                    path,
                    python_executable=os.path.join(venv_path, 'bin',
                                                   'python3'),
                    executable=EXECUTABLE,
                    **test)
                if failure_message:
                    result = Result(solution, failure_reason=failure_message)
                    results.append(result)
                    break
            else:
                finish_time = datetime.now()
                result = Result(solution, time=finish_time - start_time)
                results.append(result)

        except StopExecution:
            raise
        except Exception as e:
            print(term.red('Got exception running {}'.format(solution)))
            print(term.red(str(e)))
            failure_message = str(e)

            if hasattr(e, 'stdout') and e.stdout:
                print(term.red(e.stdout))
                failure_message = failure_message + '\nFrom stdout:\n{stdout}'.format(
                    stdout=e.stdout)

            result = Result(solution, failure_reason=failure_message)
            results.append(result)

        print()

    return results
コード例 #32
0
ファイル: caman.py プロジェクト: mPyKen/Caman
 def reloadConfig(self):
     try:
         importlib.reload(config)
         bg, newlayers = config.loadConfig(self.width, self.height)
         if newlayers is not None and bg is not None:
             self.shutdownLayers()
             self.background = cv2.resize(bg, (self.width, self.height))
             self.layers = newlayers
             self.updateLayerOrder()
             self.startLayers()
     except Exception:
         print(traceback.format_exc())
コード例 #33
0
ファイル: main.py プロジェクト: trevorlindsay/lstm
def main():

    unbuffered = os.fdopen(sys.stdout.fileno(), 'w', 0)
    sys.stdout = unbuffered

    # Ignore SettingWithCopy warnings
    pd.options.mode.chained_assignment = None

    try:
        configFile = sys.argv[1]
    except IndexError:
        configFile = 'ToyNewConfig.txt'

    dataConfig, modelConfig = loadConfig(configFile)

    # Check if a model is being read from file
    if modelConfig['InputDirectory'] == "":

        (train_data, test_data), dataConfig = load_data(dataConfig)
        modelConfig['NumFeatures'] = train_data.X.shape[1]

        ytrain_pred, ytrain_true, ytest_pred, ytest_true = run_model(
            modelConfig, dataConfig, train_data, test_data)

        # Write predictions to csv
        pd.DataFrame(
            {
                '{}_prediction'.format(train_data.config['Target']):
                ytrain_pred.values
            },
            index=train_data.X.index).sort_index(level=0).swaplevel(
                -2, -1).to_csv(train_data.config['OutputInSample'])

        pd.DataFrame(
            {
                '{}_prediction'.format(train_data.config['Target']):
                ytest_pred.values
            },
            index=test_data.X.index).sort_index(level=0).swaplevel(
                -2, -1).to_csv(test_data.config['OutputOutSample'])

    else:

        (data, ), dataConfig = load_data(dataConfig, new_model=False)
        modelConfig['NumFeatures'] = data.X.shape[1]
        ypred = load_model(modelConfig, dataConfig, data)

        pd.DataFrame({
            'alpha': ypred.values
        }, index=data.X.index).sort_index(level=0).swaplevel(-2, -1).to_csv(
            data.config['AlphaDirectory'])

    print 'Wrote predictions to csv'
コード例 #34
0
ファイル: builder.py プロジェクト: kklimonda/nodepool
    def _reloadConfig(self):
        '''
        Reload the nodepool configuration file.
        '''
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        provider_manager.ProviderManager.reconfigure(self._config,
                                                     new_config,
                                                     use_taskmanager=False)
        self._config = new_config
コード例 #35
0
ファイル: builder.py プロジェクト: kklimonda/nodepool
    def _run(self):
        '''
        Body of run method for exception handling purposes.
        '''
        # NOTE: For the first iteration, we expect self._config to be None
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        self._config = new_config

        self._checkForScheduledImageUpdates()
        self._checkForManualBuildRequest()
コード例 #36
0
ファイル: builder.py プロジェクト: Tesora/tesora-nodepool
    def _run(self):
        '''
        Body of run method for exception handling purposes.
        '''
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        provider_manager.ProviderManager.reconfigure(self._config, new_config,
                                                     use_taskmanager=False)
        self._config = new_config

        self._cleanup()
コード例 #37
0
ファイル: builder.py プロジェクト: Tesora/tesora-nodepool
    def _run(self):
        '''
        Body of run method for exception handling purposes.
        '''
        # NOTE: For the first iteration, we expect self._config to be None
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        self._config = new_config

        self._checkForScheduledImageUpdates()
        self._checkForManualBuildRequest()
コード例 #38
0
ファイル: __init__.py プロジェクト: darian19/numenta-apps
def reset(offline=False):
  """
  Reset the htm-it database; upon successful completion, the necessary schema are
  created, but the tables are not populated

  :param offline: False to execute SQL commands; True to just dump SQL commands
    to stdout for offline mode or debugging
  """
  # Make sure we have the latest version of configuration
  config.loadConfig()
  dbName = config.get('repository', 'db')

  resetDatabaseSQL = (
      "DROP DATABASE IF EXISTS %(database)s; "
      "CREATE DATABASE %(database)s;" % {"database": dbName})
  statements = resetDatabaseSQL.split(";")

  engine = getUnaffiliatedEngine()
  with engine.connect() as connection:
    for s in statements:
      if s.strip():
        connection.execute(s)

  migrate(offline=offline)
コード例 #39
0
ファイル: builder.py プロジェクト: kklimonda/nodepool
    def _run(self):
        '''
        Body of run method for exception handling purposes.
        '''
        new_config = nodepool_config.loadConfig(self._config_path)
        if not self._config:
            self._config = new_config

        self._checkForZooKeeperChanges(new_config)
        provider_manager.ProviderManager.reconfigure(self._config,
                                                     new_config,
                                                     use_taskmanager=False)
        self._config = new_config

        self._cleanup()
コード例 #40
0
ファイル: startStream.py プロジェクト: Pieloaf/TwitchThings
def main():
    usage = '==Usage==\npython startStream.py [OPTION...] [FILE...]\n\nNo arguments \t\t\tUses default config file\n-d --default\t<fName.toml>\tSets fName.toml as default config\n-c --config\t<fName.toml>\tUses fName.toml as config\n-n --new\t\t\tCreates new config file\n-h --help\t\t\tDisplays this help message'
    fileNotFound = 'Error: File Not Found'

    argv = sys.argv[1:]
    try:
        opts, args = getopt.getopt(argv, 'd:c:hn',
                                   ['default=', 'config=', 'help', 'new'])
    except getopt.GetoptError:
        print(usage)
        return

    if len(argv) == 0:
        noArgs()
    elif len(argv) > 2:
        print(usage)
    else:
        for opt, arg in opts:
            if opt in ("-d", "--default"):
                if path.isfile(path.join(getcwd(), arg)):
                    config.setDefault(arg[:-5])
                    return
                else:
                    print(fileNotFound)
                    config.invalidDefault(getcwd())
                    return

            elif opt in ['-c', '--config']:
                if not path.isfile(path.join(getcwd(), arg)):
                    print(fileNotFound)
                    print(
                        'Please try again with a valid config file. Run with -h for more details'
                    )
                    return
                else:
                    procs = config.loadConfig(arg[:-5])
                    for proc in procs:
                        proc.start()

            elif opt in ['-h', '--help']:
                print(usage)
                return

            elif opt in ['-n', '--new']:
                config.newConfig()
                return
            else:
                print('nope')
コード例 #41
0
ファイル: startStream.py プロジェクト: Pieloaf/TwitchThings
def noArgs():
    cwd = getcwd()
    if (not path.isfile(path.join(
            cwd, 'default.config'))) or (stat('default.config').st_size == 0):
        config.invalidDefault(cwd)
    else:
        defaultConfig = open('default.config', 'r')
        confName = defaultConfig.readlines()[0]
        defaultConfig.close()
        if not path.isfile(path.join(cwd, (confName + '.toml'))):
            print('File not found')
            config.invalidDefault(cwd)
        else:
            procs = config.loadConfig(confName)
            for proc in procs:
                proc.start()
コード例 #42
0
def main():
    opts = config.processArgs()

    configs = config.loadConfig(opts)
    print('load configs', configs)
    print('\n')

    config.validateConfig(configs)
    print('validate configs', configs)
    print('\n')

    files = config.readProjectDir(opts)
    print('uml files', files)
    print('\n')

    umlparser.parseFiles(files)
コード例 #43
0
def main():
    config = loadConfig('settings.conf')
    HOST = config.get('IMAP', 'HOST')
    USERNAME = config.get('IMAP', 'USERNAME')
    FOLDER = config.get('IMAP', 'FOLDER')
    FILENAME = config.get('RESULTS', 'FILENAME')
    PASSWORD = getpass.getpass()

    LOCAL_DIRECTORY = config.get('ATTACHMENTS', 'LOCAL_DIRECTORY')

    imap_server = ImapServer(HOST,
                             USERNAME,
                             PASSWORD,
                             folder=FOLDER,
                             )
    imap_server.download_attachements(directory=LOCAL_DIRECTORY)
    imap_server.logout()

    print('Finished downloading attachments')
    print()

    print('Starting decompressing archives')
    decompress_archives(LOCAL_DIRECTORY)
    print('Finished decompressing archives')
    print()

    run_code = input('Run code now? (y/N) ')
    if run_code.lower() in ('y', 'yes'):
        results = run_all()
        successes = [x for x in results if not x.failed]
        successes.sort(key=lambda x: x.time)

        print('Correct Solutions:')
        for result in successes:
            print('{name}\n\t{time}'.format(name=term.blue(result.name),
                                            time=term.magenta(str(result.time))))
            print()

        if FILENAME:
            with open(FILENAME, 'w') as f:
                for result in successes:
                    f.write('{name} {time}\n'.format(name=result.name,
                                                     time=str(result.time)))

    print()
    print('All Done')
コード例 #44
0
def main():
    config = loadConfig('settings.conf')

    HOST = config.get('IMAP', 'HOST')
    USERNAME = config.get('IMAP', 'USERNAME')
    FOLDER = config.get('IMAP', 'FOLDER')
    PASSWORD = getpass.getpass()

    imap_client = ImapClient(HOST,
                             USERNAME,
                             PASSWORD,
                             folder=FOLDER,
                             )
    email_addrs = sorted(list(imap_client.get_email_addresses()))

    for addr in email_addrs:
        print(addr)
コード例 #45
0
    def __init__(self):
        #
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.i18n()
        if os.path.isfile(const.EVIRE_CONF):
            self.conf = loadConfig(const.EVIRE_CONF)
            if not self.conf:
                QMessage(self.msg["m_loadFail"], QtGui.QMessageBox.Critical, False, False, const.EVIRE_CONF)
            else:
                self.__update()
        else:
            self.__setDefaults()
            if not saveConfig(const.EVIRE_CONF, self.conf):
                QMessage(self.msg["m_saveFail"], QtGui.QMessageBox.Critical, False, False, const.EVIRE_CONF)


        QtCore.QObject.connect(self.pluginIndexEdit,  QtCore.SIGNAL("textChanged ()"),  self.on_changed)
コード例 #46
0
ファイル: cmd.py プロジェクト: tuzzeg/kaggle-calendar
  def __call__(self, command, args):
    if args.log_config:
      with open(args.log_config) as f:
        logging.config.dictConfig(json.load(f))
    else:
      logLevel = getattr(logging, args.log_level.upper(), None)
      if not isinstance(logLevel, int):
        raise ValueError('Invalid log level: %s' % args.log_level)
      logging.basicConfig(level=logLevel)

    if args.log_http:
      http_logger = urllib2.HTTPHandler(debuglevel = 1)
      opener = urllib2.build_opener(http_logger) # put your other handlers here too!
      urllib2.install_opener(opener)

    conf = loadConfig(*args.configs)

    self._inner(command, args, conf)
コード例 #47
0
ファイル: rtl_replay.py プロジェクト: aabaker/rtl_osv21
def main(args):
	# Validate arguments
	if len(args) != 1:
		raise RuntimeError("Invalid number of arguments provided, expected a filename")
	filename = args[0]
	
	# Read in the configuration file
	config = loadConfig(CONFIG_FILE)
	
	# Find the bits in the freshly recorded data and remove the file
	bits = readRTLFile(filename)
	
	# Find the packets
	output = parseBitStream(bits, elevation=config['elevation'], verbose=True)
	
	# Report
	print " "
	print generateWeatherReport(output)
コード例 #48
0
def getPageNear():
    conf = config.loadConfig("../../conf/example_config.json")
    dataImpl = inject.inject.getDataImpl()
    sessionImpl = inject.inject.getSessionImpl()
    user = dataImpl.getPerson(1) # todo: change with sessionImpl.getSession(cookie).getId()
    user_households = map(lambda x: dataImpl.getHousehold(x), dataImpl.getHouseholdIdsFromPerson(1))
    user_household = user_households[0]
    households = dataImpl.getHouseholds()
    sorted_households = orderByDistance(user_household, households, 10)
    sorted_household_residents = []
    sorted_household_distances = []
    for i in range(0, len(sorted_households)):
        sorted_household_residents.append(map(lambda x: dataImpl.getPerson(x), dataImpl.getPersonIdsFromHousehold(int(sorted_households[i]["id"]))))
        sorted_household_distances.append("{0:.2f}".format(lonLatDistance(float(sorted_households[i]["latitude"]), float(sorted_households[i]["longitude"]), float(user_household["latitude"]), float(user_household["longitude"]))))
    carpools = []
    for i in range(0, len(sorted_households)):
        carpools.append((sorted_households[i], sorted_household_residents[i], sorted_household_distances[i]))
    t = Templite(filename=path.join(conf["projectRoot"], "src", "html", "near.templite"))
    return t.render(user=user, user_households=user_households, user_household_selected=0, carpools=carpools, num_results=10)
コード例 #49
0
ファイル: rtl_replay.py プロジェクト: torgy2k/rtl_osv21
def main(args):
    # Validate arguments
    if len(args) != 1:
        raise RuntimeError(
            "Invalid number of arguments provided, expected a filename")
    filename = args[0]

    # Read in the configuration file
    config = loadConfig(CONFIG_FILE)

    # Find the bits in the freshly recorded data and remove the file
    bits = readRTLFile(filename)

    # Find the packets
    output = parseBitStream(bits, elevation=config['elevation'], verbose=True)

    # Report
    print " "
    print generateWeatherReport(output)
コード例 #50
0
ファイル: main.py プロジェクト: kyokley/attachment_downloader
def main():
    config = loadConfig('settings.conf')
    HOST = config.get('IMAP', 'HOST')
    USERNAME = config.get('IMAP', 'USERNAME')
    FOLDER = config.get('IMAP', 'FOLDER')
    FILENAME = config.get('RESULTS', 'FILENAME')
    PASSWORD = getpass.getpass()

    LOCAL_DIRECTORY = config.get('ATTACHMENTS', 'LOCAL_DIRECTORY')

    imap_client = ImapClient(
        HOST,
        USERNAME,
        PASSWORD,
        folder=FOLDER,
    )
    imap_client.download_attachements(directory=LOCAL_DIRECTORY)
    imap_client.logout()

    print('Finished downloading attachments')
    print()

    print('Starting decompressing archives')
    decompress_archives(LOCAL_DIRECTORY)
    print('Finished decompressing archives')
    print()

    run_code = input('Run code now? (y/N) ')
    if run_code.lower() in ('y', 'yes'):
        results = run_all()

        output_results_to_stdout(results)

        if FILENAME:
            output_results_to_file(FILENAME, results)

        for result in results:
            if result.has_failures:
                result.write_failures_to_file()

    print()
    print('All Done')
コード例 #51
0
ファイル: rtl_osv21.py プロジェクト: aabaker/rtl_osv21
def main(args):
	# Read in the configuration file
	config = loadConfig(CONFIG_FILE)
	
	# Record some data and extract the bits on-the-fly
	bits = readRTL(int(config['duration']))
	
	# Read in the most recent state
	db = Archive()
	tLast, output = db.getData()
	
	# Find the packets and save the output
	output = parseBitStream(bits, elevation=config['elevation'], inputDataDict=output, verbose=config['verbose'])
		
	# Save to the database
	db.writeData(time.time(), output)
	
	# Upload
	wuUploader(config['ID'], config['PASSWORD'], output, archive=db, 
				includeIndoor=config['includeIndoor'], verbose=config['verbose'])
コード例 #52
0
def loadIsolateList(filename):
	cfg = config.loadConfig()
	isolates = pyroprinting.loadIsolatesFromFile("isolatesAll.pickle")
	isolateIdMap = {iso.name.strip(): iso for iso in isolates}

	with open(filename) as listFile:
		isoIds = {isoId.strip().strip("'").strip() for isoId in listFile.readline().split(',')}

	# print(isoIds)

	missingIsos = [iso.name for iso in isolates if iso.name.strip() not in isoIds]
	extraIsos = [isoId for isoId in isoIds if isoId not in isolateIdMap]
	print(extraIsos)
	print("extraIsoCount: {}".format(len(extraIsos)))
	print(missingIsos)
	print("missingIsoCount: {}".format(len(missingIsos)))

	sharedIsos = [iso for iso in isolates if iso.name.strip() in isoIds]

	print("{}/{} shared".format(len(sharedIsos), len(isolates)))
	with open("isolatesShared.pickle", mode='w+b') as cacheFile:
		pickle.dump(sharedIsos, cacheFile)
コード例 #53
0
def loadFromCSV(filename, outfile):
	cfg = config.loadConfig()
	isolates = pyroprinting.loadIsolates(cfg)
	isolateIdMap = {iso.name.strip(): iso for iso in isolates}
	clusters = []

	with open(filename) as csvFile:
		csvLines = "".join(line for line in csvFile if line.strip()).splitlines(True) # remove blank lines
		# print(csvLines)
		csvReader = csv.reader(csvLines, delimiter=',')
		pastHeader = False # because Aldrin's csv files have some header rows
		currentClusterId = None
		currentCluster = None

		for i, row in enumerate(csvReader):
			# print("{}/{}".format(i+1, len(csvLines)))
			if row[0] == "Cluster Id":
				pastHeader = True
			elif pastHeader:
				if row[0].startswith("Threshold:") or row[0] == "******":
					print("Multiple clusterings detected in file. Skipping the rest.")
					break

				isoId = row[1].strip()
				if isoId in isolateIdMap:
					if row[0] != currentClusterId:
						currentClusterId = row[0]
						currentCluster = set()
						clusters.append(currentCluster)
					currentCluster.add(isolateIdMap[isoId])
				else:
					print("extra isolate: {}".format(isoId))

	# print(clusters)
	print(len(clusters))

	with open(outfile, mode='w+b') as cacheFile:
		pickle.dump(clusters, cacheFile)
コード例 #54
0
 def load(self, installTranslator):
     self.badPlugins = []
     for fConf in glob.glob(const.USER_PLUGIN_PATH+"/*.conf"):
         mconf = loadConfig(fConf)
         try:
             self.__checkMConf(mconf)
         except cException as e:
             e.data += " "+fConf
             self.badPlugins.append(e)
         else:
             try:
                 mconf.plugin.description = unicode(vars(mconf.plugin)["description-"+self.locale])
             except:
                 pass
             if mconf.plugin.eps == const.EPS:
                 try:
                     main = __import__(mconf.install.mname+"."+const.PLUGIN_MAIN_MODULE).main
                 except Exception as e:
                     self.badPlugins.append( cException(e_plImportError, "%s: %s" %(str(e), mconf.install.mname)) )
                 else:
                     try:
                         self.__checkPlugin(main)
                     except cException as e:
                         e.data = "%s, %s" %(mconf.install.mname, str(e.data))
                         self.badPlugins.append( e )
                     else:
                         main.mconf = mconf
                         main.installTranslator = installTranslator
                         self.__list[mconf.plugin.name] = main
                         self.__mnameIndex[mconf.install.mname] = mconf.plugin.name
             else:
                 e = cException(e_plEPSConflict, "%s: %s \n evire: %s" %(mconf.install.mname, mconf.plugin.eps, const.EPS))
                 self.badPlugins.append(e)
     self.__buildExtensionList()
     if self.badPlugins:
         raise( cException(e_plbadPluginsFound, str(len(self.badPlugins))) )
     '''for __f in glob.glob(const.USER_PLUGIN_PATH+"/*.py") + glob.glob(const.SYSTEM_PLUGIN_PATH+"/*.py"):
コード例 #55
0
 def __init__(self, mconf):
     self.mconf = mconf
     self.conf = loadConfig(os.path.join(const.USER_CONF_PATH, self.mconf.install.mname+".conf"))
コード例 #56
0
def setDefaults():
    cfg = os.path.normcase("/opt/ems/purge/dispatcher.cfg")
    config.loadConfig(cfg, DEFAULTS)
コード例 #57
0
    for i in range(len(records)-1,-1,-1):
        t = records[i]
        chk = False
        for row in rows:
            if t.id == row[0]:
                chk = True
                break
        if chk == False:
            t.stop()

print ("Initializing database... ")
sqlCreateAll(version)
purgeDB()
print ("Initializing config...")
config.loadConfig()
credentials = config.getUser()
print ("Checking internationalization...")
checkLang()
print ("Initializing records...")
setRecords()
print ("Initializing EPG import thread...")
grabthread = epggrabthread()
grabthread.run()

print ("Starting server on: %s:%s" % (config.cfg_server_bind_address, config.cfg_server_port))
try:
    run(host=config.cfg_server_bind_address, port=config.cfg_server_port, server=CherryPyServer, quiet=True)
except Exception as ex:
    print ("Server exception. Default network settings will be used this time. Please log in using port 8030 and check your network settings.")
    print ("Starting server on: 0.0.0.0:8030")
コード例 #58
0
import unittest
import config
import model
import testingConfig

config.loadConfig(testingConfig)

class ConfigTest(unittest.TestCase):
  def test_valid(self):
    self.assertEqual(config.get("ROOT"), testingConfig.ROOT)

  def test_invalid(self):
    self.assertEqual(config.get("nonExistantConfigValue"), None)

  def test_default(self):
    self.assertEqual(config.get("nonExistantConfigValue", default=42), 42)

  def test_recursion(self):
    self.assertEqual(config.get("DISTROS", "target", "obs", "url"), testingConfig.DISTROS["target"]["obs"]["url"])

class DistroTest(unittest.TestCase):
  def setUp(self):
    self.distro = model.base.Distro.get("target")

  def test_name(self):
    self.assertTrue(self.distro.name, "target")

  def test_config(self):
    self.assertEqual(self.distro.config("obs", "url"), testingConfig.DISTROS["target"]["obs"]["url"])
    self.assertEqual(self.distro.config("nonExistantConfig", default=42), 42)
コード例 #59
0
ファイル: clusterEval.py プロジェクト: ejohns32/Thesis-Code
		len([size for size in clusterSizes if size >= 32 and size < 64]),
		len([size for size in clusterSizes if size >= 64 and size < 128]),
		len([size for size in clusterSizes if size >= 128])
	)

	noise = [isolate for isolate in isolates if isolate not in clusterMap]

	return count, minmax, (mean, math.sqrt(var)), len(noise), sizeHistogram

def filterSingletonClusters(clusters):
	filtered = [cluster for cluster in clusters if len(cluster) > 1]
	print("{}/{}".format(len(filtered), len(clusters)))
	return filtered

if __name__ == '__main__':
	cfg = config.loadConfig()
	assert cfg.isolateSubsetSize == "Shared"
	isolates = pyroprinting.loadIsolates(cfg)

	# dbscanClusters = dbscan.getDBscanClusters(isolates, cfg)
	dbscan1Clusters = dbscan.loadDBscanClustersFromFile("dbscanShared_0.995_0.995_1.pickle")
	dbscan3Clusters = dbscan.loadDBscanClustersFromFile("dbscanShared_0.995_0.995_3.pickle")
	ohclust99Clusters = filterSingletonClusters(importClusters.getOHClustClusters(99))
	# ohclust995Clusters = filterSingletonClusters(importClusters.getOHClustClusters(995))
	agglomerativeClusters = filterSingletonClusters(importClusters.getAgglomerativeClusters())
	replicatePearsons = loadReplicatePearsons(cfg)

	db1Pair = ("DBSCAN 1", dbscan1Clusters)
	db3Pair = ("DBSCAN 3", dbscan3Clusters)
	oh99Pair = ("OHClust 99", ohclust99Clusters)
	# oh995Pair = ("OHClust 995", ohclust995Clusters)
コード例 #60
0
ファイル: builder.py プロジェクト: no2a/nodepool
 def load_config(self, config_path):
     config = nodepool_config.loadConfig(config_path)
     provider_manager.ProviderManager.reconfigure(
         self._config, config)
     self._config = config