def __init__(self, over, under): Top.__init__(self, find_bounding_box(over + under)) from block import Block self.over = Block(over) self.under = Block(under)
def __init__(self, platform, **kwargs): sys_clk_freq = int(100e6) # SoC init (No CPU, we controlling the SoC with UART) SoCCore.__init__( self, platform, sys_clk_freq, cpu_type=None, csr_data_width=32, with_uart=False, with_timer=False, ident="BER Analyser Arty", ident_version=True, ) # Clock Reset Generation self.submodules.crg = CRG(platform.request("clk100")) # No CPU, use Serial to control Wishbone bus self.add_cpu_or_bridge( UARTWishboneBridge(platform.request("serial"), sys_clk_freq, baudrate=115200)) self.add_wb_master(self.cpu_or_bridge.wishbone) # FPGA identification self.submodules.dna = dna.DNA() self.submodules.top = Top()
def __init__( self , fovy , ratio , near , far ) : self.fovy = fovy self.near = near self.far = far self.ratio = ratio self.camera = None self.top = Top() self.x = 0.0 self.last_time = timer() self.plane_alpha = 65.0 / 180.0 * m.pi self.lpos = [ 1 ,-1 , 0 ]
def run(filePath, path, columnSize, rowSize): columnSize = int(columnSize) rowSize = int(rowSize) stylemap = load_workbook(filePath) prods = list() returnFileName = 'Variable_Product.csv' product_csv = open(os.path.join(path, returnFileName), 'w') sheets = stylemap.get_sheet_names() if 'TOP' in sheets: top = stylemap['TOP'] if top['B2'].value == 'O': from top import Top tops = Top(top, columnSize, rowSize) tops.run(prods) if 'OUTER' in sheets: outer = stylemap['OUTER'] if outer['B2'].value == 'O': from outer import Outer outers = Outer(outer, columnSize, rowSize) outers.run(prods) if 'BOTTOM' in sheets: bottom = stylemap['BOTTOM'] if bottom['B2'].value == 'O': from bottom import Bottom bottoms = Bottom(bottom, columnSize, rowSize) bottoms.run(prods) if 'ACC' in sheets: acc = stylemap['ACC'] if acc['B2'].value == 'O': from acc import Acc accs = Acc(acc, columnSize, rowSize - 2) accs.run(prods) pw = ProductWriter() pw.run(prods, product_csv) product_csv.close()
def way(self, tokens, command, payload): check_element = SideDialogues(self.req, self.res) check = check_element.get_answer(tokens, command, payload) if check: self.res['response']['text'] = check[0] self.res['response']['tts'] = check[1] self.res['response']['buttons'] = check[2] else: if self.user.passage_num == 0: "меню" elif self.user.passage_num == 1: "Добавить" elif self.user.passage_num == 2: "Мои мысли" elif self.user.passage_num == 3: "Чужые мысли" elif self.user.passage_num == 4: top = Top(self.db, self.user) top.way(tokens) "Топ" return self.res
def read_top(self, line): """ Method reads in a top creates a Top object from the information provided. Parameters: line: the line in the text document that contains information to create an instance of a top. Returns: top: an instance of the Top() class. """ split_line = re.split(', ', line) top = Top(split_line[0], split_line[1], split_line[2], split_line[3], split_line[4], split_line[5]) return top
def __init__(self, children): Top.__init__(self, find_bounding_box(children)) self.children = children
#!/usr/bin/python3 from nmigen import * from zedboard import ZedBoardPlatform from top import Top platform = ZedBoardPlatform() platform.build(Top())
def __init__(self, bounding_rectangle): Top.__init__(self, bounding_rectangle)
import time renkler = { 'beyaz' : (1,1,1), 'siyah' : (0,0,0) } ekran = Screen() ekran.bgcolor(renkler['siyah']) ekran.setup(height=600,width=800) ekran.tracer(0) sag_raket = Raket((350,0)) sol_raket = Raket((-350,0)) top = Top() skorT = SkorTahtasi() ekran.listen() ekran.onkey(sag_raket.yukari_git,"Up") ekran.onkey(sag_raket.asagi_git,"Down") ekran.onkey(sol_raket.yukari_git,"w") ekran.onkey(sol_raket.asagi_git,"s") oyun_aktif_mi = True while oyun_aktif_mi: ekran.update()
def top_oluştur(ayarlar, ekran, toplar): """Top objesi oluşturur.""" top = Top(ayarlar, ekran) toplar.add(top)
if __name__ == "__main__": logging.debug('This is a debug message') startTime = int(time.time()) path = sys.argv[1] + '_' + str(startTime) + '/' os.mkdir(path) outputPcap = path + 'tcpdump.pcap' outputStrace = path + 'strace' outputTop = path + 'top.json' outputLsof = path + 'lsof.json' outputLdd = path + 'ldd.txt' timeout = int(sys.argv[2]) sniff = Sniffer(outputPcap) top = Top(outputTop) strace = Strace(sys.argv[1], outputStrace, timeout) lsof = Lsof(outputLsof) ldd = Lib(sys.argv[1], outputLdd) ldd.start() topThread = threading.Thread(target=top.start, args=()) topThread.start() lsofThread = threading.Thread(target=lsof.start, args=()) lsofThread.start() sniff.start() strace.start()
class Scene : def __init__( self , fovy , ratio , near , far ) : self.fovy = fovy self.near = near self.far = far self.ratio = ratio self.camera = None self.top = Top() self.x = 0.0 self.last_time = timer() self.plane_alpha = 65.0 / 180.0 * m.pi self.lpos = [ 1 ,-1 , 0 ] def gfx_init( self ) : self.camera = Camera( ( 0 , 0 , 5 ) , ( 0 , 0 , 0 ) , ( 0 , 1 , 0 ) ) self._update_proj() glEnable( GL_DEPTH_TEST ) glEnable( GL_NORMALIZE ) glEnable( GL_CULL_FACE ) glEnable( GL_COLOR_MATERIAL ) glColorMaterial( GL_FRONT , GL_AMBIENT_AND_DIFFUSE ) def draw( self ) : self._update_proj() self.time = timer() dt = self.time - self.last_time self._step( dt ) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.camera.look() self.lpos = [ m.sin(self.x/100)*2 , -1 , m.cos(self.x/100)*2 ] self._set_lights() self._draw_scene() self.x+=dt*.3 self.last_time = self.time def reset( self ) : self.top.reset() def _step( self , dt ) : self.top.step( dt ) def _draw_scene( self ) : self.top.draw() def _update_proj( self ) : glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective( self.fovy , self.ratio , self.near , self.far ) glMatrixMode(GL_MODELVIEW) def _set_lights( self ) : glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_AMBIENT, [ 0.2 , 0.2 , 0.2 ] ); glLightfv(GL_LIGHT0, GL_DIFFUSE, [ 0.9 , 0.9 , 0.9 ] ); glLightfv(GL_LIGHT0, GL_SPECULAR,[ 0.3 , 0.3 , 0.3 ] ); glLightfv(GL_LIGHT0, GL_POSITION, self.lpos ); glEnable(GL_LIGHT0); def set_fov( self , fov ) : self.fov = fov self._update_proj() def set_near( self , near ) : self.near = near self._update_proj() def set_ratio( self , ratio ) : self.ratio = ratio self._update_proj() def set_screen_size( self , w , h ) : self.width = w self.height = h self.set_ratio( float(w)/float(h) ) def set_dens(self,v): self.top.set_dens(v) def set_x(self,v): self.top.set_x(v) def set_y(self,v): self.top.set_y(v) def set_z(self,v): self.top.set_z(v) def set_a(self,v): self.top.set_a(v) def set_w(self,v): self.top.set_w(v) def mouse_move( self , df , buts ) : if 3 in buts and buts[3] : self.camera.rot( *map( lambda x : -x*.2 , df ) ) def key_pressed( self , mv ) : self.camera.move( *map( lambda x : x*.25 , mv ) ) def toggle_wireframe( self ): self.top.toggle_wireframe() def toggle_solid( self ): self.top.toggle_solid() def toggle_gravity( self ): self.top.toggle_gravity() def set_trace_len( self , v ): self.top.set_trace_len(v)