How to use GetVariables method in redwood

Best JavaScript code snippet using redwood

TestGetVariables.py

Source:TestGetVariables.py Github

copy

Full Screen

1"""2Test that SBFrame::GetVariables() calls work correctly.3"""4from __future__ import print_function5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbplatform9from lldbsuite.test import lldbutil10def get_names_from_value_list(value_list):11 names = list()12 for value in value_list:13 names.append(value.GetName())14 return names15class TestGetVariables(TestBase):16 mydir = TestBase.compute_mydir(__file__)17 def setUp(self):18 # Call super's setUp().19 TestBase.setUp(self)20 self.source = 'main.c'21 def verify_variable_names(self, description, value_list, names):22 copy_names = list(names)23 actual_names = get_names_from_value_list(value_list)24 for name in actual_names:25 if name in copy_names:26 copy_names.remove(name)27 else:28 self.assertTrue(29 False, "didn't find '%s' in %s" %30 (name, copy_names))31 self.assertEqual(32 len(copy_names), 0, "%s: we didn't find variables: %s in value list (%s)" %33 (description, copy_names, actual_names))34 def test(self):35 self.build()36 # Set debugger into synchronous mode37 self.dbg.SetAsync(False)38 # Create a target by the debugger.39 exe = self.getBuildArtifact("a.out")40 target = self.dbg.CreateTarget(exe)41 self.assertTrue(target, VALID_TARGET)42 line1 = line_number(self.source, '// breakpoint 1')43 line2 = line_number(self.source, '// breakpoint 2')44 line3 = line_number(self.source, '// breakpoint 3')45 breakpoint1 = target.BreakpointCreateByLocation(self.source, line1)46 breakpoint2 = target.BreakpointCreateByLocation(self.source, line2)47 breakpoint3 = target.BreakpointCreateByLocation(self.source, line3)48 self.assertTrue(breakpoint1.GetNumLocations() >= 1, PROCESS_IS_VALID)49 self.assertTrue(breakpoint2.GetNumLocations() >= 1, PROCESS_IS_VALID)50 self.assertTrue(breakpoint3.GetNumLocations() >= 1, PROCESS_IS_VALID)51 # Register our shared libraries for remote targets so they get52 # automatically uploaded53 arguments = None54 environment = None55 # Now launch the process, and do not stop at entry point.56 process = target.LaunchSimple(57 arguments, environment, self.get_process_working_directory())58 self.assertTrue(process, PROCESS_IS_VALID)59 threads = lldbutil.get_threads_stopped_at_breakpoint(60 process, breakpoint1)61 self.assertEqual(62 len(threads),63 1,64 "There should be a thread stopped at breakpoint 1")65 thread = threads[0]66 self.assertTrue(thread.IsValid(), "Thread must be valid")67 frame = thread.GetFrameAtIndex(0)68 self.assertTrue(frame.IsValid(), "Frame must be valid")69 arg_names = ['argc', 'argv']70 local_names = ['i', 'j', 'k']71 static_names = ['static_var', 'g_global_var', 'g_static_var']72 breakpoint1_locals = ['i']73 breakpoint1_statics = ['static_var']74 num_args = len(arg_names)75 num_locals = len(local_names)76 num_statics = len(static_names)77 args_yes = True78 args_no = False79 locals_yes = True80 locals_no = False81 statics_yes = True82 statics_no = False83 in_scopy_only = True84 ignore_scope = False85 # Verify if we ask for only arguments that we got what we expect86 vars = frame.GetVariables(87 args_yes, locals_no, statics_no, ignore_scope)88 self.assertEqual(89 vars.GetSize(),90 num_args,91 "There should be %i arguments, but we are reporting %i" %92 (num_args,93 vars.GetSize()))94 self.verify_variable_names("check names of arguments", vars, arg_names)95 self.assertEqual(96 len(arg_names),97 num_args,98 "make sure verify_variable_names() didn't mutate list")99 # Verify if we ask for only locals that we got what we expect100 vars = frame.GetVariables(101 args_no, locals_yes, statics_no, ignore_scope)102 self.assertEqual(103 vars.GetSize(),104 num_locals,105 "There should be %i local variables, but we are reporting %i" %106 (num_locals,107 vars.GetSize()))108 self.verify_variable_names("check names of locals", vars, local_names)109 # Verify if we ask for only statics that we got what we expect110 vars = frame.GetVariables(111 args_no, locals_no, statics_yes, ignore_scope)112 print('statics: ', str(vars))113 self.assertEqual(114 vars.GetSize(),115 num_statics,116 "There should be %i static variables, but we are reporting %i" %117 (num_statics,118 vars.GetSize()))119 self.verify_variable_names(120 "check names of statics", vars, static_names)121 # Verify if we ask for arguments and locals that we got what we expect122 vars = frame.GetVariables(123 args_yes, locals_yes, statics_no, ignore_scope)124 desc = 'arguments + locals'125 names = arg_names + local_names126 count = len(names)127 self.assertEqual(128 vars.GetSize(),129 count,130 "There should be %i %s (%s) but we are reporting %i (%s)" %131 (count,132 desc,133 names,134 vars.GetSize(),135 get_names_from_value_list(vars)))136 self.verify_variable_names("check names of %s" % (desc), vars, names)137 # Verify if we ask for arguments and statics that we got what we expect138 vars = frame.GetVariables(139 args_yes, locals_no, statics_yes, ignore_scope)140 desc = 'arguments + statics'141 names = arg_names + static_names142 count = len(names)143 self.assertEqual(144 vars.GetSize(),145 count,146 "There should be %i %s (%s) but we are reporting %i (%s)" %147 (count,148 desc,149 names,150 vars.GetSize(),151 get_names_from_value_list(vars)))152 self.verify_variable_names("check names of %s" % (desc), vars, names)153 # Verify if we ask for locals and statics that we got what we expect154 vars = frame.GetVariables(155 args_no, locals_yes, statics_yes, ignore_scope)156 desc = 'locals + statics'157 names = local_names + static_names158 count = len(names)159 self.assertEqual(160 vars.GetSize(),161 count,162 "There should be %i %s (%s) but we are reporting %i (%s)" %163 (count,164 desc,165 names,166 vars.GetSize(),167 get_names_from_value_list(vars)))168 self.verify_variable_names("check names of %s" % (desc), vars, names)169 # Verify if we ask for arguments, locals and statics that we got what170 # we expect171 vars = frame.GetVariables(172 args_yes, locals_yes, statics_yes, ignore_scope)173 desc = 'arguments + locals + statics'174 names = arg_names + local_names + static_names175 count = len(names)176 self.assertEqual(177 vars.GetSize(),178 count,179 "There should be %i %s (%s) but we are reporting %i (%s)" %180 (count,181 desc,182 names,183 vars.GetSize(),184 get_names_from_value_list(vars)))185 self.verify_variable_names("check names of %s" % (desc), vars, names)186 # Verify if we ask for in scope locals that we got what we expect187 vars = frame.GetVariables(188 args_no, locals_yes, statics_no, in_scopy_only)189 desc = 'in scope locals at breakpoint 1'190 names = ['i']191 count = len(names)192 self.assertEqual(193 vars.GetSize(),194 count,195 "There should be %i %s (%s) but we are reporting %i (%s)" %196 (count,197 desc,198 names,199 vars.GetSize(),200 get_names_from_value_list(vars)))201 self.verify_variable_names("check names of %s" % (desc), vars, names)202 # Continue to breakpoint 2203 process.Continue()204 threads = lldbutil.get_threads_stopped_at_breakpoint(205 process, breakpoint2)206 self.assertEqual(207 len(threads),208 1,209 "There should be a thread stopped at breakpoint 2")210 thread = threads[0]211 self.assertTrue(thread.IsValid(), "Thread must be valid")212 frame = thread.GetFrameAtIndex(0)213 self.assertTrue(frame.IsValid(), "Frame must be valid")214 # Verify if we ask for in scope locals that we got what we expect215 vars = frame.GetVariables(216 args_no, locals_yes, statics_no, in_scopy_only)217 desc = 'in scope locals at breakpoint 2'218 names = ['i', 'j']219 count = len(names)220 self.assertEqual(221 vars.GetSize(),222 count,223 "There should be %i %s (%s) but we are reporting %i (%s)" %224 (count,225 desc,226 names,227 vars.GetSize(),228 get_names_from_value_list(vars)))229 self.verify_variable_names("check names of %s" % (desc), vars, names)230 # Continue to breakpoint 3231 process.Continue()232 threads = lldbutil.get_threads_stopped_at_breakpoint(233 process, breakpoint3)234 self.assertEqual(235 len(threads),236 1,237 "There should be a thread stopped at breakpoint 3")238 thread = threads[0]239 self.assertTrue(thread.IsValid(), "Thread must be valid")240 frame = thread.GetFrameAtIndex(0)241 self.assertTrue(frame.IsValid(), "Frame must be valid")242 # Verify if we ask for in scope locals that we got what we expect243 vars = frame.GetVariables(244 args_no, locals_yes, statics_no, in_scopy_only)245 desc = 'in scope locals at breakpoint 3'246 names = ['i', 'j', 'k']247 count = len(names)248 self.assertEqual(249 vars.GetSize(),250 count,251 "There should be %i %s (%s) but we are reporting %i (%s)" %252 (count,253 desc,254 names,255 vars.GetSize(),256 get_names_from_value_list(vars)))257 self.verify_variable_names("check names of %s" % (desc), vars, names)

