query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Send JSON message to bot.
def send_json_message_to_bot(message: dict): requests.post(config.BOT_URL, json=message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_json(self, data):\n return self.sendMessage(json.dumps(data).encode(\"utf-8\"))", "async def _sendjson(self, deviceid, message):\n\n try:\n params = json.loads(message.replace(\"'\",'\"'))\n payload = {}\n payload['action'] = 'update'\n payload[...
[ "0.8157835", "0.74844956", "0.7446224", "0.74032104", "0.7104426", "0.70463616", "0.7027255", "0.6956269", "0.69444907", "0.693412", "0.6928009", "0.6874159", "0.6848447", "0.6821482", "0.67961335", "0.67788446", "0.67593426", "0.6758233", "0.6726049", "0.67169255", "0.671338...
0.81353354
1
Start the room enter scenario.
def start_entered_scenario(camera_serial: str): global ENTER_EVENT_TRIGGERED, RECORDING_EVENT_TRIGGERED if ENTER_EVENT_ENABLED: if not ENTER_EVENT_TRIGGERED: # Set the trigger ENTER_EVENT_TRIGGERED = True related_meeting_data = get_person_meeting_from_camera(camera_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter(self, env):\n env = self._find_env(env, new=True)\n env.add_agents(self)", "def on_pre_enter(self):\n self.setup()\n self.start()", "def enter():\n pass", "def enter_exam_room(self, entry_time):\n self.state = DoctorState.IN_PATIENT_EXAM_ROOM\n s...
[ "0.6225163", "0.61829996", "0.60941166", "0.6021055", "0.600246", "0.5958339", "0.5880122", "0.5865989", "0.58430576", "0.58415574", "0.5835738", "0.58195513", "0.5729451", "0.5726484", "0.5711812", "0.5705859", "0.5703056", "0.5703056", "0.5697736", "0.56970465", "0.56851804...
0.6843294
0
Test message send to the T10 using a hardcoded device.
def test_t10_message(): send_json_message_to_t10("10.89.130.68", "cisco", "cisco", request.get_json()) return "ok"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_communication(self):\n\n self._serial_handler.tx_queue.put((0,b'testing\\n'))\n self._serial_handler._write()\n\n time.sleep(0.1) # Simulate real physical connection\n\n self._serial_handler._read() # Should get whatever was sent and put it on the rx_queue\n message = se...
[ "0.6542711", "0.6530367", "0.64198023", "0.64102006", "0.64058506", "0.63469845", "0.6282157", "0.6230593", "0.62144583", "0.61659074", "0.61659074", "0.61320263", "0.61084795", "0.61050886", "0.61050886", "0.60905254", "0.60530496", "0.60508513", "0.60467476", "0.60309225", ...
0.76748866
0
Test the "too far" scenario.
def test_too_far_scenario(): start_too_far_scenario(config.MERAKI_CAMERAS[0]["serial"]) time.sleep(WARN_EVENT_THRESHOLD) start_too_far_scenario(config.MERAKI_CAMERAS[0]["serial"]) return "ok"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_01(self):\n if True:\n self.fail()", "def test_long_run_case_that_we_want_to_skip():\n time.sleep(30)\n assert 0", "def test_does_not_die(self):\n self.herb.fitness = 1\n nt.assert_false(self.herb.death())", "def test_return_goal_actual_weight_is_too_low(se...
[ "0.64584464", "0.6423838", "0.6304726", "0.62863934", "0.62421024", "0.6196889", "0.6177566", "0.61613077", "0.61424774", "0.6135788", "0.61356604", "0.6124425", "0.60465646", "0.6043048", "0.6029514", "0.59757197", "0.5973856", "0.5969114", "0.5948488", "0.5946179", "0.59390...
0.67676914
0
Test the bot message.
def test_bot_message(): send_json_message_to_bot(request.get_json()) return "ok"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_user():", "def test_im_chat_messages(self):\n pass", "def test_say(self):\n self.client.say(\"thechannel\", \"the message\")\n self.assertEqual(self.client.lines, [\"PRIVMSG #thechannel :the message\"])", "async def testsay(self, ctx, *, message):\n await ctx.send...
[ "0.7722121", "0.7584594", "0.75813186", "0.7509312", "0.74990076", "0.74154633", "0.73647", "0.72707736", "0.7200678", "0.7151783", "0.69574857", "0.6943827", "0.69241965", "0.6833125", "0.6822243", "0.6812864", "0.6770344", "0.6743081", "0.6742397", "0.6736317", "0.6707357",...
0.7850913
0
Breaks down locator details to pattern and sensitivity
def _parse_locator(self, locator): if not ".png" in locator: pattern = locator sensitivity = None elif ".png" in locator: if not locator.endswith('.png'): locator_parts = locator.partition('=') if len(locator_parts[1]) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_pattern(self, locator):\n assert locator is not None and len(locator) > 0\n locator = locator.strip().lower()\n (pattern, sensitivity) = self._parse_locator(locator)\n\n if (sensitivity != None):\n sensitivity = float(sensitivity)\n pattern = Pattern(patt...
[ "0.57167387", "0.5086936", "0.50742686", "0.5012485", "0.49584556", "0.4907223", "0.48538217", "0.4822575", "0.48194072", "0.4798109", "0.47691458", "0.47607014", "0.4728942", "0.47222027", "0.47165644", "0.47142112", "0.47115433", "0.47051197", "0.46986005", "0.4696172", "0....
0.640897
0
Breaks down scroll details to scroll direction and scroll steps
def _parse_scroll_details(self, scroll): assert scroll is not None and len(scroll) > 0 scroll = scroll.lower() scroll_parts = scroll.partition('=') if len(scroll_parts[1]) > 0: scroll_direction = scroll_parts[0].strip() scroll_steps = int(scroll_parts[2].strip()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __navigate_scroll(self):\n try:\n _title = self.browser.title\n _body = self.browser.find_element_by_tag_name('body')\n\n i = 0\n while i < 3:\n _html = str(self.browser.page_source)\n _content = Content(_html, _title)\n ...
[ "0.6233716", "0.60394293", "0.5952445", "0.5914971", "0.58679223", "0.58648163", "0.5825444", "0.57344365", "0.57089955", "0.5693185", "0.5679035", "0.5644303", "0.5634115", "0.5632863", "0.56320226", "0.5610666", "0.5574927", "0.55665654", "0.5554274", "0.5525112", "0.551339...
0.6904732
0
Move along a sine wave around the structure P times with amplitude A Note that when used with shape this will never terminate unless your start row is near the top (which is not ideal)
def move_along_horizontal_sine_wave(shape, period=2, amplitude=5, **kwargs): shape.curr_col += 1 shape.curr_row = int(math.sin(shape.curr_col*2*np.pi/(STATE.layout.columns/period))*amplitude+.5)+shape.start_row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sinefunc(t, P, amp=1.0, phase=0.0, offset=0.0):\n return np.abs(amp) * np.sin(2*np.pi*t/P + 2*np.pi*phase/P ) + offset", "def sinwave(scene):\n # create an empty homogeneous transformation\n matrix = np.eye(4)\n # set Y as cos of time\n matrix[1][3] = np.cos(time.time()) * 2\n # set Z as si...
[ "0.6085118", "0.579322", "0.5745879", "0.5612391", "0.5355833", "0.53422123", "0.5332657", "0.5329603", "0.5326877", "0.53013176", "0.5282532", "0.5275713", "0.5259223", "0.52569646", "0.52524805", "0.52356255", "0.520783", "0.51946", "0.51909566", "0.5180724", "0.5166949", ...
0.7129515
0
Create an upward triangle with a central point. The "center" of of the indicies is the bottommiddle of the triangle
def _upward_triangle_indicies(height=3): return [(height-r,c) for r in range(height) for c in range(-abs(r),abs(r)+1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_equilateral_triangle_around_point(\n center_point: Coordinate, altitude: Decimal = TRIANGLE_ALTITUDE\n) -> Tuple[Coordinate, Coordinate, Coordinate]:\n # This is how you math I guess?\n side_length = 2 * altitude / Decimal(sqrt(3))\n\n ay = center_point.y + altitude / 2\n ax = center_p...
[ "0.62415767", "0.60697186", "0.5983894", "0.59038526", "0.58789426", "0.5878132", "0.5837039", "0.5795896", "0.5787857", "0.57716006", "0.573296", "0.5716611", "0.56996155", "0.56944036", "0.56332344", "0.56199664", "0.55856735", "0.55378634", "0.5525233", "0.55224067", "0.55...
0.67380613
0
Create a hexidiamond (or diamond is height/width are equal. This shape was a happy accident so don't expect much
def _hex_diamond_thing_indicies(half_height=3, half_width=3): return _populate_quadrants([(r,c) for r in range(half_height) for c in range(half_width) if r+c < (half_width+half_height)/2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_diamond(display, coord, box_size, color, bg_color):\n half = int(box_size * 0.5)\n left, top = coord\n vertices = [\n (left + half, top),\n (left + box_size - 1, top + half),\n (left + half, top + box_size - 1),\n (left, top + half),\n ]\n pygame.draw.polygon(dis...
[ "0.7066721", "0.6805806", "0.67862946", "0.66706693", "0.64788544", "0.64521927", "0.6407428", "0.624812", "0.6217451", "0.62144434", "0.5936698", "0.5846795", "0.5817965", "0.5814759", "0.5698248", "0.5693905", "0.5652124", "0.5579387", "0.5560653", "0.55368376", "0.55243635...
0.7205246
0
Get a pb instance from the config.
def get_pb(cls): if cls.pb_singleton is None: # Init the config by reading conf file. with open(gflags.FLAGS.conf, 'r') as conf_file: cls.pb_singleton = text_format.Merge(conf_file.read(), config_pb2.Config()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance(cls):\n\n if not cls._instance:\n cls._instance = Config()\n\n return cls._instance", "def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance", "def get_config() -> Optional[C...
[ "0.61414784", "0.6062606", "0.57294023", "0.57033986", "0.57033986", "0.5687849", "0.5682233", "0.55206746", "0.55115753", "0.5506902", "0.5470777", "0.5435427", "0.5435427", "0.54308707", "0.5418612", "0.54126674", "0.5409956", "0.53776026", "0.53776026", "0.5318656", "0.529...
0.7611659
0
Get Hardware config by name.
def get_hardware(cls, hardware_name): if cls.hardware_dict is None: # Init the hardware_dict once. cls.hardware_dict = {hw.name: hw for hw in cls.get_pb().hardware} return cls.hardware_dict.get(hardware_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self, name):\n return self.configs[name][0]", "def get_hardware(hardware_name: str) -> str:\n fixed_name = \"-\".join(hardware_name.lower().split())\n output = _get_content(fixed_name, \"hardware\")\n\n return output", "def get_config_by_name(name):\r\n attrs = get_config_attr...
[ "0.7273563", "0.6949016", "0.6795559", "0.6699866", "0.6644472", "0.6507191", "0.6492922", "0.6463077", "0.6353336", "0.63133997", "0.63029104", "0.6268669", "0.61993456", "0.6184893", "0.6178793", "0.61781013", "0.6147628", "0.61401814", "0.6126569", "0.61248326", "0.5959862...
0.7445519
0
Get realpath from a path string in config. Starting with '/' indicates an absolute path, otherwise it will be taken as a relative path of the Apollo root.
def get_realpath(cls, path_str): if path_str.startswith('/'): return path_str return os.path.abspath(os.path.join(cls.apollo_root, path_str))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def realpath(path: str) -> str:\n pass", "def realpath(path):\n\n if path.startswith('//'):\n path = bpy.path.abspath(path)\n else:\n path = os.path.realpath(path)\n\n path = path.replace('\\\\', '/')\n path = os.path.realpath(path)\n\n return path", "def realpath(self, path):\n ...
[ "0.77301323", "0.75936407", "0.74692786", "0.72557855", "0.72251844", "0.70825744", "0.70761037", "0.70343393", "0.6972751", "0.68626493", "0.6804119", "0.6591446", "0.65749484", "0.6556271", "0.65054965", "0.64656866", "0.6438085", "0.63194704", "0.63104266", "0.6278452", "0...
0.8214451
0
Increase the priority of the process by 1.
def increase_priority(self): if self._priority > 0: self._priority -= 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpriority(self, pid=None, priority=5):\n\t \n\t import win32api,win32process,win32con\n\t \n\t priorityclasses = [win32process.IDLE_PRIORITY_CLASS,\n\t win32process.BELOW_NORMAL_PRIORITY_CLASS,\n\t win32process.NORMAL_PRIORITY_CLASS,\n\t ...
[ "0.75190824", "0.738303", "0.73639184", "0.72307944", "0.69335985", "0.68952274", "0.689241", "0.66746044", "0.65766627", "0.6558075", "0.6521801", "0.6405231", "0.6405231", "0.6405231", "0.6393191", "0.635353", "0.6293825", "0.62364954", "0.6200966", "0.61457556", "0.6068769...
0.809105
0
Decrease the priority of the process by 1.
def decrease_priority(self): self._priority += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increase_priority(self):\n if self._priority > 0:\n self._priority -= 1", "def delete_and_update_priority(self):\r\n for pbi in PBI.objects.filter(priority__gt=self.priority, project=self.project):\r\n pbi.priority -= 1\r\n pbi.save()\r\n\r\n self.delete(...
[ "0.71922547", "0.66789985", "0.6409615", "0.6306493", "0.6098044", "0.6078284", "0.59733015", "0.5926074", "0.5925828", "0.5851369", "0.5711457", "0.5708569", "0.5705617", "0.569331", "0.5640073", "0.56041205", "0.56020963", "0.5599344", "0.5587728", "0.5577843", "0.5575249",...
0.85394126
0
Return True if the process has IO operations, otherwise False.
def has_io(self): return self._io
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_output(self):\n status = self.is_running()\n self.write_queued_output()\n return status", "def check_command(self):\n return self.process is not None and self.process.poll() is None", "def UseOnlyOverlappedIO(self) -> bool:", "def _proc_is_alive(self):\n if self._pr...
[ "0.6728006", "0.6674621", "0.65899", "0.6285053", "0.62166375", "0.61981267", "0.61932373", "0.6167294", "0.61512375", "0.6086169", "0.6078449", "0.6056482", "0.6051593", "0.6046538", "0.60356563", "0.60111934", "0.59875995", "0.59768844", "0.59502465", "0.59484607", "0.59436...
0.73616487
0
Execute the process and update the execution time.
def execute(self, time): self._exec_time -= time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(cls, **inputs):\n instance = cls(**inputs)\n if hasattr(instance, \"process\"):\n time_start = time.time()\n result = instance.process()\n instance.runtime = time.time() - time_start\n return result\n if hasattr(instance, \"post_process\"...
[ "0.66147035", "0.64833766", "0.63807505", "0.62302387", "0.6222028", "0.62132627", "0.62011343", "0.6161882", "0.6153423", "0.6152858", "0.61500686", "0.61018723", "0.60865843", "0.6053449", "0.59204805", "0.59158033", "0.58738226", "0.586818", "0.5833741", "0.5781091", "0.57...
0.6863703
0
rcf.get( 'my.value' [,default=None] ) Return element 'key' from the dictionairy. If the element is not present but a default is specified, than return the default value. If 'verbose' is set to True, then print debug messages to the logging about which values is returned for the given key. The option argument 'totype' d...
def get(self, key, totype='', default=None, verbose=False) : # element found ? if self.values.has_key(key) : # copy value: value = self.values[key] # convert ? if totype == 'bool' : # convert to boolean: if value in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key, default=None):", "def get(self, key, default=None):\n def find(found_item, _):\n \"\"\" This is the closer function which will be passed to find by key function , if key found than return the value \n otherwise return blanck\"\"\"\n if found_item:\n ...
[ "0.64534926", "0.6251469", "0.60194284", "0.5991601", "0.59772664", "0.59666896", "0.5960963", "0.59091663", "0.58856887", "0.58582264", "0.58386767", "0.57904947", "0.5755614", "0.57369614", "0.5693632", "0.56652397", "0.56638163", "0.56469303", "0.5636939", "0.56364596", "0...
0.7533211
0
Return a line with all '${..}' parts replaced by the corresponding rcfile values. The 2item tupple (mark1,mark2) could be used to redefine the default
def substitute(self, line, marks=('${', '}')) : # ensure that common marks are evaluated correctly: start_mark = marks[0].replace('{', '\{').replace('<', '\<').replace('$', '\$') close_mark = marks[1].replace('}', '\}').replace('>', '\>') # set syntax of keywords to be matched,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_replacer(config,change_this_line,key):\n for arg in config['HyperParameter'][key]: \n pattern=r'{}[ ]*=.*,'.format(arg)\n replace_value=config['HyperParameter'][key][arg][counter]\n if type(replace_value) is str:\n replace_value=\"'\"+replace_value+\"'\"\n change_...
[ "0.5997842", "0.5653259", "0.55641407", "0.5496313", "0.549261", "0.5427544", "0.54236406", "0.5406687", "0.5236979", "0.5196354", "0.50934047", "0.5075184", "0.5054109", "0.5053191", "0.50487894", "0.5033384", "0.5020895", "0.49910378", "0.4947748", "0.49393365", "0.49321803...
0.64586604
0
This method reads an rcfile by making an instance of the RcFile class, and then returns the dictionary of values only. This makes it backwards compatible with older implementations of the rc.py module
def read(rcfilename, silent=False) : rcdict = RcFile(rcfilename, silent=silent) return rcdict.values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadrc():\n from os.path import expanduser, exists\n kw = {}\n rcfile = expanduser(\"~/.otterrc\")\n if exists(rcfile):\n for l in open(rcfile):\n if l and l[0] == '#':\n continue\n l = l.strip()\n k, v = l.split('=', 1)\n kw[k] = v\...
[ "0.64410394", "0.63989705", "0.6235341", "0.61783165", "0.6018567", "0.6015222", "0.598155", "0.5962859", "0.58766705", "0.58535343", "0.5832061", "0.58206147", "0.5808365", "0.5783165", "0.5765665", "0.57173103", "0.5667324", "0.5649408", "0.5646103", "0.5645754", "0.5628989...
0.7766227
0
This method writes an rcfile dictionary. This makes it backwards compatible with older implementations of the rc.py module
def write(filename, rcdict) : # open file for writing: f = open(filename, 'w') # loop over key/value pairs: for k, v in rcdict.items(): # add line; at least the specified number of characters # is used for the key: f.write('%-20s:%s\n' % (k, v)) #endfor # close file: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_reviewboardrc(\n self,\n config: Union[str, Dict[str, object]] = {},\n *,\n parent_dir: Optional[str] = None,\n filename: str = '.reviewboardrc',\n ) -> str:\n if not parent_dir:\n parent_dir = os.getcwd()\n\n if not os.path.exists(parent_dir...
[ "0.58933717", "0.58280134", "0.57708037", "0.5677671", "0.56567436", "0.564652", "0.5606423", "0.5561287", "0.54439956", "0.54399455", "0.5397927", "0.5380859", "0.5378976", "0.5362301", "0.53517056", "0.5332659", "0.5321802", "0.5288789", "0.5269314", "0.5253592", "0.5247000...
0.7306515
0
return the integer which is one larger than the order number of the last fixed task
def getNextFixOrderNum(cur,vID): orderNum = execute_query(cur, """SELECT Count(*) FROM OpenTasks where vID = ? and fixTask = 1""", [vID])[0][0] orderNum = int(orderNum) + 1 return orderNum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_order_number_used():\n return Order.__last_order_number_used", "def max_known_number(self):\n return len(self.number_list)-1", "def getNextOrderNum(cur,vID):\n orderNum = execute_query(cur,\"\"\"SELECT Count(*) FROM OpenTasks where vID = ?\"\"\", [vID])[0][0]\n orderNum = int(o...
[ "0.6763644", "0.668508", "0.6189763", "0.6137287", "0.60284483", "0.5992221", "0.5902313", "0.58949655", "0.5890844", "0.58760947", "0.58221585", "0.5820193", "0.58144027", "0.5802588", "0.57986987", "0.5775288", "0.5750009", "0.57490426", "0.574343", "0.5732985", "0.5724948"...
0.7093612
0
Increment later tasks' order number by 1, orderNum is the order of the inserted task should be called before inserting the task
def fixOrderBeforeInsert(cur,vID,orderNum): cur.execute("""UPDATE OpenTasks SET orderNum = orderNum + 1 WHERE vID = ? and orderNum >= ?""",[vID, orderNum])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_task(self):\n self.task_index = self.task_index + 1", "def set_task_order(self, order):\n for task in self.tasks:\n task.order = order", "def update_item_orders(begin_order, t_task, projects, api, cmd_count):\n for task in t_tasks.values():\n if is_in_the_same_proj(t...
[ "0.67876685", "0.6770982", "0.65684867", "0.6393463", "0.6246073", "0.623554", "0.623554", "0.6102943", "0.60974747", "0.59860617", "0.59690464", "0.5954019", "0.5953115", "0.5820547", "0.5777761", "0.57628953", "0.57628953", "0.56956476", "0.56843513", "0.56710744", "0.56121...
0.7882594
0
Calculates sum of priority of misplaced items
def part_one(rucksacks: list) -> int: summ = 0 for rucksack in rucksacks: split_point = len(rucksack) // 2 first = set(rucksack[:split_point]) second = set(rucksack[split_point:]) misplaced_item = list(first.intersection(second))[0] summ += PRIORITY.get(misplaced_item, 0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minus_priority(self):\n #return (-self.size, self.vec, self.score) # kinda \"depth-first\"\n #return (self.vec, self.score, -self.size) # kinda \"breadth-first\"\n return (self.score, -self.size, self.vec) # kinda \"depth-first with back-tracking\"", "def _total_priority(self):\n r...
[ "0.613023", "0.6108493", "0.60942686", "0.60910505", "0.59696794", "0.59104174", "0.58975667", "0.5897182", "0.5833252", "0.56657416", "0.5659038", "0.56554574", "0.5651261", "0.55769664", "0.55510724", "0.55481315", "0.55368197", "0.5523055", "0.55020446", "0.5475016", "0.54...
0.6242036
0
Searches common item (badge) within group of 3 and calculates sum of priority for all such items
def part_two(rucksacks: list) -> int: summ = 0 for i in range(0, len(rucksacks), 3): first_group = set(rucksacks[i]) second_group = set(rucksacks[i + 1]) third_group = set(rucksacks[i + 2]) badge = first_group.intersection(second_group).intersection(third_group) badge = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(priority_list, totalItemCount, itemUsageDict, threshold):\n scored = list()\n for item in priority_list:\n scored.append((item, itemUsageDict[item][\"winRatio\"] * (itemUsageDict[item][\"totalCount\"]/ totalItemCount) * threshold))\n return scored", "def _greedy_packing(items: List[Item...
[ "0.6211346", "0.58101124", "0.56715894", "0.5624766", "0.5603909", "0.5542294", "0.53215784", "0.5319817", "0.5294602", "0.5222445", "0.5195872", "0.5186559", "0.51640636", "0.5154687", "0.51292366", "0.5124628", "0.5111832", "0.5103564", "0.5078185", "0.5065282", "0.5052656"...
0.6571525
0
Labels trip segments by likely mode of travel. Labels are "chilling" if traveler is stationary, "walking" if slow, "driving" if fast, and "bogus" if too fast to be real.
def label_modes(trip_list, silent=True): if silent == False: print('Preparing to label modes of travel for ' \ + str(len(trip_list)) + ' trips.') loop_counter = 0 loop_size = len(trip_list) for doc in trip_list: if silent == False: loop_counter = loop_counter ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _label_rider_by_trip_frequency(self, rider):\n if rider['total_num_trips'] <= 5*self.duration:\n label = 0\n elif rider['total_num_trips'] <= 20*self.duration:\n label = 1\n elif rider['total_num_trips'] > 20*self.duration:\n label = 2\n else:\n ...
[ "0.6683314", "0.5794343", "0.57204336", "0.5663418", "0.54465616", "0.540998", "0.53342205", "0.5294559", "0.5294559", "0.5294559", "0.5272785", "0.526113", "0.52575165", "0.52496135", "0.5243312", "0.52420646", "0.5240937", "0.52082247", "0.5200447", "0.5184323", "0.51811284...
0.63868463
1
Retrieve one modulation mask for all kids.
def mod_mask(self): # Check the *_masq values self.__log.debug("Checking the *_masq arrays") # Retrieve the kid boxes masq_names = np.unique(["{}_masq".format(item[1]) for item in self.list_detector]) self.__check_attributes(masq_names, read_missing=False) # Check that th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mask(self, h, k):\n return self.mask[(self.h==h)&(self.k==k)]", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask_id(self):\n m = 2 * self.mask...
[ "0.62485987", "0.600278", "0.600278", "0.600278", "0.600278", "0.59038883", "0.58914554", "0.58771306", "0.58382463", "0.58314395", "0.58291423", "0.5816771", "0.5796399", "0.5791533", "0.5784373", "0.5745093", "0.5737748", "0.5737748", "0.5713765", "0.56971776", "0.5696885",...
0.6057825
1
Read raw data. Also read the calibrated data in the cache file if present. Notes The different Kiss telescope positions are also handled
def read_data(self, *args, cache=False, array=np.array, **kwargs): super().read_data(*args, cache=cache, array=array, **kwargs) if cache and self._cache is not None: self.__log.info("Reading cached data :") datas = [] for data in ["calib"]: datas.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_calibration_data(self):\n #Declare global variables.\n global calDig_T1\n global calDig_T2\n global calDig_T3\n global calDig_P1\n global calDig_P2\n global calDig_P3\n global calDig_P4\n global calDig_P5\n global calDig_P6\n gl...
[ "0.6597639", "0.6477725", "0.636037", "0.63598573", "0.628827", "0.62297404", "0.6228401", "0.62251353", "0.6199615", "0.6101772", "0.6099161", "0.60946184", "0.6057053", "0.6055482", "0.60491145", "0.60060436", "0.5973747", "0.5915173", "0.5907625", "0.5891119", "0.5857807",...
0.6502552
1
Save this measurement to the database.
def save (self) : try: # This opens and closes the connections to the database. # Since writings occur only every 10 minutes it wouldn't be efficient to # let the connection open. db = MySQLdb.connect( host=config.db_host, db=config.db_name, user=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n raise NotImplementedError", "def save(self):\n raise NotImplementedError", "def save(self):\n raise NotImplementedError", "def save(self):\n\n pass", "def save(self) -> None:\n pass", "def save(self) -> None:\n pass", "def save(self) -> None:\...
[ "0.70428246", "0.70428246", "0.70428246", "0.69544524", "0.6933446", "0.6933446", "0.6933446", "0.6923404", "0.6907648", "0.6900205", "0.6877056", "0.68489957", "0.6845812", "0.6827726", "0.6827726", "0.6827726", "0.6827726", "0.6827726", "0.6798161", "0.6755691", "0.674851",...
0.73555917
0
Create a door entity in map. If no coordinates are given, pick a random (x, y) from room walls. If any of the room walls are against the map border, make sure that door cannot be placed there.
def create_door(self, room=None, status="open", tile=None, name="door", color=None, random=False, x=None, y=None): walls = room.get_walls() if random: door_seed = randint(0, len(room.get_walls()) - 1) while walls[door_seed][0] == 1 or walls[door_seed][0] == room.w - 1 or walls[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_room(room):\n global map\n for x in range(room.x1+1, room.x2):\n for y in range(room.y1+1, room.y2):\n map[x][y].blocked = False\n map[x][y].block_sight = False", "def create(self):\n\t\t# Pick a random starting position not on the parameter\n\t\tx = random.randint(1...
[ "0.65702087", "0.64936954", "0.64772934", "0.61564773", "0.6066264", "0.5991652", "0.59913564", "0.59820735", "0.5963644", "0.5950242", "0.59451026", "0.5929143", "0.59172434", "0.58972824", "0.58554417", "0.58528894", "0.5851147", "0.58323514", "0.57961446", "0.57167244", "0...
0.74560183
0
Check the availability of the given car to be rented in the provided time period car The availability of this car is verified start, end The time span. The car is available if it is not rented in this time span Return True if the car is available, False otherwise
def isCarAvailable(self, car, start, end): rentals = self.filterRentals(None, car) for rent in rentals: if start > rent.end or end < rent.start: continue return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_availability(car):\n plate_num = int(car.plate[-1]) # Get the last number of the plate\n date = car.date # Get the date \n weekday = (date.weekday() + 1)*2 # Get the number of the week day\n time = date.time() # Get the time \n restricted = [(weekday-1) , weekday % 10] # Create an interva...
[ "0.74762523", "0.72714204", "0.6433187", "0.6268924", "0.6050666", "0.5963115", "0.59383965", "0.59198993", "0.58526516", "0.5742015", "0.5701476", "0.5678647", "0.5672865", "0.56615305", "0.5639994", "0.56220275", "0.56133354", "0.5568478", "0.5555473", "0.55534595", "0.5498...
0.7850646
0
Return a list of rentals performed by the provided client for the provided car client The client performing the rental. None means all clients cars The rented car. None means all cars
def filterRentals(self, client, car): result = [] for rental in self.__repository.getAll(): if client != None and rental.client != client: continue if car != None and rental.car != car: continue result.append(rental) return resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clients_sorted_by_rentals(self):\n rentals = self.get_list()\n number_of_rented_movies = dict.fromkeys([rental.client for rental in rentals], 0)\n for rental in rentals:\n number_of_rented_movies[rental.client] += 1\n items = sorted(number_of_rented_movies.items(), key = ...
[ "0.60510564", "0.57855946", "0.57267207", "0.5495068", "0.5456945", "0.5285654", "0.52423316", "0.52244574", "0.5095199", "0.5042458", "0.5001045", "0.48717806", "0.48693237", "0.48531705", "0.4853079", "0.4828688", "0.48279813", "0.48155066", "0.47878057", "0.47713622", "0.4...
0.7709649
0
Simple match and replace of string within request
def ip_match_replace(request, injectionstring): newrequest = copy.deepcopy(request) rawrequest = request.get_raw_request() for r in INJECT_MATCH_REPLACE: regex = re.compile(r) if regex.search(rawrequest): LOG.tamper("IP detected! Replaced with {}".format(injectionstring)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FillForm(string_for_substitution, dictionary_of_vars):\n return_string = string_for_substitution\n for i in re.findall(\"//%%(.*)%%//\", string_for_substitution):\n return_string = re.sub(\"//%%\" + i + \"%%//\", dictionary_of_vars[i],\n return_string)\n return return_string", ...
[ "0.6405884", "0.6129814", "0.60701466", "0.6006177", "0.5986332", "0.5944586", "0.59011203", "0.5892035", "0.5869508", "0.58229357", "0.5802855", "0.5774343", "0.57707906", "0.57680464", "0.5750596", "0.5736021", "0.57268953", "0.56956047", "0.56938297", "0.5669029", "0.56484...
0.6794092
0
Generates a list of new requests with replaced/modified post parameters
def inject_post_param(request, injectionstring): requests = [] return requests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_requests(rf):\n post_url = '/docs/modify/'\n request_succ = [{\n \"request\": gen_request(rf, post_url, {\n \"user_id\": 1,\n \"type\": \"fetch\",\n \"document_id\": 1,\n }),\n \"response\": {\n \"code\": 200,\n }\n },\...
[ "0.6704369", "0.64402634", "0.6109998", "0.6028123", "0.58909523", "0.5875955", "0.58750314", "0.5556154", "0.55441815", "0.554336", "0.5475512", "0.54604536", "0.5455437", "0.5452279", "0.54406506", "0.54406506", "0.53951675", "0.538495", "0.538451", "0.53750795", "0.5369305...
0.64869267
1
Solves a quadratic program related to a given qubit operator.
def get_classical_solver_result(qubit_operator, offset): qp = QuadraticProgram() qp.from_ising(qubit_operator, offset) exact = MinimumEigenOptimizer(NumPyMinimumEigensolver()) return exact.solve(qp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diop_quadratic(eq, param=symbols(\"t\", integer=True)):\n var, coeff, diop_type = classify_diop(eq, _dict=False)\n\n if diop_type == BinaryQuadratic.name:\n if param is not None:\n parameters = [param, Symbol(\"u\", integer=True)]\n else:\n parameters = None\n r...
[ "0.65440845", "0.6320849", "0.63020766", "0.6229912", "0.61942685", "0.6190736", "0.6186001", "0.6118183", "0.60612786", "0.6060127", "0.59786564", "0.59761536", "0.5858187", "0.5843685", "0.5826548", "0.57481503", "0.57365835", "0.5698943", "0.56609064", "0.5646106", "0.5635...
0.65034807
1
ordering of health networks should be by priority, name
def test_health_networks_ordering(self): state = State.objects.get(name="NC") hns = HealthNetwork.objects.filter(state=state) hns_p = {n: [hn for hn in hns if hn.priority == n] for n in PRIORITY.keys()} self.assertEqual( hns_p[0], hns[: len(hns_p[0])], msg="priority 0 health ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priority(name):\n try:\n manager = Actions()\n priority = Priority[name]\n ordered_tasks = manager.order_by_priority(priority)\n click.echo(\"Ordered by priority:\" + click.style(name, bg='red', fg='white'))\n click.echo()\n console_utils.format_print_ordered(ordere...
[ "0.5870013", "0.58105636", "0.57861495", "0.5686132", "0.56482583", "0.56482583", "0.5623373", "0.53816515", "0.53049576", "0.5292775", "0.5250956", "0.52294445", "0.52216697", "0.515409", "0.5107319", "0.51055664", "0.50733155", "0.506472", "0.50563586", "0.5054701", "0.5054...
0.795008
0
creating a network with the same name in a different state is fine, but creating a network with the same name in the same state raises an IntegrityError
def test_unique_health_networks_per_state(self): state1 = State.objects.get(name="NC") state2 = State.objects.get(name="SC") kwargs = dict(priority=0, name="My Non-existent Health Network") HealthNetwork.objects.create(state=state1, **kwargs) HealthNetwork.objects.create(state=st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_and_set_network(self) -> None:\n from hathor.transaction.storage.exceptions import WrongNetworkError\n\n network = settings.NETWORK_NAME\n stored_network = self.get_network()\n\n if stored_network is None:\n # no network is set, let's try to infer it\n s...
[ "0.62125087", "0.61994624", "0.6185668", "0.61371464", "0.6014497", "0.59862936", "0.5978605", "0.5846337", "0.5810719", "0.5770879", "0.5749314", "0.57286835", "0.57163084", "0.56837964", "0.5681908", "0.5677037", "0.5669655", "0.5665639", "0.5654778", "0.5654763", "0.564764...
0.6288055
0
adding a network with an unsupported priority raises an error
def test_add_wrong_priority(self): state = State.objects.get(name="NC") bad_priority = len(list(PRIORITY.keys())) # 1 higher than the available priorities. kwargs = dict(state=state, priority=bad_priority, name="My Non-existent Health Network") self.assertRaises(ValidationError, Health...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_network(self):\n pass", "def add_network(self, router, network, distance):\n self.routers[router].add_network(network, distance)", "def add_network(self, network, distance):\n self.networks[network] = distance", "def add_nei(self, dest: int, weight: float):\r\n if not...
[ "0.6310278", "0.5923847", "0.5907903", "0.56655437", "0.56389827", "0.55968845", "0.55506074", "0.54959756", "0.5477577", "0.5470298", "0.54657966", "0.5449305", "0.54388195", "0.5422788", "0.5414837", "0.54006034", "0.5377785", "0.5374897", "0.5343064", "0.5321249", "0.53177...
0.61365
1
Postprocess a symbol table after collecting from one source. If the symbol table contains FILE symbols, they will be removed and replaced by a 'file' column on other symbols. If the symbol table contains ARM mode symbols, they will be removed and replaced by an 'arm' column on other symbols.
def postprocess_symbols(config: Config, symbols: SymbolDF) -> SymbolDF: files = [] arms = [] arm_symbols = {} current_file = '' current_arm = '' has_file = False if config['collect.prefix-file']: prefixes = config.get_re('collect.prefix') else: prefixes = None if 'typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess_file(config: Config, dfs: DFs) -> None:\n if SymbolDF.name in dfs:\n dfs[SymbolDF.name] = postprocess_symbols(config, dfs[SymbolDF.name])", "def parse_symbol_table(data, sections, elf_header):\n if is64bit(elf_header):\n symbol_entry_str = symbol_64_entry_str\n symbol_e...
[ "0.6027799", "0.57213014", "0.5678896", "0.53370655", "0.53370655", "0.5240379", "0.510453", "0.5102045", "0.50985175", "0.50433695", "0.49907583", "0.4950016", "0.49235138", "0.4910098", "0.49089348", "0.48771235", "0.48708987", "0.4854355", "0.48283255", "0.48272", "0.47998...
0.72918737
0
Verify that a catalog generated by the unit tests below contains the rows it ought to. This is done by looking for a corresponding catalog in tests/testData and verifying that the two catalogs have identical rows.
def verify_catalogs(self, cat_name): control_dir = os.path.join(getPackageDir('sims_catUtils'), 'tests', 'testData') _, control_name = os.path.split(cat_name) control_name = os.path.join(control_dir, control_name) with open(control_name, 'r') as contro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_see_all_different_products(self):\n\n # create new unittest data\n ImportUnitTestData.import_data_handler()\n # create new data\n try:\n current_dir = os.getcwd()\n directory_name = current_dir + '\\\\lesson5\\\\data\\\\'\n file_name_dict = {'pr...
[ "0.64208776", "0.61701244", "0.6072419", "0.60301155", "0.6008713", "0.6000412", "0.59985", "0.5942207", "0.59310716", "0.5895737", "0.5893529", "0.5886061", "0.58684117", "0.5866197", "0.5834321", "0.5827727", "0.5790548", "0.5764453", "0.5762863", "0.575223", "0.5746735", ...
0.6838003
0
Test that we can generate a catalog which inherits from multiple variability mixins (in this case, TestVariability and VariabilityStars). This is to make sure that the register_method and register_class decorators do not mangle inheritance of methods from mixins.
def testHybridVariability(self): cat_name = os.path.join(self.scratch_dir, 'hybridTestCatalog.dat') makeHybridTable(database=self.variability_db) myDB = CatalogDBObject.from_objid('hybridTest', database=self.variability_db) myCatalog = StellarVariabilityCatalogWithTest(myDB, obs_metadata...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ProcessMixins(self, mixins):\n self._mixins = mixins", "def test():\n # the component superclass\n from p2.components.Component import Component\n # the trait factory\n from p2.traits.Measure import Measure as measure\n\n\n # subclass\n class Base(Component):\n \"\"\"\n A s...
[ "0.57527846", "0.57445997", "0.5671585", "0.5648246", "0.551333", "0.5491303", "0.54901725", "0.5403399", "0.5254813", "0.5250898", "0.5245918", "0.5179942", "0.5150097", "0.5106484", "0.5104359", "0.5093766", "0.5088895", "0.5082123", "0.5071844", "0.5065457", "0.5057772", ...
0.63517714
0
Use the hybrid variability catalog class from testHybridVariability to verify that, if we pass an array of expmjd into applyVariability, we get the expected result out.
def testApplyVariabilityWithManyMJD(self): makeHybridTable(database=self.variability_db) hybrid_db = hybridDB(database=self.variability_db) hybrid_cat = StellarVariabilityCatalogWithTest(hybrid_db, obs_metadata=self.obs_metadata, column_out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_var_exp(self):\n with self.test_context() as session:\n test_setups, F, feed = self.prepare()\n for test_setup in test_setups:\n l = test_setup.likelihood\n y = test_setup.Y\n l.compile()\n r1 = session.run(l.logp(F, ...
[ "0.62441033", "0.5478328", "0.54694235", "0.53534585", "0.5264933", "0.5245997", "0.5183478", "0.5169352", "0.5164767", "0.5156014", "0.50279623", "0.5003747", "0.49608055", "0.49578118", "0.49560577", "0.4934729", "0.49292457", "0.487284", "0.4847929", "0.484281", "0.4840532...
0.74344283
0
Draw road lines to define valid detection areas.
def road_lines(): cv2.polylines(frame_1, [pts_1], True, yellow_color) cv2.polylines(frame_2, [pts_2], True, yellow_color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawLines(self):\n\t\tintersections = [[], []]\n\t\tfor l in self.lines:\n\t\t\tif l.direction == 'v':\n\t\t\t\tif l.rtc:\n\t\t\t\t\tposition = l.coordinate + int((self.width - 1) / 2)\n\t\t\t\telse:\n\t\t\t\t\tposition = int((l.coordinate * self.width / 100) if type(l.coordinate) == float else l.coordinate)\n...
[ "0.6935589", "0.6575923", "0.6425404", "0.6305132", "0.61926347", "0.6187055", "0.6155874", "0.61299604", "0.61294866", "0.6076995", "0.60432255", "0.60113436", "0.6008314", "0.6002908", "0.59739286", "0.59024054", "0.5898999", "0.5898862", "0.5894378", "0.58699995", "0.58633...
0.7002146
0
Takes a list of dictionaries and a list index. Returns the id for that index.
def _get_id(results, index): return results[index]['_id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_id(collection, index = \"id\", ignore_filter = False):\n\tif (not ignore_filter):\n\t\tcollection = [register[index] for register in list(collection)]\n\treturn \"'\" + (\"', '\".join(collection)) + \"'\"", "def get_id(self, index):\n return self.__keys[index]", "def get_indexed_item_from_l...
[ "0.6608865", "0.6461903", "0.6270167", "0.6254719", "0.62439704", "0.62224084", "0.60979915", "0.5953362", "0.5770354", "0.5758881", "0.57466406", "0.57018924", "0.56850445", "0.5634907", "0.5571361", "0.55570155", "0.55042535", "0.54714113", "0.5466338", "0.5462254", "0.5448...
0.6934078
0
Takes a list of dictionaries and a list index. Returns the document for that index.
def _get_doc(results, index): return results[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _index_document(index_list):\n if isinstance(index_list, abc.Mapping):\n raise TypeError(\"passing a dict to sort/create_index/hint is not \"\n \"allowed - use a list of tuples instead. did you \"\n \"mean %r?\" % list(index_list.items()))\n elif not i...
[ "0.7619862", "0.6181496", "0.6016992", "0.59967166", "0.59627914", "0.5940448", "0.59366274", "0.5891136", "0.5872575", "0.5839089", "0.58277404", "0.5806781", "0.5760332", "0.5748127", "0.5702271", "0.5691555", "0.5679571", "0.56673163", "0.5663057", "0.5657615", "0.5626698"...
0.6746059
1
Tests the _create_text_index() method when a schema is provided.
def test_create_text_index_w_schema(self): actual = self.engine._create_text_index(self.engine.schema) expected = 'TextIndex' self.assertEqual(actual, expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_text_index_noschema(self):\n actual = self.engine._create_text_index()\n expected = 'TextIndex'\n self.assertEqual(actual, expected)", "def test_creating_index_type(self):", "def test_string_index():\n\tlib.backup_and_restore(\n\t\tlambda context: create_indexes(lib.create_...
[ "0.8399966", "0.68847084", "0.6653272", "0.65279675", "0.6232708", "0.61420846", "0.6077263", "0.5866493", "0.57903063", "0.57808346", "0.5726722", "0.57109994", "0.5680334", "0.5675512", "0.56721723", "0.56721723", "0.5643351", "0.5582189", "0.5579941", "0.55570096", "0.5553...
0.8753069
0
Tests the _create_text_index() method when a schema is not provided.
def test_create_text_index_noschema(self): actual = self.engine._create_text_index() expected = 'TextIndex' self.assertEqual(actual, expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_text_index_w_schema(self):\n actual = self.engine._create_text_index(self.engine.schema)\n expected = 'TextIndex'\n self.assertEqual(actual, expected)", "def test_creating_index_type(self):", "def test_string_index():\n\tlib.backup_and_restore(\n\t\tlambda context: create_i...
[ "0.85630506", "0.6538482", "0.6379478", "0.62192476", "0.6107749", "0.60360074", "0.6031513", "0.59643614", "0.5895175", "0.5890334", "0.58874357", "0.57891434", "0.56733567", "0.5590555", "0.55498284", "0.55498284", "0.55243", "0.5514081", "0.5476263", "0.5456776", "0.544013...
0.86921626
0
Limit result list with "MAX_RESULT"
def limit_result(result_set): max_result = MAX_RESULT result = [] if max_result > 0: result = result_set[:max_result] result.append("Total result: {}".format(len(result_set))) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_result_limit(self, data):\n self.add_payload('resultLimit', data)\n self._result_limit = self._uni(data)", "def limit(self, limit):\n\n # Return between 1 and 250 results, defaults to 10\n return max(1, min(250, int(limit) if limit else 10))", "def max_results(self, max_resu...
[ "0.673919", "0.64389324", "0.62612617", "0.6195268", "0.6166678", "0.6131141", "0.60837257", "0.60630274", "0.6061646", "0.60587096", "0.6015139", "0.59791905", "0.59546673", "0.59319866", "0.5929677", "0.59154874", "0.58818", "0.58628124", "0.5826882", "0.58234286", "0.58110...
0.7924585
0
Get an Github Operator
def _github_operator(self, msg): token = self[msg.frm.person + "github_token"] result = GithubOperator(token) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_github_credendial(cls) -> 'ApiCredential':\n return cls.select_token_for_api(GITHUB_API_NAME)", "def get(self, endpoint, params=None):\n res = requests.get(\"https://api.github.com/\" + endpoint,\n auth=requests.auth.HTTPBasicAuth(self.credentials['username'], self.cre...
[ "0.60614455", "0.594694", "0.5812482", "0.5780396", "0.5726921", "0.56730396", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", "0.5613916", ...
0.73203856
0
Get an Translation Util
def _translation_util(self, msg): token = self[msg.frm.person + "github_token"] return TranslateUtil(REPOSITORY_CONFIG_FILE, token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_translation(self):", "def get_gettext():\n local_path = os.path.realpath(os.path.dirname(sys.argv[0])) + \\\n '/translations'\n langs = []\n lc, encoding = locale.getdefaultlocale()\n if (lc):\n langs = [lc]\n osLanguage = os.environ.get('LANGUAGE', None)\n if (os...
[ "0.692908", "0.6249203", "0.6228129", "0.62209576", "0.6138939", "0.6135836", "0.61316675", "0.60002774", "0.588955", "0.5859885", "0.57699263", "0.57648146", "0.57179856", "0.5707253", "0.57066154", "0.569066", "0.56857437", "0.5651666", "0.56276864", "0.5602541", "0.5530169...
0.66220915
1
Check if user had bound their github token.
def _github_bound(self, person): result = True try: result = len(self[person + "github_token"]) > 0 except BaseException: result = False return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_token(self):\n api_response = requests.get(self.api_config.get_api_url() + \"greetings/isloggedin\",\n headers={\"Authorization\": \"Bearer \" + self.API_TOKEN})\n\n if api_response.status_code == 401 or 403:\n return False\n else:\n ...
[ "0.65147024", "0.6480705", "0.63269347", "0.6250972", "0.62163246", "0.6209365", "0.6175841", "0.6166921", "0.6119698", "0.6116468", "0.6107161", "0.6025452", "0.6002667", "0.5976334", "0.59564173", "0.59537226", "0.59510547", "0.59139603", "0.5908455", "0.5898309", "0.582852...
0.77639025
0
Bump the version label of issues from old_label to new_label
def change_issues_label(self, msg, old_label, new_label): self._asset_bind(msg) yield ("Processing....") trans = self._translation_util(msg) client = self._github_operator(msg) cmd = "repo:{} label:{} is:open type:issue".format( task_repository_name(), old_label) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_replace_labels(self):\n pass", "def post_issue_labels(repo, project, issue_number):\n issue_path = '%s/%s/issues/%d' % (repo, project, issue_number)\n\n new_label_ids = request.json\n\n current_label_ids = dao.get_issue_label_ids(issue_path)\n\n revised_label_ids = current_label...
[ "0.6792092", "0.6410261", "0.63336664", "0.62997633", "0.6212655", "0.6188349", "0.6131808", "0.6078506", "0.60697824", "0.5982465", "0.59715044", "0.58801395", "0.58639926", "0.5816984", "0.576189", "0.57202476", "0.57188237", "0.5707912", "0.570286", "0.565688", "0.5632423"...
0.75369704
0
Show issue url by its id.
def show_issue(self, msg, issue_id): self._asset_bind(msg) yield "https://github.com/{}/issues/{}".format(task_repository_name(), issue_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def issue(ctx, number: Option(int, \"Issue number\")):\n url = f\"{repo}/issues/{number}\"\n view = discord.ui.View()\n view.add_item(discord.ui.Button(label=\"View Issue\", url=url))\n await ctx.respond(f\"Here's a link\", view=view)", "def build_issue_tracker_url(issue_id):\n issue_tracker_t...
[ "0.6973641", "0.67749053", "0.64473206", "0.63432825", "0.63432825", "0.6329339", "0.6315905", "0.6126929", "0.6092506", "0.603496", "0.60116416", "0.6002365", "0.5886086", "0.58832836", "0.5794558", "0.579267", "0.57825845", "0.5674633", "0.565682", "0.5643689", "0.563147", ...
0.77199227
0
Release the translating issues that have been accepted for more than specified delay days (at least 3 days)
def find_delay_issues(self, msg, delay_days, unassign): self._asset_bind(msg) yield ("Processing....") trans = self._translation_util(msg) client = self._github_operator(msg) issues = find_delay_issues(trans, client, delay_days) if unassign == 0: yield ("\n".j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maintain_leases(self) -> None:\n while not self._stop_event.is_set():\n # Determine the appropriate duration for the lease. This is\n # based off of how long previous messages have taken to ack, with\n # a sensible default and within the ranges allowed by Pub/Sub.\n ...
[ "0.5600951", "0.5391433", "0.53077644", "0.530182", "0.5256958", "0.5214244", "0.52004874", "0.5079904", "0.50456727", "0.5010773", "0.49739408", "0.49477166", "0.49456263", "0.4935877", "0.4900822", "0.48766607", "0.48477307", "0.4822325", "0.48165026", "0.48124647", "0.4810...
0.57937604
0
Find new files from a branch for a language.
def find_new_files_in(self, msg, branch, create_issue): self._asset_bind(msg) trans = self._translation_util(msg) new_file_list = trans.find_new_files( REPOSITORY_NAME, branch, TARGET_LANG) if create_issue == 0: yield ("\n".join(limit_result(new_file_list))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_updated_files_in(self, msg, branch, create_issue):\n self._asset_bind(msg)\n trans = self._translation_util(msg)\n updated_files = trans.find_updated_files(REPOSITORY_NAME, branch, TARGET_LANG)\n if create_issue == 0:\n yield (\"\\n\".join(limit_result(list(updated_f...
[ "0.5788485", "0.57070714", "0.5683101", "0.5395942", "0.53917253", "0.5343768", "0.5339315", "0.52852684", "0.5283768", "0.52731115", "0.5249437", "0.52391535", "0.5239085", "0.52318555", "0.5212088", "0.51945984", "0.5188822", "0.5180843", "0.51768464", "0.5143592", "0.51398...
0.64677894
0
Find updated files from a branch for a language.
def find_updated_files_in(self, msg, branch, create_issue): self._asset_bind(msg) trans = self._translation_util(msg) updated_files = trans.find_updated_files(REPOSITORY_NAME, branch, TARGET_LANG) if create_issue == 0: yield ("\n".join(limit_result(list(updated_files.keys()))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_files(folder):\n print_header(\"READING FILES FROM FOLDER (RECURSIVE)\", \"=\")\n files = []\n for dirpath, dirnames, filenames in os.walk(folder):\n if not dirpath.endswith(\"updates\"):\n for filename in filenames:\n root, ext = os.path.splitext(filename)\n ...
[ "0.60385823", "0.5747651", "0.5746556", "0.5706303", "0.56910634", "0.5666029", "0.56308615", "0.56270456", "0.54923", "0.54485804", "0.5438877", "0.54278654", "0.54130405", "0.5369421", "0.536918", "0.5358993", "0.53467005", "0.53339535", "0.5308779", "0.52719516", "0.525351...
0.6335095
0
Find deleted/moved files from a branch for a language.
def find_deleted_files_in(self, msg, branch, create_issue): self._asset_bind(msg) trans = self._translation_util(msg) deleted_file_list = trans.find_deleted_files( REPOSITORY_NAME, branch, TARGET_LANG) moved_files = trans.find_moved_files_in_deleted_files(REPOSITORY_NAME, br...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_files(folder):\n print_header(\"READING FILES FROM FOLDER (RECURSIVE)\", \"=\")\n files = []\n for dirpath, dirnames, filenames in os.walk(folder):\n if not dirpath.endswith(\"updates\"):\n for filename in filenames:\n root, ext = os.path.splitext(filename)\n ...
[ "0.56908476", "0.55866516", "0.54323393", "0.532697", "0.5286356", "0.5263294", "0.52617866", "0.5237295", "0.5224555", "0.5216255", "0.52129155", "0.52084595", "0.5203285", "0.5158452", "0.5138303", "0.5135574", "0.5109658", "0.51079535", "0.51076376", "0.51058733", "0.50981...
0.6073978
0
The ID or Amazon Resource Name (ARN) of the target group.
def target_group_identifier(self) -> pulumi.Input[str]: return pulumi.get(self, "target_group_identifier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_arn(self, short_name):\n target_group_info = self.get_target_group_info(short_name)\n return target_group_info['TargetGroupArn']", "def target_group(self)...
[ "0.8059303", "0.77209467", "0.76946956", "0.76142114", "0.7459761", "0.7424217", "0.7291563", "0.7291563", "0.7070664", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.7054723", "0.700518", "0.700518", "0.6932303", "0.6895912", "0.68954605", "0.689537", ...
0.77805084
1
Get an existing TargetGroupAttachment resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, target: Optional[pulumi.Input[pulumi.InputType['TargetGroupAttachmentTargetArgs']]] = None, target_group_identifier: Optional[pulumi.Input[str]] = None) -> 'TargetGroupAttach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attachment(self,\n attachment_name: Text) -> Optional[test_record.Attachment]:\n # Check current running phase state for the attachment name first.\n if self.running_phase_state:\n if attachment_name in self.running_phase_state.phase_record.attachments:\n attachment = ...
[ "0.5213174", "0.5193024", "0.5071051", "0.50478333", "0.49847454", "0.4979039", "0.48070908", "0.46779084", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.4650041", "0.46282402", "0.461483", "0.4582758", "0.4582302", "0.45697513", "0.45678928", "0.4559987...
0.752676
0
The ID or Amazon Resource Name (ARN) of the target group.
def target_group_identifier(self) -> pulumi.Output[str]: return pulumi.get(self, "target_group_identifier")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_group_identifier(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"target_group_identifier\")", "def get_target_group_arn(self, short_name):\n target_group_info = self.get_target_group_info(short_name)\n return target_group_info['TargetGroupArn']", "def target_group(self) ...
[ "0.7782377", "0.77201146", "0.7695647", "0.76161706", "0.74612945", "0.74235034", "0.72911525", "0.72911525", "0.7071454", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.7055554", "0.70069563", "0.70069563", "0.6934187", "0.6897746", "0.6897058", "0.68959...
0.8060474
0
Construct and return data provider.
def find_provider(self) -> DataProvider: data_source = self._single_data_source() identifiers = self._make_identifiers() return self._create_data_provider(data_source, identifiers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_data_provider(self, data_source: DataSource, identifiers: Identifiers) -> DataProvider:\n if data_source.driver is not None:\n return DatabaseDataProvider(data_source, identifiers, self._injector)\n elif data_source.mime_type == DataSourceConstants.MIME_TYPE_JSON:\n ...
[ "0.6566284", "0.64414555", "0.6421565", "0.6354318", "0.62949705", "0.6272591", "0.6233643", "0.6149416", "0.60801214", "0.5942076", "0.5927878", "0.5916989", "0.59090745", "0.5891367", "0.5875818", "0.58682203", "0.58377075", "0.5828267", "0.5732329", "0.56926715", "0.567040...
0.6899661
0
Find an appropriate data provider instance for a data source and return it.
def _create_data_provider(self, data_source: DataSource, identifiers: Identifiers) -> DataProvider: if data_source.driver is not None: return DatabaseDataProvider(data_source, identifiers, self._injector) elif data_source.mime_type == DataSourceConstants.MIME_TYPE_JSON: return Js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_provider(self) -> DataProvider:\n data_source = self._single_data_source()\n identifiers = self._make_identifiers()\n return self._create_data_provider(data_source, identifiers)", "def engine_for_data_source(self, data_source_id):\n engine = None\n\n # find data_source...
[ "0.80434716", "0.68087965", "0.6472477", "0.6324865", "0.6181027", "0.6065154", "0.6047303", "0.5923456", "0.5854328", "0.58054674", "0.57857233", "0.57642937", "0.5744689", "0.5741175", "0.5718049", "0.5650882", "0.56424963", "0.56369716", "0.5622577", "0.56058973", "0.55954...
0.7104102
1
Find and return data source in the list of columns.
def _single_data_source(self) -> DataSource: data_source = None for meta_column in self._meta_columns: if data_source is None: data_source = meta_column.data_source elif data_source is not meta_column.data_source: raise SomeError('Mixed data source...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_source_identifiers(self):\n collection_ids = self.am_db_api.get_collections_identifiers()\n for col in collection_ids:\n if col['code'] == self.collection_acronym:\n _raw_data = col\n break\n if _raw_data:\n return [col, ]\n ...
[ "0.630452", "0.60534185", "0.60346985", "0.59439075", "0.5786718", "0.57262063", "0.5580457", "0.5549795", "0.5502819", "0.546728", "0.54508007", "0.53607213", "0.53460145", "0.5345716", "0.53440297", "0.531765", "0.5290032", "0.5263445", "0.52465343", "0.52288145", "0.520390...
0.68384
0
Construct and return list of all identifiers in a column list.
def _make_identifiers(self) -> Identifiers: identifier_list = [] for meta_column in self._meta_columns: idf_string = meta_column.reflected_column_idf idf = Identifier.from_string(idf_string) identifier_list.append(idf) return identifier_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_values(table: list[dict[str, str]], column_name: str) -> list[str]:\n column_values: list[str] = []\n for row in table:\n item: str = row[column_name]\n column_values.append(item)\n return column_values", "def _create_sql_columns(self, a_list):\n result = \"\"\n \n...
[ "0.6425198", "0.63352287", "0.62166625", "0.62166625", "0.6156101", "0.61026555", "0.6070932", "0.60350156", "0.60269547", "0.59695834", "0.59083545", "0.5736998", "0.57237095", "0.570372", "0.56879526", "0.5640683", "0.5635314", "0.5628415", "0.5623144", "0.56099755", "0.559...
0.716665
0
Download, parse, and clean the spreads & overunder tables for one game. The columns are pinnacle, betonline, bookmaker each with suffix _spread or _over_under; datetime; hometeam, awayteam, favored; week. The first three are the bookies and give the spreads from the point of view of the favored team (so they're general...
def game(hometeam, awayteam, week, year): with urlopen(spread_url(hometeam, awayteam, week, year)) as connection: spreads_page = connection.read() # Note that infer_types is deprecated and won't work starting in Pandas 0.14 LOG.debug('Getting game %s', (hometeam, awayteam, week, year)) sp = read_html(io=spreads_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_proboxingodds(soup):\n tables = []\n site = pd.read_html(str(soup))\n for idx, table in enumerate(site):\n if idx == 0:\n pass\n elif idx % 2 != 0:\n sliced = table[(table['Unnamed: 0'].str.contains(':')) | (table['Unnamed: 0'] == 'UTC')]\n sliced =...
[ "0.6246023", "0.61548907", "0.60092086", "0.5975189", "0.5945373", "0.58612907", "0.581316", "0.57939166", "0.57939166", "0.57505715", "0.5735615", "0.57076836", "0.56700265", "0.56516606", "0.5643471", "0.56255335", "0.56039417", "0.55867517", "0.5583636", "0.5582516", "0.55...
0.7500191
0
Download, parse, and clean a table of games and scores for given season. The columns are week; hometeam; awayteam; winner; date; points, yards, and turn overs for the winning team; points, yards, and turn overs for the losing team; and season.
def season_games(year): LOG.debug('Getting season %d', year) data = read_html(io=season_games_url(year), attrs={'id': 'games'}, infer_types=False, header=0) if len(data) != 1: raise CantFindTheRightTable data = data.pop() # Cleaning. del data["Unnamed: 3"] # The code below issues "UserWar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pageScrape(season_url, wr):\r\n\r\n\thtml = urlopen(season_url)\r\n\tsoup = BeautifulSoup(html, \"lxml\")\r\n\r\n\t# our desired table has id = 'results'\r\n\t# we take the rows in the table's children\r\n\t# But we make sure to ignore the first two, since they're unrelated\r\n\ttable = soup.find(id = 'results...
[ "0.72744703", "0.71057445", "0.7024942", "0.6991828", "0.67987585", "0.6700538", "0.6658425", "0.6575679", "0.64786863", "0.64421767", "0.6356316", "0.63480973", "0.6342161", "0.63054234", "0.628538", "0.62465894", "0.62191725", "0.6196027", "0.6153302", "0.61445725", "0.6125...
0.77701926
0
Convenience wrapper for `game` when you're not sure who's the home team. We first try calling `game` with `team_a` as the home team, and if that doesn't work, we next try `team_b`. In the former case we add a column called `home_away_discrepency` equal to `False`. In the latter case the column contains `True` and the `...
def game_unknown_homeaway(team_a, team_b, week, year): try: g = game(team_a, team_b, week, year) except (CantFindTheRightTable, ValueError): g = game(team_b, team_a, week, year) awayteam, hometeam = g.hometeam.copy(), g.awayteam.copy() g.hometeam, g.awayteam = hometeam, awayteam g['home_away_discrepency'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game(self, **kw):\n _append_conds(self._default_cond, types.Game, kw)\n if 'team' in kw:\n ors = {'home_team': kw['team'], 'away_team': kw['team']}\n self.andalso(Query(self._db, orelse=True).game(**ors))\n return self", "def hometeamify(t):\n\tt = t.copy()\n\t# Win...
[ "0.6640279", "0.64301515", "0.6302677", "0.62670434", "0.6090484", "0.59702206", "0.5948577", "0.5926323", "0.5851775", "0.581768", "0.5812748", "0.57850784", "0.5778715", "0.5760123", "0.56636155", "0.5662619", "0.5662174", "0.56604946", "0.5657123", "0.5652413", "0.56399506...
0.685784
0
Download, parse, and clean the scores & spreads for all games in a season `timeout` is in seconds and `concurrency` is the number of threads to use, defaulting to the number of CPUs. If not `None`, `week` limits the games fetched to those in the given week. This function returns two values. The first is the table, whic...
def season(year, week=None, timeout=None, concurrency=_DEFAULT_CONCURRENCY): LOG.debug('Concurrency = %d', concurrency) games = season_games(year) if week is not None: games = games[games.week == week] expected_n = len(games) tables, futures_to_args, failures = [], {}, [] # See https://docs.python.org/3/library...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seasons(years, timeout=None, concurrency=_DEFAULT_CONCURRENCY):\n\ttables, failures = [], []\n\tfor year in years:\n\t\tLOG.info('=' * 10 + ' %d ' + '=' * 10, year)\n\t\ttable, failure = season(year, timeout=timeout, concurrency=concurrency)\n\t\ttables.append(table)\n\t\tfailures.extend(failure)\n\treturn pd....
[ "0.6129513", "0.5730428", "0.5411161", "0.5363586", "0.5149617", "0.50999445", "0.50895286", "0.50845605", "0.5071889", "0.5037335", "0.50228286", "0.49968722", "0.4969007", "0.49601135", "0.49494612", "0.49304613", "0.49097982", "0.48657218", "0.48565075", "0.4851376", "0.48...
0.746054
0
Download, parse, and clean multiple seasons of NFL games and spreads. `years` is an iterable of integers. `timeout` is measured in seconds. `concurrency is the number of threads to use, defaulting to the number of CPUs. This function returns two values. The first is the table, which is the the merger of the tables that...
def seasons(years, timeout=None, concurrency=_DEFAULT_CONCURRENCY): tables, failures = [], [] for year in years: LOG.info('=' * 10 + ' %d ' + '=' * 10, year) table, failure = season(year, timeout=timeout, concurrency=concurrency) tables.append(table) failures.extend(failure) return pd.concat(tables), failure...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season(year, week=None, timeout=None, concurrency=_DEFAULT_CONCURRENCY):\n\tLOG.debug('Concurrency = %d', concurrency)\n\tgames = season_games(year)\n\tif week is not None:\n\t\tgames = games[games.week == week]\n\texpected_n = len(games)\n\ttables, futures_to_args, failures = [], {}, []\n\t# See https://docs....
[ "0.6988165", "0.53787047", "0.5354344", "0.50391036", "0.48686248", "0.48666587", "0.48592305", "0.48330218", "0.47225174", "0.4698474", "0.46848443", "0.46690604", "0.46613982", "0.4643933", "0.46422544", "0.45821732", "0.4577877", "0.4571864", "0.45470133", "0.45312637", "0...
0.742822
0
Convert a `season`generated table `t` so the data is hometeam centric. `season` generates a table whose points, yards, and turnovers columns are broken down by winning and losing team and whose spreads columns are relative to the favored team. Convert all these winner/loser based columns to be home/away based and conve...
def hometeamify(t): t = t.copy() # Winner/loser based columns hw, aw = t.hometeam == t.winner, t.awayteam == t.winner assert (hw == ~aw).all() # Suffix for keys = W for winner L for loser. Values are new names for old, new in {'Pts': 'points', 'Yds': 'yards', 'TO': 'turn_overs'}.items(): t[new + '_home'] = (hw ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_games(year):\n\tLOG.debug('Getting season %d', year)\n\tdata = read_html(io=season_games_url(year),\n\t\t\t\t\t attrs={'id': 'games'},\n\t\t\t\t\t infer_types=False,\n\t\t\t\t\t header=0)\n\tif len(data) != 1:\n\t\traise CantFindTheRightTable\n\tdata = data.pop()\n\n\t# Cleaning.\n\tdel data[\"Unname...
[ "0.63010097", "0.6165743", "0.609641", "0.59280556", "0.5682527", "0.5622098", "0.5577865", "0.55546534", "0.5509511", "0.55027294", "0.5485158", "0.54674494", "0.5361212", "0.5352292", "0.5331872", "0.5305586", "0.5231739", "0.5226202", "0.51555604", "0.51513076", "0.5111141...
0.6389691
0
Return the latest football season that started before the given `date`. `date` should be a `datetime.date` object. This function merely assumes that football season starts at the beginning of September.
def latest_season_before(date): if date.month < 9: return date.year - 1 return date.year
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_football_season(date=datetime.datetime.today()):\n date_aux = subtract_months(date, 6)\n beginning_year = str(date_aux.year)\n ending_year = date_aux.year + 1\n ending_year = str(ending_year)[-2:]\n season = ''.join([beginning_year, '-', ending_year])\n return season", "def getSeason...
[ "0.69180113", "0.6146285", "0.57859606", "0.576548", "0.56443614", "0.55603045", "0.5519733", "0.54679203", "0.5379245", "0.5354513", "0.5308661", "0.5244202", "0.51410407", "0.51207197", "0.510111", "0.5079919", "0.50713015", "0.5060351", "0.5047275", "0.49737677", "0.493112...
0.7798447
0
Assignes a selfRef to a resource
def set_self_ref(self, resource): fullname = utils.class_fullname(resource) if fullname not in self._models_index: self.send_error(400, message="Unrecognized resource type: %s" % type(resource)) return -1 resource_name = self._models_index[fullname] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri", "def self_uri(self, self_uri):\n \n self._self_uri = self_uri"...
[ "0.69215506", "0.69215506", "0.69215506", "0.69215506", "0.6608306", "0.6608306", "0.62731814", "0.6217579", "0.6217579", "0.61596036", "0.6048173", "0.59555393", "0.5861509", "0.5775239", "0.5726745", "0.56997484", "0.5627227", "0.562261", "0.562261", "0.5587249", "0.5512516...
0.81884384
0
Resolves self hyperlinks (JSONPath and JSONPointers.
def _complete_href_links(self, parent_collection, current): if isinstance(current, HyperLink) or \ (isinstance(current, dict) and "href" in current): if isinstance(current["href"], (bytes, str)): resource = None if current["href"] in self._cache: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_self_href(response):\n data = jsonutils.loads(response.body)\n for link in data['versions'][0]['links']:\n if link['rel'] == 'self':\n return link['href']\n return ''", "def self_link(self):\n return self._json['coredata'].get('link', [])[0].get('@href')", "def Self(s...
[ "0.602833", "0.5747524", "0.53852236", "0.5332049", "0.53265524", "0.52382493", "0.52201176", "0.52140194", "0.52034295", "0.5167555", "0.50881326", "0.50849515", "0.5083651", "0.50580704", "0.5019191", "0.49718055", "0.4957375", "0.4956555", "0.4889869", "0.48428294", "0.483...
0.67970556
0
This method is called when the spider is opened.
def open_spider(self,Spider): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_spider(self, spider):\n pass", "def open_spider(self, spider):\n assert spider not in self.sites, \"Spider already opened: %s\" % spider\n self.sites[spider] = SpiderInfo(spider)", "def __init__(self, spider):\n\n super(SprintBehavior, self).__init__(spider)\n self.r...
[ "0.83981526", "0.7474456", "0.6518192", "0.6464361", "0.64332694", "0.6359454", "0.6268794", "0.6236614", "0.62211096", "0.62166256", "0.6149158", "0.6127409", "0.61030036", "0.60981435", "0.60644287", "0.6060854", "0.6018061", "0.60120916", "0.59972566", "0.59972566", "0.599...
0.79172105
1
Get an image set.
def get(log, session, args): log('imageset id: {highlight}{id}{reset}', highlight=Fore.GREEN, id=args.id, reset=Style.RESET_ALL) log.warn('Get imageset command coming soon.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetImageSet(cls, ID):\n if ID in cls._imageSets:\n return cls._imageSets[ID]", "def get_image_set(image_set, depth=False, scale=1):\n image_files = glob.glob(image_set)\n loaded_images = []\n\n # reorder file names to be in numbering order\n filenames_in_order = ['' for _ in ran...
[ "0.7954262", "0.6740134", "0.64645076", "0.62871885", "0.6021483", "0.601437", "0.599391", "0.5967952", "0.5960324", "0.59564406", "0.5953417", "0.5952895", "0.59492964", "0.59325", "0.5910726", "0.5877919", "0.5854985", "0.58473265", "0.5806738", "0.57102996", "0.56972474", ...
0.7376378
1
Return executable tasks with image uploads in batches. Instead of performing image uploads and updating the imageset one at a time, we reduce load on the API server by uploading many images and updating the api server in one go, consequently making upload faster.
def _get_chunk_upload_futures( executor, paths, session, create_url, complete_url, log, workload_size, offset ): total_work = len(paths) workloads = [] temp = [] i = 0 while i < total_work: path = paths[i] temp.append(path) i += 1 if len(temp) == workload_siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_image_files(name, cnts, roots, num_shards): \n \n # Break all images into batches with a [ranges[i][0], ranges[i][1]].\n spacing = np.linspace(0, sum(cnts), FLAGS.num_threads + 1).astype(np.int)\n ranges = []\n for i in range(len(spacing) - 1):\n ranges.append([spacing[i], spacing[i +...
[ "0.6663598", "0.63845474", "0.62568337", "0.6249887", "0.618294", "0.60570496", "0.60385495", "0.5976142", "0.596462", "0.5929896", "0.5870594", "0.58550143", "0.5847463", "0.5847073", "0.58429337", "0.5841489", "0.5832478", "0.5810369", "0.5801244", "0.5747127", "0.57306874"...
0.70541716
0
Delete an image set.
def delete(log, session, args): log('imageset id: {highlight}{id}{reset}', highlight=Fore.GREEN, id=args.id, reset=Style.RESET_ALL) log.warn('delete imageset command coming soon.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_set(set_name):\n\n flg = logging.getLogger(\"lettuce.xgenSetup.delete_set\")\n\n flg.info(\"Set to delete: {}\".format(set_name))\n\n if mc.objExists(set_name):\n mc.select(set_name)\n old_objects = mc.ls(selection=True)\n flg.debug(\"Old Objects:\")\n for o in old_o...
[ "0.7083559", "0.6625625", "0.65320134", "0.6487162", "0.6302784", "0.62108546", "0.61581236", "0.61563313", "0.6123999", "0.6080582", "0.6059259", "0.6047355", "0.6043354", "0.60260856", "0.600469", "0.6001009", "0.5964619", "0.5953437", "0.5917767", "0.5909501", "0.58970803"...
0.81307465
0
Resolve all paths to a list of files.
def _resolve_paths(paths): allowed_ext = tuple(MIMES.keys()) resolved = [] for path in paths: if os.path.isdir(path): resolved.extend( entry.path for entry in os.scandir(path) if entry.is_file() and entry.name.lower().endswith(allowed_ext) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_specs(paths):\n specs = []\n for path in paths:\n if os.path.isdir(path):\n _, _, files = os.walk(path).next()\n specs.extend(os.path.join(path, fname) for fname in files)\n else:\n specs.append(path)\n return specs", "def handle_files_args(*pat...
[ "0.70843834", "0.7008949", "0.7005918", "0.6991757", "0.6980533", "0.6943847", "0.6908536", "0.6815965", "0.6810721", "0.67709655", "0.66659486", "0.66539854", "0.6626398", "0.6625859", "0.660965", "0.65911394", "0.6577185", "0.6509825", "0.6505772", "0.64861", "0.64778113", ...
0.7782248
0
Check if Public box has Y coordinate > head box's
def check_yposition(public_box, head_box): # Higher Y centroid condition h_centroid = compute_centroid(head_box) box_centroid = compute_centroid(public_box) if box_centroid[1] > h_centroid[1]: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_box(coords, box):\n\tif box[0][0] < coords[0] < box[1][0] and box[1][1] < coords[1] < box[0][1]:\n\t\treturn True\n\treturn False", "def check():\n mouse = pygame.mouse.get_pos()\n\n # mouse[0] = x-coordinate of mouse position.\n # mouse[1] = y-coordinate of mouse position.\n if box1.x + box1....
[ "0.68767154", "0.6867427", "0.6867155", "0.68380576", "0.67364043", "0.6676998", "0.65949243", "0.6590243", "0.659016", "0.65420324", "0.6540078", "0.6508726", "0.64178467", "0.64138055", "0.63922703", "0.636486", "0.63461787", "0.6325837", "0.62986743", "0.6255579", "0.62415...
0.84469277
0
Calculates the attribustes x_axis and y_axis of the image. These are the spatial axes, and \ can be used to find the spatial location of a pixel and are used in the plotting functions. If one wants to alter these axis, one can do this manually by running image.x_axis = ..., \ and image.y_axis = .... Returns None.
def calc_axes(self): y_axis = np.linspace(0, self.image_shape[0] - 1, self.image_shape[0]) x_axis = np.linspace(0, self.image_shape[1] - 1, self.image_shape[1]) if hasattr(self, 'pixelsize'): y_axis *= self.pixelsize[0] x_axis *= self.pixelsize[1] return x_axis, y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_axes(self):\n self.y_axis = np.linspace(0, self.image_shape[0] - 1, self.image_shape[0])\n self.x_axis = np.linspace(0, self.image_shape[1] - 1, self.image_shape[1])\n if hasattr(self, 'pixelsize'):\n self.y_axis *= self.pixelsize[0]\n self.x_axis *= self.pixelsi...
[ "0.75874233", "0.5822837", "0.5817969", "0.57584405", "0.57190233", "0.57038426", "0.5673402", "0.5554586", "0.54701406", "0.544219", "0.54328954", "0.5411503", "0.5408289", "0.5349925", "0.5347552", "0.5324715", "0.5292402", "0.5288886", "0.52761215", "0.52639616", "0.524531...
0.7306818
1
Return True if each character in pattern is found in order in instring.
def fuzzy_match_simple(pattern, instring): p_idx, s_idx, p_len, s_len = 0, 0, len(pattern), len(instring) while (p_idx != p_len) and (s_idx != s_len): if pattern[p_idx].lower() == instring[s_idx].lower(): p_idx += 1 s_idx += 1 return p_len != 0 and s_len != 0 and p_idx == p_len
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(query):\n i = 0\n for x in query:\n if i < len(pattern) and x == pattern[i]: i += 1\n elif x.isupper(): return False\n return i == len(pattern)", "def search_string(self, pattern):\n if not pattern:\n return True\n\n l...
[ "0.6986734", "0.63803357", "0.6278569", "0.6240252", "0.6181874", "0.6150704", "0.61025155", "0.6093655", "0.60356295", "0.60251266", "0.6010011", "0.5930002", "0.58766013", "0.58752376", "0.58708507", "0.58647394", "0.5857319", "0.58516085", "0.58455545", "0.5821804", "0.579...
0.68680596
1
The mocked value when mocked_translate is called
def mocked_translate(lur): lur = { "success": {"total": 1}, "contents": { "translated": "Hi,Zaafira, I am", "text": "Hi, I am Zaafira", "translation": "yoda", }, } json_response_mock = mock.Mock() json_response_mock.json.return_value = lur ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_translation(self):", "def test_simple_translation_using_get(self):\n pass", "def translate():\n pass", "def translate(self):\n pass", "def test_translation_smoke():\n english_to_morse = get_translator(\"english\", \"morse\")\n morse_to_english = get_translator(\"morse\", ...
[ "0.71579444", "0.6881472", "0.6809995", "0.6740325", "0.6596415", "0.65692574", "0.63575834", "0.6336652", "0.6304506", "0.62915236", "0.6259732", "0.62328964", "0.6221216", "0.6167749", "0.6110162", "0.6085425", "0.6049397", "0.6040752", "0.60180646", "0.5991216", "0.5950553...
0.7410818
0
Make the matrix look pretty
def pretty_print(self): out = "" rows,cols = self.matrix.shape for row in xrange(0,rows): out += "[" for col in xrange(0,cols): out += "%+0.2f "%self.matrix[row][col] out += "]\n" return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.matrix and '\\n'.join([\"|%s|\" % s for s in [' '.join([\"%-6.3f\" % e for e in w]) for w in self.matrix]]) or \"<pusta macierz>\"", "def print_matrix_on_screen(matrix, width=5):\n for row in matrix:\n print(''.join(['{0:>{w}}'.format(item, w=width) for item in ...
[ "0.71262836", "0.69080645", "0.6853885", "0.66841817", "0.66777855", "0.6670398", "0.6620714", "0.65799606", "0.6577681", "0.65713257", "0.65455055", "0.6541483", "0.64739263", "0.64697397", "0.64694947", "0.64253175", "0.6413195", "0.6405803", "0.6385066", "0.6358517", "0.63...
0.7403584
0
Tests if Rectangle inherits Base.
def test_inheritance(self): self.assertTrue(issubclass(Rectangle, Base))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_0_is_Rectangle_class(self):\r\n self.assertTrue(issubclass(type(self.S0), Rectangle) and\r\n type(self.S0) != Rectangle)", "def test_SquareinheritancefromRectangle(self):\n Square.reset_objects()\n self.assertEqual(issubclass(Square, Rectangle), True)", "def...
[ "0.7410984", "0.73879737", "0.71916723", "0.6733655", "0.64805657", "0.6343817", "0.61637074", "0.6104673", "0.59940827", "0.590253", "0.58446425", "0.5831769", "0.57768166", "0.5750307", "0.5746952", "0.574595", "0.57251126", "0.571214", "0.5711103", "0.56737524", "0.5669128...
0.86079776
0
Tests if id is inherited from Base.
def test_id_inherited(self): Base._Base__nb_objects = 98 r = Rectangle(2, 4) self.assertEqual(r.id, 99)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_baseid(self):\n self.assertEqual(str, type(BaseModel().id))", "def _has_base(cls, base):\n if cls is base:\n return True\n elif cls is None:\n return False\n try:\n for bs in cls.__bases__:\n if _has_base(bs, base):\n return True\n except...
[ "0.7071606", "0.68614566", "0.6663652", "0.6555642", "0.65274465", "0.6456492", "0.64129174", "0.6386005", "0.63816565", "0.6371645", "0.63647985", "0.6364053", "0.6361062", "0.6350097", "0.63280857", "0.6287805", "0.6272882", "0.6255194", "0.6255194", "0.6244298", "0.6238731...
0.6967543
1
Tests update() positional arg bad values.
def test_update_args_bad(self): r = Rectangle(5, 2) d = r.__dict__.copy() r.update(10) d["id"] = 10 self.assertEqual(r.__dict__, d) with self.assertRaises(ValueError) as e: r.update(10, -5) s = "width must be > 0" self.assertEqual(str(e.excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_update_kwarg(self):\r\n m0 = TestUpdateModel.create(count=5, text='monkey')\r\n with self.assertRaises(ValidationError):\r\n m0.update(numbers=20)", "def test_invalid_update_kwarg(self):\n m0 = TestUpdateModel.create(count=5, text='monkey')\n with self.asse...
[ "0.75484985", "0.7544116", "0.7184915", "0.7156995", "0.7053883", "0.7009638", "0.6897584", "0.6860641", "0.66748905", "0.6668533", "0.6648059", "0.65885854", "0.65509695", "0.6534375", "0.6524069", "0.64533055", "0.6448236", "0.64405257", "0.64405257", "0.64405257", "0.64384...
0.7652585
0
Append raw report item or bytes to HID report
def add_report_raw(self, report_data): self._reports.append(report_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_report_item(self, report_prefix, *report_data):\n hid_report = ReportDescriptorEmitter()\n report_len = _hid_item_length.index(len(report_data))\n hid_report.bHeader = {\n \"prefix\": report_prefix,\n \"bSize\": report_len\n }\n hid_report.data = re...
[ "0.7176925", "0.5762664", "0.56536555", "0.5579736", "0.5500773", "0.5449259", "0.5405908", "0.5357833", "0.52661437", "0.5226669", "0.5153525", "0.51037776", "0.5079036", "0.5062024", "0.5052433", "0.50386965", "0.50331897", "0.5029711", "0.5022681", "0.50067246", "0.5004431...
0.66093427
1
Convenience function to add formatted HID report item
def add_report_item(self, report_prefix, *report_data): hid_report = ReportDescriptorEmitter() report_len = _hid_item_length.index(len(report_data)) hid_report.bHeader = { "prefix": report_prefix, "bSize": report_len } hid_report.data = report_data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_report_formatting(self, cell_range: str, fmt_spec: gsfmt.CellFormat):\n self.report_formatting.append((cell_range, fmt_spec))", "def format(self, item):\n raise NotImplementedError()", "def addItem(self, track_dict):\n for i in ['order_id', 'sku', 'name', 'price', 'quantity']: # ...
[ "0.58909196", "0.57545817", "0.5592168", "0.5580048", "0.55122375", "0.54767895", "0.54133266", "0.53118646", "0.5274623", "0.52535117", "0.5248676", "0.523191", "0.5217867", "0.5205428", "0.515771", "0.5144452", "0.51378083", "0.51216", "0.5105966", "0.51056516", "0.5085843"...
0.70738643
0
Convenience function to add HID input item with preformatted flags. See HID 1.11 section 6.2.2.5 for flag meanings.
def add_input_item(self, data_constant = False, array_variable = True, absolute_relative = False, wrap = False, linear = False, preferred = True, null = False, volatile = False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_flag_entry(entry_message, data=''):\n return partial(__add_entry,\n event_type='FLAG',\n entry_message=entry_message,\n data=data)", "def add_special_input(self, input, number, logid='default-log'):\n cell = self.get_cell(number, logid)\n ...
[ "0.57880765", "0.5669327", "0.56324345", "0.55200225", "0.54979795", "0.5425436", "0.53873056", "0.5352823", "0.5308463", "0.5291668", "0.52721167", "0.52556586", "0.5171872", "0.5164225", "0.515738", "0.5134334", "0.5124091", "0.5116217", "0.50476795", "0.5022534", "0.502253...
0.56855875
1
Convenience function to add HID output item with preformatted flags. See HID 1.11 section 6.2.2.5 for flag meanings.
def add_output_item(self, data_constant = False, array_variable = True, absolute_relative = False, wrap = False, linear = False, preferred = True, null = False, volatile = Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_flags_into(into, flags):\n field_added = False\n \n for flag_name in flags:\n if field_added:\n into.append(', ')\n else:\n field_added = True\n \n into.append(flag_name.replace('_', ' '))\n \n return into", "def add_item(self, command, ...
[ "0.566925", "0.5456259", "0.53306985", "0.53150094", "0.518418", "0.51789975", "0.5112157", "0.5067346", "0.5030945", "0.49701762", "0.494928", "0.49411944", "0.49125028", "0.49066538", "0.48974305", "0.48620847", "0.48526123", "0.48305097", "0.483018", "0.48075736", "0.48072...
0.5750249
0
Lint the code with flake8.
def lint(session): session.install("flake8") session.run("flake8", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flake8():\n call([\"flake8\"])", "def flake8(context):\n exec_cmd = \"flake8 .\"\n run_cmd(context, exec_cmd)", "def lint(session):\n session.install(\"flake8\", BLACK_VERSION)\n session.run(\n \"black\",\n \"--check\",\n *BLACK_PATHS,\n )\n session.run(\"flake8\",...
[ "0.7826502", "0.7439914", "0.7414755", "0.7378273", "0.71720546", "0.6855276", "0.68128854", "0.6767506", "0.6689481", "0.66845065", "0.66831493", "0.66447073", "0.66055167", "0.6570661", "0.656754", "0.6563536", "0.65325195", "0.65315926", "0.65244573", "0.65235114", "0.6497...
0.83361983
0
Get the next unmarked number.
def __get_next_unmarked(self, current): while self.__is_multiple(current): current += 1 return current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_sequence_number(self):\n cur = self._next_sequence_number\n self._next_sequence_number += 1\n return cur", "def next_num(cls):\r\n cls.num += 1\r\n return cls.num", "def next(self) -> int:\n value = self.inorder[self.index]\n self.index = self.inde...
[ "0.70734465", "0.6977527", "0.6927917", "0.69086856", "0.6900802", "0.6900802", "0.67605877", "0.6751186", "0.67221344", "0.66767734", "0.6674278", "0.66321826", "0.66191983", "0.6531785", "0.6526116", "0.6522179", "0.6513542", "0.6510174", "0.6490269", "0.6476114", "0.644534...
0.76074725
0
Check, whether current index is a multiple of one of the already discovered primes.
def __is_multiple(self, current): for prime in self.primes: if current % prime == 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def esPrimo(self, x):\r\n divisor = 0\r\n for i in range(2, x+1):\r\n if x%i == 0:\r\n divisor = divisor + 1\r\n if divisor > 1:\r\n return False\r\n return True", "def is_prime(a):\n return all(a % i for i in xrange(2, a))", "...
[ "0.68746513", "0.68040067", "0.6702705", "0.6702675", "0.6682332", "0.66237456", "0.6601964", "0.65563357", "0.6531201", "0.652898", "0.65209794", "0.6499448", "0.6499271", "0.64508814", "0.6449261", "0.6444774", "0.6443582", "0.64350456", "0.6424135", "0.6399239", "0.6384989...
0.7993067
0
Sets gpu or cpu as device.
def set_device(gpu_arg): dev = 'cpu' if gpu_arg and torch.cuda.is_available(): dev = 'cuda' elif gpu_arg: print('Not gpu found. Using cpu instead.') return torch.device(dev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_device(self, cuda=True):\n if cuda and torch.cuda.is_available():\n self.cuda = True\n self.device = torch.device('cuda')\n else:\n self.cuda = False\n self.device = torch.device('cpu')\n\n if self.verbose:\n if not cuda:\n ...
[ "0.78580344", "0.76623416", "0.7637089", "0.7610789", "0.7605773", "0.75491273", "0.74247074", "0.7374936", "0.73403174", "0.7317237", "0.7289666", "0.72644484", "0.72399104", "0.7190007", "0.7136237", "0.69835097", "0.69794333", "0.684509", "0.67909247", "0.6786786", "0.6739...
0.767788
1
Returns classifier with the specified hidden units.
def create_classifier(model, hidden_units=None): defaul_nb_units = 4096 nb_units = hidden_units if hidden_units else defaul_nb_units input_features = model.classifier[0].in_features classifier = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(input_features, nb_units, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_classifier(model, hidden_units):\n in_features = model.classifier._modules['0'].in_features\n classifier = nn.Sequential(OrderedDict([\n ('dropout1', nn.Dropout(0.5)),\n ('fc1', nn.Linear(in_features, hidden_units)), \n ('relu', nn.ReLU()),\n ('dropout2', nn.Dropou...
[ "0.67934304", "0.60427326", "0.55828494", "0.54037946", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5377559", "0.5351114", "0.534234", "0.52754366", "0.5259303", "0.52519554", "0.52263665", "0.5193453...
0.67931324
1
finds score threshold closest to the given metric's value in recursive manner
def recursive_threshold_search( metric_name, metric_val, y_proba, y_true, sample_weights=None, verbose=False ): ts_next = np.linspace(0, 1, 11) prev_min = -1 prev_max = 999 ts_final = None n_points = 5 it = 0 eps_rel = 1e-3 while True: it += 1 ts, trps, fprs, purities...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best(template, config, key_seq, metric):\n possibles = get_deep(template, key_seq)\n if 1 == len(possibles):\n return None\n best_score = 2**60\n best_val = None\n for val in possibles:\n set_deep(config, key_seq, val)\n score = metric(config)\n #print \"FFFFFFFFF\", score\n if score <...
[ "0.6242058", "0.60764176", "0.60312897", "0.60109395", "0.5900902", "0.5883688", "0.5838622", "0.58243793", "0.58210593", "0.57580566", "0.5754754", "0.57176447", "0.56844616", "0.56624895", "0.56525797", "0.5631776", "0.56171566", "0.56144166", "0.56032133", "0.5601002", "0....
0.6865603
0
Delete a redshift cluster subnet group.
def _Delete(self): cmd = self.cmd_prefix + [ 'redshift', 'delete-cluster-subnet-group', '--cluster-subnet-group-name', self.name ] vm_util.IssueCommand(cmd, raise_on_failure=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_vm_group(session, cluster, vm_group):\n client_factory = session.vim.client.factory\n group_spec = client_factory.create('ns0:ClusterGroupSpec')\n groups = []\n\n group_spec.info = vm_group\n group_spec.operation = \"remove\"\n group_spec.removeKey = vm_group.name\n groups.append(gr...
[ "0.6717698", "0.65497667", "0.6535989", "0.6361416", "0.62842244", "0.6219916", "0.6177591", "0.6167533", "0.610994", "0.61087596", "0.60966676", "0.6096312", "0.6072783", "0.605781", "0.60560346", "0.6021917", "0.6014034", "0.6008268", "0.59907883", "0.59521925", "0.5951997"...
0.88937056
0
If an edge connects to a node (word), return the index of the node
def _get_connected(edge, idx): if str(edge[0]) == str(idx) and A.lookup[int(edge[1])]["word"] != Num: return edge[1] elif str(edge[1]) == str(idx) and A.lookup[int(edge[0])]["word"] != Num: return edge[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _edgeLabel(self, node, parent):\r\n return self.word[node.idx + parent.depth: node.idx + node.depth]", "def edge_index(indexed_triangle, edge):\n for i in range(3):\n triangle_edge = indexed_triangle[(i + 1) % 3], indexed_triangle[(i + 2) % 3]\n if triangle_edge == edge:\n ...
[ "0.65566194", "0.6190244", "0.61681044", "0.6073611", "0.60537326", "0.6007597", "0.5964232", "0.59039056", "0.5896506", "0.5844572", "0.5827229", "0.5819316", "0.57526916", "0.5712475", "0.57093567", "0.5697757", "0.5680633", "0.5608613", "0.5604437", "0.55679816", "0.556712...
0.732996
0
Calls _parse_patterns() to get words related to a measurement and provides deduplication between related words and grobid response
def _get_related(stats, match, patterns_file): all_related = None measurement_formats = ["space_between", "attached", "hyphenated"] all_related = _parse_patterns(match["unit_idx"], match["measurement_format"], patterns_file) if all_related == None: all_related = _parse_patterns(match["unit_idx"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processwords(list_of_matches, lemmatag = False):\n list_of_matches = [w.lower() for w in list_of_matches]\n # remove nonwords, strip . to normalise \"dr.\"\n if translated_option != 'o' and translated_option != 'u':\n list_of_matches = [w.lstrip('.').rstrip('.') for w in list_of...
[ "0.57819784", "0.55956167", "0.5446848", "0.53935367", "0.53138745", "0.5262453", "0.52373886", "0.52355427", "0.51643676", "0.5153938", "0.51286644", "0.5086422", "0.50284916", "0.502709", "0.50240386", "0.50169647", "0.5012645", "0.5007658", "0.49831492", "0.49702612", "0.4...
0.68618006
0
Parse domain and problem PDDL files.
def load_pddl(domain_file, problem_dir, operators_as_actions=False): domain = PDDLDomainParser(domain_file, expect_action_preds=(not operators_as_actions), operators_as_actions=operators_as_actions) problems = [] problem_files = [f for f in glob.glob(os.path.join(problem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_domain(self, domainfile):\n\n with open(domainfile) as dfile:\n dfile_array = self._get_file_as_array(dfile)\n #Deal with front/end define, problem, :domain\n if dfile_array[0:4] != ['(', 'define', '(', 'domain']:\n print('PARSING ERROR: Expected (define (domain ... at start of domain ...
[ "0.66505396", "0.6467314", "0.64256436", "0.6325676", "0.61804026", "0.5982076", "0.5869378", "0.5819066", "0.56918544", "0.56028837", "0.5583641", "0.55689293", "0.5557211", "0.55362827", "0.54675335", "0.53722394", "0.53335005", "0.52810735", "0.5267228", "0.52543795", "0.5...
0.734066
0