query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Simulates a mouse wheel movement
def wheel(ticks): m = PyMouse() m.scroll(ticks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ev_mousewheel(self, event: MouseWheel) -> None:", "def on_mouse_wheel(self, e): # pragma: no cover\n super(TraceView, self).on_mouse_wheel(e)\n if e.modifiers == ('Alt',):\n start, end = self._interval\n delay = e.delta * (end - start) * .1\n self.shift(-delay)...
[ "0.70724034", "0.6867929", "0.6845834", "0.6725395", "0.6706772", "0.66839576", "0.66106194", "0.64879376", "0.6433302", "0.6428224", "0.6424929", "0.63497424", "0.6329097", "0.62871855", "0.62500674", "0.62429804", "0.62024975", "0.61738163", "0.6163825", "0.6155793", "0.613...
0.79435927
0
Compresses a byte array with the xz binary
def compress(value): process = Popen(["xz", "--compress", "--force"], stdin=PIPE, stdout=PIPE) return process.communicate(value)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_byte(byte_array, index):\n\n if byte_array[index] == 0:\n changed_byte_array = byte_array[0:index] + b\"\\xff\" + byte_array[index + 1 :]\n changed_byte_array = byte_array[0:index] + b\"\\x00\" + byte_array[index + 1 :]\n return changed_byte_array", "def test_compress_2(self):\n t...
[ "0.5709028", "0.56780964", "0.5647832", "0.5616013", "0.56071866", "0.55910605", "0.55739576", "0.55164623", "0.5504677", "0.5499852", "0.5489234", "0.5489234", "0.5486275", "0.5466205", "0.54346704", "0.54300076", "0.540067", "0.53756106", "0.53609854", "0.53576124", "0.5354...
0.5999412
1
Decompresses a byte array with the xz binary
def decompress(value): process = Popen(["xz", "--decompress", "--stdout", "--force"], stdin=PIPE, stdout=PIPE) return process.communicate(value)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decompress_2(self):\n b_array = bytearray([3]) + bytearray(b'abcdef')\\\n + bytearray([0, 32]) + bytearray([0, 113])\n actual = LZ77.decompress(b_array)\n expected = 'abcdefdeabc'\n self.assertEqual(actual, expected)", "def test_decompress_1(self):\n ...
[ "0.6248445", "0.6211954", "0.62091017", "0.6167395", "0.60436386", "0.5956435", "0.59318906", "0.5930538", "0.5903139", "0.5897572", "0.5881671", "0.5857352", "0.5821568", "0.57875955", "0.578303", "0.5764637", "0.5753524", "0.57527006", "0.5750076", "0.5742337", "0.5739909",...
0.58198994
14
Compress the file at 'path' with the xz binary
def compress_file(path): process = Popen(["xz", "--compress", "--force", "--stdout", path], stdout=PIPE) return process.communicate()[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zip_file(file_path: str) -> str:\n zip_file_path: str = file_path + \".gz\"\n\n print(f\"Compressing {file_path} into {zip_file_path}\")\n timestamp=path.getmtime(file_path)\n with open(file_path, \"rb\") as read_stream:\n with gzip.open(zip_file_path, \"wb\") as write_stream:\n s...
[ "0.7248893", "0.6594647", "0.6594647", "0.64348674", "0.64283776", "0.6283818", "0.62432826", "0.6221492", "0.6214257", "0.6159141", "0.6146967", "0.6120605", "0.6105703", "0.60970914", "0.6093049", "0.6085339", "0.6084827", "0.6059032", "0.6022121", "0.60189515", "0.59890485...
0.7983229
1
Shows a specific plane within 3D data.
def show_plane(axis, plane, cmap="gray", title=None): axis.imshow(plane, cmap=cmap) axis.set_xticks([]) axis.set_yticks([]) if title: axis.set_title(title) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_plane(unit_normal, x_array, y_array, fore):\n # print'unit normal = ', unit_normal\n z = (((unit_normal[0] * (fore[0] - x_array)) + (unit_normal[1] * (fore[1] - y_array))) / unit_normal[2]) + fore[2]\n # print 'plane numbers\\n', z\n return z", "def plane(self):\r\n from lsst.analysis...
[ "0.6780227", "0.666365", "0.6577502", "0.6563549", "0.63409144", "0.624834", "0.6219757", "0.6199828", "0.6173089", "0.6126187", "0.6115501", "0.6100461", "0.6099733", "0.6040154", "0.6024716", "0.6006487", "0.5987519", "0.59277785", "0.5921929", "0.5920941", "0.5902615", "...
0.67553663
1
Draws a cube in a 3D plot.
def slice_in_3d(axis, shape, plane): Z = np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1]]) Z = Z * shape r = [-1, 1] X, Y = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_cube(self, window):\n size = pygame.display.get_surface().get_size()\n width = (size[0]/4)\n\n window.fill((000,000,000))\n\n self.draw_face(\"U\", window, (0 + (width*1), 0 + (width*0)), width)\n self.draw_face(\"L\", window, (0 + (width*0), 0 + (width*1)), width)\n ...
[ "0.7407902", "0.71406615", "0.71255124", "0.7051842", "0.6929713", "0.6927209", "0.69070977", "0.69030863", "0.68954325", "0.6841298", "0.67818475", "0.6753072", "0.675133", "0.67188823", "0.6653603", "0.6642409", "0.6613349", "0.6610248", "0.65382105", "0.65379065", "0.65249...
0.0
-1
Allows to explore 2D slices in 3D data.
def slice_explorer(data, cmap='gray'): data_len = len(data) @interact(plane=(0, data_len-1), continuous_update=False) def display_slice(plane=data_len/2): fig, axis = plt.subplots(figsize=(20, 7)) axis_3d = fig.add_subplot(133, projection='3d') show_plane(axis, data[plane], title='P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_slice(img_3D, view):\n input_type = isinstance(img_3D, np.ndarray)\n if input_type:\n img_3D = [img_3D]\n img_shape = img_3D[0].shape\n if view == \"sag\":\n slice_pos = np.random.randint(int(0.2 * img_shape[0]), int(0.8 * img_shape[0]))\n imgs_2D = [imgg_3D[slice_pos, :, ...
[ "0.7107621", "0.6738053", "0.6709929", "0.6706025", "0.6513878", "0.64924455", "0.6423735", "0.63151467", "0.63149804", "0.6307343", "0.62615204", "0.6126598", "0.6090667", "0.607543", "0.6070433", "0.60660744", "0.60097694", "0.6005962", "0.5995597", "0.597353", "0.59621847"...
0.7134606
0
Helper function for plotting histograms.
def plot_hist(axis, data, title=None): axis.hist(data.ravel(), bins=256) axis.ticklabel_format(axis='y', style='scientific', scilimits=(0, 0)) if title: axis.set_title(title) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_histogram(self,ax=None,**kwargs):\n if not ax:\n fig = plt.figure()\n ax = fig.add_subplot(111)\n probs,bins,patches = ax.hist(self.scores_list,normed=True,label=\"Sample\",**kwargs)\n ax.vlines(self.xhat,*ax.get_ylim(),label='Mean',color='r')\n ax.legend(...
[ "0.76307493", "0.7626514", "0.74735564", "0.7414809", "0.7405838", "0.7366627", "0.7359895", "0.7336036", "0.73091656", "0.73068434", "0.71873444", "0.71678686", "0.7161124", "0.7120898", "0.70793045", "0.70793045", "0.70793045", "0.7075434", "0.707193", "0.7068348", "0.70412...
0.6881642
30
Generates a 3D surface plot for the specified region.
def plot_3d_surface(data, labels, region=3, spacing=(1.0, 1.0, 1.0)): properties = measure.regionprops(labels, intensity_image=data) # skimage.measure.marching_cubes expects ordering (row, col, plane). # We need to transpose the data: volume = (labels == properties[region].label).transpose(1, 2, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_surface(self):\n X, Y = np.meshgrid(self.x, self.y)\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n ax.plot_surface(X=X, Y=Y, Z=self.z)\n plt.show()", "def plot3d(data):\n assert span1 == span2\n span = span1\n # ---------------------- crea...
[ "0.6976554", "0.68625677", "0.6843619", "0.6560246", "0.6512885", "0.6510929", "0.6456214", "0.63602376", "0.63443196", "0.63097036", "0.6258106", "0.62344956", "0.61818576", "0.61670333", "0.61499923", "0.6146061", "0.6144096", "0.61362255", "0.60683507", "0.60314703", "0.60...
0.7583633
0
If no mapping_method, then analysis run is set up.
def run_parallel(pid, call_method_id, run_id='gwas', kinship_method='ibd'): job_id = '%s_%s_%d_%d' % (run_id, kinship_method, call_method_id, pid) file_prefix = env.env['results_dir'] + job_id #Cluster specific parameters shstr = '#!/bin/bash\n' shstr += '#$ -S /bin/bash...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_mapping(self):\n pass", "def analysis_setup(self):\n pass", "def applyMapping(self):\n pass", "def requires_mapping(self):", "def process_field_mapping(self, analysis, observable: Observable, result, result_field, result_time=None) -> None:\n pass", "def setup_mapping(...
[ "0.6723257", "0.672305", "0.65543103", "0.60905826", "0.5807275", "0.572249", "0.57076865", "0.5566315", "0.55566597", "0.5527906", "0.5521116", "0.55162174", "0.5465503", "0.5437137", "0.5386988", "0.5373432", "0.53393596", "0.5198328", "0.5180411", "0.51791704", "0.5174413"...
0.0
-1
Connect current container to the environment containers network.
def connect_to_containers_network(): logging.info("Connecting to the environment network") container_id = get_current_container_id() subprocess.check_output( 'docker network connect subsystem_tests-network {container_id}'.format(container_id=container_id), shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, container_name: str, aliases: list[str] = None,\n ipv4: str | None = None) -> None:\n self.log.debug(\n f\"Connecting {container_name} to network '{self.network_name}'\")\n self.network.connect(\n container_name, aliases=aliases, ipv4_address=ipv...
[ "0.68715274", "0.6033247", "0.5958551", "0.5952797", "0.5917014", "0.5764563", "0.57549083", "0.57498366", "0.57448465", "0.573062", "0.57062066", "0.5695735", "0.5688441", "0.5684623", "0.56554174", "0.56166863", "0.56042194", "0.5562665", "0.5559789", "0.5551756", "0.552874...
0.83500123
0
Return the current container ID.
def get_current_container_id(): with open('/proc/self/cgroup', 'rt') as cgroup_file: for line in cgroup_file.readlines(): return re.sub(r'^docker-', '', re.sub(r'\.scope$', '', re.sub(r'^.*\/', '', line.strip())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"container_id\")", "def containerID(self):\n return self._container", "def container_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"container_id\")", "def cont_to_id(self):\n r...
[ "0.86177015", "0.85974866", "0.822979", "0.81850547", "0.7676669", "0.7595466", "0.7591976", "0.7085673", "0.69835997", "0.69442016", "0.69008535", "0.6894379", "0.6839231", "0.68319935", "0.6813734", "0.6774681", "0.67729616", "0.66315556", "0.6575164", "0.6575164", "0.65332...
0.80170023
4
Overrides Die.roll() so that in addition to rolling the dice, it sets the die's value based on the currentValue.
def roll(self): self.currentValue = choice(self.possibleValues) self.value = AngryDie.ANGRY_VALUES[self.currentValue] return self.currentValue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_dice(self):\n self.roll = (random.randint(1,6), random.randint(1,6))\n return self.roll", "def roll(self):\n #dieValue = [] \n self._value = random.randrange(Die.SIDES) + 1\n self._update()\n #dieValue.append(self._value)\n #print(dieValue)\n #p...
[ "0.72756755", "0.72380686", "0.71869373", "0.71206564", "0.70240617", "0.69059175", "0.68994266", "0.685288", "0.682175", "0.67554736", "0.66809267", "0.66572595", "0.66572595", "0.6561393", "0.64926106", "0.6468559", "0.6467723", "0.6460948", "0.64546245", "0.64188683", "0.6...
0.7436479
0
A helper method that, given a valid faceValue, will update the die's currentValue and value to match the passed faceValue.
def setDieFaceValue(self, faceValue): if faceValue in AngryDie.ANGRY_VALUES: self.currentValue = faceValue self.value = AngryDie.ANGRY_VALUES[faceValue]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFace(self, value):\n self.face = value", "def setFace(self, value):\n self.face = value", "def test_currentValue_is_updated_to_roll_value(self):\n rolled_value = self.new_die.roll()\n if rolled_value == self.new_die.currentValue:\n self.assertTrue(True, \"currentVa...
[ "0.568083", "0.568083", "0.5458344", "0.54526615", "0.52289414", "0.5217452", "0.5184717", "0.5160611", "0.51151603", "0.511195", "0.50905704", "0.506557", "0.50020486", "0.49880826", "0.49478003", "0.49093857", "0.4904442", "0.48498568", "0.48484898", "0.4839955", "0.4830702...
0.81279725
0
Drive the Angry Dice game for the user. Welcomes them to the game and prints the instructions, then prompts them with the die values and what they want to roll until they advance through all the stages and win.
def main(self): text = "Welcome to Angry Dice! Roll the two dice until you get thru the 3 Stages!\n" \ "Stage 1 you need to roll 1 & 2\n" \ "Stage 2 you need to roll ANGRY & 4\n" \ "Stage 3 you need to roll 5 & 6\n" \ "You can lock a die needed for your current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self):\n\n input(\"\"\"\nWelcome to Angry Dice! Roll the two dice until you get thru the 3 Stages!\nStage 1 you need to roll 1 & 2\nStage 2 you need to roll ANGRY & 4\nStage 3 you need to roll 5 & 6\nYou can lock a die needed for your current stage\nand just roll the other one, but beware!\nIf you ...
[ "0.7677212", "0.75570935", "0.68514156", "0.6303217", "0.6295013", "0.6294594", "0.620361", "0.61641127", "0.609266", "0.6076957", "0.60398626", "0.6020962", "0.6014037", "0.60069793", "0.60060954", "0.5999888", "0.5986961", "0.5982929", "0.59672225", "0.5925162", "0.59180194...
0.7522587
2
Roll the dice passed in the list.
def roll_the_dice(self, dice): if type(dice) == list: for die in dice: die.roll()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll(dice):\n rolled_dice = []\n for die in dice[1]:\n rolled_dice.append(randint(1, CUBE_DICE_MAX_VALUE()))\n dice[1] = rolled_dice\n return dice", "def roll_the_dice(self, index):\n # first roll\n first_roll_result = self._rolls_list[index].roll_dice()\n print(f'FIRS...
[ "0.78297305", "0.76451164", "0.76148355", "0.7406287", "0.73938185", "0.73751354", "0.7322575", "0.7311594", "0.7302911", "0.72434473", "0.7187141", "0.71589607", "0.7152758", "0.71263856", "0.7106611", "0.7098338", "0.7085768", "0.70856994", "0.7061517", "0.70429206", "0.704...
0.8384107
0
Print both die values, as well as the current stage.
def print_dice(self): stage_to_print = 3 if self.current_stage == 4 else self.current_stage print("You rolled:\n a = [ {} ]\n b = [ {} ]\n\nYou are in Stage {}" .format(self.die_a, self.die_b, stage_to_print))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_current_dice(self):\n print(\"You rolled:\\n a = [ {} ]\\n b = [ {} ]\\n\".\n format(self.die_a, self.die_b))", "def print_hand(self):\n if self.cheating:\n print(\"You're cheating!\")\n print(\"until you reroll it!\")\n print(\"\"\"\nYo...
[ "0.6175284", "0.5993719", "0.5895301", "0.5708749", "0.56729364", "0.5624648", "0.5600944", "0.55977625", "0.55730206", "0.5530365", "0.5493459", "0.5430469", "0.538948", "0.53874636", "0.5384385", "0.53282684", "0.52871954", "0.5283577", "0.527334", "0.52729154", "0.5268641"...
0.7377811
0
Prompt the user for input, and return the dice they want to roll.
def determine_roll(self): dice_to_roll = [] to_roll = input("Roll dice: ") if 'a' in to_roll: dice_to_roll.append(self.die_a) if 'b' in to_roll: dice_to_roll.append(self.die_b) return dice_to_roll
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_dice(player: int) -> int:\n sides = 6\n roll_again = input(\"Player {}: Press ENTER to roll your dice...\".format(player))\n num_rolled = roll(sides)\n print(\"You rolled {}.\".format(num_rolled))\n return num_rolled", "def dice_roller():\n\n print('Use the xDy+z format to roll the dic...
[ "0.75145817", "0.73645425", "0.73168164", "0.71421844", "0.71233743", "0.7100476", "0.70834786", "0.7075699", "0.7033684", "0.70306945", "0.70136887", "0.7012352", "0.692733", "0.6923469", "0.68955934", "0.6895005", "0.6886274", "0.68699884", "0.6821573", "0.6815672", "0.6813...
0.75796336
0
Check the state of the game and if conditions are met to advance the player to the next stage.
def check_stage(self): #Initalize target and goal_stage to stage1 values target = 3 goal_stage = 2 # Set target and goal_stage if current stage is not 1 if self.current_stage == 2: target = 7 goal_stage = 3 elif self.current_stage == 3: target = 11 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance_check(self):\n values = [self.die_a.value, self.die_b.value]\n if self.stage == 3:\n if not self.cheating and \"5\" in values and \"6\" in values:\n return True\n if self.stage == 2 and \"ANGRY\" in values and \"4\" in values:\n self.stage = 3\n...
[ "0.6904773", "0.680145", "0.6782129", "0.6746176", "0.672846", "0.67035085", "0.6647363", "0.66338056", "0.660885", "0.65491366", "0.6462665", "0.6453733", "0.6429156", "0.6387714", "0.63038003", "0.62731713", "0.62604964", "0.6260225", "0.621723", "0.62048525", "0.6200238", ...
0.7219316
0
Checks to see if both dice are Angry, if so, sets current_stage to 1
def check_angry(self): if self.die_a.value == 3 and self.die_b.value == 3: print("WOW, you're ANGRY!\nTime to go back to Stage 1!") self.current_stage = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_angry_dice(self):\n if self.die_a.current_value == \"ANGRY\" and self.die_b.current_value == \"ANGRY\":\n print(\"WOW, you're ANGRY!\\nTime to go back to Stage 1!\")\n self.game_stage = 1", "def check_stage(self):\n\n #Initalize target and goal_stage to stage1 values\...
[ "0.7947746", "0.68952584", "0.67912954", "0.66577834", "0.657209", "0.65228903", "0.6070311", "0.6039068", "0.5986948", "0.58281", "0.57704735", "0.5715772", "0.5712143", "0.5680398", "0.56088614", "0.5588602", "0.55773765", "0.5547491", "0.55223674", "0.5517609", "0.5482465"...
0.74593896
1
In Stage 3, they can only hold a 5 valued die. If they hold a 6, they'll be found cheating and thus, cannot win, or advance to the next stage.
def check_cheating(self, dice=[]): #Assume they're not cheating until proven guilty self.cheating = False if self.current_stage == 3: if self.die_a not in dice and (self.die_a.value == 6): print("You're cheating! You cannot lock a 6! You cannot win " "until you...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance_check(self):\n values = [self.die_a.value, self.die_b.value]\n if self.stage == 3:\n if not self.cheating and \"5\" in values and \"6\" in values:\n return True\n if self.stage == 2 and \"ANGRY\" in values and \"4\" in values:\n self.stage = 3\n...
[ "0.7061071", "0.6833772", "0.6340773", "0.63359606", "0.6290116", "0.628443", "0.6203253", "0.6173044", "0.6135499", "0.61070085", "0.61038446", "0.60700893", "0.6055959", "0.60029256", "0.59974277", "0.5941838", "0.5928955", "0.59277576", "0.590705", "0.5904662", "0.5890709"...
0.7265603
0
This function locates all nearby cities within num_hops from the given city. It maintains a set of all the cities visited from the starting city at each hop. After completion, it removes the original city from the list of results
def find_nearby_cities(graph: TeleportGraph, city: str, num_hops: int = 1) -> set: if num_hops == 0: return set() start_city_node = graph.find_city_node(city) city_nodes = {start_city_node} for i in range(num_hops): related_cities = set() # for every city in the current set,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindDHopCities(self, X, d):\n # G = nx.Graph()\n # G.add_nodes_from(self.nodes)\n # G.add_edges_from(self.edges)\n\n # airports_id_in_city = self.airports.loc[self.airports['city'] == X, 'airport_id'].to_list()\n\n # cities_h_hop = set()\n # for airport in airports_id_...
[ "0.6298028", "0.60487", "0.58636826", "0.58009905", "0.558688", "0.5529587", "0.5491075", "0.54383576", "0.54128426", "0.5362866", "0.5285198", "0.5187931", "0.5150512", "0.5140834", "0.5108585", "0.5091598", "0.506311", "0.5040769", "0.503374", "0.4991658", "0.49839562", "...
0.73122805
0
This function determines if two cities can be reached in the graph. This algorithm uses a breadthfirst search approach
def does_route_exist(graph: TeleportGraph, start_city: str, end_city: str) -> bool: queue = Queue() start_city_node = graph.find_city_node(start_city) queue.put(start_city_node) # keep track of the nodes we've visited - if we do not do this, we'll wind up in an infinite loop because since # we're ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def are_connected(self, person1, person2):\n\n possible_nodes = Queue()\n seen = set()\n possible_nodes.enqueue(person1)\n seen.add(person1)\n\n while not possible_nodes.is_empty():\n person = possible_nodes.dequeue()\n print(\"checking\", person)\n ...
[ "0.67384744", "0.6349388", "0.63051564", "0.6257954", "0.6152257", "0.6132436", "0.6108083", "0.60494477", "0.60445905", "0.59779936", "0.59365493", "0.5929931", "0.59287775", "0.5921574", "0.58920145", "0.58911324", "0.58680403", "0.5858796", "0.58010995", "0.57815397", "0.5...
0.67146933
1
This function uses a closure to wrap the is_loop function in the context it needs to execute. It builds a Path object by traversing the tree in a depthfirst searchlike manner. The Path object itself is a stack, with the latest node in the path on the top
def does_loop_exist(graph: TeleportGraph, city: str) -> bool: start_node = graph.find_city_node(city) visited_inner_nodes = set() def is_loop(path: Path, node: CityNode) -> bool: # check the current path + node combination to see if they form a loop new_path = path + node if node !...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\"\n fringeList = util.Stack()\n print \"fringeList\",fringeList\n closedList = {str(problem.getStartState()): ([])} #Hash Map to maintain state to path\n print \"closed list:\", closedList\n isGoalStateArrived = False\n\n # Push start state into frin...
[ "0.6329693", "0.61533785", "0.6149285", "0.61012757", "0.60317045", "0.6018394", "0.5991409", "0.5937781", "0.5935834", "0.5900034", "0.5898311", "0.5897564", "0.58851016", "0.58820933", "0.587812", "0.5874348", "0.5860418", "0.5849348", "0.5839746", "0.58242905", "0.58104414...
0.0
-1
Starts this module and displays its menu. User can access default special features from here. User can go back to main menu from here.
def start_module(): menu_for_store = ["Show Table", "Add", "Remove", "Update", "Item by Durability Time", "Average Durability Time by Manufacturer", "Back to main menu"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.menu()", "def start(self) -> None:\n self.execute_startup_menu()\n self.execute_main_menu()", "def menu(self):\n from mainmenu import Menu\n gm = Menu(self.screen)\n gm.run()", "def run(self) -> None:\n\n MainMenuController().show_menu(...
[ "0.7938095", "0.7741795", "0.77349406", "0.76457036", "0.7281473", "0.7106561", "0.7106561", "0.7041256", "0.6893074", "0.6865796", "0.6844933", "0.6782512", "0.6730884", "0.67242575", "0.6687903", "0.66862607", "0.66724086", "0.6643579", "0.66138124", "0.6591422", "0.6482712...
0.6132973
43
Asks user for input and adds it into the table.
def add(table): new_list_to_add = [] new_list_to_add.append(common.generate_random(table)) new_list_to_add.extend(ui.get_inputs(["Please add the Name: "],"")) new_list_to_add.extend(ui.get_inputs(["Please add the Manufacturer: "],"")) new_list_to_add.extend(ui.get_inputs(["Please add the Year of P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(table):\n\n generated = common.generate_random(table)\n\n list_labels = ['Title: ', 'Manufacturer: ', 'Price: ', 'Number in stock: ']\n\n inputs = list_labels[:]\n\n while not inputs[2].isdigit() or not inputs[3].isdigit():\n inputs = ui.get_inputs(list_labels, 'Provide data: ')\n\n i...
[ "0.72043127", "0.70753807", "0.692427", "0.6833963", "0.6790875", "0.676084", "0.6621706", "0.66021085", "0.65713584", "0.6525232", "0.6510655", "0.64706945", "0.64340395", "0.6290243", "0.62401277", "0.6178783", "0.61465514", "0.61439264", "0.59972376", "0.5993154", "0.59722...
0.66343117
6
Remove a record with a given id from the table.
def remove(table, id_): common.toremoveid("inventory/inventory.csv",data_manager.get_table_from_file("inventory/inventory.csv"),id_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(table, id_):\n table, successful = common.remove_record(table, id_)\n\n if not successful:\n ui.print_error_message('Error!')\n\n return table", "def remove(table, id_):\n\n record = common.find_id(table, id_[0])\n if record in table:\n table = common.remove_record(table, ...
[ "0.8176463", "0.8054362", "0.80142987", "0.76159215", "0.74309653", "0.72869754", "0.72543085", "0.7076186", "0.70404893", "0.7039547", "0.6975638", "0.69384336", "0.6901097", "0.6890645", "0.6853109", "0.6842799", "0.6817162", "0.68161863", "0.68117946", "0.6789418", "0.6776...
0.6802873
19
Updates specified record in the table. Ask users for new data.
def update(table, id_): for i in table: if i[0] == id_: i[1] = ui.get_inputs(["What should i update the titel to: "],"") i[2] = ui.get_inputs(["What should I update the manufacturer to? "],"") i[3] = ui.get_inputs(["What should I update the year of purchase to? "],"") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(table,record_id='',message='',next='',\n readonly_fields='',hidden_fields='',default_fields=''):\n\n PluginWikiWidgets._set_field_attributes(table, readonly_fields,hidden_fields,default_fields)\n if not record_id: record_id=request.args(-1)\n if not record_id.isdigit()...
[ "0.7245048", "0.7108982", "0.7071606", "0.7058902", "0.6944672", "0.6926919", "0.6925757", "0.6912551", "0.6864421", "0.67838085", "0.67801327", "0.67352724", "0.67352724", "0.6695691", "0.66325665", "0.65575486", "0.653736", "0.65354466", "0.6529351", "0.6521863", "0.6492877...
0.0
-1
Reads the specified project Gutenberg book. Header comments, punctuation, and whitespace are stripped away. The function returns a list of the words used in the book as a list. All words are converted to lower case.
def get_word_list(file_name): storyEdit = [] #Reads the file starting after the beginning f = open(file_name,'r') lines = f.readlines() curr_line = 0 while lines[curr_line].find('START OF THIS PROJECT GUTENBERG EBOOK') == -1: curr_line += 1 lines = lines[curr_line+1:] #Loops through each row, making ever...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_book_words(infile):\t\n\timport string\n\t\n\tfin = open(infile) \n\tlines = fin.readlines()\n\twords = []\n\tfor line in lines[25:]: #skipping over the header information\n\t\tline = line.replace('-', ' ')\n\t\tt = line.split()\n\t\tfor word in t:\n\t\t\tword = word.strip(string.punctuation + string.whit...
[ "0.72380835", "0.7035844", "0.69978523", "0.6959783", "0.6928538", "0.68596375", "0.68219995", "0.6537841", "0.62804574", "0.6134441", "0.60707104", "0.6049446", "0.6033682", "0.60183454", "0.60149145", "0.5994137", "0.59453297", "0.5919479", "0.58863664", "0.586905", "0.5842...
0.67661035
7
Takes a list of words as input and returns a list of the n most frequently occurring words ordered from most to least frequently occurring.
def get_top_n_words(word_list, n): #Uses Counter function to create tuples of words and number of instances of word wordCount = Counter(word_list) topWords = [] orderedByFrequency = sorted(wordCount, key=wordCount.get, reverse=True) #create list of inputted 'n' top words for i in range (0 , n): topWords.app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_n_words(word_list, n):\n d = dict()\n for w in word_list:\n d[w] = d.get(w, 0) + 1\n ordered_by_frequency = sorted(d, key=d.get, reverse=True)\n return ordered_by_frequency[0:n]", "def get_top_n_words(word_list, n):\n word_counts = dict()\n\n for word in word_list:\n f...
[ "0.83019364", "0.8259304", "0.82464784", "0.8063228", "0.8041614", "0.7969055", "0.79085237", "0.78822184", "0.77217156", "0.7661636", "0.7626515", "0.75896144", "0.755189", "0.7525962", "0.748399", "0.7470999", "0.7364696", "0.71175003", "0.70950264", "0.70950264", "0.706640...
0.8294504
1
Generate N RGB colors for cmap.
def generate(N, cmap='Set1', method='matplotlib', keep_alpha=False, scheme='rgb', verbose='info'): # Set the logger set_logger(verbose=verbose) listlen = 4 if keep_alpha else 3 if method=='seaborn': sns = _check_seaborn() color_list = sns.color_palette(cmap, N) else: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_n_colors(n, cmap_name='tab20'):\n pt_region_colormap = plt.get_cmap(cmap_name)\n max_i = len(pt_region_colormap.colors)\n return [pt_region_colormap(i % max_i) for i in range(n)]", "def get_cmap(n):\n cmap_fn = plt.cm.get_cmap('hsv', n+1)\n colors = [cmap_fn(i + 1)[:3] for i in range(...
[ "0.8178953", "0.77302057", "0.76631385", "0.76402104", "0.73800164", "0.7310844", "0.72412497", "0.72399986", "0.70891625", "0.70848805", "0.705759", "0.6974212", "0.69218963", "0.6902083", "0.68446606", "0.6824279", "0.6822179", "0.68052876", "0.6770785", "0.67608047", "0.66...
0.6841107
15
Convert RGB colorrange to hex.
def rgb2hex(colors, keep_alpha=False): if isinstance(colors, list): colors = np.array(colors) if len(colors.shape)==1: colors = np.array([colors]) if not keep_alpha: colors = colors[:, 0:3] hexcolors = list(map(lambda x: matplotlib.colors.to_hex(x, keep_alpha=keep_alpha), colors...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_hexify(rgb: Iterable[int]) -> str:\n return ''.join(\n list(map(\n lambda x: hex(abs(x))[2:].zfill(2),\n rgb\n ))[::-1]\n )", "def rgb_to_hex(cls, r, g, b):\n return '#%02x%02x%02x' % (int(r), int(g), int(b))", "def rgb2hex(cls, rgb):\r\n if not t...
[ "0.7687512", "0.7467669", "0.74484754", "0.7410516", "0.7389656", "0.7368666", "0.7366835", "0.73552287", "0.73433214", "0.73162735", "0.7264452", "0.7255768", "0.7255768", "0.7255768", "0.7242387", "0.7229792", "0.72228086", "0.7195485", "0.71832603", "0.7121302", "0.7120350...
0.6617863
51
Convert hex colorrange to RGBA.
def hex2rgba(colors): if 'str' in str(type(colors)): colors = np.array([colors]) rgbcolors = list(map(lambda x: matplotlib.colors.to_rgba(x), colors)) return np.array(rgbcolors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_to_rgba(h, alpha):\n return tuple([int(h.lstrip('#')[i:i + 2], 16) for i in (0, 2, 4)] + [alpha])", "def normalize_rgb_colors_to_hex(css):\n log.debug(\"Converting all rgba to hexadecimal color values.\")\n regex = re.compile(r\"rgb\\s*\\(\\s*([0-9,\\s]+)\\s*\\)\")\n match = regex.search(css)...
[ "0.74167764", "0.70776886", "0.6812988", "0.6806883", "0.66850585", "0.66562873", "0.66246355", "0.66192836", "0.6602443", "0.6597313", "0.6596636", "0.65546227", "0.65298957", "0.6514845", "0.6510283", "0.65088314", "0.64748806", "0.6454721", "0.6445255", "0.64353675", "0.64...
0.71970624
1
Convert hex colorrange to RGB.
def hex2rgb(colors): if 'str' in str(type(colors)): colors = np.array([colors]) rgbcolors = list(map(lambda x: matplotlib.colors.to_rgb(x), colors)) return np.array(rgbcolors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex2rgb(cls, hex):\r\n valid_char = '#1234567890abcdef'\r\n conditions = (hex[0] == '#',\r\n len(hex) == 7,\r\n all(c in valid_char for c in hex))\r\n if not all(conditions):\r\n raise ValueError\r\n return int(hex[1:3], 16), int(...
[ "0.80397415", "0.79226583", "0.78379315", "0.78092486", "0.7805608", "0.7804425", "0.77812", "0.77641577", "0.7762018", "0.77501935", "0.774766", "0.77383685", "0.7595601", "0.75911206", "0.75911206", "0.75911206", "0.75911206", "0.7569708", "0.7568768", "0.75653166", "0.7564...
0.74308246
26
Convert hex to rgb.
def _hex2rgb(c_hex): # Pass 16 to the integer function for change of base return [int(c_hex[i:i + 2], 16) for i in range(1, 6, 2)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex2rgb(cls, hex):\r\n valid_char = '#1234567890abcdef'\r\n conditions = (hex[0] == '#',\r\n len(hex) == 7,\r\n all(c in valid_char for c in hex))\r\n if not all(conditions):\r\n raise ValueError\r\n return int(hex[1:3], 16), int(...
[ "0.83853227", "0.8192587", "0.8075392", "0.80479324", "0.8018519", "0.79461384", "0.7929786", "0.78758806", "0.78482735", "0.780748", "0.7790779", "0.77845526", "0.77800864", "0.77697533", "0.77679956", "0.77160627", "0.77045107", "0.76989084", "0.76989084", "0.76989084", "0....
0.76010317
27
Generate colors from input list. This function creates unique colors based on the input list y and the cmap. When the gradient hex color is defined, such as '000000', a gradient coloring space is created between two colors. The start color of the particular y, using the cmap and The end color is the defined gradient, s...
def fromlist(y, X=None, cmap='Set1', gradient=None, method='matplotlib', scheme='rgb', opaque_type='per_class', verbose='info'): # Set the logger set_logger(verbose=verbose) # make unique y = np.array(y) uiy = np.unique(y) # Get colors colors_unique = generate(len(uiy), cmap=cmap, method=me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_color_gradient():\n colors = []\n step = 10\n for red, green in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': red, 'green': green, 'blue': 0})\n for green, blue in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': 0, 'green'...
[ "0.69815975", "0.6241875", "0.608826", "0.6028528", "0.5951059", "0.58788097", "0.58780885", "0.58316827", "0.5818387", "0.5781078", "0.56648606", "0.5645055", "0.5637384", "0.56352425", "0.56185704", "0.55861217", "0.5581655", "0.5577476", "0.5556196", "0.5546131", "0.554457...
0.7146094
0
Return a gradient list of (n) colors between two hex colors. start_hex and finish_hex should be the full sixdigit color string, inlcuding the number sign ("FFFFFF")
def linear_gradient(start_hex, finish_hex="#FFFFFF", n=10): if finish_hex=='opaque': finish_hex=start_hex # Starting and ending colors in RGB form s = _hex2rgb(start_hex) f = _hex2rgb(finish_hex) # Initilize a list of the output colors with the starting color RGB_list = [s] # Calcuate a colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_color_gradient():\n colors = []\n step = 10\n for red, green in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': red, 'green': green, 'blue': 0})\n for green, blue in zip(range(255,-step, -step), range(0, 255, step)):\n colors.append({'red': 0, 'green'...
[ "0.7464628", "0.730974", "0.6747355", "0.64438266", "0.6420821", "0.6330026", "0.6233631", "0.61494654", "0.614863", "0.60044503", "0.5992193", "0.5977377", "0.59677243", "0.5953647", "0.5910034", "0.590775", "0.59075046", "0.58731186", "0.58708364", "0.586321", "0.5853994", ...
0.7984741
0
Create a linear gradient between two values.
def _incremental_steps(start, end, steps, stepsize=None): if stepsize is None: step_size = (end - start) / np.maximum((steps - 1), 1) gradient = [] for i in range(steps): value = start + step_size * i gradient.append(value) return gradient[0:steps]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_gradient(value, start, end, colour_list=None):\n\n # Translate the end colour to RGB arrays if necessary.\n if isinstance(start, str):\n # Default (search the molmol list then the X11 list).\n if colour_list == None:\n try:\n start = molmol_colours(start)\n ...
[ "0.7255634", "0.69585824", "0.6585821", "0.6522588", "0.65146476", "0.6445859", "0.6416497", "0.6357481", "0.63406503", "0.6292611", "0.62760484", "0.6210663", "0.61864525", "0.60238576", "0.6018492", "0.6007702", "0.59936553", "0.5974485", "0.59592235", "0.5944983", "0.59406...
0.0
-1
Color to dictionary. Takes in a list of RGB sublists and returns dictionary of colors in RGB and hex form for use in a graphing function defined later on.
def _color_dict(gradient): hex_colors = [_rgb2hex(RGB) for RGB in gradient] rgb_colors = np.c_[[RGB[0] for RGB in gradient], [RGB[1] for RGB in gradient], [RGB[2] for RGB in gradient]] return {'hex': hex_colors, 'rgb': rgb_colors}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assigning_colors():\n rgb_colors = {}\n for name, hex in matplotlib.colors.cnames.items():\n color = []\n # So the values are from 0-255 and not 0-1\n for i in matplotlib.colors.to_rgb(hex):\n color.append(int(i * 255))\n\n color = tuple(color)\n rgb_colors[n...
[ "0.72993577", "0.7166082", "0.71234846", "0.7105684", "0.67915034", "0.66504467", "0.6633686", "0.6622999", "0.656271", "0.65496135", "0.6542531", "0.64886117", "0.64846194", "0.63931656", "0.63931257", "0.6381189", "0.6377055", "0.6372067", "0.62352693", "0.62340975", "0.623...
0.7698112
0
Check whether the input is a valid hex color code.
def is_hex_color(color, verbose='info'): # Set the logger set_logger(verbose=verbose) if not isinstance(color, str): logger.info('Hex [%s] should be of type string' %(str(color))) return False if color.startswith('#'): color = color[1:] else: logger.info('Hex [%s] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_hex(self):\n self.assertTrue(is_valid_hex('#aabb11'))\n self.assertTrue(is_valid_hex('#000'))\n self.assertTrue(is_valid_hex('#aaa'))\n self.assertFalse(is_valid_hex('black'))\n self.assertFalse(is_valid_hex('bl(ack'))", "def is_valid_hex(hex_code: str) -> boo...
[ "0.78903884", "0.78054225", "0.7551353", "0.7472038", "0.73835933", "0.7371952", "0.73323774", "0.7326407", "0.71489763", "0.70746005", "0.70680034", "0.6905422", "0.687528", "0.679516", "0.67354673", "0.67342633", "0.67073137", "0.67032605", "0.6660225", "0.6614718", "0.6614...
0.760875
2
Set gradient on density color. This function determines the density of the data and adds a transparency column. If samples are in dense areas, transparency values are towards 1 (visible), whereas isn nonedense areas, the transparency values are towards 0 (not visible).
def gradient_on_density_color(X, c_rgb, labels, opaque_type='per_class', showfig=False, verbose='info'): # Set the logger set_logger(verbose=verbose) if labels is None: labels = np.repeat(0, X.shape[0]) from scipy.stats import gaussian_kde uilabels = np.unique(labels) # Add the transparency col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isothermal_depth_wyrtki1964_gradient(da_PT):\n\n # make land mask based on surface layer\n da_mask = da_PT.isel(z=0)*0.+1.\n\n # calculate drho/dz\n da_PT_dz = da_PT.differentiate('z') # kg/m^4\n\n # interpolate to finer vertical resolution (2.5m)\n da_interp = da_PT_dz.interp(z=np.arange(0,d...
[ "0.57073355", "0.57073355", "0.56205153", "0.5285244", "0.52843755", "0.5108466", "0.5072132", "0.50284564", "0.49939755", "0.49933887", "0.49889076", "0.4987362", "0.4982678", "0.4981954", "0.49721134", "0.49690628", "0.49479908", "0.49206397", "0.4919995", "0.49167046", "0....
0.65256983
0
Convert old verbosity to the new one.
def convert_verbose_to_new(verbose): # In case the new verbosity is used, convert to the old one. if verbose is None: verbose=0 if not isinstance(verbose, str) and verbose<10: status_map = { 'None': 'silent', 0: 'silent', 6: 'silent', 1: 'critical', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbosity(v):\n assert v in [0,1,2] # debug, warn, info\n GLOBAL['VERBOSITY'] = v", "def test_increase_verbosity(self):\n # Start from a known state.\n set_level(logging.INFO)\n assert get_level() == logging.INFO\n # INFO -> VERBOSE.\n increase_verbosity()\n ...
[ "0.6408217", "0.6038145", "0.60295814", "0.5947771", "0.5929938", "0.5909877", "0.5623561", "0.5614202", "0.55986595", "0.55324614", "0.55215126", "0.55148864", "0.54819477", "0.5481862", "0.5461689", "0.5380808", "0.53354967", "0.531541", "0.52798617", "0.52721906", "0.52597...
0.74339193
0
Set the logger for verbosity messages.
def set_logger(verbose: [str, int] = 'info'): # Set 0 and None as no messages. if (verbose==0) or (verbose is None): verbose=60 verbose = convert_verbose_to_new(verbose) # Convert str to levels if isinstance(verbose, str): levels = {'silent': 60, 'off': 60, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_verbosity(self, verbosity):\n if verbosity == 0:\n self.__logger.setLevel(logging.CRITICAL)\n if verbosity == 1:\n self.__logger.setLevel(logging.ERROR)\n if verbosity == 2:\n self.__logger.setLevel(logging.WARNING)\n if verbosity == 3:\n ...
[ "0.8115755", "0.78855675", "0.73544574", "0.72481287", "0.7224838", "0.71247065", "0.711234", "0.7095071", "0.7076668", "0.7050104", "0.70436734", "0.68502855", "0.6829931", "0.6782882", "0.6740046", "0.67367077", "0.67337465", "0.6728373", "0.6710663", "0.6692917", "0.669114...
0.7289997
3
Set the logger for verbosity messages.
def disable_tqdm(): return (True if (logger.getEffectiveLevel()>=30) else False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_verbosity(self, verbosity):\n if verbosity == 0:\n self.__logger.setLevel(logging.CRITICAL)\n if verbosity == 1:\n self.__logger.setLevel(logging.ERROR)\n if verbosity == 2:\n self.__logger.setLevel(logging.WARNING)\n if verbosity == 3:\n ...
[ "0.81160295", "0.78849846", "0.73537046", "0.7289292", "0.7246877", "0.72242355", "0.71231896", "0.7111531", "0.70946926", "0.70777905", "0.7048882", "0.70435476", "0.68507385", "0.68290937", "0.67830193", "0.67398274", "0.673591", "0.67333853", "0.6726991", "0.67109823", "0....
0.0
-1
Deploy de PyArweb en python.org.ar.
def deploy(): git_pull() if confirm("Install/upgrade requirements with pip?"): install_requeriments() django_command('collectstatic') django_command('migrate') restart()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():", "def deploy():\n build()\n copy()\n install()", "def deploy():\n require(\"hosts\", provided_by=[production, staging])\n env.release = time.strftime(\"%Y-%m-%d_%H:%M:%S\")\n upload_tar_from_git()\n install_requirements()\n setup_webserver()\n symlink_current_release()...
[ "0.69113123", "0.65194166", "0.64792144", "0.6451945", "0.6413485", "0.61965394", "0.60336876", "0.5960515", "0.5960515", "0.5960515", "0.5945097", "0.58856344", "0.5848106", "0.58176446", "0.58134186", "0.5800298", "0.5773971", "0.5745045", "0.57371277", "0.5698382", "0.5692...
0.5520349
42
Restart gunicorn sending HUP signal to his pid.
def restart(): run('kill -HUP $(cat /tmp/pyar_web.pid)')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_gunicorn():\n puts(yellow(\"Reload gunicorn graceful\"))\n sudo('kill -HUP `cat %s`' % (env.gunicorn_pidpath), user=env.app_user)", "def handle(self, *args, **options):\n try:\n with open(\"/gunicorn.pid\") as f:\n pid = int(f.read().strip())\n os....
[ "0.7595875", "0.7515631", "0.74177647", "0.7061338", "0.702291", "0.6820605", "0.6762132", "0.67176133", "0.67176133", "0.65728974", "0.656298", "0.6393916", "0.63589066", "0.6325044", "0.63238925", "0.6298795", "0.6288653", "0.627927", "0.62728465", "0.6186012", "0.61211467"...
0.6968212
5
Return size of folder at path.
def folder_size(path): return sum(getsize(f) for f in os.listdir('.') if isfile(f))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder_size(path: str) -> str:\r\n return (\r\n subprocess.check_output([\"du\", \"-sh\", \"-B1\", path]).split()[0].decode(\"utf-8\")\r\n )", "def get_size_from_path(path):\n if not os.path.isdir(path):\n return os.path.getsize(path)\n\n size = 0\n\n for dirname, dirs, files in ...
[ "0.8283314", "0.8165242", "0.80046517", "0.78010786", "0.77946424", "0.7767517", "0.77278864", "0.77143127", "0.77143127", "0.769937", "0.7691966", "0.7543926", "0.7538644", "0.7486155", "0.7480786", "0.7466756", "0.74297", "0.74095184", "0.73598933", "0.7322922", "0.7322922"...
0.8572386
0
Yield all filenames in a path.
def list_directory_files(path, folders=False): for f in os.listdir(path): if f[0] == '.': continue current_path = os.path.join(path, f) if folders is False: if os.path.isfile(current_path): if os.path.getsize(current_path) != 0: yie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_files(path):\n if os.path.isfile(path):\n yield path\n elif os.path.isdir(path):\n for dirpath, _, filenames in os.walk(path):\n for f in filenames:\n yield os.path.join(dirpath, f)\n else:\n raise RuntimeError('Path %s is invalid' % path)", "def a...
[ "0.8316498", "0.8162758", "0.7978636", "0.77177733", "0.7645544", "0.7496099", "0.7371728", "0.73671514", "0.7325709", "0.7240269", "0.72048444", "0.71422756", "0.7079702", "0.707557", "0.70674306", "0.70605344", "0.6950866", "0.69340396", "0.6924985", "0.6914971", "0.6914575...
0.0
-1
Print out debugging information string string to be printed (in)
def debug(string): if verbose: print string return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(string):\n if conf.DEBUG:\n outputs.print_debug(string)", "def output_debug_info(self):", "def debugPrint(text: str):\r\n if DEBUG:\r\n print(text)", "def debug_string(self):\n\n raise NotImplementedError", "def debug():", "def debug_print(text):\r\n if settings.de...
[ "0.76916933", "0.7513169", "0.7507592", "0.73979014", "0.73887455", "0.7374867", "0.7366604", "0.7354347", "0.7354347", "0.7234283", "0.7234283", "0.71581537", "0.70975", "0.7073775", "0.7070248", "0.7070248", "0.7016923", "0.6961993", "0.6890409", "0.68704146", "0.6854564", ...
0.7761138
0
Log the node, time, and the string string to be printed (in)
def nilog(string): node=platform.node() now=time.time() nano= "%.10f" %now utct = time.strftime("%Y-%m-%dT%H:%M:%S") logger.info('NILOG: ' + node + ',' + nano + ',' + utct + ',' + string) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Log(self, times):\n\n print '--'\n print times.PrettyPrintLog()\n\n return", "def log(text):\n print \"%s: %s\" % (str(datetime.datetime.now()), text)", "def log_time(label: str) -> None:\n print(label, datetime.now())", "def print_log(*content):\n now = datetime.datetime.now().strftime(\...
[ "0.7125287", "0.6977599", "0.6731128", "0.6702986", "0.66663325", "0.66369194", "0.65915567", "0.6529379", "0.6510782", "0.6506993", "0.6426057", "0.6324537", "0.6316714", "0.629932", "0.6274224", "0.6270883", "0.626235", "0.62466824", "0.6237593", "0.62242323", "0.6213401", ...
0.67103255
3
Do a NetInf PUBLISH for one file file_name is the file to do now
def pubone(file_name,alg,host): hash_alg=alg scheme="ni" rform="json" ext="{ \"meta\": { \"pubdirs\" : \"yep\" } }" # record start time of this stime=time.time() # Create NIdigester for use with form encoder and StreamingHTTP ni_digester = NIdigester() # Install the template URL b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish(self, filename):\n # 1) Encrypt file\n # 2) Publish to remote cloud server\n # 3) Wait for the result\n # 4) Store results in files located inside RAM folder", "def detect(self, filename):\n self.publish(filename)", "def publishUploads(self, manualVerify = True):\...
[ "0.64287066", "0.60361385", "0.5941095", "0.59345895", "0.5917054", "0.57990074", "0.57726157", "0.57401097", "0.57236075", "0.57073116", "0.5628994", "0.55332154", "0.5481817", "0.54700124", "0.54092836", "0.54011065", "0.5339769", "0.53389674", "0.5331978", "0.5296641", "0....
0.6248407
1
Command line program to perform a NetInf 'publish' operation using http convergence layer. Uses NIproc global instance of NI operations class
def py_nipubdir(): # Options parsing and verification stuff usage = "%%prog -d <pathname of content directory> -n <FQDN of netinf node> [-a <hash alg>] [-m NN] [-c count]" parser = OptionParser(usage) parser.add_option("-d", "--dir", dest="dir_name", type="string", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish():\n pass", "def hydronn():\n from hydronn.bin import extract_data\n from hydronn.bin import extract_retrieval_data\n from hydronn.bin import train\n from hydronn.bin import retrieve\n from hydronn.bin import evaluate\n\n description = (\"HYDRONN: A NRT precipitation retrieval fo...
[ "0.5767328", "0.5661973", "0.5631436", "0.55480254", "0.54211825", "0.54131734", "0.5406113", "0.53765", "0.53701484", "0.53538346", "0.5352672", "0.5315707", "0.5301884", "0.5267521", "0.5263778", "0.5224786", "0.52056885", "0.5168929", "0.51480085", "0.5146815", "0.5140904"...
0.5670017
1
This will initialize a worker process
def init_audio_builder(_encode_queue, _app_config, _lock, _only_wav, _dump_sequencer_log): global sequence_builder WordNetCache._lock = _lock sequence_builder = SequenceBuilder(app_config=_app_config, encode_queue=_encode_queue, o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self,init):\n logger.info('*** initialize: worker id=%d',self._agent.wid)\n self.commands = {'initialize':None, 'before_do_work':None, 'after_do_work':None, 'finalize':None}\n self.commands.update(init.get(self._agent.wid,{}))\n exec_command(self.commands['initialize'])",...
[ "0.73232734", "0.73105544", "0.72356534", "0.714579", "0.70134914", "0.69839424", "0.6903663", "0.6903414", "0.6900731", "0.6741941", "0.6730824", "0.67168313", "0.67149097", "0.6712364", "0.6679937", "0.6669801", "0.6663036", "0.6583762", "0.6555774", "0.6551152", "0.6539077...
0.0
-1
This will be executed as payload from a worker process
def make_audio_track(language_pair, items, part_number): global sequence_builder try: sequence_builder.make_audio_track(language_pair, items, part_number) except Exception as e: print(str(e)) print_exc()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _worker(self, args):\n pass", "def exec_worker(self, endpoint, args, request):\n raise NotImplementedError", "def run(self):\r\n self.env.process(self.rw_pifo_sm())", "def process(self):\n pass", "def executor(self):", "def do_work(self):", "def docker_worker():", "def...
[ "0.6918521", "0.6761025", "0.6694109", "0.6624723", "0.6477929", "0.64630187", "0.6447768", "0.644027", "0.6413022", "0.63529164", "0.63503426", "0.63503426", "0.63503426", "0.634449", "0.6313756", "0.6266754", "0.6241326", "0.6200068", "0.61842644", "0.61830354", "0.6179496"...
0.0
-1
Generate cached and grouped activity items for personal and universal news. Args
def build_activity(self, user_id): activity_ids = self.raw_activity_links_collection.get_activity_ids_for_user(user_id) friend_ids = self.friends_collection.getFriends(user_id, limit=None) personal_items = self.raw_activity_items_collection.get_activity_items(activity_ids) universal_ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities_to_jsonfeed(activities, actor=None, title=None, feed_url=None,\n home_page_url=None):\n try:\n iter(activities)\n except TypeError:\n raise TypeError('activities must be iterable')\n\n if isinstance(activities, (dict, str)):\n raise TypeError('activities may not...
[ "0.58782476", "0.58245516", "0.5714196", "0.54559016", "0.5373944", "0.5279887", "0.52462864", "0.52327186", "0.52325124", "0.5232471", "0.5232227", "0.5223817", "0.5216105", "0.51968014", "0.51924586", "0.519236", "0.51744807", "0.51639336", "0.51562124", "0.5153761", "0.509...
0.6624148
0
This initializes the C fitting library.
def initializeC(self, image): super(CPupilFit, self).initializeC(image) self.mfit = self.clib.pfitInitialize(self.pupil_fn.getCPointer(), self.rqe, self.scmos_cal, self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__ (self) :\n self.loadCSPAD2x2CalibParsDefault()", "def initialize(self):\n self.write_model(path=PATH.GRAD, suffix='new')\n\n if PAR.RANDOM_OVER_IT or optimize.iter == 1:\n self.get_random_frequencies()\n\n print('Generating synthetics')\n system.run('sol...
[ "0.6538869", "0.640215", "0.62104684", "0.6187296", "0.61846364", "0.6099485", "0.602922", "0.60163647", "0.5997682", "0.5991749", "0.597411", "0.5933944", "0.5894047", "0.58402103", "0.57940716", "0.57654905", "0.57517904", "0.5741623", "0.57360727", "0.57360727", "0.5736072...
0.64429295
1
Pass new peaks to the C library.
def newPeaks(self, peaks, peaks_type): c_peaks = self.formatPeaks(peaks, peaks_type) self.clib.pfitNewPeaks(self.mfit, c_peaks, ctypes.c_char_p(peaks_type.encode()), c_peaks.shape[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changePeaks(self):\n # Change the number of peaks\n if self.minpeaks is not None and self.maxpeaks is not None:\n npeaks = len(self.peaks_function)\n u = self.random.random()\n r = self.maxpeaks - self.minpeaks\n if u < 0.5:\n # Remove n ...
[ "0.64907897", "0.6027173", "0.57900417", "0.57882077", "0.5668051", "0.56633043", "0.5647525", "0.5629544", "0.562596", "0.5559616", "0.5544985", "0.5536392", "0.5512018", "0.5455464", "0.5427178", "0.54028904", "0.5350657", "0.5269623", "0.52637213", "0.525326", "0.52431154"...
0.70837945
0
Test that addEventListener gets flagged appropriately.
def test_addEventListener(): err = _do_test_raw(""" x.addEventListener("click", function() {}, true); x.addEventListener("click", function() {}, true, false); """) assert not err.failed() assert not err.notices err = _do_test_raw(""" x.addEventListener("click", function() {}, true, tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_subscribe_one_listener(self):\n def listener():\n pass\n EVENT_MANAGER.subscribe('test_listener', listener)\n self.assertIn(listener, EVENT_MANAGER._listeners['test_listener'])", "def test_mouseevents():\n\n err = _do_test_raw(\"window.addEventListener('mousemove', fun...
[ "0.63600886", "0.63525814", "0.629856", "0.6232452", "0.60886395", "0.58877194", "0.5872726", "0.57898706", "0.5751316", "0.5695141", "0.56895745", "0.5664929", "0.56027156", "0.5536601", "0.54882324", "0.54466474", "0.5415127", "0.5400491", "0.5400491", "0.5400491", "0.54004...
0.85027266
0
Tests that createElement calls are filtered properly
def test_createElement(): assert not _do_test_raw(""" var x = "foo"; x.createElement(); x.createElement("foo"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElement("script"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElement(bar); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_render_element2():\n elem = hr.Element()\n elem.append(\"this is some text\")\n elem.append(\"and this is some more text\")\n\n # This uses the render_results utility above\n file_contents = render_result(elem).strip()\n\n # making sure the content got in there.\n assert \"this is som...
[ "0.6099641", "0.5910537", "0.56316715", "0.5482185", "0.54426223", "0.54182744", "0.5415149", "0.5406062", "0.53996783", "0.53621614", "0.5355254", "0.5328316", "0.5324107", "0.5315543", "0.5293697", "0.5273912", "0.5255659", "0.5250865", "0.5217955", "0.51548404", "0.5153654...
0.7561235
0
Tests that createElementNS calls are filtered properly
def test_createElementNS(): assert not _do_test_raw(""" var x = "foo"; x.createElementNS(); x.createElementNS("foo"); x.createElementNS("foo", "bar"); """).failed() assert _do_test_raw(""" var x = "foo"; x.createElementNS("foo", "script"); """).failed() assert _do_test_raw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_createElement():\n\n assert not _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement();\n x.createElement(\"foo\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement(\"script\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n v...
[ "0.6553644", "0.5767339", "0.56110704", "0.5496338", "0.5460686", "0.5308755", "0.52212656", "0.5208479", "0.5199475", "0.5189086", "0.5153285", "0.51497877", "0.5131236", "0.51135963", "0.51049906", "0.50972146", "0.5070891", "0.50700235", "0.50475746", "0.5033134", "0.50266...
0.7780457
0
Tests that warnings on SQL methods are emitted properly
def test_sql_methods(): err = _do_test_raw(""" x.executeSimpleSQL("foo " + y); """) assert err.warnings[0]['id'][-1] == 'executeSimpleSQL_dynamic' err = _do_test_raw(""" x.createStatement("foo " + y); """) assert err.warnings[0]['id'][-1] == 'executeSimpleSQL_dynamic' err ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(self, *args, **kwargs):", "def warn():\n pass", "def test_query_wrapper_operational_error(self):\n\n _session = self.sessionmaker()\n\n _session.begin()\n self.addCleanup(_session.rollback)\n q = _session.query(self.Foo).filter(\n self.Foo.count...
[ "0.63846934", "0.6327814", "0.6292967", "0.6227003", "0.61164504", "0.606927", "0.60324985", "0.6029675", "0.60110146", "0.6006412", "0.6006412", "0.6006412", "0.6006412", "0.6006412", "0.6006412", "0.6006412", "0.6006412", "0.5999971", "0.5977941", "0.5971273", "0.59604573",...
0.73811924
0
Tests that setAttribute calls are blocked successfully
def test_setAttribute(): assert not _do_test_raw(""" var x = "foo"; x.setAttribute(); x.setAttribute("foo"); x.setAttribute("foo", "bar"); """).failed() assert _do_test_raw(""" var x = "foo"; x.setAttribute("onfoo", "bar"); """).failed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_attribute():\n elem = hr.Element(\"this is some text\", id=\"spam\", style=\"eggs\")\n elem.set_attributes(holy=\"grail\", answer=42)\n\n assert (\n get_opening_line(elem)\n == '<html id=\"spam\" style=\"eggs\" holy=\"grail\" answer=\"42\">'\n )", "def testSetAttributeActio...
[ "0.6553509", "0.6533299", "0.6466073", "0.62271565", "0.60845727", "0.600334", "0.5973352", "0.59136784", "0.5868815", "0.5804294", "0.58023375", "0.57952565", "0.57601655", "0.5696862", "0.56905687", "0.5690205", "0.5658569", "0.5632546", "0.563241", "0.56156796", "0.5583333...
0.7886286
0
This makes sure that unknown function calls still have their arguments traversed.
def test_callexpression_argument_traversal(): DECLARATIONS = ( 'function foo(x){}', 'var foo = function foo(x){}', 'var foo = (x) => {}', 'var foo = (x) => undefined', ) for declaration in DECLARATIONS: assert not _do_test_raw(""" %s; foo({"bar":funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_args(func):\n args = inspect.getfullargspec(func).args\n if args and is_selfish_name(args[0]):\n del args[0]\n return args", "def ignore(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass", "def needs_arglist(self):\n True", ...
[ "0.61856985", "0.5807541", "0.5802105", "0.57924193", "0.5757364", "0.5753708", "0.5750814", "0.5709718", "0.5687455", "0.5621083", "0.56190723", "0.55581003", "0.5552606", "0.55483025", "0.55393267", "0.5535397", "0.5522945", "0.55209094", "0.5517479", "0.55152714", "0.55129...
0.531404
47
Test that insertAdjacentHTML works the same as innerHTML.
def test_insertAdjacentHTML(): assert not _do_test_raw(""" var x = foo(); x.insertAdjacentHTML("foo bar", "<div></div>"); """).failed() assert _do_test_raw(""" var x = foo(); x.insertAdjacentHTML("foo bar", "<div onclick=\\"foo\\"></div>"); """).failed() # Test without declaration...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_createElement():\n\n assert not _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement();\n x.createElement(\"foo\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n var x = \"foo\";\n x.createElement(\"script\");\n \"\"\").failed()\n\n assert _do_test_raw(\"\"\"\n v...
[ "0.6206021", "0.54315954", "0.5343544", "0.5333806", "0.5289093", "0.52715856", "0.52019536", "0.51820296", "0.5170138", "0.51649594", "0.51338845", "0.5128217", "0.51144373", "0.50881356", "0.506577", "0.5063727", "0.50439453", "0.50368094", "0.50320894", "0.49574444", "0.49...
0.84246767
0
Test that `nsIFile.launch()` is flagged.
def test_nsIFile_launch(): assert _do_test_raw('foo.launch()').failed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fail_launch_file(self):\n args = self.args.copy()\n # Pass a string instead of a list\n args[\"traj_file\"] = \"nofile.xtc\"\n with pytest.raises(FileNotFoundError) as err:\n UI.launch(**args)\n assert \"nofile.xtc does not exist.\" in str(err.value)", "def ...
[ "0.64032733", "0.6122187", "0.5883255", "0.5880068", "0.5665483", "0.5528563", "0.552782", "0.55099374", "0.5467473", "0.5463001", "0.544874", "0.5420529", "0.5306385", "0.5299579", "0.52987474", "0.52926964", "0.52705574", "0.52683437", "0.52574074", "0.5248173", "0.52363783...
0.82881325
0
Test that `.openDialog("")` throws doesn't throw an error for chrome/local URIs.
def test_openDialog_pass(self): self.run_script(""" foo.openDialog("foo") foo.openDialog("chrome://foo/bar") """) self.assert_silent()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_openDialog(self):\n\n def test_uri(self, uri):\n self.setUp()\n self.setup_err()\n self.run_script('foo.openDialog(\"%s\")' % uri)\n self.assert_failed(with_warnings=True)\n\n uris = ['http://foo/bar/',\n 'https://foo/bar/',\n ...
[ "0.6870198", "0.61324924", "0.6001495", "0.5948701", "0.59436876", "0.58810073", "0.56357914", "0.56282413", "0.5534864", "0.5530544", "0.55118865", "0.5507113", "0.5468689", "0.545093", "0.53994143", "0.5359619", "0.5342453", "0.5341253", "0.5336293", "0.5319729", "0.5292852...
0.7835892
0
Test that `.openDialog(bar)` throws doesn't throw an error where `bar` is a dirty object.
def test_openDialog_flag_var(self): self.run_script(""" foo.openDialog(bar) """) self.assert_notices()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_openDialog_pass(self):\n self.run_script(\"\"\"\n foo.openDialog(\"foo\")\n foo.openDialog(\"chrome://foo/bar\")\n \"\"\")\n self.assert_silent()", "def test_openWindowWithWrongSettingsFile(self):\n self.createWrongSettingsFile()\n return self.assertRaise...
[ "0.664462", "0.6096759", "0.5865762", "0.56994104", "0.5670863", "0.5574597", "0.5482802", "0.54300237", "0.5427492", "0.53748256", "0.5308122", "0.52538544", "0.5234245", "0.52235", "0.5222695", "0.52182746", "0.52126163", "0.5170296", "0.516994", "0.51174134", "0.5110923", ...
0.63953465
1
Test that `.openDialog("")` throws an error where is a nonchrome, nonrelative URL.
def test_openDialog(self): def test_uri(self, uri): self.setUp() self.setup_err() self.run_script('foo.openDialog("%s")' % uri) self.assert_failed(with_warnings=True) uris = ['http://foo/bar/', 'https://foo/bar/', 'ftp://f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_openDialog_pass(self):\n self.run_script(\"\"\"\n foo.openDialog(\"foo\")\n foo.openDialog(\"chrome://foo/bar\")\n \"\"\")\n self.assert_silent()", "def error_open_mess(url: str) -> None:\n meta = MainData()\n print(('{0}Can not open URL: {1} {2}{3}').format(meta...
[ "0.76250166", "0.63414615", "0.60822976", "0.5849271", "0.5837435", "0.5826389", "0.57790226", "0.57463026", "0.5706456", "0.5685249", "0.5682213", "0.56506664", "0.56181157", "0.5609045", "0.5588032", "0.55650854", "0.5546954", "0.55328673", "0.5530209", "0.55300903", "0.551...
0.6708838
1
select from mydb.item_item where category='suncare'
def test_categoryQuery(self) -> None: result = self.entries.filter(category__iexact='suncare') self.assertGreater(len(result), 0) result = self.entries.filter(category__iexact='xxxxxx') self.assertEqual(len(result), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oreDbQuery():\n # TODO: Change TABLE name to the Crop Slection table that has not yet been Created :-(\n # TODO: Currently using the old DB for Crop Lookup table\n\n c.execute('SELECT DISTINCT Crop, GrpNo, GrpName, SubGrpNo, SubGrpName, Category FROM CCA')\n\n return c.fetchall()", "def get_items...
[ "0.61683613", "0.59296685", "0.5827819", "0.57827365", "0.5734394", "0.5708885", "0.5661912", "0.5578158", "0.55745226", "0.5478331", "0.53940827", "0.538089", "0.53388613", "0.5329586", "0.53203094", "0.5273206", "0.52608246", "0.52469826", "0.52403355", "0.52397007", "0.522...
0.5704614
6
select name from mydb.item_item where ingredients not like '%multimedia%' and ingredients not like '%provision%'
def test_excludeIngredientQuery(self) -> None: ingredient0 = 'multimedia' ingredient1 = 'provision' result = self.entries.exclude(Q(ingredients__icontains=ingredient0) | Q(ingredients__icontains=ingredient1)) self.assertEqual(988, len(result)) queries = (Q(ingredients__icontains...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n return super(BeefRecipes, self).execute().where(lower(col('ingredients')).like(\"%beef%\"))", "def test_search_by_bad_ingredients(self):\n recipe_id = self.request_mgr.search_by_ingredients(['asdfadsfa'])\n self.assertEqual(recipe_id, None)", "def test_includeIngredien...
[ "0.620481", "0.6070535", "0.5824319", "0.56567574", "0.5471123", "0.540554", "0.54015297", "0.53638273", "0.5333347", "0.53282493", "0.5299963", "0.5287664", "0.52692205", "0.5224078", "0.52074933", "0.5206623", "0.52025026", "0.5187782", "0.5176583", "0.5147688", "0.51246583...
0.6608633
0
select name from mydb.item_item where ingredients like '%multimedia%' and ingredients like '%provision%'
def test_includeIngredientQuery(self) -> None: ingredient0 = 'multimedia' ingredient1 = 'provision' result = self.entries.filter(Q(ingredients__icontains=ingredient0) & Q(ingredients__icontains=ingredient1)) self.assertEqual(1, len(result))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n return super(BeefRecipes, self).execute().where(lower(col('ingredients')).like(\"%beef%\"))", "def search_recipe(ingredients):\n\n params = '+'.join(ingredients.split())\n url_search = SEARCH_URL.format(params)\n response = req.get(url_search)\n\n return response.content",...
[ "0.6647757", "0.6191605", "0.59739184", "0.59232444", "0.5843114", "0.5770647", "0.57508814", "0.57090604", "0.56950915", "0.56343377", "0.55926657", "0.5586077", "0.555635", "0.55286276", "0.5510413", "0.55007166", "0.5458444", "0.5436161", "0.5435352", "0.5406655", "0.54020...
0.63518983
1
This cuts out all values of "arg" from the string!
def cutting(value,arg): return value.replace(arg,'working')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_string(value, arg):\n\n return value.replace(arg, '')", "def cut(value, arg):\n return value.replace(arg, '') # we can replace arg with ''. We also need to register it", "def cut_str(value, arg):\n\n return value.replace(arg,'')", "def parse_args(string):\n return re.findall('[-=][^ ]*', ...
[ "0.71844476", "0.6835684", "0.6774667", "0.67090833", "0.66573966", "0.66573966", "0.6640773", "0.64334327", "0.62785816", "0.624245", "0.62198776", "0.61978364", "0.61978364", "0.61978364", "0.61978364", "0.61978364", "0.6171914", "0.6171914", "0.6155647", "0.6096736", "0.60...
0.55772555
51
Initializes a new state object.
def __init__(self, qpos: Optional[np.ndarray] = None, qvel: Optional[np.ndarray] = None, qacc: Optional[np.ndarray] = None): self.qpos = qpos self.qvel = qvel self.qacc = qacc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n raise NotImplementedError('cannot create independent state')", "def __init__(self, state):\n self.state = state", "def __init__(self, state=State.NORMAL):\n self.state = state", "def __init__(self, init_state):\n self._curr_state = init_state", "def initial...
[ "0.8221085", "0.8184259", "0.81162816", "0.79742545", "0.7853358", "0.77889585", "0.77679455", "0.7708608", "0.7664172", "0.75280225", "0.75117093", "0.7510387", "0.74730545", "0.74558854", "0.74364495", "0.74086964", "0.73885727", "0.73800635", "0.7345474", "0.7326453", "0.7...
0.0
-1
Returns the time (total sum of timesteps) since the last reset.
def time(self) -> float: return self.sim_scene.data.time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTime(self):\n return self.step / (self.max_step + int(self.include))", "def getTime(self) -> float:\n return self.t", "def get(self):\n if self.running:\n return self.accumulated_time + pg.time.get_ticks() - self.start_time\n else:\n return self.accumula...
[ "0.7168588", "0.71211964", "0.70225096", "0.6981281", "0.69380325", "0.69172233", "0.6909712", "0.68915546", "0.6887088", "0.68044907", "0.6802243", "0.6790637", "0.67853886", "0.67688805", "0.6760488", "0.67461056", "0.67229843", "0.6677072", "0.6672788", "0.6668022", "0.666...
0.6420324
42
Processes the configuration for a group.
def _process_group(self, **config_kwargs) -> RobotGroupConfig: return RobotGroupConfig(self.sim_scene, **config_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_group_from_config(self):\n\n group_file_name = \"cicada/config/group.yaml\"\n if os.path.isfile(group_file_name):\n self.group_data = dict()\n with open(group_file_name, 'r') as stream:\n self.group_data = yaml.safe_load(stream)\n self.all_grou...
[ "0.63921624", "0.6276154", "0.5917572", "0.58930755", "0.5878203", "0.5875567", "0.5822448", "0.57812375", "0.57412446", "0.57304585", "0.5726534", "0.57034045", "0.5700766", "0.56856185", "0.5675106", "0.56413394", "0.56358737", "0.5601757", "0.55887634", "0.55571437", "0.55...
0.7236225
0
Runs one timestep of the robot for the given control.
def step(self, control_groups: Dict[str, np.ndarray], denormalize: bool = True): group_controls = [] for group_name, control_values in control_groups.items(): config = self.get_config(group_name) # Ignore if this is a hardware-only group. if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_step(self):\n self.control_instance.run_step()", "def run_single(self):\n self.run_sim_time(1)", "def run(self, T=10, x0=None, control=None):\n\n self.init(control=control, x0=x0)\n \n for i in range(round(T / self.dt)):\n self.step()\n\n # check...
[ "0.6852948", "0.65564185", "0.6438402", "0.6255005", "0.6224126", "0.6203932", "0.6151068", "0.60931796", "0.60704327", "0.60700077", "0.60636765", "0.60082597", "0.5996422", "0.5982675", "0.5972462", "0.5972462", "0.5952304", "0.5924543", "0.5899932", "0.5890532", "0.5871303...
0.0
-1
Moves the robot to the given initial state.
def set_state(self, state_groups: Dict[str, RobotState], **kwargs): group_states = [] for group_name, state in state_groups.items(): config = self.get_config(group_name) # Clip the position and velocity to the configured bounds. clipped_state = RobotState(qpos=state....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, state):\n raise NotImplementedError(\"Need to implement this method\")", "def set_state(self, state):\n if self.state == CHANNEL_MOVE_STATE_NONE:\n self.state = state", "def initial_step(self, state, action):\n next_state = self.state_transition(state, action)\n ...
[ "0.67893064", "0.6242464", "0.6183469", "0.61543345", "0.6112133", "0.6078262", "0.60704833", "0.60522616", "0.59689504", "0.596739", "0.594087", "0.5933569", "0.59301543", "0.5927122", "0.5907014", "0.5901719", "0.58989894", "0.5897002", "0.58676326", "0.58672667", "0.586587...
0.0
-1
Returns the initial states for the given groups.
def get_initial_state( self, groups: Union[str, Sequence[str]], ) -> Union[RobotState, Sequence[RobotState]]: if isinstance(groups, str): configs = [self.get_config(groups)] else: configs = [self.get_config(name) for name in groups] states = []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_initial_states(self):\n raise NotImplementedError()", "def initial_states(self):\n return self._initial_states", "def initial_states(self):\n return list(self.iter_initial_states())", "def states_initial(self):\n return self.states(\"Initial = YES\")", "def _get_group_st...
[ "0.6517598", "0.63916826", "0.61768365", "0.61699396", "0.6043793", "0.59128195", "0.5887704", "0.58768594", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", "0.58085155", ...
0.7757164
0
Returns the states for the given group configurations.
def _get_group_states( self, configs: Sequence[RobotGroupConfig]) -> Sequence[RobotState]: states = [] for config in configs: state = RobotState() # Return a blank state if this is a hardware-only group. if config.qpos_indices is None: stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_states(self):\n raise NotImplementedError()", "def get_states():\n try:\n ''' Returns a list of states in list named result '''\n data = State.select()\n return ListStyle.list(data, request), 200\n except Exception as e:\n abort(500)", "def get_all_states(self):...
[ "0.5906376", "0.587641", "0.58613956", "0.5801155", "0.57883763", "0.57819426", "0.5745295", "0.5735361", "0.5593753", "0.5529911", "0.55296177", "0.54799014", "0.5479514", "0.54587895", "0.5449307", "0.5433292", "0.5427357", "0.5345912", "0.5342106", "0.5340869", "0.5320486"...
0.7487228
0
Sets the robot joints to the given states.
def _set_group_states( self, group_states: Sequence[Tuple[RobotGroupConfig, RobotState]]): for config, state in group_states: if config.qpos_indices is None: continue if state.qpos is not None: self.sim_scene.data.qpos[config.qpos_indices] = st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_joint_states(self, joints: List[str], position: List[float] = None,\n velocity: List[float] = None) -> NoReturn:\n assert all([j in self.joints.names for j in joints]), 'all values of joints must also be in self.joints'\n \n if position is not None:\n ...
[ "0.7340826", "0.6836892", "0.6627433", "0.6219958", "0.6123465", "0.59864044", "0.5968934", "0.59389764", "0.5932464", "0.590818", "0.58539706", "0.5794332", "0.57893485", "0.57693374", "0.57496977", "0.5736451", "0.57093275", "0.56946826", "0.56944317", "0.5574347", "0.55688...
0.51125777
52
Applies the given control values to the robot.
def _perform_timestep( self, group_controls: Sequence[Tuple[RobotGroupConfig, np.ndarray]]): for config, control in group_controls: indices = config.actuator_indices assert len(indices) == len(control) self.sim_scene.data.ctrl[indices] = control ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_controls(self, control_operations: dict):\n control_index = 1\n for id, operations in control_operations.items():\n link = self.pumps[id] if id in self.pumps else self.valves[id] if id in self.valves else self.pipes[id]\n for op in operations:\n epamodule...
[ "0.60483235", "0.5974363", "0.5956806", "0.59566313", "0.5827852", "0.5825056", "0.5769332", "0.5761806", "0.5739416", "0.5700603", "0.5652478", "0.5604202", "0.5581627", "0.5543662", "0.5541567", "0.5541567", "0.5541567", "0.5541567", "0.5541567", "0.5541567", "0.5541567", ...
0.53014547
33
Applies observation noise to the given state.
def _apply_observation_noise(self, state: RobotState, config: RobotGroupConfig): if config.sim_observation_noise is None or self.random_state is None: return # Define the noise calculation. def noise(value_range: np.ndarray): amplitude = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_noise(self):\n self.noise = torch.normal(0.5, .2, self.state.shape).double()\n self.noise *= torch.sqrt(2 *\n self.vars['T']*torch.tensor(self.vars['dt']))", "def apply_noise(self, input):\n mask = np.random.binomial(1, 1-self.noise_prob, len(input)) ...
[ "0.7100496", "0.6829454", "0.6615999", "0.65508354", "0.6535193", "0.65046763", "0.6397168", "0.6329152", "0.6270984", "0.62694496", "0.6267069", "0.6266234", "0.62525165", "0.6244945", "0.6227903", "0.620435", "0.6183446", "0.6166714", "0.61635095", "0.616012", "0.6097126", ...
0.79560375
0
Denormalizes the given action.
def _denormalize_action(self, action: np.ndarray, config: RobotGroupConfig) -> np.ndarray: if config.denormalize_center.shape != action.shape: raise ValueError( 'Action shape ({}) does not match actuator shape: ({})'.format( action.shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_action(self, action):\n low = self.action_space.low\n high = self.action_space.high\n\n scale_factor = (high - low) / 2\n reloc_factor = high - scale_factor\n\n action = (action - reloc_factor) / scale_factor\n action = np.clip(action, -1.0, 1.0)\n\n ret...
[ "0.59685934", "0.5911025", "0.5838376", "0.57880056", "0.5760996", "0.5746722", "0.5595164", "0.5518302", "0.5501854", "0.5424955", "0.53894466", "0.5361105", "0.5326777", "0.5308367", "0.52543795", "0.50769705", "0.503363", "0.5022165", "0.5016263", "0.50093585", "0.50074387...
0.77185875
0
Clips the action using the given configuration.
def _apply_action_bounds(self, action: np.ndarray, config: RobotGroupConfig) -> np.ndarray: if config.control_mode == ControlMode.JOINT_POSITION: # Apply position bounds. if config.qpos_range is not None: action = np.clip(action, config.qpos_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_action_bits(action: LoggingActions, bits: int) -> int:\n\n if LoggingActions.has_action(action, bits):\n return LoggingActions.remove_actions_from_bits([action], bits)\n else:\n return LoggingActions.add_actions_to_bits([action], bits)", "def reverse_action(self, action):\n lo...
[ "0.5486495", "0.5229196", "0.49610138", "0.48103568", "0.48022357", "0.4784404", "0.47646475", "0.4745638", "0.46950883", "0.46798447", "0.46327832", "0.46148506", "0.46142355", "0.46142194", "0.45783988", "0.45724455", "0.4569896", "0.45685962", "0.45600906", "0.45600906", "...
0.0
-1
Create a fragment used to display the XBlock to a student. `context` is a dictionary used to configure the display (unused) Returns a `Fragment` object specifying the HTML, CSS, and JavaScript to display.
def student_view(self, context=None): # pylint: disable=W0613 # Load the HTML fragment from within the package and fill in the template html_str = pkg_resources.resource_string(__name__, "static/html/thumbs.html").decode('utf-8') frag = Fragment...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_view(self, context=None):\n html = self.resource_string(self.html_path)\n fragment = Fragment(html.format(self=self))\n fragment.add_css(self.resource_string(self.css_path))\n fragment.add_javascript(self.resource_string(self.js_path))\n fragment.initialize_js('WhoWhe...
[ "0.803043", "0.7568872", "0.74260396", "0.71374416", "0.7077496", "0.6981609", "0.6979395", "0.69643986", "0.695315", "0.695193", "0.6940515", "0.68856263", "0.6771916", "0.6755776", "0.66533804", "0.6626741", "0.6586341", "0.65374935", "0.6487344", "0.64490306", "0.64487976"...
0.5214808
52
Update the vote count in response to a user action.
def vote(self, data, suffix=''): # pylint: disable=unused-argument # Here is where we would prevent a student from voting twice, but then # we couldn't click more than once in the demo! # # if self.voted: # log.error("cheater!") # return vote...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up_vote(cls, user, message):\r\n pass", "def up_vote(cls, user, message):\n pass", "def relation_upvote(request, pk):\n try:\n relation = Relation.objects.get(pk=pk)\n except Relation.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\n\n if request.metho...
[ "0.7239073", "0.7119304", "0.668565", "0.6511972", "0.6503739", "0.6354325", "0.63113993", "0.6275616", "0.6274778", "0.62731385", "0.62333953", "0.62169063", "0.61895573", "0.61686796", "0.61535746", "0.60905564", "0.6069016", "0.5999043", "0.5989211", "0.5989211", "0.593912...
0.53030753
98
A canned scenario for display in the workbench.
def workbench_scenarios(): return [ ("filethumbs", """\ <vertical_demo> <filethumbs/> <filethumbs/> <filethumbs/> </vertical_demo> """) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workbench_scenarios():\n return [\n (\"Oppia Embedding\",\n \"\"\"<vertical_demo>\n <oppia oppiaid=\"0\" src=\"https://www.oppia.org\" width=\"700\" />\n </vertical_demo>\n \"\"\"),\n ]", "def workbench_scenarios():\n retur...
[ "0.69502115", "0.6878325", "0.687794", "0.68425786", "0.6841508", "0.6824964", "0.6769337", "0.6758825", "0.6684726", "0.6679064", "0.66781527", "0.6648049", "0.6647093", "0.6620656", "0.6456912", "0.64337105", "0.6387073", "0.6322783", "0.63063073", "0.627672", "0.6198262", ...
0.6202967
20
Performs HTTP POST call.
def _request(self, path): url = urllib.parse.urljoin(CONF.gerrit.url, path) request = urllib.request.Request(url) try: sock = urllib.request.urlopen(request) response = sock.read() except Exception: with excutils.save_and_reraise_exception(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_POST(self,):\n self.http_method = 'POST'\n self.response()", "def post(self, *args, **kwargs):\n return self._requests_call(util.requests_post, *args, **kwargs)", "def do_POST(self):\r\n self._send_handler_response('POST')", "def _post(self, *args, **kwargs):\n return se...
[ "0.84838665", "0.82153636", "0.8085671", "0.79459065", "0.78568274", "0.78214186", "0.7749993", "0.77131903", "0.7710755", "0.7684489", "0.76350945", "0.76104945", "0.7589615", "0.75877327", "0.75125647", "0.74714005", "0.7465422", "0.7449667", "0.7407969", "0.7389761", "0.73...
0.0
-1
This validates the post request as a whole and not just a field. During read, the validator practically skips. During post, each orderline unit is validated. If an orderline has more units than available product units, the order is not accepted.
def validate(self, attrs): exception_body = [] for orderline in attrs.get('orderlines', []): product = orderline['product'] # If orderline has less units than available, all good. if orderline['units'] <= product.units: continue # else er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self):\n cleaned_data = super().clean()\n variant = cleaned_data.get('variant')\n quantity = cleaned_data.get('quantity')\n if variant and quantity is not None:\n try:\n variant.check_quantity(quantity)\n except InsufficientStock as e:\n ...
[ "0.5745162", "0.552804", "0.55063504", "0.55063504", "0.5504187", "0.54778343", "0.54469776", "0.5445624", "0.5444358", "0.54384", "0.54326487", "0.5432112", "0.5422848", "0.54169387", "0.5380987", "0.53740376", "0.5372109", "0.5350199", "0.5332469", "0.5322742", "0.5322059",...
0.64973056
0
Runs after validation to create an order and associated orderlines. Prices are not locked as prices can always change despite being accepted. Until the order is confirmed by our agent, the prices are NOT locked in. If an 'accepted' order is shown on UI, the client should show prices from the associated product of an or...
def create(self, validated_data): orderlines = validated_data.pop('orderlines', None) if not (orderlines and len(orderlines)): raise EmptyOrderException # Create order and associated orderlines order = models.Order.objects.create(**validated_data) for orderline in or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, values):\n res = super(PurchaseOrderLine, self).create(values)\n states = ['purchase', 'done']\n if res.order_id.state in states:\n raise UserError(_('You can not create an additional purchase order line in a confirmed order '))\n return res", "def test_05_...
[ "0.65118515", "0.64460814", "0.6433476", "0.6251967", "0.6173412", "0.6157046", "0.6104601", "0.60722667", "0.60429686", "0.59729445", "0.59326535", "0.5884068", "0.58812374", "0.58809453", "0.5860326", "0.58583325", "0.5857815", "0.58318114", "0.5813478", "0.58035976", "0.57...
0.62860453
3
Actual updation of an order to confirmed/cancellation/delivery status happens here. There are only two valid transitions acceptable 1. From accepted to confirmed. 2. From confirmed to cancelled/delivered.
def update(self, instance, validated_data): # If an order is cancelled or delivered, it cannot be modified. if instance.status == CANCELLED or instance.status == DELIVERED: raise exceptions.PermissionDenied('This order cannot be modified.') # If an order is already confirmed but UI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_order(self):\n response = self.api_test_client.put('{}/orders/1'.format(\n self.BASE_URL), json={'order_status': 'accepted'})\n\n self.assertEqual(response.status_code, 201)\n self.assertTrue(\n response_as_json(response)['order']['status_updated_on'])\n ...
[ "0.68926567", "0.6892195", "0.66556543", "0.6604199", "0.64407927", "0.6413585", "0.6380169", "0.6379697", "0.6355502", "0.63130534", "0.63076985", "0.6285451", "0.6273759", "0.613097", "0.6118931", "0.6096293", "0.6087185", "0.60793054", "0.6068147", "0.6027666", "0.6010716"...
0.76192147
0
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SearchResourceShareInvitationReqBody): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Create lr scheduler based on config. note that lr_scheduler must accept a optimizer that has been restored.
def build(optimizer_config, optimizer, total_step): optimizer_type = optimizer_config.WhichOneof('optimizer') if optimizer_type == 'rms_prop_optimizer': config = optimizer_config.rms_prop_optimizer lr_scheduler = _create_learning_rate_scheduler( config.learning_rate, optimizer, total_step=total_step)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_lr_scheduler(\n cfg: CfgNode, optimizer: torch.optim.Optimizer\n) -> torch.optim.lr_scheduler._LRScheduler:\n name = cfg.SOLVER.LR_SCHEDULER_NAME\n if name == \"WarmupMultiStepLR\":\n return WarmupMultiStepLR(\n optimizer,\n cfg.SOLVER.STEPS,\n cfg.SOLVER....
[ "0.8214888", "0.81373125", "0.8030262", "0.7877491", "0.7863203", "0.777814", "0.7759245", "0.76554245", "0.7646608", "0.7585435", "0.748087", "0.74216324", "0.7285573", "0.7153245", "0.7007013", "0.69302773", "0.6923065", "0.6863463", "0.68190587", "0.6761453", "0.6728476", ...
0.81571466
1
Create optimizer learning rate scheduler based on config.
def _create_learning_rate_scheduler(learning_rate_config, optimizer, total_step): lr_scheduler = None learning_rate_type = learning_rate_config.WhichOneof('learning_rate') if learning_rate_type == 'multi_phase': config = learning_rate_config.multi_phase lr_phases = [] mom_phases = [] for phase_cfg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduler_creator(optimizer, config):\n return torch.optim.lr_scheduler.StepLR(optimizer, step_size=5, gamma=0.9)", "def build(optimizer_config, optimizer, total_step):\n optimizer_type = optimizer_config.WhichOneof('optimizer')\n\n if optimizer_type == 'rms_prop_optimizer':\n config = optimizer_conf...
[ "0.8004487", "0.7996875", "0.79782903", "0.7639045", "0.73738545", "0.7332055", "0.7301991", "0.7300177", "0.7256197", "0.7231383", "0.71939045", "0.7167134", "0.7102816", "0.7095163", "0.7091584", "0.7080664", "0.70553064", "0.69863945", "0.69457966", "0.69298434", "0.692465...
0.75770074
4
Update the display_name or display_description for this osd.
def update(self, **kwargs): self.manager.update(self, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateDisplay(self, msg):\n t = msg.data\n self.displayLbl.SetLabel(\"%s\" % t)\n self.SetTitle(\"%s\" % t)", "def device_display_name(self, device_display_name):\n\n self._device_display_name = device_display_name", "def display_name(self, display_name):\n self._display_...
[ "0.63896036", "0.6336821", "0.6326636", "0.6326636", "0.6326636", "0.6326636", "0.6326636", "0.6326636", "0.6314018", "0.6314018", "0.6314018", "0.6314018", "0.6314018", "0.6314018", "0.62420577", "0.6225104", "0.61178285", "0.6005843", "0.5882068", "0.58664495", "0.58609277"...
0.0
-1
Delete the specified osd ignoring its current state.
def force_delete(self): self.manager.force_delete(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, purge, timeout, force):\n # Set the CRUSH weight to 0.\n hookenv.log('Reweighting OSD', hookenv.DEBUG)\n reweight_osd(self.osd_id)\n\n # Ensure that the OSD is safe to stop and destroy.\n end = (datetime.datetime.now() +\n datetime.timedelta(seconds...
[ "0.58212245", "0.5652357", "0.5631923", "0.56308943", "0.561431", "0.55853283", "0.5472813", "0.5385417", "0.5382336", "0.5376866", "0.5364507", "0.5355651", "0.535345", "0.53411007", "0.5332679", "0.5301693", "0.5286166", "0.5260226", "0.52445686", "0.52367926", "0.5229653",...
0.0
-1
Get a list of all osds.
def list(self, detailed=False, search_opts=None, paginate_opts=None): if search_opts is None: search_opts = {} if paginate_opts is None: paginate_opts = {} qparams = {} for opt, val in search_opts.iteritems(): if val: qparams[opt] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(self):\n return self.__repository.get_all()", "def list(self):\n return self._list(self._path())", "def list(self):\n return self.connection.get(self.service)", "def list(self):\n return self._get_list()", "def getAll(self):\n return self.__lst", "def getLi...
[ "0.6780782", "0.6703935", "0.66433823", "0.6626435", "0.65891266", "0.6533394", "0.6533394", "0.65089464", "0.6494575", "0.64734656", "0.64625776", "0.6453494", "0.644844", "0.6447506", "0.64162856", "0.6404984", "0.6335044", "0.63190335", "0.6300186", "0.62992346", "0.629622...
0.62678444
24