Full Screen

Full Screen

test_iterators.py

Source:test_iterators.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- coding: utf-8 -*-3from __future__ import print_function, absolute_import, division4from builtins import map, range, object, zip, sorted5from . import TestBase6import unittest7import amplpy8class TestIterators(TestBase.TestBase):9 """Test Iterators."""10 def testSetIterators(self):11 ampl = self.ampl12 ampl.eval('set x;')13 self.assertEqual(14 len(ampl.getSets()),15 ampl.getSets().size()16 )17 self.assertEqual(18 ampl.getSets().size(),19 len(list(ampl.getSets()))20 )21 self.assertEqual(ampl.getSets().size(), 1)22 ampl.eval('reset;')23 self.assertEqual(ampl.getSets().size(), 0)24 ampl.eval('set x;')25 self.assertEqual(ampl.getSets().size(), 1)26 ampl.eval('set y{1..2};')27 self.assertEqual(ampl.getSets().size(), 2)28 ampl.eval('set z{1..2, {"a", "b"}};')29 self.assertEqual(ampl.getSets().size(), 3)30 ampl.eval('set xx{1..2,4..5};')31 self.assertEqual(ampl.getSets().size(), 4)32 ampl.eval('set yy{1..2,4..5,7..8};')33 self.assertEqual(ampl.getSets().size(), 5)34 ampl.eval('set zz{1..2,{"a", "b"}, 5..6};')35 self.assertEqual(ampl.getSets().size(), 6)36 self.assertEqual(37 ampl.getSet('x').numInstances(),38 len(dict(ampl.getSet('x')))39 )40 self.assertEqual(ampl.getSet('x').numInstances(), 1)41 self.assertEqual(ampl.getSet('y').numInstances(), 2)42 self.assertEqual(ampl.getSet('z').numInstances(), 4)43 self.assertEqual(ampl.getSet('xx').numInstances(), 4)44 self.assertEqual(ampl.getSet('yy').numInstances(), 8)45 self.assertEqual(ampl.getSet('zz').numInstances(), 8)46 self.assertEqual(47 max(s.numInstances() for name, s in ampl.getSets()), 848 )49 self.assertEqual(50 ampl.getSet('x').name(),51 ampl.getSets()['x'].name()52 )53 def testParameterIterators(self):54 ampl = self.ampl55 ampl.eval('param x;')56 self.assertEqual(57 len(ampl.getParameters()),58 ampl.getParameters().size()59 )60 self.assertEqual(61 ampl.getParameters().size(),62 len(list(ampl.getParameters()))63 )64 self.assertEqual(ampl.getParameters().size(), 1)65 ampl.eval('reset;')66 self.assertEqual(ampl.getParameters().size(), 0)67 ampl.eval('param x;')68 self.assertEqual(ampl.getParameters().size(), 1)69 ampl.eval('param y{1..2};')70 self.assertEqual(ampl.getParameters().size(), 2)71 ampl.eval('param z{1..2, {"a", "b"}};')72 self.assertEqual(ampl.getParameters().size(), 3)73 ampl.eval('param xx{1..2,4..5};')74 self.assertEqual(ampl.getParameters().size(), 4)75 ampl.eval('param yy{1..2,4..5,7..8};')76 self.assertEqual(ampl.getParameters().size(), 5)77 ampl.eval('param zz{1..2,{"a", "b"}, 5..6};')78 self.assertEqual(ampl.getParameters().size(), 6)79 self.assertEqual(80 ampl.getParameter('x').numInstances(),81 len(dict(ampl.getParameter('x')))82 )83 self.assertEqual(ampl.getParameter('x').numInstances(), 1)84 self.assertEqual(ampl.getParameter('y').numInstances(), 2)85 self.assertEqual(ampl.getParameter('z').numInstances(), 4)86 self.assertEqual(ampl.getParameter('xx').numInstances(), 4)87 self.assertEqual(ampl.getParameter('yy').numInstances(), 8)88 self.assertEqual(ampl.getParameter('zz').numInstances(), 8)89 self.assertEqual(90 max(p.numInstances() for name, p in ampl.getParameters()), 891 )92 self.assertEqual(93 ampl.getParameter('x').name(),94 ampl.getParameters()['x'].name()95 )96 def testVariableIterators(self):97 ampl = self.ampl98 ampl.eval('var x;')99 self.assertEqual(100 len(ampl.getVariables()),101 ampl.getVariables().size()102 )103 self.assertEqual(104 ampl.getVariables().size(),105 len(list(ampl.getVariables()))106 )107 self.assertEqual(ampl.getVariables().size(), 1)108 ampl.eval('reset;')109 self.assertEqual(ampl.getVariables().size(), 0)110 ampl.eval('var x;')111 self.assertEqual(ampl.getVariables().size(), 1)112 ampl.eval('var y{1..2};')113 self.assertEqual(ampl.getVariables().size(), 2)114 ampl.eval('var z{1..2, {"a", "b"}};')115 self.assertEqual(ampl.getVariables().size(), 3)116 ampl.eval('var xx{1..2,4..5};')117 self.assertEqual(ampl.getVariables().size(), 4)118 ampl.eval('var yy{1..2,4..5,7..8};')119 self.assertEqual(ampl.getVariables().size(), 5)120 ampl.eval('var zz{1..2,{"a", "b"}, 5..6};')121 self.assertEqual(ampl.getVariables().size(), 6)122 self.assertEqual(123 ampl.getVariable('x').numInstances(),124 len(dict(ampl.getVariable('x')))125 )126 self.assertEqual(ampl.getVariable('x').numInstances(), 1)127 self.assertEqual(ampl.getVariable('y').numInstances(), 2)128 self.assertEqual(ampl.getVariable('z').numInstances(), 4)129 self.assertEqual(ampl.getVariable('xx').numInstances(), 4)130 self.assertEqual(ampl.getVariable('yy').numInstances(), 8)131 self.assertEqual(ampl.getVariable('zz').numInstances(), 8)132 self.assertEqual(133 max(var.numInstances() for name, var in ampl.getVariables()), 8134 )135 self.assertEqual(136 ampl.getVariable('x').name(),137 ampl.getVariables()['x'].name()138 )139 def testConstraintIterators(self):140 ampl = self.ampl141 ampl.eval('var x;')142 ampl.eval('s.t. c_x: x = 0;')143 self.assertEqual(144 ampl.getConstraints().size(),145 len(ampl.getConstraints())146 )147 self.assertEqual(148 ampl.getConstraints().size(),149 len(list(ampl.getConstraints()))150 )151 self.assertEqual(ampl.getConstraints().size(), 1)152 ampl.eval('reset;')153 self.assertEqual(ampl.getConstraints().size(), 0)154 ampl.eval('var x;')155 ampl.eval('s.t. c_x: x = 0;')156 self.assertEqual(ampl.getConstraints().size(), 1)157 ampl.eval('var y{1..2};')158 ampl.eval('s.t. c_y{i in 1..2}: y[i] = i;')159 self.assertEqual(ampl.getConstraints().size(), 2)160 ampl.eval('var z{1..2, {"a", "b"}};')161 ampl.eval('s.t. c_z{(i, j) in {1..2, {"a", "b"}}}: z[i,j] = i;')162 self.assertEqual(ampl.getConstraints().size(), 3)163 ampl.eval('var xx{1..2,4..5};')164 ampl.eval('s.t. c_xx{(i, j) in {1..2,4..5}}: xx[i,j] = i+j;')165 self.assertEqual(ampl.getConstraints().size(), 4)166 self.assertEqual(167 ampl.getConstraint('c_x').numInstances(),168 len(dict(ampl.getConstraint('c_x')))169 )170 self.assertEqual(ampl.getConstraint('c_x').numInstances(), 1)171 self.assertEqual(ampl.getConstraint('c_y').numInstances(), 2)172 self.assertEqual(ampl.getConstraint('c_z').numInstances(), 4)173 self.assertEqual(ampl.getConstraint('c_xx').numInstances(), 4)174 self.assertEqual(175 max(con.numInstances() for name, con in ampl.getConstraints()), 4176 )177 self.assertEqual(178 ampl.getConstraint('c_x').name(),179 ampl.getConstraints()['c_x'].name()180 )181 def testObjectiveIterators(self):182 ampl = self.ampl183 ampl.eval('var x;')184 ampl.eval('maximize c_x: x;')185 self.assertEqual(186 ampl.getObjectives().size(),187 len(ampl.getObjectives())188 )189 self.assertEqual(190 ampl.getObjectives().size(),191 len(list(ampl.getObjectives()))192 )193 self.assertEqual(ampl.getObjectives().size(), 1)194 ampl.eval('reset;')195 self.assertEqual(ampl.getObjectives().size(), 0)196 ampl.eval('var x;')197 ampl.eval('maximize c_x: x;')198 self.assertEqual(ampl.getObjectives().size(), 1)199 ampl.eval('var y{1..2};')200 ampl.eval('maximize c_y{i in 1..2}: y[i];')201 self.assertEqual(ampl.getObjectives().size(), 2)202 ampl.eval('var z{1..2, {"a", "b"}};')203 ampl.eval('maximize c_z{(i, j) in {1..2, {"a", "b"}}}: z[i,j];')204 self.assertEqual(ampl.getObjectives().size(), 3)205 ampl.eval('var xx{1..2,4..5};')206 ampl.eval('maximize c_xx{(i, j) in {1..2,4..5}}: xx[i,j];')207 self.assertEqual(ampl.getObjectives().size(), 4)208 self.assertEqual(209 ampl.getObjective('c_x').numInstances(),210 len(dict(ampl.getObjective('c_x')))211 )212 self.assertEqual(ampl.getObjective('c_x').numInstances(), 1)213 self.assertEqual(ampl.getObjective('c_y').numInstances(), 2)214 self.assertEqual(ampl.getObjective('c_z').numInstances(), 4)215 self.assertEqual(ampl.getObjective('c_xx').numInstances(), 4)216 self.assertEqual(217 max(obj.numInstances() for name, obj in ampl.getObjectives()), 4218 )219 self.assertEqual(220 ampl.getObjective('c_x').name(),221 ampl.getObjectives()['c_x'].name()222 )223if __name__ == '__main__':...

