query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return the indices for the lowertriangle of an (n,n) array. See tril_indices() for full details.
def tril_indices_from(arr, k=0): if not arr.ndim == 2 and arr.shape[0] == arr.shape[1]: raise ValueError("input array must be 2-d and square") return tril_indices(arr.shape[0], k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _low_tri_indices(rowCount):\n for col in range(rowCount):\n for row in range(col, rowCount):\n yield (row, col)", "def tril_indices_from(arr,k=0):\r\n if not arr.ndim==2 and arr.shape[0] == arr.shape[1]:\r\n raise ValueError(\"input array must be 2-d and square\")\r...
[ "0.6915391", "0.67987496", "0.65410584", "0.6302033", "0.623863", "0.6140856", "0.60972863", "0.6071643", "0.60648185", "0.6039057", "0.5880452", "0.5821349", "0.5819102", "0.5784379", "0.5778272", "0.5654866", "0.56012547", "0.5582346", "0.5513181", "0.54886335", "0.5440669"...
0.67954814
2
Return the indices for the lowertriangle of an (n,n) array. See triu_indices() for full details.
def triu_indices_from(arr, k=0): if not arr.ndim == 2 and arr.shape[0] == arr.shape[1]: raise ValueError("input array must be 2-d and square") return triu_indices(arr.shape[0], k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _low_tri_indices(rowCount):\n for col in range(rowCount):\n for row in range(col, rowCount):\n yield (row, col)", "def triu_indices(n, k=0):\r\n return mask_indices(n, np.triu, k)", "def triu_indices_from(arr,k=0):\r\n if not arr.ndim==2 and arr.shape[0] == arr.shape[...
[ "0.6920195", "0.6518244", "0.64286083", "0.6375073", "0.6312076", "0.6288035", "0.6110235", "0.6106193", "0.6007436", "0.59465086", "0.5918727", "0.584876", "0.5715867", "0.5681119", "0.5523499", "0.54965115", "0.5461257", "0.5448224", "0.5402353", "0.5378034", "0.53777033", ...
0.63998467
3
Minmax_norm an array to [0,1] range. By default, this simply rescales the input array to [0,1]. But it has a special 'folding' mode that allows for the normalization of an array with negative and positive values by mapping the negative values to their flipped sign
def minmax_norm(arr, mode='direct', folding_edges=None): if mode == 'direct': return rescale_arr(arr, 0, 1) else: fa, fb = folding_edges amin, amax = arr.min(), arr.max() ra, rb = float(fa - amin), float(amax - fb) # in case inputs are ints if ra < 0 or rb < 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minmax_norm(X):\n return (X - tf.reduce_min(X))/(tf.reduce_max(X)-tf.reduce_min(X))", "def minmax_normalize(X):\n # X -= X.min()\n # X /= X.max()\n # X -= 0.5\n X = (X-X.min()) / (X.max() - X.min())\n return X", "def normalize_array(a, norm_max=255):\n c = a - np.min(a.flatten())\n ...
[ "0.7284555", "0.7233537", "0.70358807", "0.7013145", "0.6896299", "0.6878173", "0.68367726", "0.68146795", "0.680843", "0.6792714", "0.67869765", "0.6782714", "0.6733006", "0.6628921", "0.6627763", "0.6594137", "0.6551671", "0.6543267", "0.65072", "0.64708847", "0.6451225", ...
0.76883554
0
Gets or sets the LCID of the default working language.
def default_language_tag(self): return self.properties.get("defaultLanguageTag", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpwDefaultLanguage(self):\n parent = self.getFolderWhenPortalFactory()\n if hasattr(parent, 'getRawLanguage') and parent.getRawLanguage():\n return parent.getRawLanguage()\n tool = getToolByName(self, 'portal_languages', None)\n if tool is not None:\n return tool.getDefaultLanguage()\...
[ "0.67252374", "0.67132485", "0.6583152", "0.65031195", "0.6388692", "0.6318578", "0.62904686", "0.62530136", "0.61738086", "0.60826886", "0.6066076", "0.5921665", "0.59073246", "0.58792377", "0.587187", "0.58673817", "0.58673817", "0.5858344", "0.5839509", "0.58070004", "0.58...
0.6382949
5
Take iteratively a list of lists (at any depth level) and replace strings with the corresponding values in the ``replacements`` dictionary, leaving other types of values (floats, ints, ...) untouched.
def replace_symbols_with_values(list_of_lists, replacements): if isinstance(list_of_lists, str): # Check this first, a str is also Iterable try: return replacements[list_of_lists] except KeyError: raise ValueError("Unknown replacement '{}'".format(list_of_lists)) elif is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lister(list_value):\n\n for item in list_value:\n if isinstance(item, basestring):\n index = list_value.index(item)\n rep, fact = replacer(replace_value=item)\n if fact is True:\n list_value[index] = rep\n\n elif isins...
[ "0.7328084", "0.65288645", "0.63042635", "0.61600924", "0.6150874", "0.6146234", "0.61287457", "0.6100591", "0.60866344", "0.59514093", "0.5926102", "0.5923358", "0.58994913", "0.5883214", "0.57942194", "0.57649446", "0.57306576", "0.57287914", "0.567047", "0.5664356", "0.566...
0.787785
0
Return True if this configuration is more promising than the other configuration. Return False, otherwise. other [Configuration] A configuration to be compared against.
def __lt__(self, other): # Prioritize depth (as seen in https://gatech.instructure.com/courses/60478/external_tools/81). return (self._lower_bound / len(self._path)) < (other._lower_bound / len(other._path)) # Prioritize breadth. # return self._lower_bound < other._lower_bound
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_better_than(self, other):\n return better_candidate(self, other) is self", "def __le__(self, other):\n if self.assumptions >= other.assumptions and self.guarantees <= other.guarantees:\n return True\n else:\n return False", "def pareto_better(self, other: \"Eva...
[ "0.64952344", "0.6361276", "0.6331951", "0.63219094", "0.62310445", "0.6206093", "0.6198686", "0.61745304", "0.61286753", "0.6126356", "0.6107015", "0.6063182", "0.6052645", "0.6046647", "0.6046409", "0.6041691", "0.60402006", "0.6039535", "0.6031541", "0.60158926", "0.600875...
0.0
-1
================================= PolyArea(Coords) ================================= PolyArea method calculates the the area between given coordinates
def PolyArea(Coords): area = 0.0 for i in range(np.shape(Coords)[0]-1): # cros multiplication area = area + Coords[i,0]*Coords[i+1,1] - Coords[i+1,0]*Coords[i,1] area = area + Coords[np.shape(Coords)[0]-1,0] * Coords[0,1] - Coords[0,0] * Coords[np.shape(Coords)[0]-1,1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_polyarea(self):\n\n xcoords, ycoords = [0, 1, 1, 0, 0], [0, 0, 1, 1, 0]\n xycoords = np.stack((xcoords, ycoords), axis=1)\n\n # Area calculation from separately provided x, y coordinates\n self.assertEqual(po.polyarea(x=xcoords, y=ycoords), 1.)\n # Area calculation from ...
[ "0.7660596", "0.6941791", "0.691497", "0.69061804", "0.6866345", "0.68043923", "0.6796453", "0.66859275", "0.6653946", "0.65201116", "0.65052724", "0.6473968", "0.6422775", "0.6399194", "0.63607675", "0.63464886", "0.6317268", "0.63078225", "0.62860596", "0.6282358", "0.62781...
0.88923025
0
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if not self.weight_decay_rate:\n return False\n if self.exclude_from_weight_decay:\n for r in self.exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, ...
[ "0.70576096", "0.70576096", "0.70576096", "0.70576096", "0.70576096", "0.70423925", "0.70372206", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54...
0.6972458
10
Find unique elements with no sorting `np.unique` automatically sorts the elements. This function performs unique without sorting.
def unsorted_unique(a): indexes = np.unique(a, return_index = True)[1] a_unique = np.array(a)[sorted(indexes)] return a_unique
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(x):\n try:\n tmp = x.flatten()\n if tmp.size == 0:\n return tmp\n tmp.sort()\n idx = concatenate(([True],tmp[1:]!=tmp[:-1]))\n return tmp[idx]\n except AttributeError:\n items = list(set(x))\n items.sort()\n return asarray(items)",...
[ "0.7478786", "0.74142015", "0.73412406", "0.7268737", "0.70536083", "0.70365417", "0.69937575", "0.6883788", "0.68330574", "0.68282515", "0.6805953", "0.679551", "0.6792309", "0.67606246", "0.6749091", "0.67360646", "0.6685073", "0.66730833", "0.6657492", "0.6640093", "0.6629...
0.799677
0
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
81
Converts 24hour to 12hour
def get_hour(hour): if int(hour) == 0: return 12 elif int(hour) > 12: return int(hour) - 12 else: return hour
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_24hr_12ampm(military_hr): \n\t\n if military_hr == 0:\n hour_ampm_str = \"12am\"\n elif military_hr == 12:\n hour_ampm_str = \"12pm\"\n elif military_hr > 12:\n hour_ampm_str = str(military_hr - 12) + \"pm\"\n else:\n hour_ampm_str = str(military_hr) + \"...
[ "0.7625113", "0.7294379", "0.7241502", "0.71635115", "0.66807926", "0.63957155", "0.62780315", "0.6178499", "0.6173807", "0.60119456", "0.6006579", "0.59903944", "0.5978709", "0.59654665", "0.5895357", "0.58833545", "0.5771594", "0.5713515", "0.56888896", "0.5683352", "0.5646...
0.6504288
5
Returns True if the given program is currently running.
def is_running(program): #cmd = ["xdotool", "search", "--name", program] cmd = ["xdotool", "search", "--name", "--class", "--classname", program] try: subprocess.check_output(cmd) return True except: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running(program):\n return program in get_running()", "def is_program_running(self, wait=False):\n # return True\n return self._dict[\"RobotModeData\"][\"isProgramRunning\"]", "def is_running(self):\n if self._process:\n return self._process.poll() is None\n els...
[ "0.8601203", "0.7513488", "0.7414403", "0.73770154", "0.7352604", "0.73463315", "0.703847", "0.70161116", "0.7002891", "0.7002866", "0.70019954", "0.6966748", "0.6958656", "0.69293535", "0.68999815", "0.68864244", "0.68839884", "0.6853673", "0.681213", "0.67967826", "0.676754...
0.7487789
2
Populate the field choices from the facets returned by solr.
def populate_from_facets(self, facet_dict): # generate the list of choice from the facets self.choices = ( ( val, mark_safe(f'<span>{label}</span><span class="count">{count:,}</span>'), ) for val, (label, count) in facet_dict.items() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_choices_from_facets(self, facets):\n # borrowed from ppa-django;\n # populate facet field choices from current facets\n for key, facet_dict in facets.items():\n # restructure dict to set values of each key to tuples of (label, count)\n if key == \"type\":\n ...
[ "0.80590487", "0.7063723", "0.60578656", "0.6040489", "0.5894335", "0.57969373", "0.5786153", "0.56324756", "0.56004053", "0.55998075", "0.55789626", "0.55137926", "0.54421455", "0.54349613", "0.5418743", "0.54002786", "0.53556687", "0.53157043", "0.53111494", "0.53085494", "...
0.7238788
1
Override to set choices dynamically based on form kwargs.
def __init__(self, data=None, *args, **kwargs): super().__init__(data=data, *args, **kwargs) # if a keyword search term is not present, relevance sort is disabled if not data or not data.get("q", None): self.fields["sort"].widget.choices[0] = ( self.SORT_CHOICES[0][0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super(ChoiceFieldType, self).__init__(*args, **kwargs)\n\n self.choices = self.get_field_info_key('choices')", "def __init__(self, choices, *args, **kwargs):\n super(RangePollChoiceForm, self).__init__(*args, **kwargs)\n nominees = [(i, '%d' % i)...
[ "0.7119993", "0.6567286", "0.6486634", "0.6474941", "0.63352865", "0.6249103", "0.62429094", "0.6121085", "0.6090814", "0.6076994", "0.6058891", "0.6036008", "0.59917676", "0.5949317", "0.5949317", "0.5927481", "0.58945143", "0.5876327", "0.5872306", "0.58716255", "0.58630127...
0.0
-1
Check if any filters are active; returns true if form fields other than sort or q are set
def filters_active(self): if self.is_valid(): return bool( { k: v for k, v in self.cleaned_data.items() if k not in ["q", "sort"] and bool(v) } ) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_filter(self) -> bool:\n return self.filter_client_reference_id or self.filter_mhr_number or self.filter_registration_type or \\\n self.filter_reg_start_date or self.filter_status_type or self.filter_submitting_name or \\\n self.filter_username", "def _has_filters(self):\n ...
[ "0.7080668", "0.6836207", "0.64199954", "0.6332674", "0.62339914", "0.61433935", "0.60258555", "0.59678966", "0.59262854", "0.5903156", "0.5870578", "0.58646816", "0.58277124", "0.5797073", "0.5791555", "0.5785562", "0.57828933", "0.57690144", "0.56758165", "0.5664973", "0.56...
0.8471296
0
Set choices on field from a dictionary of facets
def set_choices_from_facets(self, facets): # borrowed from ppa-django; # populate facet field choices from current facets for key, facet_dict in facets.items(): # restructure dict to set values of each key to tuples of (label, count) if key == "type": # fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_from_facets(self, facet_dict):\n # generate the list of choice from the facets\n\n self.choices = (\n (\n val,\n mark_safe(f'<span>{label}</span><span class=\"count\">{count:,}</span>'),\n )\n for val, (label, count) in facet...
[ "0.7637493", "0.71201366", "0.6388311", "0.60933596", "0.608541", "0.57787716", "0.5755802", "0.55631715", "0.54339904", "0.53833526", "0.53487647", "0.5343062", "0.53065604", "0.5274133", "0.5268373", "0.5259151", "0.52481985", "0.52074957", "0.5202937", "0.51360047", "0.511...
0.7996882
0
Convert search terms to a list (or a list of lists for OR searches).
def parse_search_terms(self, search_terms): # v. kludgish.. TODO: do this a little more gracefully self.search_terms, b = [], [] for index, st in enumerate(search_terms): if st == "OR": self.search_terms.append(b) b = [] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_search_terms(self):\n params = self.request.QUERY_PARAMS.get(\"search\", \"\")\n return params.replace(\",\", \" \").split()", "def make_a_list_out_of_this(phrase):\n # below splits the phrase, which defaults at space \" \" and returns the individual elements\n # as elements within a ...
[ "0.7051989", "0.63229024", "0.619517", "0.6166594", "0.6073278", "0.6048257", "0.6040583", "0.6035922", "0.6019714", "0.5997594", "0.59335583", "0.5927805", "0.5913225", "0.5887079", "0.5871488", "0.5871488", "0.5871488", "0.5871488", "0.5871488", "0.5871488", "0.5871488", ...
0.7518105
0
save transition(state, action, state_next, reward) on memory
def push(self, state, action, state_next, reward): if len(self.memory) < self.capacity: self.memory.append(None) self.memory[self.index] = Transition(state, action, state_next, reward) self.index = (self.index+1) % self.capacity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember(self, state, action, reward, next_state, done):\n self.memory.store_transition(state, action, reward, next_state, done)", "def store(self, state, action, reward, next_state, done):\n self.replay_memory.append((state, action, reward, next_state, done))", "def store_transition(self, st...
[ "0.81000483", "0.8027368", "0.78706765", "0.76570886", "0.75655365", "0.7512147", "0.7491534", "0.73119557", "0.71542925", "0.71443164", "0.71415216", "0.7053323", "0.70417786", "0.7034522", "0.7028102", "0.7010787", "0.6998984", "0.6982629", "0.6809534", "0.6782573", "0.6759...
0.6870067
19
declaring the ball bouncing sideways
def sidebounce(self): self.dx=-self.dx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounce(self):\n self.y_dir *= -1 # Reverse vertical direction of travel", "def bouncing(self):\n x = random.randint(-250, 250) # where the ball will bounce on the X axis\n left_x = -850\n right_x = 850\n rand_y = random.randint(-350, 350) # ...
[ "0.7574964", "0.7515203", "0.7491813", "0.74432164", "0.71614474", "0.7153035", "0.7122904", "0.71047884", "0.7007704", "0.6916456", "0.69102883", "0.6866098", "0.6783909", "0.67050475", "0.6702499", "0.66933817", "0.66898984", "0.6663798", "0.6630958", "0.6604508", "0.659512...
0.7086912
8
declaring the ball bouncing up and down
def vertbounce(self): self.dy=-self.dy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounce(self):\n self.y_dir *= -1 # Reverse vertical direction of travel", "def bouncing(self):\n x = random.randint(-250, 250) # where the ball will bounce on the X axis\n left_x = -850\n right_x = 850\n rand_y = random.randint(-350, 350) # ...
[ "0.7443454", "0.7435364", "0.7231348", "0.71967846", "0.71241635", "0.70315075", "0.69760346", "0.69474584", "0.68942976", "0.6885569", "0.6880939", "0.68434185", "0.68222255", "0.6810306", "0.67980486", "0.67504054", "0.6747686", "0.66573983", "0.66539973", "0.66507787", "0....
0.63047105
45
Returns the default collector settings
def get_default_config(self): config = super(InterruptCollector, self).get_default_config() config.update({ 'path': 'interrupts' }) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config", "def getDefaultSettings():\n return {}", "def ge...
[ "0.70514023", "0.7008024", "0.69490683", "0.6713433", "0.65743333", "0.65309024", "0.6521635", "0.6515402", "0.6466526", "0.6447688", "0.641337", "0.6397818", "0.6380512", "0.63683224", "0.6357208", "0.63517016", "0.6331759", "0.63120294", "0.62353724", "0.6231899", "0.620749...
0.60192394
34
Tokenize a URL. Tokens are split by slash, hyphen, and dot. Redundant tokens are removed. The token "com" is removed from the list since it is a common TLD that should not be used for our purposes. Mostly taken from the website linked above.
def getTokens(input): tokensSlash = str(input).split('/') allTokens = [] for i in tokensSlash: tokensDash = str(i).split('-') for j in tokensDash: tokensDot = str(j).split('.') allTokens += tokensDot allTokens = list(set(allTokens)) # remove duplicates if 'com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenizer(url):\r\n \r\n # Split by slash (/) and dash (-)\r\n tokens = re.split('[/-]', url)\r\n \r\n for i in tokens:\r\n # Include the splits extensions and subdomains\r\n if i.find(\".\") >= 0:\r\n dot_split = i.split('.')\r\n \r\n # Remove .com and www. since they're too common\r...
[ "0.82837254", "0.6683614", "0.65632266", "0.65571535", "0.6469438", "0.63540983", "0.632796", "0.6115311", "0.610945", "0.6071607", "0.60541517", "0.6024393", "0.602004", "0.6001426", "0.5957862", "0.59482783", "0.59318495", "0.5814034", "0.5753137", "0.57478493", "0.5671944"...
0.6450165
5
If this request connected to the database, close the connection.
def close_db(e=None): db = g.pop("db", None) if db is not None: db.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection(self):\n if self.cursor is None and self.database is None:\n # if we don't have an open connection, do nothing\n return\n self.cursor.close()\n self.database.close()", "def close_connection(self):\r\n if self.conn:\r\n self.conn.cl...
[ "0.791105", "0.78456587", "0.7779806", "0.7770918", "0.77147144", "0.7697585", "0.7648415", "0.76399857", "0.7614764", "0.76102906", "0.76046777", "0.7591181", "0.7585446", "0.7566851", "0.75368667", "0.7525689", "0.7525689", "0.7523575", "0.75219256", "0.75145125", "0.751207...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if entry.data.get(CONF_ID): # discovery scanner = YeelightScanner.async_get(hass) scanner.async_unregister_callback(entry.data[CONF_ID]) data_config_entries = hass.data[DOMAIN][DATA_CONFIG_ENTRIES] if ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.5683943
87
Return the name of the device if any.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")", "def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):...
[ "0.89734465", "0.89734465", "0.8584627", "0.8584627", "0.8584627", "0.8502048", "0.84944665", "0.84194607", "0.83955586", "0.83955586", "0.8379756", "0.83165", "0.8306566", "0.8161454", "0.81564134", "0.8090303", "0.8087526", "0.8073198", "0.8006941", "0.7999654", "0.79544145...
0.0
-1
Return configured/autodetected device model.
def model(self): return self._bulb_device.model or self.capabilities.get("model")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supported_model(cls, device):\n return None", "def model(self):\n return self.device.settings[\"device\"][\"type\"]", "def model(self):\n return self.device.settings[\"device\"][\"type\"]", "def model(self):\n return self._device.device_data[self._uuid]['model']", "def _get_...
[ "0.7814992", "0.7760358", "0.7760358", "0.7719326", "0.76947623", "0.75276107", "0.745283", "0.73386544", "0.72140396", "0.71829504", "0.7153023", "0.7002003", "0.6883547", "0.6857624", "0.6803161", "0.6788081", "0.6788081", "0.677621", "0.67729807", "0.6772032", "0.67400897"...
0.7694132
5
Return the firmware version.
def fw_version(self): return self.capabilities.get("fw_ver")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def firmware_version(self):\n return self._get_system_status()[\"firmware\"]", "def firmware_version(self):\n return self.data.get('fw_ver')", "def firmware_version(self):\n return self._read(MX_FIRMWARE_VERSION)", "def firmware_version(self) -> str:\n return self._firmware_version", ...
[ "0.91053015", "0.90760416", "0.88984925", "0.87939864", "0.85300636", "0.8452078", "0.8353373", "0.8342278", "0.82618773", "0.8160373", "0.8121713", "0.80289775", "0.785214", "0.7839132", "0.78162473", "0.779018", "0.7787568", "0.7752623", "0.7739528", "0.77232605", "0.764563...
0.82181937
9
Get state of a run.
def state_run(id_, **kwargs): run = get_run_object(id_) check_run_permission(run, kwargs["token_info"]) stub = get_runs_services_stub() state = stub.State(job_pb2.ID(id=id_)) return util.deserialize_protobuf(state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self, run_id):\n raise NotImplementedError()", "def _get_run_state(self):\n if not self._run_state:\n state = self.lookup_enum([\"State\", \"state\"])\n if not state:\n self._run_state = STATE_DISHWASHER_POWER_OFF\n else:\n ...
[ "0.8303289", "0.7580644", "0.72310287", "0.7101051", "0.70998746", "0.70603585", "0.6967478", "0.6943568", "0.6943568", "0.69122666", "0.69095355", "0.6900038", "0.67927146", "0.67927146", "0.67927146", "0.67927146", "0.67927146", "0.67927146", "0.67927146", "0.67927146", "0....
0.70548785
6
Encode float x between 1 and 1 as two bytes.
def encode(x): i = int(16384 * x) return Struct("h").pack(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float_to_bin (x):\n assert type (x) is float\n s_hex = float.hex (x)\n hex_parts = RE_FLOAT_HEX_PARTS.match (s_hex)\n assert hex_parts\n \n s = hex_parts.group ('sign')\n m = hex_parts.group ('mantissa')\n se = hex_parts.group ('signexp')\n e = hex_parts.group ('exp')\n \n # Ma...
[ "0.6785549", "0.6759016", "0.6680987", "0.66505665", "0.662883", "0.64889437", "0.63726604", "0.630351", "0.6209765", "0.62045646", "0.6081865", "0.60710794", "0.6036422", "0.5979504", "0.5974094", "0.59223753", "0.59071773", "0.5883423", "0.5873075", "0.5860104", "0.58443576...
0.6047133
12
This implements the transition rule for `DiscreteOperator`s that are implemented in Numba, relying on the `_get_conn_flattened_closure` hack to make it work in numba.
def transition(rule, sampler, machine, parameters, state, key, σ): get_conn_flattened = rule.operator._get_conn_flattened_closure() n_conn_from_sections = rule.operator._n_conn_from_sections @njit4jax( ( jax.core.ShapedArray(σ.shape, σ.dtype), jax.cor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_elemwise_collapse6():\r\n\r\n shape = (4, 5)\r\n a = cuda_ndarray.CudaNdarray(theano._asarray(numpy.random.rand(*shape),\r\n dtype='float32'))\r\n a = theano._asarray(numpy.random.rand(*shape), dtype='float32')\r\n a2 = tcn.shared_constructor(a, ...
[ "0.51484096", "0.51231897", "0.51228565", "0.51168275", "0.51148343", "0.5103216", "0.5087262", "0.50657254", "0.5040118", "0.5037648", "0.503456", "0.49885952", "0.49673176", "0.49512547", "0.49469128", "0.49255267", "0.49127", "0.49111798", "0.4894093", "0.4880861", "0.4880...
0.5040553
8
This method returns an C{L{Association }} object from storage that matches the server URL and, if specified, handle. It returns C{None} if no such association is found or if the matching association is expired. If no handle is specified, the store may return any association which matches the server URL. If multiple ass...
def getAssociation(self, server_url, handle=None): query = models.Association.all().filter('url', server_url) if handle: query.filter('handle', handle) results = query.fetch(1) if len(results) > 0: assoc = xAssociation.deserialize(results[0].association) if assoc.getExpiresIn() > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAssociation(self, server_url, handle=None):\r\n query = datastore.Query('Association', {'url =': server_url})\r\n if handle:\r\n query['handle ='] = handle\r\n\r\n results = query.Get(1)\r\n if results:\r\n association = Association.deserialize(results[0]['association'])\r\n if as...
[ "0.8252874", "0.7968647", "0.64924496", "0.56788737", "0.5608735", "0.54203457", "0.5216578", "0.5071828", "0.5055335", "0.5009243", "0.47736675", "0.47469217", "0.46448871", "0.46135944", "0.455419", "0.44928598", "0.4466715", "0.4424121", "0.4370101", "0.43319282", "0.43189...
0.82745373
0
Try to read JSON in from a given filename in a predefined folder
def json_from_cache(file_name: str) -> Optional[Dict]: json_path = os.path.join(CACHE_DIR, file_name) try: with open(json_path, "r") as cache_file: return json.load(cache_file) except IOError: log.notice(f"Could not read JSON from {json_path}") return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json(filename, folder):\n with open(os.path.join(folder, filename), 'r') as f:\n return json.load(f)", "def read(self, filepath, dirpath=None):\n try:\n #filepath = os.path.normpath(filepath)\n with open(filepath) as f_p:\n try:\n ...
[ "0.78811336", "0.7738723", "0.75594205", "0.7472893", "0.73200166", "0.7311021", "0.72802764", "0.72781163", "0.72756505", "0.7247823", "0.7241469", "0.7240698", "0.7236071", "0.72337574", "0.722172", "0.72010195", "0.71961516", "0.7191366", "0.71849084", "0.7180382", "0.7170...
0.0
-1
Write some JSON to disk in a predefined folder
def json_to_cache(new_json: Dict, file_name: str) -> None: json_path = os.path.join(CACHE_DIR, file_name) ensure_dir(json_path) with open(json_path, "w") as outfile: json.dump(new_json, outfile, ensure_ascii=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_write(data, path, **kwargs):\n with open(_fsdecode(path), 'wt') as file:\n _json_dump(data, file, **kwargs)", "def write_json_to_file(directory_string, json_content):\n with open(directory_string, \"w\") as file:\n json.dump(json_content, file, default = datetime_converter, indent=4)...
[ "0.74848944", "0.7479136", "0.74114686", "0.7384584", "0.73417526", "0.7338813", "0.7332835", "0.7332598", "0.7312433", "0.7296761", "0.72937536", "0.7285341", "0.7274363", "0.72626615", "0.72577494", "0.72566205", "0.72413695", "0.71605885", "0.713893", "0.70802534", "0.7065...
0.0
-1
Get the child groups for a set of flashes.
def get_groups(self, flash_ids, combine=False, events=False): # TODO: This (and more) is very similar to GLM class. Possible refactor? flash_ids = np.atleast_1d(flash_ids) grps = list() evs = list() for _id in flash_ids: this_grps = self.groups[self.groups.parent_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self):\n #return self.get('{}/groups'.format(ApiVersion.A1.value))\n return self.get('{}/groups'.format(ApiVersion.CM1.value))", "def getChildGroups(self):\n\t\tgroupPrefix = self.__DELIMITER.join(self.__currentGroupNames)\n\t\tif groupPrefix:\n\t\t\tgroupPrefix += self.__DELIMITER\n\t\tskipLen ...
[ "0.61722964", "0.6113781", "0.6082348", "0.604792", "0.598803", "0.58479667", "0.58220893", "0.58102953", "0.5765848", "0.5728987", "0.5690098", "0.5671721", "0.5670547", "0.5670547", "0.5670547", "0.5628724", "0.5626731", "0.5606168", "0.56034815", "0.5591773", "0.55861884",...
0.6229909
0
Tells if the local data has been modified since it was last refreshed
def isDataChanged(self): return bool(self._dirty or self.ui.channelEditor.getQModel().isDataChanged() or self._dirtyMntGrps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_been_modified(self):\n return self._has_been_modified", "def check_modified(self) -> bool:\n return bool(self._modified)", "def is_updated(self):\n return self.timestamp > 0", "def is_modified(self):\n return len(self.modified_fields) > 0", "def modified(self):\r\n\t\tre...
[ "0.77544016", "0.75397485", "0.7535442", "0.7460288", "0.7453128", "0.74410504", "0.73521644", "0.7275266", "0.72691524", "0.7264193", "0.7252178", "0.7241687", "0.7185961", "0.7168969", "0.70613486", "0.7055726", "0.7055726", "0.69904816", "0.6983502", "0.6983502", "0.698188...
0.68099415
28
>>> v = vector(4,0,0) >>> normalize(v) array([1., 0., 0., 0.]) >>> v = vector(1,2,3) >>> sq = np.sqrt(1+4+9) >>> normalize(v) array([0.26726124, 0.53452248, 0.80178373, 0. ])
def normalize(v): return v * (1.0 / magnitude(v))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(v):\n return v / np.linalg.norm(v)", "def normalize(v):\n return np.array(v) / np.linalg.norm(v)", "def normalizeVector(v):\n normalizer = 1.0 / sum(v)\n\n normalized = [i * normalizer for i in v]\n return normalized", "def normalize(v):\n det = math.sqrt(v[0] * v[0] + v[1] * ...
[ "0.84684175", "0.83600307", "0.7966934", "0.7961107", "0.79584414", "0.79327613", "0.7847324", "0.77168113", "0.77132595", "0.76763064", "0.76481354", "0.75995773", "0.7579817", "0.73899406", "0.73883694", "0.7385038", "0.73823106", "0.7381569", "0.7349965", "0.7343471", "0.7...
0.7832228
7
>>> v1 = vector(3, 6, 9) >>> v2 = vector(2, 3, 4) >>> dot(v1, v2) == 3 2 + 6 3 + 9 4 True
def dot(a, b): return np.vdot(a.arr,b.arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)", "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", "def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)", "def dot(vector_1: List, vector_2: List) -> float:\n if len(vector_1) != ...
[ "0.88122493", "0.86702555", "0.8504177", "0.82725835", "0.82243925", "0.8220707", "0.8164983", "0.81025153", "0.8096341", "0.8096223", "0.80932814", "0.8056855", "0.8050023", "0.80483824", "0.8041949", "0.800086", "0.7998581", "0.79893374", "0.79833156", "0.7967807", "0.79503...
0.7924043
22
>>> v1 = vector(1,2,3) >>> v2 = vector(2,3,4) >>> cross(v1, v2) == vector(1,2,1) True >>> v1 = vector(1,2,3) >>> v2 = vector(2,3,4) >>> cross(v2, v1) == vector(1,2,1) True
def cross(a, b): #return np.cross(a,b) return vector(a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cross():\n assert_equal(cross(Vector(1, 0, 0), Vector(0, 1, 0)), Vector(0, 0, 1))\n assert_equal(cross(Vector(1, 3, 2), Vector(-1, 1, 0)), Vector(-2, -2, 4))", "def cross(vec1, vec2):\n result = np.zeros(3)\n return cross_(vec1, vec2, result)", "def cross(v1, v2):\n return np.cross(v1, ...
[ "0.8349134", "0.8341183", "0.8287545", "0.8215939", "0.80601215", "0.7885663", "0.77149785", "0.7711978", "0.7614333", "0.7572743", "0.72729856", "0.72538966", "0.7241052", "0.7236763", "0.7164063", "0.71631855", "0.70576525", "0.70266217", "0.70214224", "0.70137423", "0.7005...
0.7871695
6
Return device specific state attributes.
def extra_state_attributes(self) -> dict[str, str]: if self._cmode is None: return {} return {ATTR_CMODE: self._cmode}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self): # Can be remove from 0.99\n return self._attr", "def device_stat...
[ "0.87326586", "0.87130606", "0.87130606", "0.8661474", "0.86244243", "0.86244243", "0.86156", "0.8589153", "0.85687816", "0.85626554", "0.85169643", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "...
0.0
-1
Schedule a new longpoll. The scheduling needs to be done through a separate task, and not from inside the task itself as the runonce lock is checked while scheduling rather then at execution time.
def task_schedule_new_fetch_and_lock(): task_fetch_and_lock.delay()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start_polling(self):\n self._handle = asyncio.get_event_loop().create_task(self._poll())", "def _schedule_task(self, task: _Task) -> None:\n if isinstance(task.interval, (int, float)):\n task.next = self.sys_loop.call_later(task.interval, self._run_task, task)\n elif isinstan...
[ "0.57867044", "0.57693607", "0.55074", "0.54848945", "0.5457017", "0.5455233", "0.544854", "0.54484665", "0.543439", "0.5425115", "0.5410595", "0.53908753", "0.53766096", "0.535054", "0.53499234", "0.53159726", "0.5287135", "0.52547264", "0.5217428", "0.5204188", "0.5202774",...
0.5787216
0
This staticmethod takes a date (typestring) and returns the year and month in the format YYYYMM (typestring).
def get_date_year_month(date): cut_date = date.split('-') date_month_year = cut_date[0] + '-' + cut_date[1] return date_month_year
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_month(self, indate):\n return indate.strftime(\"%B\") + \"-\" + indate.strftime(\"%Y\")", "def get_year_and_month_from_date(raw_format_date):\n date = datetime.strptime(raw_format_date, \"%m%y\")\n\n # Get string representation of date for year and month\n year = int(date.strftime(\"%Y\")...
[ "0.72763634", "0.71627474", "0.713793", "0.7104471", "0.70486057", "0.6948336", "0.6842599", "0.6829574", "0.67639554", "0.675406", "0.66396785", "0.65600294", "0.64504504", "0.6430573", "0.64203453", "0.63437736", "0.63420486", "0.63378215", "0.6328506", "0.630834", "0.62672...
0.7839178
0
Creates an embed object that will contain the avatar of the user and will 'mention' the author of the original message. Paramters
def create_avatar_embed(message, user): requestor = message.author name = user.name avatarImage = user.avatar_url os.system(f'curl -o .img.png {avatarImage}') color_thief = ColorThief('.img.png') dominant_color = color_thief.get_color(quality=1) os.system('rm .img.png') clr = '0x' + '%0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def avatar(self, ctx:utils.Context, user:discord.User=None):\n\n if user is None:\n user = ctx.author\n with utils.Embed(use_random_colour=True) as embed:\n embed.set_image(url=user.avatar_url)\n await ctx.send(embed=embed)", "async def avatar(message, user: Param...
[ "0.7220755", "0.7065981", "0.70005155", "0.69594747", "0.6944046", "0.68691355", "0.673433", "0.66941375", "0.65377176", "0.6522726", "0.6460572", "0.64155585", "0.6284056", "0.6251793", "0.62355644", "0.6174815", "0.6142006", "0.6090169", "0.6026782", "0.5900302", "0.5857412...
0.78866696
0
Makes a forward pass with the given input through the network.
def forward(self, x, fm, camera_mat): batch_size = x.shape[0] # List of initial 3D coordinates (first item) and outputs of the layers out = list() initial_coordinates_expanded = self.initial_coordinates.expand( batch_size, -1, -1) out.append(initial_coordinates_expa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, input):\n\n return self.network(input)", "def forward(self, input):\n\n return self.network(input)", "def forward(self, input):\n\n return self.network(input)", "def forward(self, input):\n raise NotImplementedError", "def forward(self, input):\n raise N...
[ "0.8020131", "0.8020131", "0.8020131", "0.78395134", "0.78395134", "0.7701589", "0.730887", "0.7214494", "0.7199846", "0.7199846", "0.70900005", "0.7082617", "0.70466167", "0.7020421", "0.70115006", "0.6980422", "0.6966499", "0.69619286", "0.69295895", "0.69049865", "0.689067...
0.0
-1
Resolve quals definition (as dictionary coming from a to_json(quals) sql query.
def resolve_quals(conn, quallist, attribute="quals"): operator_to_look = set() attname_to_look = set() operators = {} attnames = {} for row in quallist: values = row[attribute] if not isinstance(values, list): values = [values] for v in values: operato...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_qual_score(infile, value_cast_f=int):\r\n id_to_qual = dict([rec for rec in MinimalQualParser(infile, value_cast_f)])\r\n return id_to_qual", "def list_qualifications() -> Dict[str, Any]:\n qualifications_schema = QualificationSchema(many=True)\n qualifications = Qualification.query.all()\n...
[ "0.62183905", "0.5912396", "0.58376807", "0.53827244", "0.5360832", "0.52999234", "0.512226", "0.5072654", "0.4975721", "0.49573955", "0.4916347", "0.48792332", "0.4825397", "0.47340232", "0.4695924", "0.46713558", "0.46680146", "0.46460393", "0.46286368", "0.46098846", "0.46...
0.59821117
1
Returns list of InputExample objects.
def _create_examples(self, lines, set_type): # Parallelizing a bit batch computation because it is quite slow... #lines = lines[:500] step = 18 # 17 sentences per input sequence #encoded_dict = self.tokenizer.encode('[CLS] ' + ' [SEP] [CLS] '.join(lines) + ' [SEP]') #tokens = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_source_inputs(self, class_name: str = None) -> List[str]:\n input_dir = self.input_directory\n if input_dir is None:\n return []\n all_inputs = []\n for fmt in self.input_formats:\n glob_expr = f\"*.{fmt}\"\n if class_name is not None:\n ...
[ "0.70495194", "0.7025524", "0.67530465", "0.6675962", "0.6613447", "0.6519134", "0.6478061", "0.64501965", "0.6400952", "0.6400952", "0.6400952", "0.63932276", "0.63917595", "0.6388947", "0.6388947", "0.6370418", "0.63460624", "0.6338409", "0.6298535", "0.62900734", "0.627240...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary collection_summary = awsecommerceservice.models.collection_summary.CollectionSummary.from_dictionary(dictionary.get('CollectionSummary')) if dicti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.0
-1
Get my config. Returns a dict of the config for this task.
def config(self): if self._config is None: try: task_conf = CONF.workflow.tasks[self.task_type] except KeyError: task_conf = {} self._config = CONF.workflow.task_defaults.overlay(task_conf) return self._config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config", "def get_config(self) -> Dict[str, Any]:\n if self.config is None:\n self.config = self.load_config()\n\n return self.config", "def get...
[ "0.81380033", "0.81380033", "0.7935481", "0.78627795", "0.7790323", "0.7757608", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", "0.7701663", ...
0.752085
80
Pad framewise_output to the same length as input frames.
def pad_framewise_output(framewise_output, frames_num): pad = framewise_output[:, -1 :, :].repeat(1, frames_num - framewise_output.shape[1], 1) """tensor for padding""" output = torch.cat((framewise_output, pad), dim=1) """(batch_size, frames_num, classes_num)""" return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_framewise_output(framewise_output, frames_num):\n pad = framewise_output[:, -1:, :].repeat(1, frames_num - framewise_output.shape[1], 1)\n \"\"\"tensor for padding\"\"\"\n\n output = torch.cat((framewise_output, pad), dim=1)\n \"\"\"(batch_size, frames_num, classes_num)\"\"\"\n\n return outp...
[ "0.8230455", "0.7931482", "0.7931482", "0.6540299", "0.6483363", "0.64246595", "0.6142677", "0.6035105", "0.5952847", "0.5763603", "0.5734788", "0.57071126", "0.56726646", "0.56666154", "0.5631334", "0.5616687", "0.56009144", "0.5595923", "0.5568799", "0.55595803", "0.5487239...
0.8198464
1
Create single input for OpenStack provisioner.
def create_host_requirement(self, host): required_image = host.get("image") or self._get_image(host["os"]) return { "name": host["name"], "flavor": self._get_flavor(host), "image": required_image, "key_name": self.config["keypair"], "network": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None,\n accept_language: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n distributor: Optional[pulumi.Inpu...
[ "0.581116", "0.5809518", "0.5765543", "0.5744689", "0.5714009", "0.56461656", "0.56426877", "0.5639887", "0.5631351", "0.56305856", "0.5629538", "0.5622211", "0.5620859", "0.55720574", "0.5535291", "0.55337965", "0.55092263", "0.5500885", "0.54793775", "0.5470409", "0.5468908...
0.0
-1
Forces a Unicode string to become a bytestring.
def force_bytes(value): if IS_PY3: if isinstance(value, str): value = value.encode("utf-8", "backslashreplace") else: if isinstance(value, unicode): # NOQA: F821 value = value.encode("utf-8") return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_me_bytes(string):\n return string.encode('utf8') if isinstance(string, str) else string", "def force_utf8(text):\n if isinstance(text, binary_type):\n return text\n else:\n return text.encode('utf-8')", "def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n retu...
[ "0.7950604", "0.7494114", "0.74611163", "0.736526", "0.7343636", "0.7342057", "0.73255694", "0.72963053", "0.72921216", "0.7219616", "0.7215229", "0.71370375", "0.71224475", "0.7089445", "0.70876855", "0.7068403", "0.7035774", "0.69953173", "0.69935924", "0.6978708", "0.69658...
0.7462238
2
Cleans string from invalid xml chars
def clean_xml_string(s): return VALID_XML_CHARS_REGEX.sub("", s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_invalid_xml(s):\n if _badchars_re.search(s):\n return ''.join(c for c in s if c >= ' ' or c in '\\r\\n\\t')\n else:\n return s", "def _strip_invalid_xml(s):\n if _badchars_re.search(s):\n return ''.join(c for c in s if c >= ' ' or c in '\\r\\n\\t')\n else:\n return s", "def clean_xml...
[ "0.8395313", "0.8395313", "0.76325786", "0.72462225", "0.72400254", "0.7152788", "0.7002336", "0.69919145", "0.6916065", "0.687033", "0.686678", "0.6731521", "0.6655256", "0.66450983", "0.65548456", "0.6541501", "0.6381694", "0.6360468", "0.63296366", "0.63241875", "0.6314515...
0.8506191
0
Check if a given value is ``null``. Criteria for this is based on values that shouldn't be included in the Solr ``add`` request at all.
def _is_null_value(self, value): if value is None: return True if IS_PY3: # Python 3.X if isinstance(value, str) and len(value) == 0: return True else: # Python 2.X if isinstance(value, basestring) and len(value) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _val_is_null(self, val):\r\n return val is None", "def is_null(self):\n return self.value is None", "def is_null(value: Any) -> bool:\n return not value", "def has_null(self) -> bool:\n\n return any([x is NULL for x in self.values])", "def isValid(self, value):\n return v...
[ "0.7966777", "0.7675414", "0.72924244", "0.71943104", "0.71919435", "0.71109146", "0.7044645", "0.7017645", "0.68474185", "0.67800164", "0.6740847", "0.6740847", "0.6740847", "0.6740847", "0.6740847", "0.66857105", "0.6675339", "0.660833", "0.65864235", "0.6569065", "0.655242...
0.77746046
1
Tells Solr to streamline the number of segments used, essentially a defragmentation operation. Optionally accepts ``maxSegments``. Default is ``None``. Optionally accepts ``waitFlush``. Default is ``None``. Optionally accepts ``waitSearcher``. Default is ``None``.
def optimize( self, commit=True, waitFlush=None, waitSearcher=None, maxSegments=None, handler="update", ): if maxSegments: msg = '<optimize maxSegments="%d" />' % maxSegments else: msg = "<optimize />" return self._upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_segments(self, segments):\n self.send_command(Command.SET_SEGMENT_COUNT, [segments])", "def segment(args):\n from jcvi.formats.base import SetFile\n\n p = OptionParser(segment.__doc__)\n p.add_option(\n \"--chain\",\n default=1,\n type=\"int\",\n help=\"Allow next ...
[ "0.51909155", "0.4807662", "0.47312784", "0.47224554", "0.46188262", "0.4600607", "0.45097548", "0.43260217", "0.43097267", "0.42663458", "0.42496002", "0.42404923", "0.42117444", "0.4210985", "0.41996685", "0.41599086", "0.41341916", "0.4129727", "0.41070372", "0.40991002", ...
0.6767203
0
Finalize all values that are the only choice for a unit. Go through all the units, and whenever there is a unit with a value that only fits in one box, assign the value to this box.
def only_choice(values): for unit in unitlist: for digit in "123456789": boxes = [box for box in unit if digit in values[box]] if len(boxes) == 1: values[boxes[0]] = digit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_choice(values):\n # TODO: Copy your code from the classroom to complete this function\n for unit in unitlist:\n #print (unit)\n #solved_boxes = [box for box in unit if len(values[box]) == 1]\n #unsolved_boxes = [box for box in unit if len(values[box]) > 1]\n #print (unit,...
[ "0.6149435", "0.5739129", "0.56110865", "0.5567466", "0.55310965", "0.5510611", "0.54592836", "0.5458928", "0.54497653", "0.54181445", "0.5418099", "0.53857076", "0.5360414", "0.53125787", "0.52772063", "0.52584416", "0.5257262", "0.5257262", "0.52474046", "0.5241555", "0.520...
0.5451368
8
r""" Preprocesses the ``input_id`` by first converting it to string using the ``generator_tokenizer`` and then tokenizing it using the ``question_encoder_tokenizer``.
def preprocess_query(self, input_ids, prefix): input_strings = self.generator_tokenizer.batch_decode(input_ids, skip_special_tokens=False) # handle prefix for T5 if isinstance(self.generator_tokenizer, T5Tokenizer): for i, s in enumerate(input_strings): if not s.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_pretraining(self, inputs):\n\n ref_ids = prepare_ref([inputs], self.tokenizer_ltp, self.tokenizer_cn)\n\n tokens = self.tokenizer_cn.tokenize(inputs)\n\n if len(tokens) > self.max_seq_length - 2:\n tokens = tokens[:(self.max_seq_length - 2)]\n ref_ids = ref_i...
[ "0.6157253", "0.6011973", "0.59935665", "0.5959524", "0.5938408", "0.5830877", "0.575296", "0.56359935", "0.55681187", "0.55354303", "0.5528437", "0.5496703", "0.5476708", "0.5433145", "0.5431593", "0.54210657", "0.5416125", "0.5377173", "0.53737015", "0.5349505", "0.5338652"...
0.65319693
0
Turn supplied list of AllocationRequest objects into a list of allocations dicts keyed by resource provider uuid of resources involved in the allocation request. The returned results are intended to be used as the body of a PUT /allocations/{consumer_uuid} HTTP request at
def _transform_allocation_requests_dict(alloc_reqs, want_version): results = [] for ar in alloc_reqs: # A default dict of {$rp_uuid: "resources": {}) rp_resources = collections.defaultdict(lambda: dict(resources={})) for rr in ar.resource_requests: res_dict = rp_resources[rr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform_allocation_requests_list(alloc_reqs):\n results = []\n for ar in alloc_reqs:\n provider_resources = collections.defaultdict(dict)\n for rr in ar.resource_requests:\n res_dict = provider_resources[rr.resource_provider.uuid]\n res_dict[rr.resource_class] = rr....
[ "0.8063298", "0.7020869", "0.68739104", "0.6017425", "0.58747315", "0.5671825", "0.5668013", "0.53047335", "0.5296503", "0.5240295", "0.508343", "0.50325537", "0.4964703", "0.49514338", "0.4944357", "0.49293068", "0.49243796", "0.47904134", "0.47739625", "0.47655866", "0.4726...
0.7216527
1
Turn supplied list of AllocationRequest objects into a list of dicts of resources involved in the allocation request. The returned results is intended to be able to be used as the body of a PUT /allocations/{consumer_uuid} HTTP request, prior to microversion 1.12, so therefore we return a list of JSON objects that look...
def _transform_allocation_requests_list(alloc_reqs): results = [] for ar in alloc_reqs: provider_resources = collections.defaultdict(dict) for rr in ar.resource_requests: res_dict = provider_resources[rr.resource_provider.uuid] res_dict[rr.resource_class] = rr.amount ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_allocation_candidates(req):\n context = req.environ['placement.context']\n context.can(policies.LIST)\n want_version = req.environ[microversion.MICROVERSION_ENVIRON]\n get_schema = _get_schema(want_version)\n util.validate_query_params(req, get_schema)\n\n rqparams = lib.RequestWideParam...
[ "0.7178691", "0.7162541", "0.6582189", "0.6107352", "0.5863697", "0.5587923", "0.53681725", "0.5314249", "0.5055799", "0.50106907", "0.49994317", "0.49690905", "0.487662", "0.48683962", "0.48598045", "0.4829101", "0.482535", "0.48045796", "0.478293", "0.4782239", "0.47727063"...
0.7994556
0
Checks if this object is equal to the given object.
def __eq__(self, other: Any) -> bool: if not isinstance(other, BaseOptions): return False return self.to_pb2().__eq__(other.to_pb2())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, obj):\r\n return assert_(self.obj == obj, '%r != %r' % (self.obj, obj))", "def equals(self, obj: object) -> bool:\n ...", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, o...
[ "0.84820056", "0.8479907", "0.7772451", "0.776262", "0.76864976", "0.76346", "0.7584103", "0.7563157", "0.7492194", "0.7382019", "0.7382019", "0.7377297", "0.73125404", "0.7282762", "0.72483206", "0.72483206", "0.7242191", "0.7229649", "0.721935", "0.72074294", "0.72034365", ...
0.0
-1
Load the pretrained ResNet152 and replace top fc layer.
def __init__(self, embed_size, hidden_size, vocab_size, num_layers, max_seq_length=20): # Decoder super(CaptioningModel, self).__init__() resnet = models.resnet18(pretrained=True) modules = list(resnet.children())[:-1] # delete the last fc layer. self.resnet ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet152(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet152']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model", "def resnet152(pretrained=False):\n model =...
[ "0.7173243", "0.68068516", "0.67977124", "0.6785029", "0.6749317", "0.6749317", "0.6749317", "0.6749317", "0.6732605", "0.65075487", "0.65075487", "0.6475581", "0.63911945", "0.6284571", "0.6225049", "0.6187277", "0.61413467", "0.6104824", "0.6085976", "0.6068629", "0.6041786...
0.0
-1
Eliminate the common words from a nltk Text list.
def eliminate_common(self, text=None): if text is None: text = self.nltk_text(self.text) # Remove the upper case words # Remove common words # Remove stopwords # TODO: maybe check just for nouns / verbs ??? text = set(w for w in text if w == w.lower() and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_common_words(text_vector):\n common_words = set(['the', 'and', 'to', 'of', 'a', 'I', 'in', 'was',\n 'he', 'that', 'it', 'his', 'her', 'you', 'as', 'had', 'with',\n 'for', 'she', 'not', 'at', 'but', 'be', 'my', 'on', 'have', 'him',\n 'is', 'said', 'me', 'which', 'b...
[ "0.77453023", "0.7480703", "0.7304569", "0.7275693", "0.7273945", "0.6985139", "0.6854734", "0.67847115", "0.6756467", "0.6724188", "0.6668566", "0.6667598", "0.6655243", "0.6619594", "0.65618414", "0.6493549", "0.6491564", "0.6486325", "0.64815193", "0.6450531", "0.64440286"...
0.8407093
0
Replaces 970 due to more slots available. Note that 970999, roughly, are now free.
def event1950(): header(1950) boss_dead_flag, immediate_item, delayed_item_1, delayed_item_2 = define_args('iiii') end_if_event_flag_on(boss_dead_flag) if_event_flag_on(0, boss_dead_flag) skip_if_equal(1, immediate_item, 0) item.award_item_to_host_only(immediate_item) network.disable_sync() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reserve(self):\n assert self.is_available() is True, \"this slot is not available\"", "def _shrink(self):\n self.capacity = round(self.capacity / self.factor)\n temp = [None] * self.capacity\n for i in range(self.capacity):\n temp[i] = self.store[i]\n self.store ...
[ "0.5705056", "0.5696263", "0.5676289", "0.5561961", "0.54798216", "0.5476498", "0.54707247", "0.5447159", "0.539114", "0.53601056", "0.53560024", "0.5354314", "0.53441006", "0.53286904", "0.53082025", "0.53022337", "0.52863425", "0.5269593", "0.52404076", "0.52227765", "0.522...
0.0
-1
returns true if all propositions that are preconditions of the action exist in this layer (i.e. the action can be applied)
def allPrecondsInLayer(self, action): actionPre = action.getPre() for pre in actionPre: if not(pre in self.propositions): return False for i in range(len(actionPre)): for j in range(i + 1, len(actionPre)): pre1 = actionPre[i] pre2 = actionPre[j] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_precondition(self) -> bool:\n return self._does_apply", "def check_precond(self, kb, args):\n # check for positive clauses\n for clause in self.precond_pos:\n if self.substitute(clause, args) not in kb.clauses:\n return False\n # check for negative cl...
[ "0.6837118", "0.6504576", "0.6282832", "0.62549114", "0.6239424", "0.6229914", "0.6056336", "0.6050473", "0.6033958", "0.59764284", "0.59749675", "0.5962451", "0.59534854", "0.59442925", "0.59440273", "0.59414357", "0.5929586", "0.5905324", "0.5878416", "0.58706623", "0.58393...
0.7898416
0
Computes and saves L3 embedding for given inputs.
def run(modality, inputs, output_dir=None, suffix=None, input_repr="mel256", content_type="music", audio_embedding_size=6144, audio_center=True, audio_hop_size=0.1, image_embedding_size=8192, verbose=False): if isinstance(inputs, string_types): file_list = [inputs] elif isinstan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self, inputs):\n unpacked_inputs = tf_utils.unpack_inputs(inputs)\n word_embeddings = unpacked_inputs[0]\n token_type_ids = unpacked_inputs[1]\n input_shape = tf_utils.get_shape_list(word_embeddings, expected_rank=3)\n batch_size = input_shape[0]\n seq_length = input_shape[1]\n width ...
[ "0.6141409", "0.6141409", "0.6002191", "0.5979608", "0.5843579", "0.5782888", "0.5766401", "0.5762665", "0.5728382", "0.56863475", "0.56177175", "0.5616622", "0.55811214", "0.5549932", "0.55291796", "0.5527123", "0.551758", "0.5499278", "0.54959416", "0.5482118", "0.5471783",...
0.634388
0
Return matrix of userspecified foreground and background objects.
def as_matrix(self, *, ink=1, paper=0): return tuple( tuple(ink if _c == self._1 else paper for _c in _row) for _row in self._pixels )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_in_background(self, background_strains, foreground_strains):\n output = [[[], [], [], [], []] for _ in xrange(subspecies.NUM_SUBSPECIES**2)]\n for strain in foreground_strains:\n elem_intervals = self.make_elementary_intervals(\n [self.sample_dict[sn][0] for sn in ba...
[ "0.60915947", "0.5761049", "0.5655085", "0.553903", "0.55345774", "0.5534095", "0.5494117", "0.5262364", "0.5241943", "0.5238248", "0.5225351", "0.5199275", "0.51714575", "0.5154314", "0.5091412", "0.49896938", "0.49859098", "0.49712363", "0.496936", "0.49677444", "0.49491563...
0.0
-1
Convert glyph to a string of block characters.
def as_blocks(self, resolution=(2, 2)): if not self.height: return '' matrix = self.as_matrix() return matrix_to_blocks(matrix, *resolution)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glyph(x):\n assert isinstance(x, str)\n return [x]", "def singleglyph(x):\n return [glyph(x)]", "def as_bytes(self):\n if not self._rows:\n return b''\n width = len(self._rows[0])\n bytewidth = ceildiv(width, 8)\n # byte-align rows\n rows = [\n ...
[ "0.6130963", "0.6007729", "0.5825784", "0.57893986", "0.57350844", "0.5699637", "0.56867427", "0.5586232", "0.5517764", "0.5516668", "0.55136853", "0.5436235", "0.54109365", "0.5395597", "0.5387504", "0.5377302", "0.5341501", "0.52806133", "0.5268265", "0.5263745", "0.5245249...
0.0
-1
Return a raster with a line added.
def underline(self, top_height:int=0, bottom_height:int=0): _0, _1 = '0', '1' if bottom_height > top_height: return self top_height = min(self.height, max(0, top_height)) bottom_height = min(self.height, max(0, bottom_height)) pixels = self._outer( _1 * se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raster2line(raster_file_name, out_shp_fn, pixel_value):\n\n # calculate max. distance between points\n # ensures correct neighbourhoods for start and end pts of lines\n raster, array, geo_transform = raster2array(raster_file_name)\n pixel_width = geo_transform[1]\n max_distance = np.ceil(np.sqrt...
[ "0.6763813", "0.6609446", "0.65756094", "0.65644616", "0.6388114", "0.62632", "0.62520975", "0.6189784", "0.61113816", "0.6033784", "0.60225767", "0.60225767", "0.60147315", "0.59972364", "0.59779096", "0.5970112", "0.5968529", "0.59594566", "0.5955867", "0.5953882", "0.59526...
0.0
-1
Make sure q1 and q2 are the same quantities to within the given precision.
def assertQuantityEqual(self, q1, q2, msg=None, delta=None): delta = 1e-5 if delta is None else delta msg = '' if msg is None else ' (%s)' % msg q1 = Quantity(q1) q2 = Quantity(q2) if q1.shape != q2.shape: raise self.failureException( "Shape mismatch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eq(df1, df2, precision=0.5) -> bool:\n return ((df1 - df2).abs() < precision).all()", "def _same(p1,p2,prec=0.0001):\n #return num.all(num.equal(p1,p2))\n t1 = num.fabs(p1[0]-p2[0]) < prec\n t2 = num.fabs(p1[1]-p2[1]) < prec\n if t1 and t2:\n #print \"same\", p1,p2\...
[ "0.7299522", "0.71662915", "0.6952921", "0.6850603", "0.6520175", "0.6467178", "0.6384543", "0.6374968", "0.6214496", "0.61555463", "0.60420364", "0.6026763", "0.60216063", "0.5971276", "0.5965232", "0.5963061", "0.5895836", "0.5877206", "0.5847391", "0.57889813", "0.57887864...
0.62212306
8
Main generator entrance. Both self.one() and self.all() will use this generator to obtain RecordThunkIter is a convoluted datatype. The easiest way to access it is to use map_thunk_iter() function in dataType.py which map a callback to the result of all thunks. thunks are evaluated asyncronously, which means good perfo...
def _gen(self, datapoint_params) -> RecordThunkIter: def entrance(datapoints, params_list) -> RecordThunkIter: """ Return a generator iter througth an effectful generator iter through data will cause a network connection. """ s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n counter = 0\n while True:\n if counter < len(self.all_records):\n yield self.all_records[counter]\n else:\n yield self.next()\n counter += 1", "def __iter__(self):\n for batch in self.iterator:\n ...
[ "0.6397486", "0.6069301", "0.59929514", "0.5949399", "0.59484214", "0.5835066", "0.57487625", "0.5741638", "0.57186896", "0.5712092", "0.5705545", "0.5694224", "0.5684352", "0.56692845", "0.566284", "0.565444", "0.56475216", "0.5642295", "0.56172", "0.56119436", "0.5601721", ...
0.6224088
1
If the word is before a number, it is likely MODELNAME E.g. apple watch series 3
def lf_is_before_num(x): words = x.product_name.split() if x.word_idx < len(words)-1 and words[x.word_idx+1].isnumeric(): return MODELNAME return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lf_is_numeric(x):\n words = x.product_name.split()\n if words[x.word_idx].isnumeric():\n return MODELNAME\n return -1", "def lf_is_after_brand(x, brand_names):\n words = x.product_name.split()\n if x.word_idx > 0 and words[x.word_idx-1] in brand_names:\n if any(i.isdigit() for i ...
[ "0.6609103", "0.6013188", "0.59997255", "0.5941132", "0.5870885", "0.586358", "0.57586086", "0.56449765", "0.56301737", "0.5628457", "0.56272924", "0.56195194", "0.56101805", "0.55771", "0.5539335", "0.54873604", "0.5481514", "0.5471274", "0.5457715", "0.54279166", "0.5397162...
0.753125
0
List of filenames which belong to the query set but are not selected.
def unlabeled_set(self): # unlabeled set is the query set minus the preselected set unlabeled_tag_bitmask = self._query_tag_bitmask - self._preselected_tag_bitmask return unlabeled_tag_bitmask.masked_select_from_list( self.api_workflow_client.filenames_on_server )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_set(self):\n return self._query_tag_bitmask.masked_select_from_list(\n self.api_workflow_client.filenames_on_server\n )", "def _get_files_in_db(self):\r\n query = 'SELECT DISTINCT file_name FROM {0};'.format(\r\n self.tables['measurements'])\r\n self.cu...
[ "0.70955664", "0.69156736", "0.64828014", "0.64682966", "0.64663357", "0.6464316", "0.638844", "0.63697505", "0.634285", "0.63422686", "0.63214964", "0.62280995", "0.61715925", "0.61326146", "0.6128739", "0.60733914", "0.6065121", "0.604108", "0.6038031", "0.6025476", "0.6011...
0.59853363
23
List of filenames of newly added samples (in the last query).
def added_set(self): # the added set only exists after a query if self._old_preselected_tag_bitmask is None: raise RuntimeError('Cannot compute \"added set\" before querying.') # added set is new preselected set minus the old one added_tag_bitmask = self._preselected_tag_bitm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filenames():\r\n datadir = \"./phase3_data/\"\r\n samples = os.listdir(datadir)\r\n all_files = []\r\n for i in range(len(samples)):\r\n sampfiles = []\r\n datadir = \"./phase3_data/\" + samples[i]\r\n files = os.listdir(datadir)\r\n for file in files:\r\n ...
[ "0.6810212", "0.6605287", "0.659618", "0.65632635", "0.6539105", "0.6459812", "0.6393692", "0.63551503", "0.6338973", "0.63389045", "0.6338571", "0.62988263", "0.629479", "0.6290969", "0.6242822", "0.6242377", "0.6242377", "0.6239383", "0.6234713", "0.6207206", "0.6206775", ...
0.0
-1
Considering the rows of X (and Y=X) as vectors, compute the distance matrix between each pair of vectors. This distance implementation is the distance between two points in a grid based on a strictly horizontal and/or vertical path (that is, along the grid lines as opposed to the diagonal or "as the crow flies" distanc...
def manhattan_distances(X, Y): # should not need X_norm_squared because if you could precompute that as # well as Y, then you should just pre-compute the output and not even # call this function. if X is Y: X = Y = np.asanyarray(X) else: X = np.asanyarray(X) Y = np.asanyarray...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manhattan_distances(X, Y):\r\n D = np.zeros((X.shape[0],Y.shape[0]))\r\n \r\n for X_idx in range(X.shape[0]):\r\n for Y_idx in range(Y.shape[0]): \r\n \r\n D[X_idx,Y_idx] = np.sum(np.abs(X[X_idx,:] - Y[Y_idx,:]))\r\n \r\n return D", "def euclidean_distances(X, Y):...
[ "0.7770831", "0.74655795", "0.72221386", "0.70440143", "0.7003411", "0.69414055", "0.67667186", "0.6762181", "0.66671824", "0.66490585", "0.6621166", "0.6598885", "0.6588486", "0.65820444", "0.65458953", "0.653017", "0.6527672", "0.65168613", "0.6514407", "0.648362", "0.64624...
0.7285553
2
Considering the rows of X (and Y=X) as vectors, compute the distance matrix between each pair of vectors.
def loglikehood_coefficient(n_items, X, Y): # should not need X_norm_squared because if you could precompute that as # well as Y, then you should just pre-compute the output and not even # call this function. def safeLog(d): if d <= 0.0: return 0.0 else: return n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distances(X, Y):\r\n\r\n D = np.zeros((X.shape[0],Y.shape[0]))\r\n \r\n for X_idx in range(X.shape[0]):\r\n for Y_idx in range(Y.shape[0]): \r\n \r\n D[X_idx,Y_idx] = np.sqrt(np.sum((X[X_idx,:]-Y[Y_idx,:])**2))\r\n \r\n return D", "def cosine_distances(X...
[ "0.7947374", "0.732326", "0.7293282", "0.72234964", "0.70778155", "0.70235634", "0.6914544", "0.68702495", "0.6849722", "0.6842572", "0.6830514", "0.6816462", "0.68044674", "0.68018913", "0.67837113", "0.6748725", "0.6744572", "0.6694892", "0.6670698", "0.66436875", "0.659595...
0.0
-1
Coverts input tensors to numpy ndarrays
def convert_to_numpy(*inputs): def _to_numpy(i): assert isinstance(i, torch.Tensor), "Expected input to be torch.Tensor" return i.detach().cpu().numpy() return (_to_numpy(i) for i in inputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def th_to_arr(tens: torch.Tensor) -> np.ndarray:\n return check_tensor(tens).cpu().detach().numpy()", "def to_numpy(tensor):\n raise NotImplementedError", "def tensor2np(x):\n return x.cpu().numpy()", "def _convert_to_np_array(inputs: Union[float, Tuple[float], np.ndarray], dim):\n outputs = No...
[ "0.75370157", "0.7528797", "0.7435802", "0.7149566", "0.7149566", "0.70594555", "0.7003697", "0.6941773", "0.6920963", "0.6834125", "0.6820987", "0.66868377", "0.66740686", "0.6655203", "0.66497886", "0.66426235", "0.66297895", "0.6574982", "0.6561449", "0.65392995", "0.65122...
0.75293213
2
Collect single artifact, be it in S3 or locally.
def collect_single(self, path, req_tag=True): #print('? %s' % path) # For local files, strip download path. # Also ignore any parent directories. if path.startswith(self.dlpath): folder = os.path.basename(os.path.dirname(path[len(self.dlpath):])) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_fetch_s3_artifact(uri, local_dest='.'):\n local('aws s3 cp {} {}'.format(uri, local_dest))", "def collect_s3(self):\n print('Collecting artifacts matching %s from S3 bucket %s' % (self.match, s3_bucket))\n self.s3 = boto3.resource('s3')\n self.s3_bucket = self.s3.Bucket(s3_bucke...
[ "0.70469123", "0.6940997", "0.590493", "0.5827899", "0.5826262", "0.57538307", "0.5706472", "0.567867", "0.5675168", "0.56425047", "0.56399673", "0.55415237", "0.55029", "0.5418003", "0.5350222", "0.5350222", "0.5350222", "0.5350222", "0.534246", "0.53306216", "0.53011525", ...
0.60430914
2
A callable fixture that creates a mock python package in tmp_path and returns the package directory
def make_package(tmp_path, pyproject_toml): return make_package_base(tmp_path, pyproject_toml)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_package_dir(self):\n tempdir = tempfile.mkdtemp()\n os.rmdir(tempdir)\n settings = {\n 'storage.dir': tempdir,\n }\n FileStorage.configure(settings)\n try:\n self.assertTrue(os.path.exists(tempdir))\n finally:\n os.rm...
[ "0.71668464", "0.71648365", "0.707077", "0.7026178", "0.6944759", "0.6922835", "0.691878", "0.68817353", "0.66905147", "0.6656914", "0.6582454", "0.6579341", "0.6458405", "0.6415908", "0.6411599", "0.6388235", "0.6372629", "0.63337934", "0.6288598", "0.6239651", "0.6237766", ...
0.68435705
8
A callable fixture that creates a mock python package in tmp_path and returns the package directory
def make_package_deprecated(tmp_path, pyproject_toml): return make_package_base( tmp_path, pyproject_toml, setup_func=setup_maker_deprecated, include_js=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_package_dir(self):\n tempdir = tempfile.mkdtemp()\n os.rmdir(tempdir)\n settings = {\n 'storage.dir': tempdir,\n }\n FileStorage.configure(settings)\n try:\n self.assertTrue(os.path.exists(tempdir))\n finally:\n os.rm...
[ "0.7165992", "0.7164136", "0.7068451", "0.70272714", "0.694273", "0.6922184", "0.6918412", "0.6882918", "0.68453735", "0.66885906", "0.66582453", "0.65796816", "0.65783167", "0.64560145", "0.6414546", "0.6411239", "0.63871896", "0.6370322", "0.633216", "0.6286406", "0.6237794...
0.0
-1
Generate chars given a seed (it can be an empty string) Predicts next chars according to previous chars in a loop. Next chars are chosen using probabilities to create different names each time.
def generate_names(seed="", num_names=1): # add start character (<) to seeds seeds = ["<" + seed for _ in range(num_names)] outputs = seeds.copy() # create initial states h_state = tf.zeros(shape=(num_names, embedding_dim)) c_state = tf.zeros(shape=(num_names, embedding_dim)) state...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_char(model, history, prev_chars):\n history = history[-prev_chars:]\n distr = model.get(history)\n rnd = random()\n # randomly sample most probable chars\n for char, prob in distr:\n rnd -= prob # gradually subtract until good candidate\n if rnd <= 0:\n return ...
[ "0.7398955", "0.7125424", "0.6922391", "0.6891195", "0.6888011", "0.68504727", "0.6727158", "0.6575554", "0.64264905", "0.64211714", "0.6351087", "0.63389283", "0.63141525", "0.6214913", "0.6205305", "0.6200976", "0.6161466", "0.614708", "0.61282027", "0.61171216", "0.6113133...
0.70835567
2
Adds a list of blocks to the crumble, by setting their coordinates to True. Does not check if those values are already True. Format for block_list is [(x,y), (x,y), (x,y), ...]
def add_blocks(self, block_list): blocks = block_list.copy() ## Fixes bug?? for block in block_list: x, y = block self[x, y] = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_block(self, location_list, POI_locations):\n\n \n for i in range(len(location_list)):\n this_cell = self.grid.get_cell_list_contents(location_list[i])\n\n for agent in this_cell:\n if type(agent) is nodeAgent:\n agent.block = True\n\n for i in...
[ "0.66030365", "0.5905925", "0.58311963", "0.56495714", "0.5566724", "0.54912305", "0.54864836", "0.5409979", "0.54076195", "0.53946227", "0.5382518", "0.53746617", "0.5374538", "0.53295016", "0.5323942", "0.53013605", "0.5293454", "0.52375156", "0.52320075", "0.5231403", "0.5...
0.8670279
0
Creates the application factory.
def create_request_app(settings): application = Flask(__name__) application.config.from_object(settings) db.init_app(application) application.register_blueprint(app_views) application.register_blueprint(api_views) logging_handler = RotatingFileHandler("{0}/app.log".format(settings.BASE_DIR), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app():\n app = Flask(__name__, instance_relative_config=False)\n app.config.from_object('config.Config')\n db.init_app(app)\n ma.init_app(app)\n migrate = Migrate(app, db)\n\n with app.app_context():\n from . import routes\n\n # Create tables for our models\n db.cr...
[ "0.7649329", "0.75789386", "0.75749934", "0.7542789", "0.7530117", "0.75061387", "0.74708223", "0.74633205", "0.7353847", "0.73490655", "0.73206985", "0.72978747", "0.7289467", "0.7270252", "0.7250092", "0.72465104", "0.72350144", "0.72105706", "0.71943974", "0.7174563", "0.7...
0.661813
76
The total duration of all tasks that ran on the push.
def duration(self): return int(sum(t.duration for t in self.tasks) / 3600)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduled_duration(self):\n seen = set()\n duration = 0\n for task in self.tasks:\n if task.label not in self.scheduled_task_labels:\n continue\n\n if task.label in seen:\n continue\n\n seen.add(task.label)\n duratio...
[ "0.70750093", "0.6987875", "0.6809532", "0.6771156", "0.67008936", "0.6669308", "0.6648715", "0.6648715", "0.6642854", "0.66370416", "0.66048735", "0.65889806", "0.6564531", "0.65483934", "0.65483934", "0.6516426", "0.64809996", "0.64778584", "0.6477298", "0.6472821", "0.6461...
0.8103958
0
Get an artifact from Decision task of this push.
def _get_decision_artifact(self, name): url = TASKGRAPH_ARTIFACT_URL.format(rev=self.rev, artifact=name) r = requests.get(url) if r.status_code != 200: logger.warning(f"No decision task with artifact {name} on {self.rev}.") raise MissingDataError("No decision task on {sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_artifact(self, artifact_key: str) -> object:\n return self._artifacts[artifact_key]", "def retrieve_artifact(args, producing_task_name, artifact_name):\n if producing_task_name not in args._artifacts:\n raise KeyError(f\"Cannot find {producing_task_name} in _artifacts. The task either di...
[ "0.6859929", "0.6714885", "0.6670622", "0.6609323", "0.6159352", "0.6114037", "0.583998", "0.583998", "0.583998", "0.583998", "0.58371663", "0.5768473", "0.5727282", "0.56864697", "0.56864697", "0.56864697", "0.56864697", "0.56864697", "0.56864697", "0.5556161", "0.5429708", ...
0.7670327
0
Get the tasks artifact from the shadow scheduler task called 'name'.
def _shadow_scheduler_artifacts(self): artifacts = {} for task in self._get_artifact_urls_from_label('shadow-scheduler'): if 'artifacts' not in task: continue label = task['label'] found_url = None for url in task['artifacts']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shadow_scheduler_tasks(self, name):\n # First look for an index.\n url = SHADOW_SCHEDULER_ARTIFACT_URL.format(rev=self.rev, name=name)\n r = requests.get(url)\n\n if r.status_code != 200:\n if name not in self._shadow_scheduler_artifacts:\n return None\...
[ "0.6976159", "0.6649033", "0.6550156", "0.65260506", "0.6450284", "0.6376226", "0.6327709", "0.6268586", "0.62382776", "0.62363726", "0.62322783", "0.62141657", "0.6191073", "0.6039212", "0.60315126", "0.5978834", "0.5871009", "0.58693504", "0.58417517", "0.57891047", "0.5761...
0.62753606
7
Get the name (title) of this player.
def get_name(self) -> str: def _seg2(): if self.name: return self.name else: try: return self.player.title except AttributeError: return 'No title specified' try: if self.player.ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n return self._player_name", "def get_name(self):\n \n # Return the player's name\n return self._name", "def getName(self):\n\n return self.player", "def name(self) -> str:\n try:\n return self.stats[\"Player name\"]\n except Key...
[ "0.8749819", "0.87249106", "0.84593534", "0.835844", "0.8171182", "0.79883343", "0.7964863", "0.7610038", "0.7610038", "0.75440305", "0.7512455", "0.7495721", "0.747609", "0.747609", "0.747609", "0.7440677", "0.7440677", "0.7440677", "0.7440488", "0.7429516", "0.74171865", ...
0.7882872
7
Get the current player object.
def player(self): return self.current.player
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPlayer(self):\n return self.currentPlayer", "def get_current_player(self):\n return self.current_player", "def get_current_player(self) :\n return self.current_player", "def get_current_player(self):\n\n # Return the current player\n return self._current_player", "...
[ "0.84492415", "0.8404701", "0.84017044", "0.8366663", "0.8340543", "0.83186185", "0.830703", "0.82954335", "0.8292107", "0.8292107", "0.82225496", "0.81515074", "0.7961868", "0.7912856", "0.78490186", "0.7842709", "0.774126", "0.7389038", "0.73329717", "0.72467643", "0.723842...
0.8258579
10
Create a new voice client on a specified channel.
async def create_voice_client(self, channel): voice = await self.bot.join_voice_channel(channel) try: await voice.enable_voice_events() except AttributeError: pass state = self.get_voice_state(channel.server) state.voice = voice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def connect_to_voice(self, channel: 'channel.Channel') -> 'voice_client.VoiceClient':\n if voice_client is None:\n raise RuntimeError(\"Cannot to voice - voice support is not installed\")\n\n if channel.guild != self:\n raise CuriousError(\"Cannot use channel from a differ...
[ "0.75153977", "0.64948446", "0.6226884", "0.62048393", "0.5955242", "0.5952323", "0.5909976", "0.58932656", "0.58811396", "0.5865138", "0.5817678", "0.57376015", "0.57296306", "0.57007957", "0.56454456", "0.562534", "0.5585151", "0.55837035", "0.55059814", "0.548221", "0.5465...
0.8372212
0
Get the current song queue.
async def queue(self, ctx): state = self.get_voice_state(ctx.message.server) if state.voice is None: await self.bot.say('**Not in a voice channel!**') return False if not state.songs: await self.bot.say('**Song queue is empty!**') return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queue(self):\n if self.queue is not None:\n return self.queue\n state = self.get_state()\n self.queue = state.get_queue()\n # print(\"IQ\", self.queue)\n return self.queue", "def get_queue(self):\n return self.queue", "def get_queue(self):\n r...
[ "0.78662604", "0.78366894", "0.78366894", "0.7708885", "0.7659444", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", "0.76152694", ...
0.70736057
27
Check that all elements of x are positive
def assert_positive(x): assert(all(x) >= 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isnegative(x):\n if x < 0 :\n return True\n return False", "def fun(self, x):\n if np.any(x < 0):\n return np.inf\n else:\n return 0", "def fun(self, x):\n if np.any(x > 0):\n return np.inf\n else:\n return 0", "def is_p...
[ "0.7470719", "0.72296077", "0.72095966", "0.71475345", "0.7071342", "0.7052071", "0.70485884", "0.6956397", "0.68494105", "0.68389016", "0.6816652", "0.67916405", "0.678423", "0.67650664", "0.6763081", "0.6690795", "0.6648411", "0.66150427", "0.6606947", "0.6584103", "0.65714...
0.81701094
0
Returns the maximum payload size for this transport. Most transports have a maximum packet size that can be sent. For example, UDP has a 65507 bytes MTU. py_zipkin automatically batches collected spans for performance reasons. The batch size is going to be the minimum between `get_max_payload_bytes` and `max_span_batch...
def get_max_payload_bytes(self) -> Optional[int]: # pragma: no cover raise NotImplementedError("get_max_payload_bytes is not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_size_bytes(self) -> Optional[float]:\n return pulumi.get(self, \"max_size_bytes\")", "def maximum_size(self):\n return self._maximum_size", "def max_packet_size(self):\n return max(self.fcip_doc['packet_lengths'])", "def maxSize(self):\n maxPartSize = self._unalignedMaxPar...
[ "0.6907384", "0.68627983", "0.68541986", "0.674063", "0.67396945", "0.6734887", "0.6703293", "0.66842026", "0.6658214", "0.66325015", "0.662275", "0.6498451", "0.6498451", "0.6498451", "0.6498451", "0.6490904", "0.64568436", "0.64568436", "0.64568436", "0.6426417", "0.6406231...
0.7692433
0
Initialize a Linear or Convolutional layer.
def init_layer(layer): if layer.weight.ndimension() == 4: (n_out, n_in, height, width) = layer.weight.size() n = n_in * height * width elif layer.weight.ndimension() == 2: (n_out, n) = layer.weight.size() std = math.sqrt(2. / n) scale = std * math.sqrt(3.) layer....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n # A dummy layer does nothing\r\n self.weights = np.zeros(shape=(input.shape[1], 10))\r\n bias = np.zeros(shape=(10,))\r\n pass", "def __init__(self, in_channels, out_channels, **kwargs):\n ConstrainedLayer.__init__(self, nn.Linear(in_channels, out_channe...
[ "0.6946551", "0.67547345", "0.6707431", "0.6665897", "0.6650076", "0.6640679", "0.6638478", "0.658717", "0.65688443", "0.65388083", "0.65354836", "0.6533983", "0.65278226", "0.64570576", "0.6450888", "0.6442372", "0.6424806", "0.6423904", "0.6369207", "0.63687015", "0.6366463...
0.71581787
0
Initialize a Batchnorm layer.
def init_bn(bn): bn.bias.data.fill_(0.) bn.weight.data.fill_(1.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batchnorm_init(m, kernelsize=3):\r\n n = kernelsize**2 * m.num_features\r\n m.weight.data.normal_(0, math.sqrt(2. / (n)))\r\n m.bias.data.zero_()", "def dncnn_batchnorm_init(m, kernelsize=3, b_min=0.025):\n n = kernelsize**2 * m.num_features\n m.weight.data.normal_(0, math.sqrt(2. / (n)))\n ...
[ "0.73815334", "0.718199", "0.7180469", "0.6950543", "0.67427087", "0.67249286", "0.6696273", "0.6694279", "0.6601284", "0.6590197", "0.6518155", "0.6487386", "0.6469243", "0.6458911", "0.64279944", "0.6422253", "0.6387756", "0.6363538", "0.63560706", "0.6354041", "0.6325349",...
0.0
-1
Query for right halfopen interval [l, r).
def query(self, l, r): dst_l = set() dst_r = set() l += self.N - 1 r += self.N - 1 while l < r: if l & 1: dst_l = self.func(dst_l, self.node[l]) l += 1 if r & 1: r -= 1 dst_r = self.func(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bisect_right(*args, **kwargs): # real signature unknown\n pass", "def test_right(self):\n x = np.array([-100, -2, -1, 0, 1, 1.1])\n self.assertEqual(npinterval.half_sample_mode(x), +1.05)", "def bs(arr, l, r, x):\n while l <= r:\n mid = l + (r - l)//2\n if arr[mid] == x:\...
[ "0.6521237", "0.5962696", "0.57842106", "0.57473195", "0.56855434", "0.5648532", "0.5546847", "0.54653275", "0.5455308", "0.54372406", "0.54341334", "0.5306993", "0.5260719", "0.5248285", "0.52153814", "0.5181624", "0.51792085", "0.51779634", "0.51634777", "0.5159596", "0.512...
0.556072
6
Function counts md5 hash of file where input is file_path
def count_md5hash_file(file_path): hash_md5 = hashlib.md5() with open(file_path, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return hash_md5.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_file_hash(filepath):\n with open(filepath, 'rb') as f:\n return md5(f.read()).hexdigest()", "def calc_file_md5(file_path):\n hash_md5 = str()\n method = hashlib.md5()\n if not os.path.exists(file_path):\n logger.error(\"File(%s) don not exist, can not calculation file hash\" % ...
[ "0.8018315", "0.7965841", "0.78639126", "0.7849782", "0.78127766", "0.76893175", "0.76651263", "0.76442546", "0.7612222", "0.76080316", "0.75821763", "0.7566572", "0.7555845", "0.7555322", "0.7548912", "0.75211287", "0.75041425", "0.7488032", "0.7476489", "0.7461284", "0.7431...
0.89501154
0
A helper function that extract any number from a text
def _extract_num(self, text): try: if 'studio' in text.lower(): return 0.0 text = text.replace(',', '') pattern = r'[-+]?\d*\.\d+|\d+' result = re.findall(pattern, text)[0] return float(result) except: return np.nan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_numeric(text):\n text_digits = \\\n re.sub('[^\\d]', '', text)\n if not text_digits:\n return None\n try:\n return int(text_digits)\n except ValueError:\n return None", "def extract_int(text):\n m = re.search(r\"\\d+\", text)\n ...
[ "0.77314574", "0.76525503", "0.7563327", "0.7511921", "0.7286301", "0.72470134", "0.7160466", "0.7147661", "0.7134207", "0.70645535", "0.7005501", "0.6924376", "0.68755144", "0.6827881", "0.68087167", "0.6807239", "0.67846596", "0.6778888", "0.6707231", "0.6692991", "0.662859...
0.75585616
3
helper function to unzip the price dictionary in the json file
def _unzip_pdict(self, price_dict): try: price_text = price_dict['price']['formattedPrice'].replace('$', '')\ .replace(',', '') price = self._extract_num(price_text) date = price_dict['formattedDate'] d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json_data(self, json_file:str):\n with open(json_file) as json_data:\n self._product_prices = json.load(json_data)", "def create_zip_dict() -> dict:\n with open('zip_coordinates.json', 'r') as zip_map:\n return json.loads(zip_map.read())", "def __read_temp_data(self) -> dict...
[ "0.5901224", "0.5738345", "0.5391835", "0.5355367", "0.5310326", "0.5281283", "0.52176434", "0.5158073", "0.5115969", "0.51139545", "0.5042528", "0.50273865", "0.502126", "0.50147444", "0.4995763", "0.49642718", "0.49198455", "0.4915515", "0.49034166", "0.48837534", "0.488300...
0.62157315
0
get the normal price information, for example, sales price and asking price
def _get_normal_sold_prices(self, jdict): price_dict = jdict['props']['homeDetails']['price'] try: sales_price_text = price_dict['formattedPrice'].replace(',','')\ .replace('$', '') sales_price = self._extract_num(sales_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prices(self):\n pass", "def get_price(self):\r\n return self.price", "def get_price(data):\n return data[\"summaryDetail\"][\"regularMarketPreviousClose\"][\"raw\"]", "def getPrice(self):\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Ap...
[ "0.68869174", "0.6840055", "0.68201876", "0.67868495", "0.6785083", "0.6763166", "0.6728498", "0.66985375", "0.65840966", "0.6576977", "0.6575487", "0.65702516", "0.6550844", "0.6550844", "0.6550844", "0.64999735", "0.64617074", "0.64586514", "0.6450088", "0.6441636", "0.6428...
0.70095503
0
Constructor for the Node class used to initialize all necessary fields of the Node object
def __init__(self, name, attributes, incident_edges): self.name = name # initialize all necessary fields self.attributes = attributes self.incident_edges = incident_edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.node = None\n self.data = None", "def __init__(self, nodes=None):\r\n self.nodes = nodes", "def __init__(self):\n self.__root = Node()", "def __init__(self):\n self.root = Node('')", "def __init__(self):\n self.root = self.Node(None)", ...
[ "0.8270757", "0.810787", "0.8055466", "0.8014164", "0.80139387", "0.80025434", "0.7993454", "0.7988581", "0.79303205", "0.7930228", "0.79131424", "0.79131424", "0.7908181", "0.78736365", "0.78691214", "0.78691214", "0.78691214", "0.78486216", "0.7828795", "0.7802131", "0.7781...
0.0
-1
Given a Node object, checks whether this Node object is equal to the input Node object equality of two Node objects is defined in terms of equality of their names and not as identical objects in memory
def __eq__(self, other): # check equality of names since names are unique identifiers of nodes return self.name.__eq__(other.get_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return type(self) == type(other) and self.node is other.node", "def __eq__(self, other):\n if not isinstance(other, Node):\n return False\n\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n return type(other) is type...
[ "0.792303", "0.78229594", "0.7814766", "0.7814766", "0.7814766", "0.7814766", "0.7814766", "0.78003395", "0.7577308", "0.75687593", "0.74977714", "0.7460101", "0.744646", "0.74145496", "0.7351673", "0.73259854", "0.72849333", "0.7226516", "0.7210509", "0.71873105", "0.713696"...
0.7852472
2
Returns the set of incident edges of the node
def get_incident_edges(self): return set(self.incident_edges) # return the set of incident edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edges(self):\n return \\\n set({\n edge\n for node in self.nodeset\n for edge in node.get_incident_edges()\n })", "def get_incident_nodes(self):\n # return the set of incident edges\n return \\\n {\n ...
[ "0.8223696", "0.813222", "0.74701804", "0.7383972", "0.73327655", "0.73171103", "0.7244137", "0.7244137", "0.7244137", "0.7244137", "0.7244137", "0.7244137", "0.71860677", "0.7137152", "0.71370023", "0.71221834", "0.71221834", "0.71221834", "0.7115095", "0.71137273", "0.70989...
0.84987277
1
Given a name, sets the current name of the node as the input
def set_name(self, name): self.name = name # overwrite the existing name with the input name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)", "def name(self, name):\n from_name = self.name\n assert isinstance(name, str)\n self._name = name\n if self.has_parent():\n self._parent_._name_changed(self, from_name)", "def set_name(self,...
[ "0.81654114", "0.74361104", "0.7267995", "0.7252928", "0.7209385", "0.71897745", "0.718783", "0.7121114", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.7054372", "0.70530665", ...
0.74752223
2