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 |
|---|---|---|---|---|---|---|
Get a list of all variables used in this expression. | def get_all_variables(self):
out = []
for i in self.items:
out += i.get_all_variables()
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_... | [
"0.80978125",
"0.7943349",
"0.79398817",
"0.7904174",
"0.7858665",
"0.77603346",
"0.7740691",
"0.771654",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.74525255",
"0.74407166",
"0.74282... | 0.7729506 | 7 |
Get a list of all variables used in this expression. | def get_all_variables(self):
out = []
for i in self.items:
out += i.get_all_variables()
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_... | [
"0.80978125",
"0.7943349",
"0.79398817",
"0.7904174",
"0.7858665",
"0.77603346",
"0.7740691",
"0.771654",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.74525255",
"0.74407166",
"0.74282... | 0.7729506 | 9 |
Get a list of all variables used in this expression. | def get_all_variables(self):
out = []
for i in self.items:
out += i.get_all_variables()
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_... | [
"0.80978125",
"0.7943349",
"0.79398817",
"0.7904174",
"0.7858665",
"0.77603346",
"0.7740691",
"0.771654",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.74525255",
"0.74407166",
"0.74282... | 0.7729506 | 8 |
Get a list of all variables used in this expression. | def get_all_variables(self):
return self.item.get_all_variables() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_names(self):\n return self.project.get_variable_names() + self.design.get... | [
"0.80978125",
"0.79398817",
"0.7904174",
"0.7858665",
"0.77603346",
"0.7740691",
"0.7729506",
"0.7729506",
"0.7729506",
"0.771654",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.7452525... | 0.7943349 | 1 |
Get a list of all variables used in this expression. | def get_all_variables(self):
return [self.item] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_... | [
"0.80978125",
"0.7943349",
"0.79398817",
"0.7904174",
"0.7858665",
"0.7740691",
"0.7729506",
"0.7729506",
"0.7729506",
"0.771654",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.74525255... | 0.77603346 | 5 |
Get a list of all variables used in this expression. | def get_all_variables(self):
return self.start.get_all_variables() + self.end.get_all_variables() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_variables(self):\n return []",
"def get_all_variables(self):\n return self.item.get_all_variables()",
"def variables(self):\n return [term.variable for term in self.terms]",
"def variables(self):\n return {u for u in self if u.type == 'var'}",
"def get_all_variables_... | [
"0.80978125",
"0.7943349",
"0.79398817",
"0.7904174",
"0.7858665",
"0.77603346",
"0.7740691",
"0.7729506",
"0.7729506",
"0.7729506",
"0.7668793",
"0.76653355",
"0.766425",
"0.7626891",
"0.76187885",
"0.7537116",
"0.75356245",
"0.75185627",
"0.7511451",
"0.74843293",
"0.745252... | 0.771654 | 10 |
Returns the transform object associated with the volumetric structure which is a general description of the mapping from the values to the world space. Returns | def get_transform(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera_to_object_transform(self):\n # form the full object to camera transform\n T_stp_camera = self.stp_to_camera_transform()\n T_obj_stp = self.object_to_stp_transform()\n T_obj_camera = T_stp_camera.dot(T_obj_stp)\n return T_obj_camera",
"def get_transform(self, map_from... | [
"0.70834625",
"0.67068064",
"0.6633441",
"0.6492114",
"0.64615107",
"0.6367176",
"0.6365252",
"0.6336638",
"0.6329942",
"0.6305936",
"0.63031137",
"0.6285249",
"0.6256497",
"0.6220868",
"0.61806136",
"0.61158156",
"0.6079321",
"0.60720915",
"0.60481066",
"0.6044877",
"0.60359... | 0.6404744 | 5 |
Test compose different dimension exception | def test_compose_except(self):
self.assertRaises(QiskitError, Chi(np.eye(4)).compose, Chi(np.eye(16)))
self.assertRaises(QiskitError, Chi(np.eye(4)).compose, 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__tuple_raise_dimension_error(N):\n dummy_kernel_size = None\n\n with pytest.raises(ValueError):\n utils._tuple(dummy_kernel_size, N)",
"def test_ndim_fail():\n lons = lats = np.array([0]).reshape(-1, 1, 1, 1)\n emsg = \"Require at most 3-D\"\n with pytest.raises(ValueError, match=e... | [
"0.6707328",
"0.6698565",
"0.66573185",
"0.6655831",
"0.6642506",
"0.65969753",
"0.65427613",
"0.65318185",
"0.6505272",
"0.6463453",
"0.64556426",
"0.64512056",
"0.64505684",
"0.6423707",
"0.6422534",
"0.6403702",
"0.63876843",
"0.6348737",
"0.63224447",
"0.6279241",
"0.6238... | 0.67099845 | 0 |
Test subtract method raises exceptions. | def test_subtract_except(self):
chan1 = Chi(self.chiI)
chan2 = Chi(np.eye(16))
self.assertRaises(QiskitError, chan1.subtract, chan2)
self.assertRaises(QiskitError, chan1.subtract, 5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtract(self):\n self.assertEqual(work_file.subtract(10, 5), 5)\n self.assertEqual(work_file.subtract(-1, 1), -2)\n self.assertEqual(work_file.subtract(-1, -1), 0)",
"def test_subtract_zero_arg(self):\n try:\n self.assertEqual(subtract(0, -6), 7)\n except E... | [
"0.8543303",
"0.84343976",
"0.81551117",
"0.80975556",
"0.79989403",
"0.79771197",
"0.7929341",
"0.7928706",
"0.7911542",
"0.78966004",
"0.7886877",
"0.7886877",
"0.77732474",
"0.76943123",
"0.7660907",
"0.7506185",
"0.7497504",
"0.7485219",
"0.7481085",
"0.7476953",
"0.74769... | 0.6984619 | 33 |
Update the threshold that is used to maintain a minimum stepsize. | def updateThreshold(self, t):
budget = self.budget
self.threshold = self.init_threshold * self.diameter * ((budget-t) / self.budget)**self.decay_factor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass",
"def _minimum_size_changed(self):\n self.update_minimum_size()",
"def threshold(self,thresholdValue):\n # TO DO\n pass",
"def updateThresholdValues (self, DoubleSlider, Node, ThMax ):\n ... | [
"0.6310479",
"0.62077695",
"0.6173157",
"0.61484355",
"0.6143146",
"0.61056507",
"0.603298",
"0.60261154",
"0.6012084",
"0.5954494",
"0.59117323",
"0.5838112",
"0.5838112",
"0.5830882",
"0.5830882",
"0.5830882",
"0.5830882",
"0.5830882",
"0.5730077",
"0.57173675",
"0.5716788"... | 0.67875904 | 0 |
Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player. | def __init__(self, player):
self.wall_list = pygame.sprite.Group()
self.enemy_list = pygame.sprite.Group()
self.sludge = pygame.sprite.Group()
self.consumeable = pygame.sprite.Group()
self.can_climb = pygame.sprite.Group()
self.player = player
self.spore_list = [D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, player):\n\t\tself.player = player",
"def __init__(self, player):\n self.player = player",
"def __init__(self, *args, **kwargs):\n super(Player, self).__init__(*args, **kwargs)",
"def __init__(self, player):\n self.platform_list = pygame.sprite.Group()\n self.en... | [
"0.77233726",
"0.75955576",
"0.70801985",
"0.6983557",
"0.69656616",
"0.6910456",
"0.6891195",
"0.68370837",
"0.68368727",
"0.67917955",
"0.6765255",
"0.6742759",
"0.6730675",
"0.6727625",
"0.6715831",
"0.66318893",
"0.65596664",
"0.6551567",
"0.65365624",
"0.6518062",
"0.648... | 0.63516337 | 30 |
Get Iam Policy request. | def GetIamPolicy(asset_ref):
get_iam_policy_req = dataplex_api.GetMessageModule(
).DataplexProjectsLocationsLakesZonesAssetsGetIamPolicyRequest(
resource=asset_ref.RelativeName())
return dataplex_api.GetClientInstance(
).projects_locations_lakes_zones_assets.GetIamPolicy(get_iam_policy_req) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_iam_policy(\n self,\n ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:\n # Generate a \"stub function\" on-the-fly which will actually make\n # the request.\n # gRPC handles serialization and deserialization, so we just need\n # to pass in the fu... | [
"0.70523757",
"0.70523757",
"0.70403415",
"0.667092",
"0.66670644",
"0.66670644",
"0.66670644",
"0.66670644",
"0.66670644",
"0.66670644",
"0.6593553",
"0.64680094",
"0.644721",
"0.644721",
"0.6422086",
"0.6422086",
"0.6422086",
"0.63572264",
"0.63489354",
"0.63489354",
"0.633... | 0.0 | -1 |
Add IAM policy binding request. | def AddIamPolicyBinding(asset_ref, member, role):
policy = GetIamPolicy(asset_ref)
iam_util.AddBindingToIamPolicy(
dataplex_api.GetMessageModule().GoogleIamV1Binding, policy, member, role)
return SetIamPolicy(asset_ref, policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_policy_binding(self, body, **kwargs):\n\n all_params = ['body', 'pretty']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n raise TypeError(\n \"Got a... | [
"0.62478286",
"0.62162316",
"0.617626",
"0.61569417",
"0.61168265",
"0.5954912",
"0.59200424",
"0.5878047",
"0.58152145",
"0.58152145",
"0.5776248",
"0.5659078",
"0.5642616",
"0.5622709",
"0.55267304",
"0.5494093",
"0.5457817",
"0.5449911",
"0.5415036",
"0.5352856",
"0.533413... | 0.6528228 | 0 |
Compute the angular mean dispersion (circular mean) in degrees within rolling temporal windows. | def rolling_mean_dispersion(
data: np.ndarray, time_windows: np.ndarray, fps: int
) -> np.ndarray:
results = np.full((data.shape[0], time_windows.shape[0]), -1)
for time_window in prange(time_windows.shape[0]):
jump_frms = int(time_windows[time_window] * fps)
for cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circular_mean(angles):\n\n # Convert the angles to cartesian points on the unit circle\n cartesian = np.column_stack((np.cos(angles), np.sin(angles)))\n #breakpoint()\n\n # Find the mean of the cartesian coordinates\n mean_cart = np.mean(cartesian, axis=0)\n\n # Find the angle of the mean poi... | [
"0.6310264",
"0.6262659",
"0.61605465",
"0.5904571",
"0.58919764",
"0.5838617",
"0.58296263",
"0.58276665",
"0.5784816",
"0.5784243",
"0.57602656",
"0.57315356",
"0.5685624",
"0.566589",
"0.5662045",
"0.5644741",
"0.5597444",
"0.5586954",
"0.5564045",
"0.5557412",
"0.5544385"... | 0.6963929 | 0 |
Gives the derivative of X with respect to x = M. To construct this derivative, we use a monetary shock. | def GetdXdx(Md,X):
assert X.shape[1] == 1
Xa = X.copy()
Xb = X.copy()
eps = -0.005
Xb[iMP] = Xb[iMP] + eps
Xa[Md.nX:Md.nXY] = Md.F(Xa[Md.interpstates])
Xa[Md.nXY:] = Md.Static(Xa)
Xb[Md.nX:Md.nXY] = Md.F(Xb[Md.interpstates])
Xb[Md.nXY:] = Md.Static(Xb)
return (Xb-Xa)/(Xb[iM]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff(self, x, order=1):\n \n if 'csaps' in str(self.sm_.__class__):\n derivative = self.sm_(x,nu=order)\n else:\n if order == 1:\n scalars = self.sm_.coef_\n else:\n scalars = 0\n derivative = np.ones(x.shape[0])*sca... | [
"0.6499606",
"0.6490313",
"0.6368689",
"0.63111013",
"0.6245818",
"0.6152299",
"0.6127913",
"0.60921854",
"0.6060426",
"0.6022576",
"0.60177994",
"0.5936981",
"0.5907083",
"0.59057456",
"0.59057456",
"0.58652425",
"0.58338374",
"0.58258325",
"0.57984245",
"0.5792808",
"0.5749... | 0.65564746 | 0 |
r""" Assume basis is orthonormal Assume first coefficient is the coefficient of the constant basis. Remove this assumption by extracting array index of constant term from indices Returns | def get_main_and_total_effect_indices_from_pce(coefficients,indices):
num_vars = indices.shape[0]
num_terms,num_qoi = coefficients.shape
assert num_terms==indices.shape[1]
main_effects = np.zeros((num_vars,num_qoi), np.double )
total_effects = np.zeros((num_vars,num_qoi), np.double )
varian... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recf_standard_poly(basetensor, ind, x):\n return basetensor[ind.all+ind.getPreceding(1)] * \\\n basetensor[ind.all+ind.getSpecial()]",
"def __basis0(self, xi):\n return np.where(np.all([self.knot_vector[:-1] <= xi,\n xi < self.knot_vector[1:]], axis=0), 1.0, 0.... | [
"0.5880671",
"0.5801723",
"0.57766336",
"0.57378864",
"0.5707526",
"0.567324",
"0.55965847",
"0.55815876",
"0.5559865",
"0.55331016",
"0.54956263",
"0.54732686",
"0.54708564",
"0.5458683",
"0.54552466",
"0.542093",
"0.53867656",
"0.538055",
"0.53787243",
"0.5372906",
"0.53650... | 0.5424754 | 15 |
r"""Rate (/s) counter for snmpqosqos_packets_dropped. | def snmpqosqos_packets_droppedrate(self) :
try :
return self._snmpqosqos_packets_droppedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_packets_receivedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_packets_receivedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_packets_bypassedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_packets_bypassedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def s... | [
"0.7286956",
"0.7191867",
"0.6688163",
"0.6614529",
"0.6593207",
"0.65640306",
"0.6485627",
"0.6413397",
"0.6364895",
"0.6363683",
"0.63273954",
"0.62655324",
"0.62379193",
"0.6200901",
"0.6195245",
"0.6182774",
"0.61385524",
"0.61044085",
"0.6064798",
"0.60136294",
"0.598895... | 0.8551492 | 0 |
r"""Rate (/s) counter for snmpqosqos_session_recycle_failure. | def snmpqosqos_session_recycle_failurerate(self) :
try :
return self._snmpqosqos_session_recycle_failurerate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_recycle_failed_sessionrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_recycle_failed_sessionrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_recycle_failed_backlograte(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_recycle_failed_backlograte\n\t\texcept Exception as e:\n... | [
"0.8524226",
"0.76388043",
"0.7359843",
"0.7290599",
"0.7272093",
"0.7129601",
"0.6864387",
"0.6815921",
"0.671674",
"0.67049193",
"0.6703932",
"0.6689132",
"0.6597033",
"0.6531689",
"0.653054",
"0.6494668",
"0.6347303",
"0.63375187",
"0.6314215",
"0.63141274",
"0.63118356",
... | 0.7644068 | 1 |
r"""Rate (/s) counter for snmpqosqos_error_api_ses_invalidpcb. | def snmpqosqos_error_api_ses_invalidpcbrate(self) :
try :
return self._snmpqosqos_error_api_ses_invalidpcbrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_api_ses_notreadyrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_notreadyrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_api_ses_delrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_delrate\n\t\texcept Exception as e:\n\t\t\trais... | [
"0.7713384",
"0.7499282",
"0.7353236",
"0.73108083",
"0.71489924",
"0.70570755",
"0.7052227",
"0.69479406",
"0.68740344",
"0.680726",
"0.6730087",
"0.6621808",
"0.66044676",
"0.64353967",
"0.6340968",
"0.6218662",
"0.6130596",
"0.60919964",
"0.60747814",
"0.6041276",
"0.60190... | 0.70129395 | 7 |
r"""Rate (/s) counter for snmpqosqos_error_create_action_failed. | def snmpqosqos_error_create_action_failedrate(self) :
try :
return self._snmpqosqos_error_create_action_failedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_modify_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_modify_action_failedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_create_policy_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_create_policy_failedrate\n\t\texcept E... | [
"0.7811561",
"0.75555265",
"0.7426393",
"0.7311139",
"0.71263903",
"0.6823778",
"0.6753163",
"0.6749375",
"0.6631528",
"0.64939284",
"0.64633626",
"0.6438536",
"0.6350528",
"0.63099945",
"0.6192494",
"0.61509234",
"0.6145909",
"0.6056088",
"0.60402185",
"0.60378426",
"0.59734... | 0.83103323 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_create_policy_failed. | def snmpqosqos_error_create_policy_failedrate(self) :
try :
return self._snmpqosqos_error_create_policy_failedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_create_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_create_action_failedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_libqos_api_failuresrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_libqos_api_failuresrate\n\t\texcept Exc... | [
"0.7671828",
"0.74659586",
"0.74198437",
"0.73809165",
"0.71918",
"0.687996",
"0.67553145",
"0.65671927",
"0.65642506",
"0.65613943",
"0.64792514",
"0.643909",
"0.6437164",
"0.6413665",
"0.624404",
"0.6223264",
"0.62097156",
"0.613779",
"0.60962695",
"0.6090114",
"0.60513484"... | 0.8282646 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_api_ses_del. | def snmpqosqos_error_api_ses_delrate(self) :
try :
return self._snmpqosqos_error_api_ses_delrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_api_ses_del(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_del\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_remove_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_remove_action_failedrate\n\t\texcept Exception as e:\n\t\t\trais... | [
"0.7500909",
"0.7376008",
"0.72187245",
"0.71497154",
"0.7149441",
"0.7101706",
"0.7045971",
"0.69036466",
"0.689447",
"0.6759696",
"0.6730626",
"0.6682966",
"0.65616864",
"0.6513153",
"0.6419608",
"0.6324363",
"0.62629634",
"0.6239507",
"0.614929",
"0.61485535",
"0.61324877"... | 0.85873413 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_remove_action_failed. | def snmpqosqos_error_remove_action_failedrate(self) :
try :
return self._snmpqosqos_error_remove_action_failedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_modify_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_modify_action_failedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_remove_policy_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_remove_policy_failedrate\n\t\texcept E... | [
"0.7699618",
"0.767356",
"0.7193298",
"0.71799517",
"0.71702516",
"0.708217",
"0.6805812",
"0.6753135",
"0.6727035",
"0.6520482",
"0.65200025",
"0.64926404",
"0.6424991",
"0.6327153",
"0.63178474",
"0.6262945",
"0.619134",
"0.61879855",
"0.6172559",
"0.6171245",
"0.6077923",
... | 0.83561087 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_api_ses_rem_other. | def snmpqosqos_error_api_ses_rem_otherrate(self) :
try :
return self._snmpqosqos_error_api_ses_rem_otherrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_api_ses_rem_other(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_rem_other\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_api_ses_delrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_delrate\n\t\texcept Exception as e:\n\t\t\traise e",
... | [
"0.7299262",
"0.71162575",
"0.6897665",
"0.6716733",
"0.6693406",
"0.6681297",
"0.6608652",
"0.65422493",
"0.65092754",
"0.64496523",
"0.6254512",
"0.623182",
"0.6210969",
"0.6049875",
"0.59940404",
"0.59835285",
"0.5979369",
"0.5943469",
"0.5942942",
"0.589408",
"0.5884096",... | 0.6794591 | 3 |
r"""Rate (/s) counter for snmpqosqos_sch_peer_msgs. | def snmpqosqos_sch_peer_msgsrate(self) :
try :
return self._snmpqosqos_sch_peer_msgsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_sch_session_connsrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_session_connsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_sch_links_updatedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_links_updatedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"d... | [
"0.7004913",
"0.6767166",
"0.6745489",
"0.66982174",
"0.6651338",
"0.6595485",
"0.64905494",
"0.6482608",
"0.6305257",
"0.62954825",
"0.6251399",
"0.6223874",
"0.6212787",
"0.61890745",
"0.605054",
"0.601168",
"0.5998371",
"0.59902513",
"0.5938576",
"0.5936261",
"0.5897637",
... | 0.8401591 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_cli_unknown. | def snmpqosqos_error_cli_unknownrate(self) :
try :
return self._snmpqosqos_error_cli_unknownrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_libqos_api_failuresrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_libqos_api_failuresrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_api_ses_notreadyrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_notreadyrate\n\t\texcept Exception a... | [
"0.70610523",
"0.67732805",
"0.6702273",
"0.66193336",
"0.6567103",
"0.64912593",
"0.64159334",
"0.63883984",
"0.6350264",
"0.6348433",
"0.6304386",
"0.6274934",
"0.6099984",
"0.6088802",
"0.5989531",
"0.59751844",
"0.5973026",
"0.5937526",
"0.5851643",
"0.5739578",
"0.572516... | 0.8089155 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_remove_policy_failed. | def snmpqosqos_error_remove_policy_failedrate(self) :
try :
return self._snmpqosqos_error_remove_policy_failedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_remove_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_remove_action_failedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_modify_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_modify_action_failedrate\n\t\texcept E... | [
"0.79074883",
"0.734597",
"0.728128",
"0.7242667",
"0.72302955",
"0.7209305",
"0.683424",
"0.6800642",
"0.67437935",
"0.6605925",
"0.6535829",
"0.6506101",
"0.64577734",
"0.6426275",
"0.6411705",
"0.63831234",
"0.6317246",
"0.6306756",
"0.62161016",
"0.6195891",
"0.6191892",
... | 0.82989246 | 0 |
r"""Rate (/s) counter for snmpqosqos_sch_session_conns_removed. | def snmpqosqos_sch_session_conns_removedrate(self) :
try :
return self._snmpqosqos_sch_session_conns_removedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_sch_sessions_deletedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_sessions_deletedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_sch_session_connsrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_session_connsrate\n\t\texcept Exception as e:\n\t\t\traise e"... | [
"0.7588694",
"0.7421742",
"0.721197",
"0.67902607",
"0.66627216",
"0.6618756",
"0.65080243",
"0.6503047",
"0.6436936",
"0.63082063",
"0.63033795",
"0.6254867",
"0.62029964",
"0.61891526",
"0.61705494",
"0.6163691",
"0.61502177",
"0.6149789",
"0.61386496",
"0.604491",
"0.60296... | 0.8773861 | 0 |
r"""Rate (/s) counter for snmpqosqos_flow_recycles. | def snmpqosqos_flow_recyclesrate(self) :
try :
return self._snmpqosqos_flow_recyclesrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_sch_links_createdrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_links_createdrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_sch_links_updatedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_links_updatedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"d... | [
"0.6637304",
"0.66365385",
"0.6502883",
"0.6488537",
"0.6430619",
"0.6423771",
"0.63754267",
"0.63456404",
"0.6310266",
"0.62749636",
"0.62459975",
"0.622104",
"0.6188316",
"0.6159773",
"0.61069846",
"0.61012113",
"0.60811865",
"0.6043905",
"0.6016351",
"0.59970784",
"0.59348... | 0.83243144 | 0 |
r"""Rate (/s) counter for snmpqosqos_policy_reeval. | def snmpqosqos_policy_reevalrate(self) :
try :
return self._snmpqosqos_policy_reevalrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_flow_recyclesrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_flow_recyclesrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_sch_sdrr_nodesrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_sdrr_nodesrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_... | [
"0.70911425",
"0.66635823",
"0.66515905",
"0.6466247",
"0.6442681",
"0.6356864",
"0.6353556",
"0.6336323",
"0.63201284",
"0.62508607",
"0.62326664",
"0.6214923",
"0.61899626",
"0.61815476",
"0.6131893",
"0.6091616",
"0.6005812",
"0.6002035",
"0.59145904",
"0.59038264",
"0.590... | 0.83304065 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_api_ses_notready. | def snmpqosqos_error_api_ses_notreadyrate(self) :
try :
return self._snmpqosqos_error_api_ses_notreadyrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_api_ses_delrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_delrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_libqos_api_failuresrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_libqos_api_failuresrate\n\t\texcept Exception as e:\n\t\t... | [
"0.73602164",
"0.7147599",
"0.70413965",
"0.70216656",
"0.69907033",
"0.69522166",
"0.6431358",
"0.64138323",
"0.6322593",
"0.6283399",
"0.6259915",
"0.6254148",
"0.6238311",
"0.61899865",
"0.6071316",
"0.6030395",
"0.60276574",
"0.60194665",
"0.6018445",
"0.59694016",
"0.595... | 0.8283269 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_ipc. | def snmpqosqos_error_ipcrate(self) :
try :
return self._snmpqosqos_error_ipcrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_libqos_api_failuresrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_libqos_api_failuresrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_modify_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_modify_action_failedrate\n\t\texcept Exc... | [
"0.71528363",
"0.6988104",
"0.6828804",
"0.66507965",
"0.66326296",
"0.6627339",
"0.6593462",
"0.6564627",
"0.65629447",
"0.6517099",
"0.6448969",
"0.64383364",
"0.6402898",
"0.6375774",
"0.63106585",
"0.628205",
"0.62608963",
"0.6210926",
"0.6190698",
"0.6185906",
"0.6150741... | 0.6244157 | 17 |
r"""Rate (/s) counter for snmpqosqos_error_modify_action_failed. | def snmpqosqos_error_modify_action_failedrate(self) :
try :
return self._snmpqosqos_error_modify_action_failedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_remove_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_remove_action_failedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_error_create_action_failedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_create_action_failedrate\n\t\texcept E... | [
"0.77292246",
"0.759309",
"0.74054444",
"0.72246885",
"0.71408576",
"0.7040961",
"0.6948194",
"0.67986596",
"0.67285997",
"0.6711979",
"0.66329205",
"0.6622457",
"0.6611191",
"0.63838834",
"0.6373918",
"0.63624483",
"0.6240896",
"0.6180586",
"0.60557204",
"0.60182726",
"0.601... | 0.8546603 | 0 |
r"""Rate (/s) counter for snmpqosqos_error_api_ses_rem_notinsession. | def snmpqosqos_error_api_ses_rem_notinsessionrate(self) :
try :
return self._snmpqosqos_error_api_ses_rem_notinsessionrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_error_api_ses_add_insessionrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_error_api_ses_add_insessionrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_recycle_failed_sessionrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_recycle_failed_sessionrate\n\t\texcept Excepti... | [
"0.77530974",
"0.7582664",
"0.7554708",
"0.7372263",
"0.72658277",
"0.6974625",
"0.6745412",
"0.6676638",
"0.6590075",
"0.65465957",
"0.65318346",
"0.6520597",
"0.6379898",
"0.63713187",
"0.6356005",
"0.6334228",
"0.62989855",
"0.62452716",
"0.61935306",
"0.6139404",
"0.61298... | 0.83078885 | 0 |
r"""Rate (/s) counter for snmpqosqos_sch_links_updated. | def snmpqosqos_sch_links_updatedrate(self) :
try :
return self._snmpqosqos_sch_links_updatedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_sch_links_createdrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_links_createdrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_sch_links_deletedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_sch_links_deletedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"d... | [
"0.7615236",
"0.70794696",
"0.6504473",
"0.6330261",
"0.61369073",
"0.60720164",
"0.6060706",
"0.6015504",
"0.59758335",
"0.59678507",
"0.5944543",
"0.5845514",
"0.5792466",
"0.578589",
"0.5773041",
"0.57482815",
"0.57103086",
"0.56824815",
"0.5673855",
"0.5659632",
"0.564319... | 0.86042523 | 0 |
r"""Rate (/s) counter for snmpqosqos_packets_bypassed. | def snmpqosqos_packets_bypassedrate(self) :
try :
return self._snmpqosqos_packets_bypassedrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snmpqosqos_packets_droppedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_packets_droppedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snmpqosqos_packets_receivedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_packets_receivedrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def snm... | [
"0.73806536",
"0.73737836",
"0.69151366",
"0.6816782",
"0.67822367",
"0.66593647",
"0.65967834",
"0.6542919",
"0.6423313",
"0.6307481",
"0.6298978",
"0.6286135",
"0.62521",
"0.6223493",
"0.6218443",
"0.6218164",
"0.6170329",
"0.6167586",
"0.6118307",
"0.6108861",
"0.61019355"... | 0.8075171 | 0 |
UUID is read only once set during creation. | def uuid(self):
return self._uuid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uuid(self):\n u = self.__uuid\n if u is None:\n u = str(uuid.uuid1())\n self._set_uuid(u)\n return u",
"def uuid(self, uuid: str):\n \n self._uuid = uuid",
"def uuid(self, value):\n self.unique_id = UUID(str(value)).hex",
"def uuid(self, uu... | [
"0.77605563",
"0.7724026",
"0.76410127",
"0.7591259",
"0.7521463",
"0.7521463",
"0.7521463",
"0.7521463",
"0.74166864",
"0.7252019",
"0.72498673",
"0.7246153",
"0.7238471",
"0.7238471",
"0.7238471",
"0.72374386",
"0.72116137",
"0.7209769",
"0.72064054",
"0.72064054",
"0.71601... | 0.7100937 | 22 |
This function removes all URLs from a string input. | def remove_urls(text):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_urls(text):\n text = re.sub('(?P<url>https?://[^\\s]+)', '', text)\n return text",
"def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)",
"def remove_URL(sample):\n return re.sub(r\"http\\S+\", \"\", sample)",
"def _remove_urls(text: str) -> st... | [
"0.8093915",
"0.7965597",
"0.7814867",
"0.7741918",
"0.767292",
"0.7662385",
"0.76003885",
"0.75947505",
"0.7546015",
"0.75344145",
"0.74597526",
"0.7441121",
"0.737437",
"0.72525316",
"0.7236845",
"0.71851915",
"0.706872",
"0.7041934",
"0.7009319",
"0.6952308",
"0.6923681",
... | 0.803231 | 1 |
Helper function to calculate the 1D alpha range used in Siddon algorithm | def alpha_range(x0, x1, x_min, x_max):
if x0 == x1:
raise ValueError('x1 and x2 should be different, get {} and {}'.format(x0, x1))
alpha_x1 = (x_min - x0) / (x1 - x0)
alpha_x2 = (x_max - x0) / (x1 - x0)
alpha_min = max(0, min(alpha_x1, alpha_x2))
alpha_max = min(1, max(alpha_x1, alpha_x2))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alpha_interceptions(x0, x1, x_min, x_max, alpha_min, alpha_max, dim, d):\n full_alpha_interceptions = (x_min + np.arange(dim + 1) * d - x0) / (x1 - x0)\n # print(full_alpha_interceptions)\n i_min = dim - (x_max - (alpha_min if x1 > x0 else alpha_max) * (x1 - x0) - x0) / d\n i_max = 1 + (x0 + (alpha... | [
"0.7151502",
"0.67279804",
"0.6528914",
"0.6218105",
"0.6136302",
"0.604919",
"0.6016924",
"0.59565943",
"0.5889581",
"0.5880392",
"0.58712804",
"0.5866205",
"0.5846754",
"0.5843668",
"0.58182204",
"0.57357854",
"0.5721351",
"0.5710233",
"0.56952673",
"0.56685007",
"0.5668438... | 0.6373671 | 3 |
Simplify word as much as possible and split by whitespace | def preprocess_words(word: str) -> List[str]:
return [change_latin(w) for w in word.lower().translate(SUB_MAP).split()] if word else [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def break_words(stuff):\r\n words = stuff.split(' ')\r\n return words",
"def simplify(text, whitespace=string.whitespace, delete=\"\"):\n result = []\n word = \"\"\n for char in text:\n if char in delete:\n continue\n elif char in whitespace:\n if word:\n ... | [
"0.7346262",
"0.7281156",
"0.7206372",
"0.7206372",
"0.7206372",
"0.7206372",
"0.7206372",
"0.71854097",
"0.71792233",
"0.71792233",
"0.7161359",
"0.7145347",
"0.7145347",
"0.71384066",
"0.70754904",
"0.699365",
"0.6838863",
"0.6838863",
"0.68233734",
"0.67910445",
"0.6774707... | 0.65694404 | 30 |
Return the path to the module. | def get_module_path(module_name):
module = __import__(module_name)
rootpath = os.path.dirname(module.__file__)
module_parts = module_name.split('.')
if len(module_parts) > 1:
rootpath = os.path.join(rootpath, *module_parts[1:])
return rootpath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_module_path(module):\n return pathlib.Path(os.path.dirname(os.path.abspath(inspect.getfile(module))))",
"def module_path():\n return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))",
"def _get_module_path():\n\n return os.path.dirname(os.path.realpath(__file__))",
"def modul... | [
"0.8561578",
"0.8529376",
"0.8442449",
"0.82423425",
"0.8236453",
"0.7939354",
"0.7879764",
"0.7829076",
"0.78214353",
"0.77711713",
"0.77633923",
"0.7661248",
"0.76541907",
"0.7626793",
"0.7619601",
"0.75949425",
"0.7553504",
"0.75195676",
"0.74673736",
"0.74382585",
"0.7383... | 0.747876 | 18 |
Move lift to given height. | def _move_lift(self, cmd):
self.move_lift(cmd.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_lift_down():\n return _move_lift(0.2)",
"def lift_down(self):\n\n # Can't reuse set_lift_pos due to bug above\n bottom_limit = self.get_lift_limit()\n self.send(self.cmd.SET_LIFT_SET, bottom_limit)",
"def move_lift_ground():\n return _move_lift(0)",
"def height(self, heigh... | [
"0.6408564",
"0.6247735",
"0.6153181",
"0.60399276",
"0.5982126",
"0.59783936",
"0.59747857",
"0.5893891",
"0.58824867",
"0.5826217",
"0.57799083",
"0.57756186",
"0.571243",
"0.56934667",
"0.56728005",
"0.5669018",
"0.56579214",
"0.5653484",
"0.5644823",
"0.56224054",
"0.5600... | 0.55584204 | 22 |
build a block with conv2d>batch_norm>pooling | def conv_block(self, x, weight, bias, scope):
# conv
x = tf.nn.conv2d(x, weight, [1, 1, 1, 1], 'SAME', name=scope + '_conv2d') + bias
# batch norm, activation_fn=tf.nn.relu,
# NOTICE: must have tf.layers.batch_normalization
# x = tf.contrib.layers.batch_norm(x, activation_fn=tf.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convbn_block(self, inp, conv, scale, offset, buffermean, buffervar, training, activation=tf.nn.relu, max_pool_pad='VALID'):\n stride, no_stride = [1, 2, 2, 1], [1, 1, 1, 1]\n inp = tf.nn.conv2d(inp, conv, no_stride, 'SAME')\n inp, buffermean, buffervar = self.batch_norm(inp, buffermean, bu... | [
"0.7144367",
"0.7115039",
"0.6984604",
"0.6984604",
"0.6960478",
"0.6958906",
"0.6957971",
"0.69453853",
"0.6912591",
"0.6883807",
"0.6874458",
"0.6868554",
"0.6844625",
"0.6822073",
"0.6806039",
"0.67828125",
"0.6763334",
"0.6760577",
"0.6753288",
"0.67477477",
"0.6729825",
... | 0.0 | -1 |
build a block with conv2d>batch_norm>pooling | def conv_block(self, x, weight, bias, scope):
# conv
x = tf.nn.conv2d(x, weight, [1, 1, 1, 1], 'SAME', name=scope + '_conv2d') + bias
# batch norm, activation_fn=tf.nn.relu,
# NOTICE: must have tf.layers.batch_normalization
# x = tf.contrib.layers.batch_norm(x, activation_fn=tf.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convbn_block(self, inp, conv, scale, offset, buffermean, buffervar, training, activation=tf.nn.relu, max_pool_pad='VALID'):\n stride, no_stride = [1, 2, 2, 1], [1, 1, 1, 1]\n inp = tf.nn.conv2d(inp, conv, no_stride, 'SAME')\n inp, buffermean, buffervar = self.batch_norm(inp, buffermean, bu... | [
"0.7144763",
"0.7114983",
"0.6985145",
"0.6985145",
"0.69610244",
"0.69588894",
"0.6958337",
"0.6946475",
"0.6912563",
"0.68844104",
"0.6874749",
"0.6869535",
"0.6844323",
"0.6821168",
"0.68061686",
"0.67825544",
"0.67630994",
"0.67620504",
"0.6753854",
"0.6747503",
"0.672973... | 0.0 | -1 |
A function for calculating the density ratio of samples x according to the current vae distribution | def get_autofocus_ratio(self, x):
# sample designs from the prior
z = tf.random.normal([tf.shape(x)[0], self.latent_size])
q_dx = self.q_vae.decoder.get_distribution(z, training=False)
p_dx = self.p_vae.decoder.get_distribution(z, training=False)
# evaluate the score and import... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\r\n return self.count_ones() / float(self.xspan * self.yspan)",
"def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\... | [
"0.720889",
"0.7179741",
"0.70469457",
"0.6979139",
"0.6769893",
"0.67369395",
"0.6678096",
"0.6645813",
"0.660161",
"0.65215206",
"0.64953625",
"0.6494982",
"0.6488882",
"0.6488882",
"0.6488882",
"0.6479269",
"0.64545",
"0.6427363",
"0.64254695",
"0.63842726",
"0.63579273",
... | 0.0 | -1 |
A function for calculating the density ratio of samples x according to the current vae distribution | def autofocus_weights(self, x, batch_size=32):
d = tf.data.Dataset.from_tensor_slices(x)
d = d.batch(batch_size)
d = d.prefetch(tf.data.experimental.AUTOTUNE)
return tf.concat([
self.get_autofocus_ratio(x) for x in d], axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\r\n return self.count_ones() / float(self.xspan * self.yspan)",
"def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\... | [
"0.7208109",
"0.71795845",
"0.70464957",
"0.69792646",
"0.6770143",
"0.67372465",
"0.66769195",
"0.66446424",
"0.6603002",
"0.65216804",
"0.6495827",
"0.64956295",
"0.64880884",
"0.64880884",
"0.64880884",
"0.64799273",
"0.64526373",
"0.6426722",
"0.6425247",
"0.6384357",
"0.... | 0.0 | -1 |
Builds the encoded representation of the input. The encoded model outputs the mean and logvar of the latent space embeddings/distribution, or in more mathematical terms, | def encode(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(self, input):\n result = self.encoder(input)\n result = torch.flatten(result, start_dim=1)\n\n # Split the result into mu and var components\n # of the latent Gaussian distribution\n mu = self.fc_mu(result)\n log_var = self.fc_var(result)\n\n return [mu, ... | [
"0.68119633",
"0.670978",
"0.6673847",
"0.66087186",
"0.6475182",
"0.64220095",
"0.6341739",
"0.63135695",
"0.6192409",
"0.6177818",
"0.6147038",
"0.61183727",
"0.60612106",
"0.6042604",
"0.59730697",
"0.5947219",
"0.5944232",
"0.5935973",
"0.5932455",
"0.590492",
"0.58797187... | 0.0 | -1 |
Check all urls in db that havent got an expiry date | def checkSold(auto=False):
#Create connection
db = pymysql.connect(host="localhost", user="testUser", passwd="BorrisBulletDodger", db="scraperdb", charset='utf8')
cursor = db.cursor()
#SQL Query
sql = "SELECT url FROM motorcycles WHERE adExpiry IS NULL"
#Find data
try:
cursor.ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkExpiredThread(q, results, db, cursor):\n\n while not q.empty():\n url = q.get()\n logger.debug(f\"{url} started - Tasks left: {q.unfinished_tasks}\")\n pbar.update(1)\n expired = None\n\n #Check if expired\n _, expired = getPage(url)... | [
"0.6385049",
"0.6339624",
"0.6181122",
"0.6115314",
"0.6078347",
"0.6046912",
"0.604548",
"0.6035148",
"0.589671",
"0.5895659",
"0.5882568",
"0.5861671",
"0.5828922",
"0.58061856",
"0.57957",
"0.5780539",
"0.57762337",
"0.57428974",
"0.57064843",
"0.56894374",
"0.5650496",
... | 0.5956192 | 8 |
antisymetric block diagonal matrix [[0, 1][1, 0]] | def jmat(ind: int):
return _jm[ind - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _block_diagonal(factor_matrices):\n shapes_dict = {}\n for i, matrix_i in enumerate(factor_matrices):\n for j, matrix_j in enumerate(factor_matrices):\n shapes_dict[(i, j)] = matrix_i.shape[:-1] + matrix_j.shape[-1:]\n rows = []\n # concacatenate along axis = -2\n for i, matrix... | [
"0.70033544",
"0.69868207",
"0.669661",
"0.66494536",
"0.65541595",
"0.6455023",
"0.6437622",
"0.6407818",
"0.6382942",
"0.63808846",
"0.63020235",
"0.62877613",
"0.6276881",
"0.62696373",
"0.6265198",
"0.62331074",
"0.62170756",
"0.6213792",
"0.61923265",
"0.6166402",
"0.616... | 0.0 | -1 |
Check if the user has set the '_' variable by hand. | def check_for_underscore(self):
# If something injected a '_' variable in __builtin__, delete
# ipython's automatic one so we don't clobber that. gettext() in
# particular uses _, so we need to stay away from it.
if '_' in __builtin__.__dict__:
try:
del self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_underscore_symbol(l):\r\n if \"_\" in str(l):\r\n return 1\r\n else:\r\n return 0",
"def _is_unknown(self, var):\n return var.find(\"#u\") != -1",
"def _is_blank(i):\n return i.startswith('_:')",
"def validName(varname):\r\n if (len(varname[0])>32):\r\n ... | [
"0.6438257",
"0.6125409",
"0.6112133",
"0.600193",
"0.6001846",
"0.5987426",
"0.5957369",
"0.59476507",
"0.5864597",
"0.58495975",
"0.58185315",
"0.5782329",
"0.5772125",
"0.57655",
"0.5762086",
"0.5756002",
"0.57548577",
"0.5746575",
"0.5711861",
"0.5708662",
"0.57045126",
... | 0.75248474 | 0 |
Compute and return the repr of the object to be displayed. This method only compute the string form of the repr and should NOT actual print or write that to a stream. This method may also transform the result itself, but the default implementation passes the original through. | def compute_result_repr(self, result):
try:
if self.shell.pprint:
try:
result_repr = pformat(result)
except:
# Work around possible bugs in pformat
result_repr = repr(result)
if '\n' in result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repr_(object_):\n return repr(object_)",
"def __repr__(self):\n return self.pretty_print(self.__dict__)",
"def repr(self, seen=None):\n return self.parser.repr(seen=seen)",
"def repr(self, seen=None):\n return self.parser.repr(seen=seen)",
"def __repr__(self):\n return se... | [
"0.77768147",
"0.7318501",
"0.73038995",
"0.73038995",
"0.72931117",
"0.72505116",
"0.72505116",
"0.72379243",
"0.7142197",
"0.71351683",
"0.7124918",
"0.711782",
"0.71136284",
"0.7100615",
"0.7100615",
"0.7100615",
"0.70805484",
"0.70740354",
"0.7073817",
"0.7070104",
"0.705... | 0.0 | -1 |
Test that an error is returned if a numpy array is not provided | def test_invalid_process(self):
with self.assertRaises(TypeError):
self.encoder.process([1, 2, 3, 4]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_not_empty(array: np.ndarray) -> None:\n if not array.size:\n raise ValueError(\"Array must not be empty\")",
"def test_Sobol_G_raises_error_if_values_not_numpy_array():\n fixture = [list(range(8)), str(12345678)]\n for x in fixture:\n with raises(TypeError):\n evaluate... | [
"0.705971",
"0.7007829",
"0.69399595",
"0.68619746",
"0.685753",
"0.6679237",
"0.65347785",
"0.6532009",
"0.6425685",
"0.6420574",
"0.6370336",
"0.63576686",
"0.63341445",
"0.63341445",
"0.6330988",
"0.6303206",
"0.62955695",
"0.6283241",
"0.625505",
"0.6208923",
"0.6204864",... | 0.0 | -1 |
Test that an exception is not raised on large blocks when in lax mode | def test_blocksize_lax(self):
self.default_kwargs['blocksize'] = 65535
self.default_kwargs['streamable_subset'] = False
self.encoder = StreamEncoder(**self.default_kwargs)
self.encoder._init() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_block_bad_batch(self):\n pass",
"def test_exceptionGreaterThan64k(self) -> None:\n raise LargeError(2 ** 16)",
"def test_prevent_wrong_memory(self):\n self.assertRaises(cinv.host.Error, self.wrong_memory)",
"def test_block_missing_batch(self):\n pass",
"def test_block_b... | [
"0.7255793",
"0.6935022",
"0.6654032",
"0.6653839",
"0.6557518",
"0.64061105",
"0.637614",
"0.62050825",
"0.6184355",
"0.6148567",
"0.6131231",
"0.6047093",
"0.60234076",
"0.59968686",
"0.5989321",
"0.5986526",
"0.59269446",
"0.59235376",
"0.5908852",
"0.589152",
"0.58689547"... | 0.0 | -1 |
Test that an exception is not raised on large blocks when in lax mode | def test_blocksize_lax(self):
self.default_kwargs['blocksize'] = 65535
self.default_kwargs['streamable_subset'] = False
self.encoder = FileEncoder(**self.default_kwargs)
self.encoder._init() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_block_bad_batch(self):\n pass",
"def test_exceptionGreaterThan64k(self) -> None:\n raise LargeError(2 ** 16)",
"def test_prevent_wrong_memory(self):\n self.assertRaises(cinv.host.Error, self.wrong_memory)",
"def test_block_missing_batch(self):\n pass",
"def test_block_b... | [
"0.7255793",
"0.6935022",
"0.6654032",
"0.6653839",
"0.6557518",
"0.64061105",
"0.637614",
"0.62050825",
"0.6184355",
"0.6148567",
"0.6131231",
"0.6047093",
"0.60234076",
"0.59968686",
"0.5989321",
"0.5986526",
"0.59269446",
"0.59235376",
"0.5908852",
"0.589152",
"0.58689547"... | 0.0 | -1 |
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(labels_dense, num_classes):
num_labels = labels_dense.shape[0]
index_offset = np.arange(num_labels) * num_classes
labels_one_hot = np.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
return labels_one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.824881",
"0.80753887",
"0.8051028",
"0.7976169",
"0.7907794",
"0.78988194",
"0.78912437",
"0.78702426",
"0.78474087",
"0.78474087",
"0.7824762",
"0.78241396",
"0.7766149",
"0.77636963",
"0.7752266",
"0.7752266",
"0.7752266",
"0.77479595",
"0.7742301",
"0.7737196",
"0.77208... | 0.7658008 | 31 |
Returns a ``Session`` instance by session id. | def get_by_sid(cls, sid):
data = memcache.get(sid)
if not data:
session = ndb.model.Key(cls, sid).get()
if session:
data = session.data
memcache.set(sid, data)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session(self, session_id):\n return Session(self.session_cache, self.sid, session_id, self._secret)",
"def get_session(self, session_id):\n return self._cache[session_id]",
"def get(self, session_id):\n if session_id is None:\n raise ValueError('session_id is required an... | [
"0.81321025",
"0.80684483",
"0.7575186",
"0.7493781",
"0.74463874",
"0.74058515",
"0.72545373",
"0.7249463",
"0.7235639",
"0.7121086",
"0.69635355",
"0.6957322",
"0.68980575",
"0.6764121",
"0.67446935",
"0.6619006",
"0.65706444",
"0.6570329",
"0.6534561",
"0.64967406",
"0.648... | 0.0 | -1 |
Returns a ``Session`` instance by session id. | def delete_by_user_id(cls, self, user_id):
usersessions = Session.query(Session.user_id == int(user_id)).fetch()
logging.info(usersessions)
for session in usersessions:
sid = session._key.id()
logging.info(sid)
data = Session.get_by_sid(sid)
loggin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session(self, session_id):\n return Session(self.session_cache, self.sid, session_id, self._secret)",
"def get_session(self, session_id):\n return self._cache[session_id]",
"def get(self, session_id):\n if session_id is None:\n raise ValueError('session_id is required an... | [
"0.8132412",
"0.8067841",
"0.7575577",
"0.7492631",
"0.74450517",
"0.74053615",
"0.7254087",
"0.7249545",
"0.7235255",
"0.71213865",
"0.6964077",
"0.69573075",
"0.6897356",
"0.67622316",
"0.6743412",
"0.6618054",
"0.65695536",
"0.65693694",
"0.65340286",
"0.64960957",
"0.6479... | 0.0 | -1 |
Sets the password for the current user | def set_password(self, raw_password):
self.password = security.generate_password_hash(raw_password, length=12) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setpassword(self, pwd):\n pass",
"def set_password(self, password):\n self.password = password",
"def set_password(self, password):\n self.PASS = password",
"def set_password(self, password):\n self.PASSWORD = password",
"def set_password(self, password):\n self.authe... | [
"0.84346145",
"0.82934695",
"0.8169671",
"0.8161627",
"0.81590205",
"0.7935139",
"0.7899852",
"0.789771",
"0.78954726",
"0.78849316",
"0.78333926",
"0.7816583",
"0.7795129",
"0.77901787",
"0.778048",
"0.7748624",
"0.7742674",
"0.77405965",
"0.77405965",
"0.7713553",
"0.767807... | 0.7530161 | 33 |
Estimate the quaternions given all data. Attributes ``gyr`` and ``acc`` must contain data. If ``mag`` contains data, the updateMARG() method is used. Returns | def _compute_all(self) -> np.ndarray:
if self.acc.shape != self.gyr.shape:
raise ValueError("acc and gyr are not the same size")
num_samples = len(self.acc)
Q = np.zeros((num_samples, 4))
# Compute with IMU architecture
if self.mag is None:
Q[0] = acc2q(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMARG(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray, mag: np.ndarray, dt: float = None) -> np.ndarray:\n _assert_numerical_iterable(q, 'Quaternion')\n _assert_numerical_iterable(gyr, 'Tri-axial gyroscope sample')\n _assert_numerical_iterable(acc, 'Tri-axial accelerometer sampl... | [
"0.7358467",
"0.67737937",
"0.66345656",
"0.6012856",
"0.5985096",
"0.5886803",
"0.588553",
"0.5776031",
"0.5345458",
"0.5272411",
"0.51944786",
"0.51932013",
"0.51922697",
"0.51057774",
"0.50776434",
"0.5056473",
"0.5036687",
"0.5024246",
"0.5015922",
"0.5001936",
"0.4987031... | 0.58063823 | 7 |
Quaternion Estimation with IMU architecture. | def updateIMU(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray) -> np.ndarray:
if gyr is None or not np.linalg.norm(gyr)>0:
return q
qEst = 0.5 * q_prod(q, [0, *gyr]) # (eq. 12)
a_norm = np.linalg.norm(acc)
if a_norm>0:
a = acc/a_nor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_orientation_quaternion(self):\n raise NotImplementedError('Not yet implemented!')",
"def test_to_quaternion(self):\r\n R = np.identity(3)\r\n q = to_quaternion(R)\r\n zero_vec = q - np.array([0., 0., 0., 1.])\r\n self.assertAlmostEqual(np.linalg.norm(zero_vec), 0.0)\r\n\r\... | [
"0.6422403",
"0.64138067",
"0.6326277",
"0.62809616",
"0.62284636",
"0.6223363",
"0.62096614",
"0.6153406",
"0.6047804",
"0.6047269",
"0.60430807",
"0.5954681",
"0.5905981",
"0.58911973",
"0.5861147",
"0.5831793",
"0.5812636",
"0.57956105",
"0.57822424",
"0.5755812",
"0.57407... | 0.0 | -1 |
Quaternion Estimation with a MARG architecture. | def updateMARG(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray, mag: np.ndarray) -> np.ndarray:
if gyr is None or not np.linalg.norm(gyr)>0:
return q
qEst = 0.5 * q_prod(q, [0, *gyr]) # (eq. 12)
a_norm = np.linalg.norm(acc)
if a_norm>0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quatm(q1, q0):\n w0, x0, y0, z0 = q0\n w1, x1, y1, z1 = q1\n\n return torch.cuda.FloatTensor([\n -x1*x0 - y1*y0 - z1*z0 + w1*w0,\n x1*w0 + y1*z0 - z1*y0 + w1*x0,\n -x1*z0 + y1*w0 + z1*x0 + w1*y0,\n x1*y0 - y1*x0 + z1*w0 + w1*z0,\n ])",
"def updateMARG(self, q: np.ndar... | [
"0.62689996",
"0.6123943",
"0.59824204",
"0.5976214",
"0.5969377",
"0.5948963",
"0.5945723",
"0.58710724",
"0.5796784",
"0.5764936",
"0.57410324",
"0.5738711",
"0.5698573",
"0.5688093",
"0.5646513",
"0.56292444",
"0.55762225",
"0.5557781",
"0.5553943",
"0.553004",
"0.54944676... | 0.53014076 | 35 |
Finds and returns the user with the given id, if such a user doesn't exist, return None | def getMemberWithGivenId(id: Union[str, ObjectId], **kwargs):
isResponseParsed = kwargs.get("isParsed", False)
rawData = kwargs.get("rawData", False)
logging.info("Trying to find the user with the id=" + id)
try:
user = Member.objects(id=id).first()
assert user
logging.debug... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_user_by_id(self, _id):\n user_resp = self._db.Users(database_pb2.UsersRequest(\n request_type=database_pb2.UsersRequest.FIND,\n match=database_pb2.UsersEntry(global_id=_id)))\n if user_resp.result_type != database_pb2.UsersResponse.OK:\n self._logger.warning(... | [
"0.8561217",
"0.8502597",
"0.817051",
"0.80880356",
"0.808385",
"0.8035117",
"0.79443884",
"0.79412305",
"0.7938044",
"0.79269207",
"0.7801309",
"0.7776014",
"0.77525336",
"0.77456313",
"0.77149814",
"0.76855654",
"0.76615506",
"0.7649293",
"0.7639368",
"0.7603628",
"0.759037... | 0.0 | -1 |
Test create / edit / remove an image. | def test_image(self):
browser = self.layer.get_web_browser(smi_settings)
image = self.layer.get_fixture('torvald.jpg')
browser.login(self.username, self.username)
self.assertEqual(browser.open('/root/edit'), 200)
browser.macros.create(
'Silva Image', id='image', titl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_image(self):\n pass",
"def test_create_image(self):\n pass",
"def test_edit_image_instance(self):\n self.client.force_authenticate(self.user1)\n data = {\n \"img_name\": \"photo_user1\",\n \"img_description\": \"photo of user1\",\n \"... | [
"0.81277657",
"0.79561114",
"0.78040457",
"0.7650042",
"0.74860394",
"0.74576116",
"0.73470855",
"0.7337543",
"0.73011994",
"0.72694606",
"0.72620666",
"0.72146046",
"0.7165372",
"0.7116727",
"0.711059",
"0.7083397",
"0.70729053",
"0.70679104",
"0.7036395",
"0.7011309",
"0.69... | 0.7924283 | 2 |
Tests priority queue implementation. | def priority_queue_test(a):
pq = Priority_Queue()
dummy = []
if pq.is_empty() == True:
print('pq is empty.')
array_to_pq(pq, a)
print('Converting a into a pq...')
if pq.is_empty() == False:
print('a has been transferred into pq!')
print('\nRemoving ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_priority_que_success_min_no_priority(priority_queue):\n priority_queue.insert(10)\n priority_queue.insert(5)\n priority_queue.insert(100)\n assert priority_queue._heap[0].value == 10",
"def test_priority_que_success_priority(priority_queue):\n priority_queue.insert(10)\n priority_queue... | [
"0.7998595",
"0.7978113",
"0.77483463",
"0.7724846",
"0.7560529",
"0.75168234",
"0.7366565",
"0.7226534",
"0.71774364",
"0.70563823",
"0.7051714",
"0.70112896",
"0.6950792",
"0.68365896",
"0.68334615",
"0.681549",
"0.6790634",
"0.67786425",
"0.6699356",
"0.66984564",
"0.66897... | 0.74462956 | 6 |
Return a random parameter set for the model. | def random():
# Define lattice spacing as a multiple of the particle radius
# using the formula a = 4 r/sqrt(3). Systems which are ordered
# are probably mostly filled, so use a distribution which goes from
# zero to one, but leaving 90% of them within 80% of the
# maximum bcc packing. Lattice dis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_individual():\r\n return [ random.random() for _ in range(PARAMETERS_COUNT) ]",
"def get_random_fit_parameters(self):\n all_random = self.par_obj.get_random_all()\n return np.asarray([all_random[p] for p in self.fit_parameters])",
"def generate_params(self, randomize=True):\n ... | [
"0.71428007",
"0.688349",
"0.6808765",
"0.66362673",
"0.6540666",
"0.63735193",
"0.6311061",
"0.62580836",
"0.6221744",
"0.6214573",
"0.620113",
"0.619888",
"0.6157318",
"0.61570257",
"0.61529607",
"0.61330676",
"0.61257356",
"0.6104896",
"0.6069822",
"0.6069822",
"0.6029616"... | 0.0 | -1 |
Calculates the discrete ODF for a given discrete sphere. | def odf(self, sphere):
self.gqi_vector = self.model.cache_get('gqi_vector', key=sphere)
if self.gqi_vector is None:
if self.model.method == 'gqi2':
H = squared_radial_component
# print self.gqi_vector.shape
self.gqi_vector = np.real(H(np.dot(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odf(self, sphere):\n raise NotImplementedError(\"To be implemented in sub classes\")",
"def test_density_2d(self):\n # almost spherical case\n x = 1.\n y = 1.\n e1, e2 = 5e-5, 0.\n sigma = 1.\n amp = 2.\n f_ = self.gaussian_kappa_ellipse.density_2d(x, y... | [
"0.7162984",
"0.62479115",
"0.5853649",
"0.5699979",
"0.5695614",
"0.56824833",
"0.56696063",
"0.55715925",
"0.5551039",
"0.5527438",
"0.5508767",
"0.54368275",
"0.5416286",
"0.5412122",
"0.54067904",
"0.5388561",
"0.53791136",
"0.5378805",
"0.53724706",
"0.5364546",
"0.53573... | 0.691775 | 1 |
r""" Normalize the rows of a CSR matrix by their L2 norm. If copy is True, returns a copy of the normalized matrix. | def csr_l2normalize(mat, copy=False, **kargs):
if copy is True:
mat = mat.copy()
nrows = mat.shape[0]
nnz = mat.nnz
ind, val, ptr = mat.indices, mat.data, mat.indptr
# normalize
for i in range(nrows):
rsum = 0.0
for j in range(ptr[i], ptr[i+1]):
rsum += val[j]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr_l2normalize(mat, copy=False, **kargs):\n if copy is True:\n mat = mat.copy()\n nrows = mat.shape[0]\n nnz = mat.nnz\n ind, val, ptr = mat.indices, mat.data, mat.indptr\n # normalize\n for i in range(nrows):\n rsum = 0.0 \n for j in range(ptr[i], ptr[i+1]):\n ... | [
"0.811478",
"0.811478",
"0.80977243",
"0.62578917",
"0.61549985",
"0.6145804",
"0.61083215",
"0.58978355",
"0.5849617",
"0.5842135",
"0.58351153",
"0.5825232",
"0.5811106",
"0.58064467",
"0.57898027",
"0.57506514",
"0.57319903",
"0.5714174",
"0.5691834",
"0.5653762",
"0.56162... | 0.8103095 | 2 |
Initialize Loan Dataset object. | def __init__(self, config):
self.bucket = config['bucket']
self.raw_folder = config['raw_folder']
self.processed_folder = config['processed_folder']
self.loans_raw = None
self.loans_processed = None
self.loan_status_distribution = None
self.annual_inc_summary = No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def __init__(self):\n self.__dataset = None",
"def _init_al_dataset(self):\n\n self._init_dataset()\n\n train_dataset = self.datasets['train']\n\n ... | [
"0.6772476",
"0.6699143",
"0.65986854",
"0.65175724",
"0.63482887",
"0.624214",
"0.6236769",
"0.61901647",
"0.617896",
"0.6107762",
"0.59756476",
"0.5928512",
"0.58918846",
"0.5869941",
"0.58573157",
"0.585516",
"0.58440644",
"0.58431",
"0.58335745",
"0.58199114",
"0.5787081"... | 0.0 | -1 |
Implements cmp(inst1, inst2) for the first key that is different Adjusts for the requested sort direction by inverting the result as needed. | def compare_instances(self, inst1, inst2):
for skey, sdir in zip(self._sort_keys, self._sort_dirs):
resultflag = 1 if sdir == 'desc' else -1
if inst1[skey] < inst2[skey]:
return resultflag
elif inst1[skey] > inst2[skey]:
return resultflag * -1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __cmp__(self,other):\n try:\n other_key = other._make_key()\n except AttributeError:\n return -1\n return cmp(self._make_key(), other_key)",
"def _custom_sorter(self, key1, key2):\n\n col = self._col\n ascending = self._colSortFlag[col]\n real =... | [
"0.7099979",
"0.6904231",
"0.67173624",
"0.66601074",
"0.66436845",
"0.6414422",
"0.64139867",
"0.6413248",
"0.6403002",
"0.6373202",
"0.63277024",
"0.6311816",
"0.62918574",
"0.6219977",
"0.6155822",
"0.61000204",
"0.60637254",
"0.60603654",
"0.6052233",
"0.60165983",
"0.601... | 0.70295453 | 1 |
Get the marker instance from its cell. This returns the marker instance from the cell in which it lives | def _get_marker_instance(ctx, marker):
try:
im = objects.InstanceMapping.get_by_instance_uuid(ctx, marker)
except exception.InstanceMappingNotFound:
raise exception.MarkerNotFound(marker=marker)
elevated = ctx.elevated(read_deleted='yes')
with context.target_cell(elevated, im.cell_mapp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell(self):\n return self._cell",
"def get_cell(self, location: Hashable) -> Cell:\n\t\treturn self._location_to_cell_map.get(location, None)",
"def get(self) -> HintCell:\n\n boundaries = self.boundaries.get()\n boni = self.boni.get()\n\n return HintCell(self.source, boundaries, bo... | [
"0.6708903",
"0.66516006",
"0.63596106",
"0.6277444",
"0.618865",
"0.61877245",
"0.61063427",
"0.60973793",
"0.5947471",
"0.594118",
"0.5934008",
"0.59050906",
"0.590052",
"0.5897509",
"0.5804176",
"0.58037615",
"0.577686",
"0.5760832",
"0.57479936",
"0.57330287",
"0.5728529"... | 0.7074301 | 0 |
Get a crosscell list of instances matching filters. This iterates cells in parallel generating a unified and sorted list of instances as efficiently as possible. It takes care to iterate the list as infrequently as possible. We wrap the results in InstanceWrapper objects so that they are sortable by heapq.merge(), whic... | def get_instances_sorted(ctx, filters, limit, marker, columns_to_join,
sort_keys, sort_dirs):
if not sort_keys:
# This is the default from the process_sort_params() method in
# the DB API. It doesn't really matter, as this only comes into
# play if the user didn't a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield_instances(self, instance_filter=None):\n if instance_filter and set(\"\\\"\\\\'\").intersection(instance_filter):\n raise ValueError('Invalid instance filter: %s' % instance_filter)\n page_token = None\n while True:\n params = {'maxResults': 250}\n if instance_filter:\n par... | [
"0.65896964",
"0.64632475",
"0.5570853",
"0.55109453",
"0.54803884",
"0.5463914",
"0.53889525",
"0.5323795",
"0.5294357",
"0.5289761",
"0.5259226",
"0.5245947",
"0.52282816",
"0.5201792",
"0.51602477",
"0.5142704",
"0.50829613",
"0.50684774",
"0.5030095",
"0.5011168",
"0.5000... | 0.7209749 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ImageInfo):
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.8088463",
"0.8088463",
"0.80553037",
"0.7983272",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
"0.7966844",
... | 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 |
Sets configuration for TensorFlow GPU environment based on env variable. | def _setup_gpu_environment() -> None:
gpu_memory_config = os.getenv(ENV_GPU_CONFIG)
if not gpu_memory_config:
return
# Import from tensorflow only if necessary (environment variable was set)
from tensorflow import config as tf_config
parsed_gpu_config = _parse_gpu_config(gpu_memory_config... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_gpu(gpu):\r\n os.environ['CUDA_VISIBLE_DEVICES'] = gpu\r\n tf_config = tf.ConfigProto()\r\n tf_config.gpu_options.allow_growth = True\r\n return tf_config",
"def configure_gpu_tf():\n\n try:\n # locate available devices & set required environment variables\n available_device_... | [
"0.78108644",
"0.74813545",
"0.6826066",
"0.6764458",
"0.66190743",
"0.6606401",
"0.6519573",
"0.64683366",
"0.64474756",
"0.6350582",
"0.631473",
"0.631121",
"0.6282548",
"0.61599636",
"0.61138254",
"0.61068857",
"0.6072977",
"0.6055359",
"0.60499835",
"0.599995",
"0.5987531... | 0.74113476 | 2 |
Set configuration for the CPU environment based on environment variable. | def _setup_cpu_environment() -> None:
inter_op_parallel_threads = os.getenv(ENV_CPU_INTER_OP_CONFIG)
intra_op_parallel_threads = os.getenv(ENV_CPU_INTRA_OP_CONFIG)
if not inter_op_parallel_threads and not intra_op_parallel_threads:
return
from tensorflow import config as tf_config
if inte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EnableCPU():\n global option\n option['device'] = 'CPU'",
"def set_config(config_name, host, port, core=''):\n global CONFIGS\n CONFIGS[config_name] = {'host': host, 'port': port, 'core': core}",
"def set_cpus(self, num_cpus: int) -> None:\n if self.batch:\n if self.launcher i... | [
"0.6677505",
"0.5853975",
"0.58238256",
"0.57976335",
"0.5789034",
"0.575001",
"0.5715022",
"0.56461763",
"0.5623802",
"0.5550285",
"0.55202216",
"0.55081564",
"0.5503496",
"0.54302907",
"0.54085046",
"0.5371606",
"0.53472203",
"0.53221536",
"0.5315872",
"0.53140944",
"0.5305... | 0.7395337 | 0 |
Add the routes to the Flask application object | def setup_routes(application):
# Do the controller import here after the models have been loaded
from app.controllers import view_controller, api_controller
# Some helpers to make defining the routes a bit cleaner
def get(path, rule, func, *args, **kwargs):
kwargs['methods'] = ['GET']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_routes(self):\n# from server.flask import views as flask_views\n# flask_views_custom_methods = filter(lambda x: x.startswith(\"view_\"), dir(flask_views))\n# for custom_method in flask_views_custom_methods:\n# # Retrieve data needed to add the URL rule to the Flask app\n# ... | [
"0.85039705",
"0.7646561",
"0.75888616",
"0.758347",
"0.7328595",
"0.7321869",
"0.7301055",
"0.72989315",
"0.7219503",
"0.7190631",
"0.7143104",
"0.7113233",
"0.7023898",
"0.68882275",
"0.6874056",
"0.68536806",
"0.6847867",
"0.6796373",
"0.6792366",
"0.67805153",
"0.6760714"... | 0.6984384 | 13 |
Adds the malicious blocks to the honest DAG. | def _add_malicious_blocks_to_honest_dag(self):
while self._malicious_blocks_to_add_to_honest_dag:
self._honest_dag.add(self[self._malicious_blocks_to_add_to_honest_dag.popleft()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _stop_attack(self):\n self._add_malicious_blocks_to_honest_dag()\n self._competing_chain_tip_gid = None\n self._first_parallel_block_gid = None",
"def mine(self):\n # Checking if there is anything to be mined \n if len(self.pool) > 0:\n # Getting data from the po... | [
"0.5498594",
"0.5371092",
"0.52902806",
"0.525049",
"0.5237269",
"0.5215216",
"0.51837105",
"0.5164123",
"0.5109467",
"0.50704384",
"0.50621957",
"0.5019991",
"0.50150764",
"0.4978071",
"0.4969675",
"0.49446175",
"0.4909905",
"0.4904961",
"0.4901418",
"0.4886863",
"0.4882455"... | 0.79329735 | 0 |
Initilizes a queue full of customers | def __init__(self):
queue = collections.deque() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, number):\n self.number = number\n self.totalCustomerWaitTime = 0\n self.customersServed = 0\n self.currentCustomer = None\n self.queue = LinkedQueue()",
"def addCustomer(self, c):\n self.queue.add(c)",
"def __init__(self):\n self.queues=[]",
... | [
"0.7310464",
"0.6753742",
"0.6660912",
"0.65111226",
"0.6478338",
"0.6478338",
"0.6478338",
"0.6478338",
"0.6478338",
"0.6443491",
"0.6443491",
"0.64129204",
"0.63978773",
"0.63726586",
"0.6312143",
"0.6292329",
"0.6253185",
"0.62261856",
"0.6189694",
"0.6178053",
"0.6166067"... | 0.5797335 | 43 |
Function returning the turnstile which self.target belongs | def get_arms(self) -> (list, ob.TurnstileAxis):
directions = [(0, 1), (1, 0), (0, -1), (-1, 0),
(1, 1), (-1, 1), (1, -1), (-1, -1)]
for dire in directions:
x_neighbour = self.target.x_obj + dire[0]
y_neighbour = self.target.y_obj + dire[1]
neighb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_target_tile(self):\n if self.tank.flag is not None:\n x, y = self.tank.start_position\n else:\n self.get_flag() # Ensure that we have initialized it.\n x, y = self.flag.x, self.flag.y\n return Vec2d(int(x), int(y))",
"def getTile(self):\n ret... | [
"0.6835052",
"0.62774855",
"0.62481165",
"0.6153794",
"0.60836715",
"0.602168",
"0.59690785",
"0.5954225",
"0.59516066",
"0.59234595",
"0.58821017",
"0.5864561",
"0.5860376",
"0.5851147",
"0.58387446",
"0.578773",
"0.57848674",
"0.5777758",
"0.5759148",
"0.5759148",
"0.571949... | 0.0 | -1 |
Exercise 2 Use capitalize_all to write a function named capitalize_nested that takes a nested list of strings and returns a new nested list with all strings capitalized. | def capitalize_nested(lst_str):
ret_list = []
index = 0
for i in lst_str:
if type(i) == list:
ret_list.append(capitalize_nested(lst_str[index]))
else:
ret_list.append(i.capitalize())
index += 1
return ret_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize_all(t):\n res = []\n for s in t:\n res.append(s.capitalize())\n return res",
"def capitalize_all(t):\r\n\tcopy = []\r\n\tfor i in t:\r\n\t\tif type(i) == str:\r\n\t\t\tcopy.append(i.capitalize())\r\n\t\telse:\r\n\t\t\tcopy.append(capitalize_all(i))\r\n\treturn copy",
"def capitalize(s):\n\... | [
"0.7026064",
"0.6985265",
"0.68078536",
"0.6038966",
"0.5817169",
"0.5735731",
"0.5593027",
"0.5590289",
"0.5579011",
"0.5574262",
"0.55618393",
"0.54537016",
"0.5408619",
"0.53976804",
"0.5387723",
"0.53805715",
"0.53781676",
"0.537776",
"0.53663",
"0.53334117",
"0.5324298",... | 0.77744085 | 0 |
NPV of cash flow adjusted for initial investment The `numpy_financial.npv()` function wants the initial investment as a negative cash flow in year 1 or a zero cash flow in year 1 and then need to subtract off the initial investment. | def npv(self):
cash_flow = self.cash_flow()
# If more than one row in cash_flow, we must be simulating or creating a
# data table.
n_rows = cash_flow.shape[0]
# Create an (nrows x 1) array filled with initial investment values
col0 = np.full(nrows, -self.fixed_dev_cost)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def npv(contract_duration_years, contract_duration_days,\n yearly_payments_percentage, annual_costs_reduction,\n announcement_date, nbu_discount_rate,\n days_per_year=365, npv_calculation_duration=20):\n\n days_for_discount_rate = discount_rate_days(announcement_date,\n ... | [
"0.69246334",
"0.6227518",
"0.5850616",
"0.58277905",
"0.5800107",
"0.569329",
"0.56636095",
"0.5652151",
"0.55380416",
"0.55305487",
"0.5521329",
"0.5515499",
"0.54972637",
"0.53291005",
"0.52983075",
"0.5295985",
"0.5276058",
"0.5269203",
"0.526164",
"0.52269125",
"0.522372... | 0.7681947 | 0 |
Create DataFrame version of financial model table Financial model table is transposed so that financial measures are columns. | def model_to_df(self, transpose=True):
X = np.vstack([self.sales(), self.unit_contribution(),
self.net_revenue(), self.depreciation(),
self.before_tax_profit(), self.after_tax_profit(), self.cash_flow()])
if transpose:
X = np.transpose(X)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def investments_table(self):\n table = pd.DataFrame(index=[etf.buy_date for etf in self.etfs.values()])\n table['Ticker'] = [name.split('-')[0].split('.')[0] for name in self.etfs.keys()]\n table['Buying Price (€)'] = [etf.buy_price for etf in self.etfs.values()]\n table['Number of Shar... | [
"0.6867327",
"0.6612264",
"0.6301249",
"0.61730415",
"0.60792184",
"0.6073224",
"0.60456604",
"0.595325",
"0.59496593",
"0.5944644",
"0.5904372",
"0.58613694",
"0.5846162",
"0.5840601",
"0.5804579",
"0.5799731",
"0.5799311",
"0.5797586",
"0.5772154",
"0.57717925",
"0.5768348"... | 0.7412922 | 0 |
Render the change of name into the business model objects. | def process(business: Business, filing: Dict, filing_meta: FilingMeta):
logger.debug('processing Change of Name: %s', filing)
if name_request_json := filing['changeOfName'].get('nameRequest'):
new_name = name_request_json.get('legalName')
else:
new_name = filing['changeOfName'].get('legalNa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return f'<Name:{self.name}>'",
"def __str__(self): \r\n return self.name",
"def __str__(self):\n return self.name",
"def __str__(self):\r\n return self.name",
"def __str__(self):\r\n return self.name",
"def __str__(self):\r\n return self.... | [
"0.6468253",
"0.6403284",
"0.63552487",
"0.6320504",
"0.6320504",
"0.6320504",
"0.6320189",
"0.6320189",
"0.63116306",
"0.63116306",
"0.63116306",
"0.63116306",
"0.63116306",
"0.63116306",
"0.63116306",
"0.62977076",
"0.62977076",
"0.62977076",
"0.62977076",
"0.62977076",
"0.... | 0.65276265 | 0 |
see BT08 this assumes z=0, i.e. inplane only. note that R is 2d in this case. | def kuzmin_rotation(R,c,M,G=astronomicalG):
return np.sqrt(2*G*np.power(10.,M)*R*R*np.power(c*c+R*R,-1.5)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_onto_plane(self,z):\n U=self.U\n Q=self.Q_p\n #print(((z-Q[-2,:,[2]])/P[-2,:,[2]]).T)\n #print(P[-2])\n return ((z-Q[-2,:,[2]])/U[-2,:,[2]]).T*U[-2]+Q[-2]",
"def xzplane(draw, r, y, shift = np.array([1000, 1000, 0, 0]), scale = 300):\n extent = 2.8\n pln = np.... | [
"0.71929425",
"0.6754659",
"0.6716372",
"0.6667102",
"0.66068524",
"0.6356809",
"0.63185316",
"0.62698513",
"0.6219002",
"0.61496055",
"0.60713375",
"0.6038444",
"0.6017929",
"0.60067785",
"0.60063505",
"0.5983755",
"0.5962205",
"0.5962205",
"0.59513235",
"0.59494853",
"0.594... | 0.0 | -1 |
see BT08 eq. 2.44a this is a spherical model, such that r is 3d. | def plummer_rotation(r,b,M,G=astronomicalG):
return np.sqrt(2*G*np.power(10.,M)*r*r*np.power(b*b+r*r,-1.5)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surfaceIntSphere(r: float) -> float:\n return 4.0 * np.pi * r * r",
"def aspheresurface(self):\n\t\tR = self.coefficients[0]\n\t\ttheta = np.linspace(0, 2*np.pi, 100)\n\t\trho = np.linspace(0, R, 100)\n\t\t[u,r] = np.meshgrid(theta,rho)\n\t\tX = r*cos(u)\n\t\tY = r*sin(u)\n\t\tZ = aspherepolar(self.coeffi... | [
"0.6928456",
"0.66932905",
"0.65626097",
"0.6548613",
"0.6539375",
"0.6533323",
"0.65327084",
"0.6503298",
"0.64371186",
"0.64234304",
"0.6415125",
"0.6394391",
"0.6377413",
"0.63662803",
"0.6362995",
"0.6362995",
"0.6345273",
"0.6300313",
"0.62842786",
"0.623776",
"0.6204948... | 0.0 | -1 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
conn = g.get('sqlite_db', None)
if conn is None:
conn = g.sqlite_db = connect_db()
return conn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.77379817",
"0.75827783",
"0.731633",
"0.716833",
"0.702289",
"0.6965276",
"0.6953964",
"0.6948672",
"0.68981296",
"0.68425506",
"0.6828195",
"0.6819551",
"0.68043447",
"0.67949706",
"0.67684644",
"0.6760031",
"0.675094",
"0.6747081",
"0.67314476",
"0.66986555",
"0.668763",... | 0.6572707 | 34 |
Test object IO using the S3 SDK | def test_write_file_to_bucket(
self,
mcg_obj,
awscli_pod,
bucket_class_factory,
bucket_factory,
interface,
bucketclass_dict,
):
# Retrieve a list of all objects on the test-objects bucket and
# downloads them to the pod
data_dir = "/dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_s3_gets_object_content(self):\n mock_s3 = Mock()\n mock_s3_object = Mock()\n s3_response = {'Body': mock_s3_object}\n mock_s3_object.read.return_value = \"file content\"\n mock_s3.get_object.return_value = s3_response\n\n s3_bucket = S3Bucket('bucket_name', s3_cl... | [
"0.79290044",
"0.7068225",
"0.7035422",
"0.6953664",
"0.69339716",
"0.69081223",
"0.68332195",
"0.67755705",
"0.67623305",
"0.6671153",
"0.66708803",
"0.6639953",
"0.66135585",
"0.6611791",
"0.6608675",
"0.6582093",
"0.65512145",
"0.65430963",
"0.6542211",
"0.6510598",
"0.647... | 0.6870493 | 6 |
Read a list of `InputExample`s from an input text. | def read_examples_string(input_text):#(input_file, input_text):
examples = []
unique_id = 0
with io.StringIO(input_text) as reader:
while True:
line = tokenization.convert_to_unicode(reader.readline())
if not line:
break
line = line.strip()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_examples(input_file):\n examples = []\n unique_id = 0\n with tf.gfile.GFile(input_file, \"r\") as reader:\n while True:\n line = tokenization.convert_to_unicode(reader.readline())\n if not line:\n break\n \n line = line.strip()... | [
"0.7894354",
"0.73903024",
"0.6771458",
"0.6730504",
"0.6622049",
"0.65347636",
"0.65203947",
"0.64383495",
"0.62848353",
"0.62848353",
"0.62848353",
"0.62447137",
"0.62190163",
"0.6214364",
"0.61782074",
"0.6156509",
"0.61546797",
"0.6139105",
"0.6123755",
"0.61186945",
"0.6... | 0.8270052 | 0 |
Returns a list of tuples (paragraph_id, paragraph_score) for "topk" paragraphs with the highest score. | def get_closest_sentence(self, query_emb_init, paper_id, text, topk=10):
csv_filepath = os.path.join("selected", paper_id + '.csv')
df_article = pd.read_csv(csv_filepath, index_col=0)
normalize = lambda x: x/np.linalg.norm(x, axis = 1, keepdims = True)
query_emb = normalize(query_emb_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_k(similarity, question_ids, paragraph_ids, k):\n n_questions = similarity.shape[0]\n idxs = [np.argsort(similarity[row,:])[-k:][::-1] for row in range(n_questions)]\n out = {question_ids[i]:np.array(paragraph_ids)[idxs[i]] for i in range(n_questions)}\n return out",
"def top_k_result(self... | [
"0.67378545",
"0.6651812",
"0.6559056",
"0.6446816",
"0.6324562",
"0.63115776",
"0.6234802",
"0.619466",
"0.61575156",
"0.6108978",
"0.6108978",
"0.61087394",
"0.60921025",
"0.60921025",
"0.60921025",
"0.6075689",
"0.6069665",
"0.6050277",
"0.6047602",
"0.60251105",
"0.602221... | 0.58255917 | 41 |
Return provision per trade (using a given yield curve). This is a special function used in MOPL returning provision in form of a dictionary (later used in MOPL reporting). | def calculate_provision(trade, yield_curve):
if yield_curve.Name() in ('ZAR-SWAP-SPREAD-1m', 'ZAR-SWAP-SPREAD-6m',
'ZAR-SWAP-SPREAD-9m', 'ZAR-SWAP-SPREAD-12m'):
yield_curve = acm.FYieldCurve['ZAR-SWAP']
elif yield_curve.Name() in ('ZAR-SWAP', 'USD-SWAP'):
pass
else:
mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(trade):\n yield_curve = acm.FYieldCurve['ZAR-SWAP']\n handler = ProvisionHandler(yield_curve)\n try:\n trade_provision = handler.calculate(trade)\n except ProvisionNotApplicable:\n LOGGER.debug(\"Provision not applicable for trade %s\", trade.Oid(), exc_info=1)\n trad... | [
"0.57954794",
"0.5663079",
"0.5576208",
"0.55277306",
"0.54410356",
"0.5312383",
"0.50910205",
"0.5041525",
"0.5030322",
"0.50141054",
"0.49947312",
"0.4966199",
"0.49212277",
"0.488978",
"0.4875967",
"0.4847433",
"0.48086935",
"0.478055",
"0.47440526",
"0.47206953",
"0.46991... | 0.7099809 | 0 |
Return first float/fixed leg for the instrument based on type. | def _first_leg(self, instrument):
if instrument.InsType() == 'CurrSwap':
for leg in instrument.Legs():
if leg.IsFixedLeg() and leg.Currency().Name() == 'ZAR':
return leg
else:
return None
return instrument.FirstFloatLeg() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refractive_index_glass(wavelength, type='soda-lime-low-iron'):\n\n if type.lower() == 'soda-lime-low-iron':\n wavelength = wavelength / 1000\n n = 1.5130 - 0.003169 * wavelength ** 2 + 0.003962 * wavelength ** -2 + 0 * 1j\n\n # n[wavelength < 0.3] = n[wavelength < 0.3] + 1j*0\n elif ... | [
"0.56058615",
"0.5557935",
"0.543365",
"0.54118204",
"0.5381103",
"0.5330574",
"0.5293033",
"0.5235914",
"0.5235813",
"0.52102745",
"0.5205134",
"0.51804394",
"0.5132719",
"0.5123155",
"0.5122234",
"0.50907636",
"0.509052",
"0.5088721",
"0.5076467",
"0.49678996",
"0.4918643",... | 0.7591048 | 0 |
Returns a string representation of the time | def __str__(self):
return '%.2d:%.2d:%.2d' % (self.hour, self.minute, self.second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_string(self):\n return f\"{self.year} {self.month:02} \" \\\n f\"{self.start_day:02} {self.start_hour:02} 00 {self.get_duration():6}\"",
"def timestr():\n return dt.strftime(dt.now(),'%H:%M:%S')",
"def _time_str(self):\n try:\n if not self._time:\n ... | [
"0.8369191",
"0.81801987",
"0.81062204",
"0.8099411",
"0.80909765",
"0.79639405",
"0.7957387",
"0.7954416",
"0.7922385",
"0.7899543",
"0.7859414",
"0.78225493",
"0.7801383",
"0.77925205",
"0.7764426",
"0.77511233",
"0.7749094",
"0.77378726",
"0.75792986",
"0.7541745",
"0.7540... | 0.7102359 | 52 |
Returns True/False depending on if the input string contains any numerical characters (i.e 0, 1, 2, 3...9) | def has_number(any_string):
return any(char.isdigit() for char in any_string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isNumber(string):\r\n for char in string:\r\n charNum = ord(char)\r\n if (charNum < 48 or charNum > 57):\r\n return False\r\n return True",
"def hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)",
"def only_numbers(string):\n for character in... | [
"0.8632124",
"0.8573962",
"0.8269258",
"0.8232859",
"0.807725",
"0.7990034",
"0.78774154",
"0.78322226",
"0.7770709",
"0.7733886",
"0.77141076",
"0.7692305",
"0.7682781",
"0.761857",
"0.759268",
"0.7584847",
"0.7582985",
"0.7576099",
"0.7559126",
"0.7510876",
"0.74347377",
... | 0.7951692 | 6 |
Function implements sieve of Eratosthenes (for all numbers uptil N). Returns array erat_sieve If erat_sieve[i] is True, then 2i + 3 is a prime. | def sieve_of_erat(N):
lim = int(N/2)
if N % 2 == 0:
lim -= 1
erat_sieve = [True]*lim
prime_list = []
prime_list.append(2)
for i in range(int((sqrt(N)-3)/2)+1): # Only need to run till sqrt(n)
if erat_sieve[i] == True:
j = i + (2*i+3)
while j < lim:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primeSieve(n):\n result = []\n sieve = array.array('i', (True for i in range(0, n+1)))\n for k in range(2, n+1):\n if sieve[k]:\n result.append(k)\n i = k * k\n while i <= n:\n sieve[i] = False\n i += k\n return result",
"def s... | [
"0.773296",
"0.7711814",
"0.76372546",
"0.75075114",
"0.7439609",
"0.7437077",
"0.74062085",
"0.7397674",
"0.7397674",
"0.7349972",
"0.73471904",
"0.73272383",
"0.72301954",
"0.7228703",
"0.7198129",
"0.710065",
"0.70861787",
"0.7082205",
"0.70553046",
"0.7047402",
"0.7028072... | 0.75507444 | 3 |
Return the AWS service name the client is communicating with. | def get_service_name(wrapped, instance, args, kwargs):
if "serviceAbbreviation" not in instance._service_model.metadata:
return instance._service_model.metadata["endpointPrefix"]
return instance._service_model.metadata["serviceAbbreviation"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> pulumi.Output... | [
"0.782867",
"0.782867",
"0.78069615",
"0.78069615",
"0.78069615",
"0.76763904",
"0.76327074",
"0.74933684",
"0.74933684",
"0.74933684",
"0.7377166",
"0.7377166",
"0.7377166",
"0.7220469",
"0.7048508",
"0.68280995",
"0.67807144",
"0.67807144",
"0.67807144",
"0.67807144",
"0.67... | 0.68279505 | 16 |
Contextmanager for consistent syntax for maybe creating a tempdir | def maybe_tempdir(create=False):
if create:
try:
path = tempfile.mkdtemp()
yield path
finally:
shutil.rmtree(path)
else:
yield None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.prevdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp()\n os.chdir(self.tempdir)\n return self.tempdir\n\n def __exit__(self, *a, **kwa):\n os.chdir(self.prevdir)\n ... | [
"0.799502",
"0.73509675",
"0.72976846",
"0.7288646",
"0.7164584",
"0.71433455",
"0.71317875",
"0.71153635",
"0.7106508",
"0.70851755",
"0.7062332",
"0.7044",
"0.7021753",
"0.7013624",
"0.7006995",
"0.7001173",
"0.698447",
"0.696267",
"0.694793",
"0.6918846",
"0.69073695",
"... | 0.63843256 | 65 |
Called when browse button is clicked. Opens a dialog for choosing a directory. | def on_pushButtonBrowse_clicked(self, checked=None):
if checked is None: return
path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Select path',
self.ui.lineEditPath.text()))
if path != '':
self.ui.lineEditPath.setText(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Browse(self):\n \n #run the folder manipulation routines...\n self.dir_opt = options = {}\n options['mustexist'] = False\n options['title'] = 'Select a directory...'\n \n #launch the directory selector\n self.FolderPath = tkFileDialog.askdirectory(**self.dir_opt... | [
"0.8427667",
"0.80031145",
"0.8002596",
"0.79762334",
"0.7665582",
"0.7636856",
"0.7631896",
"0.7581098",
"0.7563699",
"0.74676603",
"0.74283385",
"0.74200284",
"0.73879087",
"0.73694336",
"0.7308274",
"0.7290915",
"0.7237306",
"0.72122735",
"0.7200747",
"0.71985155",
"0.7170... | 0.695883 | 28 |
r"""Batches all the inputs tensors to the computation done by the function. So, for example, in the following code ```python This input will be captured. y = tf.placeholder_with_default(1.0, shape=[]) .Defun(tf.float32) | def batch_function(in_tensors, captured_tensors, f, num_batch_threads, max_batch_size, batch_timeout_micros, Tout, max_enqueued_batches=10, allowed_batch_sizes=[], container="", shared_name="", batching_queue="", name=None):
_ctx = _context._context or _context.context()
tld = _ctx._thread_local_data
if tld.is_ea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def placeholder_inputs(batch_size):\n # Note that the shapes of the placeholders match the shapes of the full\n # image and label tensors, except the first dimension is now batch_size\n # rather than the full size of the train or test data sets.\n images_placeholder = tf.placeholder(tf.float32, shape=(batch_si... | [
"0.6508007",
"0.64802307",
"0.6434134",
"0.64083505",
"0.63511044",
"0.6269741",
"0.6250925",
"0.6200331",
"0.6154571",
"0.6153634",
"0.6126394",
"0.60500795",
"0.6028137",
"0.5977615",
"0.59559685",
"0.5911686",
"0.59040225",
"0.5877501",
"0.5869796",
"0.58564246",
"0.584525... | 0.6124109 | 11 |
Returns the Channels Group name that sockets should subscribe to to get sent messages as they are generated. | def group_name(self):
return "DocumentChat-%s" % self.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def _get_peer_group_name(self):\n return self.__peer_group_name",
"def get_group_name(self):\n return self.groupname",
"def websocket_group(self):\n return Group(\"room-%s\" % self.id)",
"def websocket_group(self... | [
"0.6473432",
"0.6473432",
"0.6464958",
"0.64339924",
"0.6428786",
"0.6423476",
"0.6367091",
"0.6313031",
"0.62293684",
"0.62001145",
"0.61881447",
"0.61680496",
"0.6106678",
"0.6095192",
"0.60863835",
"0.60804445",
"0.6052282",
"0.6046981",
"0.6019369",
"0.6003571",
"0.597960... | 0.67025906 | 0 |
Returns a list of all supported gender values | def genders(self):
return Client.gender_choices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gender_definitions(self):\n try:\n return [\"Male\", \"Female\", \"Other\", \"Prefer not to say\"]\n\n except Exception as e:\n self._log.exception(\"Could not execute user get gender definitions logic\")\n return abort(500)",
"def gender():\r\n\r\n ... | [
"0.7901145",
"0.69290006",
"0.667544",
"0.66543764",
"0.6632433",
"0.6491739",
"0.6347266",
"0.63284165",
"0.6315022",
"0.6280871",
"0.6280871",
"0.62414575",
"0.62414575",
"0.6168826",
"0.61143893",
"0.61055756",
"0.6062132",
"0.6021914",
"0.6006925",
"0.5909424",
"0.5887977... | 0.75573355 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.