Full Screen

Full Screen

DC2Workflow.py

Source:DC2Workflow.py Github

copy

Full Screen

1from java.util import HashMap2def run_processCcd():3 process = pipeline.getProcessInstance("setup_processccd")4 vars = HashMap(process.getVariables())5 workdir = vars.remove("WORK_DIR")6 filters = vars.remove("FILTERS").split(',')7 num = 08 for filt in filters:9 nscript = vars.remove('n' + filt + 'scripts')10 for i in range(1, int(nscript) + 1):11 script = workdir + "/02-processccd/scripts/%s/visit_%03d_script.sh" % (filt, i)12 vars.put("CUR_SCRIPT", script)13 pipeline.createSubstream("processFilter", num, vars)14 num += 115def run_processEimage():16 process = pipeline.getProcessInstance("setup_processEimage")17 vars = HashMap(process.getVariables())18 workdir = vars.remove("WORK_DIR")19 filters = vars.remove("FILTERS").split(',')20 num = 021 for filt in filters:22 nscript = vars.remove('n' + filt + 'scripts')23 for i in range(1, int(nscript) + 1):24 script = workdir + "/02-processEimage/scripts/%s/visit_%03d_script.sh" % (filt, i)25 vars.put("CUR_SCRIPT", script)26 pipeline.createSubstream("processEimageFilter", num, vars)27 num += 128def run_makeFpSummary():29 process = pipeline.getProcessInstance("setup_makeFpSummary")30 vars = HashMap(process.getVariables())31 workdir = vars.remove("WORK_DIR")32 filters = vars.remove("FILTERS").split(',')33 num = 034 for filt in filters:35 nscript = vars.remove('n' + filt + 'scripts')36 for i in range(1, int(nscript) + 1):37 script = workdir + "/02p5-makeFpSummary/scripts/%s/visit_makeFpSummary_%03d_script.sh" % (filt, i)38 vars.put("MAKEFP_SCRIPT", script)39 pipeline.createSubstream("makeFpSummaryFilter", num, vars)40 num += 141def run_reportPatches():42 process = pipeline.getProcessInstance("setup_reportPatches")43 vars = HashMap(process.getVariables())44 workdir = vars.remove("WORK_DIR")45 filters = vars.remove("FILTERS").split(',')46 num = 047 for filt in filters:48 nscript = vars.remove('n' + filt + 'scripts')49 for i in range(1, int(nscript) + 1):50 script = workdir + "/03-makeSkyMap/scripts/%s/visit_%03d_script.sh" % (filt, i)51 vars.put("CUR_SCRIPT", script)52 pipeline.createSubstream("reportPatchesVisit", num, vars)53 num += 154def run_singleFrameDriver():55 process = pipeline.getProcessInstance("setup_singleFrameDriver")56 vars = HashMap(process.getVariables())57 workdir = vars.remove("WORK_DIR")58 filters = vars.remove("FILTERS").split(',')59 num = 060 for filt in filters:61 nscript = vars.remove('n' + filt + 'scripts')62 for i in range(1, int(nscript) + 1):63 script = workdir + "/02-singleFrameDriver/scripts/%s/visit_%03d_script.sh" % (filt, i)64 vars.put("CUR_SCRIPT", script)65 pipeline.createSubstream("singleFrameDriverFilter", num, vars)66 num += 167def run_jointcal():68 process = pipeline.getProcessInstance("setup_jointcal")69 vars = HashMap(process.getVariables())70 workdir = vars.remove("WORK_DIR")71 filters = vars.remove("FILTERS").split(',')72 num = 073 for filt in filters:74 nscript = vars.remove('n' + filt + 'scripts')75 for i in range(1, int(nscript) + 1):76 script = workdir + "/04-jointcal/scripts/%s/jointcal_%s_%03d.sh" % (filt, filt, i)77 vars.put("CUR_SCRIPT", script)78 pipeline.createSubstream("jointcalFilter", num, vars)79 num += 180def run_jointcalCoadd():81 process = pipeline.getProcessInstance("setup_jointcalCoadd")82 vars = HashMap(process.getVariables())83 workdir = vars.remove("WORK_DIR")84 filters = vars.remove("FILTERS").split(',')85 num = 086 for filt in filters:87 nscript = vars.remove('n' + filt + 'scripts')88 for i in range(1, int(nscript) + 1):89 script = workdir + "/05-jointcalCoadd/scripts/%s/patches_%03d.sh" % (filt, i)90 vars.put("CUR_SCRIPT", script)91 pipeline.createSubstream("jointcalCoaddFilter", num, vars)92 num += 193def run_makeCoaddTempExp():94 process = pipeline.getProcessInstance("setup_makeCoaddTempExp")95 vars = HashMap(process.getVariables())96 workdir = vars.remove("WORK_DIR")97 filters = vars.remove("FILTERS").split(',')98 num = 099 for filt in filters:100 nscript = vars.remove('n' + filt + 'scripts')101 for i in range(1, int(nscript) + 1):102 script = workdir + "/05-makeCoaddTempExp/scripts/%s/patches_%03d.sh" % (filt, i)103 vars.put("CUR_SCRIPT", script)104 pipeline.createSubstream("makeCoaddTempExpFilter", num, vars)105 num += 1106def run_assembleCoadd():107 process = pipeline.getProcessInstance("setup_assembleCoadd")108 vars = HashMap(process.getVariables())109 workdir = vars.remove("WORK_DIR")110 filters = vars.remove("FILTERS").split(',')111 num = 0112 for filt in filters:113 nscript = vars.remove('n' + filt + 'scripts')114 for i in range(1, int(nscript) + 1):115 script = workdir + "/06-assembleCoadd/scripts/%s/patches_%03d.sh" % (filt, i)116 vars.put("CUR_SCRIPT", script)117 pipeline.createSubstream("assembleCoaddFilter", num, vars)118 num += 1119def run_detectCoaddSources():120 process = pipeline.getProcessInstance("setup_detectCoaddSources")121 vars = HashMap(process.getVariables())122 workdir = vars.remove("WORK_DIR")123 filters = vars.remove("FILTERS").split(',')124 num = 0125 for filt in filters:126 nscript = vars.remove('n' + filt + 'scripts')127 for i in range(1, int(nscript) + 1):128 script = workdir + "/07-detectCoaddSources/scripts/%s/patches_%03d.sh" % (filt, i)129 vars.put("CUR_SCRIPT", script)130 pipeline.createSubstream("detectCoaddSourcesFilter", num, vars)131 num += 1132def run_mergeCoaddDetections():133 process = pipeline.getProcessInstance("setup_mergeCoaddDetections")134 vars = HashMap(process.getVariables())135 workdir = vars.remove("WORK_DIR")136 nscript = vars.remove('nscripts')137 filters = vars.remove("FILTERS").split(',')138 for num in range(int(nscript)):139 script = workdir + "/08-mergeCoaddDetections/scripts/patches_all.txt_%04d.sh" % num140 vars.put("CUR_SCRIPT", script)141 pipeline.createSubstream("mergeCoaddDetectionsFilter", num, vars)142def run_measureCoaddSources():143 process = pipeline.getProcessInstance("setup_measureCoaddSources")144 vars = HashMap(process.getVariables())145 workdir = vars.remove("WORK_DIR")146 filters = vars.remove("FILTERS").split(',')147 num = 0148 for filt in filters:149 nscript = vars.remove('n' + filt + 'scripts')150 for i in range(int(nscript)):151 script = workdir + "/09-measureCoaddSources/scripts/%s/patches_%s.txt_%05d.sh" % \152 (filt, filt, i)153 vars.put("CUR_SCRIPT", script)154 pipeline.createSubstream("measureCoaddSourcesFilter", num, vars)155 num += 1156def run_mergeCoaddMeasurements():157 process = pipeline.getProcessInstance("setup_mergeCoaddMeasurements")158 vars = HashMap(process.getVariables())159 workdir = vars.remove("WORK_DIR")160 nscript = vars.remove('nscripts')161 for num in range(int(nscript)):162 script = workdir + "/10-mergeCoaddMeasurements/scripts/patches_all.txt_%05d.sh" % num163 vars.put("CUR_SCRIPT", script)164 pipeline.createSubstream("mergeCoaddMeasurementsFilter", num, vars)165def run_forcedPhotCcd():166 process = pipeline.getProcessInstance("setup_forcedPhotCcd")167 vars = HashMap(process.getVariables())168 workdir = vars.remove("WORK_DIR")169 filters = vars.remove("FILTERS").split(',')170 num = 0171 for filt in filters:172 nscript = vars.remove('n' + filt + 'scripts')173 for i in range(1, int(nscript) + 1):174 script = workdir + "/11-forcedPhotCcd/scripts/%s/visit_%03d.sh" % (filt, i)175 vars.put("CUR_SCRIPT", script)176 pipeline.createSubstream("forcedPhotCcdFilter", num, vars)177 num += 1178def run_forcedPhotCoadd():179 process = pipeline.getProcessInstance("setup_forcedPhotCoadd")180 vars = HashMap(process.getVariables())181 workdir = vars.remove("WORK_DIR")182 filters = vars.remove("FILTERS").split(',')183 num = 0184 for filt in filters:185 nscript = vars.remove('n' + filt + 'scripts')186 for i in range(int(nscript)):187 script = workdir + "/12-forcedPhotCoadd/scripts/%s/patches_%s.txt_%05d.sh" % \188 (filt, filt, i)189 vars.put("CUR_SCRIPT", script)190 pipeline.createSubstream("forcedPhotCoaddFilter", num, vars)...

