def test_longer(self): ass = Assembly() ass.coalesce(np.array([[0., 0.], [2., 2.]])) labels = ass.coalesce(np.array([[1.9, 1.9], [3., 3.], [0.1, 0.1]])) self.assertTrue(np.array_equal(labels, [1, 2, 0])) self.assertTrue( np.array_equal(ass.points, [[0.1, 0.1], [1.9, 1.9], [3., 3.]]))
def __generate_assembly(self, instruction, n_id=""): if instruction in JUMP_OPS: commands = [ """ CMP EAX, EBX""", f""" CALL binop_{instruction.lower()}""", """ CMP EBX, False""", f""" JE EXIT_{n_id}""" ] elif instruction in ARITHMETIC_OPS + LOGIC_OPS: if instruction == "IMUL" or instruction == "IDIV": if instruction == "IDIV": Assembly.append(""" MOV EDX, 0""") commands = [f""" {instruction} EBX""", """ MOV EBX, EAX"""] elif instruction == "SUB": commands = [ f""" {instruction} EAX, EBX""", """ MOV EBX, EAX""" ] else: commands = f""" {instruction} EBX, EAX""" elif instruction in STACK_OPS: if instruction == "PUSH": register = "EBX" elif instruction == "POP": register = "EAX" commands = f""" {instruction} {register}""" Assembly.append(commands)
def eval(self, st): if self.children: result = self.children[0].eval(st) if self.value == "PLUS": if not isinstance(result, bool): return result raise ValueError( "Incompatible types: got \"Boolean\" expected \"Integer\"") elif self.value == "MINUS": Assembly.append(""" NEG EBX""") if not isinstance(result, bool): return -result raise ValueError( "Incompatible types: got \"Boolean\" expected \"Integer\"") elif self.value == "NOT": Assembly.append(""" NOT EBX""") if isinstance(result, bool): return not result else: return ~result
def eval(self, st): for child in self.children: if st.is_global: self.__generate_assembly(child.value, st.identifier) child.eval(st) if st.is_global: Assembly.append(""" res RESB 1""")
def eval(self, st): ass_mode = True if not ass_mode: print(self.children[0].eval(st)) else: self.children[0].eval(st) Assembly.write_program(["PUSH EBX"]) Assembly.write_program(["CALL print"])
def __init__(self, **kwargs): """ Build a new OC instance """ frame_size = kwargs.get('frame_size', 100) self.frame = deque([], frame_size) del kwargs['frame_size'] self.algo = Batch(MCMC, **kwargs) self.ass = Assembly()
def main(): with open(sys.argv[1], 'r') as myfile: input_data = myfile.read().replace('\n', '') st = SymbolTable() Parser.tokens.origin = input_data result = Parser.init_parse() result.eval(st) Assembly.build_file()
def __generate_assembly(self, instruction, n_id=""): if instruction == "BEFORE_ELSE": commands = [ f""" JMP FALSE_{n_id}""", f""" EXIT_{n_id}:""" ] elif instruction == "AFTER_ELSE": commands = f""" FALSE_{n_id}:""" Assembly.append(commands)
def __generate_assembly(self, instruction): if instruction == "LOOP_ENTER": commands = f""" WHILE_{self.identifier}:""" elif instruction == "LOOP_EXIT": commands = [ f""" JMP WHILE_{self.identifier}""", f""" EXIT_{self.identifier}:""" ] Assembly.append(commands)
def eval(self, st): ass_mode = True if ass_mode: Assembly.write_program([f"LOOP_{self.identifier}:"]) self.children[0].eval(st) Assembly.write_program([f"CMP EBX, False"]) Assembly.write_program([f"JE EXIT_{self.identifier}"]) self.children[1].eval(st) Assembly.write_program([f"JMP LOOP_{self.identifier}"]) Assembly.write_program([f"EXIT_{self.identifier}:"]) else: while self.children[0].eval(st) == True: self.children[1].eval(st)
def create_cantilever(l, w): assem = Assembly(2) assem.rename_node(0, "gnd") assem.rename_node(1, "tip") layer = SOI_berk() assem.add_model(Anchor(1, 1, layer.p1), ["gnd"]) assem.add_model(Beam2D(l, w, layer.p1), ["gnd", "tip"])
def test_coalesce(self): ass = Assembly() ass.coalesce(np.array([[0., 0.], [2., 2.]])) ass.coalesce(np.array([[1.9, 1.9], [3, 3], [0.1, 0.1]])) labels = ass.coalesce(np.array([[2.9, 2.9], [2.1, 2.1]])) self.assertTrue(np.array_equal(labels, [2, 1])) self.assertTrue( np.array_equal(ass.points, [[0.1, 0.1], [2.1, 2.1], [2.9, 2.9]]))
class OC: """Wraps a mini batch MCMC algorithm""" def __init__(self, **kwargs): """ Build a new OC instance """ frame_size = kwargs.get('frame_size', 100) self.frame = deque([], frame_size) del kwargs['frame_size'] self.algo = Batch(MCMC, **kwargs) self.ass = Assembly() def push_predict(self, points, columns): """ push and predict data from the dataflow :param points: a chunk of data :param columns: the column names :return: the result that can be send to the dataviz server """ arr = self._extend(points) self.algo.push(arr) centroids, labels = self.algo.predict(arr) return self._make_result(centroids, labels, columns) def _extend(self, points): """ keep the given chunk in the fixed size frame. Old data can be reused if the chunk is smaller than the frame. :param points: a chunk of data :return: the content of the frame as a ndarray """ self.frame.extend(points) return np.array(self.frame) def _make_result(self, centroids, labels, columns): """ Build a result ready for the dataviz server. The result contains all known centers, even if empty for the current centroids :param centroids: the current centroids :param labels: the labels for the data in the frame :param columns: the column names :return: the result ready fo the dataviz server """ indices = self.ass.coalesce(centroids) counts = np.zeros(len(self.ass.points)) counts[indices] = np.bincount(labels) return { 'centers': self.ass.points.tolist(), 'counts': counts.tolist(), 'columns': columns } def run(self): """Run the underlying algorithm""" return self.algo.run()
def main(): try: src_file = ARGS[1] except IndexError as e: sys.exit("Expecting pascal source file in position 1") try: exec_type = ARGS[2] except IndexError: exec_type = "i" Assembly.set_exec_type(exec_type) if exec_type in "ic": program = read_pascal(src_file).lower() Parser.parse(program).eval() else: sys.exit(f"Failed: expecting [i | c] in position 2 (got {exec_type})") if exec_type == "c": PATHS = get_paths(src_file) # Assembly.print() Assembly.make_file(PATHS["asm"]) try: call(["nasm", "-f", "elf32", "-o", PATHS["obj"], PATHS["asm"]]) except: sys.exit(f"Can't create object file from {PATHS['asm']}") try: call([ "ld", "-m", "elf_i386", "-s", "-o", PATHS["exe"], PATHS["obj"] ]) except: sys.exit(f"Can't create executable file from {PATHS['obj']}") call(["rm", f"{PATHS['asm']}", f"{PATHS['obj']}"]) print(f"Done!\nExecutable: {PATHS['exe']}")
def __generate_assembly(self, op, n_id=""): if op in JUMP_OPS: commands = [ """ CMP EAX, EBX""", f""" CALL binop_{op.lower()}""", """ CMP EBX, False""", f""" JE EXIT_{n_id}""" ] elif op in ARITHMETIC_OPS or op in LOGIC_OPS: if op == "IMUL" or op == "DIV": commands = [f""" {op} EBX""", """ MOV EBX, EAX"""] elif op == "SUB": commands = [f""" {op} EAX, EBX""", """ MOV EBX, EAX"""] else: commands = f""" {op} EBX, EAX""" elif op in STACK_OPS: if op == "PUSH": register = "EBX" elif op == "POP": register = "EAX" commands = f""" {op} {register}""" Assembly.append(commands)
def genome_assembly(args): accession, fastq_dir, outdir = args contig_dir = Path(outdir, 'contig', accession) assembly = Assembly(accession=accession, reads_path=fastq_dir, outdir=outdir) assembly.denovo() assembly.move_contig(contig_dir) shutil.rmtree(fastq_dir) shutil.rmtree(assembly.outdir) return accession, contig_dir, outdir
def eval(self, st): condition = self.children[0] true_stmts = self.children[1] false_stmts = self.children[2] if Assembly.get_exec_type() == "i": if condition.eval(st, n_id=self.identifier): true_stmts.eval(st) else: false_stmts.eval(st) else: condition.eval(st, n_id=self.identifier) true_stmts.eval(st) self.__generate_assembly("BEFORE_ELSE", n_id=self.identifier) false_stmts.eval(st) self.__generate_assembly("AFTER_ELSE", n_id=self.identifier)
def main(self): printwithtime("Welcome to the metassembler.") self.process_arguments() self.check_input() self.get_delta() self.process_delta() self.contigs_from_fasta() self.contigs_from_alignments() # TODO: these two methods should be merged? if self.process_indels_bool: self.process_indels() self.get_all_neighbors() if self.perform_assembly_bool: self.assemble() else: for contig in self.contigs.values(): self.assemblies[contig.name] = Assembly([contig]) for assembly in self.assemblies.values(): assembly.get_sequence() self.cleanup() self.summary() self.write_output() printwithtime("Done.")
ie: 'export ASSEMBLY_APP=default' ## ASSEMBLY_ENV By default, Assembly will attempt to load the 'Development' config object from './config.py' To specify a different environment, set the environment variable 'ASSEMEBLY_ENV' to the environment class name ie: 'export ASSEMBLY_ENV=Production' """ """ Import the base Assembly """ from assembly import Assembly """ If you want to use your views CLI, you can import them below """ import main.cli """ APPS = {} a dict with list of applications to load by name You can add as many views as you want per application. Set the environment variable 'ASSEMBLY_APP' to the name of the app to use ie: 'export ASSEMBLY_APP=default' """ APPS = {"default": ["main"]} """ Initialize the application the 'app' variable is required """ app = Assembly.init(__name__, APPS)
def parse_legacy(obj,mymodel): """ take a loaded legacy dictionary, decides between current filetype and legacy caDNAno 1.0 filetype Parameters ---------- obj: dictionary object generated from a JSON file See Also -------- Examples -------- """ from assembly import Assembly from part import Part my_assembly = Assembly() my_part = Part(my_assembly.createPartID()) vhelixlist = obj["vstrands"] # should rename to name = obj["name"] # placeholder, not really used # create dictionaries (keyed by vstrand #) of # row/col, scaf array, stap array vhToRowCol = {} vhToScaf = {} vhToStap = {} vhNums = [] for helix in vhelixlist: # strand should be helix num = helix["num"] # helix number vhNums.append(num) # keep track of a list of helix numbers row = helix["row"] # slice row for this helix col = helix["col"] # slice column scaf = helix["scaf"] # array of scaffold points stap = helix["stap"] # array of staple pointers vhToRowCol[num] = [row,col] vhToScaf[num] = scaf vhToStap[num] = stap # extract scaffold 5' breakpoints scafBreaks = [] for vh in vhNums: scaf = vhToScaf[vh] for i in range(len(scaf)): base = scaf[i] if (base[1] == -1) & (base[3] != -1): scafBreaks.append([vh, i]) # extract staple 5' breakpoints stapBreaks = [] for vh in vhNums: stap = vhToStap[vh] for i in range(len(stap)): base = stap[i] if (base[1] == -1) & (base[3] != -1): stapBreaks.append([vh, i]) # extract scaffold paths, starting at 5' breakpoints scafPaths = [] for scafBreak in scafBreaks: path = [] [curr_vh, curr_base] = scafBreak [next_vh, next_base] = vhToScaf[curr_vh][curr_base][2:4] while next_base != -1: [row, col] = vsToRowCol[curr_vs] [x, y, z] = getScafCoord(row,col,curr_base) path.append([curr_vs,curr_base,[x, y, z]]) # append midpoint for crossover if (curr_vs != next_vs) & (curr_base == next_base): (x1,y1,z1) = getScafCoord(row,col,curr_base) [nextrow, nextcol] = vsToRowCol[next_vs] (x2,y2,z2) = getScafCoord(nextrow,nextcol,next_base) midxyz = [(x1+x2)/2,(y1+y2)/2,(z1+z2)/2] path.append([curr_vs,curr_base,midxyz]) [curr_vs, curr_base] = [next_vs, next_base] [next_vs, next_base] = vsToScaf[curr_vs][curr_base][2:4] [row, col] = vsToRowCol[curr_vs] [x, y, z] = getScafCoord(row,col,curr_base) path.append([curr_vs,curr_base,[x, y, z]]) scafPaths.append(path) # extract staple paths, starting at 5' breakpoints stapPaths = [] for stapBreak in stapBreaks: path = [] [curr_vs, curr_base] = stapBreak [next_vs, next_base] = vsToStap[curr_vs][curr_base][2:4] while next_base != -1: [row, col] = vsToRowCol[curr_vs] [x, y, z] = getStapCoord(row,col,curr_base) path.append([curr_vs,curr_base, [x, y, z]]) # append midpoint for crossover if (curr_vs != next_vs) & (curr_base == next_base): (x1,y1,z1) = getStapCoord(row,col,curr_base) [nextrow, nextcol] = vsToRowCol[next_vs] (x2,y2,z2) = getStapCoord(nextrow,nextcol,next_base) midxyz = [(x1+x2)/2,(y1+y2)/2,(z1+z2)/2] path.append([curr_vs,curr_base,midxyz]) [curr_vs, curr_base] = [next_vs, next_base] [next_vs, next_base] = vsToStap[curr_vs][curr_base][2:4] [row, col] = vsToRowCol[curr_vs] [x, y, z] = getStapCoord(row,col,curr_base) path.append([curr_vs,curr_base, [x, y, z]]) stapPaths.append(path) my_part.VHelix = vhelixlist my_assembly.addPart(my_part) return my_parts, my_assembly
def assemble(self): printwithtime("Assembling contigs...") contigs_copy = self.contigs.copy() # greedily finds "anchor" contigs (with no neighbors on one side) for key, contig in self.contigs.items(): if contig.left == [None] or contig.right == [None]: index = len(self.assemblies) assembly = Assembly([contig]) assembly.left = contig.left assembly.right = contig.right self.assemblies[index] = assembly del(contigs_copy[key]) print("Assigning %s to assembly %i // %i contigs remaining to assign") % (key, index, len(contigs_copy)) self.contigs = contigs_copy num_contigs_list = [None, None] while contigs_copy != {}: if num_contigs_list[0] == num_contigs_list[1] != None: break else: for index, assembly in self.assemblies.items(): for key, contig in self.contigs.items(): if assembly.assembly[-1] in contig.left: if len(assembly.right) == 1 and len(contig.left) == 1: assembly.assembly.append(contig) assembly.right = contig.right del(contigs_copy[key]) print("Assigning %s to assembly %i // %i contigs remaining to assign") % (key, index, len(contigs_copy)) elif assembly.assembly[0] in contig.right: if len(assembly.left) == 1 and len(contig.right) == 1: assembly.assembly.insert(0, contig) assembly.left = contig.left del(contigs_copy[key]) print("Assigning %s to assembly %i // %i contigs remaining to assign") % (key, index, len(contigs_copy)) num_contigs_list[0] = num_contigs_list[1] num_contigs_list[1] = len(contigs_copy) # TODO: list value of xrange(100) [1st pass, 2nd pass...] # TODO: make it more clear when it enters this phase ####### handle any unassigned contigs if contigs_copy != {}: printwithtime("Assigning unassignable contigs") index = int(max(self.assemblies.keys())) # ensures that nothing is being overwritten # TODO: add a try/except loop that double-checks nothing is being overwritten for key, contig in self.contigs.items(): index += 1 self.assemblies[index] = Assembly([contig], contig.left, contig.right) del(contigs_copy[key]) print("Assigning %s to assembly %i // %i contigs remaining to assign") % (key, index, len(contigs_copy)) ####### merging assemblies # TODO: current issue, sometimes combines one assembly into multiple places... printwithtime("Merging assemblies...") num_merges = 0 assemblies_copy = self.assemblies.copy() for asmb1 in assemblies_copy.items(): for asmb2 in assemblies_copy.items(): if asmb1 != asmb2 and asmb1 in self.assemblies.items(): # the and clause helps ensure that assemblies are not merged into # assemblies that no longer exist asmb1_index = asmb1[0] asmb1_asmb = asmb1[1] asmb2_index = asmb2[0] asmb2_asmb = asmb2[1] if (asmb2_asmb.assembly[0] in asmb1_asmb.right and asmb1_asmb.right != [None] and asmb2_asmb.left != [None]) or \ (asmb1_asmb.assembly[-1] in asmb2_asmb.left and asmb2_asmb.left != [None] and asmb1_asmb.right != [None]): if len(asmb1_asmb.right) == 1 and len(asmb2_asmb.left) == 1: print("Merging assembly %s into assembly %s") % (asmb2_index, asmb1_index) # print("Old assemblies: %s and %s") % (asmb1_asmb, asmb2_asmb) asmb1_asmb.assembly.extend(asmb2_asmb.assembly) # print("New assembly: %i %s") % (asmb1_index, asmb1_asmb) asmb1_asmb.right = asmb2_asmb.right num_merges += 1 try: del(assemblies_copy[asmb2_index]) del(self.assemblies[asmb2_index]) except: printwithtime("exception!") # printwithtime("---") elif (asmb1_asmb.assembly[0] in asmb2_asmb.right and asmb2_asmb.right != [None] and asmb1_asmb.left != [None]) or \ (asmb2_asmb.assembly[-1] in asmb1_asmb.left and asmb1_asmb.left != [None] and asmb2_asmb.right != [None]): if len(asmb2_asmb.right) == 1 and len(asmb1_asmb.left) == 1: print("Merging assembly %s into assembly %s") % (asmb1_index, asmb2_index) # print("Old assemblies: %s and %s") % (asmb1_asmb, asmb2_asmb) asmb2_asmb.assembly.extend(asmb1_asmb.assembly) # print("New assembly: %i %s") % (asmb1_index, asmb2_asmb) asmb2_asmb.right = asmb1_asmb.right num_merges += 1 try: del(assemblies_copy[asmb1_index]) del(self.assemblies[asmb1_index]) except: printwithtime("exception!") # printwithtime(asmb1_asmb, asmb1_index, asmb1_asmb.left, asmb1_asmb.right # printwithtime(asmb2, asmb2_index, asmb2_asmb.left, asmb2_asmb.right # printwithtime("---" print("%i merges made.") % (num_merges)
import os from assembly import Assembly from assembly.rhino import AssemblyArtist HERE = os.path.dirname(__file__) DATA = os.path.abspath(os.path.join(HERE, "data")) filepath = os.path.join(DATA, 'flemish_bond.json') assembly = Assembly.from_json(filepath) artist = AssemblyArtist(assembly, layer='COMPAS::Assembly') artist.clear_layer() artist.draw()
from evaluation import Evaluator k=10 circle=Arc(0,0,0,2*numpy.pi,.5) circle2=Arc(2,0,0,2*numpy.pi,.5) d=Domain([circle]) d2=Domain([circle2]) mesh=Mesh([d,d2]) mesh.discretize(50) quadrule=GaussQuadrature(5,3,0.15) #mToB=Legendre.legendreBasis(mesh,0) mToB=NodalLin.nodalLinBasis(mesh) kernel=AcousticDoubleLayer(k) assembly=Assembly(mToB,quadrule) mKernel=assembly.getKernel(kernel) mIdentity=assembly.getIdentity() op=mIdentity+2*mKernel rhs=assembly.projFun([lambda t,x,normals: -numpy.exp(1j*k*x[0])]) coeffs=numpy.linalg.solve(.5*mIdentity+mKernel,rhs) plotBndFun(mToB,coeffs[:,0]) ev=Evaluator(mToB,kernel,quadrule) v=Visualizer(ev,[-1.5,3.5,-1,3],100,100,incWave=lambda x: numpy.exp(1j*k*x[0])) v.fullField(coeffs[:,0]) v.show()
def test_init(self): ass = Assembly() labels = ass.coalesce(np.array([[0., 0.], [2., 2.]])) self.assertTrue(np.array_equal(labels, [0, 1]))
def test_shorter(self): ass = Assembly() ass.coalesce(np.array([[0., 0.], [2., 2.]])) labels = ass.coalesce(np.array([[1.9, 1.9]])) self.assertTrue(np.array_equal(labels, [1])) self.assertTrue(np.array_equal(ass.points, [[0., 0.], [1.9, 1.9]]))
def __generate_assembly(self, var_name, st_id): Assembly.append(f""" {var_name}_{st_id} RESD 1""")
width, length, height = data['brick_dimensions'] # little tolerance to not 'crash' into collision objects tolerance_vector = Vector.from_data(data['tolerance_vector']) savelevel_vector = Vector.from_data(data['savelevel_vector']) # define target frame target_frame = Frame([-0.26, -0.28, height], [1, 0, 0], [0, 1, 0]) target_frame.point += tolerance_vector # create Element and move it to target frame element = Element.from_data(data['brick']) # create Assembly with element at target_frame assembly = Assembly() T = Transformation.from_frame_to_frame(element.frame, target_frame) assembly.add_element(element.transformed(T)) # Bring the element's mesh into the robot's tool0 frame element_tool0 = element.copy() T = Transformation.from_frame_to_frame(element_tool0.gripping_frame, tool.frame) element_tool0.transform(T) # define picking_configuration picking_configuration = Configuration.from_data(data['picking_configuration']) # define picking frame picking_frame = Frame.from_data(data['picking_frame']) picking_frame.point += tolerance_vector
savelevel_picking_frame = picking_frame.copy() savelevel_picking_frame.point += savelevel_vector picking_frame.point += tolerance_vector # create tool from json filepath = os.path.join(DATA, "vacuum_gripper.json") tool = Tool.from_json(filepath) # load assembly from file filepath = os.path.join(DATA, '048_flemish_bond.json') # load from existing if calculation failed at one point... clear_planning_scene = True if os.path.isfile(PATH_TO): assembly = Assembly.from_json(PATH_TO) clear_planning_scene = False else: assembly = Assembly.from_json(filepath) # create an attached collision mesh to be attached to the robot's end effector. T = Transformation.from_frame_to_frame(brick.gripping_frame, tool.frame) brick_tool0 = brick.transformed(T) attached_brick_mesh = AttachedCollisionMesh( CollisionMesh(brick_tool0.mesh, 'brick'), 'ee_link') # ============================================================================== # From here on: fill in code, whereever you see this dots ... def plan_picking_motion(robot, picking_frame, savelevel_picking_frame,
# The name of the json file to save the assembly into PATH_TO = os.path.join( DATA, os.path.splitext(os.path.basename(__file__))[0] + ".json") # Load assembly settings settings_file = os.path.join(DATA, "settings.json") with open(settings_file, 'r') as f: data = json.load(f) brick = Element.from_data(data['brick']) halfbrick = Element.from_data(data['halfbrick']) width, length, height = data['brick_dimensions'] # Create assembly assembly = Assembly() # ============================================================================== # Your code goes here. # HINT: Use the examples to see how to re-use the brick/halfbrick elements # defined above, and get a transformed instance of each of them as you # build up your brick wall. # Your code comes here # ============================================================================== # Transform assembly to correct location and adjust if needed assembly.transform(Translation([-0.26, -0.34, 0])) # Save assembly to json assembly.to_json(PATH_TO, pretty=True)
def __generate_assembly(self, value, st_id): Assembly.append(f""" MOV EBX, [{value}_{st_id}]""")
with open(settings_file, 'r') as f: data = json.load(f) # Get from settings # Get from settings brick = Element.from_data(data['brick']) halfbrick = Element.from_data(data['halfbrick']) width, length, height = data['brick_dimensions'] COURSES = 3 BRICKS_PER_COURSE = 5 MORTAR_PERPENDS = 0.003 MORTAR_BEDS = 0.003 assembly = Assembly() total_length = BRICKS_PER_COURSE * width + (BRICKS_PER_COURSE - 1) * MORTAR_PERPENDS gap_even = MORTAR_PERPENDS gap_uneven = (total_length - (BRICKS_PER_COURSE * width)) / BRICKS_PER_COURSE for row in range(COURSES): dy = row * height half_brick_ends = row % 2 != 0 gap = gap_even if row % 2 == 0 else gap_uneven dx = 0 bricks_in_course = BRICKS_PER_COURSE + (1 if half_brick_ends else 0) for j in range(bricks_in_course):
root_logger = logging.getLogger() root_logger.addHandler(console_handler) root_logger.setLevel(logging.DEBUG) if __name__ == "__main__": setup_logging() args = docopt(__doc__) if args["load"]: with open(args["<filename>"], 'r') as f: pprint.pprint(load(f)) elif args["parse"]: plan = Plan.from_file(args["<filename>"]) print plan elif args["process"]: assembly = Assembly.from_plan(args["<filename>"]) print assembly elif args["generate"]: assembly = Assembly.from_plan(args["<filename>"]) assembly.generate_files(os.path.split(args["<filename>"])[0], args["<output_folder>"]) elif args["generun"]: assembly = Assembly.from_plan(args["<filename>"]) assembly.generate_files(os.path.split(args["<filename>"])[0], args["<output_folder>"]) os.chdir(os.path.join(args["<output_folder>"], assembly.plan.name)) client = Client(docker_url()) assembly.run(client) elif args["start"]: assembly = Assembly.from_plan(args["<filename>"]) client = Client(docker_url()) assembly.start(client)
def eval(self, st): res = st.get_var(self.value) Assembly.write_program([f"MOV EBX, [{self.value}_{res[1]}]"]) return res[0]