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 |
|---|---|---|---|---|---|---|
Function that states if a vector is probabilistic or not (sum of its components = 1) vec, the vector to check a boolean that states if the vector is probabilistic | def isProbabilisticVector(vec):
return sum(vec)==1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability(prob):\n return random.random() <= prob",
"def isStochastic(vector):\n\n # if not equal to 1 within machine precision\n if abs(np.sum(vector) - 1) < sys.float_info.epsilon:\n return True",
"def validate(self):\n if self.isEmpty(): return False\n\n sum = 0\n ... | [
"0.642738",
"0.6312163",
"0.6281326",
"0.61793745",
"0.59798837",
"0.5956715",
"0.5937184",
"0.5919313",
"0.5906567",
"0.5899048",
"0.58743906",
"0.5861674",
"0.5832086",
"0.5813144",
"0.57922506",
"0.57682776",
"0.5760733",
"0.5746283",
"0.573617",
"0.5723515",
"0.5705256",
... | 0.9000012 | 0 |
Gives the array with the initial concentration value for all species. | def obtainSpeciesArray(inputsArray, nameDic, initValue, initializationDic, C0):
speciesArray=np.zeros((inputsArray.shape[0], len(list(nameDic.keys()))))
for idx,inputs in enumerate(inputsArray):
SDic = getSpeciesAtValue(nameDic, initValue)
for idx2,inputConcentration in enumerate(inputs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInitialConcentration(self):\n return _libsbml.Species_getInitialConcentration(self)",
"def concentration(self):\n return [node.concentration for node in self]",
"def setInitialConcentration(self, *args):\n return _libsbml.Species_setInitialConcentration(self, *args)",
"def unsetIn... | [
"0.72150445",
"0.6410942",
"0.63504994",
"0.60634065",
"0.6022775",
"0.59256357",
"0.5879324",
"0.5800113",
"0.57668775",
"0.57466304",
"0.57452697",
"0.57252234",
"0.57205105",
"0.5675663",
"0.5668488",
"0.5667991",
"0.56271607",
"0.5577331",
"0.55484664",
"0.55445266",
"0.5... | 0.6259297 | 3 |
Sets an album for an EasyID3 object | def set_album(audio: EasyID3, album):
audio['album'] = album
audio.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_album_artist(audio: EasyID3, album_artist):\r\n audio['albumartist'] = album_artist\r\n audio.save()",
"def set_album(self, album: str) -> None:\n self.album = album",
"def set_album_url(self, album_url: str) -> None:\n self.album_url = album_url",
"def cmd_album_update(client, ar... | [
"0.76813287",
"0.76718396",
"0.64414126",
"0.6365814",
"0.63637644",
"0.6246786",
"0.6207674",
"0.6201824",
"0.6177376",
"0.61342204",
"0.61342204",
"0.6128408",
"0.611743",
"0.60384154",
"0.603036",
"0.5994113",
"0.5983324",
"0.59631026",
"0.59631026",
"0.59152466",
"0.59137... | 0.8512228 | 0 |
Sets an album coverist for an EasyID3 object | def set_album_artist(audio: EasyID3, album_artist):
audio['albumartist'] = album_artist
audio.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_album(audio: EasyID3, album):\r\n audio['album'] = album\r\n audio.save()",
"def set_album(self, album: str) -> None:\n self.album = album",
"def get_album_cover(self):\n artist = self.get_request_arg(\"artist\")\n album = self.get_request_arg(\"album\")\n if not (albu... | [
"0.7180069",
"0.68513155",
"0.65757406",
"0.6331452",
"0.605157",
"0.59505624",
"0.5949855",
"0.59194416",
"0.5908815",
"0.5891148",
"0.5845772",
"0.58302826",
"0.5773921",
"0.57686496",
"0.5763389",
"0.57481277",
"0.57458085",
"0.5715066",
"0.57053876",
"0.5653101",
"0.56496... | 0.67837644 | 2 |
limits department to user's departments. | def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'dep':
if not request.user.is_superuser:
kwargs["queryset"] = Department.objects.filter(id=request.user.profile.department.id)
else:
kwargs["queryset"] = Department.object... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request):\n qs = super(EventAdmin, self).get_queryset(request)\n if request.user.is_superuser:\n return qs\n return qs.filter(dep=request.user.profile.department)",
"def get_default_department_id(self, cr, uid, context=None):\n user_obj = self.pool.ge... | [
"0.5813055",
"0.5728019",
"0.5478231",
"0.5410143",
"0.5410143",
"0.5152886",
"0.5049591",
"0.49960232",
"0.4965721",
"0.49632037",
"0.49566305",
"0.49453574",
"0.49218613",
"0.48988104",
"0.48922333",
"0.48876283",
"0.48341528",
"0.4827679",
"0.48104814",
"0.4780661",
"0.474... | 0.56255776 | 2 |
Hides all_app label from staff. | def get_form(self, request, obj=None, **kwargs):
if not request.user.is_superuser:
self.exclude = ('all_app', 'faculty', 'university')
return super(EventAdmin, self).get_form(request, obj, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hide_labels(self):\n pass",
"def _hide_labels(self):\n for x in 'xy':\n # \"Shared\" axis and tick labels\n axis = getattr(self, x + 'axis')\n share = getattr(self, '_share' + x)\n if share is not None:\n level = getattr(self.figure, '... | [
"0.6661552",
"0.5827043",
"0.5793188",
"0.5792547",
"0.5694158",
"0.56367385",
"0.56102115",
"0.5581144",
"0.5562529",
"0.5497971",
"0.5488656",
"0.5474966",
"0.541274",
"0.5399685",
"0.5377268",
"0.53546965",
"0.53368586",
"0.5330277",
"0.532372",
"0.5309514",
"0.5290542",
... | 0.0 | -1 |
Return whether or not given value is a valid domain. If the value is valid domain name this function returns ``True``, otherwise | def domain(value):
return pattern.match(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_domain_name(value):\n p = re.compile(\n r'^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|'\n r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|'\n r'([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\\.'\n r'([a-zA-Z]{2,13}|[a-zA-Z0-9-]{2,30}.[a-zA-Z]{2,3})$'\n )\n m = p.match(va... | [
"0.8574779",
"0.8141694",
"0.78887385",
"0.7132516",
"0.71311104",
"0.697418",
"0.69197106",
"0.6852501",
"0.6696503",
"0.6680784",
"0.6657515",
"0.66141945",
"0.6555403",
"0.64574015",
"0.6443215",
"0.64393675",
"0.6352791",
"0.6266965",
"0.6246535",
"0.6244114",
"0.62239295... | 0.6926512 | 6 |
Implementation of the KullbackLeibler divergence for two Gaussian N(mu, 1) | def kl(mu1, mu2):
return (mu2-mu1)**2/2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def KL_divergence(model_1, model_2, samples):\n posterior_1 = create_posterior_object(model_1, samples)\n posterior_2 = create_posterior_object(model_2, samples)\n return posterior_1.KL(posterior_2)",
"def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q.... | [
"0.69252795",
"0.6753317",
"0.67019755",
"0.66098267",
"0.6483148",
"0.64703333",
"0.6456745",
"0.6446098",
"0.6408367",
"0.6399509",
"0.6394079",
"0.6393689",
"0.6343265",
"0.6343265",
"0.6312885",
"0.62912774",
"0.6289064",
"0.6287098",
"0.6278899",
"0.6275159",
"0.6268544"... | 0.6258184 | 25 |
Implementation of the KullbackLeibler divergence for two Gaussian N(mu, 1) | def kl(mu1, mu2):
return (mu2-mu1)**2/2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def KL_divergence(model_1, model_2, samples):\n posterior_1 = create_posterior_object(model_1, samples)\n posterior_2 = create_posterior_object(model_2, samples)\n return posterior_1.KL(posterior_2)",
"def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q.... | [
"0.69252795",
"0.6753317",
"0.67019755",
"0.66098267",
"0.6483148",
"0.64703333",
"0.6456745",
"0.6446098",
"0.6408367",
"0.6399509",
"0.6394079",
"0.6393689",
"0.6343265",
"0.6343265",
"0.6312885",
"0.62912774",
"0.6289064",
"0.6287098",
"0.6278899",
"0.6275159",
"0.6268544"... | 0.6258184 | 24 |
Implementation of the KullbackLeibler divergence for two Gaussian N(mu, 1) | def kl(mu1, mu2):
return (mu2 - mu1) ** 2 / 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def KL_divergence(model_1, model_2, samples):\n posterior_1 = create_posterior_object(model_1, samples)\n posterior_2 = create_posterior_object(model_2, samples)\n return posterior_1.KL(posterior_2)",
"def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q.... | [
"0.6924778",
"0.67526954",
"0.6701576",
"0.66093403",
"0.64837754",
"0.6469293",
"0.64563274",
"0.6446046",
"0.6407107",
"0.6397918",
"0.6393599",
"0.63916206",
"0.6343663",
"0.6343663",
"0.6311665",
"0.62900066",
"0.62888974",
"0.6287032",
"0.6277576",
"0.6275616",
"0.626880... | 0.62143797 | 31 |
Return the xcoordinates of all points in the exterior. Returns (N,2) ndarray Xcoordinates of all points in the exterior as a float32 ndarray. | def xx(self):
return self.exterior[:, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x_coords(self):\n x_coords = np.linspace(0, self.fft_length / self.samplate, self.fft_length + 1)\n return x_coords",
"def x_points(self):\n return self._x_points",
"def get_x(self):\n return self.x[:self.nump, :]",
"def extension_x_coords(self):\n\n # Format is a list ... | [
"0.70952785",
"0.6975099",
"0.6947789",
"0.6889956",
"0.68076473",
"0.6770911",
"0.6741025",
"0.66980225",
"0.66448313",
"0.6574049",
"0.6531782",
"0.65227944",
"0.6504338",
"0.6488776",
"0.64836824",
"0.64434034",
"0.6432304",
"0.6400397",
"0.63859826",
"0.6372897",
"0.63332... | 0.6813908 | 4 |
Return the xcoordinates of all points in the exterior, rounded to the closest integer value. Returns (N,2) ndarray Xcoordinates of all points in the exterior, rounded to the closest integer value. Result dtype is int32. | def xx_int(self):
return np.int32(np.round(self.xx)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_x_coords(self):\n\n # Format is a list with each node and its parent, separated by NaN values\n return self._list_link_to_tips(col_name=\"x\")",
"def encode(self, x):\n\n try:\n xp = (np.atleast_2d(x) - self.xmin[None, :]) / self.xspan[None, :]\n return xp... | [
"0.62014663",
"0.6187422",
"0.6051746",
"0.60460943",
"0.5926916",
"0.59259355",
"0.5882376",
"0.58813065",
"0.5859228",
"0.5814791",
"0.5789999",
"0.578893",
"0.57691014",
"0.5762973",
"0.5717289",
"0.5703615",
"0.5663977",
"0.5634869",
"0.5615778",
"0.5614131",
"0.5608382",... | 0.6175656 | 2 |
Return the ycoordinates of all points in the exterior, rounded to the closest integer value. Returns (N,2) ndarray Ycoordinates of all points in the exterior, rounded to the closest integer value. Result dtype is int32. | def yy_int(self):
return np.int32(np.round(self.yy)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_y_coords(self):\n\n # Format is a list with each node and its parent, separated by NaN values\n return self._list_link_to_tips(col_name=\"y\")",
"def y_points(self):\n return self._y_points",
"def y_coords(self):\n y_coords = self.get_fre_band_arr()\n y_coords =... | [
"0.6254638",
"0.61134356",
"0.60623837",
"0.60353124",
"0.59413093",
"0.5931215",
"0.5885018",
"0.58562446",
"0.58489966",
"0.58029723",
"0.57937026",
"0.57886297",
"0.5763492",
"0.5761145",
"0.5745792",
"0.5718954",
"0.5706652",
"0.57013214",
"0.5696863",
"0.5690687",
"0.568... | 0.5441951 | 49 |
Estimate the area of the polygon. Returns number Area of the polygon. | def area(self):
if len(self.exterior) < 3:
raise Exception("Cannot compute the polygon's area because it contains less than three points.")
poly = self.to_shapely_polygon()
return poly.area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area_polygon(polygon):\n o = centroid_points(polygon)\n u = subtract_vectors(polygon[-1], o)\n v = subtract_vectors(polygon[0], o)\n a = 0.5 * length_vector(cross_vectors(u, v))\n for i in range(0, len(polygon) - 1):\n u = v\n v = subtract_vectors(polygon[i + 1], o)\n a += 0... | [
"0.8077052",
"0.8046152",
"0.7960074",
"0.79467857",
"0.7895023",
"0.7826674",
"0.77047175",
"0.75829387",
"0.7569186",
"0.7556213",
"0.754824",
"0.74289274",
"0.7405338",
"0.73766977",
"0.73553944",
"0.7335815",
"0.73079306",
"0.73073554",
"0.72461534",
"0.72401506",
"0.7211... | 0.8634776 | 0 |
Estimate the width of the polygon. Returns number Width of the polygon. | def width(self):
xx = self.xx
return max(xx) - min(xx) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWidth(self):\n area = self.getArea()\n length = self.getLength()\n return area / length",
"def getWidth(self):\n wsum = 0.0\n for quad in self._quadrilaterals:\n wsum = wsum + get_quad_width(quad)\n mwidth = (wsum / len(self._quadrilaterals)) / 1000.0\n... | [
"0.7190058",
"0.678458",
"0.6782992",
"0.67315143",
"0.66844815",
"0.6568753",
"0.6533707",
"0.6516119",
"0.6481134",
"0.645442",
"0.64379716",
"0.6430598",
"0.6351294",
"0.63273364",
"0.63140345",
"0.63007927",
"0.62943333",
"0.6293248",
"0.6259915",
"0.6254677",
"0.6222267"... | 0.5778456 | 80 |
Convert this polygon to a Shapely polygon. Returns shapely.geometry.Polygon The Shapely polygon matching this polygon's exterior. | def to_shapely_polygon(self):
# load shapely lazily, which makes the dependency more optional
import shapely.geometry
return shapely.geometry.Polygon([(point[0], point[1]) for point in self.exterior]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygon(self):\n radius = self._get_max_rupture_projection_radius()\n return self.location.to_polygon(radius)",
"def from_shapely(polygon_shapely, label=None):\n # load shapely lazily, which makes the dependency more optional\n import shapely.geometry\n\n assert isinstance(... | [
"0.7379894",
"0.73483795",
"0.7292073",
"0.6961955",
"0.69344467",
"0.6677117",
"0.65957344",
"0.65423495",
"0.63920707",
"0.627774",
"0.6251093",
"0.6225216",
"0.61988753",
"0.61836964",
"0.6127866",
"0.6112843",
"0.6107596",
"0.60701674",
"0.60362715",
"0.6018997",
"0.60085... | 0.9015824 | 0 |
Create a shallow copy of the Polygon object. | def copy(self, exterior=None, label=None, **kwargs):
return self.deepcopy(exterior=exterior, label=label, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deepcopy(self, exterior=None, label=None, **kwargs):\n return Polygon(\n exterior=np.copy(self.exterior) if exterior is None else exterior,\n label=self.label if label is None else label,\n **kwargs\n )",
"def __copy__(self):\n return Region(list_poly=sel... | [
"0.7818092",
"0.72865355",
"0.7052227",
"0.6835096",
"0.6732846",
"0.6652651",
"0.6605983",
"0.6563715",
"0.6408818",
"0.6408818",
"0.6400131",
"0.6341346",
"0.6277395",
"0.6277395",
"0.6276687",
"0.62296104",
"0.62197804",
"0.6204741",
"0.6197214",
"0.6195822",
"0.6178784",
... | 0.0 | -1 |
Create a deep copy of the Polygon object. | def deepcopy(self, exterior=None, label=None, **kwargs):
return Polygon(
exterior=np.copy(self.exterior) if exterior is None else exterior,
label=self.label if label is None else label,
**kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __copy__(self):\n return Region(list_poly=self.list_poly[:],\n props=self.props.copy())",
"def copy(self):\n return type(self)(self._geojson.copy(), **self._attrs)",
"def copy(self):\n newVertices = [v.copy() for v in self.vertices]\n return face(newVertices... | [
"0.7298153",
"0.69796866",
"0.68300503",
"0.68170315",
"0.6599278",
"0.6573213",
"0.6402535",
"0.6362293",
"0.63603324",
"0.6359613",
"0.6359613",
"0.63421625",
"0.6336208",
"0.62636113",
"0.62417465",
"0.6216212",
"0.62135106",
"0.6212699",
"0.6193789",
"0.61898357",
"0.6187... | 0.8114312 | 0 |
Computes the posterior predictive mean of a GP | def exact_predictive_mean(full_covar, full_mean, train_labels, noise, precomputed_cache=None):
if not isinstance(full_covar, LazyVariable):
full_covar = NonLazyVariable(full_covar)
return full_covar.exact_predictive_mean(full_mean, train_labels, noise, precomputed_cache) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_posterior(g: to.Tensor, lpj: to.Tensor) -> to.Tensor:\n if tvo.get_device().type == \"cpu\":\n means = _mean_post_einsum(g, lpj)\n else:\n means = _mean_post_mul(g, lpj)\n\n assert means.shape == (g.shape[0], *g.shape[2:])\n assert not to.isnan(means).any() and not to.isinf(means... | [
"0.70972437",
"0.6431112",
"0.6232736",
"0.6092299",
"0.6076458",
"0.6076458",
"0.6059944",
"0.6050309",
"0.6039575",
"0.6039575",
"0.6039575",
"0.6039575",
"0.6039575",
"0.6010156",
"0.5976946",
"0.59697634",
"0.59688157",
"0.59332657",
"0.59317845",
"0.58945775",
"0.5893456... | 0.0 | -1 |
Writes trained model config files to output_dir. | def dump_trained_model_configs(
output_dir: str, trained_cfgs: Dict[str, CfgNode]
) -> Dict[str, str]:
trained_model_configs = {}
trained_model_config_dir = os.path.join(output_dir, "trained_model_configs")
PathManager.mkdirs(trained_model_config_dir)
for name, trained_cfg in trained_cfgs.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, output_dir):\n if not os.path.exists(output_dir):\n os.makedirs(output_dir)\n\n logger.info('Saving model')\n dst_config_file = os.path.join(output_dir, self.CONFIG_FILE)\n if self.fullpath_input_configfile != dst_config_file:\n shutil.copy(sel... | [
"0.6815989",
"0.6342964",
"0.6324171",
"0.62479264",
"0.62417424",
"0.6232996",
"0.6230055",
"0.6222174",
"0.62075496",
"0.61947435",
"0.6179576",
"0.61260945",
"0.61008584",
"0.5994971",
"0.5989605",
"0.5962542",
"0.59612924",
"0.59480435",
"0.5945082",
"0.5941806",
"0.59244... | 0.66273534 | 1 |
Find the missing number with XOR bit operation Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Because we know that nums contains n numbers and that it is missing exactly one number on the range [0..n1], we know that n definitely replaces the missing... | def missingNumber(self, nums):
size = len(nums)
missing_number = len(nums)
for i in range(size):
missing_number ^= (i ^ nums[i])
return missing_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def firstMissingPositive(nums):\n\n n = len(nums)\n\n # Base case.\n if 1 not in nums:\n return 1\n\n # nums = [1]\n if n == 1:\n return 2\n\n # Replace negative numbers, zeros,\n # and numbers larger than n by 1s.\n # After this conversion nums will contain \n # only posit... | [
"0.67469937",
"0.6697666",
"0.6618132",
"0.6458031",
"0.6431478",
"0.6390652",
"0.638202",
"0.6266116",
"0.62171304",
"0.6204363",
"0.6089427",
"0.6000388",
"0.59669137",
"0.5964846",
"0.5947419",
"0.58952826",
"0.5796442",
"0.5792986",
"0.57754946",
"0.5763983",
"0.57566154"... | 0.7973433 | 0 |
initialize parameters to calculate employer contribution. | def employer_contribution_initialization(self, salary, employee_contribution, employer_match_tier_match_list):
self.salary = salary
self.employee_contribution = employee_contribution
self.employer_match_tier_match_list = employer_match_tier_match_list
self.limit_salary() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_params(self) -> None:\n self.i = 0 # Year\n self.ela = self.ela_start # Equilibrium line altitude\n self.steady_state = False # Control variable for steady state\n self.fracd8_mode = \"limited\" # Mode of the fracd8 algorithm",
"def initialize_inputs(self) -> None:\n ... | [
"0.59949696",
"0.58356243",
"0.5780562",
"0.5744114",
"0.5691163",
"0.565151",
"0.56505823",
"0.56407213",
"0.56271213",
"0.5627014",
"0.5605636",
"0.55906343",
"0.55901986",
"0.5547494",
"0.5540868",
"0.5532418",
"0.5527885",
"0.5495958",
"0.54802847",
"0.54668033",
"0.54540... | 0.7303179 | 0 |
Returns a reversed string | def reverse(seq):
return seq[::-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_string(sen):\n return sen[::-1]",
"def task10_string_reversed(text):\n return text[::-1]",
"def string_reverse(text):\n rev_text = text[::-1]\n return rev_text",
"def reversed_of_string(n):\n return ''.join(reversed(n))",
"def reverse_string(s):\n s.reverse()",
"def reverse(... | [
"0.83175164",
"0.82585406",
"0.8198879",
"0.81010795",
"0.8058415",
"0.80516845",
"0.804507",
"0.80402637",
"0.79585177",
"0.78746146",
"0.78660434",
"0.7777803",
"0.76708776",
"0.76086724",
"0.7594514",
"0.7594274",
"0.75735575",
"0.7565906",
"0.7394802",
"0.73805904",
"0.73... | 0.710317 | 38 |
Run setup logic before all test cases in this module. | def setup_class(self) -> None:
super(TestProfiles, self).setup_class()
self.custom = CustomFeature() # pylint: disable=attribute-defined-outside-init
if os.getenv('SETUP_CLASS') is None:
self.custom.setup_class(self)
# enable auto-update of profile data
self.enable_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n\n self._set_up()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n MainTests.setUp(sel... | [
"0.8383112",
"0.8183738",
"0.8156438",
"0.8100924",
"0.8100577",
"0.80213934",
"0.798838",
"0.7987468",
"0.79854214",
"0.79854214",
"0.7982017",
"0.7954423",
"0.7954423",
"0.79415584",
"0.7926816",
"0.7926816",
"0.79187953",
"0.7915424",
"0.7867512",
"0.7865393",
"0.7865393",... | 0.0 | -1 |
Transforms tuple (one, two) into string "one, two" | def format_pair(pair):
logger.info('format pair...')
formatted_pair = pair[0] + ', ' + pair[1] + '\n'
logger.debug('formatted_pair: ' + formatted_pair)
return formatted_pair | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))",
"def _tuple_to_str(self, the_tuple):\r\n ret = \"\"\r\n for item in the_tuple:\r\n ret += (\" \" + str(item))\r\n return ret[1:]",
"def format_tuple(data):\n return \",\".join([str(item) for item in data])",... | [
"0.87239045",
"0.7929531",
"0.7873769",
"0.781779",
"0.77723175",
"0.77276045",
"0.7420504",
"0.73373884",
"0.7317934",
"0.7086392",
"0.7052346",
"0.6910457",
"0.6750505",
"0.66879964",
"0.6541285",
"0.65318316",
"0.65126175",
"0.6492048",
"0.6429395",
"0.6404948",
"0.6374794... | 0.65472907 | 14 |
Compute the softmax nonlinear activation function. | def softmax(inputs):
# Your code pass
# 对向量的每个元素归一化,先把每个元素作为e的指数求结果
input_exp = np.exp(inputs)
# 返回 每个元素作为e的指数求结果 与所在列所有的这些结果和的比值,另外添加一个维度
return input_exp / np.sum(input_exp, axis=1)[:, np.newaxis] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"def softmax(x):\n return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)",
"def softmax(x):\n #pass # TODO: Compute and return softm... | [
"0.7768352",
"0.77541727",
"0.7747371",
"0.7738893",
"0.7731587",
"0.77270156",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77237934",
"0.77112085",
"0.7711048",
"0.7692442",
"0.76765347",
"0.7640326",
"0.7640326",
"0.7... | 0.0 | -1 |
This assumes we have a saved user and an accepted invite for that user's email | def create_from_invited_user(cls, user, invitation=None, **kwargs):
if not invitation:
invitations = Invitation.objects.filter(
email=user.email, accepted=True
)
invitation = invitations.first()
if not invitation:
raise exceptions.Missi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_user(request):\r\n params = request.params\r\n\r\n email = params.get('email', None)\r\n user = request.user\r\n\r\n if not email:\r\n # try to get it from the json body\r\n email = request.json_body.get('email', None)\r\n\r\n if not email:\r\n # if still no email, I ... | [
"0.70789224",
"0.70394254",
"0.7002864",
"0.68899757",
"0.66592276",
"0.66433465",
"0.66152436",
"0.65797",
"0.65381837",
"0.64925385",
"0.6490703",
"0.64790326",
"0.64675236",
"0.64601815",
"0.64106816",
"0.6369942",
"0.63327754",
"0.6326448",
"0.63023746",
"0.62940305",
"0.... | 0.0 | -1 |
Minmax normalization of a function evaluated on the unit sphere Normalizes samples to ``(samples min(samples)) / (max(samples) min(samples))`` for each unit sphere. | def minmax_normalize(samples, out=None):
if out is None:
dtype = np.common_type(np.empty(0, 'float32'), samples)
out = np.array(samples, dtype=dtype, copy=True)
else:
out[:] = samples
sample_mins = np.min(samples, -1)[..., None]
sample_maxes = np.max(samples, -1)[..., None]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalizefunction(self , values):\n maxv = np.max(values)\n minv = np.min(values)\n def f(x):\n return (x - minv)/(maxv-minv)\n return f",
"def min_max_normalization(x, min_x = None, max_x = None):\n if min_x is None:\n min_x = np.min(x, axis=0)\n if max_x is None:\n max_... | [
"0.68133473",
"0.68031144",
"0.6652163",
"0.65976346",
"0.65308917",
"0.65149224",
"0.6498391",
"0.64631385",
"0.6439245",
"0.6389115",
"0.63713443",
"0.63676053",
"0.6309157",
"0.62606144",
"0.62456155",
"0.6242297",
"0.6241713",
"0.6236689",
"0.6236689",
"0.62352705",
"0.62... | 0.74304235 | 0 |
Input dictionary is converted to an object with all the dictionary keys as its attribute. | def dict_to_object(_dict):
__obj = Configurations()
for k, v in _dict.items():
if type(v) is dict:
v = dict_to_object(v)
if not hasattr(__obj, k):
setattr(__obj, k, v)
return __obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, inp):\n return cls(**{k: v for k, v in inp.items() if k != '__class__'})",
"def dict2obj(dictionary):\r\n class Obj(object):\r\n def __init__(self, dictionary):\r\n self.__dict__.update(dictionary)\r\n return Obj(dictionary)",
"def update_from_dict(self, dictio... | [
"0.7231918",
"0.69967264",
"0.6712416",
"0.6681447",
"0.6646438",
"0.6643564",
"0.66384745",
"0.6587937",
"0.6518833",
"0.64708245",
"0.6460799",
"0.645821",
"0.6454864",
"0.6435033",
"0.6429809",
"0.64019257",
"0.64017504",
"0.6400558",
"0.6394792",
"0.63582313",
"0.6353264"... | 0.0 | -1 |
Read a yaml file and convert it to a python object. | def yaml_to_object(yaml_file):
with open(yaml_file) as f:
config = yaml_load(f, Loader=yaml_FullLoader)
return dict_to_object(config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_yaml(cls, path: str) -> \"EtlSettings\":\n with fsspec.open(path) as f:\n yaml_file = yaml.safe_load(f)\n return cls.parse_obj(yaml_file)",
"def from_path(cls, path: str) -> Any:\n cls._check_yaml()\n with open(path) as f:\n return yaml.safe_load(f)",
... | [
"0.7352576",
"0.73276865",
"0.7192743",
"0.71504086",
"0.71503276",
"0.7089212",
"0.70863396",
"0.7080356",
"0.7063345",
"0.70504373",
"0.70255494",
"0.701744",
"0.70110863",
"0.6991917",
"0.6939623",
"0.6915468",
"0.6868794",
"0.6858525",
"0.68325824",
"0.68147033",
"0.68130... | 0.8320955 | 0 |
initialize all entries given annotation json file | def _load_all(self, anno_file, shuffle):
image_set_index = []
labels = []
coco = COCO(anno_file)
img_ids = coco.getImgIds()
#print(img_ids)
cars=[3,6,8]
pedestrians=[1]
cyclists=[2,4]
lights=[10]
signs=[13]
apex_categories=cars+ped... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, annotation_file=None):\n # load dataset\n self.dataset,self.anns,self.cats,self.imgs = dict(),dict(),dict(),dict()\n self.imgToAnns, self.catToImgs = defaultdict(list), defaultdict(list)\n if not annotation_file == None:\n print('loading annotations into me... | [
"0.7096489",
"0.6678241",
"0.65247285",
"0.63871604",
"0.63805383",
"0.6371161",
"0.6290726",
"0.6234812",
"0.6216762",
"0.6173187",
"0.6136703",
"0.61280864",
"0.6117994",
"0.61033857",
"0.6088391",
"0.6078171",
"0.6059368",
"0.6052436",
"0.60514545",
"0.6031541",
"0.6025526... | 0.0 | -1 |
Open a ``tk.TopLevel`` dialog to edit the settings of this command | def edit(self, running=False):
self.running = running
self.updateInstList()
self.rows = int(self.rows)
self.window = tk.Toplevel(self.gui.root)
hf.centerWindow(self.window)
if not running:
self.window.resizable(height=False, width=False)
self.wind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_settings(self):\n\n cur_datadir = self.config.starbound_data_dir\n settings = SettingsDialog(self)\n settings.exec()\n new_datadir = self.config.starbound_data_dir\n if new_datadir:\n if cur_datadir != new_datadir:\n self.load_data()\n ... | [
"0.66139615",
"0.65809876",
"0.6557948",
"0.6477784",
"0.64226556",
"0.641947",
"0.63651174",
"0.63537604",
"0.6235702",
"0.6229017",
"0.6178756",
"0.61489487",
"0.6138625",
"0.6079057",
"0.60723495",
"0.60308015",
"0.60117626",
"0.59988916",
"0.5985666",
"0.5962535",
"0.5930... | 0.5630166 | 55 |
Set up a soccer player. The player_id starts at 0 and increases by one for each player added. You can use the player id to figure out your team (player_id % 2), or assign different roles to different agents. | def __init__(self, player_id = 0):
all_players = ['adiumy', 'amanda', 'beastie', 'emule', 'gavroche', 'hexley', 'kiki', 'konqi', 'nolok', 'pidgin', 'puffy', 'sara_the_racer', 'sara_the_wizard', 'suzanne', 'tux', 'wilber', 'xue']
self.kart = all_players[np.random.choice(len(all_players))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_player(player: Player) -> None:\n with engine.connect() as conn:\n\n conn.execute(\n player_table.insert().values(\n steamid=player.steamid,\n level=player.level,\n xp=player.xp,\n credits=player.credits,\n )\n ... | [
"0.65657794",
"0.6537067",
"0.6498121",
"0.6336818",
"0.63190246",
"0.6296418",
"0.6270926",
"0.6246251",
"0.61926866",
"0.6167465",
"0.6144041",
"0.6129296",
"0.60952467",
"0.6074662",
"0.6072991",
"0.60488796",
"0.60488796",
"0.59815276",
"0.59806126",
"0.59592867",
"0.5940... | 0.56639194 | 50 |
Convert given row and column number to an Excelstyle cell name. | def excel_style(row, col):
quot, rem = divmod(ord(col)-ord('A'), 26)
return((chr(quot-1 + ord('A')) if quot else '') +
(chr(rem + ord('A')) + str(row))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_name(self, inst_name, row, col):\n return self.bitcell_array.get_cell_name(inst_name + \"{}x\".format(OPTS.hier_seperator) + self.bitcell_array_inst.name, row, col)",
"def convert_number_to_excel_colname(n):\n\n assert 0 < n <= 256\n\n alphabet = [chr(x) for x in xrange(65, 91)]\n\n ... | [
"0.68741685",
"0.68726724",
"0.6461762",
"0.6192934",
"0.59668106",
"0.5832652",
"0.58306307",
"0.5809028",
"0.57859266",
"0.57018393",
"0.56644976",
"0.5595735",
"0.5520498",
"0.55072683",
"0.5496874",
"0.5495478",
"0.54834443",
"0.54704136",
"0.54445654",
"0.54109144",
"0.5... | 0.6625876 | 2 |
Create a AnnotInference object using a precomputed query / results | def from_qreq_(cls, qreq_, cm_list, autoinit=False):
# raise NotImplementedError('do not use')
aids = ut.unique(ut.flatten([qreq_.qaids, qreq_.daids]))
nids = qreq_.get_qreq_annot_nids(aids)
ibs = qreq_.ibs
infr = cls(ibs, aids, nids, verbose=False, autoinit=autoinit)
inf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(self, **annotations):\n return AnnotatedQuery(self, annotations)",
"async def transformer_infer(query: dict, response: Response) -> dict:\n logger.debug(\"TRANSFORMER - predicting query: \" + str(query))\n results = {}\n try:\n results = MODELS.sparse_reader.predict(query)\n ... | [
"0.5898831",
"0.5491807",
"0.541172",
"0.51026547",
"0.5069375",
"0.5065891",
"0.50212616",
"0.49994242",
"0.49972734",
"0.49880728",
"0.49719852",
"0.49640274",
"0.4945643",
"0.489522",
"0.4885272",
"0.48816785",
"0.4876209",
"0.48703566",
"0.48627922",
"0.48584872",
"0.4858... | 0.0 | -1 |
Return a string from a onehotencoded matrix | def decode_one_hot(x):
s = []
for onehot in x:
one_index = np.argmax(onehot)
c = indices_char[one_index]
s.append(c)
return ''.join(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot_to_string(self, one_hot_seq):\n gen_ints = [np.where(r==1)[0][0] for r in one_hot_seq]\n gen_char_list = self.int_to_char(gen_ints)\n generated_text = ''.join(gen_char_list)\n return generated_text",
"def one_hot_enc(self, word):\n word = self.text_to_int(word)\n word... | [
"0.7959923",
"0.7278291",
"0.7274009",
"0.72325516",
"0.71969974",
"0.71964",
"0.71653306",
"0.7122278",
"0.7065995",
"0.705549",
"0.7029026",
"0.7009225",
"0.69967717",
"0.6995262",
"0.69761",
"0.69741535",
"0.6972614",
"0.6969284",
"0.69614637",
"0.69603336",
"0.6903731",
... | 0.80289096 | 0 |
Given a play, returns the succession of speakers | def get_stances_succession(s):
repliques = s.getElementsByTagName('sp')
scene = [r.getAttribute("who") for r in repliques]
return scene | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speakers(self):\n return self._speakers",
"def get_speakers(self, request):\n return self.speaker_service.get_speakers()",
"def get_speakers(words):\n speakers = []\n utterances = \" \".join(words).split(\"<|endoftext|>\")[:-1]\n for u in utterances:\n s = u.split(\":\")[0].st... | [
"0.67425287",
"0.6072046",
"0.58061457",
"0.5787169",
"0.5738122",
"0.5662107",
"0.5636811",
"0.5621407",
"0.56204724",
"0.56023574",
"0.5589176",
"0.5569495",
"0.55623657",
"0.55487406",
"0.5520101",
"0.55097306",
"0.5506313",
"0.5493467",
"0.54931366",
"0.5462817",
"0.54514... | 0.0 | -1 |
Simple dot product between two vectors of embeddings. This returns a matrix of positive real numbers. | def _dot(self, s1, s2, tf_embs):
mat1 = tf.gather(tf_embs, s1)
mat2 = tf.gather(tf_embs, s2)
return tf.matmul(mat1, tf.transpose(mat2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))",
"def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, vec1, vec2))",
"def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)",
"def dotProduct(v1, v2):\n n1 = normalize(v1)\n n2 = normalize(v... | [
"0.73913705",
"0.73655313",
"0.73354226",
"0.7274943",
"0.7188752",
"0.7161075",
"0.7137937",
"0.70983493",
"0.7091926",
"0.70605415",
"0.7048057",
"0.7045232",
"0.7043826",
"0.7039965",
"0.7015888",
"0.70128363",
"0.7005304",
"0.69964683",
"0.6995427",
"0.6986944",
"0.698548... | 0.64668614 | 71 |
Euclidean distance between two points | def dist2d(point1, point2):
x1, y1 = point1[0:2]
x2, y2 = point2[0:2]
dist2 = (x1 - x2)**2 + (y1 - y2)**2
return math.sqrt(dist2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(point1, point2):\n\n return math.sqrt(sum([(x - y) ** 2 for x, y in zip(point1, point2)]))",
"def euclidean_distance(point1, point2):\n return np.linalg.norm(np.array(point1) - np.array(point2))",
"def euclidean_distance(point_one, point_two):\n return np.linalg.norm(point_one-p... | [
"0.8594714",
"0.85327435",
"0.852983",
"0.8479696",
"0.84645104",
"0.8378544",
"0.83645356",
"0.83464706",
"0.81745654",
"0.817045",
"0.8161608",
"0.81262684",
"0.81235254",
"0.81221235",
"0.81206346",
"0.80135185",
"0.799149",
"0.7984254",
"0.7980387",
"0.79662716",
"0.79498... | 0.0 | -1 |
generate bounding boxes from score map | def generate_bboxes_with_scores(cls_map, scale, threshold=0.5, size=12, stride=2):
assert len(cls_map.shape) == 2
indices = np.where(cls_map >= threshold)
bboxes = np.concatenate((
((indices[1] * stride) / scale).reshape(-1, 1),
((indices[0] * stride) / scale).reshape(-1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect(self, score_map, geo_map, score_map_thresh=common.SCORE_MAP_THRESH,\n box_thresh=common.BOX_THRESH, nms_thres=common.NMS_TRESH):\n if len(score_map.shape) == 4:\n score_map = score_map[0, :, :, 0]\n geo_map = geo_map[0, :, :, ]\n # filter the score map\n... | [
"0.71578807",
"0.68569255",
"0.67067534",
"0.66980857",
"0.6675855",
"0.65993726",
"0.6520382",
"0.64726627",
"0.64695",
"0.64630926",
"0.6461467",
"0.6443709",
"0.64253366",
"0.6332594",
"0.6322826",
"0.6313217",
"0.6306151",
"0.62930554",
"0.627818",
"0.6276831",
"0.6259888... | 0.72145414 | 0 |
Compute the softmax of each element along an axis of X. | def softmax(input):
list_value = []
len_compute = input.shape[-1]
shape_input = input.shape
for x in input.reshape(-1, len_compute):
# print(x)
e_x = np.exp(x - np.max(x))
res = e_x / e_x.sum(axis=0)
list_value.append(res)
return np.array(list_value).reshape(shape_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out",
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res... | [
"0.86478335",
"0.8523097",
"0.85011977",
"0.84512436",
"0.84243035",
"0.8400698",
"0.8381795",
"0.83787024",
"0.83724785",
"0.836225",
"0.83545095",
"0.8344736",
"0.8326514",
"0.83093625",
"0.8273076",
"0.82727146",
"0.82651985",
"0.8247394",
"0.8247394",
"0.8243556",
"0.8242... | 0.8023331 | 90 |
Initializes weights to random values | def InitWeights(self):
self.w = -1 + 2 * np.random.rand(self.num_of_inputs,)
self.w0 = -1 + 2 * np.random.rand() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)",
"def weights_initializer(self):\n self.weights = [np.random.normal(0, 1 / np.sqrt(x), (x, y)) for x, y in list(zip(self.structure[1:], self.structure[:-1]))]",
"def initWeights(self):\n self.weights = ... | [
"0.86601245",
"0.85718584",
"0.84052247",
"0.838252",
"0.8337537",
"0.82412547",
"0.8184335",
"0.81809044",
"0.8139619",
"0.81212205",
"0.8093443",
"0.80410266",
"0.80345976",
"0.80041456",
"0.8003966",
"0.79978085",
"0.7978447",
"0.7954606",
"0.792696",
"0.79023695",
"0.7896... | 0.84180146 | 2 |
Forward pass calculate the output as a vector of {1, 1} of the neuron for all examples in X | def Forward(self, X):
Y = np.dot(X, self.w) + self.w0
Y[Y>0] = 1
Y[Y<=0] = -1
return Y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x = self.efficient_net(x)\n return x",
"def forward(self, X):\n if self.has_bias:\n self.a = [numpy.hstack([numpy.ones((len(X),1)), X])]\n else:\n self.a = [X]\n\n self.z = []\n\n for w in self.weights[:-1]:\n self.z.append(numpy.dot(self.a[-1], w)... | [
"0.73502254",
"0.7344904",
"0.7278213",
"0.72582996",
"0.7252852",
"0.72453845",
"0.7227133",
"0.7219706",
"0.719871",
"0.7189896",
"0.7160017",
"0.7152328",
"0.7125549",
"0.7105118",
"0.71000993",
"0.70891184",
"0.7088468",
"0.7071696",
"0.7071696",
"0.7066932",
"0.7065732",... | 0.6845888 | 53 |
Keep track of the name of this service. | def _remember_service_name(self, event):
service_name = event["arguments"]["service_name"]
# We've added logging of the service_handle to the API signature in
# the Monitor, but for backwards compatibility we'll keep it as
# follows for now.
service_handle = "0x%08x" % event["ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self):\n return self._service_name",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self... | [
"0.83524597",
"0.81873435",
"0.81873435",
"0.7912456",
"0.7912456",
"0.7912456",
"0.75606775",
"0.75606775",
"0.75606775",
"0.74143535",
"0.7341236",
"0.7341236",
"0.7341236",
"0.72355634",
"0.71031094",
"0.706873",
"0.700893",
"0.69668424",
"0.6928037",
"0.6928037",
"0.68523... | 0.7891356 | 6 |
This function will be invoked by the dataset generation script to get the data tensors used by PyTorch. | def generate_dataset():
if not os.path.exists("../data/COVID-19/COVID-19.npy"):
print("Processing Training Data.")
training_data = get_training_data('../data/COVID-19/train')
print("Processing Test Data.")
test_data = get_training_data('../data/COVID-19/test')
x_train, y_tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _creatExamplesTensorData(self, examples):\n\n images = []\n \n images2 = []\n images3 = []\n images4 = []\n images5 = [] \n labels = []\n for (img_idx, label) in examples:\n img = self.dataset[img_idx][0]\n #print(img)\n ... | [
"0.65798223",
"0.63433284",
"0.62618893",
"0.62491673",
"0.61352044",
"0.61113876",
"0.60965294",
"0.60909307",
"0.60745883",
"0.6044424",
"0.60078156",
"0.598105",
"0.5969824",
"0.5969628",
"0.5969628",
"0.5942477",
"0.59350705",
"0.5893892",
"0.587515",
"0.58588636",
"0.584... | 0.5694539 | 40 |
Any models to be tested must be imported in the test's `setUpClass` method, as they need to be patched prior to `db.create_all()` in `setUp` | def setUpClass(cls):
app.config['TESTING'] = True
app.config['CSRF_ENABLED'] = False
app.config['WTF_CSRF_ENABLED'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = \
'sqlite:///' + TEST_DATABASE_PATH
# Disable login_required for tests
# Use self.enable_login(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n db.create_all()",
"def setUp(self):\n db.drop_all() # clean up the last tests\n db.create_all() # make our sqlalchemy tables",
"def setUp(self):\n\n app.config.from_object(config['testing'])\n db.create_all()",
"def setUp(self):\n self.model = sq... | [
"0.7825705",
"0.753866",
"0.7409395",
"0.72067827",
"0.71429545",
"0.7117181",
"0.71091753",
"0.7046784",
"0.6965912",
"0.6929309",
"0.6926568",
"0.6924798",
"0.6920336",
"0.6913581",
"0.68933344",
"0.68916816",
"0.6891269",
"0.6881022",
"0.68728936",
"0.6872371",
"0.6872371"... | 0.0 | -1 |
This function will find the indices of the peaks of an input ndimensional numpy array. This can be configured to find max or min peak indices, distance between the peaks, and a lower bound, at which the algorithm will stop searching for peaks (or upper bound if searching for max). Use exactly the same as find_peak_valu... | def find_peak_indices(input_array, n_peaks, min_dist=None, do_min=False, threshold=0.5):
input_array = np.array(input_array, dtype=float)
if input_array.ndim > 2:
raise ValueError('Cannot find peak indices on data greater than 2 dimensions!')
is_1d = input_array.ndim == 1
zero_dist = zero_dist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_peak_values(input_array, n_peaks, min_dist=None, do_min=False, threshold=0.5):\n if input_array.ndim > 2:\n raise ValueError('Cannot find peak indices on data greater than 2 dimensions!')\n\n if input_array.ndim == 1:\n return [input_array[i] for i in find_peak_indices(input_array, n_p... | [
"0.83074194",
"0.82934743",
"0.8069478",
"0.74674654",
"0.6951511",
"0.67870766",
"0.67738926",
"0.674359",
"0.674359",
"0.6737444",
"0.6722073",
"0.6702631",
"0.66736346",
"0.666989",
"0.66589296",
"0.66544753",
"0.65974927",
"0.65417224",
"0.6473121",
"0.6449085",
"0.640546... | 0.8069478 | 2 |
Returns a JSON string of the numpy array. | def json_serialize_numpy_array(array):
return json.dumps(json_ready_numpy_array(array)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np2str(a: np.ndarray) -> str:\n return json.dumps(a.tolist())",
"def _serialize_array(self, array):\n buffer = io.BytesIO()\n np.save(buffer, array)\n return buffer.getvalue()",
"def to_json(self) -> str:\n data_dict = self._to_list_dict()\n return json.dumps(data_dict... | [
"0.79961276",
"0.7397443",
"0.73925334",
"0.688171",
"0.6696081",
"0.6654546",
"0.66126215",
"0.65253544",
"0.65208703",
"0.65040886",
"0.6500449",
"0.64657",
"0.643039",
"0.6383189",
"0.6380034",
"0.6364132",
"0.63606334",
"0.63593346",
"0.6354532",
"0.6342062",
"0.63242596"... | 0.864861 | 0 |
Turns a JSONified numpy array back into a regular numpy array. | def load_numpy_json(array_json):
return json.loads(array_json, object_hook=json_numpy_obj_hook)[constants.NUMPY_JSON_KEY] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))",
"def json_serialize_numpy_array(array):\n return json.dumps(json_ready_numpy_array(array))",
"def _json_numpy_obj_hook(dct):\n if isinstance(dct, dict) and '__ndarray__' in dct:\n data = base64.b64decode... | [
"0.7680125",
"0.7680125",
"0.7285017",
"0.7256934",
"0.7256934",
"0.7256934",
"0.71081746",
"0.710328",
"0.68811244",
"0.68306106",
"0.68011117",
"0.6755618",
"0.6636277",
"0.6623525",
"0.66064197",
"0.6459305",
"0.6449567",
"0.6412786",
"0.6401802",
"0.6364551",
"0.6326739",... | 0.7599576 | 2 |
Returns a complexvalued numpy array of random values with shape `shape` | def complex_randn(shape):
return np.random.randn(*shape) + 1j * np.random.randn(*shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_numpy_state(nqubits, dtype=np.complex128):\n x = random_numpy_complex(2 ** nqubits, dtype)\n return (x / np.sqrt((np.abs(x) ** 2).sum())).astype(dtype)",
"def random_numpy_hermitian(nqubits, dtype=np.complex128):\n shape = 2 * (2 ** nqubits,)\n m = random_numpy_complex(shape, dtype)\n r... | [
"0.63115907",
"0.61913556",
"0.60783106",
"0.6042941",
"0.6021901",
"0.5978729",
"0.59504664",
"0.5905333",
"0.5889447",
"0.5885137",
"0.5856037",
"0.5795648",
"0.57226056",
"0.5721742",
"0.56682235",
"0.5640449",
"0.5619766",
"0.5619029",
"0.56017435",
"0.5584511",
"0.556774... | 0.82348084 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(hw_msg, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg._Header.Header()
if self.temp_1_curr is None:
self.temp_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77936506",
"0.7720004",
"0.7720004",
"0.76861507",
"0.76264745",
"0.756367",
"0.74394095",
"0.74168324",
"0.7351523",
"0.7307856",
"0.7280199",
"0.7237893",
"0.72272074",
"0.7223773",
"0.7223773",
"0.7218694",
"0.7211321",
"0.7211321",
"0.7211321",
"0.7211321",
"0.7211321"... | 0.0 | -1 |
Whether or not this AP is encrypted. False implies encryption_type == None. | def encrypted(self):
return self.encryption_type is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypted(self) -> Optional[bool]:\n return pulumi.get(self, \"encrypted\")",
"def encrypted(self) -> Optional[bool]:\n return pulumi.get(self, \"encrypted\")",
"def _should_be_encrypted(self):\n if self._should_be_encrypted_state is not None:\n return self._should_be_encryp... | [
"0.77468616",
"0.77468616",
"0.7316614",
"0.7284378",
"0.7282918",
"0.70821226",
"0.6779458",
"0.6458432",
"0.6400978",
"0.6360095",
"0.62288326",
"0.62288326",
"0.6109639",
"0.60363394",
"0.58812004",
"0.58765674",
"0.5860729",
"0.5845323",
"0.5845323",
"0.58014596",
"0.5801... | 0.833146 | 0 |
Checks if the parameters get reinitialized to the original parameters. | def test_reinitialization(conv_model):
pruned = condense.torch.PruningAgent(conv_model, condense.optimizer.sparsity_functions.Constant(0.7), apply_mask=False)
pre_pruning = [p.clone().detach().numpy() for p in pruned.model.parameters()]
# search
with condense.torch.TicketSearch(pruned):
masks =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_params(self):\n pass",
"def test_reset_params(self):\n\t\t\n\t\tparams = DEFAULT_PARAMS.copy()\n\t\tparams['fit']=PL\n\t\tvalid = self.watcher.valid_params(params)\n\t\tself.assertTrue(valid)\n\t\tparams = self.watcher.normalize_params(params)\n\t\tself.assertEqual(params['fit'], POWER_LAW)\n\t... | [
"0.6827425",
"0.6818343",
"0.6690333",
"0.66143817",
"0.648997",
"0.6446235",
"0.6435964",
"0.64078283",
"0.63528496",
"0.62838995",
"0.62692744",
"0.6225184",
"0.62122035",
"0.6193533",
"0.61814904",
"0.6151261",
"0.6144253",
"0.6125766",
"0.61127454",
"0.61073637",
"0.61059... | 0.0 | -1 |
Strip accents from input. Helper function to create 'clean' emails | def strip_accents(text):
text = six.ensure_text(text)
text = unicodedata.normalize('NFD', text)
text = text.encode('ascii', 'ignore')
return str(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_email(email: str):\n return email.lower()",
"def remove_accents(input_str):\n\n\tnfkd_form = unicodedata.normalize('NFKD', input_str)\n\treturn u\"\".join([c for c in nfkd_form if not unicodedata.combining(c)])",
"def remove_accented_chars(text):\n text = unicodedata.normalize('NFKD', text).enc... | [
"0.7021799",
"0.67536014",
"0.66955256",
"0.66761786",
"0.666797",
"0.6601749",
"0.65575325",
"0.65400857",
"0.652173",
"0.65183586",
"0.6472583",
"0.6445991",
"0.64296013",
"0.64296013",
"0.64296013",
"0.64296013",
"0.64296013",
"0.64296013",
"0.64240664",
"0.6422178",
"0.64... | 0.6280486 | 32 |
Serve a user's profile photo | def profile_photo(request, username):
try:
user = User.objects.get(username__iexact=username)
return utility.serve_file(user.profile.photo.path)
except ObjectDoesNotExist:
raise Http404() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_pic(request):\n if request.user.is_authenticated:\n profile_obj = CustomUser.objects.get(id__exact=request.user.id)\n pic = profile_obj.avatar\n return {'picture': pic}\n return {}",
"def user_profileImg(id):\n data = request.get_json(force=True)\n\n user = User.query... | [
"0.7425731",
"0.7067874",
"0.706204",
"0.69516957",
"0.6871005",
"0.68416315",
"0.6781933",
"0.67810225",
"0.67771757",
"0.67501855",
"0.67315775",
"0.67027104",
"0.66652125",
"0.6616928",
"0.65717787",
"0.6523618",
"0.6496846",
"0.6434598",
"0.6418374",
"0.6382411",
"0.63707... | 0.8558173 | 0 |
View a list of signed agreements in the user profile. | def view_agreements(request):
user = request.user
signed = DUASignature.objects.filter(user=user).order_by('-sign_datetime')
return render(request, 'user/view_agreements.html', {'user': user,
'signed': signed}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_signed_agreement(request, id):\n user = request.user\n signed = DUASignature.objects.get(user=user, id=id)\n\n return render(request, 'user/view_signed_agreement.html',\n {'user': user, 'signed': signed})",
"def myorgs(request):\n context = RequestContext(request)\n \n ... | [
"0.5884586",
"0.54331005",
"0.5431335",
"0.5430873",
"0.54159105",
"0.5398891",
"0.5397783",
"0.5391553",
"0.5387686",
"0.5273021",
"0.5228341",
"0.52003604",
"0.51820475",
"0.5145868",
"0.5143096",
"0.5142464",
"0.5124138",
"0.51136005",
"0.50779504",
"0.507683",
"0.5071921"... | 0.5968959 | 0 |
Gets the vpc_id of this VpcAttachmentDetails. VPC id | def vpc_id(self):
return self._vpc_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self... | [
"0.8290548",
"0.8290548",
"0.8290548",
"0.8290548",
"0.8290548",
"0.8290548",
"0.81788456",
"0.8129827",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.8122276",
"0.80111253",
"0.80111253",
"0.80111253",
"0.80111253"... | 0.8502114 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, VpcAttachmentDetails):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528"
] | 0.0 | -1 |
Return the smallest value in the data. | def min(self) -> Union[float, int, str]:
return self._data.min() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Min(data):\n return data.min()",
"def min(self):\n least = self.data[0]\n \n for i in range(len(self.data)):\n if self.data[i] < least:\n least = self.data[i]\n return least",
"def get_min(cls, data: tuple or list) -> float:\n cls._data_valida... | [
"0.873425",
"0.8405513",
"0.82173616",
"0.7871427",
"0.7670976",
"0.7653942",
"0.7653942",
"0.76174706",
"0.7593056",
"0.7579595",
"0.7566534",
"0.75442654",
"0.75402164",
"0.7512103",
"0.75111985",
"0.7508916",
"0.74834496",
"0.74484205",
"0.7424314",
"0.74171704",
"0.741115... | 0.8019036 | 3 |
Return the largest value in the data. | def max(self) -> Union[float, int, str]:
return self._data.max() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Max(data):\n return data.max()",
"def max(self):\n most = self.data[0]\n \n for i in range(len(self.data)):\n if self.data[i] > least:\n most = self.data[i]\n return most",
"def get_max(cls, data: tuple or list) -> float:\n cls._data_validatio... | [
"0.85486984",
"0.79553497",
"0.79170275",
"0.7868155",
"0.7831538",
"0.76822776",
"0.7680516",
"0.7679897",
"0.7510201",
"0.7477163",
"0.74442613",
"0.7414231",
"0.7401389",
"0.73846036",
"0.7371326",
"0.73421335",
"0.7336119",
"0.732782",
"0.7323482",
"0.7292995",
"0.7271684... | 0.7612599 | 8 |
A client can do patch request successfully | def test_client_can_do_patch_request(self):
response = self.httpbin_4.test_requests_patch_method()
self.assertEqual(response.request.method, 'PATCH')
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(self , request , pk = None ):\r\n return Response({'method':'patch'})",
"def patch(self, *args, **kwargs):\n return self.handle_patch_request()",
"def test_patch(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n \n # Mock go... | [
"0.7764518",
"0.7751643",
"0.77326906",
"0.763076",
"0.75312936",
"0.74637896",
"0.74347484",
"0.73837215",
"0.736269",
"0.7358247",
"0.7263651",
"0.72099453",
"0.72099453",
"0.72099453",
"0.7177987",
"0.7078033",
"0.7068756",
"0.7063043",
"0.70420396",
"0.7010907",
"0.699985... | 0.84671247 | 0 |
Init the dataset class. | def __init__(self, dataset_folder: str, mode: str, output_folder: str, transforms: torchvision.transforms = None, show_stats: bool = False):
super(FER2013, self).__init__()
self.transforms = transforms
self.show_stats = show_stats
self.mode = mode
self.database_path = j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self):\n self.__dataset = None",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s... | [
"0.831527",
"0.826496",
"0.8220359",
"0.7781776",
"0.75311595",
"0.7326731",
"0.7293301",
"0.7274212",
"0.7226745",
"0.71628165",
"0.71075994",
"0.70095",
"0.7008005",
"0.7003335",
"0.70004374",
"0.69917274",
"0.69804174",
"0.6954499",
"0.6942058",
"0.69351494",
"0.6921956",
... | 0.0 | -1 |
This func is main for homepage | def home(request):
context = get_context()
context['title'] = 'Simple App'
context['teachers'] = Teacher.objects.all().order_by('-teacher_median_rating')
#context['tea_rait'] = Review.objects.filter()
return render(request, 'home.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\r\n print(__name__ + \" invoked\")",
"def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")",
"def home(self, *args, **kwargs):\n pass",
"def homepage():\n return render_template('home/index.html', \n title=\"... | [
"0.79999846",
"0.74716014",
"0.73894984",
"0.73340285",
"0.72991085",
"0.72771865",
"0.7219062",
"0.72071993",
"0.71411794",
"0.7129828",
"0.7118443",
"0.71173626",
"0.71173626",
"0.71104914",
"0.7107016",
"0.71016544",
"0.7097906",
"0.7090019",
"0.70688385",
"0.70213443",
"0... | 0.0 | -1 |
Norm a path name to platform specific notation and make it absolute. | def cnormpath (path):
path = normpath(path)
if os.name == 'nt':
# replace slashes with backslashes
path = path.replace("/", "\\")
if not os.path.isabs(path):
path = normpath(os.path.join(sys.prefix, path))
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalized_path(path):\n return os.path.abspath(os.path.expanduser(path))",
"def normalized_file_path(path: str) -> str:\n # Convert Unix path to Windows path for WSL\n if PLATFORM == \"WSL\":\n return path.replace(\"/\", \"\\\\\")\n\n return path",
"def normpath_with_actual_case(name):... | [
"0.7336447",
"0.7148355",
"0.71451217",
"0.70282465",
"0.70282465",
"0.6980435",
"0.69760627",
"0.69303644",
"0.6852183",
"0.68321663",
"0.67753625",
"0.6765366",
"0.675558",
"0.673684",
"0.6734103",
"0.6729796",
"0.67186904",
"0.6718133",
"0.67073745",
"0.6701254",
"0.669867... | 0.6123574 | 62 |
Get filename for distribution configuration file. | def get_conf_output (self):
return self.distribution.get_conf_filename(self.install_lib) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(self):\n return self.config.get('filename', self.id) + f'_{self.file_suffix}'",
"def config_file_name(self):\n return self._config_file_name",
"def configFilename(self):\n return self.name()+'.py'",
"def getConfigFileName(self):\n return self._configFileName",
"def... | [
"0.77090293",
"0.74874216",
"0.74027467",
"0.73140043",
"0.7265739",
"0.7173191",
"0.7153522",
"0.71430117",
"0.7115683",
"0.7022546",
"0.69880027",
"0.68998444",
"0.6864928",
"0.6804361",
"0.6751416",
"0.668528",
"0.66841614",
"0.6661076",
"0.66325194",
"0.6586205",
"0.65633... | 0.7250051 | 5 |
Create a Trello checklist from a text file. | def main(board_name, card_name, checklist_name, api_key, token, file):
items = [line.strip() for line in file]
trello = Client(api_key, token)
board = utils.get_board_by_name(trello, board_name)
card = utils.get_card_by_name(board, card_name)
utils.add_checklist(card, checklist_name, items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ta_list(ta_list):\n with open(ta_list, \"r\") as ta_file:\n user_list = ta_file.readlines()\n add_to_db(\"ta_list\", user_list[1:])\n add_to_online_db(\"online_ta\", user_list[1:])\n add_to_rating_db(\"ta_rating\", user_list[1:])",
"def make_list(list_file):\r\n retur... | [
"0.6220019",
"0.6049105",
"0.5991361",
"0.59366816",
"0.58920616",
"0.57706594",
"0.57271",
"0.5703168",
"0.56986743",
"0.56762844",
"0.5666236",
"0.56651545",
"0.56222665",
"0.56182206",
"0.55502933",
"0.55396384",
"0.55396384",
"0.55386305",
"0.5537396",
"0.5536411",
"0.552... | 0.6652163 | 0 |
A port of the functionality of in_cksum() from ping.c Ideally this would act on the string as a series of 16bit ints (host packed), but this works. Network data is bigendian, hosts are typically littleendian | def _checksum(source_string):
if (len(source_string) % 2):
source_string += "\x00"
converted = array.array("H", source_string)
if sys.byteorder == "big":
converted.bytewap()
val = sum(converted)
val &= 0xffffffff # Truncate val to 32 bits (a variance from ping.c, which
# uses s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cksum(packet):\n if len(packet) & 1:\n packet = packet + '\\0'\n datas = array.array('h', packet)\n sum = 0\n for data in datas:\n sum += (data & 0xffff)\n hi = sum >> 16\n lo = sum & 0xffff\n sum = hi + lo\n sum = sum + (sum >>... | [
"0.68266654",
"0.6621628",
"0.6166654",
"0.61237586",
"0.6082005",
"0.59690475",
"0.5965959",
"0.59583664",
"0.58851594",
"0.5831702",
"0.5814601",
"0.5810303",
"0.57718307",
"0.57341945",
"0.5700165",
"0.56719637",
"0.5660523",
"0.561681",
"0.5614702",
"0.561023",
"0.5593724... | 0.69002515 | 0 |
Return column names of the primary key. | def primary_key(table_name: str) -> str:
return f"""
SELECT
a.attname AS column_name,
format_type(a.atttypid, a.atttypmod) AS data_type
FROM
pg_index i
JOIN
pg_attribute a
ON
a.attrelid = i.indrelid AND
a.attnum = ANY(i.indkey)
WHERE
i.ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _primary_key_columns(cls):\n return [col for col in cls._columns() if getattr(cls, col).primary_key]",
"def key_columns(self):\n return [str(column) for id, column in self._columns.iteritems() if column.is_key]",
"def _primary_key_names(obj):\n return [key.name for key in _get_mapper(obj).... | [
"0.8571462",
"0.7733505",
"0.7550761",
"0.729198",
"0.7163926",
"0.71426594",
"0.7133316",
"0.70919836",
"0.70902246",
"0.70867",
"0.7072937",
"0.703016",
"0.7014376",
"0.6974875",
"0.6973131",
"0.6970686",
"0.682077",
"0.681506",
"0.6706224",
"0.6670281",
"0.6641505",
"0.6... | 0.69283056 | 16 |
Return column names (child and parent) of the foreign key. | def foreign_key(
table_name: str, schema: str, parent_name: str, parent_schema: str
) -> str:
return f"""
SELECT
att2.attname as child_column,
att.attname as parent_column
FROM
(SELECT
unnest(con1.conkey) AS parent,
unnest(con1.confkey) AS child,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_foreign_keys(self, parent, child):\n foreign_keys = []\n for name, field in self.get_fields(child).items():\n ref = field.get('ref')\n if ref and ref['table'] == parent:\n foreign_keys.append(name)\n\n return foreign_keys",
"def column_names(self)... | [
"0.6841067",
"0.6618676",
"0.65524894",
"0.61063516",
"0.6040657",
"0.5968472",
"0.596027",
"0.59502906",
"0.59422207",
"0.5930121",
"0.5929025",
"0.5907262",
"0.58808804",
"0.5862561",
"0.5833313",
"0.58075583",
"0.57867783",
"0.5784262",
"0.5771038",
"0.5691164",
"0.5659069... | 0.6146149 | 3 |
Return table name if it exists in database. | def is_table_exist(table_name: str, schema: str) -> str:
return f"""
SELECT
table_name
FROM
information_schema.tables
WHERE
table_name = '{table_name}' AND
table_schema='{schema}'
LIMIT 1
""" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_table(name):\n tables = Base.metadata.tables\n table = tables.get(name, None)\n if table is not None:\n return table\n else:\n raise NameError('Unable to locate table: %s' % name)",
"def db_table_exists(table_name):\n return table_name in connection.introspection.table_name... | [
"0.7547617",
"0.7544395",
"0.74595964",
"0.7432849",
"0.7388498",
"0.7305844",
"0.7294712",
"0.7282906",
"0.7267129",
"0.72339666",
"0.72267747",
"0.7211222",
"0.7207186",
"0.7187819",
"0.71429867",
"0.7139137",
"0.71212506",
"0.7096297",
"0.70899785",
"0.70818007",
"0.702665... | 0.72769797 | 8 |
Return amount of active connections to database. | def conn_count() -> str:
return "SELECT SUM(numbackends) FROM pg_stat_database" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getconnectioncount(self):\n return self.proxy.getconnectioncount()",
"def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)",
"def open_connections(self):\n return len(self._connections_openned)",
"def num_pending_connections(self, ... | [
"0.78796375",
"0.75027466",
"0.74931246",
"0.7382555",
"0.72285795",
"0.7199084",
"0.6894097",
"0.6881193",
"0.67908794",
"0.67715734",
"0.6759076",
"0.67569005",
"0.6748304",
"0.6734837",
"0.6731041",
"0.66553915",
"0.6599534",
"0.6554709",
"0.65445864",
"0.6524201",
"0.6516... | 0.75150573 | 1 |
Return the zone's serial | def find_zone_serial(self, zone_name):
zone_name = zone_name.rstrip(".")
LOG.debug("Finding zone: %s", zone_name)
try:
return self._dnsutils.get_zone_serial(zone_name)
except os_win_exc.DNSZoneNotFound:
# Return None if the zone was not found
return No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return f\"c{self._zone.controller_index + 1}_z{self._zone.zone_index + 1}\"",
"def zone_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"zone_id\")",
"def zone_id(self) ->... | [
"0.6659643",
"0.6535801",
"0.6535801",
"0.6535801",
"0.6535801",
"0.64930165",
"0.64271617",
"0.64271617",
"0.64271617",
"0.64271617",
"0.64271617",
"0.64040816",
"0.6395742",
"0.63877946",
"0.6352276",
"0.6352276",
"0.63489485",
"0.6336435",
"0.62758946",
"0.6227626",
"0.622... | 0.62072945 | 22 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
filters = {}
print('Hello Friend! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
while True:
try:
city = input ("Which city's data would you like to loo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# load data file into a dataframe
df = pd.read_csv(CITY_DATA[city.lower()])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# extract month and day of week from Start Time to create new columns
df['month'] = df['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8131747",
"0.81087744",
"0.80456793",
"0.80419374",
"0.80089974",
"0.8006586",
"0.7998844",
"0.7997986",
"0.7988014",
"0.797856",
"0.79733896",
"0.7960562",
"0.79556054",
"0.794673",
"0.7945893",
"0.7907837",
"0.7907697",
"0.790398",
"0.79001075",
"0.7892662",
"0.7888655",... | 0.7774819 | 40 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
df['Start Time'] = pd.to_datetime(df['Start Time'])
# TO DO: display the most common month
df['month'] = df['Start Time'].dt.month
popular_month = df['month'].mode()[0]
print("\nThe m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.8023237",
"0.8021888",
"0.79149604",
"0.78255546",
"0.78211224",
"0.78133345",
"0.77648497",
"0.7739481",
"0.773519",
"0.77332956",
"0.7685631",
"0.7667726",
"0.7650597",
"0.76435405",
"0.7638843",
"0.76357967",
"0.76242906",
"0.762238",
"0.7612054",
"0.7599205",
"0.758243... | 0.7578769 | 21 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
popular_start_station = df['Start Station'].mode()[0]
print("\nThe most popular start station is: {}".format(popular_start_station))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815998",
"0.7661799",
"0.755378",
"0.74918276",
"0.74751854",
"0.7446441",
"0.7429881",
"0.74239737",
"0.7417978",
"0.74006975",
"0.73876286",
"0.7385986",
"0.7365314",
"0.73597723",
"0.7355265",
"0.7352331",
"0.7351879",
"0.73507756",
"0.734247",
"0.734072",
"0.73376113"... | 0.7356932 | 14 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
total_time = df['Trip Duration'].sum()
total_time = sec2time(total_time)
print("\nThe total travel time: {}".format(total_time))
# TO DO: display mean travel ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7863762 | 21 |
Error Handler for Page Not Found | def page_not_found(err):
return error_formatter(code='404', details=err, parm1=request.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_not_found(e):\n return render_template(\"error/404.html\"), 404",
"def page_not_found(e):\n return 'Sorry, Nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, Nothing at this URL.', 404",
"def page_not_found(e):\n return 'Sorry, Nothing at this URL.', 404",
"def p... | [
"0.8755458",
"0.8744248",
"0.8744248",
"0.8744248",
"0.8744248",
"0.8744248",
"0.8744248",
"0.8744248",
"0.8744248",
"0.87403554",
"0.87403554",
"0.87403554",
"0.87403554",
"0.87403554",
"0.87403554",
"0.87403554",
"0.871635",
"0.8687297",
"0.8678457",
"0.8664324",
"0.8637136... | 0.83053315 | 34 |
Retrieves the opens for this campaign. | def opens(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"):
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection": order_direction}
response = self._get(self.u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_open_issues(self):\n return self._retrieve_issues(\"open\")",
"def open_orders(self, **params):\n return self._get('openOrders', signed=True, params=params)",
"def get_open_orders(self):\n url = 'https://coincheck.com/api/exchange/orders/opens'\n headers = make_header(u... | [
"0.72187746",
"0.60816914",
"0.6014103",
"0.59101033",
"0.58942103",
"0.5843947",
"0.58167183",
"0.5775469",
"0.56943935",
"0.564144",
"0.56002927",
"0.5576762",
"0.5556392",
"0.55557334",
"0.5542297",
"0.55094594",
"0.55062914",
"0.54881275",
"0.5486981",
"0.5484204",
"0.548... | 0.56360435 | 10 |
Retrieves the subscriber clicks for this campaign. | def clicks(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"):
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection": order_direction}
response = self._get(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clicks(self, unit=None, units=None, timezone=None,\r\n rollup=None, limit=None, unit_reference_ts=None):\r\n params = base.get_params(None, locals())\r\n return self._get('clicks', params)",
"def clicks(self, unit=None, units=None, timezone=None,\r\n rollup=None, lim... | [
"0.596236",
"0.596236",
"0.59434444",
"0.5315434",
"0.5225909",
"0.51660526",
"0.5163335",
"0.5139027",
"0.51202774",
"0.51030475",
"0.5087831",
"0.50675285",
"0.5003917",
"0.4983451",
"0.49755508",
"0.49733418",
"0.49423635",
"0.49111903",
"0.4864795",
"0.48427454",
"0.48269... | 0.44812983 | 49 |
Retrieves the bounces for this campaign. | def bounces(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"):
params = {
"date": date,
"page": page,
"pagesize": page_size,
"orderfield": order_field,
"orderdirection": order_direction}
response = self._get(self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_budgets(self) -> list:\n return list(self.budgets.values())",
"def bombs(self) -> List[Point]:\n\t\treturn self._bombs",
"def getBoogies(self):\n return self.boogies",
"def get_budgets(self) -> list:\n return self.budget_manager.get_budgets()",
"def GetCampaignBudget(self, requ... | [
"0.5825815",
"0.57745486",
"0.57671285",
"0.5680096",
"0.5677476",
"0.5673413",
"0.5622203",
"0.5558484",
"0.55306715",
"0.53496575",
"0.5286195",
"0.5271606",
"0.5256452",
"0.5227682",
"0.52218807",
"0.52104026",
"0.51981294",
"0.5194353",
"0.5194353",
"0.5194353",
"0.519435... | 0.6349432 | 0 |
Tests the gross price of a product and a variant. Takes active_price of the variant into account. | def test_get_price_gross(self):
# Test product
self.assertEqual(self.p1.get_price_gross(self.request), 1.19)
# Test variant. By default the price_gross of a variant is inherited
self.assertEqual(self.v1.get_price_gross(self.request), 1.19)
# Now we switch to active price.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_price_net(self):\n # Test product\n self.assertEqual(\"%.2f\" % self.p1.get_price_net(self.request), \"1.00\")\n\n # Test variant. By default the price_net of a variant is inherited,\n # but the tax is.\n self.assertEqual(\"%.2f\" % self.v1.get_price_net(self.request... | [
"0.6320616",
"0.6251485",
"0.61795664",
"0.60304016",
"0.6012337",
"0.59134173",
"0.58942324",
"0.58401847",
"0.58198315",
"0.5778359",
"0.5754907",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387",
"0.5725387... | 0.7659384 | 0 |
Tests the net price of a product and a variant. Takes active_price of the variant into account. | def test_get_price_net(self):
# Test product
self.assertEqual("%.2f" % self.p1.get_price_net(self.request), "1.00")
# Test variant. By default the price_net of a variant is inherited,
# but the tax is.
self.assertEqual("%.2f" % self.v1.get_price_net(self.request), "1.00")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_price_gross(self):\n # Test product\n self.assertEqual(self.p1.get_price_gross(self.request), 1.19)\n\n # Test variant. By default the price_gross of a variant is inherited\n self.assertEqual(self.v1.get_price_gross(self.request), 1.19)\n\n # Now we switch to active ... | [
"0.6691595",
"0.62683594",
"0.62134933",
"0.621005",
"0.6190434",
"0.61837125",
"0.6180782",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.6167622",
"0.615082",
"0.60978216",
"0.6029595",
... | 0.7587305 | 0 |
Test the price vs. standard price for a product. | def test_get_standard_price_1(self):
# By default get_standard_price returns then normal price of the product
standard_price = self.p1.get_standard_price(self.request)
self.assertEqual(standard_price, 1.0)
# Switch to for sale
self.p1.for_sale = True
self.p1.save()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_product_price(self):\n prod = Product('Test Product')\n self.assertEqual(prod.price, 10)\n self.assertEqual(prod.weight, 20)\n self.assertEqual(prod.flammability, 0.5)",
"def test_default_product_price(self):\n prod = product('Test Product')\n self.asser... | [
"0.7715158",
"0.76786983",
"0.76131463",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7609277",
"0.7096094",
"0.7006096",
"0.69783443",
"0.6761585",
"0.6760364",
"0.675921",
"0.6733933",
... | 0.7617914 | 2 |
for backwards compatability if `er_config` is supplied in deprecated format, its format is corrected and returned, else it is not modified and returned asis deprecated usage >>> er_config = { | def _correct_deprecated_er_config(er_config):
if not er_config.get("model_settings", {}).get("resolver_type", None):
model_type = er_config.get("model_type")
if model_type == "resolver":
raise Exception("Could not find `resolver_type` in `model_settings` of entity resolver")
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_deprecated_config(config):\n\n # key is the name of the depreacted variable that is no longer allowed in any config files\n # value is a dictionary containing information about what to do with the deprecated config\n # 'sec' is the section of the config file where the replacement resides, i.... | [
"0.6705938",
"0.6130237",
"0.55570614",
"0.55472744",
"0.54917336",
"0.54164374",
"0.54086757",
"0.5395785",
"0.5381526",
"0.524632",
"0.5237769",
"0.51917696",
"0.5102691",
"0.50998974",
"0.50958586",
"0.5080534",
"0.50751907",
"0.50751907",
"0.50564736",
"0.5032973",
"0.502... | 0.7380771 | 0 |
Recover the Hessian of `f` on the domain boundary. That is, the Hessian in the direction tangential to the boundary. In two dimensions this gives a scalar field, whereas in three dimensions it gives a 2D field on the surface. The resulting field should only be considered on the boundary and is set arbitrarily to 1/h_ma... | def construct_boundary_hessian(f, mesh=None, op=DefaultOptions()):
if mesh is None:
mesh = f.function_space().mesh()
dim = mesh.topological_dimension()
#assert dim in (2, 3)
try:
assert dim == 2
except:
raise NotImplementedError # TODO
P1 = FunctionSpace(mesh, "CG", 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hessian(self):\n log_g = np.log(self._gv())\n log_f = np.log(self._fv())\n h_inf = np.mean((1 - log_g + log_f) / (self.y - self.err_inf) ** 2)\n return h_inf",
"def hessian(f, x, s=_DEFAULT_STEP):\n x = np.asarray(x)\n n = len(x)\n e = s * np.eye(n)\n\n forw1 = np.zeros(n)\n forw2... | [
"0.703669",
"0.69524544",
"0.69119227",
"0.6896295",
"0.6790206",
"0.667243",
"0.6562314",
"0.6559246",
"0.6549805",
"0.6492219",
"0.64844996",
"0.63698477",
"0.61329436",
"0.6100355",
"0.60659105",
"0.6032434",
"0.59992635",
"0.5926776",
"0.5923679",
"0.59167516",
"0.5909447... | 0.7486502 | 0 |
Tests the add_room method. | def test_add_room(self):
the_world = World()
name = 'theater'
description = "in a lecture theater"
the_world.add_room(name, description)
r = the_world.get_room(name)
self.assertEqual(str(r), description) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_new_room(new_room):\n try:\n uuid.UUID(str(new_room.id), version=4)\n except ValueError:\n raise ValueError('new_room id is not valid uuid4')\n assert new_room.name == 'TestRoom'\n assert new_room.type == 'public'\n assert new_room.status == 'playing'\n assert new_room.glob... | [
"0.74922293",
"0.7264509",
"0.70538616",
"0.70401347",
"0.6930893",
"0.6883655",
"0.68819433",
"0.67100763",
"0.6669142",
"0.6598007",
"0.655878",
"0.6542973",
"0.65143955",
"0.6472384",
"0.64019275",
"0.6383856",
"0.63302594",
"0.6311833",
"0.6238131",
"0.6225402",
"0.614573... | 0.8216619 | 0 |
return interpolated color from last color and this color | def getTweenColor(self, factor):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_color(self):\n idx = self._color_indexes.get(self._plotid)\n if idx is not None:\n return COLOR_CYCLE[(idx-1) % len(COLOR_CYCLE)]\n return COLOR_CYCLE[0]",
"def get_color(self, point):\n \n d = point - self._origin\n dist = int(d.dot(d) ** 0.5) % 2\n ... | [
"0.7087822",
"0.63200676",
"0.6271074",
"0.6244209",
"0.6098376",
"0.60702485",
"0.603969",
"0.60361147",
"0.60168844",
"0.60160327",
"0.5953575",
"0.5948996",
"0.5942876",
"0.58946073",
"0.58725125",
"0.5868669",
"0.58492786",
"0.5828574",
"0.5808043",
"0.5802417",
"0.577360... | 0.5910959 | 13 |
Converts a Pandas datetime to a Timestamp Proto | def _pd_datetime_to_timestamp_proto(dtype, value) -> Timestamp:
if type(value) in [np.float64, np.float32, np.int32, np.int64]:
return Timestamp(seconds=int(value))
if dtype.__str__() == "datetime64[ns]":
# If timestamp does not contain timezone, we assume it is of local
# timezone and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pb_timestamp_to_datetime(timestamp_pb):\n return (\n _EPOCH +\n datetime.timedelta(\n seconds=timestamp_pb.seconds,\n microseconds=(timestamp_pb.nanos / 1000.0),\n )\n )",
"def datetime_to_timestamp(obj: \"datetime\") -> \"Timestamp\":\n ... | [
"0.6992012",
"0.6916718",
"0.67110455",
"0.6689183",
"0.64958626",
"0.6478306",
"0.6412297",
"0.63883656",
"0.6380587",
"0.631954",
"0.62368375",
"0.62250704",
"0.62090683",
"0.61808443",
"0.6169764",
"0.6161866",
"0.6145431",
"0.6138735",
"0.6135448",
"0.6097708",
"0.6097389... | 0.80228204 | 0 |
Initialize the weights in head. | def init_weights(self, pretrained):
if self.with_shared_head:
self.shared_head.init_weights(pretrained=pretrained)
for i in range(1):
if self.with_bbox:
self.bbox_roi_extractor[i].init_weights()
self.bbox_head[i].init_weights()
if self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def setWeightInitializer(self,weights):\n self.init_w = weights",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weigh... | [
"0.815603",
"0.806733",
"0.8052603",
"0.8038924",
"0.7895786",
"0.7743422",
"0.77382624",
"0.7728443",
"0.7677289",
"0.76428324",
"0.763516",
"0.76086015",
"0.7575363",
"0.7574663",
"0.7574663",
"0.7568764",
"0.7568764",
"0.7568764",
"0.755185",
"0.7521171",
"0.7505926",
"0... | 0.7001146 | 56 |
Apply maximum filter to the spectrum to ignore deeper fluxes of absorption lines. | def filtermax(f, maxfiltsize=10):
# Maximum filter to ignore deeper fluxes of absorption lines
f_maxfilt = maximum_filter1d(f, size=maxfiltsize)
# Find points selected by maximum filter
idxmax = np.array([i for i in range(len(f)) if f[i]-f_maxfilt[i] == 0.])
return f_maxfilt, idxmax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_flux(frame):\n return np.max(frame.fluxes[frame.radii <= max_extent_px])",
"def max_flux(self):\n return np.max(self.flux)",
"def _remove_flux_extinction(self):\n self.fluxUnred = self.flux.copy()\n self.fluxErrUnred = self.fluxErr.copy()\n self.fluxRenorm = self.flux... | [
"0.71482474",
"0.65576786",
"0.64730114",
"0.6459978",
"0.6155351",
"0.596515",
"0.5873419",
"0.58694047",
"0.58484775",
"0.58401835",
"0.5837267",
"0.57952857",
"0.5772452",
"0.575531",
"0.5707928",
"0.563688",
"0.56311494",
"0.56014687",
"0.5598752",
"0.55768603",
"0.555518... | 0.6952475 | 1 |
Sets the id of this ModelDto. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.data['id'] = id",
"def id(self, id: int):\n\n self._id = id",
"def id(self, id: int):\n\n self._id = id... | [
"0.7545301",
"0.7444147",
"0.7422757",
"0.7415825",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.7238604",
"0.71724826",
"0.71724826",
"0.71724826",
"0.71724826",
"0.71724826",
"0.7147737",
"0.7105672"... | 0.0 | -1 |
Sets the color of this ModelDto. | def color(self, color):
if color is None:
raise ValueError("Invalid value for `color`, must not be `None`") # noqa: E501
self._color = color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_color(self, color):\n pass",
"def set_color(self, color):\n self.color = color",
"def setColor(self, color):\n self.__color = color",
"def set_color(self, color):\n self._color = color",
"def set_color(self, color: str):\n self.color = color",
"def set_color(sel... | [
"0.7578285",
"0.75550854",
"0.74939936",
"0.74782676",
"0.733632",
"0.7332925",
"0.72534764",
"0.7203712",
"0.7167017",
"0.71116275",
"0.70484465",
"0.70476395",
"0.70476395",
"0.70476395",
"0.70476395",
"0.6929415",
"0.668376",
"0.66110253",
"0.65771294",
"0.65560615",
"0.65... | 0.66242653 | 17 |
Sets the name of this ModelDto. | def name(self, name):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name: str):... | [
"0.75261915",
"0.75261915",
"0.75261915",
"0.75261915",
"0.75261915",
"0.75104547",
"0.74835277",
"0.745461",
"0.745461",
"0.7423095",
"0.7418761",
"0.7410301",
"0.740233",
"0.74007094",
"0.73698944",
"0.73186266",
"0.7295967",
"0.7294881",
"0.72530204",
"0.72530204",
"0.7241... | 0.0 | -1 |
Sets the activity of this ModelDto. | def activity(self, activity):
if activity is None:
raise ValueError("Invalid value for `activity`, must not be `None`") # noqa: E501
self._activity = activity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(self, activity):\n allowed_values = [\"PICKUP\", \"DROPOFF\", \"EXECUTE\", \"BREAK\"] # noqa: E501\n if activity not in allowed_values:\n raise ValueError(\n \"Invalid value for `activity` ({0}), must be one of {1}\" # noqa: E501\n .format(activ... | [
"0.70205235",
"0.69461215",
"0.63554996",
"0.62895846",
"0.62752646",
"0.6232753",
"0.61833364",
"0.6081841",
"0.5883179",
"0.56834894",
"0.56680465",
"0.56211054",
"0.55490756",
"0.54902005",
"0.5342137",
"0.51952237",
"0.51904124",
"0.517912",
"0.512955",
"0.50790954",
"0.5... | 0.72526926 | 0 |
Sets the top_tolerance of this ModelDto. | def top_tolerance(self, top_tolerance):
if top_tolerance is None:
raise ValueError("Invalid value for `top_tolerance`, must not be `None`") # noqa: E501
self._top_tolerance = top_tolerance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tolerance(self, value):\n\n self._tolerance = value",
"def set_tolerance(self, tol):\n self.tolerance = tol",
"def tolerance(self, tolerance: float) -> None:\n self._tolerance = tolerance",
"def set_tolerance(self, *args, **kwargs):\n raise ParameterError(\"The %s Stopping... | [
"0.6841155",
"0.67710084",
"0.6331334",
"0.6167406",
"0.610916",
"0.6098492",
"0.60940814",
"0.6083939",
"0.60285705",
"0.59899575",
"0.57776874",
"0.5735932",
"0.5691691",
"0.5655104",
"0.5617467",
"0.56063145",
"0.5594001",
"0.5552465",
"0.55364025",
"0.5512174",
"0.550715"... | 0.7434076 | 0 |
Sets the bottom_tolerance of this ModelDto. | def bottom_tolerance(self, bottom_tolerance):
if bottom_tolerance is None:
raise ValueError("Invalid value for `bottom_tolerance`, must not be `None`") # noqa: E501
self._bottom_tolerance = bottom_tolerance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom(self, bottom):\n\n self._bottom = bottom",
"def bottom(self, bottom):\n # type: (float) -> None\n\n if bottom is not None:\n if not isinstance(bottom, (float, int)):\n raise TypeError(\"Invalid type for `bottom`, type has to be `float`\")\n\n self.... | [
"0.62399477",
"0.61966026",
"0.6092744",
"0.59726316",
"0.59240836",
"0.5860508",
"0.5785886",
"0.56930083",
"0.5660512",
"0.56097645",
"0.55746865",
"0.55319715",
"0.55253196",
"0.55126035",
"0.5488229",
"0.5467789",
"0.546369",
"0.54347587",
"0.5430406",
"0.53683823",
"0.53... | 0.7875747 | 0 |
Sets the x of this ModelDto. | def x(self, x):
if x is None:
raise ValueError("Invalid value for `x`, must not be `None`") # noqa: E501
self._x = x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetX(self, x):\r\n\r\n self._x = x",
"def setX(self, x):\n self.x = x\n pass",
"def set_x(self, x):\n self._x = x",
"def setX(self, x):\r\n\t\tself._x=x",
"def set_x(self, x: float):\n self.x = x",
"def x(self, value):\n self.data_validator(\"x\", value)\n ... | [
"0.7968087",
"0.79295015",
"0.79221725",
"0.78873247",
"0.76668715",
"0.7599433",
"0.75240713",
"0.7374554",
"0.71904075",
"0.7181541",
"0.7181541",
"0.7149035",
"0.7096423",
"0.70205957",
"0.69956946",
"0.69020885",
"0.69020885",
"0.6878582",
"0.6878582",
"0.6741559",
"0.673... | 0.7403818 | 7 |
Sets the y of this ModelDto. | def y(self, y):
if y is None:
raise ValueError("Invalid value for `y`, must not be `None`") # noqa: E501
self._y = y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_y(self, y):\n self._y = y",
"def SetY(self, y):\r\n\r\n self._y = y",
"def setY(self, y):\n self.y = y\n pass",
"def set_y(self, y: float):\n self.y = y",
"def setY(self, y):\r\n\t\tself._y=y",
"def y(self, y):\n if type(y) is not int:\n raise ... | [
"0.81996715",
"0.8167774",
"0.815691",
"0.814624",
"0.80548793",
"0.77200365",
"0.77200365",
"0.7693411",
"0.7660961",
"0.76214176",
"0.76154184",
"0.75680715",
"0.7544004",
"0.74831194",
"0.7454638",
"0.7454638",
"0.73712885",
"0.7332098",
"0.7319096",
"0.7319096",
"0.728390... | 0.7820704 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.