Full Screen

Full Screen

AST.py

Source:AST.py Github

copy

Full Screen

1from functools import reduce2def checkAllItemsAreAST(*z):3 return reduce(lambda r, x: r and (isinstance(x, AST)), z, True)4def checkAllItemsAreValue(*z):5 return reduce(lambda r, x: r and (isinstance(x, Value)), z, True)6def fmt_comment(comment):7 if comment:8 return " ; {}".format(comment)9 return ""10class AST:11 def __repr__(self):12 return "{}()".format(self.__class__.__name__)13 def describe(self):14 return self.__repr__()15 def __hash__(self):16 return hash(self.__repr__())17 def getVariables(self):18 return set()19 def getConditionVariables(self, is_parent_condition=False):20 return set()21class Variable(AST):22 def __init__(self, name, sort):23 assert isinstance(name, str)24 assert isinstance(sort, Sort)25 self.name = name26 self.sort = sort27 def __repr__(self):28 return self.name29 # return self.describe()30 def describe(self):31 return "{}(name={}, sort={})".format(self.__class__.__name__, self.name, self.sort)32 def __hash__(self):33 return hash(self.__repr__())34 def __eq__(a, b):35 return a.name == b.name # and a.sort == b.sort36 def getVariables(self):37 return set([self])38 def getConditionVariables(self, is_parent_condition=False):39 if is_parent_condition:40 return self.getVariables()41 else:42 return set()43 def to_smt2(self):44 return self.name45 46class Sort(AST):47 def __init__(self, name, values):48 assert isinstance(name, str)49 assert isinstance(values, set) or isinstance(values, list)50 assert checkAllItemsAreValue(*values)51 self.name = name52 self.values = set(values)53 def __repr__(self):54 return "{}({})".format(self.__class__.__name__, self.name)55 def __hash__(self):56 return hash(self.__repr__())57 def __eq__(a, b):58 return a.name == b.name or a.values == b.values59 def to_smt2(self):60 return self.name61class Value(AST):62 def __init__(self, name):63 assert isinstance(name, str)64 self.name = name65 def __repr__(self):66 return self.name67 def describe(self):68 return "{}({})".format(self.__class__.__name__, self.name)69 def __hash__(self):70 return hash(self.__repr__())71 def __eq__(a, b):72 return a.name == b.name73 def to_smt2(self):74 return self.name75### Used to describe equality x == y |-> x = Ref(y)76class Ref(AST):77 def __init__(self, var):78 assert isinstance(var, Variable)79 self.variable = var80 81 def __repr__(self):82 return "{}({})".format(self.__class__.__name__, self.variable)83 def __eq__(a, b):84 return a.__class__.__name__ == b.__class__.__name__ and a.variable == b.variable85class Const(AST):86 def __init__(self):87 pass88 def __repr__(self):89 return "{}()".format(self.__class__.__name__)90 def __eq__(a, b):91 return a.__class__.__name__ == b.__class__.__name__92 def getVariables(self):93 return set()94 def to_smt2(self):95 return self.__class__.__name__96class NOp(AST):97 def __init__(self, *v, comment=""):98 assert len(v) > 099 assert checkAllItemsAreAST(*v), "v={}".format(v)100 self.v = list(v)101 self.comment = comment102 def __repr__(self):103 return "{}({}){}".format(self.__class__.__name__, ', '.join(['{}'.format(x) for x in self.v]), fmt_comment(self.comment))104 def __eq__(a, b):105 return a.v == b.v106 def getVariables(self):107 return reduce(lambda r, expr: r | expr.getVariables(), self.v, set())108 def getConditionVariables(self, is_parent_condition=False):109 return reduce(lambda r, expr: r | expr.getConditionVariables(is_parent_condition), self.v, set())110 def to_smt2(self):111 if self.v:112 return "({} {})".format(self.__class__.__name__.lower(), ' '.join([x.to_smt2() for x in self.v]))113 else:114 return "true"115class UniOp(NOp):116 def __init__(self, v1, comment=""):117 assert isinstance(v1, AST)118 self.v1 = v1119 self.comment = comment120 121 def __repr__(self):122 return "{}({}){}".format(self.__class__.__name__, self.v1, fmt_comment(self.comment))123 def __eq__(a, b):124 return a.v1 == b.v1125 def getVariables(self):126 return self.v1.getVariables()127 def getConditionVariables(self, is_parent_condition=False):128 return self.v1.getConditionVariables(is_parent_condition)129 def to_smt2(self):130 return "({} {})".format(self.__class__.__name__.lower(), self.v1.to_smt2())131class BinOp(NOp):132 def __init__(self, v1, v2, comment=""):133 assert isinstance(v1, AST)134 assert isinstance(v2, AST)135 self.v1 = v1136 self.v2 = v2137 self.comment = comment138 139 def __repr__(self):140 return "{}({}, {}){}".format(self.__class__.__name__, self.v1, self.v2, fmt_comment(self.comment))141 def __eq__(a, b):142 return a.v1 == b.v1 and a.v2 == b.v2143 def getVariables(self):144 return self.v1.getVariables() | self.v2.getVariables()145 def getConditionVariables(self, is_parent_condition=False):146 return self.v1.getConditionVariables(is_parent_condition) | self.v2.getConditionVariables(is_parent_condition)147 def to_smt2(self):148 return "({} {} {})".format(self.__class__.__name__.lower(), self.v1, self.v2)149### Holds no AST nodes150class Terminate(Const):151 pass152### True153class Top(Const):154 def to_smt2(self):155 return "true"156### False157class Bot(Const):158 def to_smt2(self):159 return "false"160class Not(UniOp):161 pass162class Eq(BinOp):163 def to_smt2(self):164 return "(= {} {})".format(self.v1, self.v2)165class And(NOp):166 pass167class Or(NOp):168 pass169class If(AST):170 def __init__(self, cond_clause, then_clause, else_clause):171 assert isinstance(cond_clause, AST)172 assert isinstance(then_clause, AST)173 assert isinstance(else_clause, AST)174 self.cond_clause = cond_clause175 self.then_clause = then_clause176 self.else_clause = else_clause177 def __repr__(self):178 return "{}({}, {}, {})".format(self.__class__.__name__, self.cond_clause, self.then_clause, self.else_clause)179 def getVariables(self):180 return self.cond_clause.getVariables() | self.then_clause.getVariables() | self.else_clause.getVariables()181 def getConditionVariables(self, is_parent_condition=False):182 return self.cond_clause.getConditionVariables(True)183 def to_smt2(self):184 return "(ite {} {} {})".format(self.cond_clause.to_smt2(), self.then_clause.to_smt2(), self.else_clause.to_smt2())185class Implies(AST):186 def __init__(self, left, right):187 assert isinstance(left, AST)188 assert isinstance(right, AST)189 self.left = left190 self.right = right191 def __repr__(self):192 return "{}({}, {})".format(self.__class__.__name__, self.left, self.right)193 def getVariables(self):194 return self.left.getVariables() | self.right.getVariables()195 def getConditionVariables(self, is_parent_condition=False):196 return self.left.getConditionVariables(True)197 def to_smt2(self):...

