def inputDataOprate(exceldata,sdic): usedata=replaceData(exceldata) if usedata in [[''],['None']]: return True for i in usedata: if ":=" not in i: log.Output(" 输入的数据有误: %s" %i,'error') return False try: sname=i.split(":=")[0].strip() svalue=str(i.split(":=")[1]).strip() obj="" if svalue.startswith("["): try: svalue = eval(svalue) except Exception,e: log.Output(e,"error") for i in sname.split("."): if isnumeric(i): obj="%s[%s]" %(obj,i) else: obj="%s['%s']" %(obj,i) scmd ='''%s%s=%s''' %("sdic",obj,svalue) exec(scmd) except Exception,e: log.Output("输入的数据有误:%s" %usedata,"error") return False
def fetch_soma_sec(section_name): cell_model = 'Hayton.hoc' h.load_file(cell_model) cell = h.L5PC soma = cell.soma[0] exec('sec = cell.' + section_name) return soma, sec
def calc(self): code = "def function():\n" code += (" ret = []\n") for variable in self.var: code +=(" " + variable + " = 0\n") code += " binCount = 0\n" code += " for item in range(" + str(2**len(self.var)) + "):\n" binCountBasis = 0b1 # TODO: Change this to use enumerate # TODO: Explain the weird ordering here for n in reversed(range(len(self.var))): code += (" " + self.var[n] + " = bool(binCount & " + str(binCountBasis) + ")\n") binCountBasis <<= 1 code += " a = int(" + self.exp + ")\n" code += " ret.append(a)\n" code += (" binCount += 1\n") code += (" return ret\n") exec(code) self.functionVal = function()
def run(self): if matplotlib is None: msg = req_missing(['matplotlib'], 'use the plot directive', optional=True) return [nodes.raw('', '<div class="text-error">{0}</div>'.format(msg), format='html')] if not self.arguments and not self.content: raise self.error('The plot directive needs either an argument or content.') if self.arguments and self.content: raise self.error('The plot directive needs either an argument or content, not both.') if self.arguments: plot_path = self.arguments[0] with io.open(plot_path, encoding='utf-8') as fd: data = fd.read() elif self.content: data = '\n'.join(self.content) plot_path = md5(data).hexdigest() # Always reset context plt.close('all') matplotlib.rc_file_defaults() # Run plot exec(data) out_path = os.path.join(self.out_dir, plot_path + '.svg') plot_url = '/' + os.path.join('pyplots', plot_path + '.svg').replace(os.sep, '/') figures = [manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()] for figure in figures: makedirs(os.path.dirname(out_path)) figure.savefig(out_path, format='svg') # Yes, if there's more than one, it's overwritten, sucks. self.arguments = [plot_url] return super(PyPlot, self).run()
def main(): topdir = detect_topdir() if topdir is None: print('Could not locate topdir. You must run ``gloabl-wasp`` ' 'either from a file tree' 'containing a ``wasp`` file or from a build directory ' 'containing an initialized `{0}` file.'.format(CACHE_FILE)) sys.exit(1) unpack_dir = os.path.join(topdir, UNPACK_DIR) if not os.path.exists(unpack_dir): fname = os.path.join(topdir, 'wasp') code = [] with open(fname, 'r') as f: start = False for line in f: if 'wasp_packed=[' in line: start = True if line == '\n' and start: break if start: code.append(line) vs = {} exec(''.join(code), vs, vs) unpack(unpack_dir, vs['wasp_packed']) sys.path.append(unpack_dir) run(topdir, unpack_dir)
def helpModule(module): """ Print the first text chunk for each established method in a module. module: module to write output from, format "folder.folder.module" """ # split module.x.y into "from module.x import y" t = module.split(".") importName = "from " + ".".join(t[:-1]) + " import " + t[-1] # dynamically do the import exec(importName) moduleName = t[-1] # extract all local functions from the imported module, # referenced here by locals()[moduleName] functions = [locals()[moduleName].__dict__.get(a) for a in dir(locals()[moduleName]) if isinstance(locals()[moduleName].__dict__.get(a), types.FunctionType)] # pull all the doc strings out from said functions and print the top chunk for function in functions: base = function.func_doc base = base.replace("\t", " ") doc = "".join(base.split("\n\n")[0].strip().split("\n")) # print function.func_name + " : " + doc print helpers.formatLong(function.func_name, doc)
def rrKSOStartServer(arg): logMessage("rrKSO startup...") if ((arg.KSOPort== None) or (len(str(arg.KSOPort))<=1)): arg.KSOPort=7774 HOST, PORT = "localhost", int(arg.KSOPort) server = kso_tcp.rrKSOServer((HOST, PORT), kso_tcp.rrKSOTCPHandler) flushLog() logMessage("rrKSO server started") flushLog() kso_tcp.rrKSONextCommand="" while server.continueLoop: try: logMessageDebug("rrKSO waiting for new command...") server.handle_request() time.sleep(1) # handle_request() seem to return before handle() completed execution except Exception, e: logMessageError( e) server.continueLoop= False; import traceback logMessageError(traceback.format_exc()) logMessage(" ") logMessage(" ") logMessage("rrKSO NextCommand ______________________________________________________________________________________________") logMessage("rrKSO NextCommand '"+ kso_tcp.rrKSONextCommand+"'") logMessage("rrKSO NextCommand ______________________________________________________________________________________________") flushLog() if (len(kso_tcp.rrKSONextCommand)>0): if ((kso_tcp.rrKSONextCommand=="ksoQuit()") or (kso_tcp.rrKSONextCommand=="ksoQuit()\n")): server.continueLoop=False kso_tcp.rrKSONextCommand="" else: exec (kso_tcp.rrKSONextCommand) kso_tcp.rrKSONextCommand=""
def create_node(self, factory, nodeurl, **config): try: as_node(nodeurl) except KeyError: pass else: raise TypeError("Node exists: %s" % nodeurl) if isinstance(factory, str): module,sep,name = factory.rpartition(".") if name: exec("import %s" % module) factory = eval(factory) parent,sep,name = nodeurl.rpartition("/") configuration = {"name": name, "parent": parent} configuration.update(config) node = factory() try: node.configure(configuration) except: msglog.log("broadway", msglog.types.WARN, "Error prevented configuration of new node: %s" % node) msglog.exception(prefix="handled") try: node.prune() except: msglog.exception(prefix="handled") else: msglog.log("broadway", msglog.types.INFO, "Node successfully pruned.") else: msglog.log("broadway", msglog.types.INFO, "New node created: %s" % node) self.updatepdo(nodeurl, node) node.start() return node.configuration()
def get_version(filename): """Extract __version__ from file by parsing it.""" with open(filename) as fp: for line in fp: if line.startswith('__version__'): exec(line) return __version__
def _add_keywords(arg_name): """ This function is used to create a decorator that add arg_name keywords to a function""" s = """def add_keywords_decorator(f): def function({0}):return f({0}) return function""" exec(s.format(', '.join(arg_name))) return locals()['add_keywords_decorator']
def __init__(self): #try loading the config file # if it doesn't exist, create one try: self.configFile = expanduser("~") + "/.puut/puut.conf" #load configuration self.config = {} exec(open(self.configFile).read(),self.config) except IOError: self.setupPuut() call(["notify-send", "Puut: Setup config", "Setup your user data at '~/.puut/puut.conf'"]) sys.exit(1) #testing if server & credentials are correct r = requests.get(self.config["serverAddress"] + "/info", auth=(self.config["user"],self.config["password"])) if not (r.text=="PUUT"): call(["notify-send", "Puut: Server error", "Contacting the server was unsuccessful, are credentials and server correct?\nResponse was: "+ r.text]) sys.exit(1) #setting up keyhooks for self.idx, self.val in enumerate(self.config["keys"]): keybinder.bind(self.val, self.hotkeyFired, self.idx) #setup GTK Status icon self.statusicon = gtk.StatusIcon() self.statusicon.set_from_file("icon.png") self.statusicon.connect("popup-menu", self.right_click_event) self.statusicon.set_tooltip("StatusIcon Example")
def parsemodel(name): parsestring = """ class %(name)s(basemodel): _repr_expr='%(name)s' def __init__(self): self.pardata1 = open(XSPEC_MODULE_PATH+'/%(name)s.dat1', 'r').readlines() self.pardata2 = open(XSPEC_MODULE_PATH+'/%(name)s.dat2', 'r').readlines() basemodel.__init__(self) for lines in self.pardata1: self.parameters.append(parameter(lines.split())) for par in self.parameters: par.model=repr(self) par.group=0 for lines in self.pardata2: linestr=lines.split() (numbkey, index, comp, modelname, parname, unit) = linestr[:6] self.__dict__[parname] = self.parameters[int(index)-1] self.__dict__[parname].name=parname self.__parameter_names__.append(parname) try:float(unit) except:self.__dict__[parname].unit=unit self.parlength=len(self.parameters) #def update(self): #for pars in [x for x in self.parameters if x.group == 0]: #object.__setattr__(self, pars.name, pars) """ % {'name':name} exec(parsestring) clsobj = locals()[name] globals().update({name:clsobj})
def __init__(self, parent=None): self.logactive = 0 self.resetactive = 0 self.port = "5555" self.ip = "" ##self.ip = "10.42.1.1" ##self.ip = "10.42.1.1" ##self.ip = "129.194.118.114" ##self.ip = "10.194.116.98" self.nb_slots = 5 self.context = zmq.Context() self.socket = self.context.socket(zmq.REQ) QtGui.QWidget.__init__(self, parent) self.showDialog() if (self.ip == ""): sys.exit(0) self.socket.connect("tcp://%s:%s" % (self.ip,self.port)) self.graphical_intf() self.setWindowTitle("Easy-phi client connected with: %s" % self.ip) self.slots = [] self.frames = [] for i in range(self.nb_slots): self.frames.append(QtGui.QFrame(self.tab[i + 1])) self.frames[i].setGeometry(QtCore.QRect(0, 50, 950, 750)) self.frames[i].setStyleSheet("QWidget {background-color: #EEEEFF }") exec('self.slots.append(slot_%d.slot(self, "10.194.116.98", str(5556+i), self.frames[i]))' % (i+1)) self.slots[i].graphical_intf() timer = QtCore.QTimer(self) QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), self.on_timer) timer.start(200) ### 0.2 second
def searchId(self, id, stype): QApplication.setOverrideCursor(Qt.WaitCursor) title_field = 'name' if stype == 'movie': cap = CapCinema title_field = 'original_title' elif stype == 'person': cap = CapCinema elif stype == 'torrent': cap = CapTorrent elif stype == 'subtitle': cap = CapSubtitle if '@' in id: backend_name = id.split('@')[1] id = id.split('@')[0] else: backend_name = None for backend in self.weboob.iter_backends(): if backend.has_caps(cap) and ((backend_name and backend.name == backend_name) or not backend_name): exec('object = backend.get_%s(id)' % (stype)) if object: func_display = 'self.display' + stype[0].upper() + stype[1:] exec("self.doAction('Details of %s \"%%s\"' %% object.%s, %s, [object, backend])" % (stype, title_field, func_display)) QApplication.restoreOverrideCursor()
def readtab(self,tabfile,fdict): if isinstance(tabfile,types.ModuleType): lextab = tabfile else: if sys.version_info[0] < 3: exec("import %s as lextab" % tabfile) else: env = { } exec("import %s as lextab" % tabfile, env,env) lextab = env['lextab'] if getattr(lextab,"_tabversion","0.0") != __version__: raise ImportError("Inconsistent PLY version") self.lextokens = lextab._lextokens self.lexreflags = lextab._lexreflags self.lexliterals = lextab._lexliterals self.lexstateinfo = lextab._lexstateinfo self.lexstateignore = lextab._lexstateignore self.lexstatere = { } self.lexstateretext = { } for key,lre in lextab._lexstatere.items(): titem = [] txtitem = [] for i in range(len(lre)): titem.append((re.compile(lre[i][0],lextab._lexreflags),_names_to_funcs(lre[i][1],fdict))) txtitem.append(lre[i][0]) self.lexstatere[key] = titem self.lexstateretext[key] = txtitem self.lexstateerrorf = { } for key,ef in lextab._lexstateerrorf.items(): self.lexstateerrorf[key] = fdict[ef] self.begin('INITIAL')
def InitiateData(self): self.ObservedData = tmcmc.mcmc.ReadMultiList(self.lcFileList) self.NuisanceData = tmcmc.mcmc.ReadDetrendFile(self.nuisONOFF) exec(self.FuncExecString % self.FuncName) self.ModelData = ModelFunc(self.ModelParams,self.ObservedData) self.DetrendedData = tmcmc.mcmc.DetrendData(self.ObservedData,self.ModelData,self.NuisanceData,'',False) if self.name == 'GJ1214': TempObserved = tmcmc.mcmc.ReadMultiList(self.objectPath+'spotflaresed/GJ1214.LC.listx') TempNuisance = tmcmc.mcmc.ReadDetrendFile(self.objectPath+'spotflaresed/GJ1214.NUS.onoffx') TempModel = ModelFunc(self.ModelParams,TempObserved) TempDetrended = tmcmc.mcmc.DetrendData(TempObserved,TempModel,TempNuisance,'',False) ActTags = ['T1','T2','T4','T5'] DT_activity = {} for fileLC in os.listdir(self.dataPath): for TT in ActTags: if fileLC.endswith(TT+'.spfl.lcx'): Data = tmcmc.iomcmc.ReadSingleDataFile(self.dataPath+fileLC) xSp = np.array(Data['all']['x']) tDt = np.array(TempDetrended[TT]['x']) idx = np.mod(tDt.searchsorted(xSp),len(tDt)) idx = idx[tDt[idx] == xSp] xData = np.array(TempDetrended[TT]['x']) yData = np.array(TempDetrended[TT]['y']) yErr = np.array(TempDetrended[TT]['yerr']) DT_activity[TT] = {'x':xData[idx],\ 'y':yData[idx], 'yerr':yErr[idx]} self.Activity = DT_activity
def HiResModelLC(self, **kwargs): Num = 5e3 # number of points DeltaT = 0.2 # days before and after T0 to compute lightcurve ModPar = self.ModelParams for key in kwargs: if key.lower() == 'npoints': Num = kwargs[key] if key.lower() == 'dt': DeltaT = kwargs[key] if key.lower() == 'modelpars': ModPar = kwargs[key] TempObserved = {} for par in self.ModelParams.keys(): if par.startswith('T0.'): TT = map(str, par.split('.')) TStart = self.ModelParams[par]['value'] - DeltaT TEnd = self.ModelParams[par]['value'] + DeltaT TempObserved[TT[1].strip()] = {'x':np.linspace(TStart,TEnd,Num)} allT = [] for Tnum in self.ObservedData['all']['tagorder'].keys(): allT.extend(TempObserved['T'+str(Tnum)]['x']) TempObserved['all'] = {'x':np.array(allT),'tagorder':self.ObservedData['all']['tagorder']} exec(self.FuncExecString % self.FuncName) HRData = ModelFunc(ModPar,TempObserved) for TT in self.ObservedData.keys(): if TT.startswith('T'): HRData[TT]['x'] = TempObserved[TT]['x'] self.HiResModelData = HRData
def main(): if len(sys.argv) > 1 and sys.argv[1] == "+diag": del sys.argv[1] diag = True else: diag = False if len(sys.argv) > 1 and sys.argv[1] == "+compile": del sys.argv[1] compile_only = True else: compile_only = False ddb_path = os.path.join(os.path.dirname(sys.argv[1]), "device_db.pyon") dmgr = DeviceManager(DeviceDB(ddb_path)) with open(sys.argv[1]) as f: testcase_code = compile(f.read(), f.name, "exec") testcase_vars = {'__name__': 'testbench', 'dmgr': dmgr} exec(testcase_code, testcase_vars) try: core = dmgr.get("core") if compile_only: core.compile(testcase_vars["entrypoint"], (), {}) else: core.run(testcase_vars["entrypoint"], (), {}) print(core.comm.get_log()) core.comm.clear_log() except CompileError as error: if not diag: exit(1)
def get_data(self): """ central routine to extract data for all variables using functions specified in derived class """ self.variables = {} for k in self.dic_vars.keys(): self._actplot_options = self.plot_options.options[k]['OPTIONS'] # set variable specific options (needed for interpolation when reading the data) routine = self.dic_vars[k] # get name of routine to perform data extraction interval = self.intervals[k] cmd = 'dat = self.' + routine if hasattr(self, routine[0:routine.index('(')]): # check if routine name is there print cmd exec(cmd) # if a tuple is returned, then it is the data + a tuple for the original global mean field if 'tuple' in str(type(dat)): self.variables.update({k: dat[0]}) # update field with data self.variables.update({k + '_org': dat[1]}) # (time, meanfield, originalfield) else: self.variables.update({k: dat}) # update field with data else: print k print self.dic_vars print routine print('WARNING: unknown function to read data (skip!), variable: %s ' % k) self.variables.update({k: None})
def loaddb(): for each in dircache.listdir('db/'): reader = csv.reader(open('db/'+each, 'rb')) templist = [] for record in reader: templist.append(record) exec("global "+str(each)+";"+str(each)+" = templist")
def main(script_name, stored_testinfo, snapshots_dir): # do interceptions and other setup task here # ... sys.path.insert(0, os.getcwd()) module_name = script_name[:script_name.rfind('.py')] print 'module name:', module_name s = "import %s as script_module"%module_name exec(s) if stored_testinfo != script_module.testinfo: sys.stderr.write("Es01 - received testinfo doesn't match script testinfo. (db outdated?)\n") sys.exit(1) screen_sampler, diagnostic = st.ScreenSampler.sampler(stored_testinfo, script_name, fn_quit=quit_pyglet_app, fn_take_snapshot=take_snapshot_cocos_app, snapshots_dir=snapshots_dir) assert diagnostic == '' clock = cc.get_autotest_clock(screen_sampler) cocos.custom_clocks.set_app_clock(clock) set_init_interceptor() #sys.stderr.write('\nafter interceptor') if hasattr(script_module, 'autotest'): # allows the script to know if running through autotest script_module.autotest = 1 script_module.main()
def init_markets(self, markets): self.market_names = markets for market_name in markets: exec('import public_markets.' + market_name.lower()) market = eval('public_markets.' + market_name.lower() + '.' + market_name + '()') self.markets.append(market)
def simulate(self,sim_periods=None): ''' Simulates this agent type for a given number of periods (defaults to self.T_sim if no input). Records histories of attributes named in self.track_vars in attributes named varname_hist. Parameters ---------- None Returns ------- None ''' orig_time = self.time_flow self.timeFwd() if sim_periods is None: sim_periods = self.T_sim for t in range(sim_periods): self.simOnePeriod() for var_name in self.track_vars: exec('self.' + var_name + '_hist[self.t_sim,:] = self.' + var_name) self.t_sim += 1 if not orig_time: self.timeRev()
def runSampleEnvironmentScan(sampleEvnGroup): # Gets the sample environment settings evnSetting = sampleEnvironments[sampleEvnGroup['target']] controller = evnSetting['controller'] preset = evnSetting[sampleEvnGroup['setting']]['preset'] waitTime = evnSetting[sampleEvnGroup['setting']]['wait'] # Drive drivable controller deviceController = sics.getDeviceController(controller) if (deviceController == None): log('Driving controller ' + controller + ' to set point ' + str(preset)) driverPath = WorkspaceUtils.getFolder(PYTHON_DRIVERS_PATH).getFullPath().toString() driverPath = driverPath.replace('/', '.')[1:] exec('from ' + driverPath + ' import ' + controller) exec(controller + '.drive(preset)') else: log('Driving controller ' + controller + ' to set point ' + str(preset)) sics.drive(controller, preset) # Stabilisation log('Stabilising the controller for ' + str(waitTime) + ' sec') sleep(waitTime) # Recurrsively run (for effectiveness we reverse the configuration on every second run) if sampleEvnGroup['setting'] % 2 == 1: runQuokkaScan(sampleEvnGroup['contents'], True, controller + '=' + str(preset)) else: runQuokkaScan(sampleEvnGroup['contents'], False, controller + '=' + str(preset))
def db_init_new_db(): exec(open(dict_path).read()) configs=[ { 'input_file': input_file, "num_processors":num_processors, 'output_swf': ouput_dir+sched2filename(s), 'stats': False, "scheduler":s } for s in sched_configs] c = conn.cursor() # Create table c.execute('''CREATE TABLE expes (hash text, state text, doer text, options text)''') # Insert a row of data for conf in configs: c.execute("INSERT INTO expes VALUES (?, 'WAIT', 'None', ?)", (opt2hash(conf), json.dumps(conf))) # Save (commit) the changes conn.commit()
def _import_module(module_name, loaded=None): """ Import the module. Import the module and track which modules have been loaded so we don't load already loaded modules. """ # Pull in built-in and custom plugin directory if module_name.startswith("bh_modules."): path_name = join("Packages", "BracketHighlighter", normpath(module_name.replace('.', '/'))) else: path_name = join("Packages", normpath(module_name.replace('.', '/'))) path_name += ".py" if loaded is not None and module_name in loaded: module = sys.modules[module_name] else: module = imp.new_module(module_name) sys.modules[module_name] = module exec( compile( sublime.load_resource(sublime_format_path(path_name)), module_name, 'exec' ), sys.modules[module_name].__dict__ ) return module
def do_px( self, line ): """Execute a Python statement. Node names may be used, e.g.: px print h1.cmd('ls')""" try: exec( line, globals(), self.getLocals() ) except Exception, e: output( str( e ) + '\n' )
def getctrldir(readin,jobid): setting={} molset = readin #open(sys.argv[1],'rt').read() molset= re.sub("@ ?",'\n',molset) exec(molset) setting['ATOM___']=atom setting['PZ___']= pz setting['FSMOM___']='%d' % fsmom setting['ALAT___']= '%9.4f' % alat rmt = discenter/2.0*rstar rsmh= rmt/2.0 eh_c =' %3.1f' % eh # converted to char eh2_c=' %3.1f' % eh2 rsmh_c= ' %3.3f' % max(rsmh,0.5) setting['RMT___']=' %3.3f' % rmt setting['EH___'] =' EH=' +4*eh_c setting['EH2___'] ='EH2=' +4*eh2_c dname1 = dirhead + setout(setting,'ATOM___') \ +',fsmom=' + setout(setting,'FSMOM___') \ +',alat=' + setout(setting,'ALAT___') dname2 = \ 'rmt='+ setout(setting,'RMT___') \ + ',EH=' + string.lstrip(eh_c) + ',EH2='+ string.lstrip(eh2_c) \ + ',' + setout(setting,'PZ___')+',' return dname1,dname2
def load_module(file_path): """ Load a Python source file containing user code. @type file_path: string @param file_path: file path @return: Loaded Python module """ try: return cache_modules[file_path] except KeyError: pass module = imp.new_module(WSCRIPT_FILE) try: code = Utils.readf(file_path, m='rU') except (IOError, OSError): raise Errors.WafError('Could not read the file %r' % file_path) module_dir = os.path.dirname(file_path) sys.path.insert(0, module_dir) exec(compile(code, file_path, 'exec'), module.__dict__) sys.path.remove(module_dir) cache_modules[file_path] = module return module
def init_observers(self, _observers): self.observer_names = _observers for observer_name in _observers: exec('import observers.' + observer_name.lower()) observer = eval('observers.' + observer_name.lower() + '.' + observer_name + '()') self.observers.append(observer)
def run(self): develop.run(self) self.execute(_post_install, [], msg='Running post installation tasks') class PostInstall(install): """Post-installation for production mode.""" def run(self): install.run(self) self.execute(_post_install, [], msg='Running post installation tasks') # Get package and author details. about: Dict[str, str] = {} with open(path.join(here, 'rake_nltk', '__version__.py')) as f: exec(f.read(), about) setup( # Name of the module name='rake_nltk', # Details version=about['__version__'], description=about['__description__'], long_description=long_description, # The project's main homepage. url=about['__url__'], # Author details author=about['__author__'], author_email=about['__author_email__'], # License license=about['__license__'],
# Create an environment for user-config.py which is # a deep copy of the core config settings, so that # we can detect modified config items easily. _exec_globals = copy.deepcopy(_public_globals) # Always try to get the user files _filename = os.path.join(base_dir, 'user-config.py') if os.path.exists(_filename): _filestatus = os.stat(_filename) _filemode = _filestatus[0] _fileuid = _filestatus[4] if not OSWIN32 and _fileuid not in [os.getuid(), 0]: warning('Skipped {fn!r}: owned by someone else.'.format(fn=_filename)) elif OSWIN32 or _filemode & 0o02 == 0: with open(_filename, 'rb') as f: exec(compile(f.read(), _filename, 'exec'), _exec_globals) else: warning('Skipped {fn!r}: writeable by others.'.format(fn=_filename)) elif __no_user_config and __no_user_config != '2': warning('user-config.py cannot be loaded.') class _DifferentTypeError(UserWarning, TypeError): """An error when the required type doesn't match the actual type.""" def __init__(self, name, actual_type, allowed_types): super().__init__( 'Configuration variable "{0}" is defined as "{1.__name__}" in ' 'your user-config.py but expected "{2}".' .format(name, actual_type, '", "'.join(t.__name__
def _path_under_setup(*args): return os.path.join(os.path.dirname(__file__), *args) release_py_path = _path_under_setup(pkg_name, '_release.py') if len(RELEASE_VERSION) > 0: if RELEASE_VERSION[0] == 'v': TAGGED_RELEASE = True __version__ = RELEASE_VERSION[1:] else: raise ValueError("Ill formated version") else: TAGGED_RELEASE = False # read __version__ attribute from _release.py: exec(open(release_py_path).read()) if __version__.endswith('git'): try: _git_version = subprocess.check_output( ['git', 'describe', '--dirty']).rstrip().decode('utf-8').replace('-dirty', '.dirty') except subprocess.CalledProcessError: warnings.warn("A git-archive is being installed - version information incomplete.") else: if 'develop' not in sys.argv: warnings.warn("Using git to derive version: dev-branches may compete.") __version__ = re.sub('v([0-9.]+)-(\d+)-(\w+)', r'\1.post\2+\3', _git_version) # .dev < '' < .post submodules = [ 'chempy.electrochemistry', 'chempy.kinetics', 'chempy.printing',
__extended_path = "/duckietown/catkin_ws/src/dt-core/packages/virtual_joystick/".split( ";") for p in reversed(__extended_path): sys_path.insert(0, p) del p del sys_path __path__ = extend_path(__path__, __name__) del extend_path __execfiles = [] for p in __extended_path: src_init_file = os_path.join(p, __name__ + '.py') if os_path.isfile(src_init_file): __execfiles.append(src_init_file) else: src_init_file = os_path.join(p, __name__, '__init__.py') if os_path.isfile(src_init_file): __execfiles.append(src_init_file) del src_init_file del p del os_path del __extended_path for __execfile in __execfiles: with open(__execfile, 'r') as __fh: exec(__fh.read()) del __fh del __execfile del __execfiles
# Les imports import sys # Ma boite à outils from ma_bao import * # Donne les noms du dossier et du module (automatiquement avec __file__ chemin,module=donner_chemin_nom(__file__) # On teste s'il n'y a pas d'erreurs de synthaxe etc. et on les montre si besoin tester("from {} import *".format(module),globals()) # On renomme ma fonction f f=eval(nom_fonction) # Si le mot de passe est bon on affiche la correction try : cheat(chemin+module,mdp) except: pass # On récupère la fonction solution exec("from {}_Correction import {} as f_sol".format(module,nom_fonction)) #-------------------------------------- def test(): try: for valeur in valeurs_a_tester: rep=f(*valeur) sol=f_sol(*valeur) assert str(rep) == str(sol), "En testant les valeurs {} le résultat obtenu est {} au lieu de {}".format(",".join([str(val) for val in valeur]),str(rep),str(sol)) send_msg("Tests validés","En testant les valeurs {} le résultat obtenu est bien {}".format(",".join([str(val) for val in valeur]),str(rep))) success(chemin+module) except AssertionError as e: fail() send_msg("Oops! ", e) if help: send_msg("Aide 💡", help)
# http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os from pathlib import Path import sys base_dir_loc = Path(__file__).parents[2] version_loc = base_dir_loc / 'octopod/_version.py' with open(version_loc) as version_file: exec(version_file.read()) sys.path.insert(0, str(base_dir_loc)) # -- Project information ----------------------------------------------------- project = 'octopod' copyright = '2020, ShopRunner data science team' author = 'ShopRunner data science team' # The short X.Y version version = __version__ # The full version, including alpha/beta/rc tags release = __version__ # -- General configuration ---------------------------------------------------
def runpy(args: List[str]) -> None: if len(args) < 2: raise SystemExit('Usage: kitty +runpy "some python code"') sys.argv = ['kitty'] + args[2:] exec(args[1])
import numpy import astropy.io.fits as pyfits import Chandra.Time import random # #--- reading directory list # path = '/data/mta/Script/Orbital/Scripts/house_keeping/dir_list' with open(path, 'r') as f: data = [line.strip() for line in f.readlines()] for ent in data: atemp = re.split(':', ent) var = atemp[1].strip() line = atemp[0].strip() exec("%s = %s" % (var, line)) # #--- append path to a private folder # sys.path.append(bin_dir) sys.path.append(mta_dir) # #--- import several functions # import mta_common_functions as mcf # #--- set a temporary file name # rtail = int(time.time() * random.random()) zspace = '/tmp/zspace' + str(rtail) #
def test_version_can_be_read_from_version_file(self): namespace = {} version_path = os.path.join(self.package_path, 'version.py') exec(open(version_path).read(), namespace) self.assertEqual(version.__version__, namespace['__version__'])
import matplotlib as mpl mpl.use('Agg') from utils import * from methods import * from greedy import * from mta import * import numpy as np import numpy.matlib as npm import warnings import scipy.io # experiment Preparation N = 11; env, runtimes, episodes, gamma = RingWorldEnv(N, unit = 1), int(80), int(1e3), lambda x: 0.95 alpha, beta = 0.05, 0.05 target_policy = npm.repmat(np.array([0.05, 0.95]).reshape(1, -1), env.observation_space.n, 1) behavior_policy = npm.repmat(np.array([0.05, 0.95]).reshape(1, -1), env.observation_space.n, 1) # get ground truth expectation, variance and stationary distribution true_expectation, true_variance, stationary_dist = iterative_policy_evaluation(env, target_policy, gamma=gamma) BASELINE_LAMBDAS = [0, 0.5, 0.75, 0.875, 0.9375, 0.96875, 1] things_to_save = {} for baseline_lambda in BASELINE_LAMBDAS: Lambda = LAMBDA(env, lambda_type = 'constant', initial_value = baseline_lambda * np.ones(N)) results = eval_method(true_online_gtd, env, true_expectation, stationary_dist, behavior_policy, target_policy, Lambda, gamma = gamma, alpha=alpha, beta=beta, runtimes=runtimes, episodes=episodes) exec("things_to_save[\'togtd_%g_results\'] = results.copy()" % (baseline_lambda * 1e5)) filename = 'togtd_N_%s_behavior_%g_target_%g_episodes_%g' % (N, behavior_policy[0, 0], target_policy[0, 0], episodes) scipy.io.savemat(filename, things_to_save) pass
from sys import version_info try: from setuptools import setup, find_packages except ImportError: import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages ctx = {} if version_info[0] < 3: execfile('pyRpc/_version.py', {}, ctx) else: exec( compile( open('pyRpc/_version.py', "rb").read(), 'pyRpc/_version.py', 'exec'), {}, ctx) setup(name="pyRpc", version=ctx['__version__'], url='https://github.com/iscab-fr/pyRpc', packages=find_packages(), include_package_data=True, install_requires=['pyzmq'], author="Justin Israel", author_email="*****@*****.**", description="A simple remote procedure call module using ZeroMQ", license="BSD", classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers',
assert abs(times[-1] - final_t) / final_t < 0.1 times = np.array(times) # Check that the timestep is preserved. assert np.allclose(np.diff(times), dt) if plot_solution: import matplotlib.pyplot as pt pt.plot(times, values, label="comp") pt.plot(times, exact(times), label="true") pt.show() error = abs(values[-1] - exact(final_t)) eocrec.add_data_point(dt, error) print(eocrec.pretty_print()) orderest = eocrec.estimate_order_of_convergence()[0, 1] assert orderest > 2 * 0.9 if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1]) else: from pytest import main main([__file__]) # vim: fdm=marker
string_types = (str, unicode) integer_types = (int, long) iterkeys = lambda d, *args, **kwargs: d.iterkeys(*args, **kwargs) itervalues = lambda d, *args, **kwargs: d.itervalues(*args, **kwargs) iteritems = lambda d, *args, **kwargs: d.iteritems(*args, **kwargs) iterlists = lambda d, *args, **kwargs: d.iterlists(*args, **kwargs) iterlistvalues = lambda d, *args, **kwargs: d.iterlistvalues(*args, **kwargs) int_to_byte = chr iter_bytes = iter import collections as collections_abc exec("def reraise(tp, value, tb=None):\n raise tp, value, tb") def fix_tuple_repr(obj): def __repr__(self): cls = self.__class__ return "%s(%s)" % ( cls.__name__, ", ".join( "%s=%r" % (field, self[index]) for index, field in enumerate(cls._fields) ), ) obj.__repr__ = __repr__ return obj
parse_command_line() if (print_usage == True) : print_usage_message() #--------------------------------------------- # Set up Trick executive parameters. #--------------------------------------------- #instruments.echo_jobs.echo_jobs_on() trick.exec_set_trap_sigfpe(True) #trick.checkpoint_pre_init(1) trick.checkpoint_post_init(1) #trick.add_read(0.0 , '''trick.checkpoint('chkpnt_point')''') # Setup for Trick real time execution. This is the "Pacing" function. exec(open( "Modified_data/trick/realtime.py" ).read()) trick.exec_set_enable_freeze(True) trick.exec_set_freeze_command(True) trick.sim_control_panel_set_enabled(True) trick.exec_set_stack_trace(False) # ========================================================================= # Set up the HLA interfaces. # ========================================================================= # Instantiate the Python SpaceFOM configuration object. federate = SpaceFOMFederateConfig( THLA.federate, THLA.manager, THLA.execution_control, THLA.ExCO,
def test_readme_sample(self): """readme sample test""" # pylint: disable=exec-used readme_name = "README.md" readme_path = Path(__file__).parent.parent.joinpath(readme_name) if not readme_path.exists() or not readme_path.is_file(): self.fail(msg=f"{readme_name} not found at {readme_path}") return # gets the first matched code sample # assumes one code sample to test per readme readme_sample = None with open(readme_path, encoding="UTF-8") as readme_file: match_sample = re.search( "```python.*```", readme_file.read(), flags=re.S, ) if match_sample: # gets the matched string stripping the markdown code block readme_sample = match_sample.group(0)[9:-3] if readme_sample is None: self.skipTest(f"No sample found inside {readme_name}.") return with contextlib.redirect_stdout(io.StringIO()) as out: try: exec(readme_sample) except Exception as ex: # pylint: disable=broad-except self.fail(str(ex)) return estimation = None probability = None str_ref1 = "Estimated value:" str_ref2 = "Probability:" texts = out.getvalue().split("\n") for text in texts: idx = text.find(str_ref1) if idx >= 0: estimation = float(text[idx + len(str_ref1) :]) continue idx = text.find(str_ref2) if idx >= 0: probability = float(text[idx + len(str_ref2) :]) if estimation is not None and probability is not None: break if estimation is None: self.fail(f"Failed to find estimation inside {readme_name}.") return if probability is None: self.fail(f"Failed to find max.probability inside {readme_name}.") return with self.subTest("test estimation"): self.assertAlmostEqual(estimation, 2.46, places=4) with self.subTest("test max.probability"): self.assertAlmostEqual(probability, 0.8487, places=4)
def test_issue3297(self): c = compile("a, b = '\U0001010F', '\\U0001010F'", "dummy", "exec") d = {} exec(c, d) self.assertEqual(d['a'], d['b']) self.assertEqual(len(d['a']), len(d['b']))
from sympy.parsing.sympy_parser import parse_expr, auto_number, rationalize try: from sympy.parsing.sympy_parser import NUMBER, NAME, OP except: from sympy.parsing.sympy_tokenize import NUMBER, NAME, OP from sympy import Basic, Symbol, Expr, Atom from sympy.core.function import AppliedUndef import sympy as sym import re from .context import context __all__ = ('symsymbol', 'sympify', 'simplify') global_dict = {} exec('from sympy import *', global_dict) for _symbol in exclude: global_dict.pop(_symbol) for _alias, _name in aliases.items(): global_dict[_alias] = global_dict[_name] cpt_names = ('C', 'E', 'F', 'G', 'H', 'I', 'L', 'R', 'V', 'Y', 'Z') cpt_name_pattern = re.compile(r"(%s)([\w']*)" % '|'.join(cpt_names)) sub_super_pattern = re.compile(r"([_\^]){([\w]+)}") def capitalize_name(name):
for filename in filenames: img = fits.open(path_to_cal+filename) # open each image data = img[0].data # split into data and header header = img[0].header if header['IMAGETYP']=='Bias Frame': bias_header = img[0].header # save header for each image type to attach to master version bias.append(data) # add data array to type list if header['IMAGETYP']=='Dark Frame': dark_header = img[0].header dark.append(data) if header['IMAGETYP']=='Flat Field': flat_header = img[0].header filters.append(header['FILTER']) # store the filters found in this directory in a list # so that we don't attempt to create new master flats with filters we did not have raw flats for code = header['FILTER']+'.append(data)' # string operations to add data to filter-specific list exec(code) del img print('Indexed files:') print(' Bias: %s' % len(bias)) print(' Dark: %s' % len(dark)) print(' Red Flat: %s' % len(Red)) print(' Green Flat: %s' % len(Green)) print(' Blue Flat: %s' % len(Blue)) print(' R Flat: %s' % len(R)) print(' V Flat: %s' % len(V)) print(' B Flat: %s' % len(B)) print(' Halpha Flat: %s' % len(Halpha)) print(' Lum Flat: %s' % len(Lum)) ## make the masters bias_master = np.median(np.array(bias),axis=0)
#!/usr/bin/env python import os import sys from setuptools import setup # Prepare and send a new release to PyPI if "release" in sys.argv[-1]: os.system("python setup.py sdist") os.system("twine upload dist/*") os.system("rm -rf dist/lightkurve*") sys.exit() # Load the __version__ variable without importing the package already exec(open('lightkurve/version.py').read()) setup(name='lightkurve', version=__version__, description="A simple and beautiful package for astronomical " "flux time series analysis in Python.", long_description=open('README.rst').read(), author='KeplerGO', author_email='*****@*****.**', license='MIT', packages=['lightkurve'], install_requires=['numpy>=1.11', 'astropy>=1.3', 'scipy>=0.19.0', 'matplotlib>=1.5.3', 'tqdm', 'oktopus', 'bs4', 'requests', 'astroquery>=0.3.7'], setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-cov', 'pytest-remotedata'], include_package_data=True,
def Flow(ngf=64, num_downs=4, norm='', act='lrelu'): exec(nnlib.import_all(), locals(), globals()) def func(input): x = input x0 = x = Conv2D(ngf, kernel_size=3, strides=1, padding='same', activation='relu', name='features.0')(x) x = MaxPooling2D()(x) x1 = x = Conv2D(ngf * 2, kernel_size=3, strides=1, padding='same', activation='relu', name='features.3')(x) x = MaxPooling2D()(x) x = Conv2D(ngf * 4, kernel_size=3, strides=1, padding='same', activation='relu', name='features.6')(x) x2 = x = Conv2D(ngf * 4, kernel_size=3, strides=1, padding='same', activation='relu', name='features.8')(x) x = MaxPooling2D()(x) x = Conv2D(ngf * 8, kernel_size=3, strides=1, padding='same', activation='relu', name='features.11')(x) x3 = x = Conv2D(ngf * 8, kernel_size=3, strides=1, padding='same', activation='relu', name='features.13')(x) x = MaxPooling2D()(x) x = Conv2D(ngf * 8, kernel_size=3, strides=1, padding='same', activation='relu', name='features.16')(x) x4 = x = Conv2D(ngf * 8, kernel_size=3, strides=1, padding='same', activation='relu', name='features.18')(x) x = MaxPooling2D()(x) x = Conv2D(ngf * 8, kernel_size=3, strides=1, padding='same')(x) x = Conv2DTranspose(ngf * 4, 3, strides=2, padding='same', activation='relu')(x) x = Concatenate(axis=3)([x, x4]) x = Conv2D(ngf * 8, 3, strides=1, padding='same', activation='relu')(x) x = Conv2DTranspose(ngf * 4, 3, strides=2, padding='same', activation='relu')(x) x = Concatenate(axis=3)([x, x3]) x = Conv2D(ngf * 8, 3, strides=1, padding='same', activation='relu')(x) x = Conv2DTranspose(ngf * 2, 3, strides=2, padding='same', activation='relu')(x) x = Concatenate(axis=3)([x, x2]) x = Conv2D(ngf * 4, 3, strides=1, padding='same', activation='relu')(x) x = Conv2DTranspose(ngf, 3, strides=2, padding='same', activation='relu')(x) x = Concatenate(axis=3)([x, x1]) x = Conv2D(ngf * 2, 3, strides=1, padding='same', activation='relu')(x) x = Conv2DTranspose(ngf // 2, 3, strides=2, padding='same', activation='relu')(x) x = Concatenate(axis=3)([x, x0]) x = Conv2D(ngf, 3, strides=1, padding='same', activation='relu')(x) return Conv2D(1, 3, strides=1, padding='same', activation='sigmoid')(x) return func
_ = system('clear') clear() num=input("Please enter your decimal here:") bin=0 divisionControl=int(num) total= [] ##Error handler if(int(num)<0): print("This is not a positive number.\n")#Yes this is not a positive number but it can still convertable to binary number system so no destroys. #Calculate for i in range(1,99): bin = int(divisionControl)%2 divisionControl = int(divisionControl)//2 if(int(divisionControl)==0): break total.append(str(bin)) #Reverse's numbers total.reverse() #Output clear() print("Your input decimal is ", num) print("Your binary is") print("1",end="",sep="") for i in total: print(str(i),sep="",end="")#Place list datas (zero and ones). print() time.sleep(6) exec(open('BinCalculator.py').read())
# (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from codecs import open # To use a consistent encoding from os import path from setuptools import setup HERE = path.dirname(path.abspath(__file__)) # Get version info ABOUT = {} with open(path.join(HERE, 'datadog_checks', 'win32_event_log', '__about__.py')) as f: exec(f.read(), ABOUT) # Get the long description from the README file with open(path.join(HERE, 'README.md'), encoding='utf-8') as f: long_description = f.read() def get_dependencies(): dep_file = path.join(HERE, 'requirements.in') if not path.isfile(dep_file): return [] with open(dep_file, encoding='utf-8') as f: return f.readlines() CHECKS_BASE_REQ = 'datadog_checks_base>=11.0.0'
from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() # Arguments marked as "Required" below must be included for upload to PyPI. # Fields marked as "Optional" may be commented out. # https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package/16084844#16084844 exec(open(path.join(here, 'rubi', '__version__.py')).read()) setup( # This is the name of your project. The first time you publish this # package, this name will be registered for you. It will determine how # users can install this project, e.g.: # # $ pip install sampleproject # # And where it will live on PyPI: https://pypi.org/project/sampleproject/ # # There are some restrictions on what makes a valid project name # specification here: # https://packaging.python.org/specifications/core-metadata/#name name='rubi.bootstrap.pytorch', # Required # Versions should comply with PEP 440:
# docimages_spectro.py # Sends commands to get images for the manual. # Images for https://alphamanual.audacityteam.org/man/Spectrogram_View # Make sure Audacity is running first and that mod-script-pipe is enabled # before running this script. #load and run the common core. exec( open("docimages_core.py" ).read() ) import math import time # 11 2KHz tones, of decreasing amplitude. # With label track to annotate it. def makeStepper(): makeWayForTracks() do( 'NewMonoTrack' ) do( 'Select: Start=0 End=22') do( 'Silence' ) #Just so we can watch. do( 'FitInWindow') for i in range( 0, 11 ): do( 'Select: Start='+str(i*2)+' End='+str(i*2+2) ) do( 'Chirp: StartFreq=2000 EndFreq=2000 StartAmp=' + str( (400**(0.1 * (10-i)))/400 )+' EndAmp=' + str( (400**(0.1 * (10-i) ))/400 )) do( 'Select: Start=0 End=22') do( 'Join' ) do( 'FitInWindow') do( 'AddLabelTrack' ) for i in range( 0, 11 ): do( 'Select: Start='+str(i*2)+' End='+str(i*2+2) )
from flask import Flask application = Flask(__name__) @application.route("/") def hello(): return "Application is Runngin!!!" if __name__ == "__main__": print("hello") exec(open('sbi.py').read()) print("its me") application.run()
import codecs import warnings import os from setuptools import find_packages, setup, Extension import numpy as np from Cython.Build import cythonize from Cython.Distutils import build_ext # get __version__ from _version.py ver_file = os.path.join('sklearn_extra', '_version.py') with open(ver_file) as f: exec(f.read()) DISTNAME = 'sklearn-extra' DESCRIPTION = 'A set of tools for scikit-learn.' with codecs.open('README.rst', encoding='utf-8-sig') as f: LONG_DESCRIPTION = f.read() MAINTAINER = 'G. Lemaitre' MAINTAINER_EMAIL = '*****@*****.**' URL = 'https://github.com/scikit-learn-contrib/scikit-learn-extra' LICENSE = 'new BSD' DOWNLOAD_URL = 'https://github.com/scikit-learn-contrib/scikit-learn-extra' VERSION = __version__ # noqa INSTALL_REQUIRES = ['cython', 'numpy', 'scipy', 'scikit-learn'] CLASSIFIERS = ['Intended Audience :: Science/Research', 'Intended Audience :: Developers', 'License :: OSI Approved',
########################################################## | lolcat # CODED BY : SULTAN SHARIAR TERMUX COMMANDS CHINAL # | lolcat # TELEGRAM : SERCH IN TELEGRAM [TERMUX_COMMANDS] # | lolcat # CONTERY : AFG TELEGRAM CHINAL # | lolcat ########################################################## | lolcat # Careted by Sultan Shariar in AFG countery # NOTE:: this script only for Roted Divais for Hack wifi import marshal exec( marshal.loads( 'c\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00@\x00\x00\x00s\xac\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00d\x00\x00d\x01\x00l\x01\x00Z\x01\x00d\x00\x00d\x01\x00l\x02\x00Z\x02\x00d\x00\x00d\x02\x00l\x00\x00m\x03\x00Z\x03\x00\x01d\x00\x00d\x03\x00l\x04\x00m\x05\x00Z\x05\x00\x01d\x04\x00Z\x06\x00d\x05\x00Z\x07\x00d\x06\x00Z\x08\x00e\x00\x00j\t\x00\x83\x00\x00d\x07\x00k\x02\x00sx\x00e\x01\x00j\n\x00d\x08\x00\x83\x01\x00\x01n\x00\x00e\x00\x00j\x03\x00d\t\x00\x83\x01\x00\x01e\x07\x00GHe\x08\x00GHd\n\x00\x84\x00\x00Z\x0b\x00d\x0b\x00\x84\x00\x00Z\x0c\x00e\x0c\x00\x83\x00\x00\x01d\x01\x00S(\x0c\x00\x00\x00i\xff\xff\xff\xffN(\x01\x00\x00\x00t\x06\x00\x00\x00system(\x01\x00\x00\x00t\x05\x00\x00\x00sleeps"\x00\x00\x00\n[+] https://github.com/rmdirlove\ns\xa9\x06\x00\x00\x1b[93m \n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82\xe2\x96\x84 \xe2\x96\x84 \xe2\x96\x80 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x84\xe2\x96\x84\xe2\x96\x84\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x80\xe2\x96\x80\xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x80 \xe2\x96\x84 \xe2\x94\x82\n\xe2\x94\x82\xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x88 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x84 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x88\xe2\x96\x84\xe2\x96\x84 \xe2\x94\x82\n\xe2\x94\x82\xe2\x96\x80 \xe2\x96\x88\xe2\x96\x80\xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88\xe2\x96\x80 \xe2\x96\x80\xe2\x96\x88 \xe2\x96\x88\xe2\x96\x80 \xe2\x96\x80\xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x84\xe2\x96\x80 \xe2\x96\x88 \xe2\x96\x88 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x96\x88\xe2\x96\x88 \xe2\x96\x88\xe2\x96\x88\xe2\x96\x80 \xe2\x96\x88 \xe2\x96\x80\xe2\x96\x80\xe2\x96\x80 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88\xe2\x96\x80\xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x88 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x96\x88 \xe2\x96\x88 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x88\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x88 \xe2\x96\x80\xe2\x96\x88\xe2\x96\x84\xe2\x96\x88\xe2\x96\x80 \xe2\x96\x80\xe2\x96\x88\xe2\x96\x84\xe2\x96\x88\xe2\x96\x80 \xe2\x96\x80\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x88 \xe2\x96\x80\xe2\x96\x84 \xe2\x96\x84\xe2\x96\x84\xe2\x96\x88\xe2\x96\x84\xe2\x96\x84 \xe2\x96\x80\xe2\x96\x84\xe2\x96\x84 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 CODED BY: https://github.com/mkdirlove \xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\n\xe2\x94\x82 .::[+] GREETINGS : https://web.facebook.com/daisuke.chiba1 [+]::. \xe2\x94\x82\n\xe2\x94\x82 .::[+] GREETINGS : https://web.facebook.com/jflorence07 [+]::. \xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98 \n sj\x00\x00\x00\x1b[92m\n[1] WPS Attack\n[2] WPA / WPA2 Attack\n[3] Offline Bruteforce\n[4] Install & Update\n[5] Exit Tool\n \ni\x00\x00\x00\x00s8\x00\x00\x00\x1b[1;91m\n[!] You must run this program as root. [!]\n\x1b[1;ms\x0e\x00\x00\x00clear && clearc\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00C\x00\x00\x00sN\x00\x00\x00t\x00\x00d\x01\x00\x83\x01\x00}\x00\x00|\x00\x00d\x02\x00\x19j\x01\x00\x83\x00\x00d\x03\x00k\x02\x00r,\x00t\x02\x00\x83\x00\x00\x01n\x1e\x00t\x03\x00j\x04\x00d\x04\x00\x83\x01\x00\x01t\x05\x00GHt\x06\x00GHt\x07\x00\x83\x00\x00\x01d\x00\x00S(\x05\x00\x00\x00Ns\x12\x00\x00\x00Continue [Y/n] -> i\x00\x00\x00\x00t\x01\x00\x00\x00Nt\x05\x00\x00\x00clear(\x08\x00\x00\x00t\t\x00\x00\x00raw_inputt\x05\x00\x00\x00uppert\x04\x00\x00\x00exitt\x02\x00\x00\x00osR\x00\x00\x00\x00t\x04\x00\x00\x00logot\x04\x00\x00\x00menut\x06\x00\x00\x00select(\x01\x00\x00\x00t\x03\x00\x00\x00con(\x00\x00\x00\x00(\x00\x00\x00\x00s\x0c\x00\x00\x00tahmid_rayatt\x04\x00\x00\x00quit+\x00\x00\x00s\x0e\x00\x00\x00\x00\x01\x0c\x01\x16\x01\n\x02\r\x01\x05\x01\x05\x01c\x00\x00\x00\x00\r\x00\x00\x00\x05\x00\x00\x00C\x00\x00\x00s\x1a\x02\x00\x00y\xfd\x01t\x00\x00d\x01\x00\x83\x01\x00}\x00\x00|\x00\x00d\x02\x00k\x02\x00r\xaa\x00t\x01\x00j\x02\x00d\x03\x00\x83\x01\x00\x01t\x03\x00d\x04\x00\x83\x01\x00}\x01\x00d\x05\x00j\x04\x00|\x01\x00\x83\x01\x00}\x02\x00t\x02\x00|\x02\x00\x83\x01\x00\x01d\x06\x00j\x04\x00|\x01\x00\x83\x01\x00}\x03\x00d\x07\x00GHt\x02\x00|\x03\x00\x83\x01\x00\x01d\x08\x00GHt\x03\x00d\t\x00\x83\x01\x00}\x04\x00d\n\x00GHt\x05\x00d\x0b\x00\x83\x01\x00\x01d\x0c\x00j\x04\x00|\x01\x00|\x04\x00\x83\x02\x00}\x05\x00t\x02\x00|\x05\x00\x83\x01\x00\x01nR\x01|\x00\x00d\r\x00k\x02\x00r^\x01t\x01\x00j\x02\x00d\x03\x00\x83\x01\x00\x01t\x03\x00d\x04\x00\x83\x01\x00}\x01\x00d\x05\x00j\x04\x00|\x01\x00\x83\x01\x00}\x02\x00t\x02\x00|\x02\x00\x83\x01\x00\x01d\x0e\x00j\x04\x00|\x01\x00\x83\x01\x00}\x06\x00d\x0f\x00GHt\x05\x00d\x10\x00\x83\x01\x00\x01t\x02\x00|\x06\x00\x83\x01\x00\x01d\x08\x00GHt\x03\x00d\t\x00\x83\x01\x00}\x04\x00t\x03\x00d\x11\x00\x83\x01\x00}\x07\x00t\x03\x00d\x12\x00\x83\x01\x00}\x08\x00d\x13\x00j\x04\x00|\x07\x00|\x04\x00|\x08\x00|\x01\x00\x83\x04\x00}\t\x00t\x02\x00|\t\x00\x83\x01\x00\x01n\x9e\x00|\x00\x00d\x0b\x00k\x02\x00rq\x01t\x06\x00\x01n\x8b\x00|\x00\x00d\x14\x00k\x02\x00r\xb9\x01t\x01\x00j\x02\x00d\x15\x00\x83\x01\x00\x01d\x16\x00GHt\x01\x00j\x02\x00d\x17\x00\x83\x01\x00\x01t\x01\x00j\x02\x00d\x18\x00\x83\x01\x00\x01t\x01\x00j\x02\x00d\x19\x00\x83\x01\x00\x01nC\x00|\x00\x00d\x10\x00k\x02\x00r\xfc\x01t\x03\x00d\x1a\x00\x83\x01\x00}\n\x00t\x03\x00d\x1b\x00\x83\x01\x00}\x0b\x00d\x1c\x00j\x04\x00|\x0b\x00|\n\x00\x83\x02\x00}\x0c\x00t\x02\x00|\x0c\x00\x83\x01\x00\x01n\x00\x00Wn\x16\x00\x04t\x07\x00k\n\x00r\x15\x02\x01\x01\x01d\x1d\x00GHn\x01\x00Xd\x00\x00S(\x1e\x00\x00\x00Ns\x1b\x00\x00\x00\x1b[91mmkdirlove@root:~# \x1b[0mi\x01\x00\x00\x00s\t\x00\x00\x00airmon-ngs\x16\x00\x00\x00Enter your interface: sA\x00\x00\x00ifconfig {0} down && iwconfig {0} mode monitor && ifconfig {0} ups\x0b\x00\x00\x00wash -i {0}s\x1a\x00\x00\x00\x1b[1mCtrl + C to stop. \x1b[0mt\x01\x00\x00\x00 s\x07\x00\x00\x00Bssid: s\x1e\x00\x00\x00\x1b[1mStarting WPS Attack...\x1b[0mi\x05\x00\x00\x00s\x15\x00\x00\x00reaver -i {0} -b {1} i\x02\x00\x00\x00s\x0f\x00\x00\x00airodump-ng {0}s\x19\x00\x00\x00\x1b[1mCtrl + C To Stop \x1b[0mi\x03\x00\x00\x00s\n\x00\x00\x00Channel : s\x0c\x00\x00\x00File Name : s)\x00\x00\x00airodump-ng -c {0} --bssid {1} -w {2} {3}i\x04\x00\x00\x00R\x03\x00\x00\x00s4\x00\x00\x00This tool is avilable for Unix / Linux like systems.s5\x00\x00\x00git clone https://github.com/mkdirlove/WI-TOOLKIT.gits&\x00\x00\x00cd WI-TOOLKIT && sudo bash ./update.shs\n\x00\x00\x00wi-toolkits\x0f\x00\x00\x00Wordlist path: s\x15\x00\x00\x00Enter Captured file: s\x17\x00\x00\x00aircrack-ng {0} -w {1} t\x00\x00\x00\x00(\x08\x00\x00\x00t\x05\x00\x00\x00inputR\x07\x00\x00\x00R\x00\x00\x00\x00R\x04\x00\x00\x00t\x06\x00\x00\x00formatR\x01\x00\x00\x00R\x06\x00\x00\x00t\x11\x00\x00\x00KeyboardInterrupt(\r\x00\x00\x00t\x06\x00\x00\x00choicet\t\x00\x00\x00interfacet\x05\x00\x00\x00intert\x04\x00\x00\x00washt\x05\x00\x00\x00bssidt\x06\x00\x00\x00reavert\x04\x00\x00\x00dumpt\x02\x00\x00\x00cht\x02\x00\x00\x00svt\x04\x00\x00\x00airot\x08\x00\x00\x00wordlistt\x05\x00\x00\x00save2t\x05\x00\x00\x00crack(\x00\x00\x00\x00(\x00\x00\x00\x00s\x0c\x00\x00\x00tahmid_rayatR\n\x00\x00\x005\x00\x00\x00s\\\x00\x00\x00\x00\x01\x03\x01\x0c\x01\x0c\x01\r\x01\x0c\x01\x0f\x01\n\x01\x0f\x01\x05\x01\n\x01\x05\x01\x0c\x01\x05\x01\n\x01\x12\x01\r\x01\x0c\x01\r\x01\x0c\x01\x0f\x01\n\x01\x0f\x01\x05\x01\n\x01\n\x01\x05\x01\x0c\x01\x0c\x01\x0c\x01\x18\x01\r\x01\x0c\x01\x07\x01\x0c\x01\r\x01\x05\x01\r\x01\r\x01\x10\x01\x0c\x01\x0c\x01\x0c\x01\x12\x01\x11\x01\r\x01(\r\x00\x00\x00R\x07\x00\x00\x00t\x03\x00\x00\x00syst\n\x00\x00\x00subprocessR\x00\x00\x00\x00t\x04\x00\x00\x00timeR\x01\x00\x00\x00t\x06\x00\x00\x00followR\x08\x00\x00\x00R\t\x00\x00\x00t\x07\x00\x00\x00geteuidR\x06\x00\x00\x00R\x0c\x00\x00\x00R\n\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00s\x0c\x00\x00\x00tahmid_rayatt\x08\x00\x00\x00<module>\x02\x00\x00\x00s\x1e\x00\x00\x00\x0c\x01\x0c\x01\x0c\x01\x10\x01\x10\x04\x06\x10\x06\x08\x06\x03\x12\x01\x10\x02\r\x01\x05\x01\x05\x01\t\n\t/' ))
import json from enum import Enum with open('conf.json') as data_file: conf = json.load(data_file) for k, v in conf.items(): exec("%s=%s" % (k, v)) class Strategy(Enum): RANDOM = 0 WEAKEST = 1 STRONGEST = 2 class StatusOfAttack(Enum): WIN = 0 LOSE = 1 RECHARGED = 2 class UnitType(Enum): SOLDIER = 0 VEHICLE = 1
def disconnect_serial(self, connector): exec('self.o.%s.link = None' % connector) exec('self.o.%s.console = None' % connector)
# -*- coding: utf-8 -*- ''' Compute the natural frequencies of the structure.''' from solution import predefined_solutions exec(open('./xc_model.py').read()) # Loads loadCaseManager = lcm.LoadCaseManager(preprocessor) loadCaseNames = ['hLoadX', 'vLoadZ'] loadCaseManager.defineSimpleLoadCases(loadCaseNames) ## Set non-linear analysis. modelSpace.analysis = predefined_solutions.penalty_newton_raphson( modelSpace.preprocessor.getProblem) ## Horizontal x load (to estimate structure stiffness). cLC = loadCaseManager.setCurrentLoadCase('hLoadX') ### Horizontal load in structure massFactor = 1.0 hLoadXVector = xc.Vector([-massFactor, 0.0, 0.00]) modelSpace.createSelfWeightLoad(allMemberSet, hLoadXVector) # Natural frequency x-direction. modelSpace.removeAllLoadPatternsFromDomain() modelSpace.addLoadCaseToDomain('hLoadX') result = modelSpace.analyze(calculateNodalReactions=True) oh = output_handler.OutputHandler(modelSpace) oh.displayDispRot(itemToDisp='uX', defFScale=50)