def __init__(self, input_file, appconfig_file): self.input_filename = input_file self.appconfig = AppConfig(appconfig_file) self.parser = Parser(self.input_filename, self.appconfig) self.question_answer = [] self.paragraph = None self.possible_answers = None
def create_app(debug): """Create an application.""" app = Flask(__name__) app.debug = debug app.config["SECRET_KEY"] = "gjr38dkjn344_!67#" env = "development" app_config = AppConfig(socketio, env) socketio.init_app(app) init_event_listeners(app_config, socketio) return app
def schedule_grow_for_shelf(grow: Grow, power_level: int, red_level: int, blue_level: int) -> None: config = AppConfig( ) # no arguments needed because it's a singleton instance shelf_grow_dict = { "grow": grow.to_json(), "power_level": power_level, "red_level": red_level, "blue_level": blue_level, } config.sio.emit("set_lights_for_grow", shelf_grow_dict) print("Event emitted from socketio obj")
def __init__(self, parent, config): QDialog.__init__(self, parent=parent) Ui_ConfigDlg.__init__(self) WndUtils.__init__(self, config) self.config = config self.main_window = parent self.local_config = AppConfig() self.local_config.copy_from(config) # block ui controls -> cur config data copying while setting ui controls initial values self.disable_cfg_update = False self.is_modified = False self.setupUi()
def test_app_config(self): try: app = AppConfig('tests/app_config.json') self.assertEqual( app.get_value('question_lines','start') , 2 ) self.assertEqual( app.get_value('question_lines','end') , 6 ) self.assertEqual( app.get_value('paragraph_length'),5000) self.assertEqual(True,True) except Exception as e: print e traceback.print_exc(file=sys.stdout) self.assertEqual(False,'Shoutd not fail') try: self.assertEqual( app.get_value('paragraph_length',2323),5000) self.assertEqual(False,'Shoud fail') except: self.assertEqual(True,True)
def __init__(self, parent, app_config: AppConfig): QDialog.__init__(self, parent=parent) Ui_ConfigDlg.__init__(self) WndUtils.__init__(self, app_config) self.app_config = app_config self.main_window = parent self.local_config = AppConfig() self.local_config.copy_from(app_config) # list of connections from self.local_config.dash_net_configs split on separate lists for mainnet and testnet self.connections_mainnet = [] self.connections_testnet = [] self.connections_current = None self.current_network_cfg: Optional[DashNetworkConnectionCfg] = None # block ui controls -> cur config data copying while setting ui controls initial values self.disable_cfg_update = False self.is_modified = False self.setupUi()
return response def getLimit(limit): try: limit = int(limit) except Exception: limit = -1 finally: return limit def getTimeout(timeout): try: timeout = int(timeout) if (timeout < 0): timeout = 15 except Exception: timeout = 15 finally: return timeout if __name__ == '__main__': appConfig = AppConfig() if (appConfig.getAssertConfigValue() == 'False'): app.run(debug=False, host='0.0.0.0') else: app.run(debug=True, host='0.0.0.0')
# -*- coding: utf-8 -*- import os import yaml from app_config import AppConfig, APP_DIR app_config = AppConfig() # Scrapy settings for steamscraping project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://doc.scrapy.org/en/latest/topics/settings.html # https://doc.scrapy.org/en/latest/topics/downloader-middleware.html # https://doc.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'steamscraping' SPIDER_MODULES = ['steamscraping.spiders'] NEWSPIDER_MODULE = 'steamscraping.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'steamscraping (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16) #CONCURRENT_REQUESTS = 32
def main(): appConfig = AppConfig() playlists = Playlists(appConfig) playlists.Download()
def __init__(self): appConfig = AppConfig() self.logger = appConfig.getLogger() self.broker = appConfig.getKafkaBroker()
import argparse import subprocess import yaml import os import glob import time import shutil import sqlite3 import xml.etree.ElementTree as ET import gdrive_adapter import metadata_util from app_info import AppInfo from app_config import AppConfig appInfo = AppInfo() appConfig = AppConfig(appInfo) IGNORE_FILE = ".pixignore" GDRIVE_REPO_PREFIX = 'gdrive:' BANNER_WIDTH = 75 config_settings_global = None config_settings_local = None def print_banner(): if quiet: return print("{:_<75}".format('')) print(""" __________._______ ________.___._______ _________ \______ \ \ \/ /\__ | |\ \ \_ ___ \
def test_app_config_exception(self): try: app = AppConfig('tests/1app_config.json') self.assertEqual(False,'Invalid file passed') except Exception as e: self.assertEqual(True,True)