Full Screen

Full Screen

jot.py

Source:jot.py Github

copy

Full Screen

1# TODO 0-based indices2# Jot3# '' -> I4# '0' -> `ab5# '1' -> SK6from pyparsing import *7import copy8import sys9def main():10 while True:11 try:12 string = input().rstrip()13 except:14 break15 debug = False16 lambda_ = False17 if len(string) > 0 and string[0] == 'd':18 debug = True19 string = string[1:]20 if len(string) > 0 and string[0] == 'l':21 lambda_ = True22 string = string[1:]23 expression = Expression.fromLambda(string)24 else:25 expression = Expression.fromJot(string)26 if debug:27 print('input ', string)28 if not lambda_:29 print('lambda ', expression)30 expression.normalized()31 if debug:32 print('normalized', expression.normalized())33 print('output ', expression.toBinary())34 else:35 print(expression.toBinary())36 print()37def jot(program):38 return Expression.fromJot(program).normalized().toBinary()39class Expression:40 @staticmethod41 def fromLambda(s):42 l = lambda l: Literal(l).suppress()43 term = Forward()44 abstraction = (l('^')+term).setParseAction(lambda t: Abstraction(*t))45 application = (l('`')+term+term).setParseAction(lambda t: Application(*t))46 index = (Regex('[1-9]') | l('(')+Regex('[1-9][0-9]+')+l(')')).setParseAction(lambda t: Variable(int(*t)))47 term <<= (abstraction | application | index)48 expression = term + StringEnd()49 return expression.parseString(s).asList()[0]50 @staticmethod51 def fromJot(s):52 S = lambda: Expression.fromLambda('^^^``31`21')53 K = lambda: Expression.fromLambda('^^2')54 I = lambda: Expression.fromLambda('^1')55 s = s.lstrip('0')56 has = I()57 while len(s) > 0:58 if s[0] == '1':59 has = Application(Application(has, S()), K())60 else:61 has = Application(Application(S(), K()), has)62 s = s[1:]63 return has64class Variable(Expression):65 def __init__(self, value):66 self.value = value67 def normalized(self):68 return self69 def getVariables(self, offset=0, memo={}):70 memo.setdefault(self.value - offset, []).append(self)71 return memo72 def substitute(self, index, expression):73 pass74 def __str__(self):75 s = str(self.value)76 return s if len(s) == 1 else '({})'.format(s)77 def toBinary(self):78 return '{}0'.format('1'*self.value)79class Abstraction(Expression):80 def __init__(self, body):81 self.body = body82 def normalized(self):83 # eta reduction: if term "t" does not contain 1, ^`t1 -> t84 self.body = self.body.normalized()85 if (isinstance(self.body, Application) and86 isinstance(self.body.argument, Variable) and87 self.body.argument.value == 1 and88 1 not in self.body.function.getVariables(offset=0, memo={})):89 shiftExternals(self.body.function, -1)90 return self.body.function91 return self92 def getVariables(self, offset=0, memo={}):93 return self.body.getVariables(offset=offset+1, memo=memo)94 def substitute(self, index, expression):95 expression = copy.deepcopy(expression)96 index += 197 shiftExternals(expression, 1)98 if isinstance(self.body, Variable):99 if self.body.value == index:100 self.body = expression101 else:102 self.body.substitute(index, expression)103 def __str__(self):104 return '^{}'.format(self.body)105 def toBinary(self):106 return '00{}'.format(self.body.toBinary())107class Application(Expression):108 def __init__(self, function, argument):109 self.function, self.argument = function, argument110 def normalized(self):111 # beta reduction: substitute 1s in t with u, incrementing externals in u as necessary, decrementing externals in t by 1, `^tu -> v112 if not isinstance(self.function, Abstraction):113 self.function = self.function.normalized()114 if not isinstance(self.function, Abstraction):115 self.argument = self.argument.normalized()116 return self117 self.function.substitute(0, self.argument)118 shiftExternals(self.function, -1)119 self.function.body = self.function.body.normalized()120 return self.function.body121 def getVariables(self, offset=0, memo={}):122 self.function.getVariables(offset=offset, memo=memo)123 return self.argument.getVariables(offset=offset, memo=memo)124 def substitute(self, index, expression):125 if isinstance(self.function, Variable):126 if self.function.value == index:127 self.function = copy.deepcopy(expression)128 else:129 self.function.substitute(index, expression)130 if isinstance(self.argument, Variable):131 if self.argument.value == index:132 self.argument = copy.deepcopy(expression)133 else:134 self.argument.substitute(index, expression)135 def __str__(self):136 return '`{}{}'.format(self.function, self.argument)137 def toBinary(self):138 return '01{}{}'.format(self.function.toBinary(), self.argument.toBinary())139def shiftExternals(expression, delta):140 external_lists = [_list for offset, _list in expression.getVariables(offset=0, memo={}).items() if offset > 0]141 for e in [item for sublist in external_lists for item in sublist]:142 e.value += delta143def naturalToBinary(n):144 return bin(n+1)[3:] if n != 0 else ''145def binaryToNatural(b):146 return int('1'+b, 2) - 1147if __name__ == '__main__':...

