query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Given a group and a server ID, determines if the group can be scaled down.
def _can_scale_down(group, server_id): _, manifest = yield Effect(GetScalingGroupInfo( tenant_id=group.tenant_id, group_id=group.uuid)) min_entities = manifest['groupConfiguration']['minEntities'] state = manifest['state'] if state.desired == min_entities: raise CannotDeleteServerBelowM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_server_in_group(group, server_id):\n try:\n response, server_info = yield Effect(TenantScope(\n retry_effect(get_server_details(server_id),\n retry_times(3),\n exponential_backoff_interval(2)),\n group.tenant_id))\n except N...
[ "0.6680492", "0.6214907", "0.56432796", "0.5541793", "0.55023", "0.5461122", "0.5456357", "0.5425536", "0.5420274", "0.54058456", "0.5356008", "0.5212527", "0.51763535", "0.51392126", "0.5131073", "0.50908464", "0.50722384", "0.50673366", "0.5064374", "0.50604606", "0.5038845...
0.7255097
0
This function adds the result data to a queue table of items to parse, which offloads this job to a periodically schedule script using celery. This performs ensures that the parse doesn't block the response to the request so the spiders can just continue on to the next url.
def queue_parse(): if not check_api_auth(): abort(401) # Unauthorized. # Get the scan_result from the query. try: # Grab the data from the body of the request scan_result = request.data.decode('utf-8') # Add the data to the queue new_parse = ParseQueue() new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_job():\n r = redis.StrictRedis()\n while True:\n curr_job = r.blpop('job_queue', 0)[1]\n r.hset('status', curr_job, 'processing')\n print('current job ID:', curr_job)\n # convert byte to string\n url = r.hget('urls', curr_job).decode(\"utf-8\")\n print('C...
[ "0.6494824", "0.6191935", "0.60885084", "0.5981475", "0.59138626", "0.58415216", "0.58401036", "0.58348846", "0.5793345", "0.57895225", "0.5672716", "0.56511146", "0.5648128", "0.56405646", "0.5605761", "0.55935496", "0.5574102", "0.55658823", "0.556461", "0.5556701", "0.5552...
0.6829844
0
If the user has bet any amount on this match, return the amount, or 0
def amount_bet(self, user): try: return Bet.objects.get(group_match = self, user=user).amount except Bet.DoesNotExist: return Decimal(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determineAmountToCall(self, player):\n\t\treturn sum(self.currentBet) - sum(player.betAmount)", "def get_player_bet(self) -> None:\n print(\"Please enter the amount you want to bet.\")\n while self.user.bet == 0:\n input_ = input(\">>> \")\n try:\n input_ = ...
[ "0.6794113", "0.6223519", "0.6108181", "0.60057443", "0.5932339", "0.5890742", "0.58811045", "0.5879205", "0.5870483", "0.5849293", "0.5843593", "0.5826016", "0.5812747", "0.5756018", "0.57512665", "0.5722931", "0.56990063", "0.56968904", "0.56963223", "0.5675625", "0.5673951...
0.7560224
0
This method represents the Zoho CRM Production environment in EU domain
def PRODUCTION(cls): return DataCenter.Environment("https://www.zohoapis.eu", cls().get_iam_url(), cls().get_file_upload_url())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SANDBOX(cls):\n\n return DataCenter.Environment(\"https://sandbox.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def DEVELOPER(cls):\n\n return DataCenter.Environment(\"https://developer.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def _production()...
[ "0.6654427", "0.65283966", "0.6355464", "0.6292572", "0.5975507", "0.5958166", "0.5926409", "0.5657863", "0.56250566", "0.5617872", "0.5612356", "0.55655277", "0.5521967", "0.5469647", "0.54644597", "0.54508966", "0.5406809", "0.53754604", "0.53497416", "0.5229801", "0.519194...
0.69666076
0
This method represents the Zoho CRM Sandbox environment in EU domain
def SANDBOX(cls): return DataCenter.Environment("https://sandbox.zohoapis.eu", cls().get_iam_url(), cls().get_file_upload_url())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PRODUCTION(cls):\n\n return DataCenter.Environment(\"https://www.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def DEVELOPER(cls):\n\n return DataCenter.Environment(\"https://developer.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def is_sandbox_env...
[ "0.66116273", "0.6140853", "0.5953916", "0.5743259", "0.5588049", "0.55783147", "0.55614895", "0.53363204", "0.53363204", "0.5295397", "0.5264733", "0.52488726", "0.52402705", "0.5197426", "0.517742", "0.51340026", "0.5115851", "0.5100123", "0.50905323", "0.5072217", "0.50695...
0.7536021
0
This method represents the Zoho CRM Developer environment in EU domain
def DEVELOPER(cls): return DataCenter.Environment("https://developer.zohoapis.eu", cls().get_iam_url(), cls().get_file_upload_url())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PRODUCTION(cls):\n\n return DataCenter.Environment(\"https://www.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def SANDBOX(cls):\n\n return DataCenter.Environment(\"https://sandbox.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())", "def qa():\n env.con...
[ "0.6822908", "0.6564338", "0.569311", "0.54253435", "0.5347225", "0.53428984", "0.5295467", "0.5287747", "0.5274085", "0.5251441", "0.5246943", "0.52405435", "0.5196288", "0.51733625", "0.51546085", "0.51530725", "0.5150173", "0.51487744", "0.5145203", "0.5106765", "0.5092737...
0.7173004
0
If this form is valid, then add the current player to the character if the current user is not an admin If the user doesn't have any other active characters, set this one to active.
def form_valid(self, form): if not self.request.user.has_perm('players.view_any_player'): form.instance.player = self.request.user.player if not form.instance.player.character_set.filter(active_flag=True).exists(): form.instance.active_flag = True messages.info(self.req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def character():\n\n fl_form = PlayerForm()\n if fl_form.validate_on_submit():\n if str(fl_form.name.data) != \"\":\n player_1 = Player(fl_form.pilot.data, fl_form.merchant.data,\n fl_form.fighter.data, fl_form.engineer.data,\n int(f...
[ "0.5625584", "0.54642135", "0.5449305", "0.5441538", "0.5364482", "0.5321135", "0.53012776", "0.52551925", "0.5192996", "0.518496", "0.516057", "0.51002276", "0.50985456", "0.50770354", "0.5061944", "0.5052752", "0.50306946", "0.49842036", "0.49753016", "0.4944898", "0.494232...
0.787305
0
Returns the cartesian coordinates based RA, DEC and distance (pc)
def cartesian_coordinates(self): # extract RA items ra_hours, ra_minutes, ra_seconds = RA_RE.match(str(self.ra)).groups() # then cast ra_hours = int(ra_hours) ra_minutes = int(ra_minutes) ra_seconds = float(ra_seconds) # extract DEC items dec_sign, dec_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cartesian_coords(self):\n r = 1\n dec = self.dec + 90\n x = r * math.sin(np.deg2rad(dec)) * math.cos(np.deg2rad(self.ra))\n y = r * math.sin(np.deg2rad(dec)) * math.sin(np.deg2rad(self.ra))\n z = r * math.cos(np.deg2rad(dec))\n\n return [x, y, z]", "def _spherica...
[ "0.73995274", "0.6745973", "0.66490835", "0.6636616", "0.6457122", "0.6325703", "0.63055325", "0.62639475", "0.6244347", "0.623888", "0.6226141", "0.6144875", "0.6085932", "0.6041589", "0.6034753", "0.6028525", "0.5974474", "0.595185", "0.59408176", "0.59363127", "0.5904646",...
0.7531364
0
calcula el area de un triangulo >>> areaTriangulo(3,6) 9.0
def areaTriangulo(base,altura): return ((base*altura)/2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areaTriangulo(base,altura):\n\treturn (base*altura)/2", "def areaTriangulo(base,altura):\n\n\treturn \"El area del triangulo es: \"+str((base*altura)/2)", "def triangle_area(triangle):\n # sides of the triangle\n a = great_circle_distance(triangle[0], triangle[1])\n b = great_circle_distance(trian...
[ "0.8194877", "0.75643784", "0.74460924", "0.72854656", "0.72680473", "0.7220651", "0.7219739", "0.71850187", "0.71784806", "0.71072453", "0.7093915", "0.7066699", "0.7050622", "0.70458424", "0.704425", "0.7040018", "0.7031224", "0.6998328", "0.693636", "0.6923735", "0.6921737...
0.8147211
1
For a configuration with sigma|i and j|beta,if direction is left return the pair (j,i);else if right return pair(i,j)
def getBufferStackPair(self, direction='right'): if direction == 'left': return tuple((self.beta.top(), self.sigma.top())) elif direction == 'right': return tuple((self.sigma.top(), self.beta.top())) else: raise(Exception, 'right direction input')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pair_indices(self):\n indices_src = []\n indices_dst = []\n for i in range(self.walk_len):\n for j in range(max(i - self.l, 0), i):\n indices_src.append(i)\n indices_dst.append(j)\n for j in range(i + 1, min(i + self.r + 1, self.walk_len)):\n indices_src.append(i)\n ...
[ "0.54521126", "0.541696", "0.5415619", "0.5412766", "0.53578", "0.5330656", "0.5294213", "0.5243787", "0.5231428", "0.51917017", "0.5188", "0.51749784", "0.5166798", "0.5148644", "0.514827", "0.51446325", "0.51317346", "0.511415", "0.51123476", "0.5083673", "0.50716573", "0...
0.619712
0
test whether the item has already become some token's head in the configuration dependency arcs.
def one_head_test(self, item): v = [i for i, j in self.A if j == item] return len(v) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_and_check(self, item) -> bool:\n with Monitor.acquire(self):\n if item in self:\n return False\n self.add(item)\n return True", "def bundle_already_in_circ_dep(bundle, circularDependencies):\n\n for circDep in circularDependencies:\n if ...
[ "0.57254916", "0.5613155", "0.5449674", "0.5412983", "0.5390588", "0.5388196", "0.5379864", "0.5322283", "0.5299939", "0.52967", "0.5296006", "0.52708983", "0.52342206", "0.52338684", "0.5182851", "0.5176164", "0.5170807", "0.516634", "0.5150568", "0.5146393", "0.514558", "...
0.57060343
1
given the sentence, generate the initial configuration
def init_config(self, sentence): self.token_dict = dict([(element[0], element[1]) for element in sentence]) self.token_dict[0] = 'root' self.POS_dict = dict([(element[0], element[2]) for element in sentence]) self.POS_dict[0] = 'ROOT' self.GS_arcs = self.get_GS_parse(sentence) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def prepare(self):\n self.sentence = choice(self.sentences)", "def initial_config(self,words):\n config = {}\n config['score'] = 0\n config['pred_tree'] = [0] * len(words)\n config['stack'] = []\n config['buffer'] = list(range(len(words)))\n config['next_mov...
[ "0.60774106", "0.5948848", "0.5926184", "0.56684905", "0.564653", "0.5638209", "0.55141395", "0.5507202", "0.5499448", "0.54644394", "0.5444243", "0.5443565", "0.5435106", "0.53987366", "0.53805435", "0.5377944", "0.53730744", "0.5370155", "0.5289412", "0.52779174", "0.527070...
0.6511718
0
return the buffer top's children according to the GS_arcs
def getBufferChildren(self, buffertop): children = [v for k, v in self.GS_arcs if k == buffertop] return children
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getChildren():", "def get_b_children(self, b_obj):\n return [child for child in Blender.Object.Get()\n if child.parent == b_obj]", "def _get_children(self) -> Sequence[\"HallwayState\"]:\n if self.cur_pos < self.end_pos:\n if self.cur_pos > 0: # Stop the hallway fro...
[ "0.623109", "0.61174434", "0.60475457", "0.59993714", "0.5997012", "0.59367996", "0.59243834", "0.5859463", "0.58421", "0.583772", "0.58316565", "0.5829913", "0.58216625", "0.57711416", "0.5750558", "0.5738751", "0.57195866", "0.57156366", "0.5711305", "0.57010406", "0.570017...
0.8450365
0
extract features from the configuration and transition pairs; return the instance list for one sentence
def feature_extract(self, CT_pairs): instances = [] for pair in CT_pairs: config = pair[0] label = pair[1] data = [] featureset = {} # for nltk NaiveBayes feature selection stuff when doing MaxEnt decoding parser commit this # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sentence_to_features(self,sentence):\n\n configured_features = self.configFeatures\n sentence_features = []\n\n for word_idx in range(len(sentence)):\n # word before(-1), current word(0), next word(+1)\n feature_span = len(configured_features)\n half_span ...
[ "0.67194945", "0.65511185", "0.6465867", "0.64284235", "0.6291032", "0.61410725", "0.60821927", "0.6067108", "0.6017618", "0.6015151", "0.5970382", "0.5898697", "0.58784443", "0.5843718", "0.58426905", "0.5835273", "0.5830976", "0.57658726", "0.5746981", "0.5724346", "0.57243...
0.6724954
0
This function parse the sentence with the classifier as oracle return the arc set
def decode_parser(self, classifier, sentence): start_config = self.init_config(sentence) config = copy.deepcopy(start_config) while not config.is_terminal(): if config.sigma == start_config.sigma: shift(config) else: # here the fea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser(sent_list): #input: list of sentences", "def get_GS_parse(self, sentence):\n GS_parse_arcs = []\n for word in sentence:\n GS_parse_arcs.append(tuple((word[3], word[0])))\n \n return GS_parse_arcs", "def get_agent(drs):\n agents = []\n for line in drs:...
[ "0.5764153", "0.55803174", "0.5572467", "0.5541616", "0.539925", "0.5312468", "0.531061", "0.53088343", "0.52970827", "0.5215407", "0.5169098", "0.51603925", "0.5148786", "0.51039743", "0.5090773", "0.5088362", "0.50782424", "0.5067547", "0.5065104", "0.5050908", "0.5050302",...
0.5793312
0
Update the discussion tree and the user graph for a discussion. Does not handle the initial post.
def update_discussion_and_user_graphs(comment, extract_comment_name, extract_parent_comment_name, extract_user_name, discussion_tree, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n diff = self._diff()\n if not diff:\n # Nothing to do!\n return\n self.parent.update_node(self, diff)", "def discussion(cls, user, discussion):\n pass", "def discussion(cls, user, discussion):\r\n pass", "def force_update_graph(self)...
[ "0.58074385", "0.57799315", "0.577862", "0.55940217", "0.5501238", "0.5398144", "0.52961725", "0.52598345", "0.51260245", "0.5114867", "0.5104043", "0.50865257", "0.50715345", "0.4940611", "0.4925508", "0.48897612", "0.48691532", "0.484295", "0.47925192", "0.47786245", "0.475...
0.66084707
0
Reads all distinct users and comments in a single document and anonymizes them. Roots are 0.
def within_discussion_comment_and_user_anonymization(comment_gen, extract_comment_name, extract_user_name, anonymous_coward_name): comment_name_set = lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_user_comments(username):\n return commentslist", "def read_all(self):\n for user_id in self.user_ids:\n self.read(user_id)", "def calcCommentsPerAuthor(self, comment, numCommentsPerAuthor):\n if len(comment['children']) > 0:\n for child in comment['children']:\n ...
[ "0.53872985", "0.5267028", "0.5225717", "0.51592636", "0.51240176", "0.5037506", "0.49322015", "0.49258843", "0.49174333", "0.49066454", "0.4867537", "0.4847373", "0.48286414", "0.48204973", "0.4658238", "0.4620312", "0.45975828", "0.45910594", "0.45764187", "0.45764187", "0....
0.5857952
0
Calculate the tilt of the psf at the center of each column using all binned pixels in the given wavelength calibration file for both orders and save to file
def calculate_psf_tilts(): for order in [1, 2]: # Get the file path = 'files/SOSS_PSF_tilt_order{}.npy'.format(order) psf_file = resource_filename('awesimsoss', path) # Dimensions subarray = 'SUBSTRIP256' X = range(2048) Y = range(256) # Get the wav...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_exposure(fname, patchralims, patchdeclims, mask=True):\n from astropy.io import fits\n \n hdr = fits.getheader(fname)\n data = fits.getdata(fname)\n unc = fits.getdata(fname.replace(\"sci\", \"unc\"))\n \n s = PostageStamp()\n s.filtername = hdr[\"FILTER\"]\n s.nx, s.ny = hdr[\"...
[ "0.5678446", "0.5540088", "0.5538263", "0.54462564", "0.5424486", "0.5383693", "0.5342209", "0.5340632", "0.5311456", "0.52527946", "0.5238421", "0.52345514", "0.52322143", "0.5202266", "0.51972324", "0.5173205", "0.51652515", "0.5158616", "0.5146182", "0.513963", "0.5120352"...
0.7354719
0
Compute angle (in degrees) for pfp0pi corner
def get_angle(pf, p0=np.array([0, 0]), pi=None): if pi is None: pi = p0 + np.array([0, 1]) v0 = np.array(pf) - np.array(p0) v1 = np.array(pi) - np.array(p0) angle = np.math.atan2(np.linalg.det([v0, v1]), np.dot(v0, v1)) angle = np.degrees(angle) return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self) -> int:", "def angle(p0, p1, prv_ang=0):\r\n ang = math.atan2(p0[1] - p1[1], p0[0] - p1[0])\r\n a0 = (ang - prv_ang)\r\n a0 = a0 % (PI * 2) - PI\r\n return a0", "def angle(self):\n v = self.p1 - self.p0\n return atan2(v.y, v.x)", "def angle(p):\n\n # TODO: Make su...
[ "0.70538425", "0.6947302", "0.69462436", "0.69391584", "0.6908755", "0.6904945", "0.67661536", "0.67510873", "0.6710462", "0.66837835", "0.6674779", "0.66648835", "0.66502064", "0.66293365", "0.65779155", "0.65426683", "0.6540813", "0.6512938", "0.6484995", "0.6483135", "0.64...
0.7785308
0
Retrieve the SOSS psf for the given wavelength, scale the total flux to 1, and set pixels below cutoff value to zero
def get_SOSS_psf(wavelength, filt='CLEAR', psfs=None, cutoff=0.005, plot=False): if psfs is None: # Get the file file = resource_filename('awesimsoss', 'files/SOSS_{}_PSF.fits'.format(filt)) # Load the SOSS psf cube cube = fits.getdata(file).swapaxes(-1, -2) wave = fits.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createIntegratedPsf(self):\n\n (wavelengths, weights) = self.filter\n for i in range(len(wavelengths)):\n\n wavelength = wavelengths[i]\n weight = weights[i]\n self.convertToOpd(wavelength) # creates self.opd\n opd = self.embedOpd()\n zf...
[ "0.64917636", "0.6366691", "0.6348664", "0.6304728", "0.6156704", "0.61114067", "0.6063054", "0.5979363", "0.5936025", "0.5933075", "0.59073347", "0.58425665", "0.58303565", "0.5808383", "0.5806179", "0.5804015", "0.57856995", "0.57820714", "0.5769877", "0.5743557", "0.569674...
0.76364976
0
Generate a frame from an array of psfs
def make_frame(psfs): # Empty frame frame = np.zeros((256, 2124)) # Add each psf for n, psf in enumerate(psfs): frame[:, n:n+76] += psf return frame[:, 38:-38]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_X_from_fps(fps, settings, field_type = \"scalar\"):\n\n M = len(fps) #number timesteps\n\n for idx, fp in enumerate(fps):\n # create array of tracer\n ug = vtktools.vtu(fp)\n if not settings.THREE_DIM:\n matrix = FluidityUtils.get_1D_grid(ug...
[ "0.5970591", "0.5758865", "0.57309073", "0.57213074", "0.5660174", "0.5582748", "0.5558829", "0.5519243", "0.54236937", "0.54222715", "0.53840387", "0.5380632", "0.5364563", "0.5353716", "0.5338726", "0.5336443", "0.532419", "0.5314058", "0.52963835", "0.52558947", "0.5251377...
0.8125363
0
Generate a lightcurve for a (76, 76) psf of a given wavelength
def psf_lightcurve(psf, ld_coeffs, rp, time, tmodel, plot=False): # Expand to shape of time axis flux = np.tile(psf, (len(time), 1, 1)) # If there is a transiting planet... if ld_coeffs is not None and rp is not None and str(type(tmodel)) == "<class 'batman.transitmodel.TransitModel'>": # Set ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_transition_spectrum_ld(self,tr):\n \n\n ta = tr[\"ta\"] # TimeAxis\n ld = tr[\"ld\"] # linear dichroism strength\n om = tr[\"om\"] # frequency - rwa\n gg = tr[\"gg\"] # natural broadening (constant or time dependent)\n fwhm = tr[\"fwhm\"] # Additional gaussian broa...
[ "0.6071024", "0.599747", "0.59363514", "0.58884495", "0.58543324", "0.5847759", "0.58208954", "0.5802301", "0.57793826", "0.5740247", "0.5709572", "0.5677103", "0.5672777", "0.5670332", "0.56376666", "0.5625992", "0.5543923", "0.55391353", "0.5505812", "0.5468244", "0.5454535...
0.65660375
0
Get the psf tilts for the given order
def psf_tilts(order): if order not in [1, 2]: raise ValueError('Only orders 1 and 2 are supported.') # Get the file path = 'files/SOSS_PSF_tilt_order{}.npy'.format(order) psf_file = resource_filename('awesimsoss', path) if not os.path.exists(psf_file): calculate_psf_tilts() re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_psf_tilts():\n for order in [1, 2]:\n\n # Get the file\n path = 'files/SOSS_PSF_tilt_order{}.npy'.format(order)\n psf_file = resource_filename('awesimsoss', path)\n\n # Dimensions\n subarray = 'SUBSTRIP256'\n X = range(2048)\n Y = range(256)\n\n ...
[ "0.5528865", "0.5011075", "0.49649766", "0.49564955", "0.4956169", "0.49063593", "0.48741284", "0.4821227", "0.48131981", "0.47749847", "0.4760791", "0.47280413", "0.4695089", "0.46911192", "0.46710125", "0.46442783", "0.4637761", "0.46079037", "0.4601243", "0.45893252", "0.4...
0.7323494
0
Generate/retrieve a data cube of shape (3, 2048, 76, 76) which is a 76x76 pixel psf for 2048 wavelengths for each trace order. The PSFs are scaled to unity and rotated to reproduce the trace tilt at each wavelength then placed on the desired subarray.
def SOSS_psf_cube(filt='CLEAR', order=1, subarray='SUBSTRIP256', generate=False): if generate: print('Coffee time! This takes about 5 minutes.') # Get the wavelengths wavelengths = np.mean(utils.wave_solutions(subarray), axis=1)[:2 if filt == 'CLEAR' else 1] coeffs = trace_polynomi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_movie_cart(field='uu1', datadir='data/', proc=-1, extension='xz',\n format='native', tmin=0., tmax=1.e38, amin=0., amax=1.,\n transform='', oldfile=False):\n\n import pylab as plt\n import sys\n from pencil.files.var import read_var\n\n mkmvvar = read_var(trimall=Tr...
[ "0.6172989", "0.59879774", "0.5987656", "0.59547395", "0.5807548", "0.57991135", "0.57438767", "0.56886256", "0.5684959", "0.56823593", "0.566843", "0.5667221", "0.5657158", "0.56294376", "0.5617956", "0.56175035", "0.5616909", "0.5606972", "0.5606433", "0.5579097", "0.548663...
0.6270983
0
Helper method which authorize admin on the site.
def authorize_admin(self, instance): # Authorize user admin. instance.client.post( reverse("login"), {"username": "admin", "password": "admin"}, ) return instance.client.get(reverse("edit"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_is_admin(context):\n init()\n credentials = context.to_policy_values()\n target = credentials\n return _ENFORCER.authorize('admin_required', target, credentials)", "def check_admin():\n if not current_user.is_admin:\n abort(403)", "def check_admin():\n if not current_user.is_...
[ "0.74345106", "0.7425156", "0.7425156", "0.74210936", "0.7341495", "0.73124653", "0.71958333", "0.7189697", "0.7079393", "0.70280814", "0.7024304", "0.69792706", "0.6952145", "0.69305676", "0.69228905", "0.6911739", "0.68927675", "0.6863806", "0.68151766", "0.6810974", "0.679...
0.8138347
0
This method set a temporary image as a photo of profile. Use this method in general in tests.
def set_temporary_photo(self, instance): image_ = self.get_temporary_photo() instance.photo = image_.name instance.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_profile_with_existing_photo(self):\n # Set a user with a photo\n user = UserFactory.create()\n file_path = os.path.join(os.path.dirname(__file__), \"normal_photo.jpg\")\n self._upload_photo(user, file_path)\n\n # Re-save profile without uploading a new photo.\n ...
[ "0.71409386", "0.68548614", "0.66254944", "0.6554185", "0.64439887", "0.644293", "0.6427322", "0.6310117", "0.6260817", "0.62497175", "0.6216264", "0.6187281", "0.6161345", "0.6159245", "0.61357254", "0.6131931", "0.612636", "0.6040169", "0.60383934", "0.59192765", "0.5888633...
0.80233586
0
Attempt to parse the given string as a date in the given format. This is similar to `datetime.strptime`, but this can handle date strings with trailing characters. If it still fails to parse, raise a `CannotParse` exception.
def parse(string, format): # Count the number of spaces in the format string (N), and # truncate everything after the (N+1)th space spaces = format.count(' ') + 1 string = ' '.join(string.split()[:spaces]) try: result = dt.datetime.strptime(string, format) except ValueError, err: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date(date_string, format):\n try:\n return datetime.strptime(date_string, format)\n except ValueError:\n return None", "def get_date(string):\r\n string = re.sub(' +', ' ', string)\r\n try:\r\n return dateutil.parser.parse(string)\r\n except (TypeError, ValueError):\...
[ "0.77803355", "0.7338455", "0.7192692", "0.7131898", "0.7082593", "0.70526695", "0.69857424", "0.69278723", "0.69182205", "0.6872004", "0.68312657", "0.6782998", "0.67559403", "0.67520505", "0.6712385", "0.66084343", "0.65894634", "0.6555672", "0.65436107", "0.65415525", "0.6...
0.7667019
1
r"""Given a simplified date or time format string, return ``(format, regexp)``, where ``format`` is a `strptime`compatible format string, and ``regexp`` is a regular expression that matches dates or times in that format. The ``simple_format`` string supports a subset of `strptime` formatting directives, with the leadin...
def format_regexp(simple_format): format, regexp = ('', '') for char in simple_format: if char in _regexps: format += '%' + char regexp += _regexps[char] else: format += char regexp += char return (format, regexp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strptime(date_string, format):\n i = 0\n format_len = len(format)\n # Iterate through the format string, applying parsers and matching literal\n # chars as appropriate.\n struct_time_d = {}\n while i < format_len:\n c = format[i]\n # If the character is not the start of a direct...
[ "0.61285603", "0.60239476", "0.58081394", "0.57337236", "0.57129973", "0.5594096", "0.55001366", "0.54521984", "0.5379229", "0.53141546", "0.5312657", "0.5275983", "0.52685183", "0.525238", "0.52323633", "0.5214025", "0.5210382", "0.5202735", "0.5201047", "0.518782", "0.51610...
0.7328014
0
Return a list of ``(format, compiled_regexp)`` for all combinations of ``date_formats`` and ``time_formats``.
def _compiled_format_regexps(date_formats, time_formats): # List of all combinations of date_formats and time_formats date_time_formats = [] for df in date_formats: for tf in time_formats: date_time_formats.append(df + ' ' + tf) # Add date-only formats for df in date_formats: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _accepted_date_formats() -> Set[str]:\n known_accepted_formats = {\n '%a, %b %d %H:%M:%S %Y',\n '%a %b %d %H:%M:%S %Y',\n '%a, %d %b %Y %H:%M:%S',\n '%a %d %b %Y %H:%M:%S',\n }\n\n known_accepted_formats = known_accepted_formats.union(\n set(date_format + ' GMT' for ...
[ "0.6185128", "0.60811466", "0.5700602", "0.5635681", "0.56178033", "0.55767286", "0.5571117", "0.55492365", "0.55334157", "0.5530819", "0.5490231", "0.54770297", "0.54650444", "0.5446491", "0.5407009", "0.5278493", "0.52613443", "0.5250836", "0.5235206", "0.5230594", "0.51908...
0.88572055
0
Try to guess the date/time format of ``string``, or raise a `CannotParse` exception.
def guess_format(string): format_regexps = _compiled_format_regexps(_date_formats, _time_formats) for format, regexp in format_regexps: if regexp.search(string): return format # Nothing matched raise CannotParse("Could not guess date/time format in: %s" % string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_known_date_formats(dt_string):\n for fmt in ('%Y%m%d', '%Y%m%d %H:%M', '%m/%d/%Y', '%m/%d/%Y %H:%M'):\n try:\n return datetime.strptime(dt_string, fmt)\n except ValueError:\n pass\n raise ValueError(\"No valid date format found.\"\n \"See http...
[ "0.7218799", "0.7198527", "0.71901727", "0.7142707", "0.70474046", "0.7045746", "0.7005559", "0.69669676", "0.696655", "0.68438387", "0.6829263", "0.68213063", "0.6689801", "0.66506296", "0.6624221", "0.6616922", "0.6577821", "0.6553804", "0.6543167", "0.6478932", "0.64512026...
0.77481097
0
Open the given file and use `guess_format` to look for a date/time at the beginning of each line. Return the format string for the first one that's found. Raise `CannotParse` if none is found.
def guess_file_date_format(filename): for line in open(filename): try: format = guess_format(line) except CannotParse: pass else: return format raise CannotParse("No date/time strings found in '%s'" % filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _guess_time_format(self, csv_file):\n import csv\n\n fmt_lst = ['%Y/%m/%d %H:%M', '%Y-%m-%d %H:%M:%S']\n\n fmt_found = None\n\n with open(csv_file,'r') as fp:\n reader = csv.DictReader(fp)\n for i,line in enumerate(reader):\n for k,v in line.iter...
[ "0.73177755", "0.7121698", "0.60003906", "0.58062", "0.57358414", "0.57347196", "0.57342833", "0.56455755", "0.560631", "0.56001645", "0.55819035", "0.55562437", "0.5541434", "0.5536523", "0.5536335", "0.5477607", "0.5477061", "0.54378504", "0.5436788", "0.54233193", "0.53979...
0.8378302
0
Given a ``line`` of text, get a date/time formatted as ``dateformat``, and return a `datetime` object rounded to the nearest ``resolution`` seconds. If ``line`` fails to match ``dateformat``, a `CannotParse` exception is raised.
def date_chop(line, dateformat='%m/%d/%y %I:%M:%S %p', resolution=60): timestamp = parse(line, dateformat) # Round the timestamp to the given resolution # First convert to seconds-since-epoch epoch_seconds = int(time.mktime(timestamp.timetuple())) # Then do integer division to truncate rounded_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_line(line):\n log_line = LogLine(line)\n dt = datetime.datetime.strptime(log_line.line[0], \"%Y-%m-%d %H:%M:%S\")\n # make a tuple with dt and the rest (splatted)\n return (dt, *log_line.line[1:])", "def convert_to_datetime(line):\n pattern = r'[A-Z]\\s([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2...
[ "0.5726692", "0.5724784", "0.5623084", "0.5499627", "0.5443075", "0.5442119", "0.5334828", "0.5160421", "0.515882", "0.5142995", "0.5127343", "0.5076593", "0.5032611", "0.50146294", "0.5001198", "0.49951977", "0.49879432", "0.49714223", "0.49463895", "0.49396697", "0.49393913...
0.7240643
0
Decorator that allows itk.ProcessObject snake_case functions to accept NumPy arraylike inputs for itk.Image inputs. If a NumPy arraylike is passed as an input, output itk.Image's are converted to numpy.ndarray's.
def accept_numpy_array_like(image_filter): import numpy as np import itk @functools.wraps(image_filter) def image_filter_wrapper(*args, **kwargs): have_array_like_input = False args_list = list(args) for index, arg in enumerate(args): if is_arraylike(arg): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, image):\n\n image = np.array(image)\n image = self.transform(image=image)['image']\n return image", "def array_input(f):\n @wraps(f)\n def wrapped(self, t):\n t = np.atleast_1d(t)\n r = f(self, t)\n return r\n return wrapped", "def __array_f...
[ "0.61235124", "0.59830266", "0.5898533", "0.58105624", "0.5764335", "0.5682655", "0.5601078", "0.5596036", "0.5596036", "0.5594527", "0.55912274", "0.55714667", "0.5541407", "0.5530026", "0.55211693", "0.5520893", "0.55089426", "0.54521316", "0.5426767", "0.5426767", "0.53915...
0.6934488
0
Takes an assignment object and returns the total number of errors made by all students for that assignment
def aggregate_errors(assignment) -> int: return sum(len(problem.errors.all()) for problem in assignment.problems.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def students_by_errors(assignment) -> dict:\n\n students = {}\n for problem in assignment.problems.all():\n for error in problem.errors.all():\n if error.student_name in students:\n students[error.student_name] += 1\n else:\n students[error.student_n...
[ "0.7025914", "0.6801699", "0.63730294", "0.6177772", "0.6030786", "0.5965525", "0.59636045", "0.5921896", "0.59119236", "0.5835997", "0.5819959", "0.5799223", "0.578654", "0.577046", "0.5616561", "0.5492114", "0.5483003", "0.54646224", "0.54423296", "0.53977823", "0.537386", ...
0.80534273
0
Takes an assignment object and returns a dictionary of each of the problems in the assignment and the number of errors all students made on that problem.
def problem_errors(assignment) -> dict: problems = {} problem_number = 1 for problem in assignment.problems.all(): problems[problem_number] = len(problem.errors.all()) problem_number += 1 return problems
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_of_errors(assignment) -> dict:\n\n errors = {}\n for problem in assignment.problems.all():\n for error in problem.errors.all():\n if error.error_type in errors:\n errors[error.error_type] += 1\n else:\n errors[error.error_type] = 1\n retu...
[ "0.76585793", "0.76471317", "0.71726066", "0.5819866", "0.5586597", "0.54972494", "0.5416243", "0.5285577", "0.5253602", "0.52260804", "0.52172834", "0.5160574", "0.513195", "0.5112678", "0.50963205", "0.5089357", "0.5084206", "0.5078838", "0.50443894", "0.502009", "0.5014332...
0.8325855
0
Takes an assignment object and returns a dictionary of each of the types of errors made in the assignment, and how often they were made by all students.
def type_of_errors(assignment) -> dict: errors = {} for problem in assignment.problems.all(): for error in problem.errors.all(): if error.error_type in errors: errors[error.error_type] += 1 else: errors[error.error_type] = 1 return errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def students_by_errors(assignment) -> dict:\n\n students = {}\n for problem in assignment.problems.all():\n for error in problem.errors.all():\n if error.student_name in students:\n students[error.student_name] += 1\n else:\n students[error.student_n...
[ "0.7615883", "0.7486786", "0.64288473", "0.59325707", "0.5806261", "0.5586526", "0.54549503", "0.5347877", "0.532228", "0.5302823", "0.5302563", "0.5275182", "0.5268504", "0.52156156", "0.5199747", "0.51752365", "0.51478344", "0.51331973", "0.51245296", "0.5120131", "0.508122...
0.79672986
0
Takes an assignment object and creates a sorted list of students ranked by how few to how many errors they made based on the of calls.
def students_by_errors(assignment) -> dict: students = {} for problem in assignment.problems.all(): for error in problem.errors.all(): if error.student_name in students: students[error.student_name] += 1 else: students[error.student_name] = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_ranking(student_scores, student_names):\n\n return [\n f\"{i+1}. {name}: {score}\"\n for i, (name, score) in enumerate(zip(student_names, student_scores))\n ]", "def organize(select, strain, equals):\n scores = []\n data = list(strainer(select, strain, equals))\n while le...
[ "0.63303703", "0.6074874", "0.57029265", "0.55667585", "0.5558301", "0.5535881", "0.5524659", "0.5508017", "0.5453176", "0.54442424", "0.54359025", "0.53503746", "0.53441733", "0.5338063", "0.532781", "0.5292211", "0.52790946", "0.5273265", "0.52695644", "0.5253859", "0.52468...
0.7052386
0
run a large motor
def run_motor(self, motor, power): self.run_flag = True super(RemoteControl, self).run_motor(motor, power)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def loop():\n # ArmDevice.storage.joints_pos = await get_positions() # Use this if encoders are wired up.\n # ArmDevice.storage.joints_pos = simulate_positions() # Use this for testing without position feedback.\n log.debug(\"command: {}\".format(ArmDevice.storage.command))\n ArmDevice.storage.co...
[ "0.65479594", "0.637305", "0.63327247", "0.6295356", "0.6255691", "0.6253849", "0.613439", "0.6079243", "0.605925", "0.60552835", "0.6011878", "0.6009268", "0.5993289", "0.59273756", "0.59195966", "0.59042937", "0.5896328", "0.5868088", "0.58462083", "0.58331347", "0.582976",...
0.69642276
0
Returns the url extension for the page confirming the user's submitted changes to their Tor Weather preferences.
def get_confirm_pref_ext(pref_auth): extension = _CONFIRM_PREF % pref_auth return extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webextensions_info(request):\n supported_languages = (\n 'de', 'en-US', 'es', 'fr', 'ja', 'pl', 'pt-PT', 'ru', 'zh-CN'\n )\n lang = find_language(request.LANG)\n if lang not in supported_languages:\n lang = 'en-US'\n url = 'https://support.mozilla.org/kb/webextensions-%s' % (lang.l...
[ "0.58391684", "0.57616216", "0.5642145", "0.56362206", "0.56362206", "0.5630109", "0.5598378", "0.5595052", "0.5532652", "0.5487156", "0.5464503", "0.5458858", "0.54098636", "0.54047495", "0.53756905", "0.53681713", "0.5357294", "0.53308743", "0.5328991", "0.5328278", "0.5305...
0.58073
1
Returns the url extension for the error page specified by the error_type parameter.
def get_error_ext(error_type, key): extension = _ERROR % (error_type, key) return extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_url(self, msg):\n formatdict = self._formatdict().update({\"msg\": msg})\n return self._frame_response(\"{protocol}://{hostname}/whitelist/error?\" \\\n \"msg={msg}\" % formatdict)", "def get_failure_url(self, lang: str = settings.LANGUAGE_CODE) -> str:\...
[ "0.60293037", "0.60169035", "0.59975165", "0.5583067", "0.54806507", "0.5474995", "0.54539865", "0.54298", "0.5393397", "0.53877103", "0.5381277", "0.5374627", "0.53743076", "0.536421", "0.53521836", "0.53430015", "0.5335615", "0.5298976", "0.5297518", "0.5263311", "0.5232646...
0.7122264
0
Returns the url extension for the page alerting the user that the fingerprint they are trying to monitor doesn't exist in the database.
def get_fingerprint_info_ext(fingerprint): extension = _FINGERPRINT_NOT_FOUND % fingerprint return extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404", "def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404", "def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404", "def page_not_found(e):\n return 'Sorry, nothing at this URL.', 404", "def page_not_fo...
[ "0.5796723", "0.5796723", "0.5796723", "0.5796723", "0.5796723", "0.5796723", "0.5796723", "0.5774338", "0.5774338", "0.5774338", "0.5774338", "0.5774338", "0.5774338", "0.5774338", "0.5774338", "0.5599441", "0.5512731", "0.54398346", "0.53601575", "0.53378606", "0.5326085", ...
0.66245157
0
Returns the complete url for the Tor Weather home page.
def get_home_url(): url = base_url + _HOME return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHome(self):\n # host = getHostWithPort(url)\n # ui = UrlInfo(url)\n # host = url[ui.getHostHead():ui.getHostTail()]\n host = self.url[self.host_head:self.host_tail]\n return \"http://\" + host + \"/\"", "def getHomePage(self):\n return self.home_url", "def url (...
[ "0.723074", "0.70980936", "0.6792789", "0.6568771", "0.6553189", "0.64337766", "0.64009786", "0.6400002", "0.6390533", "0.63778085", "0.6361005", "0.63409305", "0.6300913", "0.6300718", "0.62270015", "0.62169826", "0.61951154", "0.61944896", "0.61906403", "0.61906403", "0.618...
0.75662595
0
Returns the complete url for the preferences page, which is displayed to the user in the email reports and on some of the Tor Weather pages.
def get_preferences_url(pref_auth): url = base_url + _PREFERENCES % pref_auth return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def propeller_theme_url():\n return theme_url()", "def url(self):\n return app.settings.cherrypy.url()", "def page_url(self):\n url = '/plaque/%s' % self.key.urlsafe()\n return url", "def get_feedback_url(self):\r\n\r\n return self.get_setting('service_feedback_url')", "def u...
[ "0.61642754", "0.61377543", "0.61319333", "0.6008679", "0.59925425", "0.5932186", "0.59243554", "0.59064156", "0.58602667", "0.58250546", "0.58250546", "0.57752824", "0.5765485", "0.57419705", "0.571921", "0.56954527", "0.56901515", "0.56854", "0.5681914", "0.56767446", "0.56...
0.76017195
0
Returns the url extension for the userspecific preferences page.
def get_preferences_ext(pref_auth): ext = _PREFERENCES % pref_auth return ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_preferences_url(pref_auth):\n url = base_url + _PREFERENCES % pref_auth\n return url", "def get_confirm_pref_ext(pref_auth):\n extension = _CONFIRM_PREF % pref_auth\n return extension", "def url(self) -> str:\n return f\"{self._get_base_url()}{self.path_extension}\"", "def propelle...
[ "0.7134155", "0.6286976", "0.6094673", "0.6024081", "0.5966217", "0.5835652", "0.5763877", "0.5691833", "0.5649563", "0.56295973", "0.5601872", "0.5581633", "0.555106", "0.55409825", "0.55409825", "0.55336934", "0.5514878", "0.55092436", "0.5501633", "0.54904675", "0.54762137...
0.6647017
1
Returns the url extension for the page displayed after the user asks to be resent their confirmation email.
def get_resend_ext(confirm_auth): extension = _RESEND_CONF % confirm_auth return extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_email_confirmation_url(self,client_domain, request, emailconfirmation):\n url = reverse(\n \"accounts:confirm_email\",\n args=[emailconfirmation.key])\n ret = build_absolute_uri(\n request,\n url)\n return ret", "def get_url(cls):\n ...
[ "0.6444485", "0.6121679", "0.5974973", "0.5799933", "0.57807773", "0.57807773", "0.57183427", "0.57026285", "0.56741565", "0.5670201", "0.56420755", "0.5556889", "0.55540794", "0.5493677", "0.54817617", "0.54763895", "0.5423732", "0.54160506", "0.54081416", "0.5403571", "0.54...
0.6150792
1
Returns the complete url for the user's unsubscribe page. The url is displayed to the user in the email reports and on some of the Tor Weather pages.
def get_unsubscribe_url(unsubs_auth): url = base_url + _UNSUBSCRIBE % unsubs_auth return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe_url(self) -> str:\n return self[\"Sns\"][\"UnsubscribeUrl\"]", "def unsubscribe_user(sub_id):\n repository.unsubscribe(sub_id)\n return flask.render_template('www/email/unsubscribed.html')", "def unsubscribe(request):\n user = None\n if request.user.is_authenticated:\n ...
[ "0.8248312", "0.6656969", "0.6535919", "0.63484436", "0.62273335", "0.6153049", "0.6149846", "0.607249", "0.6054178", "0.5956143", "0.5935647", "0.58992416", "0.5780307", "0.5780307", "0.5780307", "0.5780307", "0.5780307", "0.57691187", "0.57357687", "0.56587857", "0.56334317...
0.79988396
1
Returns the Tor tshirt url
def get_t_shirt_url(): return _T_SHIRT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Url(self) -> str:", "def make_url(self, artist, song):\n url = \"http://www.azlyrics.com/lyrics/{}/{}.html\".format(artist, song)\n return url", "def url(self) -> str:\n return pulumi.get(self, \"url\")", "def url(self) -> str:\n return pulumi.get(self, \"url\")", "def getUR...
[ "0.6737412", "0.6659898", "0.63815343", "0.63815343", "0.63784796", "0.6374058", "0.6364623", "0.63645303", "0.6314996", "0.6301127", "0.6300948", "0.62441427", "0.62102", "0.6201053", "0.61579937", "0.6152843", "0.6141449", "0.61219865", "0.6101319", "0.60954565", "0.6088564...
0.7708709
0
Raw swarm cumulative equity (average swarm equity)
def raw_equity(self): if self._swarm_avg is None: raise ValueError("Run run_swarm() method before access this property") return self._swarm_avg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_perc_reducts():\n #Load RCP2.6 datq\n cubes = iris.load(data_dir+'DMSSO2NH3_18502100_RCP26_monthly.nc')\n #Get the surface and high level SO2 emissions\n surf_cube = cubes[3][:,0]\n high_cube = cubes[1][:,0]\n cubes = iris.cube.CubeList([surf_cube,high_cube])\n\n for i in range(0,len(cubes)):\n ...
[ "0.61126965", "0.5934328", "0.5719101", "0.5719101", "0.57015646", "0.5701339", "0.565671", "0.5654826", "0.5631036", "0.56149083", "0.5596574", "0.55953836", "0.5595173", "0.55807567", "0.55744004", "0.55252916", "0.5523018", "0.55183446", "0.5517316", "0.5511539", "0.549957...
0.68175024
0
Raw swarm inposition flag
def raw_inposition(self): if self._swarm_inposition is None: raise ValueError("Run run_swarm() method before access this property") return self._swarm_inposition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _moving(self, verbose=True):\n status_byte = self.read_defined_status(verbose=verbose)\n\n if status_byte in (\"simulation\", None):\n status_byte = b\"\\xdf\\xdf\"\n # else:\n # status_byte = binascii.hexlify(status_byte).decode('utf-8')\n\n # status_regis...
[ "0.5335982", "0.52958405", "0.51357025", "0.51132137", "0.50826496", "0.50552064", "0.5042596", "0.5030361", "0.5020017", "0.49750066", "0.49570167", "0.4932614", "0.49301925", "0.48969692", "0.48876557", "0.48808897", "0.48620623", "0.48606128", "0.4859491", "0.48559615", "0...
0.6453933
0
Net equity of picked swarm
def picked_equity(self): if self._swarm_series is None: raise ValueError("Run pick() method before access this property") return self._swarm_series['equity']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_equity(self):\n if self._swarm_avg is None:\n raise ValueError(\"Run run_swarm() method before access this property\")\n return self._swarm_avg", "def dvs_different_networks(self):\n self.show_step(1)\n self.env.revert_snapshot(\"dvs_vcenter_systest_setup\")\n\n ...
[ "0.58337474", "0.5646098", "0.5611107", "0.55490714", "0.54785043", "0.542056", "0.54102415", "0.53644943", "0.53540385", "0.5353745", "0.5336259", "0.5327939", "0.53227586", "0.5317326", "0.5285345", "0.5278157", "0.52762216", "0.5270819", "0.5266545", "0.5244902", "0.522623...
0.5716619
1
Series for picked swarm result
def series(self): if self._swarm_series is None: raise ValueError("Run pick() method before access this property") return self._swarm_series
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(self):\n\n chart_series = [] # will hold all the series created\n\n # determine the sensor to plot from the sensor selected by the user.\n the_sensor = bmsapp.models.Sensor.objects.get(pk=self.request_params['select_sensor'])\n\n # get the requested averaging interval in ho...
[ "0.6113491", "0.57950217", "0.57843035", "0.55591255", "0.55474114", "0.5495262", "0.54620874", "0.54612017", "0.54551774", "0.5450727", "0.54461783", "0.54426754", "0.54261756", "0.54011285", "0.53944343", "0.5392777", "0.53901225", "0.53787816", "0.5370679", "0.5357802", "0...
0.6486518
0
Backtesting and swarm picking routine
def pick(self): if self._islast_state: raise Exception("This swarm loaded from LastState Dict pick() it not applicable") swarm_settings = self.context['swarm'] nSystems = swarm_settings['members_count'] rankerclass = swarm_settings['ranking_class'] self._rebalanceti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_and_restore(self):\n # Run for 5 algo-calls\n testargs = [\"python\", \"scripts/smac\", \"--scenario_file\",\n self.scenario_one, \"--verbose\", \"DEBUG\"]\n with mock.patch.object(sys, 'argv', testargs):\n self.smaccli.main_cli()\n # Increase ...
[ "0.5866065", "0.5723503", "0.5710037", "0.5661517", "0.5656686", "0.56525254", "0.56321526", "0.56182027", "0.56130093", "0.5606447", "0.5579499", "0.556336", "0.555688", "0.55541915", "0.553283", "0.5528469", "0.55178094", "0.5510604", "0.5496303", "0.548589", "0.5474239", ...
0.6151481
0
Get alpha direction from strategy_context
def get_direction(strategy_context): direction_param = strategy_context['strategy']['opt_params'][0] if 'direction' in strategy_context['strategy']: warnings.warn("'direction' parameter in strategy_context['strategy']['direction'] is obsolete, " "please remove it t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAlpha(self,mode='full'):\n if mode=='full':\n return self.__allAlphas\n else:\n return self.__allAlphas[modeDict[mode][2]]", "def alpha(asset, strategy):\n up = asset['forward_returns'][asset['forward_returns'] > 0]\n down = asset['forward_returns'][asset['forward...
[ "0.593818", "0.57644624", "0.5629886", "0.554937", "0.55493563", "0.55493563", "0.55493563", "0.55360365", "0.54851943", "0.5482179", "0.54654527", "0.5461804", "0.5461365", "0.54591197", "0.54553163", "0.5453621", "0.54528177", "0.5398781", "0.5388797", "0.5384906", "0.53798...
0.642971
0
Return swarm name based on strategy_context
def get_name(strategy_context, suffix=''): return '{0}_{1}_{2}{3}'.format(strategy_context['strategy']['exo_name'], Swarm.get_direction(strategy_context)[1], strategy_context['strategy']['class'].name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strategy_name(self):\n return self._java_ref.getStrategyName()", "def name(self):\n suffix = ''\n if 'suffix' in self.context['strategy'] \\\n and self.context['strategy']['suffix'] is not None \\\n and len(self.context['strategy']['suffix']) > 0:\n ...
[ "0.6780126", "0.642213", "0.6113747", "0.5969466", "0.59619886", "0.5892513", "0.5674635", "0.56497276", "0.56060195", "0.56001586", "0.55869836", "0.5577453", "0.55403024", "0.54803914", "0.54789704", "0.54789704", "0.54406154", "0.5406495", "0.5406265", "0.5406265", "0.5377...
0.7250129
0
Last net exposure of picked swarm
def last_exposure(self): if self._last_exposure is None: raise ValueError("Run pick() method before access this property") return self._last_exposure
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_exposure(self):\n\n try:\n exposure = Exposure.objects.latest('pk')\n except Exposure.DoesNotExist:\n exposure = None\n\n return exposure", "def _sensor_last_update(self):\n return self._cam.get_attributes(self._sensor, self._channel)[3]", "def las...
[ "0.627684", "0.60011214", "0.59804106", "0.584215", "0.5752194", "0.57506675", "0.56921136", "0.56280786", "0.5611097", "0.5553458", "0.55467767", "0.5535321", "0.5506948", "0.54798657", "0.54633814", "0.5424016", "0.53889614", "0.53838456", "0.5349765", "0.53477883", "0.5325...
0.6302912
0
Last member list for picked swarm
def last_members_list(self): if self._last_members_list is None: raise ValueError("Run pick() method before access this property") return self._last_members_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMembers():", "def getMembers():", "def getMembers():", "def getMembers():", "def get_last(self):\n return \"%s%s%s\" % (\n # As per the original list there's a 1/39 (not conting Bob)\n # chance for a 'Mc' prefix to the lastname\n #\n ...
[ "0.6012568", "0.6012568", "0.6012568", "0.6012568", "0.58908653", "0.582603", "0.5531536", "0.5474671", "0.5453597", "0.53458", "0.53323025", "0.53323025", "0.53114444", "0.53085536", "0.5281946", "0.5279745", "0.527947", "0.52079076", "0.5195897", "0.50834906", "0.507999", ...
0.6920703
0
Restores last swarm state from dictionary
def laststate_from_dict(state_dict, strategy_context): ctx = Swarm.clone_context(strategy_context) ctx['strategy']['opt_preset'] = Swarm._parse_params(state_dict['last_members_list']) # Creating new swarm in special mode (used for online updates) swm = Swarm(ctx, laststate=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_state(self):\n return dict(self.last_state)", "def _hard_update(self, active, target):\n\n target.load_state_dict(active.state_dict())", "def forgiving_state_restore(net, loaded_dict):\n net_state_dict = net.state_dict()\n new_loaded_dict = {}\n for k in net_state_dict:\n ...
[ "0.633337", "0.6319731", "0.6252858", "0.62257636", "0.6214186", "0.6206955", "0.60510534", "0.60291725", "0.6024444", "0.60072446", "0.5971578", "0.5971578", "0.5963173", "0.5941402", "0.5842679", "0.58256954", "0.5815756", "0.5804862", "0.5803396", "0.5757096", "0.5706311",...
0.6697103
0
Copies each value in y n_ensemble times.
def transform_labels(self, y): y = np.repeat(y, self.n_ensemble, axis=0) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resample_data(self, X, y, N):\n if N > 0:\n # Split labels into set of indexes for each class\n class_idxs = [np.where(y == c)[0] for c in np.unique(y)]\n\n # Shuffle each of sets of indexes\n [np.random.shuffle(i) for i in class_idxs]\n\n # Take N...
[ "0.5696857", "0.55983675", "0.5515553", "0.55049175", "0.53981876", "0.53713936", "0.53713936", "0.53599966", "0.53441536", "0.5308044", "0.5277408", "0.52604496", "0.52238953", "0.521527", "0.5212805", "0.51969504", "0.5190573", "0.51566154", "0.5123278", "0.51224333", "0.51...
0.6092374
0
Create the complex node. Children is an expression list of reals.
def __init__(self, children): super().__init__('complex', children, None) self.real = children[0].real self.imag = children[1].imag self.complex = self.real + self.imag*1j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_value(self) -> global___Expression.ComplexValue:", "def get_complexes(self):\n q_cmplx = prefixes + \"\"\"\n SELECT ?complexTerm ?childName ?child ?stmt\n WHERE {\n {\n {?stmt belvoc:hasSubject ?complexTerm}\n UNION\n ...
[ "0.6757247", "0.6421604", "0.6077799", "0.6036496", "0.59997034", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.58063316", "0.57802093", "0.57316315", "0.56936383", "0.56929064", "0.5678592", "...
0.76445353
0
Return the corresponding OPENQASM string.
def qasm(self, prec=15): return "(" + self.children[0].qasm(prec) + "," + self.children[1].qasm(prec) + ")"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_qasm_str(self):\n return qasm(self)", "def to_asm(self) -> str:\n try:\n build_instruction = self._handlers_map()[self.segment]\n return clean_instructions(build_instruction())\n except KeyError:\n pass\n try:\n build_instruction = se...
[ "0.7685419", "0.5868934", "0.5855643", "0.5833167", "0.56840605", "0.56698763", "0.5640762", "0.5487561", "0.5357098", "0.53469735", "0.5338116", "0.5269128", "0.5248834", "0.5221731", "0.51812154", "0.51706177", "0.51705444", "0.5129476", "0.51142144", "0.5092683", "0.509032...
0.5941014
1
To preview the generated report
def preview(): html = create_html_report() return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview():\n return render_template(\"controls/preview.html\")", "def display_html_report():\n display(HTML('report_page.html'))", "def print_quick_report():\r\n print('function not yet written')\r\n # print a summary of the report as a structured pandas dataframe\r\n #Summar...
[ "0.65647286", "0.6514273", "0.6481401", "0.6326529", "0.63118035", "0.6285655", "0.6274466", "0.6243317", "0.62234545", "0.6211153", "0.6164128", "0.61612236", "0.6157429", "0.6123298", "0.6103737", "0.6102084", "0.6101047", "0.6074879", "0.6041828", "0.6021828", "0.6016878",...
0.8426991
0
read all the template files
def _readFiles(self): template_files = [] for file in os.listdir(self.template_folder): if file.endswith(".xml"): template_files.append(file) return template_files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_template_files(self, template_path):\n templates = dict()\n for file in listdir(template_path):\n template_file = re.search(r\"(.*?).html$\", file)\n if template_file:\n template_name = template_file.groups()[0]\n templates[template_name] =...
[ "0.7399289", "0.7233268", "0.709016", "0.70246196", "0.6859602", "0.6846041", "0.68209827", "0.66867626", "0.6595781", "0.64478016", "0.6365857", "0.6278409", "0.6237154", "0.62185204", "0.6200003", "0.61860764", "0.61692446", "0.61688673", "0.6166491", "0.6166088", "0.612967...
0.7968689
0
This reads the template in and returns a dict with the trigger as key and the template as value
def readTemplate(self, file): templates = {} doc = ElementTree.parse(file) entries = doc.findall("entry") for entry in entries: templates[entry.find("trigger").text] = [entry.find("description").text, entry.find("template").text] self._convertTabs(templates) return templates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context(template):\n\n return {\n v.key: v.read()\n for v in [Variable(name) for name in extract_variables(template)]\n }", "def process_template(template, data):\n t = Template(template, data)\n t.job = get_current_job()\n t.process()\n\n result = dict(template=template, data...
[ "0.690088", "0.6610917", "0.6393504", "0.61733735", "0.6040819", "0.59287363", "0.59017605", "0.5887361", "0.5881303", "0.5861772", "0.5836569", "0.5726067", "0.5715365", "0.5713643", "0.570019", "0.56194746", "0.5611597", "0.5593515", "0.55707127", "0.55575496", "0.5551132",...
0.7490698
0
This file tries to look up the filetype of the current vim file and then searches for the template file in template_folder
def getFile(self): #try to redetect the filetype vim.command("filetype detect") #return the filetype filetype = vim.eval("&ft") #filetype = vim.command("&ft") if filetype: for file in self.template_files: if filetype.lower() in file.lower(): self.hasTemplate = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _FindTemplateFile(self, topdir):\n if topdir.endswith('..'):\n topdir = '/'.join(topdir.split('/')[:-2])\n fnames = os.listdir(topdir)\n for fname in fnames:\n filename = '%s/%s' % (topdir, fname)\n if filename.endswith('.yaml') and not os.path.isdir(filena...
[ "0.7006804", "0.62505", "0.6183583", "0.61281747", "0.5950617", "0.59435374", "0.5912505", "0.58778495", "0.5829198", "0.58145374", "0.57678", "0.5711798", "0.57100046", "0.5673664", "0.5630803", "0.5594588", "0.5590428", "0.5553388", "0.55331165", "0.5499746", "0.5484739", ...
0.7654798
0
tries to insert the template, if the template does not exist, insert a tab There exists a template file
def insertTemplate(self, word, line, pos): try: template = self.templates[word][1] before = line[0:pos[0]] after = line[pos[0]+pos[1]:] template = before + template + after template_list = template.split("\n") self.template_list = template_list #TODO replace with correct t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_template(title: str) -> None:\n\n\tsite = pywikibot.Site()\n\tpage = pywikibot.Page(site, title)\n\tpage_text = page.text\n\n\tif not (has_template(page_text)):\n\t\tprint(\"'%s' not in '%s'... Adding\" % (TEMPLATE_NO_NEWLINE, page))\n\t\tpage_text = u''.join((page_text, TEMPLATE))\n\t\tpage.text = page_te...
[ "0.6787698", "0.655994", "0.6408037", "0.6361384", "0.62453693", "0.61913085", "0.6189786", "0.61587626", "0.6141149", "0.6088981", "0.60084987", "0.599285", "0.59722894", "0.59641606", "0.5960124", "0.5911975", "0.5838429", "0.5831861", "0.58280134", "0.5807192", "0.58049184...
0.7266368
0
searches the position of the first placeholder found
def findPlaceholder(self, placeholder): start = self.row for lineno in xrange(start-1, len(self.buffer)): x = self.buffer[lineno].find(placeholder) if x != -1: return (lineno, x, len(placeholder)) #not found after, search to start backwords! for lineno in xrange(start-1, 0, -1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __findPlaceholder(self, data, index):\r\n m = self.__placeholder_re.search(data, index)\r\n if m:\r\n return m.group(1), m.end()\r\n else:\r\n return None, index + 1", "def findPlaceholderIndex(text, placeholder_count):\n placeholders = map(\n lambda i: (i...
[ "0.77518433", "0.62426907", "0.61914635", "0.6016476", "0.5877722", "0.57366043", "0.5718622", "0.57105285", "0.57032603", "0.5670469", "0.5669576", "0.56579125", "0.55865747", "0.55865747", "0.5550876", "0.5550876", "0.5550876", "0.5550876", "0.5550876", "0.5550876", "0.5550...
0.76521546
1
Decode segmentation class labels into a color image
def decode_segmap(label_mask, num_classes): label_colours = get_capsicum_labels() r = label_mask.copy() g = label_mask.copy() b = label_mask.copy() for ll in range(0, num_classes): r[label_mask == ll] = label_colours[ll, 0] g[label_mask == ll] = label_colours[ll, 1] b[label_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_labels(mask, num_classes=41):\n h, w = mask.shape\n outputs = np.zeros((h, w, 3), dtype=np.uint8)\n\n img = Image.new('RGB',(len(mask[0]), len(mask)))\n pixels = img.load()\n for j_, j in enumerate(mask):\n for k_, k in enumerate(j):\n if k < num_classes:\n ...
[ "0.7805848", "0.75098044", "0.7304198", "0.7275498", "0.72520304", "0.72520304", "0.70294243", "0.69549465", "0.6898265", "0.682476", "0.679584", "0.6689548", "0.6634558", "0.6631074", "0.6520768", "0.64985836", "0.64970213", "0.6464975", "0.64312714", "0.6365957", "0.6339828...
0.7715157
1
Player {player} makes a move at ({row}, {col}). row The row of the board. col The column of the board. player The player, can be either 1 or 2.
def move(self, row, col, player):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, row, col, player):\n self.board[row][col] = player", "def make_move(board, player_num, row, col):\n board[row][col] = 'X' if player_num == 1 else 'O'", "def move(self, row, col, player):\n if self.winning == True:\n return\n self.matrix[row][col] = player\n ...
[ "0.8334732", "0.81491405", "0.79764235", "0.78849614", "0.7871985", "0.7869819", "0.7833538", "0.7759764", "0.7727419", "0.77087235", "0.7651536", "0.76198137", "0.7614189", "0.7599636", "0.7593006", "0.75929105", "0.7529066", "0.7516459", "0.7339029", "0.73178864", "0.725962...
0.8636922
0
must be called if the state of an app linked to the dock changes if index is empty that means that we don't know which app is concerned so the function update all app of the dock
def update_dock_state_color(self, *index): iterator = index if index else range(len(self.apps)) for i in iterator: app = self.apps[i] x = self._height * app.dock_index y = max(int(self._height*0.2), 1) if app.dock_state: # there are interactions bet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_apps(self):\n pass", "def upgrade():\n config = ConfigManager()\n apps = config['apps']\n for i, app in progressbar(enumerate(apps), redirect_stdout=True):\n z = Zap(app)\n if i == 0:\n z.update(show_spinner=False)\n else:\n z.update(check_appim...
[ "0.5856636", "0.5764488", "0.55949986", "0.557898", "0.55719924", "0.5556712", "0.54871875", "0.54107505", "0.5361981", "0.5358056", "0.5298752", "0.52619827", "0.5257932", "0.5257752", "0.525733", "0.5236518", "0.5236518", "0.5226954", "0.52123475", "0.5192042", "0.51911", ...
0.6961279
0
Convert weight to proper units for garden.
def weight_for_garden(self): return to_preferred_weight_units(self.weight.value, self.garden, force_large_units=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWeight(self) -> float:\n ...", "def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6", "def convert_weight_by_uom(self, weight, instance, import_process=False):\n woo_weight_uom = instance.weight_uom_id\n product_weig...
[ "0.66525835", "0.66388303", "0.6606236", "0.6495065", "0.6401649", "0.6380442", "0.6365318", "0.6341833", "0.62269056", "0.62164986", "0.6200249", "0.6189188", "0.6147499", "0.6147499", "0.6099497", "0.60930043", "0.60930043", "0.6090631", "0.606417", "0.606369", "0.6054628",...
0.7323631
0
The main function which extracts the data from the sampledata spreadsheet and splits it to a csv per account
def main(): bank_lookup = { 'Spending': bank_main, 'Income': bank_main, 'Saving': bank_savings, 'Credit card': bank_credit, } sheet_data = petl.fromxlsx('sample-data.xlsx', sheet='Data') data = sheet_data.cut(*range(5)) early_data = data.select('Date', lambda r: r.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n store = file.Storage('token.json')\n creds = store.get()\n if not creds or creds.invalid:\n flow = client.flow_from_clientsecrets('credentials.json', SCOPES)\n creds = tools.run_flow(flow, store)\n service = build('sheets', 'v4', http=creds.authorize(Http()))\n\n # Call t...
[ "0.63617843", "0.5913129", "0.5824758", "0.58233404", "0.576933", "0.57648766", "0.57443106", "0.5704869", "0.569615", "0.56674916", "0.5656156", "0.5620081", "0.56107676", "0.5608967", "0.5608129", "0.55957836", "0.557985", "0.55740327", "0.5561803", "0.5561592", "0.55265385...
0.68390256
0
Method that handles starttags. It's needed to differ from standard tags (e.g. or ) and anchor, image and iframe tags. Furthermore, for each tag it's possible to receive attributes belonging to those tags, so we need to set each attribute
def handle_starttag(self, tag, attrs): self._current_tag = tag if tag == "a": self._html += self._handle_anchor_tag(attrs) elif tag == "img": self._html += self._handle_img_tag(attrs) elif tag == "iframe": self._html += self._handle_iframe_tag(attrs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_starttag(self, tag, attrs):\n if tag == \"a\":\n curr_tag = Tag(tag)\n for attribute in attrs:\n curr_tag.add_attribute(attribute[0], attribute[1])\n self.current_tags.append(curr_tag)\n elif tag == \"img\":\n curr_tag = Tag(tag)\n...
[ "0.7784485", "0.75315005", "0.7064484", "0.70490676", "0.70389974", "0.6998906", "0.6893429", "0.677777", "0.6758485", "0.67532754", "0.6735203", "0.6633921", "0.6538303", "0.6453569", "0.6368079", "0.62008566", "0.61761206", "0.61455375", "0.61326027", "0.61061835", "0.60221...
0.76653856
1
Move the data to the content list and add placeholders to the HTML string
def handle_data(self, data): if data.strip(): self._content_list.append((self._current_tag, data)) self._html += f"{{{'placeholder_'+str(self._index)}}}" self._index += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(self, content):\n return content", "def add_default_content(self):\n data = get_default_eventpage_data()\n\n for i, section in enumerate(data):\n section[\"position\"] = i\n section[\"content\"] = render_to_string(section[\"template\"])\n del sect...
[ "0.60762805", "0.6021763", "0.5969206", "0.5890986", "0.58076334", "0.58034307", "0.5774951", "0.57682335", "0.5745227", "0.5692025", "0.5669389", "0.5665252", "0.56211066", "0.558631", "0.55846715", "0.55604553", "0.55536723", "0.55502844", "0.55090046", "0.54941", "0.547844...
0.7351561
0
Encode the html to base64. We also remove the outer div tag because wagtails adds the richtext div themselves.
def encode_html(self): html_temp = self._html try: html_temp = html_temp.split('<div class="rich-text">')[1].rsplit( "</div>", 1 )[0] except IndexError: pass return b64encode(html_temp.encode("utf-8")).decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html(html: str):\r\n WRAPPER = \"\"\"<div style=\"overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 1rem; margin-bottom: 2.5rem\">{}</div>\"\"\"\r\n # Newlines seem to mess with the rendering\r\n html = html.replace(\"\\n\", \" \")\r\n return WRAPPER.format(html)", ...
[ "0.6252061", "0.62255776", "0.6099226", "0.609459", "0.60929275", "0.6049715", "0.5859212", "0.5859212", "0.58185", "0.5774915", "0.5760695", "0.57114923", "0.5699245", "0.56821626", "0.5523436", "0.5494988", "0.54324716", "0.54230255", "0.5414909", "0.53819066", "0.5375905",...
0.7948618
0
The way Wagtail saves images to the database is in a different format than image tags. So, we convert the image tag here to the desired format. The eventual database value looks
def _handle_img_tag(self, attrs): alt = "" image_format = "" image_id = 0 for key, value in attrs: if key == "alt": alt = value if key == "class": image_format = value.split()[1].replace("-", "") if key == "src": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_internal_value(self, data):\n if isinstance(data, str) and data.startswith('data:image'):\n # Found image is encoded, and must be decoded\n format, imgstr = data.split(';base64,')\n ext = format.split('/')[-1] # Extract file extension\n id = uuid.uuid4()\n ...
[ "0.64293545", "0.6209428", "0.6131785", "0.6078381", "0.601919", "0.59364045", "0.5783975", "0.57679343", "0.5766106", "0.5766106", "0.5748267", "0.5747447", "0.57454455", "0.5707151", "0.56857127", "0.5637787", "0.5633948", "0.55801445", "0.5578169", "0.5578052", "0.5537144"...
0.6255511
1
Checks logger output from queue.
def check(self, queue_log_record: queue.Queue[LogRecord]) -> None: log_record: LogRecord = queue_log_record.get() self.logger.handle(log_record) if "FFmpeg process quit finish" in log_record.message: self.ffmpeg_process_quit_finish = True if re.search(InstanceResource.REGEX_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_queued_output(self):\n for stream in [\"stdout\", \"stderr\"]:\n while True:\n output, queue_size = getattr(self, stream).readline(timeout=0.1)\n if not (output is None or len(output) == 0):\n self.log(output, self.log_level[stream])\n ...
[ "0.6695599", "0.6401291", "0.6348741", "0.6227416", "0.60845596", "0.60078293", "0.59285367", "0.58319074", "0.5784124", "0.5775208", "0.5738639", "0.5731436", "0.57106346", "0.57042634", "0.5674892", "0.5660808", "0.5606246", "0.55886835", "0.5586341", "0.55854404", "0.55582...
0.7292924
0
Convert base 10 to another base 10. The function also accepts standard SIprefixes. Arguments
def base10_to_base10(value, old_base, new_base, power = 1, verbose = 0): if verbose > 1: print("UnitConversion.base10_to_base10()") if old_base is None: warnings.warn("UnitConversion.base10_to_base10(): argument old_base is None.") return None if new_base is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertebasenbase10(baseorig, numero):\n base10 = 0\n for i in range(len(numero)-1, -1, -1):\n base10 += DIGITOS.index(numero[i]) * baseorig**(len(numero)-i-1)\n\n return base10", "def convertebase10basen(basedest, numero):\n ret = \"\"\n while True:\n digit = numero%basedest\n ...
[ "0.7070656", "0.7051135", "0.69148386", "0.68618363", "0.6760555", "0.67586803", "0.6757287", "0.66739166", "0.666465", "0.6629699", "0.6445567", "0.63063437", "0.6281427", "0.62513715", "0.62244445", "0.621536", "0.6150034", "0.6131036", "0.6129615", "0.6125174", "0.6121779"...
0.744103
0
General function to convert the transmission for certain conditions, to transmission for other conditions. Arguments
def transmission_to_transmission(T, c, l, c_new, l_new, T_unit = "T1", T_unit_out = None, verbose = 0): if verbose > 1: print("UnitConversion.transmission_to_transmission()") if T_unit != "T1": T, dump = convert_y(T, T_unit, "T1", verbose = verbose) idx = numpy.asarray(numpy.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_to(self, data, get_recv, get_data):\n checking = bytes(data).decode().encode('ascii', 'ignore').decode()\n if not get_data:\n checking = bytes(data).decode().encode('ascii', 'ignore').decode().splitlines()[0]\n if not get_recv:\n checking = bytes(data).decode().e...
[ "0.5180546", "0.5090888", "0.5034845", "0.4989684", "0.4925967", "0.49047956", "0.48879835", "0.48786741", "0.4871478", "0.4858609", "0.48482364", "0.4831592", "0.47827938", "0.4777297", "0.4772897", "0.47553748", "0.47499585", "0.4714747", "0.4700464", "0.4694652", "0.469273...
0.57919466
0
Perform a pairwise element operation involving two arrays in batch. Currently only supports up to 3D arrays
def batch_pairwise(array1, array2, function, batch_size=50, shape=None): # Assert dimensions of arrays are equal assert array1.ndim == array2.ndim == 2 # Assert function is callable assert callable(function) # Form empty matrix to return with given shape if provided if shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cross_multiply_array_2_list():\n array_1 = np.ones((1, 3))\n array_2 = np.ones((1, 3)).tolist()\n array_out = utils.cross_multiply_array(array_1, array_2, axis=1)\n assert (1, 3, 3) == array_out.shape", "def batch_outer_product(a, b):\n a, b = normalize_and_check_ndim([a, b], 2)\n # Th...
[ "0.6474555", "0.6252369", "0.6250842", "0.6219934", "0.6160421", "0.60711443", "0.6052965", "0.60104674", "0.5995642", "0.5980817", "0.594645", "0.59385526", "0.59345466", "0.5918935", "0.5911154", "0.5894298", "0.585775", "0.5854683", "0.5841825", "0.58380187", "0.58346075",...
0.6871134
0
>>> m = Model(4, (3, 3)) >>> m.get_piece_at_opening(0, 0) 0 >>> m.get_piece_at_opening(m.size_x 1, m.size_y 1) 0 >>> m._set_piece_at_opening(Piece.PLAYER1, 1, 0) >>> m.get_piece_at_opening(1, 0) 1 >>> m.get_piece_at_opening(1, 1)
def get_piece_at_opening(self, x, y): self._validate_opening(x, y) return self._openings[x][y]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_piece(self, at):\n return self.nodes[at].piece", "def get_piece(self):\n old = self.next_piece\n new = self.create_piece()\n self.next_piece = new\n self.queue_draw()\n return old", "def __init__(self, piece):\n self.piece = piece", "def _get_piece_at_open...
[ "0.6051541", "0.5981636", "0.59641033", "0.5912433", "0.56497204", "0.55979484", "0.55670047", "0.5544224", "0.55328196", "0.54752487", "0.5463695", "0.5463695", "0.5441367", "0.53762335", "0.53707993", "0.5353213", "0.5333155", "0.531185", "0.530312", "0.5293354", "0.5291239...
0.64129823
0
Same as get_piece_at_opening, but returns Piece.NONE if (x,y) is an invalid position. >>> m = Model(4, (3, 3)) >>> m._get_piece_at_opening_or_none(0, 0) 0 >>> m._get_piece_at_opening_or_none(m.size_x 1, m.size_y 1) 0 >>> m._set_piece_at_opening(Piece.PLAYER1, 1, 0) >>> m._get_piece_at_opening_or_none(1, 0) 1 >>> m._get...
def _get_piece_at_opening_or_none(self, x, y): if self._is_valid_opening(x, y): return self._openings[x][y] else: return Piece.NONE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_piece_at_opening(self, x, y):\n self._validate_opening(x, y)\n return self._openings[x][y]", "def get_piece(self, x, y):\n if self.in_bounds(x, y) and self.piece_at(x, y):\n return self.__board[(x, y)]\n return None", "def get_piece(self) -> Union[Piece, None]:\r\...
[ "0.6993997", "0.63746876", "0.6185926", "0.59864604", "0.5799236", "0.5734156", "0.5595184", "0.55785716", "0.55400455", "0.5520113", "0.55175215", "0.55175215", "0.55106086", "0.5478291", "0.546426", "0.54432404", "0.539741", "0.53973484", "0.53973484", "0.5373151", "0.53633...
0.83418924
0
>>> m = Model(4, (2, 2)) >>> m.is_column_full(0) False >>> m.drop_piece(Piece.PLAYER1, 0) >>> m.is_column_full(0) False >>> m.drop_piece(Piece.PLAYER2, 0) >>> m.is_column_full(0) True
def is_column_full(self, x): top_row = self.size_y - 1 return self.get_piece_at_opening(x, top_row) != Piece.NONE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_column_full(column):\n if STATE[0][column] == '-': # data[0] corresponds to top row of board\n # if top row of column is a dash ie column not full\n return False\n else:\n # else column is full\n return True", "def is_full(self):\n # If at least one of the columns ...
[ "0.6531942", "0.62881696", "0.6108338", "0.6103429", "0.58427775", "0.57586294", "0.5671582", "0.5656103", "0.56339335", "0.5616936", "0.55952406", "0.55929154", "0.55708915", "0.55497515", "0.55305165", "0.55243576", "0.5433684", "0.5420405", "0.53835326", "0.53576", "0.5350...
0.6649859
0
End the current player's turn and move on to the next player.
def end_turn(self): if self.current_player_piece == Piece.PLAYER1: self.current_player_piece = Piece.PLAYER2 elif self.current_player_piece == Piece.PLAYER2: self.current_player_piece = Piece.PLAYER1 else: raise RuntimeError('Invalid current player piece')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_turn(self):\r\n self.turn += 1", "def __end_turn(self):\n self._turn_counter += 1\n # päivittää pelaajan\n self._player %=2\n self._player += 1\n if (self._gui):\n self.__status[\"text\"] = self._player_names[self._player-1]\n self.__turn_co...
[ "0.7916003", "0.7696367", "0.76730627", "0.7526631", "0.71301675", "0.7022273", "0.6984088", "0.6829111", "0.6825629", "0.68145853", "0.6771383", "0.6738377", "0.6721064", "0.66936487", "0.6680166", "0.66459703", "0.663784", "0.6629566", "0.6613371", "0.6611637", "0.6608681",...
0.7991267
0
Checks for a win caused by a piece being placed at (piece_x, piece_y). piece (Piece) The piece being placed. piece_x,piece_y (Numbers) The position of the piece. [(winning_piece_1_x, winning_piece_1_y), (winning_piece_2_x, winning_piece_2_y), ...] if the player of the piece wins. False otherwise.
def _check_for_win(self, piece, piece_x, piece_y): for slope_x, slope_y in ((1,0), (0,1), (1,1), (1,-1)): for start_x, start_y in ((piece_x - slope_x*i, piece_y - slope_y*i) for i in range(self.consecutive_pieces_to_win)): winning_piece_positions = [] for x, y in ((st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_status(self, x: int, y: int, piece: int) -> typing.Union[int, None]:\n winnable = piece * self.continuous_pieces_to_win\n\n # Horizontally continuous pieces\n if np.sum(self.board_values[x, :]) == winnable:\n return piece\n\n # Vertically continuous pieces\n ...
[ "0.7714387", "0.71684116", "0.7160652", "0.71524876", "0.70459193", "0.70286584", "0.70155853", "0.6993022", "0.6944884", "0.68826514", "0.6873216", "0.68676424", "0.68571943", "0.6835442", "0.6826662", "0.68227684", "0.68194187", "0.675412", "0.67132455", "0.6701105", "0.668...
0.85738623
0
True if the current board state is a tie. This is the same as the board being full. False otherwise. >>> m = Model._create_from_picture(3, (3, 3), [ ... 0, 0, 0, ... 0, 0, 0, ... 0, 0, 0]) >>> m._is_tie() False >>> m = Model._create_from_picture(3, (3, 3), [ ... 1, 1, 0, ... 2, 2, 1, ... 1, 1, 2]) >>> m._is_tie() False...
def _is_tie(self): for y in range(self.size_y): for x in range(self.size_x): piece = self.get_piece_at_opening(x, y) if piece == Piece.NONE: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_tie(self):\n\n shape = self.board.shape\n if np.count_nonzero(self.board) == (shape[0] * shape[1]):\n # The board is full\n player = 0\n return True\n else:\n return False", "def game_is_tied(self):\n tie_score = False\n if s...
[ "0.7468926", "0.70562285", "0.70390886", "0.6650312", "0.6408003", "0.6311634", "0.6295424", "0.6208164", "0.6115105", "0.6082029", "0.6080698", "0.60645264", "0.59645104", "0.59566826", "0.5913568", "0.59109926", "0.5899727", "0.5897146", "0.5895648", "0.5888286", "0.583464"...
0.74397993
1
Test for registry_login method positive result.
def test_registry_login_positive(self, request_api_mock): result = registry_login("username", "password") expected_result = "key" self.assertEqual(result, expected_result) request_api_mock.assert_called_once()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_successful_login(self):\n pass", "def test_login_OK(self):\n rv = self.login('super',\n '1b3231655cebb7a1f783eddf27d254ca')\n assert 'Bienvenido' in rv.data", "def test_successful_login(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo199...
[ "0.7233881", "0.6933611", "0.6782867", "0.6652973", "0.6561677", "0.6548874", "0.65468234", "0.65154165", "0.65066636", "0.6503586", "0.64484584", "0.6447106", "0.64377683", "0.6433873", "0.6393922", "0.6388949", "0.6386809", "0.6384695", "0.63809335", "0.63692856", "0.636833...
0.7717747
0
Test for registry_reset_password method positive result.
def test_registry_reset_password_positive(self, request_api_mock): registry_reset_password("email@example.com") request_api_mock.assert_called_once()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_can_reset_password(self):\n # first register a user\n self.register_user()\n # registered user forgets password \n # its a post request with the user email as the payload\n response = self.client().post(AuthTestCase.reset, data=self.reset_email)\n self.assert...
[ "0.7767088", "0.749847", "0.7464453", "0.74392015", "0.74130183", "0.7229368", "0.7141311", "0.71321625", "0.71213263", "0.71054125", "0.70570225", "0.70461035", "0.6963163", "0.6940286", "0.6912851", "0.6881348", "0.684003", "0.68024945", "0.67609924", "0.67595005", "0.67458...
0.7598332
1
Establish a connection to Google Cloud Storage storing agriculture data.
def establish_connection() -> storage.client.Client: storage_client = storage.Client.from_service_account_json(find('Agriculture.json', '/home')) return storage_client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n AUTHORIZATION_SCOPES = [\n 'https://www.googleapis.com/auth/devstorage.full_control']\n\n creds = None\n # The file token.pickle stores the user's access and refresh tokens, and is\n # created automatically when the authorization flow completes for the f...
[ "0.596186", "0.59588665", "0.58454543", "0.5755493", "0.564243", "0.5469606", "0.53677744", "0.530092", "0.5278353", "0.5270555", "0.5267123", "0.5262071", "0.5255684", "0.5247195", "0.5243197", "0.5241998", "0.5175217", "0.5130209", "0.5113716", "0.51127607", "0.509885", "...
0.70657575
0
Drop from a list of files, files specified by drop_files.
def pop_files(local_list: List[str], drop_files: List[str]) -> List[str]: files: List[str] = [f for f in local_list if f not in drop_files] return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dropMove(self, point: QPoint, selectedFiles: List[QModelIndex]) -> None:\n selectedFiles = [self._currPath.joinpath(x.data()) for i, x in enumerate(selectedFiles)\n if i % len(self._modelHeaders) == 0]\n try:\n filename = self._mainFileView.indexAt(point).sibli...
[ "0.6274261", "0.58417416", "0.5627868", "0.5450564", "0.54195285", "0.5371229", "0.53409004", "0.53381956", "0.5209906", "0.5188055", "0.51284516", "0.5120756", "0.50826204", "0.5076794", "0.5064614", "0.5050584", "0.50350296", "0.50130063", "0.50047666", "0.50014246", "0.499...
0.69275004
0
Test that when an officer issue an assessment an email is sent to the group email
def test_email_sent_to_assessor_group(self): # officer issue assessment self.client.login(self.officer.email) url = reverse('wl_applications:send_for_assessment') payload = { 'applicationID': self.application.pk, 'assGroupID': self.assessor_group.pk } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sending_mail(self):\n\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n reminders.Patient.objects.filter(\n pk__in=[self.test_patient.pk, self.other_patient.pk]\n ).update(next_visit=appt_date)\n confirmed = self.create_confirmed_...
[ "0.7080751", "0.70648086", "0.7016153", "0.6941475", "0.6869784", "0.6854586", "0.68308765", "0.68170816", "0.68155485", "0.6755837", "0.6732992", "0.6724957", "0.6719349", "0.6696172", "0.65853006", "0.6581435", "0.6580773", "0.65689814", "0.6560231", "0.6539446", "0.6527919...
0.82068163
0
Esta consulta retorna una LISTA con los ratings que el usuario ha emitido.
def ratings_usuarios(username, ratings): return list(filter(lambda x: x.username == username, ratings))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_ratings(user_id):\n return _fetch_records(f\"SELECT item_id, rating_type FROM ratings WHERE user_id = {user_id}\")", "def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]", "def get_ratings(self):\n return self.ratings", "def get_ratings(se...
[ "0.77587324", "0.6952571", "0.6860585", "0.6860585", "0.68588316", "0.66540813", "0.6542746", "0.6541774", "0.6495753", "0.6482677", "0.64488935", "0.64205724", "0.6345928", "0.62979263", "0.62368256", "0.6232412", "0.6206269", "0.6172111", "0.61582834", "0.61459374", "0.6078...
0.75215715
1
Take the data from the input file and display the max money by calling the get_max_money function and return generator
def test_inputs(): # Get data from the input file and unpacking it to three variable get_data = read_input() restructuring_info = get_data[0] machine_info = get_data[1] length = get_data[2] # start, end to slice the generator start, end = 0, 0 # Loop through lenght of restructuring #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_drawdown():\n try:\n with open(folder + 'portfolio_balance.json', encoding='utf-8') as read_file:\n data = json.loads(read_file.read(),\n object_pairs_hook=OrderedDict)\n\n def daily_price():\n \"\"\" Record daily volume in a gene...
[ "0.67404354", "0.59138083", "0.572321", "0.56172585", "0.5607067", "0.554669", "0.55295205", "0.5445193", "0.535403", "0.5352179", "0.5337163", "0.5333648", "0.5320556", "0.53137213", "0.53111684", "0.52605236", "0.519396", "0.515909", "0.51005757", "0.5085011", "0.5056105", ...
0.6512625
1
Make sure a valid GGP is set as session var and set the current one if it isn't. Return the selected GGP's roman numeral.
def _ensure_ggp_is_set(request, ggp_roman_numeral=None): if ggp_roman_numeral is not None: llp = LegislativePeriod.objects.get(roman_numeral=ggp_roman_numeral) request.session['ggp_roman_numeral'] = llp.roman_numeral request.session['ggp_facet_repr'] = llp.facet_repr elif 'ggp_roman_nume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_choice(game):\n global set_game\n set_game = game\n return set_game", "def setg(self, var, val):\n self.rpc.call(MsfRpcMethod.CoreSetG, [var, val])", "def gpa(self, new_gpa):\n if self.MIN_GPA <= new_gpa <= self.MAX_GPA:\n self._gpa = new_gpa\n else...
[ "0.5230128", "0.50398815", "0.50113773", "0.4945968", "0.4859684", "0.4853237", "0.48203847", "0.4787776", "0.47494698", "0.47351906", "0.4730962", "0.4715696", "0.47107637", "0.4684746", "0.4683502", "0.467053", "0.4664196", "0.4637679", "0.46370846", "0.46280903", "0.462573...
0.670646
0
Print a single entry to the screen
def display_entry(self, entry): border = '-' * 50 print(border) print('Employee: {}'.format(entry.employee_name)) print('Task Name: {}'.format(entry.task_name)) print("Date: {}".format(entry.date)) print("Time Spent: {}".format(entry.time_spent)) if entry.notes !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_entry(text):\n print \"Text entered: \\n '%s'\" % text", "def print_entry(entry):\n border = '-' * 50\n print(border)\n print(entry['name'])\n print(\"Date: {}\".format(entry['date']))\n print(\"Time Spent: {}\".format(entry['time_spent']))\n if entry['notes'] != '':\n print(...
[ "0.7604881", "0.7490008", "0.68592334", "0.6842278", "0.66274625", "0.6596985", "0.6362685", "0.6182261", "0.61438775", "0.6139358", "0.6136981", "0.61289585", "0.6067885", "0.60424805", "0.59795034", "0.597643", "0.5970543", "0.5966209", "0.5923482", "0.58977634", "0.5894045...
0.762026
0
Test finding expected peak matches when given a mass_shift of 5.0.
def test_cosine_hungarian_tolerance_01_shift_min5(): spec1 = numpy.array([[100, 200, 300, 500], [1.0, 1.0, 0.1, 0.1]], dtype="float").T spec2 = numpy.array([[105, 205.1, 300, 500.1], [1.0, 1.0, 0.1, 0.1]], dtype="float").T matching_pairs = collect_peak_pai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_match():\n S1=Spectrum.Spectrum()\n S1.add_peak(50.7,234)\n S1.add_peak(54.6,585)\n S1.add_peak(60.7,773)\n S1.add_peak(65.6,387)\n S1.add_peak(87.7,546)\n S1.add_peak(104.6,598)\n S1.pep_mass=100\n S1.euclidean_scale()\n\n S2=Spectrum.Spectrum()\n S2.add_peak(50.5,234/2)\n...
[ "0.60248613", "0.5964446", "0.589918", "0.5855601", "0.5829239", "0.57997787", "0.57100123", "0.5652658", "0.56419444", "0.56135005", "0.560081", "0.5576124", "0.55437875", "0.5538877", "0.553686", "0.552131", "0.55206054", "0.5502467", "0.5498179", "0.5490236", "0.54775643",...
0.68140554
0
Receives a Projectile object and applies the impulse to give speed to it.
def shoot(self, projectile): projectile.speed = self._impulse / projectile.mass return projectile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fire(self, angle):\r\n #convert the angle to the slope multiply by bullet speed for velocity\r\n self.velocity.dy = math.sin(math.radians(angle)) * BULLET_SPEED\r\n #convert the angle to the slope multiply by bullet speed for velocity\r\n self.velocity.dx = math.cos(math.radians(ang...
[ "0.59316117", "0.5884692", "0.5594743", "0.55570596", "0.5524037", "0.5483883", "0.5477438", "0.5477124", "0.5470956", "0.5431373", "0.5422255", "0.53357625", "0.5252058", "0.5245323", "0.51944166", "0.51854277", "0.51828176", "0.5178488", "0.5147133", "0.5138189", "0.5136454...
0.7854602
0
test SLEfun with matalb results
def TEST(): # test yMAT = np.load('./yrand900MATLAB.npy') DyMat = np.load('./Dyrand900MATLABreal.npy') + 1j * \ np.load('./Dyrand900MATLABimag.npy') # y = rand(900,1) dy = SLEfun(yMAT,C) a = dy - DyMat[0] print(np.shape(dy)) print(np.shape(DyMat)) print(np.shape(a)) print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_SMEL_args():\n testing_function('sme', bilinear=False)", "def linear_regression(x_train, t_train, basis, bias,reg_lambda=0, degree=1, mu=0, s=1):\n \n # Construct the design matrix.\n # Pass the required parameters to this function\n \n phi = design_matrix(x_train,basis,degree,bias,mu,...
[ "0.63632315", "0.63436526", "0.62657934", "0.62620854", "0.61904556", "0.6113969", "0.60632455", "0.60554117", "0.59718496", "0.5868393", "0.5858938", "0.58164483", "0.58161247", "0.5774808", "0.5734179", "0.5717575", "0.5712923", "0.5711649", "0.570334", "0.5692349", "0.5673...
0.63576806
1
Calculate sums and diffs on the model and update the view.
def show_calculations(self): self.view.set_sum(self.model.get_sum()) self.view.set_diff(self.model.get_diff())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_view(self):\n for row in self.view.obj_list:\n for obj in row:\n obj._update(self.model)", "def action_update_total(self):\n for order in self:\n amount_untaxed = 0.0\n for line in order.order_line_ids:\n amount_untaxed += li...
[ "0.66780245", "0.61962867", "0.6120315", "0.6019155", "0.59631884", "0.5938503", "0.5928737", "0.59252095", "0.59014624", "0.58953726", "0.5890772", "0.58753586", "0.58296543", "0.58286166", "0.5822498", "0.5820709", "0.5742585", "0.5715072", "0.5715072", "0.5683032", "0.5666...
0.7746688
0
Opens the socket, receiving clients and handling them, until the server is closed.
def open(self): import sys # open the socket to listen up to 5 connections self.__socket.listen(5) # a counter to print while's parameters counter = 0 # loop until the user requested to exit and finished receiving responses while not self.__closed: # g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server(self):\n while True:\n if DEBUG_LEVEL >= 0:\n print \"Awaiting connection...\"\n\n (client_socket, client_address) = self._socket.accept()\n if DEBUG_LEVEL >= 0:\n print \"Got connection from: {}\".format(client_address)\n\n ...
[ "0.74569803", "0.737567", "0.7340759", "0.72223806", "0.7187127", "0.71839756", "0.71498346", "0.70983887", "0.70967627", "0.7090948", "0.70387673", "0.6963759", "0.6927896", "0.6922286", "0.69103944", "0.69097054", "0.6898655", "0.6893557", "0.68925714", "0.68789345", "0.683...
0.78990966
0
This send_cryptmsg functions sends user email verification during the new user registration and sends a link to their when password reset is required.
def send_cryptmsg(userhandle, msg_type): smtpserver = smtplib.SMTP('localhost', 1025) conn = sqlite3.connect('./db/life.db') cur = conn.cursor() randomSequence = '' for i in range(16): randomSequence = randomSequence + str(randint(0,9)) if msg_type == 0: #email_verification cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_pw_reset_email(user):\n token = user.get_token()\n message = Message(\n 'Reset Your Password',\n sender='storcwebsite@gmail.com',\n recipients=[user.email])\n message.body = f\"To verify reset your password, click the link \" \\\n f\"below:\\n\\n\" \\\n f\"{url_...
[ "0.63621986", "0.6320612", "0.6319296", "0.62995183", "0.6268091", "0.62545806", "0.6232443", "0.62269676", "0.6203568", "0.6178218", "0.6139821", "0.61341226", "0.61274093", "0.61169946", "0.61156416", "0.6059936", "0.6047422", "0.60433745", "0.60411286", "0.6033168", "0.599...
0.71805495
0