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
Helper function. Strips dollar sign and decimal from a curreny string.
def _strip_currency(amount): if amount[0] == '$': amount = amount[1:] if amount.find(".") != -1: return amount.replace(".", "") return amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_dollars(input, **kwargs):\n while input.startswith('$'):\n input = input[1:]\n while input.endswith('$'):\n input = input[0:-1]\n return input", "def clean_currency(x: str):\n # cprint(f\"### Function Name:-> {inspect.stack()[0][3]} ###\", 'yellow', 'on_grey', attrs=['bold']...
[ "0.77671385", "0.7447047", "0.68365633", "0.6818885", "0.6807645", "0.6742017", "0.66203654", "0.63368356", "0.61783016", "0.61313885", "0.6120201", "0.5976194", "0.5899814", "0.5766022", "0.5743835", "0.574222", "0.56958205", "0.56278116", "0.5624136", "0.55957615", "0.55917...
0.78178936
0
Populate the two lists above in value, letter format for the whole list of codes.
def populate_code_list(): letter_code_ST = "JZIHGFEDCBA" letter_code_FG = "XWUTRQPNMLK" for pos in range( len(letter_code_ST)): #Interestingly, the values start from 0 code_ST.append(pos) # Number first code_ST.append(letter_code_ST[pos]) for pos in range(len(letter_code_FG)): code_FG.append(pos) cod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_map(values, formatting):\n return [formatting % v for v in values]", "def prepare_output(width, values):\n values =list(values)\n rows = len(values)//(width+1)\n for y in range(rows):\n yield ''.join(map(lambda x: ENCODE[str(x)],\n values[ (y+1) * (width+1): ...
[ "0.56369257", "0.5561758", "0.5529543", "0.5446699", "0.5427835", "0.53386146", "0.53382003", "0.5309835", "0.526821", "0.5245705", "0.5214192", "0.52099526", "0.5179691", "0.51711977", "0.51261926", "0.512507", "0.5123931", "0.5101935", "0.50593543", "0.5057705", "0.5041399"...
0.7094265
0
Returns value of last letter of NRIC, if either `letter` or `IC_type` is invalid, returns None.
def get_value(letter, IC_type): try: if IC_type == 'S' or IC_type == 'T': index_of_letter = code_ST.index(letter) return code_ST[index_of_letter - 1] # Number is always before letter elif IC_type == 'F' or IC_type == 'G': index_of_letter = code_FG.index(letter) return code_FG[index_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_letter(value, IC_type):\n\tif value > 10 or value < 0:\n\t\t# Invalid value (must be between 0 to 10)\n\t\treturn None\n\telif IC_type == 'S' or IC_type == 'T':\n\t\tindex_of_value = code_ST.index(value)\n\t\treturn code_ST[index_of_value + 1] # Letter is always after number.\n\telif IC_type == 'F' or IC_...
[ "0.6910916", "0.5806234", "0.5544281", "0.5487317", "0.5336157", "0.5307867", "0.5201448", "0.51994157", "0.5013348", "0.49621174", "0.49422172", "0.49378374", "0.4921364", "0.48458573", "0.48280564", "0.48193341", "0.47375146", "0.47258356", "0.4724195", "0.47147396", "0.470...
0.7461332
0
Get last letter of NRIC from value and IC_type. If any of the arguments are invalid, returns None.
def get_letter(value, IC_type): if value > 10 or value < 0: # Invalid value (must be between 0 to 10) return None elif IC_type == 'S' or IC_type == 'T': index_of_value = code_ST.index(value) return code_ST[index_of_value + 1] # Letter is always after number. elif IC_type == 'F' or IC_type == 'G': index_of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nic_name(type):\n for name, nic_type in NICS.items():\n if nic_type == type:\n return name\n return 'Unknown'", "def get_value(letter, IC_type):\n\ttry:\n\t\tif IC_type == 'S' or IC_type == 'T':\n\t\t\tindex_of_letter = code_ST.index(letter)\n\t\t\treturn code_ST[index_of_letter -...
[ "0.66916966", "0.64896417", "0.5522553", "0.54715574", "0.5308737", "0.52842236", "0.52788615", "0.5277958", "0.52117705", "0.51529765", "0.5133456", "0.5104493", "0.505939", "0.5058794", "0.5033227", "0.5032145", "0.50259393", "0.501808", "0.4996973", "0.49798307", "0.496448...
0.66925097
0
Get a random element from the set.
def getRandom(self) -> int: return random.choice(list(self.set))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.6400411", "0.639...
0.7296881
2
Computes a safe divide which returns 0 if the denominator is zero. This can be used for calculating ndcg with corner case of all candidate documents having ratings 0.
def safe_div(numerator, denominator, name='safe_div'): return array_ops.where( math_ops.equal(denominator, 0), array_ops.zeros_like(numerator), math_ops.div(numerator, denominator), name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_divide(num,denom,ifzero=0.0):\n\n return ifzero if denom==0 else num/denom", "def tryDivide(x, y):\r\n s = 0.0\r\n if y != 0.0: s = x / y\r\n return s", "def division(a, b):\n if b != 0:\n return a//b", "def div0( a, b ):\n with np.errstate(divide='ignore', invalid='ignore'):\...
[ "0.70859694", "0.6955716", "0.6930073", "0.6828075", "0.6775757", "0.67565835", "0.66287583", "0.6628523", "0.6614808", "0.6586934", "0.6567077", "0.6540245", "0.64443797", "0.64379555", "0.6232448", "0.61908776", "0.6108881", "0.6107484", "0.60677236", "0.6043705", "0.601999...
0.674868
6
Variables to keep track in the learning phase It may seem a little bit redundant but to have a "settings" and a "vars" dictionary has its reasons. The settings are reference values, which cannot be updated or modified while training. Vars stores the traces, constantly changing in the training loop. These are reset to t...
def _training_vars(self): self.vars = dict() # Temperature params self.vars['TInit'] = -1 self.vars['TDecayRate'] = 0.05 # Bowl params self.vars['q_init'] = 16.58 # initial strength for the bowl self.vars['q_max'] = 150. #self.vars['q_rate'] = 10. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_auditory_model_vars(self, sess):\n self.sess = sess\n for network_key in sorted(self.config_recognition_networks.keys()):\n fn_ckpt = self.config_recognition_networks[network_key]['fn_ckpt']\n saver0 = self.config_recognition_networks[network_key]['saver0']\n ...
[ "0.61225253", "0.59717095", "0.5915758", "0.59061307", "0.58728355", "0.5870918", "0.57286114", "0.5706334", "0.56688154", "0.5616392", "0.55609936", "0.5555865", "0.5553166", "0.5549184", "0.55336905", "0.55241793", "0.5514752", "0.55072284", "0.5495789", "0.5485493", "0.548...
0.73735076
0
Add bowl biases and weights to the Harmony biases and weights.
def merge_bowl(self): self.B += self.Bowl_bS self.Bc += self.Bowl_bC self.W += self.Bowl_WS self.Wc += self.Bowl_WS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_bowls(self):\n self.bowls = [{} for x in xrange(self.p_constants[\"NPHILOSOPHERS\"])]\n for i in xrange(self.p_constants[\"NPHILOSOPHERS\"]):\n x, y, angle = self._get_chair_coord(i, 3.6)\n self.bowls[i][\"bowl\"] = self._load_model(\n \"bowl\", scale=[2...
[ "0.60047424", "0.5679274", "0.5678474", "0.5663176", "0.5640449", "0.56149936", "0.5598284", "0.5574415", "0.5569075", "0.5556507", "0.5548192", "0.5522798", "0.5507675", "0.5492043", "0.54881877", "0.54854", "0.54817307", "0.5461625", "0.5434703", "0.54307497", "0.54294014",...
0.7259449
0
Calculate the maximum Harmony state for the actual state.
def calc_max_Harmony(self): state = torch.linalg.pinv(self.W).matmul(-self.B - self.inpS) stateC = self.toConceptual(state) harmony = self.calc_harmony(state=state) return harmony, state, stateC
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_max(self) -> float:\n raise NotImplementedError", "def max_value(gameState):\n if terminal_test(gameState): return -1", "def max_value(self, state, max_alpha, max_beta, max_depth):\r\n if state.terminal_test():\r\n return state.utility(0)\r\n if max_depth <=0 :\r\n ...
[ "0.75400776", "0.72597986", "0.654422", "0.6471142", "0.643735", "0.64132464", "0.634019", "0.63382226", "0.6273009", "0.62630934", "0.62291306", "0.6176525", "0.61650676", "0.6153123", "0.61459583", "0.6080426", "0.6074553", "0.60652167", "0.60488844", "0.5992164", "0.599041...
0.79855025
0
Converts the given string to a tf.train.BytesList feature.
def _as_bytes_feature(in_string): return tf.train.Feature(bytes_list=tf.train.BytesList(value=[in_string]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bytes_list_feature(values):\n def norm2bytes(value):\n return value.encode() if isinstance(value, str) and six.PY3 else value\n \n return tf.train.Feature(\n bytes_list=tf.train.BytesList(value=[norm2bytes(values)]))", "def _bytes_list_feature(values):\n def norm2bytes(value):\n r...
[ "0.7926125", "0.7925323", "0.7857217", "0.7850749", "0.7850749", "0.76871824", "0.76760155", "0.7616749", "0.75978374", "0.759032", "0.759032", "0.75807464", "0.7580718", "0.7580718", "0.7580718", "0.7580718", "0.7580718", "0.7580718", "0.7580718", "0.7580718", "0.7569789", ...
0.84144086
0
Normalize a vector `v`.
def normalize(v): return np.array(v) / np.linalg.norm(v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(v):\n return v / np.linalg.norm(v)", "def normalized(v):\n norm = np.linalg.norm(v)\n if norm:\n return np.array(v) / norm\n else:\n return v", "def normalizeVector(v):\n normalizer = 1.0 / sum(v)\n\n normalized = [i * normalizer for i in v]\n return normalized"...
[ "0.88866264", "0.8511819", "0.83909476", "0.8157001", "0.80623", "0.80017537", "0.7774141", "0.76479834", "0.7607122", "0.75504184", "0.75440395", "0.74560946", "0.7427551", "0.7378063", "0.73304725", "0.730142", "0.72609097", "0.7246319", "0.722799", "0.7224301", "0.7224149"...
0.88153535
1
Given the normal vectors of the mirrors stored as row vectors in `M` and a tuple of nonnegative floats `d`, compute the vector `v` whose distance vector to the mirrors is `d` and return its normalized version.
def get_init_point(M, d): return normalize(np.linalg.solve(M, d))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_eigVec(self, V, L):\n N, M = V.shape\n V_norm = np.zeros((V.shape), dtype=float)\n for i in range(M):\n V_norm[:, i] = V[:, i] / math.sqrt(abs(L[i]))\n\n return V_norm", "def _vector_norms(self, v):\n\n squared_norms = torch.sum(v * v, dim=2, keepdim=Tr...
[ "0.6118353", "0.602269", "0.6018978", "0.59968084", "0.5942168", "0.59200644", "0.59058774", "0.58908683", "0.58846945", "0.5868598", "0.58448213", "0.58239037", "0.58164924", "0.5813734", "0.581062", "0.5804792", "0.57815164", "0.5773375", "0.5772721", "0.5754829", "0.572649...
0.54321986
65
Check if a face `f` is already in the list `l`. We need this function here because when some rotation r fixes a face f = (v1, v2, ..., v_k), r maps f as an ordered tuple to (v_k, v_1, ..., v_{k1}) or (v_2, ..., v_k, v_1) where they all represent the same face.
def check_duplicate_face(f, l): for _ in range(len(f)): if f in l or f[::-1] in l: return True f = f[-1:] + f[:-1] return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_existing_face(image, trackers, face):\n\n x1, y1, w1, h1 = face\n face_mask = np.zeros_like(image)\n face_mask[y1:y1+h1, x1:x1+w1] = 1\n for t in trackers:\n try:\n x,y,w,h = t.bounding_box\n t_mask = np.zeros_like(image)\n t_mask[y:y+h, x:x+w] = 1\n\n ...
[ "0.55698216", "0.5440201", "0.5388621", "0.53773355", "0.5264561", "0.5242273", "0.52185625", "0.5108922", "0.5103948", "0.5092447", "0.50796866", "0.5067916", "0.50605226", "0.5036693", "0.50260484", "0.49998", "0.49984178", "0.48652002", "0.48626113", "0.4856504", "0.484967...
0.78313446
0
Convert an array to POVRay format, e.g. (0, 1, 2, 3) > array[4] {0, 1, 2, 3}
def pov_array(arr): return "array[{}] {{{}}}".format(len(arr), ", ".join(str(x) for x in arr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_array_ejection():\n arr: pa.Array = pa.array([1, 2, 3, 4, 5], type=pa.int8())\n\n srs: pd.Series = arr.to_pandas() # NOTE: Requires pandas installation\n nparr: np.ndarray = arr.to_numpy()\n list_: List[dict] = arr.to_pylist()\n str_: str = arr.to_string()\n\n results = {\n 'to_...
[ "0.6364142", "0.6320654", "0.6277752", "0.6118535", "0.60715115", "0.60633266", "0.60359716", "0.598602", "0.5947269", "0.59098965", "0.59077847", "0.59044456", "0.58666337", "0.5854632", "0.5827846", "0.5802326", "0.58022517", "0.57964075", "0.5779424", "0.57464546", "0.5734...
0.668896
0
Get the user's requested location of a study space
def get_user_location(loc): if not loc: return {'lat': 37.8715926, 'lng': -122.272747} geocode_result = gmaps.geocode(loc) if not geocode_result: location = {'lat': 37.8715926, 'lng': -122.272747} else: location = geocode_result[0]['geometry']['location'] return location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location(self):\n\t\treturn self.location", "def location(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"location\")", "def location(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"location\")", "def location(self) -> pulumi.Input[str]:\n return pulumi.get(self, ...
[ "0.640531", "0.6348701", "0.6348701", "0.6348701", "0.61895525", "0.6187939", "0.61768484", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", "0.6128948", ...
0.0
-1
Finds the distance between the user location and a given space using Google Maps API
def calc_distance(user_loc, space): geocode_result = gmaps.geocode(space['_location']) dest_loc = geocode_result[0]['geometry']['location'] direction = gmaps.distance_matrix(user_loc, dest_loc, mode="walking") distance = direction['rows'][0]['elements'][0]['distance']['value'] # convert to mile ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to(self, location):\r\n return gislib.getDistance((self.latitude, self.longitude), location)", "def calculate_distance(loc1, loc2):\n matrix = googlemaps.distance_matrix.distance_matrix(client=gmaps_dist, origins=loc2, destinations=loc1)\n # import pdb; pdb.set_trace()\n return matrix['r...
[ "0.71179086", "0.6902482", "0.6823635", "0.6771833", "0.6749005", "0.6746466", "0.67224365", "0.6674674", "0.65882707", "0.65789706", "0.656021", "0.65578306", "0.6541417", "0.65371376", "0.6479973", "0.6479973", "0.6479973", "0.6479973", "0.6479973", "0.6461009", "0.6450305"...
0.7759494
0
Returns a random string of length=
def get_nonce(length=16): characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' charlen = len(characters) return "".join([characters[SystemRandom().randint(0, charlen - 1)] for _ in range(0, length)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def get_random_str(len):\n return base64.urlsafe_b64encode(os.urandom(len))[0:len]", "def get_random_string(length: int) -> str:\n return \"\".join(rando...
[ "0.86591905", "0.8635846", "0.8622473", "0.86133057", "0.85840774", "0.8572303", "0.85663974", "0.8555373", "0.8554227", "0.8521527", "0.8496463", "0.8486532", "0.84807545", "0.84555703", "0.84307486", "0.8415538", "0.84123003", "0.84000725", "0.83998704", "0.8393584", "0.838...
0.0
-1
Returns the UTC timestamp (seconds passed since epoch)
def get_timestamp(): return int(time.time())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self):\n # this only returns second precision, which is why we don't use it\n #now = calendar.timegm(datetime.datetime.utcnow().utctimetuple())\n\n # this returns microsecond precision\n # http://bugs.python.org/msg180110\n epoch = datetime.datetime(1970, 1, 1)\n ...
[ "0.7936531", "0.7898519", "0.7814208", "0.7791603", "0.7756655", "0.77407104", "0.77133244", "0.76633453", "0.7637644", "0.7446242", "0.74193436", "0.7388329", "0.7388329", "0.73861676", "0.7332608", "0.7312794", "0.7295566", "0.728356", "0.72696847", "0.7249653", "0.7219464"...
0.6781564
43
Available platforms to run OpenMM integratos List of available platforms to run an OpenMM MD integrators.
def available_platforms(verbose=True): import simtk.openmm as mm platforms_available = [] for ii in range(mm.Platform.getNumPlatforms()): platform_name = mm.Platform.getPlatform(ii).getName() platform = mm.Platform.getPlatformByName(platform_name) platform_speed = platform...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Platforms():\n return platforms", "def platforms(self):\n return self.rpc.call(MsfRpcMethod.ModulePlatforms)", "def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')", "def platforms(self):\n ...
[ "0.7646808", "0.7549929", "0.7539592", "0.74577063", "0.74328923", "0.73269373", "0.7041166", "0.6884026", "0.6793907", "0.6685119", "0.6598012", "0.65335494", "0.64757353", "0.63878375", "0.63565713", "0.63317806", "0.62993985", "0.6297716", "0.6287083", "0.61901385", "0.617...
0.7323758
6
Returns the type (lead or opportunity) from the type context key. Returns None if it cannot be resolved.
def _resolve_type_from_context(self, cr, uid, context=None): if context is None: context = {} return context.get('default_type')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getType_(self, ctx):\n # type: (Optional[RelayParser.Type_Context]) -> Optional[ty.Type]\n\n if ctx is None:\n return None\n\n return self.visit(ctx)", "def get_type(self, key):\n index = self.get_index(key)\n return self.types[index]", "def get_type(self, name...
[ "0.6757136", "0.6706491", "0.65554976", "0.6554644", "0.6529281", "0.6468766", "0.6422609", "0.6422609", "0.6422609", "0.6422609", "0.6422609", "0.6422609", "0.6422609", "0.62511736", "0.6245892", "0.622516", "0.6224198", "0.6211225", "0.6200925", "0.6138933", "0.61105657", ...
0.70583355
0
Overrides case_reset from base_stage to set probability
def case_reset(self, cr, uid, ids, context=None): res = super(crm_lead, self).case_reset(cr, uid, ids, context=context) self.write(cr, uid, ids, {'probability': 0.0}, context=context) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, var=0.1):\n\n self.P = 1 / (self.nx * self.ny) # uniform value\n if var != 0:\n self.P *= (1 + var * utils.rand_mat(self.ny, self.nx, 2))\n self.P = self.P / self.P.sum() # PD over all positions", "def reset(self):\n # Sample random state from initial ...
[ "0.6310039", "0.6226406", "0.6101777", "0.60591745", "0.6032534", "0.60075146", "0.59950566", "0.59734696", "0.59534734", "0.5868997", "0.5854682", "0.58497643", "0.581375", "0.5803138", "0.5791991", "0.576477", "0.5739797", "0.57222563", "0.5715996", "0.5654095", "0.5648659"...
0.6390232
0
Overrides mail_thread message_update that is called by the mailgateway through message_process. This method updates the document according to the email.
def message_update(self, cr, uid, ids, msg, update_vals=None, context=None): if isinstance(ids, (str, int, long)): ids = [ids] if update_vals is None: update_vals = {} if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES): update_vals['priority'] = msg.get('priority')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, message):\n return self.request().update(message)", "def update_document(self):\n pass", "def update(self, msg):\n pass", "def update(self, message):\n try:\n if message['type'] == 'l2update':\n if self.snapshot_received:\n ...
[ "0.6317671", "0.61888725", "0.61003745", "0.58473474", "0.57929367", "0.57609904", "0.5661817", "0.56516045", "0.5644521", "0.56359607", "0.5608263", "0.55657", "0.55611473", "0.5529815", "0.5526934", "0.5526934", "0.5526934", "0.5526934", "0.5526934", "0.5526934", "0.5526934...
0.5480555
34
Takes in filepath for the Spotify data.csv file. Returns a clean dataframe of song features to fit model.
def wrangle(filepath): df = pd.read_csv(filepath, parse_dates=['release_date']) # dropping name, artist column df = df.drop(['name', 'artists'], axis=1) # set ID as the index df.set_index('id', inplace=True) # rearranging similar features to be together to improve readability df = df[['val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_song_feats(path):\n features = read_process_song(path, debug=True)\n df = pd.DataFrame(features)\n df.to_csv('./Features/single_song_features/song_features.csv', index=False)", "def load_to_dataframe(self) -> DataFrame:\n return read_csv(self._csv_path, converters={\n # Chec...
[ "0.69362956", "0.63597655", "0.6331217", "0.6297758", "0.62829244", "0.62829244", "0.62829244", "0.6275574", "0.6233734", "0.61915153", "0.6122192", "0.6077448", "0.60757774", "0.6049861", "0.60401785", "0.60341305", "0.59958243", "0.5992287", "0.5986672", "0.59618044", "0.59...
0.6344901
2
Takes in filepath for the Spotify data.csv file. Returns a onecolumn dataframe that combines song track and artist and retains id as index.
def the_key(filepath): df = pd.read_csv(filepath, parse_dates=['release_date']) # stripping artist column of: [ ] ' and " df['artists'] = df['artists'].str.strip("[]") df['artists'] = df['artists'].str.strip("'") df['artists'] = df['artists'].str.strip('"') df['artists'] = df['artists'].st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTrackMetaData():\n\t\n\t## Get the raw file. The low_memory option\n\t## suppresses a warning regarding mismatched datatypes in\n\t## the track_id column. That's due to spacing in the original file.\n\tdf = pd.read_csv(\"_data\\\\fma_metadata\\\\tracks.csv\",header=1,index_col=0,low_memory=False)\n\t\n\t## ...
[ "0.6758468", "0.6724776", "0.6704046", "0.6641698", "0.6571647", "0.6557118", "0.6533165", "0.64078945", "0.6371436", "0.6369313", "0.6328281", "0.62949115", "0.623732", "0.62297624", "0.6190664", "0.61502844", "0.61421573", "0.61320996", "0.6131832", "0.6122996", "0.6052281"...
0.6035717
21
Takes in a user_input (song/artist). Returns the 'name_artist' column from recom_songs dataframe.
def recommended_songs(user_input, features_df, knn_spotify, filepath): # making user input lower to not worry about capitalizations user_input = user_input.lower() key = the_key(filepath) # find what name_artist combo contains the user_input: selected_song = key.loc[key.str.contains(user_input)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_artist_by_name(sp, artist_name_input):\n\n results = sp.search(q=artist_name_input, type='artist', limit=20, offset=0, market=\"DE\")\n\n result_artist_name = results[\"artists\"][\"items\"][0][\"name\"]\n result_artist_uri = results[\"artists\"][\"items\"][0][\"uri\"]\n\n return result_arti...
[ "0.60988337", "0.5961441", "0.5884529", "0.57266366", "0.5686379", "0.56074363", "0.56065184", "0.5573404", "0.5529175", "0.5502673", "0.5474266", "0.5456593", "0.5453423", "0.5294767", "0.5244903", "0.5232788", "0.5225777", "0.5216651", "0.5175045", "0.5171443", "0.51703477"...
0.57970524
3
Plot the actual vs prediction
def actual_pred_plot(preds): actual_pred = pd.DataFrame(columns=['Cost', 'prediction']) actual_pred['Cost'] = all_data['2020':].iloc[:, -1][1:len(preds) + 1] actual_pred['prediction'] = preds[:, -1] from keras.metrics import MeanSquaredError m = MeanSquaredError() m.update_state(np.array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()", "def plot_actual_predicted(self):\n predicted = [se...
[ "0.8016363", "0.7812984", "0.7511848", "0.7478569", "0.7478569", "0.73420775", "0.7329184", "0.7304897", "0.7298501", "0.72744495", "0.7248611", "0.7196231", "0.7184339", "0.7168592", "0.7128529", "0.70985746", "0.70667577", "0.70377576", "0.700117", "0.6997515", "0.69759053"...
0.7273787
10
Returns the Significance of Correlation Difference between two targets.
def evaluate_scd (ModelClass,dataset,subgroup,target1,target2): #Calculate the complement of the subgroup complement = dataset[~dataset.index.isin(subgroup.index)] if (ModelClass == ModelClass.PhiCoefficient): rSubgroup = phi_coefficient (subgroup,target1,target2) rComp = phi_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairwise_correlation_difference(self):\r\n\r\n real_cat, synth_cat = self.to_cat(self.origdst, self.synthdst)\r\n\r\n real_cat_dem = self.get_demographics(real_cat)\r\n synth_cat_dem = self.get_demographics(synth_cat)\r\n\r\n corr_real_obj = associations(real_cat_dem, theil_u=True, ...
[ "0.60125244", "0.57761127", "0.577126", "0.577126", "0.57657313", "0.5726438", "0.56251526", "0.5592713", "0.55920583", "0.5577291", "0.5565306", "0.55225384", "0.5462655", "0.54496014", "0.54294765", "0.54237884", "0.53734756", "0.5338461", "0.53347975", "0.53312147", "0.532...
0.0
-1
returns True if 'value' (integer) is a prime number
def is_prime(value): if value < 4: return True lower_bound = 2 upper_bound = value-1 prime = True test_value = lower_bound while test_value < upper_bound: #print "testing divisibility of %d for %d" % (value, test_value) if value % test_value == 0: prime = False test_value +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(value: int) -> bool:\n\n if value == 1:\n return False\n if value <= 0:\n raise ValueError(\"Value must be greater than zero\")\n\n for i in range(2, int(value**(1/2)) + 1):\n if value % i == 0:\n return False\n return True", "def is_prime(value):\n\n i...
[ "0.86636627", "0.85487485", "0.78635824", "0.7715309", "0.76515335", "0.76185423", "0.75159156", "0.75149083", "0.7505286", "0.7480962", "0.7471573", "0.74652374", "0.74637496", "0.7446017", "0.73746896", "0.73026043", "0.7255695", "0.7242692", "0.72397643", "0.7232214", "0.7...
0.8067463
2
return a json list of stations from the dataset.
def stations(): stationquery = session.query(Station.station).all() stationlist = list(np.ravel(stationquery)) return jsonify(stationlist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati...
[ "0.86685455", "0.86644834", "0.8661863", "0.8359953", "0.83221376", "0.83035815", "0.8287723", "0.8283134", "0.8267008", "0.8264919", "0.8253602", "0.8252809", "0.82200897", "0.82093203", "0.81995565", "0.81934214", "0.8187993", "0.81121486", "0.808024", "0.80782557", "0.8037...
0.82648444
10
Return a json list of Temperature Observations (tobs) for the previous year
def tobs(): prev_year = dt.date.today() - dt.timedelta(days=365) # date_string = prev_year.strftime("%Y-%m-%d") tobsquery = session.query(Measurement.tobs).filter(Measurement.date >= prev_year).all() tobslist = list(np.ravel(tobsquery)) return jsonify(tobslist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prior_year_temp():\n\n tobs_data = session.query(Measurements.tobs).all()\n return jsonify (tobs_data)", "def tobsdata():\n # query for the dates and temperature observations from a year from the last data point.\n # * Return a JSON list of Temperature Observations (tobs) for the previous year....
[ "0.8164726", "0.7804016", "0.77074", "0.76585793", "0.7623904", "0.73627263", "0.73342705", "0.7327496", "0.72380286", "0.71261024", "0.70932883", "0.705637", "0.7048202", "0.69966257", "0.6834264", "0.6800696", "0.6793342", "0.671503", "0.66767067", "0.665408", "0.6603448", ...
0.74057007
5
getelem(a) Get base parameter of lattice element.
def getelem(self,num): #return self.M.conf()['elements'][num] return self.lat[num]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_element( self, element_name, base_element = None ):\n if base_element is not None:\n if not etree.iselement( base_element ):\n return None\n else:\n base_element = self.xml_root\n element = base_element.find( element_name )\n if element == 'N...
[ "0.5991845", "0.5860682", "0.5698688", "0.5530531", "0.5530531", "0.5467117", "0.54570043", "0.54439616", "0.5406109", "0.5341983", "0.5339352", "0.52983683", "0.52809846", "0.5248648", "0.5230902", "0.51805675", "0.51779306", "0.5158748", "0.5099375", "0.5090803", "0.5086505...
0.6401
0
This just tests to make sure no errors are thrown on the HTML representation method for Common datasets
def test_html_repr(): repr_html = grid._repr_html_() assert repr_html is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_visualisations_get_visualisation_render_data(self):\n pass", "def testHTML(self):\n\n html = self.E.html()", "def test_make_HTML_table(self):\r\n\r\n # test pie charts\r\n fracs_labels_other, fracs_labels, all_counts, other_cat...
[ "0.7282864", "0.67490876", "0.6688977", "0.6507584", "0.6369928", "0.6338411", "0.63325006", "0.62288535", "0.62077993", "0.6192887", "0.617277", "0.61692536", "0.6164598", "0.61624587", "0.61612856", "0.6114783", "0.6099281", "0.6083697", "0.60777336", "0.60775816", "0.60674...
0.64409775
4
Get str of date searched
def _get_date_find(self, request): date_find = '{} 00:00:00'.format(dict(request.query_params)['day'][0]) return date_find
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_display_date(self):\n return ''", "def search_date(self, text='date'):\n\n date = input(f\"\\nEnter a {text} (MM-DD-YYYY): \")\n date_obj = datetime.strptime(date, \"%m-%d-%Y\")\n\n try:\n date = datetime.strftime(date_obj, \"%m-%d-%Y\")\n return date...
[ "0.69267786", "0.680074", "0.6627418", "0.64060193", "0.6172169", "0.6167138", "0.6152603", "0.60899776", "0.6073025", "0.59811574", "0.59228396", "0.5922739", "0.59016067", "0.58822554", "0.58786404", "0.5805891", "0.5795461", "0.57821083", "0.5780801", "0.57745636", "0.5766...
0.6268092
4
Get str of last date month
def _get_last_date_month(self, date_find): day = datetime.strptime(date_find, settings.TIME_FORMAT) last_day_of_month = calendar.monthrange(day.year, day.month)[1] date_day_of_month = '{}-{}-{} 00:00:00'.format(day.year, day.month, last_day_of_month) return date_day_of_month
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _last_month() -> str:\n time_now = gmtime()\n\n return (\n f\"{time_now.tm_year}-{time_now.tm_mon - 1:02d}\" if time_now.tm_mon > 1\n else f\"{time_now.tm_year - 1}-12\"\n )", "def last_month_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=1) + timedelta(days...
[ "0.854076", "0.8333281", "0.79105157", "0.7598895", "0.75700057", "0.7267156", "0.72514427", "0.7145211", "0.6900546", "0.6900546", "0.6884762", "0.6882453", "0.68651193", "0.6840585", "0.6794807", "0.6721219", "0.66455907", "0.6614086", "0.65608084", "0.6512545", "0.64799213...
0.733387
5
constructs a new polynomial instance based on the properties of an input polynomial useful for copying polynomials of other types
def from_poly(cls, polynomial: 'MultivariatePolynomialSingleABC', new_coeffs: Optional[ARRAY] = None) -> 'MultivariatePolynomialSingleABC': p = polynomial if new_coeffs is None: # use the same coefficients new_coeffs = p.coeffs return cls(new_coeffs, p.multi_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_poly(kwargs):\n from sklearn.preprocessing import PolynomialFeatures\n return PolynomialFeatures(**kwargs)", "def __init__(self, *args, **kwargs):\n self.polynomials = {}\n\n if len(args) == 1 and isinstance(args[0], list): # Polynomials represented as list\n index = 0\n ...
[ "0.6568247", "0.64295983", "0.6386891", "0.63809913", "0.6318159", "0.6318154", "0.6301703", "0.61820567", "0.6155465", "0.6088631", "0.6083284", "0.6061221", "0.60523856", "0.6051641", "0.60095537", "0.60087276", "0.5999626", "0.59994143", "0.59961444", "0.59960514", "0.5917...
0.7281376
0
returns a possibly new polynomial instance with a complete multi index set
def make_complete(self) -> "MultivariatePolynomialSingleABC": grid_completed = self.grid.make_complete() return self._new_instance_if_necessary(grid_completed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_poly(cls, polynomial: 'MultivariatePolynomialSingleABC',\r\n new_coeffs: Optional[ARRAY] = None) -> 'MultivariatePolynomialSingleABC':\r\n p = polynomial\r\n if new_coeffs is None: # use the same coefficients\r\n new_coeffs = p.coeffs\r\n return cls(new_co...
[ "0.6445853", "0.6440095", "0.6105801", "0.59238476", "0.59224", "0.5767178", "0.56442356", "0.55652624", "0.5477217", "0.54606646", "0.54151535", "0.5412537", "0.5401765", "0.5386115", "0.53524613", "0.53157145", "0.53133", "0.53120846", "0.5300932", "0.5290385", "0.5270622",...
0.54306006
10
helper to pretty format a number
def int_with_commas(number): try: number = int(number) if number < 0: return '-' + int_with_commas(-number) result = '' while number >= 1000: number, number2 = divmod(number, 1000) result = ",%03d%s" % (number2, result) return "%d%s" % (num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty(self):\n return \"(%s) %s-%s\" %(self.number[:3],\n self.number[3:6],\n self.number[6:])", "def pretty(val, precision=2):\n if val == 0:\n return \"0\"\n if val == TRACE_VALUE:\n return \"T\"\n return (\"%.\" + str...
[ "0.7286883", "0.7274925", "0.7108423", "0.6958404", "0.69194293", "0.6917193", "0.6893202", "0.6875911", "0.6856405", "0.68074435", "0.6792742", "0.6784017", "0.6757867", "0.67547905", "0.6744348", "0.6718731", "0.6682275", "0.6641084", "0.6636814", "0.66163814", "0.657756", ...
0.58519626
77
helper to convert internal utc time (used in pvr) to local timezone
def localdate_from_utc_string(timestring): utc_datetime = arrow.get(timestring) local_datetime = utc_datetime.to('local') return local_datetime.format("YYYY-MM-DD HH:mm:ss")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utcTime():\r\n return calendar.timegm(time.gmtime())", "def utc_to_local(t):\n # set utc tzinfo\n t = t.replace(tzinfo=tz.tzutc())\n # convert to local timezone\n return t.astimezone(tz.tzlocal())", "def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_time)", "def lo...
[ "0.73778236", "0.7363043", "0.7347032", "0.7347032", "0.7282719", "0.727166", "0.722594", "0.71217173", "0.7119671", "0.7103872", "0.7093175", "0.7019702", "0.7018241", "0.69947916", "0.6982052", "0.69743246", "0.69650817", "0.69650817", "0.69650817", "0.6952742", "0.694198",...
0.6395096
51
returns localized version of the timestring (used in pvr)
def localized_date_time(timestring): date_time = arrow.get(timestring) local_date = date_time.strftime(xbmc.getRegion("dateshort")) local_time = date_time.strftime(xbmc.getRegion("time").replace(":%S", "")) return local_date, local_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_str():\n return time.strftime(time_fmt)", "def getTimeString():\n\tfrom time import strftime\n\treturn strftime(\"%d-%m-%Y__%H-%M-%S\")", "def get_time() -> str:\r\n return time.strftime(TIMEFORMAT)", "def get_time() -> str:\n return strftime(\"%H:%M:%S\")", "def get_time_human_re...
[ "0.7170488", "0.71332073", "0.7044098", "0.69458014", "0.68391025", "0.6812707", "0.6692055", "0.6601628", "0.6581258", "0.65720856", "0.65688366", "0.65408266", "0.65278417", "0.6516151", "0.6498708", "0.64851916", "0.64040303", "0.6385953", "0.63613594", "0.6349379", "0.634...
0.694301
4
strip any newlines from a string
def strip_newlines(text): return text.replace('\n', ' ').replace('\r', '').rstrip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rstrip_str(user, str):\n return '\\n'.join([s.rstrip() for s in str.splitlines()])", "def lstrip(string):\n return \"\\n\".join(map(str.lstrip, string.split(\"\\n\")))", "def cleanup_newlines(string):\n return string.replace(\"\\r\\n\", \"\\r\").replace(\"\\n\", \"\\r\")", "def __remove_break_li...
[ "0.7724323", "0.7688195", "0.7556427", "0.75498444", "0.7421198", "0.7318667", "0.7060322", "0.6971319", "0.69640416", "0.69640416", "0.69326794", "0.6895737", "0.6879088", "0.68717164", "0.68453085", "0.6803091", "0.6800217", "0.67892915", "0.6787174", "0.6770464", "0.675047...
0.7785894
0
Compute next action(s) given the observation(s)
def step(self, step, observation, **extra_feed): extra_feed['act_step'] = step a, v, state, neglogp = self._evaluate([self.act_action, self.vf, self.state, self.act_neglogp], observation, **extra_feed) if state.size == 0: state = None return a, v, state, neglogp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _step(self, action):\n transitions = self.query_model(self.s, action)\n prob, next_s, r, is_terminal = transitions[categorical_sample(\n (t[0] for t in transitions), self.rng)]\n\n next_s = np.asarray(next_s)\n for i in range(len(self.s) - 1):\n if next_s[i+1] ...
[ "0.751726", "0.7189361", "0.7164387", "0.67716944", "0.6678073", "0.6625705", "0.65701383", "0.6570136", "0.6534015", "0.6496407", "0.6493432", "0.64862645", "0.6484863", "0.6459856", "0.6455071", "0.6447397", "0.6432757", "0.6432757", "0.64319026", "0.643132", "0.643132", ...
0.0
-1
Onehot encode an integer series.
def onehot_integer_series(s, drop_idx=None): dummy_str = s.astype(str) dummies = pd.get_dummies(dummy_str) cols = sorted(list(dummies.columns), key=float) dummies = dummies[cols] dummies.columns = ['relative_idx' + '[' + i + ']' for i in dummies.columns] if drop_idx is None: idx_min = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_...
[ "0.8112516", "0.78948283", "0.7856221", "0.7837259", "0.7820989", "0.78016", "0.77620375", "0.7691719", "0.76888496", "0.7619088", "0.7613614", "0.76076925", "0.7599257", "0.7555001", "0.7548924", "0.7543132", "0.75408345", "0.7537357", "0.75200623", "0.7504133", "0.7484111",...
0.70329475
59
Returns a context manager/decorator that guarantee atomic execution of a given block or function across all configured and initialized SQLAlchemy instances.
def atomic(self, savepoint=True): return TransactionContext(*self.values(), savepoint=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_context(func):\r\n def wrapper(*args, **kwargs):\r\n self = args[0]\r\n with self._create_db_session() as db:\r\n self.db = db\r\n return func(*args, **kwargs)\r\n return wrapper", "def transact(fn):\n @wraps(fn)\n def wrapper(*a...
[ "0.6314164", "0.627175", "0.6228322", "0.6158349", "0.6077604", "0.59779936", "0.59688634", "0.5954343", "0.5901813", "0.58817196", "0.58795583", "0.58755004", "0.58521223", "0.58434993", "0.58433545", "0.5842696", "0.5821285", "0.5816716", "0.58128816", "0.5800979", "0.57541...
0.5486719
48
Sends email to santa on behalf of the person. Giving santa their name and information
def send_santas_list(santa, person, budget=None): if budget: msg = f'Your secret Santa for {person.name} with a budget of {budget}' else: msg = f'Your secret Santa for {person.name}' subject = 'Your Foggy Secret Santa' santas_helper = 'punnyfoggersanta@gmail.com' password = 'double...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_santa(smtp, friend, lucky_one, really_send=False):\n logger = logging.getLogger(\"send_santa\")\n logger.debug(\"{} ({} will be notified that his/her lucky one is {}\".format(friend[\"name\"], friend[\"email\"], lucky_one[\"name\"]))\n\n msg = MIMEText(\n \"Ho ho ho!\\nThis is a Secret (So...
[ "0.713851", "0.65961343", "0.65635556", "0.64579463", "0.64423394", "0.63757616", "0.62781334", "0.62663877", "0.6189054", "0.6182647", "0.6182647", "0.6182647", "0.6182647", "0.6182647", "0.6182647", "0.6182647", "0.6182647", "0.61812836", "0.6178782", "0.6155948", "0.612116...
0.68543386
1
Returns a set of all keys that appear in wb but not wl.
def subtract(wb, wl): return set(wb) - set(wl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_without_letter(l):\n\treturn {w for w in word_set if has_no_letter(w, l)}", "def without_keys(keys):\n keys = frozenset(keys) # frozenset has efficient membership lookup\n return filter_keys_c(fnot(partial(operator.contains, keys)))", "def realkeys(self):\n\n return filter(lambda s: s[:...
[ "0.65524375", "0.63359576", "0.61149055", "0.5940325", "0.5868004", "0.5740896", "0.5734251", "0.57142144", "0.5685049", "0.56526905", "0.5638166", "0.55314076", "0.55303687", "0.5529077", "0.55194294", "0.55177146", "0.55043423", "0.5486384", "0.54800874", "0.54019105", "0.5...
0.6615817
0
If any two nodes in the nodelist are neighbors in graph G, it outputs TRUE, otherwise FALSE.
def any_neighbors(nodelist, G): outcome = False #neighbors = P.neighbors(n) for i in range(len(nodelist)): for j in range(i+1, len(nodelist)): if G.has_edge(nodelist[i], nodelist[j]) or G.has_edge(nodelist[j], nodelist[i]): ##if nodelist[j] in G.neighbors(nodelist[i]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_graph(g):\n # g must be list\n if type(g) is not list:\n return False\n n = len(g)\n\n # Neighbors must all be vertices, and given in order, no dups\n for adjl in g:\n # Each adj list must be of type list\n if type(adjl) is not list:\n return False\n # N...
[ "0.71341264", "0.70365304", "0.6972505", "0.68687797", "0.68168116", "0.6760885", "0.67534477", "0.6735668", "0.6724635", "0.6702493", "0.6682289", "0.666764", "0.66403246", "0.6626178", "0.66110617", "0.66071963", "0.6589299", "0.65367943", "0.652308", "0.6504352", "0.650014...
0.8484914
0
Restore the model from a saved checkpoint.
def _restore(self, restore_folder): tf.reset_default_graph() self.init_session() ckpt = tf.train.get_checkpoint_state(restore_folder) self.saver = tf.train.import_meta_graph('{}.meta'.format(ckpt.model_checkpoint_path)) self.saver.restore(self.sess, ckpt.model_checkpoint_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore(self, checkpoint):\n checkpoint_path = os.path.join(checkpoint, \"model_weights\")\n self.model.load_weights(checkpoint_path)", "def restore(self, checkpoint):\n raise NotImplementedError", "def restore(self):\n if self._restored_model:\n return\n with self.eval_graph.g...
[ "0.8344333", "0.8252216", "0.8184343", "0.80984694", "0.8080369", "0.8038346", "0.7839738", "0.7704049", "0.7701672", "0.7567944", "0.75634336", "0.75435215", "0.7514873", "0.749713", "0.7457411", "0.7426517", "0.731789", "0.72922343", "0.72922343", "0.72723144", "0.7207922",...
0.79543144
6
Construct the DiscoGAN operations.
def _build(self): if self.attn: self.Attn = AttentionNet(self.dim_b1, channels=self.channels, name='Attn') self.predsb1 = self.Attn(self.xb1, is_training=self.is_training) self.predsb2 = self.Attn(self.xb2, is_training=self.is_training, reuse=True) #TODO: generato...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_gan(self):\n # make weights in the discriminator not trainable\n self.d_model.trainable = False\n # get noise and label inputs from generator model\n gen_noise, gen_label = self.g_model.input\n # get image output from the generator model\n gen_output = self.g_mod...
[ "0.7037307", "0.6773145", "0.6642887", "0.6610782", "0.64606017", "0.64562225", "0.6410779", "0.633772", "0.62687176", "0.61853826", "0.6172082", "0.6135871", "0.61321867", "0.6119659", "0.61158615", "0.61078185", "0.6082727", "0.60760665", "0.6072108", "0.60670644", "0.60578...
0.58925456
31
Fetches the DataLoader object for each type in types from task. In super resolution tasks there is no such thing like task. So it is replaced with totally Random datasets. TODO for MAML
def fetch_dataloaders(types,n_cpu,folder_name): shot_size=2 #how many images in a shot test_suffix='_test' val_suffix='_val' dataloaders = {} for split in ['train', 'test', 'val']: if split in types: # use the train_transformer if training data, # else use eval_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_dataloader(types, dataset_dir, params):\n\n dataloaders = {}\n samplers = {}\n\n for split in ['train', 'val', 'test']:\n if split in types:\n path = os.path.join(dataset_dir, \"{}\".format(split))\n\n # Use the train_transformer if training data, else use eval_trans...
[ "0.72427875", "0.72416854", "0.7105497", "0.7013546", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.6925535", "0.69101447", "0.69042706", "0.68658936", "0.6864223", "0.6858604", "0.6823818", "0.67694664", "0.6760154...
0.72576153
0
Returns the name of the class
def find_name(self): return self.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_name(cls):\n return cls.__name__", "def class_name(cls):\n return cls.__name__", "def className(self):\n namevalue = self.__class__.__name__\n return str(namevalue)", "def f_get_class_name(self):\n return self.__class__.__name__", "def getClassName(self):\n n = t...
[ "0.8928834", "0.8928834", "0.8915145", "0.8912482", "0.88998675", "0.883571", "0.8759982", "0.87531096", "0.8733105", "0.862729", "0.8447899", "0.83121455", "0.82482237", "0.8237201", "0.8175965", "0.8171621", "0.8104922", "0.808653", "0.808653", "0.808653", "0.808653", "0....
0.7973398
27
Get incremental update for Min aggregate.
def _get_min_delta(self, instance, mode, previous): new_value = self._get_value_from_instance(instance) if mode == LEAVING: # new denormalized value is somewhere in DB, computing full # aggregate return self._get_full_aggregate(instance, exclude=True) if mode ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cummin(self):\n return self._lift(lambda c: c.cummin)", "def get_min_increments(self):\n\n return self.min_increments", "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def min(self):\n return self.__min", "def min(self):\n return ...
[ "0.6708575", "0.65667766", "0.65467554", "0.6482662", "0.6477188", "0.6454097", "0.6454097", "0.64439785", "0.6440469", "0.6390353", "0.6390353", "0.6377975", "0.6377975", "0.63663465", "0.6247068", "0.6229548", "0.61922675", "0.61847126", "0.61845815", "0.6175511", "0.611623...
0.62039864
16
Get aggregate subquery for full recompute of min/max aggregates.
def _get_full_aggregate(self, instance: models.Model, exclude: bool = False ) -> Optional[expressions.Subquery]: foreign_object = self._get_foreign_object(instance) if foreign_object is None: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregator():\n return Aggregator(\n agg_col=\"col_a\", values_col=\"col_b\", aggregates=[\"min\", \"max\", \"avg\", \"sum\"]\n )", "def calc_aggregate(self, dataset):\n if not self.needs_aggregate:\n logup('no aggregate calculation needed', level='warning')\n logger...
[ "0.6670844", "0.56717455", "0.56564933", "0.56390107", "0.56003207", "0.55667055", "0.55291814", "0.5474393", "0.5456852", "0.5408077", "0.5386999", "0.5335678", "0.530763", "0.5297721", "0.5293099", "0.5288855", "0.52514994", "0.5250286", "0.52284753", "0.5212568", "0.519593...
0.60166913
1
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.70900273
51
Returns the number of particles, if available.
def num_particles(self) -> Optional[Tuple[int, int]]: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_particles(self) -> int:\n return len(self.particles)", "def __len__(self):\n return self.nparticles", "def __len__(self):\n return len(self.particles.position[:,0])", "def num_particles(self) -> Tuple[int, int]:\n return (self.num_alpha, self.num_beta)", "def get_num_par...
[ "0.8590967", "0.79944277", "0.75770855", "0.7312709", "0.72170895", "0.6770507", "0.65453345", "0.6338748", "0.6315498", "0.6279628", "0.6253482", "0.6234182", "0.62217486", "0.61973864", "0.61826366", "0.6174397", "0.6140656", "0.6120221", "0.6075899", "0.6072864", "0.607286...
0.85676587
1
Calculate the approximate distance between two points, given their Lat/Lon values
def calcApproxDist(lon1, lat1, lon2, lat2): import math from shapely.geometry import Point if lat1 == lat2 and lon1 == lon2: return 0.0 point1 = Point(lon1,lat1) point2 = Point(lon2, lat2) return math.acos(math.sin(math.radians(point1.y))*math.sin(math.radians(point2.y))+math.cos(mat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']", "def distance_coordinates(lat1: Decimal, lon1: Decimal, lat2: Decimal, lon2: Decimal) -> Decimal:\n lat1 = math.radians(lat1)\n lon1 = math.radians(lon1)\n lat2 = math.radians(lat2)\...
[ "0.8199098", "0.7822446", "0.78014714", "0.7679517", "0.7670383", "0.76700294", "0.764351", "0.7591339", "0.757111", "0.7564444", "0.75632316", "0.7553037", "0.7544618", "0.7542004", "0.7538206", "0.7536084", "0.75343615", "0.752787", "0.75252414", "0.7522725", "0.75122535", ...
0.7367009
37
Calculate the average rating of a user
def calcUserMeanRating(userRatingGroup): userID = userRatingGroup[0] ratingSum = 0.0 ratingCnt = len(userRatingGroup[1]) if ratingCnt == 0: return (userID, 0.0) for item in userRatingGroup[1]: ratingSum += item[1] return (userID, 1.0 * ratingSum / ratingCnt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_average_user_ratings(user_ratings):\n ave_ratings = {}\n \n for user,value in user_ratings.items():\n sum = 0\n movie_num=0\n for movieId, rating in value.items():\n sum += float(rating)\n movie_num += 1\n average = sum / movie_num\n ave...
[ "0.80205566", "0.7939321", "0.7926681", "0.7753855", "0.76854134", "0.76696795", "0.7651114", "0.7589814", "0.7562439", "0.7513138", "0.74459785", "0.7426623", "0.74214137", "0.7368612", "0.73571825", "0.7303121", "0.71451694", "0.7126474", "0.708925", "0.7052273", "0.6982415...
0.7985902
1
Parse an unsigned 8bit integer from the bytes.
def unpack_uint8(data): value = unpack(DecodeUtils.UINT8_BYTE_FORMAT, data[:1])[0] return value, 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_u8(as_bytes: typing.List[int]) -> int:\n return le_bytes_to_int(as_bytes, False)", "def read_uint8(self):\n bytes = self.data[:1]\n value = struct.unpack('!B',bytes)[0]\n self.data = self.data[1:]\n return value", "def u8(value: bytes, endian: str = \"little\", sign: b...
[ "0.73713845", "0.69921416", "0.67187464", "0.6702818", "0.66954696", "0.6689113", "0.6662149", "0.66144216", "0.66144216", "0.6565723", "0.64349794", "0.6393906", "0.6361286", "0.63568467", "0.63192356", "0.6304266", "0.62671477", "0.619058", "0.61608195", "0.6131338", "0.611...
0.7273293
1
Parse a signed 8bit integer from the bytes.
def unpack_int8(data): value = unpack(DecodeUtils.INT8_BYTE_FORMAT, data[:1])[0] return value, 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_integer(bytes_data): # type: (bytes) -> int\n values = [ord(b) for b in bytes_data]\n # check if the integer is normalized\n if (\n len(values) > 1\n and (\n values[0] == 0xff\n and values[1] & 0x80\n or values[0] ...
[ "0.6990185", "0.6858169", "0.6797516", "0.6487372", "0.6438777", "0.6365395", "0.6346872", "0.6334926", "0.632714", "0.6302889", "0.6258864", "0.62514436", "0.62475884", "0.6219506", "0.6163626", "0.61533463", "0.613502", "0.61292875", "0.6127012", "0.6121435", "0.61190104", ...
0.69142514
1
Send an email to a user notifying them that their account has been created.
def create_email(user): if 'research' in user.get_domains(): domain = 'research' else: domain = 'academic' subject = "ECE/CIS Account Created" helprequest = "https://www.eecis.udel.edu/service" message = "Your ECE/CIS %s account has been created with the username: %s\n\n" % (domain, use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has been submitted by %s.<br><br>\n\nGo here to view or edit the request: <br>\n<a href=\"%s\">%s</a>\n<br><br>\nSincerely,<...
[ "0.7724701", "0.73471016", "0.72438747", "0.72387886", "0.7115087", "0.70752954", "0.7019787", "0.69922435", "0.69350284", "0.69245523", "0.6917842", "0.6917842", "0.6917842", "0.6917842", "0.6917842", "0.6917842", "0.6917842", "0.6917842", "0.689684", "0.6867531", "0.6866085...
0.747938
1
get the "kind" attribute for a parse node
def get_nd_kind(e,form): sc_sp = vcb.spell_sc(e.sc) if sc_sp == "QuoteBlk": return NdKind.quote if sc_sp == "ParenBlk": return NdKind.paren if e.check_sc(WP_punct): return NdKind.punct if form == NdForm.queryclause or \ form == NdForm.queryphrase or \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kind(self):\n return self.get_data(\"kind\")", "def get_kind(self, ):\n return self.get_parameter('kind')", "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind\")", "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind\")", "def kind(self) -> Opti...
[ "0.6558836", "0.6395545", "0.6094172", "0.6094172", "0.6094172", "0.6094172", "0.6061718", "0.6061718", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.60044855", "0.6...
0.53693974
63
This method accepts a list of graph nodes, and returns a corresponding list of parse nodes.
def get_parse_nodes(lst,parent,sr): nds = [] for e in lst: if e.msnode is not None: nds.append(e.msnode) continue # create a parse node and add to "nds". text = lexer.src[e.S:e.E+1] if e.is_verb() \ else vcb.spell(e.wrds) form = get_nd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, ast_nodes: List[ast.ASTNode]) -> List[ast.ASTNode]:\n pass", "def parse_nodelist(nodelist):\n split_nodelist = nodelist.split(\",\")\n\n parsed_nodelist = []\n for node in split_nodelist:\n\n if \"[\" in node and \"]\" in node:\n node = parse_node(node)\n\n ...
[ "0.6344931", "0.62818646", "0.62697077", "0.6229976", "0.62220335", "0.6070117", "0.6014768", "0.59697944", "0.5886597", "0.5886088", "0.58427227", "0.58322626", "0.5814805", "0.5812239", "0.5750342", "0.57266974", "0.5721351", "0.5695989", "0.5678007", "0.5670684", "0.565537...
0.5231977
86
Create a view that returns a single Product object based on the product ID (pk) and render it to the 'productdetail.html' template. Or return a 404 error if the post is not found. User can add a review too
def product_detail(request, pk): product = get_object_or_404(Product, pk=pk) if request.method == "POST": if not request.user.is_authenticated: return redirect('login') else: form = ReviewForm(request.POST) if form.is_valid(): review = form.sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_detail_view(request, pk=None, *args, **kwargs):\n # instance = Product.objects.get(pk=pk)\n # Using in-built get_object_or_404 error\n # instance = get_object_or_404(Product, pk=pk)\n\n # # Our own version of 404\n # try:\n # instance = Product.objects.get(pk=pk)\n # except Pro...
[ "0.77373123", "0.755058", "0.74416995", "0.7310316", "0.7305183", "0.7245424", "0.7184846", "0.7181551", "0.69021404", "0.68619937", "0.678674", "0.6697914", "0.6680278", "0.6665663", "0.66148835", "0.6566058", "0.6562269", "0.64760804", "0.6450543", "0.63844514", "0.6343725"...
0.661468
15
Constructor. Build point from x and y and z
def __init__(self, x = np.float32(0.0), y = np.float32(0.0), z = np.float32(0.0)): self._x = np.float32( x ) self._y = np.float32( y ) self._z = np.float32( z )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, x, y, z):\n self.x = x\n self.y = y\n self.z = z", "def from_xyz(cls, x, y, z):\n obj = cls()\n obj._x = x\n obj._y = y\n obj._z = z\n return obj", "def __init_primitive(self, point_x, point_y, point_z):\n self.x = point_x\n ...
[ "0.78146017", "0.7782909", "0.77533406", "0.774728", "0.76041216", "0.7596423", "0.73721755", "0.72505987", "0.7228292", "0.711185", "0.7062159", "0.69915956", "0.69110364", "0.6847511", "0.6774434", "0.66863275", "0.6660342", "0.66444695", "0.66075885", "0.65997636", "0.6552...
0.71242756
9
Given the index i, returns the proper item
def __getitem__(self, i): if i < X: raise IndexError("point3d::__getitem__: negative index {0}".format(i)) if i == X: return self._x if i == Y: return self._y if i == Z: return self._z # beyond Z raise IndexError("point3d::_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self,i):\n return self._items[i]", "def __getitem__(self, i):\n return self.get(i, i + 1)", "def get_item(self, index: int) -> _T:\n return self.index_to_item[index]", "def __getitem__(self, i):\n return self._ar[i]", "def __getitem__(self, i):\n\t\tif i < self.n...
[ "0.8097822", "0.78811437", "0.7584663", "0.7531509", "0.7465457", "0.7418461", "0.7394784", "0.73842716", "0.7314473", "0.72610945", "0.7236078", "0.723439", "0.72247165", "0.72010475", "0.7185192", "0.71575785", "0.71551096", "0.70876527", "0.70601946", "0.70598936", "0.7042...
0.0
-1
Canny edge detector instead of a Laplacian kernel is that the edges are all single pixel edges in the resulting image
def edgeDetection(image): output = np.array(image) #ksize determines details median_filtimg2 = cv2.medianBlur(output,5) lowThreshold = 100 edges = cv2.Canny(median_filtimg2,lowThreshold,lowThreshold*2) #kernel size determines the bold kernel = np.ones((1,1), np.uint8) dialateimg = cv2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_detect_canny(gray_img):\n\n edges = cv2.Canny(gray_img, 100, 200)\n\n return edges", "def edgeDetection():\n image1 = cv2.imread(\"images\\OC14.tiff\")\n edges = cv2.Canny(image1, 100, 200)\n image1 = cv2.resize(image1, (612, 512))\n edges = cv2.resize(edges, (612, 512))\n cv2.imsho...
[ "0.7614531", "0.75476444", "0.75039446", "0.7399708", "0.73855066", "0.73777705", "0.734354", "0.73343897", "0.7332954", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346", "0.7253346",...
0.76259655
0
Function goes through a text and uses NLTK to tokenize it, grabbing all parts of speech contained in the types_to_remove list. Returns a List of lists of a part of speech (string) and a list of those words.
def get_words_for_fill(text, types_to_remove): # Parts of speech parsing types = pos_tag(text) word_lst = [] # For each type to remove, we append it and a list of words to word_lst for index in range(len(types_to_remove)): word_lst.append([types_to_remove[index], []]) # Fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def madlib_remove(text, types_to_remove):\n # Tokenize the text\n tokens = word_tokenize(text)\n # Gets rid of weirdness\n tokens = remove_weirdness(tokens)\n # Gets parts of speech\n orignial = pos_tag(tokens)\n word_lst = []\n \n word_index = 0\n # next_remove is used along with wor...
[ "0.7889726", "0.6906226", "0.6835494", "0.66882706", "0.66818017", "0.66793203", "0.6669046", "0.6599055", "0.6575317", "0.6519294", "0.6505143", "0.6498522", "0.6491718", "0.64866424", "0.64862865", "0.6466624", "0.645005", "0.6441251", "0.6433838", "0.6429249", "0.6428838",...
0.8367128
0
Function takes a text (List of strings) and removes a random amount of words that are parts of speech specified in types_to_remove_list Returns a new list of strings with some words removed and replaced by a string denoting thier parts of speech
def madlib_remove(text, types_to_remove): # Tokenize the text tokens = word_tokenize(text) # Gets rid of weirdness tokens = remove_weirdness(tokens) # Gets parts of speech orignial = pos_tag(tokens) word_lst = [] word_index = 0 # next_remove is used along with word_index # t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words_for_fill(text, types_to_remove):\n # Parts of speech parsing\n types = pos_tag(text)\n \n word_lst = []\n \n # For each type to remove, we append it and a list of words to word_lst\n for index in range(len(types_to_remove)):\n word_lst.append([types_to_remove[index], []])\...
[ "0.7764373", "0.70716745", "0.67324823", "0.6561459", "0.6539524", "0.6475677", "0.6463758", "0.6456611", "0.64456904", "0.6440487", "0.6422589", "0.6383632", "0.6383245", "0.63535583", "0.6319063", "0.62903494", "0.61995286", "0.6164367", "0.6120431", "0.6088785", "0.60762",...
0.8275887
0
Shorten a list computing the average over subsets of entries
def shorten_list(original: np.ndarray, size: int) -> np.ndarray: # Compute the size of the window for the averaged elements window_size = math.ceil(len(original) / size) # Compute the trimmed length so that the list can be reshaped correctly rounded_len = window_size * math.floor(len(original) / win...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg(list):\n return sum(list) / len(list)", "def average(lst):\n return sum(lst)/len(lst)", "def avg(l):\n return (sum(l)/float(len(l)))", "def avg(lst: list):\n return sum(lst) / len(lst)", "def avg():\n\n # call sum method to add up the values in the collection & div by the num of item...
[ "0.7302903", "0.7191029", "0.71259147", "0.70965517", "0.700189", "0.6935504", "0.6935186", "0.6891205", "0.68835086", "0.6861036", "0.68507874", "0.6789785", "0.6750113", "0.67335176", "0.6702216", "0.66694134", "0.65973353", "0.6574791", "0.6488216", "0.6488024", "0.6486529...
0.6638508
16
Update this config manager with values from the config dict. All values will be given the priority and source if they have higher priority than the current values.
def update_config(self, config, priority, source): for key, value in config.items(): self._config[key].add(value, priority, source)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_config(self, update_dict):\n self.config = recursive_merge_dicts(self.config, update_dict)", "def init_config(self):\n super().init_config()\n for param in self.parameters():\n if param.name == 'source':\n continue\n self.add_config_item(param....
[ "0.6581132", "0.6492026", "0.6486105", "0.6463663", "0.64563775", "0.6453161", "0.639583", "0.6379144", "0.63316506", "0.63113517", "0.6304261", "0.62811786", "0.62701225", "0.62667394", "0.6224454", "0.62000585", "0.61864936", "0.6138734", "0.6127429", "0.61130834", "0.61056...
0.79682726
0
Expand the value by recursively expanding all the references in the value. This only works on string or multiple strings values and if a non string value is referenced it will be converted to string.
def _expand_value(self, value, multiple=False): if multiple: return tuple(self._expand_value(item) for item in value) elif isinstance(value, str): expanded_value = value for match in re.finditer(r'\${([\w\d.]+)}', value): key = match.group(1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(self):\n if len(self.children) == 0:\n return self.val\n params = (',').join([ child.flatten() for child in self.children ])\n return '%s(%s)' % (self.val, params)", "def expand(self, s, lvars):\n if is_String(s):\n try:\n s0, s1 = s[:2...
[ "0.57368153", "0.5705461", "0.5512213", "0.53706056", "0.5309204", "0.52790105", "0.52620554", "0.51775265", "0.5127051", "0.4995942", "0.49663898", "0.48598605", "0.4855586", "0.4831368", "0.48134065", "0.48129892", "0.48128045", "0.4805924", "0.48058614", "0.4788923", "0.47...
0.7185337
0
Returns a numpy array of register bytes to ping DAC register
def regPing(cls): regs = np.zeros(cls.REG_PACKET_LEN, dtype='<u1') regs[0] = 0 # No sequence start regs[1] = 1 # Readback after 2us return regs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regPing(cls):\n regs = np.zeros(cls.REG_PACKET_LEN, dtype='<u1')\n regs[0] = 1 # Master mode to prevent daisy passthrough.\n regs[1] = 1 # Readback after 2us\n regs[51] = cls.MONITOR_0\n regs[52] = cls.MONITOR_1\n return regs", "def regPllQuery(cls):\n regs ...
[ "0.67478544", "0.6577787", "0.6003289", "0.5949199", "0.5781544", "0.5698234", "0.56073993", "0.55969465", "0.55628383", "0.5540556", "0.55306125", "0.5519226", "0.55055386", "0.54764205", "0.5466178", "0.54622555", "0.5440598", "0.54204446", "0.5419586", "0.54119444", "0.541...
0.72466743
0
Get a runner for this board
def buildRunner(self, reps, info): mem = info.get('mem', None) startDelay = info.get('startDelay', 0) sram = info.get('sram', None) runner = self.RUNNER_CLASS(self, reps, startDelay, mem, sram) return runner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_runner(self, runner_id: int = 0) -> ExperimentRunner:\n return self.runners[runner_id]", "def get_runner(task, endpoint, runner_type):\n return ScenarioRunner._get_cls(runner_type)(task, endpoint)", "def runner(self) -> Optional[pulumi.Input['ElastigroupIntegrationGitlabRunnerArgs']]:\n ...
[ "0.78009766", "0.6505204", "0.64436895", "0.6112908", "0.6088012", "0.60428387", "0.59508646", "0.59508646", "0.5945104", "0.58690155", "0.58620715", "0.58474237", "0.5767974", "0.56976616", "0.5669445", "0.56272554", "0.561763", "0.55884075", "0.550557", "0.549982", "0.54984...
0.5115727
52
Returns a numpy array of register bytes to ping DAC register
def regPing(cls): regs = np.zeros(cls.REG_PACKET_LEN, dtype='<u1') regs[0] = 1 # Master mode to prevent daisy passthrough. regs[1] = 1 # Readback after 2us regs[51] = cls.MONITOR_0 regs[52] = cls.MONITOR_1 return regs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regPing(cls):\n regs = np.zeros(cls.REG_PACKET_LEN, dtype='<u1')\n regs[0] = 0 # No sequence start\n regs[1] = 1 # Readback after 2us\n return regs", "def regPllQuery(cls):\n regs = np.zeros(cls.REG_PACKET_LEN, dtype='<u1')\n regs[0] = 0 # No sequence start\n ...
[ "0.72464156", "0.6576534", "0.6002863", "0.59489465", "0.57810265", "0.5698021", "0.56062615", "0.55950886", "0.5561551", "0.5539806", "0.55303484", "0.55187076", "0.550427", "0.54749215", "0.54661095", "0.5462384", "0.5440117", "0.54201937", "0.5419437", "0.541004", "0.54092...
0.67472947
1
Conservative estimate of the length of a sequence in seconds.
def sequenceTime_sec(cmds): cycles = sum(MemorySequence.cmdTime_cycles(c) for c in cmds) return cycles * 40e-9 # assume 25 MHz clock -> 40 ns per cycle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n if self.running:\n return ZERO_TIME\n else:\n return self.end - self.start", "def to_length_secs(self):\n return (self.bpm / 60.0) / self.period", "def time_length(self):\n return self._time_length", "def obs_length(self):\n return ...
[ "0.6998882", "0.68524516", "0.6797562", "0.6761214", "0.67362887", "0.6660412", "0.64433813", "0.6378702", "0.63394797", "0.6308439", "0.6295415", "0.6287739", "0.627436", "0.6274238", "0.6220752", "0.6211181", "0.61874086", "0.6177266", "0.6162294", "0.6150027", "0.6148058",...
0.0
-1
Update eines bestimmten chatmessageObjekts.
def put(self,id): adm = Administration() cm = ChatMessage.from_dict(api.payload) if cm is not None: cm.set_id(id) adm.save_chatmessage(cm) return '', 200 else: return '', 500
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, chatmessage):\n\n cursor = self._cnx.cursor()\n\n command = \"UPDATE chatmessage \" + \" SET text=%s,chat_id=%s WHERE id=%s\"\n data = (chatmessage.get_text(), chatmessage.get_chat_id(),chatmessage.get_id())\n cursor.execute(command, data)\n\n self._cnx.commit()\...
[ "0.7388177", "0.71790093", "0.69108164", "0.6665034", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6545039", "0.6486534", ...
0.57174474
84
Selects best half of each population and saves n individuals from this selection for migration. Creates a new dictionary for index, fit values and weights.
def select_from_best_half(pops,fit_pop): index_d = {} fit_inds_d = {} pop_inds_d = {} for i in range(n_islands): index_d[i] = heapq.nlargest(int(npop/2), range(npop), key=lambda x: fit_pop[i][x]) index_d[i] = random.sample(index_d[i], n_migrate) fit_inds_d[i] = list(map(lambda y:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_weights(self, generations):\n for gen in range(generations):\n print(\" Generation: %s\" % gen)\n self._pop_f1 = 0\n self._queue_search(self.population)\n self._queue.join()\n self._scores = {}\n while not self._results.empty():\...
[ "0.6018473", "0.58698547", "0.5855939", "0.5824104", "0.5815992", "0.57884735", "0.57478344", "0.56325215", "0.5613777", "0.5593953", "0.55751854", "0.5485434", "0.5467187", "0.5451086", "0.5425107", "0.5421535", "0.54184806", "0.5416091", "0.54080534", "0.5386495", "0.538569...
0.69576675
0
Selects best n individuals from the population and saves it to a new dictionary, one for index, fit values and indivual weights.
def select_best(pops, fit_pop): best_index_d = {} best_fit_inds_d = {} best_pop_inds_d = {} for i in range(n_islands): best_fit_inds_d[i] = heapq.nlargest(n_migrate, fit_pop[i]) best_index_d[i] = heapq.nlargest(n_migrate, range(npop), key=lambda x: fit_pop[i][x]) best_pop_inds_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(individuals, n):\r\n # return selBest(individuals, n)\r\n return individuals[:n]", "def top_n(self, n):\n top = {}\n for code, feat_set in self.iteritems():\n tuples = sorted(feat_set.items(), reverse=True, key=itemgetter(1))\n best = {feat for feat, _ in tupl...
[ "0.64846075", "0.6284101", "0.6260117", "0.61807966", "0.6101424", "0.6093527", "0.6085642", "0.6077123", "0.6068297", "0.5980875", "0.59738123", "0.58168894", "0.581556", "0.56334335", "0.56281275", "0.56201684", "0.5574899", "0.5555969", "0.5535717", "0.5535717", "0.5535717...
0.60210127
9
Convolve a batch of nodes and children. Lots of high dimensional tensors in this function. Intuitively it makes more sense if we did this work with while loops, but computationally this is more efficient. Don't try to wrap your head around all the tensor dot products, just follow the trail of dimensions.
def conv_step(self, parent_node_embedding, children_embedding, children_index, node_dim, w_t, w_r, w_l, b_conv): with tf.compat.v1.name_scope('conv_step'): # nodes is shape (batch_size x max_tree_size x node_dim) # children is shape (batch_size x max_tree_size x max_children) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_node(self, parent_node_embeddings, children_embeddings, children_indices, node_dim, layer):\n with tf.compat.v1.name_scope('conv_node'):\n w_t, w_l, w_r = self.weights[\"w_t_\" + str(layer)], self.weights[\"w_l_\" + str(layer)], self.weights[\"w_r_\" + str(layer)]\n b_conv = s...
[ "0.5940407", "0.54227793", "0.5352251", "0.5349569", "0.5199552", "0.51420975", "0.50914097", "0.5035469", "0.5019315", "0.49476445", "0.49455276", "0.49445716", "0.4913043", "0.48972735", "0.4874584", "0.48715165", "0.4864481", "0.48490533", "0.48468614", "0.48410136", "0.48...
0.6305923
0
Reset all the statistics and metrics fields.
def reset(self) -> None: self.statistics = defaultdict(float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.sum_metric = 0.\n self.num_inst = 0.\n self.metrics.reset_stats()", "def reset_metric_stats(self):\n\n self.__stats_table = {}", "def stats_reset(self):\n self.stats.reset()", "def stats_reset(self):\n self.stats.reset()", "def reset_metric_...
[ "0.8472925", "0.832886", "0.82712287", "0.82712287", "0.82181585", "0.8127687", "0.81063384", "0.7841572", "0.7768799", "0.7764818", "0.77358586", "0.768062", "0.76459306", "0.7632498", "0.7632498", "0.7632498", "0.75435334", "0.7526935", "0.74830943", "0.7433618", "0.7430342...
0.8191474
5
Create subset of dataset and properly handle kernels. Slice X, y according to indices for crossvalidation, but take care of precomputed kernelmatrices or pairwise affinities / distances. If ``estimator._pairwise is True``, X needs to be square and we slice rows and columns. If ``train_indices`` is not None, we slice ro...
def _safe_split(estimator, X, y, indices, train_indices=None): if _safe_tags(estimator, key="pairwise"): if not hasattr(X, "shape"): raise ValueError( "Precomputed kernels or affinity matrices have " "to be passed as arrays or sparse matrices." ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_kernel(X, y, train_test_split, split_index, clf_info, permute):\n import numpy as np\n from sklearn.pipeline import Pipeline\n\n def to_instance(clf_info):\n mod = __import__(clf_info[0], fromlist=[clf_info[1]])\n params = {}\n if len(clf_info) > 2:\n params ...
[ "0.5633974", "0.5441278", "0.54332125", "0.54044044", "0.5276328", "0.52614975", "0.5258819", "0.52243674", "0.52212816", "0.52212816", "0.5191108", "0.5188722", "0.5167675", "0.5150642", "0.5143706", "0.51176107", "0.5111362", "0.5111362", "0.507479", "0.50455844", "0.503007...
0.75309926
0
Get all nodes that are connected to current_node
def get_connected_nodes(current_node, paths): connectedNodes = list() for path in paths: if (current_node.id == path.source.id): node = path.destination.copy() node.setParent(current_node) node.f = path.cost + node.heuristic connectedNodes.append(node) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNodes(self):\n return self.__allNodes", "def nodes(self):\n return self.graph.nodes", "def nodes(self):\n\n return list(set(self._graph.keys() + [x for x in itertools.chain.from_iterable(self._graph.values())]))", "def get_all_nodes(self):\n # NOTE: return copy, so no one w...
[ "0.72011834", "0.6996537", "0.6976682", "0.6942847", "0.68924725", "0.68712366", "0.6846873", "0.6806145", "0.67980975", "0.67691165", "0.6764509", "0.67623854", "0.67623854", "0.67623854", "0.6755477", "0.67500514", "0.6748937", "0.6717678", "0.6708518", "0.6706472", "0.6694...
0.7208526
0
Goes through all visited nodes via their parents, returns a list of the correct order in which we traversed the graph
def find_solution(last_node): solution = list() node = last_node while True: solution.append(node.id) if (node.parent == None): # found the first node solution.reverse() return solution node = node.parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parents(graph, node):\n return list(graph.pred[node].keys())", "def _get_parents(self):\n parents = []\n parent = self.parent\n while(parent):\n parents.append(parent)\n parent = parent.parent\n parents.reverse()\n return parents", "def find_p...
[ "0.711731", "0.7075661", "0.70328367", "0.6830098", "0.6797029", "0.6780164", "0.6730721", "0.67158437", "0.66968924", "0.6696468", "0.6664417", "0.66362536", "0.65828097", "0.6570099", "0.6570099", "0.65653294", "0.65133226", "0.6512602", "0.65038615", "0.65032846", "0.64982...
0.0
-1
Called when the screen manager wants to remove this screen from the display. We have no choice but to obey when this method is called. So hide our background. Our models will be hidden automatically as the 3d nodes are removed from the render tree
def hide(self): super(SkillShotScreen, self).hide() if self.cube != None: self.cube.clearLight(self.dlnp) if self.cubeMovement: self.cubeMovement.finish() if self.cubeRotation: self.cubeRotation.finish() if self.awardMovement: self.awardMovement.finish() base.tas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self):\r\n self.visible = False", "def clear_scene(self):\n # Save grid visibility\n restore = self.__grid_visibility\n\n # Set invis\n if restore:\n self.__graphics_grid.set_visibility(False)\n\n # Set all objects invis\n for obj in self.sc...
[ "0.7087873", "0.6615855", "0.6585287", "0.6578363", "0.6513618", "0.6479681", "0.6463028", "0.6380824", "0.63767445", "0.6369106", "0.6278177", "0.6263273", "0.6244399", "0.6243241", "0.6241614", "0.6213222", "0.62098575", "0.6191652", "0.61867195", "0.6179239", "0.61784524",...
0.6034707
39
return the index of an array ordered as [l=0 m=0, l=1 m=1, l=1 m=0, l=1 m=1, ....]
def get_index_lm(l, m): return (l+1)**2 -1 -l + m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idx_of(array, value, order='low'):\n if not order in ['low', 'high']:\n raise ValueError(\n '`order` should only be low or high.'\n )\n diff = array - value\n if order == 'low':\n # If value lower than anything, return index 0\n if not np.any(array <= value):...
[ "0.6531746", "0.6453401", "0.6421848", "0.63176495", "0.6227621", "0.621238", "0.6172804", "0.6162753", "0.6133431", "0.61009794", "0.6072919", "0.60638434", "0.6062158", "0.605947", "0.60340124", "0.60298973", "0.60279", "0.6009752", "0.59955", "0.5995266", "0.5982176", "0...
0.6199376
6
Converts a quaterion in the form of a pose orientation into a heading.
def orientationToHeading(orientation): res = [0, 0, 0, 0] res[0] = orientation.x res[1] = orientation.y res[2] = orientation.z res[3] = orientation.w return tf.transformations.euler_from_quaternion(res)[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading(yaw):\n q = euler2quat(0.0, 0.0, yaw)\n quat = Quaternion()\n quat.w = q[0]\n quat.x = q[1]\n quat.y = q[2]\n quat.z = q[3]\n return quat", "def getHeading(q):\n yaw = math.atan2(2 * (q.x * q.y + q.w * q.z),\n q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z)\...
[ "0.71091366", "0.69794357", "0.65639895", "0.64986974", "0.64956474", "0.644483", "0.627264", "0.62332237", "0.6218608", "0.6203297", "0.61656183", "0.6164748", "0.5980168", "0.5963536", "0.5926954", "0.59136003", "0.5868614", "0.58648425", "0.5786832", "0.5776677", "0.577667...
0.70309937
1
Name assignment through testdata(name) allows dict caching.
def test_name_attribute_assignment(self): self.assertNotIn('aldous', self.__dict__) self.aldous self.assertIn('aldous', self.__dict__) self.assertIs(self.__dict__['aldous'], self.aldous)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_name(self, data, firstname, secondname):\n layer = Points(data)\n assert layer.name == \"Points\"\n\n layer = Points(data, name=firstname)\n assert layer.name == firstname\n\n layer.name = secondname\n assert layer.name == secondname", "def get_data(name):\n ...
[ "0.6393306", "0.63249505", "0.6240958", "0.61811626", "0.61345464", "0.6052474", "0.6006592", "0.58476937", "0.5842565", "0.5804274", "0.5802099", "0.5758022", "0.57148683", "0.5709355", "0.5707304", "0.5688314", "0.56758815", "0.5643899", "0.5604059", "0.5603624", "0.5593508...
0.62305164
3
test 404 error page
def test_errors(self): rc = self.app.get('/this_should_not_exist', follow_redirects=True) assert b'404 error :(' in rc.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_handler_PageNotFound404(self):\n response = self.testapp.get('/notexistentpage/', expect_errors=True)\n self.assertEqual(404, response.status_int)\n self.assertIn('Page Not Found', response.normal_body)\n self.assertEqual('application/json', response.content_type)", "de...
[ "0.84182584", "0.8350967", "0.83365065", "0.8007176", "0.7965419", "0.7895687", "0.7892552", "0.7884124", "0.78334194", "0.7809191", "0.7809191", "0.7809191", "0.7809191", "0.7809191", "0.7809191", "0.7809191", "0.780419", "0.780419", "0.7801295", "0.7791209", "0.77885836", ...
0.8265105
3
Set up an 'Indirect' instance. 'key' must provide 'IComponentKey'
def __init__(self, key, default=NOT_GIVEN): self.key = adapt(key,IComponentKey) self.default = default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, key):\n Base.__init__(self, key)", "def __init__(self, key):\n Base.__init__(self, key)", "def __init__(self, key):\n self.key = key", "def __init__(self, key=None):\n self.key = key", "def __init__(self, key, value, handler, getter, contains):\n self._...
[ "0.557358", "0.557358", "0.5496867", "0.54355437", "0.53505135", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.5193574", "0.519097", "0.5190053", "0.51432544", "0.51284206", "0.511327", "0.51044554", "0.5099638", ...
0.6466041
0
Get a 'CompositeName' subclass using this as firstelement parser
def asCompositeType(klass): class _CompositeName(CompositeName): def mdl_fromString(_CNClass,aString): # Parse plain composite name, using this as compound parser name = CompositeName.parse(aString, klass) if isinstance(name, klass): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_name(self):\r\n try:\r\n rval = self.name\r\n except AttributeError:\r\n if 0:\r\n l = []\r\n for n in self.fgraph.toposort():\r\n if hasattr(n.op, \"name\") and n.op.name is not None:\r\n v = n.op....
[ "0.65961456", "0.5611216", "0.5585384", "0.55432624", "0.54376084", "0.53885263", "0.53805673", "0.5279403", "0.527698", "0.52212536", "0.52027935", "0.51842034", "0.51246816", "0.5122781", "0.5122286", "0.5076838", "0.5076838", "0.5076838", "0.5076838", "0.5076838", "0.50768...
0.664904
0
Creates a training dataset from existing dataset
def get_train_dataset(self): return SubsetDataset(self.ds, self.train_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataset():\n return TabularDataset.from_path('tests/data/dummy_tabular/train.csv', sep=',')", "def get_training_data() -> GraphDataset:\n _load_data_if_needed()\n return training_data", "def _create_dataset(options, is_training, input_pipeline_context=None):\n dataset = tf.data.Dataset.list...
[ "0.74760675", "0.71444046", "0.7076663", "0.70763874", "0.70619285", "0.69907266", "0.69406134", "0.6907871", "0.6907742", "0.6907623", "0.6875715", "0.68477553", "0.6843984", "0.6842714", "0.6807683", "0.6797751", "0.6783228", "0.67748934", "0.67617935", "0.6747691", "0.6741...
0.65615904
40
Sets the text cursor to the end of the document, then to the given lineno.
def goto_line(editor, lineno, scroll=False): count = editor.blockCount() if lineno > count: lineno = count lineno = lineno-1 pos = editor.document( ).findBlockByNumber( lineno).position() goto_position(editor, pos) if scroll: bar = editor.verticalScrollBar()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_end_lineno():\n if origin:\n record.origin.line_end = lineno", "def set_endline(self, line_no):\n self.set_attribute(\"endline\", line_no)", "def set_line_end(self, line_nr):\n self._line_end = line_nr", "def move_to_line_end(self) -> None:\n self.index = se...
[ "0.62187815", "0.6209572", "0.61946297", "0.61119956", "0.5768381", "0.57579494", "0.5736042", "0.57065177", "0.56861925", "0.5576839", "0.5506485", "0.5463629", "0.5330148", "0.52994525", "0.5288886", "0.5237982", "0.523665", "0.51582116", "0.51582116", "0.5156547", "0.51282...
0.58540535
4
Delete a group. The default groups cannot be deleted.
def delete_group(self, group_name): params = { 'name': group_name } self.sonarqube._make_call('post', API_USER_GROUPS_DELETE, **params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_group(self, group):\n raise NotImplementedError('delete_group')", "def deleteGroup(groupName):\r\n Group.deleteGroup(groupName)", "def delete_group(self, group_name):\r\n params = {'GroupName' : group_name}\r\n return self.get_response('DeleteGroup', params)", "def dele...
[ "0.85996777", "0.8159453", "0.8094092", "0.8003237", "0.7968093", "0.79495174", "0.7904916", "0.78762573", "0.78659636", "0.7856635", "0.7844608", "0.7742248", "0.7673185", "0.76722735", "0.7644875", "0.75909734", "0.75873613", "0.7488563", "0.7455524", "0.7440715", "0.740857...
0.7453251
19
Test the email for a new user is normalized
def test_new_user_email_normalized(self): email = 'test@GMAIL.COM' user = get_user_model().objects.create_user(email, 'test123') self.assertEqual(user.email, email.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())", "def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod...
[ "0.79984254", "0.7997281", "0.79201037", "0.7871696", "0.78619236", "0.785927", "0.7858499", "0.7853585", "0.7844939", "0.7773778", "0.7771046", "0.7745209", "0.7744957", "0.7702127", "0.75698525", "0.75344014", "0.74174696", "0.7257744", "0.7147643", "0.7080147", "0.70342535...
0.78920823
5
Test creating user with no email raises error
def test_new_user_invalid_email(self): with self.assertRaises(ValueError): get_user_model().objects.create_user(None, 'test123')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))", "def test_creating_a_new_user_without_email(self):\n\n with self.asser...
[ "0.90313256", "0.8963383", "0.8736711", "0.8736247", "0.87256855", "0.8717645", "0.87053293", "0.87032956", "0.8700956", "0.869592", "0.86902976", "0.8681168", "0.86709315", "0.8597593", "0.85930586", "0.85868686", "0.8557775", "0.85267687", "0.8396068", "0.83576405", "0.8287...
0.87146974
8
Test the tag string representation
def test_tag_str(self): tag = models.Tag.objects.create( user=sample_user(), name='Internal' ) self.assertEqual(str(tag), tag.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Docker'\n )\n\n self.assertEqual(str(tag), tag.name)", "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Vegan'\...
[ "0.70703965", "0.6938718", "0.6938718", "0.6922232", "0.69209194", "0.6899433", "0.6885665", "0.6861665", "0.66865885", "0.64923304", "0.637821", "0.6311385", "0.63077676", "0.62146807", "0.616337", "0.61539763", "0.60839355", "0.60640544", "0.6059385", "0.5983592", "0.594861...
0.7170174
0
return the suffix dict
def get_suffix_dict(self): return self.suffix_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffixDict():\n return {'trpk': 'tpke', 'forges': 'frgs', 'bypas': 'byp', 'mnr': 'mnr', 'viaduct': 'via', 'mnt': 'mt',\n 'lndng': 'lndg', 'vill': 'vlg', 'aly': 'aly', 'mill': 'ml', 'pts': 'pts', 'centers': 'ctrs', 'row': 'row', 'cnter': 'ctr',\n 'hrbor': 'hbr', 'tr': 'trl', 'lndg': 'ln...
[ "0.77540374", "0.69547606", "0.6939465", "0.6939465", "0.6837411", "0.6637627", "0.65001506", "0.65001506", "0.645571", "0.6359308", "0.63367945", "0.6318509", "0.63104326", "0.62708914", "0.62708914", "0.62708914", "0.61772746", "0.61356014", "0.60788155", "0.6076232", "0.60...
0.86243165
0
Associates the specified promotion asset with the specified campaigns.
def associate_asset_with_campaigns( client, customer_id, promotion_asset_resource_name, campaign_ids ): if len(campaign_ids) == 0: print(f"Asset was not associated with any campaigns.") return campaign_service = client.get_service("CampaignService") campaign_asset_service = client.get_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_asset_with_ad_groups(\n client, customer_id, promotion_asset_resource_name, ad_group_ids\n):\n if len(ad_group_ids) == 0:\n print(f\"Asset was not associated with any ad groups.\")\n return\n\n ad_group_service = client.get_service(\"AdGroupService\")\n ad_group_asset_servic...
[ "0.68118477", "0.5458652", "0.5197358", "0.518365", "0.5102761", "0.4989788", "0.47916248", "0.47841915", "0.47830895", "0.47233653", "0.47026694", "0.46705714", "0.45984635", "0.4594442", "0.45530567", "0.44720846", "0.44709775", "0.4398728", "0.43637556", "0.436068", "0.433...
0.7919765
0
Associates the specified promotion asset with the specified campaigns.
def associate_asset_with_ad_groups( client, customer_id, promotion_asset_resource_name, ad_group_ids ): if len(ad_group_ids) == 0: print(f"Asset was not associated with any ad groups.") return ad_group_service = client.get_service("AdGroupService") ad_group_asset_service = client.get_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_asset_with_campaigns(\n client, customer_id, promotion_asset_resource_name, campaign_ids\n):\n if len(campaign_ids) == 0:\n print(f\"Asset was not associated with any campaigns.\")\n return\n\n campaign_service = client.get_service(\"CampaignService\")\n campaign_asset_servi...
[ "0.791878", "0.5457961", "0.5195292", "0.5182085", "0.510101", "0.4988737", "0.4790867", "0.47820067", "0.47816998", "0.4722624", "0.4701914", "0.46689376", "0.45965028", "0.45924795", "0.45532042", "0.4473407", "0.4470588", "0.44008443", "0.4362075", "0.43594718", "0.4331378...
0.68108475
1
Retrieves the message string for a specific Windows Event Log source.
def GetWindowsEventMessage(self, log_source, message_identifier): database_reader = self._GetWinevtRcDatabaseReader() if not database_reader: return None if self._lcid != self.DEFAULT_LCID: message_string = database_reader.GetMessage( log_source, self.lcid, message_identifier) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_source_from_event(event):\n return event.message.annotations[\"iothub-message-source\".encode()].decode()", "def event_source(self) -> str:\n return pulumi.get(self, \"event_source\")", "def event_source(self) -> str:\n return pulumi.get(self, \"event_source\")", "def event_m...
[ "0.703995", "0.64170665", "0.64170665", "0.5495709", "0.54918444", "0.5480781", "0.5419732", "0.5411037", "0.53605455", "0.53066844", "0.5278774", "0.5271213", "0.52499604", "0.5234725", "0.5170608", "0.5145364", "0.51453567", "0.51346934", "0.51346093", "0.5111521", "0.51115...
0.7678674
0
Compute softmax values for each sets of scores in x.
def softmax(x): pass # TODO: Compute and return softmax(x) exp_x = np.exp(x) sum_x = np.sum(exp_x, axis=0) softmax = exp_x/sum_x return softmax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7797116", "0.77627903", "0.7760451", "0.7757387", "0.7658399", "0.7658399", "0.7658399", "0.7658399", "0.7587644", "0.7433347", "0.7409716", "0.73956805", "0.73604953", "0.7319298", "0.72706646", "0.72645944", "0.7263417", "0.72585905", "0.7231768", "0.7216702", "0.7203891...
0.71583205
24