Full Screen

Full Screen

calculatorApp.py

Source:calculatorApp.py Github

copy

Full Screen

1from tkinter import *2import math3import parser # will help to solve mathematical operations4root = Tk()5root.title("Calculator")6# get the users input and place in the textfield/input box7i = 08# factorial = math.factorial()9def getVariables(num):10 global i # keeps track to where the number must be placed11 display.insert(i, num) # at witch index position you want to place number12 i += 1 # next time it will append i to be position 1, so 1234567...13def getOperation(operator):14 global i15 lengthOfOperator = len(operator) # after getting operator, we calculate it's length16 display.insert(i, operator)17 i += lengthOfOperator # we increment global i with operators length18def calculate():19 entireString = display.get()20 try:21 a = parser.expr(entireString).compile()22 result = eval(a)23 clearAll()24 display.insert(0, result)25 except Exception:26 clearAll()27 display.insert(0, "Error")28def clearAll(): # delleting the entire display29 display.delete(0, END) # from where to where delete, from 0 to END, means all30def undo(): # delete single element31 entireString = display.get() # gets all the input value as string32 if len(entireString):33 newString = entireString[:-1] # that it would specify 1 element34 clearAll() # then it deletes all from string35 display.insert(0, newString) # puts all old string as new but with -1 string36 else:37 clearAll()38 display.insert(0, "Error")39def myFactorial():40 stringOfInput = display.get() # breaks is 5+5, because it cant be a string41 try:42 gotNumber = int(stringOfInput)43 fact = 144 while (gotNumber > 0):45 fact = fact * gotNumber46 gotNumber = gotNumber - 147 clearAll()48 display.insert(0, fact)49 except ValueError:50 clearAll()51 display.insert(0, "Error, only numbers can be factorials.")52# adding the input field53display = Entry(root) # input field is Entry()54display.grid(row=1, columnspan=7, sticky=W + E) # adding to main field layout55# adding buttons to the calculator56Button(root, text="1", command=lambda: getVariables(1)).grid(row=2, column=0)57Button(root, text="2", command=lambda: getVariables(2)).grid(row=2, column=1)58Button(root, text="3", command=lambda: getVariables(3)).grid(row=2, column=2)59Button(root, text="4", command=lambda: getVariables(4)).grid(row=3, column=0)60Button(root, text="5", command=lambda: getVariables(5)).grid(row=3, column=1)61Button(root, text="6", command=lambda: getVariables(6)).grid(row=3, column=2)62Button(root, text="7", command=lambda: getVariables(7)).grid(row=4, column=0)63Button(root, text="8", command=lambda: getVariables(8)).grid(row=4, column=1)64Button(root, text="9", command=lambda: getVariables(9)).grid(row=4, column=2)65# adding other buttons to calculator66Button(root, text="AC", command=lambda: clearAll()).grid(row=5, column=0) # removes everything from input field67Button(root, text="0", command=lambda: getVariables(0)).grid(row=5, column=1)68Button(root, text="=", command=lambda: calculate()).grid(row=5, column=2)69Button(root, text="+", command=lambda: getOperation("+")).grid(row=2, column=3)70Button(root, text="-", command=lambda: getOperation("-")).grid(row=3, column=3)71Button(root, text="*", command=lambda: getOperation("*")).grid(row=4, column=3)72Button(root, text="/", command=lambda: getOperation("/")).grid(row=5, column=3)73# adding new operations74Button(root, text="pi", command=lambda: getOperation("*3.14")).grid(row=2, column=4)75Button(root, text="%", command=lambda: getOperation("%")).grid(row=3, column=4)76Button(root, text="(", command=lambda: getOperation("(")).grid(row=4, column=4)77Button(root, text="exp", command=lambda: getOperation("**")).grid(row=5, column=4)78Button(root, text="<-", command=lambda: undo()).grid(row=2, column=5)79Button(root, text="x!", command=lambda: myFactorial()).grid(row=3, column=5)80Button(root, text=")", command=lambda: getOperation(")")).grid(row=4, column=5)81Button(root, text="^2", command=lambda: getOperation("**2")).grid(row=5, column=5)82Button(root, text=",", command=lambda: getOperation(",")).grid(row=5, column=5)...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1"""2The goal of this project is to create a simplistic calculator providing;3Multiplication4Addition5Subtraction6Division7"""8from tkinter import *9import parser10"""11i is used to keep the position of the current number in the input field12reset is used for when = is pressed, its used so that after = is pressed the input field will be cleared if another number is attempted to be entered13"""14i = 015reset = 016root = Tk()17root.title('Calculator')18display = Entry(root)19display.grid(row=1, columnspan=6, sticky=N+E+S+W)20# Recieves the number based on the button pressed and displays it on the input field21def getVariables(num):22 global i23 global reset24 if reset == 1:25 clearAll()26 reset = 027 display.insert(i, num)28 i += 129# clears the input field30def clearAll():31 display.delete(0, END)32# recieves the operator as a parameter, which is put into the input field33# resets the reset counter to 0 as an operation has been pressed, the next number wont clear the field34def getOperation(operator):35 global i36 global reset37 reset = 038 length = len(operator)39 display.insert(i, operator)40 i += length41# the input is retrieved from the field, the parser module is used to scan the string42# the string is then accepted into the eval function to give a result that displays in the input field43def equals():44 input = display.get()45 global reset46 reset = 147 try:48 x = parser.expr(input).compile()49 total = eval(x)50 clearAll()51 display.insert(0, total)52 except Exception:53 clearAll()54 display.insert(0, "Error")55# GUI setup56Button(root, text=1, command=lambda: getVariables(1)).grid(row=2, column=0, sticky=N+E+S+W)57Button(root, text=2, command=lambda: getVariables(2)).grid(row=2, column=1, sticky=N+E+S+W)58Button(root, text=3, command=lambda: getVariables(3)).grid(row=2, column=2, sticky=N+E+S+W)59Button(root, text=4, command=lambda: getVariables(4)).grid(row=3, column=0, sticky=N+E+S+W)60Button(root, text=5,command=lambda: getVariables(5)).grid(row=3, column=1, sticky=N+E+S+W)61Button(root, text=6,command=lambda: getVariables(6)).grid(row=3, column=2, sticky=N+E+S+W)62Button(root, text=7, command=lambda: getVariables(7)).grid(row=4, column=0, sticky=N+E+S+W)63Button(root, text=8, command=lambda: getVariables(8)).grid(row=4, column=1, sticky=N+E+S+W)64Button(root, text=9, command=lambda: getVariables(9)).grid(row=4, column=2, sticky=N+E+S+W)65Button(root, text="C", command=lambda: clearAll()).grid(row=5, column=0, sticky=N+E+S+W)66Button(root, text=" 0", command=lambda: getVariables(0)).grid(row=5, column=1, sticky=N+E+S+W)67Button(root, text=" .", command=lambda: getVariables(".")).grid(row=5, column=2, sticky=N+E+S+W)68Button(root, text="+", command=lambda: getOperation("+")).grid(row=2, column=3, sticky=N+E+S+W)69Button(root, text="-", command=lambda: getOperation("-")).grid(row=3, column=3, sticky=N+E+S+W)70Button(root, text="*", command=lambda: getOperation("*")).grid(row=4, column=3, sticky=N+E+S+W)71Button(root, text="/", command=lambda: getOperation("/")).grid(row=5, column=3, sticky=N+E+S+W)72Button(root, text="=", command=lambda: equals()).grid(row=5, column=4, sticky=N+E+S+W)...

