query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return model with global max pool op
def model_with_global_max_pool2d(): inputs = tf.keras.Input(shape=(8, 8, 3,)) x = tf.keras.layers.Conv2D(8, (2, 2))(inputs) x = tf.keras.layers.GlobalMaxPool2D()(x) x = tf.keras.layers.Flatten()(x) outputs = tf.keras.layers.Dense(10, activation=tf.nn.softmax, name="model_with_global_max_pool2d")(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pool(self, x, name=\"\"):\n return tf.nn.max_pool(x, ksize=self.mp_size, strides=self.mp_stride,\n padding=self.mp_padding, name=name)", "def _max_pool(x):\n return tf.nn.max_pool(value=x,\n ksize=[1, 2, 2, 1],\n strides=[1,...
[ "0.7269419", "0.7243938", "0.7227773", "0.72227514", "0.71937203", "0.7046185", "0.70104825", "0.6986319", "0.6848748", "0.6832572", "0.68086195", "0.68079615", "0.67616844", "0.6731801", "0.67291313", "0.67123437", "0.6663036", "0.66181093", "0.66181093", "0.6610998", "0.660...
0.76176584
0
Gets a dict of form data with normalized field names.
def _get_normalized_form_data(self, form, key): data = {} if form.data else form.initial prefix = 'gc{}-'.format(key) for field_name in form.data: normalized_field_name = field_name[len(prefix):] if field_name in form.data and field_name.startswith(prefix) and form.data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_data(self) -> dict:\n with logging.LogCall(__file__, \"get_form_data\", self.__class__):\n return self.serialize()", "def form_data(self) -> dict:\n return copy.deepcopy(self.data)", "def form_data(self):\n from couchforms import XMLSyntaxError\n from .utils ...
[ "0.66238964", "0.6523883", "0.63611794", "0.62735623", "0.6265674", "0.6173006", "0.6158901", "0.61106837", "0.6109531", "0.608981", "0.60859835", "0.6059278", "0.60534596", "0.6042204", "0.59851694", "0.5980913", "0.5977545", "0.59774405", "0.5948431", "0.59432006", "0.59213...
0.75258654
0
Converts session data to an ordered dict of forms.
def _session_data_to_forms(self, user, department, session_data): forms = OrderedDict() if not session_data: key, form = self._create_certificate_form(user, department) forms.update({key: form}) else: for index, (key, form_data) in enumerate(session_data): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forms_to_session_data(self, forms):\n session_data = []\n\n for key in forms:\n data = self._get_normalized_form_data(forms[key], key)\n\n # Store a key/data pair in the session data\n session_data.append([str(key), data])\n\n return session_data", "def ...
[ "0.8139848", "0.7277883", "0.63586354", "0.60039186", "0.59320915", "0.59302473", "0.58909214", "0.58705395", "0.5800856", "0.56936264", "0.5639518", "0.55805653", "0.55639845", "0.55626124", "0.55314165", "0.55205965", "0.5506974", "0.54904985", "0.54498845", "0.54390883", "...
0.79440534
1
Construct a new session object for querying youtube api v3 about video information.
def __init__(self, apikey, session=None): super().__init__('https://www.googleapis.com/youtube/v3/videos', apikey, session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, url, params=None):\n super(YoutubeVideo, self).__init__(url, params)\n self.video_id = self.get_video_id()", "def get(self):\r\n self.response.headers['Content-Type'] = 'application/json; charset=utf-8'\r\n youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSI...
[ "0.64441925", "0.60444665", "0.599901", "0.5980019", "0.5912023", "0.57905734", "0.5760766", "0.5734622", "0.56934035", "0.5681194", "0.5672862", "0.5659906", "0.5633669", "0.56238675", "0.5602071", "0.5596583", "0.55700886", "0.55292636", "0.5525699", "0.5488292", "0.5486387...
0.7197451
0
Get limits for the x, y and z axes so the plot is fitted to the axes.
def _get_limits(idf=None, polygons=None): if polygons: x = [pt[0] for color in polygons for p in polygons[color] for pt in p] y = [pt[1] for color in polygons for p in polygons[color] for pt in p] z = [pt[2] for color in polygons for p in polygons[color] for pt in p] elif idf: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_plot_limits(self) -> None:\n matplotlib.pyplot.xlim(0, self.imgsz[0])\n matplotlib.pyplot.ylim(self.imgsz[1], 0)", "def xlim(self):\r\n lim = [ax.get_xlim() for ax in self._subaxes]\r\n if lim == []:\r\n lim = None\r\n return lim", "def limits(self):\n\n\t\...
[ "0.72449344", "0.7136714", "0.7037312", "0.7036583", "0.69637364", "0.69435495", "0.68720514", "0.68314934", "0.6817437", "0.67171234", "0.66993386", "0.6655732", "0.66311485", "0.66187423", "0.65988237", "0.65796316", "0.65699095", "0.65026474", "0.65012693", "0.6493964", "0...
0.55643165
91
Create a sqlalchemy session context. This allows transaction based sql operations. The scope of the sqlalchemy session context is the same as the request.
def _create_db_session(self): session = Session() try: yield session session.commit() except Exception: session.rollback() raise finally: session.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session():\n return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))", "def session(db, request):\n connection = db.engine.connect()\n transaction = connection.begin()\n\n options = dict(bind=connection, binds={})\n session = db.create_scoped_session(options=opt...
[ "0.7513137", "0.75105995", "0.74831206", "0.74786276", "0.7459645", "0.74523056", "0.7352764", "0.73358476", "0.73333365", "0.73255074", "0.7315277", "0.72830683", "0.7227546", "0.71489096", "0.7141479", "0.7136895", "0.7136309", "0.7069453", "0.70509017", "0.7043104", "0.702...
0.7012544
22
Return list of device parameters available.
def get_resource_params(self): return SBE37Parameter.list()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_params():\n return Parameter.list()", "def get_parameters_list(self):\n return self.description[\"config\"][\"values\"].keys()", "def get_resource_params(self):\n return Parameter.list()", "def get_resource_params(self):\n return Parameter.list()", "def get_para...
[ "0.7101235", "0.7019266", "0.6956897", "0.6956897", "0.68711567", "0.68517077", "0.67677885", "0.67075", "0.6660094", "0.65980184", "0.6571377", "0.6546663", "0.6525897", "0.651118", "0.6505991", "0.64620256", "0.64581656", "0.6451976", "0.64347064", "0.6421263", "0.6417065",...
0.61061925
49
Filename with extensions removed.
def base_filename(self): return self.filename.split('.')[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_extension(filename):\n return filename.rsplit('.',1)[-2]", "def filename_strip_ext(filename):\n base = os.path.basename(filename)\n # Strip file extension\n return os.path.splitext(base)[0]", "def clear_ext(x):\r\n return os.path.splitext(os.path.basename(x))[0]", "def remove_extensi...
[ "0.7986783", "0.7947299", "0.78787977", "0.74497956", "0.744002", "0.73650706", "0.73578966", "0.7233652", "0.7209014", "0.71895075", "0.71651924", "0.7077635", "0.70416236", "0.70369756", "0.69893414", "0.6909573", "0.6882729", "0.6852489", "0.6847761", "0.6802356", "0.67933...
0.0
-1
Identify if object uses the Table format. Returns bool
def latex_identify(origin, filepath, fileobj, *args, **kwargs): return filepath is not None and filepath.endswith(".tex")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isTable(self, tableName):\n url = '%s/_table/%s' % (self.uri, tableName)\n data, resp = self.execute(method='GET', url=url, decode=True)\n return data", "def isTable(line):\n # Make the string easier to parse.\n line_stripped = lineNormalise(line)\n\n # Return value.\n ret = ...
[ "0.7154935", "0.69347847", "0.6713884", "0.66774654", "0.65027237", "0.6405559", "0.6318535", "0.6290614", "0.60154223", "0.6012122", "0.59830076", "0.59671795", "0.59329677", "0.59227884", "0.5915592", "0.58908486", "0.58749175", "0.5863745", "0.5826872", "0.5823325", "0.582...
0.0
-1
Behaviour on time expiration
def on_expiration_time(self, alarm) -> None: return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expiry(self):\n return time() + self.ttl * (0.95 + 0.1 * random())", "def is_expired(self):\n return int(time.time()) - self.time > self.interval", "def check_expiration(self, cur_time):\n\n\t\ttime_limit = 1000\n\t\ttime_elapsed = cur_time - self.time_created\n\n\t\t# Erase cache after an ar...
[ "0.7400812", "0.72605306", "0.71626914", "0.71506196", "0.71320415", "0.7101007", "0.7060373", "0.7058079", "0.7056206", "0.7041179", "0.7022438", "0.70009494", "0.69908535", "0.69833755", "0.69778395", "0.6973487", "0.69629925", "0.6924481", "0.69232047", "0.6911352", "0.690...
0.74505216
0
Behaviour on time expiration
def on_expiration_time(self, alarm): self.state.on_expiration_time(alarm) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_expiration_time(self, alarm) -> None:\r\n return", "def expiry(self):\n return time() + self.ttl * (0.95 + 0.1 * random())", "def is_expired(self):\n return int(time.time()) - self.time > self.interval", "def check_expiration(self, cur_time):\n\n\t\ttime_limit = 1000\n\t\ttime...
[ "0.745051", "0.7402179", "0.72598827", "0.71624225", "0.71500504", "0.71005267", "0.7059663", "0.70587087", "0.7055313", "0.70403373", "0.70228344", "0.70004857", "0.6990823", "0.69826275", "0.6976515", "0.697291", "0.6961537", "0.6923688", "0.6922838", "0.69123536", "0.69046...
0.7131818
5
Compute the probability of a state being a starting state using the given trajectories.
def initial_probabilities_from_trajectories(n_states, trajectories): p = np.zeros(n_states) for t in trajectories: p[t.transitions()[0][0]] += 1.0 return p / len(trajectories)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_start_prob(n_states):\n start_prob_est = np.random.rand(n_states, 1)\n start_prob_est /= np.sum(start_prob_est, 0)\n assert np.isclose(np.sum(start_prob_est, 0), 1.)\n return start_prob_est", "def _starting_prob(self, s):\n return self._starting_state_distribution.pdf(s)", "def rand...
[ "0.7247876", "0.7185046", "0.70080256", "0.6820418", "0.67057043", "0.6681877", "0.66306335", "0.6456886", "0.6441795", "0.6379684", "0.63352114", "0.6298333", "0.6288684", "0.62628675", "0.6260707", "0.6251168", "0.624895", "0.6241197", "0.6183321", "0.6126166", "0.6120189",...
0.808079
0
Parses command line arguments and returns ArgumentParser object.
def parseArguments(): parser = argparse.ArgumentParser( description='Generate a template embedded ARM project.', epilog="armwiz {}".format(__date__)) parser.add_argument('-p','--projectname', help='Specify project name via -p <projectname>', metavar="<projectname>", defau...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_line_argument_parser() -> argparse.ArgumentParser:\n parser = argparse.ArgumentParser(\n description=description(),\n epilog=epilog(),\n formatter_class=argparse.RawDescriptionHelpFormatter,\n )\n return parser", "def command_line_argument_parser() -> argparse.ArgumentPa...
[ "0.8069404", "0.8069404", "0.76196426", "0.7484409", "0.74191934", "0.7375233", "0.7326458", "0.73214287", "0.7315357", "0.7314414", "0.7314248", "0.73079056", "0.72804755", "0.7277045", "0.7269803", "0.7255856", "0.7234787", "0.7224361", "0.7202089", "0.7196735", "0.71878046...
0.0
-1
Given input for email sets user's email if valid and not taken
def user_profile_setemail(token, email): users = database.get_users() for user in users: if user['email'] is email: raise error.InputError(description="This email is already taken") u_id = database.get_current_user(token) user = database.get_user_data(u_id) user['email'] = email ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self):\n email = input(\"Email: \").strip()\n if email is None or email == \"\":\n print(self.INVALID_INPUT)\n self.display_cust_unlock()\n else:\n return email", "def validate_email(self, email):\n user = User.query.filter_by(email=...
[ "0.7721941", "0.7694243", "0.7640573", "0.7519524", "0.74694294", "0.74686646", "0.74686646", "0.7459104", "0.7454275", "0.7445476", "0.7438407", "0.73791075", "0.7317884", "0.7274616", "0.726877", "0.7210037", "0.71950847", "0.71857846", "0.71678466", "0.71678466", "0.714088...
0.70125633
32
Gets a collection of `InputExample`s for the train set.
def get_train_examples(self, data_dir): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_train_inputs(self, example):\n return example", "def get_train_examples(self):\n raise NotImplementedError()", "def get_train_examples(self, input_file):\r\n raise NotImplementedError()", "def _create_examples(self, data, set_type):\n examples = []\n for (i, elem) in en...
[ "0.7351035", "0.7176929", "0.7130133", "0.6560737", "0.6423411", "0.64047164", "0.6340917", "0.6288625", "0.62828803", "0.62512344", "0.62508", "0.62338984", "0.6222759", "0.6222759", "0.62098795", "0.62098795", "0.62098795", "0.62098795", "0.62098795", "0.62098795", "0.62098...
0.6250895
22
Gets a collection of `InputExample`s for the dev set.
def get_dev_examples(self, data_dir): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dev_examples(self, input_file):\r\n raise NotImplementedError()", "def get_train_inputs(self, example):\n return example", "def get_examples(self, env):\n return self.fam.c_get_examples(self, env)", "def get_dev_examples(self):\n raise NotImplementedError()", "def _create_ex...
[ "0.68099505", "0.6588394", "0.65571433", "0.65519285", "0.64274293", "0.63813734", "0.6255137", "0.6191493", "0.6115438", "0.60936713", "0.60547465", "0.60515034", "0.5990582", "0.59278655", "0.5921486", "0.59197146", "0.5919686", "0.5914534", "0.5914534", "0.5914534", "0.591...
0.5993667
23
Convert a set of `InputExample`s to a list of `InputFeatures`.
def convert_examples_to_features(examples, label_list, max_seq_length, tokenizer, class_weight): feats = [] class_weight = get_examples_class_weight(examples, class_weight, label_list) for (ex_index, example) in enumerate(examples): if ex_index % 10000 == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_examples_to_features(examples, tokenizer, is_training, args):\n all_features = []\n positive_features = 0\n negative_features = 0\n logger.info(\"Converting a list of NqExamples into InputFeatures ...\")\n for index, example in enumerate(tqdm(examples)):\n example_index = example[...
[ "0.7313619", "0.7043189", "0.69537574", "0.6944703", "0.68829805", "0.68623215", "0.68499136", "0.6838839", "0.6821367", "0.67009884", "0.66914606", "0.6658505", "0.6588142", "0.65752536", "0.65514153", "0.64245003", "0.6417711", "0.633485", "0.63252825", "0.63159335", "0.628...
0.6765219
9
Here, we define the final gan model, based on the generator and discriminator models. We also pass the input shape.
def define_gan(g_model, d_model, image_shape): # make weights in the discriminator not trainable for layer in d_model.layers: if not isinstance(layer, BatchNormalization): layer.trainable = False # define the source image in_src = Input(shape=image_shape) # connect the source im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_gan(self):\n # make weights in the discriminator not trainable\n self.d_model.trainable = False\n # get noise and label inputs from generator model\n gen_noise, gen_label = self.g_model.input\n # get image output from the generator model\n gen_output = self.g_mod...
[ "0.79150385", "0.7653347", "0.7291678", "0.71470284", "0.70194167", "0.6821328", "0.6767653", "0.67312586", "0.664788", "0.6629011", "0.6568209", "0.65337884", "0.6509679", "0.65050095", "0.64977705", "0.6463172", "0.6448851", "0.6402434", "0.63832754", "0.63763434", "0.63591...
0.7147072
3
Checks if _deid_map table exists in the given dataset.
def check_if_deid_map_exists(project_id, dataset): table_info_df = get_table_info_for_dataset(project_id, dataset) column_list = table_info_df['table_name'].tolist() if '_deid_map' in column_list: return consts.SKIP elif 'deid_map' in column_list: return consts.RENAME return consts....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_dataset(self, dataset):\n assert dataset, \"Must input a valid dataset name.\"\n return any(self.get_by_dataset(dataset))", "def create_deid_map_table_queries(project):\n deid_and_combined_df = get_combined_datasets_for_deid_map(project)\n combined_datasets_list = deid_and_combined...
[ "0.6243791", "0.5921224", "0.5862878", "0.58258134", "0.5740741", "0.57221866", "0.5704945", "0.56976765", "0.56715035", "0.56506824", "0.563104", "0.55656487", "0.5563275", "0.5563261", "0.5514038", "0.5498521", "0.5484313", "0.54817504", "0.54725087", "0.5466442", "0.545704...
0.8482313
0
Transforming an specific string into a date with format DD/MM/YYYY.
def date(string): return string[17:19]+"/"+string[15:17]+"/"+string[11:15]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_date(date_str):\n return datetime.strptime(date_str, \"%d/%m/%Y\")", "def datemake(datestring):\n return dtt.datetime.strptime(datestring,'%m/%d/%Y')", "def str_2_date(str_date):\n str_format = \"%m/%d/%y\"\n return datetime.strptime(str_date, str_format)", "def str2date(date):\n r...
[ "0.79006696", "0.7877436", "0.78348124", "0.78316873", "0.7633172", "0.7477035", "0.7441873", "0.7438004", "0.7239859", "0.7193773", "0.70806223", "0.7073203", "0.70514446", "0.7050316", "0.7043088", "0.70361465", "0.70288926", "0.6997086", "0.6996767", "0.6980106", "0.696969...
0.67513496
32
Transforming an specific string from the dataset into a month integer.
def get_month(string): return int(string[15:17])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_month(string): \n datetime_object = datetime.datetime.strptime(string, \"%B\")\n\n month_number = datetime_object.month\n\n return month_number", "def month(self) -> int:\n if self.is_old_style:\n return int(self.split('/', 1)[1][2:4])\n return int(self[2:4])", ...
[ "0.78339547", "0.6991977", "0.68675023", "0.67093915", "0.6585043", "0.6583717", "0.6522631", "0.65153396", "0.64246273", "0.63913697", "0.63224703", "0.6309049", "0.62984", "0.6287066", "0.62853175", "0.61746716", "0.61678356", "0.60979843", "0.6068492", "0.60650593", "0.604...
0.7543263
1
Creates a scatter plot that contains the same information as a confusion matrix.
def _bokeh_output_histogram( y_true: np.ndarray, y_pred: np.ndarray, class_names: Sequence[str], title_rows: Sequence[str], sample_weights: Optional[np.ndarray] = None, x_label_rotation: Union[str, float] = "horizontal", ) -> Callable[[], Figure]: n = len(class_names) assert_that(np.sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_plot(self):\n\n X = self.reduce_dimension(n_components=2)\n\n plt.figure()\n plt.scatter(X[:,0], X[:,1])\n\n return plt", "def scatter_plot(x_train, y_train, x_test, y_test, class1, class2):\n train_c0 = x_train[y_train == 0, :]\n train_c1 = x_train[y_train == 1, :]\...
[ "0.74131846", "0.73453987", "0.7212111", "0.7111455", "0.678459", "0.67830664", "0.6736045", "0.6735733", "0.6722029", "0.6719697", "0.6702924", "0.6702897", "0.66985315", "0.6695453", "0.666597", "0.66559994", "0.6654712", "0.6636807", "0.6634248", "0.65571654", "0.65457404"...
0.0
-1
Creates a confusion matrix heatmap.
def _bokeh_confusion_matrix( y_true: np.ndarray, y_pred: np.ndarray, class_names: Sequence[str], title_rows: Sequence[str], x_label_rotation: Union[str, float] = "horizontal", y_label_rotation: Union[str, float] = "vertical", ) -> Callable[[], Figure]: cm = sklmetrics.confusion_matrix(y_tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confusion_matrix_heatmap(y_test, preds, classification_labels):\n labels = list(set(y_test))\n long_labels = [ll + \" (\" + str(l) + \")\" for ll, l\n in zip(classification_labels, labels)]\n cm = confusion_matrix(y_test, preds, labels=labels)\n fig = plt.figure(figsize=(20, 20))\...
[ "0.8079532", "0.7329811", "0.7156625", "0.714516", "0.71391094", "0.71230274", "0.70907986", "0.70495623", "0.70381236", "0.6997711", "0.69807917", "0.69659513", "0.691102", "0.68971246", "0.6896661", "0.687814", "0.68549275", "0.6835854", "0.6829668", "0.67743295", "0.674008...
0.0
-1
Creates a scatter plot that contains the same information as a confusion matrix.
def _bokeh_confusion_scatter( y_true: np.ndarray, y_pred: np.ndarray, class_names: Sequence[str], title_rows: Sequence[str], x_label_rotation: Union[str, float] = "horizontal", y_label_rotation: Union[str, float] = "vertical", ) -> Callable[[], Figure]: if len(y_true) != len(y_pred): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_plot(self):\n\n X = self.reduce_dimension(n_components=2)\n\n plt.figure()\n plt.scatter(X[:,0], X[:,1])\n\n return plt", "def scatter_plot(x_train, y_train, x_test, y_test, class1, class2):\n train_c0 = x_train[y_train == 0, :]\n train_c1 = x_train[y_train == 1, :]\...
[ "0.74124336", "0.73467916", "0.7212641", "0.711166", "0.67852646", "0.67838466", "0.673718", "0.6736241", "0.6722911", "0.67030776", "0.67018706", "0.67001325", "0.6695713", "0.6666835", "0.6655957", "0.6655799", "0.6637261", "0.66352075", "0.655707", "0.6546196", "0.6516719"...
0.67216337
9
Description Remover with list of stopwords specified by the user.
def custom( stopword=None, **params): entrypoint_name = 'Custom' settings = {} if stopword is not None: settings['Stopword'] = try_set( obj=stopword, none_acceptable=True, is_of_type=list) component = Component( name=entrypoint_name, settings=settin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords(self, *args):\n if self.remove_stopwords is False:\n raise Exception(\"Error - enable stopword removal functionality\")\n if type(args) != list:\n raise Exception(\"Error - expected a list\")\n if args == []:\n raise Exception(\"Error - no ...
[ "0.7647255", "0.7641123", "0.7435462", "0.73342234", "0.7296096", "0.72319716", "0.72216547", "0.7207029", "0.71754843", "0.71630305", "0.71366453", "0.7119436", "0.7110916", "0.7080817", "0.7062187", "0.70618033", "0.7058717", "0.70534563", "0.70376515", "0.70376515", "0.703...
0.63535666
80
Check whether model has object level permissions.
def model_has_permissions(obj: models.Model) -> bool: additional_labels = ["flow.Storage"] return hasattr(obj, "permission_group") or obj._meta.label in additional_labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_object_permission(self, request, view, obj):\n if request.method in permissions.SAFE_METHODS:\n return True\n if all([request.user, request.user.is_staff]):\n return True\n elif all([request.user, type(obj) == type(request.user), obj == request.user]):\n ...
[ "0.78756624", "0.781401", "0.7799718", "0.77996665", "0.77838135", "0.77522767", "0.7711636", "0.7677022", "0.76713127", "0.76681125", "0.7638648", "0.7631789", "0.7628719", "0.7621447", "0.76193994", "0.7610984", "0.7603616", "0.7595528", "0.75844723", "0.75626624", "0.75516...
0.7996643
0
Return the tuple (user_or_group, name). The user_or_group is user or group and name is either 'user' or 'group'.
def get_identity(user_group: Union[Group, User]) -> Tuple[UserOrGroup, str]: if isinstance(user_group, AnonymousUser): return get_anonymous_user(), "user" UserModel = get_user_model() if isinstance(user_group, UserModel): return user_group, "user" if isinstance(user_group, Group): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __prep_group_or_user(self, group_name=None, user_name=None):\n\n # Check if both variable are passed OR neither variables are passed\n if group_name and user_name:\n raise ValueError(\"Both group_name and user_name were defined. Only of these values can be defined.\")\n elif not...
[ "0.64836055", "0.55922645", "0.5590267", "0.5575566", "0.55299616", "0.55214655", "0.5505393", "0.5432677", "0.54275304", "0.5366127", "0.5280897", "0.5249126", "0.5212907", "0.5194494", "0.5183242", "0.516792", "0.51519734", "0.5149493", "0.51265925", "0.51109844", "0.510751...
0.60617185
1
Check if one can grant or revoke owner permission. Owner permission to user should only be granted or revoked when allow_user_owner is set. Owner permission to group should never be set.
def check_owner_permission(payload: dict, allow_user_owner: bool, obj: models.Model): for entity_type in ["users", "groups"]: for user_identification, permission in payload.get(entity_type, {}).items(): if permission == "owner": if entity_type == "users" and not allow_user_owner:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner_or_permissions(**perms):\n original = commands.has_permissions(**perms).predicate\n\n async def extended_check(ctx):\n if ctx.guild is None:\n raise errors.NoPrivateMessage\n return ctx.guild.owner_id == ctx.author.id or await original(ctx)\n\n return commands.check(exte...
[ "0.72537684", "0.71432227", "0.7111834", "0.69583964", "0.69460505", "0.6877894", "0.68661547", "0.683036", "0.6817919", "0.6817919", "0.67819685", "0.6726928", "0.670339", "0.6676365", "0.6551557", "0.6549114", "0.65204394", "0.651725", "0.6502963", "0.6502963", "0.64776736"...
0.773739
0
Add the log level to the event dict.
def add_upper_log_level(logger, method_name, event_dict): event_dict["level"] = method_name.upper() return event_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level(self, log_level):\n self.logger.setLevel(log_level)", "def add_level(self, level):\n return", "def logs_add_message(self, level, message):\n pass", "def set_log_level(self, level):\n if level == 'info':\n level = logging.INFO\n if level == 'debug':\n ...
[ "0.66763777", "0.6568067", "0.65290135", "0.6349708", "0.6225883", "0.62212133", "0.6218766", "0.6214043", "0.619401", "0.618545", "0.6181116", "0.61349046", "0.6133718", "0.60971624", "0.6070584", "0.605857", "0.6039594", "0.602524", "0.6022099", "0.5995022", "0.5987285", ...
0.6748369
0
Create model's layers and initialize the weights
def __init__(self): super(AlexNet, self).__init__() initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=0.01) bias = tf.keras.initializers.Ones() bias0 = tf.keras.initializers.Zeros() self.drop = tf.keras.layers.Dropout(.5) # Input is 227 and not 224 as sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_weights(self):\n for layer in self._cnn_layers:\n weights_initializer.WeightsInitializer.initialize_layer_or_model(layer)", "def init_weights(model):\n ...", "def build_layer(self) :\n inputsWithBias = self.input_count + 1\n self.weights = np.random.rand(inputsWithBi...
[ "0.77850956", "0.77621686", "0.754918", "0.7515623", "0.741224", "0.74100894", "0.7350956", "0.731648", "0.7283748", "0.72257346", "0.7204779", "0.7147508", "0.7100905", "0.7032231", "0.69899184", "0.6970427", "0.6955541", "0.69130176", "0.6904016", "0.68962425", "0.68753415"...
0.0
-1
Get configuration of the model
def get_config(self): return super().get_config()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(self):\n return self.config", "def config(self) -> ModelConfigDict:\n return self.config_obj.to_dict()", "def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)", "def get_configurat...
[ "0.78695184", "0.7862853", "0.77675325", "0.7575643", "0.7519113", "0.7519113", "0.74972624", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", "0.7471751", ...
0.7579623
3
Return a string representation of the class.
def __repr__(self): # Check required to be able to pass None or quote wraped string # into the repr. name = self._name if name: name = name.__repr__() return ("Process(%s, start_time=%s, stop_time=%s)" % (name, self._start_time, self._stop_time) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def __repr__(self):\n outl = 'class :'+self.__class__.__name_...
[ "0.81191397", "0.7812065", "0.7791025", "0.77723247", "0.77518076", "0.7710963", "0.7617531", "0.75566894", "0.7503642", "0.74922866", "0.7471308", "0.7455818", "0.7455818", "0.7455818", "0.74540037", "0.74515283", "0.7437837", "0.74022067", "0.73984396", "0.73712087", "0.736...
0.0
-1
The cookie ID associated with this request. This value will be unique for the request.
def _cookie_id(self): if not self.__cookie_id: # Generate a cookie ID if one hasn't been made yet self.__cookie_id = self.get_argument("cookie_id", None) if not self.__cookie_id: global cookie_counter self.__cookie_id = cookie_counter ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_id(self):\n return self.request_data['id']", "def cookie(self) -> Optional[str]:\n return self._state.get(\"cookie\", None)", "def get_uid_from_cookie(self):\n user_id = self.request.cookies.get('user_id')\n return user_id and utils.check_secure_cookie(user_id)", "...
[ "0.7126761", "0.6902421", "0.6713818", "0.6687699", "0.661378", "0.65825975", "0.64952904", "0.64728224", "0.64336246", "0.642736", "0.6399717", "0.63936776", "0.63542056", "0.6337327", "0.631997", "0.63031745", "0.62855726", "0.62773895", "0.62746906", "0.6226697", "0.620366...
0.83010465
0
Convert string number representation to float.
def to_us_number(number): number = number.replace('.', '') number = number.replace(',', '.') return float(number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])", "def convert_str_float(x):\n\ttry:\n\t\treturn float(x)\n\texcept ValueError:\n\t\tprint(\"must be a number\")", "def _convert_to_float(s):\n try:\n return float(s)\n except:\n re...
[ "0.81577456", "0.8044069", "0.80348134", "0.7949184", "0.789166", "0.7848662", "0.7662928", "0.7653817", "0.7614494", "0.75455004", "0.74550873", "0.73988295", "0.7344253", "0.7326363", "0.7303831", "0.729217", "0.7272375", "0.72667795", "0.7199241", "0.71858174", "0.71478117...
0.0
-1
Create a mosaic plot from a dataframe. Right now only horizontal mosaic plots are supported, i.e. rows are prioritized over columns.
def mosaic_plot(data, rows, cols, vary_lightness=False, ax=None, legend=True): cont = pd.crosstab(data[cols], data[rows]) sort = np.argsort((cont / cont.sum()).iloc[0]) cont = cont.iloc[:, sort] if ax is None: ax = plt.gca() pos_y = 0 positions_y = [] n_cols = cont.shape[1] colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_heatmap(df):\n\n fig = go.Figure(data=go.Heatmap(\n z=df.values.tolist(),\n x=df.columns,\n #y=[classifier for classifier in df.index.values.tolist()],\n y = df.index.values.tolist(),\n hove...
[ "0.62593037", "0.6220265", "0.607737", "0.6069061", "0.60488564", "0.59701693", "0.5959861", "0.59490454", "0.5828705", "0.58131284", "0.5791862", "0.5758736", "0.5677728", "0.561457", "0.561452", "0.5561442", "0.5539591", "0.55172807", "0.5511576", "0.5509743", "0.54879415",...
0.72127837
0
Shorten axes labels and tick labels. Uses _shortname to change labels as a side effect.
def _short_tick_names(ax, label_length=20, ticklabel_length=10): ax.set_yticks(ax.get_yticks().tolist()) ax.set_xticks(ax.get_xticks().tolist()) ax.set_xticklabels( [_shortname(t.get_text(), maxlen=ticklabel_length) for t in ax.get_xticklabels()] ) ax.set_yticklabels( [_shor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xaxis(self,label,units):\n if units != \"\": label = label + \" (\" + units + \")\"\n self.subplot.set_xlabel(label)\n pass", "def make_label(self, label, units):\n nice_label = self.tex_axis_label(label)\n if not (units == 'dimensionless') and \\\n (units is not ...
[ "0.6453884", "0.63091487", "0.61024654", "0.60074323", "0.5981512", "0.5820715", "0.57550526", "0.57281876", "0.57041794", "0.56828797", "0.56153893", "0.5517902", "0.5516496", "0.5510675", "0.5500265", "0.5476972", "0.5465943", "0.54459417", "0.54368114", "0.54276204", "0.53...
0.79533833
0
Scatter plot for categories. Creates a scatter plot for x and y grouped by c.
def discrete_scatter(x, y, c, unique_c=None, legend='first', clip_outliers=True, alpha='auto', s='auto', ax=None, jitter_x=False, jitter_y=False, **kwargs): alpha = _get_scatter_alpha(alpha, x) s = _get_scatter_size(s, x) if ax is None: ax = plt.gca() if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_plot(group1, group2):\n plt.scatter(group1, group2)\n plt.show()", "def _category_plot(self, element, x, y, data):\n labelled = ['y' if self.invert else 'x'] if x != 'index' else []\n if self.value_label != 'value':\n labelled.append('x' if self.invert else 'y')\n\n ...
[ "0.62944365", "0.6273058", "0.6250776", "0.6222933", "0.619619", "0.6178261", "0.6144808", "0.61396825", "0.61252946", "0.61018527", "0.60127306", "0.5987695", "0.5983874", "0.59837705", "0.59817827", "0.59542114", "0.5936364", "0.59093", "0.5901431", "0.5877763", "0.5842082"...
0.6688197
0
Computes the diagonal of the (observed) Fisher information matrix.
def fisher_diag( negative_log_likelihood: LossFun, params: Any, inputs: jnp.ndarray, targets: jnp.ndarray, ) -> jnp.DeviceArray: return jnp.square( ravel(jax.grad(negative_log_likelihood)(params, inputs, targets)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(self):\n return self.rep.diagonal()", "def diagonal(self):\n M = self.rep\n m, n = self.shape\n return [M[i, i] for i in range(min(m, n))]", "def diagonal(step='Metropolis', iters=5000):\n X = mc.Uniform('X', lower=-1., upper=1., value=[0., 0.])\n\n @mc.potential\...
[ "0.6801682", "0.66132337", "0.6587387", "0.64470315", "0.62856394", "0.6216051", "0.61956936", "0.6156756", "0.6120031", "0.6089011", "0.60764974", "0.6013825", "0.6003092", "0.59998447", "0.5960165", "0.59564614", "0.59369653", "0.59290934", "0.5920861", "0.5906225", "0.5898...
0.6354004
4
Fit the Pipeline. Fit and apply given transforms to the data, then fit the model on the transformed data.
def fit(self, ts: TSDataset) -> "Pipeline": self.ts = ts self.ts.fit_transform(self.transforms) self.model.fit(self.ts) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_transform(self, data):\n p = self._get_pipeline(self._params)\n return p.fit_transform(data)", "def fit_transform(self, data):\n if not self._transformers:\n return self._preprocess(data)\n\n transformed_data = self._preprocess(data)\n final_step = self._tran...
[ "0.78348744", "0.7634114", "0.7622818", "0.74800265", "0.74401873", "0.74279714", "0.7389048", "0.7101711", "0.70897293", "0.7085718", "0.70367295", "0.70365757", "0.7004992", "0.6990908", "0.6987758", "0.6976234", "0.69717896", "0.6963145", "0.6942096", "0.6920304", "0.69169...
0.67712384
31
r"""Given an index return an example from the position.
def __getitem__(self, item): return {'text': self.texts[item], 'label': self.labels[item]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item(self, index, rng=None):\n if index is None:\n rng = kwarray.ensure_rng(rng)\n index = rng.randint(0, self.n_samples)\n\n if index < self.n_positives:\n sample = self.get_positive(index, rng=rng)\n else:\n index = index - self.n_positives...
[ "0.6802264", "0.676309", "0.6761832", "0.6617753", "0.6580388", "0.65452653", "0.63973", "0.63196665", "0.62835634", "0.628346", "0.62713134", "0.6228255", "0.62223506", "0.6199706", "0.6185447", "0.61793107", "0.61635405", "0.61530817", "0.6108982", "0.6070217", "0.6062702",...
0.0
-1
Shows stats and information about current guild.
async def membercount(ctx, *args): if ctx.message.channel.is_private: await bot.delete_message(ctx.message) return g = ctx.message.server gid = g.id membs = str(len(g.members)) membs_on = str(len([m for m in g.members if not m.status == Status.offline])) users = str(len([m for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def stats(ctx):\n pythonVersion = platform.python_version()\n dpyVersion = discord.__version__\n serverCount = len(bot.guilds)\n memberCount = len(set(bot.get_all_members()))\n\n embed = discord.Embed(\n title=f\"{bot.user.name} Stats\",\n description=\"\\uFEFF\",\n colour...
[ "0.7263817", "0.71782815", "0.7131748", "0.7001834", "0.69652236", "0.6958627", "0.6903964", "0.6859176", "0.68318266", "0.67624027", "0.6751602", "0.6706869", "0.6662018", "0.6601903", "0.65654343", "0.65519553", "0.65515625", "0.65355563", "0.65261716", "0.6519268", "0.6501...
0.0
-1
__call__(self, x, finetune=False) Invokes the forward propagation of BatchNormalization. In training mode, the BatchNormalization computes moving averages of mean and variance for evaluation during training, and normalizes the input using batch statistics.
def __call__(self, x, **kwargs): argument.check_unexpected_kwargs( kwargs, test='test argument is not supported anymore. ' 'Use chainer.using_config') finetune, = argument.parse_kwargs(kwargs, ('finetune', False)) if hasattr(self, 'gamma'): gamma = self.gamma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_...
[ "0.6875177", "0.686221", "0.6825619", "0.64800715", "0.645479", "0.6425954", "0.6373195", "0.6365986", "0.63327247", "0.6285357", "0.627124", "0.62499857", "0.6243673", "0.6231377", "0.62215304", "0.61961967", "0.6195935", "0.61464417", "0.6130463", "0.61200947", "0.61165434"...
0.80289406
0
Resets the population count for collecting population statistics. This method can be skipped if it is the first time to use the finetuning mode. Otherwise, this method should be called before starting the finetuning mode again.
def start_finetuning(self): self.N = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reinit(self):\n self.logger.info(\"Reinit called. Clear the population.\")\n self.set_init_population([], perf_name=None)\n self._gt_rollouts = []\n self._gt_scores = []", "def reset_next_population(self):\n self.next_population = []", "def reset(self):\n if not se...
[ "0.7372122", "0.73329914", "0.71878517", "0.699537", "0.699537", "0.69919646", "0.6859545", "0.68533504", "0.6807315", "0.6778661", "0.67305106", "0.6720021", "0.6715473", "0.6658221", "0.6648325", "0.66371506", "0.65548116", "0.6550627", "0.65500027", "0.6546087", "0.6532955...
0.6108732
62
Project into the tangent space. Usually the same as egrad2rgrad
def proj(self, X, G): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tangent(self, p):\n p = array(p, float)\n v = (p - self.o)\n v /= norm(v)\n b = self.o + ((cross(v, self.N) - v) / 3)*self.r\n mb = _mirror_(self.o, p, b) \n mbb = mb - b\n return mbb/norm(mbb)", "def computeTangent(self):\n # return np.matmul(self.exam...
[ "0.71433276", "0.6944794", "0.67297846", "0.6462124", "0.64144534", "0.6310642", "0.6288211", "0.6261557", "0.6258516", "0.62065065", "0.6149693", "0.61299664", "0.6068976", "0.60456324", "0.59807914", "0.58239603", "0.5809741", "0.5800137", "0.57766217", "0.5767548", "0.5743...
0.0
-1
A mapping from the Euclidean gradient G into the tangent space to the manifold at X. For embedded manifolds, this is simply the projection of G on the tangent space at X.
def egrad2rgrad(self, X, G): return self.proj(X, G)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeTangent(self):\n # return np.matmul(self.examples.T, self.gradAmbient)\n return self.gradAmbient + self.centroid * minkowskiDot(self.centroid, self.gradAmbient)", "def proj(self, X, G):\n raise NotImplementedError", "def g(self, X):\n\n return (X[0])**2 - 2*X[0] + X[1]**3...
[ "0.57202685", "0.5684287", "0.56506914", "0.5531437", "0.5426087", "0.5266315", "0.5233484", "0.5209376", "0.51755935", "0.5172781", "0.51689166", "0.51462895", "0.5116278", "0.51131195", "0.50995994", "0.50980353", "0.5090509", "0.5085216", "0.50838065", "0.5056675", "0.5040...
0.55419004
3
A retraction mapping from the tangent space at X to the manifold. See Absil for definition of retraction.
def retr(self, X, G): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retraction(self, v, x, c):\n c = self.truncate_c(c)\n new_v = self.expmap(v, x, c)\n return self.proj(new_v, c)", "def _untransform(self, X: Tensor) -> Tensor:\n X_new = X.clone()\n X_new[..., self.indices] = 10.0 ** X_new[..., self.indices]\n return X_new", "def c...
[ "0.575803", "0.55296284", "0.5391757", "0.534215", "0.52485466", "0.5192087", "0.51837397", "0.51709193", "0.51478386", "0.51376426", "0.51177233", "0.50867915", "0.50847423", "0.50622445", "0.50481963", "0.5041714", "0.50158346", "0.5015376", "0.50130427", "0.50069124", "0.5...
0.0
-1
Returns a random, unit norm vector in the tangent space at X.
def randvec(self, X): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vecnorm(X) :\n\tXtemp = X - np.min(X)\n\tXnorm = Xtemp * 2 / np.max(Xtemp) - 1\n\treturn Xnorm", "def random_unit_tangent_vec(self, base_point, n_vectors=1):\n shape = base_point.shape\n if len(shape) > 1 and shape[-2] > 1 and n_vectors > 1:\n raise ValueError(\n \"Sev...
[ "0.6697116", "0.6633927", "0.6555211", "0.6469738", "0.64672256", "0.6466895", "0.62796694", "0.6278503", "0.62507796", "0.6216168", "0.6092589", "0.6086808", "0.6082151", "0.60797554", "0.6060915", "0.60371727", "0.60060287", "0.60060287", "0.60060287", "0.598891", "0.597660...
0.5546388
71
Transports d, which is a tangent vector at x1, into the tangent space at x2.
def transp(self, x1, x2, d): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tangential_distortion(self, xy: np.ndarray, r2: np.ndarray) -> np.ndarray:\n # dtx = 2xy * p1 + p2 * (r^2 + 2x^2)\n # dty = p1 * (r^2 + 2y^2) + 2xy * p2\n xty = xy[:, 0] * xy[:, 1]\n dtx = 2 * xty * self.p[0] + self.p[1] * (r2 + 2 * xy[:, 0] ** 2)\n dty = self.p[0] * (r2 + 2...
[ "0.62952924", "0.62569714", "0.61545", "0.6088679", "0.5946583", "0.5931927", "0.59010154", "0.58834106", "0.5847089", "0.5836788", "0.5830435", "0.5769111", "0.5744328", "0.5735793", "0.5708261", "0.56960833", "0.5653199", "0.564208", "0.5641268", "0.56334007", "0.5628427", ...
0.6277807
1
The exponential (in the sense of Lie group theory) of a tangent vector U at X.
def exp(self, X, U): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gelu(x):\n return x * 0.5 * (1.0 + F.tanh(F.sqrt(2 / math.pi) * (x + 0.044715 * (x ** 3))))", "def elu(x):\n return np.where(x < 0, np.exp(x) - 1, x)", "def selu(x): # https://gist.github.com/naure/78bc7a881a9db17e366093c81425184f\n alpha = 1.6732632423543772848170429916717\n scale = 1.0507009...
[ "0.7306948", "0.7016486", "0.6999739", "0.69829786", "0.6853082", "0.68306595", "0.6828083", "0.6803315", "0.6803315", "0.6803315", "0.6803315", "0.6803315", "0.6803315", "0.6803315", "0.6803315", "0.6758181", "0.6705828", "0.66566306", "0.6621795", "0.66108114", "0.6603319",...
0.7750054
0
Computes the intrinsic mean of X and Y, that is, a point that lies midway between X and Y on the geodesic arc joining them.
def pairmean(self, X, Y): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def d_mean(x, y):\n return (x + y) / 2", "def mape(x, y):\n return statistics.mean(ape(x, y))", "def get_center(self):\n\n x = np.array(self.x)\n y = np.array(self.y)\n return np.mean(x), np.mean(y)", "def avg(x, y):\n return (x + y)/2", "def get_mean(self):\n return nu...
[ "0.72091436", "0.70792454", "0.6920424", "0.66236514", "0.6520856", "0.6321251", "0.62995625", "0.6200656", "0.61863524", "0.61863524", "0.6145899", "0.61439306", "0.6041739", "0.6035128", "0.6022485", "0.5989087", "0.5973875", "0.59691864", "0.5956793", "0.59486085", "0.5942...
0.6292192
7
Returns the zero tangent vector at X.
def zerovec(self, X): return np.zeros(X.size())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tangent(x, K=10, C=0.1):\n s = np.zeros_like(x)\n m = (x >= 0)\n # 1) x >= 0\n e = np.exp(-x[m] * C)\n s[m] = K * (1 - e) / (1 + e)\n # 2) x < 0\n e = np.exp(x[~m] * C)\n s[~m] = K * (e - 1) / (e + 1)\n return s", "def returnTangentVectorAtXi(self, xi_value):\n xVec, yVec, z...
[ "0.7180941", "0.63736475", "0.6352444", "0.61244786", "0.60274935", "0.60025793", "0.600036", "0.596903", "0.5966394", "0.5959191", "0.59385544", "0.5917829", "0.59016407", "0.5872008", "0.5871878", "0.5861603", "0.58095413", "0.5764716", "0.5739877", "0.56989694", "0.5697017...
0.55364853
36
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(y_true, y_pred, classes, normalize=False, title=None, cmap=plt.cm.Blues): if not title: if normalize: title = 'Normalized confusion matrix' else: title = 'Confusion matrix,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81942594", "0.80949026", "0.8028581", "0.8018849", "0.79934716", "0.7990885", "0.7980801", "0.79750925", "0.7960907", "0.79557455", "0.79372376", "0.7934255", "0.79340357", "0.79309034", "0.7925931", "0.7924125", "0.79232645", "0.7922545", "0.79224193", "0.79218626", "0.79...
0.0
-1
Check if the object is within the given distance from origin_point, returns
def _object_in_zone(self, object, distance: float): x0, y0 = self.origin_point x1, y1 = object.body.position obj_dist = math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) if obj_dist < distance: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def around(self, point, distance):\n return self.distance(point) <= distance", "def hit(self, origin, sightVector, hitError):\n distance = [0, 0, 0]\n for i in range(0, 3):\n distance[i] = self.translation[i] - origin[i]\n v1 = normalize(distance)\n v2 = normalize(si...
[ "0.67588323", "0.67227286", "0.6579763", "0.65754175", "0.6550611", "0.64685863", "0.6439322", "0.6341795", "0.63335687", "0.631851", "0.6308309", "0.6299217", "0.6281756", "0.62696373", "0.62423325", "0.62423325", "0.62423325", "0.62423325", "0.62423325", "0.62423325", "0.62...
0.75537294
0
Returns True if obj is an instance of a dataclass.
def _is_dataclass_instance(obj): return hasattr(type(obj), '__dataclass_fields__')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dataclass_instance(obj: Any) -> bool:\n return dataclasses.is_dataclass(obj) and not isinstance(obj, type)", "def isclassinstance(object):\n if not hasattr(object, \"__class__\"):\n return False\n if isbuiltin(object.__class__):\n return False\n return True", "def is_kind_of_cl...
[ "0.901118", "0.7407845", "0.73034966", "0.72383547", "0.7238161", "0.7238161", "0.72214854", "0.72177786", "0.72177786", "0.72177786", "0.72177786", "0.72177786", "0.72177786", "0.7197136", "0.7188834", "0.71734035", "0.71728307", "0.71574026", "0.71500915", "0.7106451", "0.7...
0.86450404
1
Return the fields of a dataclass instance as a new dictionary mapping field names to field values.
def asdict(obj, *, dict_factory=dict): if not _is_dataclass_instance(obj): raise TypeError("asdict() should be called on dataclass instances") return _asdict_inner(obj, dict_factory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields(class_or_instance):\n\n # Might it be worth caching this, per class?\n try:\n fields_dict = getattr(class_or_instance, _FIELDS)\n except AttributeError:\n raise TypeError(\"must be called with a dataclass type or instance\")\n\n return fields_dict", "def declared_fields(class...
[ "0.7917745", "0.73211527", "0.7006833", "0.69605935", "0.68871534", "0.68538296", "0.68324256", "0.6708716", "0.6666433", "0.65864307", "0.65840167", "0.65836215", "0.6580536", "0.6540082", "0.65352523", "0.652932", "0.652891", "0.6495413", "0.6493182", "0.6493182", "0.649318...
0.0
-1
1. Test GET /orders when no orders exist
def test_fetch_all_orders_when_none_exist(self): response = self.api_test_client.get('{}/orders'.format(self.BASE_URL)) self.assertEqual(response.status_code, 404) self.assertEqual(response_as_json( response)['message'], 'No orders exist as yet')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_order_not_found(self):\n resp = self.app.get('/orders/0')\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)", "def test_get_order_not_found(self):\n resp = self.app.get('/orders/0')\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)", "def tes...
[ "0.8308016", "0.8308016", "0.7894911", "0.7677505", "0.7591937", "0.72186655", "0.7169413", "0.71467626", "0.71396196", "0.7054314", "0.7034672", "0.70090955", "0.69778055", "0.69672924", "0.6956257", "0.69442636", "0.69133407", "0.68991846", "0.68751264", "0.6840929", "0.680...
0.8250712
2
gather_nd with interpolation as torch.grid_sample func
def _grid_nd_sample(in_tensor, indices, batch_dims=1): # with tf.variable_scope("grid_nd_sample", reuse=False): interpolation_indices = indices[..., -2:] rounded_indices = indices[..., :-2] inter_floor = tf.floor(interpolation_indices) inter_ceil = tf.math.ceil(interpolation_indices) p1_indices ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_gather(self, values, indices):\n\n idx = indices.unsqueeze(-1)\n idx = idx.int()\n size = indices.shape[0]\n rg = torch.arange(size, dtype=torch.int32).to(self.device)\n rg = rg.unsqueeze(-1)\n rg = rg.repeat([1, int(indices.shape[-1])])\n rg = rg.unsqueez...
[ "0.6307485", "0.61616975", "0.5992615", "0.5938428", "0.5898372", "0.5877989", "0.5863944", "0.5863099", "0.5863099", "0.58423793", "0.5770899", "0.5750407", "0.57094544", "0.5704224", "0.5704224", "0.5703079", "0.5695427", "0.5684598", "0.5671521", "0.56672937", "0.56671363"...
0.73965335
0
Turn a list of list of (list of ...) dicts into a list of dicts.
def flatten(l): result = [] for x in l: if type(x) is list: result.extend(flatten(x)) else: result.append(x) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_dict(list_of_dicts):\n output = defaultdict(list)\n for dict_ in list_of_dicts:\n for key, value in dict_.items():\n dict_[key].append(value)\n return dict(output)", "def to_listdict(list_list):\n # Fastest way to this is cycle through every row but the first\n # and ...
[ "0.7110415", "0.6785707", "0.672497", "0.6671177", "0.66500974", "0.64433455", "0.6346722", "0.6278689", "0.6190238", "0.61778617", "0.61064917", "0.60896856", "0.60601324", "0.60337245", "0.6024109", "0.5996321", "0.5984575", "0.59722376", "0.59721255", "0.59593606", "0.5889...
0.54895365
70
Try to establish version control with an invalid version
def test_version_control_invalid(self): versions = ('Thirteen', '-1', -1, '' , 13) # A fresh repository doesn't go up to version 13 yet for version in versions: #self.assertRaises(ControlledSchema.InvalidVersionError, # Can't have custom errors with assertRaises... ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version_missing(self):\r\n self.assertIsNone(self._version_test(self.no_version))", "def test_undefined_semver(self):\n v1 = versions.Version(version='1.2.3', name='foo')\n expected = None\n\n self.assertEqual(v1.build, expected)", "def test_no_version(self):\r\n err...
[ "0.68352205", "0.6831202", "0.6825282", "0.65294236", "0.65123844", "0.6510586", "0.6461885", "0.63753134", "0.6358751", "0.6236324", "0.6223833", "0.62054825", "0.6190483", "0.61862504", "0.6179952", "0.6135915", "0.61343217", "0.6128363", "0.6122344", "0.61093444", "0.60790...
0.7330861
0
Get an item or attribute of an object but prefer the attribute.
def getattr(self, obj: t.Any, attribute: str) -> t.Any: try: return getattr(obj, attribute) except AttributeError: pass try: return obj[attribute] except (TypeError, LookupError, AttributeError): return self.undefined(obj=obj, name=attribut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getitem(obj, attr, default=None):\n from functools import partial\n _getattr = partial(getattr, obj)\n getter = getattr(obj, '__getitem__', None) or _getattr\n try:\n return getter(attr)\n except (KeyError, AttributeError):\n return default", "def __getattr__(self, item):\n ...
[ "0.76386076", "0.70016384", "0.6998841", "0.69968605", "0.6903373", "0.682826", "0.67007834", "0.6650254", "0.6644323", "0.66111374", "0.65913266", "0.65913266", "0.6565057", "0.65507996", "0.6548512", "0.65078104", "0.6452337", "0.6449073", "0.6443441", "0.6432434", "0.64159...
0.6867643
5
Lex the given sourcecode and return a generator that yields tokens as tuples in the form ``(lineno, token_type, value)``.
def lex( self, source: str, name: t.Optional[str] = None, filename: t.Optional[str] = None, ) -> t.Iterator[t.Tuple[int, str, str]]: source = str(source) try: return self.lexer.tokeniter(source, name, filename) except TemplateSyntaxError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(code):\n lineno = 1\n line_start = 0\n\n for match in TOKEN_REGEX.finditer(code):\n kind = match.lastgroup\n value = match.group(kind)\n\n if kind == 'IGNORE':\n if '\\n' in value:\n lineno += value.count('\\n')\n # match.start() i...
[ "0.67679435", "0.6550635", "0.62877554", "0.6271801", "0.62701327", "0.61371034", "0.6123835", "0.5884135", "0.5834906", "0.57587695", "0.5707789", "0.5693775", "0.5676789", "0.5670746", "0.56177783", "0.5597869", "0.5578111", "0.55625236", "0.55542636", "0.55083466", "0.5503...
0.6872963
0
For very large templates it can be useful to not render the whole template at once but evaluate each statement after another and yield piece for piece. This method basically does exactly that and returns a generator that yields one item after another as strings.
def generate(self, *args: t.Any, **kwargs: t.Any) -> t.Iterator[str]: if self.environment.is_async: import asyncio async def to_list() -> t.List[str]: return [x async for x in self.generate_async(*args, **kwargs)] yield from asyncio.run(to_list()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abc():\r\n yield \"a\"\r\n yield \"b\"\r\n yield \"c\"", "def simple():\n yield 1\n yield 2\n yield 3", "def render_content(content, **context):\n if content is None:\n yield u''\n elif isinstance(content, basestring):\n yield content\n elif callable(content):\n ...
[ "0.59119636", "0.5802921", "0.57706994", "0.5578495", "0.55617845", "0.5500655", "0.5452796", "0.5397037", "0.5383921", "0.53472006", "0.5318249", "0.53166026", "0.52893597", "0.52416563", "0.52310807", "0.5207066", "0.5202807", "0.5158685", "0.51500714", "0.5143144", "0.5127...
0.57749826
2
Create one hot vector(s) with the given index(indices).
def one_hot(index, dims, dtype=np.uint8): seq_len = len(index) ret = np.zeros((seq_len, dims), dtype) for i in range(seq_len): ret[i][index[i]]=1 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_one_hot(class_indices, num_classes):\n one_hot_vectors = np.zeros((len(class_indices), num_classes))\n for vector_arg, class_args in enumerate(class_indices):\n one_hot_vectors[vector_arg, class_args] = 1.0\n return one_hot_vectors", "def indices_one_hot(labels_indices, num_classes=10):\n\...
[ "0.8202164", "0.80405766", "0.8024869", "0.7740232", "0.76883376", "0.7674767", "0.76424617", "0.7626948", "0.7626644", "0.76210797", "0.7614029", "0.7602011", "0.74203765", "0.7378809", "0.7365611", "0.7365611", "0.7365611", "0.7365611", "0.73653185", "0.7332268", "0.7101691...
0.78042555
3
Get arguments from CLI
def get_args(): parser = argparse.ArgumentParser( description="""Remove the UCE locus name from nexus alignments.""" ) parser.add_argument( "--alignments", required=True, action=FullPaths, type=is_dir, help="""The input directory containing nexus files to filt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cli_arguments(self):\n pass", "def get_args():\n\n parser = get_argument_parser()\n args = parser.parse_args()\n\n return args", "def parse_cli_args():\r\n parser = argparse.ArgumentParser(\r\n description=\"list all installed packages\")\r\n\r\n parser.add_argument(\"-v\",...
[ "0.83995515", "0.7696954", "0.7674078", "0.7656369", "0.75491726", "0.7546294", "0.7523218", "0.7521475", "0.7514517", "0.75119865", "0.74877495", "0.74807847", "0.74693704", "0.7466727", "0.74665916", "0.74520636", "0.74513096", "0.7427955", "0.7422721", "0.74211824", "0.740...
0.0
-1
Set value to default (for 3ds Max like behavior) > used on rightclick event
def set_value_to_default(self): self.setValue(self.default_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rec_default(self):\n self.new_func_triggers.setText('(0,5)')\n self.new_param.setText('1')", "def rec_default(self):\n self.twin_triggers.setText('(2)')\n self.twin_halves.setText('(0,0)')", "def _on_click(self, _):\n self.value = not self.value", "def rec_default(self)...
[ "0.6751293", "0.6524859", "0.64412534", "0.63850105", "0.6328431", "0.62392324", "0.62146693", "0.61695653", "0.61534035", "0.6149237", "0.6133636", "0.6128789", "0.61026096", "0.6005721", "0.5999437", "0.5959383", "0.5949771", "0.59134954", "0.5910798", "0.5894903", "0.58427...
0.68171674
0
Open a browser to the instructions page.
def browseInstructions(self, event): browseURI(self.instructionsURI)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_in_browser(self):\n webbrowser.open(self.url)", "def _about_dialogue(self):\n webbrowser.open('https://github.com/ldrumm/yubikey-totp-gui')", "def _help_dialogue(self):\n webbrowser.open('https://github.com/ldrumm/yubikey-totp-gui/wiki')", "def open_manual() -> None:\n\n path...
[ "0.671832", "0.65242296", "0.64867294", "0.64718336", "0.6468435", "0.6453586", "0.6447694", "0.6415966", "0.64136815", "0.6385538", "0.63692135", "0.6363255", "0.63457465", "0.6293899", "0.62617403", "0.6256758", "0.62350434", "0.622782", "0.6187152", "0.6147671", "0.6137959...
0.6440288
7
Returns if the word is in the trie.
def search(self, word: str) -> bool: current = self.root for letter in word: if letter not in current.children: return False current = current.children[letter] return current.has_end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr...
[ "0.8386823", "0.81510955", "0.81230164", "0.7856358", "0.7830011", "0.77931386", "0.7792269", "0.7764405", "0.7752762", "0.7746937", "0.7710187", "0.7681166", "0.76761425", "0.76636624", "0.7649853", "0.7633719", "0.7627433", "0.7610955", "0.75764817", "0.7568698", "0.7561647...
0.7496588
25
Get the value at index i
def get(self, i: int) -> int: return self.range_sum(i, i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xval(self, i):\n return self.x[i]", "def __getitem__(self, i):\n\t\tif i < self.n:\n\t\t\treturn self.v[i]", "def __getitem__(self, i):\n return self.data[i]", "def __getitem__(self, i):\n return self.get(i, i + 1)", "def get(self, i):\n\t\tif(i < 0 or i >= self.d):\n\t\t\traise Va...
[ "0.7918859", "0.7879606", "0.7870006", "0.78582245", "0.783389", "0.7766674", "0.77607477", "0.7732207", "0.76742065", "0.76378226", "0.75980604", "0.75442374", "0.7514756", "0.75061285", "0.75061285", "0.72349375", "0.7164053", "0.7116724", "0.70552033", "0.70226914", "0.701...
0.70332783
19
Parse a JSON string and set values to object attributes
def load_from_json(self, json={}): self.original_json = json for key in self.__dict__.keys(): if key in json: setattr(self, key, json[key]) self.set_expiration()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, string):\n dct = json.loads(string)\n return cls.from_dict(dct)", "def fromJSONString(self, JSONString):\n JSONObject = json.loads(JSONString)\n self.fromDict(JSONObject)", "def from_json(self, json_string):\n o = json.loads(json_string)\n properties = {}\n ...
[ "0.70797265", "0.69475603", "0.6919799", "0.6772023", "0.6679104", "0.6679104", "0.6625114", "0.65511477", "0.64009243", "0.6389046", "0.6380474", "0.6378934", "0.6337567", "0.63174736", "0.6316181", "0.63122606", "0.6268323", "0.6268323", "0.62550014", "0.62462944", "0.62334...
0.6223071
21
Compute expiration date using expires_in attribute
def set_expiration(self): # This is an arbitrary decision setting the expiration time # to the current date + expires_in - 10 seconds self.expiration = datetime.now() + \ timedelta(seconds=(self.expires_in - 10)) logging.debug('Token expiration set to %s' % self.expiration)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expires_in(self):\n # TODO: Use Arrow?\n expiration = datetime.datetime.fromtimestamp(self.expiration)\n now = datetime.datetime.now()\n\n return expiration - now", "def expiration(self):\n return datetime(int(self.exp_year), int(self.exp_month),\n calendar.month...
[ "0.7622574", "0.74698514", "0.7280477", "0.72560334", "0.7164952", "0.7102859", "0.7066285", "0.7017344", "0.6981535", "0.6895895", "0.6894819", "0.6865071", "0.6842095", "0.6801995", "0.67605644", "0.67045385", "0.6674677", "0.6660995", "0.66497314", "0.66144174", "0.6603656...
0.66862017
16
Put instance to dict
def put_request_session(self, key, inst): with self.GLOB_LOCK: inst.touch() self._request_sessions[key] = inst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self, key, obj):\n attrs = self.load_attrs()\n attrs[key] = obj\n self.store_attrs(attrs)", "def put(cls, obj):\n pass", "def update(self, obj):\n self.identity_map[obj._instance_key] = obj\n self.register_dirty(obj)", "def _get_dict(self, obj):\n\n ...
[ "0.6583491", "0.645932", "0.63589305", "0.6323048", "0.6297056", "0.6233517", "0.62055385", "0.61510074", "0.60864174", "0.60864174", "0.6069794", "0.6049458", "0.6028055", "0.60183156", "0.60183156", "0.6007885", "0.6007885", "0.59967583", "0.5995191", "0.598711", "0.5958743...
0.0
-1
Used by fit_predict to return model evaluation metrics through crossvalidation, specifically for classification models
def predict_and_cv_score(self, x_data, y_data, custom_kfold=None): f1_scores = [] recall_scores = [] precision_scores = [] accuracy_scores = [] for model in self.list_of_models: f1_scores.append(cross_val_score(model, x_data, y_data, cv=custom_kfold, scoring='f1').mea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clf_eval():\n y_true = np.random.randint(2, size=10000)\n y_pred = np.clip(np.random.normal(0.25, 0.3, size=y_true.shape) + y_true * 0.5, 0, 1)\n\n model_eval = ClassificationEvaluation(\n y_true=y_true,\n y_pred=y_pred,\n class_names=['a', 'b'],\n model_name='foo',\n )\...
[ "0.75144696", "0.7497496", "0.7349594", "0.73141915", "0.72244525", "0.7207625", "0.7183288", "0.7131278", "0.71118087", "0.7104797", "0.70812535", "0.7079839", "0.7022299", "0.7016983", "0.6995465", "0.69783986", "0.6972256", "0.6970008", "0.69450635", "0.6928211", "0.692635...
0.69236493
22
Used by fit_predict to return model evaluation metrics through crossvalidation, specifically for regression models
def predict_and_cv_score_regression(self, x_data, y_data, custom_kfold=None): r2_scores = [] mse_scores = [] for model in self.list_of_models: r2_scores.append(cross_val_score(model, x_data, y_data, cv=custom_kfold, scoring='r2').mean()) mse_scores.append(cross_val_score(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(model, eval_data, num_labels): \n # Turn on the evaluation state to ignore dropouts\n model.eval()\n results = [predict(model, x) for x, y in eval_data]\n f1_score, accuracy = get_metrics(np.array([y for x, y in eval_data]), results, num_labels)\n return f1_score, accuracy", "def e...
[ "0.7434861", "0.7095115", "0.70465183", "0.69509083", "0.69131374", "0.69102055", "0.6908029", "0.6902455", "0.6881166", "0.68446517", "0.68426144", "0.6794651", "0.6793014", "0.6780967", "0.67757785", "0.67669886", "0.674755", "0.67341805", "0.67236453", "0.67236406", "0.671...
0.7326447
1
Tokenize the text input using NLTKs word_tokenize()
def tokenize_text(text): return [word for word in word_tokenize(text) if (word.isalpha() == 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_text(text):\n return nltk.tokenize.word_tokenize(text)", "def tokenize(text):\n text = text.decode('utf-8')\n return nltk.word_tokenize(text)", "def tokenize(raw_text):\n tokenized_text = nltk.tokenize.word_tokenize(raw_text)\n return tokenized_text", "def tokenize(text):\n to...
[ "0.8303857", "0.8129445", "0.8039359", "0.7953297", "0.7948555", "0.7920005", "0.79193926", "0.7915047", "0.78726137", "0.7844544", "0.7812001", "0.7803892", "0.7794861", "0.77789605", "0.7771819", "0.77714103", "0.775791", "0.7755309", "0.7747356", "0.7747356", "0.7741924", ...
0.0
-1
Return the api id.
def get_api_id_from(file): with open(file, "r") as f: api_info = pickle.load(f) return api_info['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.get_api_endpoint()", "def api_id(self) -> int:\n try:\n api_id = int(self._parser.get(constants.CLIENT_CREDENTIALS_SECTION, 'API_ID'))\n return api_id\n except configparser.NoSectionError:\n raise configparser.Error(f\"Конфигур...
[ "0.8192269", "0.7923326", "0.72857684", "0.7060594", "0.70565146", "0.6860814", "0.68273765", "0.682589", "0.6823798", "0.67648923", "0.6728808", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", "0.6701726", ...
0.6827555
6
Add entities for passed config_entry in HA.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: hub: DeebotHub = hass.data[DOMAIN][config_entry.entry_id] new_devices = [] for vacbot in hub.vacuum_bots: new_devices.append(DeebotVacuum(vacbot)) if new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_setup_entry(\n hass: HomeAssistant,\n config_entry: ConfigEntry,\n async_add_entities: AddEntitiesCallback,\n) -> None:\n coordinators: dict[str, RitualsDataUpdateCoordinator] = hass.data[DOMAIN][\n config_entry.entry_id\n ]\n\n async_add_entities(\n RitualsSwitchEnt...
[ "0.6562468", "0.62983084", "0.62799484", "0.6278163", "0.6274243", "0.6206305", "0.6205755", "0.61862373", "0.6179064", "0.6165534", "0.61598295", "0.61379576", "0.6122485", "0.6107209", "0.6097407", "0.6094783", "0.6083814", "0.6058082", "0.60489327", "0.6046326", "0.6040817...
0.57070255
55
Return entity specific state attributes. Implemented by platform classes. Convention for attribute names is lowercase snake_case.
def extra_state_attributes(self) -> Optional[Mapping[str, Any]]: attributes: dict[str, Any] = {} rooms: dict[str, Any] = {} for room in self._rooms: # convert room name to snake_case to meet the convention room_name = slugify(room.subtype) room_values = rooms....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extra_state_attributes(self):\n state_attr = {}\n if self.vendor_id is not None:\n state_attr[ATTR_VENDOR_ID] = self.vendor_id\n state_attr[ATTR_VENDOR_NAME] = self.vendor_name\n if self.type_id is not None:\n state_attr[ATTR_TYPE_ID] = self.type_id\n ...
[ "0.7229976", "0.718195", "0.7141178", "0.7116054", "0.70937127", "0.70072806", "0.700647", "0.70009476", "0.6985321", "0.69266015", "0.6921594", "0.69194144", "0.69184166", "0.68879586", "0.68854785", "0.6869149", "0.6866153", "0.68570524", "0.68570524", "0.6848794", "0.68487...
0.0
-1
Create the app object and return it
def create_app(): app = Flask(__name__) # Load application settings settings = os.environ.get("FLASK_SETTINGS", SETTINGS) if settings is not None: c = Config(settings) print(c) app.config.update(c.get_map('flask')) from users.views import user # Register the blueprints ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n app = create_app()\n return app", "def app():\n return create_app()", "def create_app(self):\n raise NotImplementedError", "def create():\n\n return App()", "def _create_app_instance(script_info):\n return create_app()", "def get_app(self):\n return Application()...
[ "0.86219174", "0.846839", "0.841322", "0.83985764", "0.8334573", "0.8106147", "0.7955877", "0.786966", "0.7774832", "0.7769306", "0.76641476", "0.7636182", "0.76080185", "0.7546913", "0.75468355", "0.7538712", "0.75114894", "0.7456657", "0.7455357", "0.7442867", "0.7377457", ...
0.70880806
55
Paints the selection item.
def paintSelectionItem(self, tag): if tag == "skin": self.paintOptions(["skin.png"], "skin") elif tag == "mask": if self.avatarConfiguration["gender"] == "boy": self.paintOptions(["masko.png"], "mask") else: self.paintOptions(["maska.png"], "mask") elif tag == "hair": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_selected(self):\n if self.get_selected() is not None and not self.check_if_locked(self.get_selected()):\n self.color_cell(pos=self.get_selected(\n ), color=SELECTED_INVALID if self.get_selected() in self.invalid else SELECTED)", "def on_selected(self):\n self.colour =...
[ "0.73639786", "0.70427626", "0.70354766", "0.6993003", "0.69353014", "0.69259495", "0.675598", "0.6746916", "0.6717034", "0.6652914", "0.6550275", "0.6456941", "0.6437748", "0.6332917", "0.6258266", "0.618958", "0.6188641", "0.61616313", "0.6113218", "0.6105374", "0.61021817"...
0.6198362
15
Opens the close file dialog.
def closeFileDialog(self, result): filePath = None if result == "OK": filePath = self.listDir.getFileName() if filePath: self.showImage(filePath) self.window.remove_child(self.dialog) self.dialog.destroy() self.fileDialogShow = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filemenu_Close(self):\n\n self.on_closing()", "def close(file):\n args = {\"file\": file}\n send_command(\"close\", args)", "def _close_dialog(*args):\n global _dialog\n if _dialog is not None:\n _dialog.destroy()\n _dialog = None", "def onBtnCloseClicked(self):\n self.close()...
[ "0.73460746", "0.7023839", "0.69492364", "0.6878078", "0.6840062", "0.67554885", "0.66877294", "0.6682146", "0.6671386", "0.6671386", "0.6643962", "0.6637478", "0.6610322", "0.659762", "0.65933716", "0.6540071", "0.65233684", "0.64974564", "0.6469414", "0.6468541", "0.6468206...
0.7020331
2
To create the summed profile of all individual profiles in an instance, we can use a dictionary comprehension to iterate over all profiles in the instance.
def model_data_from_instance(self, instance): xvalues = np.arange(self.data.shape[0]) return sum( [ profile.model_data_1d_via_xvalues_from(xvalues=xvalues) for profile in instance ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_profiles(self):\n self._profiles = {\n k: np.zeros((len(self.hybrid_time_index), len(self.hybrid_meta)),\n dtype=np.float32)\n for k in OUTPUT_PROFILE_NAMES}", "def profile(self, data):\n\n # need to store the output of each morphism in the ana...
[ "0.6303733", "0.6003777", "0.60003054", "0.5991352", "0.5959558", "0.59029984", "0.5899841", "0.5897682", "0.5875563", "0.5859356", "0.58367246", "0.5785412", "0.57500017", "0.57378715", "0.572503", "0.56675404", "0.5656984", "0.5638969", "0.56253994", "0.56197834", "0.561978...
0.0
-1
This method is identical to the previous tutorial, except it now uses the `model_data_from_instance` method to create the profile.
def visualize(self, paths, instance, during_analysis): xvalues = np.arange(self.data.shape[0]) model_data = self.model_data_from_instance(instance=instance) residual_map = self.data - model_data chi_squared_map = (residual_map / self.noise_map) ** 2.0 """The visualizer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_profile_for_user(sender, instance, **kwargs):\n if kwargs['created']:\n new_profile = ImagerProfile(user=instance)\n new_profile.save()", "def create_profile(sender, **kwargs):\n\n # I import profile here cause i can't import it right in the top.\n from .profiles import Profile\n\...
[ "0.7288304", "0.7257323", "0.72221214", "0.72215366", "0.7192119", "0.7140724", "0.7114105", "0.7092448", "0.7081291", "0.7081034", "0.7064456", "0.7064456", "0.7064456", "0.69776773", "0.6940732", "0.69337696", "0.69326335", "0.6882552", "0.6872377", "0.68693244", "0.6825349...
0.0
-1
Returns a 1D Gaussian on an input list of Cartesian x coordinates. The input xvalues are translated to a coordinate system centred on the Gaussian, via its `centre`. The output is referred to as the `model_data` to signify that it is a representation of the data from the model.
def model_data_1d_via_xvalues_from(self, xvalues: np.ndarray): transformed_xvalues = np.subtract(xvalues, self.centre) return np.multiply( np.divide(self.normalization, self.sigma * np.sqrt(2.0 * np.pi)), np.exp(-0.5 * np.square(np.divide(transformed_xvalues, self.sigma))), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_data_1d_via_xvalues_from(self, xvalues: np.ndarray) -> np.ndarray:\r\n transformed_xvalues = xvalues - self.centre\r\n\r\n return np.multiply(\r\n np.divide(self.normalization, self.sigma * np.sqrt(2.0 * np.pi)),\r\n np.exp(-0.5 * np.square(np.divide(transformed_xvalue...
[ "0.6511304", "0.62219405", "0.60758066", "0.58818203", "0.58516496", "0.5827418", "0.5708849", "0.5660607", "0.56337976", "0.5622666", "0.55980283", "0.55980283", "0.55621004", "0.5559702", "0.5481954", "0.5396391", "0.5382293", "0.5382293", "0.53440315", "0.53438157", "0.529...
0.6594829
0
Returns a 1D Gaussian on an input list of Cartesian x coordinates. The input xvalues are translated to a coordinate system centred on the Gaussian, via its `centre`. The output is referred to as the `model_data` to signify that it is a representation of the data from the model.
def model_data_1d_via_xvalues_from(self, xvalues: np.ndarray): transformed_xvalues = np.subtract(xvalues, self.centre) return self.normalization * np.multiply( self.rate, np.exp(-1.0 * self.rate * abs(transformed_xvalues)) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_data_1d_via_xvalues_from(self, xvalues: np.ndarray):\r\n transformed_xvalues = np.subtract(xvalues, self.centre)\r\n return np.multiply(\r\n np.divide(self.normalization, self.sigma * np.sqrt(2.0 * np.pi)),\r\n np.exp(-0.5 * np.square(np.divide(transformed_xvalues, sel...
[ "0.6594319", "0.6510771", "0.62236106", "0.60766315", "0.5882499", "0.585287", "0.58271587", "0.5708917", "0.56606776", "0.56216574", "0.55980146", "0.55980146", "0.55620664", "0.5561733", "0.54832405", "0.5397384", "0.5380961", "0.5380961", "0.5345305", "0.5344314", "0.52946...
0.56327635
9
Convert UTC datetime to localtime timezone ('Europe/Stockholm')
def convert_to_localtime(dt): tz = pytz.timezone('Europe/Stockholm') dt = dt.replace(tzinfo=pytz.utc) dt = dt.astimezone(tz) return dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localtime_for_timezone(value, timezone):\r\n return adjust_datetime_to_timezone(value, settings.TIME_ZONE, timezone)", "def GetLocalTime(dt, tz):\n return dt.replace(tzinfo=pytz.utc).astimezone(tz)", "def utc2localtime(date):\n return date - (datetime.utcnow() - datetime.now())", "def localize_dat...
[ "0.6936038", "0.67989963", "0.6781287", "0.6716644", "0.6716644", "0.6716644", "0.6712792", "0.6622246", "0.66188514", "0.6613277", "0.6530687", "0.6522463", "0.6522463", "0.65096396", "0.650923", "0.6456534", "0.64432096", "0.6438188", "0.6429396", "0.64009583", "0.63939345"...
0.8419736
0
Set the payload to the given value.
def set_payload(self, payload): self._payload = payload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPayload(self, payload):\n self.__payload = payload", "def set_payload(self, payload):\n self.payload = json.dumps(payload)", "def set_payload(self, payload):\n self._str_payload = payload\n self._obj_payload = None", "def payload(self, payload):\n\n self._payload = p...
[ "0.77700126", "0.7607542", "0.759514", "0.75175667", "0.7101841", "0.7013674", "0.67309165", "0.6662137", "0.6647326", "0.65303284", "0.6516512", "0.64631796", "0.64532405", "0.6440627", "0.64308095", "0.6426576", "0.6417389", "0.6417389", "0.6417389", "0.6417389", "0.6417389...
0.7944514
0
Return a list of all the values for the named field. These will be sorted in the order they appeared in the original message, and may contain duplicates. Any fields deleted and reinserted are alwyas appended to the header list.
def getall(self, name, failobj=None): values = [] name = name.lower() for k, v in self._headers: if k.lower() == name: values.append(v) return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortedFields(cls):\n return [\n i[0] for i in sorted(cls._nameToValue.items(), key=lambda item: item[1])\n ]", "def fields(self):\n return [f[1] for f in sorted(self.dd.fields.items())]", "def get_field_names(self):\n return {rv[0] for rv in self.iter_fields()}", "d...
[ "0.7227821", "0.68804765", "0.65010124", "0.64877665", "0.6461606", "0.64428866", "0.6391083", "0.63055766", "0.6281034", "0.6247848", "0.6242284", "0.62284935", "0.6167847", "0.61624306", "0.61449486", "0.6140014", "0.6131532", "0.6087768", "0.60766345", "0.6065869", "0.6057...
0.60114175
23
Get the brightness of the dither object.
def get_brightness(self): _lib.caca_get_dither_brightness.argtypes = [_Dither] _lib.caca_get_dither_brightness.restype = ctypes.c_float return _lib.caca_get_dither_brightness(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brightness(self) -> float:\n # http://alienryderflex.com/hsp.html\n r, g, b = self.r, self.g, self.b\n return sqrt(0.299*r**2 + 0.587*g**2 + 0.114*b**2)/255", "def brightness(self):\n return self.get_value('bri')", "def brightness(self):\n return round((self._device.curre...
[ "0.8029478", "0.7875212", "0.77922827", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.7781082", "0.77647805", "0.7688449", "0.7615564", "0.74948394", "0.74389976", "0.73013204"...
0.88095915
0
Return the dither's current antialiasing method.
def get_antialias(self): _lib.caca_get_dither_antialias.argtypes = [_Dither] _lib.caca_get_dither_antialias.restype = ctypes.c_char_p return _lib.caca_get_dither_antialias(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetAntialiasMode(*args, **kwargs):\n return _gdi_.GraphicsContext_GetAntialiasMode(*args, **kwargs)", "def set_antialias(self, value):\n _lib.caca_set_dither_antialias.argtypes = [_Dither, ctypes.c_char_p]\n _lib.caca_set_dither_antialias.restype = ctypes.c_int\n\n return _lib.ca...
[ "0.7316774", "0.70382136", "0.62590796", "0.5920561", "0.55210084", "0.54143494", "0.50951344", "0.5059895", "0.50450474", "0.48415008", "0.48221686", "0.4799041", "0.478852", "0.47513354", "0.47095522", "0.4669869", "0.46551496", "0.46278602", "0.46060565", "0.4600004", "0.4...
0.7915878
0
Choose colours used for dithering. value A string describing the colour set that will be used for the dithering.
def set_color(self, value): _lib.caca_set_dither_color.argtypes = [_Dither, ctypes.c_char_p] _lib.caca_set_dither_color.restype = ctypes.c_int return _lib.caca_set_dither_color(self, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_charset(self, value):\n _lib.caca_set_dither_charset.argtypes = [_Dither, ctypes.c_char_p]\n _lib.caca_set_dither_charset.restype = ctypes.c_int\n\n return _lib.caca_set_dither_charset(self, value)", "def color(value):\r\n return 'RGB({}, {}, {})'.format(value.red(), value.bl...
[ "0.6068375", "0.6018215", "0.5914558", "0.5752664", "0.57084477", "0.5689596", "0.5675022", "0.5637268", "0.56303346", "0.5612185", "0.5524138", "0.5523459", "0.55111074", "0.5506187", "0.54789203", "0.5464128", "0.5463799", "0.5461586", "0.5434332", "0.54321027", "0.54320204...
0.6906732
0
Get current colour mode.
def get_color(self): _lib.caca_get_dither_color.argtypes = [_Dither] _lib.caca_get_dither_color.restype = ctypes.c_char_p return _lib.caca_get_dither_color(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_mode(self):\n mode=lib.is_SetColorMode(self.hcam,0x8000)\n return self._color_modes_inv.get(mode,mode)", "def color_mode(self):\n return ids_core.Camera.color_mode.__get__(self)", "def color_mode(self) -> ColorMode:\n if self._dimmable:\n return ColorMode.BR...
[ "0.8506589", "0.8062411", "0.75024205", "0.7239905", "0.7206059", "0.71338886", "0.70655864", "0.7058712", "0.705761", "0.7049096", "0.7003177", "0.6987268", "0.6987268", "0.6925067", "0.69029975", "0.68971854", "0.68906504", "0.6877764", "0.6841367", "0.68247694", "0.6807551...
0.0
-1
Create new Heap based on priority argument
def _create_priorities(self, pri): heaps = self.priorities heaps[pri] = MinBinaryHeap()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_heap(self, frequency):\n\n\n\t\t\tfor key in frequency:\n\t\t\t\tnode = self.HeapNode(key, frequency[key])#instaciamos un nodo con el valor y frecuencia\n\t\t\t\theapq.heappush(self.heap, node)#agregamos el nodo al priority queue", "def heapify(x):\n pass", "def build_heap(self):\n n = int((...
[ "0.7393375", "0.67986894", "0.64988506", "0.6449566", "0.6432171", "0.6426354", "0.64262825", "0.64262825", "0.64262825", "0.64245623", "0.6410928", "0.63822424", "0.6370285", "0.63593113", "0.63568485", "0.63538027", "0.6352294", "0.6352216", "0.63434476", "0.6324766", "0.63...
0.74990505
0
Insert new node into Heap, based on priority. The order of the insert is maintained by order dictating the value of the node in each Heap.
def insert(self, pri): heaps = self.priorities if pri > 10 or pri < 1: raise ValueError( 'Priority must be between 1 (high) - 10 (low)' ) if pri not in heaps.keys(): self._create_priorities(pri) priority = heaps.get(pri) priori...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, value, priority=2):\n if not isinstance(priority, int):\n raise TypeError(\"Priority must be an integer\")\n if priority in self.priority_queue:\n self.priority_queue[priority].append(value)\n else:\n self.priority_queue[priority] = [value]\n ...
[ "0.7493382", "0.747859", "0.7303172", "0.7274606", "0.7218348", "0.7193368", "0.6929881", "0.6925497", "0.6896418", "0.68946266", "0.68823105", "0.6800372", "0.67784363", "0.67307657", "0.6704276", "0.6652443", "0.66325456", "0.6625264", "0.66204196", "0.65797853", "0.6561100...
0.7620247
0
Returns multiple hex strings `data` as bytes.
def hex_strings_to_bytes(data: Iterable[str]) -> bytes: byte_array = array('B') for hexstr in data: byte_array.extend(int(hexstr[index:index+2], 16) for index in range(0, len(hexstr), 2)) return byte_array.tobytes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_hexstr(data: bytes) -> str:\n return ''.join(int_to_hexstr(byte) for byte in data)", "def b2a_hex(data):\n\n return binascii.b2a_hex(data)", "def hexstr_to_bytes(data: str) -> bytes:\n byte_array = array('B', (int(data[index:index + 2], 16) for index in range(0, len(data), 2)))\n retur...
[ "0.7278739", "0.69301456", "0.68820524", "0.67279637", "0.67273766", "0.6685252", "0.6528643", "0.6507147", "0.6499234", "0.6466613", "0.64450103", "0.643173", "0.6396244", "0.63774174", "0.6301702", "0.62324184", "0.6211707", "0.6182273", "0.61719114", "0.60947466", "0.60823...
0.8027493
0
Returns hex string `data` as bytes.
def hexstr_to_bytes(data: str) -> bytes: byte_array = array('B', (int(data[index:index + 2], 16) for index in range(0, len(data), 2))) return byte_array.tobytes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_hexstr(data: bytes) -> str:\n return ''.join(int_to_hexstr(byte) for byte in data)", "def hex_strings_to_bytes(data: Iterable[str]) -> bytes:\n byte_array = array('B')\n for hexstr in data:\n byte_array.extend(int(hexstr[index:index+2], 16) for index in range(0, len(hexstr), 2))\n ...
[ "0.7540623", "0.72735554", "0.7264539", "0.7164419", "0.712034", "0.7057515", "0.70497096", "0.7027782", "0.7005459", "0.69885397", "0.67918706", "0.66520184", "0.6585216", "0.65836406", "0.6557071", "0.6551698", "0.6516621", "0.6486435", "0.62897897", "0.62782013", "0.624652...
0.7490721
1
Create a user with the given email and password.
def create_user(self, email: str, password: str, **kwargs: str) -> "User": email = self.normalize_email(email) user: "User" = self.model(email=email, **kwargs) user.set_password(password) user.save() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(email, password='test', **kwargs):\n user = get_user_model().objects.create(email=email, **kwargs)\n user.set_password(password)\n user.save()\n return user", "def create_user(email='user@example.com', password='testpass123'):\n return get_user_model().objects.create_user(email=ema...
[ "0.8815903", "0.8682614", "0.86186355", "0.8592563", "0.8572997", "0.8572997", "0.8572997", "0.8563415", "0.8554833", "0.8554833", "0.8511704", "0.851129", "0.8505482", "0.85019517", "0.85019517", "0.85019517", "0.84820235", "0.8475811", "0.84723836", "0.8463488", "0.84614134...
0.8355751
48
Format the given UNIX timestamp in the '%Y%m%d%H%M%S%Z' format. timestamp (int) The timestamp to convert. (str) The converted timestamp.
def formatTimestamp(self, timestamp): return time.strftime('%Y%m%d-%H%M%S-%Z', time.localtime(timestamp))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_timestamp(timestamp: float) -> str:\n\n dt = datetime.utcfromtimestamp(timestamp)\n return dt.strftime('%Y/%m/%d %H:%M:%S UTC%z')", "def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')", "def format_timestamp(timestamp):\n try:\n date = ...
[ "0.8248668", "0.7892845", "0.75943416", "0.74010617", "0.7311571", "0.7187406", "0.7116556", "0.70874643", "0.70874643", "0.70874643", "0.70685565", "0.7060189", "0.6967192", "0.6936942", "0.69314146", "0.68966395", "0.67437476", "0.6722041", "0.6721315", "0.6598178", "0.6546...
0.831771
0
Initialisation. sensorMac (str) The MACaddress of the Bluetooth sensor.
def __init__(self, plugin, hostname, projectname, sensorMac): Logger.__init__(self, plugin, hostname, projectname) self.sensor = sensorMac self.logFiles = ['scan', 'rssi'] self.logs = dict(zip(self.logFiles, [open('/'.join([ self.logDir, '%s-%s-%s.log' % (self.hostname, self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac(self, mac):\n\n self._mac = mac", "def __init__(self, node, mac, sensor_id):\n super().__init__(node, mac)\n self.sensor_id = sensor_id\n self.sensor_type = SENSORS[sensor_id]\n self.node_callbacks = (AVAILABLE_SENSOR_ID, sensor_id)", "def from_mac(self):\n rea...
[ "0.64202636", "0.63291633", "0.6165792", "0.61127704", "0.6004181", "0.5994989", "0.5994989", "0.59901", "0.5957456", "0.5901115", "0.58880174", "0.588691", "0.58227724", "0.5801586", "0.57481027", "0.5727732", "0.5703983", "0.5703345", "0.5699915", "0.5689891", "0.568221", ...
0.0
-1
Quantizes a value to the closest value in a list of quantized values.
def quantize(value, quant, with_index=False): mids = [(quant[i] + quant[i + 1]) / 2.0 for i in range(len(quant) - 1)] ind = bisect.bisect_right(mids, value) if with_index: return ind, quant[ind] else: return quant[ind]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnearest(iterable, value):\n return min(enumerate(iterable), key=lambda i: abs(i[1] - value))", "def closestValue(aList: list, givenV: int):\n abs_diff = lambda list_value: abs(list_value - givenV)\n\n return min(aList, key=abs_diff)", "def quantifyValues( values, scale):\r\n\r\n\tfor v in range...
[ "0.60405785", "0.60346353", "0.59024376", "0.58044064", "0.5680126", "0.5652785", "0.5632271", "0.56285363", "0.56191117", "0.5606158", "0.55948305", "0.55835664", "0.5536345", "0.5536345", "0.5513843", "0.5510794", "0.5436136", "0.54047954", "0.54021806", "0.53601295", "0.53...
0.5795247
4
Configure flask_app with the settings from settings.py.
def configure_app(flask_app): flask_app.config['RESTPLUS_SWAGGER_UI_DOC_EXPANSION'] = \ settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION flask_app.config['RESTPLUS_VALIDATE'] = \ settings.RESTPLUS_VALIDATE flask_app.config['SQLALCHEMY_DATABASE_URI'] = \ settings.SQLALCHEMY_DATABASE_URI ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app_config(self, app: Flask) -> Flask:\n app.secret_key = config.get_setting('SECRET_KEY')\n return app", "def update_flask(self, flask_app):\n flask_app.config.update(self.flask_config_dict)", "def app(self):\n\n ## set flask specific things that are non-optional\n ...
[ "0.78092724", "0.74835205", "0.73006094", "0.7236674", "0.70968115", "0.70810926", "0.7050148", "0.70427734", "0.70294017", "0.7010278", "0.7008004", "0.69754964", "0.68153656", "0.6801271", "0.6795116", "0.6771952", "0.66904813", "0.66592824", "0.6637816", "0.6604093", "0.65...
0.79909986
0