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
Test checker for whether matching is stable or not.
def test_check_stability(): residents = [Resident("A"), Resident("B"), Resident("C")] hospitals = [Hospital("X", 2), Hospital("Y", 2)] (a, b, c), (x, y) = residents, hospitals a.set_prefs([x, y]) b.set_prefs([y]) c.set_prefs([y, x]) x.set_prefs([c, a]) y.set_prefs([a, b, c]) gam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check():", "def match(self) -> bool:", "def test_match_correct(self, event: Event, pr_algorithm, minimal_state: State):\n assert pr_algorithm.match(event, minimal_state)", "def check_stability(self):", "def test_match_left_none():\r\n runmatch(lcode_left_none)", "def test_match_right_none()...
[ "0.594465", "0.594353", "0.5866137", "0.58372444", "0.5782722", "0.57116014", "0.569137", "0.5661478", "0.5660017", "0.5641539", "0.5637666", "0.56293386", "0.5627196", "0.5614456", "0.56038964", "0.5542264", "0.55329216", "0.5529746", "0.5523878", "0.5474978", "0.54693824", ...
0.51438534
79
parses the options for the planning including the targets
def parse_options(site, darkness, date, plan_range): # parse targets opts = {} opts.update(parse_date(date)) opts.update(parse_range(plan_range)) opts.update(parse_site(site)) opts.update(parse_darkness(darkness)) return opts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n opt = self.gather_options()\n opt.isTrain = self.isTrain # train or test\n\n # process opt.suffix\n if opt.suffix:\n suffix = ('_' + opt.suffix.format(**vars(opt))) if opt.suffix != '' else ''\n opt.name = opt.name + suffix\n\n opt.f_map...
[ "0.62074244", "0.59689", "0.59588844", "0.5875803", "0.5780339", "0.5754228", "0.57520694", "0.5705439", "0.5700765", "0.56824964", "0.5640865", "0.5615099", "0.5609186", "0.5605042", "0.5589972", "0.55796164", "0.5563828", "0.5488467", "0.548542", "0.5478226", "0.54763347", ...
0.67171156
0
parse the range options
def parse_range(option): return {"range": timedelta(days=option)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_range(option, opt_str, value, parser):\n # Preserve the original option string for print output.\n\n parser.values.ensure_value(\"raw_%s\" % option.dest, value)\n\n # Place the max and min into a single entry for each found\n # threshold. This lets a user see all possible ranges passed by\n...
[ "0.68641734", "0.64663", "0.6461454", "0.6431249", "0.64209527", "0.6322825", "0.6321341", "0.6262145", "0.6225956", "0.61157084", "0.60893756", "0.6082446", "0.60010207", "0.5982482", "0.5957853", "0.58720285", "0.58702815", "0.5854096", "0.5840488", "0.5828852", "0.5792684"...
0.7645768
0
parse date and range
def parse_date(option): date_opt = option date = Time(datetime.utcnow()).datetime if date_opt is not None: date = Time(date_opt, scale="utc").datetime date = datetime(date.year, date.month, date.day) return {"date": date}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date_range(\n date_range: str,\n) -> Tuple[Optional[datetime.date], Optional[datetime.date]]:\n date_range = date_range.lstrip(\"\\\\\")\n split = date_range.split(\"-\")\n if len(split) > 2:\n raise ValueError(\n \"Invalid date range, should only specify one dash in date ra...
[ "0.69496834", "0.6842823", "0.67660517", "0.6615257", "0.65185654", "0.64432776", "0.64398843", "0.6386422", "0.6376004", "0.6292795", "0.6227388", "0.62164617", "0.6211114", "0.6141747", "0.6140293", "0.61234504", "0.6117977", "0.6112637", "0.6109786", "0.6046468", "0.604065...
0.0
-1
main function of the tool that performs the planning
def plan_targets(target, site, darkness, date, plan_range): targets = iop_targets.resolve_target_list(target) options = parse_options(site, darkness, date, plan_range) summarize_options(options, targets) # Setup the nights to plan and calculate sun rise/set times planned_nights = iop_nights.setup_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\t# GET THE DIALOG CONTENT\n\tpolicyFlag = int(sys.argv[3])\n\tif policyFlag == 0:\n\t\texistedIterNum = 15000\n\t\texistedThetaFileName = 'algorithms/theta/cycle_tree/of0w1.0g5v0.0625l0.05'\n\telif policyFlag == 1:\n\t\texistedIterNum = 10000\n\t\texistedThetaFileName = 'algorithms/theta/cycle_tree/o...
[ "0.7199436", "0.7175628", "0.71665376", "0.7101281", "0.6975896", "0.69690853", "0.6864884", "0.6853323", "0.6847819", "0.6827581", "0.68167394", "0.67758334", "0.67334515", "0.67334515", "0.67334515", "0.67334515", "0.67334515", "0.67334515", "0.67334515", "0.67334515", "0.6...
0.0
-1
Testing to check if the PVC volume was created successfully
def test_pvc_creation(self, mock_logger, mock_run_to_compl, mock_pvc_create): self.assertIsInstance(init_pvc(self.data, self.filer), PVC)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pvcvolume_attach(self):\n v = self.cs.volumes.get('pvcvolume')\n self.cs.volumes.attach(v, 1, '/dev/vdc')\n self.cs.assert_called('POST',\n '/volumes/pvcvolume/action')", "def test_create_volume(self, mock_ghn):\n ctxt = context.get_admin_context(...
[ "0.7457292", "0.7293168", "0.7195492", "0.6962155", "0.68749386", "0.6638356", "0.6575415", "0.65737724", "0.65491074", "0.6500569", "0.6487423", "0.64540786", "0.6361075", "0.63578856", "0.63056785", "0.6305089", "0.6280213", "0.62753564", "0.6267789", "0.6223779", "0.619556...
0.66817355
5
Testcase for finding if the PVC creation failed with exit 0
def test_pvc_failure(self, mock_logger, run_to_compl, mock_pvc_create, mock_pvc_delete): self.assertRaises(SystemExit, init_pvc, self.data, self.filer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pvc_creation(self, mock_logger, mock_run_to_compl, mock_pvc_create):\n self.assertIsInstance(init_pvc(self.data, self.filer), PVC)", "def test_vmfactory_fail(self):\n self.command.output = \"foo.vmx\"\n with self.assertRaises(VMInitError):\n self.command.package = self.in...
[ "0.64863044", "0.636269", "0.6359872", "0.6171155", "0.61627007", "0.61235106", "0.6072229", "0.60417724", "0.602527", "0.5993727", "0.5867872", "0.585176", "0.5840988", "0.5839947", "0.5835358", "0.57915354", "0.5782399", "0.5769757", "0.57690483", "0.56890714", "0.56839293"...
0.7272803
0
Test that fetched Malware objects are wellformed
def test_index(populate_malware, authenticated_client): names = [malware.name for malware in populate_malware] for name in names: query_json = {'name': name} rv = authenticated_client.post('/api/entities/filter/', data=json.dumps(query_json), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_malware_have_techniques(attck_fixture):\n for malware in attck_fixture.enterprise.malwares:\n if malware.techniques:\n assert getattr(malware,'techniques')", "def test_malware_have_actors(attck_fixture):\n for malware in attck_fixture.enterprise.malwares:\n if malware.acto...
[ "0.6753312", "0.62137586", "0.62131786", "0.6054662", "0.604343", "0.59996074", "0.5981002", "0.5909198", "0.5886412", "0.5814652", "0.57630396", "0.57399", "0.5711823", "0.57050747", "0.5703893", "0.56574583", "0.563821", "0.5593698", "0.55885243", "0.55871683", "0.55865103"...
0.6298893
1
Tests updating a new object via PUT.
def test_put(populate_malware, authenticated_client): rv = authenticated_client.get('/api/entities/{0:s}/'.format(populate_malware[0].id)) entity_json = json.loads(rv.data) rv = authenticated_client.put('/api/entities/{0:s}/'.format(entity_json['id']), data=json.dumps({'lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_method(self):\n self.getPage('/blah', method='PUT')\n self.assertStatus('200 OK')\n self.assertHeader('Content-Type', 'application/json')\n self.assertBody('{\"mystring\": \"blah\"}')", "def taco_test_put_update(self):\n body = '{ \"id\": 400, \"name\": \"item4\", ...
[ "0.8103551", "0.80811286", "0.77770305", "0.77689296", "0.77537143", "0.7665791", "0.7640661", "0.7604226", "0.7553142", "0.7541913", "0.7483781", "0.7395787", "0.7386326", "0.73781395", "0.73470914", "0.73064786", "0.7275389", "0.7244537", "0.72116286", "0.71898234", "0.7184...
0.0
-1
The logger gets initialized with a name (logger by default), which is also part of the name of the logfiles, if persistence is enabled. If rotation_interval (log rotation interval) is set to 0 (default), all output will be written to a single log file. When rotation is enabled,
def __init__(self, name="logger", loglevel=3, persist=True, flush=True, rotation_interval=1, format="text"): self.name = name self.loglevel = loglevel self.persist = persist self.flush = flush self.format = format self.rotation_interval = rot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_logbook(name, extension='.txt', level=logging.INFO, soloDir = True):\n formatter = logging.Formatter(fmt='%(asctime)s.%(msecs)03d (%(name)s) - %(message)s', datefmt='%d-%m-%y %H:%M:%S')\n date = datetime.today().strftime('%Y-%m-%d')\n if soloDir:\n log_path = str(settings.DATA_DIR + name ...
[ "0.6630192", "0.65736866", "0.65538865", "0.6480561", "0.64405483", "0.64157355", "0.6408364", "0.640588", "0.6376535", "0.63044286", "0.62730765", "0.62329596", "0.62253886", "0.6189911", "0.6173905", "0.61433166", "0.61343294", "0.611963", "0.6104088", "0.61026853", "0.6079...
0.70223504
0
convert parsed instruction format into pyparsing grammer
def build_grammer(ast): # example: # ['ldw', ['tgt', 'reg'], ',', ['offset', 's7'], '(', ['base', 'reg'], ')'] def lookup(name, type, modifier=None): g = globals()[type].setResultsName(name).setName(name) if modifier == plus: g = pp.Group(pp.delimitedList(g, delim=",")) d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_instruction(instruction: str) -> Tuple[int, int, int]:\n\t# NOOP\n\tif match := NOOP_REGEX.match(instruction):\n\t\tinstruction_type = 0\n\t# ADD\n\telif match := ADD_REGEX.match(instruction):\n\t\tinstruction_type = 1\n\t# MINUS\n\telif match := MINUS_REGEX.match(instruction):\n\t\tinstruction_type = ...
[ "0.605632", "0.60111564", "0.5925806", "0.58522624", "0.5783257", "0.57504004", "0.5728153", "0.5717114", "0.5711363", "0.5704006", "0.5698306", "0.5690248", "0.5654756", "0.5613274", "0.56095576", "0.5582052", "0.55348366", "0.5512344", "0.5498963", "0.54925406", "0.5473631"...
0.51525617
59
Check if norm layer is in correct train state.
def check_norm_state(modules, train_state): for mod in modules: if isinstance(mod, _BatchNorm): if mod.training != train_state: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_norm_state(modules, train_state):\n for mod in modules:\n if isinstance(mod, _BatchNorm):\n if mod.training != train_state:\n return False\n return True", "def has_emb_layer_norm_before(model_state):\n return any(k.startswith(\"emb_layer_norm_before\") for k, p...
[ "0.793346", "0.67689735", "0.661185", "0.6503076", "0.6476175", "0.6219339", "0.61168087", "0.6102992", "0.60851747", "0.5981991", "0.5981991", "0.5933828", "0.59312683", "0.59198314", "0.590348", "0.5878359", "0.5868085", "0.58631355", "0.58382577", "0.5830594", "0.58257794"...
0.8030396
1
Construct a new Transform object An array of operations that manipulate the trace data, for example filtering or sorting the data arrays.
def __init__(self, **kwargs): super(Transform, self).__init__('transforms') # Import validators # ----------------- from plotly.validators.heatmapgl import (transform as v_transform) # Initialize validators # --------------------- # Populate data dict with prop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, transforms):\n super().__init__(transforms)\n self.S1 = transforms[0]\n self.T1 = transforms[1]\n self.S2 = transforms[2]\n self.T2 = transforms[3]", "def __init__(self, transforms):\n self.transforms = transforms", "def __init__(self, transforms):\n...
[ "0.64450544", "0.6047228", "0.5957629", "0.59549063", "0.5921418", "0.58241445", "0.58241445", "0.58241445", "0.58241445", "0.58241445", "0.58241445", "0.58241445", "0.57942915", "0.5784964", "0.5783769", "0.5750437", "0.5715402", "0.56863594", "0.56863594", "0.56863594", "0....
0.51939946
55
Return the cosine similarity between vector a and b.
def cos_sim(a, b): numerator, sosA, sosB = 0, 0, 0 #sum of squares for denom for i in movies: #replace movies numerator += (ratingai * ratingbi) sosA += ratingai * ratingai sosB += ratingbi * ratingbi denom = sqrt(sosA * sosB) #make sure denom won't be 0! return numerator / deno...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(a, b):\n cs = dot_product(a, b)/(norm(a) * norm(b))\n return cs", "def cosine_similarity(cls, vec_a, vec_b):\n return np.dot(vec_a, vec_b) / \\\n (np.linalg.norm(vec_a) * np.linalg.norm(vec_b))", "def cosine_similarity(a, b):\n if a.ndim != 1 or b.ndim != 1:\n ...
[ "0.9152629", "0.9123586", "0.8628271", "0.85290915", "0.8427776", "0.8416829", "0.83845985", "0.83020973", "0.8284079", "0.8208634", "0.820216", "0.8121326", "0.8069175", "0.79891837", "0.7935514", "0.78413475", "0.78242147", "0.78125125", "0.77350307", "0.77096653", "0.76706...
0.73320496
31
Return the adjusted cosine similarity between vector a and b.
def adj_cos_sim(a, b, avg_a, avg_b): adj_a, adj_b = [], [] for val in a: #replace a, not necessarily a vector if we do OOP adj_a.append(val - avg_a) #negative res for val in b: adj_b.append(val - avg_b) return cos_sim(adj_a, adj_b) #is this slower than if I wrote it out/expanded it?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(a, b):\n cs = dot_product(a, b)/(norm(a) * norm(b))\n return cs", "def cosine_similarity(cls, vec_a, vec_b):\n return np.dot(vec_a, vec_b) / \\\n (np.linalg.norm(vec_a) * np.linalg.norm(vec_b))", "def cosine_similarity(a, b):\n if a.ndim != 1 or b.ndim != 1:\n ...
[ "0.87131846", "0.8546428", "0.8107705", "0.79870147", "0.79809254", "0.79333097", "0.7864782", "0.7748505", "0.7737781", "0.77308553", "0.7730662", "0.76590806", "0.7637511", "0.76223207", "0.7564928", "0.7562569", "0.75531864", "0.7344096", "0.7298929", "0.72495806", "0.7220...
0.7113526
24
Takes in a movie's ID and returns a list of strings representing the genres pertaining to the movie. Access the movies dataframe to convert the large concatenated string delimited by '|'.
def listGenres(movieId): genres = movies.at[movieId, 'genres'] #change movies to whatever variable name the movies df has genres = genres.split('|') return genres
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_genres(genres):\n\tgenre_list = []\n\tfor genre in genres:\n\t\tgenre_list.append(genre.name)\n\n\treturn \", \".join(genre_list)", "def _get_genre_vector(self, movie_id, list=False):\n if list:\n return self.movies[self.movies['movie_id'] == movie_id][self.genres].iloc[0].tolist()\n ...
[ "0.6485439", "0.6418141", "0.6309844", "0.629249", "0.61343706", "0.61148256", "0.60804826", "0.6047403", "0.6014202", "0.59429395", "0.5928665", "0.59123415", "0.5909058", "0.585417", "0.58491015", "0.5799681", "0.5774838", "0.577413", "0.5769358", "0.57170504", "0.5686664",...
0.84673285
0
Takes in a list of predicted ratings and a list of actual ratings for a set of movies and computes the mean absolute error of our predictions.
def mae(predicted, actual): #maybe make some assertions, assume have same length & in right order interm_total = 0 for i in range(len(predicted)): interm_total += abs(predicted[i] - actual[i]) return interm_total / len(predicted)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_absolute_error(predictions, ratings_test):\n return np.abs(predictions - np.array(ratings_test.rating)).mean()", "def mean_squared_error ( actuals, predictions ):\n return np.mean ( ( actuals - predictions ) ** 2 )\n # End mean_squared_error()", "def mean_squared_error ( actuals, predictions ...
[ "0.73422986", "0.7151543", "0.7151543", "0.7146762", "0.70993924", "0.69311756", "0.6910379", "0.68469757", "0.66862285", "0.66852677", "0.66530865", "0.6627376", "0.66062737", "0.6590158", "0.658878", "0.65615636", "0.6515388", "0.65142846", "0.64485", "0.6440558", "0.643734...
0.6110793
49
Takes in a list of predicted ratings and a list of actual ratings for a set of movies and computes the root mean square error of our predictions.
def rmse(predicted, actual): #maybe make some assertions, assume have same length & in right order interm_total = 0 for i in range(len(predicted)): interm_total += (predicted[i] - actual[i]) ** 2 return sqrt(interm_total / len(predicted))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error ( actuals, predictions ):\n return np.mean ( ( actuals - predictions ) ** 2 )\n # End mean_squared_error()", "def mean_squared_error ( actuals, predictions ):\n return np.mean ( ( actuals - predictions ) ** 2 )\n # End mean_squared_error()", "def mean_squared_error(prediction...
[ "0.7167294", "0.7167294", "0.7134918", "0.69895697", "0.6954634", "0.69295204", "0.69183964", "0.67908305", "0.67088586", "0.6700815", "0.6667378", "0.6665828", "0.65780556", "0.6568806", "0.6543323", "0.65049005", "0.6441019", "0.6425092", "0.6396935", "0.63875955", "0.63875...
0.6367347
22
clean up raw titles taken from BOMojo to facilitate better searches on OMDB/Twitter
def processTitle(title): cleaned = re.sub(r'[@#\"]+', '', title.lower().strip()) cleaned = re.sub(r'\(\d{4}.*\)', '', cleaned) cleaned = re.sub(r':.+', '', cleaned).strip() return cleaned
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_title(self, title):\n\t\t# strip apostrophes\n\t\tif '\\'' in title:\n\t\t\ttitle = re.sub('\\'', '', title)\n\t\tif '.' in title:\n\t\t\ttitle = re.sub('.', '', title)\n\t\treturn title", "def clean_title(title):\n title = re.sub(\"\\n\", \"\", title) # Remove newlines\n title = ' '.join(title...
[ "0.6604108", "0.6413314", "0.6245085", "0.62396383", "0.62070096", "0.6201837", "0.6178692", "0.61765945", "0.60911244", "0.6089713", "0.608802", "0.6075226", "0.6067024", "0.60305786", "0.59994125", "0.59956473", "0.594616", "0.59446096", "0.5936255", "0.59050155", "0.589108...
0.64549226
1
output a data table to CSV for visual inspection
def outputData(tname): table = pd.read_sql("SELECT * FROM {0}".format(tname), ENGINE) table.to_csv("data/{0}.csv".format(tname), sep=",", header=True, index=False, quoting=csv.QUOTE_NONNUMERIC)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self):\n self.tableView.df.to_csv('Data export.csv', index=False)\n print('CSV file exported')", "def generate_csv(table, header):\n with open(\"%s.csv\" % header, \"w\") as csvfile:\n for i in range(len(table)):\n for j in range(len(table[i])):\n i...
[ "0.75195706", "0.73774415", "0.719166", "0.7110487", "0.7089844", "0.70896596", "0.7071763", "0.70578736", "0.70538783", "0.7041552", "0.70119685", "0.6945632", "0.69442695", "0.6914141", "0.68514514", "0.6846723", "0.68346244", "0.68259144", "0.68199605", "0.680954", "0.6808...
0.7156569
3
pull the next date for which to search for new data
def findNextDate(cnx, firstdate): cur = cnx.cursor() cur.execute("SELECT gross_date FROM boxoffice ORDER BY gross_date DESC LIMIT 1") try: lastdate = cur.fetchone()[0] nextdate = datetime.strptime(lastdate, '%Y-%m-%d') + timedelta(days=1) nextdate = nextdate.strftime('%Y-%m-%d') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_release_date(date):\n df = get_release_dates()\n df = df[df['ReleaseDate'] > date]\n return df['ReleaseDate'].iloc[0]", "def find_next_valid(data, date):\n correct_date = None\n while correct_date is None:\n try:\n _ = data.loc[date]\n correct_date = date\n ...
[ "0.736613", "0.7089448", "0.7066551", "0.69742924", "0.6841013", "0.6803448", "0.6733757", "0.65900165", "0.6249408", "0.62220967", "0.62220967", "0.6202062", "0.61446637", "0.6117578", "0.6051559", "0.6039819", "0.602323", "0.5971371", "0.5857774", "0.5829712", "0.5808867", ...
0.67084557
7
scrape BOMojo for information on the top N movies in terms of daily gross
def getTopMovies(endpoint, date, count=10): try: response = urlreq.urlopen(endpoint.format(date)) soup = BeautifulSoup(response.read(), "html.parser") table = soup.find('table', border="0", cellpadding="5", cellspacing="1") tdata = [] for i, row in enumerate(table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_movies(genre: Genre) -> List[Movie]:\n\n html = download_top_movies(genre)\n soup = parse_top_movies(html)\n return [extract_movie(result) for result in soup]", "def scrape_movie_page(dom):\n # to save the information\n info = []\n\n # find the information block needed\n header =...
[ "0.71330565", "0.67618537", "0.6608621", "0.656355", "0.6549088", "0.6464945", "0.64557415", "0.6446494", "0.6415211", "0.6344131", "0.6254804", "0.62027013", "0.619816", "0.61576635", "0.61518717", "0.61433727", "0.6072192", "0.6044976", "0.60145175", "0.5932325", "0.5837514...
0.72936654
0
generate a tweepy API object to perform actions
def generateAPI(c_key, c_sec, a_tok, a_sec, **kwargs): auth = tweepy.OAuthHandler(c_key, c_sec) auth.set_access_token(a_tok, a_sec) api = tweepy.API(auth, **kwargs) return api
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_api():\n\n auth = tweepy.OAuthHandler(Consumer_key, Consumer_key_secret)\n auth.set_access_token(Access_token, Access_token_secret)\n api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)\n\n return api", "def __init__(self):\n auth = tweepy.OAuthHandler(co...
[ "0.72307414", "0.71253115", "0.709998", "0.69709504", "0.6892117", "0.6864982", "0.6747763", "0.6702982", "0.6688524", "0.6688524", "0.66325337", "0.66152906", "0.65276515", "0.65111357", "0.6489107", "0.64700675", "0.6451166", "0.644855", "0.64357334", "0.6417696", "0.641477...
0.69804233
3
process a given tweet to prepare it for storage
def processTweet(title, tweet, remove_title=False): # create a title regex and initialize a dictionary to hold results texp = r"#?" + r" ?".join(processTitle(title).split(" ")) results = {} # retrieve author metadata results['author_id'] = tweet.author.id results['author_name'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tweet(tweet):\n global start_date\n global end_date\n global geo_enabled_tweets\n global retweets\n\n # Check for filters before processing any further\n if args.filter and tweet.source:\n if not args.filter.lower() in tweet.source.lower():\n return\n\n tw_date = ...
[ "0.72721946", "0.7039031", "0.6736819", "0.6640499", "0.6595347", "0.6585862", "0.6540867", "0.65392375", "0.64957726", "0.6471852", "0.6453129", "0.6349555", "0.6304325", "0.61687505", "0.61530614", "0.61504155", "0.6125002", "0.61050314", "0.6098452", "0.60467815", "0.60453...
0.6764535
2
search twitter for tweets mentioning a given movie title
def searchMovie(api, title, date, count, retweets=False): since = date until = datetime.strptime(since, '%Y-%m-%d') + timedelta(days=1) until = until.strftime('%Y-%m-%d') query = "\"{0}\" since:{1} until:{2} -filter:links".format(processTitle(title), since, until) if retweets == False: que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_title(title):\n\turl = tmdb_api(\"search/movie\")+\"&query=\"+urllib.quote_plus(title)\n\tresponse = json.load(urllib2.urlopen(url))\n\treturn JSONResponse(response)", "def search_movies(title: str) -> list[tuple]:\n with connection:\n search = '%' + title + '%'\n return list(conne...
[ "0.6925293", "0.6724913", "0.64352965", "0.6390151", "0.6380741", "0.6323461", "0.6268078", "0.61828446", "0.6174598", "0.610009", "0.6096859", "0.60881114", "0.60233986", "0.5969585", "0.59671646", "0.59104264", "0.58904886", "0.5866746", "0.5842005", "0.5801552", "0.5786741...
0.68453336
1
retrieve movie metadata from OMDB
def getMovieInfo(endpoint, title, year): params = {'t': title, 'y': year, 'plot':'short', 'r':'json', 'tomatoes':'true'} response = requests.get(endpoint, params=params) try: response.raise_for_status() response = response.json() if 'Error' in response.keys(): raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOmdbInfo(title):\n baseUrl = \"http://www.omdbapi.com/?\"\n # parsing the API credentials to the base url\n credentialsData = urllib.parse.urlencode(credentials)\n finalUrl = baseUrl + credentialsData\n parameters = {\"t\": title} # Parameters to add a query to the url\n try:\n r =...
[ "0.70910835", "0.6855289", "0.6734887", "0.65963125", "0.6587276", "0.65848976", "0.65397507", "0.651509", "0.649011", "0.6487825", "0.6443921", "0.63679284", "0.636016", "0.63368636", "0.6247301", "0.623941", "0.6220363", "0.61828387", "0.6102056", "0.609643", "0.6065145", ...
0.622112
16
insert a new movie into the movies table
def insertMovie(cnx, title, date, results): try: cur = cnx.cursor() cur.execute('INSERT INTO movies VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', (title, date, results['Actors'], results['Director'], results['Genre'], results['Plot'], results['Rated'], results[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_movie_to_db(self):\n MOVIE.insert_one({\n \"title\": self.title,\n \"year\": self.year\n })", "def insert(self, movie):\n self._currentMovie = self.movies.add(movie)\n self._updateMovieList = True", "def create(movie):\n schema = MovieSchema()\n n...
[ "0.81389934", "0.75338364", "0.72310257", "0.7177825", "0.7136104", "0.7132212", "0.69271517", "0.6926719", "0.6923478", "0.68877876", "0.6880706", "0.68791896", "0.67456186", "0.6744896", "0.6655135", "0.6625037", "0.65993536", "0.6581402", "0.6463103", "0.6446574", "0.64421...
0.7341244
2
main driver program to gather daily data
def gatherData(): # connect to database, set up the tweepy API object, and find the next date to search cnx = sqlite3.connect(DB_FILE) api = generateAPI(wait_on_rate_limit=True, wait_on_rate_limit_notify=True, **CREDENTIALS) nextdate = findNextDate(cnx, FIRSTDATE) year = nextdate[:4] # attem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print get_latest_data()", "def main():\n credentials = get_credentials()\n now = datetime.datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time\n max = 7\n events = getEvents(credentials, now, max)\n if not events:\n print('No upcoming events found.')\n for event ...
[ "0.67580193", "0.6650759", "0.6525746", "0.64976233", "0.6491844", "0.64623386", "0.64084315", "0.6386345", "0.6351465", "0.6345402", "0.63255656", "0.6315899", "0.631295", "0.6292713", "0.6276271", "0.6266144", "0.6226493", "0.62246346", "0.6222256", "0.6209975", "0.61979985...
0.0
-1
Return a binding site name from a given agent.
def get_binding_site_name(agent): # Try to construct a binding site name based on parent grounding = agent.get_grounding() # We don't want to accidentally deal with very deep ontological # cases here such as CHEBI (e.g., GTP) which requires thousands # of lookups to resolve if grounding != (None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_name(self, obj):\n site = obj.site\n return (\"%s\" % (site.name))", "def server_agent_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"server_agent_name\")", "def server_agent_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"serv...
[ "0.60516745", "0.5991255", "0.5991255", "0.5868282", "0.5762695", "0.5751871", "0.54725695", "0.54660743", "0.5430123", "0.5412076", "0.5372198", "0.53381824", "0.5273435", "0.51932955", "0.5154005", "0.50929475", "0.50890386", "0.50785226", "0.5071362", "0.4990982", "0.49901...
0.83094543
0
Return site names for a modification.
def get_mod_site_name(mod_condition): if mod_condition.residue is None: mod_str = abbrevs[mod_condition.mod_type] else: mod_str = mod_condition.residue mod_pos = mod_condition.position if \ mod_condition.position is not None else '' name = ('%s%s' % (mod_str, mod_pos)) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_site_names(self, include = ['*'], exclude = []):\n \n raise NotImplementedError('get_site_names')", "def affecteds_names(self):\n return [m.name for m in self.affecteds]", "def get_urls(self):\r\n if self.mod.filename:\r\n return [x + self.mod.filename for x in se...
[ "0.59734267", "0.55854976", "0.54443717", "0.53902864", "0.5368823", "0.5288254", "0.52330816", "0.51733387", "0.5106047", "0.51046014", "0.5099322", "0.5099322", "0.5074785", "0.50735295", "0.5044799", "0.5037665", "0.5037665", "0.49848792", "0.49837267", "0.49308565", "0.48...
0.48955134
21
Create and return a new object. See help(type) for accurate signature.
def __new__(*args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_object():\n return object()", "def create(cls, _):\n return cls", "def __newobj__(cls, *args):\n return cls.__new__(cls, *args)", "def create(cls):\n pass\n return cls()", "def __new__(cls):\n return object.__new__(cls)", "def __new__(cls):\n return objec...
[ "0.75212413", "0.74254465", "0.7227017", "0.7224189", "0.7096888", "0.7096888", "0.7059055", "0.70071834", "0.69155335", "0.68690395", "0.6814675", "0.6812803", "0.6802038", "0.66921675", "0.6628809", "0.6586155", "0.6570953", "0.6558287", "0.6547422", "0.65455115", "0.654116...
0.0
-1
Implement setattr(self, name, value).
def __setattr__(self, *args, **kwargs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setattr__(self, name, value):\n self.set(**{name: value})", "def set_attr(self, name, value):\n setattr(self, name, value)", "def __setattr__(self, name, value):\n if not hasattr(self, name):\n raise AttributeError(\"'%s' object has no attribute '%s'\" % (type(self).__name...
[ "0.868889", "0.8361373", "0.8290292", "0.8283524", "0.82243794", "0.8204499", "0.8099823", "0.8099823", "0.8071226", "0.80402154", "0.8024459", "0.79978293", "0.79883593", "0.7987577", "0.79493016", "0.7936443", "0.79316676", "0.7890851", "0.78896946", "0.78018266", "0.775468...
0.0
-1
The combination of associate_user and load_extra_data functions of djangosocialauth. The reason for combining these two pipeline functions is to decrease the number of database visits.
def social_associate_and_load_data(backend, details, response, uid, user, social_user=None, *args, **kwargs): extra_data = backend.extra_data(user, uid, response, details) created = False if not social_user and user: social_user, created = UserSocialAuth.objects.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_extra_data(backend, details, response, uid, user, social_user=None,\n *args, **kwargs):\n social_user = social_user or \\\n UserSocialAuth.get_social_auth(backend.name, uid)\n if social_user:\n extra_data = backend.extra_data(user, uid, response, details)\n...
[ "0.6427262", "0.5478884", "0.5240445", "0.52389956", "0.5213373", "0.519633", "0.51899827", "0.5171619", "0.5155315", "0.51518744", "0.5148101", "0.5131034", "0.5093896", "0.50883776", "0.5074174", "0.5033296", "0.50316167", "0.50292736", "0.5025192", "0.50241655", "0.5004713...
0.6337023
1
Prettyprint a list of builders from a master.
def pp_builders(builders, master): columns = ['name', 'slavename', 'category'] title = 'outputting builders for: %s' % master notfound = 'no builders found.' pp_internal(builders, columns, title, notfound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllBuilders(self):\n names = self.status.getBuilderNames(categories=self.categories)\n builders = [self.status.getBuilder(n) for n in names]\n return builders", "def list_builders(self) -> List[str]:\n return sorted(_iter_builder_names(self._ns2data_dir))", "def listBuilderNames(...
[ "0.6192067", "0.60224825", "0.55578184", "0.55578184", "0.5387139", "0.53863895", "0.53175986", "0.52845865", "0.5281185", "0.5277838", "0.5247651", "0.52469724", "0.5176106", "0.512959", "0.5071999", "0.49349397", "0.49117327", "0.48857865", "0.48785007", "0.48488688", "0.48...
0.77710736
0
Expand builders which have multiple slaves into multiple builders with one slave each.
def dup_slaves(builders): def arrayify(possible_array): """Convert 'string' into ['string']. Leave actual arrays alone.""" if isinstance(possible_array, basestring): return [possible_array] return possible_array duped_slaves = [] for b in builders: for slave in arrayify(b['slavenames']): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slavebuilders(self):\n return self._get_slave_builders(lambda s:\n s.slavename in self._online_slaves and\n s.slavename not in self._busy_slaves)", "def pp_builders(builders, master):\n\n columns = ['name', 'slavename', 'category']\n title = 'outputting builders for: %s' % master\n notfound =...
[ "0.7009561", "0.5939224", "0.5697346", "0.554258", "0.52212834", "0.51657134", "0.51587296", "0.5150197", "0.51009035", "0.5070033", "0.5056523", "0.5022392", "0.5016884", "0.49988937", "0.49728", "0.49724874", "0.49134463", "0.48988444", "0.48966083", "0.48809367", "0.484797...
0.7059593
0
Convert 'string' into ['string']. Leave actual arrays alone.
def arrayify(possible_array): if isinstance(possible_array, basestring): return [possible_array] return possible_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strings_to_list(one_or_more_strings):\n if isinstance(one_or_more_strings, str):\n return [one_or_more_strings]\n else:\n return list(one_or_more_strings)", "def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input", "def explode(_...
[ "0.7060984", "0.7050311", "0.7019041", "0.6896074", "0.68879455", "0.6805283", "0.67713535", "0.67248327", "0.6600286", "0.6444824", "0.6418021", "0.6392094", "0.63635457", "0.63421506", "0.6302689", "0.62985396", "0.6285999", "0.62579507", "0.6233276", "0.6212226", "0.620852...
0.68721193
5
Return a list of builders which match what is specified in 'spec'.
def search(builders, spec): if 'builder' in spec: return [b for b in builders if b['name'] == spec['builder']] elif 'hostname' in spec: return [b for b in builders if b['slavename'] == spec['hostname']] else: return [b for b in builders if (b['name'] == spec['either...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose(builders, spec):\n\n candidates = search(builders, spec)\n buildername = get_builder(candidates, spec.values()[0])\n\n if not buildername:\n return None\n\n blder = [b for b in builders if b['name'] == buildername][0]\n\n return blder", "def getAllBuilders(self):\n names = self.status.g...
[ "0.7065604", "0.6366904", "0.6205621", "0.59313875", "0.5801212", "0.5716414", "0.5580702", "0.54017884", "0.5263097", "0.52591556", "0.5248544", "0.52406526", "0.52212656", "0.52202344", "0.5194147", "0.5179128", "0.5170816", "0.5136215", "0.51341134", "0.51207536", "0.51207...
0.76802087
0
Return a pair of (mastername, path) for all masters found.
def get_masters(): # note: ListMasters uses master.cfg hardcoded as part of its search path def parse_master_name(masterpath): """Returns a mastername from a pathname to a master.""" _, tail = os.path.split(masterpath) sep = '.' hdr = 'master' chunks = tail.split(sep) if not chunks or chunk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masters(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"masters\")", "def ListMasters(cue='master.cfg', include_public=True, include_internal=True):\n # Look for \"internal\" masters first.\n path_internal = os.path.join(\n BUILD_DIR, os.pardir, 'build_internal', 'm...
[ "0.7142009", "0.70371884", "0.68338263", "0.64809763", "0.6472665", "0.6472665", "0.6311474", "0.6304537", "0.62080437", "0.60861564", "0.6067843", "0.60515904", "0.60162145", "0.59996986", "0.5956191", "0.5953216", "0.5837279", "0.5673788", "0.56117886", "0.558528", "0.55739...
0.7571945
0
Returns a mastername from a pathname to a master.
def parse_master_name(masterpath): _, tail = os.path.split(masterpath) sep = '.' hdr = 'master' chunks = tail.split(sep) if not chunks or chunks[0] != hdr or len(chunks) < 2: raise ValueError('unable to parse mastername from path! (%s)' % tail) return sep.join(chunks[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_lookup = {}\n for mn, path in masters:\n master = {}\n master['mastername'] = mn\n master_lookup[mn] = path\n masternames.append(master)\n\n candidates = [mn for mn in masternames if mn['mastername'] == searchname...
[ "0.6372923", "0.6317169", "0.61556184", "0.610252", "0.60480016", "0.600932", "0.58795077", "0.58532685", "0.58285683", "0.5752388", "0.57484525", "0.5719935", "0.57097894", "0.56524986", "0.56494594", "0.564476", "0.564476", "0.564476", "0.5600287", "0.5599613", "0.5592351",...
0.8282636
0
Confirm a sequence only contains one unique value and return it.
def only_get_one(seq, key, source): def uniquify(seq): return list(frozenset(seq)) res = uniquify([s[key] for s in seq]) if len(res) > 1: print >>sys.stderr, 'error: %s too many %ss:' % (source, key) for r in res: print ' ', r return None elif not res: print 'error: %s zero %ss' % (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isdistinct(seq):\n return len(seq) == len(set(seq))", "def get_unique(self):\n return self.serie.nunique()", "def is_unique(self):\r\n return self._unique", "def uniq(seq):\r\n #TODO: consider building a set out of seq so that the if condition\r\n #is constant time -JB\r\n retur...
[ "0.6194614", "0.61632925", "0.6018149", "0.60084176", "0.59649074", "0.5959102", "0.5955434", "0.5943642", "0.59182596", "0.5835167", "0.58102876", "0.5796282", "0.5759754", "0.5730302", "0.56856775", "0.56828374", "0.5673099", "0.5668738", "0.55292314", "0.5515162", "0.54578...
0.625032
0
Return unique builder name from a list of builders.
def get_builder(slaves, keyval): errstring = 'string \'%s\' matches' % keyval return only_get_one(slaves, 'name', errstring)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBuilderNames():", "def listBuilderNames():", "def listBuilderNames():", "def GetBotNamesForBuilder(builders, builder_name):\n bots = []\n pool_names = builders['builders'][builder_name]['bot_pools']\n for pool_name in pool_names:\n for entry in builders['bot_pools'][pool_name]['bots']:\n bo...
[ "0.69416225", "0.6723085", "0.6723085", "0.65255445", "0.6470424", "0.63513696", "0.6288651", "0.6103744", "0.5903304", "0.5774765", "0.57546216", "0.56133306", "0.54580605", "0.5434363", "0.5427097", "0.5427097", "0.5319753", "0.5281067", "0.5212107", "0.52096176", "0.519287...
0.5666771
11
Search through builders matching 'spec' and return it.
def choose(builders, spec): candidates = search(builders, spec) buildername = get_builder(candidates, spec.values()[0]) if not buildername: return None blder = [b for b in builders if b['name'] == buildername][0] return blder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(builders, spec):\n if 'builder' in spec:\n return [b for b in builders if b['name'] ==\n spec['builder']]\n elif 'hostname' in spec:\n return [b for b in builders if b['slavename']\n == spec['hostname']]\n else:\n return [b for b in builders if (b['name'] ==\n ...
[ "0.74085414", "0.5914206", "0.5404804", "0.53804606", "0.53804606", "0.5173281", "0.51628286", "0.5149105", "0.5062585", "0.50532424", "0.5007297", "0.50054854", "0.49976838", "0.49824825", "0.4926369", "0.48937625", "0.48742664", "0.48677486", "0.48448572", "0.47606125", "0....
0.7681437
0
Connect to chromium LKGR server and get LKGR revision.
def get_lkgr(): try: conn = urllib.urlopen('http://chromium-status.appspot.com/lkgr') except IOError: return (None, 'Error connecting to LKGR server! Is your internet ' 'connection working properly?') try: rev = int('\n'.join(conn.readlines())) except IOError: return (None, 'Error c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLKGR():\n\n try:\n conn = urllib.urlopen('https://chromium-status.appspot.com/lkgr')\n except IOError:\n return (None, 'Error connecting to LKGR server! Is your internet '\n 'connection working properly?')\n try:\n rev = int('\\n'.join(conn.readlines()))\n except IOError:\n return...
[ "0.7639202", "0.5643532", "0.5526256", "0.5292058", "0.52112335", "0.5158212", "0.5131409", "0.51192427", "0.5084575", "0.5029493", "0.49947414", "0.4977814", "0.49504116", "0.49502164", "0.49388358", "0.49381736", "0.49336123", "0.49293384", "0.49293384", "0.49240768", "0.48...
0.76185536
1
Verify arguments are correct and prepare args dictionary.
def args_ok(inoptions, pos_args): if inoptions.factory_properties: for key in inoptions.factory_properties: setattr(inoptions, key, inoptions.factory_properties[key]) if inoptions.list_masters: return True if inoptions.build_properties and not inoptions.master_dir: if inoptions.build_properti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_args(self, args_):\n\n pass", "def __check_args(self):\n self.__check_args_type()\n self.__check_args_val()", "def check_arguments(self):\n ## only four test operation is permitted, if given anything apart from this, then it should print error message\n if (self.ar...
[ "0.7524365", "0.7385789", "0.7053287", "0.69999295", "0.6985941", "0.68912166", "0.68684274", "0.68312424", "0.67038983", "0.66816574", "0.6628343", "0.6617935", "0.661433", "0.6587311", "0.65323263", "0.65291506", "0.6506392", "0.6493578", "0.6490966", "0.6479323", "0.646865...
0.6173015
45
Output error and stop further steps.
def buildException(status, why): print >>sys.stderr, 'build error encountered:', why print >>sys.stderr, 'aborting build' status.code = 1 reactor.callFromThread(reactor.stop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize_error():\n print('')\n exit(-1)", "def exit_on_error(self) -> None:\n if self.errors:\n sys.exit(1)", "def stop_err(msg):\n sys.stderr.write('%s\\n' % msg)\n sys.exit(-1)", "def call_error():\r\n print(\"Error in input format.\")\r\n sys.exit()", "def should...
[ "0.76871026", "0.7620726", "0.72847825", "0.722326", "0.71368927", "0.70985675", "0.6998441", "0.6992924", "0.69576144", "0.69307584", "0.69207406", "0.6894901", "0.6878585", "0.6854247", "0.6834557", "0.6831641", "0.6812907", "0.6808463", "0.6802954", "0.6802954", "0.6787063...
0.0
-1
Tear down twisted session.
def finished(): print >>sys.stderr, 'build completed successfully' reactor.callFromThread(reactor.stop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self):\n logging.info(\"Shutdown\")\n self._sessionmanager.Shutdown()", "def close(self):\n self.__session.remove()", "def close(self):\n self.__session.remove()", "def close(self):\n self.__session.remove()", "async def shutdown(self, ctx):\n await se...
[ "0.70598125", "0.6998482", "0.6998482", "0.6998482", "0.6988004", "0.6942793", "0.69355035", "0.6903656", "0.68920654", "0.68756866", "0.68607336", "0.68400365", "0.68310785", "0.6735389", "0.6730148", "0.671928", "0.6656418", "0.66507643", "0.6634737", "0.66242105", "0.66220...
0.0
-1
Run the next step, optionally skipping if there is a stepfilter.
def startNextStep(steps, run_status, prog_args): def getNextStep(): if not steps: return None return steps.pop(0) try: s = getNextStep() if hasattr(prog_args, 'step_regex'): while s and not prog_args.step_regex.search(s.name): print >>sys.stderr, 'skipping step: ' + s.name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_step(self) -> None:", "def next_step(self):\n self.proceed()\n self.execute_current()", "def step(self, **kwargs):\n pass", "def step(self, step=None):\n pass", "def _step(self):\n pass", "def step(self):\n while self.state != STATE_TERMINAL:\n ...
[ "0.6615308", "0.65612143", "0.6438154", "0.63276404", "0.6169919", "0.61310494", "0.6100939", "0.60929835", "0.6047394", "0.60388684", "0.6027473", "0.5933554", "0.58823085", "0.5839381", "0.5839381", "0.5828136", "0.5741703", "0.56705713", "0.56664586", "0.56664586", "0.5660...
0.5515624
35
Check if the previous step succeeded before continuing.
def checkStep(rc, steps, run_status, prog_args): if (rc == FAILURE) or (rc == EXCEPTION): buildException(run_status, 'previous command failed') else: defer.maybeDeferred(lambda x: startNextStep(x, run_status, prog_args), steps)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready_to_proceed(self):\n if self.current_step is None or self.step_position == StepPosition.Before:\n return False\n\n for condition, _ in self.current_step.conditions:\n if condition.satisfied():\n return True\n return False", "def try_advance(self)...
[ "0.6924123", "0.6897496", "0.6432004", "0.64264905", "0.6425109", "0.63696253", "0.6231616", "0.6207607", "0.619148", "0.6149748", "0.61462504", "0.6142753", "0.614151", "0.6126543", "0.6112948", "0.6102814", "0.6095051", "0.60858077", "0.6071269", "0.60315263", "0.60169834",...
0.71053165
0
Print out a list of steps in the builder.
def generate_steplist(my_factory): steps = [] stepnames = {} for factory, cmdargs in my_factory.steps: cmdargs = cmdargs.copy() try: step = factory(**cmdargs) except: print >>sys.stderr, ('error while creating step, factory=%s, args=%s' % (factory, cmdargs)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_steps(steps, printer=logging.info):\n\n # Print steps and respective kwargs in pipeline\n for si, (class_object, kwargs) in enumerate(steps, 1):\n if not kwargs:\n printer('{}) {}'.format(si, class_object.__name__))\n continue\n\n # Width of kwarg keyword, to mak...
[ "0.71910936", "0.64591366", "0.6434415", "0.6221022", "0.6214201", "0.620257", "0.6115325", "0.61081594", "0.61029005", "0.60843486", "0.6066363", "0.6058359", "0.6048852", "0.60436594", "0.5989871", "0.59669226", "0.59497505", "0.5945767", "0.58630234", "0.5857588", "0.58519...
0.0
-1
Given a string, load all masters and pick the master that matches.
def choose_master(searchname): masters = get_masters() masternames = [] master_lookup = {} for mn, path in masters: master = {} master['mastername'] = mn master_lookup[mn] = path masternames.append(master) candidates = [mn for mn in masternames if mn['mastername'] == searchname] errstring ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_masters():\n\n # note: ListMasters uses master.cfg hardcoded as part of its search path\n def parse_master_name(masterpath):\n \"\"\"Returns a mastername from a pathname to a master.\"\"\"\n _, tail = os.path.split(masterpath)\n sep = '.'\n hdr = 'master'\n chunks = tail.split(sep)\n if...
[ "0.59240687", "0.5650912", "0.5650912", "0.5484264", "0.544708", "0.5408858", "0.5354618", "0.5318847", "0.51864445", "0.5169288", "0.51414424", "0.5123247", "0.51117146", "0.5093722", "0.5075803", "0.4926", "0.48871285", "0.4880617", "0.48195487", "0.47273347", "0.47038534",...
0.7108627
0
Attach build and buildslaves to each step.
def process_steps(steplist, build, buildslave, build_status, basedir): for step in steplist: step.setBuild(build) step.setBuildSlave(buildslave) step.setStepStatus(build_status.addStepWithName(step.name)) step.setDefaultWorkdir(os.path.join(basedir, 'build')) step.workdir = os.path.join(basedir, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stepStarted(build, step):", "def build_step(self):\n\n pass", "def build_step(self):\n pass", "def build_step(self):\n pass", "def steps(self, steps):\n\n self._steps = steps", "def merge_steps(self, steps):\n raise NotImplementedError", "def stepFinished(build, s...
[ "0.60801065", "0.6005942", "0.59210396", "0.59210396", "0.5855583", "0.5763112", "0.56093055", "0.5504773", "0.5465347", "0.541182", "0.5409328", "0.5386782", "0.538314", "0.53748685", "0.53719014", "0.5365673", "0.5361277", "0.53086853", "0.5272315", "0.5268723", "0.5249136"...
0.6598073
0
Extract shell commands from step.
def get_commands(steplist): commands = [] for step in steplist: if hasattr(step, 'command'): cmdhash = {} renderables = [] accumulateClassList(step.__class__, 'renderables', renderables) for renderable in renderables: setattr(step, renderable, step.build.render(getattr(step, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shell(self, shell):", "def shell_command_strings(self, command):\n return (None, \"$(shell \" + command + \")\", None)", "def extract_commands(self):\n # import pdb; pdb.set_trace()\n left_i = 0\n right_i = 1\n commands = {}\n cmd = self.cmd\n\n if not c...
[ "0.62787807", "0.6205541", "0.59439397", "0.57891214", "0.5723175", "0.56572735", "0.5631145", "0.5605977", "0.5601769", "0.55819225", "0.5537334", "0.551242", "0.5481799", "0.5445721", "0.5445366", "0.5432864", "0.5421588", "0.5414213", "0.54119444", "0.5395798", "0.53597456...
0.6046613
2
Initialise the eazy object.
def __init__(self, OUTPATH, OUTPREFIX): self.path = OUTPATH self.prefix = OUTPREFIX self.apply_prior = False if not self.path.endswith("/"): self.path = self.path + "/" self.params, self.apply_prior = self.getParams(self.path, self.prefix) self.zout = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def initialise(self):", "def do_i...
[ "0.7445991", "0.7445991", "0.7445991", "0.7445991", "0.7445991", "0.7445991", "0.7445991", "0.7445991", "0.73927194", "0.7332743", "0.7290069", "0.7266646", "0.7266646", "0.7266646", "0.7266646", "0.7266646", "0.72549605", "0.7246767", "0.7245598", "0.7245598", "0.72157526", ...
0.0
-1
Get the contents of the .param EAZY output file and return as a dictionary object.
def getParams(self, path, prefix, verbose = True): fpath = path + prefix + ".param" if not os.path.isfile(fpath): if verbose: print '.params file not found - please check!' return False params = dict(np.loadtxt(fpath, dtype=str, comments="#")) if bool(params['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_parameter_file( param_file_name ):\n return json.loads( open( param_file_name).read() )", "def _read_settings():\n parser = argparse.ArgumentParser(\n description='extract molecular fragments')\n parser.add_argument('-i', type=str, dest='input',\n help='input JSON ...
[ "0.6471408", "0.60893655", "0.60254073", "0.60105526", "0.60096985", "0.59862536", "0.59680444", "0.5957866", "0.59509706", "0.591111", "0.58881617", "0.58322906", "0.5806964", "0.57989657", "0.5794131", "0.57913566", "0.57668686", "0.5729273", "0.5718993", "0.5717271", "0.56...
0.0
-1
Return the contents of the EAZY cache file in a dictionary
def getCache(self, path, prefix, verbose = True): fpath = path + prefix + "_cache" if not os.path.isfile(fpath): if verbose: print "Cache file not found - please check!" return False with open(fpath, "rb") as f: s = np.fromfile(f, count=4, dtype=np.int32) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_cache():\n try:\n cache_file = open(CACHE_FILENAME, 'r', encoding=\"utf-8\")\n cache_contents = cache_file.read()\n cache_dict = json.loads(cache_contents)\n cache_file.close()\n return cache_dict\n except:\n cache_dict = {}\n return cache_dict", "d...
[ "0.7426107", "0.7003848", "0.6940114", "0.6829228", "0.66353035", "0.6561614", "0.6475884", "0.64701176", "0.6441302", "0.63921094", "0.639017", "0.63582116", "0.6356054", "0.6356054", "0.6354886", "0.63147855", "0.629293", "0.624724", "0.6163521", "0.6160946", "0.6151438", ...
0.5636934
64
Open the ascii .zout file and return as an astropy.table Table object.
def getOut(self, path, prefix, verbose = True): fpath = path + prefix + ".zout" if not os.path.isfile(fpath): if verbose: print ".zout file not found - please check!" return False try: zout = Table.read(fpath, format="ascii") if verbose: print "....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pdread2astrotable(csvgzdir):\n df = pd.read_csv(csvgzdir)\n tb = Table.from_pandas(df)\n return tb", "def read_tabix(\n file: PathType, storage_options: Optional[Dict[str, str]] = None\n) -> TabixIndex:\n with open_gzip(file, storage_options=storage_options) as f:\n magic = read_bytes_...
[ "0.6445617", "0.58485997", "0.56481296", "0.5641298", "0.5635116", "0.5553415", "0.5553415", "0.5550646", "0.5523641", "0.54948246", "0.53368026", "0.52775514", "0.52525586", "0.5251553", "0.5247824", "0.52383107", "0.5213523", "0.5205577", "0.5199613", "0.5189507", "0.518745...
0.61672497
1
Open the .coeff EAZY output file and return contents as a dictionary object
def getCoeff(self, path, prefix, verbose = True): fpath = path + prefix + ".coeff" # print 'get coeff path', fpath if not os.path.isfile(fpath): if verbose: print ".coeff file not found - please check!" return False with open(fpath, "rb") as f: s = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_output_file(outfile: os.PathLike):\n with open(outfile, mode=\"r\") as f:\n res = {}\n for line in f:\n model, var, val = line.split(\":\")\n model = model.strip()\n if model not in res:\n res[model] = {}\n ...
[ "0.6290784", "0.6113737", "0.6085913", "0.5871633", "0.58495826", "0.58220476", "0.5799313", "0.5752368", "0.56779546", "0.5649936", "0.5642193", "0.5599682", "0.556524", "0.5538183", "0.5530907", "0.55146635", "0.5490223", "0.5482123", "0.5465694", "0.5461214", "0.5453267", ...
0.5549966
13
Open the .tempfilt EAZY output file and return contents as a dictionary object
def getTempfilt(self, path, prefix, verbose = True): fpath = path + prefix + '.tempfilt' if not os.path.isfile(fpath): if verbose: print ".tempfilt file not found - please check!" return False with open(fpath, "rb") as f: s = np.fromfile(f, count = 4, dtype...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readtempfilt(MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT'):\n\n root = os.path.join(OUTPUT_DIRECTORY, MAIN_OUTPUT_FILE)\n \n ###### .tempfilt\n file_path = root+'.tempfilt'\n \n if os.path.exists(file_path) is False:\n raise ValueError('File, %s, not found.' %(file_path))\n\n ...
[ "0.711481", "0.6126175", "0.594898", "0.56255794", "0.55975693", "0.555666", "0.55090946", "0.55012673", "0.548985", "0.5441883", "0.5371903", "0.53018695", "0.529611", "0.5256127", "0.5240169", "0.5194636", "0.5193826", "0.51894754", "0.51860964", "0.51855606", "0.5164739", ...
0.6364439
1
Open the .pz EAZY output file and return contents as a dictionary object
def getPz(self, path, prefix, verbose = True): fpath = path + prefix + ".pz" if not os.path.isfile(fpath): if verbose: print ".pz file not found - please check!" return False with open(fpath, "rb") as f: s = np.fromfile(f, count=2, dtype=np.int32) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_to_dictionary():\n\n return;", "def read_file(filename):\n # Read in as nested dictionary\n # hipparcos_data = {'(star catalog number':\n # { 'parallax' : ... , 'apparent_magnitude' : ... , 'blue_minus_visual' : ... },\n # ... }\n\n return hipparcos_data", "as...
[ "0.6477481", "0.5687221", "0.55963707", "0.555326", "0.54855376", "0.54763544", "0.54614484", "0.5372779", "0.5358996", "0.5338705", "0.53302336", "0.5328768", "0.53002435", "0.53000194", "0.529421", "0.5283907", "0.525488", "0.5251823", "0.5246022", "0.5234127", "0.51833165"...
0.50832134
30
Open the .zbin EAZY output file and return contents as a dictionary object
def getBin(self, path, prefix, verbose = True): fpath = path + prefix + ".zbin" if not os.path.isfile(fpath): if verbose: print ".zbin file not found - please check!" return False with open(fpath, "rb") as f: s = np.fromfile(f, count=1, dtype=np.int32) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_to_dictionary():\n\n return;", "def read_archive(self):\n print '------------------------------------'\n print ' Archiving the simulation results'\n print ' '\n self.archive = {}\n with open(self.archive_data, 'r') as f:\n for line in f:\n (key, val) = line.split()\n ...
[ "0.6425174", "0.5940175", "0.58725595", "0.5715125", "0.5622214", "0.5616681", "0.55860937", "0.5580861", "0.5564032", "0.5561638", "0.5522089", "0.5476602", "0.547554", "0.533191", "0.53222144", "0.53065765", "0.52383524", "0.52364534", "0.52283925", "0.5224154", "0.52168286...
0.0
-1
Compute the normalised PDF for an object in the output
def getPDF(self, idx, path = False, prefix = False, verbose = True): if path is False: path = self.path if prefix is False: prefix = self.prefix if not isinstance(idx, (list, np.ndarray)): idx = [idx] params, apply_prior = self.getParams(path, prefix) pz_d = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self,x):\n returnPdf = self._distribution.pdf(x)\n return returnPdf", "def pdf(self, x):\n raise NotImplementedError", "def normal_pdf(x: torch.Tensor) -> torch.Tensor:\n return torch.exp(-(x ** 2 / 2)) / np.sqrt(2 * np.pi)", "def pdf(self,x):\n if self.transformation:\n pdfVa...
[ "0.6779025", "0.67060024", "0.67034996", "0.65615475", "0.65343434", "0.6449618", "0.642357", "0.64226717", "0.6377885", "0.6377885", "0.637643", "0.63481814", "0.6324596", "0.63121724", "0.62875146", "0.62816155", "0.6273578", "0.6232625", "0.62272394", "0.62031245", "0.6193...
0.0
-1
Write a new .params file, overwritten with new key values
def writeParams(self, outpath = False, newvals = False, clobber = False, verbose = True): if newvals is not False and type(newvals) is not dict: if verbose: print "New parameters not in dictionary format - please check!" return False outparams = self.params if newvals ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_params(self, force=False):\n\t\tif force or not os.path.exists(self._get_params_filepath()):\n\t\t\tf = open(self._get_params_filepath(), 'w')\n\t\t\tf.write(\"\\n\".join(self.params))\n\t\t\tf.write(\"\\n\")\n\t\t\tf.close()\n\t\t\tlogger.debug(\"Wrote %s\" % (self._get_params_filepath()))\n\t\telse:\n...
[ "0.73747414", "0.7367924", "0.6965227", "0.69542533", "0.67178345", "0.6705485", "0.64723575", "0.6471904", "0.6431831", "0.6351544", "0.6347792", "0.63348347", "0.6263163", "0.6246471", "0.61968315", "0.6188766", "0.61873174", "0.61659473", "0.61176175", "0.6111604", "0.6104...
0.7389937
0
Grab the current zeropoints from the .zeropoints file
def getZeropoints (self, indir, inpref, verbose = True): if os.path.isfile(indir+inpref+'.zeropoint'): zeropoints = np.genfromtxt(indir+inpref+'.zeropoint', usecols=1, dtype=np.float32) if verbose: print "zeropoints captured successfully!" return zeropoints else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPointsFromFile(traceFile):\r\n g = minidom.parse(traceFile)\r\n if g.getElementsByTagName('gpx'):\r\n return getPointsFromGpx(g)\r\n elif g.getElementsByTagName('kml'):\r\n return getPointsFromMercuryFile(traceFile)\r\n else:\r\n return [] #echec -no points\r", "def get_a...
[ "0.61317664", "0.59517145", "0.5922443", "0.58649415", "0.5825099", "0.58034104", "0.57739806", "0.5744703", "0.57242584", "0.5695771", "0.56932396", "0.56530195", "0.56403214", "0.5625227", "0.56025916", "0.55972755", "0.5574614", "0.55499184", "0.55398184", "0.5490028", "0....
0.7392869
0
Calculate the photometric zeropoints for a spectroscopic sample
def calcZeropoints(self, eazypath, indir, inpref, tol = 1e-2, clobber = True, maxiters = 100, exclude = False, verbose = True, plot = False): zp_table = Table.read(indir+inpref+".zeropoint", format="ascii.no_header") newpvals = {"GET_ZP_OFFSETS": 1, "FIX_ZSPE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PA_SB_Zx_func(data, weit_data, pix_size, cx, cy, z0, R_bins):\n\tDa0 = Test_model.angular_diameter_distance(z0).value ## in unit 'Mpc'\n\tNx = data.shape[1]\n\tNy = data.shape[0]\n\tx0 = np.linspace(0, Nx-1, Nx)\n\ty0 = np.linspace(0, Ny-1, Ny)\n\tpix_id = np.array(np.meshgrid(x0,y0))\n\n\t#..center pixel poin...
[ "0.6416052", "0.63215095", "0.6161897", "0.61533886", "0.60753524", "0.607235", "0.6072261", "0.6034678", "0.6013616", "0.596318", "0.5955432", "0.5914271", "0.59079623", "0.5838066", "0.5828683", "0.5815866", "0.57941943", "0.57479525", "0.5717172", "0.57110345", "0.5696119"...
0.0
-1
Run EAZY and collect the output.
def runEAZY(self, eazypath, inpath, inpref): command = ("cd {directory}; {0} -p {1} -t {2} -z {3}".format(eazypath, inpref+".param", inpref+".translate", inpref+".zeropoint", director...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n my_emr = EmrProcessing()\n\n if \"-s\" in sys.argv:\n my_emr.verbose_mode = False\n else:\n my_emr.verbose_mode = True\n print \"\\nStarting Titanic Data Analysis\"\n my_emr.parse_user_selections()\n\n # Setup\n my_emr.clear_local_output_directory()\n my_emr....
[ "0.57431215", "0.5409531", "0.5399925", "0.5399925", "0.53816", "0.52810526", "0.5280897", "0.52732193", "0.5271705", "0.52603763", "0.52446514", "0.5219894", "0.5172208", "0.51682454", "0.5145979", "0.5121802", "0.51211095", "0.50872207", "0.50812286", "0.5064914", "0.506491...
0.58166707
0
Plot a comparison between photometric and spectroscopic redshifts
def plotComparison(self, photoz = "z_peak", show = True): fig, ax = plt.subplots(1, 1, figsize=(5.5, 5)) spec_z = self.zout["z_spec"] photo_z = self.zout[photoz] xy_max = np.max([spec_z.max(), photo_z.max()]) + 0.1 prng = np.arange(0, xy_max+0.05, 0.05) ax.plot(spec_z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n\t\tself.plotOfSpect()", "def plot(self):\n\t\tself.plotOfSpect().plot()", "def plot_colour_mag_diagram(params,mags, colours, local_mags, local_colours,\n target, source, blend, RC, blue_filter, red_filter,\n yaxis_filter, tol, log):\n\n ...
[ "0.66576403", "0.65320396", "0.64093614", "0.6394958", "0.63727075", "0.6201341", "0.61825037", "0.61814046", "0.6138984", "0.61138934", "0.6106851", "0.60940653", "0.6091854", "0.6068858", "0.6003209", "0.600191", "0.5991049", "0.59887123", "0.5985631", "0.5977557", "0.59421...
0.0
-1
Calculate some useful statistics for the photoz/specz comparison.
def getCompStats(self, photoz = "z_peak", verbose = True): specz = self.zout["z_spec"] photoz = self.zout[photoz] dz = (photoz - specz) diff = (dz / (1.+specz)) nmad = 1.4826 * np.median( np.abs( dz - np.median(dz) ) ) mean_offset = np.mean(diff) median_offset ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSampleImageStats(self):\n \n imgfiles = []\n imgfiles.append(\"v1_i1_g_m400_s20_f.fits\")\n imgfiles.append(\"v1_i1_g_m400_s20_u16.fits\")\n imgfiles.append(\"v1_i2_g_m400_s20_f.fits\")\n imgfiles.append(\"v1_i2_g_m400_s20_u16.fits\")\n imgfiles.append(\"v2_...
[ "0.62995243", "0.626098", "0.61650515", "0.60723734", "0.60337234", "0.6022576", "0.5963165", "0.59203196", "0.5843567", "0.5823474", "0.58122724", "0.5804204", "0.577855", "0.56952435", "0.56760657", "0.5613303", "0.56002814", "0.55723095", "0.55523425", "0.5547705", "0.5523...
0.78785306
0
Test to see what happens when only a subset of the potential settings are used
def test_wp_eval_some_settings(): args = {'line_by_line': True, "max_length": 512} with pytest.raises(ValueError): result = happy_wp.eval("../data/wp/train-eval.txt", args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_settings(self):\r\n pass", "def check_settings(self):\n pass", "def test_checkCustoms(self):\n self.failUnlessEqual(self.nice.opts['myflag'], \"PONY!\")\n self.failUnlessEqual(self.nice.opts['myparam'], \"Tofu WITH A PONY!\")", "def test_check_required_success():\n se...
[ "0.672732", "0.665855", "0.6543287", "0.6459723", "0.63275325", "0.63275325", "0.62311333", "0.61921144", "0.61921144", "0.61721367", "0.613498", "0.6128301", "0.6111549", "0.60465807", "0.6014964", "0.6011822", "0.5996574", "0.59954536", "0.59722525", "0.59559226", "0.593957...
0.0
-1
Returns the fields needed for an extensible attributes ipam call.
def extensible_attributes(): return 'extensibleattributedef?'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_account_attributes():\n pass", "def get_api_fields(cls):\n return ['fqdn', 'ttl', 'description', 'views']", "def getAttributes(self):\n pass", "def get_ea_attributes(path, logger):\n reattrib = None\n try:\n reattrib = requests.get(PAYLOAD['url'] + \"extensibleattri...
[ "0.64952034", "0.6412314", "0.6406711", "0.62219125", "0.61058205", "0.60922253", "0.6087751", "0.6087751", "0.60825884", "0.607636", "0.60684806", "0.60631704", "0.60596853", "0.6051178", "0.6046008", "0.6033764", "0.6031279", "0.6006388", "0.5993471", "0.5978762", "0.596880...
0.6063322
11
Returns the fields needed for an extensible attributes ipam call.
def extensible_attributes_list_values(): return "extensibleattributedef?" \ "_return_fields=" \ "list_values," \ "comment," \ "name," \ "type"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_account_attributes():\n pass", "def get_api_fields(cls):\n return ['fqdn', 'ttl', 'description', 'views']", "def getAttributes(self):\n pass", "def get_ea_attributes(path, logger):\n reattrib = None\n try:\n reattrib = requests.get(PAYLOAD['url'] + \"extensibleattri...
[ "0.649405", "0.64128107", "0.6405656", "0.6219948", "0.61061186", "0.6090734", "0.6085757", "0.6085757", "0.6083903", "0.60761714", "0.6068696", "0.60633224", "0.606197", "0.6059749", "0.60496956", "0.6047246", "0.60332847", "0.60306746", "0.6005083", "0.59933203", "0.5976819...
0.59678864
21
Returns the fields needed for a network views ipam call.
def network_views(): return 'networkview?'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_fields(cls):\n return ['fqdn', 'ttl', 'description', 'views']", "def getViews(read):\n ...", "def get_vm_data_fields(self):\n\n raise NotImplementedError", "def info(self):\n info = \">>>> IP\" + '\\n'\n info += \" To: \" + self.destinationIp + '\\n'\n inf...
[ "0.58593136", "0.57089645", "0.5631673", "0.56026655", "0.5583982", "0.5524781", "0.54614687", "0.5457726", "0.54543835", "0.54375136", "0.5420535", "0.52939105", "0.52843255", "0.5243048", "0.52313054", "0.5225801", "0.5189378", "0.5185825", "0.517134", "0.5154297", "0.51468...
0.596402
0
Returns the fields needed from networks ipam call.
def networks(view): return "network?" \ "_return_fields=" \ "extattrs," \ "comment," \ "network," \ "network_view," \ "utilization&" \ "network_view=" + view + \ "&_max_results=-25000"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_info():", "def getFields(iface):\n return getFieldsInOrder(iface)", "def test_ipam_vlans_read(self):\n pass", "def get_ip(self):", "def get_fields() :\n st=hp.synfast(cltt+nltt,nside,new=True,verbose=False,pol=True)\n ff0=nmt.NmtField(mask_lss,[st])\n return ff0", "def info(sel...
[ "0.5779202", "0.56970006", "0.56601065", "0.56375086", "0.5631149", "0.54892325", "0.54859495", "0.5472514", "0.54665065", "0.5439959", "0.5439959", "0.5439959", "0.54203576", "0.5398455", "0.53844625", "0.5379024", "0.53763855", "0.53588057", "0.5348849", "0.53384274", "0.53...
0.5089324
44
Returns the fields needed from networkcontainers ipam call.
def networkcontainers(view): return "networkcontainer?" \ "_return_fields=" \ "extattrs," \ "comment," \ "network," \ "network_view," \ "utilization&" \ "network_view=" + view + \ "&_max_resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_info():", "def getFields(iface):\n return getFieldsInOrder(iface)", "def get_interface_info(self): # real signature unknown; restored from __doc__\n pass", "def get_ip(self):", "def test_ipam_aggregates_read(self):\n pass", "def test_ipam_ip_addresses_read(self):\n pass", ...
[ "0.5752631", "0.5632856", "0.55738837", "0.5550749", "0.5510972", "0.54324913", "0.5415445", "0.5317205", "0.52685046", "0.5245804", "0.5200601", "0.5200096", "0.5200038", "0.5169341", "0.51556444", "0.51506966", "0.51506966", "0.51506966", "0.51459086", "0.51456106", "0.5135...
0.0
-1
Returns the fields needed from networks ipam call.
def ipv6_networks(view): return "ipv6network?" \ "_return_fields=" \ "extattrs," \ "comment," \ "network," \ "network_view," \ "utilization&" \ "network_view=" + view + \ "&_max_results=-25000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_info():", "def getFields(iface):\n return getFieldsInOrder(iface)", "def test_ipam_vlans_read(self):\n pass", "def get_ip(self):", "def get_fields() :\n st=hp.synfast(cltt+nltt,nside,new=True,verbose=False,pol=True)\n ff0=nmt.NmtField(mask_lss,[st])\n return ff0", "def info(sel...
[ "0.5775925", "0.569589", "0.566016", "0.5638428", "0.5630748", "0.5490142", "0.54885566", "0.5472954", "0.5465002", "0.5437468", "0.5437468", "0.5437468", "0.5420819", "0.53993124", "0.53843606", "0.53766876", "0.5373815", "0.5353859", "0.5346021", "0.5335662", "0.53345245", ...
0.0
-1
Returns the fields needed from networkcontainers ipam call.
def ipv6_networkcontainers(view): return "ipv6networkcontainer?" \ "_return_fields=" \ "extattrs," \ "comment," \ "network," \ "network_view," \ "utilization&" \ "network_view=" + view + \ "&_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_info():", "def getFields(iface):\n return getFieldsInOrder(iface)", "def get_interface_info(self): # real signature unknown; restored from __doc__\n pass", "def get_ip(self):", "def test_ipam_aggregates_read(self):\n pass", "def test_ipam_ip_addresses_read(self):\n pass", ...
[ "0.5752631", "0.5632856", "0.55738837", "0.5550749", "0.5510972", "0.54324913", "0.5415445", "0.5317205", "0.52685046", "0.5245804", "0.5200601", "0.5200096", "0.5200038", "0.5169341", "0.51556444", "0.51506966", "0.51506966", "0.51506966", "0.51459086", "0.51456106", "0.5135...
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Greens): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8192804", "0.8094402", "0.80277497", "0.80176693", "0.7992383", "0.7989708", "0.7979215", "0.79741204", "0.7959607", "0.7955097", "0.79358983", "0.79329205", "0.7932711", "0.79295874", "0.79247147", "0.79228914", "0.792216", "0.79215133", "0.7921201", "0.7920765", "0.79161...
0.785076
44
Wrap records object that are exhaustable (eg generators, file objects, db cursors) so that we can sample them for inspection and inference without losing records.
def wrap_records_object(obj: Any) -> Any: if isinstance(obj, SampleableIterator): # Already wrapped return obj if isinstance(obj, ResultProxy): return SampleableCursor(obj) if isinstance(obj, IOBase): return SampleableIO(obj) if isinstance(obj, abc.Generator): ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *records: ScalarSequence):\n self._records = [r for r in records if r]", "def records(self):\r\n raise NotImplementedError()", "def __iter__(self):\n counter = 0\n while True:\n if counter < len(self.all_records):\n yield self.all_records...
[ "0.6080863", "0.5741171", "0.55929357", "0.5570124", "0.5447731", "0.54261357", "0.5404625", "0.53648776", "0.5355849", "0.53219557", "0.5255752", "0.5210186", "0.5188838", "0.51879054", "0.5187643", "0.51652", "0.51625055", "0.5120713", "0.50605875", "0.50605875", "0.5032449...
0.72915584
0
Construct a new FA session.
def __init__(self, username): self.username = username self._requests = requests.Session() self._requests.headers["User-Agent"] = constants.USER_AGENT self._requests.headers["Referer"] = constants.FA_ROOT + "/" self._rate_limit_start = datetime.datetime.now() self._rate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session(aq_instance):\n dirname = os.path.dirname(__file__)\n filename = os.path.join(dirname, 'secrets.json')\n\n with open(filename) as f:\n secrets = json.load(f)\n\n credentials = secrets[aq_instance]\n session = AqSession(\n credentials[\"login\"],\n credentials[...
[ "0.6634107", "0.6326105", "0.6310392", "0.6274315", "0.6241301", "0.6186287", "0.6178623", "0.61726516", "0.61697036", "0.6166564", "0.6161023", "0.6105878", "0.60832137", "0.60805315", "0.60735244", "0.60646576", "0.6022593", "0.6021701", "0.60208005", "0.6016343", "0.601144...
0.0
-1
Rate limit calls to a function.
def _limited_call(self, func, *args, **kwargs): # Check seconds that have passed now = datetime.datetime.now() diff = (now - self._rate_limit_start).total_seconds() if diff >= 60: # If greater than a minute, reset the rate limit self._rate_limit_count = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratelimited():\n\n lock = threading.Lock()\n\n def decorator(func):\n last_call = time.perf_counter()\n\n @wraps(func)\n def ratelimit(*args, **kwargs):\n limit = kwargs.get(\"ratelimit\", None)\n if limit:\n count, seconds = limit.split(\"/\")\n ...
[ "0.774844", "0.7687252", "0.73051584", "0.7302061", "0.7221094", "0.7193447", "0.7186658", "0.7117065", "0.710736", "0.7102475", "0.70750374", "0.7038235", "0.69855464", "0.6896162", "0.68784034", "0.6843292", "0.6843292", "0.6843292", "0.67920244", "0.6740426", "0.66486627",...
0.8237565
0
Get a CAPTCHA puzzle.
def get_captcha(self): res = self._limited_call(self._requests.get, constants.FA_ROOT + "/captcha.jpg") data = res.content return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n try:\n imageFilename = random.choice(os.listdir(self.cacheDir))\n imagePath = os.path.join(self.cacheDir, imageFilename)\n with open(imagePath) as imageFile:\n self.image = imageFile.read()\n except IndexError:\n raise GimpCa...
[ "0.61169136", "0.6112375", "0.60955966", "0.5859403", "0.5839033", "0.5812558", "0.5522057", "0.5405848", "0.53841287", "0.5343834", "0.5302962", "0.5302095", "0.52938336", "0.52660924", "0.5257254", "0.52544385", "0.5173279", "0.5142943", "0.51268345", "0.5119854", "0.511594...
0.6154923
0
Log in to the site. Call .logout to log out, or use this method with the context manager.
def login(self, password, captcha): url = constants.FA_ROOT + "/login/" data = { "action": "login", "name": self.username, "pass": password, "captcha": captcha, "login": "Login to\u00a0FurAffinity", } logger.info("Logging in as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_in(self):\n\n # Get login page.\n self.get_endpoint(endpoint=self.config['paths']['login'])\n\n # Post log-in data.\n email_form = self.browser.find_element_by_xpath(\"//input[@id='email']\")\n pw_form = self.browser.find_element_by_xpath(\"//input[@id='password']\")\n ...
[ "0.7290045", "0.7128971", "0.7029878", "0.70254457", "0.6998062", "0.6989771", "0.6910118", "0.69069165", "0.69020975", "0.6878334", "0.68720883", "0.6850107", "0.6816924", "0.67713416", "0.67486775", "0.67442846", "0.6725656", "0.66482985", "0.65863806", "0.65805143", "0.653...
0.0
-1
Log out of the site.
def logout(self): logger.info("Logging out") self._limited_call(self._requests.get, constants.FA_ROOT + "/logout/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logOut(self):\n self.client.logout()", "def logout(self):\n pass", "def logout():\n rino.login.logout()", "def logout(self):\n self.__send_command(\"LOGOUT\")", "def logout():", "def logout():\n login()", "def log_out_user(self):\n flask_login.logout_user()", "de...
[ "0.8635206", "0.82986826", "0.8285628", "0.8208519", "0.8206995", "0.8138281", "0.80890554", "0.7998981", "0.7973082", "0.7925552", "0.7922266", "0.7895177", "0.7888047", "0.7873234", "0.78515416", "0.7807907", "0.7790976", "0.77811825", "0.775594", "0.7750046", "0.7744232", ...
0.78818446
13
Return submissions found in pages of a base url.
def _scan_submission_page(self, url_format): submissions = [] try: page = 1 while True: url = url_format % page doc = self._limited_call(self._html_get, url) logger.debug("Scanning submissions from %s" % url) coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urls(base_url):\n res = requests.get(base_url, headers=HEADERS)\n res = BeautifulSoup(res.text, 'html.parser')\n res = res.find_all(href=re.compile('pdf'))\n return res", "def get_submissions(username, problem, cookies, is_clicker, sesssion):\r\n url = '/'.join([courseserver, coursepath, c...
[ "0.5971324", "0.5961301", "0.59605527", "0.5955323", "0.58842486", "0.5882445", "0.58632535", "0.5807735", "0.57095593", "0.5695872", "0.5692507", "0.5645808", "0.5624923", "0.5583744", "0.5556068", "0.55493116", "0.5507686", "0.55000055", "0.54877317", "0.5482656", "0.544188...
0.65737253
0
Starts the Load Balancer application
def run_lb(name): global init_param, stop # Read the initial config parameters with open('init_config.json') as init_config: init_param = json.load(init_config) # Check if all the values are not null for param, value in init_param.items(): if not value: logger.warning(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self) -> None:\n if self.bolt_app.logger.level > logging.INFO:\n print(get_boot_message())\n else:\n self.bolt_app.logger.info(get_boot_message())\n\n web.run_app(self.web_app, host=\"0.0.0.0\", port=self.port)", "def start():\n app.run()", "def start() -...
[ "0.7244366", "0.67025673", "0.6595618", "0.6525551", "0.65218407", "0.65112716", "0.6436959", "0.64000326", "0.6390139", "0.63894284", "0.6378471", "0.6378471", "0.6368097", "0.6355661", "0.6349179", "0.62332124", "0.6215053", "0.6215012", "0.61955005", "0.614471", "0.613681"...
0.5770426
71
Gets the IP of the users currently on the WiFi
def get_wifi_users(): response = requests.get(url=f"http://{init_param['ryu_ip']}:8080/\ stats/flow/{init_param['br-int_dpid']}") rules = response.json()[init_param['br-int_dpid']] wifi_users = [] for rule in rules: try: vlc_ip = rule["match"]["nw_dst"] except KeyError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetWirelessIP(self):\n ip = self.wifi.GetIP()\n return ip", "def get_public_ip():\n public_ip = get('https://api.ipify.org').text\n return public_ip", "def publicIP(self):\n return self.query('https://plex.tv/:/ip')", "def checkIP(self):\n\t\tself.get(\"https://ifconfig.me/\")\...
[ "0.7699801", "0.67521274", "0.67227936", "0.6681065", "0.6656468", "0.6654231", "0.6638662", "0.66331196", "0.66173965", "0.6582812", "0.6568506", "0.65680355", "0.6561505", "0.6549181", "0.65410495", "0.6517311", "0.6516988", "0.65079516", "0.65009683", "0.64814854", "0.6435...
0.65245605
15
Returns the list of the users that are currently on the VLC/mmWave
def get_vlc_users(wifi_list): vlc_users = [user for user in users if user["vlc_ip"] not in wifi_list] return vlc_users
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_users(self):\n return self.mycam.devicemgmt.GetUsers()", "def user_list(self, mapp, url_of_liveserver):\n return mapp.getjson(url_of_liveserver)['result'].keys()", "def all_users():\n\treturn [unicode(name[:-4]).lower() for name in os.listdir(os.path.join(WORLD_DIR, 'players'))]", "def ...
[ "0.74427754", "0.6795005", "0.672411", "0.67044204", "0.6702518", "0.66885984", "0.66357285", "0.6614727", "0.65836966", "0.65774393", "0.6577427", "0.65748775", "0.6572361", "0.65383404", "0.653604", "0.6530479", "0.65299314", "0.6490531", "0.6474435", "0.6440596", "0.643123...
0.75741893
0
Converts time as an option into a datetime.datetime. Returns None if not specified.
def parse_time_option(value): if not value: return None try: return _EPOCH + datetime.timedelta(seconds=int(value)) except ValueError: pass for fmt in ('%Y-%m-%d',): try: return datetime.datetime.strptime(value, fmt) except ValueError: pass raise ValueError('Failed to parse %s'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_from_time(time: datetime.time, date: datetime.date = datetime.date.today()):\n if type(time) == datetime.time:\n return datetime.datetime.combine(date, time)\n else:\n return time", "def parse_time(time_input, *, force_datetime=False, allow_undefined=False, **kwargs):\n\n if a...
[ "0.68546826", "0.683096", "0.67861164", "0.6604809", "0.64384985", "0.6394784", "0.6331635", "0.62863314", "0.62711996", "0.6268744", "0.62352127", "0.620883", "0.6158795", "0.6090492", "0.60857975", "0.60848105", "0.6053297", "0.60125333", "0.59862024", "0.5982028", "0.59811...
0.67915386
2
Fetches data from swarming and returns it.
def fetch_data(swarming, start, end, state, tags): # Split the work in days. That's a lot of requests to do. queue = Queue.Queue() threads = [] def run(start, cmd): data = json.loads(subprocess.check_output(cmd)) queue.put((start, int(data['count']))) day = start while day != end: data = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_data(self):\n pass", "def run(self):\n results = self.fetch()\n return results", "def fetch_data(self):", "async def fetch_data(self) -> T:", "def data():\n return volumes_fetchers.get_json_data()", "def get_data():\n return", "async def _fetch_data(self) -> T:\n ...
[ "0.656309", "0.6497311", "0.64277226", "0.6388809", "0.6219082", "0.61422515", "0.61238706", "0.6111634", "0.6094759", "0.607809", "0.60757875", "0.60490596", "0.5996118", "0.598899", "0.59853625", "0.59853625", "0.5912132", "0.5912132", "0.5912132", "0.5903248", "0.5899217",...
0.5962772
16
Setup the aREST binary sensor.
def setup_platform(hass, config, add_devices, discovery_info=None): resource = config.get(CONF_RESOURCE) pin = config.get(CONF_PIN) if None in (resource, pin): _LOGGER.error('Not all required config keys present: %s', ', '.join((CONF_RESOURCE, CONF_PIN))) return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.ser = Serial()\n self.device_obj = ZBSensor(self.ser)", "def setUp(self):\n self.sensor = Sensor('127.1.1.3', 9000)", "def __init__(self):\n self._read_calibration_data()\n self.configure_sensor(\n TemperatureOversamplings.x08,\n ...
[ "0.6209206", "0.6132519", "0.57827735", "0.57115394", "0.56619436", "0.5657306", "0.56566656", "0.5559778", "0.5507198", "0.55019826", "0.5441228", "0.5435611", "0.5408168", "0.53973293", "0.538949", "0.53633904", "0.5356179", "0.5353374", "0.5349762", "0.5343878", "0.5338553...
0.55974704
7
Initialize the aREST device.
def __init__(self, arest, resource, name, pin): self.arest = arest self._resource = resource self._name = name self._pin = pin self.update() if self._pin is not None: request = requests.get('{}/mode/{}/i'.format (self._resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def init(self):\n logger.info(\"Init device: %s\", self._serial)\n self._callback(STATUS_INIT)\n\n self._init_binaries()\n self._init_apks()\n await self._init_forwards()\n\n await adb.shell(self._serial, \"/data/local/tmp/atx-agent server --stop\")\n await ad...
[ "0.6444274", "0.6330388", "0.6299139", "0.62126595", "0.61097986", "0.6039827", "0.5993592", "0.59869677", "0.59306645", "0.5883426", "0.5880507", "0.58715373", "0.5868116", "0.5868116", "0.5868116", "0.5859604", "0.5851872", "0.5851872", "0.5851872", "0.5851872", "0.58076674...
0.56759477
41
Return the name of the binary sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return f\"{DEFAULT_NAME}_{BINARY_SENSOR}\"", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self._sensor.name", "def name(self):\n return f\"{self.sensor_type['name']} ({self._mac[-5:]})\"", "def name(self):\n return self.d...
[ "0.82069147", "0.8016458", "0.7923548", "0.76958257", "0.7668517", "0.7534579", "0.72059137", "0.7146881", "0.7066772", "0.6925692", "0.6923594", "0.67905974", "0.67600256", "0.67595863", "0.66872895", "0.6645599", "0.6642735", "0.66148776", "0.6601633", "0.6601633", "0.66016...
0.0
-1
Return true if the binary sensor is on.
def is_on(self): return bool(self.arest.data.get('state'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return self._sensor_state()", "def is_on(self):\n return getattr(self.coordinator.data[0], self._sensor) is True", "def is_on(self):\n data = self.sensor_data\n if data and data[\"model\"] == \"SML\" and data[\"changed\"]:\n return data[\"state\"] == ST...
[ "0.7853332", "0.76352257", "0.7587365", "0.7494062", "0.74632245", "0.74632245", "0.74632245", "0.7458867", "0.7458476", "0.73671085", "0.73671085", "0.73581773", "0.73362136", "0.7291605", "0.7263485", "0.7212699", "0.7204223", "0.718982", "0.7121019", "0.7081601", "0.705846...
0.7081065
20
Get the latest data from aREST API.
def update(self): self.arest.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_data():\n try:\n print '\\nRequesting new data.....\\n'\n response = get(\"https://api.myjson.com/bins/2csub\")\n if response.status_code is 200:\n print '\\nSuccess (200) in downloading data\\n'\n current_json = response.json()\n set_backup_d...
[ "0.69037545", "0.6617101", "0.648815", "0.63266337", "0.63005227", "0.63005227", "0.6281676", "0.6281676", "0.6278101", "0.6271919", "0.6258911", "0.62241006", "0.6204899", "0.61852705", "0.6169884", "0.6165374", "0.61476934", "0.6141144", "0.61288834", "0.60983145", "0.60928...
0.0
-1
Initialize the aREST data object.
def __init__(self, resource, pin): self._resource = resource self._pin = pin self.data = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\t\tsuper().__init__()\n\t\t\n\t\t# Typically a list of data here\n\t\t# Typically a dict of header keys and values here", "def __init__(self, data):\n self.data = data\n return", "def __init__(self, data=None):\n self.data = data", "def __init__(self):\n self...
[ "0.67280114", "0.6717379", "0.6682897", "0.6569234", "0.6562224", "0.6559889", "0.6559889", "0.6559889", "0.6559889", "0.65542865", "0.6554195", "0.65215546", "0.64844275", "0.6484227", "0.64589953", "0.6457893", "0.6446397", "0.6441969", "0.6429045", "0.639269", "0.6382177",...
0.0
-1
Get the latest data from aREST device.
def update(self): try: response = requests.get('{}/digital/{}'.format( self._resource, self._pin), timeout=10) self.data = {'state': response.json()['return_value']} except requests.exceptions.ConnectionError: _LOGGER.error("No route to device '%s'. Is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_rest(self):\n # PROTECTED REGION ID(AsyncTabata.rest_read) ENABLED START #\n return self._rest\n # PROTECTED REGION END # // AsyncTabata.rest_read", "def get_latest_data():\n try:\n print '\\nRequesting new data.....\\n'\n response = get(\"https://api.myjson.com...
[ "0.675981", "0.6415501", "0.6267848", "0.62456656", "0.6203895", "0.61584896", "0.6130172", "0.6068994", "0.6045216", "0.6005045", "0.5990922", "0.5987145", "0.596897", "0.5952027", "0.5932656", "0.5929275", "0.59236604", "0.58907956", "0.58907956", "0.5875404", "0.58722246",...
0.0
-1
Tests that the output html is generated correclty by the clustering function
def test_output_html(tmp_path): # This will be the file to temporary_file = os.path.join(tmp_path, 'test-cluster.html') # Run clustering on small dummy data (see test_clustering.py) cluster = TextClustering(embedding_random_state=42, reducer_random_state=43, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def cluster_classification_tex(f,browsing_matrix,diversifying_matrix, weblog,session_data_threshold,cluster_type,classification_column_diversity,classification_wanted_transaction):\n divpat_classification_wanted_transaction = classification_wanted_transaction\n ...
[ "0.68014586", "0.64515656", "0.6283319", "0.6218219", "0.61491203", "0.6064487", "0.5956804", "0.5843667", "0.5821508", "0.5812067", "0.5782588", "0.5746487", "0.572244", "0.5716077", "0.57043064", "0.5677167", "0.5629126", "0.5620701", "0.5605728", "0.5572866", "0.5569146", ...
0.7976958
0
Override the default train() to freeze the BN parameters
def train(self, mode=True, freeze_bn=False): super(WideResNet, self).train(mode) self.freeze_bn = freeze_bn if self.freeze_bn: print("Freezing Mean/Var of BatchNorm2D.") print("Freezing Weight/Bias of BatchNorm2D.") if self.freeze_bn: for m in self.mod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, *args, **kwargs):\n raise NotImplementedError", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self, ):\n raise NotImplementedError", "def tr...
[ "0.6963234", "0.6939087", "0.6939087", "0.6939087", "0.6939087", "0.6939087", "0.69190997", "0.6901135", "0.68561196", "0.6850719", "0.68132", "0.6813139", "0.67859966", "0.6785637", "0.6709828", "0.6674066", "0.66536355", "0.6645038", "0.6637477", "0.662026", "0.66150165", ...
0.6582539
22
programmer_type e.g. INTEGER or programmer defined type
def __init__(self, programmer_type): self.programmer_type = programmer_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_():\n pass", "def opinion_type():\n pass", "def _type(self):\n return self._id[1]", "def program_type(self, value):\n\n types = {\n 'executableProgram': '1'\n }\n\n self._program_type = types[value]", "def Type(self) -> _n_6_t_5:", "def _type(self) ->...
[ "0.62550634", "0.6194765", "0.61409026", "0.60830945", "0.6071827", "0.6035185", "0.60270154", "0.588981", "0.587063", "0.58595556", "0.5849741", "0.58421713", "0.5834853", "0.5820968", "0.58097893", "0.5783257", "0.5766275", "0.57662106", "0.57528615", "0.57528615", "0.57528...
0.65804327
0
Size in words and programmer_type e.g. integer
def __init__(self, num_params): self.num_params = num_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_size(self):\n\t\treturn 4*self.version + 17", "def getSize(self):\n return 1", "def getSize(self):\n return 1", "def getSize(language=None):", "def getSize(self) -> int:\n ...", "def getSize(self) -> int:\n ...", "def word_size(tpname):\n if tpname == \"uint3...
[ "0.73081714", "0.70577526", "0.7009011", "0.7003701", "0.6970362", "0.6970362", "0.6962064", "0.68956697", "0.6845606", "0.6825537", "0.68143684", "0.68104845", "0.67622477", "0.6742321", "0.67140716", "0.6710887", "0.6704871", "0.66993916", "0.6625745", "0.661541", "0.660608...
0.0
-1
Size in words and programmer_type e.g. integer
def __init__(self, num_params): self.num_params = num_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_size(self):\n\t\treturn 4*self.version + 17", "def getSize(self):\n return 1", "def getSize(self):\n return 1", "def getSize(language=None):", "def getSize(self) -> int:\n ...", "def getSize(self) -> int:\n ...", "def word_size(tpname):\n if tpname == \"uint3...
[ "0.73083884", "0.7057839", "0.7009008", "0.7002719", "0.6969705", "0.6969705", "0.69600403", "0.68952006", "0.68450075", "0.6824593", "0.68134356", "0.6809526", "0.6760405", "0.6741088", "0.67141205", "0.67103976", "0.67043126", "0.66976994", "0.6625272", "0.6613481", "0.6605...
0.0
-1