def run(): parse_arguments() log = init_logging() log.info("{}, {}".format(brand.name, brand.version)) try: import debug debug.init() except ImportError as ie: pass pygame.init() p.platform = platform machine.init() config.init() bind() init() if p.options["develop"]: p.engine.processors += [p.keyboard.process] p.engine.processors += [p.proc.process] p.engine.processors += [p.timers.service] p.engine.processors += [p.events.dispatch] p.now = time.time() startup.init() extra.init() startup.bootstrap() p.engine.run()
def init(scriptConfig, engineConfig, userPreferences, customGraphicPrefs, loadingScreenGUI=None): global g_settings if not config_consts.SEND_CONSTS_TO_CLIENT: import db.DBLogic db.DBLogic.initDB(False, IGNORE_CACHE_TAG not in sys.argv) BigWorld.gameLoadingScreenSetProgress(0.965) import gc gc.set_debug(gc.DEBUG_UNCOLLECTABLE | gc.DEBUG_INSTANCES | gc.DEBUG_SAVEALL) if consts.IS_DEBUG_IMPORTED: debug.init() Settings.g_instance = Settings.Settings(scriptConfig, engineConfig, userPreferences, customGraphicPrefs) g_settings = Settings.g_instance BigWorld.gameLoadingScreenSetProgress(0.992) ClientLog.g_instance.init( Settings.g_instance.userPrefs[Settings.KEY_CLIENT_LOGGING]) ClientLog.g_instance.general('Client start.') for x in GUI.roots(): GUI.delRoot(x) BigWorld.worldDrawEnabled(False) BigWorld.setRedefineKeysMode(True) CompoundSystem.setCompoundAlphaAnimSpeed(COMPOUND_ALPHA_ANIM_SPEED) g_windowsManager.start() if loadingScreenGUI: loadingScreenGUI.script.removeAllCallbacks() loadingScreenGUI.script.active(False) BigWorld.setScreenshotNotifyCallback(screenshotNotifyCallback) from account_helpers import ClanEmblemsCache ClanEmblemsCache.ClanEmblemsCache() import CameraZoomStatsCollector CameraZoomStatsCollector.CameraZoomStatsCollector() days = engineConfig.readInt('debug/logDayLimit', -1) if days >= 0: deleteOldFiles(BigWorld.getAppLogsDirectory(), days, '.log') deleteOldFiles(BigWorld.getAppLogsDirectory(), days, '.dmp') import BattleReplay BattleReplay.g_replay = BattleReplay.BattleReplay() BattleReplay.g_replay.deleteOldReplays() RSSDownloader.init() connectionManager.onConnected += onConnected connectionManager.onDisconnected += onDisconnected g_waitingInfoHelper.addWaitingInfo(WAITING_INFO_TYPE.BOOTSTRAP, time.time() - _bwPersonalityStarted)
def __init__(self): self.prevKey = '' self.should_keep_going = True self.paused = False self.hp = 30 self.wordDictionary = dictionary.Dictionary("dictionary_testfile") self.stat = stats.Stats() self.scrn = screen.Screen(self.stat) self.scrn.scr.nodelay(1) self.words = [] self.wordsOnScreen = 10 self.pos_in_word = 0 self.last_time = datetime.datetime.now() self.probableWords = [] self.poss_vals = list(range(1, self.scrn.height - 10)) debug.init() self.new_game()
def Start(): global BOT, proc, A, config_debugmode, db, config, log config = ConfigFile() thread_handler.init(config) loadConfig(config) log = debug.init(config) BOT = Bot(config_prefix, config_rconip, config_rcon, config_debugmode, config=config) A = API() # @TODO Fix this bullshit BOT.Startup() loadMods() proc = GameOutput(config_serversocket) db = database.init(config) x = os.uname() A.say("UrTBot V%s loaded on %s (%s/%s)" % (_version_, sys.platform, x[2], x[4])) loop()
str(currentProcess.PeakVirtualMemorySize64), str(currentProcess.WorkingSet64), str(currentProcess.PeakWorkingSet64)]) + "\n") memoryDumpFile.close() # dispose process handles p.Dispose() currentProcess.Dispose() # ============================================================================ # 3.n Self test # ---------------------------------------------------------------------------- if __name__ == '__main__': debug.init(sys.stdout) sys.stdout = debug.out sys.stderr = debug.err debug.brf('brief') debug.out('normal') debug.vrb('verbose') debug.err('error') sys.stderr.write('Error message\n') try: 1/0 except Exception, e: debug.exception(e) def addGuiAppender(remotePort = 31337): """ Create and add UDP appender for GUI
sys.path.append(os.path.join(root, 'persuasion/code/grab_data')) import discussion as debate data_root_dir = os.path.join(root, "persuasion/data") debate.data_root_dir = data_root_dir from discussion import Discussion as Debate sys.path.append(os.path.join(root, 'utilities/nlp')) sys.path.append(os.path.join(root, 'utilities')) import post from nltk.corpus import wordnet init("debug_out") stopWords = ['without','i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers', 'herself', 'it', 'its', 'itself', 'they', 'them', 'their', 'theirs', 'themselves', 'what', 'which', 'who', 'whom', 'this', 'that', 'these', 'those', 'am', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had', 'having', 'do', 'does', 'did', 'doing', 'a', 'an', 'the', 'and', 'but', 'if', 'or', 'because', 'as', 'until', 'while', 'of', 'at', 'by', 'for', 'with', 'about', 'against', 'between', 'into', 'through', 'during', 'before', 'after', 'above', 'below', 'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', 'over', 'under', 'again', 'further', 'then', 'once', 'here', 'there', 'when', 'where', 'why', 'how', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other', 'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 's', 't', 'can', 'will', 'just', 'don', 'should', 'now', 'let'] falsePositives = [ u'thermo', u'matthew',u'mathew',u'peter',u'charles', u'david',u'gods','god' ,u'welcome', u'dr', u'hitler',u'linux', u'hunt', u"i'm", u'dont',u'call', u'started',u'calling',u'georgia', u"canada", u'montana', u'maine',u'maryland', u'missouri', u'ing', 'org'] isDigit = re.compile(r'\d') def explore(directory, ids, site, func, pd = False): ret = [] for threadId in ids: filename = threadId debug("Processing %s\n" % filename)
#!/usr/bin/python # # Copyright (C) 2016, Vector Li ([email protected]) # import sys import os def foo(d="/tmp"): if os.path.isdir(d): return True else: return False def main(argc, argv): foo() return 0 if __name__ == "__main__": import debug debug.init('DEBUG', True) argc, argv = len(sys.argv), sys.argv sys.exit(main(argc, argv))
#!/usr/bin/python import debug as ud fd = ud.init("stdout", ud.NO_FLUSH, ud.FUNCTION) assert isinstance(fd, file) ud.debug(ud.MAIN, ud.ERROR, "Error in main: %%%") ud.debug(ud.MAIN, ud.WARN, "Warning in main: %%%") ud.debug(ud.MAIN, ud.PROCESS, "Process in main: %%%") ud.debug(ud.MAIN, ud.INFO, "Information in main: %%%") ud.debug(ud.MAIN, ud.ALL, "All in main: %%%") ud.set_level(ud.MAIN, ud.PROCESS) l = ud.get_level(ud.MAIN) assert l == ud.PROCESS ud.reopen() ud.set_function(ud.FUNCTION) ud.begin("Function") ud.end("Function") ud.set_function(ud.NO_FUNCTION) ud.begin("No function") ud.end("No function") ud.exit() ud.set_level(ud.MAIN, ud.ALL) l = ud.get_level(ud.MAIN) assert l != ud.ALL