id
stringlengths
20
20
title
stringclasses
1 value
text
stringlengths
8
768k
ffae56d84459cf7d0fad
def enqueue(self, e): return self._data.add_last(e)
ffae662e2ddc1e95f1f6
def pipe_no_wait(process): if platform.system().lower().startswith('win'): pipefd = process.stdout.fileno() SetNamedPipeHandleState = windll.kernel32.SetNamedPipeHandleState SetNamedPipeHandleState.argtypes = [HANDLE, LPDWORD, LPDWORD, LPDWORD] SetNamedPipeHandleState.restype = BOOL ...
ffae6fa784753cc0deab
def saveData(self): self.annotation_dict[os.path.basename(self.images[self.current_index])]=self.rect_list for i in self.images: key=os.path.basename(i) if key in self.annotation_dict.keys(): list_rect=self.annotation_dict[key] else: co...
ffae94bf30316143dd07
def read_image(filename: str) -> np.ndarray: try: img = cv2.cvtColor(cv2.imread(filename), cv2.COLOR_RGB2BGR) except Exception: img = cv2.imread(filename) return img
ffae9d2d7f21e5305edf
async def put(self) -> None: product = self.get_argument("product") description = self.get_argument("description") category = self.get_argument("category") price = self.get_argument("price") supplier = self.get_argument("supplier") product_rating = self.get_argument("prod...
ffaea1a806c3ffee6618
def reportMedAndAvg(l): median = getMedianSalary(l) avg = getAverageSalary(l) print "Median Salary: ${:.2f}".format(median) print "Average Salary: ${:.2f}".format(avg)
ffaea6fef393c7756fd0
def GetAttachments(service, user_id, msg_id): try: file_names = [] message = service.users().messages().get(userId=user_id, id=msg_id).execute() if 'parts' in message['payload']: for part in message['payload']['parts']: extentions = re.findall("(?<=\.)([...
ffaece400d66fc52f311
def data_loader(csv_file, batch_size=32, train=True, is_validation=False): df = pd.read_csv(csv_file) # The Image column has pixel values separated by space; convert # the values to numpy arrays: df['Image'] = df['Image'].apply(lambda im: np.fromstring(im, sep=' ')) df = df.dropna() # drop all...
ffaed1c2d6508c8ae13b
def get_uid(path, api_base, api_auth): url = urlparse.urljoin(api_base + "/", "path") + path res = requests.get(url, auth=api_auth) res.raise_for_status() return json.loads(res.text)['uid']
ffaee7da862ff64e355b
def load_data(self, filepath=None): df = pd.read_csv(filepath, converters={"paragraphs": literal_eval}) df = filter_paragraphs(df) self.cdqa_pipeline.fit_retriever(df=df)
ffaee9b9f3839f578f22
def test_no_queues_available(self): # When no queues are available, a NoAvailableQueues Exception should be raised self.assertRaises(resources.NoAvailableQueues, resources.get_least_busy_available_queue)
ffaf04b55027b61f76ba
def _check_interface(self, userid, ip): result_list = self._smtclient.execute_cmd(userid, 'ip addr') for element in result_list: if ip in element: return True return False
ffaf2af8a01b6ad79259
def recordinglocation_delete_perm(request): allowed_roles = ['Superuser'] if request.user.has_role(allowed_roles) == True: return True else: #TODO add logging return False
ffaf52306e22eac7b9d6
def huff_code(symb, prob): # ------------------------------------------------------------------ def group(symb, prob): """ Taking a list of symols('symb') and a corresponding list of probabilities('prob'), the two least probable symbols are first grouped into a list and added to...
ffaf62ba9493a024879f
def loadPFDic(fPF): PFDic = {} lines = conTable(fPF) for line in lines: x = line.strip().split() phone = x[0] feat = x[1] val = x[2] addPhoneFeatureValue(phone, feat, val, PFDic) return PFDic
ffaf6a2441a11769f143
def read_queue(self, queue, **kwargs): return None
ffafabb4ba1059927a3c
def _validate_request(self): # Validate resource # try: # if not is_downloadable_resource(self.resource_id): # raise PackagerControllerError(_("This resource cannot be downloaded")) # except t.ObjectNotFound: # raise PackagerControllerError("Resource not f...
ffafac45e8c52aff4e46
def format_error(error): return { "ename": error.__class__.__name__, "evalue": str(error), "traceback": list(format_exc().splitlines()), }
ffafb5fba1d04f45bbd2
def challenge_reset(user): if user in guns: clean_guns(user) return "Challenge reset, %(nick)s," else: return "You're not challenging anyone, %(nick)s."
ffafd54dd29c2000548b
def _filling_combination_function(x, x1, x2, f1, f2): w = _filling_weight_function def g1(x): x_outs = [] for x0 in x: x_out = 0 for i in range(len(f1)): x_out += f1[i] * x0 ** (len(f1) - i - 1) x_outs.append(x_out) return x_outs ...
ffb00d54f5c408bbdb18
def __iadd__(self, other): self.append(other) return self
ffb01d2cc2a02b3e80f4
def get_gene_info(self, symbol): return
ffb01e076dcb0b0496c7
def test_save_map(self): # TODO: Write test to get multiple map images # mr.save_map(f_name) pass
ffb034b6555d92341f3d
def _props_dict(self): return dict([(a, getattr(self, a)) for a in self.__props__])
ffb0549a674bb83f5690
def get_sheet_data(): creds = None # The file token_sheets.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token_sheets.pickle'): with open('token_sheets.pickle', 'rb') as token:...
ffb06a50d22c3119068d
def make_file_name(data_path,shot_num,freq): return '{0}{1}_{2:4.3}GHz.h5'.format(data_path,shot_num,float(freq))
ffb07a74b4bebec1d8c5
def stack_control(self): #initial loop point xs=self.st.pop() #instance to control and manage chains ch=chainMan() cert_list=[] while xs: #print xs cert_list.append(xs) xs=self.st.pop() #Loading with cert obje...
ffb08658e1150f2e6efd
def convert_data_col(df): return df.withColumn("MedianAge", col("Median Age").cast(T.FloatType())) .withColumn("MalePopulation", col("Male Population").cast(T.IntegerType())) .withColumn("FemalePopulation", col("Female Population").cast(T.IntegerType())) .withColumn...
ffb08d636e06181a1ee3
def percentile(x,cdf,frac=0.68): indx = bisect.bisect(cdf, frac) - 1 return ((frac - cdf[indx])/(cdf[indx+1] - cdf[indx]) *(x[indx+1] - x[indx]) + x[indx])
ffb0abb82ceeb555bda2
def get_simulation_parameters(self, sim_protocols): amp = sim_protocols['amp'] shared_params = {} shared_params['stim_type'] = sim_protocols['stim_func'] if 'parameter_scaling' in sim_protocols: shared_params['parameter_scaling'] = sim_protocols['parameter_scaling']...
ffb0d5def80e47c75d51
def eos_idx(self): return self.vocab[self.eos_token]
ffb10ab01c9851b022b5
def _file_exists(self, path): return False
ffb11254245770989518
def clean_regions(regions): removed_regions = [] marked_for_removal = [] for (i, region) in enumerate(regions): center = region['internal_rect'][0] for other_region in regions: if other_region['props'].area > region['props'].area: dist = cv2.pointPolygonTest(other...
ffb11b6cd8d65355aad4
def timestampParse(tStr, f=TIMESTAMPFORMATS.DATETIMESEC_DOTS): if f is TIMESTAMPFORMATS.DATETIMESEC_DOTS: t = timegm(time.strptime(tStr, '%Y.%m.%d.%H.%M.%S')) elif f is TIMESTAMPFORMATS.MMDDYYYY_SLASHES: t = timegm(time.strptime(tStr, '%m/%d/%Y')) else: raise ValueError(f'Unexpected format: f={f!r}') return t
ffb12e307d949eacf1a5
def post(name): path = '{}/{}'.format(POST_DIR, name) post = flatpages.get_or_404(path) return render_template('post.html', post=post, name='Blog')
ffb13f3e2bbba6e846e2
def convert_csv(self) -> List[str]: data = [] variable, dimensions, values = self._do_it() for index, value in enumerate(values): year = self.start_year + index if (value not in ["0.0", "0", ""]) and (year <= self.end_year): try: val...
ffb1615953fc153990bd
def test_config_default(configured_valiant: Valiant) -> None: v = configured_valiant assert v.cache_dir is not None assert v.configuration_dir is not None
ffb18488744fa47dd5f8
def set_labels(self, labels): self._labels = labels
ffb193ccf5690ab66257
def isSameKindAs(self, *args): return _osg.Geometry_isSameKindAs(self, *args)
ffb1a052efc0ad74b91f
def get_valid_egress_port(): egress_port = [] ex_egress_ports = [] egressPrtRange = ( get_config_arg( "cross_connects", "egress_ports_range")).split( '-') for j in range(int(egressPrtRange[0]), int(egressPrtRange[1]) +...
ffb1a9c6dae6e9a05709
def createWeightedResultsDFOneEstimator(al_results,atl_results,weighting,estimator_name,candsets_super_results,max_quota=200,filename='al_and_atl_results'): d = atl_results mean_2iter,mean_10iter,mean_20iter,mean_30iter,mean_50iter,mean_100iter,mean_maxiter = [],[],[],[],[],[],[] al_mean_2iter,al_mean_10...
ffb1ca8bfc1ba57506a7
def __call__(self, *args): return self._macro(*args)
ffb1e8fe735b91c30661
def solar_radiation_vertical(locator, path_arcgis_db, latitude, longitude, year, gv, weather_path): print(weather_path) # Set environment settings arcpy.env.workspace = path_arcgis_db arcpy.env.overwriteOutput = True arcpy.CheckOutExtension("spatial") # local variables simple_cq_shp = locat...
ffb1f2633731acc08776
def next_batch(self, batch_size): start = self._index_in_epoch self._index_in_epoch += batch_size if self._index_in_epoch > self._num_examples: # Finished epoch self._epochs_completed += 1 # Shuffle the data perm = numpy.arange(self._num_examples) nump...
ffb20978940e696e82fa
def countPlayers(): DB, c = connect() c.execute("SELECT count(*) as num FROM player_registration") results = c.fetchone() number_of_players = results[0] DB.close return number_of_players
ffb20c277ea8e46af627
def _get_node_id(self, node) -> str: return node.id
ffb21f577e71d5b4409c
def update(self,old_sqlobject, new_sqlobject,table): return True
ffb239dbfeeacf298e5e
def trackPitch(self, audio): # figure out how big our analysis window and hop size are in audio frames hopSize = int(round(self.hopSizeInSec * self.sampleRateInHz)) analysisWindowSizeInFrames = int(round(self.analysisWindowSizeInSec * self.sampleRateInHz)) # print an exception if audio ...
ffb239ff61a4dead158f
def test_bad_item(): bad = m.give_recommendation(model, "meow", key) assert (bad == "RECOMMEND POPULAR ITEMS")
ffb23f74414ec7e4e044
def check_word(s): if contains_naughty_chars(s): return False if count_vowels(s) < 3: return False return has_letter_sequence(s)
ffb26d42ec33c8d4222c
def _dice_loss_binary(output, target, weights=None): smooth = 1. target = target.float() intersection = output * target numerator = 2 * (intersection.sum()) denominator = output + target denominator = denominator.sum() loss_per_channel = 1 - ((numerator + smooth)...
ffb273c521db557bac3b
def test_reading_corrupted_fcs_file(self): path = os.path.join(BASE_PATH, 'data', 'FlowCytometers', 'corrupted', 'corrupted.fcs') self.assertRaises(ValueError, parse_fcs, path)
ffb29c66b6693525b669
def date_from_year_doy(year, doy): d = datetime.datetime(year=year, month=1, day=1) + datetime.timedelta(days=doy) return d.isoformat()
ffb2a3ff1f2e79eb882e
def build( self, problem: Problem, variable_set: np.ndarray ) -> List[LpConstraint]: pass
ffb2bfd442a7a03024dc
def rate(self) -> int: return self.__rate
ffb2c568c219d021168b
def is_locked(self): ret_val = self._is_locked() return ret_val
ffb2dc8c6ad2a71c5df8
def low_middle_high_out_degree_ratio(G): all_out_degrees = {} all_out_degrees = nx.out_degree_centrality(G) sorted_all_out_degrees = sorted(all_out_degrees.items(), key=operator.itemgetter(1)) sorted_nodes = [k for (k, v) in sorted_all_out_degrees] n = nx.number_of_nodes(G) third = n / 3 ...
ffb2f24377ea876751f3
def clear(cls): cls.queues = {} cls.threads = {} cls.failure = False
ffb303e8b9aa3f5bbe05
def test_q_vector_4d(data_4d): u_g, v_g = geostrophic_wind(data_4d.height) q1, q2 = q_vector(u_g, v_g, data_4d.temperature, data_4d.pressure) q1_truth = np.array([[[[-9.02684270e-13, 2.04906965e-13, 2.90366741e-12, 2.19304520e-12], [4.39259469e-13, 1.21664810e-13, 1.52570637e-12, ...
ffb30c972d063eb9b2ea
def close_env(self): pass
ffb32aca3ae921038fe3
def update_user(self, bridge_account, uw_account, person, hrp_wkr):
ffb361a4caafa64aba74
def _logfile_wrapper(file_path=None): if file_path is None: def log_handler(line): line = line.rstrip() if len(line): LOG.info(line) yield log_handler else: with open(file_path, "w") as log_file: def log_handler(line): l...
ffb37d5b71c4e30e6f8b
def clear_modules(self): self.modules = {} self.clear()
ffb3a4f6ef19bebeb9cb
def buySell(self): for stock in self.watch_stocks: if stock.buy: if self.balance / len(self.watch_stocks) > 0: # Check if there is money to be invested self.balance -= stock.buyStock(self.balance / len([stock for stock in self.watch_stocks if stock.buy])) ...
ffb3ab8296c4b16a2740
def destination_name(self) -> pulumi.Output[str]: return pulumi.get(self, "destination_name")
ffb3b9f49c03ffcde158
def csv_writer (dataframe, csv_name): try: dataframe.to_csv(csv_name + ".csv",index=False) except: print("Please enter both a dataframe and output name")
ffb3ef17291581cb151c
def _merge_options(self, *objects): return _merge(self.options, *objects)
ffb3ef3d1b73f3355471
def get_configuration_object(self, name): # type: (str) -> Optional[str] return self._get_configuration_text(name)
ffb3fd98d8cc341ebfbb
def get_masks(self): return self.get_field("masks")
ffb402556dd97905f161
def compute_sil_score_vector(filelist): silscore = dict() for f in filelist: y, X = get_labels_features(f) num_clusters = np.unique(y).shape[0] silscore[num_clusters]= sklm.silhouette_samples(X,y) return silscore
ffb40814dd12025213cd
def _fake_build(self, outfile_name, infile_names, _, context): with open(ka_root.join(outfile_name), 'w') as fout: with open(ka_root.join(infile_names[0])) as fin: fout.writelines(fin)
ffb41e231c674e5d76ea
def par_checker_ext(line: str) -> bool: # TODO: Implement this function ...
ffb43fe3e30db2f96db4
def get_loc_str(self): return "[%s, x=%s, y=%s]" % (self.level, self.column, self.row)
ffb450cbc24c2a651dc1
def DisableProtocolStack(self, *args, **kwargs): payload = { "Arg1": self.href } for i in range(len(args)): payload['Arg%s' % (i + 2)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute('disableProtocolStack', payload=payload, response_object=None)
ffb4523be73880207250
def test_4(self): assert palindrome("race car") == True
ffb4763c860f4fd7ff54
def module_remove(self): self.test_runner.run_module_remove()
ffb48acd42badb74e503
def _build_molecule(self) -> None: # Get config from input parameters # molecule is in PySCF atom string format e.g. "H .0 .0 .0; H .0 .0 0.2" # or in Z-Matrix format e.g. "H; O 1 1.08; H 2 1.08 1 107.5" # other parameters are as per PySCF got.Mole format atom = self._c...
ffb49abdbb32b4499980
def negation(self, text): if self.lang not in self.languages: raise LangDependencyError("Negation - language not defined") if self.lang == "spanish": text = self.spanish_negation(text) elif self.lang == "english": text = self.english_negation(text) el...
ffb4a25a4e70820ff23f
def sort_words(self) -> list: return sorted(list(self.__words))
ffb4bbb06fa0b68e229f
def main(): parser = argparse.ArgumentParser() parser.add_argument( '--config_file', dest='config_file', required=True, default=None, help='JSON config file.') args = parser.parse_args() config = Config(args.config_file) logger.info("Executing preprocessing ...
ffb4c7308570a4211dac
def mean_formatter(self, data): values = data[0] output = np.empty(len(values)) for ind, i in enumerate(values): mean_i = np.mean(i) if mean_i == 0: output[ind] = np.nan else: output[ind] = np.log10(np.mean(i))/self.nyquist_ra...
ffb4f207fd8af6b2db7c
def copy_to_main_file(self): if self.use_server_paths: self.path_in = self.path_in_server self.path_out = self.path_out_server self.path_train = self.path_train_server self.path_dev = self.path_dev_server id_to_label = self.load_labels() # {tweet_id: lang...
ffb501407a278adf2adb
def test_model(self, validation): pass
ffb52288d31ad10d2cb1
def manifest(): return app.send_static_file('manifest.html')
ffb57bcd094e213a47f9
def stop(self): if self.srv: self.srv.stop()
ffb5924767b714d42bcb
def display_total_currency(message): dateFormat = "%m/%d/%Y" try: chat_id = str(message.chat.id) day_week_month = message.text if day_week_month not in user_list[chat_id].spend_display_option: raise Exception( 'Sorry I can\'t show spendings for "{}"!'.format(...
ffb597f57f0fe247574a
def SetStatus(self, status): # ------------------------------------------------------------------------ if status == "on": self.runButton.SetLabel("Stop") if status == "off": self.runButton.SetLabel("Start")
ffb59c388ce99c7bc514
def result(self, state, action): if (self.len_y > 0): action = tuple(action) new_state = np.array(state) # Make a copy new_state[action] += 1 return convert_to_tuple(new_state)
ffb5a47f64da7fc39b0c
def members(self): return self.get_member_list()
ffb5a73875991e197a64
def sphere(cls, c, typ, P, n, R=None, bounding=None): # TODO: cheaper implementation without conic return cls.conic(c=c, k=0, typ=typ, P=P, n=n, R=R, bounding=bounding)
ffb5b1552ae5bafa5276
def flaskbb_tpl_form_registration_after(form):
ffb5bfc66bdcab9f2139
def get_info(self): info = { "name": self.name, "modalities": list(self.modalities.keys()), "output_dim": self.output_dim, "desc": self.desc } return info
ffb5d90d45c47cc4572e
def load_image(name): fullname = os.path.join(STATIC_PATH, 'images', name) image = pygame.image.load(fullname) return image
ffb5f91acb13ec8864e1
def on_privmsg(self, connection, event): source = event.source().split('!')[0] raw = event.arguments()[0].decode('utf-8', 'ignore') args = raw.split() if not args: return two = args[0][:2].upper() if two == 'ST': # STATUS muteds = [] b...
ffb61016c60aa9604288
def floor_key(self, key): return self.floor_item(key)[0]
ffb6183bd99ff381a890
def waitforcommit(self, txnid=None, timetowait=5, iterations=12): if not txnid: txnid = self.LastTransaction if not txnid: logger.info('no transaction specified for wait') return True passes = 0 while True: passes += 1 status ...
ffb63f133eeb90fa839a
def get_builds(): subprocess.getoutput("oc get builds --output=json > allbuildsfromproject1.json") with open("allbuildsfromproject1.json", "r") as read_file: data = json.load(read_file) tabular_data = json_normalize(data['items']) build_pod_names = (tabular_data['metadata.annotations.openshift.i...
ffb6418489dea9a88559
def application_version_set(version): cmd = ['application-version-set'] cmd.append(version) try: subprocess.check_call(cmd) except OSError: log("Application Version: {}".format(version))
ffb64c2a157e3ea09a18
def showInOverview( self ): self.currentItem().canvasLayer.setInOverview( not( self.currentItem().canvasLayer.isInOverview() ) ) self.updateLayerSet() self.canvas.updateOverview()
ffb6b5fb6b96696cbc9b
def get_messages(self): with self.db: with self.db.cursor() as curs: curs.execute("SELECT * FROM messages") return list(map(lambda e: Message(*e), curs.fetchall()))