query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Parses all .sgfs in `directory` and updates database accordingly. `directory` is assumed to be a path ending in 'YYYYmmddHH'. e.g. /path/to/games/2019070100/
def analyze_dir(directory): counts = Counter() next_moves = defaultdict(Counter) example_sgfs = {} b_wins = Counter() sgf_files = [os.path.join(directory, p) for p in os.listdir(directory) if p.endswith('.sgf')] amt = int(len(sgf_files) * FLAGS.sample_frac) if FLAGS.sample_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usagestats_parse(dirpath):\r\n # Create database\r\n # TODO: change to an easier format, probably json.\r\n db, cursor = create_table()\r\n\r\n # Some vars for logging\r\n processed = 0\r\n err = 0\r\n\r\n # Iterate through the /usagestats/ directory and fetch all files\r\n for root, di...
[ "0.53457755", "0.5272943", "0.522", "0.5175559", "0.5155737", "0.51370525", "0.5131457", "0.5120154", "0.5110887", "0.51071286", "0.5103022", "0.51002693", "0.5084197", "0.506192", "0.5057502", "0.50454944", "0.5033248", "0.50327975", "0.5024265", "0.5013997", "0.5005775", ...
0.62088275
0
Read the wave function of Nth state from the file numbered by jjjj
def read_from_file(jjjj, N, path='/data/users/mklymenko/science/H2_100/programing/dis/v0/'): p1 = np.loadtxt(path+'ff_'+str(jjjj)+'.dat') a = [] a = np.where( ((p1[:, 1] == 111) & (p1[:, 2] == 111) & (p1[:, 3] == 111)))[0] n1 = N X = np.array(p1[a[n1]+1:a[n1+1], 0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readNextGenSpectrum(fname=''):\n\n print('Reading : ', fname)\n\n with open(fname, 'r') as rfile:\n dum = rfile.readline()\n sdum = dum.split()\n teff = float(sdum[0])\n logg = float(sdum[1])\n mph = float(sdum[2])\n dum = rfile.readline()\n nwav = float(d...
[ "0.6181482", "0.5862029", "0.56960034", "0.5677018", "0.56482685", "0.56220466", "0.5604546", "0.5573163", "0.5567389", "0.55650276", "0.5486313", "0.547349", "0.54472053", "0.5439266", "0.54381114", "0.5421353", "0.5416626", "0.54019856", "0.53966343", "0.53939825", "0.53676...
0.63657975
0
Same as show_func(self,x) but returns decomposed primitive Gaussian functions
def show_gf(self, x): g = np.zeros((len(x[0]), self._num_fu), dtype=np.float64) for j in range(self._num_fu): x1 = self._gf[j*5] x2 = self._gf[j*5+1] x3 = self._gf[j*5+2] w = self._gf[j*5+3] a = self._gf[j*5+4] r1 = pow((x[0]-x1), 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_func(self, x):\n\n if (self._flag == 1):\n g = self.modelfun(x, *self._gf)\n elif (self._flag == 2):\n g = self.modelfun1(x, *self._gf)\n elif ((self._flag == 0) & (self._load != '0')):\n pass\n else:\n # pass\n sys.exit(\"...
[ "0.6923806", "0.61165667", "0.58499724", "0.578721", "0.5772432", "0.572566", "0.5708594", "0.56611586", "0.5646653", "0.56375355", "0.5631954", "0.562097", "0.5598726", "0.55861354", "0.5576355", "0.55678403", "0.55473655", "0.55415136", "0.55403167", "0.5530078", "0.5522108...
0.6513373
1
Returns the list of URL patterns which have to be added to main urls.py By default returns a sigle URL pattern which mounts app's urls.py as under the app's label path. Most likely you don't need to edit this function.
def urlpatterns(self): regex = r'^%s/' % self.label urls_module = '%s.urls' % self.name ns = self.label return [url(regex, include(urls_module, namespace=ns, app_name=ns))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover_urls():\n urlpatterns = []\n\n for app in settings.INSTALLED_APPS:\n try:\n _temp = __import__(f'{app}.urls', globals(), locals(), ['urlpatterns'], 0)\n urlpatterns += _temp.urlpatterns\n\n except ModuleNotFoundError:\n pass\n\n return urlpattern...
[ "0.78666055", "0.76514953", "0.75988424", "0.74951446", "0.7466889", "0.7462883", "0.7424311", "0.72087145", "0.7128712", "0.71177673", "0.7090256", "0.70579743", "0.6972757", "0.69723296", "0.6950012", "0.6892247", "0.6667635", "0.6659763", "0.66339105", "0.6629913", "0.6492...
0.84036785
0
A signal called by the constructor once the app instance is ready (once it's registered)
def ready(self): # export app settings self.export_settings() # import the submodule with signal handlers self.load_module('signals')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready(self):\n import main.signals # noqa", "def on_startup(self) -> None:\n ...", "def ready(self):\n\n from . import signals # noqa", "def on_start(self):\n App.on_start(self)\n self.root.register()", "def on_start(self):\n self.init()", "def ready(self):...
[ "0.74507123", "0.73261684", "0.73054254", "0.72979665", "0.7194798", "0.71527547", "0.71152693", "0.70625466", "0.702905", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.683485", "0.68191284", "0.68191147", "...
0.7368948
1
A decorator to add a periodic task. Decorated function has to accept
def periodic_task(cls, delta, name=None): if isinstance(delta, int): delta = datetime.timedelta(seconds=delta) def decorator(func): registry_name = name or '%s.%s' % (func.__module__, func.__name__) cls.periodic_tasks[registry_name] = PeriodicTaskFun(func, delta, reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_periodic_tasks(sender, **kwargs):\n sender.add_periodic_task(60, scheduled_task.s(), name='A scheduled task')", "def Schedule(interval=3600):\n # TODO:: if func need to return something\n def schedule(func):\n @wraps(func)\n def wrapper(*args, **kwargs):\n while True:\...
[ "0.67738533", "0.6409797", "0.63915294", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.6348526", "0.6347841", "0.6334383", "0.6309153", "0.625314", "0.62467635", "0.61627775", "0....
0.7903502
0
Uses Gibbs sampling to segment an image into foreground and background. Inputs
def gibbs_segmentation(image, burn_in, collect_frequency, n_samples): (Nx, Ny, _) = image.shape distribution = np.zeros( (Nx, Ny) ) # Initialize binary estimates at every pixel randomly. estimates = (np.random.random( (Nx, Ny) ) > .5).astype(int) total_iterations = burn_in + (collect_frequency *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_process(fgMask):\n backSub = cv.createBackgroundSubtractorKNN()\n kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2))\n kernel2 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2))\n #kernel1 = np.ones((3,3),np.uint8)\n #kernel2 = np.ones((3,3), np.uint8)\n\n ...
[ "0.60925585", "0.59579676", "0.5944388", "0.5910497", "0.5808057", "0.5794726", "0.57745075", "0.57592636", "0.5752392", "0.5752392", "0.5737282", "0.572165", "0.5718988", "0.56727695", "0.56688863", "0.5667283", "0.5656513", "0.56523293", "0.5646415", "0.564283", "0.5639516"...
0.6486014
0
Returns values of the grid at points neighboring (x,y) Inputs
def get_neighbors(grid, x, y): out = [] if x > 0: out.append(grid[x-1, y]) if y > 0: out.append(grid[x, y-1]) if y < grid.shape[1] - 1: out.append(grid[x, y+1]) if x < grid.shape[0] - 1: out.append(grid[x+1, y]) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xy(self, x, y):\r\n\t\treturn self.grid[y, x]", "def get_xy_grid(nx, ny):\n\tfor n in [nx, ny]:\n\t\tif not isodd(n):\n\t\t\traise Exception(\"[get_xy_grid] only accept odd number\")\n\n\tx, y = np.mgrid[-(nx-1)/2:(nx+1)/2, -(ny-1)/2:(ny+1)/2]\n\n\treturn x, y", "def neighbours(x, y):\n n = []\n ...
[ "0.7048819", "0.6988485", "0.6886183", "0.6840988", "0.6834184", "0.6812989", "0.6711071", "0.66918945", "0.66904217", "0.6687271", "0.6672603", "0.66403353", "0.6630548", "0.6619971", "0.6610192", "0.6555865", "0.6553371", "0.6549096", "0.6524648", "0.6524648", "0.649784", ...
0.7839016
0
Check FPU mode was not changed during the test.
def check_fpu_mode(request): old_mode = get_fpu_mode() yield new_mode = get_fpu_mode() if old_mode != new_mode: warnings.warn("FPU mode changed from {0:#x} to {1:#x} during " "the test".format(old_mode, new_mode), category=FPUModeChangeWarning, stackl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_test_mode(self):\n\n # Ensure that we default to test mode off\n self.assertFalse(self.driver._test_mode)\n\n exception = False\n try:\n self.driver.set_test_mode(False)\n self.driver.test_force_state(state=1)\n\n except TestModeException:\n ...
[ "0.6161543", "0.6077402", "0.602634", "0.5968215", "0.59399635", "0.5799107", "0.5782805", "0.5766817", "0.56953335", "0.5690476", "0.567844", "0.55987924", "0.5596079", "0.55791", "0.5551743", "0.55079734", "0.5506978", "0.5492651", "0.5483458", "0.5458876", "0.5451956", "...
0.83218914
0
Calculate distance between two vectors using pearson method
def pearson_distance(vector1, vector2) : sum1 = sum(vector1) sum2 = sum(vector2) sum1Sq = sum([pow(v,2) for v in vector1]) sum2Sq = sum([pow(v,2) for v in vector2]) pSum = sum([vector1[i] * vector2[i] for i in range(len(vector1))]) num = pSum - (sum1*sum2/len(vector1)) den = math.sqrt((su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def distance(p1, p2):\n return np.linalg.norm(p2-p1)", "def distance(p1, p2):\n return np.linalg.norm(np.array(p1) - np.array(p2))", "def distance...
[ "0.7294797", "0.7278467", "0.7270707", "0.70065033", "0.6940717", "0.6914079", "0.687906", "0.6853775", "0.68429995", "0.6828889", "0.6796051", "0.6794433", "0.67713475", "0.67655015", "0.6764504", "0.67617387", "0.6739371", "0.67008483", "0.6689883", "0.66892594", "0.6667814...
0.82104915
0
Publish an Alembic cache file for the scene and publish it to Shotgun.
def __publish_alembic_cache(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __publish_geocache(self, item, output, work_template, primary_publish_path,\n sg_task, comment, thumbnail_path, progress_cb):\n # determine the publish info to use\n #\n progress_cb(10, \"Determining publish details\")\n\n # get the current sce...
[ "0.6180006", "0.58817565", "0.5879691", "0.5615526", "0.55755055", "0.5549456", "0.5518195", "0.5488557", "0.53738135", "0.5355673", "0.53469515", "0.53295285", "0.5316194", "0.5295457", "0.52651227", "0.5242149", "0.5208094", "0.519602", "0.51877934", "0.51724315", "0.516887...
0.65435106
0
Publish an Alembic cache file for the scene and publish it to Shotgun.
def __publish_geocache(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path and e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __publish_alembic_cache(self, item, output, work_template, primary_publish_path,\n sg_task, comment, thumbnail_path, progress_cb):\n # determine the publish info to use\n #\n progress_cb(10, \"Determining publish details\")\n\n # get the curren...
[ "0.65446615", "0.58813435", "0.587966", "0.5616056", "0.5576552", "0.55503", "0.5517325", "0.54890555", "0.53740954", "0.53564984", "0.5346136", "0.53308266", "0.5318086", "0.5296485", "0.5264278", "0.524097", "0.5208991", "0.5195995", "0.5189076", "0.5173123", "0.5169205", ...
0.61809075
1
Export a Maya file for the camera and publish it to Shotgun.
def __publish_mayacamera(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_camera(progress_controller=None):\n if progress_controller is None:\n progress_controller = ProgressControllerBase()\n progress_controller.maximum = 7\n\n from stalker import Task, Version\n from anima.dcc import mayaEnv\n\n m = mayaEnv.Maya()\n v = m.get_current_version()\n ...
[ "0.6774113", "0.6170067", "0.6094196", "0.5807592", "0.5593866", "0.5566821", "0.55538255", "0.5492313", "0.5441863", "0.5441394", "0.54356366", "0.5406046", "0.540113", "0.53069115", "0.5299804", "0.52989906", "0.52933705", "0.52650744", "0.52415776", "0.5216365", "0.5212121...
0.6862812
0
Export an Alembic file for the camera and publish it to Shotgun.
def __publish_alembiccamera(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_camera(progress_controller=None):\n if progress_controller is None:\n progress_controller = ProgressControllerBase()\n progress_controller.maximum = 7\n\n from stalker import Task, Version\n from anima.dcc import mayaEnv\n\n m = mayaEnv.Maya()\n v = m.get_current_version()\n ...
[ "0.6083645", "0.5946963", "0.57567835", "0.5715746", "0.5713011", "0.5650772", "0.55849946", "0.555498", "0.54727066", "0.5459543", "0.54370785", "0.5400925", "0.5385602", "0.53685206", "0.5327392", "0.5321729", "0.5304796", "0.5301103", "0.5287265", "0.5260967", "0.52580863"...
0.6043398
1
Find the animation range from the current scene.
def _find_scene_animation_range(self): # look for any animation in the scene: animation_curves = cmds.ls(typ="animCurve") # if there aren't any animation curves then just return # a single frame: if not animation_curves: return (1, 1) # something in the scen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentAnimRange():\n return int(oma.MAnimControl.minTime().value), int(oma.MAnimControl.maxTime().value)", "def get_frame_range(self):\n #self._root = self.get_root_node()\n #startFrame = int(self._root.knob('first_frame').value())\n #endFrame = int(self._root.knob('last_frame').v...
[ "0.71858317", "0.6609152", "0.6361358", "0.6292253", "0.6262991", "0.6139651", "0.6130778", "0.6130778", "0.61261404", "0.61125124", "0.6087573", "0.6052101", "0.59913844", "0.5926955", "0.58776486", "0.58599156", "0.58571494", "0.58331656", "0.5719528", "0.56707656", "0.5669...
0.8159036
0
Returns the game result and wage Earned. Plays One Round of BlackJack
def play_blackjack(wager, max_wager): game = BlackJack(wager=wager, max_wager=max_wager, allow_split=True, allow_dd=True) player = game.players[0] print('\nYour Hand %s has %s points. Your wager is: %d' % (player['hand'], game.player_hand_value(), player['wager'])) print("Dealer's upcard is: ", game.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_game(self):\n self.dealer.hit_until_hold()\n message = self.bold_message(self.dealer.final_str_with_hand()+ \"\\n\")\n if self.dealer.has_blackjack():\n message += \"The Dealer has Blackjack. All players without blackjack will lose the round.\\n\\n\"\n for pl...
[ "0.74676996", "0.7168184", "0.6733583", "0.6671142", "0.6599137", "0.6537235", "0.6495052", "0.648471", "0.6455073", "0.63855594", "0.6383431", "0.63688266", "0.6352971", "0.6303885", "0.6285994", "0.62824136", "0.62114704", "0.62050974", "0.6204267", "0.6198414", "0.6196291"...
0.7301225
1
Test that the number of spins can be properly counted. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_spins(self): # Test the number of spins counted. self.assertEqual(mol_res_spin.count_spins(), 4) self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 8) self.assertEqual(mol_res_spin.count_spins(selection='@N5'), 1) self.assertEqual(mol_res_spin.count_spin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_no_spins(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 0)", "def test_count_spins_no_pipe(self)...
[ "0.8216668", "0.79208726", "0.6061253", "0.59907717", "0.5961885", "0.59412616", "0.59404606", "0.59132665", "0.5879472", "0.5839816", "0.5767341", "0.57627225", "0.5760211", "0.5658254", "0.5647766", "0.56327945", "0.5631395", "0.5559625", "0.55477506", "0.5539356", "0.54946...
0.87852323
0
Test that the number of spins (zero) can be properly counted. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_no_spins(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Test the number of spins counted. self.assertEqual(mol_res_spin.count_spins(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_spins(self):\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 4)\n self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 8)\n self.assertEqual(mol_res_spin.count_spins(selection='@N5'), 1)\n self.assertEqual(mol_res_spin...
[ "0.8364899", "0.80283797", "0.63442856", "0.609039", "0.6043598", "0.6036848", "0.6035397", "0.5966873", "0.58482337", "0.58064646", "0.57407767", "0.56835514", "0.56486934", "0.563143", "0.5597956", "0.55912817", "0.55141515", "0.546807", "0.54593736", "0.5443237", "0.544082...
0.846338
0
Test that the counting of the number of spins raises an error when no pipe exists. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_spins_no_pipe(self): # Reset relax. reset() # Test for the error. self.assertRaises(RelaxNoPipeError, mol_res_spin.count_spins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_no_spins(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 0)", "def test_count_spins(self):\n\n ...
[ "0.8297968", "0.7812048", "0.67697406", "0.61876446", "0.6167623", "0.6036055", "0.58979064", "0.58179224", "0.5769859", "0.57561326", "0.5715153", "0.5708538", "0.5594331", "0.5509007", "0.54806995", "0.5468505", "0.54357624", "0.54193336", "0.5419145", "0.5415963", "0.53699...
0.88973
0
Test the function for determining if moleculeresiduespin data exists. The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data(self): # This should be True. self.failUnless(mol_res_spin.exists_mol_res_spin_data())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # This should be False.\n self.failIf(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res...
[ "0.86498624", "0.8171099", "0.8008126", "0.7832109", "0.7612232", "0.74061805", "0.7374406", "0.64998114", "0.6273386", "0.6179472", "0.5896734", "0.58264905", "0.5745269", "0.57218933", "0.57177144", "0.5715544", "0.5627069", "0.56219554", "0.56199694", "0.55988914", "0.5454...
0.91275215
0
Determine if moleculeresiduespin data exists (with data for a single molecule). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_mol(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Name the first molecule. dp.mol[0].name = 'TOM40' # This should be Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='or...
[ "0.84925765", "0.8205755", "0.81849754", "0.7938019", "0.78887266", "0.75465906", "0.6573173", "0.63930625", "0.56609166", "0.5556357", "0.5478604", "0.53835493", "0.5380998", "0.53788584", "0.53724927", "0.5332502", "0.5311545", "0.52456486", "0.52142644", "0.52067447", "0.5...
0.8367752
1
Determine if moleculeresiduespin data exists (when a single residue is numbered). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_res_num(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Number the first residue. dp.mol[0].res[0].num = 1 # This should ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_single_spin_num(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n dp = pipes.get_pipe('orig')\n\n # Number the first spin.\n dp.mol[0].res[0].spin[0].num = 234\...
[ "0.84456354", "0.82298267", "0.8103048", "0.79645956", "0.79151535", "0.77068615", "0.6438838", "0.6125528", "0.6099552", "0.5864683", "0.57085097", "0.5695363", "0.5664928", "0.55890244", "0.55634105", "0.5563084", "0.5443872", "0.5368424", "0.53031784", "0.52392286", "0.519...
0.8403741
1
Determine if moleculeresiduespin data exists (when a single spin is named). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_spin_name(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Name the first spin. dp.mol[0].res[0].spin[0].name = 'NH' # Thi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.83926356", "0.83922964", "0.8218184", "0.81590086", "0.8031726", "0.7876572", "0.6523379", "0.6487321", "0.5793478", "0.566882", "0.5593635", "0.5562465", "0.55435604", "0.5511731", "0.54539114", "0.54490983", "0.5361425", "0.535502", "0.53494656", "0.53312635", "0.5321676...
0.8426691
0
Determine if moleculeresiduespin data exists (when a single spin is numbered). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_spin_num(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Number the first spin. dp.mol[0].res[0].spin[0].num = 234 # This...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.8392751", "0.823386", "0.8206758", "0.817102", "0.8049526", "0.75779665", "0.6515433", "0.63660663", "0.5854637", "0.57079095", "0.5615342", "0.55319315", "0.552877", "0.5456042", "0.54262865", "0.5386728", "0.53743654", "0.5337322", "0.53064", "0.5303351", "0.5252378", ...
0.8513595
0
Determine if moleculeresiduespin data exists when no data exists. The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # This should be False. self.failIf(mol_res_spin.exists_mol_res_spin_data())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.86641157", "0.8070875", "0.80186194", "0.7868918", "0.77041644", "0.74484134", "0.70216393", "0.65485287", "0.62315524", "0.58949995", "0.57270414", "0.56871605", "0.5657348", "0.55692613", "0.5513263", "0.54984736", "0.5497161", "0.5481748", "0.54525614", "0.5450925", "0....
0.8743408
0
Test the format_info_full() function for all combinations of input.
def test_format_info_full1(self): # The spin info and expected string - covering all possible combinations. info = [ # 5 bits of info. {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10, 'spin_name': 'N', 'spin_num': 200, 'string': "Molecule Ubi, residue Ala 10, spin N 200...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_format_correlation_info(self):\r\n # With 999 permutations.\r\n exp = 'Correlation coefficient\\tParametric p-value\\tNonparametric ' + \\\r\n 'p-value\\tCI (lower)\\tCI (upper)\\n0.7778\\t0.0000\\t' + \\\r\n '0.000\\t0.0000\\t1.0000\\n'\r\n obs = format_corr...
[ "0.61617583", "0.5618504", "0.55047697", "0.5475531", "0.5467334", "0.544068", "0.5422697", "0.54041266", "0.5374505", "0.53257984", "0.5319085", "0.53129464", "0.5284171", "0.5279987", "0.52776444", "0.52651304", "0.52415544", "0.51991093", "0.51775396", "0.5157071", "0.5129...
0.72220844
0
First test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array1(self): # The data. data = ['1', 'GLY'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2) # Test the string. self.assertEqual(id, ':1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.78925526", "0.7822347", "0.76349664", "0.7610406", "0.75354004", "0.6579472", "0.60722893", "0.5760644", "0.5730065", "0.5698617", "0.5577793", "0.55716354", "0.554988", "0.55279154", "0.5508247", "0.5425098", "0.5357982", "0.53330165", "0.52789444", "0.527686", "0.527214"...
0.8076779
0
Second test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array2(self): # The data. data = ['1', 'GLY', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2, spin_num_col=3, spin_name_col=4) # Test the string. self.assertEqual(id, ':1@234')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array1(self):\n\n # The data.\n data = ['1', 'GLY']\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin_id_data_arr...
[ "0.8086905", "0.7927075", "0.7615566", "0.7598885", "0.75597614", "0.6486901", "0.6055875", "0.58638847", "0.57211256", "0.5610557", "0.55860114", "0.558456", "0.5549974", "0.54673797", "0.53942615", "0.53439724", "0.5339024", "0.5296352", "0.52316296", "0.5216718", "0.520122...
0.8013001
1
Third test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array3(self): # The data. data = ['Ap4Aase', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=None, res_name_col=None, spin_num_col=2, spin_name_col=3) # Test the string. self.assertEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.7930686", "0.79260224", "0.77357745", "0.7663863", "0.7659892", "0.64280635", "0.5991729", "0.591287", "0.5785646", "0.5763235", "0.5534429", "0.5532555", "0.5476528", "0.5412773", "0.5298371", "0.528956", "0.52654487", "0.523596", "0.52343017", "0.5201792", "0.5143447", ...
0.79937476
0
Fifth test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array5(self): # The data. data = ['Ap4Aase', '1', 'GLY', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5) # Test the string. self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.815962", "0.80106467", "0.781097", "0.7796662", "0.77246344", "0.6556488", "0.5972483", "0.596083", "0.5889257", "0.58199716", "0.58112353", "0.5503903", "0.5457309", "0.54131293", "0.5382142", "0.53779155", "0.53478414", "0.5337792", "0.5311869", "0.53046256", "0.5285401"...
0.80710626
1
Sixth test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array6(self): # The data. data = ['1', 'GLY', None, None] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2) # Test the string. self.assertEqual(id, ':1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array5(self):\n\n # The data.\n data = ['Ap4Aase', '1', 'GLY', '234', 'NH']\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5)\n\n # Test the string.\n ...
[ "0.784438", "0.7714932", "0.7577586", "0.757559", "0.7561462", "0.6163308", "0.5690773", "0.56745136", "0.56711537", "0.5610869", "0.56024593", "0.5324083", "0.527502", "0.5271551", "0.5269606", "0.52232736", "0.52200073", "0.5196732", "0.5193356", "0.5152407", "0.5141934", ...
0.8226237
0
Test the proper operation of the molecule loop with molecule selection. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop(self): # Loop over the molecules. for mol in mol_res_spin.molecule_loop('#RNA'): # Test the molecule name. self.assertEqual(mol.name, 'RNA') # Test loop length. self.assertEqual(len(list(mol_res_spin.molecule_loop('#RNA'))), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_selection(self):\n\n # Molecule data.\n name = ['Ap4Aase', 'RNA']\n\n # Loop over the molecules.\n i = 0\n for mol in mol_res_spin.molecule_loop():\n # Test the molecule names.\n self.assertEqual(mol.name, name[i])\n\n # ...
[ "0.78410846", "0.72731423", "0.71487254", "0.7066662", "0.6906277", "0.6623356", "0.6518581", "0.64826006", "0.64725286", "0.6450824", "0.6367674", "0.62304765", "0.61855984", "0.61084175", "0.60988086", "0.609054", "0.6079127", "0.5973447", "0.59563404", "0.55609775", "0.548...
0.75784975
1
Test the proper operation of the molecule loop when no data is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the molecules. i = 0 for molecule in mol_res_spin.molecule_loop(): i = i + 1 # Test loop ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_selection(self):\n\n # Molecule data.\n name = ['Ap4Aase', 'RNA']\n\n # Loop over the molecules.\n i = 0\n for mol in mol_res_spin.molecule_loop():\n # Test the molecule names.\n self.assertEqual(mol.name, name[i])\n\n # ...
[ "0.79922223", "0.79701054", "0.79289037", "0.74845135", "0.731188", "0.68929285", "0.6694039", "0.65099937", "0.6446146", "0.6183709", "0.6016163", "0.5998978", "0.5988837", "0.59473413", "0.5947067", "0.58972764", "0.57490903", "0.57089925", "0.5673426", "0.5634207", "0.5628...
0.88965213
0
Test the proper operation of the molecule loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for molecule in mol_res_spin.molecule_loop(): pass # Test for the no pipe error. self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the molecules.\n i = 0\n for molecule in mol_res_spin.molecule_loop():\n i = i + 1\n\n ...
[ "0.85301226", "0.79059464", "0.7656533", "0.73368526", "0.7248419", "0.70627767", "0.69679505", "0.6318001", "0.63044786", "0.6154404", "0.61035573", "0.5977854", "0.5860056", "0.5848514", "0.5847035", "0.5795445", "0.56938887", "0.55405074", "0.5520122", "0.5514679", "0.5450...
0.84358346
1
Test the proper operation of the molecule loop when no selection is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_selection(self): # Molecule data. name = ['Ap4Aase', 'RNA'] # Loop over the molecules. i = 0 for mol in mol_res_spin.molecule_loop(): # Test the molecule names. self.assertEqual(mol.name, name[i]) # Increment i. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the molecules.\n i = 0\n for molecule in mol_res_spin.molecule_loop():\n i = i + 1\n\n ...
[ "0.7604223", "0.73143464", "0.73025155", "0.7007973", "0.6872689", "0.6866279", "0.6847027", "0.6842967", "0.64472896", "0.64401734", "0.640884", "0.6354868", "0.6325706", "0.6155382", "0.58229405", "0.5801081", "0.5721982", "0.5642657", "0.5607593", "0.55608016", "0.5551149"...
0.8007402
0
Test the proper operation of the residue loop with residue selection. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop(self): # Loop over the residues. for res in mol_res_spin.residue_loop('#Ap4Aase:Glu'): # Test the selection. self.assertEqual(res.num, 2) # Test loop length. self.assertEqual(len(list(mol_res_spin.residue_loop('#Ap4Aase:Glu'))), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_selection(self):\n\n # Spin data.\n num = [1, 2, 4, -5, -4]\n name = [None, 'Glu', 'Pro', None, None]\n\n # Loop over the residues.\n i = 0\n for res in mol_res_spin.residue_loop():\n # Test the residue numbers.\n self.assertE...
[ "0.81529486", "0.7770318", "0.7552308", "0.6837369", "0.674307", "0.64884526", "0.6445583", "0.63936305", "0.6344969", "0.6327929", "0.6228372", "0.62093467", "0.600957", "0.600777", "0.59746706", "0.59265643", "0.59220964", "0.5913016", "0.5843478", "0.5786151", "0.57159615"...
0.8213552
0
Test the proper operation of the residue loop when no data is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the residues. i = 0 for residue in mol_res_spin.residue_loop(): i = i + 1 # Test loop leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_selection(self):\n\n # Spin data.\n num = [1, 2, 4, -5, -4]\n name = [None, 'Glu', 'Pro', None, None]\n\n # Loop over the residues.\n i = 0\n for res in mol_res_spin.residue_loop():\n # Test the residue numbers.\n self.assertE...
[ "0.8301634", "0.82040375", "0.7788324", "0.7710455", "0.7556808", "0.72358716", "0.70310825", "0.6912135", "0.66328", "0.66025203", "0.6565843", "0.6549843", "0.6462473", "0.6374776", "0.6350188", "0.6347619", "0.6336793", "0.61492753", "0.6104927", "0.58747214", "0.5848667",...
0.8984354
0
Test the proper operation of the residue loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for residue in mol_res_spin.residue_loop(): pass # Test for the no pipe error. self.assertR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the residues.\n i = 0\n for residue in mol_res_spin.residue_loop():\n i = i + 1\n\n ...
[ "0.85945946", "0.77838326", "0.7751666", "0.76332873", "0.7629808", "0.7481475", "0.6956494", "0.69382966", "0.68887913", "0.65152484", "0.6382403", "0.63752276", "0.6283524", "0.6206884", "0.62047124", "0.61061484", "0.6081791", "0.6047085", "0.59946924", "0.5982436", "0.588...
0.86027044
0
Test the proper operation of the residue loop when no selection is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_selection(self): # Spin data. num = [1, 2, 4, -5, -4] name = [None, 'Glu', 'Pro', None, None] # Loop over the residues. i = 0 for res in mol_res_spin.residue_loop(): # Test the residue numbers. self.assertEqual(res.num, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the residues.\n i = 0\n for residue in mol_res_spin.residue_loop():\n i = i + 1\n\n ...
[ "0.8018613", "0.7852093", "0.77218246", "0.70574504", "0.68793595", "0.67554224", "0.66418993", "0.65647024", "0.64698106", "0.6459469", "0.6435851", "0.63787186", "0.62164485", "0.6151769", "0.61505395", "0.61433077", "0.60872215", "0.60452425", "0.5893791", "0.5879402", "0....
0.83963245
0
Test the function for returning the desired molecule data container. The function tested is pipe_control.mol_res_spin.return_molecule().
def test_return_molecule(self): # Ask for a few molecules. mol1 = mol_res_spin.return_molecule('#Ap4Aase') mol2 = mol_res_spin.return_molecule(selection='#RNA', pipe='orig') # Test the data of molecule 1. self.assertEqual(mol1.name, 'Ap4Aase') # Test the data of molecu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_molecule_pipe_fail(self):\n\n # Try to get a molecule from a missing data pipe.\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#Ap4Aase', pipe='new')\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#RNA', pipe='new'...
[ "0.63652605", "0.636043", "0.6196237", "0.61398995", "0.6118704", "0.59954035", "0.5866117", "0.5800223", "0.57261777", "0.56701607", "0.56608844", "0.55993", "0.5499727", "0.5499299", "0.5475103", "0.5424967", "0.53821063", "0.53715503", "0.5311273", "0.5283148", "0.5275008"...
0.82855994
0
Test the failure of the function for returning the desired molecule data container. The function tested is pipe_control.mol_res_spin.return_molecule().
def test_return_molecule_pipe_fail(self): # Try to get a molecule from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#Ap4Aase', pipe='new') self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#RNA', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_molecule(self):\n\n # Ask for a few molecules.\n mol1 = mol_res_spin.return_molecule('#Ap4Aase')\n mol2 = mol_res_spin.return_molecule(selection='#RNA', pipe='orig')\n\n # Test the data of molecule 1.\n self.assertEqual(mol1.name, 'Ap4Aase')\n\n # Test the ...
[ "0.7752265", "0.6388569", "0.6297495", "0.6286569", "0.62686867", "0.6196573", "0.6173113", "0.617114", "0.6123175", "0.60926574", "0.59676576", "0.5883313", "0.587805", "0.5837631", "0.58120954", "0.577729", "0.5614546", "0.56138414", "0.56082726", "0.55601", "0.55297875", ...
0.75012517
1
Test the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_residue().
def test_return_residue(self): # Ask for a few residues. res1 = mol_res_spin.return_residue(':1') res2 = mol_res_spin.return_residue(selection=':2') res4 = mol_res_spin.return_residue(selection=':4', pipe='orig') res5 = mol_res_spin.return_residue(selection='#RNA:-5', pipe='orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_single_residue_info(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_single_residue_info('1')\n res2 = mol_res_spin.return_single_residue_info('2,Glu')\n res4 = mol_res_spin.return_single_residue_info('Pro,4')\n res5 = mol_res_spin.return_single_r...
[ "0.75668174", "0.6807258", "0.6658924", "0.6526883", "0.641903", "0.6259072", "0.62291884", "0.6145257", "0.61449796", "0.60818225", "0.6001908", "0.594091", "0.5885459", "0.58385515", "0.57113373", "0.5641675", "0.5627909", "0.5625898", "0.5486544", "0.54508084", "0.5426877"...
0.84991
0
Test the failure of the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_residue().
def test_return_residue_pipe_fail(self): # Try to get a residue from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_residue, selection=':2', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_residue(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_residue(':1')\n res2 = mol_res_spin.return_residue(selection=':2')\n res4 = mol_res_spin.return_residue(selection=':4', pipe='orig')\n res5 = mol_res_spin.return_residue(selection='#RNA:-5',...
[ "0.8170825", "0.738827", "0.7088673", "0.6640738", "0.64614236", "0.6410077", "0.6326799", "0.628192", "0.6172335", "0.6162224", "0.61231905", "0.60759443", "0.6006672", "0.59830487", "0.5976972", "0.588619", "0.58454573", "0.5789694", "0.56599325", "0.55045515", "0.5500338",...
0.748504
1
Test the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_single_residue_info().
def test_return_single_residue_info(self): # Ask for a few residues. res1 = mol_res_spin.return_single_residue_info('1') res2 = mol_res_spin.return_single_residue_info('2,Glu') res4 = mol_res_spin.return_single_residue_info('Pro,4') res5 = mol_res_spin.return_single_residue_info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_residue(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_residue(':1')\n res2 = mol_res_spin.return_residue(selection=':2')\n res4 = mol_res_spin.return_residue(selection=':4', pipe='orig')\n res5 = mol_res_spin.return_residue(selection='#RNA:-5',...
[ "0.7970382", "0.7181199", "0.6772322", "0.61946106", "0.618991", "0.60239536", "0.59026784", "0.5900764", "0.5900667", "0.5892051", "0.57719076", "0.5698098", "0.56888527", "0.5679066", "0.5602712", "0.55790323", "0.55473787", "0.55005234", "0.5484408", "0.544164", "0.542363"...
0.8470204
0
Test the failure of the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_single_residue_info().
def test_return_single_residue_info_fail(self): # Ask for a few residues. self.assertRaises(RelaxError, mol_res_spin.return_single_residue_info, '1,2') self.assertRaises(RelaxError, mol_res_spin.return_single_residue_info, '1,Glu,Pro') self.assertRaises(RelaxError, mol_res_spin.return_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_single_residue_info(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_single_residue_info('1')\n res2 = mol_res_spin.return_single_residue_info('2,Glu')\n res4 = mol_res_spin.return_single_residue_info('Pro,4')\n res5 = mol_res_spin.return_single_r...
[ "0.79661804", "0.7835014", "0.69599706", "0.63726276", "0.6243398", "0.61490476", "0.60890734", "0.6079709", "0.5994329", "0.59389675", "0.5879574", "0.5872051", "0.57941824", "0.5751928", "0.57405704", "0.5738197", "0.5649554", "0.5574121", "0.5553376", "0.55352575", "0.5525...
0.7993023
0
Test the function for returning the desired spin data container. The function tested is pipe_control.mol_res_spin.return_spin().
def test_return_spin(self): # Ask for a few spins. spin1 = mol_res_spin.return_spin('#Ap4Aase:1') spin2 = mol_res_spin.return_spin(spin_id='#Ap4Aase:2') spin3 = mol_res_spin.return_spin(spin_id='#Ap4Aase:4', pipe='orig') spin4 = mol_res_spin.return_spin(spin_id='#RNA:-5@N5', pip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_spin_pipe_fail(self):\n\n # Try to get a spin from a missing data pipe.\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_spin, spin_id=':2', pipe='new')", "def test_return_molecule(self):\n\n # Ask for a few molecules.\n mol1 = mol_res_spin.return_molecule('#A...
[ "0.6254745", "0.62498236", "0.62125456", "0.6161361", "0.6015934", "0.597637", "0.58106077", "0.57989025", "0.57807255", "0.5775557", "0.57453865", "0.5677636", "0.56534547", "0.5535556", "0.55239886", "0.53587866", "0.5336745", "0.5311502", "0.52942914", "0.5217297", "0.5215...
0.8249369
0
Test the failure of the function for returning the desired spin data container. The function tested is pipe_control.mol_res_spin.return_spin().
def test_return_spin_pipe_fail(self): # Try to get a spin from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_spin, spin_id=':2', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_spin(self):\n\n # Ask for a few spins.\n spin1 = mol_res_spin.return_spin('#Ap4Aase:1')\n spin2 = mol_res_spin.return_spin(spin_id='#Ap4Aase:2')\n spin3 = mol_res_spin.return_spin(spin_id='#Ap4Aase:4', pipe='orig')\n spin4 = mol_res_spin.return_spin(spin_id='#RNA:...
[ "0.78494513", "0.66188395", "0.6351322", "0.63377", "0.63215846", "0.62711096", "0.6125446", "0.6110812", "0.59731114", "0.5921803", "0.589555", "0.5886584", "0.572914", "0.5577149", "0.5547649", "0.550307", "0.5490488", "0.5437511", "0.5385294", "0.5323193", "0.52905536", ...
0.7464118
1
Test the proper operation of the spin loop with spin selection. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop(self): # Spin data. select = [1, 0] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop('@N5'): # Test the selection. self.assertEqual(spin.select, select[i]) # Test the spin names. self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_selection(self):\n\n # Spin data.\n select = [0, 1, 0, 0, 1, 1, 0, 1]\n name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5', '2H']\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop():\n # Test the selection.\n ...
[ "0.76839185", "0.7019713", "0.68919516", "0.68854254", "0.65529144", "0.6440893", "0.6163988", "0.59719443", "0.5952859", "0.59403336", "0.5869492", "0.5838458", "0.5775429", "0.5759338", "0.569917", "0.56271356", "0.5577104", "0.55301183", "0.549381", "0.54663414", "0.538889...
0.8171222
0
Test the proper operation of the spin loop when no data is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop(): i = i + 1 # Test loop length. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_pipe(self):\n\n # Reset relax.\n reset()\n\n # Function for the problem of catching an error in a generator function.\n def fail_test():\n for spin in mol_res_spin.spin_loop():\n pass\n\n # Test for the no pipe error.\n self....
[ "0.7811089", "0.7292637", "0.7291406", "0.7091763", "0.6846889", "0.6789092", "0.6699432", "0.66825855", "0.66130304", "0.63301605", "0.61651087", "0.6073626", "0.5983543", "0.5924072", "0.5917373", "0.591516", "0.58277524", "0.5808656", "0.5755179", "0.5706209", "0.56306875"...
0.87055194
0
Test the proper operation of the spin loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for spin in mol_res_spin.spin_loop(): pass # Test for the no pipe error. self.assertRaises(Rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop():\n i = i + 1\n\n # Test loo...
[ "0.8414788", "0.7601054", "0.7113457", "0.7043407", "0.7001332", "0.673422", "0.66587317", "0.653782", "0.64508295", "0.6446371", "0.62323546", "0.5766039", "0.5760466", "0.57546294", "0.5717464", "0.5711903", "0.57100135", "0.5633577", "0.5567761", "0.55639905", "0.55532223"...
0.83668333
1
Test the proper operation of the spin loop when no selection is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_selection(self): # Spin data. select = [0, 1, 0, 0, 1, 1, 0, 1] name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5', '2H'] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop(): # Test the selection. self.assertEqua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop(self):\n\n # Spin data.\n select = [1, 0]\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop('@N5'):\n # Test the selection.\n self.assertEqual(spin.select, select[i])\n\n # Test the spin names.\n ...
[ "0.75004387", "0.7467984", "0.7230426", "0.6575248", "0.64682966", "0.6366928", "0.629157", "0.61815935", "0.59252053", "0.59217304", "0.59209067", "0.5756598", "0.569629", "0.5623459", "0.55442035", "0.5533466", "0.5505412", "0.5480573", "0.547112", "0.5420042", "0.53915197"...
0.8127604
0
Test the proper operation of the spin loop with wildcard spin selection ''. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_wildcard(self): # Spin data. select = [0, 1, 1, 0] name = ['NH', 'NH', 'N5', 'N5'] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop('@N*'): # Test the selection. self.assertEqual(spin.select, select[i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop(self):\n\n # Spin data.\n select = [1, 0]\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop('@N5'):\n # Test the selection.\n self.assertEqual(spin.select, select[i])\n\n # Test the spin names.\n ...
[ "0.76207334", "0.74092525", "0.6786517", "0.67461604", "0.6667878", "0.6086697", "0.6002766", "0.5998333", "0.5985406", "0.58735466", "0.58593804", "0.5647808", "0.5585266", "0.5514325", "0.550792", "0.54545707", "0.543505", "0.54324937", "0.5399342", "0.5395513", "0.53469473...
0.8172461
0
Test boolean and in molresspin selections.
def test_boolean_and_selection(self): # The selection loop: sel = list(mol_res_spin.residue_loop("#Ap4Aase:4 & :Pro")) # Test: self.assertEqual(len(sel), 1) for res in sel: self.assert_(res.name == "Pro" and res.num == 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_complex_selection(self):\n\n # The residue selection loop.\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro | #RNA\"))\n\n # Residue names and numbers.\n names = ['Pro', None, None]\n numbers = [4, -5, -4]\n\n # The residues.\n self.assert...
[ "0.70032185", "0.6886894", "0.6886894", "0.62776476", "0.62746215", "0.62711465", "0.61798936", "0.6083441", "0.5987472", "0.59555334", "0.59517634", "0.5910961", "0.585857", "0.58579606", "0.5849827", "0.58383787", "0.58287346", "0.5822584", "0.5805983", "0.57605493", "0.575...
0.7390658
0
Test complex boolean molresspin selections.
def test_boolean_complex_selection(self): # The residue selection loop. sel = list(mol_res_spin.residue_loop("#Ap4Aase:4 & :Pro | #RNA")) # Residue names and numbers. names = ['Pro', None, None] numbers = [4, -5, -4] # The residues. self.assertEqual(len(sel), 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_and_selection(self):\n\n # The selection loop:\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro\"))\n\n # Test:\n self.assertEqual(len(sel), 1)\n for res in sel:\n self.assert_(res.name == \"Pro\" and res.num == 4)", "def boolean_func(exper...
[ "0.66458935", "0.64277714", "0.62511396", "0.6227797", "0.61286384", "0.5731911", "0.5731911", "0.5623282", "0.5538769", "0.5524149", "0.54843676", "0.5470526", "0.54597956", "0.53990823", "0.53824186", "0.5378115", "0.53747463", "0.5374542", "0.5369208", "0.5353589", "0.5331...
0.77207905
0
Test complex boolean molresspin selections with parenthesis.
def fixme_test_boolean_parenthesis_selection(self): # The selection loop: sel = list(mol_res_spin.residue_loop("(#Ap4Aase & :Pro) | (#RNA & :-4)")) # Test: self.assertEqual(len(sel), 2) for res in sel: self.assert_(res.num in [-4, 4])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_complex_selection(self):\n\n # The residue selection loop.\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro | #RNA\"))\n\n # Residue names and numbers.\n names = ['Pro', None, None]\n numbers = [4, -5, -4]\n\n # The residues.\n self.assert...
[ "0.72196627", "0.622446", "0.617506", "0.6151499", "0.6054697", "0.5972477", "0.595188", "0.59008986", "0.5731449", "0.571927", "0.56771934", "0.5491429", "0.54325634", "0.5403343", "0.537575", "0.5369136", "0.53508174", "0.5343714", "0.53357446", "0.53322315", "0.53228456", ...
0.65406233
1
Return the list of accessibility services
def get_accessibility_services(self): result = [] services = self.find_tags("service") for s in services: for action in s.findall("./intent-filter/action"): if "android.accessibilityservice.AccessibilityService" in action.attrib.values(): result.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_services(self) -> list[str]:\r\n return self.services", "def get_services(self):\r\n return get_service_list()", "def list_services(ctx):\n pass", "def getServices(self):\n pass", "def services(self):\n return self.agent.http.get(\n lambda x: ...
[ "0.68534184", "0.6790268", "0.67288893", "0.6717567", "0.6657605", "0.6592076", "0.6433918", "0.6382641", "0.6368458", "0.633186", "0.6297952", "0.628866", "0.627553", "0.62480915", "0.6243383", "0.62318575", "0.61614", "0.61078346", "0.6070793", "0.60232335", "0.5990591", ...
0.8399575
0
Return region field as a representation.
def to_representation(self, instance): return instance.region
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n # type: () -> string_types\n return self._region", "def region(self) -> str:\n return self.__region", "def __repr__(self: RcnRegion) -> str:\n return f\"RcnRegion.{self.name}\"", "def region(self):\n return self._region", "def region(self):\n re...
[ "0.6821899", "0.6763117", "0.67216176", "0.6716908", "0.6716908", "0.6671237", "0.6656148", "0.6619242", "0.6594691", "0.65667427", "0.6521952", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.6379895", "0.63188833", "0.63188833", "0.631...
0.7870258
0
Save new CourierRegion instances to the database.
def save_regions(validated_data): for region in validated_data['regions']: new_region = CourierRegionsSerializer(data={ 'courier_id': validated_data['courier_id'], 'region': region }) if not new_region.is_valid(): raise Validat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data):\n\n region = CourierRegions.objects.create(\n courier_id=Courier.objects.get(courier_id=validated_data['courier_id']),\n region=validated_data['region']\n )\n return region", "def save(self, f):\n self.f = f\n for region i...
[ "0.64264625", "0.5719807", "0.56590676", "0.54390705", "0.54215187", "0.5370093", "0.53380907", "0.53348017", "0.530663", "0.52896005", "0.52896005", "0.5281476", "0.52535737", "0.52535737", "0.52535737", "0.52535737", "0.52434415", "0.5241482", "0.5241482", "0.5241482", "0.5...
0.7319758
0
Save new WorkingHours instances to the database.
def save_hours(validated_data): for w_h in validated_data['working_hours']: new_w_h = WorkingHoursSerializer(data={ 'courier_id': validated_data['courier_id'], 'working_hours': w_h }) if not new_w_h.is_valid(): raise Validation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_hours(validated_data):\n\n for d_h in validated_data['delivery_hours']:\n new_d_h = DeliveryHoursSerializer(data={\n 'order_id': validated_data['order_id'],\n 'delivery_hours': d_h\n })\n if not new_d_h.is_valid():\n rais...
[ "0.6595605", "0.6511643", "0.6050262", "0.6011547", "0.580755", "0.580755", "0.580755", "0.580755", "0.57043535", "0.5699419", "0.56891483", "0.56619227", "0.5596039", "0.5595059", "0.5548948", "0.55391455", "0.55391455", "0.55391455", "0.55391455", "0.55391455", "0.55391455"...
0.7561775
0
Raises ValidationError if the given list of regions is empty, the list otherwise.
def validate_regions(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_regions(validated_data):\n\n for region in validated_data['regions']:\n new_region = CourierRegionsSerializer(data={\n 'courier_id': validated_data['courier_id'],\n 'region': region\n })\n if not new_region.is_valid():\n ...
[ "0.58792216", "0.58624536", "0.58315694", "0.58029544", "0.5629878", "0.560681", "0.53393847", "0.5311191", "0.5308086", "0.5301234", "0.52908784", "0.5228517", "0.5227655", "0.5113418", "0.510784", "0.50779873", "0.5052461", "0.5052382", "0.5038692", "0.50158596", "0.5013641...
0.81604916
0
Raises ValidationError if the given list of working hours is empty, the list otherwise.
def validate_working_hours(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_delivery_hours(self, value):\n\n if len(value) == 0:\n raise ValidationError('List should not be empty.')\n return value", "def save_hours(validated_data):\n\n for w_h in validated_data['working_hours']:\n new_w_h = WorkingHoursSerializer(data={\n ...
[ "0.7269126", "0.6866808", "0.6861681", "0.67966706", "0.6211005", "0.6202418", "0.59814394", "0.58779675", "0.5871235", "0.57033545", "0.5618451", "0.55920196", "0.5522947", "0.5502552", "0.5354208", "0.5335648", "0.52977383", "0.525785", "0.5205049", "0.52016556", "0.5159868...
0.8444958
0
Save new instances of DeliveryHours to the database.
def save_hours(validated_data): for d_h in validated_data['delivery_hours']: new_d_h = DeliveryHoursSerializer(data={ 'order_id': validated_data['order_id'], 'delivery_hours': d_h }) if not new_d_h.is_valid(): raise ValidationE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data):\n\n d_h = DeliveryHours.objects.create(\n order_id=Order.objects.get(order_id=validated_data['order_id']),\n delivery_start=validated_data['delivery_hours'][:5],\n delivery_end=validated_data['delivery_hours'][6:]\n )\n return ...
[ "0.6799848", "0.65913475", "0.57204527", "0.5639961", "0.56362647", "0.5613045", "0.5545568", "0.54776233", "0.5454978", "0.5431331", "0.5412394", "0.5412394", "0.5412394", "0.5412394", "0.53458804", "0.5314343", "0.5288774", "0.5245218", "0.52222604", "0.5202509", "0.5193683...
0.7650199
0
Raises ValidationError if the given list of delivery hours is empty, the list otherwise.
def validate_delivery_hours(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_working_hours(self, value):\n\n if len(value) == 0:\n raise ValidationError('List should not be empty.')\n return value", "def save_hours(validated_data):\n\n for d_h in validated_data['delivery_hours']:\n new_d_h = DeliveryHoursSerializer(data={\n ...
[ "0.70854056", "0.6905043", "0.6794095", "0.66818875", "0.631159", "0.58860403", "0.58774155", "0.56794053", "0.5401232", "0.53009903", "0.52992254", "0.5283572", "0.52385384", "0.52176595", "0.51481444", "0.5120775", "0.5075307", "0.506215", "0.505264", "0.5031269", "0.501651...
0.83690053
0
Raises ValidationError if order with given id does not exist, is not assigned to any courier or is already completed.
def validate_order_id(self, value): if not Order.objects.filter(order_id=value).exists(): raise ValidationError(f'Order with id {value} does not exist.') order_obj = Order.objects.get(order_id=value) if order_obj.assign_time is None: raise ValidationError(f'Order with id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, attrs):\n\n errors = {}\n order_obj = Order.objects.get(order_id=attrs['order_id'])\n if order_obj.courier_id.courier_id != attrs['courier_id'].courier_id:\n errors['order_id'] = f'Order with id {order_obj.order_id} is assigned to another courier.'\n unknow...
[ "0.6367057", "0.61440265", "0.60556054", "0.5945867", "0.58446044", "0.57476765", "0.57366914", "0.5560988", "0.54352444", "0.5427547", "0.54036677", "0.53682196", "0.53528076", "0.5352244", "0.53520465", "0.53500265", "0.5327493", "0.53269213", "0.53213036", "0.53162146", "0...
0.8479572
0
Raises ValidationError of the order with the given id is assigned to another courier, specified complete_time is greater than order's assign_time or there are unexpected fields in the request body.
def validate(self, attrs): errors = {} order_obj = Order.objects.get(order_id=attrs['order_id']) if order_obj.courier_id.courier_id != attrs['courier_id'].courier_id: errors['order_id'] = f'Order with id {order_obj.order_id} is assigned to another courier.' unknown = set(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_order_id(self, value):\n\n if not Order.objects.filter(order_id=value).exists():\n raise ValidationError(f'Order with id {value} does not exist.')\n order_obj = Order.objects.get(order_id=value)\n if order_obj.assign_time is None:\n raise ValidationError(f'Or...
[ "0.7156292", "0.63136715", "0.5466236", "0.53860146", "0.52171755", "0.5214629", "0.5198121", "0.5026115", "0.5020451", "0.49440423", "0.49169457", "0.48243418", "0.4787714", "0.47877014", "0.47723362", "0.4748931", "0.4731741", "0.46965528", "0.46746913", "0.4651812", "0.464...
0.69398975
1
Randomly sample `n` memories
def sample(self, n): idx = np.random.randint(0, len(self.memory), size=n) return [self.memory[i] for i in idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(n, seed= 0):\n data = list(range(n))\n while True:\n np.random.seed(seed)\n np.random.shuffle(data)\n yield from data", "def sample(self, n):\n raise NotImplementedError", "def sample_batch(memory, n):\n batch = rnd.sample(memory, n) # List containing tuples\n ...
[ "0.75761276", "0.7508017", "0.74692214", "0.7464645", "0.74448174", "0.7441827", "0.73945725", "0.734842", "0.71837", "0.7161568", "0.71080214", "0.7107572", "0.7095622", "0.7086794", "0.7068867", "0.70568603", "0.70141", "0.7003059", "0.69959825", "0.69918495", "0.69673544",...
0.8171086
0
Saves a priority weight and a memory, x.
def encode(self, weight, x): # Sanity weight = float(weight) if np.isclose(weight, 0.0): raise ValueError("w must be > 0") # Pad out if len(self.memory) < self.capacity: self.memory.append(None) self.priority.append(None) # Remember ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_weights(self, the_path):\n torch.save(self.model.state_dict(), the_path)", "def save(self, weight_path, vocab_path, output_path, binary=False):\n w2v_save_model(weight_path.encode(\"ascii\"),\n vocab_path.encode(\"ascii\"), \n output_path.encode(...
[ "0.55070525", "0.5479773", "0.54729784", "0.54729784", "0.539775", "0.53781176", "0.53729707", "0.5255315", "0.5204153", "0.51955986", "0.51532245", "0.5136106", "0.51347286", "0.5108663", "0.5106836", "0.5048806", "0.5046801", "0.50428057", "0.50421166", "0.5030649", "0.5026...
0.68081224
0
When we XOR elements, the ideal case to maximize the result is to have the XOR operands to have different bits for each position. An operation can remove a bit but cannot add one, so the goal is to remove all bits shared between array elements. Therefore, the solution is to perform OR on all elements.
def max_xor(A): return reduce(lambda x, y: x | y, A)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(self):\n\n \"\"\" fisrt i pick element we need to xor each other and put theme in list\"\"\"\n bits_to_xor = []\n for i in self.xor_input:\n bits_to_xor.append(self.state[i])\n\n \"\"\" next xor the list elemet usin reduce with lambda func.\"\"\"\n...
[ "0.7474404", "0.7227875", "0.71612287", "0.71068895", "0.71062714", "0.6935171", "0.69207716", "0.6826871", "0.66807395", "0.6589879", "0.6547784", "0.6523073", "0.64804363", "0.64760613", "0.6439925", "0.64305127", "0.6383687", "0.6372895", "0.6336047", "0.63346505", "0.6327...
0.72547776
1
A function to find the maximum of the acquisition function It uses a combination of random sampling (cheap) and the 'LBFGSB' optimization method. First by sampling ``num_warmup`` points at random, and then running LBFGSB from ``num_starting_points`` random starting points.
def acq_max(f_acq, gp, y_max, bounds, space, num_warmup, num_starting_points): # Warm up with random points x_tries = [space.random_sample() for _ in range(int(num_warmup))] ys = f_acq(x_tries, gp=gp, y_max=y_max) x_max = x_tries[ys.argmax()] max_acq = ys.max() # Explore the pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250):\n\n # Warm up with random points\n x_tries = random_state.uniform(bounds[:, 0], bounds[:, 1],\n size=(n_warmup, bounds.shape[0]))\n ys = ac(x_tries, gp=gp, y_max=y_max)\n x_max = x_tries[ys....
[ "0.62064785", "0.58723736", "0.58493215", "0.5803944", "0.5755144", "0.56878924", "0.5686157", "0.56028587", "0.55518836", "0.5547421", "0.553826", "0.5501719", "0.5482462", "0.54465926", "0.5444505", "0.54270524", "0.5395608", "0.5392558", "0.5367147", "0.53619885", "0.53508...
0.6244207
0
Set the defaults for the given agents.
def set_defaults(self, agents): for a in agents: for k, v in a.get_defaults().items(): self.env[k] = v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_agents(self, agents):\n if self.single_agent_mode:\n raise ValueError(\n \"Setting agent in single agent mode or human mode is not allowed.\"\n )\n\n self.agents = agents\n # If at least one agent needs raw data, we set self.allow_raw_data = True\n ...
[ "0.7123729", "0.6784273", "0.67001903", "0.6271799", "0.61820745", "0.6158705", "0.6158705", "0.6158705", "0.59732956", "0.59680927", "0.59333277", "0.58075494", "0.5709466", "0.56820816", "0.5672702", "0.567123", "0.56681", "0.564538", "0.5598141", "0.55943185", "0.5541246",...
0.8821057
0
Create a deep copy of the game.
def copy(self): new_game = Game(self.name, *self.agents, independent_update=self.independent_update, default_run_kwargs=self.default_run_kwargs, _set_defaults=False) new_game.i = self.i new_game.env = self.env_copy() new_game.env["game"] = new_game return new_game
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n # create a new game and adjust it\n game_copy = Game()\n game_copy.turn_number = self.turn_number\n # copy player characters\n game_copy.player1 = Class.copy_monster(self.player1)\n game_copy.player2 = Class.copy_monster(self.player2)\n # reference...
[ "0.79710436", "0.76304597", "0.7624862", "0.7530829", "0.735413", "0.7306646", "0.7019784", "0.6898342", "0.6871119", "0.67451036", "0.6714296", "0.6711205", "0.6701819", "0.6690582", "0.6682592", "0.66806793", "0.6680429", "0.66452944", "0.66334337", "0.66334337", "0.6633433...
0.86879694
0
Create a deep copy with new agents.
def copy_with_agents(self, *agents, **named_agents): return self.copy().add_agents(*agents, **named_agents)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_game = Game(self.name, *self.agents, independent_update=self.independent_update, default_run_kwargs=self.default_run_kwargs, _set_defaults=False)\n new_game.i = self.i\n new_game.env = self.env_copy()\n new_game.env[\"game\"] = new_game\n return new_game", ...
[ "0.64163107", "0.6415633", "0.6331236", "0.630281", "0.6287885", "0.6160814", "0.61473835", "0.6124182", "0.6101197", "0.6057805", "0.60413456", "0.602687", "0.5934685", "0.59219915", "0.5908063", "0.588306", "0.5876571", "0.5862516", "0.5856848", "0.58544517", "0.5850434", ...
0.67792404
0
Equivalent to .copy().reset(args, kwargs).
def clone(self, *args, **kwargs): return self.copy().reset(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(*args):", "def reset(*args):", "def reset(*args):", "def reset(self, *args, **kwargs):", "def reset(self, *args):\n raise NotImplementedError", "def reset(self, *args, **kwargs):\n ...", "def reset(self, **kwargs):\n for k, v in kwargs.items():\n setattr(self, ...
[ "0.7387241", "0.7387241", "0.7387241", "0.70620394", "0.68944395", "0.6861086", "0.67391557", "0.6706456", "0.6441948", "0.6430577", "0.6393383", "0.63583297", "0.63236713", "0.63117933", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504...
0.7875659
0
Add an agent to be called at interval _period_.
def attach(self, agent, period, name=None): if isinstance(agent, Agent): agent = agent.clone(name=name, period=period) else: agent = Agent(name, agent, period=period) self.agents.append(agent) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newperiod(self, period):\n logger.debug(u\"{} New Period\".format(self.joueur))\n self.currentperiod = RepetitionsEXPERIENCE_NOM_COURT(period)\n self.le2mserv.gestionnaire_base.ajouter(self.currentperiod)\n self.repetitions.append(self.currentperiod)\n yield (self.remote.call...
[ "0.63139504", "0.5614659", "0.5556661", "0.54355025", "0.5423074", "0.5197547", "0.51729447", "0.5061283", "0.5061283", "0.5060387", "0.504039", "0.50223863", "0.5007248", "0.498901", "0.49737817", "0.4944588", "0.49106753", "0.48939013", "0.48071665", "0.47930655", "0.478684...
0.64388436
0
Gather final parameters, running every agent again if _ensure_all_agents_run_.
def finalize(self, ensure_all_agents_run=True): self.final_step = True try: if ensure_all_agents_run: for _ in range(self.max_period): self.step() return self.env_copy() finally: self.final_step = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_all_agent(self):\n for a in self.agents:\n soft_update(a.target_actor, a.actor, self.tau)\n soft_update(a.target_critic, a.critic, self.tau)\n self.num_iteration += 1", "def _apply_params(self):\n config = self.get_startup_config()\n # Pass true to _se...
[ "0.63572925", "0.58247304", "0.5736279", "0.5681283", "0.5670931", "0.5564711", "0.55375224", "0.5520162", "0.54561305", "0.53911257", "0.53798974", "0.5360203", "0.53507215", "0.5349996", "0.53491586", "0.53387153", "0.533229", "0.5301695", "0.5299479", "0.5296466", "0.52879...
0.66002065
0
Plot _xs_ vs. _ys_ on the given axis with automatic or custom label names and _kwargs_ passed to plot. One of _xs_ or _ys_ may be None to replace with a sequence and must otherwise be a variable name, list, or function of the env.
def plot(self, ax, xs, ys, xlabel=None, ylabel=None, label=None, alpha=0.6, **kwargs): if xs is None and ys is None: raise ValueError("both of xs and ys cannot be None") if isinstance(xs, Str): xs_list = self.env[xs] elif callable(xs): xs_list = xs(self.env) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(x, y, ns, **kwargs):\n if isinstance(x, str):\n x = [x]\n if isinstance(y, str):\n y = [y]\n \n def data_lookup(arr):\n arr_data = []\n arr_label = []\n for a_ in arr:\n if isinstance(a_, str):\n arr_label.append(a_)\n ...
[ "0.67550695", "0.6138962", "0.6067398", "0.6053372", "0.59938", "0.59759384", "0.597428", "0.5972828", "0.5935644", "0.5918692", "0.5905465", "0.5859092", "0.5807438", "0.5805799", "0.5759312", "0.5742589", "0.57250696", "0.57136345", "0.5699154", "0.56960934", "0.56851363", ...
0.7535068
0
Obtains a ready to use style_transfer model file.
def get_pretrained_model(destination): url = "https://storage.googleapis.com/download.magenta.tensorflow.org/models/ \ arbitrary_style_transfer.tar.gz" os.system("curl -o arbitrary_style_transfer.tar.gz {0}".format(url)) with tarfile.open("arbitrary_style_transfer.tar.gz") as tar: if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_style():\n\n style = os.path.join(os.path.dirname(__file__), \"templates\", \"style.css\")\n with open(style, \"r\") as opencss:\n return opencss.read().strip()", "def get_model_and_assets():\n\n return common.read_model('cloth_corner.xml'),common.ASSETS", "def _get_model():\n with ope...
[ "0.5762988", "0.56735617", "0.5595069", "0.55804044", "0.5348759", "0.5340475", "0.5333773", "0.5213094", "0.52033925", "0.5180057", "0.51697576", "0.51513886", "0.5150505", "0.5148918", "0.5148204", "0.5123702", "0.510021", "0.50826496", "0.5067555", "0.50636643", "0.5043299...
0.6710467
0
Initialize with a lightfield in np.uint8 format. Optionally pass width and height of the canvas and sensitivity to the mouse.
def __init__(self, lf, width= None, height= None, sensitivity=2): super().__init__(size=(width, height)) # Adjustable dimensions of the canvas and mouse sensitivity self.width = width or lf.shape[-2] self.height = height or lf.shape[-3] self.dim = lf.ndim self.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, width, height):\n self.width = width\n self.height = height\n self.pixels = []\n self.r = 255\n self.g = 0\n self.b = 0\n self.pointSize = 30\n self.vr = 255\n self.vg = 200\n self.vb = 200\n self.glclear()", "def __i...
[ "0.57412136", "0.5677878", "0.5673382", "0.5629524", "0.55770236", "0.54769325", "0.54700756", "0.5453247", "0.5440439", "0.5382337", "0.53306824", "0.5293759", "0.5290555", "0.52754855", "0.5219319", "0.5217659", "0.52054334", "0.5137539", "0.51299554", "0.51256675", "0.5121...
0.72030973
0
Applies cv2.resize to each image of the lightfield (6dim)
def resize_lightfield(raw_lightfield, desired_size): # -> lightfield if raw_lightfield.ndim == 6: n_depth, n_cols, n_rows, *_ = raw_lightfield.shape output_lightfield = np.empty([n_depth, n_cols, n_rows] + list(desired_size)[::-1] + [3], dtype=np.uint8) for k, depth in enumerate(raw_lightf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(fl):\n #print(\"processing of images\")\n print(fl)\n img = cv2.imread(fl, cv2.IMREAD_COLOR)\n resized_img = cv2.resize(img, (146, 243), interpolation=cv2.INTER_CUBIC)\n return resized_img", "def resizeImages(img_path,size=(50,50)):\n image = cv2.imread(img_path)\n resized ...
[ "0.6966502", "0.6862376", "0.6512721", "0.6415095", "0.6333766", "0.62988776", "0.6276172", "0.627098", "0.62702346", "0.62640584", "0.62184846", "0.6149587", "0.6065171", "0.6062927", "0.6053445", "0.6053445", "0.60356414", "0.6007041", "0.59975797", "0.5984891", "0.59809804...
0.7499734
0
Convenience function for converting unpickled mission into mission instances.
def reload_missions(unpickledMissions): for missionId, params in unpickledMissions.items(): # A true file format would be nice if missionId == 'pendingMissions': self.pendingMissions = params continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(cls, serd):\r\n return cls(*serd)", "def from_serializable(self, _):\n\n assert False, \"Not implemented\"", "def from_serializable(self, _):\n\n assert False, \"not implemented\"", "def _deserialize(cls, *args):\n return cls(*args)", "def loads(cls, data: str) -...
[ "0.53312004", "0.53231305", "0.5300342", "0.5205318", "0.516451", "0.51606286", "0.51114714", "0.5066639", "0.5066639", "0.5059862", "0.50490946", "0.50444037", "0.50308233", "0.50265086", "0.5026082", "0.50245154", "0.50166994", "0.50164783", "0.5004725", "0.49910545", "0.49...
0.66441584
0
Return current mission of the UAV (First in the MISSION_STATUS list)
def current_mission(self): try: return self.missions[self.status.mission_task_list[0]] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mission(self) -> Optional[Mission]:\n # XXX: This currently can be `None`\n return self._mission", "def _select_mission(self):\n if wait_until(self.emulator.is_ui_element_on_screen, ui_element=self.mission_selector_ui):\n logger.debug(f\"Selecting Epic Quest's mission: {self.m...
[ "0.6453036", "0.5754468", "0.566482", "0.5642156", "0.5633182", "0.55878025", "0.55187774", "0.54879326", "0.5467559", "0.5432458", "0.5419924", "0.5392557", "0.5386191", "0.5379635", "0.53663546", "0.53264517", "0.53114265", "0.5309297", "0.5300201", "0.52791274", "0.5263213...
0.7763624
0
Removes a mission from self.pendingMissions without sending it to the aircraft.
def reject_mission(self, missionId): print('Rejecting mission', missionId, 'for aircraft', self.id); self.pendingMissions.remove(missionId) if self.outputBackupFile is not None: with open(self.outputBackupFile, "ab") as f: pickle.dump({'pendingMissions' : self.pending...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, pool_name, *missions):\n\t\tpool = getattr(self, pool_name)\n\n\t\t# check mission state\n\t\tmissions = [m for m in missions if m.state not in (\"ANALYZING\", \"DOWNLOADING\")]\n\n\t\tfor mission in missions:\n\t\t\tdel pool[mission.url]\n\n\t\tself.cleanup()\n\t\tself.bubble(\"MISSION_LIST_REARR...
[ "0.6742761", "0.6493032", "0.62579316", "0.6030683", "0.59712803", "0.5816333", "0.57373405", "0.56957203", "0.55815095", "0.5552496", "0.5463226", "0.54363286", "0.5421029", "0.5399139", "0.5335216", "0.5306899", "0.52801126", "0.5279806", "0.5276704", "0.5248654", "0.523948...
0.71302354
0
Execute last mission in self.pendingMission To be removed when a real management is implemented
def execute_mission(self): self.pendingMissions = [] messageInterface.send(self.currentMission.build_message())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_mission(self):\n cmds = self.vehicle.commands\n self.vehicle.commands.clear()\n self.vehicle.flush()\n\n # After clearing the mission, we MUST re-download the mission from the \n # vehicle before vehicle.commands can be used again.\n # See https://github.com/dron...
[ "0.59472746", "0.5922551", "0.58533317", "0.5841672", "0.57032734", "0.567079", "0.5670382", "0.5663894", "0.5635181", "0.5568485", "0.5553974", "0.5549903", "0.55493927", "0.55345213", "0.55327535", "0.55241054", "0.55047387", "0.5479589", "0.5467998", "0.5403099", "0.53952"...
0.8171932
0
visualisation of the input image interest points
def viz1(img, interest_points, color='r'): x = [a[1] for a in interest_points] #blob detection x axis y = [a[0] for a in interest_points] #blob detection y axis s = [a[2] for a in interest_points] #blob detected at sigma plt.imshow(img, cmap='gray') #adding the input image to plot for x, y, s in zip(x, y, s)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_image_sequence(self):\r\n\r\n imv = pg.ImageView()\r\n\r\n imv.show()\r\n\r\n imv.setImage(self.imageData)\r\n\r\n self.layout.addWidget(imv, 0, 0)\r\n\r\n\r\n\r\n avgImage = np.mean(self.imageData, axis=0)\r\n\r\n ima = pg.ImageView()\r\n\r\n ima.setImage(...
[ "0.640478", "0.63847405", "0.63375556", "0.6287032", "0.62815773", "0.62655914", "0.62209034", "0.6200891", "0.6193365", "0.61490846", "0.6137267", "0.6074347", "0.60507184", "0.6024846", "0.6012585", "0.6002759", "0.59989774", "0.5996514", "0.5971851", "0.59677815", "0.59248...
0.7920742
0
sum of squared differences between values in patch1, patch2
def count_difference(patch1, patch2): return np.sum(np.square(patch1 - patch2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_squared_errors(P1,P2):\r\n return sum(euclidean_distance_3(p1,p2) for (p1,p2) in zip(P1,P2))", "def sum_of_squared_errors(P1,P2):\r\n return sum(euclidean_distance_2(p1,p2) for (p1,p2) in zip(P1,P2))", "def lsumdiffsquared(x,y):\r\n sds = 0\r\n for i in range(len(x)):\r\n sds = sd...
[ "0.64779776", "0.64131725", "0.64053327", "0.6281641", "0.6239101", "0.6176397", "0.6149316", "0.6146877", "0.6091206", "0.6080922", "0.6026293", "0.60062623", "0.59793645", "0.59259605", "0.5902211", "0.5887385", "0.5883692", "0.58622724", "0.5851945", "0.58446634", "0.57766...
0.71716875
0
Returns an interface generator for |interface|. Called once for each interface that is not a callback function.
def InterfaceGenerator(self, interface, common_prefix, super_interface_name, source_filter): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface(self):\n\n data = ['[Interface]']\n for item in INTERFACE_KEYS:\n value = getattr(self, item, None)\n if value:\n data.append(value)\n\n return '''\n'''.join(data)", "def from_interface(cls,interface,*args,**kargs):\n conf = Configura...
[ "0.5531334", "0.5525865", "0.5515438", "0.5429782", "0.53885365", "0.528917", "0.5258199", "0.5203507", "0.51787335", "0.5171712", "0.5062256", "0.50554425", "0.5033998", "0.50218827", "0.50152045", "0.49968714", "0.49968714", "0.49968714", "0.49968714", "0.49968714", "0.4996...
0.75885934
1
Processes an interface that is a callback function.
def ProcessCallback(self, interface, info): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ProcessCallback(self, interface, info, file_path):\n self._dart_callback_file_paths.append(file_path)\n code = self._emitters.FileEmitter(file_path)\n\n code.Emit(self._templates.Load('callback.darttemplate'))\n code.Emit('typedef $TYPE $NAME($PARAMS);\\n',\n NAME=interface.id,\n ...
[ "0.7388945", "0.7388945", "0.6996998", "0.6519538", "0.64906186", "0.6338862", "0.63003725", "0.6191194", "0.6136016", "0.61295897", "0.60569656", "0.59520614", "0.5946387", "0.59059787", "0.5898366", "0.58923596", "0.58829063", "0.5862582", "0.57494104", "0.5743533", "0.5733...
0.8318254
1
Generates a lib file from a template and a list of files. Additional keyword arguments are passed to the template. Typically called from self.GenerateLibraries.
def _GenerateLibFile(self, lib_template, lib_file_path, file_paths, **template_args): # Load template. template = self._templates.Load(lib_template) # Generate the .lib file. lib_file_contents = self._emitters.FileEmitter(lib_file_path) # Emit the list of #source directives. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(\n files: List[Path] = typer.Argument(default=None, dir_okay=False, exists=True),\n template: Optional[str] = typer.Option(\n None, '--template', help='Name of template file'\n ),\n logo: Optional[str] = typer.Option(None, '--logo', help='Name of logo file'),\n logo_width: Optional[s...
[ "0.62458265", "0.6209271", "0.576154", "0.5760894", "0.56814146", "0.56250805", "0.56250805", "0.5602158", "0.5560846", "0.55587965", "0.55550075", "0.54758096", "0.54517764", "0.5416102", "0.5375398", "0.53513515", "0.5331048", "0.5306458", "0.52994704", "0.52932733", "0.525...
0.7688387
1
Prints integers 1 through 100 sequentially in a ten by ten grid.
def ten_by_ten(): n=1 while n<=100: if n%10 == 0: print n else: print n, n +=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_grid():\n print_line()\n for line in range(2):\n for post in range(4):\n print_post()\n print_line()", "def main():\n num_label = 1\n print('Printing ten random integers...')\n for i in range(NUM_RANDOM):\n print(str(num_label) + '):' + ' ' + str(random.ra...
[ "0.6569543", "0.65679497", "0.65646607", "0.6375016", "0.6352492", "0.63101375", "0.63097316", "0.6271304", "0.62634146", "0.62566876", "0.6251355", "0.6243986", "0.61811495", "0.61799407", "0.6137668", "0.6136843", "0.6128697", "0.61076075", "0.6107073", "0.6088797", "0.6087...
0.7224331
0
Initiates potential matrixes. v has boundary values and initial guess of 9 everywhere else vNew is a copy of v vExact is the exact analytical solution, 10 everywhere
def initiateVMatrixes(): global v, vNew, vExact # Initialize the grid to 0 v = np.zeros((n+1, n+1)) # matrix of v, index are i: row, j:column # Set the boundary conditions for i in range(1,n): v[0,i] = 10 v[n,i] = 10 v[i,0] = 10 v[i,n] = 10 # Exact solution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate():\n global v, vNew, n, stepsToToleranceArray\n stepsToToleranceArray = []\n for n in nArray:\n print('Currently working with n = ', n)\n initiateVMatrixes()\n step = 0\n toleranceAcqurired = False\n while not toleranceAcqurired:\n step+=1\n ...
[ "0.6296358", "0.6104716", "0.59339637", "0.5927703", "0.5892736", "0.58395153", "0.58070314", "0.58070314", "0.5806339", "0.5777011", "0.5720289", "0.5665781", "0.55881447", "0.5543292", "0.55227625", "0.552212", "0.55061567", "0.5506091", "0.5480284", "0.5473143", "0.5467505...
0.81041306
0
One checkerrelax iteration. v[i,j] is set as the avarage of its neighbours.
def relax_checker(): checker = 2 global v, vNew, n for check in range(0,2): for x in range(1,n): for y in range(1,n): if (x*(n+1) + y) % 2 == check: v[x,y] = (v[x-1][y] + v[x+1][y] + v[x][y-1] + v[x][y+1])*0.25
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relaxVertex(self, v):\r\n for arc in self.graph.getAdj(v):\r\n neighbour = arc.getExtremityNode()\r\n if neighbour in self.closed_set:\r\n continue\r\n self.nb_relax_edges += 1\r\n new_dist = self.dists_so_far[v] + arc.getWeight()\r\n ...
[ "0.58130586", "0.5767384", "0.5755898", "0.56656975", "0.55695224", "0.5568701", "0.54769075", "0.5428179", "0.532105", "0.5316448", "0.5302247", "0.529143", "0.5271398", "0.5224567", "0.52211946", "0.52183616", "0.5149348", "0.5143607", "0.51420367", "0.512446", "0.5123433",...
0.64761513
0
Main calculation function that first initalizes with initiateVMatrixes() and then uses relax() until v is within tolerance. 1. Iterate for n = 5, 10 2. Iterate for the range of n in nArray
def calculate(): global v, vNew, n, stepsToToleranceArray stepsToToleranceArray = [] for n in nArray: print('Currently working with n = ', n) initiateVMatrixes() step = 0 toleranceAcqurired = False while not toleranceAcqurired: step+=1 relax_ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initiateVMatrixes():\n global v, vNew, vExact\n # Initialize the grid to 0\n v = np.zeros((n+1, n+1)) # matrix of v, index are i: row, j:column\n # Set the boundary conditions\n for i in range(1,n):\n v[0,i] = 10\n v[n,i] = 10\n v[i,0] = 10\n v[i,n] = 10\n #...
[ "0.72669476", "0.6188595", "0.617031", "0.6000074", "0.5868834", "0.58029294", "0.5790344", "0.57772875", "0.5773755", "0.5764524", "0.56795913", "0.5678016", "0.5666207", "0.56653416", "0.5660726", "0.5638518", "0.5625004", "0.5608089", "0.56063926", "0.56031847", "0.5598390...
0.84747493
0
Produce a sequence of IOTool commands to enable and disable given Spectra lamps. Keyword arguments must be lamp names, as specified in the scope configuration. The values specified must be True to enable that lamp, False to disable, or None to do nothing (unspecified lamps are also not altered).
def _iotool_lamp_commands(self, **lamps): commands = [] for lamp, enabled in lamps.items(): if enabled is None: continue pin = self._spconfig.IOTOOL_LAMP_PINS[lamp] if enabled: commands.append(self._iotool.commands.set_high(pin)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lamps(self, **lamp_parameters):\n self._set_state(lamp_parameters.items())", "def all_lamps_slow():\n HOUSE = pre_process.get_house()\n\n for id_num, lamp in HOUSE.lamps.items():\n lamp.turn_on()\n lamp.set_transition_time(500)\n lamp.set_brigthness(254)\n lamp.send_c...
[ "0.5408981", "0.5334635", "0.4870005", "0.48662877", "0.48420778", "0.48191276", "0.48072937", "0.47955528", "0.47886992", "0.4721579", "0.46996623", "0.46858644", "0.46583447", "0.46001318", "0.46000558", "0.45971966", "0.45952561", "0.45923606", "0.45860842", "0.4581945", "...
0.7597153
0
Set a number of lamp parameters at once using keyword arguments, e.g. spectra.lamps(red_enabled=True, red_intensity=255, blue_enabled=False) Intensity values must be in the range [0, 255]. Valid lamp names can be retrieved with get_lamp_specs().
def lamps(self, **lamp_parameters): self._set_state(lamp_parameters.items())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setParameters(self, lam=45, **ukwargs):\n\t\tEvolutionStrategy1p1.setParameters(self, **ukwargs)\n\t\tself.lam = lam\n\t\tif ukwargs: logger.info('Unused arguments: %s' % (ukwargs))", "def setLSLimits(*args):\n args[0].Limit.LSLimit.ls_limit = args[1]", "def setLCLimits(*args):\n args[0].Limit.LCLimi...
[ "0.6750617", "0.64525014", "0.60727084", "0.60697347", "0.5997909", "0.58803946", "0.57326317", "0.57204014", "0.56676894", "0.5609716", "0.56088686", "0.5593763", "0.5560277", "0.5505796", "0.5471875", "0.54498017", "0.5446686", "0.54387254", "0.543406", "0.5431726", "0.5406...
0.7872269
0
Return a property setter/getter pair, either from a "real" property get/set pair, or a "virtual" property like "red_enabled" or "cyan_intensity".
def _get_getter_setter(self, prop): if hasattr(self, 'set_'+prop): return getattr(self, 'get_'+prop), getattr(self, 'set_'+prop) else: lamp_name, lamp_prop = prop.rsplit('_', 1) if lamp_name not in self._available_lamps: raise ValueError('Invalid lamp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Property(name):\n\n attr_name = \"__\" + name\n\n def get(self):\n try:\n return self.__dict__[attr_name]\n except KeyError:\n raise AttributeError, name\n\n def set(self, value):\n if attr_name not in self.__dict__ \\\n or self.__dict__[attr_name] ...
[ "0.6777496", "0.6488281", "0.6468719", "0.6371053", "0.62944317", "0.62325764", "0.61520195", "0.6063008", "0.605303", "0.5963396", "0.5923303", "0.5914463", "0.5900428", "0.5866823", "0.58495504", "0.58495504", "0.57912683", "0.5725679", "0.5702438", "0.56925863", "0.568346"...
0.661035
1
Produce a command that switches the green/yellow paddle to the green filter position.
def _iotool_enable_green_command(self): return self._iotool.commands.set_high(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_green(self,command):\n if \"on\" in command:\n print 'Green ON'\n GPIO.output(22,GPIO.HIGH)\n elif \"off\" in command:\n print 'Green OFF'\n GPIO.output(22,GPIO.LOW)\n elif \"flash\" in command:\n print 'Flashing green'\n FlashPin(pin=22,count=5,delay=0.1)\n else:\n...
[ "0.6667252", "0.6028988", "0.6024907", "0.5635577", "0.539456", "0.5389388", "0.52197635", "0.5214792", "0.5152538", "0.51346695", "0.50763196", "0.5059358", "0.50518", "0.50459635", "0.50299966", "0.5006441", "0.5004159", "0.49799615", "0.4970993", "0.4952227", "0.49450052",...
0.6651339
1
Produce a command that switches the green/yellow paddle to the yellow filter position.
def _iotool_enable_yellow_command(self): return self._iotool.commands.set_low(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _iotool_enable_green_command(self):\n return self._iotool.commands.set_high(self._spconfig.IOTOOL_GREEN_YELLOW_SWITCH_PIN)", "def do_green(self,command):\n if \"on\" in command:\n print 'Green ON'\n GPIO.output(22,GPIO.HIGH)\n elif \"off\" in command:\n print 'Green OFF'\n GP...
[ "0.66017234", "0.6463711", "0.6408746", "0.576167", "0.5699568", "0.5610469", "0.52996385", "0.528892", "0.52802473", "0.52086544", "0.5200548", "0.5187345", "0.5174531", "0.51482487", "0.5146435", "0.51361644", "0.5129312", "0.50764745", "0.50689256", "0.5049614", "0.5039266...
0.6588561
1
'position' should be either 'green' or 'yellow' to insert the corresponding excitation filter into the green/yellow beam.
def set_green_yellow_filter(self, position): if position not in {'green', 'yellow'}: raise ValueError('"position" parameter must be either "green" or "yellow"') if position == 'green': self._iotool.execute(self._iotool_enable_green_command()) else: self._iotoo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_synthetic_more_positions():\n background = Image.new('RGB', (100, 50))\n patch = Image.new('RGB', (10, 10))\n positions = [\n [5, 5],\n [9, 5]\n ]\n\n parameters = {\n 'data': [background, patch],\n 'positions': positions\n }\n\n images.synthetic(parameters...
[ "0.53531677", "0.5220632", "0.5194332", "0.5193839", "0.51745796", "0.4996859", "0.48552203", "0.48219103", "0.48006073", "0.47713152", "0.4769842", "0.47544366", "0.47400308", "0.4717013", "0.47052014", "0.4670778", "0.4665777", "0.46621022", "0.46432894", "0.46413597", "0.4...
0.63949525
0
Initializer method Raises exception if date is invalid. This may be due to the day exceeding the maximum number of days in the given month, or February 29 is specified on a nonLeap Year, etc.
def __init__(self, year=1900, month=1, day=1): # ensure the inputs are parsed into integers year = int(year) month = int(month) day = int(day) # if the year is not from 0000 to 9999 if not (0 <= year and year <= 9999): raise Exception("Year must be between 000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate(year, month, day):\n if day is not None and month is None:\n raise ValueError(\"Day without month\")\n if day is None:\n day = 1\n if month is None:\n month = 1\n if year is None:\n year = 2000\n # actual validation happen...
[ "0.76030535", "0.7002074", "0.6673425", "0.6647609", "0.65993536", "0.63706475", "0.6331436", "0.6283567", "0.62462884", "0.6236522", "0.6227877", "0.6186614", "0.6181855", "0.6148485", "0.6121073", "0.6105989", "0.6061786", "0.60375345", "0.6025827", "0.59781796", "0.5962233...
0.72118706
1
Given another date, find out how many days passed since this date.
def days_since(self, otherDate): # initialize days passed days = 0 # time difference of the year yearDiff = otherDate.get_year() - self.get_year() days += yearDiff * 365 # if other date is in the future, traverse forwards otherwise go # backwards if yearDi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datediff_today(date):\n today = datetime.date.today()\n datediff = (today - date).days\n return datediff", "def diff_dates(date1, date2):\n\n return abs(date2 - date1).days", "def _get_number_of_days(self, date_from, date_to):\n\n DATETIME_FORMAT = \"%Y-%m-%d %H:%M:%S\"\n from_dt ...
[ "0.7271025", "0.71568805", "0.69931793", "0.687202", "0.6865785", "0.68303543", "0.6826376", "0.68105143", "0.6737072", "0.67137754", "0.6684774", "0.6589549", "0.6587052", "0.6512795", "0.65027285", "0.647871", "0.64774734", "0.6458868", "0.64533335", "0.6426467", "0.6415163...
0.7558373
0