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
Get the delta X from a left direction
def test_findXCoordinateFromDirection_left(self): actual_result = rules.findXCoordinateFromDirection(8) expected_result = -2 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left_distance(self):\n return self.x", "def pos_left(self, x=1):\n\n self.x -= x\n return self.pos(self.x, self.y)", "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def get_left(self):\n return -self.l_motor.get()", "def left(self):\n if self.pos >...
[ "0.82075435", "0.79344296", "0.7572694", "0.7388498", "0.735274", "0.731266", "0.731266", "0.7269696", "0.71689415", "0.71689415", "0.7132461", "0.7108066", "0.7085654", "0.70678705", "0.7056366", "0.701981", "0.7010041", "0.69809663", "0.6925751", "0.69125366", "0.69064295",...
0.65682304
37
Handle a bad direction
def test_findXCoordinateFromDirection_bad(self): self.assertRaises(ValueError, rules.findXCoordinateFromDirection, 80)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_direction(direction):\n valid_directions = [\"forwards\", \"backwards\"]\n\n if direction not in valid_directions:\n return f\"`direction` must be one of [{', '.join(valid_directions)}]\"\n\n return False", "def test_findDirection_bad(self):\n startCoordinate = coordinate.Coord...
[ "0.64457107", "0.6431128", "0.59023845", "0.58593196", "0.5857923", "0.58337206", "0.5814574", "0.5794645", "0.57255983", "0.5713911", "0.56316334", "0.56134814", "0.55767596", "0.5555252", "0.5540778", "0.55354196", "0.55186427", "0.5508847", "0.5497151", "0.5490839", "0.548...
0.5892146
3
Get the delta Y from a left direction
def test_findYCoordinateFromDirection_left(self): actual_result = rules.findYCoordinateFromDirection(7) expected_result = 0 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def get_left(self):\n return -self.l_motor.get()", "def pos_down(self, y=1):\n\n self.y += y\n return self.pos(self.x, self.y)", "def upleft(self):\n return Coord([self.x - 1, self.y - 1])", "def __get_y__(se...
[ "0.735407", "0.7098737", "0.69108516", "0.6823766", "0.6746996", "0.6623058", "0.6428845", "0.6383905", "0.6308379", "0.63070005", "0.6301892", "0.6296186", "0.62940204", "0.6260142", "0.6233566", "0.6217046", "0.6187829", "0.61841154", "0.6119185", "0.6114301", "0.61121523",...
0.67268586
5
Get the delta Y from a right direction
def test_findYCoordinateFromDirection_up(self): actual_result = rules.findYCoordinateFromDirection(1) expected_result = 2 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_y__(self):\n return self.Direction['y']", "def calculate_position_y(cls, position_y, direction):\n cls.raise_exception_if_invalid_direction(direction)\n return position_y + cls.DIRECTION_MAPPER[direction][1]", "def getBotRightVelocity(self):\n\t\tif len(self.prevPositions) < 2:\n...
[ "0.7415944", "0.7058163", "0.6893687", "0.6861486", "0.679843", "0.67935485", "0.67726815", "0.6753201", "0.6743264", "0.6693129", "0.6676823", "0.6672408", "0.6672115", "0.6671134", "0.66600674", "0.6654607", "0.6645873", "0.6626593", "0.66253406", "0.6601017", "0.65896916",...
0.6340395
45
Get the delta Y from a left direction
def test_findYCoordinateFromDirection_down(self): actual_result = rules.findYCoordinateFromDirection(4) expected_result = -2 self.assertEqual(actual_result, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downleft(self):\n return Coord([self.x - 1, self.y + 1])", "def get_left(self):\n return -self.l_motor.get()", "def pos_down(self, y=1):\n\n self.y += y\n return self.pos(self.x, self.y)", "def upleft(self):\n return Coord([self.x - 1, self.y - 1])", "def __get_y__(se...
[ "0.735407", "0.7098737", "0.69108516", "0.6823766", "0.6746996", "0.67268586", "0.6623058", "0.6428845", "0.6383905", "0.6308379", "0.63070005", "0.6301892", "0.6296186", "0.62940204", "0.6260142", "0.6233566", "0.6217046", "0.6187829", "0.61841154", "0.6119185", "0.6114301",...
0.59450686
46
Handle a bad direction
def test_findYCoordinateFromDirection_bad(self): self.assertRaises(ValueError, rules.findYCoordinateFromDirection, 80)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_direction(direction):\n valid_directions = [\"forwards\", \"backwards\"]\n\n if direction not in valid_directions:\n return f\"`direction` must be one of [{', '.join(valid_directions)}]\"\n\n return False", "def test_findDirection_bad(self):\n startCoordinate = coordinate.Coord...
[ "0.64457107", "0.6431128", "0.59023845", "0.5892146", "0.58593196", "0.5857923", "0.58337206", "0.5814574", "0.5794645", "0.57255983", "0.5713911", "0.56316334", "0.56134814", "0.55767596", "0.5555252", "0.55354196", "0.55186427", "0.5508847", "0.5497151", "0.5490839", "0.548...
0.5540778
15
Return a dictionary of diffstat information for a diffset.
def diffstats(diffset): counts = diffset.get_total_line_counts() # TODO: Take into account the non raw counts review board might # have to display information about replacement. return { 'insert': counts.get('raw_insert_count', 0), 'delete': counts.get('raw_delete_count', 0), }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diffstat(self):\r\n url = '{0}/diffstat'.format(self.get_url())\r\n request = http.Request('GET', url)\r\n\r\n return request, parsers.parse_json", "def diffstat(self):\n for diffstat in self._get_paged(\"diffstat\"):\n yield DiffStat(diffstat, **self._new_session_args)...
[ "0.70968556", "0.666974", "0.59959733", "0.59312314", "0.5841939", "0.57571334", "0.566059", "0.5640931", "0.563014", "0.5592719", "0.5575118", "0.5567187", "0.5483914", "0.54734266", "0.54181707", "0.5389446", "0.53859234", "0.5384173", "0.53651166", "0.5353329", "0.5309579"...
0.8136382
0
Return a dictionary containing diffstat information. If no rev is provided, use the latest diffset. If the requesting user is the submitter, take any draft diffsets into account.
def get_diffstats(review_request, user, rev=None): # Ensure we're working with the base review request, not a draft. review_request = review_request.get_review_request() if rev is None: # If the user is the submitter we might want to use the draft diffset. draft = review_request.get_draft(u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff(self, rev=None):\r\n args = []\r\n if rev is not None:\r\n args.append(\"-r %d\" % rev)\r\n out = self._authsvn('diff', args)\r\n return out", "def diff(self, revision=None):\n if not revision:\n revision = Revision.latest_revision(self.instance)\...
[ "0.59980303", "0.5838497", "0.5777238", "0.5759859", "0.5542309", "0.5527837", "0.54685724", "0.54519284", "0.5437927", "0.53403556", "0.52737635", "0.524713", "0.52007115", "0.52005863", "0.51799476", "0.51608956", "0.51590776", "0.51563096", "0.5123263", "0.51172936", "0.51...
0.74918723
0
Reserve the origin attribute while getting dummies
def GetDummies(data_set, categorical_features): reserve_name = data_set.name reserve_trn_len = data_set.trn_len data_set = pd.get_dummies(data_set, columns=categorical_features, drop_first=True) data_set.name = reserve_name data_set.trn_len = reserve_trn_len return data_set
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_dummy_obj(self):\n for d in self.dummies:\n self.map.remove_node(d)\n\n self.dummies = []", "def untie_everything(self):\r\n self.tied_indices = []", "def __resetLocal__(self,featureVals):\n self.amITrained = False\n self._amplitudes = {}\n self._eigs ...
[ "0.5686756", "0.5557571", "0.5537352", "0.55227154", "0.54721504", "0.54721504", "0.54721504", "0.5448542", "0.53795433", "0.5373506", "0.52839226", "0.5265491", "0.5261756", "0.52273184", "0.517853", "0.5169756", "0.5163168", "0.5160226", "0.51585186", "0.51465416", "0.51300...
0.0
-1
Concatenate train set and test set, This may lead to data leakage, but we have to do that because some tricks suck as dummy code will be wrong
def ConcatDF(train_set, test_set): df_all = pd.concat([train_set, test_set], sort=True).reset_index(drop=True) df_all.trn_len = train_set.shape[0] return df_all
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ConcatDF(train_set, test_set):\n return pd.concat([train_set, test_set], sort=True).reset_index(drop=True)", "def get_training_and_testing_sets(data, Y):\r\n data = pd.concat([data, Y], axis=1)\r\n x,y=data.shape\r\n train_X_sub1=data[0:x//6]\r\n dev_X_sub1 = data[x//6:x//6 + x//12]\r\n tes...
[ "0.72702205", "0.7119447", "0.6611562", "0.6522652", "0.6515046", "0.6469268", "0.640398", "0.6212674", "0.6208587", "0.6185535", "0.6140687", "0.60801977", "0.59785014", "0.59742194", "0.59706175", "0.59375256", "0.5934598", "0.593107", "0.59287834", "0.5923713", "0.5889146"...
0.7195508
1
Divide the data set that concatenated from train set and test set
def DivideDF(df_all): return df_all.iloc[:df_all.trn_len], df_all.iloc[df_all.trn_len:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_dataset(data_set, train_size, test_size):\n # Generate random indices without rep...
[ "0.73923093", "0.7316695", "0.73096097", "0.7292028", "0.7082199", "0.70577854", "0.699461", "0.69900775", "0.69663644", "0.69636", "0.69602627", "0.69523257", "0.6950047", "0.69360214", "0.69216895", "0.69130886", "0.6910069", "0.68873096", "0.6882777", "0.68530935", "0.6824...
0.0
-1
Get train and test data set.
def GetDataSet(path): # Read csv files df_train_set = pd.read_csv(os.path.join(path, "train.csv")) df_test_set = pd.read_csv(os.path.join(path, "test.csv")) # Filter df_train_set.drop("Id", axis=1, inplace=True) df_test_set.drop("Id", axis=1, inplace=True) # Assign name df_train_set.name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset(self):\n\n trainset = datasets.STL10('datasets/STL10/train/', split='train', transform=self.train_transforms,\n target_transform=None, download=True)\n valset = datasets.STL10('datasets/STL10/test/', split='test', transform=self.val_transforms,\n ...
[ "0.7832964", "0.7789843", "0.7632272", "0.75655854", "0.7256563", "0.72525346", "0.7169658", "0.71620417", "0.7151106", "0.7131625", "0.71311575", "0.7130896", "0.71091825", "0.70842814", "0.70833063", "0.70096624", "0.70075047", "0.6993283", "0.69746387", "0.69455457", "0.69...
0.0
-1
Simply fill nan values
def DealWithMissingValues(data_set: pd.DataFrame): data_set.fillna(method="pad", inplace=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_nan(A):\n\tinds = np.arange(A.shape[0])\n\tgood = np.where(np.isfinite(A))\n\tA[np.isnan(A)] = np.interp(inds[np.isnan(A)], inds[good], A[good])\n\treturn A", "def fill_nan(array):\n idx = np.arange(array.shape[0])\n good = np.where(np.isfinite(array))\n interp = interpo...
[ "0.8199574", "0.7925708", "0.77308667", "0.7693126", "0.7664297", "0.7597855", "0.7462525", "0.74502945", "0.7211371", "0.7154806", "0.71474856", "0.7142177", "0.7110163", "0.7099303", "0.6983724", "0.69163424", "0.69066197", "0.6883187", "0.68601936", "0.681218", "0.681136",...
0.65897727
25
Show missing numbers if it exists
def GetMissingValues(data_set: pd.DataFrame): # Get missing features and missing line counts missing_features = [] missing_line_counts = [] for column in data_set.columns: missing_line_count = data_set[column].isnull().sum() if missing_line_count != 0: missing_features.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_values():\n print('Missings in the train data:', train_data.isnull().sum())", "def task8_missing_number(num):\n check_list = list(range(1, max(num) + 1))\n result = list(set(check_list) - set(num))\n return result", "def get_missing_test_numbers(a_dict, logged_test_numbers):\n tnum_l...
[ "0.6732465", "0.6668786", "0.6668368", "0.6469321", "0.64369404", "0.6392679", "0.63542736", "0.6340361", "0.6182563", "0.6148259", "0.6077315", "0.6046442", "0.59800965", "0.59622073", "0.59599406", "0.593957", "0.590098", "0.5886578", "0.5875229", "0.5852242", "0.581376", ...
0.0
-1
Parses Conferences on wikicfp domain and follow links to actual conference page if link exists
def parse_wikicfp_page(self, response): # Processing of individual CFP page within wikicfp if re.search('cfp/servlet/event.showcfp', response.url): # Conference page self.num_conf_crawled += 1 # Series information exists only for series crawl in wikicfp_all response....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_links(self, from_year):\n self.links = []\n self.titles = []\n self.speakers = []\n self.dates = []\n\n r = requests.get(self.calendar_url)\n soup = BeautifulSoup(r.text, \"html.parser\")\n\n if self.verbose:\n print(\"Getting links for press con...
[ "0.6242029", "0.5957307", "0.5563976", "0.5432399", "0.54143894", "0.5413671", "0.53456557", "0.52990365", "0.52787286", "0.51410985", "0.5128235", "0.5118946", "0.5101586", "0.50898093", "0.507496", "0.5020961", "0.49787804", "0.49642515", "0.4960764", "0.4945461", "0.494287...
0.6074987
1
we use statistics of ngram to disambiguate the rhyme category, but there is still risk of mismatching and ambiguity
def get_line_rhyme(self, line): tail_char = line[-1] if tail_char in self._rhyme_dic: rhyme_candis = self._rhyme_dic[tail_char] if len(rhyme_candis) == 1: return rhyme_candis[0] if tail_char in self._char_rhyme_map: bigram = line[-2] + line[-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngram_frequency(word):\r\n\tword = word.lower()\r\n\tword = re.sub(r'[^A-Za-z. ]','',word)\r\n\tngram_statistics = {}\r\n\tngram_categorization_model_keys = []\r\n\tngram_categorization_model_occurances = []\r\n\tres = [0 for _ in range(0,300)]\r\n\tfor ituple in ngram_categorization_model:\r\n\t\tngram_catego...
[ "0.6331422", "0.62371904", "0.6158774", "0.61285675", "0.6075707", "0.6073298", "0.60395265", "0.59200674", "0.589902", "0.5887911", "0.5881809", "0.5868411", "0.5812009", "0.5810124", "0.579886", "0.5784275", "0.57811457", "0.57735", "0.57678723", "0.57591045", "0.57580376",...
0.0
-1
pick houses from self.env_set
def _pick_envs_to_load(self, split, max_envs, start_idx, in_order): if split in ['val', 'test'] or in_order: pruned_env_set = self.env_set[start_idx:start_idx+max_envs] # could be void if start_idx arrives end else: if max_envs < len(self.env_set): env_inds = np.random.choice(len(self.env_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_households(self, attr, old, new):\n index = new[0]\n school_id = self.data.iloc[index].school_id\n # List all agents that have the same school id\n same_school = self.data[self.data.school_id == school_id].index\n self.source.selected.indices = list(same_school)", "d...
[ "0.53169477", "0.5086531", "0.50442874", "0.5043684", "0.5027562", "0.501078", "0.50006616", "0.4983505", "0.4892833", "0.48900834", "0.4887874", "0.48799852", "0.48696637", "0.4855021", "0.48342144", "0.48321876", "0.48022148", "0.47826496", "0.47820404", "0.47569978", "0.47...
0.5894043
0
idx qid, house question, answer qe, ae type attr path_ix nav_ids nav_types nav_ego_feats navs of (l, 3200) float32 nav_action_inputs navs of (l, ) int64 nav_action_outputs navs of (l, ) int64 nav_ego_imgs navs of (l, 224, 224, 3) uint8 if necessary
def __getitem__(self, index): idx = self.available_idx[index] qn = self.questions[idx] qid = qn['id'] house = qn['house'] attr, room_attr = self.question_to_attribute(qn) # encode question and answer qe = self.encoded_questions[qn['h5_id']] ae = self.encoded_questions[qn['h5_id']] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_paths(data, relation_level_words, qald=False,goldorpred='gold'):\n abstract_question = data[goldorpred]['abstract_question'].replace('<e>', 'entity1').replace('<l>', 'literal1')\n question = ei.vocabularize(nlutils.tokenize(abstract_question))\n\n \"\"\"======\"\"\"\n question_dep = []\n ...
[ "0.47627646", "0.47548252", "0.4704405", "0.466417", "0.46623504", "0.4603262", "0.45375147", "0.45369682", "0.45208377", "0.4509831", "0.4502285", "0.449974", "0.44854072", "0.44819766", "0.4477061", "0.44590774", "0.44526723", "0.44371733", "0.4418434", "0.44158706", "0.440...
0.667768
0
Run set_target_object/room before calling this function!
def spawn_agent(self, min_dist, max_dist, split): conn_map = self.episode_house.env.house.connMap point_cands = np.argwhere((conn_map > min_dist) & (conn_map <= max_dist) ) if point_cands.shape[0] == 0: return None, None point_idx = np.random.choice(point_cands.shape[0]) if split == 'train' else 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e", "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e", "def init(self, target):\n pass", "def setCurrentTarget(self):\n if se...
[ "0.63913363", "0.63913363", "0.62136173", "0.59611523", "0.5901944", "0.5878155", "0.5878058", "0.58259785", "0.57819474", "0.57339656", "0.55785", "0.5536274", "0.5523582", "0.5515335", "0.55148864", "0.5501707", "0.54905826", "0.5456762", "0.5454063", "0.54427016", "0.54412...
0.0
-1
attrs are [object_color_equal, object_size_bigger/smaller, object_dist_farther/closer, room_size_bigger/smaller] room_attrs are [inroom, xroom]
def question_to_attribute(self, qn): attr = '' if 'object_color' in qn['type']: attr = 'object_color_equal' elif 'object_size' in qn['type']: compare_type = 'bigger' if 'bigger' in qn['question'] else 'smaller' attr = 'object_size_%s' % compare_type elif 'room_size' in qn['type']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, room,\n monster_symbol='m', monster_color='white',\n monster_name='generic_monster', monster_ai='basic',\n ai_action=True, ai_action_radius=10,\n fighter_hp=1, fighter_defense=0, fighter_power=0, fighter_xp=0,\n trea...
[ "0.5633651", "0.56281585", "0.54987335", "0.5497923", "0.51746804", "0.5157434", "0.51292056", "0.50903624", "0.50852436", "0.5079441", "0.5076012", "0.5069625", "0.5069535", "0.50191796", "0.4992347", "0.4981469", "0.49468", "0.49361178", "0.4929939", "0.49253476", "0.492441...
0.55781496
2
Wrapped datetime specific instance.
def DT (self) : return self._body
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime(self):\n return datetime(*tuple(self))", "def __init__(self, strict=True, **kwargs):\r\n self.strict = strict\r\n super(DateTime, self).__init__(**kwargs)", "def omniscient_datetime(*args):\n d = original_datetime(*args)\n if settings.USE_TZ:\n d = timezone.make_a...
[ "0.6891938", "0.65516645", "0.63991517", "0.6353348", "0.6125995", "0.6077955", "0.6050468", "0.5954843", "0.5946195", "0.59021163", "0.5884555", "0.5871482", "0.5722839", "0.5719277", "0.57126653", "0.56486267", "0.5619723", "0.5610949", "0.56015664", "0.5593643", "0.5531774...
0.0
-1
Do basic tests over the gaussian function
def test_gauss(gaussian): x_gauss, x = gaussian assert len(x) == 25 assert x_gauss[0] == x_gauss[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gaussian():\n x0 = Parameter('x0')\n sig = Parameter('sig', positive=True)\n x = Variable('x')\n\n new = sympy.exp(-(x - x0)**2/(2*sig**2))/sympy.sqrt((2*sympy.pi*sig**2))\n assert isinstance(new, sympy.Expr)\n g = Gaussian(x, x0, sig)\n assert issubclass(g.__class__, sympy.Expr)\n ...
[ "0.71569026", "0.71300036", "0.69926065", "0.689196", "0.6883935", "0.68262583", "0.6825799", "0.6679407", "0.66321474", "0.66280776", "0.6577144", "0.64698523", "0.6467045", "0.64211404", "0.6419664", "0.6415374", "0.64126265", "0.6411648", "0.6408169", "0.6404639", "0.63606...
0.70641977
2
Make sure that the 1d convolution implemented provides the same result as the 2d convolution (python package implementation)
def test_gaussian_filter(): def rgb2gray(rgb): r, g, b = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] gray = 0.2989 * r + 0.5870 * g + 0.1140 * b return gray img = rgb2gray(np.array(Image.open('data/graf.png'))) gx, x = gauss_module.gauss(4) gx = gx.reshape(1, gx.shape[0]) gy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_same_convolution(conv1d_placeholder, spatial_onehot, output_size, width, stride):\n conv_layer = Convolution((3, output_size), lambda x: 1, strides=stride, padding=\"same\")\n output = conv_layer(conv1d_placeholder)\n output_width = output.axes.find_by_name(\"W\")[0].length\n assert output_wid...
[ "0.7460406", "0.73170173", "0.7062893", "0.7062232", "0.7018009", "0.7001281", "0.6940282", "0.6900652", "0.6690584", "0.66841036", "0.6681077", "0.66725844", "0.6652221", "0.66517836", "0.66450524", "0.66121566", "0.65842104", "0.65494543", "0.653681", "0.6512027", "0.650163...
0.0
-1
Due to how Python manages scope, the creation of closure is wrapped into a function. The lambda cannot be created in the loop, because then all function calls will refer to the same variable!.
def _create_new_criteria_function(lm,mm): return lambda D, i, u, j: parametrized_insertion_criteria(D, i, u, j, lm=lm, mm=mm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lambda(n):\n for i in range(n):\n yield lambda : i", "def test_lambda(n):\n return [lambda v=i: v for i in range(n)]", "def _gen_closure(fnc,arg):\n return lambda s: fnc(arg)", "def test_closure(a):\n def x1(b):\n\n def x4(c):\n return b\n return x...
[ "0.66687864", "0.6453177", "0.6441694", "0.62486774", "0.6158847", "0.6149522", "0.613451", "0.6026405", "0.5967721", "0.59382486", "0.5916454", "0.59115493", "0.5900501", "0.57569826", "0.5739094", "0.57091045", "0.5662242", "0.56328", "0.5598219", "0.55570084", "0.55467045"...
0.0
-1
This is the implementation of Mole and Jameson (1976) cheapest insertion algorithm. The emerging route is first initialized according to which strain criterion (insertion cost calculation method) is used, On each step an unrouted customer for which the insertion cost is lowest (between any two nodes on the emerging rou...
def mole_jameson_insertion_init(D, d, C, L=None, minimize_K=False, strain_criterion='all' ): callback_configurations = [] if strain_criterion=='proximity_ranking' or strain_criterion=='all': callback_configurations.append( ( _create_new_criteria_function(lm=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safeJourney(Alist,s,d):\n #Initialize dictionaries\n dinit = 10**6\n Edict = {} #Explored nodes\n Udict = {} #Unexplored nodes\n path = [[] for l in Alist]\n\n Alen = len(Alist) #length of Alist\n dinits = [dinit]*Alen #list of airport indexes\n Udict = dict(zip(list(range(Alen)),dinits...
[ "0.6560185", "0.6236826", "0.6223014", "0.6154328", "0.6079165", "0.60468", "0.5980044", "0.5947014", "0.5939437", "0.5888121", "0.58642095", "0.58552253", "0.58538413", "0.58406043", "0.57866955", "0.57730013", "0.57542545", "0.5741422", "0.57220036", "0.57218945", "0.569465...
0.52982587
68
Initialize the graphics view.
def __init__(self, type, controller): super(GUI, self).__init__() self.controller = controller self.layout = QtWidgets.QHBoxLayout(self) self.leftSide = QtWidgets.QVBoxLayout(self) self.generateWidget = Generate(self, self.controller) self.leftSide.addWidget(self.gene...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_graphics(self):\n self.renderer = vtk.vtkRenderer()\n self.window = vtk.vtkRenderWindow()\n self.window.AddRenderer(self.renderer)\n self.renderer.SetBackground(1.0, 1.0, 1.0)\n self.window.SetSize(1000, 1000)\n\n # Create a trackball interacter to transofor...
[ "0.738486", "0.7245235", "0.7245235", "0.71699125", "0.69324094", "0.6878057", "0.68248576", "0.67956203", "0.67449474", "0.67285466", "0.67102", "0.67010546", "0.66953194", "0.66546637", "0.6624726", "0.6610313", "0.6596297", "0.6591724", "0.6586789", "0.65769166", "0.655664...
0.0
-1
this test shows that when list() is given a iterable object list will create a list and put each item in that iterable object into that created list
def testCreateFromIterable(self): self.assertEqual(["c","h","e","k","a"],list("cheka"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_iterlist_op_1():\n\n @ops.iterlist_op\n def f(x):\n return [4, 5, 6]\n\n result = f(iter([1, 2, 3])) # Passing in an iterator, as expected\n\n assert(isinstance(result, list)), f\"{result}\"\n assert(result == [4, 5, 6])", "def test_listiter_op_1():\n\n @ops.listiter_op\n de...
[ "0.67141134", "0.6685624", "0.65879583", "0.65396696", "0.65396696", "0.6528297", "0.65097594", "0.6507952", "0.6507952", "0.639472", "0.6357265", "0.62581646", "0.6256366", "0.624183", "0.6190519", "0.6117395", "0.6117395", "0.60700786", "0.6008047", "0.60052884", "0.5988655...
0.64752835
9
this testcase proves that for list object '==' checks equality based on content checking, rather that reference checking
def testEquality(self): list1 = [1,2] list2 = [1,2] # not the same object self.assertIsNot(list1,list2) self.assertNotEqual(id(list1),id(list2)) self.assertFalse(list1 is list2) # but content is equal self.assertEqual(list1,list2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_identity(self):\n pass", "def check_lists_equal( list1, list2, assertobject ):\n assertEqualsImproved( len( list1 ), len( list2 ), assertobject )\n for element in list1:\n assertobject.assertIn( element, list2 )", "def testMutable(self):\n alist = [1,2,3]\n aref = alist\...
[ "0.71370006", "0.7099526", "0.6874867", "0.6859387", "0.6776912", "0.6727213", "0.6631619", "0.65954477", "0.6538188", "0.6502381", "0.6497191", "0.6493001", "0.6463698", "0.6459172", "0.64429367", "0.6437611", "0.6419223", "0.6414189", "0.63548326", "0.6349761", "0.6301157",...
0.7994808
0
difference between "list.sort" and builtin "sorted" is that "list.sort" sort the list in place while builtin "sorted" return a new list sorted by specific order
def testSort(self): numlist = [6,4.78,1.2,5] numlist.sort() self.assertEqual([1.2,4.78,5,6],numlist) strlist = ["kgb","mss","cheka"] strlist.sort() self.assertEqual(["cheka","kgb","mss"],strlist) # ------------ reverse sort num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list(self,list_):\r\n list_.sort()", "def sort_list():\n fun_list = basic_list_exception.make_list()\n fun_list.sort()\n return fun_list", "def sorted(x) -> List:\n pass", "def python_sort(a_list):\n \n start_time = time.time()\n\n a_list.sort()\n\n end_time = time.time(...
[ "0.7887157", "0.73782283", "0.73607516", "0.7267121", "0.72059846", "0.71099776", "0.7100431", "0.70780563", "0.70418423", "0.70310795", "0.69471747", "0.6916764", "0.6910774", "0.69079554", "0.68409765", "0.6807745", "0.6721783", "0.6717191", "0.6674685", "0.6646439", "0.663...
0.71553606
5
element in the lsit can be changed
def testMutable(self): alist = [1,2,3] aref = alist alist[1] = "stasi" self.assertEqual([1,"stasi",3],aref)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change():", "def updateLstAllElement(self):\n self.lstAllElement=[self.idVet, self.libelle,self.marque,self.quantite,self.prixHTVA,self.tauxTVA,self.taille,self.categorie,self.couleur,self.lstAssorti]", "def element(self, element):\n pass", "def changed(self):\n\t\tpass", "def update_E(se...
[ "0.5974379", "0.5922887", "0.5706644", "0.56755984", "0.5652195", "0.5602778", "0.55848145", "0.5569042", "0.5516961", "0.5512565", "0.5488783", "0.54719365", "0.54701895", "0.5461035", "0.54609835", "0.542505", "0.54209566", "0.5420029", "0.5420029", "0.5420029", "0.5414117"...
0.54831463
11
list is mutable type, has the 'reference' nature
def testReferenceFeature(self): alist = [1] aref = alist alist.append("stasi") self.assertEqual([1,"stasi"],aref) self.assertIs(aref,alist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ref_ex1():\n\n print(\"Look Alikes\")\n print(\"===========\")\n\n lst1 = [7, 3, 2]\n lst2 = [7, 3, 2]\n print(lst1, lst2)\n\n lst1[1] = -8\n print(lst1, lst2)\n\n print(\"\")\n print(\"Aliases\")\n print(\"=======\")\n\n lst3 = [1, 5, 9]\n lst4 = lst3\n print(lst3, lst4)...
[ "0.7354346", "0.7250251", "0.70623386", "0.693525", "0.6908979", "0.6905237", "0.68102694", "0.6598454", "0.65117925", "0.64936775", "0.6433605", "0.64088255", "0.6204775", "0.6192246", "0.61391217", "0.6081045", "0.6048543", "0.60200906", "0.59972274", "0.5973449", "0.597120...
0.6211245
12
Return an operator given the path to a database.
def loadOperator(pathToDb, loadCycle, loadNode, allowMissing=False): # `import armi` doesn't work if imported at top from armi import cases if not os.path.exists(pathToDb): raise ValueError( f"Specified database at path {pathToDb} does not exist. \n\n" "Double check that esc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operator(self):\n col = self.pos\n operators = [\"||\", \"&&\", \">>\", \"<<\", \"!=\", \">=\", \"<=\", \"==\", \"##\"] + \\\n [\"-\", \"+\", \"!\", \"*\", \"/\", \"|\", \"&\", \"^\", \"<\", \">\", \"?\", \":\", \"~\", \"#\", \"=\", \"%\"]\n try:\n index = self.match_...
[ "0.5361934", "0.5345323", "0.52730507", "0.5133861", "0.51303923", "0.5125685", "0.5095104", "0.5086308", "0.5076296", "0.50663847", "0.504918", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", "0.5047888", ...
0.5978742
0
Convert database files between different versions.
def convertDatabase( inputDBName: str, outputDBName: Optional[str] = None, outputVersion: Optional[str] = None, nodes: Optional[List[Tuple[int, int]]] = None, ): dbIn = databaseFactory(inputDBName, permission=Permissions.READ_ONLY_FME) if dbIn.version == outputVersion: runLog.important(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgradedb(self, args):\n upgrade_db(args.dbfile)", "def _convert_rosetta_db_to_basic_db(self):\n pass", "def migrate(ctx, start_version, end_version):\n if ctx.obj['TYPE'] == 'file':\n if ctx.obj['DATA_FILE']:\n file_path = ctx.obj['DATA_FILE']\n else:\n ...
[ "0.63407254", "0.6322698", "0.61341935", "0.60159844", "0.57008606", "0.567188", "0.56600946", "0.56428075", "0.56238115", "0.55924803", "0.5589563", "0.5580526", "0.55748826", "0.5569592", "0.556925", "0.55508006", "0.5528553", "0.55067235", "0.5505626", "0.54876965", "0.547...
0.68520933
0
Return the underlying h5py File that provides the backing storage for a database. This is done here because HDF5 isn't an official aspect of the base Database abstraction, and thus making this part of the base Database class interface wouldn't be ideal. However, we violate this assumption when working with "auxiliary" ...
def _getH5File(db): if isinstance(db, Database3): return db.h5db else: raise TypeError("Unsupported Database type ({})!".format(type(db)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_db(self):\n # if it is not open, open it.\n if self.h5file.isopen is True:\n return self.h5file\n else:\n self.h5file = tb.open_file(filename=self.filepath, mode='a')\n assert self.h5file.isopen\n return self.h5file", "def hdf5_file(self):\n ...
[ "0.63894004", "0.6325323", "0.5979841", "0.5845819", "0.5709331", "0.5573591", "0.55464363", "0.5419186", "0.5413009", "0.5404134", "0.5402279", "0.5396553", "0.5393392", "0.53786933", "0.53507555", "0.5344345", "0.5339578", "0.5317838", "0.5294479", "0.5289991", "0.52769095"...
0.72821635
0
Parse lines from a file containing scattering data. Assume that lines without two or three numerical columns are not scattering data and are header or junk. An empty array is returned if these criteria are not met.
def parse_sas_data_line(line): cols = line.split() ncols = len(cols) if ncols < 2: data = np.array([],dtype=np.float) else: if ncols > 3: ncols = 3 try: data = np.array(cols[0:ncols], dtype=np.float) except: data = np.array([...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_file(input_file):\n header_lines = 0\n last_pound_pos = -1\n with open(input_file, 'r') as data_file:\n while (data_file.read(1) == '#'):\n last_pound_pos = data_file.tell()\n header = data_file.readline()\n header_lines += 1\n\n #Read the next ...
[ "0.6135837", "0.5916294", "0.59119976", "0.5905361", "0.5874234", "0.58589786", "0.5851976", "0.5756723", "0.5734717", "0.56929773", "0.5651191", "0.56496507", "0.56231004", "0.56061757", "0.55397755", "0.55212134", "0.55057025", "0.5502649", "0.54836565", "0.54817307", "0.54...
0.584905
7
Load magnitude of scattering vector, q, and intensity, I, data from file and filter for values between q_min and q_max.
def read_sas_file(filename): data = np.array([],dtype=np.float) with open(filename,'r') as f: for line in f: # Only the first 2 or 3 columns are parsed cols = parse_sas_data_line(line) if cols.any(): if dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_scatter_curve(filename, q_min, q_max):\n \n try:\n scatter_data = read_sas_file(filename)\n except:\n print(\"Unable to load \" + filename)\n print(\"Check that the file exists, and contains lines with at least two columns of numberical data\\n\")\n sys.exit(1)\n\n ...
[ "0.62943393", "0.58814245", "0.54279727", "0.5416429", "0.5340518", "0.53365", "0.5312966", "0.53028476", "0.5295134", "0.52634937", "0.5233531", "0.5220195", "0.5213372", "0.51964384", "0.5186909", "0.5168423", "0.5128792", "0.5117724", "0.51074344", "0.5094335", "0.5092197"...
0.0
-1
Load magnitude of scattering vector, q, and intensity, I, data (and potentially error in I) from file and filter for values between q_min and q_max.
def load_scatter_curve(filename, q_min, q_max): try: scatter_data = read_sas_file(filename) except: print("Unable to load " + filename) print("Check that the file exists, and contains lines with at least two columns of numberical data\n") sys.exit(1) qrange_mask = (scat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDataFile(self, filename):\n self.magneticfield = MagneticField(filename)\n self._meqfile = filename\n\n wallR, wallZ = self.magneticfield.getWall()\n\n self.rmin, self.rmax = np.amin(wallR), np.amax(wallR)\n self.zmin, self.zmax = np.amin(wallZ), np.amax(wallZ)", "def r...
[ "0.5680521", "0.5428513", "0.5353534", "0.5295121", "0.5253234", "0.5213317", "0.5192037", "0.5187126", "0.5159289", "0.5138375", "0.5130577", "0.5127485", "0.5093703", "0.5088959", "0.50883", "0.50879556", "0.5084919", "0.5079182", "0.50727534", "0.5027459", "0.5026445", "...
0.6320465
0
Read in a list of scattering curve files and return a list of dictionaries which contain the file name ('file'), an array of Q and I(Q) vales ('data'), the radius of gyration ('rg') and the crosssection ('rxs1').
def read_scatter_curves(curve_files, units, param): curves = [] for curve_file in curve_files: curve = {} curve['file'] = curve_file # Read in the scattering curve # Modeling is performed in angstroms so convert files in nm to a if units == 'nm': curve['da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_from_sc_file(axes, f, uf, true_max):\n f_combo_dict = collections.defaultdict(list)\n uf_combo_dict = collections.defaultdict(list)\n max_x = -10000\n max_y = -10000\n min_x = 10000\n min_y = 10000\n\n for fileType in [uf, f]:\n for i, item in enumerate(fileType):\n ...
[ "0.62675303", "0.6176889", "0.6142395", "0.58858454", "0.5876028", "0.5847257", "0.5815131", "0.58049107", "0.5796159", "0.57542104", "0.57402223", "0.5739488", "0.57298195", "0.5717066", "0.57040155", "0.5665045", "0.5653632", "0.5630872", "0.56305236", "0.56249666", "0.5598...
0.72098076
0
Load yaml file containing the ranges for all analyses.
def process_qrange_file(filename): f = open(filename, 'r') q_ranges = yaml.load(f) return q_ranges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml_file(self, path):\n with path.open('r') as handle:\n data = load_yaml(handle)\n\n self.set_all(**self.SCHEMA.load(data).data)", "def load_yaml(self):\n env = self.state.document.settings.env\n relpath, abspath = env.relfn2path(directives.path(self.arguments[0]...
[ "0.63422006", "0.57995796", "0.5766984", "0.574815", "0.573764", "0.57361096", "0.5614416", "0.5582548", "0.5572529", "0.5568093", "0.5553858", "0.5536593", "0.54736644", "0.5459305", "0.538914", "0.53844225", "0.53229624", "0.53033197", "0.52961624", "0.52952296", "0.5284542...
0.68835
0
Match two scatter curves. Get intensity, I, values from one data set at the q (scaterring vector magnitude) values present in the other. Input is two q vs I scattering curves. Output is I values from the source data set matched to the q values of the target set.
def match_scatter_curves(target_data, source_data): # Create list of calculated I values matched to the nearest experimental q # Remember that the arrays in python start at 0, those in Fortran at 1 last_source = len(source_data) last_target = len(target_data) # Initialize array to hold the calcula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_curves(target_data, source_data, q_min, q_max, chi2):\n\n if chi2:\n rfactor, scale = calculate_chi2(target_data, source_data, q_min, q_max)\n else:\n rfactor, scale = calculate_rfactor(\n target_data, source_data, q_min, q_max)\n\n return rfactor, scale", "def calcu...
[ "0.56384337", "0.5514092", "0.5465273", "0.5464144", "0.54291075", "0.54191035", "0.5410992", "0.5403209", "0.53972155", "0.5342674", "0.53372824", "0.532874", "0.5325885", "0.5307892", "0.5297777", "0.5290474", "0.52871025", "0.5279677", "0.52782655", "0.5225266", "0.5209964...
0.7495544
0
Compute comparison metric (R factor or Chi^2). Input is two q vs I scattering curves and the min/max q values to use to compare them. The target (experimental) curve is scaled to match the source (theoretical) one. This is because the theoretical curve is based on a calculation of I/Io. Output is the R factor and the s...
def compare_curves(target_data, source_data, q_min, q_max, chi2): if chi2: rfactor, scale = calculate_chi2(target_data, source_data, q_min, q_max) else: rfactor, scale = calculate_rfactor( target_data, source_data, q_min, q_max) return rfactor, scale
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_rfactor(target_data, source_data, q_min, q_max):\n\n matched_source_I = match_scatter_curves(target_data, source_data)\n\n # Get average I for experimental and calculated values over matched q range\n matched_no = len(matched_source_I)\n expt_avg = np.mean(target_data[0:matched_no, 1])\n ...
[ "0.68376523", "0.6492629", "0.55108064", "0.5445589", "0.5386808", "0.5345272", "0.53385323", "0.52746767", "0.52524316", "0.52124363", "0.51650137", "0.5163609", "0.51559365", "0.5129782", "0.5114901", "0.51110995", "0.50248575", "0.50235295", "0.5023434", "0.5019229", "0.50...
0.79531777
0
Compute R factor comparing two scattering curves. Input is two q vs I scattering curves and the min/max q values to use to compare them. The target (experimental) curve is scaled to match the source (theoretical) one. This is because the theoretical curve is based on a calculation of I/Io. Output is the R factor and th...
def calculate_rfactor(target_data, source_data, q_min, q_max): matched_source_I = match_scatter_curves(target_data, source_data) # Get average I for experimental and calculated values over matched q range matched_no = len(matched_source_I) expt_avg = np.mean(target_data[0:matched_no, 1]) calc_avg ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_curves(target_data, source_data, q_min, q_max, chi2):\n\n if chi2:\n rfactor, scale = calculate_chi2(target_data, source_data, q_min, q_max)\n else:\n rfactor, scale = calculate_rfactor(\n target_data, source_data, q_min, q_max)\n\n return rfactor, scale", "def calcu...
[ "0.7753233", "0.58153874", "0.5712545", "0.53757167", "0.5279661", "0.52676696", "0.52249604", "0.51984113", "0.5190254", "0.51797056", "0.5145067", "0.5140006", "0.5114124", "0.510577", "0.5075585", "0.5032694", "0.502384", "0.5012232", "0.49598452", "0.4957949", "0.4931579"...
0.68906873
1
Compute Chi^2 comparing two scattering curves. Input is two q vs I scattering curves and the min/max q values to use to compare them. The target (experimental) curve is scaled to match the source (theoretical) one. This is because the theoretical curve is based on a calculation of I/Io. Output is the Chi^2 and the scal...
def calculate_chi2(target_data, source_data, q_min, q_max): matched_source_I = match_scatter_curves(target_data, source_data) # Get average I for experimental and calculated values over matched q # range matched_no = len(matched_source_I) expt_avg = np.mean(target_data[0:matched_no, 1]) calc_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_curves(target_data, source_data, q_min, q_max, chi2):\n\n if chi2:\n rfactor, scale = calculate_chi2(target_data, source_data, q_min, q_max)\n else:\n rfactor, scale = calculate_rfactor(\n target_data, source_data, q_min, q_max)\n\n return rfactor, scale", "def calcu...
[ "0.72039247", "0.5903445", "0.5728763", "0.5679894", "0.56745183", "0.563039", "0.5551781", "0.5550915", "0.5501156", "0.5463921", "0.5455437", "0.5452026", "0.5440274", "0.54046345", "0.5401157", "0.5397274", "0.5318091", "0.53127307", "0.5302951", "0.52710074", "0.52679455"...
0.7524854
0
Linear fit x vs y data. calc_type (rg, rxs1, rxs2) determines value computed from gradient and intercept in Guinier and other analyses of small angle scattering curves.
def sas_curve_fit(x, y, calc_type): result = {} n = len(x) if (n == 0) or (len(y) == 0): err = "Error: No values to fit in " + calc_type + " calculation\n" raise Exception(err) #result['error'] = err else: # Linear fit to the input x and y values #fit_coeffs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearfit_s1(x, y):\r\n x *= N.ones(1); y *= N.ones(1)\r\n mx = N.mean(x); my = N.mean(y)\r\n slope = 1.; yint = my-mx\r\n rl_slope, sd_slope, rl_yint, sd_yint, s_yint, cov = robust_linefit(x, y)\r\n \r\n return slope, sd_slope, yint, sd_yint, s_yint, cov", "def linear_regression(self, x_da...
[ "0.64826363", "0.6309423", "0.6292486", "0.6138011", "0.6078534", "0.59990513", "0.59841806", "0.5863627", "0.5851407", "0.58428884", "0.5836996", "0.5771239", "0.5766344", "0.5713542", "0.56316483", "0.5586694", "0.55863845", "0.55366975", "0.5526817", "0.5521595", "0.55129"...
0.7035865
0
Outputs graph of x and y to a pdf file. x and y are intended to be functions of the magnitude of scattering vector, q, and intensity, I. Values that are computed from the graph (outputs) and range of R? qfit written on graph
def graph_sas_curve(filename, x, y, title_text, x_lab, y_lab, x_min, x_max, y_min, y_max, **kwargs): fit_coeffs = kwargs.get('fitcoeffs', None) outputs = kwargs.get('outputs', None) rq_range = kwargs.get('rqrange', None) mask = kwargs.get('mask', None) # Plot the input x, y val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_pdf(data,b,X,outfile):\t\r\n\tme = \"LE_Plot.plot_pdf: \"\r\n\tshowplot = False\r\n\tt0 = time.time()\r\n\t## Data\r\n\tx, y = data\r\n\txmax, ymax = np.abs(x).max(), np.abs(y).max()\r\n\t## Plot pdf\r\n\tfs = 25\r\n\t# counts, xedges, yedges, im = plt.hist2d(x,y, bins=100, range=[[-2*X,+2*X],blim(b,X)], ...
[ "0.65296495", "0.62556636", "0.6085604", "0.6072946", "0.6003194", "0.59075755", "0.58855313", "0.58549", "0.5809094", "0.5739868", "0.56985754", "0.56939775", "0.5660247", "0.5650745", "0.5650164", "0.56166774", "0.55975235", "0.55961955", "0.5593082", "0.558692", "0.5572759...
0.5387877
43
Prints out formated q and I columns to output.
def output_sas_curve(curve, filename): if filename is not None: output = open(filename, 'w') else: output = sys.stdout for qi_pair in curve: output.write("{0:7.4f} {1:7.4f}\n".format(qi_pair[0], qi_pair[1])) output.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printqtable(self):\n\t\tout = \"PRINTING QTABLE\\n\"\n\t\tfor key in self.qtable:\n\t\t\tout += \"state: \" + str(key) + \"\\n\"\n\t\t\tfor i in range(self.game.pips+1):\n\t\t\t\tout += f\"rew{i}: {self.qtable[key][i]:.3f} \"\n\t\t\tout += \"\\n\"\n\t\treturn out", "def print_PQ(q):\n for item in q:\n ...
[ "0.70717496", "0.7048381", "0.6404846", "0.6365367", "0.6351997", "0.6332962", "0.61797464", "0.61541086", "0.6131866", "0.6126434", "0.6097812", "0.60565346", "0.60377866", "0.60294825", "0.60274976", "0.5978773", "0.59669054", "0.58863413", "0.588584", "0.5870688", "0.58671...
0.0
-1
Calculate the Rg and Rxs1 from linear fits to the functions of the input curve values (q, I). In the case of Rg the Guinier fit is to q^2 vs ln(I), for Rxs1 it is to q^2 vs ln(Iq).
def get_curve_descriptors(curve, rg_min, rg_max, rxs1_min, rxs1_max, *args): # Fitting is performed on: # q^2 vs ln(I) for Rg # q^2 vs ln(I*q) for Rxs x = curve[:, 0] ** 2 y_rg = np.log(curve[:, 1]) y_rxs = np.log(curve[:, 1] * curve[:, 0]) # Create mask to select range of q values for Rg ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sas_curve_fit(x, y, calc_type):\n\n result = {}\n\n n = len(x)\n\n if (n == 0) or (len(y) == 0):\n err = \"Error: No values to fit in \" + calc_type + \" calculation\\n\"\n raise Exception(err)\n #result['error'] = err\n else:\n # Linear fit to the input x and y values\n...
[ "0.605578", "0.5877867", "0.5832726", "0.5832662", "0.57186884", "0.5693924", "0.56421226", "0.5623981", "0.5517047", "0.54979545", "0.549774", "0.54974747", "0.54570127", "0.5453601", "0.541977", "0.5409155", "0.5367099", "0.53388757", "0.53322685", "0.532931", "0.5319078", ...
0.5903254
1
Saves dictionary in path.
def save_json_file(**kwargs): dict_to_save = kwargs["dict_to_save"] path = kwargs["path"] with open(path,'wb') as fp: json.dump(dict_to_save, fp) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, path='dict.pic'):\n with open(path, 'wb') as f:\n pickle.dump(self.__dictionary, f)", "def save(self, path):\n with open(path, 'wb') as f:\n pkl.dump(self, f)", "def save(self, path: Path, data: dict):\n self.info(data)\n os.makedirs(path.parent,...
[ "0.8156424", "0.7739863", "0.77196157", "0.7709216", "0.7681167", "0.7499659", "0.7499659", "0.7499659", "0.74758714", "0.7360721", "0.73478764", "0.72891444", "0.7285685", "0.7285685", "0.7285685", "0.7253103", "0.7243494", "0.7231061", "0.7181783", "0.71751034", "0.71315217...
0.6719308
45
This is the method used by Predictors.ai to interact with the model. It is the only method that needs to be implemented to deploy the model on Predictors.ai
def predictors_ai_interface(self, **kwargs): pipe_id = kwargs['pipe_id'] input_data = kwargs['input_data'] input_files_dir = kwargs['input_files_dir'] output_files_dir = kwargs['output_files_dir'] output_data = self.predict(pipe_id, input_data, input_files_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def predict_api():\n pass", "def predict():\n\n predict_cfg = get_predict_args()\n device = get_device()\n print(device)\n\n # load checkpoint\n ckpt_path = find_ckpt_in_directory(predict_cfg.ckpt)...
[ "0.6984333", "0.68782455", "0.6673396", "0.66272396", "0.6600812", "0.65296173", "0.6517009", "0.65158325", "0.64813536", "0.644822", "0.6429023", "0.64018166", "0.6354974", "0.63139385", "0.6303747", "0.62957084", "0.6285682", "0.6280027", "0.627423", "0.6257732", "0.6257732...
0.0
-1
Create the core messagehandler. Also starts up depending threads
def __init__(self): threading.Thread.__init__(self) self.shutdown = False self.name = 'domoscore' self.rpc = rpc(self.name) self.rpc.log_info("starting main thread") self.rpc.handle(self.register, "register") self.rpc.handle(self.sensorValue, "sensorValue") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n self.dispatcher.start()\n self.replyer.start()", "def start(self):\n\n def pubsub_thread():\n \"\"\" Call get_message in loop to fire _handler. \"\"\"\n\n while not self._stop.is_set():\n self._pubsub.get_message()\n sleep...
[ "0.6369178", "0.63625515", "0.633308", "0.6186753", "0.61862725", "0.6167738", "0.60974264", "0.6088992", "0.60875434", "0.60620826", "0.5952578", "0.59207726", "0.58730865", "0.5850386", "0.58470225", "0.58376884", "0.57883096", "0.5787849", "0.5764191", "0.5751453", "0.5750...
0.63266504
3
RPC function to register a module
def register(self, data=None): returnvalue = False try: module = Module.get_by_name(data['name']) except DoesNotExist: module = Module.add(name=data['name'], queue=data['queue']) for rpc in data['rpc']: argslist = [] if "args" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, module):\n tagvalues = \"\\n\".join([\"%s: %s\" % (attr, str(getattr(module, attr))) for attr in dir(module) if attr in ['create', 'menu', 'name', 'label'] ])\n # tagvalues = \"\\n\".join([\"%s\" % (attr) for attr in dir(module) if attr not in ['urls'] ])\n logger.debug(\"mo...
[ "0.710305", "0.68038905", "0.65690994", "0.65593517", "0.6511528", "0.6500591", "0.6408624", "0.6359136", "0.6344225", "0.6296262", "0.6287295", "0.62527144", "0.6180132", "0.6180132", "0.61799145", "0.61693335", "0.61673915", "0.6166312", "0.6161581", "0.615456", "0.6125936"...
0.6791904
2
RPC function to send a data value to the core. It also triggers the checking of depending triggers
def sensorValue(self, key=None, value=None, timestamp=None): try: self.logger.debug('logging trigger value for {0} with value {1}'.format(key, value)) Sensor.get_by_id(key).add_value(value) except Exception as e: self.logger.warn('Something went wrong registering tri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, value):\n pass", "def send(value):\r\n return value", "def _send_data(self):\n pass", "def send(self, data):", "def send(self, data):\n pass", "def send_data(self, data):\n # test_dict = {'ext': '1105', 'ip_address': '192.168.10.55', 'status': 'OK', 'ping': '...
[ "0.6560559", "0.6557983", "0.65332717", "0.6475165", "0.63426757", "0.63372713", "0.629647", "0.6270873", "0.6257218", "0.61608404", "0.61465144", "0.61347085", "0.6066361", "0.60478175", "0.6029204", "0.6023097", "0.6022667", "0.6011719", "0.5990419", "0.59707654", "0.596811...
0.0
-1
Start the core thread
def run(self): self.logger.info("starting Dashi consumer") while not self.shutdown: self.rpc.listen()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.thread.start()", "def start(self) -> None:\n start_thread(super().start, self.__class__.__name__)", "def start(self):\n self._thread.start()", "def start(self):\n self._setup_thread()\n self.thread.start()", "def start(self):\n \n sel...
[ "0.73384786", "0.7254174", "0.7210217", "0.7201224", "0.6993055", "0.6963443", "0.6897489", "0.68625474", "0.681053", "0.68081605", "0.6780735", "0.67657864", "0.6750371", "0.6750371", "0.6680953", "0.6675509", "0.6644162", "0.6599766", "0.6574553", "0.65421563", "0.65279335"...
0.0
-1
Stop the core thread
def end(self): self.shutdown = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._Thread__stop()", "def stop(self):\n debug(\"CBA4.__worker_thread.stop()\")\n self.__run = False\n #end stop()", "def stop(self):\n\n self.stop_thread = True", "def stop_thread(self):\n t, e = self.workers[0]\n e = e.set() # pu...
[ "0.8118453", "0.7949373", "0.7930008", "0.7887663", "0.76762074", "0.76762074", "0.7591198", "0.75860834", "0.7577884", "0.7577884", "0.7577884", "0.7577884", "0.7559412", "0.75473344", "0.7522022", "0.7494112", "0.74908835", "0.74758166", "0.74500954", "0.74500954", "0.74500...
0.0
-1
Create a api handler. This is automaticaly build from the messagehandler
def __init__(self): threading.Thread.__init__(self) self.shutdown = False self.name = 'api' self.rpc = rpc(self.name) self.rpc.log_info("starting rpc api thread") rpchandle = domoslog.rpchandler(self.rpc) self.logger = logging.getLogger('api') self.logger....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_new_handler(self, *args, **kwargs):", "def create_handler(event, context):\n return update_endpoint(event)", "def __create_handler():\n if not ServiceHandler.instance:\n ServiceHandler.instance = ServiceHandler()\n return ServiceHandler.instance", "def __init__(self, common_api_handl...
[ "0.65934217", "0.6533182", "0.63217163", "0.61371607", "0.6033087", "0.5883099", "0.5846581", "0.5829885", "0.58280313", "0.5784566", "0.5784225", "0.5632384", "0.56148505", "0.55882126", "0.5583079", "0.55631435", "0.5549574", "0.5393488", "0.53734934", "0.5373018", "0.53643...
0.0
-1
RPC api call, returns a list with a tuple with module data (name, queue, Active)
def listModules(self): modules = [(module.name, module.queue, module.Active) for module in self.db.getModules()] return modules
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc(self) -> global___Rpc:", "def get_queues_info() -> List[QueueInfo]:\n from src.server.oasisapi.analyses.models import AnalysisTaskStatus\n\n # setup an entry for every element in the broker (this will include\n # queues with no workers yet)\n res = [\n {\n 'name': q,\n ...
[ "0.6413622", "0.61402905", "0.6116551", "0.6082819", "0.6021262", "0.588938", "0.58609927", "0.5812053", "0.5793564", "0.57764167", "0.57638174", "0.5659447", "0.5590769", "0.5558482", "0.553459", "0.55314624", "0.55239093", "0.54997844", "0.54942393", "0.5483135", "0.5470676...
0.5761541
11
RPC call, returns a list of tuples with sensors database (identifier, instant, activated, module name, description)
def listSensors(self, module=None): if module: try: sensors = self.db.getModuleSensors(self.db.getModule(module)) except DoesNotExist: return None else: sensors = self.db.getSensors() # convert to list of tuples return [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sensors():\n sensor_data = query_db('SELECT * FROM sensors')\n return jsonify(results=sensor_data)", "def GET_sensors(self):\n self.sensors.GetAll()\n self.sensors.sensors['charging-state'] = \\\n pyrobot.CHARGING_STATES[self.sensors.sensors['charging-state']]\n print simplejson.dumps(sel...
[ "0.6393391", "0.6253768", "0.59395397", "0.593439", "0.5932335", "0.58385205", "0.56590295", "0.5607915", "0.5571273", "0.5545934", "0.54861724", "0.54751205", "0.5471921", "0.546852", "0.54496706", "0.5435644", "0.53989005", "0.53935105", "0.53745294", "0.53367937", "0.53067...
0.6304722
1
RPC api call, lists all arguments of a sensor
def listSensorArgs(self, sensor=None): returnvalue = None if not sensor: pass else: sensor = self.db.getSensorByIdent(sensor) returnvalue = self.db.getSensorDict(sensor) return returnvalue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_info():", "def rpc(self) -> global___Rpc:", "def calls_cmd(args):\n r = requete(\"VoiceService.VoiceApplication:getCallList\")\n if r is None or not 'status' in r:\n return\n\n r = r['status']\n if len(args) == 1 and args[0] == '?':\n return print(r[0]....
[ "0.6629112", "0.59871316", "0.57738215", "0.57366514", "0.5699133", "0.5685285", "0.5684429", "0.5664077", "0.56445086", "0.54334176", "0.5389509", "0.5366804", "0.53633016", "0.5363134", "0.5350959", "0.53481513", "0.5347571", "0.533289", "0.5327297", "0.53271383", "0.531899...
0.62036693
1
returns a list of a 2 value tuple, key, arguments. Arguments are a list of arguments, each containing a list containing the name, type, optionality and description
def listPrototypes(self, module=None): returnvalue = None try: module = self.db.getModule(module) except DoesNotExist: returnvalue = None else: rpcs = self.db.getRPCs(module, 'add') returnvalue = [(rpc.Key, [(arg.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPair(self, args):\r\n return self.name, self.getValue(args)", "def args(self) -> tuple[Basic, ...]:\n return self._args", "def get_json_argument_list():\n list_of_arguments_to_get = [\"finish_time\", \"segmentation_training_samples\", \"patch_count_per_image\", \"learning_rate\", \"batc...
[ "0.6293299", "0.62735635", "0.6106884", "0.61037457", "0.60892504", "0.60835505", "0.60782856", "0.6032734", "0.599288", "0.5980638", "0.59729356", "0.5970055", "0.5867083", "0.5850874", "0.5845503", "0.58453166", "0.5821932", "0.5813906", "0.5792243", "0.5780724", "0.5774805...
0.0
-1
Start the api handler thread
def run(self): self.logger.info("start consuming api calls") while not self.shutdown: self.rpc.listen()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_API():\n\n print(\"Starting OrderManager API Server.\")\n thread_ordermanager_API.start()", "def _start(self):\n\n super(PySwitchLibApiDaemonRunner, self)._start()", "async def start(self):", "async def start(self):", "def run(self):\n while self.running:\n self.han...
[ "0.74724424", "0.69080186", "0.6738512", "0.6738512", "0.6694738", "0.66475725", "0.6623388", "0.65421504", "0.64729136", "0.64465594", "0.64427185", "0.64390844", "0.642696", "0.63928586", "0.63877904", "0.6363439", "0.6363371", "0.6354995", "0.62945694", "0.62651324", "0.62...
0.6741574
2
Parse a $$math$$ block
def parse_block_math(self, m): self.tokens.append({ 'type': 'block_math', 'text': m.group(1) })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_math_cmd(self, line):\n self.E_str = \"parse_math_cmd\"\n line = line.strip()\n\n new_var_name, metadata_name = self.get_variable_name(line)\n\n # Split the line by =\n words = line.split('=')\n _, maths = words\n maths = maths.replace(\"$\", \"\")\n ...
[ "0.6627344", "0.6515901", "0.6399946", "0.6230076", "0.6224127", "0.61547863", "0.6136919", "0.61289555", "0.6112584", "0.60356355", "0.5937152", "0.5899705", "0.5892373", "0.5864457", "0.58395207", "0.58043087", "0.5791234", "0.5728444", "0.5706931", "0.5688357", "0.5681846"...
0.78205043
0
`initialize` is called only once when the model is being loaded. Implementing `initialize` function is optional. This function allows the model to intialize any state associated with this model.
def initialize(self, args): # You must parse model_config. JSON string is not parsed here self.model_config = json.loads(args['model_config']) print("model_config:", self.model_config) self.input_names = [] for input_config in self.model_config["input"]: self.input_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def initialize(self, model):\n pass", "def initialize(self) -> None:\n self.model = load(self.path)", "def init_model(self):\n pass", "def initialize(self):\n pass", "def _initialize(self):\n pass", "def _initialize(self):\n ...
[ "0.7922824", "0.7833245", "0.7121588", "0.7108596", "0.70317143", "0.7006685", "0.7006685", "0.7006685", "0.69785035", "0.69778067", "0.696979", "0.696979", "0.696979", "0.696979", "0.696979", "0.69580877", "0.69351006", "0.69351006", "0.6934833", "0.68810725", "0.68810725", ...
0.0
-1
`execute` must be implemented in every Python model. `execute` function receives a list of pb_utils.InferenceRequest as the only argument. This function is called when an inference is requested for this model. Depending on the batching configuration (e.g. Dynamic Batching) used, `requests` may contain multiple requests...
def execute(self, requests): responses = [] for request in requests: infer_outputs = pb_utils.get_input_tensor_by_name( request, self.input_names[0]) im_infos = pb_utils.get_input_tensor_by_name(request, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExecuteBatch(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def ExecuteBatch(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n conte...
[ "0.6375495", "0.6375495", "0.6048663", "0.59890074", "0.5898378", "0.5888777", "0.5833882", "0.5833882", "0.5737521", "0.5663895", "0.5434578", "0.5345063", "0.5344431", "0.5314354", "0.527206", "0.52704257", "0.52529854", "0.52165484", "0.5213345", "0.52020395", "0.52017784"...
0.64383364
0
`finalize` is called only once when the model is being unloaded. Implementing `finalize` function is optional. This function allows the model to perform any necessary clean ups before exit.
def finalize(self): print('Cleaning up...')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _finalize(self):\n for model in self.models:\n model._finalize()", "def finalize(self):\n raise NotImplementedError('Must be implemented in subclasses.')", "def finalize(self):\n self.classifier.finalize()", "def finalize():\n pass", "def finalize():\n pass", "def fi...
[ "0.75447696", "0.70889837", "0.7084198", "0.7040922", "0.7040922", "0.69991946", "0.69760233", "0.69760233", "0.6966195", "0.6964688", "0.6964595", "0.6964595", "0.6964595", "0.6964595", "0.6964595", "0.6964595", "0.6962548", "0.69426155", "0.689655", "0.689655", "0.689655", ...
0.68017924
21
Loads data from a CSV file located at `csv_file`
def load_data_from_csv(csv_file, users_to_i = {}, items_to_i = {}): raw_data = [] with open(csv_file) as f: csvreader = csv.reader(f) # skipping first row (header) next(csvreader) for user, item in csvreader: raw_data.append((user, item)) return load_data_from_arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def load(csvfile):\n return PsychoPyCSV(csvfile)", "def get_data(self, csv_file):\n pass", "def load_dataset_from(csv_file: str) -> pd.DataFrame:\n\n print(\">>> LOADING DATASET FROM FILE {filename}\".format(filename=csv_file))\n if not csv_file.endswith(\".csv\"):...
[ "0.7783272", "0.7730919", "0.7629962", "0.7581937", "0.7467191", "0.74592704", "0.7457141", "0.7454635", "0.7404338", "0.7354931", "0.7325368", "0.7277852", "0.7268166", "0.7259237", "0.7245137", "0.7231865", "0.72284836", "0.7227219", "0.7214435", "0.7155065", "0.7096461", ...
0.735131
10
Generate a WMI base a specific marker Trace marker is used to identify the underlying object
def wmi_trace_marker(marker: Enum) -> Struct: return Struct( "version" / Int16ul, "type" / check_enum(marker), "flags" / Const(0xc0, Int8ul) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return f\"Marker at {super().__repr__()}\"", "def __repr__(self):\n return f\"Marker at {super().__repr__()}\"", "def get_reflect_marker(self):\r\n return Marker((255, 255, 255), self._screen)", "def export_base(self):\n \n return (self.typ + \" no \" + str...
[ "0.60454005", "0.60230863", "0.5618681", "0.53838336", "0.53631455", "0.53274184", "0.52811784", "0.52787894", "0.5269781", "0.5246951", "0.5200085", "0.51915157", "0.5154832", "0.5153821", "0.51111484", "0.51029664", "0.50822985", "0.50801104", "0.50572926", "0.50393933", "0...
0.6092112
0
Makes a system call to rest_auth.py, a Python script modified from
def getrmlsthelper(self): printtime('Downloading {} alleles'.format(self.analysistype), self.start) # Extract the path of the current script from the full path + file name homepath = os.path.split(os.path.abspath(__file__))[0] # Set the path/name of the folder to contain the new alleles...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth():\n pass", "def auth():\n pass", "def main():\n\n config_file = 'auth_demo.cfg'\n config = ConfigParser.SafeConfigParser({\n 'username':'',\n })\n config.read(config_file)\n if not config.has_section('auth_demo_login'):\n config.add_section('auth...
[ "0.6345018", "0.6345018", "0.5996943", "0.5966874", "0.5905733", "0.5859134", "0.57976", "0.576943", "0.57551086", "0.5743807", "0.5737722", "0.5687899", "0.5615365", "0.5601679", "0.55998474", "0.55698365", "0.55685717", "0.5567104", "0.55488694", "0.5520772", "0.55117303", ...
0.0
-1
Return data store for agency.
def kv(self): return self._consul.kv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_store(self) -> 'outputs.DataStoreInfoBaseResponse':\n return pulumi.get(self, \"data_store\")", "def _get_store(self):\n return self._store", "def data_store(self) -> pulumi.Input['DataStoreInfoBaseArgs']:\n return pulumi.get(self, \"data_store\")", "def getSessionStore(self):\n...
[ "0.64798516", "0.62940806", "0.6177713", "0.6065085", "0.59708", "0.5899037", "0.5863626", "0.58171207", "0.58065635", "0.57615834", "0.5732366", "0.5675867", "0.5629987", "0.55948126", "0.5584164", "0.5581087", "0.5557894", "0.5557404", "0.55573314", "0.5552282", "0.54406166...
0.0
-1
Removes anything the inmemory pseudodatabase contains, to ensure test independence.
def reset(self): self.jobs: Dict[int, JobRow] = {} self.events: Dict[int, List[EventRow]] = {} self.job_counter = count(1) self.queries: List[Tuple[str, Dict[str, Any]]] = [] self.notify_event = None self.notify_channels = [] self.periodic_defers: Dict[str, int] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n with database() as db:\n db.query(\"DELETE FROM persons WHERE person_name = 'test_person_a' OR person_name = 'test_person_b'\")", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "d...
[ "0.72212243", "0.7075657", "0.7075657", "0.7075657", "0.7075657", "0.7075657", "0.7075657", "0.691395", "0.68814236", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.6716124", "0.66772574", "0.6613947", "0.6603796", ...
0.0
-1
Calling a query will call the _ method on this class. Suffix is "run" if no result is expected, "one" if a single result, and "all" if multiple results.
def generic_execute(self, query, suffix, **arguments) -> Any: query_name = self.reverse_queries[query] self.queries.append((query_name, arguments)) return getattr(self, f"{query_name}_{suffix}")(**arguments)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query(self):\n return _run_query(self.query)", "def _run_query(self):", "def query(self, query):", "def query(self, **kwargs):", "def query(self):\n pass", "def query(self):", "def make_query(self):", "def __call__(self, query=None, limit=1, uid=None):\n\n # Query prefix\...
[ "0.6719964", "0.66792995", "0.64606917", "0.6383278", "0.6371573", "0.63211226", "0.627995", "0.6194975", "0.5992636", "0.58021146", "0.5753793", "0.57446074", "0.57445633", "0.56929576", "0.5677893", "0.56512135", "0.56392777", "0.56234354", "0.5610585", "0.55985904", "0.558...
0.61180556
8
Procedurally generates a table and adds it to the XML
def _add_table(self, name, offset, rot, half_size, friction, has_legs): # Create body for this table, and add it to worldbody table_body = new_body(name=name, pos=offset - np.array([0, 0, half_size[2]])) self.worldbody.append(table_body) # Create core attributes for table geoms ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildTables(self, xmlfile, htmlfile):\n t = xeputils.xeptable.XEPTable()\n for xep in self.xeps:\n # Do not include XEP readme and template in the table.\n if isinstance( xep.nr, ( int, long ) ) :\n t.updateXEP(xep)\n t.writeXMLTable(xmlfile)\n t...
[ "0.74516946", "0.72935635", "0.7018654", "0.70033413", "0.68429774", "0.68148804", "0.66371644", "0.65015805", "0.6497859", "0.6451108", "0.62612915", "0.61967397", "0.6164456", "0.6125158", "0.6068412", "0.6035069", "0.5993856", "0.59926885", "0.5904884", "0.58805615", "0.58...
0.0
-1
Configures correct locations for this arena
def configure_location(self): # Set floor correctly self.floor.set("pos", array_to_string(self.bottom_pos))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_locations():\n STATUS['locations']['monster'][0] = generate_random_coord(STATUS['grid_size'])\n STATUS['locations']['monster'][1] = generate_random_coord(STATUS['grid_size'])\n STATUS['locations']['weapon'][0] = generate_random_coord(STATUS['grid_size'])\n STATUS['locations']['weapon'][1] = gen...
[ "0.5902864", "0.5788083", "0.566627", "0.5588298", "0.55418116", "0.55088085", "0.5442755", "0.54118943", "0.53610355", "0.53148246", "0.53037614", "0.5274148", "0.5269604", "0.5227204", "0.52206093", "0.5210463", "0.52102774", "0.51957375", "0.51864976", "0.51828134", "0.517...
0.6191456
0
Runs any necessary postprocessing on the imported Arena model
def _postprocess_arena(self): # Create tables for i, (offset, rot, half_size, friction, legs) in enumerate( zip(self.table_offsets, self.table_rots, self.table_half_sizes, self.table_frictions, self.has_legs) ): self._add_table( name=f"table{i}", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocessor(self) :\n\t\tlogging.debug(\"nning AR post processor\")\n\t\tpass", "def main_modeling_pipeline():\n\n\n data_df = pd.read_csv('gs://aiplatformfilipegracio2020/head_train_data.csv')\n data_df = data_df[[LABEL, 'price', 'days_on_site']]\n\n class_weights = calculate_class_weights(data_...
[ "0.63163775", "0.583071", "0.5803663", "0.57914853", "0.5732038", "0.5630254", "0.5630254", "0.5630254", "0.5630254", "0.5630254", "0.5598505", "0.5596272", "0.5550122", "0.55418843", "0.551331", "0.551143", "0.5502309", "0.5475127", "0.547062", "0.54696137", "0.5464052", "...
0.51183176
99
Edit created order by its primary key
def editOrder(request, pk): order = Meal.objects.get(pk=pk) form = OrderForm(instance=order) if request.method == 'POST': filledForm = OrderForm(request.POST, instance=order) if filledForm.is_valid(): filledForm.save() form = filledForm note = "Your order ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_order():", "def update_order():", "def create_order():", "def put_new_order(self, item: dict):\n return self.table_connection.put_item(Item=item)", "def save(self, *args, **kwargs):\n if not self.order_number:\n self.order_number = self._generate_order_number()\n ...
[ "0.7377786", "0.7377786", "0.6603852", "0.6351103", "0.6250598", "0.6250598", "0.6185037", "0.6178835", "0.60784626", "0.60784626", "0.6042809", "0.5995732", "0.5981196", "0.5974003", "0.59242314", "0.5906804", "0.5896384", "0.5890739", "0.58623105", "0.58623105", "0.58623105...
0.56949407
34
Determines the server's behaviour using urls.
def run_server_by_urls(getter_url, handler_url): get_method = find_getter(getter_url) logger.debug('start serving') get_method(getter_url, handler_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_urls(self):\n base_test_url = 'http://{}:{}/'.format(TESTING_CONFIG['host'],\n TESTING_CONFIG['port'])\n self.conn._host_url == base_test_url\n self.conn.aheader_url == base_test_url + 'analysis_header'\n self.conn.atail_url == base...
[ "0.6468079", "0.6056906", "0.5978593", "0.5850525", "0.57687324", "0.56448376", "0.5586892", "0.5585556", "0.5571096", "0.5512941", "0.55023026", "0.5501335", "0.5497448", "0.5475079", "0.5463967", "0.54323035", "0.5373179", "0.5372019", "0.5353865", "0.5350774", "0.53449684"...
0.5297544
27
Test loading the data into memory
def test_loading(self): self.assertIsInstance(self.data.districts, list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_test_data(self):\n self._save_test_data()", "def load_data(self) -> None:", "def load_data(self):", "def test_002_load_data(self):\n __test = chess_storage.ChessStorage()\n __test_filename = consts.TEST_FILENAME\n __test_data = list(range(consts.TEST_LIST_LENGHT))\n ...
[ "0.76403165", "0.75613415", "0.74405694", "0.73429775", "0.698014", "0.6953178", "0.69166166", "0.6904472", "0.68588537", "0.676182", "0.6701181", "0.6680089", "0.6637727", "0.6630223", "0.66285294", "0.6604002", "0.6601542", "0.65942174", "0.6586814", "0.65772706", "0.656904...
0.6041755
72
Test that we can retrieve actual data
def test_retrieval(self): self.assertIsInstance(self.data.get_district_by_name( "New Paltz Central School District" ), shapefile._ShapeRecord) self.assertIsInstance(SocialNPHS.data.district, shapefile._ShapeRecord) with self.assertRaises(IndexError): self.data.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_object_get_details(self):\n pass", "def test_get_info(self):\n pass", "def test_get_record(self):\n pass", "def test_get(self):\n pass", "def test_get_records(self):\n pass", "def test_raw_data(self):\n self.assertEqual(self.tester.raw_data, 1)", ...
[ "0.83040386", "0.7592085", "0.7570853", "0.75216335", "0.750367", "0.74942774", "0.74742824", "0.74613625", "0.73578", "0.7357461", "0.7232688", "0.72317475", "0.71951586", "0.71870357", "0.71821666", "0.7178218", "0.71503276", "0.7138974", "0.7121461", "0.7082353", "0.705159...
0.0
-1
If input object is an ndarray it will be converted into a dict holding dtype, shape and the data, base64 encoded.
def default(self, obj): numpy_types = ( np.bool_, # np.bytes_, -- python `bytes` class is not json serializable # np.complex64, -- python `complex` class is not json serializable # np.complex128, -- python `complex` class is not json serializable # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, obj):\n if isinstance(obj, np.ndarray):\n if obj.flags['C_CONTIGUOUS']:\n obj_data = obj.data\n else:\n cont_obj = np.ascontiguousarray(obj)\n assert(cont_obj.flags['C_CONTIGUOUS'])\n obj_data = cont_obj.data...
[ "0.7285015", "0.7285015", "0.7259372", "0.7155377", "0.7137759", "0.6932167", "0.6918994", "0.6918994", "0.6918994", "0.64177775", "0.6341543", "0.6310709", "0.5843858", "0.5809174", "0.58036816", "0.5672971", "0.5655243", "0.56076634", "0.55190325", "0.5500997", "0.5490805",...
0.0
-1
Read dense Jester dataset and split train/test data randomly.
def read_jester_data(fname='jester-dense-subset-100x20.csv'): logging.info('reading data') try: data = pd.read_csv(fname) except IOError as err: print str(err) url = 'https://gist.github.com/macks22/b40ac9c685e920ad3ca2' print 'download from: %s' % url sys.exit(DATA_N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_train_test_split():\n # Load all documents\n conn = sq.connect(config.DB_FILE)\n documents = pd.read_sql_query('select pubmed_id, review_id, included, title, abstract from article ', conn)\n\n # Identify unique review IDs\n review_ids = documents['review_id'].unique()\n\n # Set seed for random sampli...
[ "0.6528886", "0.64985585", "0.6490711", "0.64342165", "0.6429354", "0.6394741", "0.6342159", "0.6324972", "0.6307256", "0.62858176", "0.6265146", "0.6257298", "0.6205019", "0.620443", "0.6178737", "0.6150126", "0.611777", "0.60921246", "0.60828966", "0.6066437", "0.60641325",...
0.74138194
0
Construct the Probabilistic Matrix Factorization model using pymc3. Note that the `testval` param for U and V initialize the model away from 0 using a small amount of Gaussian noise.
def build_pmf_model(train, alpha=2, dim=10, std=0.01): # Mean value imputation on training data. train = train.copy() nan_mask = np.isnan(train) train[nan_mask] = train[~nan_mask].mean() # Low precision reflects uncertainty; prevents overfitting. # We use point estimates from the data to intial...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_test(nu, fsigma_T, fsigma_P, models_in, amps_in, params_in, models_fit, label):\n # Generate fake data with some \"true\" parameters\n (D_vec, Ninv) = gen_data(nu, fsigma_T, fsigma_P, models_in, amps_in, params_in)\n Ninv_sqrt = np.matrix(linalg.sqrtm(Ninv))\n (dust_params, sync_params, cmb_p...
[ "0.56138206", "0.5586942", "0.55433214", "0.5351772", "0.529997", "0.52595276", "0.5223859", "0.5215091", "0.52088547", "0.5177972", "0.51590854", "0.50957006", "0.5061981", "0.5017527", "0.49781993", "0.49613118", "0.49568832", "0.4943264", "0.4940687", "0.49263063", "0.4922...
0.6167692
0
Build the original BPMF model, which we cannot sample from due to current limitations in pymc3's implementation of the Wishart distribution.
def build_bpmf_model(train, alpha=2, dim=10, std=0.01): n, m = train.shape beta_0 = 1 # scaling factor for lambdas; unclear on its use # Mean value imputation on training data. train = train.copy() nan_mask = np.isnan(train) train[nan_mask] = train[~nan_mask].mean() logging.info('building...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_mod_bpmf_model(train, alpha=2, dim=10, std=0.01):\n n, m = train.shape\n beta_0 = 1 # scaling factor for lambdas; unclear on its use\n\n # Mean value imputation on training data.\n train = train.copy()\n nan_mask = np.isnan(train)\n train[nan_mask] = train[~nan_mask].mean()\n\n # We...
[ "0.72188264", "0.61532706", "0.6023628", "0.5833241", "0.5797192", "0.5724574", "0.5723442", "0.5719858", "0.5715735", "0.56933236", "0.56768894", "0.56603485", "0.56331044", "0.5607353", "0.55702585", "0.55379814", "0.55144966", "0.5503024", "0.5484061", "0.5476444", "0.5475...
0.7269002
0
Build the modified BPMF model using pymc3. The original model uses Wishart priors on the covariance matrices. Unfortunately, the Wishart distribution in pymc3 is currently not suitable for sampling. This
def build_mod_bpmf_model(train, alpha=2, dim=10, std=0.01): n, m = train.shape beta_0 = 1 # scaling factor for lambdas; unclear on its use # Mean value imputation on training data. train = train.copy() nan_mask = np.isnan(train) train[nan_mask] = train[~nan_mask].mean() # We will use sepa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_bpmf_model(train, alpha=2, dim=10, std=0.01):\n n, m = train.shape\n beta_0 = 1 # scaling factor for lambdas; unclear on its use\n\n # Mean value imputation on training data.\n train = train.copy()\n nan_mask = np.isnan(train)\n train[nan_mask] = train[~nan_mask].mean()\n\n logging....
[ "0.6512337", "0.60092825", "0.567834", "0.5658303", "0.55903035", "0.5580925", "0.5573696", "0.5532462", "0.55020326", "0.5474026", "0.54726166", "0.54643524", "0.54269475", "0.5414196", "0.5403196", "0.5379074", "0.537768", "0.53350365", "0.5313411", "0.52971154", "0.5286176...
0.6656812
0
Check if a line is header.
def _is_header(line): line = line.strip() if line.startswith('#') or line.startswith('track') or line.startswith( 'browser'): # BED header return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_header(line):\n return line[0] == '>'", "def check_header(line):\n if line[:7] == '###### ':\n line = '<h6>' + line[7:] + '</h6>'\n elif line[:6] == '##### ':\n line = '<h5>' + line[6:] + '</h5>'\n elif line[:5] == '#### ':\n line = '<h4>' + line[5:] + '</h4>'\n elif li...
[ "0.90293974", "0.79356164", "0.7800237", "0.7654996", "0.7427677", "0.7177651", "0.71695125", "0.7159226", "0.7146845", "0.7069064", "0.70204705", "0.70001435", "0.69541633", "0.6851527", "0.68049", "0.66462415", "0.66202724", "0.6611603", "0.6611603", "0.64868945", "0.648689...
0.8483625
1
Parse lines to get reads from the input read file.
def parse(self, *args, **kwargs): if self.is_gzipped: fin = gzip.open(self.path, 'rb') else: fin = open(self.path, 'r') line_num = 0 expect_header = True for line in fin: line_num += 1 line = line.strip() if not line: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __read_lines__(self):\r\n fd = open(self.input_file, \"r\")\r\n lines = fd.readlines()\r\n fd.close()\r\n return lines", "def process_lines(self, lines):\n line_index = 0\n n_lines = len(lines)\n while line_index < n_lines:\n if lines[line_index].st...
[ "0.69258976", "0.66003734", "0.65865076", "0.65514225", "0.65241826", "0.6469301", "0.6401494", "0.63737977", "0.6328333", "0.62591934", "0.6223086", "0.6206942", "0.6202654", "0.61415637", "0.6081667", "0.60471404", "0.6029287", "0.60218334", "0.6015924", "0.5982434", "0.598...
0.0
-1
Parse lines to get reads from the input read file.
def parse(self, paired=False, shift=100): for read in self.handle: if read.is_unmapped or read.is_qcfail or read.is_secondary \ or read.is_supplementary: continue if paired: if not read.is_paired: logger.debug( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __read_lines__(self):\r\n fd = open(self.input_file, \"r\")\r\n lines = fd.readlines()\r\n fd.close()\r\n return lines", "def process_lines(self, lines):\n line_index = 0\n n_lines = len(lines)\n while line_index < n_lines:\n if lines[line_index].st...
[ "0.69234943", "0.66012603", "0.65864605", "0.65512294", "0.6521317", "0.6467308", "0.6402224", "0.63724", "0.6326894", "0.6258525", "0.62227803", "0.6207747", "0.6200397", "0.61411375", "0.60814875", "0.604438", "0.6026843", "0.602283", "0.60144675", "0.5981471", "0.5980653",...
0.0
-1
Get proper read parser for the given format.
def get_read_parser(format): format = format.lower() if format == 'bed': return BedReadParser elif format == 'bedpe': return BedPeReadParser elif format == 'sam': return SamReadParser elif format == 'bam': return BamReadParser else: raise ValueError(f"unkn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parser(filepath, cfg):\n if not os.path.isfile(filepath):\n LOG.error('File not found: %s', filepath)\n return\n valid_parsers = importer.get_parsers(filepath, cfg)\n if not valid_parsers:\n LOG.error('No parsers found for file: %s', filepath)\n return\n\n if len(va...
[ "0.6131928", "0.60937136", "0.6045996", "0.58665407", "0.58590126", "0.5809873", "0.58025086", "0.57651305", "0.5758732", "0.57091504", "0.5667895", "0.5651484", "0.56421953", "0.5586466", "0.55685693", "0.5534864", "0.5503993", "0.54882073", "0.54529166", "0.54084545", "0.53...
0.88633776
0
Test a recursive merge of two status dictionaries
def test_recursive_update(): test = Status.update_dict({'generation': TEST_1_ATTRS_1}, {'generation': TEST_1_ATTRS_2}) assert test['generation']['run_id'] == TEST_1_ATTRS_1['run_id'] assert test['generation']['job_status'] == TEST_1_ATTRS_2['job_status']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recursive_merge(self):\n dict_1 = {\n 'key': {\n 'deep_key_1': 'original_value_1',\n 'deep_key_2': 'original_value_2'\n }\n }\n dict_2 = {\n 'key': {\n 'deep_key_2': 'new_value_2',\n 'deep_key...
[ "0.70699894", "0.68547225", "0.68238133", "0.66119456", "0.65711254", "0.65020204", "0.6499048", "0.6461705", "0.6442443", "0.6428743", "0.6409568", "0.63924336", "0.6374389", "0.6356342", "0.6348538", "0.6343374", "0.6339143", "0.6316803", "0.62815475", "0.62786376", "0.6271...
0.64845693
7
Test file creation and collection
def test_file_collection(): with tempfile.TemporaryDirectory() as STATUS_DIR: Status.make_job_file(STATUS_DIR, 'generation', 'test1', TEST_1_ATTRS_1) Status.make_job_file(STATUS_DIR, 'generation', 'test2', TEST_2_ATTRS_1) Status.update(STATUS_DIR) with open(os.path.join(STATUS_DIR, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_creation(data, logging_file_name):\n create_instance(data, logging_file_name)\n log_file_name = create_file_path(logging_file_name)\n print(log_file_name)\n if data is None or len(data) == 0:\n assert not os.path.exists(log_file_name)\n else:\n assert os.path.exists(log_f...
[ "0.7461448", "0.73518395", "0.73045737", "0.7251613", "0.7166898", "0.71258205", "0.70516205", "0.7050503", "0.70366", "0.7008296", "0.69309276", "0.6856841", "0.68465465", "0.6802331", "0.6774128", "0.6764452", "0.6762398", "0.6749557", "0.6735404", "0.6731379", "0.6729802",...
0.7302167
3
Test file creation and reading
def test_make_file(): with tempfile.TemporaryDirectory() as STATUS_DIR: Status.make_job_file(STATUS_DIR, 'generation', 'test1', TEST_1_ATTRS_1) status = Status.retrieve_job_status(STATUS_DIR, 'generation', 'test1') msg = 'Failed, status is "{}"'.format(status) assert status == 'R', m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_creation(data, logging_file_name):\n create_instance(data, logging_file_name)\n log_file_name = create_file_path(logging_file_name)\n print(log_file_name)\n if data is None or len(data) == 0:\n assert not os.path.exists(log_file_name)\n else:\n assert os.path.exists(log_f...
[ "0.7360315", "0.72867465", "0.7264493", "0.7150804", "0.7088082", "0.7009468", "0.69931275", "0.6988977", "0.69652444", "0.6931245", "0.6907508", "0.68741745", "0.6857578", "0.6853722", "0.6774158", "0.6766216", "0.6752629", "0.67525613", "0.6718231", "0.6716792", "0.6703876"...
0.6928599
10
Test job addition and exist check
def test_job_exists(): with tempfile.TemporaryDirectory() as STATUS_DIR: Status.add_job(STATUS_DIR, 'generation', 'test1', job_attrs={'job_status': 'submitted'}) exists = Status.job_exists(STATUS_DIR, 'test1') assert exists
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_addition():\n with tempfile.TemporaryDirectory() as STATUS_DIR:\n Status.add_job(STATUS_DIR, 'generation', 'test1')\n status1 = Status(STATUS_DIR).data['generation']['test1']['job_status']\n\n Status.add_job(STATUS_DIR, 'generation', 'test1',\n job_attrs={...
[ "0.72872704", "0.7204852", "0.68101156", "0.66714615", "0.6622515", "0.66078657", "0.6596242", "0.65822595", "0.6559245", "0.64998597", "0.64640236", "0.6440778", "0.64162385", "0.6409369", "0.63889015", "0.6380754", "0.63741344", "0.6320242", "0.62653357", "0.62551504", "0.6...
0.7668623
0
Test job addition and exist check
def test_job_addition(): with tempfile.TemporaryDirectory() as STATUS_DIR: Status.add_job(STATUS_DIR, 'generation', 'test1') status1 = Status(STATUS_DIR).data['generation']['test1']['job_status'] Status.add_job(STATUS_DIR, 'generation', 'test1', job_attrs={'job_status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_exists():\n with tempfile.TemporaryDirectory() as STATUS_DIR:\n Status.add_job(STATUS_DIR, 'generation', 'test1',\n job_attrs={'job_status': 'submitted'})\n exists = Status.job_exists(STATUS_DIR, 'test1')\n assert exists", "def test_matching_jobs_existin...
[ "0.7668623", "0.7204852", "0.68101156", "0.66714615", "0.6622515", "0.66078657", "0.6596242", "0.65822595", "0.6559245", "0.64998597", "0.64640236", "0.6440778", "0.64162385", "0.6409369", "0.63889015", "0.6380754", "0.63741344", "0.6320242", "0.62653357", "0.62551504", "0.62...
0.72872704
1
Test job addition and replacement
def test_job_replacement(): with tempfile.TemporaryDirectory() as STATUS_DIR: Status.add_job(STATUS_DIR, 'generation', 'test1', job_attrs={'job_status': 'submitted'}) Status.add_job(STATUS_DIR, 'generation', 'test1', job_attrs={'addition': 'test', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_addition():\n with tempfile.TemporaryDirectory() as STATUS_DIR:\n Status.add_job(STATUS_DIR, 'generation', 'test1')\n status1 = Status(STATUS_DIR).data['generation']['test1']['job_status']\n\n Status.add_job(STATUS_DIR, 'generation', 'test1',\n job_attrs={...
[ "0.726686", "0.6905744", "0.6609184", "0.6590907", "0.64921033", "0.6491962", "0.6479421", "0.6470252", "0.6433977", "0.63717645", "0.6351452", "0.63509756", "0.62832236", "0.62299746", "0.6220371", "0.62189835", "0.6209426", "0.620375", "0.6172135", "0.61520845", "0.61494327...
0.7602344
0
Execute module as pytest with detailed summary report.
def execute_pytest(capture='all', flags='-rapP'): fname = os.path.basename(__file__) pytest.main(['-q', '--show-capture={}'.format(capture), fname, flags])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(run_type, module, config):\n print(\" -----------------------------------------------------------------\")\n print(\" Beginning \" + run_type.lower() + \" test suite \")\n print(\" -----------------------------------------------------------------\")\n print(\"\")\n summary = run_quiet(run_...
[ "0.72504675", "0.68715066", "0.6861118", "0.67923087", "0.6693342", "0.66854435", "0.6595857", "0.6548619", "0.65412146", "0.6535354", "0.6469479", "0.6465738", "0.6464574", "0.64562017", "0.641981", "0.64085966", "0.637916", "0.63596404", "0.6356207", "0.63495654", "0.634263...
0.6190488
35
First, it finds the total amount of contacts for each listing_id. Second, it finds the top most contacted listings.
def find_top_five_most_contacted_listings_per_month(self): available_dates = self.contacts.quer_distinct_components("contact_date", "Contacts") available_listing_ids = self.contacts.quer_distinct_components("listing_id", "Contacts") self.ordered = {} for date in available_dates:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_listings(self):\n listing_ids = self.context.listing_ids\n if len(listing_ids) == 0:\n return\n listing_ids = [lid.lower() for lid in listing_ids]\n params = {\n 'limit': 0,\n 'offset': 0,\n 'lang': self.portal_state.language(),\n ...
[ "0.5714392", "0.5504233", "0.53158736", "0.52735156", "0.50318676", "0.50244784", "0.50148946", "0.50043106", "0.49452168", "0.49347422", "0.49322554", "0.4921248", "0.48818243", "0.48799545", "0.48490244", "0.4818993", "0.4793874", "0.4769546", "0.47455272", "0.46993467", "0...
0.7177975
0
Parses the collected data into a dict
def generate_dict_top_five(self): all_months = {} # Loops over each avilable non-duplicate date available_dates = self.contacts.quer_distinct_components("contact_date", "Contacts") for date in available_dates: top_five = self.ordered[date] all_months[date] = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data( self ):\n self.parsed_data = dict( self.results )", "def get_data(self):\n self.data = dict()\n # list to save all the attributes we are going to create\n self.attr = []\n # list to save all the groups available in the incomming input\n self.groups.extend...
[ "0.7335327", "0.69097733", "0.6876233", "0.66875476", "0.64781004", "0.6423315", "0.63635683", "0.6295866", "0.6179777", "0.6155332", "0.6152996", "0.6149452", "0.614944", "0.61326593", "0.6130262", "0.61247736", "0.611546", "0.60994387", "0.6095851", "0.6092316", "0.6058877"...
0.0
-1
Return a link to the image in its source Website or details about the image that help looking it up or debugging it. Override for your dataset, but pass to this function if you encounter images not in your dataset.
def image_reference(self, image_id): return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def get_image_link(self):\n table = self.soup.find('table')\n image_tag = table.find('img')\n image_name = self.soup.find_all(\"b\")[1].text\n return image_tag['src'], image_name\n\n # image = td.find_all('img')\n # print(image)\n # if imag...
[ "0.7356831", "0.7320701", "0.7044893", "0.69738954", "0.69392264", "0.6825294", "0.6793268", "0.6658253", "0.6630269", "0.658179", "0.6563168", "0.6563168", "0.6563168", "0.6556118", "0.65384156", "0.6535433", "0.64960885", "0.6488741", "0.6426024", "0.642439", "0.6424377", ...
0.0
-1
Prepares the Dataset class for use.
def prepare(self, class_map=None): def clean_name(name): """Returns a shorter version of object names for cleaner display.""" return ",".join(name.split(",")[:1]) # Build (or rebuild) everything else from the info dicts. self.num_classes = len(self.class_info) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(self):\n if self.opts['verbose']:\n print(\"Preparing dataset (one-time operation)...\")\n # Create paths files and load them back in\n self._build_ID_sets()\n self._create_ID_files()\n self._load_ID_files()\n if self.opts['verbose']:\n pr...
[ "0.7758656", "0.7241418", "0.7239436", "0.7222972", "0.7210236", "0.72034883", "0.70932466", "0.7042313", "0.6992051", "0.694836", "0.69467616", "0.6880937", "0.68526316", "0.680469", "0.67841667", "0.6780072", "0.67789966", "0.67789966", "0.6729223", "0.6705986", "0.66246676...
0.6476941
30
Returns a shorter version of object names for cleaner display.
def clean_name(name): return ",".join(name.split(",")[:1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_names_short(self):\r\n return [p.get_name() for p in self.people]", "def get_names_from_full_objects(objects):\n return [obj.name for obj in objects]", "def __str__(self):\n name=''\n for prop in self.properties.itervalues():\n name+=str(prop)\n return name", ...
[ "0.6896629", "0.68546605", "0.6810425", "0.6623793", "0.66023505", "0.6594769", "0.64818907", "0.6474733", "0.6473779", "0.64563364", "0.6453014", "0.64212185", "0.6386153", "0.6386153", "0.6374827", "0.6345542", "0.6344488", "0.6342986", "0.63186526", "0.63086903", "0.629974...
0.0
-1
Takes a source class ID and returns the int class ID assigned to it.
def map_source_class_id(self, source_class_id): return self.class_from_source_map[source_class_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source_class_id(self, class_id, source):\n info = self.class_info[class_id]\n assert info['source'] == source\n return info['id']", "def get_source_class_id(self, class_id, source):\n info = self.class_info[class_id]\n assert info['source'] == source\n return inf...
[ "0.8493009", "0.8493009", "0.6766999", "0.6760587", "0.6760587", "0.66088873", "0.6549115", "0.6302364", "0.62795174", "0.6275053", "0.6236329", "0.6236329", "0.61188203", "0.6107271", "0.59653497", "0.5949911", "0.58152884", "0.572042", "0.5719192", "0.5719192", "0.5719192",...
0.7406211
3
Map an internal class ID to the corresponding class ID in the source dataset.
def get_source_class_id(self, class_id, source): info = self.class_info[class_id] assert info['source'] == source return info['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_source_class_id(self, source_class_id):\n return self.class_from_source_map[source_class_id]", "def map_source_class_id(self, source_class_id):\n return self.class_from_source_map[source_class_id]", "def map_id_to_idx(self, class_ids):\n class_idx = torch.zeros(class_ids.shape, dty...
[ "0.73133224", "0.73133224", "0.67706954", "0.6197687", "0.6047091", "0.6020897", "0.59112316", "0.58618355", "0.5850386", "0.5751023", "0.5733445", "0.56539035", "0.56316966", "0.56235695", "0.562181", "0.5613915", "0.5586703", "0.54934883", "0.5488558", "0.54843575", "0.5481...
0.6395847
4