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 |
|---|---|---|---|---|---|---|
Returns torch.utils.data.DataLoader for train and validation datasets | def get_data_loaders(cap_files, visual_feats, vocab, bow2vec, batch_size=100, num_workers=2, n_caption=2, video2frames=None, video2frames_target=None, visual_feats_target=None, caption_file_target=None, multi_flag=0):
if video2frames_target!=None and visual_feats_target!=None:
if multi_flag == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_loader(dataset, train_batch_size, validation_split=0.2):\n # number of samples in train and test set\n train_len = int(len(dataset) * (1 - validation_split))\n test_len = len(dataset) - train_len\n train_set, test_set = torch.utils.data.random_split(dataset, [train_len, test_len])\n # creat... | [
"0.8140166",
"0.8118663",
"0.8117353",
"0.8068962",
"0.8051284",
"0.79718786",
"0.7915507",
"0.78709507",
"0.7857036",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.7831179",
"0.78008175",
"0.7796776",
"0.7746052",
... | 0.0 | -1 |
Returns torch.utils.data.DataLoader for test dataset | def get_test_data_loaders(cap_files, visual_feats, vocab, bow2vec, batch_size=100, num_workers=2, n_caption=2, video2frames = None):
dset = {'test': Dataset4DualEncoding(cap_files['test'], visual_feats['test'], bow2vec, vocab, n_caption, video2frames = video2frames['test'])}
data_loaders = {x: torch.utils.dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_test, **self.dl_kwargs)",
"def get_test_loader(test_dataset,\n batch_size,\n num_workers=4,\n pin_memory=False):\n data_loader = ... | [
"0.892942",
"0.8561808",
"0.84053403",
"0.8336456",
"0.82766837",
"0.8276276",
"0.7904253",
"0.7898874",
"0.7791975",
"0.77733445",
"0.77315015",
"0.7718101",
"0.7604569",
"0.7572384",
"0.75618887",
"0.7448701",
"0.7448583",
"0.7412788",
"0.7385015",
"0.73724735",
"0.73699397... | 0.0 | -1 |
Tests what happens when df has a name. | def test_004_when_df_is_named() -> None:
df = generate_test_data()
df.name = "Named dataframe"
skim(df) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_slice_name(self):\n self.insert()\n data = self.tbl['name']\n assert self.check(self.idata[:, [0, 1]], data)",
"def test_log_names(names, capsys, test_df):\n\n @log_step(names=names)\n def do_nothing(df, *args, **kwargs):\n return df\n\n test_df.pipe(do_nothing)\n\n ... | [
"0.6618273",
"0.6615118",
"0.6449738",
"0.6409146",
"0.63291734",
"0.6324979",
"0.6260462",
"0.6222949",
"0.6202707",
"0.6190321",
"0.61280036",
"0.60812736",
"0.605781",
"0.5976045",
"0.597216",
"0.5946071",
"0.59046507",
"0.59026575",
"0.5901728",
"0.58165526",
"0.5808646",... | 0.77494466 | 0 |
Return True if sprite is touching any sprite in geometry | def is_touching(
sprite: arcade.Sprite,
geometry: arcade.SpriteList,
*,
check_top: bool = True,
displacement: Tuple[int, int] = (5, 5)
) -> bool:
dirs = [(-1, 0), (+1, 0), (0, -1)] # Left # Right # Bottom
if check_top:
dirs.append((0, +1)) # Top
for dir in dirs:
if c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersect(self, sprite):\n return not ((self.left > sprite.right)\n or (self.right < sprite.left)\n or (self.top < sprite.bottom)\n or (self.bottom > sprite.top))",
"def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n raindrop.h... | [
"0.71044695",
"0.6765573",
"0.65148145",
"0.64601254",
"0.6407479",
"0.63434964",
"0.63165826",
"0.6300353",
"0.6270968",
"0.6262671",
"0.6204516",
"0.6204306",
"0.6185195",
"0.61756194",
"0.61678344",
"0.6068088",
"0.60657084",
"0.6047504",
"0.60418826",
"0.6037236",
"0.6002... | 0.69199556 | 1 |
Yield, as lists, permutations of range(n) that respect parts. | def _partition_perms(parts, n):
if not parts:
yield list(range(n))
return
prt = parts[0]
if len(prt) <= 1:
for p in _partition_perms(parts[1:], n):
yield p
return
for baseperm in _partition_perms(parts[1:], n):
for newperm in itertools.permutations(prt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part_2():\n return itertools.permutations(range(5, 10))",
"def partitions(n):\n for a in range(2,n//2+1):\n yield a, n-a",
"def part_1():\n return itertools.permutations(range(5))",
"def windows_of_permutations(n, step):\n def gen(p):\n for i in range(0, NB_AVIONS-n, step):\n ... | [
"0.7673727",
"0.73109347",
"0.7304291",
"0.72319645",
"0.7226306",
"0.7200097",
"0.71706617",
"0.7124495",
"0.710067",
"0.7088146",
"0.70836574",
"0.7021219",
"0.69707274",
"0.6951192",
"0.692426",
"0.6899019",
"0.6898932",
"0.6897408",
"0.6843629",
"0.6843629",
"0.683761",
... | 0.80717975 | 0 |
Borrow a docker widget from Krita's existing list of dockers and returns True. Returns False if invalid widget was passed. | def borrowDocker(self, docker):
# Does requested widget exist?
if isinstance(docker, QDockWidget) and docker.widget():
# Return any previous widget to its original docker
self.returnDocker()
self.widgetDocker = docker
self.widget ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returnDocker(self):\r\n # Ensure there's a widget to return\r\n if self.widget:\r\n self.widgetDocker.setWidget(self.widget)\r\n self.widget = None\r\n self.widgetDocker = None",
"def docker_available(): # type: () -> bool\n return bool(get_docker_command())... | [
"0.631959",
"0.60172135",
"0.59079784",
"0.5552849",
"0.5532445",
"0.5374137",
"0.5307119",
"0.53005993",
"0.52816594",
"0.52227587",
"0.51291066",
"0.51088923",
"0.51063114",
"0.5038037",
"0.499391",
"0.49931163",
"0.49577045",
"0.49294376",
"0.49280307",
"0.48862693",
"0.48... | 0.761889 | 0 |
Adjust the position and size of the Pad to that of the active View. | def adjustToView(self):
view = self.activeView()
if view:
self.resizeToView() # Resize first because the x-position is dependant on correct width.
# pos = self.parentWidget().mapFromGlobal(view.mapToGlobal(QPoint(view.width() - self.parentWidget().width(), 0))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resizeToView(self): # The Tool Options widget is a nightmare to resize :)\r\n view = self.activeView()\r\n\r\n if view and self.widget.isVisible():\r\n # We start with the tool options sizeHint as a goal size and then\r\n # shrink it down if necessary to fit inside the view.... | [
"0.6125446",
"0.5846994",
"0.584446",
"0.5788828",
"0.5756493",
"0.5744157",
"0.57009524",
"0.5666064",
"0.5652958",
"0.56485355",
"0.56057",
"0.55552614",
"0.55135983",
"0.549873",
"0.5486038",
"0.5479174",
"0.54651165",
"0.5453882",
"0.5432328",
"0.5421478",
"0.5390611",
... | 0.7132964 | 0 |
Generate planetary mass values in units of Earth mass. The prototype provides a loguniform distribution between the minimum and maximum values. | def gen_mass(self, n):
n = self.gen_input_check(n)
Mpr = self.Mprange.to("earthMass").value
Mp = (
np.exp(np.random.uniform(low=np.log(Mpr[0]), high=np.log(Mpr[1]), size=n))
* u.earthMass
)
return Mp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_planet_mass_from_radius_Ning2018_table(R):\n logR = np.log10(R)\n q = np.random.random() # drawn quantile\n logM = logMR_table_interp(logR, q)[0][0]\n return 10.**logM # planet mass in Earth masses",
"def new_flat_mass_distribution_nbody(number_of_particles, **keyword_arguments):\n if... | [
"0.66249394",
"0.61890584",
"0.60942155",
"0.60834646",
"0.60287446",
"0.60258204",
"0.5921546",
"0.5888827",
"0.57942003",
"0.5789091",
"0.568885",
"0.56754345",
"0.5675429",
"0.56574",
"0.5647803",
"0.56421876",
"0.5619946",
"0.5604251",
"0.5575307",
"0.5521068",
"0.5502638... | 0.74400866 | 0 |
Probability density function for eccentricity constrained by semimajor axis, such that orbital radius always falls within the provided sma range. The prototype provides a uniform distribution between the minimum and maximum allowable values. | def dist_eccen_from_sma(self, e, a):
# cast a and e to array
e = np.array(e, ndmin=1, copy=False)
a = np.array(a, ndmin=1, copy=False)
# if a is length 1, copy a to make the same shape as e
if a.ndim == 1 and len(a) == 1:
a = a * np.ones(e.shape)
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_cdf(x: float, mu: float = 0, sigma: float = 1) -> float:\n return (1 + math.erf((x - mu) / math.sqrt(2) / sigma)) / 2",
"def norm_cdf(mu, sigma, x):\n return 0.5 * (1 + math.erf((x - mu) / (sigma * math.sqrt(2.0))))",
"def radial_distribution_function(alpha):\n\n ALPHA_MAX = 0.59999\n\n ... | [
"0.6520501",
"0.6312787",
"0.62137073",
"0.6127275",
"0.60802734",
"0.6047804",
"0.6017441",
"0.5979422",
"0.59518844",
"0.59444994",
"0.59266937",
"0.5925302",
"0.592447",
"0.59236187",
"0.59179354",
"0.5902549",
"0.5902183",
"0.5901249",
"0.58904696",
"0.58630085",
"0.58533... | 0.0 | -1 |
Probability density function for eccentricity The prototype provides a uniform distribution between the minimum and maximum values. | def dist_eccen(self, e):
return self.uniform(e, self.erange) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normal_distribution_cdf(x, stddev):\n return 0.5 * (1.0 + tf.erf(x / (math.sqrt(2) * stddev + 1e-20)))",
"def gc_prob_density(r):\n return np.exp(_interp_ln_dens(r))",
"def uniform_cdf(x):\n if x <0: return 0 #uniform random is never less than 0\n elif x < 1: return x #e.g. P(... | [
"0.68117684",
"0.66976607",
"0.6621948",
"0.6583343",
"0.65655243",
"0.6528212",
"0.6527223",
"0.65139514",
"0.65120125",
"0.65116286",
"0.6508886",
"0.6471776",
"0.639284",
"0.63607097",
"0.6321234",
"0.62662196",
"0.62636805",
"0.62365544",
"0.6231074",
"0.6226588",
"0.6220... | 0.59767747 | 39 |
Probability density function for albedo The prototype provides a uniform distribution between the minimum and maximum values. | def dist_albedo(self, p):
return self.uniform(p, self.prange) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_probability_density(self):\n # Setup\n copula = GaussianMultivariate(GaussianUnivariate)\n copula.fit(self.data)\n X = np.array([2000., 200., 0.])\n expected_result = 0.032245296420409846\n\n # Run\n result = copula.probability_density(X)\n\n # Check... | [
"0.68134224",
"0.67888397",
"0.6787017",
"0.6748713",
"0.6647758",
"0.6645709",
"0.66312516",
"0.6597787",
"0.659528",
"0.6565072",
"0.64986473",
"0.6481216",
"0.6468703",
"0.64539945",
"0.6432069",
"0.63125473",
"0.62983245",
"0.62929326",
"0.6270323",
"0.62409246",
"0.62404... | 0.6043138 | 40 |
Probability density function for planetary mass in Earth mass The prototype provides an unbounded power law distribution. Note that this should really be a function of a density model and the radius distribution for all implementations that use it. | def dist_mass(self, Mp):
Mearth = np.array(Mp, ndmin=1) * u.earthMass
tmp = ((Mearth >= self.Mprange[0]) & (Mearth <= self.Mprange[1])).astype(float)
Mjup = Mearth.to("jupiterMass").value
return tmp * Mjup ** (-1.3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omega_plasma(number_density, mass):\n return np.sqrt(4 * np.pi * number_density * cgs.e**2 / mass)",
"def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3",
"def gc_prob_density(r):\n return np.exp(_interp_ln_dens(r))",
"def density(... | [
"0.6600993",
"0.6358704",
"0.6146763",
"0.61380917",
"0.6054088",
"0.60407364",
"0.5999023",
"0.59850943",
"0.5982486",
"0.59662855",
"0.594824",
"0.5935826",
"0.592153",
"0.5910607",
"0.58995277",
"0.58980834",
"0.5886013",
"0.5871225",
"0.58650285",
"0.5861288",
"0.5849253"... | 0.57653666 | 27 |
function to calculate haversine distance between two coordinates | def haversine(lat1, lng1, lat2, lng2):
lat1, lng1, lat2, lng2 = map(np.radians, (lat1, lng1, lat2, lng2))
AVG_EARTH_RADIUS = 6371 # in km
lat = lat2 - lat1
lng = lng2 - lng1
d = np.sin(lat * 0.5) ** 2 + np.cos(lat1) * np.cos(lat2) * np.sin(lng * 0.5) ** 2
h = 2 * AVG_EARTH_RADIUS * np.arcsin(np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_distance_haversine(coord1, coord2):\n lat1, lon1 = coord1\n lat2, lon2 = coord2\n # approximate radius of earth in km\n R = 6373.0\n\n lat1 = radians(lat1)\n lon1 = radians(lon1)\n lat2 = radians(lat2)\n lon2 = radians(lon2)\n\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n\n ... | [
"0.81799287",
"0.81478584",
"0.81337464",
"0.8093445",
"0.79182065",
"0.7866355",
"0.785832",
"0.7855717",
"0.7848234",
"0.78135306",
"0.7813489",
"0.78016865",
"0.78012383",
"0.77976793",
"0.77960604",
"0.77947104",
"0.7792573",
"0.77740586",
"0.7773124",
"0.77619845",
"0.77... | 0.7759811 | 20 |
Convert a segmentation image label array to onehot format by replacing each pixel value with a vector of length num_classes Arguments | def one_hot_encode(label, label_values):
semantic_map = []
for colour in label_values:
equality = np.equal(label, colour)
class_map = np.all(equality, axis = -1)
semantic_map.append(class_map)
semantic_map = np.stack(semantic_map, axis=-1)
return semantic_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_one_hot(label, num_of_class=2):\r\n import numpy as np\r\n one_hot = np.zeros((len(label), num_of_class), dtype=np.uint8)\r\n for i in range(len(label)):\r\n one_hot[i, int(label[i] - 1)] = 1 # label is 1 and 2\r\n\r\n return one_hot",
"def _convert_to_onehot_labels(seg_label, nu... | [
"0.81069267",
"0.8085033",
"0.8003013",
"0.78574216",
"0.78474563",
"0.7822191",
"0.7784274",
"0.77800703",
"0.7753589",
"0.77504784",
"0.7733223",
"0.772966",
"0.772966",
"0.7702978",
"0.7702978",
"0.76638746",
"0.76505363",
"0.76505363",
"0.76505363",
"0.7649278",
"0.764593... | 0.72269046 | 76 |
Transform a 2D array in onehot format (depth is num_classes), to a 2D array with only 1 channel, where each pixel value is the classified class key. Arguments | def reverse_one_hot(image):
x = np.argmax(image, axis = -1)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_one_hot(arr, num_classes):\n arr = arr.data.astype(int)\n a = np.zeros((arr.shape[0], num_classes))\n a[np.arange(len(a)), arr] = 1\n return tensor.Tensor(a, requires_grad=True)",
"def to_one_hot(arr, num_classes):\n arr = arr.data.astype(int)\n a = np.zeros((arr.shape[0], num_classes))\... | [
"0.8407353",
"0.8407353",
"0.8314588",
"0.80671155",
"0.79580903",
"0.7928642",
"0.78764963",
"0.7865731",
"0.7865731",
"0.7865731",
"0.7865731",
"0.78627324",
"0.7861825",
"0.7859157",
"0.78558487",
"0.7804347",
"0.7755625",
"0.77133626",
"0.7672838",
"0.7671969",
"0.7656193... | 0.0 | -1 |
Convert datetime to string. This format is specific to the 42API responses. | def datetime_to_str(date_time):
return (date_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date2str(datetime_object):\n if datetime_object is None:\n return 'None'\n return datetime_object.strftime('%Y-%m-%dT%H:%M:%S.%f')[0:-3]",
"def datetime_to_str(obj):\n return obj.strftime(\"%Y-%m-%d %H:%M:%S\")",
"def get_at_as_string(self):\n\n return self.at.strftime(\"... | [
"0.7604059",
"0.75213706",
"0.74777484",
"0.7472459",
"0.7472459",
"0.74433047",
"0.73942304",
"0.73628324",
"0.73344004",
"0.7230595",
"0.7188497",
"0.71679205",
"0.7146225",
"0.7130487",
"0.7124028",
"0.7089322",
"0.70852363",
"0.7068547",
"0.7004259",
"0.69412184",
"0.6925... | 0.7485813 | 2 |
Returns the rolling mean difference of two columns from two different dataframes | def rollmeandiff(df1, p1, df2, p2, win):
win = win * 60 * 24
df1 = df1.resample('1Min').mean()
df1 = df1.interpolate(method='time')
df2 = df2.resample('1Min').mean()
df2 = df2.interpolate(method='time')
df1['rm' + p1] = df1[p1].rolling(window=win, center=True).mean()
df2['rm' + p2] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mean_diff(x, y):\n return np.mean(x) - np.mean(y)",
"def get_rolling_mean(df, window):\n # return pd.rolling_mean(values, window=window)\n rolling_df=pd.DataFrame(index=df.index)\n for sym in df.columns:\n df_tmp= pd.Series.rolling(df[sym],window=window).mean().to_frame() # to_frame conve... | [
"0.6507714",
"0.6106984",
"0.5859848",
"0.58319014",
"0.580875",
"0.5745259",
"0.57277775",
"0.5712647",
"0.5695073",
"0.5626577",
"0.5623458",
"0.56131816",
"0.55884475",
"0.5587288",
"0.55855405",
"0.55855405",
"0.552472",
"0.54642403",
"0.5422263",
"0.5353996",
"0.5312572"... | 0.68950415 | 0 |
This function extracts the file name without file path or extension | def getfilename(path):
return path.split('\\').pop().split('/').pop().rsplit('.', 1)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_file_name(file_path):\n # ファイルパスからファイル名(拡張子含む)を取り出す\n file_name = file_path.split('/')[-1]\n # 拡張子を取り除く\n return file_name.split('.')[0]",
"def get_file_name(path: str) -> str:\n return os.path.splitext(os.path.basename(path))[0]",
"def file_name(path):\n return os.path.basename(p... | [
"0.827043",
"0.79685843",
"0.79280597",
"0.7903983",
"0.79027706",
"0.7851801",
"0.78515226",
"0.78462726",
"0.7832843",
"0.7832684",
"0.7721276",
"0.7719551",
"0.7718403",
"0.7673163",
"0.7671674",
"0.7671674",
"0.767003",
"0.76509094",
"0.76422113",
"0.76402074",
"0.7631596... | 0.7618766 | 22 |
Finds closest date index in a dataframe to a date object | def fcl(df, dtObj):
return df.iloc[np.argmin(np.abs(pd.to_datetime(df.index) - dtObj))] # remove to_pydatetime()
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_date(series, date=pd.to_datetime('today'), period='future'):\n\n x = series.copy()\n x = x.append(pd.Series(date, index=[len(x.index)]))\n x = x.ix[pd.to_datetime(x).sort_values().index]\n x = x.reset_index(drop=True)\n index_today = x[x == date].head(1)\n if period == 'future':\n ... | [
"0.68794584",
"0.614806",
"0.61420214",
"0.60998404",
"0.59301",
"0.583425",
"0.5743214",
"0.56506276",
"0.5585261",
"0.5572064",
"0.5552598",
"0.55510914",
"0.54534477",
"0.54406565",
"0.5436556",
"0.54239976",
"0.5420138",
"0.5404564",
"0.53924257",
"0.53915596",
"0.5363325... | 0.7609274 | 0 |
For compatibility with untyped UserProfile. This constructor can be deleted once all profiles in the UserProfile collection have the type information in the _t field | def __init__(self, data=None, **kw):
def _get_class_by_id(profile_id):
from solariat_bottle.db.user_profiles.social_profile import DELIMITER, TwitterProfile, FacebookProfile
pos = unicode(profile_id).rfind(DELIMITER) + 1
if pos == 0:
return self.__class__
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, security_identifier, profile_path):\n super(UserProfile, self).__init__()\n self.profile_path = profile_path\n self.security_identifier = security_identifier",
"def test_user_profile_created(self):\n\t\tself.assertTrue(\n\t\t\thasattr(self.user, 'profile'),\n\t\t\t\"User profile does ... | [
"0.6021644",
"0.6002194",
"0.5867527",
"0.5800564",
"0.5718362",
"0.5573651",
"0.5489613",
"0.54343003",
"0.53477186",
"0.5347246",
"0.5298277",
"0.5281695",
"0.52621394",
"0.525421",
"0.5253119",
"0.52517766",
"0.5250549",
"0.5230383",
"0.5224366",
"0.52037984",
"0.5165553",... | 0.66719407 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.78289187 | 79 |
The string representation of the progress bar displayed in the console. Almost identical as the one provided by plumbum, but adjusted in the width of the progress bar. | def __str__(self):
width = self.width
if self.length == 0:
percent = 1
else:
percent = max(self.value, 0) / self.length
pg_char = self.pg_char
ending = ' ' + (self.str_time_remaining()
if self.timer else '{0} of {1} complete'.format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_progress_bar(self, percent: int) -> str:\n \n full_bars = percent // 5\n\n bar = \"▓\" * full_bars\n bar += \"░\" * (20 - full_bars)\n\n return bar",
"def format(self):\n return self.__progressBar.format()",
"def __str__(self):\n # Render prefix\n ... | [
"0.76053405",
"0.7505548",
"0.7367014",
"0.72575825",
"0.7248245",
"0.7233354",
"0.71540153",
"0.71267337",
"0.71089846",
"0.7070246",
"0.69361645",
"0.6922082",
"0.6912905",
"0.6909906",
"0.69072807",
"0.6904508",
"0.68774915",
"0.68068063",
"0.6771885",
"0.669723",
"0.66647... | 0.7839979 | 0 |
Initialize the Updates class. `fromTime` is the epoch time to start your date range to search for. You can set `toTime` to set the epoch time to end your date range. Must be one week from `fromTime`. You can also set `language` with a language id to get the result in the specific language. | def __init__(self, fromTime, toTime='', language=''):
self.update_filters(fromTime, toTime, language) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, from_, to):\n r = requests.get('https://tw.rter.info/capi.php?api=HIeh22KXrDg')\n self.data = r.json()\n self.set_locations(from_, to)",
"def __init__(self, start_time, end_time, events, **other_fields):\n self._start_time = start_time\n self._end_time = end_... | [
"0.59230524",
"0.52097017",
"0.52085394",
"0.52049863",
"0.5204521",
"0.51908046",
"0.5154689",
"0.5154689",
"0.5154689",
"0.5154689",
"0.5153686",
"0.51261073",
"0.5089626",
"0.5074976",
"0.5029114",
"0.5026765",
"0.49787825",
"0.49749735",
"0.4894832",
"0.48864323",
"0.4864... | 0.6656485 | 0 |
For readability, this example uses 0based event times in milliseconds => timestamp values are between 0 and 10000 if we run it for 10 seconds. But kafka needs real 1970based timestamps, among other things to handle event retention in the topics. | def event_time_1970(event_time):
return event_time + start_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_timestamp():\n return (datetime.utcnow() - datetime(1970,1,1)).total_seconds()",
"def test_timestamp_and_datetime_extraction():\n test_datetime = datetime.datetime(2017, 1, 15)\n test_timestamp = (test_datetime - datetime.datetime(1970, 1, 1)).total_seconds() * 1000.0\n\n # valid time... | [
"0.59547764",
"0.59526",
"0.58434176",
"0.58217335",
"0.58158016",
"0.5689694",
"0.56637734",
"0.5659834",
"0.5644939",
"0.563312",
"0.56171453",
"0.5605041",
"0.55734926",
"0.5539446",
"0.5508994",
"0.55055386",
"0.5489431",
"0.54744864",
"0.544524",
"0.5440625",
"0.5433861"... | 0.61820066 | 0 |
Returns the next runs for the queue. Note that this call is NOT safe across multiple queue instances. Use `safe_next_run` to ensure that multiple queues use proper locking. | def _unsafe_next_runs(state):
blocking = _blocking_runs(state)
staged = _staged_runs()
_sync_state_for_blocking(blocking, state)
_sync_state_for_staged(staged, state)
if state.sync_state_cb:
state.sync_state_cb(state, blocking=blocking, staged=staged)
startable_runs = [run for run in sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_run(self):\n for run in self._runs:\n # Because the runs are ordered, look for the first run where\n # stop_time is in the future.\n if run.is_next_run(self._now):\n return run\n # If we arrive here, no next run (today).\n return None",
... | [
"0.6888489",
"0.6534599",
"0.61039776",
"0.597678",
"0.591212",
"0.5871271",
"0.58382994",
"0.5775463",
"0.5684589",
"0.5661192",
"0.5612328",
"0.55899966",
"0.55881333",
"0.5583479",
"0.5441215",
"0.5430594",
"0.53594023",
"0.5340618",
"0.5330885",
"0.52788",
"0.5248667",
... | 0.6550606 | 1 |
Returns the path of the top level directory for tests. | def get_tests_directory() -> str:
module_file_path = os.path.abspath(__file__)
return os.path.dirname(module_file_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dir():\n return os.path.abspath(os.path.dirname(__file__))",
"def tests_dirpath():\n execdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n return os.path.join(execdir, \"tests\")",
"def get_test_path():\n path, name = os.path.split(__file__)\n return os.p... | [
"0.81215745",
"0.8015675",
"0.7870933",
"0.7540341",
"0.7535322",
"0.75181365",
"0.74075913",
"0.7307251",
"0.7289853",
"0.72832763",
"0.7244071",
"0.71973234",
"0.71973234",
"0.71876824",
"0.7177795",
"0.7165948",
"0.71262175",
"0.70827174",
"0.70801693",
"0.70398545",
"0.70... | 0.79457223 | 2 |
Return the name of the max thermostat, if any. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def high_temperature(self):\r\n try:\r\n return str(self.connect()['main']['temp_max'])\r\n except:\r\n return '@weather_high_temperature'",
"def name(self):\n return \"Softmax. T=\" + str(self.temperature)",
"def _get_maxth(self):\n return self.__maxth",
"def _g... | [
"0.6425143",
"0.62399065",
"0.6208031",
"0.6208031",
"0.6208031",
"0.6208031",
"0.6208031",
"0.6208031",
"0.5950074",
"0.594597",
"0.5898861",
"0.58735156",
"0.5872104",
"0.5857352",
"0.58537436",
"0.58022255",
"0.57585126",
"0.5746295",
"0.56489754",
"0.5646148",
"0.5633524"... | 0.0 | -1 |
Obtain a a list of switches or DPID detected by this controller | def get_of_switches(self):
try:
of_response = requests.get(self.url + "restconf/operational/opendaylight-inventory:nodes",
headers=self.headers)
error_text = "Openflow response {}: {}".format(of_response.status_code, of_response.text)
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_switches(self):\n return [x for x,y in self.devices.items() if y.device_type == \"Switch\"]",
"def get_switch_ids():\n\n device_id_list = []\n url = 'https://' + APIC_EM + '/network-device'\n header = {'accept': 'application/json', 'X-Auth-Token': APIC_EM_TICKET}\n device_response = r... | [
"0.7138114",
"0.68955404",
"0.6731312",
"0.66347605",
"0.635237",
"0.6301039",
"0.60537493",
"0.6020206",
"0.6009499",
"0.6002091",
"0.6000891",
"0.5991667",
"0.59631324",
"0.59576833",
"0.59524524",
"0.5945641",
"0.58473474",
"0.5802822",
"0.5802769",
"0.5797686",
"0.5787094... | 0.5597906 | 39 |
Insert a new static rule | def new_flow(self, data):
try:
self.logger.debug("new_flow data: {}".format(data))
if len(self.pp2ofi) == 0:
self.obtain_port_correspondence()
# We have to build the data for the opendaylight call from the generic data
flow = {
'i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(self, rule):\n self.rule.append(rule)",
"def add_rule(self, rule):\n \n self.rules.append(rule)",
"def add_rule(self, rule) -> None:\n self.add_rules([rule])",
"def add_rule(self, rule: Rule):\n self.rules.append(rule)",
"def insert(self, rule, ident=None):\n... | [
"0.7218155",
"0.7102035",
"0.69493747",
"0.69324464",
"0.6780685",
"0.6764265",
"0.6672618",
"0.66470325",
"0.6567027",
"0.6545793",
"0.6545217",
"0.64527535",
"0.64166754",
"0.64141387",
"0.6343296",
"0.62875783",
"0.6239138",
"0.61966234",
"0.6114479",
"0.6108734",
"0.60939... | 0.0 | -1 |
This function adds a directed edge in the graph. | def add_edge(self, src, dst, cost):
self.E = self.E + 1
self.adjacency_list[src].append((dst, cost)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ... | [
"0.79517686",
"0.78506327",
"0.78417563",
"0.7782719",
"0.77156013",
"0.7635785",
"0.75246453",
"0.7524335",
"0.7522489",
"0.7518157",
"0.75078475",
"0.7492549",
"0.7461275",
"0.7374444",
"0.7371732",
"0.7360301",
"0.7341315",
"0.7331023",
"0.7323595",
"0.7316847",
"0.7316172... | 0.7251364 | 27 |
This function adds a vertex in the graph. | def add_vertex(self):
self.visited_node += [False]
self.V = self.V + 1
self.adjacency_list.append(list()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex_id):\n pass # TODO",
"def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex",
"def add_vertex(self, vertex):\n self.vertices... | [
"0.875103",
"0.8608016",
"0.8415082",
"0.8367331",
"0.83450633",
"0.828421",
"0.82081264",
"0.8164498",
"0.8113748",
"0.8113748",
"0.80491287",
"0.8013405",
"0.8009619",
"0.7969831",
"0.79670084",
"0.79648036",
"0.79360276",
"0.7923973",
"0.7911282",
"0.79079545",
"0.7897201"... | 0.8122187 | 8 |
Determine unit vector based on 1 or 2dimensional array. | def unit_vector(vector):
unit_vector = np.zeros((len(vector), vector.shape[1]))
norm = np.linalg.norm(vector, axis=1)
ndim = vector.ndim
if ndim == 1: # Handling of 1-dimensional array
unit_vector = vector / norm
elif ndim == 2: # Handling of 2-dimensional array
for i in range(0, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit(vector: np.array) -> np.array:\n return np.array([*vector]) / np.sqrt((vector * vector).sum(axis=0))",
"def unit_vector(vector):\n #print 'unit_vector'\n #print vector\n #print type(vector)\n #npvector = np.array(vector)\n return vector / np.linalg.norm(vector)",
"def unit():\n ... | [
"0.7321731",
"0.7304217",
"0.70687604",
"0.6950046",
"0.6926619",
"0.69215703",
"0.68931806",
"0.68458885",
"0.6845351",
"0.6845351",
"0.6845351",
"0.6832249",
"0.67858595",
"0.6781421",
"0.67530936",
"0.67530936",
"0.67530936",
"0.67530936",
"0.67530936",
"0.67530936",
"0.67... | 0.72651064 | 2 |
initialize Binary Heap to given number of elements | def __init__(self, size):
self.size = size
self.n = 0
self.elements = [[0, None] for i in range(size+1)]
self.positions = [0 for i in range(size+1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_heap(self):\n n = int((len(self.array) / 2) - 1)\n\n while n >= 0:\n self.heapify_top_down(n)\n n -= 1",
"def build_heap(self, arr):\n i = len(arr) // 2\n self.size = len(arr)\n self.heap_list = [-1] + arr[:]\n while i > 0:\n se... | [
"0.7082389",
"0.7030181",
"0.7023462",
"0.70082486",
"0.6881547",
"0.6849785",
"0.6783698",
"0.67486805",
"0.67057675",
"0.6696159",
"0.6689873",
"0.66707385",
"0.66586155",
"0.6636275",
"0.6628902",
"0.6588499",
"0.6579911",
"0.65409565",
"0.65363944",
"0.6530506",
"0.652090... | 0.5953304 | 65 |
Insert item into heap with given priority | def insert(self, id, priority):
self.n += 1
i = self.n
while i > 1:
pIdx = int(i/2)
p = self.elements[pIdx]
if priority > p[PRIORITY]:
break
self.elements[i] = list(p)
self.positions[p[ID]] = 1
i = pIdx
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue(self, item, priority):\n # TODO: Insert given item into heap\n ...",
"def push(self, priority: float, item):\n heappush(self._heap, (-1 * priority, item))",
"def push(self, priority, key):\n index = len(self.__heap)\n self.__position[key] = index\n self.__h... | [
"0.84859186",
"0.82513833",
"0.7681949",
"0.7636521",
"0.760399",
"0.7563727",
"0.75615716",
"0.7494399",
"0.7446312",
"0.73691",
"0.7359239",
"0.72964066",
"0.728436",
"0.7279581",
"0.7213292",
"0.72044617",
"0.71409315",
"0.7133108",
"0.7101555",
"0.7049353",
"0.70385575",
... | 0.73821056 | 9 |
Given a Linear or Convolutional module, this method checks if the module if followed by either BatchNormalization and/or a nonlinearity. In this case, returns the last of these modules as better location to compute attributions on. | def find_best_module_for_attributions(model, module):
modules = list(model.modules())
try:
current_idx = modules.index(module)
eval_module = module
for next_module in modules[current_idx+1:]:
if isinstance(next_module, _BatchNorm):
print(f"BatchNorm detected: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate_linear_layer(mod: nn.Module) -> Optional[str]:\n candidate_layer = None\n for layer_name, m in mod.named_modules():\n if isinstance(m, nn.Linear):\n candidate_layer = layer_name\n break\n\n return candidate_layer",
"def _backward_hook(\n self,\n modu... | [
"0.5874164",
"0.5598617",
"0.5475953",
"0.53826606",
"0.53732294",
"0.53249496",
"0.5290964",
"0.5246238",
"0.5246238",
"0.5218593",
"0.5208148",
"0.5115701",
"0.5114278",
"0.510309",
"0.5066047",
"0.49855718",
"0.49227604",
"0.49223298",
"0.48979035",
"0.4873188",
"0.4872289... | 0.6586325 | 0 |
Apply a function to a list of datasets and either a list of axes or labels. Applies a user provided function fn to produce a matrix with columns for each dataset and rows either given by axes or label. Both axes and label cannot both be lists. | def fn_matrix(datasets, fn, axes = None, label = None):
if isinstance(axes, list) and isinstance(label, list):
raise NotImplementedError('Only one of label or axes can be a list')
# By default, run over axes if no keywords given
if axes is None and label is None:
axes = datasets[0].columns... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_matrix(datasets, axes = None, label = None):\n fn = lambda fd, axis: fd[axis].mean()\n \n return fn_matrix(datasets, fn, axes, label)",
"def count_matrix(datasets, labels):\n \n fn = lambda fd, axis: fd.shape[0]\n return fn_matrix(datasets, fn, axes = None, label = labels)",
"def app... | [
"0.5955386",
"0.56479764",
"0.5482249",
"0.54413867",
"0.5401203",
"0.5300341",
"0.52632874",
"0.5218866",
"0.51119584",
"0.50693494",
"0.50569195",
"0.5056438",
"0.50430274",
"0.49997213",
"0.49914658",
"0.4979323",
"0.49406937",
"0.4913134",
"0.49078846",
"0.49071428",
"0.4... | 0.8217464 | 0 |
Function for initializing the fuzzy pendulum class. | def __init__(self, use_gravity = False, theta_epsilons = None,
omega_epsilons = None, alpha_epsilons = None):
self.theta_points = self.get_points(theta_epsilons)
self.omega_points = self.get_points(omega_epsilons)
self.alpha_points = self.get_points(alpha_epsilons)
theta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pendulum, name=\"Pendulum\", dt=0.01):\n super().__init__(name=name)\n self.pendulum = pendulum\n self.dt = dt",
"def __init__(\n self,\n length: np.float64,\n mass: np.float64,\n starting_angle: np.float64,\n starting_angular_vely: np.fl... | [
"0.6580058",
"0.6232801",
"0.57611996",
"0.57340485",
"0.57340485",
"0.568568",
"0.56852555",
"0.5659422",
"0.563699",
"0.5633517",
"0.5607624",
"0.55901617",
"0.5586766",
"0.5576254",
"0.55694586",
"0.5530696",
"0.5492463",
"0.5492463",
"0.5489224",
"0.5474302",
"0.5432902",... | 0.50708425 | 79 |
Return a string of the permutation in cycle notation. Example ======= >>> a = perm((1, 2), (5, 4, 3, 7)) >>> str(a) '(1 2)(3 7 5 4)' | def __str__ (self):
cycles = []
for cycle in self._getcycles():
cycles.append(' '.join(str(x) for x in cycle).join('()'))
return ''.join(cycles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__ (self):\n argument = ', '.join(str(tuple(cycle)) for cycle in self._getcycles())\n return 'perm({})'.format(argument)",
"def perm_to_string(self, perm):\n perm_string = \"\"\n for i in range(1,55):\n perm_string += str(perm(i)) + \" \"\n\n return (perm_s... | [
"0.81117016",
"0.76367056",
"0.7612344",
"0.6316861",
"0.61902285",
"0.6088137",
"0.6028935",
"0.59004784",
"0.5899719",
"0.58704484",
"0.5727235",
"0.5706823",
"0.5696822",
"0.56769",
"0.56361127",
"0.5595891",
"0.55855685",
"0.558396",
"0.5576018",
"0.5573765",
"0.55716044"... | 0.6693856 | 3 |
Return the parity of the permutation. The sign of a permutation is 1 for an odd permutation, and +1 for an even permutation. Examples ======== >>> a = perm((4,)) >>> a.sgn 1 >>> b = perm((1, 3)) >>> b.sgn 1 >>> (a2).sgn 1 >>> (a b).sgn 1 | def sgn (self):
even_cycles = filter(lambda x: not (len(x) % 2), self._getcycles())
return -2 * (len(even_cycles) % 2) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __parity_of_permutation(cls, lst: Iterable) -> int:\n\t\tparity = 1\n\t\tlst = list(lst)\n\t\tfor i in range(0, len(lst) - 1):\n\t\t\tif lst[i] != i:\n\t\t\t\tparity *= -1\n\t\t\t\tmn = SquareMatrix.__idx_of_minimum(lst[i:]) + i\n\t\t\t\t\n\t\t\t\tlst[i], lst[mn] = lst[mn], lst[i]\n\t\treturn parity",
"def p... | [
"0.67443085",
"0.6573884",
"0.6413994",
"0.6355099",
"0.6279781",
"0.6098381",
"0.6094549",
"0.5789514",
"0.5786472",
"0.55890405",
"0.557011",
"0.5478953",
"0.5435841",
"0.54098403",
"0.5306557",
"0.5283011",
"0.5219643",
"0.5187517",
"0.5169027",
"0.5127967",
"0.50901866",
... | 0.0 | -1 |
Testing the GET reviewrequests//diffs//files//originalfile/ API with draft diff | def test_with_draft_diff(self):
repository = self.create_repository(tool_name='Test')
review_request = self.create_review_request(
repository=repository,
submitter=self.user,
publish=True)
diffset = self.create_diffset(review_request, draft=True)
filed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_raw_diff(self, review):\r\n return self.http_request('/r/%s/diff/raw/' % review, {})",
"def test_with_new_file(self):\n repository = self.create_repository(tool_name='Test')\n review_request = self.create_review_request(\n repository=repository,\n submitter=self.use... | [
"0.7140718",
"0.7050583",
"0.66038525",
"0.65402764",
"0.65055305",
"0.64403284",
"0.63579106",
"0.6202091",
"0.6169201",
"0.6140135",
"0.61215425",
"0.6032468",
"0.6017773",
"0.6004842",
"0.5996947",
"0.595759",
"0.59457797",
"0.5944064",
"0.5917977",
"0.5907243",
"0.5869171... | 0.86453414 | 0 |
Heuristic function for state value, returns a score(int) | def evaluate(self, state):
transpose = state.board.transpose() # columns in state.board = rows in transpose
count = []
opponentcount = []
for row, column in zip(state.board, transpose):
rowcounter = collections.Counter(row)
columncounter = collections.Counter(column)
count.append(rowcounter.get(state.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(state):\n if wins(state, COMP):\n score = -1\n elif wins(state, HUMAN):\n score = 1\n else:\n score = 0\n\n return score",
"def evaluate(state):\r\n if wins(state, COMP):\r\n score = +1\r\n elif wins(state, HUMAN):\r\n score = -1\r\n else:\r\n ... | [
"0.78882146",
"0.784043",
"0.7345457",
"0.7157743",
"0.7139524",
"0.7114301",
"0.69793195",
"0.69246036",
"0.684755",
"0.6846288",
"0.6827858",
"0.6793",
"0.67383766",
"0.672263",
"0.67144525",
"0.669461",
"0.6675759",
"0.6610985",
"0.6583729",
"0.65820086",
"0.6579002",
"0... | 0.0 | -1 |
Renders the index page. | def index():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('ind... | [
"0.85183567",
"0.8432923",
"0.8432657",
"0.8416253",
"0.8416253",
"0.8386969",
"0.82956177",
"0.82400775",
"0.8239558",
"0.8239558",
"0.8122614",
"0.8122614",
"0.8122614",
"0.81219",
"0.81049687",
"0.8094918",
"0.80905485",
"0.80903816",
"0.8078912",
"0.8058271",
"0.8058271",... | 0.8077632 | 33 |
Get all tasks in the inbox that are not done and that belong to the specified user. | def inbox_user_notdone(user):
return Task.objects.select_related('project').filter(user=user, folder='inbox', done=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incomplete_tasks_user(user):\n return Task.objects.filter(user=user, done=False).exclude(folder='trash')",
"def incomplete_tasks(user):\n return Task.incomplete.filter(assigned=user)",
"def tasks_for_user(kls, user):\n tasks = SpecialQuestTask.objects.all()\n tasks_done = [t for t in ta... | [
"0.82049286",
"0.7706857",
"0.7463678",
"0.69252944",
"0.6806922",
"0.6736634",
"0.6635358",
"0.65539414",
"0.64536655",
"0.6424899",
"0.63940686",
"0.6285065",
"0.6187246",
"0.6129116",
"0.60526174",
"0.6032426",
"0.6010052",
"0.599861",
"0.59704995",
"0.59421873",
"0.590338... | 0.8560268 | 0 |
Get all tasks that are not done and that belong to the specified user. | def incomplete_tasks_user(user):
return Task.objects.filter(user=user, done=False).exclude(folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incomplete_tasks(user):\n return Task.incomplete.filter(assigned=user)",
"def inbox_user_notdone(user):\n return Task.objects.select_related('project').filter(user=user, folder='inbox', done=False)",
"def tasks_for_user(kls, user):\n tasks = SpecialQuestTask.objects.all()\n tasks_done =... | [
"0.8089866",
"0.78783625",
"0.77489686",
"0.72304434",
"0.677555",
"0.6740717",
"0.6708064",
"0.6651819",
"0.64525056",
"0.6360377",
"0.6315772",
"0.6309367",
"0.62835956",
"0.6203606",
"0.6168234",
"0.6152748",
"0.6097131",
"0.602229",
"0.6010326",
"0.5934783",
"0.59046227",... | 0.8372574 | 0 |
Get all projects with a tag that belong to the current user. | def projects_with_tag(request, tag):
return tag.project_set.filter(user=request.user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_for(user):\n projects = Project.get_for(user)\n return Tag.objects.filter(\n project__in=list(projects)\n )",
"def get_for(user):\n return Project.objects.filter(\n user_group__members=user\n ).distinct()",
"def get_projects_of_user(self, user_id... | [
"0.792653",
"0.656235",
"0.65059346",
"0.64130145",
"0.6383067",
"0.62712926",
"0.6190738",
"0.6176322",
"0.6139101",
"0.6036447",
"0.60219395",
"0.596392",
"0.5944466",
"0.59329563",
"0.5826548",
"0.5818838",
"0.5790577",
"0.57863843",
"0.57661813",
"0.5763478",
"0.57343364"... | 0.8496658 | 0 |
Get all tasks with a tag that belong to the current user. | def tasks_with_tag(request, tag):
return tag.task_set.filter(user=request.user).exclude(folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tasks_with_tag(self, tag, params={}, **options):\n path = \"/tags/%s/tasks\" % (tag)\n return self.client.get_collection(path, params, **options)",
"def get_tasks_tag(self, tag=None):\n cur = self.conn.cursor()\n if tag == None:\n return None\n else:\n ... | [
"0.8071348",
"0.7656431",
"0.6827161",
"0.6622916",
"0.6433297",
"0.63607097",
"0.630221",
"0.6290128",
"0.6274648",
"0.62427753",
"0.61241746",
"0.6057698",
"0.6055371",
"0.6047118",
"0.6012956",
"0.59085476",
"0.5871621",
"0.5871621",
"0.58119506",
"0.58027416",
"0.5796941"... | 0.73029834 | 2 |
Get all tasks in the trash that belong to the current user. | def trash(request):
return Task.objects.select_related('project').filter(user=request.user, folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trash_user(user):\n return Task.objects.select_related('project').filter(user=user, folder='trash')",
"def all_tasks(request):\n return Task.objects.select_related('project').filter(user=request.user).exclude(folder='trash')",
"def get_tasks(self):\n return self.tasks.all()",
"def get(self):... | [
"0.7427179",
"0.7185722",
"0.7101083",
"0.70496583",
"0.69196063",
"0.6835596",
"0.66913146",
"0.6642428",
"0.66018",
"0.6515386",
"0.65151095",
"0.6511336",
"0.650035",
"0.63794744",
"0.6363064",
"0.6290313",
"0.62643033",
"0.6246829",
"0.6192291",
"0.6169369",
"0.611715",
... | 0.690771 | 5 |
Get all tasks in the trash that belong to the specified user. | def trash_user(user):
return Task.objects.select_related('project').filter(user=user, folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incomplete_tasks_user(user):\n return Task.objects.filter(user=user, done=False).exclude(folder='trash')",
"def List(self, user=None):\n with self.acc_lock:\n self._load()\n\n result = []\n if user:\n for k, v in self.tasks.iteritems():\n if v['use... | [
"0.69775087",
"0.68069696",
"0.67699724",
"0.6760868",
"0.6738564",
"0.66116315",
"0.6606868",
"0.65669215",
"0.6454341",
"0.64496624",
"0.6445537",
"0.6438018",
"0.6417957",
"0.63501453",
"0.63219404",
"0.6218223",
"0.61527145",
"0.60759014",
"0.603698",
"0.59355927",
"0.591... | 0.7860092 | 0 |
Get all tags that belong to the current user. | def tags(request):
return Tag.objects.filter(user=request.user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_user(user):\n return Tag.objects.all().filter(owner=user)",
"def get_for(user):\n projects = Project.get_for(user)\n return Tag.objects.filter(\n project__in=list(projects)\n )",
"def get_asset_tags(user_id):\n result = db.session.query(Tag).filter(\n Not... | [
"0.7770027",
"0.7167589",
"0.6774995",
"0.66879195",
"0.6644451",
"0.6644451",
"0.6601105",
"0.6545425",
"0.65307975",
"0.6454482",
"0.64482707",
"0.644693",
"0.6423923",
"0.6391455",
"0.6347909",
"0.6283487",
"0.623402",
"0.62259024",
"0.6221772",
"0.6184805",
"0.61619717",
... | 0.7161054 | 2 |
Get all open projects that belong to the current user. | def open_projects(request):
return Project.objects.prefetch_related('task_set').filter(user=request.user, open=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_projects_user(user):\n return Project.objects.prefetch_related('task_set').filter(user=user, open=True)",
"def get_projects():\n if current_user.get_id() is None:\n return\n with database.engine.begin() as connection:\n result = connection.execute(select(\n [models.proj... | [
"0.8149598",
"0.7258314",
"0.69690424",
"0.6893914",
"0.68613523",
"0.6788141",
"0.67876947",
"0.6759775",
"0.675115",
"0.6711831",
"0.6680222",
"0.66205317",
"0.66006476",
"0.6543333",
"0.64915854",
"0.6482727",
"0.64806795",
"0.64352983",
"0.6390567",
"0.63835585",
"0.63735... | 0.75008255 | 1 |
Get all open projects that belong to the specified user. | def open_projects_user(user):
return Project.objects.prefetch_related('task_set').filter(user=user, open=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re... | [
"0.76115316",
"0.75172126",
"0.7335415",
"0.71012306",
"0.6991892",
"0.6943037",
"0.6861453",
"0.6625245",
"0.6596967",
"0.6473751",
"0.64701456",
"0.63082844",
"0.6244381",
"0.61578655",
"0.61360407",
"0.61117095",
"0.61083376",
"0.60057664",
"0.6003162",
"0.5893403",
"0.586... | 0.83851707 | 0 |
Get all projects that belong to the current user. | def projects(request):
return Project.objects.prefetch_related('task_set').filter(user=request.user) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_projects():\n if current_user.get_id() is None:\n return\n with database.engine.begin() as connection:\n result = connection.execute(select(\n [models.projects.c.project_id, models.projects.c.name, models.projects.c.path, models.projects.c.creation_date, models.projects.c.use... | [
"0.8107182",
"0.7744434",
"0.743277",
"0.7331056",
"0.7233015",
"0.7207158",
"0.7135796",
"0.7135061",
"0.71338266",
"0.71055907",
"0.7097772",
"0.7054735",
"0.7041527",
"0.6992611",
"0.69875383",
"0.6971294",
"0.6959246",
"0.6942202",
"0.69079036",
"0.68687904",
"0.6858285",... | 0.6995249 | 13 |
Get all tasks that have reminders due within 2 days. | def reminders_soon(request):
now = timezone.now()
soon = now + timedelta(days=2)
return Task.objects.filter(
user=request.user, reminder__lt=soon, reminder_seen=False, done=False).exclude(folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_tasks(self):\n if self.able:\n notifications = []\n for task in self.tasks.all():\n if task.deadline is not None:\n if self._get_delta(task.deadline) < timezone.localtime():\n self.tasks.remove(task)\n ... | [
"0.60868067",
"0.5778199",
"0.5490895",
"0.54786587",
"0.54597944",
"0.54487723",
"0.5419434",
"0.54187286",
"0.54074603",
"0.5398042",
"0.5357788",
"0.5313726",
"0.5270403",
"0.5181551",
"0.5167565",
"0.51510733",
"0.51324815",
"0.51028377",
"0.5100843",
"0.5059059",
"0.5017... | 0.6968844 | 0 |
Get all pinned tasks of the current user that are not in the Trash. | def pinned_tasks(request):
return Task.objects.filter(pinned=True, user=request.user).exclude(folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pinned_tasks_srp(request):\n return Task.objects.select_related('project').filter(pinned=True, user=request.user).exclude(folder='trash')",
"def tasks_in_project(request, project):\n return project.task_set.filter(user=request.user).exclude(folder='trash')",
"def inbox_user_notdone(user):\n return... | [
"0.7495725",
"0.6647854",
"0.6567567",
"0.6487442",
"0.6422287",
"0.6223839",
"0.62028295",
"0.6156449",
"0.6070902",
"0.6010718",
"0.5994",
"0.5989363",
"0.58836126",
"0.58729947",
"0.58417964",
"0.5832912",
"0.57969844",
"0.57758147",
"0.5748211",
"0.57470936",
"0.57338744"... | 0.8015453 | 0 |
Get all pinned tasks of the current user that are not in the Trash (with Project data). | def pinned_tasks_srp(request):
return Task.objects.select_related('project').filter(pinned=True, user=request.user).exclude(folder='trash') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pinned_tasks(request):\n return Task.objects.filter(pinned=True, user=request.user).exclude(folder='trash')",
"def tasks_in_project(request, project):\n return project.task_set.filter(user=request.user).exclude(folder='trash')",
"def inbox_user_notdone(user):\n return Task.objects.select_related('... | [
"0.8124406",
"0.7317948",
"0.69276667",
"0.69040227",
"0.65500796",
"0.64234847",
"0.63849545",
"0.619029",
"0.61190313",
"0.60669607",
"0.6053313",
"0.60026866",
"0.59531176",
"0.59410614",
"0.59409153",
"0.59241927",
"0.586358",
"0.57827556",
"0.57419086",
"0.5734217",
"0.5... | 0.7990339 | 1 |
Parse a numering value from a query string value | def parse_int_from_qs(query, name, default):
try:
if len(query) > 0:
qs = urllib.parse.parse_qs(query)
if name in qs:
return int(qs[name][0])
except ValueError:
pass
return default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(value):\n return int(value)",
"def _parseNumber(self, str):\r\n\t\tif (str.count(\".\") == 0):\r\n\t\t\treturn int(str)\r\n\t\tif (str.count(\".\") == 1):\r\n\t\t\treturn float(str)\r\n\t\treturn str",
"def parse_number(txt):\n return int(txt)",
"def _parse_positive_int_param(request, que... | [
"0.66910136",
"0.61299455",
"0.5986598",
"0.5925569",
"0.5802936",
"0.579991",
"0.57957184",
"0.5784198",
"0.5775909",
"0.5775909",
"0.57698905",
"0.5740466",
"0.5733255",
"0.57221687",
"0.5709728",
"0.564221",
"0.563953",
"0.56303036",
"0.56107944",
"0.5604608",
"0.55634034"... | 0.6875365 | 0 |
Set default parameters for reductions. | def default_pypeit_par(self):
par = pypeitpar.PypeItPar()
par['rdx']['spectrograph'] = 'not_alfosc'
# Ignore PCA
par['calibrations']['slitedges']['sync_predict'] = 'nearest'
# Set pixel flat combination method
par['calibrations']['pixelflatframe']['process']['combine'] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_parameters(self):\n super().set_default_parameters()",
"def __init__(self, default=None):\n # this will hold the list of current parameters,\n # corresponding to the reduction recipe\n self.current = []\n self.stepnames = []\n\n # this holds initial set v... | [
"0.7263637",
"0.6981142",
"0.6731152",
"0.6729822",
"0.66492987",
"0.659682",
"0.65311843",
"0.6520106",
"0.6513136",
"0.6449649",
"0.6422568",
"0.6422568",
"0.64129347",
"0.63989174",
"0.63939035",
"0.6335946",
"0.63204956",
"0.6306268",
"0.61620575",
"0.61432475",
"0.614169... | 0.0 | -1 |
Generate the meta data dict Note that the children can add to this | def init_meta(self):
meta = {}
# Required (core)
meta['ra'] = dict(ext=0, card='OBJRA')
meta['dec'] = dict(ext=0, card='OBJDEC')
meta['target'] = dict(ext=0, card='OBJECT')
meta['decker'] = dict(ext=0, card='ALAPRTNM')
meta['binning'] = dict(card=None, compound=Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_data(self) -> Dict:\n pass",
"def metadata(self) -> dict:\n\n meta = {}\n meta['name'] = self.name\n meta['potential_key'] = self.potential_key\n meta['potential_id'] = self.potential_id\n meta['potential_LAMMPS_key'] = self.potential_LAMMPS_key\n meta['p... | [
"0.7611825",
"0.6926708",
"0.6916665",
"0.6855819",
"0.6794806",
"0.6757867",
"0.67008656",
"0.6652285",
"0.6644393",
"0.6615971",
"0.66074073",
"0.65457475",
"0.65456355",
"0.65314656",
"0.6498004",
"0.64959383",
"0.6454346",
"0.64204746",
"0.6410104",
"0.64076114",
"0.63988... | 0.6578848 | 11 |
Returns the latest date to be used when purging the cache. So we do not purge files being downloaded. | def _latest_date(self):
with self.connection as db:
latest = db.execute(
"SELECT MIN(creation_date) FROM cache WHERE size IS NULL"
).fetchone()[0]
if latest is None:
latest = db.execute(
"SELECT MAX(creation_date) FROM cache... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheduled_purge_date(self) -> str:\n return pulumi.get(self, \"scheduled_purge_date\")",
"def get_latest_date(cls):\n\n return cls.query.order_by(desc(cls.date)).first().date",
"def get_last_usage_date(path: str) -> datetime:\r\n date: datetime\r\n\r\n if not os.path.exists(path):\r\n ... | [
"0.6641179",
"0.6475996",
"0.64081967",
"0.6280654",
"0.6280654",
"0.62096757",
"0.61870086",
"0.61750185",
"0.61464685",
"0.61163247",
"0.6110284",
"0.60400814",
"0.60400814",
"0.5969421",
"0.59318787",
"0.5919777",
"0.5917915",
"0.5917459",
"0.59077066",
"0.5905694",
"0.586... | 0.74889517 | 0 |
Saves the underlying tensor back to an image | def to_image_file(self, path, params=None):
assert(isinstance(path, str))
assert(len(path) > 0)
if params is not None:
assert(isinstance(params, dict))
return cv2.imwrite(path, self.to_numpy(), **params)
return cv2.imwrite(path, self.to_numpy()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_tensor(tensor, path, title=\"NONAME\"):\n image = to_image(tensor)\n\n image.save(os.path.join(path, \"{}.jpg\".format(title)))",
"def save_image(img, view, ts, output_dir):\n\n img = tf.image.decode_jpeg(img, channels=3)\n img = Image.fromarray(img.numpy(), 'RGB')\n img.save(os.path.join... | [
"0.7091996",
"0.70323",
"0.69713795",
"0.68567044",
"0.6663866",
"0.66332036",
"0.66163987",
"0.66046757",
"0.66001266",
"0.6559787",
"0.65589726",
"0.6558608",
"0.6553429",
"0.6505368",
"0.64516026",
"0.6440218",
"0.6433763",
"0.64279425",
"0.6409107",
"0.63667023",
"0.63548... | 0.0 | -1 |
Setup data for tests. | def setUp(self):
model.db.create_all()
(self.conversation,
self.users,
self.msgs) = model.seed(server.app) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()",
"def setUp(self):\n self.dataset = get_test_dataset()",
"def setUp(self):\n\n self.test_data_path = 'testing/test_data/'",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls... | [
"0.81038857",
"0.79905665",
"0.7946954",
"0.7944548",
"0.7944548",
"0.7944548",
"0.7944548",
"0.7861665",
"0.78557146",
"0.78193986",
"0.7770159",
"0.7720192",
"0.7610491",
"0.7560285",
"0.75358725",
"0.7534758",
"0.74406785",
"0.7417068",
"0.74125254",
"0.7403374",
"0.740129... | 0.0 | -1 |
Select each batch with the given positions. Once advanced indexing can be hybridized, we can revise the implementation. out[i, j, ...] = data[i, positions[i, j], ...] | def select_vectors_by_position(data, positions):
# Here, we use gather_nd to select the output from data:
# Need to compute
# out[i, j, :] = in[i, masked_position[i, j], :]
# Thus, construct a indices with shape [2, batch_size, num_masked_position], where
# indices[0, i, j] = i
# indic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_vectors_by_position(data, val, positions):\n positions = positions.astype(np.int32)\n # batch_idx.shape = (batch_size, 1) as [[0], [1], [2], ...]\n batch_idx = np.expand_dims(npx.arange_like(positions, axis=0),\n axis=1).astype(np.int32)\n batch_idx = batch_id... | [
"0.5949324",
"0.58777654",
"0.5870559",
"0.5824906",
"0.5739889",
"0.57125914",
"0.57125914",
"0.57125914",
"0.56358397",
"0.55459386",
"0.5514342",
"0.5503351",
"0.54621744",
"0.535052",
"0.53470194",
"0.5330549",
"0.53224784",
"0.5298508",
"0.5295236",
"0.5295236",
"0.52816... | 0.77109927 | 0 |
Update each batch with the given positions. Considered as a reversed process of "select_vectors_by_position", this is an operator similar to "add_vectors_by_position" that updates the results instead of adding. | def update_vectors_by_position(data, val, positions):
positions = positions.astype(np.int32)
# batch_idx.shape = (batch_size, 1) as [[0], [1], [2], ...]
batch_idx = np.expand_dims(npx.arange_like(positions, axis=0),
axis=1).astype(np.int32)
batch_idx = batch_idx + np.zer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updatePositions(self, univs):\n self.positions.update(univs)",
"def add_vectors_by_position(data, increment, positions):\n # Here, we use index_add to disperse the output from data:\n # Need to compute\n # out[i, masked_position[i, j], :] = in[i, j, :]\n # Thus, construct an indices with... | [
"0.65305287",
"0.6406578",
"0.64017546",
"0.62563574",
"0.6032919",
"0.60107887",
"0.59604865",
"0.5860675",
"0.5686449",
"0.5626992",
"0.56116253",
"0.55663425",
"0.5551926",
"0.5540829",
"0.5478529",
"0.5472426",
"0.5467219",
"0.5467219",
"0.5463622",
"0.5451387",
"0.544924... | 0.7790306 | 0 |
Handler retrieves all gates associated with a given feature. | def test_do_get__success(self, mock_get_approvers):
mock_get_approvers.return_value = ['reviewer1@example.com']
with test_app.test_request_context(self.request_path):
actual = self.handler.do_get(feature_id=self.feature_id)
expected = {
"gates": [
{
"id": 1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gates(self):\n return self.gates",
"def do_get(self, **kwargs) -> dict[str, Any]:\n feature_id = kwargs.get('feature_id', None)\n gates: list[Gate] = Gate.query(Gate.feature_id == feature_id).fetch()\n\n # No gates associated with this feature.\n if len(gates) == 0:\n return {\n ... | [
"0.6369732",
"0.59681505",
"0.5587192",
"0.5543859",
"0.55134237",
"0.54941064",
"0.54710376",
"0.54528755",
"0.54528755",
"0.54528755",
"0.5265893",
"0.5259671",
"0.5189443",
"0.51069033",
"0.50960445",
"0.50883573",
"0.5007887",
"0.4956129",
"0.49462032",
"0.492067",
"0.490... | 0.0 | -1 |
Gets the message_uris of this Operations. | def message_uris(self):
return self._message_uris | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages(self):\n return self._messages",
"def messages(self):\n return self._messages",
"def messages(self):\n return self._messages",
"def messages(self):\n return MessageNotification.messages",
"def get_links(self):\n msg = self.get_message()\n return msg.sp... | [
"0.5953097",
"0.5953097",
"0.5953097",
"0.59343493",
"0.56942403",
"0.56044215",
"0.55547917",
"0.5545718",
"0.5545718",
"0.5545718",
"0.5464977",
"0.5460213",
"0.5458392",
"0.5444083",
"0.54419035",
"0.5439234",
"0.54106987",
"0.54048944",
"0.54048944",
"0.53961825",
"0.5347... | 0.84862775 | 0 |
Sets the message_uris of this Operations. | def message_uris(self, message_uris):
self._message_uris = message_uris | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_uris(self):\n return self._message_uris",
"def messages(self, messages):\n\n self._messages = messages",
"def messages(self, messages):\n\n self._messages = messages",
"def messages(self, messages):\n\n self._messages = messages",
"def messages(self, messages):\n ... | [
"0.5986909",
"0.584561",
"0.584561",
"0.584561",
"0.5802213",
"0.5631539",
"0.5564232",
"0.5247202",
"0.51873374",
"0.51599824",
"0.5149855",
"0.51197743",
"0.5019313",
"0.4973826",
"0.4967919",
"0.48751172",
"0.48226613",
"0.47167608",
"0.46721545",
"0.46629313",
"0.46483377... | 0.82470834 | 0 |
Sets the messages of this Operations. | def messages(self, messages):
self._messages = messages | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages(self, messages):\n self._messages = messages",
"def messages(self, messages):\r\n\r\n self._messages = messages",
"def _set_message(self, value):\n self.__message = value",
"def updateMessages(self, parameters):\n return",
"def updateMessages(self, parameters):\n ... | [
"0.8014013",
"0.79535276",
"0.6556355",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
"0.6436502",
... | 0.7911829 | 4 |
Gets the actions of this Operations. | def actions(self):
return self._actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self):\n\n return self._actions.getSlice(0)",
"def actions(self):\n\n return self._actions.getSlice(0)",
"def getActions(self):\n actions = self.actions[:]\n return actions",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n ret... | [
"0.8242834",
"0.8242834",
"0.8213049",
"0.81740016",
"0.8167719",
"0.8138019",
"0.78985786",
"0.78384584",
"0.77870494",
"0.7659093",
"0.7621263",
"0.7621263",
"0.7621263",
"0.7568886",
"0.75611556",
"0.75556266",
"0.75449073",
"0.7506917",
"0.7506917",
"0.728141",
"0.7253792... | 0.82548857 | 0 |
Push new node to priority queue | def pushPriorityQueue(self, node):
if self.priority == "bin":
heappush(self.unvisited, node)
elif self.priority == "fib":
fheappush(self.unvisited, node)
else: # list
self.unvisited.append(node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue(self, item, priority):\n # TODO: Insert given item into heap\n ...",
"def push(self, transition, priority):\n priority = priority * 10000\n priority = self._clip_p(priority)\n priority = int(priority)\n # if we reached the capacity, overwrite the oldest item\... | [
"0.7484956",
"0.71449536",
"0.71334535",
"0.70161366",
"0.6942078",
"0.6931039",
"0.68956727",
"0.6844681",
"0.6830522",
"0.6796128",
"0.6773003",
"0.67547184",
"0.6739763",
"0.6718525",
"0.67164814",
"0.669749",
"0.669749",
"0.66956466",
"0.66913855",
"0.66742855",
"0.667388... | 0.7895078 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 76 |
Updates product property values. | def update_product_values(request, property_group_id):
property_group = lfs_get_object_or_404(PropertyGroup, pk=property_group_id)
product_ids = request.POST.getlist("product-id")
products = Product.objects.filter(pk__in=product_ids)
for product in products:
for property in property_group.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateProperties(self):\n self.manage_changeProperties(title = self.getTitle(),\n description = self.getDescription(),\n basepath = self.getPath())",
"def add_custom_properties(product):\n \n # TODO: may override property of o... | [
"0.6657335",
"0.6611141",
"0.653149",
"0.6509591",
"0.6412747",
"0.6363334",
"0.63390166",
"0.62904555",
"0.62843716",
"0.6239701",
"0.6186918",
"0.61564195",
"0.61431366",
"0.6128051",
"0.6114813",
"0.6054787",
"0.60273755",
"0.60148674",
"0.5928027",
"0.59201825",
"0.590318... | 0.74405664 | 0 |
Get absolute assets directory using sqlite database path as a reference. | def _get_asset_dir(self, database):
if not database:
return 'assets'
path = os.path.dirname(database)
return os.path.join(path, 'assets') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_asset_path(name):\n return os.path.join(constants.ROOT_DIR, 'assets', name)",
"def get_db_path():\n \n return(db_run.db_abs_path)",
"def generate_sqlite_db_path():\n tmp_dir = str(tempfile.mkdtemp())\n abspath = os.path.abspath( # noqa: PTH100\n os.path.join( # noqa: PTH118\n ... | [
"0.68366194",
"0.66038924",
"0.65854824",
"0.6567497",
"0.6551408",
"0.653602",
"0.6420977",
"0.6269323",
"0.6231511",
"0.62173945",
"0.607654",
"0.60459805",
"0.60380095",
"0.59839976",
"0.59738487",
"0.5959194",
"0.5936903",
"0.5915608",
"0.59102046",
"0.5904048",
"0.589010... | 0.8476665 | 0 |
Creates a matrix filled with zeros. | def zeros_matrix(self, rows, cols):
M = []
while len(M) < rows:
M.append([])
while len(M[-1]) < cols:
M[-1].append(0.0)
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in range(width):\n newrow = [0] * height\n returnvalue.addRow(*newrow)\n return returnvalue",
"def ze... | [
"0.83105844",
"0.82251585",
"0.8177624",
"0.80738527",
"0.8053129",
"0.7960837",
"0.7950135",
"0.7950135",
"0.7792159",
"0.7705187",
"0.7678834",
"0.76101226",
"0.7580145",
"0.74690133",
"0.7464018",
"0.7462307",
"0.74617356",
"0.7240482",
"0.7231481",
"0.718796",
"0.71302176... | 0.814171 | 3 |
Checks the equality of two matrices. | def check_matrix_equality(self, Am, Bm, tol=None):
# Section 1: First ensure matrices have same dimensions
if len(Am) != len(Bm) or len(Am[0]) != len(Bm[0]):
return False
# Section 2: Check element by element equality
# use tolerance if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsEqual(*args, **kwargs):\n return _gdi_.GraphicsMatrix_IsEqual(*args, **kwargs)",
"def _are_matrix_elements_equal(element, another_element):\n difference = sympy.N(sympy.expand(element) - sympy.expand(another_element))\n\n try:\n return np.allclose(\n float(sympy.re(difference... | [
"0.7714554",
"0.740203",
"0.7398573",
"0.7387387",
"0.73428464",
"0.73169017",
"0.7311009",
"0.7276583",
"0.7269618",
"0.7231773",
"0.71865493",
"0.71372896",
"0.7098439",
"0.7072754",
"0.7070013",
"0.7067749",
"0.70479655",
"0.69766957",
"0.69462913",
"0.6940412",
"0.693163"... | 0.7137955 | 11 |
converts dense tensor x to sparse format | def to_sparse(x):
x_typename = torch.typename(x).split('.')[-1]
sparse_tensortype = getattr(torch.sparse, x_typename)
indices = torch.nonzero(x)
if len(indices.shape) == 0: # if all elements are zeros
return sparse_tensortype(*x.shape)
indices = indices.t()
values = x[tuple(indices[i] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SimpleSparseTensorFrom(x):\n x_ix = []\n x_val = []\n for batch_i, batch in enumerate(x):\n for time, val in enumerate(batch):\n x_ix.append([batch_i, time])\n x_val.append(val)\n x_shape = [len(x), np.asarray(x_ix).max(0)[1]+1]\n x_ix = tf.constant(x_ix, tf.int64)\n x_val = tf.constant(x_va... | [
"0.7648397",
"0.7599587",
"0.7598531",
"0.75391126",
"0.73031443",
"0.73001194",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72935396",
"0.72800845",
... | 0.8253765 | 0 |
automatically assign symbols to different clusters, start with '!' | def symbolsAssign(clusters):
alphabet = ['A','a','B','b','C','c','D','d','E','e',
'F','f','G','g','H','h','I','i','J','j',
'K','k','L','l','M','m','N','n','O','o',
'P','p','Q','q','R','r','S','s','T','t',
'U','u','V','v','W','w','X','x','Y','y','Z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_symbols(self):\n self.add_labels()\n variable_counter = 16\n for i in range(len(self.commands)):\n command = self.commands[i]\n if command.startswith('@'): # symbols always reside in A instructions\n value = command.split('@')[1]\n ... | [
"0.57611203",
"0.56967247",
"0.5549534",
"0.5420195",
"0.53969574",
"0.5377274",
"0.5376027",
"0.53635615",
"0.5308677",
"0.530028",
"0.5273284",
"0.5243025",
"0.5210544",
"0.5198164",
"0.5182084",
"0.5175294",
"0.5164498",
"0.5142797",
"0.5134589",
"0.5123554",
"0.5113748",
... | 0.60405517 | 0 |
Initializes an edge between vertices v and w of the given weight. | def __init__(self, v, w, weight):
if v < 0:
raise IllegalArgumentException("vertex index must be a nonnegative integer")
if w < 0:
raise IllegalArgumentException("vertex index must be a nonnegative integer")
if math.isnan(weight):
raise IllegalArgumentExceptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weight(w):\n shape = w.shape\n if len(shape) == 4:\n i, o, u, v = shape\n k = np.sqrt(6 / (i * u * v + o * u * v))\n w.data.uniform_(-k, k)\n elif len(shape) == 2:\n k = np.sqrt(6 / sum(shape))\n w.data.uniform_(-k, k)\n elif len(shape) == 1:\n w.data.zero_()",
"def __init__(self, ... | [
"0.7059962",
"0.6985204",
"0.6741537",
"0.67109",
"0.6605743",
"0.6535024",
"0.6383154",
"0.6337379",
"0.62953526",
"0.62523234",
"0.6142419",
"0.609523",
"0.6093473",
"0.60727596",
"0.60598975",
"0.6058051",
"0.60504174",
"0.60291606",
"0.59892726",
"0.5980371",
"0.59776914"... | 0.7653025 | 0 |
Returns either endpoint of this edge. | def either(self):
return self._v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint\")",
"def endpoint(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint\")",
"def endpoint(self):\n return self.Endpoint",
"def getEndpoint(nodeTuple, pointList, direction, isRev... | [
"0.6749542",
"0.6749542",
"0.6695471",
"0.66825694",
"0.66606414",
"0.665726",
"0.66341835",
"0.6627366",
"0.6603337",
"0.65539706",
"0.65478814",
"0.65270776",
"0.64598405",
"0.63791895",
"0.6352825",
"0.6341761",
"0.6341761",
"0.63368154",
"0.6252958",
"0.6249637",
"0.62495... | 0.0 | -1 |
Checks if this edge has smaller weight than other edge | def __lt__(self, other):
return self.weight() < other.weight() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.weight < other.weight",
"def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return F... | [
"0.7408439",
"0.717427",
"0.717427",
"0.71102875",
"0.7014654",
"0.67417485",
"0.67417485",
"0.66068983",
"0.66068983",
"0.6588866",
"0.6588866",
"0.6411511",
"0.63798916",
"0.6275046",
"0.62529576",
"0.6252676",
"0.6228883",
"0.6222635",
"0.61763614",
"0.6157413",
"0.6133057... | 0.7314293 | 1 |
Checks if this edge has greater weight than other edge | def __gt__(self, other):
return self.weight() > other.weight() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.weight > other.weight",
"def __gt__(self, other):\n if self.head_vertex <= other.head_vertex:\n return False\n elif self.tail_vertex <= other.tail_vertex:\n return False\n elif self.weight <= other.weight:\n retur... | [
"0.7963535",
"0.7318416",
"0.7318416",
"0.7129417",
"0.7129417",
"0.68948746",
"0.68125826",
"0.6747067",
"0.6747067",
"0.6555964",
"0.6505616",
"0.64786625",
"0.64471745",
"0.6431947",
"0.6394534",
"0.6393306",
"0.6285698",
"0.62731266",
"0.623691",
"0.623691",
"0.62277573",... | 0.78941107 | 1 |
Returns a string representation of this edge. | def __repr__(self):
return "{}-{} {:.5f}".format(self._v, self._w, self._weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n # string representation includes values of all inner fields\n return \\\n \"Edge Weight: \" + str(self.weight) + \"\\n\" + \\\n \"Edge Attributes: \" + str(self.attributes) + \"\\n\" + \\\n \"First Incident Node: \\n\" + str(self.first_incident_no... | [
"0.83645093",
"0.82307255",
"0.817626",
"0.783757",
"0.7708114",
"0.7678149",
"0.7678149",
"0.75732565",
"0.75467056",
"0.74453324",
"0.7422453",
"0.7406451",
"0.7398116",
"0.7396412",
"0.73224294",
"0.727886",
"0.727727",
"0.727727",
"0.7249402",
"0.72165906",
"0.71373504",
... | 0.0 | -1 |
Create an empty linkedlist. | def __init__(self):
self._head = self._Node(None, None, None)
self._tail = self._Node(None, None, None)
self._head._next = self._tail
self._tail._prev = self._head
self._size = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_empty_ll():\n from linked_list import Linked_List\n this_empty_ll = Linked_List()\n return this_empty_ll",
"def create_empty_node():\n from linked_list import Node\n return Node()",
"def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = n... | [
"0.79805195",
"0.791627",
"0.7225095",
"0.70803684",
"0.6935301",
"0.6820973",
"0.67908347",
"0.6772688",
"0.6715047",
"0.6715047",
"0.66754013",
"0.6664002",
"0.66501695",
"0.6630796",
"0.6607086",
"0.65998125",
"0.6582175",
"0.6582175",
"0.6582175",
"0.6578814",
"0.65773267... | 0.70088804 | 4 |
Return (but do not remove) the element at the front of the list. Raise Empty exception if the list is empty. | def first(self):
if self.is_empty():
raise Empty('list is empty')
return self._head._next._element # front aligned with head of list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._element # front aligned with head of list",
"def first(self):\n if self.is_empty():\n raise Empty('Queue is empty')\n return self._head._element #... | [
"0.7752586",
"0.74099046",
"0.7282146",
"0.72793466",
"0.7206405",
"0.71876144",
"0.7164988",
"0.70447963",
"0.69901526",
"0.69766706",
"0.6973059",
"0.68946236",
"0.6859805",
"0.6850732",
"0.6834931",
"0.67847836",
"0.6758627",
"0.6758318",
"0.6750658",
"0.672823",
"0.670278... | 0.7707012 | 1 |
Return (but do not remove) the element at the end of the list. Raise Empty exception if the list is empty. | def last(self):
if self.is_empty():
raise Empty('list is empty')
return self._tail._prev._element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._tail._element",
"def peek(self):\n if self.is_empty():\n return None\n list_length = len(self.list) - 1\n return self.list[list_length]",
"def peek(self):\n # TODO... | [
"0.74378264",
"0.71719545",
"0.7125959",
"0.71155465",
"0.6989195",
"0.69059515",
"0.6636301",
"0.6633014",
"0.66323364",
"0.65883636",
"0.6557477",
"0.65439236",
"0.6501861",
"0.6498579",
"0.64924735",
"0.64650846",
"0.64434916",
"0.6442915",
"0.64238566",
"0.6406884",
"0.63... | 0.7323044 | 1 |
Remove and return the first element of the list. Raise Empty exception if the list is empty. | def delete_first(self):
if self.is_empty():
raise Empty('list is empty')
return self._delete_node(self._head._next) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeFirst(self):\n if self.__nelems == 0:\n raise BaseException('Empty List')\n\n temp = self.__head\n if self.__nelems == 1:\n self.__head = self.__tail = None\n\n else:\n self.__head = temp.getNext()\n temp.setNext(None)\n\n sel... | [
"0.78991073",
"0.75871634",
"0.72870994",
"0.72291464",
"0.7227498",
"0.71314",
"0.7059464",
"0.7025865",
"0.68990326",
"0.6868407",
"0.68648756",
"0.67826676",
"0.67779195",
"0.6756591",
"0.67530614",
"0.67460805",
"0.6603666",
"0.6589892",
"0.6575842",
"0.6547908",
"0.65375... | 0.7575001 | 2 |
Remove and return the last element of the list. Raise Empty exception if the list is empty. | def delete_last(self):
if self.is_empty():
raise Empty('list is empty')
return self._delete_node(self._head._next) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._tail._element",
"def removeLast(self):\n\n if self.__nelems == 0:\n raise BaseException('Empty List')\n\n temp = self.__tail\n\n if self.__nelems == 1:\n self.__... | [
"0.7952911",
"0.78545207",
"0.7734324",
"0.76807016",
"0.75608784",
"0.75423265",
"0.7471553",
"0.74297446",
"0.74237794",
"0.73801297",
"0.73182845",
"0.7303615",
"0.71922785",
"0.7168534",
"0.71666306",
"0.7153403",
"0.7095375",
"0.70027524",
"0.6975392",
"0.69069004",
"0.6... | 0.77929187 | 2 |
Add an element to the front of list. | def add_first(self, e):
self._insert_between(e, self._head, self._head._next) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def append_front(self, item):\n\n self.front = Node(item, self.front)",
"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 = ne... | [
"0.79423994",
"0.74610764",
"0.73641574",
"0.73481613",
"0.72543836",
"0.7247341",
"0.72420067",
"0.7226393",
"0.7208336",
"0.7124624",
"0.7069336",
"0.702636",
"0.69689316",
"0.68480355",
"0.68480355",
"0.6838375",
"0.6817686",
"0.6788466",
"0.67804295",
"0.6752576",
"0.6709... | 0.6809373 | 17 |
gets the file, converts into a dictionary, converts the dict to df and returns the dataframe | def do_it_all(path):
df = pd.DataFrame(columns=['eyr', 'byr', 'iyr',
'hgt', 'hcl', 'ecl', 'pid', 'cid'])
with open(path, 'r') as f:
identities = f.read().split('\n\n')
for idx in range(len(identities)):
word = identities[idx].split('\n')
mydict = break_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_df(filepath):\n dd = [json.loads(f) for f in open(filepath).readlines()]\n return pd.DataFrame(dd)",
"def read_file(fname: str) -> pd.DataFrame:\n raw_data = (\n pd.read_hdf(fname).to_frame().reset_index(level=[0, 1]).loc[ANALYSIS_DATE]\n )\n raw_data[\"date\"] ... | [
"0.7090648",
"0.68936205",
"0.68233174",
"0.68092513",
"0.6763396",
"0.67625344",
"0.65999454",
"0.659917",
"0.6573855",
"0.6566392",
"0.6560054",
"0.6549813",
"0.65459555",
"0.652101",
"0.647713",
"0.64649713",
"0.6432914",
"0.6427686",
"0.64103186",
"0.6371364",
"0.6334442"... | 0.58499676 | 94 |
Get current config list located in pareto front. | def best_config(self):
if self.total_propose == 0:
idx = random.randint(0, len(self.config_list))
result = {'config_id': idx,
'score': -1 * float('inf'),
'configs': self.config_list[idx]}
return [result]
else:
pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_configs(self):\n return self.stage.active_configs",
"def get_config_app(self):\n if self.degree(self.id) in [0, 1, 2]:\n return self.get_config_j(self.id)\n else:\n return list(set(self.get_config_j(self.id)) | set(self.get_prp_j(self.id)[1]))",
"def gather... | [
"0.63654137",
"0.6180223",
"0.61520773",
"0.60510564",
"0.60289204",
"0.60077065",
"0.59973365",
"0.59450805",
"0.59295607",
"0.59282494",
"0.5903441",
"0.5851795",
"0.58506054",
"0.5846849",
"0.5841717",
"0.58347124",
"0.58102137",
"0.57993484",
"0.5792543",
"0.5792492",
"0.... | 0.0 | -1 |
Indicates whether the file type is not permitted Returns False if no extension is found | def is_excluded_filetype(f):
index = f.find('.')
if index < 0:
return False
ext = f[index:]
return ext in EXCLUDE_EXTS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_allowed(self):\n if self._allowed_ext:\n if self.get_ext() not in self._allowed_ext:\n return False\n \n return True",
"def test_09_is_allowed_file_no_ext(self):\n\n filename = \"somename\"\n is_allowed = utils.is_allowed_file(filename)\n ... | [
"0.83240396",
"0.77942693",
"0.76151675",
"0.7530704",
"0.75259846",
"0.7524645",
"0.7352044",
"0.73514414",
"0.73280877",
"0.7302475",
"0.7295002",
"0.7291362",
"0.7291362",
"0.72735536",
"0.72735536",
"0.72735536",
"0.72735536",
"0.72735536",
"0.72735536",
"0.7272168",
"0.7... | 0.71753895 | 31 |
Returns the delivery count for a message from the rabbit queue. The value is autoset by rabbitmq. | def get_delivery_count_from_properties(properties):
delivery_count = 0
if properties.headers and 'x-delivery-count' in properties.headers:
delivery_count = properties.headers['x-delivery-count']
return delivery_count + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_delivery_count(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"max_delivery_count\")",
"def queue_message_count(self, queue_name):\n queue_list = self.__session.getObjects(_class=\"queue\", _name=queue_name)\n if len(queue_list):\n return queue_list[0].m... | [
"0.6709223",
"0.66982794",
"0.66167665",
"0.6444206",
"0.6311343",
"0.6303713",
"0.6274923",
"0.62372905",
"0.6234774",
"0.6212053",
"0.6185387",
"0.6179889",
"0.6149624",
"0.610546",
"0.60466397",
"0.60238516",
"0.59542876",
"0.5885226",
"0.58820045",
"0.58453333",
"0.583301... | 0.6469772 | 3 |
Set the value of the AWSAccessKeyId input for this Choreo. ((required, string) The Access Key ID provided by Amazon Web Services.) | def set_AWSAccessKeyId(self, value):
super(PutBucketWebsiteRedirectInputSet, self)._set_input('AWSAccessKeyId', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_AWSAccessKeyId(self, value):\n super(DescribeEvaluationsInputSet, self)._set_input('AWSAccessKeyId', value)",
"def set_AWSAccessKeyId(self, value):\n super(ListOrdersInputSet, self)._set_input('AWSAccessKeyId', value)",
"def set_AWSSecretKeyId(self, value):\n super(PutBucketWebsite... | [
"0.7270082",
"0.6704517",
"0.5431787",
"0.4765893",
"0.46070117",
"0.46001327",
"0.45747438",
"0.44713902",
"0.42492792",
"0.4188816",
"0.4122087",
"0.41139",
"0.41126734",
"0.41098735",
"0.40647092",
"0.39668",
"0.39527822",
"0.3917529",
"0.38755238",
"0.38383633",
"0.380253... | 0.71043444 | 1 |
Set the value of the AWSSecretKeyId input for this Choreo. ((required, string) The Secret Key ID provided by Amazon Web Services.) | def set_AWSSecretKeyId(self, value):
super(PutBucketWebsiteRedirectInputSet, self)._set_input('AWSSecretKeyId', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_AWSSecretKeyId(self, value):\n super(DescribeEvaluationsInputSet, self)._set_input('AWSSecretKeyId', value)",
"def set_AWSSecretKeyId(self, value):\n super(ListOrdersInputSet, self)._set_input('AWSSecretKeyId', value)",
"def vpc_id(self, vpc_id):\n self._vpc_id = vpc_id",
"def se... | [
"0.70131356",
"0.64643115",
"0.546943",
"0.5330544",
"0.51882875",
"0.48380002",
"0.48380002",
"0.48380002",
"0.48380002",
"0.48380002",
"0.48380002",
"0.4723722",
"0.4640567",
"0.4640567",
"0.4640567",
"0.4640567",
"0.4640567",
"0.4640567",
"0.4640567",
"0.4640567",
"0.46405... | 0.7062842 | 0 |
It calculates the energy of the unit cell. | def getEnergy(self, recalculate):
if recalculate:
try:
calc = (GULP(keywords=self.params["gulp_keywords_calculate_energy"]["value"],
library=self.params["gulp_library"]["value"]))
self.structure.set_calculator(calc)
self.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))",
"def computeEnergy(self):\n\t\tGmo = self.Gmo\n\t\te = self.e\n\t\tself.Ec = 0.0\n\n\t\tfor i in range( self.nocc ):\n\t\t\tfor j in range( self.nocc ):\n\t\t\t\tfor a in range( self.nocc,se... | [
"0.7788216",
"0.7442665",
"0.739711",
"0.73937464",
"0.7345643",
"0.7271584",
"0.7242835",
"0.7219529",
"0.72008675",
"0.71812636",
"0.7119352",
"0.70640564",
"0.7032864",
"0.7003838",
"0.69992054",
"0.6998398",
"0.69614077",
"0.69602054",
"0.6937596",
"0.6913324",
"0.6892815... | 0.0 | -1 |
Return a dictionary of axis specs vars is the list of variables to specify vardict is a variable dictionary object | def getDataStats(vars, vardict):
# for scale variables, make dictionary entries for min and max values
# for categorical variables make dictionary entries for category lists based on value labels
scaletemplate = r"""SCALE: linear(dim(1), min(%(themin)s), max(%(themax)s))"""
cattemplate = r"""SCALE:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variable_values_dict(self, vars):\n vars = list(vars)\n values = self.get_variable_values(vars)\n ret = OrderedDict()\n for var, value in zip(vars, values):\n ret[var] = value\n return ret",
"def dictOfVariables(self):\n return {x.name: x for x in self... | [
"0.6238873",
"0.62217146",
"0.6213855",
"0.60766494",
"0.6053211",
"0.60239667",
"0.5972697",
"0.594253",
"0.59311473",
"0.5906865",
"0.5894809",
"0.58656734",
"0.5848857",
"0.5814869",
"0.5781686",
"0.5773028",
"0.57529366",
"0.57319224",
"0.57212204",
"0.57167083",
"0.57124... | 0.0 | -1 |
Return list of current split variables and splitmode If no splits, return is [], None | def getsplitinfo():
splitvarlist = spss.GetSplitVariableNames()
if len(splitvarlist) == 0:
return [], None
else:
splittype = spssaux.getShow("split", olang="english")
if splittype.lower().startswith("layer"):
splittype="layered"
else:
splittype="s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splits(self) -> List[int]:\n if self._splits is None:\n self.RefreshStats()\n return self._splits",
"def splittable_variables(self) -> List[int]:\n #print(\"enter bartpy/bartpy/data.py CovariateMatrix splittable_variables\")\n \n for i in range(0, self._n_features):\n ... | [
"0.6435344",
"0.63009703",
"0.6277274",
"0.6189077",
"0.61751056",
"0.5983746",
"0.59805334",
"0.58524466",
"0.579001",
"0.5751952",
"0.57246643",
"0.5707878",
"0.56781507",
"0.56420803",
"0.56128216",
"0.5612438",
"0.5592472",
"0.55600035",
"0.55032307",
"0.54625386",
"0.544... | 0.77714163 | 0 |
build self attributes from a dictionary d. | def attributesFromDict(d):
self = d.pop('self')
for name, value in d.items():
setattr(self, name, value)
"""Manage a log file"""
def __init__(self, logfile):
"""logfile is the file name or None"""
self.logfile = logfile
if self. logfile:
self.fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_from_dict(self, d):\n for k, v in d.items():\n # First, keys must be strings, not ints\n if isinstance(k, int):\n k = str(k)\n # Now, assign to the key, handling nested AttrDicts properly\n if isinstance(v, dict):\n self.set_... | [
"0.735037",
"0.7038443",
"0.6853879",
"0.6852573",
"0.67283714",
"0.6691564",
"0.66080815",
"0.65285236",
"0.65113527",
"0.6495476",
"0.646025",
"0.64567804",
"0.6348805",
"0.6264283",
"0.62199086",
"0.6208103",
"0.6198838",
"0.61819416",
"0.6143907",
"0.6136911",
"0.61367005... | 0.0 | -1 |
Updates the camera location to that which is in the currently activated view unless a vtkOpenGLCamera is specified. | def update(self, cam=None):
if cam is None:
# This allows use to dynamicly select cameras
cam = GetActiveCamera()
self.orientation = cam.GetOrientation()
self.position = cam.GetPosition()
self.focus = cam.GetFocalPoint()
self.viewup = cam.GetViewUp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_camera(self, render=False):\n self._renderer.set_camera(\n # needs fix, distance moves when focal point updates\n distance=self._renderer.plotter.camera.distance * 0.9,\n focalpoint=tuple(self._ras),\n reset_camera=False)",
"def setup_camera(self) ->... | [
"0.7213129",
"0.70466304",
"0.69922227",
"0.6894294",
"0.6867658",
"0.6810971",
"0.65627605",
"0.6557848",
"0.6522619",
"0.65115494",
"0.65044063",
"0.64349824",
"0.64078206",
"0.6363573",
"0.63012123",
"0.6270064",
"0.6268989",
"0.62382203",
"0.6235302",
"0.6221746",
"0.6177... | 0.6319437 | 14 |
Make an InputLayer for specified data. This method will construct the input layer, as well as the placeholder inside the input layer for specified data. The placeholder will have the shape | def make_input(name, data, dtype=None, **tags):
from ..utils import make_placeholder_for
input_var = make_placeholder_for(name, data, dtype=dtype, **tags)
input_layer = InputLayer(input_var, shape=(None,) + data.shape[1:])
return input_layer, input_var | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_placeholders(data):\r\n\tdata_shape = data.feature_shape()\r\n\twith tf.name_scope(\"input\"):\r\n\t\tinput = tf.placeholder(tf.float32, [None, *data_shape], name=\"image\")\r\n\t\tlabel = tf.placeholder(tf.int32, [None], name=\"label\")\r\n\t\tval_unit = tf.constant(1.0, tf.float32)\r\n\t\trate_retain = ... | [
"0.65807885",
"0.64615226",
"0.6299417",
"0.62185526",
"0.6193083",
"0.60677046",
"0.60083956",
"0.5999986",
"0.5987832",
"0.5959069",
"0.593917",
"0.5901465",
"0.5837989",
"0.58227926",
"0.5805698",
"0.58007395",
"0.5784859",
"0.5752199",
"0.57337534",
"0.5709357",
"0.570315... | 0.81865895 | 0 |
Separate a comma or space separated list. | def separate_list_input(input_: str) -> List[str]:
no_commas = input_.replace(",", " ")
# Each string is naturally unicode, this causes problems with M2Crypto SANs
# TODO: check if above is still true when M2Crypto is gone ^
return [str(string) for string in no_commas.split()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma(s):\n return s.split(',')",
"def listify(item, do_strip=False):\n if not item:\n return []\n elif isinstance(item, list):\n return item\n elif isinstance(item, string_types) and item.count(','):\n if do_strip:\n return [token.strip() for token in ite... | [
"0.7227408",
"0.7016272",
"0.6702853",
"0.66007435",
"0.660072",
"0.65889245",
"0.65438014",
"0.6532363",
"0.6527039",
"0.61547697",
"0.6139123",
"0.6132996",
"0.61135685",
"0.6108641",
"0.6071673",
"0.6064285",
"0.6044566",
"0.604434",
"0.6010855",
"0.6003237",
"0.59881717",... | 0.65598553 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.