query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Retrieve link to persistance mechanism
def _link(self): return self._interface(self.fspath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLink(self):", "def getNoteStoreUrl(self, authenticationToken):\r\n pass", "def getLink(self):\n return self.link", "def get_url(self):\n return self.db_url", "def url(self):\n return self.storage.url(self.name)", "def link(self):\n \n self.__enter__()\n ...
[ "0.66899043", "0.6360058", "0.6057088", "0.60436183", "0.5956282", "0.59523934", "0.59127355", "0.5892777", "0.5855571", "0.5855571", "0.5855571", "0.5832151", "0.5825213", "0.5808694", "0.5808694", "0.5795157", "0.5773146", "0.57467055", "0.5686189", "0.5640394", "0.5640394"...
0.53345376
39
Populate the index from a sql table
def load(cls, table_name: str, index_col: str = "operator"): # df = Operator_Table.df # df.operator = df.operator.apply(sp.normalize) # df.operator_alias = df.operator_alias.apply(sp.normalize) # df = df.rename(columns={"operator_alias": "alias"}) try: import models ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index():", "def build_index():\n pass", "def build_index(self):\n \n \n geoids = self.partitions.find_or_new(table='facilities_geoids')\n addresses = self.partitions.find_or_new(table='facilities_addresses')\n facilities = self.partitions.find(table='facilities'...
[ "0.7213231", "0.6684144", "0.65098643", "0.6441818", "0.6408963", "0.63851833", "0.6318164", "0.6292551", "0.62921697", "0.62792414", "0.6179801", "0.617612", "0.610432", "0.60891044", "0.6074349", "0.6074349", "0.6042582", "0.5986674", "0.5965966", "0.59287876", "0.592021", ...
0.5452085
76
Look for an exact match for the target string in a list of all operator names. If found, returns the alias for that name. Otherwise, returns None.
def lookup(self, target: str) -> pd.Series: try: # self.refresh() result = pd.Series(name=target) if target is not None: result = self.loc[target].copy() if result.ndim > 1: result = result.max() result[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fuzzy_match(self, other):\n magic, fuzzy = False, False\n try:\n magic = self.alias == other.magic\n except AttributeError:\n pass\n\n if '.' in self.alias:\n major = self.alias.split('.')[0]\n fuzzy = major == other.alias \n return...
[ "0.600872", "0.5476128", "0.5431273", "0.53964996", "0.5336919", "0.53155607", "0.5303619", "0.5226297", "0.52201563", "0.51875824", "0.5180949", "0.51748854", "0.5127156", "0.51046616", "0.50755596", "0.5064597", "0.5043313", "0.5024844", "0.5005249", "0.49946284", "0.499088...
0.54977614
2
Attempt to fuzzy match the target string to an operator name using the given scorer function. The alias for the match with the highest score is returned. If a match with a score above the cutoff is not found, None is returned
def _fuzzy_match( self, target: str, scorer=None, score_cutoff=85, limit=1 ) -> pd.Series: scorer = scorer or self.default_scorer() # result = pd.Series(name = target) extracted: list = process.extractBests( target, self.operator, scorer=scorer, limit=limit, score_cutof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fuzzy_match(object, answer, threshold=80):\n answer_phrase = generate_ngrams(answer)\n if answer_phrase:\n best_match = [fuzz.ratio(object, phr) for phr in answer_phrase]\n if np.max(best_match)>threshold:\n return np.max(best_match), answer_phrase[np.argmax(best_match)]\n ...
[ "0.6589819", "0.64425164", "0.58997977", "0.58632153", "0.58299005", "0.56999075", "0.5664272", "0.5549336", "0.5484873", "0.5475975", "0.53234446", "0.53025043", "0.52954453", "0.52909315", "0.5284119", "0.5278062", "0.5250008", "0.5246519", "0.51911473", "0.51895994", "0.51...
0.71131057
2
Get updated records from the database
def refresh(self): new = self.table.records_updated_since(self.updated.max()).set_index("operator") new = new.rename(columns={"operator_alias": "alias", "fscore": "confidence"}) if not new.empty: # TODO: this is clunky. need to fix later self.update(new) for idx, values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updates(self, request, version):\n task = EtlTask.objects.get_for_model(self.queryset.model)\n if task.last_changes:\n offset = task.last_changes.strftime(\"%Y-%m-%d %H:%M\")\n queryset = self.queryset.filter(last_modify_date__gte=offset)\n else:\n offset =...
[ "0.6702553", "0.6538225", "0.6296629", "0.6269668", "0.62084794", "0.6174577", "0.61277586", "0.6011581", "0.59838617", "0.59722775", "0.59722775", "0.59722775", "0.59113353", "0.5910794", "0.59095263", "0.58913016", "0.5880948", "0.5802331", "0.57978505", "0.5750909", "0.574...
0.5467505
53
Assess the distance between the names of the underlying operators produce a mean distance from one another. If their mean distance surpasses a certain threshold, divide the operator names at the mean and rename the alias of those aliases in the group with the larger mean. (Alternatively, classify with sklean to find a ...
def diverge(cls, alias1: str): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_evaluation(ops, mut):\n\n center = ops[0]\n min_distortion = distortion([ops[0]], ops, mut)\n for i in ops:\n tmp = distortion([i], ops, mut)\n if tmp < min_distortion:\n center = i\n min_distortion = tmp\n return center", "def eval_mean_distance(played_d...
[ "0.5520021", "0.50843334", "0.5065839", "0.4932081", "0.4928756", "0.49083254", "0.48984692", "0.48236924", "0.4807179", "0.48032764", "0.47765797", "0.4763124", "0.47613123", "0.4753312", "0.47391325", "0.47310758", "0.47147945", "0.46967348", "0.46832567", "0.46761087", "0....
0.0
-1
Populate the index from a json file.
def load(cls, path: str): df = pd.read_json(path, convert_dates=["updated", "created"]) df = FileIndex(data=df, path=path) if "operator" in df.columns: df = df.set_index("operator") return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self, json_file, target_index='infinity'):\n # data = json.loads(json_file)\n with open(json_file) as f:\n data = json.load(f)\n self.elasticsearch.index(index=target_index, doc_type='image_vector', body=data)", "def load_index_from_cache(self):\n cache = open...
[ "0.747001", "0.6945988", "0.6746498", "0.6735094", "0.66761446", "0.66439533", "0.6639118", "0.6610646", "0.62583476", "0.61591774", "0.61463624", "0.6078079", "0.6065206", "0.6014596", "0.60142374", "0.5997697", "0.5977178", "0.59698784", "0.59464496", "0.5944197", "0.594263...
0.62580574
9
Save Index to file
def save(self) -> None: try: js = json.loads( self.reset_index().to_json(orient="records", date_format="iso") ) with open(self._fp, "w") as f: f.writelines(json.dumps(js, indent=4)) logger.debug(f"Saved index to {self._fp}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\n self.index.saveIndex(c.index_path('hnsw.index'))\n joblib.dump(self.ys, \"%s.ys\" % self.index_file_prefix)", "def writeindextofile(index):\n writetofile(index[0], \"invertedindex1\")\n writetofile(index[1], \"invertedindex2\")\n writetofile(index[2], \"invertedindex3\")\...
[ "0.8103557", "0.7670749", "0.76576316", "0.760385", "0.75967723", "0.73518753", "0.7314572", "0.72119933", "0.7082714", "0.7073918", "0.7024572", "0.7007928", "0.6977166", "0.6963725", "0.69155496", "0.686387", "0.68256783", "0.67764086", "0.67097294", "0.66410786", "0.661986...
0.7216647
7
Look for an exact match for the target string in a list of all operator names. If found, returns the alias for that name. Otherwise, returns None.
def lookup(self, target: str) -> pd.Series: try: # self.refresh() result = pd.Series(name=target) if target is not None: result = self.loc[target].copy() if result.ndim > 1: result = result.max() result[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fuzzy_match(self, other):\n magic, fuzzy = False, False\n try:\n magic = self.alias == other.magic\n except AttributeError:\n pass\n\n if '.' in self.alias:\n major = self.alias.split('.')[0]\n fuzzy = major == other.alias \n return...
[ "0.60058826", "0.5474259", "0.54306984", "0.5395898", "0.5336259", "0.5314073", "0.5303197", "0.5225841", "0.52174765", "0.51858866", "0.51789933", "0.51755756", "0.5125417", "0.5103533", "0.5076306", "0.50645787", "0.50409764", "0.5024462", "0.5001895", "0.4993382", "0.49906...
0.54979354
3
Attempt to fuzzy match the target string to an operator name using the given scorer function. The alias for the match with the highest score is returned. If a match with a score above the cutoff is not found, None is returned
def _fuzzy_match( self, target: str, scorer=None, score_cutoff=85, limit=1 ) -> pd.Series: scorer = scorer or self.default_scorer() # result = pd.Series(name = target) extracted: list = process.extractBests( target, self.operator, scorer=scorer, limit=limit, score_cutof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fuzzy_match(object, answer, threshold=80):\n answer_phrase = generate_ngrams(answer)\n if answer_phrase:\n best_match = [fuzz.ratio(object, phr) for phr in answer_phrase]\n if np.max(best_match)>threshold:\n return np.max(best_match), answer_phrase[np.argmax(best_match)]\n ...
[ "0.659055", "0.64439535", "0.59002095", "0.5863153", "0.5831834", "0.5701473", "0.5665831", "0.5550824", "0.54848444", "0.5475604", "0.5324608", "0.53036016", "0.52972806", "0.5290554", "0.5284169", "0.52791375", "0.5251146", "0.52473545", "0.5191728", "0.51911855", "0.518684...
0.71132505
1
Get updated records from the database
def refresh(self): new = self.table.records_updated_since(self.updated.max()).set_index("operator") new = new.rename(columns={"operator_alias": "alias", "fscore": "confidence"}) if not new.empty: # TODO: this is clunky. need to fix later self.update(new) for idx, values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updates(self, request, version):\n task = EtlTask.objects.get_for_model(self.queryset.model)\n if task.last_changes:\n offset = task.last_changes.strftime(\"%Y-%m-%d %H:%M\")\n queryset = self.queryset.filter(last_modify_date__gte=offset)\n else:\n offset =...
[ "0.6702509", "0.6538232", "0.6296598", "0.62696797", "0.62084246", "0.61745894", "0.61277264", "0.6011599", "0.5983865", "0.59722954", "0.59722954", "0.59722954", "0.5911353", "0.5910805", "0.59094757", "0.5891323", "0.58809704", "0.5802351", "0.579783", "0.5750917", "0.57492...
0.5467523
54
Assess the distance between the names of the underlying operators produce a mean distance from one another. If their mean distance surpasses a certain threshold, divide the operator names at the mean and rename the alias of those aliases in the group with the larger mean. (Alternatively, classify with sklean to find a ...
def diverge(cls, alias1: str): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_evaluation(ops, mut):\n\n center = ops[0]\n min_distortion = distortion([ops[0]], ops, mut)\n for i in ops:\n tmp = distortion([i], ops, mut)\n if tmp < min_distortion:\n center = i\n min_distortion = tmp\n return center", "def eval_mean_distance(played_d...
[ "0.55205715", "0.5083899", "0.50661826", "0.4933381", "0.49283728", "0.49085572", "0.4898324", "0.4822347", "0.4807188", "0.48029503", "0.4775096", "0.47633815", "0.4761373", "0.4752688", "0.47391406", "0.472966", "0.47146857", "0.46963546", "0.46840042", "0.46775493", "0.467...
0.0
-1
Populate the index from a sql table.
def load(cls): df = Operator_Table.df df.operator = df.operator.apply(sp.normalize) df.operator_alias = df.operator_alias.apply(sp.normalize) df = df.rename(columns={"operator_alias": "alias"}) return SQLIndex(data=df).set_index("operator")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index():", "def build_index():\n pass", "def create_new_index(self, dict_pg_info):\n # ! Setting if fun can use default setting\n ruler = Rules()\n str_conn = ruler.pg_info_rules(dict_pg_info)\n conn = psycopg2.connect(str_conn)\n\n with conn:\n with ...
[ "0.6368501", "0.6023515", "0.59747756", "0.59641385", "0.5937889", "0.592518", "0.590878", "0.5883567", "0.5831351", "0.58310884", "0.5824989", "0.5792725", "0.5674515", "0.56426316", "0.5632395", "0.5627473", "0.5621183", "0.5617214", "0.5617214", "0.5613995", "0.55791384", ...
0.61137277
1
Merge result into the database
def save(cls, result: pd.Series) -> None: result = result.rename( {"name": "operator", "alias": "operator_alias", "fscore": "confidence"} ) result = result.to_frame().T[ ["operator", "operator_alias", "confidence", "method"] ] try: cls.table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_result_batch(self, results):\n session = self.session_factory()\n for result in results:\n if not self._check_row_exists(pk=result.get('id')):\n session.add(PipelineRun(**result))\n if self._get_filtered_results(id=result.get('id'), status='IN_PROGRESS'...
[ "0.6059761", "0.6023335", "0.5986452", "0.58878183", "0.58587795", "0.5827826", "0.57429814", "0.5736765", "0.57184654", "0.5684917", "0.5680063", "0.56601053", "0.56524307", "0.5648465", "0.56473595", "0.56111944", "0.5603365", "0.55938107", "0.55917615", "0.55879015", "0.55...
0.54443294
34
Look for an exact match for the target string in a list of all operator names. If found, returns the alias for that name. Otherwise, returns None.
def lookup(self, target: str) -> pd.Series: try: # self.refresh() result = pd.Series(name=target) if target is not None: result = self.loc[target].copy() if result.ndim > 1: result = result.max() result[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fuzzy_match(self, other):\n magic, fuzzy = False, False\n try:\n magic = self.alias == other.magic\n except AttributeError:\n pass\n\n if '.' in self.alias:\n major = self.alias.split('.')[0]\n fuzzy = major == other.alias \n return...
[ "0.600872", "0.5476128", "0.5431273", "0.53964996", "0.5336919", "0.53155607", "0.5303619", "0.5226297", "0.52201563", "0.51875824", "0.5180949", "0.51748854", "0.5127156", "0.51046616", "0.50755596", "0.5064597", "0.5043313", "0.5024844", "0.5005249", "0.49946284", "0.499088...
0.54977614
1
Attempt to fuzzy match the target string to an operator name using the given scorer function. The alias for the match with the highest score is returned. If a match with a score above the cutoff is not found, None is returned
def _fuzzy_match( self, target: str, scorer=None, score_cutoff=85, limit=1 ) -> pd.Series: scorer = scorer or self.default_scorer() # result = pd.Series(name = target) extracted: list = process.extractBests( target, self.operator, scorer=scorer, limit=limit, score_cutof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fuzzy_match(object, answer, threshold=80):\n answer_phrase = generate_ngrams(answer)\n if answer_phrase:\n best_match = [fuzz.ratio(object, phr) for phr in answer_phrase]\n if np.max(best_match)>threshold:\n return np.max(best_match), answer_phrase[np.argmax(best_match)]\n ...
[ "0.6589819", "0.64425164", "0.58997977", "0.58632153", "0.58299005", "0.56999075", "0.5664272", "0.5549336", "0.5484873", "0.5475975", "0.53234446", "0.53025043", "0.52954453", "0.52909315", "0.5284119", "0.5278062", "0.5250008", "0.5246519", "0.51911473", "0.51895994", "0.51...
0.71131057
0
Assess the distance between the names of the underlying operators produce a mean distance from one another. If their mean distance surpasses a certain threshold, divide the operator names at the mean and rename the alias of those aliases in the group with the larger mean. (Alternatively, classify with sklean to find a ...
def diverge(cls, alias1: str): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_evaluation(ops, mut):\n\n center = ops[0]\n min_distortion = distortion([ops[0]], ops, mut)\n for i in ops:\n tmp = distortion([i], ops, mut)\n if tmp < min_distortion:\n center = i\n min_distortion = tmp\n return center", "def eval_mean_distance(played_d...
[ "0.55212533", "0.50854033", "0.5065224", "0.49335217", "0.49285668", "0.4908087", "0.48990777", "0.48233825", "0.48066035", "0.4803067", "0.47749212", "0.47635058", "0.47623038", "0.47537285", "0.47375804", "0.4728953", "0.47153434", "0.46961704", "0.46841297", "0.46764016", ...
0.0
-1
Do not return anything, modify nums inplace instead.
def moveZeroes(self, n: List[int]) -> None: w = 0 for r in range(len(n)): if n[r] != 0: n[r], n[w] = 0, n[r] w += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Get the features from one image. Global intensity histogram per channel and local histogram on image patches.
def _get_features_from_batch_images(self, img, r, p): tmp_feats = [] for channel in range(4): current_img = img[channel, :, :] tmp_feats = np.append(tmp_feats, np.histogram(current_img)[0]) # extract 8*8 patches of 64*64 px and derive 10 bins histogram for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_hist_features(img, p):\n # Compute the histogram of the color channels separately\n channel1_hist = np.histogram(img[:, :, 0], bins=p.hist_bins)\n channel2_hist = np.histogram(img[:, :, 1], bins=p.hist_bins)\n channel3_hist = np.histogram(img[:, :, 2], bins=p.hist_bins)\n # Concatenate...
[ "0.7379405", "0.73698366", "0.7358129", "0.7352107", "0.73067987", "0.72972965", "0.72677433", "0.7140472", "0.7089154", "0.7082067", "0.6995413", "0.6963337", "0.6898634", "0.68926054", "0.6876243", "0.6866601", "0.6840813", "0.6817776", "0.6807787", "0.68063486", "0.6802365...
0.78143317
0
Main features extraction function.
def _extract_features(self, all_batches, patch_size, train=True): # manually derive basic intensities features # takes 20 sec / 1048 images batch on my laptop in 4 cores // p = patch_size r = 512 // p labels = np.empty(0) feats = np.empty(0) for counter, tmp in en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()", "def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}", "def extractFeatures(self, datum):\n abstract", "...
[ "0.80551636", "0.7476482", "0.7449748", "0.74376774", "0.72759044", "0.72360015", "0.71951854", "0.71951854", "0.71786666", "0.71786666", "0.7144344", "0.7119816", "0.695923", "0.69585216", "0.6923738", "0.6879381", "0.6851909", "0.68421155", "0.6829337", "0.68229896", "0.674...
0.6427413
41
Return the largest k elements (by magnitude) of vec
def _topk(vec, k): # on a gpu, sorting is faster than pytorch's topk method #topkIndices = torch.sort(vec**2)[1][-k:] # however, torch.topk is more space efficient # topk on cuda returns what looks like uninitialized memory if # vals has nan values in it # saving to a zero-initialized output ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk(vec, k):\n vec = torch.topk(vec, k)\n return vec.view(-1).data.tolist()", "def _get_k_largest(lst, k):\n sorted_lst = sorted([(val, index) for index, val in enumerate(lst)])\n return list(reversed(sorted_lst[-k:]))", "def fetch_top_k(vect, mat, k):\n resultant = np.dot(mat, vect)\n a...
[ "0.70072746", "0.694857", "0.67012167", "0.6503669", "0.64816123", "0.6479474", "0.6429288", "0.63603586", "0.6348943", "0.6219995", "0.6148244", "0.6119454", "0.6073502", "0.6013036", "0.6009005", "0.6008039", "0.59666955", "0.59358937", "0.5894497", "0.584554", "0.5819495",...
0.6379255
7
equal area projection to spherical coorindate
def lambert_eqarea(khi,phi): r = 2 * np.sin(khi/2.) th = phi return r, th
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self, (lng, lat)):\n x = lng * DEG_TO_RAD\n lat = max(min(MAX_LATITUDE, lat), -MAX_LATITUDE)\n y = lat * DEG_TO_RAD\n y = math.log(math.tan((math.pi / 4) + (y / 2)))\n return (x*EARTH_RADIUS, y*EARTH_RADIUS)", "def sphere_area(radius : number) -> number:\n area = 4*pi*radius*radius\n retur...
[ "0.6437393", "0.63807535", "0.6313511", "0.61041933", "0.60751605", "0.6064479", "0.6049043", "0.6032563", "0.6012711", "0.5995009", "0.5943727", "0.5930662", "0.59111685", "0.5879559", "0.58755404", "0.5866631", "0.5839192", "0.5820025", "0.5777919", "0.5765673", "0.5743934"...
0.0
-1
Generator for a sliding window walker; yields a new substring of sequence as well as the position of the left end of the window.
def sliding_window(sequence, width=2, step=1, seq_only=False): for position in range(0, len(sequence) - width, step): yield sequence[position: position + width] if seq_only else (position, sequence[position: position + width])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sliding_window(seq, n=DEFAULT_WINDOW_WIDTH):\n it = iter(seq)\n result = tuple(islice(it, n))\n if len(result) == n:\n yield result \n for elem in it:\n result = result[1:] + (elem,)\n yield result", "def sliding_window_analysis(sequence, function,\n ...
[ "0.6834851", "0.65151423", "0.6398749", "0.6279482", "0.6083154", "0.60000926", "0.5993172", "0.5971204", "0.5971204", "0.5791553", "0.56396246", "0.5636666", "0.5559646", "0.5535868", "0.54835385", "0.54810375", "0.5475382", "0.5470839", "0.5463914", "0.5445849", "0.5411979"...
0.7074384
0
Returns the reverse complement of a positionweight matrix.
def wc_matrix(matrix): return [{"A": position["T"], "T": position["A"], "C": position["G"], "G": position["C"]} for position in matrix[::-1]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_matrix(self):\n return SWAP.matrix @ self.matrix @ SWAP.matrix", "def __neg__(self):\r\n return mat4(map(lambda x: -x, self.mlist))", "def inverse(self):\n group = self.group\n r = tuple([(i, -j) for i, j in self.array_form[::-1]])\n return group.dtype(r)", "def...
[ "0.7011902", "0.60254407", "0.59786683", "0.5896039", "0.58089143", "0.57692766", "0.5745344", "0.5692964", "0.5679361", "0.56626594", "0.5652216", "0.56342137", "0.5633222", "0.5618562", "0.56127685", "0.56087816", "0.5606974", "0.56052554", "0.5596738", "0.5594267", "0.5594...
0.510713
85
This function is called automatically by sciunit and clones it into self.observation This checks if the experimental_data is of some desired form or magnitude. Not exactly this function but a version of this is already performed by the ValidationTestLibrary.get_validation_test
def validate_observation(self, observation, first_try=True): print("validate_observation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shapes(self):\n\n # Creates a raw layer\n self.validator.adata.raw = self.validator.adata\n self.validator.adata.raw.var.drop(\"feature_is_filtered\", axis=1, inplace=True)\n self.validator.adata.X = examples.adata_non_raw.X.copy()\n self.validator.adata.uns[\"X_normaliz...
[ "0.5877965", "0.5852415", "0.5822772", "0.5707541", "0.56967235", "0.56730175", "0.5636447", "0.55875695", "0.5568945", "0.55493855", "0.5545418", "0.5510037", "0.55092335", "0.54929996", "0.5448216", "0.54284984", "0.5409777", "0.5409752", "0.53558064", "0.53478", "0.5327068...
0.5509749
12
Generates resting Vm from soma. The function is automatically called by sciunit.Test which this test is a child of. Therefore as part of sciunit generate_prediction is mandatory.
def generate_prediction(self, model, verbose=False): #self.confidence = confidence # set confidence for test 90%, 95% (default), 99% # self.observation["created_later"] = "generate_prediction" #print(self.observation) print(self.observation["created_later"]) return 666.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_svm():\n backend = BasicAer.get_backend('statevector_simulator')\n random_seed = r.randint(1, 10598)\n\n quantum_instance = QuantumInstance(backend, seed=random_seed, seed_transpiler=random_seed)\n\n # iris\n pres = \"Test pour le data set Iris (facile, classique)\"\n test_from_func(pres...
[ "0.5936731", "0.58449227", "0.5832882", "0.5806163", "0.56090754", "0.5552659", "0.55265224", "0.54068804", "0.5372567", "0.53497547", "0.53247535", "0.531252", "0.5301973", "0.5224144", "0.52184594", "0.5209817", "0.5201285", "0.51980144", "0.51979405", "0.51375645", "0.5119...
0.52487266
13
This function like generate_pediction is called automatically by sciunit which RestingVmTest is a child of. This function must be named compute_score The prediction processed from "vm_soma" is compared against the experimental_data to get the binary score; 0 if the prediction correspond with experiment, else 1.
def compute_score(self, observation, prediction, verbose=False): #print(observation) score = TScore.compute( self.observation, prediction ) print("compute_score")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, test_data):\n\n\t\tpass", "def score():\n # Get probability from our data\n data = flask.request.json\n x = np.matrix(data[\"example\"])\n x_add = scaler.transform(x[0, (0,4,5,6,7,8)])\n x_scaled = np.delete(x, [0,4,5,6,7,8], axis=1)\n x_scaled = np.insert(x_scaled, (0,3,3,3,3,3...
[ "0.6292821", "0.6264465", "0.6261162", "0.6158336", "0.61248165", "0.60617495", "0.6059161", "0.6052629", "0.5940177", "0.5930881", "0.59085554", "0.59062296", "0.58507663", "0.58476144", "0.5836477", "0.5834371", "0.58234507", "0.5818891", "0.58088255", "0.58037376", "0.5802...
0.66401887
0
Establish the database, create an engine if needed, and register the models.
def configure_db(): global _ENGINE, sa_logger, _MAX_RETRIES, _RETRY_INTERVAL if not _ENGINE: billing_sql_connection = CONF.billing_sql_connection _MAX_RETRIES = CONF.sql_max_retries _RETRY_INTERVAL = CONF.sql_retry_interval connection_dict = sqlalchemy.engine.url.make_url(billing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_db():\n import cerbereapp.models\n Base.metadata.create_all(bind=engine)", "def setup_db():\n\n engine = config['tg.app_globals'].sa_engine\n # model.init_model(engine)\n # model.metadata.create_all(engine)", "def init_db(self):\n\n # The user can provide a custom string\n if self...
[ "0.80127066", "0.79147583", "0.79010004", "0.77331024", "0.7706037", "0.7563964", "0.734508", "0.725109", "0.7214508", "0.71930456", "0.719184", "0.716469", "0.71618533", "0.7159122", "0.71580553", "0.71514654", "0.7144555", "0.7144555", "0.71386635", "0.71174407", "0.7065824...
0.68134224
32
Helper method to grab session
def get_session(autocommit=True, expire_on_commit=False): global _MAKER if not _MAKER: assert _ENGINE _MAKER = sqlalchemy.orm.sessionmaker(bind=_ENGINE, autocommit=autocommit, expire_on_commit=expire_on_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session(get_session):\n return get_session()", "def getSession():\n return call(\"getSession\")", "def session(self):\n return self.session_store.get_session()", "def get_session(self):\n return self.session", "def get_session():\n request_session = requests.Session()\n\n # Try to...
[ "0.7973383", "0.7817807", "0.76734984", "0.7623463", "0.73637754", "0.7344661", "0.73370534", "0.7312605", "0.7312", "0.7292933", "0.72908765", "0.7227813", "0.7219954", "0.71882755", "0.71820396", "0.71819615", "0.71819615", "0.7159061", "0.7157339", "0.71509784", "0.7143215...
0.0
-1
Return True if error in connecting to db.
def is_db_connection_error(args): # NOTE(adam_g): This is currently MySQL specific and needs to be extended # to support Postgres and others. conn_err_codes = ('2002', '2003', '2006') for err_code in conn_err_codes: if args.find(err_code) != -1: return True return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_db_connection(self):\n self.logger.debug('Checking database connection.')\n if self.db is None:\n try:\n self.connect_to_db()\n except Exception as e:\n print('Lost database connection.')\n self.logger.error('Lost database c...
[ "0.768802", "0.76695615", "0.7357796", "0.69938886", "0.6968846", "0.69685704", "0.695936", "0.6947775", "0.6887957", "0.6868652", "0.68522286", "0.6785703", "0.6768961", "0.67433053", "0.67409956", "0.6696983", "0.66877383", "0.6673695", "0.666373", "0.6658879", "0.6595638",...
0.7619212
2
Retry DB connection. Copied from nova and modified.
def wrap_db_error(f): def _wrap(*args, **kwargs): try: return f(*args, **kwargs) except sqlalchemy.exc.OperationalError, e: if not is_db_connection_error(e.args[0]): raise remaining_attempts = _MAX_RETRIES while True: L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retry_on_connection_error(exc):\n\n if isinstance(exc, db_exception.DBConnectionError):\n LOG.warning(\"Connection error detected. Retrying...\")\n return True\n return False", "def _retry_occurred(self):", "def db_auto_reconnect(func):\r\n @wraps(func)\r\n def wrapper(*args, **k...
[ "0.69502443", "0.67862636", "0.66337717", "0.6532174", "0.6528916", "0.6525842", "0.65242094", "0.65150666", "0.6500685", "0.64712876", "0.6449775", "0.64261687", "0.64096195", "0.6382624", "0.63109654", "0.6287411", "0.62764084", "0.62584907", "0.6249289", "0.6226552", "0.61...
0.0
-1
Get all project record.
def get_all_project_record(deleted=False): session = get_session() query = session.query(models.ProjectAccountRecord).\ filter_by(deleted=deleted).\ all() return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_project_records():\r\n records = flask.request.db_api.get_all_project_record()\r\n return flask.jsonify(records=records)", "def get_projects():\n return Project.query.all()", "def get_projects(self):\n res = self.conn.cursor().execute(\"SELECT * FROM projects\")\n return res....
[ "0.8395336", "0.7698113", "0.7534286", "0.73463917", "0.7295614", "0.71893334", "0.7128193", "0.71230257", "0.7120601", "0.71182877", "0.7017964", "0.6991092", "0.6973284", "0.6909829", "0.68773997", "0.6870416", "0.6786631", "0.67659", "0.6765425", "0.6757861", "0.67525625",...
0.738502
3
Get account record for project.
def record_get_for_project(project_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectAccountRecord).\ filter_by(project_id=project_id).\ filter_by(deleted=deleted).\ first() if not result: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account(self):\n return self._account", "def get_account(self):\n return self._account", "def get_account(self, account):\n \n pass", "def account(self, account_code):\r\n return acc.Account(self, account_code)", "def account(self, account_id: str):\n retur...
[ "0.6873403", "0.6873403", "0.6768942", "0.65608275", "0.6481947", "0.6471267", "0.6470501", "0.64585155", "0.6380671", "0.63713425", "0.63052857", "0.63029593", "0.6294659", "0.61823344", "0.616734", "0.61592054", "0.61530197", "0.6139093", "0.6127555", "0.61225945", "0.60992...
0.7251701
0
Create account record for project.
def record_create_for_project(project_id, values): values['project_id'] = project_id values['created_at'] = datetime.datetime.utcnow() values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = models.ProjectAccountRecord() record_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_account_project(self, create):\n row = {'PROJ_NAME1': 'Some Proj', 'PROJ_NO': '121-212',\n 'SECTOR': 'IT'}\n sync.create_account(row, None)\n self.assertTrue(create.called)\n account, row, issue_map = create.call_args[0]\n self.assertEqual(account.na...
[ "0.75250834", "0.7177558", "0.71739244", "0.707201", "0.7024612", "0.6820869", "0.67543614", "0.6753563", "0.6743432", "0.67337596", "0.6614218", "0.65826344", "0.6565613", "0.65346366", "0.647355", "0.6444409", "0.64416903", "0.6433336", "0.6433", "0.64252216", "0.6414233", ...
0.76885504
0
Update account record for project.
def record_update_for_project(project_id, values): values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = record_get_for_project(project_id, session=session) record_ref.update(values) record_ref.save(session=session) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, account):\n model = models.load('Account', account)\n return self.client.update_account(model=model)", "def update_account(row, account):\n if row['LAST_UPDATED_FROM_PAYGOV']:\n updated_at = datetime_from(row['LAST_UPDATED_FROM_PAYGOV'])\n account.donations.filter(...
[ "0.75752455", "0.7561981", "0.6564723", "0.6549342", "0.6443432", "0.64052767", "0.6362356", "0.6242186", "0.62039346", "0.6195929", "0.6176977", "0.61544794", "0.60663426", "0.6014485", "0.60042244", "0.5999836", "0.59962326", "0.5988404", "0.5988404", "0.5988404", "0.598840...
0.5839677
31
Update account record by record_id.
def record_update_for_project_by_id(record_id, values): values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = get_project_record_by_id(record_id, session=session) record_ref.update(values) record_ref.save(session=session) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_update_for_user(record_id, values):\n session = get_session()\n with session.begin():\n record_ref = get_user_record(record_id, session=session)\n record_ref.update(values)\n record_ref.save(session=session)", "def update_record(conn, record_id: int, hash: str):\n cur = c...
[ "0.7288022", "0.7048947", "0.69176865", "0.6763814", "0.6732461", "0.66992444", "0.660613", "0.6523691", "0.6473934", "0.64594585", "0.6457677", "0.6452143", "0.6381156", "0.6349426", "0.63355607", "0.63014734", "0.6256432", "0.62355167", "0.6199448", "0.61454207", "0.6098174...
0.6370856
13
Destroy account record for project.
def record_destroy_for_project(project_id): session = get_session() with session.begin(): session.query(models.ProjectAccountRecord).\ filter_by(project_id=project_id).\ update({'deleted': True, 'deleted_at': datetime.datetime.utcnow(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account(self, account):\n \n pass", "def delete_account(self):\n Credential.account_list.remove(self)", "def delete(account):\n account.stripe_account.delete()\n account.delete()", "def delete_account(self):\n signals.before_gameaccount_deleted.send(gameaccount=se...
[ "0.76962966", "0.74316823", "0.7380734", "0.7321574", "0.6965246", "0.69463253", "0.6917392", "0.69166034", "0.68574756", "0.6784433", "0.6770951", "0.6721752", "0.66982305", "0.6688007", "0.66563594", "0.6620386", "0.65966487", "0.6591575", "0.6591472", "0.6562468", "0.65266...
0.77929056
0
Destroy account record for project by record id.
def destroy_project_record_by_id(record_id): session = get_session() with session.begin(): record_ref = get_project_record_by_id(record_id, session=session) record_ref.delete(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_destroy_for_project(project_id):\n session = get_session()\n with session.begin():\n session.query(models.ProjectAccountRecord).\\\n filter_by(project_id=project_id).\\\n update({'deleted': True,\n 'deleted_at': datetime.datetime.utcnow()...
[ "0.7914912", "0.74007756", "0.7235547", "0.6944781", "0.6778722", "0.6724235", "0.67061377", "0.6690477", "0.6684126", "0.6674596", "0.6673089", "0.6586451", "0.65708244", "0.6446228", "0.63494915", "0.63357514", "0.6325784", "0.6323633", "0.6301844", "0.62872565", "0.6274903...
0.8081782
0
Get all item record for project by project id.
def get_all_item_record_for_project(project_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectItemRecord).\ filter_by(project_id=project_id).\ filter_by(deleted=deleted).\ all() if not result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_item_record_for_project(project):\r\n db_api = flask.request.db_api\r\n try:\r\n records = db_api.get_all_item_record_for_project(project)\r\n items = db_api.get_all_item()\r\n item_dict = dict([(i.id, i) for i in items])\r\n record_dict = {}\r\n for record in r...
[ "0.813911", "0.7328739", "0.69601107", "0.67463654", "0.6533493", "0.63821095", "0.63788885", "0.634504", "0.63328993", "0.6316908", "0.6295516", "0.62620634", "0.61942583", "0.61678183", "0.6166824", "0.6155322", "0.6145036", "0.6108053", "0.60920167", "0.6046282", "0.602754...
0.79447895
1
Get item record for project by item id.
def item_record_get_for_project(project_id, item_id, deleted=False, session=None): session = session or get_session() result = session.query(models.ProjectItemRecord).\ filter_by(project_id=project_id).\ filter_by(item_id=item_id).\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(item_id):\n return Item.query.filter_by(id=item_id).first()", "def get_project_item_record_by_name(project_id, item_name,\n deleted=False, session=None):\n session = session or get_session()\n if not item_get_by_name(item_name, session=session):\n i...
[ "0.79094803", "0.78173584", "0.779059", "0.7556272", "0.74198294", "0.7246455", "0.72274256", "0.7185601", "0.70975524", "0.7045275", "0.7031257", "0.700558", "0.69499576", "0.69349205", "0.69239855", "0.6913654", "0.6911511", "0.68850607", "0.68822163", "0.6859151", "0.67955...
0.82235324
0
Get item record for a project by item name.
def get_project_item_record_by_name(project_id, item_name, deleted=False, session=None): session = session or get_session() if not item_get_by_name(item_name, session=session): item_create(item_name, session=session) item = item_get_by_name(item_name, session=ses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_record_get_for_project(project_id, item_id,\n deleted=False, session=None):\n session = session or get_session()\n result = session.query(models.ProjectItemRecord).\\\n filter_by(project_id=project_id).\\\n filter_by(item_id=item_i...
[ "0.7511793", "0.6906444", "0.6748321", "0.6576447", "0.657298", "0.65694696", "0.6549003", "0.6524026", "0.649842", "0.64756", "0.63357013", "0.628752", "0.6284544", "0.6263267", "0.6244177", "0.61833465", "0.6174139", "0.6136428", "0.61308837", "0.6121236", "0.61090165", "...
0.8403567
0
Create item record for project.
def item_record_create_for_project(project_id, values, session=None): values['created_at'] = datetime.datetime.utcnow() values['project_id'] = project_id values['used'] = 0 if 'price' in values: values['price'] = int(values['price']) session = session or get_session() with session.begi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_project_item_records(project, item):\r\n db_api = flask.request.db_api\r\n record = {}\r\n\r\n if flask.request.method == 'GET':\r\n try:\r\n records = db_api.get_project_item_record_by_name(project_id=project,\r\n it...
[ "0.67992556", "0.66644853", "0.6627822", "0.66117144", "0.65483904", "0.64934033", "0.6480519", "0.64766985", "0.64618635", "0.64616525", "0.643769", "0.6425833", "0.6419744", "0.6397447", "0.6312063", "0.62760675", "0.62558514", "0.6227413", "0.62180895", "0.62023485", "0.62...
0.7986861
0
Create item record for project.
def item_record_update_for_project(project_id, values): values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = item_record_get_for_project(project_id, values["item_id"], session=session) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_record_create_for_project(project_id, values, session=None):\n values['created_at'] = datetime.datetime.utcnow()\n values['project_id'] = project_id\n values['used'] = 0\n\n if 'price' in values:\n values['price'] = int(values['price'])\n\n session = session or get_session()\n wit...
[ "0.7986861", "0.67992556", "0.66644853", "0.6627822", "0.66117144", "0.65483904", "0.64934033", "0.6480519", "0.64766985", "0.64618635", "0.64616525", "0.643769", "0.6425833", "0.6419744", "0.6397447", "0.6312063", "0.62760675", "0.62558514", "0.6227413", "0.62180895", "0.620...
0.0
-1
Update item record by item record_id.
def update_project_item_record_by_id(record_id, values): values['updated_at'] = datetime.datetime.utcnow() session = get_session() with session.begin(): record_ref = get_project_item_record(record_id, session=session) price = values.get('price', None) if price and price != record_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_item_record(id):\r\n db_api = flask.request.db_api\r\n record = {}\r\n\r\n if flask.request.method == 'GET':\r\n try:\r\n record = db_api.get_project_item_record(id)\r\n except exception.ProjectItemRecordNotFound:\r\n raise webob.exc.HTTPNotFound()\r\n\r\n ...
[ "0.7118001", "0.7086754", "0.6939123", "0.6875679", "0.67684174", "0.6705709", "0.6603891", "0.6562499", "0.6495993", "0.642799", "0.63300025", "0.62748045", "0.62592906", "0.6219607", "0.6203007", "0.6176232", "0.6166459", "0.61270183", "0.61230475", "0.61213315", "0.6054235...
0.7189731
0
Get account record for user.
def record_get_for_user(project_id, user_id, deleted=False): session = get_session() query = session.query(models.UserAccountRecord).\ filter_by(project_id=project_id).\ filter_by(user_id=user_id).\ filter_by(deleted=deleted) return query.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetAccountFromUser(self):\n name = self._GetAccountNameFromUser()\n number = self._GetAccountNumberFromUser()\n # Validate that the number is a number (assumes no alphabet characters in\n # the account number).\n if re.match(\"^[0-9]*$\", number) is None:\n raise ValueError(\"Account numbe...
[ "0.7582313", "0.73810774", "0.7379446", "0.73619837", "0.728641", "0.720849", "0.7114318", "0.7114318", "0.69070274", "0.6905375", "0.6758387", "0.6721938", "0.6680151", "0.66314286", "0.6567621", "0.65584415", "0.65564144", "0.6526109", "0.65027344", "0.6495356", "0.63669413...
0.66611445
13
Get all user record.
def get_all_user_record(deleted=False): session = get_session() query = session.query(models.UserAccountRecord).\ filter_by(deleted=deleted).\ all() return query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_users():", "def get_all_users():\n return Users.query.all()", "def get(self):\n return get_all_users()", "def get(self):\n return get_all_users()", "def get(self):\n return get_all_users()", "def get(self):\n return get_all_users()", "def get(self):\n ...
[ "0.8148167", "0.8062945", "0.80126846", "0.80126846", "0.80126846", "0.80126846", "0.7990221", "0.79466975", "0.7916389", "0.79000103", "0.78579146", "0.78118426", "0.77407473", "0.76903015", "0.76642764", "0.76446116", "0.7603502", "0.7577979", "0.75728434", "0.75572944", "0...
0.7046725
46
Create account record for user.
def record_create_for_user(project_id, user_id, values): values['project_id'] = project_id values['user_id'] = user_id session = get_session() with session.begin(): record_ref = models.UserAccountRecord() record_ref.update(values) record_ref.save(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self) -> None:\n # update when the account was created\n self.account_created = datetime.now().date()\n self.insert_to_db()\n log(f\"An account for User:{self.id} has been created.\")", "def create_account(self, user):\n tx = self.iroha.transaction(\n ...
[ "0.8198229", "0.7656714", "0.7563802", "0.754604", "0.7523484", "0.7507451", "0.7296358", "0.7262638", "0.7256525", "0.72457975", "0.723914", "0.71757126", "0.7168977", "0.71368366", "0.71026397", "0.7088115", "0.70726377", "0.7044514", "0.6994375", "0.6966342", "0.6965118", ...
0.76038736
2
Create account record for user.
def record_update_for_user(record_id, values): session = get_session() with session.begin(): record_ref = get_user_record(record_id, session=session) record_ref.update(values) record_ref.save(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self) -> None:\n # update when the account was created\n self.account_created = datetime.now().date()\n self.insert_to_db()\n log(f\"An account for User:{self.id} has been created.\")", "def create_account(self, user):\n tx = self.iroha.transaction(\n ...
[ "0.8198229", "0.7656714", "0.76038736", "0.7563802", "0.754604", "0.7523484", "0.7507451", "0.7296358", "0.7262638", "0.7256525", "0.72457975", "0.723914", "0.71757126", "0.7168977", "0.71368366", "0.71026397", "0.7088115", "0.70726377", "0.7044514", "0.6994375", "0.6966342",...
0.0
-1
Destroy account record for user.
def record_destroy_for_user(project_id, user_id): session = get_session() with session.begin(): session.query(models.UserAccountRecord).\ filter_by(project_id=project_id).\ filter_by(user_id=user_id).\ update({'deleted': True, 'dele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account(self, account):\n \n pass", "def delete_user(self) -> None:\n table_dictionary = {\n 'Apple': {\n 'table': 'AppleReceipts',\n 'user_id': 'User_id'\n },\n 'ESL': {\n 'table': 'ESLReceipts',\n ...
[ "0.7598277", "0.7517481", "0.7431796", "0.7385498", "0.7362621", "0.7354271", "0.7324764", "0.73033106", "0.7242971", "0.7206662", "0.72000504", "0.7199782", "0.714332", "0.704806", "0.69823027", "0.6978666", "0.69577897", "0.695324", "0.69298196", "0.69298196", "0.69298196",...
0.7243282
8
Destroy account record for user by record id.
def destroy_user_record_by_id(record_id): session = get_session() with session.begin(): session.query(models.UserAccountRecord).\ filter_by(id=record_id).\ update({'deleted': True, 'deleted_at': datetime.datetime.utcnow(), '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_record(self, record_id):\r\n self.record.deleteObject(id=record_id)", "def record_destroy_for_user(project_id, user_id):\n session = get_session()\n with session.begin():\n session.query(models.UserAccountRecord).\\\n filter_by(project_id=project_id).\\\n ...
[ "0.7428881", "0.70678204", "0.69996387", "0.69786745", "0.6923281", "0.6863564", "0.6838221", "0.67867917", "0.6773444", "0.6655968", "0.66454196", "0.66296005", "0.655638", "0.65561914", "0.6556088", "0.6553839", "0.6539259", "0.65297717", "0.65183675", "0.6514868", "0.65042...
0.826225
0
Get event log for tenant or user.
def event_get(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAccessLogForUser(cls, user):\n return cls.objects.filter(user_id=user.pk).order_by('timestamp')", "def get_eventlogs_detail(self, conn, id):\n path = urlJoin(urls.EVENT_LOG[\"GET\"], id)\n resp = conn.command(apiMethod=\"GET\", apiPath=path)\n return resp", "def getLog(self):...
[ "0.6378935", "0.6191199", "0.6155786", "0.6149457", "0.6149457", "0.6101304", "0.5987789", "0.59368587", "0.59368587", "0.5933352", "0.58958244", "0.58567405", "0.5849712", "0.57722425", "0.57491046", "0.57342017", "0.5707942", "0.56680214", "0.5650455", "0.5649152", "0.56258...
0.7186435
0
Create event log for tenant or user.
def event_create(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_create(sender, instance, created, **kwargs):\n if created:\n stracks.user(instance).log(\"? has been created\")", "def create_log_entry_when_user_logs_in(sender, request, user, **kwargs):\n create_user_log(\n request=request,\n user=user,\n type=_account_const.AUTHENTICA...
[ "0.64820445", "0.63328654", "0.6176685", "0.6098838", "0.6082016", "0.60325897", "0.6020694", "0.5998269", "0.59666187", "0.58728296", "0.5845204", "0.5739365", "0.5670226", "0.56540704", "0.5646611", "0.56244636", "0.5620357", "0.5588737", "0.5570638", "0.55596507", "0.55296...
0.7805796
0
Destroy event log for tenant or user.
def event_destroy(tenant_id, user_id=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_audit_delete(sender, user, request, **kwargs):\n\n try:\n UserAudit.objects.get(audit_key=request.session[constants.USERWARE_AUDIT_KEY]).delete()\n except:\n pass\n logger.info(_('User {} logged out'.format(request.user.username)))", "def delete(self):\n backend = self._get...
[ "0.68693596", "0.62246245", "0.61553496", "0.61405814", "0.6087588", "0.59832424", "0.5951968", "0.58644575", "0.582783", "0.58232427", "0.5809617", "0.5775968", "0.57755435", "0.5759473", "0.57312846", "0.570118", "0.5697515", "0.56482196", "0.56314635", "0.55968815", "0.557...
0.813976
0
Renvoie une Incident avec la MEDV completee (Attend une MEDV innexistante)
def predict(request): if request.method == 'GET': return JsonResponse(serializer.errors, status=400) elif request.method == 'POST': print(request) data = JSONParser().parse(request) serializer = IncidentSerializer(data=data) if serializer.is_valid(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_incident(self, __assistant):\r\n\r\n _report_date = int(datetime.strptime(self.txtIncidentDate.get_text(),\r\n '%Y-%m-%d').toordinal())\r\n\r\n # Retrieve the hardware ID.\r\n _model = self.cmbHardware.get_model()\r\n _row = self.cmbH...
[ "0.49407217", "0.49343365", "0.48329788", "0.47588772", "0.4737496", "0.4737496", "0.47058782", "0.47027096", "0.46789026", "0.46773216", "0.46342605", "0.46328428", "0.46245873", "0.46245873", "0.46136704", "0.46073547", "0.46002063", "0.45842218", "0.45684904", "0.45520234", ...
0.0
-1
Retrieve, update or delete a Incident.
def incident_detail(request, pk): try: Incident = Incident.objects.get(pk=pk) except Incident.DoesNotExist: return HttpResponse(status=404) if request.method == 'GET': serializer = IncidentSerializer(Incident) return JsonResponse(serializer.data) elif request.method == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_an_incident(self, id):\n sql = f\"SELECT * FROM incidences WHERE incidences.id={id}\"\n curr = Db().cur\n curr.execute(sql)\n output = curr.fetchone()\n return output", "def get(*, db_session, incident_id: int) -> Optional[Incident]:\n return db_session.query(Inciden...
[ "0.57337767", "0.5693353", "0.56903386", "0.54576063", "0.5443404", "0.5376091", "0.5369639", "0.53686297", "0.53374654", "0.5288004", "0.5210048", "0.51772356", "0.51492304", "0.50980365", "0.5071856", "0.5063114", "0.5051532", "0.50009227", "0.4985093", "0.4922284", "0.4906...
0.6207881
0
Tests the creation of an text layer via the layer factory.
def test_layer_factory(self): self.graphic = Text('Test') assert_layer_factory(self, 'text')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fixed_text_layer(self):\n\t\tself.graphic = Text('text')\n\t\tself.viewport = Viewport(0, 0, 100, 100)\n\t\tself.offset_x = 10\n\t\tself.offset_y = 5\n\n\t\t# Test a static text layer first\n\t\tself.layer = text_layer.FixedStaticTextLayer(\n\t\t\tself.graphic, viewport=self.viewport,\n\t\t\toffset_x=self...
[ "0.68004715", "0.62582254", "0.6083502", "0.5984313", "0.5946537", "0.5838513", "0.5829028", "0.58284557", "0.5803945", "0.5803416", "0.57713497", "0.5756482", "0.56175125", "0.560891", "0.5477224", "0.5453544", "0.5436384", "0.5339267", "0.5318148", "0.53089434", "0.53021735...
0.8442944
0
Tests fixed text layers. Also ensures that LiveText objects are updated.
def test_fixed_text_layer(self): self.graphic = Text('text') self.viewport = Viewport(0, 0, 100, 100) self.offset_x = 10 self.offset_y = 5 # Test a static text layer first self.layer = text_layer.FixedStaticTextLayer( self.graphic, viewport=self.viewport, offset_x=self.offset_x, offset_y=self.offset_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_layer_factory(self):\n\t\tself.graphic = Text('Test')\n\n\t\tassert_layer_factory(self, 'text')", "def test_generate_mine_text(self):\n pg.font.init()\n font_surface = utils.generate_mine_text(1)\n self.assertIsInstance(font_surface, pg.Surface)", "def test_gameAddText(self):\n ...
[ "0.6388988", "0.59385103", "0.5931025", "0.5791703", "0.57001746", "0.5595606", "0.5564164", "0.55368245", "0.5527248", "0.5493804", "0.54809046", "0.5429338", "0.5343724", "0.53400725", "0.53017783", "0.5292878", "0.5261921", "0.5240859", "0.5239271", "0.52359575", "0.522805...
0.7963431
0
Asserts that the layer's graphic is at the expected coordinates.
def assert_layer_graphic_position(self): expected_x = self.offset_x + self.viewport.x expected_y = self.offset_y + self.viewport.y graphic = self.layer.graphic self.assertEqual(graphic.x, expected_x, "x of layer graphic is %s, should be %s." % (graphic.x, expected_x)) self.assertEqual(graphic.y, expected_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_game_over_coordinates(self):\n pg.font.init()\n font = utils.FONT.render(\"test\", True, utils.FONT_COLOUR)\n game_over_coords = utils.game_over_coords(font)\n self.assertIsInstance(game_over_coords, pg.Rect)", "def test_layer_ok(self):\n self.assertTrue(self.vector)",...
[ "0.6886318", "0.6400074", "0.61993706", "0.6192627", "0.61068124", "0.6041083", "0.6019883", "0.6003798", "0.59852034", "0.59708446", "0.5953457", "0.594311", "0.59375787", "0.5932929", "0.58274615", "0.58258504", "0.5810158", "0.5809842", "0.57834", "0.57723904", "0.57717806...
0.87353176
0
Delegates user input to the handling function when activated.
def handleForever(self): self._logger.info("Starting to handle conversation with keyword '%s'.", self.persona) while True: # Print notifications until empty notifications = self.notifier.getAllNotifications() for notif in notifications: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_input(self, event):\n pass", "def install_handle_input(self):\n pass", "def handle_inputs(self):\n user_input = \"\"\n while user_input != \"exit\":\n self.print_divider()\n user_input = input()\n self.do_action_for_input(user_input)", "...
[ "0.72647256", "0.7187669", "0.68825173", "0.65996367", "0.65698135", "0.6506021", "0.6504362", "0.6443073", "0.6431098", "0.6333757", "0.6307175", "0.6221088", "0.6143257", "0.6126705", "0.6095621", "0.6084434", "0.6000683", "0.59981483", "0.5921418", "0.590317", "0.589731", ...
0.0
-1
Performs a batch normalization followed by a ReLU.
def batch_norm_relu(inputs, is_training, relu=True, init_zero=False, data_format='channels_first'): if init_zero: gamma_initializer = tf.zeros_initializer() else: gamma_initializer = tf.ones_initializer() if data_format == 'c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_normalization(input_var=None):\n\n # Hyperparameters\n hp = Hyperparameters()\n hp('batch_size', 30)\n hp('n_epochs', 1000)\n hp('learning_rate', 0.01)\n hp('l1_reg', 0.00)\n hp('l2_reg', 0.0001)\n hp('patience', 5000)\n\n # Create connected layers\n # Input layer\n l_in ...
[ "0.692773", "0.6830901", "0.6740521", "0.6675622", "0.6608609", "0.65809447", "0.6534637", "0.652944", "0.64998734", "0.64971787", "0.6481464", "0.6394366", "0.6381936", "0.63704985", "0.6360569", "0.63473797", "0.63164675", "0.6280415", "0.62686515", "0.62644416", "0.6252339...
0.6519259
8
Pads inputs w.r.t. data format.
def _padding(inputs, paddings, data_format): if data_format == 'channels_first': padded_inputs = tf.pad( inputs, [[0, 0], [0, 0], paddings, paddings]) else: padded_inputs = tf.pad( inputs, [[0, 0], paddings, paddings, [0, 0]]) return padded_inputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_dataset(dataset, padding=0):\n max_l = max(len(x) for x in dataset[\"input_ids\"])\n for name in PADDED_INPUTS:\n dataset[name] = [x + [padding if name != \"lm_labels\" else -100] * (max_l - len(x)) for x in dataset[name]]\n return dataset", "def pad(data, *args, **kwargs): # pragma: no ...
[ "0.6714534", "0.65620893", "0.63622624", "0.6301816", "0.6300907", "0.62297213", "0.6203088", "0.61806923", "0.61762965", "0.6154326", "0.61143845", "0.60824525", "0.604327", "0.60138506", "0.5969655", "0.5911536", "0.5877184", "0.5751767", "0.5698976", "0.5692566", "0.564209...
0.62052333
6
Pads the input along the spatial dimensions independently of input size.
def fixed_padding(inputs, kernel_size, data_format='channels_last'): pad_total = kernel_size - 1 pad_beg = pad_total // 2 pad_end = pad_total - pad_beg return _padding(inputs, (pad_beg, pad_end), data_format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:, -size[0]:, :, :], M1, M1[:, 0:size[0], :, :]], 1)\n return M1", "def pad_spatial(self, x):\n n, t, c, h, w = x.size()\n\n pad_h = (4 - h % 4) % 4\n p...
[ "0.7338553", "0.6975063", "0.6685168", "0.6617578", "0.6493419", "0.6390938", "0.63418573", "0.6319363", "0.6297954", "0.62938833", "0.6280606", "0.6108473", "0.6040027", "0.59399575", "0.5939143", "0.59307957", "0.593072", "0.5904553", "0.58525276", "0.5831835", "0.5822233",...
0.56921554
29
Pads the input along the spatial dimensions independently of input size.
def space_to_depth_fixed_padding(inputs, kernel_size, data_format='channels_last', block_size=2): pad_total = kernel_size - 1 pad_beg = (pad_total // 2 + 1) // block_size pad_end = (pad_total // 2) // block_size return _padding(inputs, (pad_beg, pad_end), data_format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_pad(input, size):\n M1 = tf.concat([input[:, :, -size[1]:, :], input, input[:, :, 0:size[1], :]], 2)\n M1 = tf.concat([M1[:, -size[0]:, :, :], M1, M1[:, 0:size[0], :, :]], 1)\n return M1", "def pad_spatial(self, x):\n n, t, c, h, w = x.size()\n\n pad_h = (4 - h % 4) % 4\n p...
[ "0.7338553", "0.6975063", "0.6685168", "0.6617578", "0.6493419", "0.6390938", "0.63418573", "0.6319363", "0.6297954", "0.62938833", "0.6280606", "0.6108473", "0.6040027", "0.59399575", "0.5939143", "0.59307957", "0.593072", "0.5904553", "0.58525276", "0.5831835", "0.5822233",...
0.0
-1
Fuses spacetodepth and transpose. Spacetodepth performs the following permutation, which is equivalent to tf.nn.space_to_depth. As spacetodepth has an implicitly transpose, input transpose is fused into spacetodepth transform. images = tf.reshape(images, [batch, h // block_size, block_size, w // block_size, block_size,...
def fused_transpose_and_space_to_depth( images, block_size=2, transpose_input=True): batch_size, h, w, c = images.get_shape().as_list() if block_size != 0: images = tf.reshape(images, [batch_size, h // block_size, block_size, w // block_size, block_size, c]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_conv2d_transpose(g, op, block):\n\n dilations = op.attr(\"dilations\")\n groups = op.attr(\"groups\")\n paddings = op.attr(\"paddings\")\n padding_algorithm = op.attr(\"padding_algorithm\")\n strides = op.attr(\"strides\")\n output_padding = op.attr(\"output_padding\") if op.attr(\"ou...
[ "0.6252821", "0.6187393", "0.6059542", "0.60442156", "0.60276586", "0.60033554", "0.5998148", "0.59918356", "0.5949912", "0.5934507", "0.5899734", "0.5860573", "0.58351976", "0.5719159", "0.570773", "0.56841886", "0.5680008", "0.56749076", "0.56631535", "0.5646647", "0.563803...
0.7638583
0
Strided 2D convolution with explicit padding. The padding is consistent and is based only on `kernel_size`, not on the dimensions of `inputs` (as opposed to using `tf.layers.conv2d` alone).
def conv2d_fixed_padding(inputs, filters, kernel_size, strides, data_format='channels_first'): if strides > 1: inputs = fixed_padding(inputs, kernel_size, data_format=data_format) outputs = tf.layers.conv2d( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2d_fixed_padding(inputs, filters, kernel_size, strides, data_format):\n # The padding is consistent and is based only on `kernel_size`, not on the\n # dimensions of `inputs` (as opposed to using `tf.layers.conv2d` alone).\n if strides > 1:\n inputs = fixed_padding(inputs, kernel_size, data_format)\n\...
[ "0.7897865", "0.78809714", "0.78273654", "0.7678087", "0.7575362", "0.7527666", "0.7510199", "0.7343924", "0.733184", "0.72405255", "0.7214543", "0.7163506", "0.7088934", "0.706851", "0.6946939", "0.6916445", "0.69016784", "0.68804586", "0.68630147", "0.6833584", "0.6829672",...
0.793444
0
Standard building block for residual networks with BN after convolutions.
def residual_block(inputs, filters, is_training, strides, use_projection=False, data_format='channels_first'): shortcut = inputs if use_projection: # Projection shortcut in first layer to match filters and strides shortcut = conv2d_fixed_padding( inputs=inputs, filters=fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_resnet(self):\r\n\r\n # INPUTS\r\n inputs_data = Input((self.data_rows, self.data_cols, 1),name='inputs_data')\r\n\r\n\r\n def residual_block(input, output_channels=64, kernel_size=(3, 3), stride=(1, 1)):\r\n x = Conv2D(output_channels, kernel_size, padding='same', strides...
[ "0.6761057", "0.6718992", "0.65846515", "0.65790915", "0.649853", "0.64868796", "0.64450806", "0.64450806", "0.6441736", "0.6411527", "0.64062256", "0.6399525", "0.63963383", "0.63919085", "0.6371196", "0.63613915", "0.62739086", "0.62727815", "0.6233148", "0.623134", "0.6202...
0.0
-1
Bottleneck block variant for residual networks with BN after convolutions.
def bottleneck_block(inputs, filters, is_training, strides, use_projection=False, data_format='channels_first'): shortcut = inputs if use_projection: # Projection shortcut only in first block within a group. Bottleneck blocks # end with 4 times the number of filters. filters_out = 4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet50_base(freeze_blocks=[1,2,3], weight_regularizer=None, bias_regularizer=None):\n img_input = Input(shape=(None, None, 3))\n bn_axis = 3\n train1 = 1 not in freeze_blocks\n x = Conv2D(64, (7, 7), strides=(2, 2), padding='same', name='conv1', trainable=train1,\n kernel_regularizer=weigh...
[ "0.67967707", "0.6790556", "0.67886436", "0.6717657", "0.65665877", "0.6537484", "0.6519858", "0.65195817", "0.6465134", "0.64170057", "0.64149576", "0.63950753", "0.63930964", "0.6377483", "0.6363764", "0.63319874", "0.6259834", "0.6256376", "0.62512606", "0.62451756", "0.62...
0.57658273
78
Creates one group of blocks for the ResNet model.
def block_group(inputs, filters, block_fn, blocks, strides, is_training, name, data_format='channels_first'): # Only the first block per block_group uses projection shortcut and strides. inputs = block_fn(inputs, filters, is_training, strides, use_projection=True, data_format=dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_new_block(self):\n block = BasicBlock()\n self.blocks.append(block)\n return block", "def _make_layer(self, X, name, block, num_blocks, out_channels):\n\n for i in range(0, num_blocks):\n X = block(X, name = name + '_block{}'.format(i), out_channels=out_channels)\n ...
[ "0.6954946", "0.65904", "0.6526099", "0.6515287", "0.6488976", "0.63835907", "0.6347426", "0.62397134", "0.62314355", "0.6205652", "0.6190623", "0.61754125", "0.6172874", "0.6130437", "0.6098664", "0.60650057", "0.6059756", "0.60370356", "0.60317415", "0.6030886", "0.6020759"...
0.5980943
22
Transforms the convolution kernel for spacetodepth computation. This function transforms the kernel for spacetodepth convolution. For example, the kernel size is [7, 7, 3, 64] (conv0 in ResNet), and the block_size is 2. First the kernel is padded with (top and left) zeros to [8, 8, 3, 64]. Then, it is transformed to [4...
def transform_space_to_depth_kernel(kernel, dtype, block_size=2): def _round_up(num, multiple): remainder = num % multiple if remainder == 0: return num else: return num + multiple - remainder h, w, in_d, out_d = kernel.get_shape().as_list() pad_h = _round_up(h, block_size) - h pad_w = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_conv2d(g, op, block):\n\n dilations = op.attr(\"dilations\")\n groups = op.attr(\"groups\")\n paddings = op.attr(\"paddings\")\n padding_algorithm = op.attr(\"padding_algorithm\")\n strides = op.attr(\"strides\")\n\n kernel = g.get_node(op.input(\"Filter\")[0])\n input_x = g.get_no...
[ "0.6796937", "0.66202474", "0.65691066", "0.65528923", "0.64849013", "0.643785", "0.6437256", "0.62981987", "0.62667286", "0.6247232", "0.62432134", "0.6236941", "0.6229701", "0.62242377", "0.6193961", "0.61879545", "0.61837673", "0.61757994", "0.6170011", "0.6163105", "0.613...
0.7187211
0
Uses spacetodepth convolution for conv0. This function replaces the first convolution (conv0) in ResNet with spacetodepth transformation. It creates a convolution kernel, whose dimension and name are the same as those of conv0. The `inputs` is an image tensor that already has the spacetodepth transform.
def conv0_space_to_depth(inputs, filters, kernel_size, strides, data_format='channels_last', space_to_depth_block_size=2): if space_to_depth_block_size != 2: raise ValueError('Space-to-depth does not support block_size (%d).' % space_to_depth_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conv2d_layer(self, inputs, filters_num, kernel_size, name, use_bias=False, strides=1):\n if strides > 1: # modified 0327\n inputs = tf.pad(inputs, paddings=[[0, 0], [1, 0], [1, 0], [0, 0]], mode='CONSTANT')\n conv = tf.layers.conv2d(inputs=inputs, filters=filters_num,\n ...
[ "0.6708323", "0.66756195", "0.6621401", "0.6586069", "0.64907104", "0.64795524", "0.6387748", "0.6367544", "0.6344067", "0.6319126", "0.62981534", "0.62717414", "0.62711716", "0.6268527", "0.62594", "0.6196591", "0.6192265", "0.61805904", "0.61562115", "0.61560106", "0.614476...
0.66131324
3
Generator for ResNet v1 models.
def resnet_v1_generator(block_fn, layers, num_classes, data_format='channels_first', conv0_kernel_size=7, space_to_depth_block_size=0): def model(inputs, is_training): """Creation of the model graph.""" if space_to_depth_block_size != 0: # conv0 uses space...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet():\n return models.resnet152(pretrained=True)", "def resnet46(pretrained=False):\n model = ResNet(BasicBlock, [3, 6, 10, 3])\n if pretrained:\n pass\n #model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n return model", "def resnet10(**kwargs):\n model = R...
[ "0.6477364", "0.5927687", "0.5920352", "0.58649075", "0.58071506", "0.579971", "0.57836306", "0.57792336", "0.57619435", "0.5743424", "0.5732439", "0.57324135", "0.57249564", "0.57208186", "0.57071954", "0.57071954", "0.56922096", "0.5672616", "0.5654497", "0.56540555", "0.56...
0.5432183
62
Creation of the model graph.
def model(inputs, is_training): if space_to_depth_block_size != 0: # conv0 uses space-to-depth transform for TPU performance. inputs = conv0_space_to_depth( inputs=inputs, filters=64, kernel_size=conv0_kernel_size, strides=2, data_format=data_format, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create_recurrent_layers()\n\t\tself._create_de_embedding()\n\t\tself._create_loss()\n\t\tself._create_optimizer()\n\t\tself._create_summaries()", "def build_graph(self):\n self.__create_placeholders()\n ...
[ "0.7939871", "0.7903479", "0.76862854", "0.7662326", "0.76437825", "0.752375", "0.74270034", "0.74230933", "0.73559767", "0.7346491", "0.7346491", "0.7310608", "0.72618264", "0.7238236", "0.7205029", "0.7205029", "0.71261346", "0.7120608", "0.7120411", "0.706077", "0.7048368"...
0.0
-1
Returns the ResNet model for a given size and number of output classes.
def resnet_v1(resnet_depth, num_classes, data_format='channels_first', conv0_kernel_size=7, conv0_space_to_depth_block_size=0): model_params = { 18: {'block': residual_block, 'layers': [2, 2, 2, 2]}, 34: {'block': residual_block, 'layers': [3, 4, 6, 3]}, 50: {'block': bottleneck_block,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(model, method, num_classes, insize):\n\n if model in ['wrn', 'r50', 'r101','r110', 'r152', 'r32', 'r18', 'r56', 'r20']:\n net = get_resnet_model(model, method, num_classes, insize)\n elif model in ['r164']:\n net = get_network_slimming_model(method, num_classes)\n elif model in...
[ "0.7139012", "0.6874386", "0.6863167", "0.6748865", "0.6748865", "0.6732016", "0.66270846", "0.65792286", "0.6578705", "0.6546086", "0.6498878", "0.6487927", "0.6482792", "0.6482792", "0.64242315", "0.64242315", "0.6388637", "0.6351621", "0.63336664", "0.6325872", "0.6311921"...
0.0
-1
Prints a chain iterating its headers
def print_headers(headers_map, fork=False): print("\nHeaders") for header_hash in list(headers_map.keys()): header = headers_map[header_hash] if fork and header.hashMerkleRoot != b"\xcc" * 32: continue print("header hash:\t\t", header.GetHash().hex()) print() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_subheaders(self):\n for subheader in self.subheaders:\n print(subheader)", "def printme(self):\n sys.stdout.write(self._header)\n for k in range(len(self)):\n sys.stdout.write(self.line(k))", "def get_headers_for_print(self):\n lines_for_print = []\n ...
[ "0.65482354", "0.64316934", "0.6394731", "0.6159447", "0.6078206", "0.60606414", "0.60512024", "0.6042295", "0.6005242", "0.59862447", "0.58384", "0.5827246", "0.57998735", "0.57509196", "0.5744481", "0.5736322", "0.57327485", "0.5727085", "0.5698431", "0.5691338", "0.569043"...
0.6886069
0
Print the interlinks of the blocks of a chain
def print_interlinks(headers_map, interlink_map): print("\nInterlinks") for i in interlink_map.keys(): print("Key:", i.hex()[:6], "| Level:", int(headers_map[i].compute_level())) print_tuple(interlink_map[i]) print("+" * 32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_paths_between_yields(paths): # pragma: no cover\n from graphviz import Digraph\n dot = Digraph(name=\"top\")\n for i, path in enumerate(paths):\n prev = None\n for block in path:\n if isinstance(block, Branch):\n label = \"if \" + astor.to_source(block.c...
[ "0.6082883", "0.5979062", "0.59749126", "0.59170777", "0.5899505", "0.5830778", "0.5731966", "0.5722667", "0.56706434", "0.5669561", "0.5637989", "0.5628519", "0.56036234", "0.5600618", "0.5568108", "0.5546844", "0.5495533", "0.54540217", "0.5449112", "0.5428345", "0.54201317...
0.6727348
0
indices seem different than below because element is a hex string, not a byte array
def print_proof_element(element): print("Prev header:\t", element[0:64]) # print('Version:\t', element[ 64: 66]) # print('Something:\t', element[ 66: 72]) print("Interlink hash:\t", element[72:136]) print("Merkle root:\t", element[136:200]) # print('Time:\t\t', element[200:2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_byte_array_conversion():\n ob = ConversionTest()\n\n assert ob.ByteArrayField is None\n\n ob.ByteArrayField = [0, 1, 2, 3, 4]\n array = ob.ByteArrayField\n assert len(array) == 5\n assert array[0] == 0\n assert array[4] == 4\n\n value = b\"testing\"\n ob.ByteArrayField = value\n...
[ "0.61879593", "0.6169586", "0.5947031", "0.5947031", "0.5886045", "0.5635032", "0.56292176", "0.5617642", "0.56158674", "0.5572353", "0.55332905", "0.5514198", "0.5507884", "0.5505075", "0.5501913", "0.5480814", "0.5480478", "0.5449285", "0.5448715", "0.5439642", "0.54233086"...
0.0
-1
Removes the genesis block of the proof
def remove_genesis(proof): old_size = len(proof) print("Removing genesis block from proof ...") proof.pop(-1) print("OK") print("old size:", old_size, "-> new size:", len(proof))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_block(self, block):\n raise NotImplementedError()", "def remove_from_block(self):\n self.enclosing_block.remove_ops([self])", "def delete_block(self, block):\n raise NotImplementedError('delete_block')", "def remove(self, block):\n try:\n self.blocks[block.he...
[ "0.6290408", "0.5996669", "0.59115857", "0.5884244", "0.5854443", "0.58376217", "0.58081526", "0.57852006", "0.57547975", "0.5726658", "0.56836265", "0.5676911", "0.5623997", "0.5612229", "0.5596398", "0.55962217", "0.55749035", "0.5566368", "0.5550208", "0.5549425", "0.55247...
0.8608646
0
Changes a specific byte in a byte array
def swap_byte(byte_array, index): if byte_array[index] == 0: changed_byte_array = byte_array[0:index] + b"\xff" + byte_array[index + 1 :] changed_byte_array = byte_array[0:index] + b"\x00" + byte_array[index + 1 :] return changed_byte_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bit(self, index_of_byte, index_of_bit, new_value):\n if index_of_bit >= self.binary_size:\n print(\"You tried to modify a byte at %d index. This cannot be done. The maximum index is %d.\"%(index_of_bit, self.binary_size - 1))\n else:\n new_value = str(new_value)\n ...
[ "0.7607034", "0.7187944", "0.6851375", "0.6837722", "0.6780952", "0.6729589", "0.6723024", "0.6679319", "0.64730704", "0.6376428", "0.6333384", "0.62949824", "0.62935746", "0.6257262", "0.6237112", "0.6162971", "0.6119067", "0.6108211", "0.61019486", "0.609579", "0.5928492", ...
0.7412648
1
Changes the interlink hash in a block hash Each block is represented with a 112 bytes hash.
def change_interlink_hash(proof, block_index): block_of_interest = proof[block_index][0] changed_block = swap_byte(block_of_interest, 0) changed_proof = ( proof[0:block_index] + [(changed_block, proof[block_index][1])] + proof[block_index + 1 :] ) return changed_proof
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_block(self):\n sha = hasher.sha256()\n sha.update((str(self.index) + str(self.timestamp) + str(self.data) + str(self.previous_hash)).endswith('utf-8'))\n return sha.hexdigest()", "def hash(self, hash):\n\n self._hash = hash", "def hash(self, hash):\n\n self._hash = h...
[ "0.6883189", "0.67876226", "0.67876226", "0.67761916", "0.67401713", "0.65702283", "0.65575254", "0.64846873", "0.6470802", "0.64679575", "0.6459402", "0.64477664", "0.6369744", "0.6369744", "0.6367037", "0.6361284", "0.6347822", "0.6322299", "0.6299315", "0.6297634", "0.6277...
0.6925265
0
Deletes a number of blocks from the proof starting from block_index
def skip_blocks(proof, block_index, skipped_blocks=1): if block_index >= len(proof): return proof for i in range(block_index, block_index + skipped_blocks): print("Deleting block", i) del proof[i] return proof
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __delitem__(self, index):\n def _removeBlock(blockIndex):\n block = self._doc.findBlockByNumber(blockIndex)\n if block.next().isValid(): # not the last\n cursor = QTextCursor(block)\n cursor.movePosition(QTextCursor.NextBlock, QTextCursor.KeepAnchor)\...
[ "0.71626973", "0.68964684", "0.62942344", "0.625104", "0.6132582", "0.60548794", "0.6051101", "0.6042633", "0.6016819", "0.59291697", "0.5908609", "0.5838923", "0.58307886", "0.5816913", "0.581112", "0.5768777", "0.5763255", "0.5763255", "0.5733283", "0.5707062", "0.5648815",...
0.8000275
0
Replaces a block in the proof. The new block has the same interlink but different header hash
def replace_block(proof, headers_map, interlink_map, block_index): prevous_block = proof[block_index - 1][0] block_hash = prevous_block[36:68] block = headers_map[block_hash] interlink = list_flatten(interlink_map[block.GetHash()]) block_2 = mine_block( block.hashPrevBlock, block.nBits - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_interlink_hash(proof, block_index):\n\n block_of_interest = proof[block_index][0]\n changed_block = swap_byte(block_of_interest, 0)\n changed_proof = (\n proof[0:block_index]\n + [(changed_block, proof[block_index][1])]\n + proof[block_index + 1 :]\n )\n return change...
[ "0.6696862", "0.6492034", "0.62668824", "0.62506884", "0.62480694", "0.6142988", "0.61030936", "0.6102814", "0.6081092", "0.6058437", "0.6036382", "0.6030431", "0.60070413", "0.5958737", "0.5852314", "0.58496255", "0.5832161", "0.5744932", "0.57379293", "0.5737272", "0.572282...
0.8152844
0
Create, edit and print chains and proofs
def main(): parser = argparse.ArgumentParser(description="Prints the contents of a NiPoPoW") parser.add_argument("--blocks", required=True, type=int, help="Number of blocks") parser.add_argument( "--output", default="proof.pkl", type=str, help="Name of exported proof" ) args = parser.parse_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n parser = argparse.ArgumentParser(\n description=\"Create and store proof from create_blockchain_new.py\"\n )\n group = parser.add_mutually_exclusive_group()\n group.add_argument(\"--blocks\", type=int, help=\"Number of blocks\")\n group.add_argument(\"--proof\", type=str, help...
[ "0.6269092", "0.593019", "0.5699991", "0.566571", "0.558477", "0.5554511", "0.5437828", "0.53985196", "0.5362294", "0.53594774", "0.5350961", "0.5350664", "0.5346109", "0.53326225", "0.5318476", "0.5311653", "0.53101516", "0.5306257", "0.5296305", "0.52940077", "0.529166", ...
0.68124014
0
Compute the structure factor through a fourier transform of the radial distribution function. The consdered trajectory must include valid elements. Atomic form factors are estimated by atomic number. The computed structure factor is only valid for certain values of Q. The lowest value of Q that can sufficiently be desc...
def structure_factor(trj, Q_range=(0.5, 50), n_points=1000, framewise_rdf=False, weighting_factor='fz'): if weighting_factor not in ['fz']: raise ValueError('Invalid weighting_factor `{}` is given.' ' The only weighting_factor currently supported is `fz`.'.format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StructureFactor(ID,f,hkl,z=None):\n ID=goodID(ID)\n i=complex(0,1)\n h=hkl[0]\n k=hkl[1]\n l=hkl[2]\n L=latticeType[ID]\n if L=='fcc':\n F=f*(1+np.exp(-i*np.pi*(k+l))+np.exp(-i*np.pi*(h+l))+np.exp(-i*np.pi*(h+k)))\n elif L=='bcc':\n F=f*(1+np.exp(-i*np.pi*(h+k+l))) \n elif...
[ "0.61005145", "0.5547126", "0.5504173", "0.54883736", "0.53962797", "0.5384088", "0.5333023", "0.5327243", "0.52803975", "0.52569383", "0.5241156", "0.52071124", "0.51957417", "0.5193955", "0.5186578", "0.51780033", "0.51702636", "0.51467496", "0.51093566", "0.5086104", "0.50...
0.62520516
0
Compute r_ij(t), the distance between atom j at time t and atom i and time 0. Note that this alone is likely useless, but is an intermediate variable in the construction of a dynamic structure factor. See 10.1103/PhysRevE.59.623.
def compute_dynamic_rdf(trj): n_atoms = trj.n_atoms n_frames = trj.n_frames r_ij = np.ndarray(shape=(trj.n_atoms, trj.n_atoms, trj.n_frames)) for n_frame, frame in enumerate(trj): for atom_i in range(trj.n_atoms): for atom_j in range(trj.n_atoms): r_ij[atom_i, atom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(ri, rj):\n return abs(ri[0] - rj[0]) + abs(ri[1] - rj[1])", "def r(self, t):\n from scipy.optimize import fsolve\n t = YEAR_TO_SEC * t\n t_coll = fsolve(lambda x: self.r_free(x) - self.snr.r_reverse(x), 4e3)\n # 4e3 years is a typical value that works for fsolve\n ...
[ "0.5410007", "0.52558136", "0.52129275", "0.51934403", "0.5120384", "0.50158536", "0.49003237", "0.48539624", "0.48512992", "0.4837882", "0.48160997", "0.4813014", "0.48086157", "0.48014414", "0.47951403", "0.47862214", "0.47764075", "0.47283062", "0.47244427", "0.47240275", ...
0.60190296
0
This function is called to check if a username / password combination is valid.
def check_auth(username, password): ADMIN_USER = config.CONFIG_VARS['ADMIN_USER'] ADMIN_PASS = config.CONFIG_VARS['ADMIN_PASS'] return username == ADMIN_USER and password == ADMIN_PASS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth(username, password, expected_user, expected_pw):\n return username == expected_user and password == expected_pw", "def validate_authentication(self, username, password):\n return self.user_table[username]['pwd'] == password", "def check_auth(username, password):\n return usernam...
[ "0.8221681", "0.81452113", "0.79765403", "0.79615504", "0.788556", "0.78595155", "0.7838946", "0.78279626", "0.7815743", "0.77989453", "0.7786234", "0.7770711", "0.7761279", "0.77546805", "0.7753378", "0.7752181", "0.77496976", "0.7731222", "0.77148515", "0.76884216", "0.7686...
0.7653261
27
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Could not verify your credentials for that url', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})", "def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )", "def authenticate():\n return Response(\n 'You have to login with pro...
[ "0.8093736", "0.80926424", "0.7958403", "0.7852648", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", ...
0.7843114
4
Moler class of Unix command mount.
def __init__(self, connection, options=None, device=None, directory=None, prompt=None, newline_chars=None, runner=None): super(Mount, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mount(self):\n return self._mount", "def mount(self, mount):\n assert mount in (ComponentBase.MOUNTS)\n if mount==self.MOUNT_HYB:\n raise Exception(\"Unsupported mount.\")\n self._mount = mount\n self._check_mount()", "def testMountCommand(self):\n with self.assertRaises(FilePath...
[ "0.68459976", "0.6746837", "0.66094476", "0.65165293", "0.6478037", "0.63636965", "0.63398814", "0.6326575", "0.6229015", "0.61068434", "0.6089923", "0.6050603", "0.60273486", "0.60215586", "0.601697", "0.6004157", "0.5968393", "0.59526014", "0.59160775", "0.59134746", "0.587...
0.667246
2
Read examples from path.
def _read_examples(self, train_test_val_split, path): train_examples = [] eval_examples = [] test_examples = [] with genomics_reader.TFRecordReader( ngs_errors.get_train_filename(path), proto=example_pb2.Example) as fin: train_examples = list(fin) with genomics_reader.TFRecordReader( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_examples(path: str) -> List['InputExample']:\n with open(path, 'rb') as fh:\n return pickle.load(fh)", "def load_examples(path: str) -> List['InputExample']:\n with open(path, 'rb') as fh:\n return pickle.load(fh)", "def load_examples(path: str) -> List['InputExampl...
[ "0.7140732", "0.7140732", "0.7140732", "0.70798475", "0.7010377", "0.6614629", "0.6553155", "0.65470684", "0.6530755", "0.65236205", "0.6338437", "0.6306377", "0.6261953", "0.6246576", "0.61261564", "0.61261564", "0.61261564", "0.61261564", "0.61261564", "0.61261564", "0.6126...
0.62074655
14
render the content for the graph container
def render_content(self, request, tag): if self.showreel_document is not None: graph_row_xml = XMLString(self.get_content_xml()) return graph_row_xml.load() else: oops_container = self.get_bad_container() return oops_container.load()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphs():\n return render_template(\"graphs.html\")", "def get_content_render(fig, index: int, content: str = ''):\n # returns a html tag\n return html.Div([\n dcc.Graph(id=f'graph_{graph_nr[index]}', figure=fig),\n html.H3(content),\n ], style={'font-family': 'Helvetica',\n ...
[ "0.7299308", "0.71782285", "0.68271524", "0.6663665", "0.664291", "0.6620926", "0.6457115", "0.6414615", "0.6356832", "0.6356767", "0.63431394", "0.63144624", "0.6310719", "0.6260441", "0.6242107", "0.6227696", "0.6209762", "0.6199873", "0.6185111", "0.61758035", "0.61743957"...
0.6722177
3
something has gone wrong that causes the page not to render correctly return some xml to respond to this
def get_bad_container(self): return XMLFile( FilePath("TrackerDash/snippets/no_dash_data_container.xml"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml():\n try:\n return Response(render_template(\n 'lti.xml.j2'), mimetype='application/xml'\n )\n except:\n app.logger.error(\"Error with XML.\")\n return return_error('''Error with XML. Please refresh and try again. If this error persists,\n please cont...
[ "0.6696877", "0.6493592", "0.6273593", "0.6260683", "0.6117754", "0.60652006", "0.60274285", "0.60092545", "0.5996741", "0.59941775", "0.58831203", "0.5871651", "0.58566284", "0.58541214", "0.57838386", "0.5783325", "0.576661", "0.57623935", "0.5737121", "0.5731637", "0.57185...
0.0
-1
get the showreel item url array
def get_showreel_item_urls(self): links = [] rel_path = "../" if self.display: rel_path = rel_path * 2 for item in self.showreel_document["reels"]: if item["item_type"] == 'dashboard': link = "../%sdisplay/dashboard/%s" % (rel_path, item["title"])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def url(self):\n return url_for_item(self.key)", "def url(self):\n return url_for_item(self.key)", "def url(self, index):\r\n return self.arraydata[index.row()][3]", "def get_item_url(self, item):\n return self.get_absolute_url(item, 'detail')", "def get_url(...
[ "0.6485568", "0.645834", "0.645834", "0.6320854", "0.6319648", "0.63013756", "0.6289393", "0.6228144", "0.6174826", "0.6151455", "0.60874134", "0.5989771", "0.59726894", "0.59524935", "0.5925669", "0.59131056", "0.5910598", "0.58754987", "0.58629525", "0.5838614", "0.58370227...
0.8105406
0
We ask for owners as email addresses but LDAP needs the DN for the appropriate object
def process_group_owners(data): owner_list = [] owners = data.split("\r\n") for owner in owners: if owner != "": result = shared_ldap.find_from_email(owner) if result is None: shared_sd.post_comment( "Unable to add %s as an owner as the ema...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_empty_owners():\n result = shared_ldap.find_from_email(shared.globals.REPORTER)\n if result is not None:\n shared_sd.post_comment(\n \"Adding %s as the owner of the group.\" % shared.globals.REPORTER, True)\n return [result]\n\n # OK - something stupid is happening but ...
[ "0.6519693", "0.6108533", "0.601819", "0.5960598", "0.59551305", "0.5824557", "0.5728829", "0.5621332", "0.55355567", "0.5514881", "0.5485151", "0.5441718", "0.54410255", "0.5418896", "0.54182565", "0.54131806", "0.53478324", "0.5340073", "0.5334549", "0.5328107", "0.53239036...
0.60889524
2
Try to add the reporter as a fallback owner or if no alternative owners have been specified. This should work since only employees are allowed to use this request type and all employees are in LDAP.
def handle_empty_owners(): result = shared_ldap.find_from_email(shared.globals.REPORTER) if result is not None: shared_sd.post_comment( "Adding %s as the owner of the group." % shared.globals.REPORTER, True) return [result] # OK - something stupid is happening but let's give our...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user(self, requestor, requestee, default=None):\n self.lock.acquire()\n self.users.add(requestor)\n ok = requestee in self.users\n self.lock.release()\n\n # if this isn't the default app, also add the user to the default app\n if default != self and default != No...
[ "0.5346557", "0.5095638", "0.50383765", "0.5028467", "0.48953253", "0.48707283", "0.4851011", "0.48406032", "0.48377118", "0.48243517", "0.48027915", "0.4784198", "0.47707832", "0.47077477", "0.46895742", "0.46746963", "0.46505794", "0.46497324", "0.4624019", "0.46179965", "0...
0.63934386
0
Performs the designed action, based on the logic implemented for this method by all the classes that subclass this one, and overrides this method
def play(self, rumble, **kwargs) -> Any: pass # abstract methods does not provides an implementation in Python
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_action(self):\n pass", "def _do_action(self):\n pass", "def act(self):\n raise NotImplementedError", "def _action(self):\n pass", "def action(self):\n pass", "def action(self):\n pass", "def act(self):\n pass", "def perform(self):\n pass...
[ "0.76621544", "0.76621544", "0.7254013", "0.71458393", "0.7133721", "0.7133721", "0.7113193", "0.70026004", "0.69369143", "0.6874843", "0.6846552", "0.673988", "0.673988", "0.6686165", "0.6655994", "0.6655625", "0.660916", "0.65968966", "0.65783566", "0.65521324", "0.65328544...
0.0
-1
From the start node assign registers as they are laid out in the ideal circuit diagram in [CDKM96]_. Assumes that the there are no dead ends in the graph, and any available neighbor can be selected from the start without any further checks.
def assign_registers_to_line_or_cycle(start: int, graph: nx.Graph, num_length: int) \ -> Tuple[Sequence[int], Sequence[int], int, int]: if 2 * num_length + 2 > nx.number_of_nodes(graph): raise ValueError("There are not enough qubits in the graph to support the computation.") graph = graph.copy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign(self, starts):\n # Initialize the set of open and closed nodes, and the connection map\n open_set, closed_set = starts, set()\n \n # Initialize a map of assignments and associated profits\n profits = {s:0 for s in starts}\n \n while open_set:\n\n ...
[ "0.62554306", "0.5982689", "0.5950736", "0.5790706", "0.5765575", "0.5628461", "0.5544183", "0.55432373", "0.55188954", "0.550841", "0.54753715", "0.5472471", "0.5345496", "0.5322016", "0.53219366", "0.5297514", "0.5297507", "0.5270394", "0.52688956", "0.5244919", "0.52377003...
0.6497673
0
Searches for a layout among the given qubits for the two nbit registers and two additional ancilla that matches the simple layout given in figure 4 of [CDKM96]_. This method ignores any considerations of physical characteristics of the qc aside from the qubit layout. An error is thrown if the appropriate layout is not ...
def get_qubit_registers_for_adder(qc: QuantumComputer, num_length: int, qubits: Optional[Sequence[int]] = None)\ -> Tuple[Sequence[int], Sequence[int], int, int]: if qubits is None: unavailable = [] # assume this means all qubits in qc are available else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_mapping_consistency(layout):\n values = sorted(layout.values())\n keys = list(layout)\n ref_keys = [\"q\" + str(i) for i in range(len(keys))]\n if keys != ref_keys:\n raise PlacementError(\"Some physical qubits in the layout may be missing or duplicated.\")\n if values != list(rang...
[ "0.49703202", "0.48756662", "0.48414853", "0.46022666", "0.45521045", "0.45476255", "0.44789764", "0.43654552", "0.43505117", "0.4343972", "0.43153837", "0.43040147", "0.43010375", "0.4282951", "0.42795786", "0.4265875", "0.42644864", "0.42477572", "0.42424133", "0.42418486", ...
0.49284887
1
Produces a program implementing reversible adding on a quantum computer to compute a + b. This implementation is based on [CDKM96]_, which is easy to implement, if not the most efficient. Each register of qubit labels should be provided such that the first qubit in each register is expected to carry the least significa...
def adder(num_a: Sequence[int], num_b: Sequence[int], register_a: Sequence[int], register_b: Sequence[int], carry_ancilla: int, z_ancilla: int, in_x_basis: bool = False, use_param_program: bool = False) -> Program: if len(num_a) != len(num_b): raise ValueError("Numbers being added must b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addition(a, b):\n bina = [int(x) for x in bin(a)[2:]]\n binb = [int(x) for x in bin(b)[2:]]\n while len(bina) >= len(binb):\n binb = [0]+binb\n while len(bina) < len(binb)-1:\n bina = [0]+bina\n bina.reverse()\n binb.reverse()\n n = len(bina)+len(binb)\n na = len(bina)\n ...
[ "0.8332056", "0.7943099", "0.7541027", "0.7422055", "0.72869945", "0.68409365", "0.66323876", "0.657023", "0.6435118", "0.6424183", "0.6408739", "0.63692945", "0.63223016", "0.63202614", "0.63042223", "0.6280893", "0.6249376", "0.62431586", "0.6136598", "0.610853", "0.6102547...
0.7033453
5
Convenient wrapper for collecting the results of addition for every possible pair of n_bits long summands.
def get_n_bit_adder_results(qc: QuantumComputer, n_bits: int, registers: Optional[Tuple[Sequence[int], Sequence[int], int, int]] = None, qubits: Optional[Sequence[int]] = None, in_x_basis: bool = False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BitAdd(m, n, length):\n\n lmax = max(len(m), len(n))\n c = 0\n ml = [0] * (lmax - len(m)) + [int(x) for x in list(m)]\n nl = [0] * (lmax - len(n)) + [int(x) for x in list(n)]\n rl = []\n for i in range(1, lmax+1):\n if ml[-i] + nl[-i] + c == 0:\n rl.insert(0, 0)\n ...
[ "0.639511", "0.63929343", "0.59793633", "0.59044194", "0.5766572", "0.573465", "0.56742185", "0.5659172", "0.5646547", "0.56439763", "0.56177783", "0.5554337", "0.555092", "0.5537357", "0.5496097", "0.549155", "0.5491507", "0.54769105", "0.54585946", "0.54068106", "0.54036504...
0.6577094
0
Get the probability of a successful addition for each possible pair of two n_bit summands from the results output by get_n_bit_adder_results
def get_success_probabilities_from_results(results: Sequence[Sequence[Sequence[int]]]) \ -> Sequence[float]: num_shots = len(results[0]) n_bits = len(results[0][0]) - 1 probabilities = [] # loop over all binary strings of length n_bits for result, bits in zip(results, all_bitstrings(2 * n_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_bit_adder_results(qc: QuantumComputer, n_bits: int,\n registers: Optional[Tuple[Sequence[int], Sequence[int], int,\n int]] = None,\n qubits: Optional[Sequence[int]] = None, in_x_basis: bool = False,...
[ "0.67043245", "0.6088592", "0.6078585", "0.60144264", "0.5993007", "0.59269917", "0.59174794", "0.5848427", "0.58017844", "0.5783029", "0.57710576", "0.57601815", "0.5722196", "0.57119036", "0.5695961", "0.5689013", "0.5688207", "0.56689256", "0.5668077", "0.5657879", "0.5653...
0.6910166
0
Get the distribution of the hamming weight of the error vector (number of bits flipped between output and expected answer) for each possible pair of two n_bit summands using results output by get_n_bit_adder_results
def get_error_hamming_distributions_from_results(results: Sequence[Sequence[Sequence[int]]]) \ -> Sequence[Sequence[float]]: num_shots = len(results[0]) n_bits = len(results[0][0]) - 1 hamming_wt_distrs = [] # loop over all binary strings of length n_bits for result, bits in zip(results, al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_possible_outcomes(m, bits):\n\n # This is filled with loads of dirty binary tricks...You have been warned\n\n size = max(m.shape) # Max of shape to account for bra or ket\n nqubits = int(math.log(size, 2) + .1) # Number of qubits possible\n\n # Make the output states and put in output_matric...
[ "0.616687", "0.588979", "0.5826358", "0.58103514", "0.5805173", "0.5767479", "0.5664263", "0.5663091", "0.5662125", "0.56533957", "0.5645126", "0.56185484", "0.556853", "0.55329996", "0.54994404", "0.5493898", "0.546257", "0.544698", "0.5440642", "0.5435228", "0.5425672", "...
0.70478463
0