query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the state attributes of the sensor. | def device_state_attributes(self):
attr = self.collector.observations_data["metadata"]
attr.update(self.collector.observations_data["data"]["station"])
attr[ATTR_ATTRIBUTION] = ATTRIBUTION
return attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\n\t\treturn self._state_attributes",
"def device_state_attributes(self):\n\t\treturn self._attributes",
"def device_state_attributes(self):\r\n return self._attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n... | [
"0.8349223",
"0.8340841",
"0.8244031",
"0.8243777",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.81417567",
"0.81401604",
... | 0.7713895 | 33 |
Return the name of the sensor. | def name(self):
return f"{self.location_name} {self.sensor_name.replace('_', ' ').title()}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.sensor.name",
"def name(self):\n return self.sensor.name",
"def name(self) -> str:\n return self._sensor.name",
"def sensor_name(self):\n return self._sensor_name",
"def name(self):\n return SENSOR_NAME",
"def name(self):\n return '{... | [
"0.9172938",
"0.9172938",
"0.9119264",
"0.90965885",
"0.8981336",
"0.85841",
"0.8511273",
"0.8511273",
"0.82223254",
"0.81386924",
"0.809015",
"0.77122",
"0.7700968",
"0.7556649",
"0.7541934",
"0.7540329",
"0.7538318",
"0.75381917",
"0.7537575",
"0.74322224",
"0.74322224",
... | 0.79436237 | 11 |
Return the state attributes of the sensor. | def device_state_attributes(self):
attr = self.collector.daily_forecasts_data["metadata"]
attr[ATTR_ATTRIBUTION] = ATTRIBUTION
# If there is no data for this day, do not add attributes for this day.
if self.day < len(self.collector.daily_forecasts_data["data"]):
attr[ATTR_DA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\n\t\treturn self._state_attributes",
"def device_state_attributes(self):\n\t\treturn self._attributes",
"def device_state_attributes(self):\r\n return self._attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n... | [
"0.8349223",
"0.8340841",
"0.8244031",
"0.8243777",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.81417567",
"0.81401604",
... | 0.0 | -1 |
Return the name of the sensor. | def name(self):
return f"{self.location_name} {self.sensor_name.replace('_', ' ').title()} {self.day}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.sensor.name",
"def name(self):\n return self.sensor.name",
"def name(self) -> str:\n return self._sensor.name",
"def sensor_name(self):\n return self._sensor_name",
"def name(self):\n return SENSOR_NAME",
"def name(self):\n return '{... | [
"0.9172938",
"0.9172938",
"0.9119264",
"0.90965885",
"0.8981336",
"0.85841",
"0.8511273",
"0.8511273",
"0.82223254",
"0.81386924",
"0.809015",
"0.79436237",
"0.77122",
"0.7700968",
"0.7556649",
"0.7540329",
"0.7538318",
"0.75381917",
"0.7537575",
"0.74322224",
"0.74322224",
... | 0.7541934 | 15 |
Handle the `!=` operator. | def __ne__(self, other):
return Bool(self.value != other.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\r\n\t\t\treturn not (self == other) # opposite of eq\r",
"def __ne__(self, other):\n return not self.value != other",
"def __ne__(self,other):\n return not self.__eq__(other)",
"def __ne__(self, value):\n return not self == value",
"def __ne__(self, other):\n ... | [
"0.7701856",
"0.7623848",
"0.7601371",
"0.7599848",
"0.7564839",
"0.7563925",
"0.7552646",
"0.7539964",
"0.7526658",
"0.7526658",
"0.7520586",
"0.7508582",
"0.7498265",
"0.74929726",
"0.74929726",
"0.7492929",
"0.74904346",
"0.74888265",
"0.747111",
"0.747111",
"0.7456733",
... | 0.0 | -1 |
String representation of the class. | def __repr__(self):
return self.__str__() # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Class({})\".format(\", \".join(\"{}={}\".format(k, v) for k, v in self.items()))",
"def to_str (self):\n return str(self.__class__) + \" \" + pprint.pformat(self.to_dict())",
"def __str__(self):\n return \"\\n\".join([str(c) for c in self.get_classes()])",
"... | [
"0.8664411",
"0.8400987",
"0.8357878",
"0.8216963",
"0.81556624",
"0.8145425",
"0.8064506",
"0.7983946",
"0.78919905",
"0.78919905",
"0.78259504",
"0.7794093",
"0.7755964",
"0.7732831",
"0.7701502",
"0.7687556",
"0.7663224",
"0.7637192",
"0.76368475",
"0.7633759",
"0.7633759"... | 0.0 | -1 |
Handle the `!=` operator. | def __ne__(self, other):
if not isinstance(other, NoneType):
return Bool(True)
return Bool(False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\r\n\t\t\treturn not (self == other) # opposite of eq\r",
"def __ne__(self, other):\n return not self.value != other",
"def __ne__(self,other):\n return not self.__eq__(other)",
"def __ne__(self, value):\n return not self == value",
"def __ne__(self, other):\n ... | [
"0.7701856",
"0.7623848",
"0.7601371",
"0.7599848",
"0.7564839",
"0.7563925",
"0.7552646",
"0.7539964",
"0.7526658",
"0.7526658",
"0.7520586",
"0.7508582",
"0.7498265",
"0.74929726",
"0.74929726",
"0.7492929",
"0.74904346",
"0.74888265",
"0.747111",
"0.747111",
"0.7456733",
... | 0.0 | -1 |
String representation of the class. | def __repr__(self):
return self.__str__() # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Class({})\".format(\", \".join(\"{}={}\".format(k, v) for k, v in self.items()))",
"def to_str (self):\n return str(self.__class__) + \" \" + pprint.pformat(self.to_dict())",
"def __str__(self):\n return \"\\n\".join([str(c) for c in self.get_classes()])",
"... | [
"0.8664359",
"0.8401233",
"0.8357845",
"0.8216172",
"0.8155078",
"0.81459904",
"0.8064289",
"0.7985094",
"0.7891267",
"0.7891267",
"0.78273165",
"0.77935815",
"0.7757128",
"0.7733175",
"0.7701981",
"0.76886094",
"0.76631373",
"0.7638477",
"0.7638123",
"0.7634844",
"0.7634844"... | 0.0 | -1 |
Handle the `!=` operator. | def __ne__(self, other):
if isinstance(other.value, bool):
return Bool(self.value != other.value)
else:
raise self._type_error() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\r\n\t\t\treturn not (self == other) # opposite of eq\r",
"def __ne__(self, other):\n return not self.value != other",
"def __ne__(self,other):\n return not self.__eq__(other)",
"def __ne__(self, value):\n return not self == value",
"def __ne__(self, other):\n ... | [
"0.7701856",
"0.7623848",
"0.7601371",
"0.7599848",
"0.7564839",
"0.7563925",
"0.7552646",
"0.7539964",
"0.7526658",
"0.7526658",
"0.7520586",
"0.7508582",
"0.7498265",
"0.74929726",
"0.74929726",
"0.7492929",
"0.74904346",
"0.74888265",
"0.747111",
"0.747111",
"0.7456733",
... | 0.0 | -1 |
String representation of the class. | def __repr__(self):
return self.__str__() # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Class({})\".format(\", \".join(\"{}={}\".format(k, v) for k, v in self.items()))",
"def to_str (self):\n return str(self.__class__) + \" \" + pprint.pformat(self.to_dict())",
"def __str__(self):\n return \"\\n\".join([str(c) for c in self.get_classes()])",
"... | [
"0.8664411",
"0.8400987",
"0.8357878",
"0.8216963",
"0.81556624",
"0.8145425",
"0.8064506",
"0.7983946",
"0.78919905",
"0.78919905",
"0.78259504",
"0.7794093",
"0.7755964",
"0.7732831",
"0.7701502",
"0.7687556",
"0.7663224",
"0.7637192",
"0.76368475",
"0.7633759",
"0.7633759"... | 0.0 | -1 |
Handle the `!=` operator. | def __ne__(self, other):
return Bool(self.name != other.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\r\n\t\t\treturn not (self == other) # opposite of eq\r",
"def __ne__(self, other):\n return not self.value != other",
"def __ne__(self,other):\n return not self.__eq__(other)",
"def __ne__(self, value):\n return not self == value",
"def __ne__(self, other):\n ... | [
"0.7701856",
"0.7623848",
"0.7601371",
"0.7599848",
"0.7564839",
"0.7563925",
"0.7552646",
"0.7539964",
"0.7526658",
"0.7526658",
"0.7520586",
"0.7508582",
"0.7498265",
"0.74929726",
"0.74929726",
"0.7492929",
"0.74904346",
"0.74888265",
"0.747111",
"0.747111",
"0.7456733",
... | 0.0 | -1 |
String representation of the class. | def __repr__(self):
return self.__str__() # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Class({})\".format(\", \".join(\"{}={}\".format(k, v) for k, v in self.items()))",
"def to_str (self):\n return str(self.__class__) + \" \" + pprint.pformat(self.to_dict())",
"def __str__(self):\n return \"\\n\".join([str(c) for c in self.get_classes()])",
"... | [
"0.8664411",
"0.8400987",
"0.8357878",
"0.8216963",
"0.81556624",
"0.8145425",
"0.8064506",
"0.7983946",
"0.78919905",
"0.78919905",
"0.78259504",
"0.7794093",
"0.7755964",
"0.7732831",
"0.7701502",
"0.7687556",
"0.7663224",
"0.7637192",
"0.76368475",
"0.7633759",
"0.7633759"... | 0.0 | -1 |
Preprocessing image for predicting | def preprocess(path, img_w, img_h):
img = cv.imread(path)
img = fix_size(img, img_w, img_h)
img = np.clip(img, 0, 255)
img = np.uint8(img)
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
img = img.astype(np.float32)
img /= 255
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_preprocessing(image):\n # convert to float to allow for division operation\n image = tf.to_float(image)\n # below is the same as `xception.preprocess_input(image)`\n image /= 127.5\n image -= 1.0\n return image",
"def preprocessing(img):\n img = Image.open(img).convert('L')\n im... | [
"0.78078043",
"0.7612486",
"0.7574316",
"0.7414879",
"0.73404133",
"0.73149526",
"0.7297776",
"0.7293676",
"0.72912574",
"0.7276319",
"0.72754747",
"0.72752446",
"0.7268917",
"0.7239894",
"0.72361696",
"0.7234534",
"0.7231974",
"0.72128314",
"0.72128314",
"0.71545833",
"0.712... | 0.66961455 | 69 |
Convenience function for accessing corner points of polygon. | def get(self):
return self._polygon | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corners(self):\n # needs to handle unbounded cases.\n return (np.asarray(x) for x in itertools.product(*zip(self.bounds.lb, self.bounds.ub)))",
"def corner(self):\n return self._corner",
"def corner(self):\n return self._corner",
"def corners(self):\n from pyresample.sp... | [
"0.6667427",
"0.66438913",
"0.66438913",
"0.6526037",
"0.63651884",
"0.6327743",
"0.62994075",
"0.62920207",
"0.6246003",
"0.62323",
"0.62180716",
"0.6213665",
"0.62067145",
"0.61756283",
"0.6056951",
"0.60396093",
"0.60321784",
"0.59852874",
"0.5983312",
"0.5935123",
"0.5905... | 0.6168291 | 14 |
Get coordinates of corner points in pillow format. Point in pillow is represented as (width, height). This function changes the order of last two points and exchange the order of height and width of each point. | def get_pil_format(self):
corner_points = self._polygon
corner_points = corner_points[:2] + corner_points[2:][::-1]
corner_points = [point[::-1] for point in corner_points]
return corner_points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corner_coords(self):\n x0, y0, width, height = self._rect_bbox\n xc = x0, x0 + width, x0 + width, x0\n yc = y0, y0, y0 + height, y0 + height\n return xc, yc",
"def get_corners_mm(self):\n top_right = np.zeros(2)\n points = np.zeros([3,54],dtype=np.float32)\n\n ... | [
"0.6780179",
"0.65141475",
"0.6398436",
"0.6301926",
"0.6301298",
"0.62991524",
"0.6173839",
"0.6120568",
"0.60363895",
"0.60049456",
"0.5999228",
"0.59972626",
"0.5974626",
"0.5967361",
"0.5943955",
"0.5936121",
"0.5923273",
"0.5923273",
"0.58944917",
"0.5884552",
"0.5874880... | 0.7491817 | 0 |
Check whether two polygons overlap with each other. | def is_overlap(self, polygon):
if not isinstance(quadrilateral, type(self)):
raise TypeError(
'Argument quadrilateral should be instance of {}, which actually '
'has type {}'.format(type(self), type(quadrilateral)))
if not len(self._quadrilateral) or not len(q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polygonsOverlap(poly1, poly2):\r\n try: #do this using try:...except rather than hasattr() for speed\r\n poly1 = poly1.verticesPix #we want to access this only once\r\n except:\r\n pass\r\n try: #do this using try:...except rather than hasattr() for speed\r\n poly2 = poly2.vertice... | [
"0.82617384",
"0.8132133",
"0.78866285",
"0.78100663",
"0.7436477",
"0.74328804",
"0.73808163",
"0.7233143",
"0.72015554",
"0.7148448",
"0.7135949",
"0.7109462",
"0.709686",
"0.709239",
"0.7041544",
"0.7037715",
"0.70056194",
"0.69968396",
"0.6963347",
"0.6956193",
"0.6950255... | 0.0 | -1 |
Compute bounding box of quadrilateral. | def get_bounding_box(self):
if not len(self._quadrilateral):
raise ValueError('The `_quadrilateral` should not be empty list.')
# each point is represented as (height, width)
top_left, top_right, bottom_left, bottom_right = self.get()
y_min = min(top_left[0], top_right[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BoundingBox( self ) :\n \n # loop over corners:\n for i in range(self.n) :\n # first?\n if i == 0 :\n west = self.corners[i].x\n east = self.corners[i].x\n south = self.corners[i].y\n north = self.corners[i... | [
"0.7342538",
"0.7317833",
"0.7079603",
"0.69909537",
"0.6926609",
"0.68476814",
"0.68236107",
"0.68112236",
"0.6766619",
"0.67031753",
"0.6694788",
"0.66766495",
"0.66378355",
"0.6612412",
"0.6566715",
"0.6538027",
"0.6521093",
"0.6478602",
"0.64530206",
"0.6448217",
"0.64407... | 0.75360465 | 0 |
Add a vertical color bar to an image plot. | def add_colorbar(im, aspect=20, pad_fraction=0.5, **kwargs):
from mpl_toolkits import axes_grid1
divider = axes_grid1.make_axes_locatable(im.axes)
width = axes_grid1.axes_size.AxesY(im.axes, aspect=1./aspect)
pad = axes_grid1.axes_size.Fraction(pad_fraction, width)
current_ax = plt.gca()
cax = d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorbar(self):\r\n self.cb = mlab.colorbar(object=self.h,orientation='vertical')",
"def _add_colorbar(fig, ax, vmin, vmax, imshow_defaults, colorbar_defaults):\n\n # Create new axis object for colorbar\n cax = fig.add_axes([0.02, 0.02, 0.96, 0.03])\n\n # Initialise color bar usin... | [
"0.7656203",
"0.71510255",
"0.6888853",
"0.6845556",
"0.68091375",
"0.6745876",
"0.66850567",
"0.66728914",
"0.6606361",
"0.65394825",
"0.65080386",
"0.64956975",
"0.6479089",
"0.6387315",
"0.6288309",
"0.62491",
"0.62032175",
"0.61909014",
"0.6175067",
"0.6154431",
"0.615064... | 0.681995 | 4 |
Encodes a tree to a single string. | def serialize(self, root):
if root is None:
return u'{}'
l = self.serialize(root.left)
r = self.serialize(root.right)
return u'{}{}:[{},{}]{}'.format('{', root.val, l, r, '}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7053364",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69672054",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6640... | 0.6664641 | 21 |
r"""Resolution (number of DOFs) of the component functions. A `ValueError` is raised if the two component functions have different DOFs. | def num(self):
if self.s_fun.N != self.t_fun.N:
raise ValueError("Component functions have different DOFs.")
return self.s_fun.N | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolution(self):\n return int(self.transform[0,0]), int(self.transform[1,1])",
"def resolution(self) -> np.ndarray:\n return self.constants.get(\"resolution\", np.array([4, 4, 40]))",
"def disp_fc(allkindofcomplexity):\n model = dpf.Model(allkindofcomplexity)\n return model.results.dis... | [
"0.5717131",
"0.5449956",
"0.53850067",
"0.5194696",
"0.51379275",
"0.50994736",
"0.5065202",
"0.50407016",
"0.50404143",
"0.50254685",
"0.5019498",
"0.501156",
"0.50076747",
"0.49948964",
"0.49447674",
"0.49388176",
"0.4937932",
"0.4925076",
"0.4923626",
"0.4920723",
"0.4902... | 0.5909586 | 0 |
r"""Reparameterize the curve using a given strategy. | def reparameterize(self, strategy="arc_length", metric=None,
coord_space=False, **kw):
self._check_reparam_args(metric, coord_space)
kw['metric'] = metric
kw['coord_space'] = coord_space
if strategy == "arc_length":
return self.reparameterize_by_arc_len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_params(self, strategy: str = None):\n if strategy is None:\n return\n elif strategy == 'default':\n for lin in self.all_linears:\n lin.reset_parameters()\n else:\n raise NotImplementedError()\n return",
"def adjust_learning_rat... | [
"0.55833554",
"0.5527389",
"0.551221",
"0.5493093",
"0.5489344",
"0.5482421",
"0.5482421",
"0.5480539",
"0.5469941",
"0.54679304",
"0.54679304",
"0.54679304",
"0.54599047",
"0.5438226",
"0.5418502",
"0.5401582",
"0.53911656",
"0.5388211",
"0.53812885",
"0.53645486",
"0.534858... | 0.63557076 | 0 |
Return the password (API token) for a specified user. If the user does not exist, returns None. | def get_password(username):
if username in app_users.keys():
return app_users[username]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUserPassword(self,user):\n if self.userexists(user):\n return self._dict.get(user)\n return None",
"def GetPassword(user):\n s = secrets.GetSecret(_PasswordName(user))\n try:\n return json.loads(s)\n except ValueError:\n # Pre-json format.\n return dict(version=_PASSWO... | [
"0.770518",
"0.7684493",
"0.76564693",
"0.72556806",
"0.7022271",
"0.7022271",
"0.68016493",
"0.6776163",
"0.6712621",
"0.6650891",
"0.6620152",
"0.66103584",
"0.65928525",
"0.65385807",
"0.65385807",
"0.65385807",
"0.65385807",
"0.65385807",
"0.65385807",
"0.65385807",
"0.65... | 0.70804626 | 4 |
Update a specific pastie by ID. Returns an HTTP 404 error if the requested pastie does not exist. Otherwise returns the updated pastie. | def update_pastie(pastie_id):
pastie = get_pastie_by_id(pastie_id)
if pastie is None:
abort(404)
if not request.json:
abort(400)
if 'content' not in request.json:
abort(400)
my_pastie = db.update_pastie(pastie_id, {
"content": request.json.get('content', pastie.conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, id):\n args = self.reqparse.parse_args()\n query = models.Todo.update(**args).where(models.Todo.id == id)\n query.execute()\n return models.Todo.get(models.Todo.id == id), 200",
"def put(self, id):\n\n args = self.reqparse.parse_args()\n query = models.Todo... | [
"0.66559404",
"0.6551693",
"0.6144435",
"0.6144435",
"0.60794204",
"0.5900255",
"0.58527875",
"0.58235836",
"0.58089906",
"0.5776622",
"0.57695097",
"0.5709427",
"0.5708684",
"0.5677105",
"0.5674595",
"0.5665386",
"0.565765",
"0.55990964",
"0.5558508",
"0.5553239",
"0.5497314... | 0.7806541 | 0 |
returns count number of points radii away from center. | def make_circle_targets(center=[0,0], count=8, radii=[1]):
pts = []
for radius in radii:
for angle in np.linspace(0,2*np.pi, count+1):
px,py = radius*np.sin(angle), radius*np.cos(angle)
px += center[0]
py += center[1]
pts.append((px,py))
return pts[1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radius_of_gyration(points):\n N = len(points)\n diff=np.zeros((N**2))\n count=0\n for i in points:\n for j in points:\n diff[count]=np.dot((i - j),(i-j))\n count = count + 1\n return np.sqrt(1/(2*N**2.0) * sum(diff))",
"def numInCircle(r,points): \r\n count =... | [
"0.6857238",
"0.675156",
"0.66990584",
"0.6585399",
"0.65755594",
"0.6525365",
"0.64689887",
"0.64623404",
"0.64227444",
"0.6382616",
"0.63661593",
"0.636543",
"0.6320815",
"0.631092",
"0.62780315",
"0.62741965",
"0.62641627",
"0.62361115",
"0.62361115",
"0.62361115",
"0.6236... | 0.0 | -1 |
Returns beta, or v / c. The arguments should be in compatible units. | def beta(en, mass):
if en < 0.0 or mass < 0.0:
raise ValueError('mass and energy must be positive')
try:
b = (sqrt(en)*sqrt(en + 2*mass)) / (en + mass)
except ZeroDivisionError:
raise ValueError('mass and energy cannot both be zero')
if b > 1.0:
b = 1.0
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beta(vector):\n return mass(vector) / time_component(vector)",
"def B(alpha, beta):\n return math.gamma(alpha)*math.gamma(beta)/math.gamma(alpha + beta)",
"def beta(self, alpha: int, beta: int):\n pass",
"def beta(self):\n return self._scala.beta()",
"def get_beta(self):\n ... | [
"0.70245075",
"0.65786",
"0.6535831",
"0.6507069",
"0.6409742",
"0.63428134",
"0.6338466",
"0.6324675",
"0.6324675",
"0.6267368",
"0.6229849",
"0.6222233",
"0.6210777",
"0.62044996",
"0.6163456",
"0.6160039",
"0.6067134",
"0.6051083",
"0.60236895",
"0.60236895",
"0.60051596",... | 0.6383368 | 5 |
Get QuerySet from cached widget. | def get_queryset(self):
return self.widget.filter_queryset(self.term, self.queryset) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query_set(self):\n return self.model.QuerySet(self.model)",
"def get_queryset(self):\n return self.queryset",
"def get_query_set(self):\n return QuerySet(self.model, using=self._db)",
"def _get_queryset(self):\n return self.model.objects.all()",
"def qs(self):\n r... | [
"0.6795994",
"0.6723343",
"0.6404047",
"0.6370166",
"0.62323296",
"0.6177906",
"0.61467916",
"0.6114738",
"0.61075383",
"0.61075383",
"0.61007273",
"0.6098128",
"0.60863",
"0.60863",
"0.60531914",
"0.60463184",
"0.604317",
"0.6034444",
"0.59446865",
"0.59090126",
"0.58821756"... | 0.6252376 | 4 |
Get and return widget from cache. | def get_widget_or_404(self):
field_id = self.kwargs.get('field_id', self.request.GET.get('field_id', None))
if not field_id:
raise Http404('No "field_id" provided.')
try:
key = signing.loads(field_id)
except BadSignature:
raise Http404('Invalid "field_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cacheme( self ) :\n dofunc = lambda : self\n cachemgr = h.fromconfig( 'cachemgr' )\n cachenm = cachemgr.get_cache( cache_namespace )\n cachenm.remove_value( key=self.cache_key )\n return cachenm.get( key=self.cache_key, createfunc=dofunc )",
"def get_cache():\n return... | [
"0.68247676",
"0.6681154",
"0.65593636",
"0.65180594",
"0.6477215",
"0.63230395",
"0.6319463",
"0.62685406",
"0.62602794",
"0.62481",
"0.62210625",
"0.6169173",
"0.6113237",
"0.61021155",
"0.60951316",
"0.6058217",
"0.6056008",
"0.6047223",
"0.60333914",
"0.6004132",
"0.59998... | 0.6120576 | 12 |
Check given matrix tags to be in the given list of matric tags. | def can_process_matrix(entry, matrix_tags):
if len(matrix_tags) == 0:
return True
count = 0
if 'tags' in entry:
for tag in matrix_tags:
if tag in entry['tags']:
count += 1
return count > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tagsAre(self,tags):\n\t\treturn all([x in self.tags for x in tags])",
"def __check_tags__(m, **kwargs):\n tags = [p.linker for p in m] + [p.rnd_wlk_tag for p in m]\n req_tags = kwargs.get('req_tags', ['head', 'tail', 'mirror', 'head_cap', 'tail_cap'])\n tmp = True\n for tg in req_tags:\n t... | [
"0.6177819",
"0.60127825",
"0.5895962",
"0.5687217",
"0.56374305",
"0.56322014",
"0.5521219",
"0.54744804",
"0.54610217",
"0.53940266",
"0.5336288",
"0.5285151",
"0.5266312",
"0.5263032",
"0.526005",
"0.52423406",
"0.52405256",
"0.52321887",
"0.52110004",
"0.51888925",
"0.518... | 0.74168634 | 0 |
Loads data for the specified city and filters by month and day if applicable. | def f_load_data(city, month, day):
# load data file into a dataframe
df = pd.read_csv(CITY_DATA[city])
# 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['St... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n... | [
"0.83183694",
"0.8226695",
"0.8150808",
"0.80794895",
"0.80427766",
"0.8017983",
"0.8001192",
"0.79902804",
"0.7979157",
"0.797769",
"0.79721206",
"0.7957008",
"0.7955993",
"0.79484135",
"0.7931038",
"0.79188",
"0.7912735",
"0.791154",
"0.790504",
"0.7902931",
"0.79026365",
... | 0.7745533 | 62 |
Displays statistics on the most frequent times of travel. | def f_time_stats(df):
print('\n')
print('-'*70)
print('Calculating The Most Frequent Times of Travel...')
print('-'*70)
start_time = time.time()
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# TO DO: display the most ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ... | [
"0.7973481",
"0.7850757",
"0.77994037",
"0.7781465",
"0.7774358",
"0.7761718",
"0.7752516",
"0.77377707",
"0.7725528",
"0.7717532",
"0.7684718",
"0.76827013",
"0.7680481",
"0.76791",
"0.76493955",
"0.76444066",
"0.76435655",
"0.76422024",
"0.76290774",
"0.7623855",
"0.7623656... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def f_station_stats(df):
print('\n')
print('-'*70)
print('Calculating The Most Popular Stations and Trip...')
print('-'*70)
start_time = time.time()
# TO DO: display most commonly used start station
most_common_start_station = df["Start Station"].mode()[0]
print("Most commonly used [St... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)... | [
"0.7809938",
"0.76727635",
"0.7538624",
"0.74982685",
"0.7490305",
"0.74887866",
"0.7436869",
"0.7429845",
"0.74274427",
"0.7425571",
"0.74126786",
"0.7404592",
"0.7382532",
"0.7379482",
"0.73747545",
"0.7365935",
"0.73561436",
"0.7351966",
"0.7324152",
"0.7304813",
"0.729985... | 0.70826626 | 81 |
Displays statistics on the total and average trip duration. | def f_trip_duration_stats(df):
print('\n')
print('-'*70)
print('Calculating Trip Duration...')
print('-'*70)
start_time = time.time()
# TO DO: display total travel time
print('Total Travel Time (in hours): ', df['Trip Duration'].sum()/60/60)
# TO DO: display mean travel time
prin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ... | [
"0.82698804",
"0.81186754",
"0.80481917",
"0.80468994",
"0.79780424",
"0.7962861",
"0.7959512",
"0.7946294",
"0.7936397",
"0.7929802",
"0.79278564",
"0.79269135",
"0.79246616",
"0.79200053",
"0.79158986",
"0.7915428",
"0.7913144",
"0.79076344",
"0.7903745",
"0.79023826",
"0.7... | 0.7880471 | 23 |
Randomly forget (1'iq')100 percent of the words from the wordfile 'path', write them into the file, and return the file name. | def _make_lexicon(path, iq):
# pseudo-random psudo-unique file name
file_name = "vocab" + str(time.time()) + str(random.random()) + ".txt"
vocab = open(file_name, 'w')
all_words = open(path)
random.seed()
for word in all_words.readlines():
if random.random() < iq:
vocab.writ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def randomwords(self, ctx):\r\n\r\n #Generating random words\r\n with open(folderPath + 'wordlist.txt', 'r', encoding='utf-8') as fullList:\r\n RwordList = fullList.readlines()\r\n\r\n rWords = \"\"\r\n\r\n for i in range(1, 4):\r\n rWords += \" \... | [
"0.6275235",
"0.61069626",
"0.60693276",
"0.604571",
"0.59609973",
"0.5932699",
"0.5924868",
"0.59088373",
"0.59020114",
"0.5892032",
"0.5856757",
"0.58437216",
"0.58437216",
"0.58429205",
"0.5817971",
"0.5805072",
"0.57161313",
"0.56957054",
"0.5690158",
"0.56584895",
"0.561... | 0.66656256 | 0 |
Creates and saves a User with the given email, date of birth and password. | def create_user(self, id, password=None):
if not id:
raise ValueError('Users must have an id ')
user = self.model(
id=id,
)
user.set_password(password)
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,\n is_staff, is_superuser, **extra_fields):\n now = timezone.now()\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email,\n ... | [
"0.81546026",
"0.81305367",
"0.8107395",
"0.8098282",
"0.8083993",
"0.8078478",
"0.8073247",
"0.80615944",
"0.8061434",
"0.8040791",
"0.8031472",
"0.80222136",
"0.80172515",
"0.801283",
"0.80103856",
"0.8008831",
"0.8004529",
"0.7999172",
"0.7992534",
"0.79828453",
"0.7981847... | 0.0 | -1 |
Creates and saves a superuser with the given email, date of birth and password. | def create_superuser(self, id, password):
user = self.create_user(id,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, email, date_of_birth, password):\n user = self.create_user(\n email,\n password=password,\n date_of_birth=date_of_birth,\n\n )\n user.is_admin = True\n user.save(using=self._db)\n return user",
"def create_superuser(se... | [
"0.8193982",
"0.81588477",
"0.8147194",
"0.8047828",
"0.8046815",
"0.80064356",
"0.8006133",
"0.79983854",
"0.79913336",
"0.79751766",
"0.7969442",
"0.7969442",
"0.7969442",
"0.7967593",
"0.7967593",
"0.7967593",
"0.7967593",
"0.7958177",
"0.7944435",
"0.79290116",
"0.7920999... | 0.0 | -1 |
Return the unit of measurement of the sensor, if any. | def native_unit_of_measurement(self) -> str | None:
if self.block is not None:
return self.entity_description.native_unit_of_measurement
if self.restored_data is None:
return None
return self.restored_data.native_unit_of_measurement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return SENSOR_NAMES[self.sensor_name][0]",
"def unit_of_measurement(self):\n return self._sensor[2]",
"def unit_of_measurement(self) -> str | None:\n return self.sensor_value.unit_of_measurement",
"def unit_of_measurement(self) -> str | None:\n ret... | [
"0.90132713",
"0.8930087",
"0.88227415",
"0.8816991",
"0.875823",
"0.86900645",
"0.8635743",
"0.8530596",
"0.8430567",
"0.83511096",
"0.83195645",
"0.82971966",
"0.82971966",
"0.82971966",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.829710... | 0.7755766 | 55 |
Return the unit of measurement of the sensor, if any. | def native_unit_of_measurement(self) -> str | None:
return self.entity_description.native_unit_of_measurement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return SENSOR_NAMES[self.sensor_name][0]",
"def unit_of_measurement(self):\n return self._sensor[2]",
"def unit_of_measurement(self) -> str | None:\n return self.sensor_value.unit_of_measurement",
"def unit_of_measurement(self) -> str | None:\n ret... | [
"0.90132713",
"0.8930087",
"0.88227415",
"0.8816991",
"0.875823",
"0.86900645",
"0.8635743",
"0.8530596",
"0.8430567",
"0.83511096",
"0.83195645",
"0.82971966",
"0.82971966",
"0.82971966",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.8297101",
"0.829710... | 0.7858077 | 53 |
Get the bounding box from coordinates | def _bbox_from_coords(coords: list) -> Optional[BBox]:
try:
xxx, yyy = zip(*coords)
return BBox(west=min(xxx), south=min(yyy), east=max(xxx), north=max(yyy))
except ValueError:
pass
coord_bbox = None
for coord_set in coords:
bbox = _bbox_from_coords(coord_set)
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounding_box(self):\n\n upper_left = Dot(min(self.dots, key=lambda d: d.x).x, min(self.dots, key=lambda d: d.y).y)\n lower_right = Dot(max(self.dots, key=lambda d: d.x).x, max(self.dots, key=lambda d: d.y).y)\n rows = lower_right.y - upper_left.y + 2\n cols = lower_right.x - upper_l... | [
"0.80000234",
"0.7826111",
"0.77721834",
"0.77570415",
"0.773598",
"0.770773",
"0.76879776",
"0.76562744",
"0.7585672",
"0.7581975",
"0.7576298",
"0.75458795",
"0.75022566",
"0.7494537",
"0.7407855",
"0.7403389",
"0.74010617",
"0.74010617",
"0.73699963",
"0.7367306",
"0.73197... | 0.68104535 | 64 |
Return sha256 checksum of file given by path. | def _sha256sum(input_file):
hasher = hashlib.sha256()
with open(input_file, "rb") as file:
for chunk in iter(lambda: file.read(65536), b""):
hasher.update(chunk)
return hasher.hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_checksum(path):\n\n with abort_if_file_changes_during_read(path):\n m = hash_implementation()\n\n with open(path, 'rb') as f:\n for chunk in read_in_chunks(f, io.DEFAULT_BUFFER_SIZE):\n m.update(chunk)\n\n return m.hexdigest()",
"def sha256sum(file_path)... | [
"0.8341639",
"0.8160346",
"0.8007797",
"0.79227144",
"0.78722954",
"0.7860842",
"0.781262",
"0.7765782",
"0.7558004",
"0.75435656",
"0.75006235",
"0.74983567",
"0.74603885",
"0.7450738",
"0.7407467",
"0.73671263",
"0.73354834",
"0.7324653",
"0.7283762",
"0.72813916",
"0.72482... | 0.71976036 | 25 |
Generate multiple permutation replicates. | def draw_perm_reps(data_1, data_2, func, size=1):
# Initialize array of replicates: perm_replicates
perm_replicates = np.empty(size)
for i in range(size):
# Generate permutation sample
perm_sample_1, perm_sample_2 = permutation_sample(data_1, data_2)
# Compute the test statistic
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations():\n return [*range(permutation_count)]",
"def create_permutations(*opts):\n param_list = [x for x in product(*opts)]\n \n return param_list",
"def test04_permute_bijection(variants_all_backends_once):\n for p in range(3):\n sample_count = 2**(p+1)\n for seed in ra... | [
"0.75604016",
"0.70100474",
"0.6898639",
"0.68208355",
"0.68120944",
"0.6778641",
"0.6756075",
"0.66524094",
"0.653629",
"0.65350455",
"0.6361172",
"0.63607186",
"0.6342119",
"0.63299614",
"0.6326187",
"0.63239133",
"0.6311225",
"0.63062304",
"0.62989897",
"0.6289436",
"0.628... | 0.68222004 | 3 |
flips a matrix A[i][j] such that it becomes A[j][i] | def transpose(self):
new_data = [list(i) for i in zip(*self.data)]
assert new_data == numpy.transpose(self.data).tolist()
return new_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse(A):\n## return np.transpose( inverse_transpose(A), (0,2,1))\n return np.swapaxes( inverse_transpose(A), -1,-2)",
"def _transflip(self):\n trans = self.data.transpose(1,0,2,3)\n trans = np.flip(trans, 2)\n self.data = self.data + trans # full data with 2 * diagonal\n ... | [
"0.7265552",
"0.68691033",
"0.6735425",
"0.6675387",
"0.6641952",
"0.6609173",
"0.6551002",
"0.652869",
"0.6509072",
"0.64934933",
"0.64871216",
"0.6480798",
"0.64649725",
"0.6429229",
"0.6417686",
"0.63922423",
"0.63891834",
"0.63867617",
"0.638315",
"0.6372132",
"0.63371384... | 0.0 | -1 |
Checks if a given string is composed of only digits >>> is_digits("123") True >>> is_digits("abc") False >>> is_digits("3434a") False | def is_digits(string: str) -> bool:
output: bool = False
try:
num: int = int(string)
output = True
except ValueError as e:
output = False
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_digits(input_str):\n return any(i in string.digits for i in input_str)\n pass",
"def isDigitString(s):\n\n for char in s:\n if char not in string.digits: return 0\n return 1",
"def isDigit(string):\n return string.isdigit()",
"def hasReNumbers(inputString):\... | [
"0.8237286",
"0.81198686",
"0.7707411",
"0.74934614",
"0.7467888",
"0.7467888",
"0.72130144",
"0.7204821",
"0.7150491",
"0.71460974",
"0.7104709",
"0.7087778",
"0.70766675",
"0.7004114",
"0.69735664",
"0.6757219",
"0.6703114",
"0.66856414",
"0.6660951",
"0.66485023",
"0.66320... | 0.84267753 | 0 |
Creates the evaluation metrics for the model. | def create_eval_metrics(labels, logits, human_labels, params):
eval_metrics = {}
predictions = tf.cast(tf.argmax(logits, axis=1), tf.int32)
in_top_5 = tf.cast(tf.nn.in_top_k(logits, labels, 5), tf.float32)
eval_metrics['top_5_eval_accuracy'] = tf.metrics.mean(in_top_5)
eval_metrics['eval_accuracy'] = tf.metr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate(self): \n\n metrics = []\n\n for i, pred in enumerate(self.predictions): \n\n ac = accuracy_score(self.y_test, pred)\n cm = confusion_matrix(self.y_test, pred)\n \n ## CONDER: ... | [
"0.7037027",
"0.6880567",
"0.65773124",
"0.65349746",
"0.6521905",
"0.6516033",
"0.65000844",
"0.64229184",
"0.6411463",
"0.6400442",
"0.63938355",
"0.6337083",
"0.63330007",
"0.6329775",
"0.6294288",
"0.6279724",
"0.62704414",
"0.62522566",
"0.6242029",
"0.621196",
"0.620430... | 0.6245235 | 18 |
Excludes `None` values from a listlike object. | def compact(lst: List[Any]) -> List[Any]:
return [item for item in lst if item is not None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_None(self, list_like):\n result = filter(lambda v: v[1] is not None, enumerate(list_like))\n result = list(zip(*result))\n return result[1], result[0]",
"def drop_none(tweets):\n return [tweet for tweet in tweets if tweet is not None]",
"def omit_falsy(collection: list):\n ... | [
"0.7498115",
"0.72017395",
"0.6967001",
"0.6873186",
"0.67609936",
"0.6732264",
"0.6661264",
"0.6555774",
"0.6537528",
"0.63792306",
"0.62797725",
"0.6127791",
"0.6124663",
"0.60661685",
"0.6061653",
"0.6043337",
"0.59970886",
"0.59803253",
"0.5978614",
"0.59752333",
"0.58867... | 0.7031157 | 2 |
Converts a bytes value to a string using `utf8`. | def as_text(v: Union[bytes, str]) -> str:
if isinstance(v, bytes):
return v.decode('utf-8')
elif isinstance(v, str):
return v
else:
raise ValueError('Unknown type %r' % type(v)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _utf8str(x):\r\n if six.PY3:\r\n return str(x)\r\n if isinstance(x, six.binary_type):\r\n return x\r\n elif isinstance(x, six.text_type):\r\n return x.encode('utf-8')\r\n else:\r\n return six.binary_type(x)",
"def utf8(s: bytes):\n\n return str(s, 'utf-8')",
"def bytes2str(val):\n if ... | [
"0.8335209",
"0.8283142",
"0.8176277",
"0.8082723",
"0.80183625",
"0.8015175",
"0.7990818",
"0.7973429",
"0.7936941",
"0.7922878",
"0.7905562",
"0.78631616",
"0.7859775",
"0.7832488",
"0.7824389",
"0.77448815",
"0.7702439",
"0.76999927",
"0.7651626",
"0.76146483",
"0.76057965... | 0.6905481 | 58 |
Return now in UTC | def now():
return datetime.datetime.now(datetime.timezone.utc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now():\n return datetime.utcnow().replace(tzinfo=utc)",
"def now():\n return datetime.datetime.utcnow().replace(tzinfo=pytz.utc)",
"def now_in_utc():\n return datetime.datetime.now(tz=pytz.UTC)",
"def now_in_utc():\n return datetime.datetime.now(tz=pytz.UTC)",
"def now():\n return dateti... | [
"0.85849607",
"0.8505958",
"0.85027194",
"0.85027194",
"0.8482621",
"0.8442152",
"0.84296834",
"0.84200954",
"0.834195",
"0.83314055",
"0.831983",
"0.827582",
"0.8264931",
"0.82597804",
"0.8228741",
"0.82276416",
"0.8196422",
"0.8183962",
"0.8154539",
"0.8125391",
"0.8124651"... | 0.83334553 | 9 |
Returns whether the obj is an iterable, but not a string | def is_nonstring_iterable(obj: Any) -> bool:
return isinstance(obj, Iterable) and not isinstance(obj, str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_iter(obj):\n return isinstance(obj, Iterable) and not isinstance(obj, str)",
"def is_iterable(obj):\n return hasattr(obj, '__iter__') and not isinstance(obj, str)",
"def is_iterable(obj):\n return not isinstance(obj, str) and isinstance(obj, collections.Iterable)",
"def is_iterable(obj: Any) ... | [
"0.90405804",
"0.8962892",
"0.8763928",
"0.8744108",
"0.86913866",
"0.8378122",
"0.82830614",
"0.7987596",
"0.79322857",
"0.78579026",
"0.784648",
"0.78049463",
"0.7798739",
"0.7776013",
"0.76821715",
"0.7664612",
"0.75880134",
"0.75225276",
"0.74705225",
"0.7470439",
"0.7426... | 0.9042939 | 0 |
Returns current UTC timestamp | def current_timestamp() -> int:
return calendar.timegm(datetime.datetime.utcnow().utctimetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_utc_time():\n utcnow = datetime.datetime.utcnow()\n return str(utcnow.timestamp())",
"def current_timestamp_utc():\n return int(timegm(gmtime()))",
"def get_current_timestamp(self):\n return datetime.datetime.now(local_timezone).isoformat()",
"def _current_time():\n utc... | [
"0.87158155",
"0.8516935",
"0.84845763",
"0.8440705",
"0.8433801",
"0.8431645",
"0.82900435",
"0.81990075",
"0.8156735",
"0.81422335",
"0.80035967",
"0.79782605",
"0.7954809",
"0.794953",
"0.79181594",
"0.78978497",
"0.78978497",
"0.78820395",
"0.78397757",
"0.78373426",
"0.7... | 0.8009214 | 10 |
Returns strand equivalent volumetric heat capacity array | def calculate_winding_eq_cv(self, magnetic_field, kappa_cv=1):
winding_cv_array = np.zeros((len(self.temperature_profile), 2))
for i in range(len(self.temperature_profile)):
winding_cv_array[i, 0] = self.temperature_profile[i]
winding_cv_array[i, 1] = kappa_cv*self.winding_eq_cv(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volumetric_heat_capacity(self):\n return self.rho * self.cp",
"def heatCapacity(planet, T):\n c = planet.cpCoeff\n return np.polyval(c, T)",
"def specific_heat_capacity(self):\n return self.fluid.specific_heat(self.T_C)",
"def getCellVolume(self):\n if self.crd_sys == 'sph':\n\... | [
"0.6600529",
"0.60486215",
"0.60321563",
"0.55732733",
"0.55419004",
"0.5482855",
"0.5467508",
"0.5453048",
"0.54323566",
"0.5406865",
"0.5370367",
"0.5282235",
"0.52717406",
"0.5227522",
"0.51892716",
"0.5171807",
"0.51712286",
"0.5156232",
"0.5149258",
"0.51110286",
"0.5081... | 0.0 | -1 |
The pred_performance function takes as input a dataframe, list of models and model configurations. It returns the best model based on the evaluation metric specified by the user (default is MAEs), the performance metrics for all models, and predictions for each model. | def pred_performance(dataset:pd.DataFrame,
train_size:float,
forecast_size:int,
window_size:int,
list_models:list,
model_configs:dict=h_parameters,
granularity:str="1d",
eva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_model_performance(self, prediction_column_name='predicted_tokens'):\n df = self.df_intersection_no_dup\n\n df['perfect_prediction'] = \\\n df.apply(\n lambda row: self.perfect_match(row[prediction_column_name], row['function_name_tokens']), axis=1)\n\n df[... | [
"0.66645586",
"0.6565427",
"0.6350212",
"0.6333106",
"0.60597503",
"0.6039978",
"0.6039868",
"0.60274297",
"0.59986055",
"0.59968126",
"0.5990123",
"0.59667546",
"0.5956971",
"0.5940681",
"0.59284866",
"0.59283847",
"0.59094",
"0.5902458",
"0.5889197",
"0.585352",
"0.5851278"... | 0.7891035 | 0 |
Checks that the component is run on GNU/Linux platform. | def check_platform():
if not sys.platform.startswith('linux'):
print(Fore.RED + "✖ This component must be run on GNU/Linux platform (e.g. Raspbian)." + Fore.RESET)
sys.exit(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_linux():\n return guess_os() == 'linux'",
"def islinux():\n return sys.platform.startswith('linux')",
"def is_linux():\n return sys.platform.startswith('linux')",
"def is_linux_check():\n if sys.platform == \"linux\" or sys.platform == \"linux2\":\n return\n else:\n raise ... | [
"0.75916016",
"0.73235583",
"0.73220754",
"0.7311977",
"0.73064893",
"0.7089117",
"0.69979393",
"0.6919575",
"0.66340154",
"0.65674156",
"0.6545529",
"0.64106005",
"0.6370676",
"0.6364413",
"0.63587236",
"0.6291787",
"0.6196176",
"0.61305773",
"0.6077975",
"0.6027347",
"0.602... | 0.8402619 | 0 |
get_in_active_affiliates returns a list of affiliates who are not active but not deleted | def get_in_active_affiliates(self, organization_id: Optional[str]) -> tuple:
if not isinstance(organization_id, str) or not bool(organization_id.strip()):
message: str = 'organization_id is required'
raise InputError(status=error_codes.input_error_code, description=message)
affi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliates(self):\n return (\n self.filter(pu_status__in=(\"fac\", \"stf\"))\n .filter(membership__role__title__in=self.affiliate_roles)\n .exclude(cdh_staff=True)\n )",
"def active_accounts(self):\n # TODO: Figure out what accounts are active based on me... | [
"0.70784736",
"0.6076734",
"0.5758316",
"0.5657016",
"0.56297946",
"0.5628461",
"0.55983037",
"0.5562739",
"0.55461365",
"0.55461365",
"0.55461365",
"0.55461365",
"0.55461365",
"0.55324036",
"0.5506504",
"0.5478152",
"0.5415469",
"0.54088527",
"0.54088527",
"0.54088527",
"0.5... | 0.68731976 | 1 |
Transform 2D arrays in multiple 1D arrays, converting types to fit json as needed. | def _linearize(name, value):
data = {}
if isinstance(value['values'], list):
data[name] = {
'target': value['target'],
'values': _typetransform(value['values']),
}
elif isinstance(value['values'], np.ndarray):
if len(value['values'].shape) == 1:
da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _typetransform(data):\n assert isinstance(data, list) and len(data) > 0\n if isinstance(data[0], str):\n return list(map(str, data))\n elif isinstance(data[0], bytes):\n return list(map(lambda u: u.decode('utf8'), data))\n else:\n try:\n if isinstance(data[0], float)... | [
"0.5985927",
"0.5944559",
"0.5928875",
"0.5856941",
"0.58262956",
"0.5754963",
"0.5670898",
"0.5658269",
"0.56496143",
"0.5636371",
"0.56346005",
"0.56334823",
"0.56282526",
"0.561937",
"0.55660254",
"0.554631",
"0.55341315",
"0.5530364",
"0.5529927",
"0.5519439",
"0.5497123"... | 0.0 | -1 |
Generates an ASCIIonly slug. | def slugify(string, delim=u'-'):
result = []
for word in _punct_re.split(string.lower()):
result.extend(unidecode(word).split())
return unidecode(delim.join(result)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_slug(text, delim=u'-'):\n from zine.application import get_application\n if get_application().cfg['ascii_slugs']:\n return gen_ascii_slug(text, delim)\n return gen_unicode_slug(text, delim)",
"def generate_slug(text: str, size: int) -> str:\n hash_num = int(hashlib.md5(text.encode('utf... | [
"0.7973561",
"0.7442021",
"0.7282818",
"0.72087806",
"0.71897197",
"0.7074797",
"0.7033865",
"0.69367236",
"0.6756441",
"0.6664828",
"0.6653687",
"0.6574536",
"0.64412993",
"0.6436358",
"0.6431438",
"0.64281917",
"0.6388676",
"0.636634",
"0.6347826",
"0.6336249",
"0.63338536"... | 0.0 | -1 |
resolution Desired resolution of the project stream | def __init__(self, resolution):
# Initialize the base class, so that the object can run on its own
# thread.
super(LocalDisplay, self).__init__()
# List of valid resolutions
RESOLUTION = {'1080p' : (1920, 1080), '720p' : (1280, 720), '480p' : (858, 480)}
if resolution not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resolution(self):\n return self.resolution",
"def resolution(self):\n return self.get_resolution()",
"def getResolution(self):\n return self._api.getResolution()",
"def Resolution(self):\n\t\treturn self._get_attribute('resolution')",
"def resolution(self):\n return self... | [
"0.72809064",
"0.7262724",
"0.7106838",
"0.68947667",
"0.6755359",
"0.6731471",
"0.6709349",
"0.67072207",
"0.66703814",
"0.6597748",
"0.65237224",
"0.6520767",
"0.6483268",
"0.6446",
"0.6427852",
"0.64259344",
"0.64017695",
"0.63706875",
"0.6348677",
"0.63389736",
"0.6324069... | 0.5249326 | 73 |
additive attention(support batch of input with sequences) | def attention_additive_batch(self,input_sequences_original, attention_level,reuse_flag=False): #TODO check: paper 'Neural Machine Transation By Jointly Learning To Align and Translate'
# [batch_size,seq_length,num_units*2].
input_sequences=tf.transpose(input_sequences_original,perm=[0,2,1]) #[batch_siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention_additive_batch(input_sequences, attention_level,reuse_flag=False): #TODO check: paper 'Neural Machine Transation By Jointly Learning To Align and Translate'\n # [batch_size,seq_length,num_units*2].\n input_sequences=tf.transpose(input_sequences,perm=[0,2,1]) #[batch_size,num_units,sequence_len... | [
"0.7187216",
"0.7141438",
"0.68417794",
"0.6794085",
"0.6741095",
"0.6715665",
"0.66956043",
"0.6684378",
"0.6606589",
"0.659783",
"0.6509925",
"0.64522296",
"0.64522296",
"0.64490604",
"0.64011276",
"0.63700736",
"0.6347369",
"0.6293072",
"0.62845266",
"0.62784034",
"0.62722... | 0.7379437 | 0 |
additive attention(support batch of input with sequences) | def attention_additive_batch(input_sequences, attention_level,reuse_flag=False): #TODO check: paper 'Neural Machine Transation By Jointly Learning To Align and Translate'
# [batch_size,seq_length,num_units*2].
input_sequences=tf.transpose(input_sequences,perm=[0,2,1]) #[batch_size,num_units,sequence_length]<--... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention_additive_batch(self,input_sequences_original, attention_level,reuse_flag=False): #TODO check: paper 'Neural Machine Transation By Jointly Learning To Align and Translate'\n # [batch_size,seq_length,num_units*2].\n input_sequences=tf.transpose(input_sequences_original,perm=[0,2,1]) #[ba... | [
"0.73801947",
"0.7141411",
"0.68424416",
"0.6793413",
"0.6741415",
"0.6715562",
"0.66952926",
"0.6685178",
"0.66062814",
"0.65994996",
"0.65082985",
"0.6452141",
"0.6452141",
"0.6448875",
"0.64019144",
"0.6369737",
"0.63479877",
"0.6291988",
"0.62857157",
"0.6278803",
"0.6272... | 0.71881956 | 1 |
Get the document representations with masked sentences. | def get_doc_rep_with_masked_sent(input_sent_reps_doc,
sent_mask_embedding,
input_mask_doc_level,
batch_size_static=32,
max_masked_sent_per_doc=2,
loop_sent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_representations(self):\n return self._text_representations",
"def to_sentences(doc):\n return doc.strip().split('\\n')",
"def sentences(doc):\n return [s.strip() for s in doc.split('. ')]",
"def preprocess_documents(document):\n s = re.sub(\"[\\(\\[].*?[\\)\\]]\", \"\", document)\n ... | [
"0.58618224",
"0.57888454",
"0.5710944",
"0.5698123",
"0.5687745",
"0.5581933",
"0.55803275",
"0.5551297",
"0.55146545",
"0.5503855",
"0.54692715",
"0.5369777",
"0.52883875",
"0.52862877",
"0.52625024",
"0.52607304",
"0.5243463",
"0.5237123",
"0.5237123",
"0.52267414",
"0.521... | 0.5209051 | 22 |
Normalise all probabilities in a settings dictionary to sum to one, of possible | def normalise_probabilities(settings_dict: dict):
c_cols = settings_dict["comparison_columns"]
for col_settings in c_cols:
for p in ["m_probabilities", "u_probabilities"]:
if p in col_settings:
if None not in col_settings[p]:
if sum(col_settings[p]) != 0:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(probabilities):\n for person in probabilities:\n for distribution in [\"gene\", \"trait\"]:\n prob_sum = reduce(lambda x, y: x + y, list(probabilities[person][distribution].values()))\n for prob_key in probabilities[person][distribution]:\n probabilities... | [
"0.73776996",
"0.7332111",
"0.7149009",
"0.7146819",
"0.7119856",
"0.69257075",
"0.66500664",
"0.6648489",
"0.6434504",
"0.6417131",
"0.6287637",
"0.62341934",
"0.6220002",
"0.62006223",
"0.6123027",
"0.60480654",
"0.6040038",
"0.599509",
"0.5950125",
"0.58690435",
"0.5848065... | 0.7573561 | 0 |
Randomly choose K points from the array x of ndimensional points | def choosestartingpoint(x, K):
npoints = x.shape[0]
i = np.random.choice(npoints, K, replace=False)
return x[i, :] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def K_points(X, K):\r\n m = len(X)\r\n return X[np.random.choice(m, K, replace=False), :]",
"def forgy(K, X):\n N = X.shape[0]\n return X[np.random.choice(range(N), size=K)]",
"def generate_k(data_set, k):\n return random.sample(data_set, k)",
"def generate_k(data_set, k):\n return random.s... | [
"0.81444454",
"0.76441574",
"0.73444766",
"0.7207246",
"0.69073236",
"0.6855578",
"0.68125826",
"0.6812427",
"0.6720044",
"0.6713823",
"0.67135686",
"0.66996807",
"0.66793364",
"0.6666828",
"0.66333103",
"0.6627855",
"0.6585926",
"0.6555069",
"0.65537643",
"0.65499455",
"0.65... | 0.79040414 | 1 |
To test if an endpoint that already returns a response work. Positive test case, should work just fine. | def _view_function_response() -> Response:
return Response(dumps({"message": "This is a JSON."}),
status=200, content_type='application/json') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_already_response() -> None:\n actual = _view_function_response()\n expected = Response(dumps({\"message\": \"This is a JSON.\"}),\n status=200, content_type='application/json')\n assert actual.response == expected.response\n assert actual.status_code == expected.status_code\... | [
"0.743354",
"0.68946636",
"0.68347883",
"0.68247664",
"0.6821929",
"0.67664236",
"0.67349434",
"0.65470135",
"0.65043485",
"0.64042103",
"0.6368293",
"0.63588244",
"0.635216",
"0.6349492",
"0.6349369",
"0.6349369",
"0.63391423",
"0.6334647",
"0.6332344",
"0.6327871",
"0.63219... | 0.0 | -1 |
To test if an endpoint that already returns a malformed response work. Negative test case, should raise an error that will result in a 500. | def _view_function_response_failure() -> Response:
return Response("This is obviously not JSON.", content_type='plain/text',
status=200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_endpoint(client):\n\n result = client.get('/nonsense')\n assert result.status_code == 404",
"def test_unexpected_exception(self):\n response = handler(ValueError('unexpected'), {})\n self.assertIsNone(response)",
"def test_unexpected_response(requests_mock_get, invalid_resp... | [
"0.74245024",
"0.7284641",
"0.728005",
"0.72736347",
"0.722546",
"0.72182316",
"0.7205578",
"0.70802367",
"0.7074367",
"0.70460224",
"0.7043172",
"0.69928026",
"0.6981735",
"0.6978784",
"0.6937911",
"0.6925545",
"0.69250435",
"0.6919555",
"0.6908926",
"0.6892744",
"0.68720704... | 0.0 | -1 |
To test if an endpoint that cannot be converted into a JSON raises a TypeException. | def _view_function_tuple_failure() -> tuple[Callable, int]:
return lambda x: 1, 20 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_json_response() -> None:\n with raises(TypeError):\n _view_function_response_failure()",
"def test_exceptions(self):\n exc = ValueError(\"Expected some cheese.\")\n resp = self.app._mangle_response(Request(_env()), exc)\n body = json.loads(resp.body)\n self.asse... | [
"0.7319141",
"0.70991576",
"0.6949278",
"0.68701917",
"0.6807536",
"0.6804276",
"0.6767018",
"0.6761073",
"0.6639135",
"0.65870196",
"0.65418243",
"0.65332264",
"0.6431282",
"0.6431186",
"0.6416538",
"0.64090854",
"0.6406446",
"0.63888735",
"0.63663924",
"0.63338554",
"0.6330... | 0.0 | -1 |
To test if an endpoint that returns too many values raises a TypeException. | def _view_function_tuple_pack() -> tuple[dict, int, int]:
return {"msg": "This is a JSON."}, 200, 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_too_many_values(self):\n code = 'a, b, c = [1, 2, 3, 4]'\n before, after = before_and_after((3, 0))\n self.throws(code, EXPECTEDLENGTH, [], before, 'pypy')\n self.throws(code, TOOMANYVALUES, [], after, 'pypy')\n self.throws(code, TOOMANYVALUES, interpreters='cpython')",
... | [
"0.6102719",
"0.59274983",
"0.5867248",
"0.58176184",
"0.5806893",
"0.578805",
"0.5754623",
"0.5748741",
"0.57231206",
"0.5722201",
"0.57171607",
"0.5715539",
"0.569584",
"0.5683563",
"0.5680533",
"0.5646818",
"0.5641143",
"0.5629454",
"0.5603263",
"0.5592382",
"0.55694103",
... | 0.0 | -1 |
Return True if this Emoji is usable. | def is_usable(self) -> bool:
return self.public or (
self.public is None and Config.system.emoji_unreviewed_are_public
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_eoud(self):\n try:\n dif = self.parts[0]\n if dif in [0x0F, 0x1F]:\n return True\n except IndexError:\n pass\n\n return False",
"def is_valid(self):\n\n if not self.character_data:\n log.warning(\"Couldn't save animatio... | [
"0.6688632",
"0.65069",
"0.64675903",
"0.63745093",
"0.6309345",
"0.6279806",
"0.62605935",
"0.62392217",
"0.6215556",
"0.61221385",
"0.6042579",
"0.6040351",
"0.6033304",
"0.60230315",
"0.5993027",
"0.59719217",
"0.59620947",
"0.5938546",
"0.59211445",
"0.5911766",
"0.589388... | 0.67662865 | 0 |
Set meta data for calculating values of an axis. This provides the meta data required to calculate one of the axes. This data is stored in the `info` attribute, which is carried around by this class and easily written to disk. The information provided is subsequently used in `get_axis` to calculate the values along a g... | def set_axis_info(self, axis_name, centre, delta) :
if not axis_name in self.axes :
raise ValueError("axis_name not in self.axes.")
self.info[axis_name + '_centre'] = float(centre)
self.info[axis_name + '_delta'] = float(delta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMeta(self, axis, **args):\n self.meta[axis].update(args)\n self.stimParams.setMeta(axis, self.meta[axis])",
"def add_meta(self) -> None:\n for key in (\"latitude\", \"longitude\", \"altitude\"):\n self.append_data(np.array(self.getvar(key)), key)\n for key in (\"time... | [
"0.7338227",
"0.6548571",
"0.5941534",
"0.5937316",
"0.59338754",
"0.57650954",
"0.5675522",
"0.56436616",
"0.56186914",
"0.56003994",
"0.54211545",
"0.5402196",
"0.53968513",
"0.5386379",
"0.53820896",
"0.53467214",
"0.53217083",
"0.5271737",
"0.5270816",
"0.52614963",
"0.52... | 0.65423065 | 2 |
Get the shape of the represented matrix (vector). | def mat_shape(self) :
_check_axis_names(self)
return (self.size,) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_shape(self):\n if self.data_type == \"scalar\":\n return self.data.shape\n elif self.data_type == \"vector\":\n return self.data.shape[:-1]\n elif self.data_type == \"matrix\":\n return self.data.shape[:-2]",
"def np_shape(matrix):\n return matrix... | [
"0.7707259",
"0.7671984",
"0.7660086",
"0.7644631",
"0.7502996",
"0.7402327",
"0.7156754",
"0.71042925",
"0.7073091",
"0.70133954",
"0.6961552",
"0.69170994",
"0.69163275",
"0.6915886",
"0.6892477",
"0.6888944",
"0.68852705",
"0.6875365",
"0.6860395",
"0.6840414",
"0.6835167"... | 0.7433266 | 5 |
Return the shape of the array only including axes that correspond to rows. | def row_shape(self) :
shape = ()
for axis_ind in self.rows :
shape = shape + (self.shape[axis_ind],)
return shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.raw.shape[:self.ndim]",
"def np_shape(matrix):\n return matrix.shape",
"def shape(self):\n dims = list(self._shape)\n if dims == [0]:\n dims = []\n return dims",
"def shape(self):\n return np.shape(self.data)",
"def np_shape(ma... | [
"0.7506456",
"0.70101297",
"0.69922477",
"0.69815993",
"0.6972141",
"0.69589686",
"0.69473636",
"0.69465065",
"0.6923427",
"0.6897274",
"0.6890396",
"0.6831977",
"0.68107545",
"0.680346",
"0.6797493",
"0.6783274",
"0.67602146",
"0.67523926",
"0.6747571",
"0.6738231",
"0.67378... | 0.7202762 | 1 |
Return the shape of the array only including axes that correspond to rows. | def col_shape(self) :
shape = ()
for axis_ind in self.cols :
shape = shape + (self.shape[axis_ind],)
return shape | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self.raw.shape[:self.ndim]",
"def row_shape(self) :\n\n shape = ()\n for axis_ind in self.rows :\n shape = shape + (self.shape[axis_ind],)\n\n return shape",
"def np_shape(matrix):\n return matrix.shape",
"def shape(self):\n dims = li... | [
"0.7506456",
"0.7202762",
"0.70101297",
"0.69922477",
"0.69815993",
"0.6972141",
"0.69589686",
"0.69473636",
"0.69465065",
"0.6923427",
"0.6897274",
"0.6890396",
"0.6831977",
"0.68107545",
"0.680346",
"0.6797493",
"0.6783274",
"0.67602146",
"0.67523926",
"0.6747571",
"0.67382... | 0.67288 | 22 |
Get the shape of the represented matrix. | def mat_shape(self) :
self.check_rows_cols()
_check_axis_names(self)
nrows = 1
for axis in self.rows :
nrows *= self.shape[axis]
ncols = 1
for axis in self.cols :
ncols *= self.shape[axis]
return (nrows, ncols) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return (len(self.matrix), len(self.matrix[0]))",
"def np_shape(matrix):\n return matrix.shape",
"def np_shape(matrix):\n return (matrix.shape)",
"def mat_shape(self) :\n _check_axis_names(self)\n return (self.size,)",
"def _get_shape(self):\n if self.dat... | [
"0.7980609",
"0.7823063",
"0.78055435",
"0.779388",
"0.7768845",
"0.7695534",
"0.7668824",
"0.76391274",
"0.74374664",
"0.7393038",
"0.73881274",
"0.73409474",
"0.72666067",
"0.72557837",
"0.72057",
"0.7195149",
"0.719392",
"0.719392",
"0.71666175",
"0.7148063",
"0.7146607",
... | 0.7313328 | 12 |
Returns an iterator over the blocks of a matrix. | def iter_blocks(self) :
# Build the iterator class.
class iterator(object) :
def __init__(self, arr) :
self.arr = arr
self.n_blocks, self.block_shape, self.n_axes_diag = \
arr.get_num_blocks(True, True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n yield from self.matrix",
"def __iter__(self):\n for y, row in enumerate(self._matrix):\n for x, cell in enumerate(row):\n yield (Point(x, y), cell)",
"def to_local_iterator(self) -> Generator:\n for b in self._blocks:\n block = ray... | [
"0.67110455",
"0.65673333",
"0.6548427",
"0.64127403",
"0.6371366",
"0.6199289",
"0.61668676",
"0.6136351",
"0.61133575",
"0.6045612",
"0.60232264",
"0.6005082",
"0.59620017",
"0.59086996",
"0.5890916",
"0.5878311",
"0.580291",
"0.5768532",
"0.57642174",
"0.5721521",
"0.57152... | 0.78449243 | 0 |
Internal class factory for making a matrix class that inherits from either info_array or info_memmap. | def _mat_class_factory(base_class) :
if (not base_class is info_array) and (not base_class is info_memmap) :
raise TypeError("Matrices inherit from info arrays or info memmaps.")
class mat_class(mat, base_class) :
__doc__ = mat.__doc__
info_base = base_class
return mat_class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n\n self.__safe_for_unpickling__ = True\n\n # Override kwargs if args are specified. This makes it easier\n # to use and increases functionality (e.g. pickling)\n if len(args) == 1:\n kwargs[\"rows\"] = args[0]\n elif len(args) == 2... | [
"0.6343013",
"0.6329391",
"0.6281753",
"0.62639266",
"0.62617296",
"0.6132992",
"0.6077905",
"0.6057163",
"0.59919536",
"0.5963386",
"0.5836571",
"0.57754415",
"0.5755529",
"0.5752755",
"0.57310927",
"0.5699866",
"0.5643001",
"0.56407875",
"0.55793977",
"0.55065286",
"0.54994... | 0.83445704 | 0 |
Create a new algebra object with uninitialized data but otherwise the same as the passed object. | def empty_like(obj) :
out = sp.empty_like(obj)
return as_alg_like(out, obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(self, Algebra, data, evaluate=True):\n return Algebra(self, data)",
"def zero(self):\r\n return AdemElement({}, algebra=self)",
"def _construct_obj(self):\n if self.obj_id:\n self._construct_obj_from_id()\n elif self._raw_data:\n self._construct_obj_fro... | [
"0.64070535",
"0.58626765",
"0.5687026",
"0.5602056",
"0.55634433",
"0.54469186",
"0.53878653",
"0.52961576",
"0.5255155",
"0.5247843",
"0.5222835",
"0.51943445",
"0.51864076",
"0.5174488",
"0.5159694",
"0.51539105",
"0.51476556",
"0.51315725",
"0.5131236",
"0.5131236",
"0.51... | 0.5717426 | 2 |
if the deck size + discard pile is less than 4, then this returns false because there aren't enough trains in supply (they need to be spent) | def has_grabbable_train_pile(self):
return len(self.trains) + len(self.discarded_trains) > 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_enough_cards(self):\n enough = len(self.deck.full_deck) > 6\n\n return enough",
"def free_hand(hand):\n return len(hand) < 3",
"def isFlush(self):\n cards = self.tableBothCards('suit')\n for card in cards.values():\n if card >= 5:\n return True\n... | [
"0.72074974",
"0.6906888",
"0.6728482",
"0.64936656",
"0.64865357",
"0.6451339",
"0.6433376",
"0.6368982",
"0.6344939",
"0.62988263",
"0.6268734",
"0.62443286",
"0.62435144",
"0.62108564",
"0.6205341",
"0.61619526",
"0.61466867",
"0.61292416",
"0.61268646",
"0.6124524",
"0.61... | 0.63841224 | 7 |
Configures ad landing page. | def _process_landing_page(self, item, feed_item):
if feed_item.get(FieldMap.AD_LANDING_PAGE_ID, ''):
landing_page = self._landing_page_dao.get(feed_item, required=True)
item['clickThroughUrl'] = {'landingPageId': landing_page['id']}
if feed_item.get(FieldMap.AD_URL_SUFFIX, ''):
item['clickTh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_landing(request):\r\n # Open home page\r\n browser = current_browser()\r\n url = request.config.getoption(\"--landing_url\")\r\n base = LogBase(browser)\r\n click = LogClickBase(browser)\r\n locate = LogLocateBase(browser)\r\n\r\n base.open_home_page(url)\r\n\r\n # Open landing pa... | [
"0.6412072",
"0.6192551",
"0.6176114",
"0.60726035",
"0.59365284",
"0.590933",
"0.57519543",
"0.57096076",
"0.5644791",
"0.55762845",
"0.5402102",
"0.5399599",
"0.53841394",
"0.5296642",
"0.52930254",
"0.52588964",
"0.52575505",
"0.52482903",
"0.524015",
"0.52179253",
"0.5199... | 0.5205138 | 20 |
Calculate the crosscorrelation for the `ingested data`. Use `target` timeseries column as target; the correlation is computed against all lags of all the other columns which include numbers. NaN values, introduced by the various shifts, are replaced with 0. | def calc_xcorr(target: str, ingested_data: DataFrame, max_lags: int, modes: [str] = ["pearson"]) -> dict:
def df_shifted(df, _target=None, lag=0):
if not lag and not _target:
return df
new = {}
for c in df.columns:
if c == _target:
new[c] = df[_target... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def df_rolling_autocorr(df, window, lag=1):\n\n return (df.rolling(window=window)\n .corr(df.shift(lag))) # could .dropna() here",
"def auto_correlation(arr):\n return cross_correlation(arr, arr)",
"def calculate_target_correlations(df, target):\n # Calculate pearson correlation of all numerica... | [
"0.6359501",
"0.604051",
"0.5993268",
"0.5982914",
"0.5963527",
"0.5944235",
"0.5919121",
"0.5919121",
"0.5919121",
"0.583052",
"0.5794837",
"0.57946455",
"0.5792434",
"0.5789819",
"0.57508796",
"0.5697172",
"0.5660978",
"0.5631716",
"0.5617492",
"0.5604975",
"0.5590574",
"... | 0.70147115 | 0 |
Masks out all values in the given batch of matrices where i <= j holds, i < j if mask_diagonal is false In place operation | def mask_(matrices, maskval=0.0, mask_diagonal=True):
b, h, w = matrices.size()
indices = torch.triu_indices(h, w, offset=0 if mask_diagonal else 1, dtype=torch.long)
matrices[:, indices[0], indices[1]] = maskval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask_(matrices, maskval=0.0, mask_diagonal=True):\n b, h, w = matrices.size()\n\n indices = torch.triu_indices(h, w, offset=0 if mask_diagonal else 1)\n matrices[:, indices[0], indices[1]] = maskval",
"def mask_index(mat, index):\n\n n = len(mat)\n\n for i in range(n):\n mat[index, i] =... | [
"0.7464805",
"0.6197604",
"0.59210604",
"0.58296543",
"0.5820173",
"0.580211",
"0.57585204",
"0.56908214",
"0.5643033",
"0.56037277",
"0.5556539",
"0.5487585",
"0.54866636",
"0.54563034",
"0.5433715",
"0.54025066",
"0.5362733",
"0.53282285",
"0.5325957",
"0.5325957",
"0.53190... | 0.73911583 | 1 |
Sets the locale. Parameter must be in the format accepted by locale.setlocale(). | def setLocale(self, loc):
locale.setlocale(locale.LC_ALL, loc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setlocale(*args, **kwargs): # real signature unknown\n pass",
"def setLocale(self, value):\n return self._set(locale=value)",
"def locale(self, locale):\n\n self._locale = locale",
"def setLocale():\n import locale\n #zh_locale = 'zh_CN.UTF-8'\n zh_locale = 'en_US.UTF-8'\n tr... | [
"0.80254114",
"0.77916723",
"0.76863056",
"0.7559336",
"0.7552957",
"0.69009984",
"0.6576471",
"0.6547794",
"0.63801557",
"0.63801557",
"0.62874126",
"0.6071019",
"0.60179436",
"0.5997422",
"0.59630656",
"0.58908385",
"0.5833064",
"0.5751926",
"0.5736246",
"0.57357705",
"0.57... | 0.79652476 | 1 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
stuff = fetch.fetch.fetch_popular_toprated()
popShowName = stuff[0]
popShowID = stuff[1]
popShowPoster = stuff[2]
return render(
request,
'app/index.html',
{
'title':'Home Page',
'y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\treturn render_template('home.html')",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )",
"def home():\r\n return render_template('home.html')",
"def home():\r\n return render_template(\"home.html\")",
"def home():\n\n return render_t... | [
"0.8605755",
"0.8495015",
"0.8452865",
"0.84418297",
"0.83532524",
"0.83532524",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
... | 0.0 | -1 |
Renders the contact page. | def contact(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/contact.html',
{
'title':'Contact',
'message':'Your contact page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template(\"contact.html\")",
"def contact():\n return render_template(\"home/contact.html\")",
"def contact():\r\n return render_template(\r\n 'contact.html',\r\n title='Contact',\r\n year=datetime.now().year,\r\n message='Your contact page.'\... | [
"0.8325958",
"0.82439756",
"0.8212342",
"0.8212342",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8185291",
"0.8172992",
"0.8172992",
"0.8051458",
"0.8005288",
... | 0.7544549 | 41 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'title':'About',
'message':'Welcome to Django TV Project',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"... | 0.0 | -1 |
Renders the about page. | def episode_Show_Details(request, episode_num):
assert isinstance(request, HttpRequest)
stuff,guestDetails,epImagesDetails = fetch.fetch.getEpisodeDetails(episode_num)
ep_Name = stuff[0]
ep_Overview = stuff[1]
ep_Poster = stuff[2]
guestNames = guestDetails[0]
guestPosters = guestDe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"... | 0.0 | -1 |
Given a matrix, returned symmetrized matrix. If matrix is a non empty matrix, then matrix[i][j] == matrix[j][i] | def symmetrization(matrix):
if matrix and len(matrix) < 2:
return matrix
n_row = len(matrix)
n_col = len(matrix[0])
if n_row != n_col:
return matrix
for row in range(0, n_row):
col = row
while col < n_col:
local_max = max(matrix[row][col], matrix[col][r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_2d_symmetric(mat):\n if is_ndarray(mat):\n if mat.ndim != 2:\n return False\n if mat.shape[0] != mat.shape[1]:\n return False\n else:\n return np.allclose(mat, mat.T)\n else:\n raise NotImplementedError(\"is_symmetric only implemented for nu... | [
"0.7295466",
"0.6545695",
"0.6439652",
"0.628279",
"0.62814635",
"0.61779225",
"0.6137827",
"0.611263",
"0.60954034",
"0.6061733",
"0.6038091",
"0.60380185",
"0.60147274",
"0.59871954",
"0.59777904",
"0.59042704",
"0.58851075",
"0.58636403",
"0.58586574",
"0.584642",
"0.58454... | 0.7919603 | 0 |
Check that response can be safely converted to json according to the expected from SD. If no json object can be obtained an exception is raised | def parse_json_from_sd(self, response):
if response.status_code == codes.no_content: # @UndefinedVariable
return None
try:
resp_json = response.json() # SD always respond with json
except ValueError:
raise SdAdminLibraryException() # default error message i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_response(self, response):\n\n status = response.status_code\n\n if status == 204:\n return\n elif status == 401 or status == 403:\n raise APIException(response)\n elif status == 404:\n json = response.json()\n raise ResourceNotFoundE... | [
"0.75363505",
"0.69467616",
"0.6897934",
"0.68896186",
"0.6852897",
"0.6825073",
"0.66703504",
"0.666766",
"0.6662906",
"0.6639531",
"0.6622467",
"0.6603331",
"0.6580275",
"0.6559187",
"0.6541632",
"0.65197265",
"0.6516293",
"0.65102255",
"0.6456089",
"0.64474773",
"0.6423002... | 0.65748054 | 13 |
HTTP POST to service directory Send a HTTP POST request to the service directory. The request will include an empty body or a JSON body. This method may transform the body parameter into a JSON string when a dictionary is passed. The JSON response is parsed and returned as a dictionary. | def post(self, path, body=None, headers=None):
return self._request('POST', path, headers=headers, data=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n\n _dict = self.unpack_post()\n return self.operation(_dict, BINDING_HTTP_POST)",
"def post(self):\n\n _dict = self.unpack_post()\n return self.operation(_dict, BINDING_HTTP_POST)",
"def do_POST(self):\n response, code = {}, OK\n context = {\"request_i... | [
"0.68151677",
"0.68151677",
"0.68114656",
"0.6454214",
"0.6417694",
"0.63758093",
"0.63758093",
"0.6351816",
"0.63489413",
"0.6340347",
"0.62588406",
"0.62483793",
"0.6220095",
"0.6176348",
"0.6171408",
"0.61514014",
"0.61367774",
"0.6133635",
"0.6120794",
"0.61203873",
"0.60... | 0.6130251 | 18 |
HTTP PUT to service directory Send a HTTP PUT request to the service directory. The request will include an empty body or a JSON body. This method may transform the body parameter into a JSON string when a dictionary is passed. The JSON response is parsed and returned as a dictionary. | def put(self, path, body=None, headers=None):
return self._request('PUT', path, headers=headers, data=body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(self, path, body, options={}):\n\n headers = {}\n\n headers.update(self.DEFAULT_HEADERS)\n headers.update(options.get('headers') or {})\n headers.update(self.auth_header() or {})\n\n url = '%s%s' %(self.url, path)\n response = requests.put(url, json.dumps(body), he... | [
"0.687343",
"0.6839415",
"0.6801636",
"0.6770715",
"0.67444825",
"0.6710038",
"0.6663787",
"0.6576445",
"0.6575907",
"0.6574773",
"0.6533833",
"0.65058523",
"0.64595634",
"0.6437031",
"0.6436382",
"0.6431581",
"0.6422329",
"0.6397391",
"0.63948804",
"0.6359603",
"0.6354609",
... | 0.6621993 | 7 |
Purpose The purpose of this function is to take an unmodified labels array (where all of the entries are class labels as strings) and map each unique element to a numerical value to end up with a numerical labels array that is more sutible for Sklearn classification models. | def label_transformer(labels_arr: np.array):
# First let's collect all of the unique labels and order them in
# alphabetical order.
assert any([isinstance(labels_arr[0], np.str_),
isinstance(labels_arr[0], str)])
unique_labels_arr = np.unique(labels_arr)
# Now that we have this coll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_to_numeric(labels):\n labels = np.array(labels)\n if np.issubdtype(labels.dtype, np.integer):\n return labels\n else:\n cats = np.unique(labels)\n map_ = dict(zip(cats, np.arange(cats.shape[0])))\n return np.array([map_[i] for i in labels])",
"def labels_to_int(l... | [
"0.7871265",
"0.7510062",
"0.73446774",
"0.7334439",
"0.7231682",
"0.7208599",
"0.716304",
"0.7143923",
"0.70951635",
"0.7015512",
"0.70031714",
"0.68990546",
"0.6864763",
"0.678165",
"0.6774066",
"0.67694265",
"0.66866446",
"0.6686238",
"0.6658023",
"0.66423047",
"0.6567224"... | 0.85138047 | 0 |
Initializes the hero on its initial position | def __init__(self,h_settings,screen):
self.screen = screen
self.h_settings = h_settings
#Uploads the hero image and get the rect
self.image = pygame.image.load('images/hero_small.bmp')
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super().__init__()\n self.you_win_texture = arcade.load_texture(\"sources/images/full.png\")\n\n \"\"\" reset the viewport \"\"\"\n arcade.set_viewport(0, SCREEN_WIDTH - 1, 0, SCREEN_HEIGHT - 1)",
"def __init__(self):\n super().__init__()\n self.gam... | [
"0.66110975",
"0.6586826",
"0.65480673",
"0.64789367",
"0.64552516",
"0.64510757",
"0.62607324",
"0.6149126",
"0.61097705",
"0.61070156",
"0.60603654",
"0.60198975",
"0.601294",
"0.6000961",
"0.59994954",
"0.5989746",
"0.59815264",
"0.59809977",
"0.59706986",
"0.5937438",
"0.... | 0.6564575 | 2 |
Initializes the hero lives on its initial position | def __init__(self,h_settings,screen):
super(HeroLives, self).__init__()
self.screen = screen
self.h_settings = h_settings
#Uploads the hero image and get the rect
self.image = pygame.image.load('images/hero_very_small.bmp')
self.rect = self.image.get_rect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self):\r\n \r\n self.player = Player(GREEN, RADIUS)\r\n self.screen.fill(self.BG_COLOR)\r\n self.score = 0\r\n self.ticks = 0\r\n self.lives = 1\r\n self.sight = BEAM_SIGHT",
"def on_init(self):\n ... | [
"0.67653954",
"0.6338829",
"0.62477356",
"0.62441146",
"0.62117463",
"0.6160768",
"0.61381114",
"0.6090946",
"0.6059169",
"0.604313",
"0.60321367",
"0.6029949",
"0.6001554",
"0.5975532",
"0.5967559",
"0.5961871",
"0.5961819",
"0.5950928",
"0.5932227",
"0.58985543",
"0.5896997... | 0.6068478 | 8 |
Returns the number of spikes. | def __len__(self):
return len(self.spikes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCounts(spikes):\n\tba = np.array([0]*(np.max(spikes)+1))\n\tfor s in spikes:\n\t\tba[s] = ba[s] + 1\n\treturn ba.astype(float)",
"def nr_spikes(self, time, spikes, info):\n\n if \"stimulus_start\" not in info:\n if self.strict:\n raise ValueError(\"spike_rate require info[... | [
"0.7355267",
"0.72679126",
"0.7240894",
"0.69676626",
"0.69467014",
"0.6734692",
"0.67321736",
"0.6657548",
"0.6584529",
"0.64662814",
"0.61160266",
"0.61153096",
"0.61069375",
"0.6097043",
"0.6050752",
"0.60505176",
"0.60505176",
"0.6010501",
"0.5985672",
"0.5985672",
"0.598... | 0.56721205 | 73 |
Returns a copy of this spike train. Use this function if you want to create a real (deep) copy of this spike train. Simple assignment `t2 = t1` does not create a copy of the spike train data, but a reference as `numpy.array` is used for storing the data. | def copy(self):
return SpikeTrain(self.spikes.copy(), [self.t_start, self.t_end]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n new_tsp = TravelingSalesmanProblem(self.path)\n return new_tsp",
"def copy(self):\n return Trajectory(self.df.copy(), self.id, parent=self.parent)",
"def getSpikeTrain(self):\n \n spike_train = np.zeros( int(self.T/self.dt) )\n \n if le... | [
"0.6207001",
"0.5913082",
"0.5855237",
"0.58198524",
"0.5797674",
"0.5741176",
"0.5694065",
"0.5645238",
"0.56399864",
"0.5604107",
"0.5556107",
"0.5536849",
"0.5509826",
"0.5508805",
"0.5502256",
"0.5483121",
"0.54658175",
"0.54637325",
"0.5452018",
"0.54466254",
"0.5446602"... | 0.7759148 | 0 |
Performs forward pass of the input. Here an input tensor x is transformed through several layer transformations. | def forward(self, x):
feat = self.features(x)
feat = feat.squeeze()
out = self.classifier(feat)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n self.input = x\n nb_layer = 0\n for idx, layer in enumerate(self.layers.values()):\n x = layer(x)\n if layer.__dict__['_name'] == 'linear':\n nb_layer += 1\n self.layers['fc_' + str(nb_layer)].pre_activation = x\n ... | [
"0.8261022",
"0.8234585",
"0.79553866",
"0.7868558",
"0.7807674",
"0.77805513",
"0.7775143",
"0.77535355",
"0.7743139",
"0.7741146",
"0.7741146",
"0.77337414",
"0.77304024",
"0.7715609",
"0.76959723",
"0.76959723",
"0.7690663",
"0.76899534",
"0.7658196",
"0.7641168",
"0.76311... | 0.0 | -1 |
replaces postgres boolean literals with 0|1 within the values in an INSERT statement as created by pg_dump. | def replace_booleans(line):
insert, values = line.split('(', 1)
assert values.endswith(');')
values = values[:-2]
clean_values = []
for token in values.split(', '):
if token == 'true':
token = "1"
elif token == 'false':
token = "0"
clean_values.append(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bool_converter(value, db):\n if db in ('postgres', 'rdbhost'):\n return \"'t'\" if value else \"'f'\"\n else:\n return '1' if value else '0'",
"def convert_booleans(row):\n for k, v in row.items():\n if v is None:\n continue\n if v.strip().lower... | [
"0.6535235",
"0.64821196",
"0.619893",
"0.6178842",
"0.61326295",
"0.60807323",
"0.60163534",
"0.572018",
"0.5692854",
"0.5668011",
"0.56597143",
"0.56382275",
"0.5564724",
"0.5555501",
"0.5464827",
"0.5463577",
"0.54623",
"0.5452211",
"0.540126",
"0.5395746",
"0.53677285",
... | 0.6521773 | 1 |
Test the error messages returned by Flat and HalfFlat distributions for inconsistent sample shapes | def test_flat_halfflat_broadcast(tf_seed, check_broadcast):
dist, samples = check_broadcast
for sample in samples:
with pytest.raises(ValueError, match=r"not consistent"):
dist.log_prob(sample) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_face_normals_exception_raised(self, error_msg, *shapes):\n self.assert_exception_is_raised(normals.face_normals, error_msg, shapes)",
"def test_gather_faces_exception_raised(self, error_msg, *shapes):\n self.assert_exception_is_raised(normals.gather_faces, error_msg, shapes)",
"def test_loss_rai... | [
"0.71498054",
"0.71345115",
"0.68536484",
"0.6801674",
"0.6769645",
"0.67459667",
"0.6729084",
"0.66235685",
"0.65733063",
"0.6481179",
"0.64673877",
"0.6437669",
"0.62743866",
"0.6261793",
"0.62192225",
"0.6204676",
"0.61982495",
"0.6166162",
"0.61643445",
"0.6152461",
"0.61... | 0.59473956 | 33 |
Returns True if lower bound is infinity. | def lower_inf(self):
return self._range.lower is None and not self._range.empty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_is_finite(self):\n return self.min is not None",
"def isfinite(self):\n return True",
"def isfinite(self):\n return False",
"def is_finite(self):\n return True",
"def is_infinite(self):\n points = self.points()\n for point in points:\n ... | [
"0.76946974",
"0.73721254",
"0.725551",
"0.72317934",
"0.72233856",
"0.7210063",
"0.72018987",
"0.7201359",
"0.7158464",
"0.7153992",
"0.7141574",
"0.7136457",
"0.71136874",
"0.71101946",
"0.7093296",
"0.7091436",
"0.6935923",
"0.68925315",
"0.68402433",
"0.68300337",
"0.6810... | 0.7927389 | 0 |
Returns True if upper bound is infinity. | def upper_inf(self):
return self._range.upper is None and not self._range.empty | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_infinite(self):\n points = self.points()\n for point in points:\n if point[-1] == 0:\n return True\n return False",
"def isInfinite(self):\r\n for _begin,end,_step in self._ranges:\r\n if end is None:\r\n r... | [
"0.7680547",
"0.76591116",
"0.7657757",
"0.76285625",
"0.7496636",
"0.748653",
"0.74839044",
"0.74511206",
"0.7393872",
"0.7373907",
"0.73597634",
"0.73490226",
"0.73373795",
"0.7281989",
"0.7277353",
"0.7245108",
"0.71478593",
"0.7138056",
"0.71245766",
"0.71238834",
"0.7122... | 0.8128023 | 0 |
Returns True if both ranges share any points. >>> intrange(1, 10).overlap(intrange(5, 15)) True >>> intrange(1, 5).overlap(intrange(5, 10)) False | def overlap(self, other):
return not self << other and not other << self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_overlap(*ranges) -> bool:\n ovr_lap = []\n if ranges:\n # Form a set from first range object\n first_range = set(ranges[0])\n\n # Form a set from other ranges by combining with chain and\n # find intersection between them\n\n ovr_lap = first_range.intersection(set(ch... | [
"0.7675123",
"0.76587194",
"0.75377506",
"0.7523627",
"0.75016224",
"0.747614",
"0.74539065",
"0.74034077",
"0.7392066",
"0.73215383",
"0.72522736",
"0.7208801",
"0.71677047",
"0.7130543",
"0.7074396",
"0.705732",
"0.7034219",
"0.7030716",
"0.7026813",
"0.69360536",
"0.692493... | 0.611311 | 88 |
Returns True if self ends at the same point as other. Other can be either range or scalar of the range's type. If range doesn't include the end, a scalar other value will always return False. | def endswith(self, other):
if isinstance(other, self.__class__):
if self.upper_inc == other.upper_inc:
return self.upper == other.upper
else:
return False
elif isinstance(other, self.type):
if self.upper_inc:
return sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap(self, other):\n return not (self.begin >= other.end or self.end <= other.begin)",
"def is_containing(self, another: 'Range') -> bool:\n return self.start <= another.start and self.end >= another.end",
"def endswith(self, other):\n\n if isinstance(other, self.type):\n ... | [
"0.71475655",
"0.71333337",
"0.71327424",
"0.69576734",
"0.6926841",
"0.6808341",
"0.6756753",
"0.6752672",
"0.67489266",
"0.67014444",
"0.6670395",
"0.66260993",
"0.6623874",
"0.6584722",
"0.6559464",
"0.651602",
"0.6353418",
"0.6335473",
"0.6331467",
"0.631838",
"0.62907875... | 0.661841 | 13 |
Returns True if self starts either after or the same spot as other. | def startsafter(self, other):
if isinstance(other, self.__class__):
if self.lower == other.lower:
return other.lower_inc if self.lower_inc else not other.lower_inc
elif self.lower_inf:
return False
elif other.lower_inf:
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_after(self, other):\n if self == other:\n return False\n if self.is_before(other) == True:\n return False\n if self.is_before(other) == False:\n return True",
"def is_after(self, other):\n return self.__cmp__(other) > 0",
"def is_on_or_after(s... | [
"0.7403491",
"0.7308435",
"0.7256913",
"0.722599",
"0.70090526",
"0.6974803",
"0.6891023",
"0.6876196",
"0.67131263",
"0.6579445",
"0.65710026",
"0.6541702",
"0.6522073",
"0.6511019",
"0.65028036",
"0.6500643",
"0.64723325",
"0.64450526",
"0.6423003",
"0.64073944",
"0.6402615... | 0.68398 | 8 |
Returns True if self end either before or the same spot as other. | def endsbefore(self, other):
if isinstance(other, self.__class__):
if self.upper == other.upper:
return other.upper_inc if self.upper_inc else not other.upper_inc
elif self.upper_inf:
return False
elif other.upper_inf:
return T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_after(self, other):\n if self == other:\n return False\n if self.is_before(other) == True:\n return False\n if self.is_before(other) == False:\n return True",
"def is_in_back_of(self, other):\n return self.y > other.y",
"def is_after(self, oth... | [
"0.77636415",
"0.7464347",
"0.7458055",
"0.7344855",
"0.71746933",
"0.7139637",
"0.6979636",
"0.68833715",
"0.67108256",
"0.66479445",
"0.6633917",
"0.6620755",
"0.6600347",
"0.6589568",
"0.6585445",
"0.655516",
"0.65518034",
"0.6548244",
"0.6540304",
"0.64913785",
"0.6480487... | 0.704025 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.