def run() -> None: if len(sys.argv) < 2: print('No entry point specified.') sys.exit(1) if sys.argv[1] == 'discordbot': from discordbot import bot bot.init() elif sys.argv[1] == 'decksite': from decksite import main main.init() elif sys.argv[1] == 'decksite-profiler': from werkzeug.middleware.profiler import ProfilerMiddleware from decksite import main main.APP.config['PROFILE'] = True main.APP.wsgi_app = ProfilerMiddleware(main.APP.wsgi_app, restrictions=[30 ]) # type: ignore main.init() elif 'price_grabber' in sys.argv: from price_grabber import price_grabber price_grabber.run() elif 'srv_price' in sys.argv: from price_grabber import srv_prices srv_prices.init() elif sys.argv[1] in ['scraper', 'scrapers', 'maintenance']: task(sys.argv) elif sys.argv[1] == 'tests': print('Call `dev.py tests` instead.') sys.exit(1) elif sys.argv[1] == 'rotation': from rotation_script import rotation_script rotation_script.run() elif sys.argv[1] == 'logsite': import logsite logsite.APP.run(host='0.0.0.0', port=5001, debug=True) elif sys.argv[1] == 'github_tools': import github_tools github_tools.APP.run(host='0.0.0.0', port=5002, debug=True) else: try: m = importlib.import_module( '{module}.main'.format(module=sys.argv[1])) m.run() # type: ignore except ImportError: print("I don't recognize `{0}`".format(sys.argv[1])) sys.exit(1) sys.exit(0)
def run(): if len(sys.argv) == 0: print('No entry point specified.') sys.exit(1) if 'discordbot' in sys.argv: from discordbot import bot bot.init() elif 'decksite' in sys.argv: from decksite import main main.init() elif 'decksite-profiler' in sys.argv: from werkzeug.contrib.profiler import ProfilerMiddleware from decksite import main main.APP.config['PROFILE'] = True main.APP.wsgi_app = ProfilerMiddleware(main.APP.wsgi_app, restrictions=[30]) main.init() elif 'price_grabber' in sys.argv: from price_grabber import price_grabber price_grabber.run() elif 'srv_price' in sys.argv: from price_grabber import srv_prices srv_prices.init() elif sys.argv[1] in ['scraper', 'scrapers', 'maintenance']: task(sys.argv) elif 'tests' in sys.argv: import pytest from magic import multiverse, oracle multiverse.init() oracle.init() sys.argv.remove('tests') code = pytest.main() sys.exit(code) else: print("You didn't tell me what to run or I don't recognize that name") sys.exit(1) sys.exit(0)
def price_grabber() -> None: from price_grabber import price_grabber as grabber grabber.run()