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 |
|---|---|---|---|---|---|---|
The component pdf p_k(x; mu_k, sigma_k) | def component_pdfs(x, mus, sigmas):
n_components = mus.shape[0]
return np.array([gaussian_pdf(x, mus[k,:], sigmas[k, :, :]) for k in range(n_components)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _multivariate_gaussian(self, x, mu_k, sigma_k):\n return multivariate_normal.pdf(x, mu_k, sigma_k)",
"def pdf(self, data=None):\n ndim = self.lam.size\n if data is None:\n raise ValueError('No data given!')\n self.data = np.atleast_2d(data)\n # (T, k) array\n ... | [
"0.7243944",
"0.7122818",
"0.69185126",
"0.68300146",
"0.66222215",
"0.65508056",
"0.6513147",
"0.64969236",
"0.6463092",
"0.64626175",
"0.63948226",
"0.6373973",
"0.63665843",
"0.63361454",
"0.62801707",
"0.621426",
"0.6193032",
"0.6176756",
"0.6171287",
"0.61619306",
"0.616... | 0.5973881 | 34 |
The component pdf p_k(x; mu_k, sigma_k) | def likelihood_function(X, taus, mus, sigmas):
N = X.shape[0] # number of data points
get_component_prob = lambda x: component_pdfs(x, mus, sigmas)
T = np.apply_along_axis(arr=X, func1d=get_component_prob, axis=1) # gaussian component probabilities in row format (NxK)
taus_rep = np.tile(taus, reps=(N, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _multivariate_gaussian(self, x, mu_k, sigma_k):\n return multivariate_normal.pdf(x, mu_k, sigma_k)",
"def pdf(self, data=None):\n ndim = self.lam.size\n if data is None:\n raise ValueError('No data given!')\n self.data = np.atleast_2d(data)\n # (T, k) array\n ... | [
"0.7243944",
"0.7122818",
"0.69185126",
"0.68300146",
"0.66222215",
"0.65508056",
"0.6513147",
"0.64969236",
"0.6463092",
"0.64626175",
"0.63948226",
"0.6373973",
"0.63665843",
"0.63361454",
"0.62801707",
"0.621426",
"0.6193032",
"0.6176756",
"0.6171287",
"0.61619306",
"0.616... | 0.0 | -1 |
Turns the given color image into a binary image using Otsu's method to determine the threshold value. Morphological closing is applied to the output. | def get_binary_image(img, closing_radius):
# convert to grayscale
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
img = cv.GaussianBlur(img, (5, 5), 0) # little bit of filtering to reduce noise
# threshold using Otsu. Seems to work very well if there is enough contrast and sharp edges in the image
thr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_binary_image(self, color_image):\r\n # get yellow lanes \r\n lower_yellow = np.array([0,50, 100])\r\n upper_yellow = np.array([180, 255, 255])\r\n mask_yellow = cv2.inRange(color_image, lower_yellow, upper_yellow)\r\n output_yellow = cv2.bitwise_and(color_image, color... | [
"0.75089645",
"0.74994314",
"0.7353734",
"0.73187023",
"0.7179666",
"0.71784616",
"0.70848423",
"0.70380664",
"0.6993084",
"0.69170696",
"0.6863178",
"0.68593365",
"0.6811652",
"0.67929125",
"0.67568773",
"0.6741879",
"0.6738309",
"0.67254263",
"0.67064995",
"0.67012656",
"0.... | 0.6548193 | 28 |
Create an ellipse shaped mask of the given size. The ellipse is dilated by the specified offset | def get_ellipse_mask(ellipse, img_shape, offset=0):
# create image
mask = np.zeros((img_shape[0], img_shape[1]), dtype=np.uint8)
try:
# fill ellipse
draw_ellipse(mask, ellipse, (255, 255, 255), -1)
except Exception as ex:
logging.getLogger("StrainDetection").warning("Unable to c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_ellipse(self, color, position, size, border_width = 0, anchor= 'topleft'):\n # We'll try to make sure that everything is okay later\n \n color = spyral.color._determine(color)\n offset = self._calculate_offset(anchor, size)\n pygame.draw.ellipse(self._surf, color, (posit... | [
"0.63135374",
"0.62722075",
"0.5993526",
"0.58033866",
"0.57794535",
"0.5752152",
"0.5669167",
"0.562769",
"0.56140393",
"0.5608835",
"0.5584218",
"0.5581703",
"0.55707437",
"0.5496543",
"0.5476986",
"0.546765",
"0.5456867",
"0.5447372",
"0.53932524",
"0.5381595",
"0.5355072"... | 0.7234773 | 0 |
Calculate the radius of a given ellipse at the specified angle. | def ellipse_radius_at_angle(ellipses_np, query_angles):
# ensure that all arrays have the right dimensions
radii = np.reshape(ellipses_np[:, 2:4], (-1, 2)) # make sure it's an n-by-2 matrix
ellipse_angle = np.reshape(ellipses_np[:, 4], (-1, 1)) # make sure it's a column vector
query_angles = np.resha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arc_radius(height_in_units):\n return height_in_units * _ARC_HEIGHT_UNIT / (1 - math.cos(_ANGLE))",
"def area_ellipse(radius_x: float, radius_y: float) -> float:\r\n if radius_x < 0 or radius_y < 0:\r\n raise ValueError(\"area_ellipse() only accepts non-negative values\")\r\n return pi * rad... | [
"0.6585415",
"0.6572188",
"0.64306986",
"0.6369141",
"0.63640285",
"0.6334469",
"0.6310871",
"0.6259107",
"0.62220883",
"0.6220437",
"0.6203076",
"0.61862946",
"0.6173566",
"0.61477137",
"0.6143963",
"0.6143963",
"0.61041725",
"0.60898817",
"0.606294",
"0.60490364",
"0.603918... | 0.7406878 | 0 |
Visualizes the strain detection result by drawing the detected ellipse on the image. Can also show specific radial strain values at certain angles. | def visualize_result(img, ellipse, radii=None, angles=None, reference_ellipse=None, strain=None, marker_size=8,
title=""):
if img is None or ellipse is None:
return img
img = np.copy(img) # copy so we don't alter the original
blue = (255, 0, 0)
green = (0, 200, 0)
red... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawEllipse(img, center, axes, angle, startAngle=0, endAngle=360, color = (0,0,255), fill = -1):\n\tcv2.ellipse(img, center, axes, angle, startAngle, endAngle, color, fill)",
"def display():\r\n fill(un)\r\n ellipse(x,y,2*rayonBalle,2*rayonBalle)\r\n \r\n fill(deux)\r\n ellipse(xDeux,yDeux,2*r... | [
"0.62787783",
"0.61492157",
"0.5979481",
"0.59766865",
"0.597348",
"0.5896743",
"0.5879478",
"0.5837023",
"0.5834916",
"0.5824496",
"0.5770942",
"0.5709803",
"0.57042104",
"0.5683414",
"0.5679596",
"0.5659559",
"0.560907",
"0.5571803",
"0.556948",
"0.5566363",
"0.5546686",
... | 0.772018 | 0 |
Metodo construtor da classe Node. | def __init__(self, state, goal, parent=None):
self.state = state
self.neighbors = []
self.visited_right = False
self.visited_left = False
self.parent_right = None
self.parent_left = None
self.parent = parent
self.g = 0 if not parent else parent.g + 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = Node('')",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n self.root = Node(None)",
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self):\n ... | [
"0.82912785",
"0.8236625",
"0.8236625",
"0.8175077",
"0.816364",
"0.81248236",
"0.8098383",
"0.8098383",
"0.8098383",
"0.80898887",
"0.7945995",
"0.7904458",
"0.78406316",
"0.77167886",
"0.7687677",
"0.7680773",
"0.76382595",
"0.7628259",
"0.76030475",
"0.7601231",
"0.7538864... | 0.0 | -1 |
Sobrescrita do metodo de igualdade (__eq__). | def __eq__(self, another_node):
return Node.state_as_string(self.state) == Node.state_as_string(another_node.state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8577829",
"0.8473279",
"... | 0.0 | -1 |
Checks if a ui object has typable type. | def _valid_typable_object(ui_object, platform=Platform.ANDROID):
if platform == Platform.ANDROID:
return ui_object.obj_type in _TYPABLE_OBJECT_DESC.keys()
else:
assert False, 'Wrong Platform' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _valid_typable_object_with_name(ui_object, platform=Platform.ANDROID):\n if platform == Platform.ANDROID:\n return (ui_object.obj_type in _TYPABLE_OBJECT_DESC.keys() and\n _valid_object_with_name(ui_object))\n else:\n assert False, 'Wrong Platform'",
"def verify_type(self, obj):\n r... | [
"0.7663882",
"0.7338475",
"0.71092886",
"0.6991584",
"0.6921893",
"0.68917876",
"0.6765442",
"0.67502445",
"0.6727878",
"0.6711479",
"0.66089845",
"0.655486",
"0.6523792",
"0.65183437",
"0.65065336",
"0.64704704",
"0.64701164",
"0.64533174",
"0.64186484",
"0.6411833",
"0.6400... | 0.8108024 | 0 |
Gets object type string. | def _get_obj_type_str(action_rule,
ui_object,
accept_empty=True,
platform=Platform.ANDROID):
obj_type_candidates = ['icon', 'item']
if accept_empty:
obj_type_candidates.append('')
if action_rule == common.ActionRules.GRID_CONTEXT_RULE:
obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n return pulumi.get(self, \"object_type\")",
"def object_type(self) -> str:\n return pulumi.get(sel... | [
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.8554677",
"0.85137904",
"0.826582",
"0.8148561",
"0.8148561",
"0.8036511",
"... | 0.0 | -1 |
The name of the resource group. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_gr... | [
"0.8794932",
"0.85470533",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.84212106",
"0.837923",
"0.8275838",
"0.8230199",
"0.82145786",
"0.807179",
"0.807179",
"0.80... | 0.81754035 | 30 |
The name of the user profile. | def user_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "user_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return self.user.username + \"'s Profile\"",
"def user_name(self) -> str:\n return pulumi.get(self, \"user_name\")",
"def get_user_fullname(self):\n return self.applicant.userprofile.display_name()",
"def __str__(self):\n profile = {\n 'address': se... | [
"0.8115589",
"0.79605514",
"0.79032505",
"0.78227675",
"0.78078455",
"0.7766729",
"0.7741077",
"0.76365244",
"0.7623626",
"0.75846046",
"0.7565712",
"0.7565453",
"0.7488862",
"0.74860716",
"0.74847776",
"0.74681073",
"0.74681073",
"0.738379",
"0.7363319",
"0.7361092",
"0.7340... | 0.7040179 | 43 |
The display name of the Azure Resource Manager template that produced the environment. | def arm_template_display_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "arm_template_display_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arm_template_display_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"arm_template_display_name\")",
"def inspect_template_name(self) -> str:\n return pulumi.get(self, \"inspect_template_name\")",
"def template_name(self) -> pulumi.Output[Optional[str]]:\n return... | [
"0.7892981",
"0.7482402",
"0.71215767",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.6856488",
"0.6848355",
"0.67874736",
"0.67287433",
"0.6681131",
"... | 0.7655293 | 1 |
The location of the resource. | def location(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self) -> str:\n return self.metadata.location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return pulumi.ge... | [
"0.7555213",
"0.74963796",
"0.74963796",
"0.74963796",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.7312402",
"0.73097575",
"0.7136478",
... | 0.0 | -1 |
The name of the environment. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._env_name",
"def environment_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"environment_name\")",
"def name(self):\n return get_env_name(self.tool_name,\n self._python,\n self._requ... | [
"0.88247174",
"0.8514951",
"0.8427358",
"0.8231855",
"0.8134775",
"0.8126391",
"0.77787375",
"0.7737477",
"0.75888616",
"0.7587013",
"0.7255528",
"0.72232443",
"0.7205673",
"0.7137208",
"0.7129914",
"0.70380133",
"0.6991552",
"0.696028",
"0.6939775",
"0.6909553",
"0.68777037"... | 0.0 | -1 |
Get an existing Environment resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = EnvironmentArgs.__new__(EnvironmentArgs)
__props__.__dict__["arm_temp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Environment':\n opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))\n\n __props__ = EnvironmentArgs.__new__(EnvironmentArgs)\n\n __props__.__dict... | [
"0.6545777",
"0.6168442",
"0.6152393",
"0.61106586",
"0.61102676",
"0.6090866",
"0.6073507",
"0.59325826",
"0.58820075",
"0.58387506",
"0.5818248",
"0.58069515",
"0.57874495",
"0.57864374",
"0.5779581",
"0.57135886",
"0.56772476",
"0.5641371",
"0.5598876",
"0.5524049",
"0.544... | 0.6518716 | 1 |
The display name of the Azure Resource Manager template that produced the environment. | def arm_template_display_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "arm_template_display_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arm_template_display_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"arm_template_display_name\")",
"def inspect_template_name(self) -> str:\n return pulumi.get(self, \"inspect_template_name\")",
"def template_name(self) -> pulumi.Output[Optional[str]]:\n return ... | [
"0.7655293",
"0.7482402",
"0.71215767",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.68987066",
"0.6856488",
"0.6848355",
"0.67874736",
"0.67287433",
"0.6681131",
"... | 0.7892981 | 0 |
The location of the resource. | def location(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self) -> str:\n return self.metadata.location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return self.__location",
"def location(self) -> str:\n return pulumi.ge... | [
"0.7555213",
"0.74963796",
"0.74963796",
"0.74963796",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.73580384",
"0.7312402",
"0.73097575",
"0.7136478",
... | 0.6752694 | 55 |
The name of the resource. | def name(self) -> pulumi.Output[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self):\n return self._resource_name",
"def name(self):\n return self.raw_resource[\"name\"]",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def ... | [
"0.8797532",
"0.8770644",
"0.8469626",
"0.8306927",
"0.8306927",
"0.8075097",
"0.8075097",
"0.8075097",
"0.8075097",
"0.8075097",
"0.77082634",
"0.76422197",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
"0.7560483",
... | 0.0 | -1 |
The provisioning status of the resource. | def provisioning_state(self) -> pulumi.Output[str]:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provisioning_state(self) -> str:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> str:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> str:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_s... | [
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"0.8282707",
"... | 0.8209398 | 29 |
The identifier of the resource group containing the environment's resources. | def resource_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "resource_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(se... | [
"0.83627874",
"0.83627874",
"0.83627874",
"0.83627874",
"0.83627874",
"0.81291115",
"0.7838433",
"0.78316456",
"0.77571845",
"0.77571845",
"0.7615663",
"0.753469",
"0.753469",
"0.753469",
"0.753469",
"0.753469",
"0.753469",
"0.753469",
"0.753469",
"0.7376498",
"0.73673624",
... | 0.806918 | 6 |
The type of the resource. | def type(self) -> pulumi.Output[str]:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pu... | [
"0.87906647",
"0.8584323",
"0.8584323",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8225315",
"0.79590267",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.78331804",
"0.7... | 0.0 | -1 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
node = self.root
for c in word:
if c not in node.children:
return False
node = node.children[c]
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7856802",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7753436",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079"... | 0.74377877 | 36 |
Set all nonzero elements (elements currently in the sparsity pattern) to the given value. Useful to set to 0 mostly. | def csr_row_set_val(csr, row, value=0):
if not isinstance(csr, sps.csr_matrix):
raise ValueError('Matrix given must be of CSR format.')
csr.data[csr.indptr[row]:csr.indptr[row+1]] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_pars ( self , value = 0 ) :\n for f in self.__pars : f.setVal( value )",
"def setZeroes(self, matrix: List[List[int]]) -> None:\r\n import copy\r\n m=len(matrix)\r\n n=len(matrix[0])\r\n m_copy=copy.deepcopy(matrix)\r\n for i in range(m):\r\n for j i... | [
"0.681021",
"0.6457613",
"0.6423003",
"0.64064205",
"0.6398592",
"0.63663006",
"0.63539284",
"0.6345746",
"0.6328642",
"0.6326541",
"0.62506604",
"0.6227977",
"0.6217288",
"0.6216938",
"0.62130475",
"0.619986",
"0.6193208",
"0.61800337",
"0.61793345",
"0.6179182",
"0.6150275"... | 0.0 | -1 |
Checks whether given outermost scoped map entries have topological structure apt for fusion | def check_topo_feasibility(sdfg, graph, map_entries, intermediate_nodes, out_nodes):
# For each intermediate and out node: must never reach any map
# entry if it is not connected to map entry immediately
# for memoization purposes
visited = set()
def visit_descendants(graph, no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_be_applied(self, sdfg: SDFG, subgraph: SubgraphView) -> bool:\n # get graph\n graph = subgraph.graph\n for node in subgraph.nodes():\n if node not in graph.nodes():\n return False\n\n # next, get all the maps\n map_entries = helpers.get_outermost... | [
"0.67054045",
"0.5607276",
"0.55002624",
"0.5440051",
"0.5420567",
"0.532978",
"0.5291018",
"0.5270614",
"0.5250488",
"0.524257",
"0.5183565",
"0.5179906",
"0.5179384",
"0.5168615",
"0.51609915",
"0.5141711",
"0.51401395",
"0.5127928",
"0.5125389",
"0.5098742",
"0.50942504",
... | 0.6730448 | 0 |
For a given intermediate access node, return a set of indices that correspond to array / subset dimensions in which no change is observed upon propagation through the corresponding map nodes in map_entries / map_exits. | def get_invariant_dimensions(self, sdfg: dace.sdfg.SDFG, graph: dace.sdfg.SDFGState,
map_entries: List[nodes.MapEntry], map_exits: List[nodes.MapExit],
node: nodes.AccessNode):
variant_dimensions = set()
subset_length = -1
for in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_compressible_nodes(sdfg: dace.sdfg.SDFG,\n graph: dace.sdfg.SDFGState,\n intermediate_nodes: List[nodes.AccessNode],\n map_entries: List[nodes.MapEntry],\n m... | [
"0.6135496",
"0.5683309",
"0.5668987",
"0.5563009",
"0.5469743",
"0.5386425",
"0.5302051",
"0.52778465",
"0.5242188",
"0.5231178",
"0.52002335",
"0.51963794",
"0.51943564",
"0.51936275",
"0.5168415",
"0.51443154",
"0.51406837",
"0.513929",
"0.5065348",
"0.5062162",
"0.5061017... | 0.6040024 | 1 |
Make a plucked string of a particular length using FM synthesis | def fm_plucked_string_note(sr, note, duration, lam = 3):
envelope = lambda N, sr: exp_env(N, sr, lam)
return fm_synth_note(sr, note, duration, \
ratio = 1, I = 8, envelope = envelope,
amplitude = envelope) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repeat_to_length(string_to_expand: str, length: int) -> str:\n return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length]",
"def get_fixed_length_string(string: str, length=20) -> str:\n if len(string) > length:\n return f\"{string[: length - 3]}...\"\n spacing = \"\".jo... | [
"0.68271565",
"0.6184429",
"0.6129762",
"0.6121944",
"0.60606194",
"0.6060107",
"0.60128564",
"0.5984889",
"0.5965209",
"0.59579825",
"0.5939928",
"0.5901825",
"0.58879477",
"0.58753973",
"0.5841773",
"0.5827019",
"0.5816829",
"0.58162117",
"0.5813211",
"0.5782545",
"0.577961... | 0.6708796 | 1 |
Get the distance to nearest obstacle. This method needs to be implemented in the specific env implementation | def nearest_obstacle_distance(self, state, *args, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance(self):\n print(\"voici la distance à l'obstacle\")",
"def __get_distance(self, game_object):\n obj_x, obj_y = game_object.get_coordinates()\n self_x, self_y = self._coordinates\n\n inner = (obj_x-self_x)**2 + (obj_y-self_y)**2\n return math.sqrt(inner)",
"def... | [
"0.70763373",
"0.6916811",
"0.6834616",
"0.67737603",
"0.6772844",
"0.65421396",
"0.65414286",
"0.65414286",
"0.6491201",
"0.6409989",
"0.63983446",
"0.6360081",
"0.6336198",
"0.6328163",
"0.63262594",
"0.63002294",
"0.6289058",
"0.62855166",
"0.6261895",
"0.6245946",
"0.6235... | 0.70965 | 0 |
Return the current date and time formatted for a message header. | def date_time_string(timestamp=None):
if timestamp is None:
timestamp = time.time()
return email.utils.formatdate(timestamp, usegmt=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time(self):\r\n now = datetime.datetime.now()\r\n month = rfc822._monthnames[now.month - 1].capitalize()\r\n return ('[%02d/%s/%04d:%02d:%02d:%02d]' %\r\n (now.day, month, now.year, now.hour, now.minute, now.second))",
"def format_message(self, message):\n return \"... | [
"0.74677795",
"0.72134626",
"0.7036841",
"0.69758844",
"0.69123936",
"0.6860012",
"0.68412703",
"0.6783878",
"0.67790556",
"0.67743635",
"0.6749689",
"0.6736323",
"0.6722745",
"0.6710519",
"0.66845053",
"0.6674315",
"0.6639379",
"0.662203",
"0.66216946",
"0.6590525",
"0.65817... | 0.0 | -1 |
Instantiates a `Loss` from its config (output of `get_config()`). | def from_config(cls, config):
return cls(**config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def from_config(cls, loss_config: AttrDict):\n return cls(loss_config)",
"def init_loss(config):\n if config.loss == 'cross_entropy':\n criterion = nn.CrossEntropyLoss()\n elif config.loss == 'label_smoothing':... | [
"0.7865729",
"0.7865729",
"0.6786548",
"0.6635496",
"0.66031206",
"0.65174663",
"0.64920735",
"0.6476997",
"0.6476177",
"0.62358457",
"0.6226515",
"0.61258495",
"0.6092099",
"0.60900325",
"0.6075301",
"0.60425204",
"0.5944963",
"0.5941057",
"0.5768906",
"0.5768906",
"0.575949... | 0.54044783 | 45 |
Computes the mean absolute error between labels and predictions. `loss = mean(abs(y_true y_pred), axis=1)` | def mean_absolute_error(y_true, y_pred):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
return backend.mean(math_ops.abs(y_pred - y_true), axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_error(labels, predictions):\n pred_values = predictions['predictions']\n return {'mae': tf.metrics.mean_absolute_error(\n labels, pred_values)}",
"def mean_absolute_error(y, y_pred, w):\n return np.average(np.abs(y_pred - y), weights=w)",
"def calc_loss(predictions... | [
"0.80667424",
"0.7965529",
"0.7909066",
"0.78249055",
"0.77870995",
"0.77054894",
"0.7582376",
"0.75638753",
"0.75638753",
"0.755841",
"0.7520214",
"0.744197",
"0.7414742",
"0.7343341",
"0.7330417",
"0.7278785",
"0.7250387",
"0.72465336",
"0.7243071",
"0.72349966",
"0.7171132... | 0.8090256 | 0 |
Computes the mean absolute percentage error between `y_true` and `y_pred`. `loss = 100 mean(abs((y_true y_pred) / y_true), axis=1)` | def mean_absolute_percentage_error(y_true, y_pred):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
diff = math_ops.abs(
(y_true - y_pred) / backend.maximum(math_ops.abs(y_true),
backend.epsilon()))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_absolute_percentage_error(y_true, y_pred):\n output_errors = 100*np.average(np.abs(y_true - y_pred)/y_true)\n return np.average(output_errors)",
"def mean_absolute_percentage_error(y_true, y_pred):\n y_true, y_pred = np.array(y_true), np.array(y_pred)\n return np.mean(np.abs((y_true - y_pred... | [
"0.871951",
"0.867229",
"0.867229",
"0.8611364",
"0.8566097",
"0.83024114",
"0.82082254",
"0.8194134",
"0.8154447",
"0.78907",
"0.78007776",
"0.76275754",
"0.7579637",
"0.7460464",
"0.7429004",
"0.7374108",
"0.7370344",
"0.7365005",
"0.7348623",
"0.73379385",
"0.733196",
"0... | 0.8418601 | 5 |
Computes the squared hinge loss between `y_true` and `y_pred`. `loss = mean(square(maximum(1 y_true y_pred, 0)), axis=1)` | def squared_hinge(y_true, y_pred):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
y_true = _maybe_convert_labels(y_true)
return backend.mean(
math_ops.square(math_ops.maximum(1. - y_true * y_pred, 0.)), axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hinge(y_true, y_pred):\n y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)\n y_true = math_ops.cast(y_true, y_pred.dtype)\n y_true = _maybe_convert_labels(y_true)\n return backend.mean(math_ops.maximum(1. - y_true * y_pred, 0.), axis=-1)",
"def hinge_loss(self, y_true=None, y_pred=Non... | [
"0.82352906",
"0.80867594",
"0.7517892",
"0.7450811",
"0.74376905",
"0.7406718",
"0.7378119",
"0.7378119",
"0.7360072",
"0.7296074",
"0.72456366",
"0.7244185",
"0.72122777",
"0.7194819",
"0.7163286",
"0.7160181",
"0.7149667",
"0.71419245",
"0.7082052",
"0.70513225",
"0.704963... | 0.8891885 | 0 |
Computes the hinge loss between `y_true` and `y_pred`. `loss = mean(maximum(1 y_true y_pred, 0), axis=1)` | def hinge(y_true, y_pred):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
y_true = _maybe_convert_labels(y_true)
return backend.mean(math_ops.maximum(1. - y_true * y_pred, 0.), axis=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hinge_loss(self, y_true=None, y_pred=None, decimal=5, **kwargs):\n y_true, y_pred, binary, representor, decimal = self.get_processed_data2(y_true, y_pred, decimal)\n if binary:\n # replacing 0 = -1\n y_true[y_true == 0] = -1\n y_pred[y_pred == 0] = -1\n ... | [
"0.8366818",
"0.8175839",
"0.73551494",
"0.7335244",
"0.7159172",
"0.7094759",
"0.7094759",
"0.7084359",
"0.7078781",
"0.7074391",
"0.7057187",
"0.7047357",
"0.7042067",
"0.69892997",
"0.69855434",
"0.69738626",
"0.6933831",
"0.69332236",
"0.6894251",
"0.6890254",
"0.6866237"... | 0.8738169 | 0 |
Logarithm of the hyperbolic cosine of the prediction error. `log(cosh(x))` is approximately equal to `(x 2) / 2` for small `x` and to `abs(x) log(2)` for large `x`. This means that 'logcosh' works mostly like the mean squared error, but will not be so strongly affected by the occasional wildly incorrect prediction. | def log_cosh(y_true, y_pred):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
def _logcosh(x):
return x + math_ops.softplus(-2. * x) - math_ops.cast(
math_ops.log(2.), x.dtype)
return backend.mean(_logcosh(y_pred - y_true), axis=-1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logcosh(y_true, y_pred):\n\n def _logcosh(x):\n return x + nn.softplus(-2. * x) - math_ops.log(2.)\n\n return K.mean(_logcosh(y_pred - y_true), axis=-1)",
"def acosh(x):\n return math.log(x+math.sqrt(x*x-1))",
"def _log_cosh_error_compute(sum_log_cosh_error: Tensor, n_obs: Tensor) ->Tensor:\n re... | [
"0.74150884",
"0.7265277",
"0.70172673",
"0.67317367",
"0.6227404",
"0.62114656",
"0.6074256",
"0.607202",
"0.5962181",
"0.5937984",
"0.59287596",
"0.59006083",
"0.5805744",
"0.57276446",
"0.5658371",
"0.56483096",
"0.56437826",
"0.5625247",
"0.56046206",
"0.5587339",
"0.5580... | 0.7613957 | 0 |
Computes the categorical crossentropy loss. | def categorical_crossentropy(y_true,
y_pred,
from_logits=False,
label_smoothing=0,
axis=-1):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossentropy_loss(y_true, y_pred):\n ce = tf.keras.losses.categorical_crossentropy(y_true, y_pred, from_logits=True) \n return ce",
"def categorical_crossentropy(predictions, targets):\n return theano.tensor.nnet.categorical_crossentropy(predictions, targets)",
"def categorical_crossentropy(pre... | [
"0.8234132",
"0.801983",
"0.801983",
"0.78860074",
"0.78606915",
"0.77535206",
"0.7542817",
"0.7461506",
"0.73878723",
"0.73459363",
"0.7313188",
"0.72762954",
"0.7247943",
"0.7244424",
"0.7228929",
"0.72204506",
"0.7198388",
"0.7147404",
"0.7093519",
"0.7092186",
"0.7075462"... | 0.6774857 | 43 |
Computes the sparse categorical crossentropy loss. | def sparse_categorical_crossentropy(y_true, y_pred, from_logits=False, axis=-1):
y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)
y_true = math_ops.cast(y_true, y_pred.dtype)
return backend.sparse_categorical_crossentropy(
y_true, y_pred, from_logits=from_logits, axis=axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss(labels, logits):\n return sparse_categorical_crossentropy(labels, logits, from_logits=True)",
"def sparse_cross_entropy(true, pred, axis=-1, epsilon=1e-7):\n true = ivy.one_hot(true, pred.shape[axis])\n return cross_entropy(true, pred, axis, epsilon)",
"def sparse_cross_entropy(y_true, y_pred... | [
"0.7954146",
"0.7614978",
"0.7467854",
"0.7404816",
"0.7354107",
"0.71705383",
"0.7064498",
"0.7064498",
"0.69864917",
"0.6947025",
"0.6923205",
"0.68772006",
"0.6835799",
"0.6821985",
"0.67486286",
"0.67382556",
"0.66378057",
"0.66265273",
"0.65963894",
"0.6595304",
"0.65951... | 0.7617286 | 1 |
Computes the cosine similarity between labels and predictions. Note that it is a number between 1 and 1. When it is a negative number between 1 and 0, 0 indicates orthogonality and values closer to 1 indicate greater similarity. The values closer to 1 indicate greater dissimilarity. This makes it usable as a loss funct... | def cosine_similarity(y_true, y_pred, axis=-1):
y_true = nn.l2_normalize(y_true, axis=axis)
y_pred = nn.l2_normalize(y_pred, axis=axis)
return -math_ops.reduce_sum(y_true * y_pred, axis=axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cosine_loss(predictions,\n labels,\n weights = 1.0,\n loss_reduction = LossReductionType.SUM_BY_NONZERO_WEIGHTS,\n **kwargs):\n del kwargs # Unused\n check_shape_equal(predictions, labels)\n cosine = 1.0 - jnp.sum(predictions * labels, axis=-1)\n ... | [
"0.71765155",
"0.67528576",
"0.6623946",
"0.6523527",
"0.64602715",
"0.6436148",
"0.64294314",
"0.6322764",
"0.6313735",
"0.6209274",
"0.6207677",
"0.61768717",
"0.61673397",
"0.61631984",
"0.6117086",
"0.6107713",
"0.609009",
"0.60771525",
"0.60537165",
"0.60509014",
"0.6047... | 0.80107373 | 0 |
Process text, remove stopwords and obtain lemmas, but does not split into sentences. This function should not emit newlines! | def proc_text(self, text):
lemmas = []
tokens = []
doc = self(text)
for tokObj in doc:
if self._remove_punct and tokObj.is_punct:
continue
lemma = tokObj.lemma_
text = tokObj.text
if self._keep_only_alpha_num and not is_alp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_text(text):\n return [token.text for token in nlp(text) if not token.is_stop]",
"def lem_and_stem(text, stopwords):\n\n\tlemmatizer = WordNetLemmatizer()\n\tstemmer = PorterStemmer()\n\tprocessed_text = []\n\tfor token, pos in text:\n\t\tpos = map_pos_tag(pos)\n\t\tif not (pos == wn.NOUN):\n\t\t\t... | [
"0.77558935",
"0.76819676",
"0.7611716",
"0.75638014",
"0.75489646",
"0.7506425",
"0.74586594",
"0.74542224",
"0.74525785",
"0.740927",
"0.7387765",
"0.7353655",
"0.7349905",
"0.7308248",
"0.7308248",
"0.7253384",
"0.7196554",
"0.7193804",
"0.7186191",
"0.715718",
"0.70882404... | 0.79113 | 0 |
Creates a zero mask used for cutout of shape `img_height` x `img_width`. | def create_cutout_mask(img_height, img_width, num_channels, size):
assert img_height == img_width
# Sample center where cutout mask will be applied
height_loc = np.random.randint(low=0, high=img_height)
width_loc = np.random.randint(low=0, high=img_width)
# Determine upper right and lower left cor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cutout_img(img, size=2):\n img_height, img_width, num_channels = (img.shape[0], img.shape[1],\n img.shape[2])\n assert len(img.shape) == 3\n mask, _, _ = create_cutout_mask(img_height, img_width, num_channels, size)\n return img * mask",
"def mask_img(img... | [
"0.666125",
"0.64113444",
"0.6235268",
"0.6158048",
"0.6155189",
"0.6151017",
"0.614534",
"0.6112508",
"0.6103006",
"0.6024639",
"0.593355",
"0.59294456",
"0.592919",
"0.59254825",
"0.58938146",
"0.5890035",
"0.5885623",
"0.58810395",
"0.5847517",
"0.5842918",
"0.5835156",
... | 0.7337895 | 0 |
Returns the Redis key for this Queue. | def key(self):
return self._key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(self):\n\n return self._key",
"def key(self) -> str:\n return self.__key",
"def key(self) -> str:\n\n return self._key",
"def key(self) -> str:\n return self._key",
"def get_key(self) -> int:\n return self.__key",
"def get_key(self):\n return self.key... | [
"0.7401469",
"0.7384712",
"0.7384259",
"0.7383533",
"0.7300395",
"0.72804934",
"0.72804934",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"0.72490466",
"... | 0.711665 | 77 |
Returns whether the current queue is empty. | def is_empty(self):
return self.count == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.91652936",
"0.9143277",
"0.91223687",
"0.91223687",
"0.9116412",
"0.91133803",
"0.91128767",
"0.9053576",
"0.90249777",
"0.89567274",
"0.8909282",
"0.8891891",
"0.8891891",
"0.88844454",
"0.88349694",
"0.8799376",
"0.8749665",
"0.8727868",
"0.86564493",
"0.86208576",
"0.85... | 0.0 | -1 |
Create a `VideoStream` from a local file or file object. | def from_file(cls, f, **kwargs):
if isinstance(f, string_types):
with open(f, 'rb') as f:
return cls(value=f.read(), **kwargs)
else:
if 'format' not in kwargs:
ext = os.path.splitext(f)[1]
if ext:
kwargs['format'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_video_from_path(path: Union[Path, str]) -> videoType:\n\n if isinstance(path, str):\n path = Path(path)\n video_path = path.resolve()\n if video_path.exists():\n print(f\"Video loaded from {video_path}\")\n vid: videoType = cv2.VideoCapture(str(video_path))\n else:\n ... | [
"0.59670144",
"0.5859887",
"0.57195824",
"0.56674504",
"0.55571514",
"0.5512965",
"0.5273307",
"0.52590656",
"0.52576154",
"0.5215024",
"0.5208624",
"0.519247",
"0.51791924",
"0.51656705",
"0.5151133",
"0.51029974",
"0.50901157",
"0.50848985",
"0.5078497",
"0.50682974",
"0.50... | 0.0 | -1 |
Create a `VideoStream` from a url. This wil set the .value trait to the url, and the .format trait to 'url' | def from_url(cls, url, **kwargs):
kwargs = dict(kwargs)
kwargs['format'] = 'url'
# for now we only support ascii
return cls(value=url.encode('ascii'), **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def video_url(cls, url, ytdl, *, loop=None, stream=False):\n loop = loop or asyncio.get_event_loop()\n data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))\n song_list = {'queue': []}\n if 'entries' in data:\n if len(data['entries... | [
"0.6755657",
"0.6333643",
"0.6290966",
"0.6261832",
"0.60623175",
"0.5906185",
"0.5873666",
"0.5844546",
"0.5835066",
"0.57705647",
"0.5766454",
"0.57573324",
"0.5709617",
"0.5690201",
"0.56761956",
"0.5646314",
"0.55947167",
"0.55135083",
"0.5505823",
"0.5454492",
"0.5445291... | 0.646433 | 1 |
Convenience method to get the camera facing the user (often front) | def facing_user(cls, audio=True, **kwargs):
return cls._facing(facing_mode='user', audio=audio, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facing(self) -> Union[int, float]:\n return self.proto.facing",
"def get_front_facing_xz(self):\n yaw_radian = math.radians(self.cur_rotation)\n return cam.step * math.sin(yaw_radian) * math.cos(0), cam.step * math.cos(\n yaw_radian) * math.cos(0)",
"def frontFace(self):\n\n... | [
"0.7166068",
"0.6582872",
"0.6395413",
"0.6336902",
"0.62579405",
"0.62579405",
"0.6120758",
"0.60214937",
"0.5899009",
"0.5888612",
"0.5857484",
"0.58518016",
"0.5819143",
"0.58134824",
"0.57558954",
"0.5748585",
"0.57283956",
"0.5688167",
"0.5617978",
"0.5602293",
"0.556637... | 0.5962353 | 8 |
Convenience method to get the camera facing the environment (often the back) | def facing_environment(cls, audio=True, **kwargs):
return cls._facing(facing_mode='environment', audio=audio, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facing(self) -> Union[int, float]:\n return self.proto.facing",
"def camera(self):\n return self.__camera",
"def get_front_facing_xz(self):\n yaw_radian = math.radians(self.cur_rotation)\n return cam.step * math.sin(yaw_radian) * math.cos(0), cam.step * math.cos(\n ya... | [
"0.67180645",
"0.62675256",
"0.6265583",
"0.6230747",
"0.6157115",
"0.6157115",
"0.6093342",
"0.5989311",
"0.5980771",
"0.5878859",
"0.57914823",
"0.5776531",
"0.56922734",
"0.56531",
"0.5646697",
"0.56258506",
"0.5610292",
"0.5605953",
"0.56028825",
"0.55986726",
"0.55979383... | 0.63619137 | 1 |
Test for the add category endpoint. | def test_category_addition(self):
login = self.autheniticate()
token = json.loads(login.data.decode()).get('token')
res = self.app.post(category_url,
data=json.dumps(self.data),
headers=dict(Authorization="Bearer " + token),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_category(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.login('Bo_theo5@example.com', 'Bo1995')\n self.dashboard()\n rv = self.category('Breakfast')\n self.assertIn(b'Category created', rv.data)",
"def test_create_category(sel... | [
"0.79921836",
"0.7929647",
"0.7892986",
"0.77288604",
"0.7720393",
"0.76150435",
"0.7323187",
"0.7293096",
"0.7274912",
"0.7234198",
"0.72004664",
"0.71933603",
"0.7136637",
"0.71256006",
"0.71096015",
"0.7096102",
"0.7077836",
"0.706584",
"0.7059394",
"0.7050811",
"0.7010757... | 0.755668 | 6 |
Test for the add category endpoint. | def test_category_addition_twice(self):
login = self.autheniticate()
token = json.loads(login.data.decode()).get('token')
self.app.post(category_url,
data=json.dumps(self.data),
headers=dict(Authorization="Bearer " + token),
conte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_category(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.login('Bo_theo5@example.com', 'Bo1995')\n self.dashboard()\n rv = self.category('Breakfast')\n self.assertIn(b'Category created', rv.data)",
"def test_create_category(sel... | [
"0.79921836",
"0.7929647",
"0.7892986",
"0.77288604",
"0.7720393",
"0.76150435",
"0.755668",
"0.7323187",
"0.7293096",
"0.7274912",
"0.7234198",
"0.72004664",
"0.71933603",
"0.7136637",
"0.71256006",
"0.71096015",
"0.7077836",
"0.706584",
"0.7059394",
"0.7050811",
"0.70107573... | 0.7096102 | 16 |
Test for the get all categories endpoint. | def test_get_all_categories(self):
login = self.autheniticate()
token = json.loads(login.data.decode()).get('token')
self.app.post(category_url,
data=json.dumps(self.data),
headers=dict(Authorization="Bearer " + token),
content_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_all_categories(self):\n response = self.client.get('/api/v1/categories',\n headers=self.attendant_headers)\n self.assertEqual(response.status_code, 200)",
"def test_get_categories(self):\n pass",
"def test_get_categories(self):\n\n res ... | [
"0.8822829",
"0.7776198",
"0.7712427",
"0.7673166",
"0.7655295",
"0.7604786",
"0.7553136",
"0.7553136",
"0.7544597",
"0.7469626",
"0.73753995",
"0.7363111",
"0.73149323",
"0.72931814",
"0.7252135",
"0.71793",
"0.7116685",
"0.70142865",
"0.6965827",
"0.69457626",
"0.69248724",... | 0.7888818 | 1 |
Test the add category to a product | def test_add_category_to_product(self):
login = self.autheniticate()
token = json.loads(login.data.decode()).get('token')
self.app.post(product_url,
data=json.dumps(self.product_data),
headers=dict(Authorization="Bearer " + token),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_category(self):\n self.add_success(self.test_data['pants'])",
"def test_create_category(self):\n pass",
"def test_categories_product(self):\n response = self.client.post('api/v1/category/products',\n data=json.dumps(category_product[0]),\n ... | [
"0.79060245",
"0.7761856",
"0.7697818",
"0.7626614",
"0.7547153",
"0.7524319",
"0.7455759",
"0.737539",
"0.73746395",
"0.7297654",
"0.71572566",
"0.7070989",
"0.7018873",
"0.69631386",
"0.69419795",
"0.6910252",
"0.69037026",
"0.68240994",
"0.6819834",
"0.6813745",
"0.6792031... | 0.7915693 | 0 |
Returns a value of the environment variable `EMAIL_NOTIFICATION` that indicates the email address which the notification should be sent to. However, if this variable is not set, its value will be an empty string. Returns string Value of `EMAIL_NOTIFICATION` or `""` | def email_address() -> str:
return os.environ.get("EMAIL_NOTIFICATION", "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notification_sender_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"notification_sender_email\")",
"def notification_sender_email(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"notification_sender_email\")",
"def notification_sender_email(self) -> Optional[pu... | [
"0.68610597",
"0.68302006",
"0.68302006",
"0.6584015",
"0.6077307",
"0.60769844",
"0.60769844",
"0.60136074",
"0.59971035",
"0.5973536",
"0.5947213",
"0.59389174",
"0.59306514",
"0.58929586",
"0.58877474",
"0.587702",
"0.58251476",
"0.5806526",
"0.5779899",
"0.5773934",
"0.57... | 0.8190519 | 0 |
Testing if the first and last month work correctly | def test_datestring_to_timestamp(self):
result = datestring_to_timestamp("01-JAN-1990")
self.assertEqual(result, 631148400.0)
result = datestring_to_timestamp("01-DEC-2000")
self.assertEqual(result, 975625200.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_all_valid_months(self):\n\n for expected, month in enumerate(range(1, 12), 2):\n actual = self.expander.get_next_month(month)\n self.assertEqual(expected, actual)\n self.assertEqual(1, self.expander.get_next_month(12))",
"def test_date_accept_last_month(self):\n ... | [
"0.70776594",
"0.7032643",
"0.7026606",
"0.68901277",
"0.68025976",
"0.670849",
"0.66621387",
"0.6647475",
"0.66433066",
"0.6619552",
"0.6542366",
"0.651044",
"0.6504022",
"0.6488034",
"0.6373668",
"0.6372599",
"0.6369391",
"0.63610286",
"0.63564754",
"0.63404995",
"0.6324705... | 0.0 | -1 |
Get the ID of the AWS account. | def id(self) -> str:
account_id = self.__session.client("sts").get_caller_identity().get("Account")
if account_id:
return account_id
raise ValueError("get_caller_identity did not return Account") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"account_id\")",
"def account_id(self) -> str:\n return pulumi.get(self, \"ac... | [
"0.8006171",
"0.8006171",
"0.8006171",
"0.8006171",
"0.8006171",
"0.8006171",
"0.8006171",
"0.8006171",
"0.79006517",
"0.777924",
"0.777924",
"0.777924",
"0.7687667",
"0.7660363",
"0.7598779",
"0.7594282",
"0.7586716",
"0.75405294",
"0.75405294",
"0.75405294",
"0.75405294",
... | 0.7551465 | 17 |
Get a cached boto3 session. Session creation was moved out of class init to improve performance by only creating the session once it is needed. | def __session(self) -> boto3.Session:
return self.__ctx.get_session() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session() -> Any:\n session = boto3.session.Session()\n return session",
"def boto_session(self) -> Session:\n return boto3.session.Session(\n aws_access_key_id=self.aws_access_key_id,\n aws_secret_access_key=self.aws_secret_access_key,\n aws_session_token=se... | [
"0.7787552",
"0.7555609",
"0.7246328",
"0.72267455",
"0.692728",
"0.69056547",
"0.68886364",
"0.688004",
"0.6869889",
"0.68605",
"0.6838464",
"0.6797435",
"0.6752471",
"0.6739417",
"0.6712267",
"0.6697522",
"0.66697323",
"0.6638824",
"0.66362387",
"0.66306907",
"0.6599582",
... | 0.780452 | 0 |
Test removing business from mission endpoint. | def test_remove_business_from_mission(self):
business = Business.create(**self.business_data)
self.mission.businesses.append(business)
db.session.commit()
with self.client as c:
with c.session_transaction() as sess:
sess['user_id'] = self.user2.id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_mission(self):\n\n self.user2.missions.append(self.mission)\n db.session.commit()\n\n with self.client as c:\n with c.session_transaction() as sess:\n sess['user_id'] = self.user2.id\n\n db.session.add(self.mission)\n\n # test add... | [
"0.66024727",
"0.6407725",
"0.6374858",
"0.63200593",
"0.62530845",
"0.6233027",
"0.62095106",
"0.62039435",
"0.619838",
"0.61550707",
"0.6146772",
"0.61023986",
"0.6082958",
"0.60597646",
"0.6044742",
"0.6042715",
"0.6042265",
"0.6040362",
"0.6037351",
"0.60290754",
"0.60128... | 0.7496795 | 0 |
remove stopwords stem the sentence return a vector (list) of tokens eg. "Hello my name is XY" > ["hello", "name", "XY"] | def stem(self, input_string, train=True):
# extract single words
splits = input_string.split()
stemmed = []
languages = {
"en": "english",
"it": "italian",
"de": "german"
}
stemmer = SnowballStemmer(languages[self.language])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n # convert text to lowercase and remove puctuation\n text = re.sub(r\"[^a-zA-Z0-9]\",\" \",text.lower())\n\n # tokenize the words\n tokens = word_tokenize(text)\n\n #stem and remove stop words\n stemmer = PorterStemmer()\n stop_words = stopwords.words('english')\n\n ste... | [
"0.7934534",
"0.792278",
"0.7905758",
"0.78541726",
"0.7852138",
"0.7807016",
"0.7805899",
"0.7801435",
"0.7738117",
"0.77282095",
"0.76996464",
"0.76912326",
"0.75398785",
"0.7538439",
"0.7505831",
"0.75016314",
"0.74933124",
"0.74930686",
"0.7484944",
"0.7478283",
"0.747346... | 0.0 | -1 |
Test removal of filegrp | def test_remove_file_group0(self):
with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as tempdir:
mets = OcrdMets(filename=join(tempdir, 'mets.xml'))
self.assertEqual(len(mets.file_groups), 17)
self.assertEqual(len(mets.find_all_files()), 35)
# pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_file_group_regex(self):\n with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as tempdir:\n mets = OcrdMets(filename=join(tempdir, 'mets.xml'))\n self.assertEqual(len(mets.file_groups), 17)\n self.assertEqual(len(mets.find_all_files()), 35)\n ... | [
"0.70561343",
"0.697586",
"0.697586",
"0.68204933",
"0.67010784",
"0.659715",
"0.6554693",
"0.65175635",
"0.64872134",
"0.6468802",
"0.6389165",
"0.6326825",
"0.630831",
"0.6269514",
"0.62484145",
"0.6240385",
"0.6240385",
"0.62230587",
"0.6205914",
"0.61878943",
"0.6177738",... | 0.76095444 | 0 |
Test removal of filegrp | def test_remove_file_group_regex(self):
with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as tempdir:
mets = OcrdMets(filename=join(tempdir, 'mets.xml'))
self.assertEqual(len(mets.file_groups), 17)
self.assertEqual(len(mets.find_all_files()), 35)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_file_group0(self):\n with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as tempdir:\n mets = OcrdMets(filename=join(tempdir, 'mets.xml'))\n self.assertEqual(len(mets.file_groups), 17)\n self.assertEqual(len(mets.find_all_files()), 35)\n ... | [
"0.76095444",
"0.697586",
"0.697586",
"0.68204933",
"0.67010784",
"0.659715",
"0.6554693",
"0.65175635",
"0.64872134",
"0.6468802",
"0.6389165",
"0.6326825",
"0.630831",
"0.6269514",
"0.62484145",
"0.6240385",
"0.6240385",
"0.62230587",
"0.6205914",
"0.61878943",
"0.6177738",... | 0.70561343 | 1 |
Test a city warncell. | def test_city():
dwd = DwdWeatherWarningsAPI(WARNCELL_ID_CITY)
assert dwd.data_valid
assert dwd.warncell_id == WARNCELL_ID_CITY
assert dwd.warncell_name == WARNCELL_NAME_CITY
start_time = datetime.datetime.now(
datetime.timezone.utc
) - datetime.timedelta(0, TIME_TOLERANCE)
stop_time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_county():\n dwd = DwdWeatherWarningsAPI(WARNCELL_NAME_COUNTY)\n assert dwd.data_valid\n assert dwd.warncell_id == WARNCELL_ID_COUNTY\n assert dwd.warncell_name == WARNCELL_NAME_COUNTY\n start_time = datetime.datetime.now(\n datetime.timezone.utc\n ) - datetime.timedelta(0, TIME_TO... | [
"0.6379488",
"0.6004741",
"0.5993523",
"0.59910804",
"0.5902552",
"0.58984655",
"0.5870899",
"0.58584625",
"0.58062506",
"0.58018297",
"0.57384914",
"0.57319796",
"0.5722392",
"0.57186",
"0.5700766",
"0.5696919",
"0.56818336",
"0.5637922",
"0.5637922",
"0.5637922",
"0.5614656... | 0.71314543 | 0 |
Test a county warncell. | def test_county():
dwd = DwdWeatherWarningsAPI(WARNCELL_NAME_COUNTY)
assert dwd.data_valid
assert dwd.warncell_id == WARNCELL_ID_COUNTY
assert dwd.warncell_name == WARNCELL_NAME_COUNTY
start_time = datetime.datetime.now(
datetime.timezone.utc
) - datetime.timedelta(0, TIME_TOLERANCE)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_county(self):\n counties = self.geographies.find({ 'geoid': '15009' })\n\n self.assertEqual(counties.count(), 1)\n\n county = counties[0]\n\n self.assertEqual(county['sumlev'], config.SUMLEV_COUNTY)\n self.assertEqual(county['metadata']['NAME'], 'Maui County')\n s... | [
"0.59854764",
"0.57911575",
"0.5563302",
"0.5357074",
"0.53432715",
"0.5331933",
"0.5265566",
"0.52198654",
"0.5151443",
"0.5082058",
"0.5079556",
"0.5063037",
"0.5048087",
"0.5047218",
"0.5046241",
"0.5029172",
"0.50134677",
"0.49901107",
"0.49605715",
"0.49590206",
"0.49568... | 0.7319368 | 0 |
Deserializes string to date. | def deserialize_date(string):
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialize_datetime(string):\n try:\n from dateutil.parser import parse\n return parse(string)\n except ImportError:\n return string",
"def str2date(s):\n return datetime.strptime(s.decode(), \"%Y-%m-%d %H:%M:%S\")",
"def string_to_date(string):\n params = string.s... | [
"0.7276856",
"0.7061473",
"0.6958",
"0.69396937",
"0.6652705",
"0.6593376",
"0.65927553",
"0.6457389",
"0.6425631",
"0.638903",
"0.63701856",
"0.6357189",
"0.6318383",
"0.63119954",
"0.6306552",
"0.62919325",
"0.6289173",
"0.62726253",
"0.62642545",
"0.62425977",
"0.6232906",... | 0.8111336 | 0 |
Deserializes a dict and its elements. | def _deserialize_dict(data, boxed_type):
return {k: _deserialize(v, boxed_type)
for k, v in iteritems(data)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize_map(self, schema, annotated_datum):\n if not isinstance(annotated_datum, dict):\n raise AvroTypeException(schema, annotated_datum)\n deserialize = functools.partial(self._deserialize_data, schema.values)\n return dict((key, deserialize(value)) for key, value in six.... | [
"0.6191342",
"0.6151847",
"0.60153216",
"0.60124713",
"0.60124713",
"0.5980951",
"0.5970036",
"0.5911582",
"0.59015924",
"0.58768755",
"0.58768755",
"0.58768755",
"0.58768755",
"0.58768755",
"0.58768755",
"0.58593833",
"0.58504444",
"0.5807601",
"0.5795291",
"0.571231",
"0.57... | 0.63790333 | 0 |
Get access to a specific named table. Returns a table if it exists. create a new table if it dose not exists | def table(self, name):
if name in self._tables:
return _tables[name]
table = Table(name, self._storage) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_table(name):\n tables = Base.metadata.tables\n table = tables.get(name, None)\n if table is not None:\n return table\n else:\n raise NameError('Unable to locate table: %s' % name)",
"def get_table(self, groupname, tablename):\n self.open_db()\n p = self.get_table... | [
"0.7274775",
"0.7041935",
"0.6897534",
"0.6866357",
"0.66625863",
"0.66405",
"0.66158134",
"0.65355724",
"0.6524038",
"0.65063107",
"0.6495576",
"0.6459291",
"0.62977916",
"0.6297761",
"0.6295989",
"0.6261844",
"0.62587637",
"0.6258028",
"0.6238913",
"0.6176216",
"0.61656964"... | 0.6840572 | 4 |
return name so that is is not in list, by appending _1, _2, ... as necessary up to a max suffix >>> unique_name('foo', ['bar, 'baz']) 'foo' >>> unique_name('foo', ['foo', 'bar, 'baz']) 'foo_1' | def unique_name(name, nlist, max=1000):
out = name
if name in nlist:
for i in range(1, max+1):
out = "%s_%i" % (name, i)
if out not in nlist:
break
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_unique_name(first_letters, count, name, unique_list, suffix=False):\n if suffix:\n while name in unique_list:\n count += 1\n end_count = \"%03d\" % count\n name = name[:-3] + end_count\n else:\n while name in unique_list:\n count += 1\n ... | [
"0.76058364",
"0.74454206",
"0.6999527",
"0.68441147",
"0.6829427",
"0.6794005",
"0.67693126",
"0.66106445",
"0.6438301",
"0.63753724",
"0.6277164",
"0.62155783",
"0.62136793",
"0.6213005",
"0.6173278",
"0.61619556",
"0.6157407",
"0.6139286",
"0.6108692",
"0.6097459",
"0.6091... | 0.8346059 | 0 |
Assert that two arrays have the same shape and similiar values | def assert_allclose(a, b, rtol=1e-5, atol=1e-8):
assert a.shape == b.shape, f"shape mismatch a={a.shape} b={b.shape}"
assert np.allclose(a, b, rtol=rtol, atol=atol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_same_shapes(array1, array2):\n return array1.shape == array2.shape",
"def checkArraysEqual(self, a, b):\n # Modified from GNUplot would be better to have this in some module\n self.checkArrayAttrs(a, b)\n np.testing.assert_array_equal(a, b)\n if len(a.set_arrays) > 1:\n ... | [
"0.8106591",
"0.78643346",
"0.7746001",
"0.74663836",
"0.736612",
"0.7322372",
"0.73153806",
"0.73040456",
"0.72362083",
"0.719494",
"0.7168871",
"0.7146455",
"0.7117838",
"0.7077361",
"0.7033871",
"0.702433",
"0.701847",
"0.7006624",
"0.70027024",
"0.69683844",
"0.6934038",
... | 0.6989695 | 19 |
Represents phasespace positions, i.e. positions and conjugate momenta (velocities). The class can be instantiated with Astropy representation objects (e.g., | def __init__(self, pos, vel=None, frame=None):
if isinstance(pos, coord.Galactocentric):
pos = pos.data
if not isinstance(pos, coord.BaseRepresentation):
# assume Cartesian if not specified
if not hasattr(pos, 'unit'):
pos = pos * u.one
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, position, momentum, mass):\n self.position = position\n self.momentum = momentum\n self.mass = mass",
"def __init__(self, direction, position):\n self.direction = normalize(direction)\n self.position = np.array(position)",
"def position(self):\n return self.atom... | [
"0.6150794",
"0.5937008",
"0.59127337",
"0.5867208",
"0.5774493",
"0.5761982",
"0.5757471",
"0.5679939",
"0.56673616",
"0.5612497",
"0.55976343",
"0.55950487",
"0.5579872",
"0.555176",
"0.55325407",
"0.5507327",
"0.54976237",
"0.5488417",
"0.5478355",
"0.546022",
"0.5452787",... | 0.50538564 | 71 |
This returns a single array containing the phasespace positions. | def w(self, units=None):
if self.ndim == 3:
cart = self.cartesian
else:
cart = self
xyz = cart.xyz
d_xyz = cart.v_xyz
x_unit = xyz.unit
v_unit = d_xyz.unit
if ((units is None or isinstance(units, DimensionlessUnitSystem)) and
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_positions(self):\n\n return np.array([p.position for p in self.particles])",
"def position(self):\n return self.atoms.reshape((1,-1))",
"def positions(self, session):\n positions = session.query(\n Timepoint.position_x,\n Timepoint.position_y,\n Timepoi... | [
"0.7129386",
"0.66548884",
"0.6456949",
"0.6427426",
"0.63030064",
"0.62351894",
"0.6152087",
"0.6118353",
"0.6085959",
"0.59923816",
"0.5980196",
"0.59686345",
"0.5960531",
"0.59527117",
"0.59440416",
"0.5941337",
"0.59383833",
"0.5906271",
"0.58944285",
"0.58807737",
"0.587... | 0.0 | -1 |
applies padding to tensor | def pad(x, padding, fill_value=0):
input_shape = x.shape
output_shape = []
indices = []
for dim, pad in enumerate(padding):
try:
left_pad, right_pad = pad
except TypeError:
left_pad = right_pad = pad
output_shape.append(left_pad + input_shape[dim] + right... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(tensor):\n paddings = tf.constant([[0, 0], [0, 10], [0, 0]])\n out = tf.pad(tensor, paddings, \"CONSTANT\", constant_values=0)\n return out",
"def _fixed_padding(inputs, kernel_size, *args, mode='CONSTANT', **kwargs):\n pad_total = kernel_size - 1\n pad_beg = pad_total // 2\n pad_end = ... | [
"0.745439",
"0.73487943",
"0.7326403",
"0.72777706",
"0.72518533",
"0.72387564",
"0.72365046",
"0.72229475",
"0.71769875",
"0.7151584",
"0.71513814",
"0.7127912",
"0.70841396",
"0.7070666",
"0.70434254",
"0.7025758",
"0.70005286",
"0.69951564",
"0.6989641",
"0.6944507",
"0.69... | 0.7071826 | 13 |
Resets any changes to Postgres settings from previous tests | def pg_reset(pg):
pg.reset_hba()
os.truncate(pg.pgdata / "postgresql.auto.conf", 0)
# If a previous test restarted postgres, it was probably because of some
# config that could only be changed across restarts. To reset those, we'll
# have to restart it again. In other cases a reload should be enoug... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset():\n teardown_db()\n build()",
"def reset_db():\n db.drop_all()\n _init_db()",
"def reset_settings():\n settings = Settings()\n settings.reset()\n settings.save()",
"def pytest_unconfigure(config):\n db = Graph(DEFAULT_DB)\n db.delete_all()",
"def reset_db():\n\n web... | [
"0.70151556",
"0.69217587",
"0.69014245",
"0.6797128",
"0.67886275",
"0.67687696",
"0.6740773",
"0.660811",
"0.65868604",
"0.65727836",
"0.6523126",
"0.64893764",
"0.6422606",
"0.6422606",
"0.6380708",
"0.63777894",
"0.6364942",
"0.6364317",
"0.6364317",
"0.6364317",
"0.63643... | 0.7645209 | 0 |
Sanity check to make sure no users in database have the same email address | def get_duplicate_emails():
UserModel = get_user_model()
users = UserModel.objects.all()
emails_seen = {}
duplicate_emails = []
for user in users:
email = user.email.lower()
if email in emails_seen:
duplicate_emails.append(email)
else:
emails_seen[emai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_unique_email(email):\n if AssociatedEmail.objects.filter(email=email.lower(), is_primary_email=False):\n raise ValidationError(_(\"User with this email already exists.\"),\n code='email_not_unique',)\n if User.objects.filter(email=email.lower()):\n rais... | [
"0.74954545",
"0.7421789",
"0.73467535",
"0.734529",
"0.73353744",
"0.73335373",
"0.7299755",
"0.7292057",
"0.727195",
"0.72315866",
"0.7213775",
"0.7213775",
"0.72100383",
"0.7196136",
"0.7174662",
"0.7147363",
"0.7142157",
"0.7114329",
"0.7080489",
"0.7024529",
"0.7018995",... | 0.0 | -1 |
Builds the aggregated dataset with parameters provided. Also creates metrics calculated from aggregates. | def build_agg_data(self, data, total_subscribers, agg_type, market=None, year_filter=None):
if year_filter:
df = data[data.year == year_filter]
else:
df = data
if market:
df = df[df.market == market]
agg_data = df.groupby([agg_type, 'year']).agg(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_dataset(self):\n filepath = self.filepath\n agg_type = self.agg_type\n year_filter = self.year_filter\n market = self.market\n\n data = self.read_data(filepath, agg_type)\n total_subscribers = self.get_ending_subscribers(data, agg_type, market)\n report = ... | [
"0.71058047",
"0.6233205",
"0.6082422",
"0.5939425",
"0.5912202",
"0.58906823",
"0.5759947",
"0.5727137",
"0.57092893",
"0.5668966",
"0.5666784",
"0.5637544",
"0.56352764",
"0.5609787",
"0.5586512",
"0.5528874",
"0.55191344",
"0.5516299",
"0.5514298",
"0.5446313",
"0.54459363... | 0.5910284 | 5 |
DictStorage specific driver initiation method Returns a DictStorage instance for nodes and edges and a AdjacencyView for adjacency based on the initiated nodes and edges stores. | def init_dictstorage_driver(nodes, edges, data):
node_storage = DictStorage(nodes)
edge_storage = DictStorage(edges)
data_storage = DictStorage(data)
adjacency_storage = AdjacencyView(node_storage, edge_storage)
return node_storage, edge_storage, adjacency_storage, data_storage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __int__(self, storage):\r\n self._storage = storage\r\n self.tables={}",
"def __init__(self):\r\n self.__storage = {}",
"def __init__(self, adjacency={}):\r\n self.d = dict(adjacency)",
"def _init_storage(self):\n if self._ is None:\n self._ = Parameters(self... | [
"0.5923415",
"0.58309376",
"0.58236873",
"0.575227",
"0.56802166",
"0.56111926",
"0.56111926",
"0.56111926",
"0.55947673",
"0.5556095",
"0.555283",
"0.55178404",
"0.55056924",
"0.54922646",
"0.5490295",
"0.54693913",
"0.5469268",
"0.5433592",
"0.5405555",
"0.53943",
"0.539151... | 0.84782666 | 0 |
Implement class __len__ Returns the number of items in the _storage or the selective view on it. | def __len__(self):
if self.is_view:
return len(self._view)
return len(self._storage) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return len(self._get_storage())",
"def __len__(self) -> int:\n return len(self._store)",
"def __len__(self):\n return self._number_of_items",
"def __len__(self, *item_types):\n return self.storage().__len__(*item_types)",
"def __len__(self):\n\t\treturn len(... | [
"0.86143196",
"0.81249774",
"0.8106126",
"0.79613394",
"0.7958065",
"0.7882254",
"0.7880673",
"0.7851766",
"0.7851766",
"0.7810791",
"0.77994174",
"0.77994174",
"0.77994174",
"0.7788584",
"0.7752426",
"0.7752426",
"0.77453506",
"0.77453506",
"0.77417964",
"0.77417964",
"0.774... | 0.8377302 | 1 |
The path to the HMM profiles file in the application data. | def profiles_path(self) -> Path:
return self._config.data_path / "hmm" / "profiles.hmm" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata_path(self):\n profile_path, _ = metadata.get_paths(self.workspace, self.profile)\n return profile_path",
"def profile_directory_path(request, file):\n return directory_path('profile', file)",
"def _get_profiles_dir(self):\n from dbt.config.profile import PROFILES_DIR\n\n ... | [
"0.740797",
"0.7218755",
"0.71007264",
"0.67722124",
"0.6672037",
"0.65033096",
"0.63074213",
"0.6196737",
"0.6196622",
"0.61427075",
"0.6098307",
"0.6066816",
"0.6000531",
"0.5995214",
"0.5993958",
"0.5989575",
"0.5972773",
"0.5966185",
"0.5923179",
"0.59141487",
"0.5909712"... | 0.8648695 | 0 |
Get an HMM resource. | async def get(self, hmm_id: str) -> HMM:
document = await self._mongo.hmm.find_one({"_id": hmm_id})
if document:
return HMM(**document)
raise ResourceNotFoundError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, context, id_):\n try:\n db_resource_mgr_data = self.db_api.get_resource_manager(\n context, id_)\n _resource_mgr_data = _make_response(db_resource_mgr_data)\n\n except exception.NotFound as e:\n raise e\n\n except Exception as e:\n ... | [
"0.5663735",
"0.5387361",
"0.5307969",
"0.5233631",
"0.5225225",
"0.522239",
"0.51962346",
"0.517016",
"0.51533484",
"0.513286",
"0.5109624",
"0.507666",
"0.5030264",
"0.50129753",
"0.50105745",
"0.50037515",
"0.49983552",
"0.49678633",
"0.49656793",
"0.49573606",
"0.4956917"... | 0.77394676 | 0 |
Home page route with the short information about the project | def home():
return render_template('main.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n response.view_title = myconf.get('app.name') + ' Home Page'\n return dict(message='')",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\r\n return render_template(\r\n 'index.html',\r\n titl... | [
"0.7309698",
"0.7307404",
"0.7217872",
"0.7203257",
"0.7201067",
"0.7188825",
"0.7160268",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.712467",
"0.71164614",
"0.7106526",
"0.71055305",
"0.70819813",
"0.70604... | 0.679466 | 91 |
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format | def _convert_to_degress(value):
d = float(value.values[0].num) / float(value.values[0].den)
m = float(value.values[1].num) / float(value.values[1].den)
s = float(value.values[2].num) / float(value.values[2].den)
return d + (m / 60.0) + (s / 3600.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points2float(gpx_track):\n \n points = np.empty([gpx_track.get_points_no(), 2])\n elevation = np.empty([gpx_track.get_points_no(), 1])\n n = 0\n for segment in gpx_track.segments:\n for point in segment.points:\n points[n, 0] = point.longitude\n points[n, 1] = point.... | [
"0.6407143",
"0.6319198",
"0.621633",
"0.6170141",
"0.61541116",
"0.61147827",
"0.6075413",
"0.5995006",
"0.5935889",
"0.5933057",
"0.5843076",
"0.58211493",
"0.5801884",
"0.5726553",
"0.57250273",
"0.5718506",
"0.56938654",
"0.56821233",
"0.56551874",
"0.56551874",
"0.564182... | 0.6223344 | 2 |
Sets the id of this EnginePool. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\... | [
"0.73342097",
"0.7236362",
"0.70390874",
"0.7018616",
"0.69461143",
"0.6829305",
"0.6788985",
"0.6788985",
"0.6788985",
"0.6788985",
"0.6788985",
"0.6787526",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
"0.6776697",
... | 0.0 | -1 |
Sets the name of this EnginePool. | def name(self, name):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_pool_name(self, pool_name):\n if _CNX_POOL_NAME_REGEX.search(pool_name):\n raise AttributeError(f\"Pool name '{pool_name}' contains illegal characters\")\n if len(pool_name) > _CNX_POOL_MAX_NAME_SIZE:\n raise AttributeError(f\"Pool name '{pool_name}' is too long\")\n ... | [
"0.79579395",
"0.7648425",
"0.7648425",
"0.7637344",
"0.7621097",
"0.760083",
"0.7565252",
"0.7553984",
"0.7553984",
"0.7553984",
"0.7553984",
"0.7553984",
"0.748745",
"0.74676555",
"0.74660635",
"0.7425449",
"0.7383316",
"0.7366253",
"0.7314891",
"0.7314891",
"0.73096174",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, EnginePool):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
r""" Renders an image of a `menpo.shape.TexturedTriMesh` or `menpo.shape.ColouredTriMesh` from a barycentric coordinate image pair. Note that the texture is rendered without any lighting model think of this as a piecewise affine warp of the mesh's texture into the image ( with zbuffering). As there is no lighting model... | def rasterize_mesh_from_barycentric_coordinate_images(
mesh, bcoords_image, tri_indices_image
):
# Sample the mesh texture space to find the colors-per pixel
colours = mesh.sample_texture_with_barycentric_coordinates(
bcoords_image.as_vector(keep_channels=True).T, tri_indices_image.as_vector()
)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rasterize_shape_image_from_barycentric_coordinate_images(\n mesh, bcoords_image, tri_indices_image\n):\n # Sample the mesh texture space to find the colors-per pixel\n shape_per_pixel = mesh.project_barycentric_coordinates(\n bcoords_image.as_vector(keep_channels=True).T, tri_indices_image.as_v... | [
"0.6165744",
"0.5703856",
"0.5612595",
"0.5395781",
"0.5266634",
"0.51922673",
"0.5191948",
"0.5161446",
"0.51403636",
"0.50204045",
"0.5014859",
"0.5014683",
"0.48837546",
"0.48741856",
"0.48726642",
"0.48711103",
"0.48567376",
"0.48059133",
"0.47939113",
"0.47831056",
"0.47... | 0.6803361 | 0 |
Retrieve a specific policy information point type | def get(isamAppliance, name, check_mode=False, force=False):
ret_obj = search(isamAppliance, name, check_mode=False, force=False)
id = ret_obj['data']
if id == {}:
logger.info("PIP Type {0} had no match, skipping retrieval.".format(name))
warnings = ["PIP Type {0} had no match, skipping ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_type\")",
"def pol... | [
"0.6683216",
"0.6472881",
"0.64700353",
"0.6351884",
"0.61321765",
"0.6001825",
"0.5999606",
"0.59982014",
"0.5894542",
"0.57975495",
"0.57326937",
"0.57308245",
"0.5687897",
"0.56325066",
"0.5615179",
"0.5594528",
"0.5594528",
"0.55858314",
"0.55858314",
"0.55858314",
"0.552... | 0.0 | -1 |
View decorator that redirects anonymous users to the login page. | def login_required(view):
@functools.wraps(view)
def wrapped_view(**kwargs):
if not google.authorized:
return redirect(url_for('google.login'))
return view(**kwargs)
return wrapped_view | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_required(view):\n\n @functools.wraps(view)\n def wrapped_view(**kwargs):\n if g.user is None:\n return redirect(url_for(\"login\"))\n\n return view(**kwargs)\n\n return wrapped_view",
"def login_required(view):\n\n @functools.wraps(view)\n def wrapped_view(**kwar... | [
"0.77004105",
"0.7692761",
"0.7692761",
"0.7666458",
"0.7587069",
"0.7420861",
"0.7350903",
"0.7307588",
"0.72310424",
"0.7171028",
"0.71178895",
"0.7048241",
"0.7037672",
"0.7037152",
"0.7032739",
"0.70224386",
"0.70209527",
"0.7009933",
"0.7002392",
"0.69853187",
"0.6958924... | 0.0 | -1 |
Checks if there are any current query parameters. | def _query_is_empty(self):
return not self.query._query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arguments_valid(self) -> bool:\n return self.find and self.near and self.max_results >= 1",
"def _check_params(self):\n pass",
"def __checkForEmptyQuery(self):\n empty = True\n for key in self.queries:\n if len(self.queries[key]) > 0:\n empty = False\n... | [
"0.6877821",
"0.6777944",
"0.67242247",
"0.6708931",
"0.670107",
"0.6666464",
"0.65264064",
"0.65253973",
"0.6277048",
"0.62413096",
"0.62140536",
"0.61904377",
"0.61854476",
"0.6158086",
"0.6146813",
"0.6100726",
"0.6080515",
"0.6042326",
"0.6039909",
"0.60153794",
"0.599034... | 0.588822 | 26 |
Calls model.cuda() and moves input(s) to the GPU before forward. | def to_cuda(network):
network.cuda()
network._to_cuda_forward_cache = network.forward
def cuda_forward(x):
return network._to_cuda_forward_cache(x.cuda(non_blocking=True))
network.forward = cuda_forward | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(model: nn.Module, inputs: torch.Tensor, device: torch.device):\n\n model.eval()\n model.to(device)\n\n with torch.no_grad():\n inputs = inputs.to(device)\n return model(inputs)",
"def forward(self, input):\n if isinstance(input.data, torch.cuda.FloatTensor) and \\\n ... | [
"0.71993726",
"0.6810224",
"0.6784514",
"0.6784514",
"0.6730342",
"0.665503",
"0.66264606",
"0.6605767",
"0.6486718",
"0.647614",
"0.644669",
"0.6366767",
"0.6363385",
"0.6358321",
"0.63280445",
"0.62886834",
"0.62791324",
"0.6244983",
"0.6214021",
"0.6194943",
"0.6182245",
... | 0.65838253 | 8 |
Return a 'fixed' version of filename. | def get_fixed_filename(filename):
new_name = ""
for i, char in enumerate(filename):
if i + 1 != len(filename):
previous_character = filename[i - 1]
next_character = filename[i + 1]
if char.islower() and next_character.isupper():
new_name += char + "_"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _safe_filename(filename):\n date = datetime.datetime.utcnow().strftime(\"%Y-%m-%d-%H%M%S\")\n basename, extension = filename.rsplit('.', 1)\n return \"{0}-{1}.{2}\".format(basename, date, extension)",
"def _safe_filename(filename):\n filename = secure_filename(filename)\n date = datetime.datet... | [
"0.7250059",
"0.71424264",
"0.7099398",
"0.70534736",
"0.6940534",
"0.68074816",
"0.6781198",
"0.67568046",
"0.673747",
"0.6724021",
"0.67217356",
"0.6685823",
"0.6665831",
"0.6630088",
"0.661831",
"0.6595872",
"0.658626",
"0.65764874",
"0.6531638",
"0.6502819",
"0.64971834",... | 0.7067578 | 3 |
Instantiate email account with a missing user; raise NotFound. | def test_email_account_operation_with_missing_user(self):
user_id = 'missinguser'
self.assertRaises(error.NotFound, \
SpokeEmailAccount, self.org_name, user_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_no_email(self):\n\n self.portal.portal_properties.site_properties.use_email_as_login = True\n\n self.assertRaises(\n ValueError,\n api.user.create,\n username='chuck', password='secret'\n )",
"def test_email_account_operation_with_missing_org(... | [
"0.69699657",
"0.68819875",
"0.6837033",
"0.67312473",
"0.663104",
"0.6617902",
"0.6596133",
"0.6532918",
"0.6489969",
"0.64667934",
"0.6458306",
"0.6456809",
"0.6455444",
"0.6443411",
"0.6425901",
"0.6383854",
"0.6383854",
"0.6383854",
"0.6383854",
"0.6383854",
"0.6372417",
... | 0.7522062 | 0 |
Input invalid email account; raise InputError. | def test_invalid_email_account_input(self):
acc = SpokeEmailAccount(self.org_name, self.user_id)
email_addr = '*@domain.loc'
self.assertRaises(error.InputError, acc.get, email_addr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email_address_input(self):\n email_addr = '*@domain.loc'\n addr = SpokeEmailAddress(self.org_name, self.user_id)\n self.assertRaises(error.InputError, addr.get, email_addr)",
"def validate_email(self):\n email = input(\"Email: \").strip()\n if email is None or ... | [
"0.7161201",
"0.7048843",
"0.6912678",
"0.6788109",
"0.6781482",
"0.67796594",
"0.65442675",
"0.6523411",
"0.6407673",
"0.6259101",
"0.62421036",
"0.6202552",
"0.6192161",
"0.6160116",
"0.61177427",
"0.6072893",
"0.60425246",
"0.6041711",
"0.60241824",
"0.6010957",
"0.5992504... | 0.78459936 | 0 |
Create an email address on a missing user; raise NotFound. | def test_email_address_operation_with_missing_user(self):
user_id = 'missinguser'
self.assertRaises(error.NotFound, SpokeEmailAddress, self.org_name,
user_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_signup_missing_email(self):\n\n invalid_u = User.signup(None, \"testuser\", \"testpass\", \"Test\", \"User\", None)\n \n uid = 99999\n invalid_u.id = uid\n\n with self.assertRaises(exc.IntegrityError) as context:\n db.session.commit()",
"def test_private_cre... | [
"0.71299",
"0.69036907",
"0.6886628",
"0.68688524",
"0.68075514",
"0.678664",
"0.6773475",
"0.6703725",
"0.66505134",
"0.663288",
"0.6620322",
"0.66169894",
"0.6608755",
"0.66049266",
"0.65792066",
"0.65749305",
"0.6570228",
"0.6566165",
"0.6566165",
"0.6566165",
"0.6566165",... | 0.7100219 | 1 |
Input invalid email address; raise InputError. | def test_invalid_email_address_input(self):
email_addr = '*@domain.loc'
addr = SpokeEmailAddress(self.org_name, self.user_id)
self.assertRaises(error.InputError, addr.get, email_addr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email_account_input(self):\n acc = SpokeEmailAccount(self.org_name, self.user_id)\n email_addr = '*@domain.loc'\n self.assertRaises(error.InputError, acc.get, email_addr)",
"def validate_email(self):\n email = input(\"Email: \").strip()\n if email is None or em... | [
"0.76768327",
"0.71916544",
"0.7117868",
"0.6943647",
"0.6893162",
"0.6812822",
"0.6798628",
"0.67253274",
"0.6632119",
"0.66221124",
"0.66132754",
"0.65533084",
"0.64896375",
"0.6482545",
"0.64584666",
"0.6371436",
"0.6357276",
"0.63412493",
"0.63137716",
"0.6266989",
"0.625... | 0.77535284 | 0 |
Delete a missing email domain; raise NotFound. | def test_delete_missing_email_domain(self):
email_dom = 'missing.domain.loc'
domain = SpokeEmailDomain(self.org_name)
self.assertRaises(error.NotFound, domain.delete, email_dom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_missing_email_address(self):\n email_addr = 'deletemissing@' + self.email_dom\n addr = SpokeEmailAddress(self.org_name, self.user_id)\n self.assertRaises(error.NotFound, addr.delete, email_addr)",
"def test_delete_missing_email_account(self):\n email_addr = 'deletemiss... | [
"0.7401869",
"0.71494025",
"0.7131001",
"0.6370021",
"0.60160357",
"0.5932959",
"0.59293866",
"0.5912277",
"0.5847035",
"0.58199537",
"0.58160776",
"0.57859385",
"0.5751094",
"0.57440805",
"0.5704916",
"0.57034194",
"0.5651695",
"0.5636459",
"0.5622555",
"0.5609453",
"0.56089... | 0.8121705 | 0 |
Input invalid domain name; raise InputError. | def test_invalid_email_domain_input(self):
email_dom = '*.domain.loc'
domain = SpokeEmailDomain(self.org_name)
self.assertRaises(error.InputError, domain.create, email_dom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_error(name):\n\n if len(name) > MAX_NAME_LENGHT:\n raise InputError(description=\"Name cannot be more than 20 characters long\")",
"def ask_for_domain():\n found = False\n\n # Keep asking until a valid domain has been entered by the user\n while not found:\n domain = u\"https:/... | [
"0.66654533",
"0.63370323",
"0.6136611",
"0.6118212",
"0.60468197",
"0.6028643",
"0.6019894",
"0.5991184",
"0.5968507",
"0.5927754",
"0.591728",
"0.59086376",
"0.59086376",
"0.59086376",
"0.5867708",
"0.5820435",
"0.57683015",
"0.575537",
"0.5715708",
"0.5697232",
"0.5691202"... | 0.7235347 | 0 |
Return all collected data points for a given column. | def _get_datapoints(sheet, row, col):
rowc = _FIELDS['cell_value']['datapoints']['row']
# Data can start on two different rows. Try first option and then next row.
if sheet.cell(row + rowc, col).value:
start_row = row + rowc
final_row = row + rowc
else:
start_row = row + (rowc + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_column(self, columnname):\n c_index = self._get_header_index(columnname)\n\n column_data = []\n for row in self.data:\n column_data.append(row[c_index])\n \n return column_data",
"def _get_column_values(self, col: str) -> ndarray:\n dtype, loc = self.... | [
"0.63427573",
"0.63187414",
"0.6277209",
"0.62261003",
"0.62022257",
"0.61248934",
"0.60308",
"0.60047793",
"0.59994596",
"0.59849536",
"0.59543896",
"0.5943522",
"0.5904303",
"0.5852058",
"0.5848643",
"0.57927823",
"0.57646006",
"0.5756187",
"0.572177",
"0.5702031",
"0.56908... | 0.601268 | 7 |
Get the head records of a table or its partition. | def head(self, limit, partition=None, columns=None):
if limit <= 0:
raise ValueError('limit number should >= 0.')
params = {'data': '', 'linenum': limit}
if partition is not None:
if not isinstance(partition, odps_types.PartitionSpec):
partition = odps_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self, limit, columns=None):\n return self.table.head(limit, partition=self.partition_spec, columns=columns)",
"def head(app, args):\n d = util.load(args.db, args.table)\n print('# data shape:', d.shape)\n print(d.head(args.no))",
"def head(self, rows, as_list=False):\n indexes =... | [
"0.6876935",
"0.6870285",
"0.686547",
"0.6782883",
"0.6170176",
"0.5918048",
"0.5910925",
"0.5792704",
"0.57421744",
"0.5700905",
"0.5699855",
"0.56483483",
"0.564688",
"0.5638466",
"0.55826473",
"0.5520958",
"0.5519087",
"0.5518169",
"0.5518169",
"0.54509145",
"0.54396546",
... | 0.7226628 | 0 |
Create a PyODPS DataFrame from this table. | def to_df(self):
from ..df import DataFrame
return DataFrame(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_DataFrame (self):\n return DataFrame(self.table)",
"def get_df(self) -> pd.DataFrame:\n return pd.DataFrame(self.fetchall(), columns=self.headers())",
"def to_df(self):\n from ..df import DataFrame\n\n return DataFrame(self.table).filter_parts(self)",
"def data_frame_creato... | [
"0.80573237",
"0.74013644",
"0.7302773",
"0.7234144",
"0.7213072",
"0.718057",
"0.7098049",
"0.7098049",
"0.7098049",
"0.7098049",
"0.7098049",
"0.7066271",
"0.6944339",
"0.68972045",
"0.6843204",
"0.6842877",
"0.67790866",
"0.67637116",
"0.6738266",
"0.6737045",
"0.67039937"... | 0.7436244 | 1 |
Loads the given JSON file and returns it as dictionary. Arguments | def json_load(path):
with open(path) as f:
dictionary = json.load(f)
return dictionary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dictionary",
"def load_json(filename: str) -> Dict:\n \n with open(filename, 'r') as json_file:\n return json.load(json_file)",
... | [
"0.8326856",
"0.8317554",
"0.81788",
"0.81183165",
"0.807707",
"0.80307496",
"0.8020538",
"0.7997242",
"0.7996748",
"0.7983331",
"0.7953047",
"0.79315734",
"0.792999",
"0.7908006",
"0.7882883",
"0.78685904",
"0.7860988",
"0.7860455",
"0.78478134",
"0.784523",
"0.7844137",
"... | 0.8173456 | 3 |
A wrapper around `tf.layers.Conv2D`. | def Conv2D(
inputs,
filters,
kernel_size,
strides=(1, 1),
padding='same',
data_format='channels_last',
dilation_rate=(1, 1),
activation=None,
use_bias=True,
kernel_initializer=None,
bias_initializer=tf.zeros_initializer(),
k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv2d(self, x, W):\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv(in_channels, out_channels, kernel_size, stride=1, padding=0):\n weight = weight_variable()\n return nn.Conv2d(in_channels, out_channels,\n kernel_size=kernel_size, stride=stride... | [
"0.75853294",
"0.758357",
"0.7580159",
"0.75793046",
"0.7509184",
"0.74605453",
"0.7409277",
"0.7388107",
"0.7388107",
"0.73704934",
"0.73333544",
"0.7325948",
"0.7325948",
"0.7325948",
"0.7325948",
"0.73130095",
"0.72797036",
"0.72749966",
"0.72436917",
"0.7218968",
"0.72132... | 0.0 | -1 |
A wrapper around `tf.layers.Conv2DTranspose`. | def Conv2DTranspose(
inputs,
filters,
kernel_size,
strides=(1, 1),
padding='same',
data_format='channels_last',
activation=None,
use_bias=True,
kernel_initializer=None,
bias_initializer=tf.zeros_initializer(),
kernel_regularizer=Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv2x2t(in_planes, out_planes, stride=1):\n return nn.ConvTranspose2d(in_planes, out_planes, kernel_size=2, stride=stride)",
"def _conv2d_transpose_block(in_f, out_f, *args, **kwargs):\n return nn.Sequential(\n nn.ConvTranspose2d(in_f, out_f, *args, **kwargs),\n nn.BatchNorm2d(out_f),\n ... | [
"0.76954085",
"0.75244975",
"0.748299",
"0.717986",
"0.7085278",
"0.70139813",
"0.6992246",
"0.6989254",
"0.68859583",
"0.6884191",
"0.6848078",
"0.6818578",
"0.67341393",
"0.67196554",
"0.6707424",
"0.6646795",
"0.6641846",
"0.6606147",
"0.65925723",
"0.6581614",
"0.6554959"... | 0.6812937 | 12 |
Use tf.image.resize_images to resize feature map. We have to do some transposing first before using image resize if the data_format is 'channels_first', because resize_images only accept 'channels_last'. | def ResizeImages(
images,
size,
method=tf.image.ResizeMethod.BILINEAR,
align_corners=True,
data_format='channels_last'):
l = images
if data_format == 'channels_first':
l = tf.transpose(l, [0,2,3,1])
l = tf.image.resize_images(l, size, method, align_corners)
if data_format == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_resize_images(self, img_name, label_name):\n image_string = tf.read_file(img_name)\n image_decoded = tf.image.decode_jpeg(image_string, channels=3)\n image_resized = tf.image.resize_images(image_decoded, [self.img_h, self.img_w])\n image_resized /= 255\n b, g, r = tf.... | [
"0.68802714",
"0.6650436",
"0.64357024",
"0.6404168",
"0.6353694",
"0.6343838",
"0.6333304",
"0.63139033",
"0.62597877",
"0.6253945",
"0.6248685",
"0.62017095",
"0.6201633",
"0.61932874",
"0.61765873",
"0.61613894",
"0.61222345",
"0.60553116",
"0.6032682",
"0.60323936",
"0.59... | 0.6247504 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.