def main(): import coreaux coreaux.main() import core core.main() import coreaux.addons coreaux.addons.main()
def execution_ctrl_message(): arg = str(sys.argv[1]) if arg == "custom": return input_handler.take_str_input("Enter custom message: ") elif arg == "fantasy": return core.main() + core.list_players(core.my_team) else: return core.main()
def run(self): while True: #Main code goes here ... #Note that logger level needs to be set to logging.DEBUG before this shows up in the logs logger.debug("Debug message") logger.info("Info message") logger.warn("Warning message") logger.error("Error message") result = { 'host' : 'localhost', 'check': 'test_check', 'result' : 'OK' } # r = requests.post('http://127.0.0.1:5000/results', data = result) #print r.text core.main() time.sleep(10)
def main(): os.system("clear") ts(5) print(banner) try: van = input(R + "cbf>> " + W) if van == "use modules qiwi/hacker": ts(3) print("") print("") mod = input(R + "cbf[hack/checker?]: " + W) if mod == "checker": balance.bal() main() elif mod == "hack": vivod.viv() main() elif van == "help": from core import help main() elif van == "quit": print(R + "good bye!" + W) else: print(R + "[X]" + W + " Wrong command -> " + van) ts(2) main() except (KeyboardInterrupt): print(R + "[X]" + W + " Exiting...")
def reset_db(app, db): """ Delete all tables; Create all tables; Populate roles and users. """ # Drop all tables print('Dropping all tables') db.drop_all() # Create all tables print('Creating all tables') db.create_all() # Adding roles print('Adding roles') admin_role = Role(name='admin') db.session.add(admin_role) # Add users print('Adding users') list_users = [] user = add_user(app, db, 'admin', 'Admin', 'User', '*****@*****.**', 'Password1') for currency in SITE_CURRENCIES: volume = Volumes(currency=currency, volume=0) db.session.add(volume) setattr(user, currency, decimal.Decimal(str(uniform(9000, 9999)))) user.roles.append(admin_role) db.session.commit() print ('Adding random orders') users = db_adapter.find_all_objects(User) for u in users: list_users.append(u) for currency, currency2 in EXCHANGABLE_CURRENCIES: for i in range(1,100): user_pass = random.choice(list_users) order_type = random.choice(['buy', 'sell']) amount = uniform(1, 100) price_per_unit = uniform(0.0001, 10) add_order(app, db, user_pass, order_type, currency, currency2, amount, price_per_unit, db_adapter) db_adapter.commit() print ('Orders added') print ('Fullfil batch starting') core.main() print ('Fullfil batch ended')
def main(): #print command line arguments #if len(sys.argv) == 1: # print("Please enter test case") # sys.exit() #print(sys.argv[1]) for example_num in range(len(examples)): prediction_matrix = core.main(examples[example_num] + "_500by500.ply") solution_path = examples[example_num] + ".invHazard.pgm" print(solution_path) solution = load_pgm_file(solution_path.replace("/", "\\")); correct = 0; total = size * size; for i in range(size): for j in range(size): if(solution.getpixel((i,j))==prediction_matrix[i][j]): correct = correct + 1 print("The prediction accuracy is "+correct/float(total)+"%")
def main(): #print command line arguments #if len(sys.argv) == 1: # print("Please enter test case") # sys.exit() #print(sys.argv[1]) for example_num in range(len(examples)): prediction_matrix = core.main(examples[example_num] + "_500by500.ply") solution_path = examples[example_num] + ".invHazard.pgm" print(solution_path) solution = load_pgm_file(solution_path.replace("/", "\\")) correct = 0 total = size * size for i in range(size): for j in range(size): if (solution.getpixel((i, j)) == prediction_matrix[i][j]): correct = correct + 1 print("The prediction accuracy is " + correct / float(total) + "%")
def test_main_raises_pkg_exception(self, mock_clean_exit): bad_inputs = [ self.bad_input, self.decoy_input, self.track_changes_input ] pkg_exception = exceptions.RecomposeError expected_exception = exceptions.RecomposeExit for filename in bad_inputs: input = filename output = self.output with testfixtures.OutputCapture(): with self.subTest(input=input): with self.assertRaises(Exception) as fail: core.main(input, output) mock_clean_exit.assert_called() # SystemExit suppressed. self.assertIsInstance(fail.exception, pkg_exception) self.assertIsInstance(fail.exception, expected_exception)
def run(self): """Overwrite run() method, put what you want the thread do here""" while not self.__stop: if self.__status == 0: time.sleep(1) elif self.__status == 1: try: os.chdir(self.__curWorkDir) if self.__platform == 0: core.main(self.__task,self.__channelJsonData) core.deleteWorkspace(self.__task) elif self.__platform == 1: pass #coreios.main(self.__task) #coreios.deleteWorkspace(self.__task) self.__status = 0 except Exception as e: self.__status = 0 # file_operate.reportError(traceback.format_exc(), int(threading.currentThread().getName())) error_operate.error(80)
def data_handle(): data = request.form['product'] amazon = request.form.get('amazon') flipkart = request.form.get('flipkart') a_title, a_price, a_url, f_title, f_price, f_url = core.main( data, amazon, flipkart) return render_template("index.html", a_title=a_title, a_price=a_price, a_url=a_url, f_title=f_title, f_price=f_price, f_url=f_url)
def run(self): """Overwrite run() method, put what you want the thread do here""" print '<---packThread run()--->' while not self.__stop: if self.__status == 0: time.sleep(1) elif self.__status == 1: try: os.chdir(self.__curWorkDir) if self.__platform == 0: core.main(self.__task) core.deleteWorkspace(self.__task) # elif self.__platform == 1: # coreios.main(self.__task) # coreios.deleteWorkspace(self.__task) self.__status = 0 except Exception as e: print '<---packThread Exception--->%s' % (e) self.__status = 0 file_operate.reportError( traceback.format_exc() + '\r\n%s' % (e), int(threading.currentThread().getName())) error_operate.error(80)
def Translation(self): if len(self.lineEdit.text()) != 0: self.open_path = self.lineEdit.text() if os.path.exists(self.open_path): if core.main(self.open_path): QMessageBox.warning(self, "Oops", "Faild to translate") else: QMessageBox.information( self, "Successful", "Translate done in Translation-result file") else: QMessageBox.warning(self, "Oops", "Please set you Language") else: QMessageBox.warning(self, "Oops", "Please choice a srt file")
def main(): print(banner) try: van = input(">>> ") if van == "1" or van == "01": balance.bal() main() elif van == "2" or van == "02": vivod.viv() main() elif van == "3" or van == "03": print(R+"\nBye, bye\n"+W) else: print(R+"[X]"+W+" Wrong command -> " + van) ts(1) main() except(KeyboardInterrupt): print(R+"[X]"+W+" Exiting...")
from core import main main()
else: networks = None filtered = False self.networks.export_networks(export_format, filename, networks, self.tracks, filtered) def export_add_network(self, mac): self.export_networks[mac] = True def export_remove_network(self, mac): self.export_networks[mac] = False def update_statusbar(self): if self.map is not None: on_map = len(self.map.markers) else: on_map = 0 text = "Networks: %s in the current session, %s total, %s in the network list, %s on the map" % \ (len(self.networks.recent_networks), len(self.networks.networks), len(self.network_list.network_iter), on_map) self.statusbar.push(self.statusbar_context, text) if __name__ == "__main__": try: from . import core except SystemError: import core core.main()
def main(self): # 单独过一关的主函数 num_list = copy.deepcopy(shudu.run_return_num()) # 数独算法,从原始num_list_orn,计算出结果num_list_result num_list_result = core.main(num_list) shudu.run_input_num(num_list_result)
import os import core if __name__ == '__main__': core.main( "data/search_meguro.csv", "data/meguro.geojson", "Meguro-ku", { "CONSUMER_KEY": os.getenv("MEGURO_CONSUMER_KEY"), "CONSUMER_SECRET": os.getenv("MEGURO_CONSUMER_SECRET"), "ACCESS_TOKEN": os.getenv("MEGURO_ACCESS_TOKEN"), "ACCESS_TOKEN_SECRET": os.getenv("MEGURO_ACCESS_TOKEN_SECRET"), }, )
import sys from core import main if __name__ == '__main__': sys.exit(main())
@log_exceptions def cleanup(self, *args, **kwargs): """Cleanup SHOULD be called before quitting mainloop. remember to use super() to call all mixin/parent cleanup methods too""" for mkey in self.motors.keys(): self.motors[mkey].stop() if self.xbeehandler: self.xbeehandler.quit() super().cleanup(*args, **kwargs) @log_exceptions def quit(self, *args): """Cleans up and stops mainloop""" self.logger.info("Quitting") self.logger.debug("Calling cleanup") self.cleanup() self.logger.debug("Stopping mainloop") self.mainloop.stop() @log_exceptions def run(self): """Starts the mainloop, will only return when mainloop stops""" self.logger.info("Starting mainloop") self.mainloop.start() self.logger.debug("Closing mainloop") self.mainloop.close() if __name__ == '__main__': instance = main(__file__, KaraCRTL)
import os, sys, pprint #is_64bits = sys.maxsize > 2**32 # # #if not os.path.exists('hyrobot/core.pyd'): # from shutil import copyfile # if is_64bits: # copyfile('hyrobot/core.cp37-win_amd64.pyd', 'hyrobot/core.pyd') # else: # copyfile('hyrobot/core.cp37-win32.pyd', 'hyrobot/core.pyd') if not (3, 6, 0) <= sys.version_info < (3, 9, 0): print("黑羽robot只支持 Python 3.6、3.7、3.8 版本") exit() from core import main result = main() pprint.pprint(result)
def run(): sanityCheck() core.main()
The Main Fucntion Init the Code """ def main(): start = sb0x_shell() start.run() """ The While loop is For The Exception """ if __name__ == '__main__': parser = optparse.OptionParser(version=SB0X_VERSION) parser.parse_args() while True: try: LOOP_COUNT += 1 if LOOP_COUNT == 1: api.std.cles() header() main() except KeyboardInterrupt: notify("\ntype 'q' to quit") except EOFError: notify("Ctrl + D Pressed") api.std.quit(0) except Exception as e: error(e.message) api.std.quit(1)
import os import asyncio use_uvloop = False print(' - Detecting uvloop...') try: import uvloop except ImportError: print(' - Could not load uvloop') else: print(' - Will use uvloop.') use_uvloop = True while True: print(' - Loading bot code') import core print(' - Ready to start bot!') retval = core.main(use_uvloop) print(' - Bot stopped.') if retval: # restart print(' - Flushing buffers') sys.stdout.flush() print(' - Restarting bot.') if sys.platform in ['linux', 'linux2', 'darwin']: os.execl(sys.executable, sys.executable, *sys.argv) else: print(' - Unloading old code') del core sys.modules = {} print(' - Discarding old event loop') loop_old = asyncio.get_event_loop() loop_old.close() print(' - Creating new event loop')
from core import main import logging import os path = os.getcwd() logger = logging.getLogger('web-daemon') logger.setLevel(logging.DEBUG) fh = logging.FileHandler(path + '/logs/daemon-logs.log') fh.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s -- %(message)s') fh.setFormatter(formatter) logger.addHandler(fh) main(logger, path, "https://google.com", "*****@*****.**")
def test_main_runs(self): input = self.good_input output = self.output core.main(input, output)
# -*- coding: utf-8 -*- import sys import os import unittest import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__) + '/src' ))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__) + '/tests' ))) #from core import get_answer from core import main if __name__ == '__main__': f = open('packets/tcp.txt','r') g = open('packets/udp.txt','r') main(f)
from core import main import argparse # Parse command line arguments parser = argparse.ArgumentParser(description='Run analysis program on a log file') parser.add_argument("filename", help="Source log file") parser.add_argument("logtype", help="The kind of log") parser.add_argument("-e", "--export_prototypes", action="store_true", help="Export models to file") parser.add_argument("-i", "--import_prototypes", action="store_true", help="Import models from file") args = parser.parse_args() import_prototypes = False export_prototypes = False if args.export_prototypes: export_prototypes = True if args.import_prototypes: import_prototypes = True main(args.filename, args.logtype, export_prototypes, import_prototypes)
#Rebond for b in balls: print(b) if b[0] > core.WINDOW_SIZE[0] - b[5]: b[2] = abs(b[2]) * -1 b[4] = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) if b[0] < b[5]: b[2] = abs(b[2]) b[4] = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) print("change X") if b[1] > core.WINDOW_SIZE[1] - b[5]: b[3] = abs(b[3]) * -1 b[4] = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) print("change Y") if b[1] < b[5]: b[3] = abs(b[3]) for b in balls: b[0] = int(b[0] + 5 * b[2]) b[1] = int(b[1] + 5 * b[3]) for b in balls: pygame.draw.circle(core.screen, (b[4]), (b[0], b[1]), b[5]) core.main(setup, run)
#import time import core #frequencyInSec = 60.0 * 1.0 #every minute #frequencyInSec = 60.0 * 30.0 #every 30 minutes #postToTumblr = True #startTime = time.time() #step = frequencyInSec - ((time.time() - startTime) % frequencyInSec) #while True: # if step > 1: #print "tick - " + time.strftime("%H:%M:%S") # core.main(postToTumblr) # step = frequencyInSec - ((time.time() - startTime) % frequencyInSec) # time.sleep(step) # else: # print "Error in step calculation - step="+step core.main(True)
def data_handle(): data = request.form['product'] a_title, a_price, a_url, f_title, f_price, f_url = core.main(data) return render_template("index.html",a_title = a_title, a_price = a_price, a_url = a_url ,f_title= f_title, f_price = f_price, f_url = f_url)
#!/usr/bin/python # -*- coding: utf-8 -*- #sys.argv[1:] ######################### ### File requirements ### ######################### ### import main module function from core import main ### import system module import sys #################### ### File manager ### #################### if __name__ == '__main__': main(*sys.argv[1:])
for mac in self.export_networks: if self.export_networks[mac] is True: networks.append(mac) else: networks = None self.networks.export_networks(export_format, filename, networks, self.tracks) def export_add_network(self, mac): self.export_networks[mac] = True def export_remove_network(self, mac): self.export_networks[mac] = False def update_statusbar(self): if self.map is not None: on_map = len(self.map.markers) else: on_map = 0 text = "Networks: %s in the current session, %s total, %s in the network list, %s on the map" % \ (len(self.networks.recent_networks), len(self.networks.networks), len(self.network_list.network_iter), on_map) self.statusbar.push(self.statusbar_context, text) if __name__ == "__main__": try: from . import core except SystemError: import core core.main()
twitter = OAuth1Session(CK, CS, AT, AS) req = twitter.post(url, params = params) # レスポンスを確認 if req.status_code == 200: print ("--tweet OK--") else: print ("--tweet Error code: {0}--".format(req.status_code)) done = False while True: date = dt.now() print(date, "checking now...") if done == False and (date.hour == 23 or date.hour == 16) and 59 > date.minute > 20: print("--call core main--") result = core.main() done = True msg = "【unkaitter bot test】{0}に雲海が出る尤度は{1}です。".format((date + td(days=1)).strftime("%Y-%m-%d"), result[0][1]) print(msg) post_tweet(msg) print("--done--") if date.hour == 0 or date.hour == 17: print("--ready--") done = False time.sleep(60)
def main(): """Entry point for the application script.""" core.main()
parser.add_argument('-v', '--verbose', action='store_true', help='increase output verbosity') parser.add_argument('-f', '--forget_cache', action='store_true', help='disregard cached deals when deciding whether to send emails') parser.add_argument('-s', '--suppress_emails', action='store_true', help='suppress email sending') parser.add_argument('--smtp', default='smtp.gmail.com', help='SMTP email server (default:smtp.gmail.com)') parser.add_argument('-u', '--user', help='email user') parser.add_argument('-p', '--password', help='email password') schedule_group = parser.add_mutually_exclusive_group() schedule_group.add_argument('--hours', type=int, help='schedule a run every number of hours') schedule_group.add_argument('--minutes', type=int, help='schedule a run every number of minutes') args = parser.parse_args() if not args.suppress_emails and (args.user is None or args.password is None): print('Please provide --user and --password arguments or enable the --suppress_emails option') parser.print_usage() else: core.main(args) if args.hours or args.minutes: scheduler = BackgroundScheduler() if args.hours: scheduler.add_job(core.main, 'interval', args=[args] if args is not None else [], hours=args.hours) elif args.minutes: scheduler.add_job(core.main, 'interval', args=[args] if args is not None else [], minutes=args.minutes) scheduler.start() print('Schedule started...') print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: # This is here to simulate application activity (which keeps the main thread alive). while True: time.sleep(2) except (KeyboardInterrupt, SystemExit): # Not strictly necessary if daemonic mode is enabled but should be done if possible