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 |
|---|---|---|---|---|---|---|
I'm the 'opt_value' property. | def opt_value(self):
return self._opt_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self._get_value(self.optionType, self.value, self.defaultValue)",
"def OptionValue(self):\n if self.force_auto_sync:\n self.get('OptionValue')\n return self._OptionValue",
"def get_option_value(self, key):\n\n # Check the key.\n self.... | [
"0.7695498",
"0.75160086",
"0.693515",
"0.6907238",
"0.6876313",
"0.68060356",
"0.6750063",
"0.673023",
"0.66447",
"0.6594422",
"0.65721446",
"0.65721446",
"0.65721446",
"0.6558912",
"0.655406",
"0.6546801",
"0.65446997",
"0.65446997",
"0.65446997",
"0.65446997",
"0.65446997"... | 0.85266 | 0 |
Create a canvas on the right side of the frame | def __init__(self, frame, width, height):
self.canvas = Tkinter.Canvas(frame, width = int(width),
height = int(height))
self.canvas.pack(side = CANVAS["POSITION"])
self.canvas.configure(background = check_color(CANVAS["BACKGROUND_COLOR"])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_canvas(self):\n\n self.canvas = Canvas(self)\n self.scrollbar = ttk.Scrollbar(self, orient= VERTICAL,\n command=self.canvas.yview) \n self.canvas.configure(yscrollcommand=self.scrollbar.set)\n \n # make sure to add scrollbar before adding the canvas\n ... | [
"0.66195023",
"0.62900144",
"0.62900144",
"0.62900144",
"0.6259406",
"0.6139302",
"0.6135286",
"0.6125125",
"0.6019838",
"0.5919777",
"0.5888397",
"0.5849573",
"0.57538784",
"0.57368976",
"0.57129246",
"0.56891966",
"0.56763834",
"0.5664521",
"0.5642157",
"0.55990934",
"0.557... | 0.566045 | 18 |
Call the line class to add a polyline item on the canvas | def draw_polyline(self, points, line_width, line_color):
line_color = check_color(line_color)
STline.line(self.canvas, points, line_width, line_color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polyline(self, pointlist, cls=None, style=None, attrs=None):\n payload = self._meta.make_payload(cls, style, attrs)\n pts_str = ' '.join('%s,%s' % (x, y) for x, y in pointlist)\n self.elements.append(\"\"\"<polyline points=\"%s\" %s/>\"\"\" % (pts_str, payload))\n return self",
"d... | [
"0.72656536",
"0.72656536",
"0.7092736",
"0.69299716",
"0.6873782",
"0.6844418",
"0.66164196",
"0.66061544",
"0.6589458",
"0.6480161",
"0.64328104",
"0.6431058",
"0.6428271",
"0.64259815",
"0.6424522",
"0.64206433",
"0.6412458",
"0.63978",
"0.63714385",
"0.6371064",
"0.636798... | 0.7009961 | 3 |
Ensure that the keystone user is present with the specified properties. name The name of the user to manage password The password to use for this user. | def user_present(
name,
password,
email,
tenant=None,
enabled=True,
roles=None,
profile=None,
password_reset=True,
project=None,
**connection_args
):
ret = {
"name": name,
"changes": {},
"result": True,
"comment": 'User "{}" will be updated'.fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(name, password, **kwargs):\n if not user_exists(name, **kwargs):\n create_user(name, password, **kwargs)",
"def check_existing_users(user_name,password):\n\n\n new_user = User(user_name,password)\n\n return new_user",
"def test_create_with_username(self):\n properties = self.por... | [
"0.69401443",
"0.6461471",
"0.63163096",
"0.62046903",
"0.6197496",
"0.6155894",
"0.61412865",
"0.6108911",
"0.60730237",
"0.60649776",
"0.6052253",
"0.60481143",
"0.60374796",
"0.60361123",
"0.60292125",
"0.6015896",
"0.6014642",
"0.6014321",
"0.6005248",
"0.6003213",
"0.599... | 0.6136841 | 7 |
Ensure that the keystone user is absent. name The name of the user that should not exist | def user_absent(name, profile=None, **connection_args):
ret = {
"name": name,
"changes": {},
"result": True,
"comment": 'User "{}" is already absent'.format(name),
}
# Check if user is present
user = __salt__["keystone.user_get"](name=name, profile=profile, **connection_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absent(name, database=None, user=None, password=None, host=None, port=None):\n ret = {\"name\": name, \"changes\": {}, \"result\": True, \"comment\": \"\"}\n\n # check if user exists and remove it\n if __salt__[\"influxdb08.user_exists\"](name, database, user, password, host, port):\n if __opts... | [
"0.71133214",
"0.66945195",
"0.6585958",
"0.64945734",
"0.64895654",
"0.6487798",
"0.64379394",
"0.6423274",
"0.64190096",
"0.63430214",
"0.6280308",
"0.6272947",
"0.62694633",
"0.6265773",
"0.62545973",
"0.62511045",
"0.6229977",
"0.62204033",
"0.6218796",
"0.6208554",
"0.61... | 0.72208434 | 0 |
Calculates surviving combatants after a battle and updates this entity's soldiers and mages lists by removing random KIAs and improving the stats of the survivors For simplicity, we take the "average life" to be the mean of the possible life range for both soldiers and mages. Upon finishing a battle, the surviving unit... | def calculate_survivors(self, planet=None):
mage_life = 0
if self.magos:
# Calculate survivors
mage_life = sum(self.race.rango_vid_mago) // 2
survivors = min(self.vida / mage_life, len(self.magos))
if planet:
planet.magos = survivors
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, g):\n \n self.game = g\n \n #if the player is dead, KILL THEM\n if self.hp[0] <= 0 and self.dead == False:\n self.dead = True\n self.deadt = 0\n #clear debuffs\n\n if self.dead == True:\n self.deadt += g.deltaT /... | [
"0.63905156",
"0.60726476",
"0.5827834",
"0.58143336",
"0.5618268",
"0.56173724",
"0.5583538",
"0.55375594",
"0.55266774",
"0.552392",
"0.5520356",
"0.55165654",
"0.54871655",
"0.54827607",
"0.5474453",
"0.5466229",
"0.54578835",
"0.5456407",
"0.545575",
"0.54526037",
"0.5452... | 0.6427245 | 0 |
Receives a date str and convert it into a datetime object | def convert_to_datetime(date_str):
tz = date_str.rfind("+")
return datetime.strptime(date_str[:tz -1], "%a, %d %b %Y %H:%M:%S") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_datetime(datestr):\n\n from dateutil import parser\n from datetime import datetime\n\n date = parser.parse(datestr)\n return date",
"def parse_datetime(date_str: str) -> datetime:\n return dateutil.parser.parse(date_str)",
"def convert_str2date(date):\n import datetime\n date = ... | [
"0.8167047",
"0.80831426",
"0.79583085",
"0.7816407",
"0.7774197",
"0.7768535",
"0.7764832",
"0.77454257",
"0.77393603",
"0.76995426",
"0.7687901",
"0.7682562",
"0.7637706",
"0.7614879",
"0.76009727",
"0.7585005",
"0.75717074",
"0.7515832",
"0.7496986",
"0.7492563",
"0.748847... | 0.75431204 | 17 |
Receives a list of datetimes and returns the month (format YYYYMM) that occurs most | def get_month_most_posts(dates):
posts_yr_mo = [post_date.strftime("%Y-%m") for post_date in dates]
posts_frequency = collections.Counter(posts_yr_mo)
return posts_frequency.most_common()[0][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_common_month(df):\n common_month = df['month'].mode()[0]\n print(\"Most common month is {}.\".format(get_month_name(common_month)))",
"def count_by_months(all_articles, number_of_months):\n all_dates = get_all_dates(all_articles)\n year_and_months_count = {}\n\n if number_of_months < 1 or... | [
"0.6511621",
"0.5909826",
"0.58501095",
"0.58267087",
"0.5811582",
"0.57121617",
"0.5711624",
"0.5701133",
"0.56948787",
"0.56809133",
"0.56291866",
"0.5611539",
"0.5584624",
"0.55829054",
"0.5506484",
"0.54748726",
"0.54685485",
"0.5453931",
"0.54367024",
"0.54049987",
"0.53... | 0.75499934 | 0 |
Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4] The target boxes are expected in format (center_x, center_y, w, h), normalized by the image size. | def loss_boxes(self, outputs, targets, indices, num_boxes):
assert 'pred_boxes' in outputs
idx = self._get_src_permutation_idx(indices)
src_boxes = outputs['pred_boxes'][idx]
target_boxes = torch.cat([t['boxes'][i] for t, (_, i) in zip(targets, indices)], dim=0)
loss_bbox = F.l1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_boxes(self, outputs, targets, indices, num_boxes):\n assert 'pred_boxes' in outputs\n idx = self._get_src_permutation_idx(indices)\n src_boxes = outputs['pred_boxes'][idx]\n tgt_idx = [i[torch.where(i >= 0)[0]] for i in indices]\n target_boxes = torch.cat([t['boxes'][i] ... | [
"0.77105623",
"0.7660171",
"0.7608288",
"0.7580019",
"0.7253084",
"0.71778846",
"0.67273164",
"0.65829676",
"0.6376323",
"0.63556206",
"0.6346721",
"0.6311438",
"0.62772405",
"0.623812",
"0.623812",
"0.61970073",
"0.61708605",
"0.6135549",
"0.61230147",
"0.61139446",
"0.60994... | 0.7564021 | 4 |
Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4] The target boxes are expected in format (center_x, center_y, w, h), normalized by the image size. | def loss_boxes_panoptic(self, outputs, targets, indices, num_boxes):
assert 'pred_boxes' in outputs
idx = self._get_src_permutation_idx(indices)
src_boxes = outputs['pred_boxes'][idx]
target_boxes = torch.cat([t['boxes'][i] for t, (_, i) in zip(targets, indices)], dim=0)
target_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_boxes(self, outputs, targets, indices, num_boxes):\n assert 'pred_boxes' in outputs\n idx = self._get_src_permutation_idx(indices)\n src_boxes = outputs['pred_boxes'][idx]\n tgt_idx = [i[torch.where(i >= 0)[0]] for i in indices]\n target_boxes = torch.cat([t['boxes'][i] ... | [
"0.7708873",
"0.7658759",
"0.76066405",
"0.75783825",
"0.75623256",
"0.7251272",
"0.71789217",
"0.65815794",
"0.63737315",
"0.63553274",
"0.63462645",
"0.63108605",
"0.6276396",
"0.62377286",
"0.62377286",
"0.6195557",
"0.61702925",
"0.6134808",
"0.6122964",
"0.6113557",
"0.6... | 0.6725683 | 7 |
Maps X (1D vector) into the pth power. | def polyFeat(X, p):
# You need to return the following variables correctly.
X_poly = np.zeros((X.shape[0], p))
# ====================== YOUR CODE HERE ======================
for i in range(p):
X_poly[:, i] = X[:, 0] ** (i + 1)
# ===================================================... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pn(x, w_list):\n\treturn sum(map(lambda w: w[1] * np.power(x, w[0]), enumerate(w_list)))",
"def add_polynomial_features(x, power):\n if type(power) is int and type(x) is np.ndarray:\n return np.concatenate([x**i for i in range(1, power+1)], axis=1)\n return None",
"def _prob_map(self, x):\n ... | [
"0.6938881",
"0.643751",
"0.6342861",
"0.6273873",
"0.6239384",
"0.62177634",
"0.6060949",
"0.59960514",
"0.599105",
"0.5974435",
"0.5962794",
"0.5961761",
"0.5961761",
"0.5961761",
"0.5946891",
"0.5884185",
"0.5871658",
"0.5861159",
"0.58578354",
"0.5851925",
"0.58476365",
... | 0.60129017 | 7 |
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(labels_dense, num_classes):
num_labels = labels_dense.shape[0]
index_offset = numpy.arange(num_labels) * num_classes
labels_one_hot = numpy.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
return labels_one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.82509226",
"0.80772066",
"0.8052351",
"0.79781777",
"0.7908086",
"0.7901809",
"0.78927463",
"0.78712845",
"0.7850624",
"0.7850624",
"0.78275776",
"0.78261137",
"0.77689123",
"0.77538806",
"0.77538806",
"0.77538806",
"0.7748842",
"0.7744533",
"0.7736261",
"0.7722455",
"0.77... | 0.7765254 | 13 |
conv2d returns a 2d convolution layer with full stride. | def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')",
... | [
"0.76294184",
"0.7626325",
"0.7578354",
"0.7464178",
"0.7425643",
"0.7425643",
"0.7425643",
"0.7425643",
"0.7385575",
"0.7337334",
"0.73298347",
"0.7329191",
"0.7313136",
"0.73011947",
"0.7296412",
"0.72693735",
"0.7246813",
"0.723127",
"0.7208128",
"0.71960634",
"0.71898824"... | 0.7457383 | 4 |
weight_variable generates a weight variable of a given shape. | def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)",
"def create_weight_variable(shape):... | [
"0.8267109",
"0.82348764",
"0.815819",
"0.8156324",
"0.81374705",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81341064",
"0.81203765",
"0.8064536",
"0.7981936",
"0.7978305",
"0.79572064",
"0.... | 0.8139299 | 4 |
Returns whether or not the user is logged in. | def is_logged_in(self) -> bool:
return self.id is not None and self.username is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_logged_in():\n return 'user' in session",
"def isLoggedIn(self):\n session = self.getSession()\n if session is not None:\n return True\n return False",
"def is_logged_in(self):\n return self.__is_logged_in",
"def logged_in(self) -> bool:\n return self._... | [
"0.8745039",
"0.8713494",
"0.8685968",
"0.8602615",
"0.8571882",
"0.8560649",
"0.84809583",
"0.8433032",
"0.8339884",
"0.8335798",
"0.81091666",
"0.8022663",
"0.8010746",
"0.79779094",
"0.7908079",
"0.78766686",
"0.7827508",
"0.7730682",
"0.7568679",
"0.7558064",
"0.74770683"... | 0.8575942 | 4 |
Return true if the object is a class. | def isSampleObject(self, object):
return isinstance(object, Sample) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isclass(object):\r\n return isinstance(object, (type, types.ClassType))",
"def isclass(object):\n if not inspect.isclass(object):\n return False\n if isbuiltin(object):\n return False\n return type not in inspect.getmro(object)",
"def class_is(cls: Class) -> bool:\n pass",
... | [
"0.872781",
"0.8689777",
"0.847604",
"0.8062617",
"0.80282146",
"0.80282146",
"0.8018681",
"0.80158186",
"0.79666317",
"0.79666317",
"0.79666317",
"0.79666317",
"0.79666317",
"0.79666317",
"0.794599",
"0.7932038",
"0.79265285",
"0.7922377",
"0.78950083",
"0.7596183",
"0.75640... | 0.0 | -1 |
Return a string representation of the object. | def __str__(self):
return f"QChem log file {self.filename}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def to_string(self):\r\n return self.__str__()",
"def __str__(self):\n return str(self.obj)",
"def as_string(self):\n return self.__repr__()",
"def __str__(self):\n return str(self.serialize())",
"def __s... | [
"0.82722086",
"0.8227395",
"0.8225791",
"0.8176045",
"0.8126391",
"0.80690956",
"0.8060906",
"0.80385435",
"0.80385435",
"0.80350095",
"0.80350095",
"0.80350095",
"0.80350095",
"0.80350095",
"0.8000414",
"0.79693323",
"0.79693323",
"0.79693323",
"0.79693323",
"0.79693323",
"0... | 0.0 | -1 |
Return a representation of the object. | def __repr__(self):
return f'QChem("{self.filename}")' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def __repr__(self) -> str:\n return str(self.as_dict())",
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __repr__(self):\n return json.dumps(self.__dict__)",
"def __repr__(self):\n ... | [
"0.78727806",
"0.7668644",
"0.76516104",
"0.75705904",
"0.7518613",
"0.7518613",
"0.7518613",
"0.7518613",
"0.7518613",
"0.7506125",
"0.74930704",
"0.74640274",
"0.7457539",
"0.74347013",
"0.74347013",
"0.74347013",
"0.74347013",
"0.74347013",
"0.74347013",
"0.74347013",
"0.7... | 0.0 | -1 |
Convert a pair of lat lon positions into a distance in km | def distance_between(alat, alon, blat, blon):
alat, alon = radians(90-alat), radians(alon)
blat, blon = radians(90-blat), radians(blon)
return 6373*acos(sin(alat)*sin(blat)*cos(alon-blon) + cos(alat)*cos(blat)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def coord_distance(lat1, lon1, lat2, lon2):\n\tlon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])\n\tdlon = lon2 - lon1\n\tdlat = lat2 - lat1\n\ta = math.sin(dlat/2)**2 + m... | [
"0.7862896",
"0.77781653",
"0.7752016",
"0.7601808",
"0.7546006",
"0.753103",
"0.74930495",
"0.74871093",
"0.7483002",
"0.74704474",
"0.7453147",
"0.7449646",
"0.7433407",
"0.74319607",
"0.74064964",
"0.73734385",
"0.7366901",
"0.7339194",
"0.7312129",
"0.730171",
"0.72736776... | 0.0 | -1 |
True if course is considered a Core Academic Course | def is_core(self):
#core_stems = (
# 'Algebra','Geometry','Precalculus','Calculus',
# 'Biology','Chemistry','Physics','Living Environment','Global Environment','Scientific Literacy',
# 'History','Economics',
# 'Literature','Lang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isCourseObject(self):\n return 'Course' == self.ecparent.Type()",
"def course_tester(courses):\n\n return False",
"def is_enrolled(self, course):\n return bool(\n self.enrolled_courses_dict.get(course.get_namespace_name()))",
"def is_course_full(cls, course):\r\n is_cou... | [
"0.718495",
"0.6590688",
"0.6482167",
"0.64129263",
"0.637382",
"0.6337961",
"0.62835747",
"0.626792",
"0.6255688",
"0.62330747",
"0.621149",
"0.6073171",
"0.60359013",
"0.5897468",
"0.58175325",
"0.58106095",
"0.57848215",
"0.57738537",
"0.57647055",
"0.57363135",
"0.5731337... | 0.6216859 | 10 |
Implement a simple turtle race from left to right across the screen. | def turtle_race():
# Create the turtle screen and two turtles (leave this as the first line).
screen, artist, writer = turtle_setup()
# Rename the artist turtle and move her to the left, above the x-axis.
flojo = artist # Flo-Jo, https://en.wikipedia.org/wiki/Florence_Griffith_Joyner
flojo.shape( ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_flower():\n turtle.right(45)\n draw_petal()\n turtle.right(90)\n draw_petal()\n turtle.right(90)\n draw_petal()\n turtle.right(90)\n draw_petal()\n turtle.right(135)\n turtle.forward(150)",
"def go_right(self):\n self.change_x = 6\n self.direction = \"R\"",
... | [
"0.6429608",
"0.6391551",
"0.63859105",
"0.63802904",
"0.63802904",
"0.6367157",
"0.63617444",
"0.6279238",
"0.6279238",
"0.6243669",
"0.6204914",
"0.618821",
"0.6181678",
"0.616414",
"0.61473113",
"0.6145319",
"0.6131757",
"0.6068427",
"0.60508084",
"0.6042987",
"0.6021478",... | 0.70222795 | 0 |
Create a new node and inserts it at the front of the linked list | def add_front(self, key, value):
new_node = SLNode(key, value)
new_node.next = self.head
self.head = new_node
self.size = self.size + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_front(self, item):\n new_node = Node(item)\n # if the list is empty, make it head\n if self.head is None:\n self.head = new_node\n # else, \n else:\n new_node.next = self.head # new node points to current head\n self.head = new_node # c... | [
"0.7992858",
"0.76557714",
"0.7524217",
"0.75176823",
"0.7515608",
"0.74362546",
"0.74095976",
"0.7407693",
"0.7351683",
"0.7339363",
"0.73086447",
"0.73081934",
"0.7290364",
"0.7285901",
"0.7282208",
"0.7256946",
"0.72559303",
"0.72386116",
"0.72063273",
"0.71860677",
"0.717... | 0.74541277 | 6 |
This function will normalize, removed stop words, stemmed and lemmatized. Returns tokenized text | def tokenize(self, text):
# Normalize text
text = re.sub(r"[^a-zA-Z0-9]", " ", text.lower())
# Tokenize text
tokens = word_tokenize(text)
# Remove stop words
tokens = [t for t in tokens if t not in stopwords.words("english")]
# Lemmatization
lemmatizer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n tokens=word_tokenize(text)\n lemmatizer=WordNetLemmatizer()\n \n clean_tokens=[]\n for tok in tokens:\n clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n clean_tokens.append(clean_tok)\n return clean_tokens\n pass",
"def tokenize(text):\n text = t... | [
"0.81024426",
"0.80733",
"0.7949768",
"0.7946409",
"0.7930924",
"0.7910222",
"0.7904825",
"0.78997177",
"0.78628385",
"0.7858766",
"0.7858766",
"0.7851632",
"0.7827027",
"0.7807884",
"0.77340424",
"0.77021724",
"0.7699626",
"0.76809967",
"0.7667121",
"0.7662281",
"0.76592153"... | 0.7954637 | 2 |
Parses out google3 local path from an absolute path. | def GetGoogle3RelativePath(path):
m = GOOGLE3_REGEX.match(path)
if m is not None:
return m.group(1)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local(path):\n path = os.path.abspath(path)\n if os.path.isfile(path):\n return LocalFile(path)\n if os.path.isdir(path):\n return LocalFolder(path)\n raise ValueError(\"%s does not exist\" % path)",
"def _get_local_src(self, path: Path) -> Path:\n src = \"\"\n\n i... | [
"0.6306311",
"0.62214494",
"0.59694207",
"0.58396584",
"0.5780124",
"0.5757819",
"0.5695508",
"0.56870645",
"0.5640389",
"0.55895644",
"0.55783916",
"0.5570131",
"0.5569178",
"0.5562918",
"0.55616754",
"0.55506533",
"0.55393857",
"0.5526783",
"0.5526783",
"0.54895216",
"0.548... | 0.7614583 | 0 |
A setter to set the character name | def characterName(self, characterName):
self._characterName = characterName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_character_name(self, character_name):\n self.name = character_name",
"def set_character(self, character):\n self.character = character",
"def setName(self,value):\n assert value == None or type(value) == str, repr(value)+' is not a valid name'\n self._name = value",
"def s... | [
"0.8789265",
"0.7185645",
"0.7170966",
"0.7157089",
"0.7122759",
"0.7013169",
"0.69969946",
"0.6841874",
"0.6794544",
"0.6794544",
"0.67822695",
"0.67822695",
"0.67822695",
"0.67822695",
"0.67647344",
"0.6720245",
"0.67188686",
"0.67093676",
"0.66969556",
"0.66964334",
"0.668... | 0.80855274 | 1 |
Reads layout from json file | def read_layout(outFile=None, linked=False, append=False):
from cgl.plugins.blender.lumbermill import scene_object, LumberObject, import_file
from cgl.core.utils.read_write import load_json
import bpy
if outFile == None:
outFileObject = scene_object().copy(ext='json', task='lay', user='publish'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadJson (self, path):\n\n # get all lines in json, concatenate then into a big string then parse it\n with open(path, \"r\") as file_content:\n all_lines = file_content.readlines()\n all_content_str = \"\".join(all_lines)\n json_dict = json.loads(all_content_str)... | [
"0.63289076",
"0.5966606",
"0.592646",
"0.5900032",
"0.58867663",
"0.5885637",
"0.58519465",
"0.58294666",
"0.58218426",
"0.5816248",
"0.5809441",
"0.58092374",
"0.5786234",
"0.5767316",
"0.57420963",
"0.57311535",
"0.5718361",
"0.57155836",
"0.5711147",
"0.5707128",
"0.57003... | 0.0 | -1 |
Fetch the global object of ConfigHandler. | def get_config_handler():
global config_handler
# This is to ensure that incase the initial setup
# of config handler failed,
return config_handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__con... | [
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023",
"0.71949023"... | 0.77860075 | 0 |
Return the access key for the account user. | def get_access_key():
return get_config_handler().get_access_key() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_key\")",
"def access_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_key\")",
"def get_api_key_from_user_id(self, user_id: str) -> str:\n response = self.get(self.url + \"/my-account\", params... | [
"0.7420857",
"0.73051786",
"0.72092587",
"0.7199931",
"0.7013371",
"0.70037043",
"0.6844681",
"0.6792196",
"0.6767326",
"0.67521733",
"0.66578096",
"0.66578096",
"0.6590052",
"0.6585067",
"0.6519433",
"0.6435639",
"0.6419223",
"0.6366738",
"0.63539565",
"0.63518226",
"0.63136... | 0.7312752 | 1 |
Return the access key for the account user. | def get_service_url():
return get_config_handler().get_service_url() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_key\")",
"def get_access_key():\n return get_config_handler().get_access_key()",
"def access_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_key\")",
"def get_api_key_from_user_id(self, user_id:... | [
"0.7424534",
"0.7316149",
"0.73080844",
"0.72069657",
"0.720372",
"0.7016445",
"0.700141",
"0.6847496",
"0.6794899",
"0.67669284",
"0.6752762",
"0.6659735",
"0.6659735",
"0.6587564",
"0.6585039",
"0.65165305",
"0.64383477",
"0.6416174",
"0.6364119",
"0.6352004",
"0.6351022",
... | 0.0 | -1 |
Check if uuid_to_test is a valid UUID. | def is_valid_uuid(uuid_to_test, version=4):
try:
uuid_obj = UUID(uuid_to_test, version=version)
return True
except:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_uuid(uuid_to_test, version=4):\n\n try:\n uuid_obj = UUID(uuid_to_test, version=version)\n except ValueError:\n return False\n return str(uuid_obj) == uuid_to_test",
"def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n re... | [
"0.856201",
"0.8333562",
"0.81566405",
"0.8037443",
"0.80285954",
"0.79438263",
"0.7737565",
"0.7735353",
"0.7735353",
"0.7624127",
"0.7594492",
"0.75570476",
"0.7150848",
"0.7110522",
"0.69539124",
"0.69253844",
"0.6689126",
"0.6688008",
"0.6663205",
"0.6656687",
"0.66413414... | 0.86852235 | 0 |
Returns a datetime of the next day of the week. | def next_day_of_week(current, day_of_week):
while current.weekday() != day_of_week:
current += timedelta(1)
return current | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_seven_day(self):\n today = datetime.date.today()\n week_next = today + datetime.timedelta(days=7)\n return week_next.strftime('%Y-%m-%d')",
"def get_next_weekend():\n d = datetime.date.today()\n # day 5 for saturday\n t = datetime.timedelta((7 + 5 - d.weekday()) % 7)\n r... | [
"0.78101915",
"0.77943146",
"0.7647407",
"0.7647407",
"0.76107144",
"0.7563299",
"0.7427946",
"0.73666096",
"0.73392856",
"0.72860914",
"0.72560734",
"0.7177408",
"0.70775145",
"0.6933132",
"0.6790459",
"0.6577945",
"0.6473751",
"0.64352036",
"0.64352036",
"0.6390388",
"0.638... | 0.7930185 | 0 |
Perform forward, backward and gradient descent step here. The function is called once for every batch (see trainer.py) to perform the train step. The function returns the mean loss value which is then automatically logged in our variable self.train_history. | def train_step(self, X_batch: np.ndarray, Y_batch: np.ndarray):
# Almost the same as previous task, calculates the cross entropy loss for multiple classes using the softmax loss equation provided in the assignment.
targets = Y_batch
outputs = self.model.forward(X_batch)
self.model.backw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def training_step(self, train_batch, batch_idx):\n x, y = train_batch\n logits = self.forward(x)\n loss = self.nll_loss(logits, y)\n logs = {\"train_loss\": loss}\n return {\"loss\": loss, \"log\": logs}",
"def training_step(self, train_batch, batch_idx):\n x, y = train_... | [
"0.72399986",
"0.7226812",
"0.71466047",
"0.7112469",
"0.7109423",
"0.7094328",
"0.70851207",
"0.7064775",
"0.70561963",
"0.6967799",
"0.6951023",
"0.693233",
"0.6927034",
"0.6910866",
"0.6894351",
"0.6894319",
"0.6873195",
"0.68572617",
"0.6836661",
"0.683643",
"0.6825336",
... | 0.70781666 | 7 |
Compares two Relay types by referential equality. | def same_as(self, other):
return super().__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\r\n\r\n return type(self) == type(other) and self.ttype == other.ttype",
"def _is_equal_same_type(self, other):\n return True",
"def __eq__(self, other):\n return type(self) == type(other) and self.node is other.node",
"def __eq__(self, other):\r\n\t\treturn... | [
"0.6598956",
"0.65034163",
"0.6409711",
"0.63498235",
"0.6346446",
"0.6276831",
"0.627437",
"0.6270207",
"0.62475944",
"0.6180235",
"0.6176883",
"0.6176883",
"0.6176883",
"0.6176883",
"0.6176883",
"0.6175577",
"0.6099658",
"0.6098708",
"0.6098465",
"0.6098465",
"0.6062067",
... | 0.6093609 | 20 |
Function enables a user to fetch a single question from the platform using the questionId by checking if that id corresponds to any question in the list in which case it returns a success message with the question that has been fetched. In a case where the question id does not match, an error message is returned statin... | def get_one_question(questionId):
try:
if len(questions) < 0:
return jsonify({
'message': 'You have no questions yet.'
}), 400
question = questions[questionId - 1]
# ans = filter(lambda a: a['questionId'] == questionId, answers)
return jsonify(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_specific_question(self, question_id):\n\n question = self.sql.fetch_details_by_criteria(\n \"question_id\", question_id, \"questions\")\n\n response, status = \"\", 200\n\n if not question:\n\n return self.makeresp(\"Question not found\", 404)\n\n user = ... | [
"0.73691463",
"0.69522274",
"0.6244807",
"0.6244641",
"0.61873055",
"0.61862487",
"0.6172777",
"0.6076735",
"0.60689384",
"0.5953759",
"0.59042364",
"0.58929026",
"0.58474535",
"0.58026195",
"0.56773794",
"0.5616859",
"0.561123",
"0.55795896",
"0.5570631",
"0.5532885",
"0.547... | 0.738922 | 0 |
Computes a mask defining if pixels are warped outside the image domain, or if they fall into a fixed image mask or a warped moving image mask. | def GetCurrentMask(self, displacement):
# exclude points which are transformed outside the image domain
mask = th.zeros_like(self._fixed_image.image, dtype=th.uint8, device=self._device)
for dim in range(displacement.size()[-1]):
mask += displacement[..., dim].gt(1) + displacement[..... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_masks(masks):\n masks = ee.List(masks) if isinstance(masks, list) else masks\n first = ee.Image.constant(0)\n\n def compute(mask, first):\n first = ee.Image(first)\n return first.Or(mask)\n\n bad_pixels = ee.Image(masks.iterate(compute, first))\n good_pixels = bad_pixels.Not(... | [
"0.6479739",
"0.6294556",
"0.6294556",
"0.6250249",
"0.6226467",
"0.6156257",
"0.60894936",
"0.6082597",
"0.6061726",
"0.6018818",
"0.60117364",
"0.5979352",
"0.59732443",
"0.59689766",
"0.59639883",
"0.59633493",
"0.595583",
"0.5948956",
"0.5925771",
"0.58756775",
"0.5871246... | 0.69207907 | 0 |
Sets the indentation level and character offset. | def _SetIndentation(self, level, bullet=False):
if self._level < level:
# Level increases are strictly 1 at a time.
if level >= len(self._indent):
self._indent.append(0)
indent = self._INDENT
if bullet and level > 1:
# Nested bullet indentation is less than normal indent for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_indent_level(self, indent_level):\n self.indent_level = indent_level",
"def indentation(self, indent: str) -> None:\n self._indent = indent\n self._update()",
"def indent(self, increment=1):\n # increase the indentation level\n self._level += increment\n # and ... | [
"0.7216636",
"0.6266022",
"0.619705",
"0.6172949",
"0.6156947",
"0.6122159",
"0.6122159",
"0.6028613",
"0.60271084",
"0.59835124",
"0.58960444",
"0.589379",
"0.58368784",
"0.576356",
"0.5740775",
"0.5717026",
"0.56345135",
"0.5615231",
"0.5604845",
"0.56005645",
"0.5586833",
... | 0.69743425 | 1 |
Returns if user is admin. | def is_admin(self):
return self.admin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False",
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_admin(self):\n if not self.current_user:\n ... | [
"0.8897804",
"0.88507414",
"0.8760365",
"0.86509454",
"0.8615862",
"0.85861737",
"0.85325634",
"0.8527266",
"0.8511907",
"0.8504027",
"0.8492033",
"0.8486194",
"0.8450879",
"0.8450879",
"0.83993834",
"0.83910316",
"0.8342812",
"0.8325723",
"0.832202",
"0.83064276",
"0.8306231... | 0.85829705 | 6 |
Generates a random MAC address. Used when dynamic addressing is not possible (logical router ports for example). | def random_mac():
return '"02:%02x:%02x:%02x:%02x:%02x"' % (random.randint(0,255),
random.randint(0,255),
random.randint(0,255),
random.randint(0,255),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_random_mac_addr(self):\n return \"02:00:00:%02x:%02x:%02x\" % (random.randint(0, 255),\n random.randint(0, 255),\n random.randint(0, 255))",
"def get_random_mac():\n\t\n\t# use the Dlink range\n\tmac = \"00:... | [
"0.89214003",
"0.8686625",
"0.86699736",
"0.81266034",
"0.80781543",
"0.80781543",
"0.7650509",
"0.75559175",
"0.72565866",
"0.7081184",
"0.6914509",
"0.67026085",
"0.66142476",
"0.6564345",
"0.65477747",
"0.6526881",
"0.6507412",
"0.64886993",
"0.64590484",
"0.6441847",
"0.6... | 0.8513976 | 3 |
This function will return a random datetime between two datetime objects. | def random_date(start, end):
delta = end - start
int_delta = (delta.days * 24 * 60 * 60) + delta.seconds
random_second = randrange(int_delta)
return start + timedelta(seconds=random_second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date(start, end):\r\n return start + datetime.timedelta(\r\n # Get a random amount of seconds between `start` and `end`\r\n seconds=random.randint(0, int((end - start).total_seconds())),\r\n )",
"def random_date(start, end):\n delta = end - start\n int_delta = (delta.days * 2... | [
"0.7793104",
"0.7563482",
"0.75460297",
"0.75308543",
"0.7510594",
"0.7510594",
"0.7510594",
"0.7510594",
"0.7510594",
"0.7405867",
"0.7335943",
"0.723639",
"0.720883",
"0.7170567",
"0.6946398",
"0.6861816",
"0.67524296",
"0.66049016",
"0.6575737",
"0.652601",
"0.6250336",
... | 0.7565675 | 1 |
Gives rating to auctionable resource. Returns 1 if positive, 0 if negative | def coil_enter_auction_rating(auction_agent_df, agent_df, not_enterted_auctions):
auction_agent_df = auction_agent_df[['T1', 'T2', 'T3', 'T4', 'T5']]
a = auction_agent_df.isnull().sum().sum()
if int(not_enterted_auctions) > int(6): # in case this coil did not enter auctions for more than 20 times, it wi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rating(self):\n if not (self.votes and self.score):\n return 0\n return float(self.score)/(self.votes+self.field.weight)",
"def rate_item(self, trans, user, item, rating, comment=''):\n item_rating = self.get_user_item_rating(trans.sa_session, user, item, webapp_model=tran... | [
"0.66756326",
"0.6316767",
"0.6297828",
"0.6190548",
"0.61292726",
"0.6021463",
"0.60006475",
"0.5971721",
"0.5965942",
"0.5951076",
"0.59502786",
"0.5928521",
"0.5913096",
"0.58719224",
"0.58341634",
"0.582897",
"0.58202094",
"0.58201325",
"0.5817831",
"0.58012205",
"0.57966... | 0.0 | -1 |
Same as Pandas.io.sql.read_frame, except it takes params for binding Returns a DataFrame corresponding to the result set of the query string. Optionally provide an index_col parameter to use one of the columns as the index. Otherwise will be 0 to len(results) 1. | def from_sql(con, sql, params=(), index_col=None, coerce_float=True, l_select=None):
cur = con.cursor()
# we assum sql statement is always using '?' style binding
# need to convert that into Oracle style if it's Oracle
pattern=re.compile(r'\?')
db_src=db_type(con)
if type(params) not in (list, t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataframe(q):\n cnx = create_engine(postgres_str)\n query = q\n return pd.read_sql_query(query, cnx)",
"def read_query(self, sql, index_col=None, coerce_float=True, parse_dates=None, \n params=None, chunksize=None):\n args = _convert_pa... | [
"0.6529991",
"0.64610094",
"0.6379069",
"0.6114378",
"0.611369",
"0.6042731",
"0.59480786",
"0.59421355",
"0.5912953",
"0.5814379",
"0.5766525",
"0.57502353",
"0.5631585",
"0.5607742",
"0.55506474",
"0.5519669",
"0.55180144",
"0.5511958",
"0.55060846",
"0.54758674",
"0.547043... | 0.60359484 | 6 |
Performs stochastic gradient descent using initial parameters and given | def stochastic_gradient_descent(y, tx, initial_w, max_iters, gamma, compute_loss, compute_grad,
batch_size=1, verbose=False):
w = initial_w.copy()
loss = 0
for n_iter, (minibatch_y, minibatch_tx) in \
enumerate(batch_iter(y, tx, batch_size, num_batches=max_iters... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stochastic_gradient_descent(y, tx, initial_w, batch_size, max_iters, gamma):\n\n # Define parameters to store w and loss\n ws = [initial_w]\n losses = []\n w = initial_w\n\n for n_iter in range(max_iters):\n\n # ***************************************************\n # INSERT YOUR CO... | [
"0.7209267",
"0.713662",
"0.71055186",
"0.7081791",
"0.7023867",
"0.6984415",
"0.6960176",
"0.68958515",
"0.6844859",
"0.684484",
"0.68050444",
"0.67910784",
"0.67890865",
"0.6759243",
"0.6744365",
"0.67344147",
"0.6726008",
"0.6695113",
"0.6689834",
"0.6655257",
"0.6630171",... | 0.70961547 | 3 |
Logistic regression using gradient descent | def logistic_regression(y, tx, initial_w, max_iters, gamma, verbose=False):
return gradient_descent(y, tx, initial_w, max_iters, gamma,
compute_logistic_loss, compute_logistic_gradient, verbose=verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logit_cost_grad(self, theta, X, y):\n\n grad = np.zeros(len(theta))\n\n ### YOUR CODE HERE\n sig = utils.sigmoid(theta)\n # sig = np.subtract(sig, y)\n sig = sig - y\n grad = np.dot(X.T, sig) + 2 * self.params['lamb'] * self.regularizer[1](self.weights)\n ### EN... | [
"0.7683251",
"0.76300657",
"0.755224",
"0.7487062",
"0.7340621",
"0.7301625",
"0.7280634",
"0.7277446",
"0.7258249",
"0.7253478",
"0.7249984",
"0.7247254",
"0.7238215",
"0.7232508",
"0.7188665",
"0.71744543",
"0.7170769",
"0.715796",
"0.7136113",
"0.7134905",
"0.7132616",
"... | 0.7806816 | 0 |
Takes and dataset and returns a standardized dataset, a mean, and a std. dev. If no mean/std is passed to the function, the metrics are calulated on the dataset. Standardizing is done by subtracting the mean and dividing by the std. dev for each column, | def standardize(x, mean=None, std=None):
mean = mean if mean is not None else x.mean(axis=0)
std = std if std is not None else x.std(axis=0)
return (x - mean) / std, mean, std | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(data):\r\n mean = data.mean(axis=0)\r\n std = data.std(axis=0)\r\n return (data - mean)/std",
"def normalize_standard_deviation(dataset):\n return dataset*(1/np.std(dataset))",
"def standardize(data):\n stddev = data.std()\n #if stddev == 0.:\n # sys.exit(\"data.std() =... | [
"0.8044537",
"0.7705899",
"0.7636773",
"0.74006444",
"0.73481596",
"0.7330528",
"0.72901237",
"0.72275555",
"0.7216248",
"0.71954894",
"0.7172761",
"0.70657367",
"0.7063394",
"0.7032338",
"0.7032207",
"0.70064545",
"0.6980215",
"0.6951935",
"0.69495505",
"0.69495505",
"0.6924... | 0.77502257 | 1 |
Returns a list of GC along the DNA sequence given a DNA sequence and the size of the sliding window | def gc_content_along_the_chain(dna_sequence, window_size):
sub_sequences = extract_sub_sequences(dna_sequence, window_size)
gc_results = []
for sub_sequence in sub_sequences:
gc_results.append(gc_content(sub_sequence))
return gc_results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gc_sliding(self, window=500):\n\n gc_res = []\n\n # Get contigID for each window position\n labels, xbars = self._get_window_labels(window)\n\n # Get complete sequence to calculate sliding window values\n complete_seq = \"\".join(self.contigs.values()).lower()\n\n ... | [
"0.73284394",
"0.68191457",
"0.67010045",
"0.65568155",
"0.6364963",
"0.62408805",
"0.6097348",
"0.5990865",
"0.5980615",
"0.59394646",
"0.5878013",
"0.58654106",
"0.57809514",
"0.57543194",
"0.56926984",
"0.56799173",
"0.5627238",
"0.55715406",
"0.5540355",
"0.5535345",
"0.5... | 0.795195 | 0 |
Find starting value for optimization lambda. To prevent the lambdaoptimizer from ending in a local minimum, calculate evidence for a widerange of loglambda values so that approximate value of minimum can be determined. | def __findStartValue(self):
self.minEvidence = 1e120*np.ones(self.nStartValues)
for idx1 in range(self.nStartValues):
self.minEvidence[self.nStartValues-1-idx1] = self.__minBayesianEvidence(self.logLamStart[self.nStartValues-1-idx1])
# If minEvidence > 1e100 a negative value has been found for wMP which
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __bestLambda(self):\n\t\t\n\t\t# Determine starting value for brent-method (to avoid local minimum).\n\t\tself.startValue = self.__findStartValue()\n\t\t\t\n\t\t# Check if there exists a minimum within the range of self.lamStart. \n\t\t# Otherwise, use fmin because we cannot provide an interval. \n\t\tif (self... | [
"0.77420306",
"0.66637987",
"0.6014424",
"0.5927075",
"0.5783607",
"0.57586443",
"0.57470024",
"0.5738404",
"0.57264906",
"0.5723465",
"0.5698741",
"0.5691256",
"0.56847227",
"0.56690526",
"0.56555545",
"0.56503403",
"0.56182885",
"0.55806696",
"0.554213",
"0.5515114",
"0.550... | 0.8254801 | 0 |
Compute my distance from the origin | def distance_from_origin(self):
return ((self.x ** 2) + (self.y ** 2)) ** 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) **0.5",
"def distance_to_origin(self):\n return np.sqrt(self.x ** 2 + self.y ** 2)",
"def distance_from_origin(self) -> float:\n return self._distance_from_origin",
"def distanceFromOrigin(self):\n return ((sel... | [
"0.8565058",
"0.84973544",
"0.8323514",
"0.8296796",
"0.8215572",
"0.7732662",
"0.74226093",
"0.7381035",
"0.7292783",
"0.7264896",
"0.72594285",
"0.7255858",
"0.72473836",
"0.7230952",
"0.7207537",
"0.7149636",
"0.7141725",
"0.71386373",
"0.7136102",
"0.7132502",
"0.71323717... | 0.85663384 | 4 |
Return the halfway point between myself and the target | def halfway(self, target):
mx = (self.x + target.x) / 2
my = (self.y + target.y) / 2
return Point(mx, my) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halfway(self, target):\r\n mx = (self.x + target.x)/2\r\n my = (self.y + target.y)/2\r\n return Point(mx, my)",
"def halfway(self, target):\n mx = (self.x + target.x)/2\n my = (self.y + target.y)/2\n return Point(mx, my)",
"def halfway(self, target):\n mx = ... | [
"0.87881154",
"0.87804437",
"0.87804437",
"0.87804437",
"0.7259463",
"0.6758766",
"0.65792817",
"0.6313983",
"0.6158496",
"0.6015091",
"0.5987895",
"0.58925045",
"0.5864899",
"0.5864066",
"0.58579016",
"0.5839627",
"0.58203584",
"0.58011335",
"0.5798595",
"0.5789876",
"0.5784... | 0.87390566 | 4 |
Returns the booking for this vehicle at the specified time, or None if it is not booked | def get_booking_at(self, datetime):
for booking in self.booking_set.all():
if booking.schedule_start <= datetime < booking.schedule_end and not booking.is_cancelled():
return booking
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consultation_booking_query(self, cid, sid, time, date):\n if not self.check_course_exist(cid):\n return ConsultationError.INVALID_COURSE.value\n is_weekday, feedback = self.check_weekday(date)\n time = self.round_time(time)\n if is_weekday:\n try:\n ... | [
"0.59419656",
"0.5900521",
"0.54695857",
"0.5356685",
"0.53330183",
"0.5315499",
"0.5301539",
"0.52482957",
"0.522441",
"0.51650226",
"0.5115044",
"0.51087815",
"0.5103097",
"0.49631387",
"0.4931431",
"0.49238187",
"0.49167684",
"0.4915736",
"0.48982537",
"0.48967505",
"0.488... | 0.76903594 | 0 |
Creates an empty Stack with a fixed capacity | def __init__(self, capacity=2):
self._capacity = capacity
self._data = [0] * self._capacity
self._size = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_empty_stack():\n return Stack(0, None)",
"def create_stack():\n\n return Stack()",
"def create(self):\n if self.size == 0:\n self.size = int(input(\"Enter size of the stack to be created: \"))\n self.arr = [None] * self.size",
"def initstack(st_size):\r\n stack = []\r... | [
"0.8270082",
"0.719738",
"0.707812",
"0.70511115",
"0.6646839",
"0.6600815",
"0.63275594",
"0.62746406",
"0.61743385",
"0.6028601",
"0.6001284",
"0.5986815",
"0.5966191",
"0.5928012",
"0.5922859",
"0.5887357",
"0.5874708",
"0.58495134",
"0.5834894",
"0.5789751",
"0.57759565",... | 0.5824756 | 19 |
Returns True if the stack is empty | def is_empty(self):
return self._size == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False",
"def empty(self):\r\n return len(self.stack) == 0",
... | [
"0.9332867",
"0.92789197",
"0.9274068",
"0.92656803",
"0.92286783",
"0.92286783",
"0.92080474",
"0.9207467",
"0.91589785",
"0.90660965",
"0.9035021",
"0.8994494",
"0.89741784",
"0.89704764",
"0.89704764",
"0.8956348",
"0.893535",
"0.892253",
"0.8907522",
"0.8895873",
"0.88494... | 0.7589674 | 77 |
Adds an item to the top of the stack | def push(self, addition):
if self._size < self._capacity:
self._data[self._size] = addition
self._size += 1
else:
self.grow()
self.push(addition) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item):\r\n self.stack.insert(0, item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n # Reassign the link to top of the stack and update the\n self.top = [item] + self.top",
"d... | [
"0.85849726",
"0.82373846",
"0.82373846",
"0.81803393",
"0.8018804",
"0.79732704",
"0.79623485",
"0.79289365",
"0.78603554",
"0.7773772",
"0.7710631",
"0.7663574",
"0.7630123",
"0.7595881",
"0.75826687",
"0.75599563",
"0.7555494",
"0.7522195",
"0.74593717",
"0.7437966",
"0.73... | 0.0 | -1 |
Removes and returns the top item from the stack Does nothing if stack is empty Reduces stack size if number of items is half capacity | def pop(self):
if not self.is_empty():
half_cap = self._capacity // 2
item = self._data[self._size-1]
self._data[self._size-1] = 0
self._size -= 1
if self._size <= half_cap:
if half_cap != 0:
self.shr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(stack):\n item = top(stack)\n stack.top = stack.top.next\n stack.size = stack.size - 1\n return item",
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n ... | [
"0.81985193",
"0.8195566",
"0.80072707",
"0.78869426",
"0.7870224",
"0.7843244",
"0.7791167",
"0.7682353",
"0.7678646",
"0.7655905",
"0.7638873",
"0.76052153",
"0.75751585",
"0.7561257",
"0.7553124",
"0.75441587",
"0.75285906",
"0.7483013",
"0.747193",
"0.74694425",
"0.745156... | 0.724026 | 47 |
Returns, but does not remove, the top item from the stack. Does nothing if stack is empty | def top(self):
if self.is_empty():
pass
else:
return self._data[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(stack):\n item = top(stack)\n stack.top = stack.top.next\n stack.size = stack.size - 1\n return item",
"def top(self):\n try:\n if self.size() > 0:\n return self.items[len(self.items) - 1]\n else:\n raise IndexError('Cannot get top it... | [
"0.8363948",
"0.833831",
"0.82095796",
"0.8202316",
"0.816675",
"0.81659234",
"0.8080214",
"0.8031014",
"0.8027596",
"0.7984854",
"0.793684",
"0.78891253",
"0.7875137",
"0.7862273",
"0.78483224",
"0.7814423",
"0.7807021",
"0.7788942",
"0.7781021",
"0.7769384",
"0.77349144",
... | 0.0 | -1 |
Build an actor (policy) network that maps states > actions. | def forward(self, state):
x = F.relu(self.fc1(state))
x = F.relu(self.fc2(x))
x = F.relu(self.fc3(x))
x = F.relu(self.fc4(x))
return F.tanh(self.fc5(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ... | [
"0.69359016",
"0.6364094",
"0.626973",
"0.62094635",
"0.620179",
"0.6186583",
"0.6146872",
"0.61468554",
"0.612835",
"0.60188985",
"0.6001306",
"0.5977953",
"0.5961626",
"0.5953903",
"0.5950408",
"0.59300184",
"0.5915341",
"0.5897457",
"0.5893305",
"0.58928853",
"0.588037",
... | 0.0 | -1 |
return FFmpeg static path | def return_static_ffmpeg():
path = ''
if os.name == 'nt':
path += os.path.join(os.environ['USERPROFILE'],'Downloads/FFmpeg_static/ffmpeg/bin/ffmpeg.exe')
else:
path += os.path.join(os.environ['HOME'],'Downloads/FFmpeg_static/ffmpeg/ffmpeg')
return os.path.abspath(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_path_to_front_end():\n dpath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'fe')\n log(\"Front-end static files @ {0}\".format(dpath))\n\n return dpath",
"def path_static():\n return os.path.abspath(os.path.dirname(__file__))+'/_static'",
"def static(path):\n ... | [
"0.6349937",
"0.63496566",
"0.6244722",
"0.6190559",
"0.6190559",
"0.61846644",
"0.612303",
"0.60095847",
"0.5934745",
"0.5917884",
"0.590562",
"0.58003664",
"0.57960093",
"0.5783576",
"0.5749033",
"0.5738181",
"0.5724431",
"0.572331",
"0.56799066",
"0.5675679",
"0.56488484",... | 0.84150594 | 0 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def pretty_date(time=None):
now = datetime.now()
if type(time) is int:
diff = now - datetime.fromtimestamp(time)
elif isinstance(time, datetime):
diff = now - time
elif not time:
diff = now - now
second_diff = diff.seconds
day_diff = diff.days
if day_diff < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.7883249",
"0.77363366",
"0.77084684",
"0.7691332",
"0.7648346",
"0.75148964",
"0.71024424",
"0.6906198",
"0.68916905",
"0.68408394",
"0.68116295",
"0.6655602",
"0.6655102",
"0.66546637",
"0.66209096",
"0.65855974",
"0.6553067",
"0.65279335",
"0.65135163",
"0.65026283",
"0.... | 0.6819872 | 10 |
Return a resource representing all visible executions of this workflow. | def executions(self) -> PredictorEvaluationExecutionCollection:
if getattr(self, 'project_id', None) is None:
raise AttributeError('Cannot initialize execution without project reference!')
return PredictorEvaluationExecutionCollection(
project_id=self.project_id, session=self._se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execution_all(request, format=None):\n if request.method == 'GET':\n executions = Execution.objects.all()\n serializer = ExecutionSerializer(executions, many=True)\n return Response(serializer.data)",
"def activities(self):\r\n return resources.Activities(self)",
"def get_con... | [
"0.63231176",
"0.63160175",
"0.58076274",
"0.5729084",
"0.5699504",
"0.5682006",
"0.5661524",
"0.5661524",
"0.5661524",
"0.56301934",
"0.56222004",
"0.5589843",
"0.55617183",
"0.5553011",
"0.5551858",
"0.5511983",
"0.54540217",
"0.5448445",
"0.5412478",
"0.54087186",
"0.54068... | 0.5700279 | 4 |
The last use group in `Map` batch. This is useful in case any Sprite is added to the `Map` to be drawn by the Map's batch without being managed by the Map. Using this value plus one will ensure the sprite will be drawn over the map. | def last_group(self):
return BaseLayer.groups-1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_bottom(group: pygame.sprite.Group):\r\n return max(map(lambda sprt: sprt.rect.bottom, group), default=0)",
"def group_bottom_sprites(group: pygame.sprite.Group):\r\n bottom = max(map(lambda sprt: sprt.rect.bottom, group), default=RESOLUTION[1])\r\n return list(filter(lambda sprt: sprt.rect.bot... | [
"0.65593183",
"0.58752656",
"0.5329335",
"0.5299459",
"0.5269572",
"0.5208592",
"0.5175771",
"0.5153515",
"0.5054316",
"0.5046924",
"0.50452846",
"0.49708056",
"0.49700668",
"0.4964859",
"0.49513927",
"0.49465606",
"0.49465606",
"0.49465606",
"0.49465597",
"0.49399558",
"0.49... | 0.70135885 | 0 |
Determines whether or not one intersection value is equal to another. Normally, callers will use this to determine whether or not the closest intersection and the closest major are the same. | def isEqual (self, other) :
return self.id == other.getIdent () | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_equal(self, a, b):\n return a.X[0] == b.X[0]",
"def values_eq(self, a, b):\r\n return a == b",
"def is_identical(self, other):\n return (self.compounddatatype == other.compounddatatype and\n self.min_row == other.min_row and\n self.max_row == other.max_... | [
"0.63534296",
"0.62813824",
"0.61804295",
"0.6088173",
"0.6060158",
"0.60358936",
"0.6016147",
"0.6000966",
"0.59910405",
"0.59635377",
"0.5962275",
"0.5944339",
"0.5941936",
"0.5939863",
"0.5929116",
"0.59159565",
"0.59159565",
"0.5907115",
"0.5906119",
"0.58943236",
"0.5885... | 0.0 | -1 |
Convenience function to transpose a convolutional layer and use weight tying | def transpose(incoming, conv, nonlinearity, *args, **kwargs):
return TransposedConv2DLayer(incoming, conv.input_shape[1],
conv.filter_size, stride=conv.stride,
crop=conv.pad, W=conv.W,
flip_filters=not conv.flip_filte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv_transpose(\n conv_type,\n nd_util,\n input,\n weight,\n bias=None,\n stride=1,\n padding=0,\n output_padding=0,\n groups=1,\n dilation=1,\n):\n weight_shape = list(weight.shape)\n return FunctionLib.apply(\n conv_type,\n input.device,\n [input, wei... | [
"0.7776447",
"0.7178143",
"0.7153144",
"0.7151554",
"0.71389586",
"0.7090323",
"0.7031235",
"0.698399",
"0.6848685",
"0.67817694",
"0.66477203",
"0.66292626",
"0.65644145",
"0.65598965",
"0.65553874",
"0.6551319",
"0.6549589",
"0.6542905",
"0.65120935",
"0.6506025",
"0.650210... | 0.71935004 | 1 |
Set up x and y coordinates so as to center the game on the screen | def getScreen(self):
return self.screen | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.center = Point()\n #x coordinate is set in these amount of pixels to leave a slight gap between the screen and paddle just like in real pong video games\n self.center.x = SCREEN_WIDTH - 10\n #when game starts, paddle is placed on the middle of screen's right e... | [
"0.77032506",
"0.75377285",
"0.7395124",
"0.73748493",
"0.73495716",
"0.72960883",
"0.72906536",
"0.72906536",
"0.72113687",
"0.7182989",
"0.7182989",
"0.7182989",
"0.7155895",
"0.704701",
"0.69839627",
"0.69839627",
"0.69839627",
"0.6963726",
"0.69303155",
"0.6929514",
"0.69... | 0.0 | -1 |
This method is used for send the request in woo and get the response of product attribute and create that attribute into woo commerce connector of odoo | def sync_woo_attribute(self, instance, woo_common_log_id):
common_log_line_obj = self.env["common.log.lines.ept"]
model_id = common_log_line_obj.get_model_id("woo.product.attribute.ept")
obj_woo_attribute = self.env['woo.product.attribute.ept']
odoo_attribute_obj = self.env['product.attr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, data):\n data = {\n \"attribute\":data\n }\n content = super(ProductAttributeAdapter,self).create(data)\n result = content.get('attribute_id')\n if not result :\n raise FailedJobError(\"Result from Magento : %s\"%content)\n ... | [
"0.65743524",
"0.6531173",
"0.64528435",
"0.64025396",
"0.620427",
"0.599423",
"0.593495",
"0.59296244",
"0.5924343",
"0.5901278",
"0.5856579",
"0.58036757",
"0.5756786",
"0.57298684",
"0.56827927",
"0.5682726",
"0.56648517",
"0.5657989",
"0.5655404",
"0.56453574",
"0.5628568... | 0.655372 | 1 |
location of chromedriver needed for running selenium on chrome browser. SPECIFY IT IN CONF FILE driver = webdriver.Chrome(conf.CHROME_DRIVER_PATH) FOR CHROME driver = webdriver.Firefox() FOR FIREFOX | def __init__(self):
driver = webdriver.Firefox() #working with firefox. see above comment and edit it to change the browser
self.driver.get("https://moodle.niituniversity.in")
self.tLogin() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_chprofile(self):\n logging.info(\"# Setting up chrome profile.\")\n driver_path = \"../drivers/chromedriver\"\n return driver_path",
"def create_chprofile(self):\n logging.info(\"# Setting up chrome profile.\")\n driver_path = \"../drivers/chromedriver\"\n ret... | [
"0.7121335",
"0.7121335",
"0.7008077",
"0.69712734",
"0.69363296",
"0.6855179",
"0.6854034",
"0.6840493",
"0.68066543",
"0.6742802",
"0.671337",
"0.6615062",
"0.6519762",
"0.64009774",
"0.6378048",
"0.63600725",
"0.63550794",
"0.6348012",
"0.63299346",
"0.630354",
"0.6188778"... | 0.0 | -1 |
Calculate the attendance rate from the attendance records. | def update_attendance_rate(self):
total_attendees = self.attendee_set.all().count()
attended = self.attendee_set\
.filter(presented=True)\
.count()
self.attendance_rate = attended / total_attendees
assert(self.attendance_rate != None)
self.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attendance(self):\n\n if len(self.attendance_list):\n attendance_sum = 0\n for attendance in self.attendance_list:\n attendance_sum += attendance.attendance_state\n return attendance_sum/len(self.attendance_list) * 100\n\n else:\n ret... | [
"0.68739635",
"0.6680452",
"0.6347757",
"0.5782001",
"0.57462823",
"0.5700232",
"0.5687045",
"0.56683266",
"0.56399506",
"0.5602833",
"0.55916286",
"0.5572287",
"0.5568879",
"0.55328375",
"0.5514146",
"0.5434117",
"0.5429049",
"0.5400566",
"0.53997153",
"0.5387254",
"0.535710... | 0.7188022 | 0 |
Maggies of the model SED through the input passbands. model_maggie only differs from input_maggie in that they are computed from the best fit SEDs through the input passbands; these two maggies should be very close to each other if the fits are good. | def model_maggie(self):
if self._model_maggie is not None:
return self._model_maggie
self._model_maggie = reconstruct_maggie(self.coeffs, self.redshift,
self.ptable[self.filter_list])
return self._model_maggie | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absmag(self, filter_list=None, band_shift=0.):\n if not filter_list:\n filter_list = self.filter_list\n\n # get model maggies for abs mag\n bs = np.ones(self.redshift.shape, dtype=FTYPE) * band_shift\n rm = reconstruct_maggie(self.coeffs, bs, self.ptable[filter_list])\n ... | [
"0.61388665",
"0.55315477",
"0.55187553",
"0.55083895",
"0.54190373",
"0.52926016",
"0.52832144",
"0.5279321",
"0.52767175",
"0.52713364",
"0.5254593",
"0.51855576",
"0.51589495",
"0.51317084",
"0.51047975",
"0.5104359",
"0.5064447",
"0.50472575",
"0.5039397",
"0.50319505",
"... | 0.67099524 | 0 |
Get url for user's detail view. | def get_absolute_url(self):
return reverse("users:detail", kwargs={"username": self.username}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse('users:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self) -> str:\n return reverse(\"accounts:user-detail\", args=[str(self.user.id)])",
"def get_absolute_url(self):\n return reverse('accountInfo-detail', args=[str(self.uid)])",
"d... | [
"0.7963328",
"0.78354645",
"0.7563318",
"0.7460553",
"0.7415205",
"0.74021924",
"0.73742825",
"0.7253231",
"0.7247492",
"0.71429956",
"0.71248406",
"0.7023358",
"0.6971622",
"0.6905849",
"0.6905849",
"0.6886404",
"0.6884817",
"0.68827534",
"0.68645763",
"0.6855898",
"0.685589... | 0.78631604 | 3 |
Gets the created_date of this ChatUserThreadResource. The date the user thread was created | def created_date(self):
return self._created_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_created(self):\n return self._date_created",
"def date_created(self):\n return self._date_created",
"def date_created(self):\n return self._date_created",
"def date_created(self) -> datetime:\n return self._date_created",
"def created_time(self) -> datetime.datetime:\n ... | [
"0.6903408",
"0.6903408",
"0.6903408",
"0.68622667",
"0.6850349",
"0.6850349",
"0.6786935",
"0.6705644",
"0.658298",
"0.6558502",
"0.64726067",
"0.64726067",
"0.64726067",
"0.64726067",
"0.645365",
"0.64173037",
"0.6372399",
"0.6372399",
"0.6372399",
"0.6372399",
"0.63464653"... | 0.7177331 | 1 |
Gets the read_count of this ChatUserThreadResource. The number of messages read in the thread | def read_count(self):
return self._read_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message_count(self):\n return self.buffer.count()",
"def message_count(self):\n return self._message_count",
"def rtt_read_channel_count(self):\n down_channel_number = ctypes.c_uint32()\n up_channel_number = ctypes.c_uint32()\n\n result = self._lib.NRFJPROG_rtt_read_c... | [
"0.6257311",
"0.62394744",
"0.6220564",
"0.61878294",
"0.61771005",
"0.6100139",
"0.59490275",
"0.59133714",
"0.5830274",
"0.5800908",
"0.5712329",
"0.5710218",
"0.57101625",
"0.5691817",
"0.5635065",
"0.5619713",
"0.5609608",
"0.5593367",
"0.5588482",
"0.55876267",
"0.557686... | 0.7262497 | 0 |
Sets the read_count of this ChatUserThreadResource. The number of messages read in the thread | def read_count(self, read_count):
self._read_count = read_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_reads(self, num_reads):\n if self.local_vars_configuration.client_side_validation and num_reads is None: # noqa: E501\n raise ValueError(\"Invalid value for `num_reads`, must not be `None`\") # noqa: E501\n\n self._num_reads = num_reads",
"def message_count(self, message_count)... | [
"0.57844347",
"0.5702885",
"0.5691406",
"0.5404078",
"0.5395319",
"0.5360208",
"0.5329295",
"0.5329295",
"0.5226304",
"0.5222241",
"0.50689846",
"0.50666994",
"0.5045025",
"0.5044207",
"0.50222456",
"0.5014638",
"0.49755675",
"0.49657777",
"0.49638587",
"0.49503097",
"0.49376... | 0.73013663 | 0 |
Sets the thread of this ChatUserThreadResource. The details about the thread | def thread(self, thread):
self._thread = thread | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def thread_id(self, thread_id):\n\n self._thread_id = thread_id",
"def set_thread_name(self, thread_name: str):\n self.thread_name = thread_name",
... | [
"0.6630631",
"0.6630631",
"0.6630631",
"0.6358085",
"0.5808126",
"0.5673603",
"0.55051094",
"0.5468684",
"0.54530764",
"0.5357711",
"0.5340085",
"0.53311354",
"0.53073716",
"0.5299163",
"0.52892315",
"0.52627546",
"0.5222327",
"0.5208959",
"0.5200269",
"0.5132681",
"0.509753"... | 0.6434738 | 3 |
Gets the thread_id of this ChatUserThreadResource. The id of the thread | def thread_id(self):
return self._thread_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n if hasattr(self, \"_thread_id\"):\n return self._thread_id\n for id, thread in threading._active.items():\n if thread is self:\n return id",
"def get_id(self):\n if hasattr(self, \"_thread_id\"):\n return self._thread_id\n ... | [
"0.7192295",
"0.7192295",
"0.7179676",
"0.6651624",
"0.66315013",
"0.65997016",
"0.6582702",
"0.65539235",
"0.64988333",
"0.59575874",
"0.5952224",
"0.5933226",
"0.5865224",
"0.5847507",
"0.5839094",
"0.5791999",
"0.5783414",
"0.5766336",
"0.5680278",
"0.5672813",
"0.5672813"... | 0.7905823 | 0 |
Sets the thread_id of this ChatUserThreadResource. The id of the thread | def thread_id(self, thread_id):
self._thread_id = thread_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_originator_id(self, thread_originator_id):\n\n self._thread_originator_id = thread_originator_id",
"def thread_id(self):\n return self._thread_id",
"def set_thread_name(self, thread_name: str):\n self.thread_name = thread_name",
"def delete_thread(self, thread_uid: str):\n ... | [
"0.60664546",
"0.58813614",
"0.5835784",
"0.5708696",
"0.5643062",
"0.5380938",
"0.52854824",
"0.52657",
"0.5234094",
"0.52214843",
"0.5150493",
"0.5121417",
"0.5083216",
"0.5053998",
"0.5050657",
"0.4994197",
"0.49928132",
"0.49581677",
"0.49498898",
"0.49485517",
"0.4943654... | 0.7628486 | 2 |
Gets the updated_date of this ChatUserThreadResource. The date the user thread was updated | def updated_date(self):
return self._updated_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_at(self):\n return self._updated_at",
"def updated_at(self):\n return self._updated_at",
"def updated_at(self):\n return self._updated_at",
"def updated(self) -> datetime:\n return self._updated",
"def updated(self) -> datetime:\n return datetime.strptime(self... | [
"0.66180265",
"0.66180265",
"0.66180265",
"0.64954114",
"0.63876426",
"0.6358819",
"0.628679",
"0.62393504",
"0.62300026",
"0.62101257",
"0.62101257",
"0.62074",
"0.61699206",
"0.6114108",
"0.6106753",
"0.6069354",
"0.5995152",
"0.5995152",
"0.5995152",
"0.5983186",
"0.597877... | 0.71201503 | 1 |
Sets the updated_date of this ChatUserThreadResource. The date the user thread was updated | def updated_date(self, updated_date):
self._updated_date = updated_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_date(self, updated_date):\n self._updated_date = updated_date",
"def updated_date(self, updated_date):\n if updated_date is None:\n raise ValueError(\"Invalid value for `updated_date`, must not be `None`\") # noqa: E501\n\n self._updated_date = updated_date",
"def u... | [
"0.67651635",
"0.65790963",
"0.64310586",
"0.62051994",
"0.61615634",
"0.61615634",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.5823786",
"0.57622975",
"0.57622975",
"0.55954033",
"0.5516571",
"0.5497... | 0.6794037 | 1 |
Gets the user_id of this ChatUserThreadResource. The id of the user | def user_id(self):
return self._user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_id(self):\n return self.id_user",
"def user_id(self):\n return self.status.user[\"id\"]",
"def get_id(self):\n return self.user_id",
"def get_id(self) -> int:\n return self.user_id",
"def user_id(self) -> str:\n return self._user_id",
"def user_id(self) -> ... | [
"0.7343068",
"0.68853176",
"0.6828922",
"0.6789547",
"0.6786583",
"0.6786583",
"0.663362",
"0.6625411",
"0.6542836",
"0.65102595",
"0.6482228",
"0.6482228",
"0.64817876",
"0.64749455",
"0.6422526",
"0.6413251",
"0.63667774",
"0.6215003",
"0.62138456",
"0.6194238",
"0.6177186"... | 0.7125117 | 3 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ChatUserThreadResource):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528"
] | 0.0 | -1 |
Valida si existe un usuario con ese username | def validate_usuario(self, data):
user = Usuario.objects.filter(usuario=data)
# Si estoy creando (no hay instancia) comprobar si hay usuarios con ese
# username
if not self.instance and len(user) != 0:
raise ValidationError(u"Ya existe un usuario con ese usuario")
# Si estoy actualizando (hay instancia) y ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_username(self):\n username = self.cleaned_data.get('username')\n user_exists = User.objects.filter(username=username).exists()\n\n if user_exists:\n raise forms.ValidationError(\n 'El usuario ya existe en nuestros registros.'\n )\n\n return... | [
"0.8098091",
"0.8053317",
"0.78804547",
"0.7788118",
"0.7715609",
"0.7698866",
"0.7674665",
"0.7663345",
"0.7650589",
"0.7646391",
"0.7641546",
"0.76356393",
"0.76356393",
"0.7548074",
"0.7504629",
"0.74570525",
"0.7445814",
"0.74222434",
"0.73940253",
"0.73729795",
"0.736616... | 0.7696947 | 6 |
T = otsu(img) Calculate a threshold according to the Otsu method. | def otsu(img, ignore_zeros=False):
# Calculated according to CVonline: http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/threshold.pdf
hist = fullhistogram(img)
hist = np.asarray(hist,double) # This forces everything to be double precision
if ignore_zeros:
hist[0] = 0
Ng = len(hi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def otsu(img, invert=False):\n\tgray = grayscale(img)\n\tblur = cv2.GaussianBlur(gray, (5,5), 0)\n\tif invert:\n\t\tret, thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)\n\t\treturn thresh\n\telse:\n\t\tret, thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)\n\t\tret... | [
"0.7932078",
"0.7017424",
"0.69252455",
"0.68297535",
"0.6791155",
"0.66946363",
"0.66946363",
"0.66827756",
"0.65322876",
"0.64080346",
"0.6224046",
"0.61979353",
"0.6096657",
"0.6056538",
"0.5941125",
"0.5837977",
"0.574149",
"0.5739578",
"0.57361245",
"0.57354623",
"0.5707... | 0.8047665 | 0 |
Convert a date of the format 'YYYYMMDD' to a datetime.date object. (Will also accept MM/DD/YYYY format, ISO 8601 timestamps, or existing datetime objects; these shouldn't be in COUNTER reports, but they do show up in real world data...) | def convert_date_run(datestring):
if isinstance(datestring, datetime.date):
return datestring
try:
return datetime.datetime.strptime(datestring, "%Y-%m-%d").date()
except ValueError:
try:
return datetime.datetime.strptime(datestring, "%m/%d/%Y").date()
except Val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to_python_date(date):\n try:\n ret_date = datetime.datetime.strptime(date, \"%d/%m/%y\")\n except ValueError:\n #another format -- a year can also have four digits\n ret_date = datetime.datetime.strptime(date, \"%d/%m/%Y\")\n return ret_date",
"def conv_int_to_date(date):\n... | [
"0.75595444",
"0.7410672",
"0.7340338",
"0.7323156",
"0.72344416",
"0.71716344",
"0.71114665",
"0.711",
"0.70881355",
"0.7009997",
"0.6997348",
"0.6984778",
"0.6932708",
"0.68898076",
"0.6877453",
"0.68272424",
"0.67820185",
"0.67421716",
"0.6668876",
"0.664518",
"0.6609846",... | 0.65139365 | 24 |
Find last day of a month from any day in the month. | def last_day(orig_date):
day_number = calendar.monthrange(orig_date.year, orig_date.month)[1]
return datetime.date(orig_date.year, orig_date.month, day_number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_day_of_month(year, month):\n last_days = [31, 30, 29, 28, 27]\n for i in last_days:\n try:\n end = datetime.datetime(year, month, i)\n except ValueError:\n continue\n else:\n return end.day\n return None",
"def last_day_of_month(date):\n ... | [
"0.84892106",
"0.81349576",
"0.81349576",
"0.80477875",
"0.78493303",
"0.76940113",
"0.74995786",
"0.74246585",
"0.72140056",
"0.7137636",
"0.7116274",
"0.6745853",
"0.6707496",
"0.6699622",
"0.6627035",
"0.6552997",
"0.65116096",
"0.64850694",
"0.6276225",
"0.62559783",
"0.6... | 0.7085767 | 11 |
Find the first day of the next month after the given date. | def next_month(dateobj):
year_delta, old_month = divmod(dateobj.month, 12)
return datetime.date(dateobj.year + year_delta, old_month + 1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_month(date):\n\n return date + datetime.timedelta(days=calendar.monthrange(date.year, date.month)[1])",
"def first_of_next_month(ref_date):\n year, month = add_months(ref_date.year, ref_date.month, 1)\n return type(ref_date)(year, month, 1)",
"def next_day(date):\n return date + datetime.t... | [
"0.8466234",
"0.77630866",
"0.7326399",
"0.7326399",
"0.7280617",
"0.7280617",
"0.72270215",
"0.7199902",
"0.6969081",
"0.6955558",
"0.69180673",
"0.69180673",
"0.68084455",
"0.67616004",
"0.67260414",
"0.6691699",
"0.66586876",
"0.6561155",
"0.6525154",
"0.6492997",
"0.64844... | 0.7336214 | 2 |
Find the first day of the previous month before the given date. | def prev_month(dateobj):
year_delta, old_month = divmod(dateobj.month - 2, 12)
return datetime.date(dateobj.year + year_delta, old_month + 1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prev_month_start(dt):\n _y, _m, _d = dt.year, dt.month, dt.day\n\n if _m == 1:\n _m = 12\n _y -= 1\n else:\n _m -= 1\n\n _d = 1\n\n return date(_y, _m, _d)",
"def first_day_of_month(date):\n return date.replace(day=1)",
"def first_day_of_month(date):\n return date.... | [
"0.7514496",
"0.70269006",
"0.70269006",
"0.69976664",
"0.6978098",
"0.68689734",
"0.66702807",
"0.6620018",
"0.6620018",
"0.6395445",
"0.6308963",
"0.62416375",
"0.6226517",
"0.6186152",
"0.6154112",
"0.61514854",
"0.61241764",
"0.6105966",
"0.6077866",
"0.60754454",
"0.6056... | 0.6983693 | 4 |
Predict and compute the mean absolute error. | def score(self, test_index):
y_pred = self.predict(test_index)
mae = mean_absolute_error(self._y[test_index], y_pred)
return mae | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def mean_absolute_error(y_true, y_pred):\n \n # ... | [
"0.7088475",
"0.7069263",
"0.7056246",
"0.6937412",
"0.68936723",
"0.68724",
"0.6859827",
"0.68446916",
"0.6747657",
"0.6733615",
"0.67202574",
"0.6713833",
"0.6683662",
"0.6636355",
"0.662765",
"0.66262186",
"0.66097444",
"0.66011935",
"0.65969247",
"0.65949035",
"0.65882665... | 0.6340665 | 53 |
Predict and compute the mean absolute error. | def score(self, test_index):
y_pred = self.predict(test_index)
mae = mean_absolute_error(self._y[test_index], y_pred)
return mae | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))",
"def mean_absolute_error(y_true, y_pred):\n \n # ... | [
"0.7086201",
"0.70679975",
"0.705466",
"0.69383776",
"0.6892386",
"0.68707085",
"0.68585837",
"0.6843604",
"0.6748632",
"0.67358816",
"0.6719142",
"0.67137384",
"0.6685248",
"0.6635503",
"0.6625787",
"0.66249114",
"0.66092926",
"0.6599208",
"0.6598184",
"0.65965277",
"0.65888... | 0.63401544 | 52 |
Return current state, a dictionary of variable names to values This is used to save/restore states, so make deep copies of values | def Current(self):
return dict([(vname, copy.deepcopy(getattr(self.module, vname)))
for vname in self.module.state ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_dict(self):\n return {k: getattr(self, k) for k in self.VARS}",
"def state_dict(self, *args, **kwargs):\n return self.module.state_dict(*args, **kwargs)",
"def __getstate__(self):\n state: Dict[str, Any] = deepcopy(self.__dict__)\n del state['__db']\n return state",... | [
"0.7593354",
"0.7437526",
"0.7405926",
"0.7330012",
"0.7275113",
"0.7275113",
"0.7250448",
"0.7226475",
"0.72124296",
"0.71847093",
"0.7103537",
"0.7092987",
"0.70901906",
"0.7080829",
"0.7037469",
"0.70311314",
"0.7027655",
"0.7017144",
"0.7016975",
"0.70022917",
"0.6998453"... | 0.7595463 | 0 |
Return all categories from DB | def _get_all_categories() -> dict:
categories = database.fetchall("Categories", "id", "name_ua")
return categories | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories():\n return session.query(Category)",
"def getAllCategory():\n return session.query(Category).all()",
"def get_all() -> list:\n categorias = []\n conn = GenericDao.connect()\n cursor = conn.execute(\"SELECT * FROM categorias\")\n for row in cursor:\n categoria = Cate... | [
"0.84295714",
"0.8338642",
"0.8174337",
"0.81462014",
"0.8069659",
"0.78785324",
"0.7852358",
"0.7851421",
"0.7748237",
"0.7742497",
"0.7715785",
"0.7675892",
"0.76297134",
"0.7576413",
"0.7562497",
"0.751597",
"0.7497163",
"0.74710804",
"0.7432265",
"0.74261934",
"0.74240166... | 0.84034145 | 1 |
Takes in a known wavelength (in metres) to find motor step size (calibration). Returns steps_data and dps_data, where steps_data = (steps, unique_steps_between_peaks, unique_steps_counts) dps_data = (_dpses, unique_dpses, unique_dpses_counts, dps_mean, dps_std) Finds the number of steps between maxima, then finds the c... | def get_motor_step_dps_per_peak(self, known_wavelength):
steps, unique_steps_between_peaks, unique_steps_counts = self.get_steps_between_peaks()
_dpses = known_wavelength / (2 * steps)
dps_mean, dps_std = np.mean(_dpses), np.std(_dpses)
unique_dpses, unique_dpses_counts = np.unique(_dps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dseries(temp, wavelength):\n if wavelength < 300 or wavelength > 830:\n return 0\n mm=wavelength%10\n s=_dseriesd(temp, wavelength-mm)\n if mm==0:\n return s\n m=mm*0.1\n e=_dseriesd(temp, (wavelength-mm)+10)\n return s+(e-s)*m",
"def calc_stepsize(self):\n # Calculate... | [
"0.5407341",
"0.53900784",
"0.5301673",
"0.52934635",
"0.52591234",
"0.5253586",
"0.5196733",
"0.5143672",
"0.51206464",
"0.5116872",
"0.51164144",
"0.5050969",
"0.49529925",
"0.49399012",
"0.4937298",
"0.49234334",
"0.49180844",
"0.48998046",
"0.48961392",
"0.48961392",
"0.4... | 0.74776536 | 0 |
Endpoint that renders an OpenApi spec for all views that belong to a certain version | def get(self, version):
version_found = False
api_spec = self._create_api_spec(version)
for base_api in current_app.appbuilder.baseviews:
if isinstance(base_api, BaseApi) and base_api.version == version:
base_api.add_api_spec(api_spec)
version_found = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swagger():\n return jsonify(current_app.spec.to_dict())",
"def dispatch(self, req, *args):\n builder = nova.api.openstack.views.versions.get_view_builder(req)\n if req.path in ('/', ''):\n return builder.build_versions(VERSIONS)\n else:\n return builder.build_ver... | [
"0.6591506",
"0.6572317",
"0.6448626",
"0.6269265",
"0.6267862",
"0.6200955",
"0.6142061",
"0.61397207",
"0.6081235",
"0.59681547",
"0.5949045",
"0.58548594",
"0.57892203",
"0.57807016",
"0.57663614",
"0.5685804",
"0.5668646",
"0.56328607",
"0.5604897",
"0.5588322",
"0.558346... | 0.72201186 | 0 |
Test that th email field is optional. | def test_email_is_optional(self):
self.updated_data['email'] = ''
self.update_user()
self.assertEqual(self.user.email, self.updated_data['email']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_blank_email(self):\n rv = self.signup('Bo', 'Theo', '', 'Bo1995', 'Bo1995')\n self.assertIn(b'Field must be between 6 and 30 characters long.', rv.data)",
"def test_email():\n assert is_email(None) is None\n assert is_email('test@example.com') is None\n assert is_email('other')",
"def... | [
"0.7527722",
"0.7457945",
"0.70958996",
"0.70436895",
"0.7004847",
"0.7003563",
"0.6906372",
"0.68828064",
"0.68039125",
"0.6721579",
"0.66506475",
"0.6648329",
"0.66353995",
"0.66205215",
"0.6609932",
"0.6559079",
"0.65513396",
"0.65416276",
"0.654009",
"0.6539827",
"0.64708... | 0.7311002 | 2 |
Generator for sequencetosequence tasks that uses tokens. This generator assumes the files at source_path and target_path have the same number of lines and yields dictionaries of "inputs" and "targets" where inputs are token ids from the " "split source (and target, resp.) lines converted to integers using the token_map... | def token_generator(source_path, target_path, token_vocab, eos=None):
eos_list = [] if eos is None else [eos]
with tf.gfile.GFile(source_path, mode="r") as source_file:
with tf.gfile.GFile(target_path, mode="r") as target_file:
source, target = source_file.readline(), target_file.readline()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def character_generator(source_path, target_path, character_vocab, eos=None):\n eos_list = [] if eos is None else [eos]\n with tf.gfile.GFile(source_path, mode=\"r\") as source_file:\n with tf.gfile.GFile(target_path, mode=\"r\") as target_file:\n source, target = source_file.readline(), target_file.read... | [
"0.59099215",
"0.5786372",
"0.56074005",
"0.5578314",
"0.55373627",
"0.5469531",
"0.545364",
"0.5434892",
"0.5377537",
"0.5370183",
"0.536413",
"0.5334036",
"0.5323862",
"0.52478784",
"0.52400494",
"0.5236072",
"0.5235062",
"0.5180217",
"0.5143994",
"0.5118781",
"0.5099885",
... | 0.7124365 | 0 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
return redirect('/departments') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def departments(request):
if 'selected_package' in request.session:
del request.session['selected_package']
assert isinstance(request, HttpRequest)
status, result = api.show_departments()
return render(
request,
'app/departments.html',
{
'title': 'แผนกและแพ็คเ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85647297",
"0.8503022",
"0.8448552",
"0.8404981",
"0.83938396",
"0.82932264",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.82675695",
"0.82430005"... | 0.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'title': 'About',
'message': 'Your application description page.',
'year': datetime.now().year,
'logged_user': request.session.get('user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.76937646 | 65 |
Renders the about page. | def doctor_detail(request):
if 'selected_package' not in request.session or 'selected_doctor' not in request.session:
return redirect('/doctor-search')
if request.method == 'POST':
request.session['selected_date'] = json.loads(request.POST['date'])
return redirect('/confirm/')
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def doctor_profile(request):
if not check_user_group('doctor', request.user):
raise PermissionDenied
doctor_id = api.get_doctor_id(request.user.username)[1]
status, doctor = api.show_doctor_detail(doctor_id)
status, orders = api.get_doctor_orders(doctor_id)
return render(
request,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def regular_packages(request):
if request.method == 'POST':
request.session['selected_package'] = request.POST['package']
return redirect('/doctor-search/')
assert isinstance(request, HttpRequest)
status, result = api.show_general_list()
return render(
request,
'app/regul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85647297",
"0.8503022",
"0.8448552",
"0.8404981",
"0.83938396",
"0.82932264",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.82675695",
"0.82430005"... | 0.0 | -1 |
Renders the about page. | def special_packages(request, package_id):
assert isinstance(request, HttpRequest)
if request.method == 'POST':
request.session['selected_package'] = request.POST['package']
return redirect('/doctor-search/')
status, result = api.show_special_package_info(package_id)
# print(result)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def search_for_doctor(request):
if 'selected_package' not in request.session:
return redirect('/departments/')
if request.method == 'POST':
request.session['selected_doctor'] = request.POST['doctor_id']
return redirect('/doctor-detail/')
# print(request.session['selected_package'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.