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
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ServerPolicyStatus): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Choose which frame type and index a name should have. If this is the first use of this name in the current frame, then a new frame location will be chosen for the name.
def chooseFrame(self, name, accessType): # It's unknown yet whether the assignment is to a local slot or an # (outer) frame slot, or even to a global frame slot. Check to see # whether the name is already known to be local; if not, then it must # be in the outer frame. Unless it's not i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_frames(self, new_frameName):\n\n if new_frameName in self.__frame_names:\n\n #Give rise to a new frame\n\n if new_frameName == \"image_frame\":\n image_frame= ImageFrame.Image_Frame(self.master,\n self.width,\...
[ "0.6417307", "0.6350224", "0.5904649", "0.58932483", "0.5608948", "0.5509908", "0.5484199", "0.54562545", "0.5447085", "0.5371874", "0.53243893", "0.5305225", "0.52813077", "0.52448356", "0.5235267", "0.5230552", "0.5171598", "0.5079637", "0.50533754", "0.5039628", "0.5037176...
0.7728104
0
Yields all unique elements of an iterable sorted. Elements are considered non unique if the equality comparison to another element is true. (In those cases, the set conversion isn't sufficient as it uses identity comparison.)
def eliminate_duplicates(iterable): class NoElement: pass prev_elem = NoElement for elem in sorted(iterable): if prev_elem is NoElement: prev_elem = elem yield elem continue if prev_elem != elem: prev_elem = elem yield elem
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(iterable, filterfalse=filterfalse):\n seen = set()\n add = seen.add\n for element in filterfalse(seen.__contains__, iterable):\n add(element)\n yield element", "def unique(iterable):\n seen_items = set()\n for item in iterable:\n if item not in seen_items:\n ...
[ "0.8080448", "0.79921764", "0.79044235", "0.7786547", "0.7750833", "0.771787", "0.76388717", "0.7634662", "0.7265679", "0.7209599", "0.719988", "0.71597266", "0.71095926", "0.7089081", "0.7060289", "0.70281726", "0.69399834", "0.6927299", "0.6911788", "0.68818307", "0.6851843...
0.73040575
8
Custom collation function to collate dicts
def dict_collate(data): # Assuming there's at least one instance in the batch add_data_keys = data[0].keys() collected_data = {k: [] for k in add_data_keys} for i in range(len(list(data))): for k in add_data_keys: collected_data[k].append(data[i][k]) for k in add_data_keys: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_collation_register_twice(self):\n con = sqlite.connect(\":memory:\")\n con.create_collation(\"mycoll\", lambda x, y: (x > y) - (x < y))\n con.create_collation(\"mycoll\", lambda x, y: -((x > y) - (x < y)))\n result = con.execute(\"\"\"\n select x from (select 'a' as ...
[ "0.5957875", "0.5773422", "0.56671554", "0.56619173", "0.5535473", "0.5463053", "0.54407513", "0.54157037", "0.5397239", "0.53944534", "0.53863084", "0.5365938", "0.5257866", "0.52518815", "0.525027", "0.525027", "0.523402", "0.52329475", "0.5223205", "0.5221392", "0.5180027"...
0.0
-1
Return pathname relative to `cwd`.
def relName(path, cwd=None, root=None): relRoot = os.path.normpath((root or projectRoot)) + os.sep cwd = os.path.abspath((cwd or os.getcwd())) + os.sep if path == cwd or path == cwd[:-1]: return "." if path.startswith(cwd): # The relative name is below the CWD, so we simply strip off th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rel_cwd():\n return os.path.relpath(os.getcwd(), git_toplevel())", "def relDir(self, cwd=None, root=None):\n return os.path.dirname(self.relName(cwd, root)) or \".\"", "def cwd_in_path():\n ...", "def from_cwd(root, path):\n return normpath(join(root, normpath(path)))", "def get_path(path...
[ "0.7406327", "0.7113691", "0.70737165", "0.70674914", "0.6975727", "0.67902523", "0.67449915", "0.6740676", "0.6727358", "0.67247295", "0.67202383", "0.6691596", "0.66870797", "0.6674695", "0.6669674", "0.6659272", "0.6643701", "0.66408265", "0.6624103", "0.66087735", "0.6607...
0.6649587
16
Return a normalised absolute path for path. If the path is not an absolute name then the parentDir is used.
def normPath(path, parentDir): if not os.path.isabs(path): path = os.path.join(parentDir, path) return os.path.normpath(os.path.abspath(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_dir_path(path):\n return absolute_path(os.path.dirname(path))", "def _parent_path(cls,path):\n # os.path.dirname(), but strip directories like files (like unix basename)\n # Treat directories like files...\n if path[-1]=='/':\n path=path[:-1]\n ret = os.path.dir...
[ "0.7890651", "0.7631865", "0.74872303", "0.73932683", "0.73752886", "0.7360769", "0.7182527", "0.7109822", "0.71082306", "0.7092217", "0.70776844", "0.70559853", "0.70227927", "0.7022636", "0.7006433", "0.7001878", "0.6978618", "0.6975001", "0.6954019", "0.69438314", "0.69357...
0.78135127
1
If possible, return pathname, relative to cwd.
def relName(self, cwd=None, root=None): return relName(self.path, cwd, root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cwd_in_path():\n ...", "def rel_cwd():\n return os.path.relpath(os.getcwd(), git_toplevel())", "def from_cwd(root, path):\n return normpath(join(root, normpath(path)))", "def get_path(path):\n if _prefix and not '/' in path:\n path = _prefix + path\n\n if not _cwd:\n return pat...
[ "0.7611167", "0.74436456", "0.70555264", "0.70382106", "0.6990636", "0.6959593", "0.6921195", "0.6891867", "0.6883711", "0.68789315", "0.6848974", "0.68370444", "0.6818094", "0.6761395", "0.6745095", "0.67360044", "0.67249894", "0.67127687", "0.670877", "0.6691079", "0.668612...
0.0
-1
If possible, return pathname, relative to cwd of files file's directory. This is basically equivalent to
def relDir(self, cwd=None, root=None): return os.path.dirname(self.relName(cwd, root)) or "."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relative_pathname(self):\n return os.path.join(Exam.EXAM_FILES_LOCATION,\n str(self.unique_id)[0:2],\n str(self.unique_id) + self.file_ext)", "def file_directory(file):\n return os.path.dirname(os.path.realpath(file))", "def file_path(file...
[ "0.7431574", "0.74144644", "0.7360036", "0.7328648", "0.72763646", "0.7238585", "0.7199691", "0.7193376", "0.7178382", "0.71556705", "0.71423656", "0.7087771", "0.70574623", "0.7053284", "0.7030056", "0.7024078", "0.7018442", "0.70158154", "0.69989663", "0.69906795", "0.69767...
0.68879986
26
Strip count directory parts from the path.
def stripDirs(path, count): # TODO: This is a hack and not robust. parts = path.split(os.sep) return os.sep.join(parts[count:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanup_path(path):\n return string.join(filter(None, string.split(path, '/')), '/')", "def strip_path(self):\n return self.path.replace('/', '')", "def clean_directory_path(path):\n allowed = string.digits + string.ascii_letters + string.whitespace\n stripped = \"\".join(c for c in ...
[ "0.68269604", "0.67470235", "0.66249835", "0.6603068", "0.6593223", "0.6435374", "0.64313084", "0.6384034", "0.63713366", "0.6342017", "0.6283861", "0.6225416", "0.6160719", "0.61480796", "0.61244345", "0.6117377", "0.6107738", "0.6096632", "0.60954845", "0.6092049", "0.60353...
0.7985243
0
Split a path into its components.
def pathComponents(path): parts = [p for p in path.split(os.path.sep) if p not in ["", "."]] return parts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitPath(self, path):\n return os.path.split(path)", "def pathSplit(path):\n path = re.split('/|\\\\\\\\', path)\n return path", "def split_path(self, path):\n path = path.strip(\"/\")\n return path.split(\"/\") if len(path) > 0 else []", "def __split_path(path: str) -> List[s...
[ "0.84890676", "0.8194551", "0.81075996", "0.8080714", "0.8075926", "0.8026409", "0.7852271", "0.7759397", "0.7756276", "0.76221246", "0.75630945", "0.7441417", "0.7349478", "0.7338691", "0.7195613", "0.7178414", "0.7176555", "0.71747863", "0.7146289", "0.71365356", "0.7107749...
0.7682226
9
Get nearest directory for a path.
def parentOrThisDir(path): if not os.path.isdir(path): path = os.path.dirname(path) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDirectory(path):\n\tfrom os.path import split\n\tpath = normalizePath(path)\n\treturn split(path)[0]", "def get_directory(path):\n return mangle_path(path).rsplit('/',1)[0]", "def get_path_to_rel_location(directory_to_find):\n path = Path.cwd()\n num_tries = 5\n for num_up_folder in range(nu...
[ "0.74014413", "0.72831106", "0.7133734", "0.70763063", "0.69934523", "0.67752105", "0.6554369", "0.65290904", "0.6490574", "0.64479357", "0.64098763", "0.6394256", "0.6388311", "0.6365258", "0.6351042", "0.6350602", "0.63437116", "0.6254225", "0.62524724", "0.6241705", "0.616...
0.6530118
7
Generates the weight decay op for the given variables.
def get_decay_op(weight_decay, learning_rate, opt_step, vars_to_decay=None): with tf.control_dependencies([opt_step]): if vars_to_decay is None: vars_to_decay = tf.trainable_variables() decay_ops = [] for v in vars_to_decay: decayed_val = v * (1. - learning_rate * weight_decay) decay_ops...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variable_with_weight_decay(name, shape, stddev, wd):\n\n #var = _variable_on_cpu(name, shape, tf.truncated_normal_initializer(stddev=stddev))\n var = weight_variable(shape)\n if wd is not None:\n weight_decay = tf.mul(tf.nn.l2_loss(var), wd, name='weight_loss')\n tf.add_to_collection('losses', weigh...
[ "0.63839954", "0.6349044", "0.63090134", "0.6294481", "0.6291312", "0.62322056", "0.620419", "0.62011784", "0.6188934", "0.61553234", "0.61525613", "0.6135793", "0.61321795", "0.6093986", "0.60843873", "0.60517675", "0.60517675", "0.60469264", "0.60370636", "0.6035367", "0.60...
0.6472492
0
Produces piecewise learning rate tensor that decays exponentially.
def get_learning_rate(training_params): initial_lr = training_params.initial_lr lr_decay_factor = training_params.lr_decay_factor lr_decay_steps_str = training_params.lr_decay_steps_str if lr_decay_steps_str: global_step = tf.train.get_or_create_global_step() lr_decay_steps = [int(s) for s in lr_decay_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exponentialLearningRate(base):\n def function(t):\n return base ** (t-1)\n return function", "def learning_rate(self, t):\n # return self.init_learning_rate * (1 - t)\n return self.init_learning_rate / (1 + t)\n # return self.init_learning_rate * exp(-t)\n # return se...
[ "0.70736307", "0.6849547", "0.68267155", "0.67753506", "0.67230624", "0.6674483", "0.6672137", "0.663576", "0.663576", "0.6591306", "0.657995", "0.6418673", "0.6407172", "0.6396397", "0.63688594", "0.6359079", "0.63430244", "0.6331718", "0.6318481", "0.63050807", "0.63046503"...
0.59314823
41
Returns a TPU estimator spec for the task at hand.
def model_fn(features, mode, params): problem.initialize_model() optimizer = optimizer_class(problem, batch_size=params["batch_size"]) training_params = training_params_class() learning_rate_normal = get_learning_rate(training_params) separate_conditioning_optimizer = ( training_params_condi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tpu_build(self):\n def _define_model(features, labels, mode, params):\n data_source = (features, labels)\n self.outputs = {}\n self.losses = {}\n self.otters = {}\n outputs, losses, others = self.define_model(data_source, mode)\n\n if mo...
[ "0.6752263", "0.6078433", "0.5990123", "0.59044427", "0.58802575", "0.54585767", "0.5387597", "0.53145456", "0.5279787", "0.52658534", "0.5261542", "0.5200471", "0.5183984", "0.5183792", "0.51776844", "0.5171219", "0.51421046", "0.51304877", "0.5125984", "0.51027215", "0.5095...
0.0
-1
Check what reward the current pano yields, based on instructions.
def _check_reward(self, pano_id, streetlearn): reward = 0 previous_step = self._current_step reward = super(StepByStepInstructionGame, self)._check_reward( pano_id, streetlearn) if previous_step != self._current_step and not self._reached_goal: # If we changed the step, but haven't termi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observe_reward(self,state,action,statePrime,reward):\n if self.exploring:\n self.training_steps_total += 1", "def check(self, reward_new, reward, iteration):\n return reward_new > reward", "def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length...
[ "0.6247786", "0.62383354", "0.61899155", "0.60818493", "0.60627747", "0.6058126", "0.6052285", "0.60498905", "0.5957239", "0.59256274", "0.5907415", "0.58988523", "0.58907026", "0.588896", "0.5882541", "0.5876923", "0.58725345", "0.5860146", "0.5851461", "0.5815362", "0.58134...
0.6755335
0
Save a list of stop_words with joblib.save under $CACHE_DIR/stop_words/.pkl
def save(self, name, stop_words): self.stop_words = stop_words # list of stop words self.name = self.model_dir / (str(name) + '.pkl') dump(self.stop_words, str(self.name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_stopwords():\r\n\tprint('\\nbuilding stopwords')\r\n\t\r\n\tif load_stopwords():\r\n\t\treturn\r\n\r\n\tglobal stopwords\r\n\tstopwords = nltk.corpus.stopwords.words('english')\r\n\tfor f in os.listdir(paths.path_data_stopwords):\r\n\t\tpath_stopwords = paths.path_data_stopwords + '/' + f\r\n\t\twith op...
[ "0.7139917", "0.67501676", "0.6478352", "0.64356506", "0.6390759", "0.6385867", "0.63354886", "0.6324995", "0.6310111", "0.6258721", "0.6112037", "0.60606295", "0.60606295", "0.60606295", "0.6031896", "0.59685814", "0.59685814", "0.5950769", "0.5926634", "0.5899575", "0.58790...
0.73457456
0
Delete stop words specified by a name
def delete(self, name): if (self.model_dir / (str(name) + '.pkl')).exists(): (self.model_dir / (str(name) + '.pkl')).unlink()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeCustomStopwords(self, words, stopWords):\n\t\tremoved = [word for word in words if word not in stopWords]\t\t\n\t\treturn removed", "def stopword_removal(words):\n stops = set(stopwords.words('english'))\n words = [w for w in words if w not in stops]\n return words", "def remove_stopwords_fu...
[ "0.7418067", "0.7403274", "0.73748505", "0.73731565", "0.7285647", "0.7262066", "0.7259893", "0.72521317", "0.72288114", "0.722125", "0.7214436", "0.72063893", "0.719325", "0.719325", "0.719325", "0.719325", "0.7175708", "0.7129501", "0.71049064", "0.7096272", "0.70850927", ...
0.0
-1
Returns a list of exiting stopwords
def list(self): return [os.splitext(el)[0] for el in os.listdir(str(self.model_dir))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_words():\n return get_stop_words('es') + get_stop_words('ca') + get_stop_words('en')", "def getStopWords(self):\n\t\treturn self.stop_words", "def stopword_filter(words):\n new_words = []\n for w in words:\n if w in stopwords.words(\"german\"): continue\n else: new_words += [w]\...
[ "0.80919904", "0.80404764", "0.79436415", "0.7852554", "0.78314847", "0.77728045", "0.7753986", "0.7743703", "0.77028596", "0.77028596", "0.77028596", "0.77028596", "0.7683081", "0.76474947", "0.7640728", "0.7616929", "0.7598977", "0.7541021", "0.7520652", "0.75021523", "0.74...
0.0
-1
Load information from the .tsv files and store contents into a pandas DataFrame.
def load(filename): if filename.endswith(MULTI_TEST_FILE_NAME) or\ filename.endswith(SINGLE_TEST_FILE_NAME): column_names.remove('complexity') try: df = pd.read_csv(f"{filename}", delimiter='\t', header=0, names=column_names, quoting=csv.QUOTE_NONE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_tsv(path):\n return pd.read_csv(path, sep=\"\\t\", index_col=0)", "def load_tsv(path: str, ncols: int, nonames: bool) -> DataFrame:\n cols = range(ncols) if ncols else None\n return pandas.read_csv(path, usecols=cols, sep='\\t', skipinitialspace=True, header='infer' if not nonames else None)", ...
[ "0.71380943", "0.69189364", "0.6720503", "0.6676054", "0.6663747", "0.66289455", "0.6606629", "0.6438941", "0.6341446", "0.6318157", "0.6251356", "0.6241831", "0.6238118", "0.61580557", "0.61442673", "0.6143602", "0.6132961", "0.6128239", "0.61223125", "0.6108173", "0.6100985...
0.0
-1
Assemble a uri based on a base, any number of path segments, and query string parameters.
def urljoin(base, *path): return reduce(_join, path, base)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_uri(self, uri_base, params):\n if not params:\n return uri_base\n else:\n uri_extension = \"?\"\n for param in params:\n uri_extension = uri_extension + param + \"&\"\n uri_extension = uri_extension[:-1] # clip off the final & \n ...
[ "0.8172855", "0.76806617", "0.7514452", "0.68805695", "0.68683267", "0.66982967", "0.6585141", "0.6470752", "0.6420921", "0.6362778", "0.6343998", "0.6313391", "0.6288651", "0.6276502", "0.6271441", "0.6254907", "0.6223089", "0.6205844", "0.6118751", "0.6094671", "0.6076809",...
0.6015223
24
Prepares the text by removing punctuation marks and splitting it into a list.
def _prep(self, text): # Removing punctuation marks. stripped = sub(r'[^\w\s]', '', str(text)) # Splitting the string into a list (based on spaces). split = stripped.split() return split
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_text(input_string):\n \n temp_string = input_string.lower()\n temp_string = remove_punctuation(temp_string)\n out_list = temp_string.split()\n return out_list", "def prepare_text(input_string):\n \n temp_string = input_string.lower()\n temp_string = remove_punctuation(temp_str...
[ "0.77144146", "0.77144146", "0.76622474", "0.7596424", "0.73815674", "0.7255264", "0.7167096", "0.7167096", "0.7163276", "0.71371406", "0.711718", "0.7071105", "0.70470077", "0.70092475", "0.6953413", "0.6943132", "0.69184244", "0.6891759", "0.68890965", "0.6866788", "0.68075...
0.840494
0
Splits CamelCase and converts to lower case with underscores.
def camel_to_snake_case(value): return re_camel_case.sub(r"_\1", value).strip("_").lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camel2underscore(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()", "def underscorecase(camelcased):\n return re.sub('([A-Z]+)', r'_\\1', camelcased).lower()", "def camel_to_underscore(name):\n s1 = re.sub('(.)([A-Z][a-z]+)'...
[ "0.76830953", "0.7640025", "0.76090544", "0.7475341", "0.74361634", "0.72330886", "0.72274196", "0.70651466", "0.70625854", "0.70586276", "0.70586276", "0.7043308", "0.7037222", "0.6958388", "0.69282466", "0.6904049", "0.6892343", "0.68920887", "0.6876655", "0.68763614", "0.6...
0.65499127
49
Converts a string from snake_case to camelCase
def snake_to_camel_case(value): words = value.strip("_").split("_") return words[0].lower() + "".join([word.capitalize() for word in words[1:]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])", "def snake_to_camel_case(string: str):\n return ''.join(string_component.title() for string_component in string.split('_'...
[ "0.87410486", "0.85672706", "0.84411246", "0.82493037", "0.82054013", "0.8186395", "0.8183385", "0.81677455", "0.81656843", "0.8144525", "0.8113281", "0.8101143", "0.80441004", "0.80195016", "0.80017805", "0.7993668", "0.7969217", "0.79631966", "0.79575366", "0.7947377", "0.7...
0.8073005
12
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module.
def CreateFromDOM (node, default_namespace=None): if default_namespace is None: default_namespace = Namespace.fallbackNamespace() return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)", "def CreateFromDOM (node, default_namespace=None):\n if default...
[ "0.6948814", "0.6948814", "0.6948814", "0.6945842", "0.67019373", "0.67019373", "0.67019373", "0.67002743", "0.66684055", "0.66547805", "0.66248775", "0.65973485", "0.6588119", "0.656763", "0.6512766", "0.64923924", "0.6475155", "0.6425131", "0.6326797", "0.63157785", "0.6313...
0.7010723
6
Initializes a TeekoPlayer object by randomly selecting red or black as its piece color.
def __init__(self): self.my_piece = random.choice(self.pieces) self.opp = self.pieces[0] if self.my_piece == self.pieces[1] else self.pieces[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, color):\n self.id = Piece.PIECE_ID\n self.crowned = False\n self.color = color\n\n Piece.PIECE_ID += 1", "def __init__(self, colour):\n self.colour = colour\n self.name = \"Player\"", "def randomcolour(self):\n r = random.randrange(1, 255)\n ...
[ "0.64600736", "0.64198476", "0.64055675", "0.6374913", "0.629889", "0.62343335", "0.62268627", "0.6149101", "0.60701865", "0.6066644", "0.6044372", "0.60339445", "0.6031407", "0.60198843", "0.60007805", "0.6000347", "0.59983206", "0.5992445", "0.5988255", "0.5972648", "0.5972...
0.6194739
7
Returns True iff all conditions are met for the move to be valid.
def is_move_valid(move: Move, board: Board, whites_turn: bool) -> bool: if out_of_bounds(move[0]) == True or out_of_bounds(move[1]) == True: return False if move[0] == move[1]: return False if is_current_players_piece(piece_at_position(move[0], board), False) and whites_turn == True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_check(self):\r\n \r\n if not self.run:\r\n return False\r\n \r\n if self.get_num_legal_moves() == 0:\r\n SlTrace.lg(\"NO more legal moves!\", \"nolegalmoves\")\r\n ###return False \r\n \r\n if self.new_move:\r\n se...
[ "0.7248889", "0.7239794", "0.71985495", "0.7062835", "0.6891651", "0.6875428", "0.6819506", "0.67919004", "0.67807204", "0.67641354", "0.67560995", "0.6749744", "0.67474866", "0.67123723", "0.67013174", "0.666489", "0.6657267", "0.66547406", "0.66400826", "0.661247", "0.65954...
0.65529734
22
Returns True iff a stalemate has been reached.
def is_stalemate(board: Board, whites_turn: bool) -> bool: if not can_move(board, whites_turn) and not is_in_check(board, whites_turn): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stale(self, now: datetime | None = None) -> bool:\n return (\n self.last_seen is None\n or (now or dt_util.utcnow()) - self.last_seen > self.consider_home\n )", "def stalemate(_user_id):\n _board = boards[_user_id]\n return _board.is_stalemate()", "def stalemate(se...
[ "0.76447594", "0.73443186", "0.703082", "0.68219113", "0.66044015", "0.65854275", "0.6518179", "0.65177095", "0.644885", "0.64448303", "0.6412739", "0.6356102", "0.6347586", "0.6325895", "0.62864363", "0.62627596", "0.6258337", "0.6255597", "0.62515897", "0.62200636", "0.6214...
0.7166373
2
Get a random element from the set.
def getRandom(self): if not self.l: return -1 return random.choice(self.l)
{ "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.7296881", "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.640...
0.62901545
34
Basic imshow of array
def greyscale( array, ax = None, cbar = False, mask = None, show = True, filename = None, setnan = 0.0, **kwargs ): if array.ndim is 2: if mask is not None: imshow( np.ma.masked_array( array, mask = mask ), ax = ax, **kwargs ) else: imshow( array, ax = ax, **kwargs ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(array):\n plt.figure()\n plt.imshow(array)\n plt.show()", "def im_show(img):\n img = img / 2 + 0.5 # unnormalize\n npimg = img.numpy()\n plt.imshow(np.transpose(npimg, (1, 2, 0)))\n plt.show()", "def display(array):\n if isinstance(array, np.ndarray):\n ...
[ "0.8463961", "0.76629657", "0.76445615", "0.7600223", "0.7553572", "0.75090504", "0.74779713", "0.7447986", "0.7289508", "0.72265935", "0.7208547", "0.72040373", "0.6994973", "0.69736373", "0.6906168", "0.68954635", "0.6847263", "0.682242", "0.68214387", "0.6816742", "0.66752...
0.6377622
57
Return a near color that is lighter or darker than the base color. If baseColor.lightness is higher than 128 than darker is used else lighter is used.
def driftColor(baseColor, factor=110): if baseColor.lightness() > 128: return baseColor.darker(factor) else: return baseColor.lighter(factor+10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightness(color):\n\n strongest = max(color.red, color.green, color.blue)\n weakest = min(color.red, color.green, color.blue)\n return 0.5 * (strongest + weakest) / 255", "def _get_base_color(self, color):\n # check base case\n if self._is_base_color(color):\n return color...
[ "0.62726617", "0.60137886", "0.59658533", "0.5902884", "0.5767994", "0.57113945", "0.5673752", "0.56702846", "0.56123877", "0.5565894", "0.5503537", "0.5493119", "0.54908687", "0.5453843", "0.53960043", "0.5363331", "0.53459525", "0.53283775", "0.5296112", "0.5296112", "0.529...
0.6371028
0
Plot a real image and a generated image from the grayscale version.
def plot_one(epoch, ds, discriminator, generator): yuv_image_tensor = load_one_img(ds) y_channel, real_uv_channel, edge_channel = get_channels(yuv_image_tensor) gen_uv_channel = generator([y_channel, edge_channel], training=False) disc_gen_result = discriminator([y_channel, gen_uv_channel], training=F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(img_name, title='Fig', grayscale=False):\n\n if not grayscale:\n plt.imshow(img_name)\n plt.title(title)\n plt.show()\n else:\n plt.imshow(img_name, cmap='gray')\n plt.title(title)\n plt.show()", "def plot_img(X: np.ndarray, **kwargs):\n kwargs.se...
[ "0.69348764", "0.6787732", "0.67413425", "0.67303425", "0.66672295", "0.66052425", "0.65481853", "0.6522031", "0.64703155", "0.6465298", "0.64570874", "0.6454665", "0.6439694", "0.6430747", "0.6425237", "0.6424067", "0.6311589", "0.6285277", "0.62846786", "0.62635475", "0.625...
0.55292517
99
Plots loss to png file in lossfig directory. Creates a graph of each loss and all the losses together
def plot_loss(path_to_loss, file_name): path = '../' labels = ['gen_total_loss', 'gen_loss', 'l1_loss', 'disc_total_loss', 'disc_gen_loss', 'disc_real_loss'] with open(path_to_loss + file_name + '.csv', newline='') as f: reader = csv.reader(f) data = np.array(list(reader)) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss(model_dir):\n ## extract loss from csv\n file_dir = os.path.join(model_dir, 'losses.csv')\n data = pd.read_csv(file_dir)\n epochs = data['epoch'].ravel()\n loss = data['loss'].ravel()\n\n fig, ax = plt.subplots(1, 1, figsize=(7, 5), sharey=True, sharex=True, dpi=400)\n ax.plot(ep...
[ "0.77401257", "0.77369577", "0.7530977", "0.75001794", "0.7462188", "0.74439675", "0.7325832", "0.72748333", "0.7211667", "0.7197712", "0.71903574", "0.7093697", "0.7054593", "0.7051354", "0.70351547", "0.6992125", "0.6970982", "0.6944921", "0.6925543", "0.6897213", "0.686777...
0.77406245
0
Return the equality comparison of scores with other instance.
def __eq__(self, transposon): return self.score == transposon.score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return self.eval_score < other.eval_score", "def __eq__(self, other): # função para comparar movimentos\n if isinstance(other, MoveScore):\n return self.move == other.move \\\n and self.score == other.score \\\n and self...
[ "0.7198622", "0.70254505", "0.6891371", "0.6837691", "0.680709", "0.6802093", "0.6701583", "0.6682951", "0.6650744", "0.66427094", "0.6624099", "0.66184175", "0.6603502", "0.6599263", "0.6599263", "0.65704095", "0.6546947", "0.65347767", "0.65247434", "0.64967334", "0.6479617...
0.72538066
0
Return the area of the rectangle.
def area(self): return self.__width * self.__height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n area = self.__width * self.__height\n return area", "def rect_area(rect):\n return rect[2] * rect[3]", "def area(self):\n area = self.__length * self.__width\n\n return area", "def area(self):\n num_rows = self.row_end - self.row_start\n num_cols...
[ "0.84325457", "0.82909906", "0.82603425", "0.8257897", "0.82447535", "0.8193426", "0.8193426", "0.8193426", "0.8179606", "0.81777185", "0.81302994", "0.81182295", "0.81182295", "0.8116582", "0.8107163", "0.80986", "0.8085878", "0.8079814", "0.80778915", "0.8073485", "0.807235...
0.8087417
17
Return the cost associated with an output ``a`` and desired output ``y``. Note that np.nan_to_num is used to ensure numerical stability for log close to 0 values. In particular, if both ``a`` and ``y`` have a 1.0 in the same slot, then the expression (1y)np.log(1a) returns nan. The np.nan_to_num ensures that that is co...
def value(a, y): return np.sum(np.nan_to_num(-y*np.log(a)-(1-y)*np.log(1-a)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_cost(a, y):\n return np.sum(-(y * np.log(a) + (1 - y) * np.log(1 - a)))", "def cost_(self, y_hat, y, eps=1e-15):\n\t\treturn -(1 / y.shape[0]) * np.sum((y * np.log(y_hat + eps)) + (1 - y) * np.log(1 - y_hat + eps))", "def compute_cost(AL, Y):\n m = AL.shape[1]\n cost = 1./m*(-Y*np.l...
[ "0.72751987", "0.6889791", "0.6827363", "0.6704231", "0.66171503", "0.656028", "0.65560186", "0.65281487", "0.6520213", "0.6442163", "0.6385961", "0.6342134", "0.63276535", "0.63136923", "0.63121414", "0.6294276", "0.62240905", "0.6202097", "0.6172527", "0.6155843", "0.615131...
0.6765319
3
Residual unit with 2 sub layers with preactivation, plan A shortcut.
def _residual_v2(self, x, in_filter, out_filter, stride, activate_before_residual=False): with tf.name_scope("residual_v2") as name_scope: if activate_before_residual: x = self._batch_norm(x) x = self._relu(x) orig_x = x else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TruncatedResidual(r,alpha_base,reuse=False):\n with tf.variable_scope('TrResidual') as scope: \n if reuse:\n scope.reuse_variables()\n \n alpha = alpha_variable(\"alpha\",[dOutput]) \n alpha_final = tf.multiply(alpha,alpha_base)\n \n if istrainAlpha:\n ...
[ "0.62511563", "0.6174284", "0.60802054", "0.6023532", "0.59308875", "0.58607334", "0.5842625", "0.58325934", "0.5740648", "0.56798375", "0.5648771", "0.56279063", "0.55423933", "0.5531578", "0.5503611", "0.54477596", "0.54378855", "0.5435599", "0.5406573", "0.53772974", "0.53...
0.57365197
9
Given a list of sequences, return a batched list of indices into the list, where the batches are grouped by length, in descending order. Batches may be at most max_words in size, defined as max sequence length size.
def batch_by_length(seqs, max_words: int) -> List[List[int]]: # Use negative index so we can get sort by position ascending. lengths_indices = [(len(seq), i) for i, seq in enumerate(seqs)] lengths_indices.sort() batches: List[List[int]] = [] batch: List[int] = [] for length, i in lengths_indices...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _batch_by_length(\n seqs: Sequence[Any], max_words: int, get_length=len\n) -> List[List[Any]]:\n # Use negative index so we can get sort by position ascending.\n lengths_indices = [(get_length(seq), i) for i, seq in enumerate(seqs)]\n lengths_indices.sort()\n batches = []\n batch: List[int] =...
[ "0.7683755", "0.6624619", "0.6536619", "0.6276051", "0.62678564", "0.60459405", "0.60082006", "0.58786637", "0.58786637", "0.58786637", "0.5861992", "0.585695", "0.58468163", "0.5804263", "0.574242", "0.5733399", "0.5697175", "0.569429", "0.5675031", "0.5654944", "0.5626655",...
0.7960933
0
Return if other position represent the same location
def __eq__(self, other): raise NotImplementedError('must be implemented by subclass')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()", "def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y", "def check_position...
[ "0.7725555", "0.75503904", "0.75305015", "0.7300696", "0.7112371", "0.71108377", "0.71108377", "0.7086934", "0.7075562", "0.70683205", "0.70402765", "0.6947477", "0.6920208", "0.6888818", "0.687351", "0.6816564", "0.6804738", "0.67903745", "0.6786941", "0.67706823", "0.676106...
0.0
-1
Return true if other does not represent the same location
def __ne__(self,other): return not (self == other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()", "def __ne__(self, other: 'LocationOutput') -> bool:\n return not self == other", "def __ne__(self, other: 'L...
[ "0.81532466", "0.81440216", "0.785388", "0.75326985", "0.74979633", "0.74869627", "0.74869627", "0.74806494", "0.747623", "0.74693495", "0.74093527", "0.73998183", "0.739158", "0.7354709", "0.7343927", "0.7299803", "0.72481364", "0.7233381", "0.7208416", "0.7109216", "0.70737...
0.0
-1
Return demographic and clinical data associated with a case_uuid
def get_demo_and_clin_data(case_uuid): url = "https://api.gdc.cancer.gov/cases/" + case_uuid params = ( ('pretty', 'true'), ('expand', 'diagnoses,demographic'), ) response = requests.get(url, params=params) try: diagnoses = response.json()['data']['diagnoses'][0] data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def case_samples_data(case_id: str, report_api_mip_dna: MipDNAReportAPI):\n return report_api_mip_dna.status_db.get_case_samples_by_case_id(case_internal_id=case_id)", "def view_cases(context,case_id):\n\n adapter = context.obj['adapter']\n\n if case_id is not None:\n results = adapter.find_case(...
[ "0.6495743", "0.6484939", "0.6235798", "0.6234151", "0.6200139", "0.6076853", "0.59007406", "0.58614266", "0.58476204", "0.5782883", "0.569237", "0.5652985", "0.5622082", "0.55757475", "0.55699754", "0.55545557", "0.5533586", "0.5455871", "0.5431444", "0.5429416", "0.54099596...
0.8314795
0
Gets the time the server was last online
async def do_lastonline(): download = urllib.request.urlopen(server_api) data = json.loads(download.read()) timestamp = data['last_online'] time = datetime.datetime.fromtimestamp(int(timestamp)).strftime('%Y-%m-%d %H:%M:%S') await bot.send_message(c, 'The server was last online ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_since_last_seen(self):\n return time.time() - self.time_last_seen", "def servertime(self):\r\n return servertime.Servertime(self)", "def last_heartbeat_time(self) -> str:\n return pulumi.get(self, \"last_heartbeat_time\")", "def time_at_server():\n return time.asctime()",...
[ "0.7436268", "0.742982", "0.7423033", "0.73263544", "0.72932196", "0.72711706", "0.7251347", "0.7107605", "0.70904326", "0.70831394", "0.70355225", "0.701711", "0.6998889", "0.69604933", "0.69604933", "0.69598484", "0.69469565", "0.6929278", "0.6916713", "0.6876238", "0.68693...
0.7261096
6
read an image flexibly with ND2Reader.
def load_nd2_plane(path:str,frame:str='cyx',axes:str='tz',idx:int=0): with ND2Reader(path) as images: images.bundle_axes = frame images.iter_axes = axes img = images[idx] return img.squeeze()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(path):\n img = ndimage.imread(path, mode=\"RGB\") \n return img", "def read_image(image_path, *args, **kwargs):\n # TODO: Implement the method\n image2 = Image.open(image_path)\n image = num.asarray(image2)\n\n return image", "def read_image(img_path):\n img = imageio.imr...
[ "0.7310385", "0.6960278", "0.67284966", "0.6608443", "0.6518449", "0.6515642", "0.64875996", "0.6452916", "0.6414032", "0.64067197", "0.64061594", "0.6344165", "0.62440044", "0.6239782", "0.6228974", "0.62116915", "0.6206441", "0.6177588", "0.6173649", "0.61510825", "0.613563...
0.0
-1
Compute the symmetrized products of the subsets of the amplitudes. Each input amplitude should be a 1d vector. This function computes the probability amplitude for all output states, bunched and cf, when the state is written as product of a number of not necessarily orthogonal states. The order of the elements in the o...
def symmetrise_arrays(*amps): # some input checking if len(amps) < 2: raise ValueError('At least 2 amplitudes must be given.') amps = np.asarray(amps) for amp in amps: if amp.ndim != 1: raise ValueError('amps1 and amps2 must be 1d arrays (vectors).') # utility variables f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symbolic_joint_probabilities_triple(symX, symY, symZ):\n \n if (len(symX) != len(symY)) or (len(symY) != len(symZ)):\n raise ValueError('All arrays must have same length')\n\n symX = np.array(symX)\n symY = np.array(symY)\n symZ = np.array(symZ)\n \n # initialize\n jp = defaultdi...
[ "0.49318594", "0.48723552", "0.47958106", "0.47885624", "0.47753412", "0.47367057", "0.47246432", "0.4708768", "0.47052833", "0.4684705", "0.4657872", "0.46404397", "0.46398476", "0.46252418", "0.46176648", "0.4602089", "0.45980242", "0.45744562", "0.45434743", "0.45128074", ...
0.7657992
0
Deletes a number n of messages.
async def prune(self, ctx, n=1): n = abs(n) if n > Commands.prune_cutoff: await ctx.channel.send('You can only delete up to 25 messages at a time.') return log.debug(f'Purging {n + 1} message(s)...') # Includes the invoking command await ctx.message.remove_reacti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_packets(self, num):\n for i in range(num):\n del self._packets[0]", "async def purge(self, ctx, msg_number: int = 10):\n\n if ctx.guild.id == 202724765218242560:\n return\n\n if msg_number > 100:\n await ctx.error(\"No more than 100 messages can be...
[ "0.669167", "0.6650018", "0.6615764", "0.6289261", "0.62865543", "0.62834466", "0.62640405", "0.6263869", "0.6205922", "0.6144665", "0.61182433", "0.60696864", "0.6039014", "0.6002418", "0.5974791", "0.59651583", "0.59504515", "0.5910717", "0.5899065", "0.5897481", "0.5884719...
0.74094
0
Performs a deep merge of two nested dicts by expanding all Mapping objects until they reach a nonmapping value (e.g. a list, string, int, etc.) and copying these from the source to the destination.
def merge_dicts(source, destination): for key, value in source.items(): key = key.lower() if isinstance(key, str) else key if isinstance(value, Mapping): node = destination.setdefault(key, {}) merge_dicts(value, node) else: destination[key] = value ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dict_recursive(target, src):\r\n for k in src.keys():\r\n if ((k in target and isinstance(target[k], dict) and\r\n isinstance(src[k], collections.Mapping))):\r\n merge_dict_recursive(target[k], src[k])\r\n else:\r\n target[k] = src[...
[ "0.780889", "0.77241457", "0.7617097", "0.75951463", "0.7571081", "0.74016404", "0.7264163", "0.72207785", "0.72103864", "0.71487683", "0.71112484", "0.7067898", "0.7033799", "0.6977609", "0.69516927", "0.69498956", "0.6942224", "0.69316804", "0.6866131", "0.6851359", "0.6840...
0.7789402
1
Groups a list of assignment_groups.
def group_assignmentgroups(assignment_group_list): return group_nodes(assignment_group_list, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_assignments(assignment_list):\n return group_nodes(assignment_list, 1)", "def groups(self, groups):\n self._groups = groups", "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n\n self._groups = groups", "def groups(self, groups):\n\n ...
[ "0.7586126", "0.64399743", "0.62463236", "0.62463236", "0.62463236", "0.62463236", "0.6199939", "0.6089215", "0.5961018", "0.595345", "0.59281945", "0.58983195", "0.58720165", "0.58608377", "0.5854921", "0.57546955", "0.57222784", "0.5717467", "0.5700008", "0.5675782", "0.567...
0.81257063
0
Round to nearest multiple of base.
def round_mult(x, base=10): a = ((abs(x) - 1) // base) * base # nearest multiple b = a + base # round up return b * np.sign(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_round(x, base):\n\n return base * round(x/base)", "def my_round(x, base=10):\n return base * round(x / base)", "def roundMultiple(x, base=4):\n return int(base * round(float(x)/base))", "def roundTo(numberValue, baseValue):\n # Round a numberValue, to multiples of baseValue\n ...
[ "0.81975245", "0.8068042", "0.78700405", "0.7679338", "0.75806296", "0.73229784", "0.71284723", "0.7041137", "0.6999954", "0.6925214", "0.68765813", "0.6767943", "0.65825313", "0.655042", "0.65319127", "0.6528641", "0.6519714", "0.65073735", "0.64760584", "0.6464013", "0.6446...
0.8341957
0
Return sequence of bursts from sequence of lengths. The sequence of bursts is represented as specified for Dyer's VNG.
def ngrams_bursts(len_seq, round=None): bursts = get_bursts(len_seq) ngrams = np.array(list(map(sum, bursts))) if round is not None: ngrams = round_mult(ngrams, base=round) return ngrams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bursts(len_seq):\n directions = len_seq / abs(len_seq)\n index_dir_change = np.where(directions[1:] - directions[:-1] != 0)[0] + 1\n bursts = np.split(len_seq, index_dir_change)\n return bursts", "def get_burst(self):\n\n print('\\t Detect bursts \\t\\t\\t %d %1.2f' %(self.burst_s,self...
[ "0.7642918", "0.5753224", "0.5719003", "0.5616926", "0.5512817", "0.54312605", "0.5379249", "0.53718466", "0.53663146", "0.5360365", "0.53579843", "0.5310468", "0.53027236", "0.5301329", "0.52803206", "0.5206711", "0.51798886", "0.51191986", "0.51169485", "0.51092744", "0.508...
0.5888152
1
PDF of multivariate normal distribution with covariance sigma.
def norm_pdf(x, sigma): return np.exp(-np.dot(x.T, np.linalg.solve(sigma,x))/2.0) / \ np.sqrt(np.linalg.det(2*np.pi*sigma))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_pdf(x, mu, sigma):\n\n prefac = 1 / (sigma * math.sqrt(2 * math.pi))\n expt = np.exp(-(x - mu)**2 / (2 * sigma**2))\n\n return prefac * expt", "def pdf(x, mu, std):\n if std == 0:\n return 0\n return (1.0 / (std * sqrt(2 * pi))) * np.exp(-(x - mu) ** 2 / (2 * std ** 2))", "def _m...
[ "0.7553301", "0.7415195", "0.729221", "0.7028097", "0.7008073", "0.69854283", "0.696237", "0.6954657", "0.68555075", "0.68544406", "0.68307644", "0.6825786", "0.6810504", "0.677751", "0.67766076", "0.6740555", "0.6739785", "0.6727175", "0.67232955", "0.6708105", "0.66949385",...
0.7682356
0
searches for target in int_list[low..high] and returns index if found If target is not found returns None. If list is None, raises ValueError
def bin_search(target, low, high, int_list): # must use recursion if int_list == None: raise ValueError if len(int_list) == 0: return None middle = (low + high) // 2 if low > high or low < 0 or high > len(int_list): return None elif int_list[middle] == target: return middle e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_search(target, low, high, int_list): # must use recursion\n if int_list == None:\n raise ValueError(\"Must be a list\")\n \n middle = (low + high) // 2\n if low > high:\n return None\n if int_list[middle] > target:\n return bin_search(target, low, middle - 1, int_list)\n if int_...
[ "0.7721266", "0.76297164", "0.7627844", "0.76167643", "0.7500824", "0.71302825", "0.706128", "0.7029466", "0.70062613", "0.6906226", "0.6848578", "0.6821165", "0.68201923", "0.67853427", "0.67291236", "0.6691049", "0.66904867", "0.6690327", "0.6678125", "0.6622146", "0.661850...
0.78054655
0
Helper function to check if the value is hex or not.
def ishex(data: str) -> bool: return bool(re.fullmatch(r"^0[x|X][0-9a-fA-F]+", data)) or bool(re.fullmatch(r"^[0-9a-fA-F]+[h|H]$", data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_hex(s): \n # if it can be converted to a base 16 int then it is hex\n try:\n int(s, 16)\n return True\n \n except ValueError:\n # it could not be converted therefore is not hex\n return False\n # end try", "def test_is_valid_hex(self):\n self.assertTrue...
[ "0.7998938", "0.7629752", "0.7536916", "0.7392625", "0.7238388", "0.7085903", "0.70778865", "0.6954162", "0.6843334", "0.6651114", "0.6638694", "0.66079456", "0.65334415", "0.63423383", "0.63392484", "0.633065", "0.62688243", "0.6245108", "0.62011683", "0.6156826", "0.6106876...
0.78617287
1
Create and save a new superuser
def create_superuser(self, email, password, **extrac_fields): user = self.create_user(email, password) user.is_superuser = True user.is_staff = True user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, username, email, password):\n print(\"creating super user....\")\n user = self.create_user(\n\n username=username,\n password=password,\n email = email,\n commit=False,\n )\n user.is_staff = True\n user.is_sup...
[ "0.78087", "0.77497375", "0.774197", "0.7660062", "0.7631642", "0.7626315", "0.75912565", "0.7544807", "0.753022", "0.75288737", "0.7511065", "0.74730754", "0.7466605", "0.74555784", "0.7446073", "0.7438326", "0.74324477", "0.74277264", "0.7425949", "0.73970294", "0.7396613",...
0.7569382
7
Inits Mapper with a layer name, an xml url, and an empty list for records.
def __init__(self, layer_name, url): self.layer_name = layer_name self.url = url self.records = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n for layer in self._layer_class_map:\n setattr(self, layer, self._layer_class_map[layer]())", "def __init__(self):\n\n self._datamappers = {\n '*/*': DataMapper()\n }", "def __init__(self, layer_list_info):\n self.layer_list_info = la...
[ "0.57119125", "0.5519248", "0.54819435", "0.5395597", "0.52655894", "0.5232298", "0.5105444", "0.5098389", "0.5096981", "0.5071765", "0.5070257", "0.5053318", "0.50470877", "0.50470024", "0.5030811", "0.5021941", "0.50217134", "0.50101656", "0.4994154", "0.49929744", "0.49714...
0.6801645
0
Returns JSON containing all rooms for a given building.
def parse_times(building): if 'date' in request.args: start = request.args.get('date') end = request.args.get('date') else: start = request.args.get('start') end = request.args.get('end') if building == 1: sessionid = get_wharton_sessionid(public=True) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRooms(building_data):\n rooms = []\n floors = building_data['containedSpaces']\n for floor in floors:\n if(floor['type'] == 'FLOOR'):\n r = requests.get(FenixSpacesAPI_URL + \"/\" + str(floor['id']))\n floor_data = r.json()\n for floor_rooms in floor_data['co...
[ "0.7602965", "0.72747517", "0.6870624", "0.68434954", "0.6613637", "0.64624", "0.64573836", "0.64368874", "0.6323639", "0.62922686", "0.62576556", "0.61753356", "0.6150372", "0.6069661", "0.60475427", "0.5995182", "0.59764236", "0.5952766", "0.5888215", "0.58643734", "0.58605...
0.6148618
13
splits iterable by strides of 3 chars. Each string starting by index i
def window(iterable, stride=3): for i in range(len(iterable) - stride + 1): yield iterable[i: i + stride]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition(string, n):\n letter_groups = zip_longest(*[iter(string)]*n, fillvalue='')\n return (\n ''.join(group)\n for group in letter_groups\n )", "def splits(text, L=20):\n return [(text[:i+1], text[i+1:]) \n for i in range(min(len(text), L))]", "def split(container, ...
[ "0.6500111", "0.6398877", "0.61367995", "0.6051084", "0.6051084", "0.60411155", "0.5989638", "0.591726", "0.58752406", "0.5826395", "0.57918763", "0.5722407", "0.57170004", "0.56826264", "0.5676447", "0.56734705", "0.5671132", "0.5594229", "0.55840176", "0.555727", "0.5530404...
0.58851343
8
This is a wrapper around webdriver selenium
def __init__(self, base_url="", driver=None, driver_kwargs=None, enable_highlighting=False, enable_screen_shot_highlight=False, implicit_wait=0, think_time=0, download_folder='', scree...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_selenium():\n # Define the options to run with headless mode enabled\n options = Options()\n options.headless = True\n\n # Instatiate the browser object here, pointing at an exectable location which should be located in the same\n # base directory as the script\n driver = webdriver.Fire...
[ "0.6969775", "0.68646353", "0.68073285", "0.67697954", "0.6762492", "0.6738535", "0.66713846", "0.6633263", "0.66107094", "0.6538164", "0.6530042", "0.65251225", "0.65049815", "0.64730436", "0.6472564", "0.6464669", "0.646318", "0.64625436", "0.6454665", "0.6442423", "0.64398...
0.69198334
1
Calculate the total (real time) amount of money for donations, filtered by status.
def get_amount_total(self, status_in=None): if self.amount_asked == 0: # No money asked, return 0 return 0 donations = self.donation_set.all() if status_in: donations = donations.filter(order__status__in=status_in) total = donations.aggregate(sum=S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_total(kind):\r\n\ttotal = 0\r\n\tfor item in payments[kind]:\r\n\t\tif item.is_active:\r\n\t\t\ttotal += item.amount\r\n\treturn total", "def compute_total_paid(self):\n total = 0.0\n for line in self.loan_ids:\n if line.pay:\n total += line.amount\n s...
[ "0.67710716", "0.66992456", "0.66859996", "0.6558943", "0.63371253", "0.6310792", "0.6125244", "0.6123201", "0.60929537", "0.60903376", "0.60903376", "0.6068417", "0.60553384", "0.59583735", "0.59458965", "0.59423643", "0.5940138", "0.5918118", "0.5907741", "0.59001225", "0.5...
0.7265904
0
Returns true if the other_describer doesn't provide any additional information To be implemented by the subclasses
def suppresses(self, other_describer): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n if not isinstance(other, MtreeIntegratedUsage):\n return True\n\n return self.to_dict() != other.to_dict()", "def __ne__(self, other):\n if not isinstance(other, CtmagentBasicInfoType):\n return True\n\n return self.to_dict() != other.t...
[ "0.6782536", "0.65348864", "0.6322818", "0.619969", "0.6165674", "0.6160439", "0.61545795", "0.61482966", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", "0.6139519", ...
0.76702297
0
Create and configure the app
def create_app(test_config=None): app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( SECRET_KEY=os.environ.get('FLASK_SECRET_KEY', 'dev'), # SQLALCHEMY_DATABASE_URI='sqlite:////' + os.path.join(app.instance_path, 'app.sqlite'), SQLALCHEMY_DATABASE_URI=os.enviro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l...
[ "0.78739405", "0.7851701", "0.7814302", "0.7757001", "0.7740401", "0.7740267", "0.7730145", "0.76000756", "0.7583368", "0.75722855", "0.7566694", "0.75233513", "0.75110537", "0.74510133", "0.7446155", "0.74319845", "0.7421335", "0.7413455", "0.7395716", "0.7368225", "0.736303...
0.7119838
43
Convert an image from linear RGB to sRGB.
def rgb_to_srgb(rgb): ret = np.zeros_like(rgb) idx0 = rgb <= 0.0031308 idx1 = rgb > 0.0031308 ret[idx0] = rgb[idx0] * 12.92 ret[idx1] = np.power(1.055 * rgb[idx1], 1.0 / 2.4) - 0.055 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055, 2.4))", "def sRGB_linear_to_sRGB(rgb_linear):\n\n \"\"\"sRGB standard for gamma inverse correction.\"\"\"\n rgb = np.where(\n rgb_linear <= 0.00304,\n 12.92 * rgb_linear,\n 1...
[ "0.76357144", "0.7592674", "0.7065833", "0.69897646", "0.6712566", "0.6692114", "0.65842897", "0.632556", "0.63065344", "0.6247401", "0.619918", "0.61963326", "0.61357456", "0.612815", "0.61195815", "0.6102068", "0.6080786", "0.6077855", "0.60694706", "0.60626096", "0.6011852...
0.64171314
7
Strip the parameters from the url
def sanitizeUrl(url): return url.split('?')[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_url(self, url):\n return \"\".join(url.split(\"?\")[:1])", "def clean_params(self, url):\n if isinstance(url, unicode):\n url = url.encode(\"utf-8\")\n parts = list(urlparse.urlsplit(url))\n if not parts[3]:\n return url\n query = urlparse.parse...
[ "0.784437", "0.71920675", "0.707331", "0.6893769", "0.68281347", "0.67142737", "0.66784537", "0.66542864", "0.6415316", "0.6352589", "0.63218266", "0.63004804", "0.62882966", "0.62585604", "0.62425894", "0.622924", "0.6170534", "0.61415976", "0.61203545", "0.60935533", "0.609...
0.69607335
3
Returns onehot encoded Variable
def to_categorical(y, num_columns): y_cat = np.zeros((y.shape[0], num_columns)) y_cat[range(y.shape[0]), y] = 1.0 return y_cat
{ "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_classes):\n return np.eye(n_classes)[x]", "def one_hot(y_):\n y_ = y_.reshape(len(y_))\n ...
[ "0.8121293", "0.80437994", "0.80373216", "0.79746693", "0.79646856", "0.79440534", "0.79381895", "0.79274017", "0.78687656", "0.78521234", "0.78004986", "0.77972883", "0.778436", "0.77638763", "0.77571285", "0.7745554", "0.7730836", "0.77264756", "0.77055925", "0.77040774", "...
0.0
-1
Evaluate new coordinate and add to heap if necessary Maintains a max heap of size k. Heap represents the set of smallest k distances seen so far.
def manage_heap(heap, coordinates, distance): if distance > SUN_DISTANCE: if len(heap) < k: heap.append((distance, coordinates)) if len(heap) == k: heapq._heapify_max(heap) elif distance < heap[0][0]: heapq._heappushpop_max(heap, (distance, coordinates))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, k): \r\n self.heap_array.append(k)\r\n\r\n current_index = len(self.heap_array) - 1\r\n while (current_index > 0):\r\n parent_index = ((current_index-1)//2)\r\n\r\n if int(self.heap_array[current_index]) > int(self.heap_array[parent_index]): # if no vialation of the min hea...
[ "0.72123355", "0.6714717", "0.66206855", "0.6474443", "0.6324156", "0.6304968", "0.6240461", "0.62161267", "0.6214256", "0.6150259", "0.6093149", "0.58751976", "0.5865632", "0.5843746", "0.5812911", "0.5809221", "0.58018446", "0.5741976", "0.57322127", "0.570641", "0.5700361"...
0.7884625
0
Passed a chart_name (like 'books_per_year') it returns a dict of
def get_chart_data(self, chart_name): chart_data = { "name": chart_name, } data_method = getattr(self, "get_data_{}".format(chart_name)) chart_data.update(data_method()) return chart_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_education_chart(region_list, comparison):\n print('education chart HI')\n print(comparison)\n if comparison == 'field':\n qty_data = create_data_by_field_qty(region_list, 'education')\n qty_chart = {\n 'chartType': 'bar',\n 'chartName': 'Status Pendidikan men...
[ "0.58559465", "0.5752174", "0.57116705", "0.56706667", "0.5595315", "0.556921", "0.5555412", "0.5526063", "0.5512115", "0.54434675", "0.5415542", "0.54100364", "0.5354659", "0.53459257", "0.5312653", "0.52867484", "0.52860004", "0.5285427", "0.52648443", "0.5215264", "0.51835...
0.7112281
0
Test it raises a Value Error if not supplied with a cube.
def test_fails_input_not_a_cube(self): plugin = NonLinearWeights(0.85) notacube = 0.0 msg = "The first argument must be an instance of " "iris.cube.Cube" with self.assertRaisesRegex(TypeError, msg): plugin.process(notacube, self.coord_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_value(self):\n self.assertRaises(ValueError, Square, 0, 2, 3)\n self.assertRaises(ValueError, Square, -2)\n self.assertRaises(ValueError, Square, 3, -3, 2)\n self.assertRaises(ValueError, Square, 2, 3, -2)", "def test_get_default_raises(self):\n with self.assertRa...
[ "0.7132066", "0.7084213", "0.69410414", "0.6884474", "0.6847477", "0.65439415", "0.65407234", "0.65136474", "0.6506086", "0.6486253", "0.64712566", "0.646726", "0.6455723", "0.64504063", "0.64153063", "0.6412662", "0.6407681", "0.64054775", "0.6396232", "0.6376542", "0.633275...
0.72050524
0
tau = intersection_area / det_area
def tau_calculation(self, det, gt): return np.round((self.area_of_intersection(det, gt) / self.area(det)), 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigma_calculation(self, det, gt):\n return np.round((self.area_of_intersection(det, gt) / self.area(gt)), 2)", "def area(self) -> float:\n return cross3(self.b.position - self.a.position,\n self.c.position - self.a.position).length() / 2.0", "def effective_area(n_selected...
[ "0.68724537", "0.62798613", "0.62354803", "0.6082255", "0.6038193", "0.59698033", "0.59634846", "0.5904357", "0.58869916", "0.5884849", "0.58834344", "0.58807385", "0.5873903", "0.5829616", "0.5827875", "0.5819578", "0.58146846", "0.5808548", "0.5797198", "0.57923895", "0.577...
0.7794924
0
get_rad_filename create the filename of the corresponding rad file to this psv file
def get_rad_filename(input_file): # replace PSV with RAD (path, filename) = os.path.split(input_file) rad_filename = filename.replace('psv', 'rad') rad_filename = rad_filename.replace('PSV', 'RAD') rad_file = os.path.join(path, rad_filename) # rename to .TAB from .TXT in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_filename (self):\n\t\tassert self.__patient_name and self.__location_name, \"New filename could not be determined, one or more needed arguments is empty!\"\n\t\t_patient_name = self.__patient_name.split(' ')\n\t\t_patient_name.reverse()\n\t\t\n\t\treturn os.path.join(os.path.dirname(self.file._path), \"...
[ "0.65329045", "0.633384", "0.62575334", "0.6212639", "0.61902", "0.614011", "0.60878605", "0.6076047", "0.6061794", "0.60518986", "0.6032443", "0.59610105", "0.5941279", "0.5940411", "0.59335166", "0.5928005", "0.5920914", "0.59049404", "0.58850765", "0.58790284", "0.58738494...
0.7864317
0
Retrieve the sender's email address from a Message object
def get_sender_email(mail: Message) -> str: sender_pattern = re.compile("^(?P<name>.*)\s<(?P<email>.*)>$") from_header = mail['From'] # type: str sender = sender_pattern.match(from_header) if not sender: raise KeyError("Invalid From header on email") return sender.group('email')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sender_email(message):\r\n message_headers = message['payload']['headers']\r\n for header in message_headers:\r\n if header['name'] == 'From':\r\n return header['value']", "def envelope_sender(self):\n envelope_sender = None\n # TODO: Make this check better as soon a...
[ "0.81603336", "0.7136111", "0.6911859", "0.69069296", "0.6717064", "0.669544", "0.65050346", "0.6500724", "0.6496999", "0.64878774", "0.64878774", "0.64590865", "0.64440066", "0.642572", "0.6404721", "0.6399642", "0.638859", "0.6344489", "0.63159096", "0.6311154", "0.6271924"...
0.73088914
1
Assert that the endpoint returns 200.
def test_account_payments(session, client, jwt, app): token = jwt.create_jwt(get_claims(), token_header) headers = {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} inv_number = 'REG00001' payment_account = factory_payment_account().save() invoice_1 = factory_invoice(payment...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert200(self, response):\n self.assertEqual(response.status_code, 200)", "def test_response_200_on_get(self):\n pass", "def test_site_get_status_200_code(api_client):\n r = api_client.get(path=\"/\")\n assert r.status_code == 200", "def test_GET_call_api_and_return_200Ok(client):\n\...
[ "0.82210654", "0.8013816", "0.7946608", "0.7903406", "0.7885061", "0.7880224", "0.77164006", "0.77164006", "0.7668261", "0.76476663", "0.7645023", "0.7640879", "0.7640879", "0.7563328", "0.75562114", "0.752852", "0.752852", "0.752852", "0.752852", "0.752852", "0.752852", "0...
0.0
-1
Assert that the endpoint returns 200.
def test_create_account_payments(session, client, jwt, app): token = jwt.create_jwt(get_claims(), token_header) headers = {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} inv_number_1 = 'REG00001' payment_account = factory_payment_account().save() invoice_1 = factory_invoice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert200(self, response):\n self.assertEqual(response.status_code, 200)", "def test_response_200_on_get(self):\n pass", "def test_site_get_status_200_code(api_client):\n r = api_client.get(path=\"/\")\n assert r.status_code == 200", "def test_GET_call_api_and_return_200Ok(client):\n\...
[ "0.82210654", "0.8013816", "0.7946608", "0.7903406", "0.7885061", "0.7880224", "0.77164006", "0.77164006", "0.7668261", "0.76476663", "0.7645023", "0.7640879", "0.7640879", "0.7563328", "0.75562114", "0.752852", "0.752852", "0.752852", "0.752852", "0.752852", "0.752852", "0...
0.0
-1
Assert that the endpoint returns 201.
def test_create_eft_payment(session, client, jwt, app): token = jwt.create_jwt(get_claims(roles=[Role.CREATE_CREDITS.value, Role.STAFF.value]), token_header) headers = {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} payload = { 'paidAmount': 100, 'paymentDate': str(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertHttpCreated(self, resp):\r\n return self.assertEqual(resp.status_code, 201)", "def test_api_can_create_a_post(self):\n self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)", "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(se...
[ "0.81217253", "0.7460375", "0.7408927", "0.7408927", "0.74039865", "0.7316677", "0.7143668", "0.71283555", "0.71094376", "0.70752454", "0.70586383", "0.69067943", "0.69047403", "0.68997616", "0.6787367", "0.676711", "0.6761176", "0.6755503", "0.6715449", "0.6715449", "0.66644...
0.0
-1
Assert that the endpoint returns 201.
def test_create_wire_payment(session, client, jwt, app): token = jwt.create_jwt(get_claims(roles=[Role.CREATE_CREDITS.value, Role.STAFF.value]), token_header) headers = {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} payload = { 'paidAmount': 100, 'paymentDate': str(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertHttpCreated(self, resp):\r\n return self.assertEqual(resp.status_code, 201)", "def test_api_can_create_a_post(self):\n self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)", "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(se...
[ "0.81217253", "0.7460375", "0.7408927", "0.7408927", "0.74039865", "0.7316677", "0.7143668", "0.71283555", "0.71094376", "0.70752454", "0.70586383", "0.69067943", "0.69047403", "0.68997616", "0.6787367", "0.676711", "0.6761176", "0.6755503", "0.6715449", "0.6715449", "0.66644...
0.0
-1
Determine whether a string should be None
def none_string(line): out_line = None if line.lower() == "none" or len(line) == 0 else line return out_line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_set(string):\n if string is None:\n return True\n elif string == '':\n return True\n return False", "def is_str_null(msg):\n\n if None == msg or \"\" == msg:\n return True\n return False", "def string_none(value):\n is_string_none = not value or value.lower() == '...
[ "0.8147372", "0.77528894", "0.76555467", "0.7448464", "0.733984", "0.7268267", "0.71985304", "0.7084756", "0.7043334", "0.70162356", "0.6964445", "0.6959334", "0.6938492", "0.6831619", "0.68183035", "0.68014014", "0.67972964", "0.6740244", "0.67371243", "0.67260796", "0.67044...
0.66131157
22
Insert the currently selected media file into the arrangement under the cursor
def onInsert(self): self.mainWindow.insert()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_media_dialog(self):\r\n\r\n file = filedialog.askopenfilename()\r\n\r\n if add_media(file, 0, self): # Checking if the process of adding the media file was successful\r\n\r\n if file: # Checking whether the user has aborted the operation\r\n # Getting the path of t...
[ "0.64108276", "0.59206975", "0.5744633", "0.571973", "0.56528217", "0.5636527", "0.5620853", "0.56106055", "0.5487543", "0.5466699", "0.5451426", "0.5437087", "0.5403422", "0.5389904", "0.53844744", "0.5379771", "0.5362906", "0.5321768", "0.5321768", "0.53102994", "0.5299032"...
0.51220435
32
Test select entity update (new Doorbell Message).
async def test_select_update_doorbell_settings( hass: HomeAssistant, mock_entry: MockEntityFixture, camera: Camera ): expected_length = ( len(mock_entry.api.bootstrap.nvr.doorbell_settings.all_messages) + 1 ) _, entity_id = ids_from_device_description( Platform.SELECT, camera, CAMERA_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_select_update_doorbell_message(\n hass: HomeAssistant,\n mock_entry: MockEntityFixture,\n camera: Camera,\n):\n\n _, entity_id = ids_from_device_description(\n Platform.SELECT, camera, CAMERA_SELECTS[2]\n )\n\n state = hass.states.get(entity_id)\n assert state\n assert...
[ "0.70132655", "0.6867614", "0.6631987", "0.65988415", "0.65615875", "0.65316397", "0.65316397", "0.65316397", "0.6520963", "0.65112036", "0.6490303", "0.64468205", "0.64289516", "0.6395018", "0.6385547", "0.63742477", "0.6362416", "0.6360843", "0.6360843", "0.6357354", "0.634...
0.722385
0
Test select entity update (change doorbell message).
async def test_select_update_doorbell_message( hass: HomeAssistant, mock_entry: MockEntityFixture, camera: Camera, ): _, entity_id = ids_from_device_description( Platform.SELECT, camera, CAMERA_SELECTS[2] ) state = hass.states.get(entity_id) assert state assert state.state == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_select_update_doorbell_settings(\n hass: HomeAssistant, mock_entry: MockEntityFixture, camera: Camera\n):\n\n expected_length = (\n len(mock_entry.api.bootstrap.nvr.doorbell_settings.all_messages) + 1\n )\n\n _, entity_id = ids_from_device_description(\n Platform.SELECT, ca...
[ "0.72689337", "0.6829804", "0.65783525", "0.65678406", "0.6546206", "0.6539165", "0.6519299", "0.6507325", "0.6491839", "0.6488671", "0.6448673", "0.6448673", "0.6448673", "0.63567585", "0.63567585", "0.6336721", "0.62614495", "0.62581915", "0.624381", "0.62070864", "0.618040...
0.7023743
1
Requests the URL for an unsupported view to verify that the URL is redirected back to the home page.
def test_redirect_view(self): # TODO: Get test to work. client = Client() #response = client.get(reverse(testurl)) #self.assertEqual(301, response.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(self, url):\r\n abort(404)", "def view(self, url):\n abort(404)", "def page_not_found(e):\n flash(\"Error: Try Something Different This Time\")\n return redirect(url_for('login'))", "def test_load_unknow_page(self):\n\n c = Client()\n response = c.get('/unknown_page...
[ "0.6847523", "0.66854084", "0.6536267", "0.6419212", "0.62090343", "0.61908275", "0.61739266", "0.613874", "0.6105762", "0.6105762", "0.6105762", "0.6105762", "0.6105762", "0.6105762", "0.6105762", "0.6095979", "0.6095979", "0.6095979", "0.6095979", "0.6095979", "0.6095979", ...
0.0
-1
Derivatie of the sigmoid function.
def sigmoid_prime(z): return sigmoid(z)*(1-sigmoid(z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def deriv_sigmo...
[ "0.8710434", "0.8690088", "0.86392784", "0.86392784", "0.8459337", "0.82057196", "0.81899357", "0.80860883", "0.8084304", "0.80672425", "0.80672425", "0.8051608", "0.80223507", "0.79907656", "0.7989944", "0.7989621", "0.7985374", "0.7976172", "0.7976062", "0.79659456", "0.795...
0.0
-1
fetches por_flocs Excel file to Dataframe.
def por_flocs(): return pd.read_excel('por_flocs.xlsx')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset():\n\n df_ = pd.read_excel(\"D:\\VERİBİLİMİOKULU\\VERİSETLERİ\\post_bilgileri.xlsx\")\n df = df_.copy()\n return df", "def load_data(self) -> pd.DataFrame:\n\n if not os.path.exists(self.file_name):\n raise FileNotFoundError(f\"File does not exist: {self.file_name}\")\...
[ "0.6609525", "0.659091", "0.64574337", "0.63307166", "0.6299624", "0.6251718", "0.62476176", "0.6219169", "0.619476", "0.615432", "0.61495185", "0.6100073", "0.60729945", "0.60316724", "0.6028355", "0.6007475", "0.5979089", "0.59532183", "0.5934095", "0.58814836", "0.5868181"...
0.8302454
0
Changes discord presence to "Playing TravelFeed.io" when the bot comes online
async def on_ready(): try: await bot.change_presence(game=discord.Game(name='TravelFeed.io')) except: logger.warning("Could not change Discord presence") logger.info("Login to Discord successful")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_ready():\n await bot.change_presence(status=discord.Status.online, activity=discord.Game(activity))", "async def on_ready():\n print(\"I'm in\")\n print(client.user)\n await client.change_presence(activity=discord.Game(name=IN_GAME))", "async def change_status():\n await client.chan...
[ "0.7858613", "0.6921455", "0.68838876", "0.6832439", "0.67582107", "0.67129916", "0.6588332", "0.64534837", "0.6369182", "0.63463753", "0.6262644", "0.6256835", "0.6211035", "0.6179102", "0.6117602", "0.6105671", "0.6102776", "0.61001617", "0.6067344", "0.6064777", "0.6055203...
0.7534066
1
Get the duration of the track in seconds
def duration_in_seconds(self): "Should not set track length" return self.duration / float(self.samplerate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_duration(self):\n return self._track_duration", "def media_duration(self):\n return self._table.active_track_total_time.total_seconds()", "def get_duration_track(artist, track):\n track_infos = get_infos(artist, track)\n if track_infos == None :\n return None\n return in...
[ "0.7929323", "0.78502065", "0.7805565", "0.7763692", "0.7689711", "0.75909597", "0.7582169", "0.75025606", "0.7433587", "0.74124", "0.7393538", "0.73866856", "0.7373791", "0.73321253", "0.72795147", "0.72573525", "0.7247296", "0.7233963", "0.72326326", "0.72274697", "0.722448...
0.8387663
0
Return the precision given the number of true positives (tp) and false positives (fp). Precision is 1 when fp is zero as there are no spurious results, even if tp is zero.
def precision(self): return float(self.tp) / (self.tp + self.fp) if self.fp != 0 else 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_precision(num_tp, num_fp, num_fn):\n if (num_tp + num_fp) == 0:\n return 1\n else:\n return num_tp / (num_tp + num_fp)", "def precision(self):\n tpos, fpos = len(self.__true_positives), len(self.__false_positives)\n return float(tpos) / (tpos + fpos)", "def get_p...
[ "0.7979056", "0.72534674", "0.7060016", "0.7015973", "0.69771844", "0.69157547", "0.6772041", "0.6749229", "0.6531237", "0.6452713", "0.64518684", "0.64088243", "0.6318719", "0.6274969", "0.6259018", "0.62385774", "0.6206243", "0.6195379", "0.6140252", "0.6139028", "0.6120437...
0.80117685
0
Return the recall given the number of true positives (tp) and false negatives (fn). Recall is 1 when fn is zero as there are no spurious results, even if tp is zero.
def recall(self): return float(self.tp) / (self.tp + self.fn) if self.fn != 0 else 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_recall(num_tp, num_fp, num_fn):\n if (num_tp + num_fn) == 0:\n return 0\n else:\n return num_tp / (num_tp + num_fn)", "def get_recall(TP, FN):\n recall = TP / (TP + FN)\n return recall", "def recall(y_true, y_pred):\n tp = true_positive(y_true, y_pred)\n fn = false...
[ "0.8015059", "0.7102912", "0.6978518", "0.69229704", "0.65564334", "0.6533329", "0.65192664", "0.64188826", "0.6413658", "0.63756746", "0.6374991", "0.63296336", "0.629908", "0.6296179", "0.6278972", "0.62305796", "0.6181835", "0.6141671", "0.61284363", "0.6125064", "0.609951...
0.7428737
1
Return the false positive rate given the number of false positives (fp) and true negatives (tn). False positive rate is 1 when tn is zero as there are no spurious results, even if fp is zero.
def fpr(self): return float(self.fp) / (self.fp + self.tn) if self.tn != 0 else 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def true_negative_rate(y_true, y_pred):\n n = np.sum(y_true == 0)\n tn = np.sum((y_pred == y_true) & (y_true == 0))\n return tn / n", "def false_positive(y_true, y_pred):\n # initialize\n fp = 0\n for yt, yp in zip(y_true, y_pred):\n if yt == 0 and yp == 1:\n fp += 1\n retu...
[ "0.72760886", "0.70268005", "0.6881411", "0.68618387", "0.67576635", "0.6669083", "0.66238886", "0.6409933", "0.63858837", "0.63651115", "0.6239311", "0.61829144", "0.6069303", "0.60664344", "0.6045329", "0.59817016", "0.59738106", "0.5966003", "0.59215915", "0.59126484", "0....
0.6488554
7
Gets the beta value without any error.
def _get_a(b): bval = (b - 6.0) _a = np.exp(-1.6805 - 1.7139*bval + 0.8155*bval**2 - 0.6667*bval**3)*r0 return _a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _beta(self):\n return _handle_ab(self.solution, self.use_const)[1]", "def beta(self):\n return self._beta", "def beta(self):\n return self._beta", "def _pvalue_beta(self):\n return _handle_ab(self._pvalues_all, self.use_const)[1]", "def pvalue_beta(self):\n return sel...
[ "0.8277686", "0.81749076", "0.81749076", "0.8029875", "0.8005773", "0.7558529", "0.75572", "0.7455098", "0.7448629", "0.73354685", "0.7292963", "0.7279979", "0.72149783", "0.7202633", "0.718031", "0.71242124", "0.70989686", "0.70897985", "0.70196337", "0.69401973", "0.6908727...
0.0
-1
The activation of every nodes in current layer
def forward_activate(self, a_prev, w, b, func_type): z = np.dot(w, a_prev) + b if 'sigmod' == func_type.lower(): a = 1 / (1 + np.exp(-z)) elif 'relu' == func_type.lower(): a = np.where(z >= 0, z, 0) elif 'leaky relu' == func_type.lower(): a = np.where(z >= 0, z, 0.01 * z) elif 'tanh' == func_type.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_activation(self):\r\n\r\n x=0\r\n edges=self.in_edges\r\n for edge in edges:\r\n x+= edge.source.activation*edge.weight\r\n self.activation=1/(1+exp(-x))", "def output_layer_activation(x):\n return x", "def activate(self, inputs, max_iters=10, verbose=False...
[ "0.76774824", "0.7254912", "0.7038288", "0.697561", "0.6962904", "0.67408377", "0.67284316", "0.6704305", "0.6704305", "0.66954225", "0.6687904", "0.6676637", "0.66083586", "0.65518934", "0.65213466", "0.64969915", "0.6472381", "0.6455701", "0.64490896", "0.6447537", "0.64144...
0.0
-1
Warning this set level works different to the logging levels from the logging modules It only loggs the specific level!!!
def setLevel(self, level): self.level = level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_logging_level(self, level):\n if str(level) == '1':\n self.logging_level = logging.DEBUG\n elif str(level) == '2':\n self.logging_level = logging.INFO\n elif str(level) == '3':\n self.logging_level = logging.WARNING\n elif str(level) == '4':\n ...
[ "0.83128154", "0.81982964", "0.8123441", "0.8080448", "0.80524296", "0.7990128", "0.79567695", "0.79253346", "0.7873479", "0.78397745", "0.78048825", "0.7804394", "0.7787514", "0.775979", "0.77123636", "0.76728463", "0.7657564", "0.7631749", "0.7596773", "0.7532826", "0.75124...
0.6954793
50
Just opens a file and returns the file pointer
def open_file(filename="default.txt", filepath="default_path"): if filepath == "default_path": filepath = "" try: fp = open(filepath + filename, "r+") # Opens file for reading and writing return fp except IOError: l.error(str(filepath + filename) + " is not an existing fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileopen(file):\n return _posixfile_().fileopen(file)", "def open_and_read_file(file_path):\n\n file = open(file_path)\n file = file.read()\n\n return file", "def open_and_read_file(file_path):\n\n # your code goes here\n with open(file_path) as open_file:\n open_file = open_file.r...
[ "0.79106057", "0.74671996", "0.7442113", "0.74153167", "0.7411237", "0.73867816", "0.7337049", "0.7309408", "0.72897136", "0.725517", "0.72535", "0.7252287", "0.72293067", "0.7187051", "0.7183019", "0.7183019", "0.716809", "0.71532714", "0.7138592", "0.7118966", "0.7110351", ...
0.70582503
21
Convert seconds value into datatime struct which can be used for xaxis labeeling
def int2dt(ts, ts_mult=1e3): return datetime.datetime.utcfromtimestamp(float(ts) / ts_mult)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_time_seconds(self):\n xknx = XKNX()\n sensor = Sensor(\n xknx, \"TestSensor\", group_address_state=\"1/2/3\", value_type=\"time_seconds\"\n )\n sensor.sensor_value.payload = DPTArray(\n (\n 0x45,\n 0xEC,\n 0...
[ "0.6037678", "0.60151094", "0.5902495", "0.5789053", "0.57698333", "0.5756503", "0.56998414", "0.5695367", "0.56924516", "0.56923556", "0.56559575", "0.56510186", "0.5589356", "0.55751383", "0.5571451", "0.55614936", "0.55509114", "0.5543542", "0.5539482", "0.5526644", "0.551...
0.5170021
99
Converts int time to timestring
def get_timestring_from_int(time_array, format="%H:%M:%S"): list = [] for value in time_array: list.append((value, int2dt(value, 1).strftime(format))) return list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_str(num):\n if num > 3600:\n return \"%0.2f hrs\" % (num / 3600)\n elif num > 60:\n return \"%0.2f mins\" % (num / 60)\n else:\n return \"%d seconds\" % num", "def _hour_to_time(num: int):\n return datetime.datetime.now().replace(hour=num).strftime(\"%-I %p\")", "def d...
[ "0.7694274", "0.7600043", "0.75069386", "0.74781907", "0.74567175", "0.7360215", "0.73013383", "0.7278415", "0.72732997", "0.7269285", "0.7234709", "0.7230359", "0.7218547", "0.7177966", "0.71739703", "0.711119", "0.7095433", "0.7084982", "0.7052444", "0.70169544", "0.6995191...
0.66337633
47
Convert seconds value into datatime struct which can be used for xaxis labeeling
def int2dt(ts, ts_mult=1e3): return datetime.utcfromtimestamp(float(ts) / ts_mult)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str_time_seconds(self):\n xknx = XKNX()\n sensor = Sensor(\n xknx, \"TestSensor\", group_address_state=\"1/2/3\", value_type=\"time_seconds\"\n )\n sensor.sensor_value.payload = DPTArray(\n (\n 0x45,\n 0xEC,\n 0...
[ "0.6037678", "0.60151094", "0.5902495", "0.5789053", "0.57698333", "0.5756503", "0.56998414", "0.5695367", "0.56924516", "0.56923556", "0.56559575", "0.56510186", "0.5589356", "0.55751383", "0.5571451", "0.55614936", "0.55509114", "0.5543542", "0.5539482", "0.5526644", "0.551...
0.52177805
84
Converts a dict to panda dataframes for easy manipulation etc.
def convert_to_df(to_convert, abs=False): import pandas as pd # Convert all data to panda data frames index = list(to_convert.keys()) columns = list(to_convert[index[0]]["data"].keys()) return_dict = { "All": pd.DataFrame(columns=columns), "keys": index, "columns": columns, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_DataFrame(data):\n return pd.DataFrame.from_dict(data)", "def convert_measuerment_dict_to_DataFrame(measurement_dict):\n df = pd.DataFrame.from_dict(measurement_dict, orient='index')\n return(df)", "def combine_dict_to_df(self, dict):\n\t\treturn pd.concat(dict.values(), axis=1)", "def c...
[ "0.8059452", "0.7631733", "0.7489436", "0.74161744", "0.7390376", "0.7367805", "0.7366398", "0.73650634", "0.7346928", "0.7334421", "0.7268139", "0.7218518", "0.6954949", "0.68464476", "0.66732633", "0.66146195", "0.6557861", "0.6535382", "0.6449816", "0.64214706", "0.6416471...
0.58366793
57
Converts a dictionary to a xml conform string
def convert_dict_to_xml(data_dict): from dicttoxml import dicttoxml return dicttoxml(data_dict, attr_type=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_obj(dict):\n string = \"\"\n for key in dict.keys():\n string += ' <{}>{}</{}>\\n'.format(key, dict[key], key)\n return string", "def ConvertToXML (given_dict) :\r\n stream_thing = cStringIO.StringIO()\r\n WriteToXMLStream(given_dict, stream_thing, 'top')\r\n return stream_thi...
[ "0.845272", "0.81291276", "0.6649774", "0.65305966", "0.6483101", "0.64377224", "0.64257705", "0.64160836", "0.63789696", "0.6255298", "0.6254579", "0.6245275", "0.622529", "0.620372", "0.6191599", "0.6181708", "0.61802655", "0.61252695", "0.61200124", "0.6101624", "0.6055791...
0.7663886
2
Get the formatters for a dataframe.
def get_column_formatters(df): formatters = {} for p in df.columns: (a, b) = p if b.endswith("Q"): formatters[p] = lambda x: "%.2f" % x elif b.startswith("T_"): formatters[p] = lambda x: "%.1f" % x else: formatters[p] = lambda x: "%.0f" % x ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats(self):\n if getattr(self, \"_coldefs\", None) is not None:\n return self._coldefs.formats\n\n return None", "def get_formatters(self, method_string):\n formatters = self.formatter_lookup_fn(method_string)\n return formatters or get_default_formatters()", "def ...
[ "0.6720017", "0.6411269", "0.6128905", "0.5910928", "0.585844", "0.5770554", "0.550217", "0.547369", "0.5414404", "0.5309702", "0.5268849", "0.525526", "0.5248033", "0.52395093", "0.52206933", "0.52044374", "0.5196219", "0.51326203", "0.5131759", "0.510412", "0.50755364", "...
0.7211429
0
Make some modifications to the html structure. Split all multirow cells and replace keys of repres by their corresponding values.
def process_ipet_table(table, repres, add_ind=False, swap=False): # split rowspan cells from the tables body to enable js datatable table_rows = [e for e in table.find(".//tbody").iter() if e.tag == "tr" or e.tag == "th"] groupcount = 1 oldtext = "" for row in table_rows: cellcount = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_html(self) -> None:\n\n row_xpath = f\"{self.y}_radGridOpinions_ctl00\"\n more_rows = self.html.xpath(f\"//tr[contains(@id, '{row_xpath}')]\")\n for row in more_rows:\n self.cases.append(\n {\n \"date\": row.xpath(\".//td[3]\")[0].text_...
[ "0.5710288", "0.553139", "0.54121155", "0.54119694", "0.5372363", "0.531896", "0.52491", "0.5233433", "0.5206455", "0.51740396", "0.517362", "0.5164092", "0.51141816", "0.50906265", "0.50780666", "0.50300205", "0.50233483", "0.4997933", "0.49907538", "0.49897304", "0.49721244...
0.5802958
0
Setup the IPET evaluation.
def setup_evaluation(evalfile, solufile, tolerance, evalstring=False): if evalstring: evaluation = IPETEvaluation.fromXML(evalfile) else: evaluation = IPETEvaluation.fromXMLFile(evalfile["path"]) evaluation.set_grouptags(True) evaluation.set_validate(solufile) evaluation.set_feastol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n insts = []\n for i in range(5):\n insts.append(pysat.Instrument('pysat', 'testing',\n clean_level='clean'))\n self.testC = pysat.Constellation(instruments=insts)\n self.testI = pysat.Instrument('pysat', 'testing', cl...
[ "0.64219975", "0.6421099", "0.6216099", "0.6188956", "0.61888206", "0.61063975", "0.6106245", "0.6094714", "0.6048873", "0.593416", "0.5912913", "0.5865511", "0.58306336", "0.5819357", "0.58018136", "0.57828933", "0.57751566", "0.5772968", "0.57464767", "0.57017785", "0.56762...
0.59003264
11
Figures out the full path of the directory containing this file. `PACKAGE_DIR` becomes the parent of that directory, which is the root of the solvertools package.
def module_path(): return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_dir():\n return Path(__file__).parent", "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def package_dir(self):\r\n return \".\"", "def _get_package_directory(self, package_name: str) -> str:\n return os.path.abspath(\n os.path.join(\n ...
[ "0.81602395", "0.8062657", "0.7526837", "0.73567075", "0.73142666", "0.7164011", "0.71322", "0.7081865", "0.70072436", "0.6978351", "0.6930246", "0.68948233", "0.6875065", "0.686499", "0.6850653", "0.6828237", "0.6813047", "0.6804818", "0.67853224", "0.6778022", "0.6752795", ...
0.6365788
59
makes the ball bounce upon collision between it and the screen edges or the paddles
def detect_collision(): # with the top and bottom of screen if ball.ycor() > GAME_Y_BARRIER or ball.ycor() < -GAME_Y_BARRIER: ball.bounce_y() # with the paddles if ball.distance(paddle_right) < 50 and ball.xcor() > GAME_X_BARRIER \ or ball.distance(paddle_left) < 50 and ball.xcor() <...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ball_bounce(wall):\n if wall: # top & bottom walls\n ball_vel[1] = -ball_vel[1]\n else: # left or right walls\n ball_vel[0] = -ball_vel[0]", "def updateBall(self):\n if self._ball.getLeft() <= 0 or self._ball.getRight() >= GAME_WIDTH:\n self._ball.bounceSides()\n ...
[ "0.80809534", "0.79897755", "0.7860784", "0.78078", "0.7763963", "0.7698833", "0.76171386", "0.7607339", "0.7573954", "0.7510823", "0.74989855", "0.7455601", "0.74395144", "0.74264336", "0.7407874", "0.7393429", "0.7388129", "0.7311593", "0.73078597", "0.72798496", "0.7225374...
0.8287781
0
Assert that the post endpoint works.
def test_post_default_statement_settings_daily(session, client, jwt, app): token = jwt.create_jwt(get_claims(), token_header) headers = {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} rv = client.post('/api/v1/payment-requests', data=json.dumps(get_payment_request(business_identifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n pass", "def test_post(self):\n self.assertEqual(200, self.response.status_code)", "def test_post_method(self):\n ...
[ "0.848375", "0.848375", "0.8448435", "0.8396971", "0.8392715", "0.83805436", "0.8341863", "0.829582", "0.823757", "0.8122103", "0.80877185", "0.8037776", "0.8030858", "0.7962242", "0.79454166", "0.7803735", "0.7801654", "0.7783452", "0.7741588", "0.7735566", "0.7667413", "0...
0.0
-1