Full Screen

Full Screen

OneDFit.py

Source:OneDFit.py Github

copy

Full Screen

1import ROOT as rt2import RazorCombinedFit3from RazorCombinedFit.Framework import Analysis4import RootTools5class OneDAnalysis(Analysis.Analysis):6 7 def __init__(self, outputFile, config):8 super(OneDAnalysis,self).__init__('OneDFit',outputFile, config)9 10 def analysis(self, inputFiles):11 12 fileIndex = self.indexInputFiles(inputFiles)13 14 import OneDBox15 boxes = {}16 #start by setting all box configs the same17 for box, fileName in fileIndex.iteritems():18 print 'Configuring box %s' % box19 boxes[box] = OneDBox.OneDBox(box, self.config.getVariables(box, "variables"))20 boxes[box].defineSet("pdf1pars", self.config.getVariables(box, "pdf1"))21 boxes[box].defineSet("pdf2pars", self.config.getVariables(box, "pdf2"))22 boxes[box].defineSet("otherpars", self.config.getVariables(box, "others"))23 boxes[box].defineSet("otherpars2", self.config.getVariables(box, "others2"))24 #boxes[box].defineSet("mean", self.config.getVariables(box, "mean"))25 #boxes[box].defineSet("sigma", self.config.getVariables(box, "sigma"))26 # switch to kFALSE to fit for R^2 in slices of MR27 boxes[box].define(fileName, rt.kFALSE)28 29 print 'Variables for box %s' % box30 boxes[box].workspace.allVars().Print('V')31 print 'Workspace'32 boxes[box].workspace.Print('V')33 # perform the fit34 fr = boxes[box].fit1D(fileName,None, "RMRTree2",rt.RooFit.PrintEvalErrors(-1),rt.RooFit.Extended(True))35 self.store(fr, dir=box)36 self.store(fr.correlationHist("correlation_%s" % box), dir=box)37 #store it in the workspace too38 getattr(boxes[box].workspace,'import')(fr,'independentFR')39 40 for box in boxes.keys():...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = new ActiveXObject("Redwood.Redwood");2var variables = redwood.GetVariables();3WScript.Echo("Variables: " + variables);4var redwood = new ActiveXObject("Redwood.Redwood");5var variables = redwood.GetVariables();6WScript.Echo("Variables: " + variables);7var redwood = new ActiveXObject("Redwood.Redwood");8var variables = redwood.GetVariables();9WScript.Echo("Variables: " + variables);10var redwood = new ActiveXObject("Redwood.Redwood");11var variables = redwood.GetVariables();12WScript.Echo("Variables: " + variables);13var redwood = new ActiveXObject("Redwood.Redwood");14var variables = redwood.GetVariables();15WScript.Echo("Variables: " + variables);16var redwood = new ActiveXObject("Redwood.Redwood");17var variables = redwood.GetVariables();18WScript.Echo("Variables: " + variables);19var redwood = new ActiveXObject("Redwood.Redwood");20var variables = redwood.GetVariables();21WScript.Echo("Variables: " + variables);22var redwood = new ActiveXObject("Redwood.Redwood");23var variables = redwood.GetVariables();24WScript.Echo("Variables: " + variables);25var redwood = new ActiveXObject("Redwood.Redwood");26var variables = redwood.GetVariables();27WScript.Echo("Variables: " + variables);28var redwood = new ActiveXObject("Redwood.Redwood");29var variables = redwood.GetVariables();30WScript.Echo("Variables: " + variables);

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2redwood.GetVariables(function (err, result) {3 if (err) {4 console.log(err);5 }6 else {7 console.log(result);8 }9});10{ '0': '1',

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var rv = redwood.GetVariables();3console.log(rv);4var redwood = require('redwood');5redwood.SetVariables({ 'var1': 'val1', 'var2': 'val2' });6console.log('done');7var redwood = require('redwood');8redwood.SetVariable('var1', 'val1');9redwood.SetVariable('var2', 'val2');10console.log('done');11var redwood = require('redwood');12var rv = redwood.GetVariable('var1');13console.log(rv);14var redwood = require('redwood');15var rv = redwood.GetVariable('var3');16console.log(rv);17var redwood = require('redwood');18var rv = redwood.GetVariable('var1');19console.log(rv);20var redwood = require('redwood');21redwood.SetVariable('var1', 'val1');22redwood.SetVariable('var2', 'val2');23redwood.SetVariable('var1', 'val3');24console.log('done');25var redwood = require('redwood');26var rv = redwood.GetVariable('var1');27console.log(rv);28var redwood = require('redwood');29var rv = redwood.GetVariable('var1');30console.log(rv);31var redwood = require('redwood');32redwood.SetVariable('var1', 'val1');

Full Screen

Using AI Code Generation

copy

Full Screen

1var redwood = require('redwood');2var result = redwood.GetVariables();3console.log(result);4var redwood = {5 GetVariables: function () {6 return 'test';7 }8};9module.exports = redwood;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run redwood automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful