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 |
|---|---|---|---|---|---|---|
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(ModifyParametersResponse, self).__init__(*args, **kwds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77949476",
"0.7720804",
"0.7720804",
"0.7686951",
"0.762662",
"0.75640523",
"0.7440169",
"0.74174535",
"0.73515964",
"0.73084396",
"0.7280321",
"0.7237698",
"0.7227384",
"0.72244126",
"0.72244126",
"0.72194636",
"0.72119427",
"0.72119427",
"0.72119427",
"0.72119427",
"0.72... | 0.0 | -1 |
Converts meters to milimeters. | def m_to_mm(meters):
return meters * 1000.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meters_to_miles(meters):\n miles = meters / 1609.344\n return miles",
"def mm_to_m(millimeters):\n return millimeters / 1000.0",
"def km2m(km):\n return km * 1000",
"def to_meters(d, d_unit):\n if d_unit == UOM_M:\n dm = d\n elif d_unit == UOM_KM:\n dm = d * 1000\n elif... | [
"0.8099118",
"0.7654807",
"0.75052965",
"0.747334",
"0.73941135",
"0.73189515",
"0.7245095",
"0.7101393",
"0.6990333",
"0.6884329",
"0.68485934",
"0.68464553",
"0.68314904",
"0.667797",
"0.6649009",
"0.6564214",
"0.6540102",
"0.64470494",
"0.64375705",
"0.64063",
"0.6398858",... | 0.80986494 | 1 |
Converts millimeters to meters. | def mm_to_m(millimeters):
return millimeters / 1000.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_to_mm(meters):\n return meters * 1000.0",
"def km2m(km):\n return km * 1000",
"def meters_to_miles(meters):\n miles = meters / 1609.344\n return miles",
"def to_meters(d, d_unit):\n if d_unit == UOM_M:\n dm = d\n elif d_unit == UOM_KM:\n dm = d * 1000\n elif d_unit ==... | [
"0.8026335",
"0.7807353",
"0.76467115",
"0.7620023",
"0.756225",
"0.7516817",
"0.74047",
"0.7377517",
"0.70911825",
"0.7033034",
"0.7021843",
"0.7006877",
"0.6976809",
"0.69229585",
"0.68587154",
"0.68578655",
"0.6847806",
"0.6797553",
"0.67707723",
"0.66906095",
"0.6673733",... | 0.81466347 | 0 |
Convert a corpus of 1grams to ngrams | def ngramify(corpus, n):
unlist = 0
if type(corpus[0]) is not list:
corpus = [corpus]
unlist = 1
new_corpus = []
for line in corpus:
new_line = []
for gram in range(len(line) - n + 1):
new_gram = ""
for i in range(n):
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_ngrams(texts,n,ngram_mod):\r\n return [turnmod(doc,n,ngram_mod) for doc in texts]",
"def generate_ngram(corpus,n=2):\r\n def generate_ngram_str(text,n):\r\n text = tokenizer.tokenize(text)\r\n for i in range(0, len(text)-n+1):\r\n yield text[i:i+n]\r\n if isinstance(cor... | [
"0.68439054",
"0.68354195",
"0.6796388",
"0.6778834",
"0.6559013",
"0.65142643",
"0.65136415",
"0.64913404",
"0.64857227",
"0.64513016",
"0.64390874",
"0.6382145",
"0.63761294",
"0.63665086",
"0.636636",
"0.6361948",
"0.6361869",
"0.6298943",
"0.62661195",
"0.62141836",
"0.62... | 0.723488 | 0 |
Output the list of neighbors of this vertex. | def __str__(self):
return f"{self.name} adjacent to {[x.name for x in self.neighbors]}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbors(self):\n # return the neighbors\n # if len(self.neighbors.keys()) != 0:\n # # print('\\n')\n return self.neighbors.keys()\n # else:\n # # print(self.id)\n # raise ValueError('No neighbors')\n # return self.neighbors.keys()",
"... | [
"0.7470071",
"0.7388382",
"0.73658884",
"0.7348766",
"0.7325524",
"0.72469354",
"0.7228414",
"0.7228414",
"0.7228414",
"0.7228414",
"0.72214717",
"0.72050905",
"0.7083574",
"0.706749",
"0.6941783",
"0.6898203",
"0.6884782",
"0.6883768",
"0.6878985",
"0.6869419",
"0.68587565",... | 0.60639775 | 59 |
Return the neighbors of this vertex. | def get_neighbors(self):
return self.neighbors.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self):\n return self.graph.neighbors(self.id)",
"def neighbors(self):\n return self._neighbors",
"def neighbors(self):\n return self.mesh.neighbors()",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighbors",
... | [
"0.8577959",
"0.85306996",
"0.850339",
"0.8190792",
"0.8190792",
"0.8190792",
"0.8190792",
"0.81690764",
"0.8124509",
"0.806112",
"0.8030858",
"0.8014107",
"0.7952302",
"0.7918339",
"0.7856372",
"0.78494",
"0.78207767",
"0.7726381",
"0.7726381",
"0.76581526",
"0.7603187",
"... | 0.79144543 | 14 |
Return all the vertices in the graph. | def get_vertices(self):
return list(self.vertices.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n return list(self._graph)",
"def vertices(self):\n return list(self.__graph.values())",
"def get_vertices(self):\n return self.graph.keys()",
"def vertices(self):\n return list(self.graph_dict.keys())",
"def vertices(self):\n return list(self.__graph_... | [
"0.8706675",
"0.8674397",
"0.8478822",
"0.840716",
"0.8383381",
"0.8383381",
"0.8383381",
"0.8362319",
"0.8341675",
"0.8071636",
"0.79845595",
"0.7951315",
"0.79113555",
"0.7865437",
"0.7850983",
"0.7835449",
"0.78261626",
"0.7816375",
"0.7802192",
"0.7802192",
"0.77639514",
... | 0.7987539 | 10 |
calculate the index parameters for einsum | def calc_einsum_idx(bits, n):
assert len(bits) + n <= len(SYMBOLS)
tens_in = SYMBOLS[:n]
tens_out = list(tens_in)
mat_left = ''
mat_right = ''
for pos, idx in enumerate(reversed(bits)):
mat_left += SYMBOLS[-1 - pos]
mat_right += tens_in[-1 - idx]
tens_out[-1 - idx] = SY... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def einsum(subscripts, *operands):\n raise NotImplementedError",
"def einsum(ops, *args):\n\n if len(args) != 2:\n raise ValueError(\"Currently only two operands are supported\")\n\n inops, outops = ops.split('->')\n inops = inops.split(',')\n\n # All indices that are in input AND in ou... | [
"0.64451003",
"0.61576843",
"0.58611125",
"0.5857245",
"0.58121216",
"0.5806508",
"0.56761134",
"0.5593677",
"0.55833584",
"0.5572559",
"0.55683815",
"0.55683815",
"0.5552588",
"0.55447793",
"0.5543061",
"0.553615",
"0.55137575",
"0.5483152",
"0.5481554",
"0.5456765",
"0.5454... | 0.56422937 | 7 |
Moves the center of the layer to the given mobject or point | def move_to(self, mobject_or_point):
layer_center = self.surrounding_rectangle.get_center()
if isinstance(mobject_or_point, Mobject):
target_center = mobject_or_point.get_center()
else:
target_center = mobject_or_point
self.shift(target_center - layer_center) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recenter(self, point=(0, 0)):\n self.center = Point(*point)",
"def move_center(obj):\n desktop = QApplication.desktop()\n dw = desktop.width()\n dh = desktop.height()\n size = obj.size()\n mw = size.width()\n mh = size.height()\n obj.move(dw/2-mw/2, dh/2-mh/2)",
"def __moveCente... | [
"0.7170075",
"0.71628433",
"0.7028819",
"0.6874346",
"0.6856329",
"0.67638797",
"0.67320794",
"0.661841",
"0.64701086",
"0.64391935",
"0.64171493",
"0.6359452",
"0.6278079",
"0.62632585",
"0.6257007",
"0.6234732",
"0.62116873",
"0.6211445",
"0.6211445",
"0.62025553",
"0.61969... | 0.8354218 | 0 |
Initalize name and age attibutes. | def __init__(self, name, age):
self.name = name
self.age = age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, first_name, last_name, age):\n self.first_name = first_name\n self.last_name = last_name\n self.age = age",
"def __init__(self, first_name, last_name, age):\n self.first_name = first_name\n self.last_name = last_name\n self.age = age",
"def __init__(... | [
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.7472384",
"0.736729",
"0.7351724",
"0.7351724",
"0.7351724",
"0.7351724",
"0.72921795",
"0.7189177",
"0.7124933",
"0.711583",
"0.6997387",
"0.6881059",
"0.686831... | 0.75609356 | 0 |
Draw a lane on top of the input image. | def draw_lane(warped, undist, ploty, left_fitx, right_fitx):
warp_zero = np.zeros_like(warped).astype(np.uint8)
color_warp = np.dstack((warp_zero, warp_zero, warp_zero))
# Recast the x and y points into usable format for cv2.fillPoly()
pts_left = np.array([np.transpose(np.vstack([left_fitx, ploty]))])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_lane_on_img(undist, warped, left_fitx, right_fitx, ploty, Minv, curvature, distance):\n # Create an image to draw the lines on\n warp_zero = np.zeros_like(warped).astype(np.uint8)\n color_warp = np.dstack((warp_zero, warp_zero, warp_zero))\n\n # Recast the x and y points into usable format for... | [
"0.67943126",
"0.66649216",
"0.64818674",
"0.6418783",
"0.63952714",
"0.62138444",
"0.6211565",
"0.619524",
"0.61348593",
"0.60031664",
"0.5998958",
"0.59781384",
"0.59550387",
"0.5897628",
"0.5897591",
"0.58611846",
"0.5840195",
"0.582475",
"0.5760503",
"0.5707468",
"0.57030... | 0.6702092 | 1 |
Compute curvature of the lane. | def compute_curvature(ploty, left_fitx, right_fitx):
ym_per_pix = 30 / 720 # meters per pixel in y dimension
xm_per_pix = 3.7 / 700 # meters per pixel in x dimension
y_eval = np.max(ploty)
# Fit new polynomials to x,y in world space
left_fit_cr = np.polyfit(ploty * ym_per_pix, left_fitx * xm_per... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curvature(self):\n return self.circle().curvature(self.o, self.r, p = self.a)",
"def curvature(self):\n if self.x[0] == self.x[-1] and self.y[0] == self.y[-1]:\n x_looped=self.x\n y_looped=self.y\n else:\n x_looped=np.append(self.x,self.x[0])\n ... | [
"0.78845567",
"0.75644016",
"0.74950033",
"0.7323651",
"0.7076267",
"0.705644",
"0.7043518",
"0.7040169",
"0.7038423",
"0.70067185",
"0.70010746",
"0.69800335",
"0.6798102",
"0.67309994",
"0.65965605",
"0.6489783",
"0.6463339",
"0.6454901",
"0.6219937",
"0.62174886",
"0.61240... | 0.62173545 | 20 |
Create a new Hub instance. The arguments this base class accepts defines the API that Hubs have to work with. A Hub does not get free reign over everything in the anaconda class, as that would be a big mess. Instead, a | def __init__(self, data, storage, payload, instclass):
GUIObject.__init__(self, data)
common.Hub.__init__(self, storage, payload, instclass)
# enable the autoContinue feature if we are in kickstart
# mode, but if the user interacts with the hub, it will be
# disabled again
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hub(*args, **kwargs): # pylint:disable=unused-argument\n\n return get_hub_noargs()",
"def __new__(cls, *args, **kwargs):\n\n if cls.__instance is None:\n cls.__instance = super().__new__(cls, *args, **kwargs)\n return HueBridge.__instance",
"def hub(self) -> N4Hub:\n ... | [
"0.6333296",
"0.6185106",
"0.5881818",
"0.58691466",
"0.5821281",
"0.57845896",
"0.57837033",
"0.57112443",
"0.5707279",
"0.56418616",
"0.5617311",
"0.5607532",
"0.5542869",
"0.5524708",
"0.55055356",
"0.54557866",
"0.54540545",
"0.5453736",
"0.5448733",
"0.5445865",
"0.54456... | 0.0 | -1 |
Test run prefix failure when project is not owned. | def test_run_prefix__not_owned_project(mocker):
runner = CliRunner()
mocked_login = mocker.patch.object(APIClient, "login", return_value=None)
mocked_get_sample_sheet = mocker.patch.object(
APIClient,
"get_sample_sheet",
side_effect=APIClientError(message="", status_code=403),
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owner(self):\n self.assertIsNone(self.env.project_repo_owner)",
"def test_run_prefix__bad_project_id(mocker):\n runner = CliRunner()\n mocked_login = mocker.patch.object(APIClient, \"login\", return_value=None)\n mocked_get_sample_sheet = mocker.patch.object(\n APIClient,\n \"g... | [
"0.6864181",
"0.6602463",
"0.6333457",
"0.6300504",
"0.6300504",
"0.6300504",
"0.62660736",
"0.62457985",
"0.6192925",
"0.61408246",
"0.61408246",
"0.6139142",
"0.6121623",
"0.6077299",
"0.60644114",
"0.6046862",
"0.60282046",
"0.6022516",
"0.60222137",
"0.5997651",
"0.598971... | 0.76186424 | 0 |
Test run prefix when all paths are filtered out. | def test_run_prefix__filter_empty(mocker):
runner = CliRunner()
mocked_login = mocker.patch.object(APIClient, "login", return_value=None)
mocked_get_sample_sheet = mocker.patch.object(
APIClient,
"get_sample_sheet",
return_value=SampleSheet(**MOCKED_EMPTY_UPLOADS),
)
mocked_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testIgnoredPrefix(self):\n\n INPUT = \\\n\"\"\"MODULE windows x86 111111111111111111111111111111111 module1.pdb\nINFO CODE_ID FFFFFFFF module1.exe\nFILE 1 /src/build/foo/../file1_1.cc\nFILE 2 /src/build/bar/../file1_2.cc\nFILE 3 /src/build/baz/../file1_2.cc\nFUNC 1000 c 0 Function1_1\n1000 8 45 2\n1008 4 46... | [
"0.6349929",
"0.6131987",
"0.60549086",
"0.6046119",
"0.60353076",
"0.5917593",
"0.58634615",
"0.5739606",
"0.5685225",
"0.5683032",
"0.564694",
"0.5612115",
"0.5610498",
"0.5575685",
"0.55119973",
"0.55070037",
"0.5502701",
"0.5493641",
"0.54747695",
"0.5461724",
"0.5451959"... | 0.6141838 | 1 |
Normalize url strip extra slashes | def normalize_url(url: str) -> str:
parts = urlparse(url)
path = quote(parts.path)
while '//' in path:
path = path.replace("//", "/")
return urlunparse(parts._replace(path=path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_url(self, url):\n pass",
"def test_remove_extra_slash():\n # TODO: Should we actually do this?\n # TODO: See https://webmasters.stackexchange.com/questions/8354/what-does-the-double-slash-mean-in-urls/8381#8381\n assert (normalize_url(\"http://www.example.com/foo//bar.html\") ==\n ... | [
"0.8238166",
"0.76687336",
"0.74364126",
"0.7385651",
"0.73251337",
"0.732249",
"0.7312243",
"0.73107517",
"0.72585523",
"0.722911",
"0.7179825",
"0.7145567",
"0.7135223",
"0.7101815",
"0.7081153",
"0.703944",
"0.69733435",
"0.6961975",
"0.69546723",
"0.69366103",
"0.69047874... | 0.7903861 | 1 |
Returns either ResourceSet or Resource object depending on the method used on the ResourceManager | def __getattr__(self, resource):
return ResourceManager(self, resource) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_manager():\n return visa.ResourceManager()",
"def get(owner_name, resource_name):\n resource = get_node(owner_name, resource_name)\n return resource if isinstance(resource, Resource) else None",
"def get_resource(self, name: str) -> ResourceBase:\n resource = self.get_payload(name)... | [
"0.6427367",
"0.6302617",
"0.6212542",
"0.6141588",
"0.61380017",
"0.61308825",
"0.599233",
"0.5954676",
"0.5905831",
"0.5905831",
"0.5903391",
"0.5851032",
"0.582217",
"0.5812098",
"0.5799584",
"0.5788237",
"0.57741416",
"0.5759168",
"0.5722071",
"0.57105094",
"0.57105094",
... | 0.72057605 | 0 |
Unload a PS4 config entry. | async def async_unload_entry(hass, entry):
await hass.config_entries.async_forward_entry_unload(
entry, 'media_player')
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(opp: OpenPeerPower, entry: ConfigEntry):\n unload_ok = await opp.config_entries.async_unload_platforms(entry, PLATFORMS)\n if unload_ok:\n opp.data[DOMAIN].pop(entry.entry_id)\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):... | [
"0.63136554",
"0.62951547",
"0.62818575",
"0.62721974",
"0.61352473",
"0.61295736",
"0.6101547",
"0.60732883",
"0.60732883",
"0.60732883",
"0.60732883",
"0.60732883",
"0.60732883",
"0.6034596",
"0.6034596",
"0.6033568",
"0.6033239",
"0.6013711",
"0.6013711",
"0.6013711",
"0.6... | 0.5564422 | 73 |
Return the training labels in a window for a scene. | def get_train_labels(self, window, scene):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_labels(self, window: Box, scene: Scene) -> np.ndarray:\n label_store = scene.ground_truth_label_source\n return label_store.get_labels(window)",
"def get_train_labels(self, window: Box, scene: Scene) -> Labels:\n raise NotImplementedError()",
"def get_train_windows(self, scen... | [
"0.7966283",
"0.7798991",
"0.7265608",
"0.6694866",
"0.65028435",
"0.62377584",
"0.5988588",
"0.584093",
"0.5775172",
"0.5762933",
"0.5709718",
"0.5704332",
"0.56375337",
"0.5596694",
"0.5583465",
"0.5571005",
"0.5531313",
"0.5474767",
"0.5474767",
"0.5454555",
"0.5451008",
... | 0.82684714 | 0 |
Return windows to compute predictions for. | def get_predict_windows(self, extent):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_by_windows(net, windows):\n prediction, inputs = [], []\n for input in windows:\n _, pred = tr.max(net(Variable(tr.LongTensor(input))).data, 1)\n prediction.append(pred)\n inputs.append(input[2])\n return prediction, inputs",
"def get_windows(self, x_train, y_train):\n\n... | [
"0.7308443",
"0.69149125",
"0.6751682",
"0.65363765",
"0.65172076",
"0.6336955",
"0.62844676",
"0.6257712",
"0.6154276",
"0.6135209",
"0.6122107",
"0.60169363",
"0.59938544",
"0.59687746",
"0.5958213",
"0.595314",
"0.5927065",
"0.5912988",
"0.58769995",
"0.5872762",
"0.581108... | 0.7434657 | 0 |
Inverse Generalized Pareto distribution function | def _gpinv(p, k, sigma):
x = np.full_like(p, np.nan)
if sigma <= 0:
return x
ok = (p > 0) & (p < 1)
if np.all(ok):
if np.abs(k) < np.finfo(float).eps:
x = - np.log1p(-p)
else:
x = np.expm1(-k * np.log1p(-p)) / k
x *= sigma
else:
if np.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ginverse(p, x):\n x_ = x.data\n sinu = torch.sin(p.narrow(-1,0,1)).pow(2)\n x_.narrow(-1,1,1).mul_(sinu.pow(-1))\n return x_",
"def inversePois( N, **kwargs):\n if 'rateParameter' in kwargs.keys() and kwargs['rateParameter'] is not None:\n rateParameter = kwargs['rateParameter']\n el... | [
"0.67397004",
"0.6464465",
"0.6321824",
"0.62746143",
"0.62618697",
"0.62309855",
"0.6205447",
"0.615529",
"0.61459124",
"0.6023905",
"0.6023905",
"0.60104656",
"0.60021293",
"0.5937363",
"0.5922518",
"0.5910365",
"0.5904778",
"0.5899963",
"0.5867539",
"0.58445907",
"0.583822... | 0.6126141 | 9 |
R"""Calculates the simulation standard error, accounting for nonindependent samples. The trace is divided into batches, and the standard deviation of the batch means is calculated. | def mc_error(x, batches=5):
if x.ndim > 1:
dims = np.shape(x)
#ttrace = np.transpose(np.reshape(trace, (dims[0], sum(dims[1:]))))
trace = np.transpose([t.ravel() for t in x])
return np.reshape([mc_error(t, batches) for t in trace], dims[1:])
else:
if batches == 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _loss_std_mean(self, iterations):\n\n loss_array = np.array(self._loss_list[-iterations:])\n return loss_array.mean(), loss_array.std()",
"def example1(N):\n\tX = np.random.rand(N)\n\tI_estm = np.mean(X**3)\n\ts_square = np.var(X**3) *N / (N-1)\n\tstd_error = np.sqrt(s_square/N) \n\tprint(\"sim... | [
"0.70057946",
"0.68390673",
"0.66659987",
"0.6662417",
"0.6657394",
"0.66327155",
"0.65887237",
"0.6581318",
"0.6569803",
"0.6560721",
"0.6551147",
"0.6524239",
"0.6516896",
"0.6500014",
"0.6454315",
"0.64295864",
"0.64202684",
"0.6395534",
"0.6385373",
"0.636469",
"0.6338079... | 0.0 | -1 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
continue_on_error = dictionary.get('continueOnError')
is_active = dictionary.get('isActive')
script_params = dictionary.get('scrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.8317774",
"0.81688094",
"0.81688094",
"0.81190014",
"0.80890834",
"0.7978278",
"0.7949868",
"0.7922533",
"0.78986734",
"0.7894851",
"0.7887616",
"0.7882821",
"0.78817123",
"0.7876602",
"0.78581864",
"0.78390956",
"0.7804517",
"0.7804517",
"0.7804517",
"0.7804517",
"0.78045... | 0.0 | -1 |
Gets the arrays containing cartesian components of velocity (Vx,Vy,Vz) corresponding to [i,j,k] points | def obtain_vel_timestep(self, tstep):
return np.swapaxes(np.array([np.ndarray.flatten(self.data["Base"]["Zone1"]["FlowSolution_%04d" % tstep]["VelocityX"][" data"][:, :, :]),
np.ndarray.flatten(self.data["Base"]["Zone1"]["FlowSolution_%04d" % tstep]["VelocityY"][" data"][:, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec(self):\r\n\r\n xv = np.arange(self.dx / 2, self.lx, self.dx)\r\n yv = np.arange(-self.ly / 2 + self.dy / 2, self.ly / 2, self.dy)\r\n zv = np.arange(self.oz, self.lz + self.oz, self.dz)\r\n\r\n if self.ox != 0:\r\n xv = np.arange(self.ox, self.lx + self.ox, self.dx)\r... | [
"0.7101398",
"0.70776194",
"0.70124835",
"0.700386",
"0.68758",
"0.68413407",
"0.67421407",
"0.6700389",
"0.665668",
"0.6633154",
"0.66116726",
"0.6575808",
"0.6548541",
"0.65302455",
"0.65032643",
"0.64823025",
"0.64748967",
"0.6474298",
"0.6413701",
"0.6366578",
"0.6335503"... | 0.0 | -1 |
Removes invalid characters from file name. | def sanitize_filename(f):
keepchars = (" ", ".", "_")
return "".join(c for c in f if c.isalnum() or c in keepchars).rstrip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _clean_filename(name):\n return re.sub(\"[^\\\\w .]\", \"\", name)",
"def cleanFilename(filename):\n badChars = {ord('?'): None, ord('*'): None, ord('/'): None,\n ord('\\\\'): None, ord(':'): None, ord('\"'): \"''\",\n ord('<'): None, ord('>'): None, ord('|'): None}\n r... | [
"0.84822077",
"0.83218986",
"0.8280965",
"0.8243771",
"0.8064014",
"0.80218416",
"0.8019753",
"0.79930943",
"0.79808086",
"0.79590577",
"0.78875965",
"0.78869075",
"0.7878406",
"0.7813342",
"0.7808066",
"0.77896094",
"0.7748946",
"0.7722432",
"0.770628",
"0.76743174",
"0.7639... | 0.8127544 | 4 |
Create training state dictionary to keep track of improvements during training. | def make_train_state(save_path, early_stopping_patience):
return {'stop_early': False,
'early_stopping_step': 0,
'early_stopping_patience': early_stopping_patience,
'steps': 0,
'min_val_loss': float('Inf'),
'train_loss': [],
'val_loss': [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_dict(self):\n return {\n 'epoch': self.epoch,\n 'iterations_in_epoch': self.iterations_in_epoch,\n }",
"def __getstate__(self) -> Dict:\n # Add config to state so complete Algorithm can be reproduced w/o it.\n state = {\n \"algorithm_class\":... | [
"0.70667714",
"0.6986455",
"0.695569",
"0.6848989",
"0.6802879",
"0.6705729",
"0.67004836",
"0.6661675",
"0.6623169",
"0.65840894",
"0.65807706",
"0.6573176",
"0.65642005",
"0.65642005",
"0.6504052",
"0.64976233",
"0.64318424",
"0.6423986",
"0.64161533",
"0.6389785",
"0.63788... | 0.70746076 | 0 |
Initialize a which connects from `pre_layer` to `post_layer`. | def __init__(self, pre_layer, post_layer, weight, config):
self.pre_layer = pre_layer
self.post_layer = post_layer
self.weight = weight
self._last_pre_spike_time = -torch.ones(self.pre_layer.size) # -1 means never fired
self._last_post_spike_time = -torch.ones(self.post_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Connect(self, pre, post, w):\n self.connections.append([pre, post, w])",
"def __init__(self):\n self.layer_scope = None\n self.out = None",
"def connect_layers(self):\n if not self.check():\n msg = \"Failed to check neural network.\"\n print(msg)\n ... | [
"0.65301245",
"0.6225404",
"0.6123501",
"0.6088971",
"0.6046199",
"0.6029564",
"0.58880097",
"0.5881301",
"0.5860258",
"0.5846217",
"0.5773738",
"0.57559687",
"0.56904185",
"0.5675919",
"0.5671891",
"0.5670746",
"0.5643728",
"0.5621509",
"0.5606108",
"0.5578978",
"0.55730325"... | 0.6766845 | 0 |
Updates weights when new prespikes come. | def update_on_pre_spikes(self, time):
if self.static:
return
# decay first
dw = self.decay * (self.w_max - self.w_min)
self.weight -= RRAM_device_variation(self.variation, dw)
self._clamp()
# record new pre-spikes
self._last_pre_spike_time.masked_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value\n self.weights_clipping()",
"def init_weights(self, pretrained=None):\n ... | [
"0.7214913",
"0.6945532",
"0.687607",
"0.6638368",
"0.651723",
"0.6458818",
"0.643688",
"0.64160323",
"0.6371484",
"0.6364129",
"0.6308953",
"0.6307685",
"0.6282611",
"0.6259005",
"0.6230916",
"0.6229917",
"0.62296224",
"0.62021476",
"0.6186296",
"0.61845326",
"0.61343277",
... | 0.7237097 | 0 |
Updates weights when new postspikes come. | def update_on_post_spikes(self, time):
if self.static:
return
# record new post-spikes
self._last_post_spike_time.masked_fill_(self.post_layer.firing_mask, time)
# mask
pre_active = self._last_pre_spike_time >= 0
active = torch.ger(pre_active, self.post_laye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def updateWeights(self, message):\n prefWeights = [self.prefWghts1.GetValue(), \n self.prefWghts2.GetValue(), \n self.prefW... | [
"0.6742675",
"0.65955687",
"0.6279314",
"0.62568784",
"0.6165243",
"0.607181",
"0.5963555",
"0.5961713",
"0.5933013",
"0.58582705",
"0.5843206",
"0.5817981",
"0.57951903",
"0.5776321",
"0.56932354",
"0.5675878",
"0.56726027",
"0.56687224",
"0.5665927",
"0.56616205",
"0.564814... | 0.7269296 | 0 |
Load the recipe yaml and returns a Recipe dataclass | def load_yaml(cls, file=None):
if file is None: file = f'{rcp.base_path}cfg.yml'
try:
with open(file, 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
cfg.__dict__ = config
return cfg
except FileNotFoundError:
print("Config ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_autopkg_recipe(path):\n recipe = None\n\n if path.endswith(\".yaml\"):\n try:\n # try to read it as yaml\n with open(path, \"rb\") as f:\n recipe = yaml.safe_load(f)\n except Exception as err:\n print(\"{}: yaml parsing error: {}\".format... | [
"0.6865065",
"0.6718186",
"0.67070127",
"0.6392108",
"0.6171312",
"0.6160998",
"0.6091691",
"0.6087048",
"0.60724753",
"0.60639375",
"0.60081846",
"0.592371",
"0.5899842",
"0.58580077",
"0.5772508",
"0.5772058",
"0.56736004",
"0.5667542",
"0.56611776",
"0.56518984",
"0.563545... | 0.0 | -1 |
Load the recipe yaml and returns a Recipe dataclass | def load_yaml(cls, file=None):
if file is None:
file = f'{cls.base_path}rcp_{rcp.stage}.yml'
try:
with open(file, 'r') as f:
recipe = yaml.load(f, Loader=yaml.FullLoader)
rcp.__dict__ = recipe
return rcp
except FileNotFoundError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_autopkg_recipe(path):\n recipe = None\n\n if path.endswith(\".yaml\"):\n try:\n # try to read it as yaml\n with open(path, \"rb\") as f:\n recipe = yaml.safe_load(f)\n except Exception as err:\n print(\"{}: yaml parsing error: {}\".format... | [
"0.6863815",
"0.67161316",
"0.6389472",
"0.6170314",
"0.6159039",
"0.6093254",
"0.6084738",
"0.6072883",
"0.60644436",
"0.60066324",
"0.5922645",
"0.59006864",
"0.5859308",
"0.5773187",
"0.5771925",
"0.5674321",
"0.56665534",
"0.566062",
"0.5652187",
"0.5636064",
"0.5628614",... | 0.67065614 | 2 |
Test that Client.get_organizations correctly handles error response | def test_client_get_organizations_error(mocker, error_message, capsys):
mocker.patch("tracker_client.client.get_auth_token")
mocker.patch("tracker_client.client.create_client")
test_client = Client()
test_client.execute_query = mocker.MagicMock(return_value=error_message)
with pytest.raises(ValueEr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_l_organizations(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_getorganizations_item(self):\n pass",
"def test_organizations_read(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_getorgs(self):\n ... | [
"0.7717444",
"0.7567782",
"0.7508172",
"0.74716",
"0.73793566",
"0.7350932",
"0.7154086",
"0.6964535",
"0.68975323",
"0.68658894",
"0.68622684",
"0.6833181",
"0.68085074",
"0.676628",
"0.67517614",
"0.6746029",
"0.67350936",
"0.66046906",
"0.6589324",
"0.6540158",
"0.6537453"... | 0.7242379 | 6 |
Test that Client.get_organization correctly handles error response | def test_client_get_organization_error(mocker, error_message, capsys):
mocker.patch("tracker_client.client.get_auth_token")
mocker.patch("tracker_client.client.create_client")
test_client = Client()
test_client.execute_query = mocker.MagicMock(return_value=error_message)
with pytest.raises(ValueErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_client_get_organizations_error(mocker, error_message, capsys):\n mocker.patch(\"tracker_client.client.get_auth_token\")\n mo... | [
"0.79906636",
"0.773056",
"0.73287123",
"0.72179586",
"0.72005486",
"0.71193105",
"0.71161807",
"0.7050821",
"0.701269",
"0.6973437",
"0.69446194",
"0.68851227",
"0.67593706",
"0.6699409",
"0.66743374",
"0.66459197",
"0.6642057",
"0.6603917",
"0.6602872",
"0.6585254",
"0.6542... | 0.7342035 | 2 |
Separate out the template and directory from an image name. | def _image2template_directory(filename):
directory = os.path.dirname(filename)
if not directory:
# then it should be the current working directory
directory = os.getcwd()
image = os.path.split(filename)[-1]
template = _image2template(image)
return template, directory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_to_name(img):\n\n return os.path.dirname(img) + '_' + os.path.basename(img)",
"def image_name(name):\n \n # Gets the '.' position\n dot = name.find('.')\n # Slice the name from beginning and before '.'\n img = name[:dot]\n # return string with jpg format\n return \"{}.jpg\".forma... | [
"0.69408995",
"0.6702387",
"0.6644299",
"0.66365147",
"0.6617208",
"0.65734774",
"0.63994396",
"0.6356103",
"0.6339548",
"0.6335136",
"0.62565047",
"0.61662126",
"0.6154113",
"0.6145367",
"0.61179394",
"0.6114574",
"0.607338",
"0.6069159",
"0.60652024",
"0.6063564",
"0.606054... | 0.7161358 | 0 |
Find images which match the input template in the directory provided. | def find_matching_images(template, directory):
files = os.listdir(directory)
# to turn the template to a regular expression want to replace
# however many #'s with EXACTLY the same number of [0-9] tokens,
# e.g. ### -> ([0-9]{3})
# change 30/may/2008 - now escape the template in this search to co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(filename):\n\n template, directory = scan_helper_image_files.image_to_template_directory(\n filename\n )\n\n indices = scan_helper_image_files.template_directory_to_indices(\n template, directory\n )\n\n return [\n scan_helper_image_fil... | [
"0.7291707",
"0.7095123",
"0.70132256",
"0.65808135",
"0.65514374",
"0.65167814",
"0.64777744",
"0.6359497",
"0.63439935",
"0.63205105",
"0.62727",
"0.61281836",
"0.60799444",
"0.6071693",
"0.6036643",
"0.6020387",
"0.59473467",
"0.59459233",
"0.594325",
"0.5943176",
"0.58850... | 0.78444874 | 0 |
Sets the id of this V0CommandRequest. Unique command request identifier | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_id(self, command_id):\n\n self._command_id = command_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id"... | [
"0.65745074",
"0.65729547",
"0.65729547",
"0.65729547",
"0.6169968",
"0.5946375",
"0.5933126",
"0.59034187",
"0.5902427",
"0.5875469",
"0.5875469",
"0.5875469",
"0.5875469",
"0.5875469",
"0.5847862",
"0.58330953",
"0.5817592",
"0.57973665",
"0.57973665",
"0.57973665",
"0.5797... | 0.5687955 | 89 |
Gets the command_type of this V0CommandRequest. | def command_type(self):
return self._command_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_type(self):\n t = self.current_command.split(' ')[0]\n if t in commands.get('arithmetic'):\n return 'C_ARITHMETIC'\n\n if t not in commands:\n raise ValueError('{} is an invalid command type.'.format(t))\n\n return commands.get(t)",
"def commandType(s... | [
"0.74959725",
"0.731706",
"0.7071374",
"0.6970451",
"0.68869185",
"0.6475814",
"0.6303084",
"0.6146641",
"0.61329377",
"0.61329377",
"0.61329377",
"0.60710114",
"0.60303336",
"0.5949598",
"0.5947867",
"0.59409297",
"0.5936223",
"0.5925828",
"0.58877623",
"0.58187276",
"0.5740... | 0.81066346 | 0 |
Sets the command_type of this V0CommandRequest. | def command_type(self, command_type):
allowed_values = ["DEVICE", "GROUP", "DYNAMIC"]
if command_type not in allowed_values:
raise ValueError(
"Invalid value for `command_type` ({0}), must be one of {1}"
.format(command_type, allowed_values)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_type(self):\n return self._command_type",
"def __init__(self, type, _command_input):\n self._command_input = _command_input\n \"\"\"\n Represents the command\n \"\"\"\n self._command = type",
"async def async_send_command(self, cmd_type, command=\"\"):\n ... | [
"0.64768416",
"0.6209938",
"0.6067273",
"0.59686655",
"0.5942344",
"0.588161",
"0.588161",
"0.588161",
"0.5714169",
"0.57021916",
"0.557532",
"0.54251087",
"0.54060346",
"0.54060346",
"0.53092927",
"0.5284494",
"0.52449054",
"0.5234589",
"0.51957834",
"0.51957834",
"0.5156971... | 0.7683511 | 0 |
Gets the device_type of this V0CommandRequest. | def device_type(self):
return self._device_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_type(self):\n return self._meta['device_type']",
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def device_type(self):\n return Context.devtype2str[self.device_typeid]",
"def device_class(self):\n return self._device_type",
"def device_typ... | [
"0.7022557",
"0.68934137",
"0.68934137",
"0.67235976",
"0.6696392",
"0.66872305",
"0.66214603",
"0.6604504",
"0.6604504",
"0.6604504",
"0.6501994",
"0.636126",
"0.633661",
"0.63295555",
"0.6268322",
"0.6246563",
"0.6238104",
"0.6185915",
"0.6185915",
"0.6185915",
"0.6185915",... | 0.7070464 | 0 |
Sets the device_type of this V0CommandRequest. | def device_type(self, device_type):
allowed_values = ["active", "inactive", "all"]
if device_type not in allowed_values:
raise ValueError(
"Invalid value for `device_type` ({0}), must be one of {1}"
.format(device_type, allowed_values)
)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_device_type(device: str = \"cuda\"):\n DefaultDeviceType._default_device_type = device",
"def device_type(self, device_type):\n # type: (string_types) -> None\n\n if device_type is not None:\n if not isinstance(device_type, string_types):\n raise TypeError(\... | [
"0.6643906",
"0.6436704",
"0.6228725",
"0.61733866",
"0.57014465",
"0.5567155",
"0.54439515",
"0.5405106",
"0.5405106",
"0.53611773",
"0.5291968",
"0.52831775",
"0.5277985",
"0.52692217",
"0.5253126",
"0.5205218",
"0.51745594",
"0.5135404",
"0.5127225",
"0.5127225",
"0.512722... | 0.6564658 | 1 |
Gets the command_args of this V0CommandRequest. | def command_args(self):
return self._command_args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def args(self):\n return self.cmd_args",
"def cmd_args(self):\n return [\"0\", self.name]",
"def get_args(self):\n req_argv = self._ptr.contents.argv\n args = []\n if bool(req_argv):\n i = 0\n while 1:\n s = bytestostr(req_argv[i])\n ... | [
"0.7209498",
"0.66014856",
"0.6427924",
"0.62334996",
"0.6211118",
"0.6208842",
"0.6189143",
"0.61302686",
"0.61302686",
"0.61302686",
"0.60952264",
"0.608283",
"0.60609347",
"0.60441625",
"0.60044",
"0.5998303",
"0.59300166",
"0.59005815",
"0.5865591",
"0.584898",
"0.5841319... | 0.77521163 | 0 |
Gets the schedule of this V0CommandRequest. | def schedule(self):
return self._schedule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule(self) -> pulumi.Input['ScheduleArgs']:\n return pulumi.get(self, \"schedule\")",
"def schedule(self) -> pulumi.Input['CanaryScheduleArgs']:\n return pulumi.get(self, \"schedule\")",
"def schedule(self) -> pulumi.Output['outputs.CanarySchedule']:\n return pulumi.get(self, \"sch... | [
"0.70051384",
"0.68474853",
"0.6739031",
"0.6614931",
"0.6469839",
"0.6450284",
"0.6402178",
"0.6380898",
"0.61095655",
"0.60794026",
"0.6033817",
"0.5999442",
"0.5941287",
"0.5912172",
"0.58796215",
"0.5854578",
"0.5839461",
"0.58319616",
"0.58319616",
"0.5809912",
"0.576870... | 0.6953363 | 1 |
Sets the schedule of this V0CommandRequest. | def schedule(self, schedule):
self._schedule = schedule | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def svc_set_zone_schedule(self, schedule: str, **kwargs) -> None:\n await self._device.set_schedule(json.loads(schedule))",
"def schedule(self, schedule):\n \n self._schedule = schedule",
"def schedule(self, schedule):\n if (self.local_vars_configuration.client_side_validation... | [
"0.7154514",
"0.7045176",
"0.643068",
"0.5909116",
"0.59045166",
"0.5896162",
"0.580762",
"0.56573373",
"0.5614645",
"0.5579906",
"0.55389804",
"0.5531746",
"0.5482317",
"0.5458805",
"0.5458805",
"0.5452167",
"0.54210913",
"0.54159486",
"0.53575695",
"0.53532684",
"0.53402054... | 0.68938345 | 3 |
Sets the schedule_args of this V0CommandRequest. | def schedule_args(self, schedule_args):
self._schedule_args = schedule_args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def svc_set_zone_schedule(self, schedule: str, **kwargs) -> None:\n await self._device.set_schedule(json.loads(schedule))",
"def schedule(self, schedule):\n \n self._schedule = schedule",
"def schedule(self, schedule):\n\n self._schedule = schedule",
"def schedule(self, sche... | [
"0.66654056",
"0.62551916",
"0.61177075",
"0.61177075",
"0.597175",
"0.5909914",
"0.5770014",
"0.5766574",
"0.56729376",
"0.5560964",
"0.54505783",
"0.5412858",
"0.5286528",
"0.51269716",
"0.50794",
"0.50280493",
"0.50134146",
"0.5011693",
"0.50111413",
"0.50093174",
"0.49307... | 0.7528838 | 0 |
Gets the issued_by of this V0CommandRequest. command is issued by this user | def issued_by(self):
return self._issued_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issued_by(self, issued_by):\n\n self._issued_by = issued_by",
"def created_by(self) -> Optional['outputs.UserInfoResponse']:\n return pulumi.get(self, \"created_by\")",
"def invoker(self) -> User:\n return self.msg.source",
"def created_by(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.6313954",
"0.5701578",
"0.55866885",
"0.5509486",
"0.5508986",
"0.55016655",
"0.54413724",
"0.53431386",
"0.53431386",
"0.53431386",
"0.53431386",
"0.53431386",
"0.53431386",
"0.534291",
"0.5324281",
"0.53096145",
"0.5301848",
"0.5255429",
"0.52446693",
"0.5241363",
"0.523... | 0.7799019 | 0 |
Sets the issued_by of this V0CommandRequest. command is issued by this user | def issued_by(self, issued_by):
self._issued_by = issued_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issued_by(self):\n return self._issued_by",
"def assigned_by_user(self, assigned_by_user):\n\n self._assigned_by_user = assigned_by_user",
"def issued_at(self, issued_at):\n if self.local_vars_configuration.client_side_validation and issued_at is None: # noqa: E501\n raise ... | [
"0.6874974",
"0.58429664",
"0.5662741",
"0.56198364",
"0.5565787",
"0.5542809",
"0.55101854",
"0.539204",
"0.539038",
"0.5378643",
"0.533266",
"0.5270437",
"0.52265084",
"0.52265084",
"0.52265084",
"0.52265084",
"0.52265084",
"0.52265084",
"0.5055288",
"0.5051569",
"0.4923181... | 0.81755745 | 0 |
Sets the created_on of this V0CommandRequest. Timestamp of command request | def created_on(self, created_on):
self._created_on = created_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_at(self, created_at: \"str\"):\n self._attrs[\"createdAt\"] = created_at",
"def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at",
"def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at",
"def created_at... | [
"0.6540427",
"0.6529694",
"0.6529694",
"0.6529694",
"0.65121675",
"0.6403907",
"0.6368529",
"0.6356972",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.63060063",
"0.... | 0.7068772 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, V0CommandRequest):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
Return the number of BTC in a given address using blockchain.info | def getBtcInWallet(address):
btc = 'https://blockchain.info/q/addressbalance/' + address
check = requests.get(btc)
value = int((check.content)) / 100000000.0
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_num_transactions(self, address):\n params = [f\"0x{address}\", __class__.DEFAULT_BLOCK_LATEST]\n nonce = self._json_call(\"eth_getTransactionCount\", params)\n return nonce",
"def get_address_balance(litecoinaddress):\n total_balance = 0\n unspent = list_unspent(litecoinaddres... | [
"0.7114299",
"0.7095142",
"0.69612867",
"0.6591941",
"0.6573834",
"0.64108676",
"0.63494885",
"0.629371",
"0.6241683",
"0.62331784",
"0.62064624",
"0.609366",
"0.60861075",
"0.6049634",
"0.6046436",
"0.601994",
"0.5981325",
"0.59783965",
"0.5951696",
"0.59363365",
"0.58900934... | 0.7525788 | 0 |
Compute Tp(x)h as the valid part of the convolution between x and h (see [Appendix A, 1]). | def _matvec(self, h: np.ndarray) -> np.ndarray:
return convolve(self.x, h, mode='valid', method=self.method) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def T(p, x):\n y = alpha * mean(p(W))\n if y <= P(x): \n return P(x) \n h = lambda r: alpha * mean(p(alpha*(x - D(r)) + W))\n return fix_point(h, P(x), y)",
"def atrous_conv2(x, h, S):\n M, N = x.shape\n P, Q = h.shape\n\n S0 = S[0, 0]\n S1 = S[1, 1]\n\n # Convert to integers\n... | [
"0.6127939",
"0.6120387",
"0.59404635",
"0.59043235",
"0.58256465",
"0.5811633",
"0.58040124",
"0.5788544",
"0.5773664",
"0.5747479",
"0.57267946",
"0.57250684",
"0.5723893",
"0.56893224",
"0.56864345",
"0.56544966",
"0.563295",
"0.56223786",
"0.560241",
"0.55783725",
"0.5574... | 0.0 | -1 |
Compute Tp(x)'u as the valid part of the crosscorrelation between x and h (see [Appendix A, 1]). | def _rmatvec(self, u: np.ndarray) -> np.ndarray:
return convolve(self.x.conj()[::-1], u, mode='valid', method=self.method) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def h_T(self, z0):\n # Get the governing variables\n (B, N, u_slip, u_inf) = self.get_variables(z0, 0.)\n \n # Compute U_N\n U_N = u_slip / (B * N)**(1./4.)\n \n # Compute the correlation equation\n return 2.9 * np.exp(-(U_N - 1.0)**2 / 28.09) * (B / N**3)**(... | [
"0.6296508",
"0.60323375",
"0.6003968",
"0.5901906",
"0.5786118",
"0.57753634",
"0.57517487",
"0.5751211",
"0.5729694",
"0.5708474",
"0.56905365",
"0.5688389",
"0.5606458",
"0.5599386",
"0.5575395",
"0.55713916",
"0.55629224",
"0.55368584",
"0.5464966",
"0.54471314",
"0.54405... | 0.0 | -1 |
Tests login should fail with 400 when no users in db. | def test_login_fail_no_users_in_db(self):
serializer = G(LoginSerializer)
response = self.client.post(self.login_url, serializer.data, format='json')
self.assertEquals(response.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_registered_user_trying_to_login(self): \n # try logging in the user without registering the user \n res = self.client().post(AuthTestCase.login, data=self.user)\n # bad request \n self.assertEqual(res.status_code, 401)",
"def test_login_login_inexisting_user_false(se... | [
"0.7963515",
"0.79499274",
"0.79053605",
"0.7900822",
"0.78877836",
"0.78189075",
"0.78119713",
"0.78045934",
"0.7750257",
"0.7631598",
"0.76159286",
"0.7572578",
"0.75542426",
"0.75262743",
"0.7525239",
"0.7504597",
"0.7493961",
"0.7489551",
"0.7427746",
"0.7426745",
"0.7425... | 0.8602676 | 0 |
Calculates the euclidean distance between two points `a` and `b`. >>> edist([3, 5], [3, 2]) 3.0 This can also be used to calculate the distance between two points | def edist(a, b):
return euclidean(np.array(a), np.array(b)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(a, b):\n return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)",
"def eucl_dist(a, b):\n return np.sqrt( (a[0]-b[0])** 2 + (a[1]-b[1])** 2)",
"def euclidean_distance(a: Tuple[float, ...], b: Tuple[float, ...]) -> float:\n assert len(a) == len(b)\n return sqrt(sum(pow(x[0] - x[1], ... | [
"0.7252823",
"0.7230598",
"0.7110215",
"0.69977224",
"0.6949704",
"0.6911609",
"0.6902561",
"0.6863502",
"0.68089664",
"0.6784607",
"0.6747578",
"0.67315567",
"0.6645501",
"0.66252935",
"0.6615679",
"0.6596334",
"0.6595883",
"0.65891415",
"0.657936",
"0.6565525",
"0.6559157",... | 0.8408554 | 0 |
Calculates the great circle distance between `a` and `b` in meters. Longitude comes first. | def gcdist(a, b):
lon1, lat1 = a
lon2, lat2 = b
dLat = radians(lat2 - lat1)
dLon = radians(lon2 - lon1)
a = (sin(dLat / 2) * sin(dLat / 2) +
cos(radians(lat1)) * cos(radians(lat2)) *
sin(dLon / 2) * sin(dLon / 2))
c = 2 * atan2(sqrt(a), sqrt(1 - a))
return EARTH_RA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, a, b):\n \n # -----------------------------\n # Your code\n '''R = 3963 # radius of Earth (miles)\n lat1, lon1 = math.radians(a[0]), math.radians(a[1])\n lat2, lon2 = math.radians(b[0]), math.radians(b[1])\n \n return math.acos(math.sin(la... | [
"0.8001021",
"0.7825847",
"0.7766649",
"0.77653086",
"0.76751053",
"0.7652041",
"0.76199657",
"0.76109576",
"0.7510119",
"0.74797785",
"0.745716",
"0.73900086",
"0.73439574",
"0.733297",
"0.7271637",
"0.7249918",
"0.7218222",
"0.71509373",
"0.7132324",
"0.7117962",
"0.7114621... | 0.7677978 | 4 |
Calculates the area of a triangle. >>> triarea([1, 1], [5, 1], [3, 5]) 8.0 | def triarea(a, b, c):
return 0.5 * edist(a, b) * pdist(c, a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle_area(triangle):\n # sides of the triangle\n a = great_circle_distance(triangle[0], triangle[1])\n b = great_circle_distance(triangle[0], triangle[2])\n c = great_circle_distance(triangle[1], triangle[2])\n\n # it may happen that the triangle is degenerate\n # for the rare case where ... | [
"0.83158547",
"0.83014643",
"0.8046978",
"0.80394703",
"0.79821485",
"0.7897",
"0.78512156",
"0.7829142",
"0.7811481",
"0.78035146",
"0.76788473",
"0.7640983",
"0.76405835",
"0.7630634",
"0.759255",
"0.75606364",
"0.7552975",
"0.7536755",
"0.7531912",
"0.74693644",
"0.7371169... | 0.75928485 | 14 |
Check if ``value`` is ``None`` and then return ``replacement`` or else ``value``. | def default(value, replacement):
return value if value is not None else replacement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assignValue(value):\n if value == \"\":\n return None\n else:\n return value",
"def safe_value(field_val, replace_value):\n return field_val if not pd.isna(field_val) else replace_value",
"def if_none(value: Any, default: Any):... | [
"0.6660578",
"0.6613612",
"0.65441215",
"0.64243644",
"0.62796026",
"0.62160474",
"0.6201507",
"0.6178093",
"0.6118662",
"0.6096982",
"0.60936654",
"0.5924155",
"0.59061086",
"0.5849543",
"0.58396316",
"0.57365334",
"0.5715832",
"0.5697977",
"0.56938106",
"0.56600845",
"0.559... | 0.7717248 | 0 |
Initialize a new RouteTrie for holding routes. Add a default handler for missing page '404 page not found' by default | def __init__(self, root_handler="root handler", not_found_handler="404 page not found"):
self.trie = RouteTrie(handler=root_handler)
self.not_found_handler = not_found_handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, root_handler, path_not_found):\n if self.__test_path(root_handler) and self.__test_path(path_not_found):\n self.route_trie = RouteTrie(root_handler) # Passes root handler to the initialised trie\n self.path_not_found = path_not_found # St... | [
"0.77391464",
"0.72330534",
"0.7139312",
"0.6831823",
"0.6831823",
"0.58847696",
"0.5855817",
"0.5847486",
"0.58082473",
"0.5771556",
"0.57402",
"0.5719271",
"0.57009685",
"0.56841284",
"0.56461746",
"0.5623216",
"0.5583799",
"0.5561679",
"0.55346733",
"0.55340624",
"0.553406... | 0.8488705 | 0 |
turn off living room sensor and light | def watching_tv(self, entity, attribute, old, new, kwargs):
self.sensor_living.set_state_boolean(False)
self.turn_off(self.args['entity_light_livingroom']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lightning_turnoff(self):\n self.turnOff()",
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def turn_off(self, **kwargs: Any) -> None:\n self._device.power_on = False\n _LOGGER.debug(\"Turn off light %s\", self._device.ip)",
"def turnLightingSystemOff... | [
"0.8027763",
"0.7881808",
"0.78628564",
"0.7852059",
"0.7826896",
"0.7746513",
"0.758893",
"0.7552582",
"0.74800456",
"0.7452518",
"0.74472594",
"0.7436831",
"0.7429329",
"0.7378085",
"0.7376865",
"0.7313147",
"0.7310081",
"0.72473574",
"0.7242686",
"0.72366506",
"0.71773106"... | 0.0 | -1 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.7489052",
"0.7288358",
"0.7159325",
"0.715323",
"0.7065856",
"0.6984727",
"0.6964892",
"0.69536865",
"0.6912471",
"0.68334424",
"0.68176156",
"0.68093187",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.67855513",
"0.675501",
"0.675501",
... | 0.67575085 | 20 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.7604412",
"0.7447652",
"0.74042964",
"0.72808254",
"0.7208795",
"0.7165644",
"0.7157375",
"0.71450114",
"0.71450114",
"0.71450114",
"0.71450114",
"0.71450114",
"0.71450114",
"0.7131455",
"0.7100775",
"0.70969015",
"0.70969015",
"0.70969015",
"0.70969015",
"0.70969015",
"0.... | 0.70625025 | 37 |
Return a dictionary of lists of combinations suitable for recursively building expressions. Each dictionary key is a tuple of (numops, numoperands), | def get_sub_combinations(maxop):
combo = collections.defaultdict(list)
for numops in range(maxop+1):
if numops:
combo[numops, 1].append((numops-1,))
for op1 in range(numops):
combo[numops, 2].append((op1, numops - op1 - 1))
for op2 in range(numops - op1):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cexpr_operands(self):\n\n if self.op >= cot_comma and self.op <= cot_asgumod or \\\n self.op >= cot_lor and self.op <= cot_fdiv or \\\n self.op == cot_idx:\n return {'x': self.x, 'y': self.y}\n\n elif self.op == cot_tern:\n return {'x': self.x, 'y': self.y, 'z': self.z}\n\n ... | [
"0.5999137",
"0.5714099",
"0.5710613",
"0.56541336",
"0.5616212",
"0.5574981",
"0.5551246",
"0.5549024",
"0.5531994",
"0.5521797",
"0.55193716",
"0.5494046",
"0.54286397",
"0.538554",
"0.5381815",
"0.53440404",
"0.5309845",
"0.5309169",
"0.52913207",
"0.52886856",
"0.5240098"... | 0.66136533 | 0 |
Add the given log record to our internal buffer. | def emit(self, record):
self.buffer.append(record.__dict__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logRecordHandler(self, logrecord):\n logrecords = self._logrecords\n logrecords.append(logrecord)\n if len(logrecords) > self._queuesize:\n logrecords.pop(0)\n self._logRecordsTotal += 1",
"def append_history_record(self, history_record):\n self.history.append(hi... | [
"0.7656953",
"0.7019942",
"0.69621897",
"0.6862358",
"0.6859548",
"0.6851083",
"0.6701503",
"0.666603",
"0.66525877",
"0.66107184",
"0.64985406",
"0.6439939",
"0.6434333",
"0.6403766",
"0.63955563",
"0.63680303",
"0.6277182",
"0.62395304",
"0.623361",
"0.61633956",
"0.6150976... | 0.7264085 | 2 |
Display a single 2D image without calling plt.show() to open in the browser | def show_one(img):
dpi = 40
margin = 0.05
nda = sitk.GetArrayFromImage(img)
spacing = img.GetSpacing()
extent = (0, nda.shape[1] * spacing[1], nda.shape[0] * spacing[0], 0)
figsize = (5, 5)
fig = plt.figure(figsize=figsize, dpi=dpi)
ax = fig.add_axes([margin, margin, 1 - 2 * margin, 1 - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display(array):\n plt.figure()\n plt.imshow(array)\n plt.show()",
"def plot_single_image(image):\n image = image.cpu()\n \n assert type(image) is torch.Tensor, 'Image to plot is not torch.Tensor'\n image_size = int(np.sqrt(image.shape[0]))\n image = image.view(image_size, ... | [
"0.7497872",
"0.73334044",
"0.7279706",
"0.7269517",
"0.72403944",
"0.72173846",
"0.72031224",
"0.7181507",
"0.7162125",
"0.7162125",
"0.7162125",
"0.71266854",
"0.7088066",
"0.7074717",
"0.70544463",
"0.7031941",
"0.7011936",
"0.7008005",
"0.69987035",
"0.69820845",
"0.69638... | 0.73412454 | 1 |
The number of records that have been successfully ingested. | def ingested_record_count(self) -> int:
return pulumi.get(self, "ingested_record_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingested_record_count(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"ingested_record_count\")",
"def valid_record_count(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"valid_record_count\")",
"def get_num_records(self):\n return self.__num_records",
"def total_reco... | [
"0.8516084",
"0.7815549",
"0.77324647",
"0.75117624",
"0.749213",
"0.7401824",
"0.7388828",
"0.73729974",
"0.7320719",
"0.73074645",
"0.73066294",
"0.7229886",
"0.71639794",
"0.7134289",
"0.71201915",
"0.710988",
"0.70986",
"0.70986",
"0.70986",
"0.70986",
"0.70986",
"0.709... | 0.8484928 | 1 |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")",
"def ... | [
"0.79197055",
"0.79197055",
"0.78673273",
"0.78673273",
"0.78673273",
"0.78673273",
"0.78673273",
"0.77086383",
"0.75538516",
"0.72825897",
"0.7059962",
"0.6980595",
"0.69207853",
"0.68701607",
"0.6730099",
"0.67056817",
"0.6654813",
"0.6647115",
"0.65513295",
"0.654286",
"0.... | 0.66403157 | 42 |
Convert a datetime.timedelta object or a regular number to a custom formatted string, just like the stftime() method does for datetime.datetime objects. The fmt argument allows custom formatting to be specified. Fields can include seconds, minutes, hours, days, and weeks. Each field is optional. | def strfdelta(tdelta, fmt='{D:02}d {H:02}h {M:02}m {S:02}s', inputtype='timedelta'):
# Convert tdelta to integer seconds.
if inputtype == 'timedelta':
remainder = int(tdelta.total_seconds())
elif inputtype in ['s', 'seconds']:
remainder = int(tdelta)
elif inputtype in ['m', 'minu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strfdelta(tdelta, fmt='{D:02}d {H:02}h {M:02}m {S:02}s', inputtype='timedelta'):\n\n # Convert tdelta to integer seconds.\n if inputtype == 'timedelta':\n remainder = int(tdelta.total_seconds())\n elif inputtype in ['s', 'seconds']:\n remainder = int(tdelta)\n elif inputtype in ['m', ... | [
"0.7220824",
"0.6864036",
"0.6714858",
"0.6714858",
"0.6614516",
"0.63232905",
"0.6253588",
"0.6240432",
"0.6239678",
"0.6223708",
"0.6209081",
"0.61640507",
"0.61497885",
"0.6136426",
"0.61345863",
"0.60151047",
"0.5971274",
"0.5969002",
"0.59683853",
"0.5956922",
"0.5937370... | 0.7200782 | 1 |
Calculate distance between two lat lons in meters | def calcDistance(lat1, lon1, lat2, lon2):
nauticalMilePerLat = 60.00721
nauticalMilePerLongitude = 60.10793
rad = math.pi / 180.0
milesPerNauticalMile = 1.15078
yDistance = (lat2 - lat1) * nauticalMilePerLat
xDistance = (math.cos(lat1 * rad) + math.cos(lat2 * rad)) * (lon2 - lon1) * (nautic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def get_distance(lat1, lon1, lat2, lon2):\n phi1 = math.radians(lat1)\n phi2 = math.radians(lat2)\n d_phi = math.radians(lat2 - lat1)\n d_lam = math.radians(lon2 - lon1)\n a =... | [
"0.81619495",
"0.8019495",
"0.79386705",
"0.79356486",
"0.7895579",
"0.7890299",
"0.78805834",
"0.78701454",
"0.78631645",
"0.7852822",
"0.7851326",
"0.7849004",
"0.7846848",
"0.7840741",
"0.78396577",
"0.78251183",
"0.78251183",
"0.78251183",
"0.78251183",
"0.78251183",
"0.7... | 0.70739245 | 80 |
Caclulate distance between two lat lons in meters | def calcDistanceOptimized(lat1, lon1, lat2, lon2):
rad = 0.017453292519943
yDistance = (lat2 - lat1) * 60.00721
xDistance = (math.cos(lat1 * rad) + math.cos(lat2 * rad)) * (lon2 - lon1) * 30.053965
distance = math.sqrt( yDistance**2 + xDistance**2 )
return distance * 1852.00088832 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def get_distance(lat1, lon1, lat2, lon2):\n phi1 = math.radians(lat1)\n phi2 = math.radians(lat2)\n d_phi = math.radians(lat2 - lat1)\n d_lam = math.radians(lon2 - lon1)\n a =... | [
"0.8047353",
"0.7941379",
"0.78285235",
"0.7826923",
"0.78169733",
"0.78036195",
"0.778747",
"0.77862394",
"0.77799237",
"0.77799237",
"0.77799237",
"0.77799237",
"0.77799237",
"0.77717376",
"0.7761975",
"0.77556854",
"0.77532864",
"0.7752737",
"0.7748005",
"0.77454954",
"0.7... | 0.7602878 | 30 |
get timeseries batch dataset | def generator(X: np.array, y: np.array, time_steps: int):
n_batches = X.shape[0] - time_steps - 1
X_time = np.zeros((n_batches, time_steps, X.shape[1]))
y_time = np.zeros((n_batches, 1))
for i in range(n_batches):
X_time[i] = X[i:(i + time_steps), :]
y_time[i] = y[i + time_steps]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(dataset,time_step=1):\n dataX,dataY=[],[]\n for i in range(len(dataset)-time_step):\n a=dataset[i:i+time_step]\n dataX.append(a)\n dataY.append(dataset[i+time_step])\n return np.asarray(dataX),np.asarray(dataY)",
"def retrieve_data_timeseries(hfile, setname):\n ... | [
"0.70268846",
"0.6819271",
"0.68130153",
"0.6607272",
"0.6554005",
"0.65291405",
"0.6247394",
"0.62179554",
"0.6199225",
"0.6194544",
"0.6194118",
"0.6183021",
"0.6178989",
"0.61634916",
"0.6152554",
"0.6147113",
"0.6104174",
"0.6094735",
"0.6054658",
"0.60503805",
"0.6026775... | 0.0 | -1 |
For a given "magic number" i (i.e. spacing of the evenly spaced ticks in the decade [1,10]), compute the integer representation of the smallest tick not less than x. | def _logtickceil_as_irep(self,x,i):
j,b = self._power_and_interval(x,i)
k = int(ceil(float(x)/b))
n = self._power_and_index_to_irep(j,k,i)
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fastfloor(x):\n return int(x) if x > 0 else int(x) - 1",
"def magicnr(value, error):\n\t\tmagics = [\t(10 ** (nextpow10(error))),\n\t\t\t\t\t(10 ** (nextpow10(error))) / 2.0,\n\t\t\t\t\t(10 ** (nextpow10(error))) / 4.0,\n\t\t\t\t\t(10 ** (nextpow10(error))) / 10.0,\n\t\t\t\t\t(10 ** (nextpow10(error))) / ... | [
"0.62673134",
"0.622662",
"0.6209612",
"0.61783314",
"0.6125506",
"0.6063315",
"0.5999275",
"0.59929633",
"0.59666777",
"0.591938",
"0.588613",
"0.5867755",
"0.5847978",
"0.5821465",
"0.5808052",
"0.5756045",
"0.57190514",
"0.56987214",
"0.5685863",
"0.56685156",
"0.56606424"... | 0.54888016 | 35 |
Returns the ConfigRevision object corresponding to the device's current running configuration. Inputs | def running_config(self, **kwargs):
return self.api_request(self._get_method_fullname("running_config"), kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_config_version(self):\n return self._get_param(\"ConfigVersion\")",
"def get_config() -> Optional[Config]:\n return CurrentConfig.get()",
"def get_config(self):\n return ConfigFile.from_file(path.join(self.run_dir, \"os-stdin\"))",
"def revision(self) -> Optional[pulumi.Input[in... | [
"0.6105331",
"0.6067523",
"0.6046373",
"0.60299873",
"0.5963593",
"0.5950405",
"0.5920111",
"0.58800423",
"0.5870412",
"0.58196163",
"0.5814482",
"0.5802144",
"0.5800801",
"0.57988113",
"0.5759733",
"0.5759733",
"0.5759733",
"0.5759733",
"0.5759733",
"0.57567865",
"0.57560813... | 0.0 | -1 |
The general Device object corresponding to this infrastructure device. Inputs | def device(self, **kwargs):
return self.api_request(self._get_method_fullname("device"), kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device(self):\n raise NotImplementedError()",
"def device(self):\n return next(self.parameters()).device",
"def device(self):\n return next(self.parameters()).device",
"def device(self):\n return next(self.parameters()).device",
"def device(self):\n return next(se... | [
"0.73365176",
"0.7002417",
"0.7002417",
"0.7002417",
"0.7002417",
"0.7002417",
"0.6972675",
"0.6855479",
"0.67833996",
"0.6758104",
"0.6664428",
"0.6581982",
"0.6556773",
"0.6541471",
"0.64967954",
"0.64967954",
"0.64910173",
"0.6433468",
"0.6430039",
"0.64212984",
"0.6414788... | 0.57989234 | 75 |
Given a NumPy / OpenCV 2 image, crops it to the given width and height, around it's centre point | def crop_around_center(image, width, height):
image_size = (image.shape[1], image.shape[0])
image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))
if(width > image_size[0]):
width = image_size[0]
if(height > image_size[1]):
height = image_size[1]
x1 = int(image_cente... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop(img: 'np.ndarray', x: int, y: int, width: int, height: int) -> 'np.ndarray':\n return img[y:y+height, x:x+width]",
"def crop_around_center(image, width, height):\r\n\r\n image_size = (image.shape[1], image.shape[0])\r\n image_center = (int(image_size[0] * 0.5), int(image_size[1] * 0.5))... | [
"0.76377535",
"0.74180055",
"0.7380922",
"0.7369841",
"0.7331407",
"0.728423",
"0.727816",
"0.7252315",
"0.72463363",
"0.72463363",
"0.7190007",
"0.7180537",
"0.7168692",
"0.7141646",
"0.71074295",
"0.70952344",
"0.70926756",
"0.7081143",
"0.7067312",
"0.7041019",
"0.7040211"... | 0.738121 | 3 |
Get the workload namespace | def _get_workload_namespace(self):
namespace_yaml_file = os.path.join(
os.path.join(self.workload_subscription_dir, self.workload_name),
"namespace.yaml",
)
namespace_yaml_data = templating.load_yaml(namespace_yaml_file)
return namespace_yaml_data["metadata"]["nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_workload_namespace(self):\n\n app_set_data = list(\n templating.load_yaml(self.appset_yaml_file, multi_document=True)\n )\n\n for _app_set in app_set_data:\n if _app_set[\"kind\"] == constants.APPLICATION_SET:\n return _app_set[\"spec\"][\"template... | [
"0.79215",
"0.74587005",
"0.72701824",
"0.72394884",
"0.72394884",
"0.72394884",
"0.72394884",
"0.72394884",
"0.7225776",
"0.7225776",
"0.7225776",
"0.7188017",
"0.71449125",
"0.71449125",
"0.71449125",
"0.71449125",
"0.71449125",
"0.71449125",
"0.71449125",
"0.71449125",
"0.... | 0.807937 | 0 |
Get the workload namespace | def _get_workload_namespace(self):
app_set_data = list(
templating.load_yaml(self.appset_yaml_file, multi_document=True)
)
for _app_set in app_set_data:
if _app_set["kind"] == constants.APPLICATION_SET:
return _app_set["spec"]["template"]["spec"]["destin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_workload_namespace(self):\n namespace_yaml_file = os.path.join(\n os.path.join(self.workload_subscription_dir, self.workload_name),\n \"namespace.yaml\",\n )\n namespace_yaml_data = templating.load_yaml(namespace_yaml_file)\n return namespace_yaml_data[\"m... | [
"0.80794793",
"0.7456808",
"0.72676843",
"0.72365",
"0.72365",
"0.72365",
"0.72365",
"0.72365",
"0.72234535",
"0.72234535",
"0.72234535",
"0.7185546",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"0.714172",
"... | 0.7921815 | 1 |
Update model weights directly inserting `updates` at correct locations. `updates` must be aligned to `model.(non_)trainable_weights` and is inserted according to model `weights_structure` (see `get_model_weights_structure`). | def update_model_weights(model, updates, weights_structure=None,
force_update=False, trainable=True):
if weights_structure is None:
weights_structure = get_model_weights_structure(model)
assert len(updates) == len(weights_structure)
for update, structure in zip(updates, we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _modify_updates(self, updates):\n\n if self.max_kernel_norm is not None:\n W, = self.transformer.get_params()\n if W in updates:\n updated_W = updates[W]\n row_norms = T.sqrt(T.sum(T.sqr(updated_W), axis=(0, 1, 2)))\n desired_norms = T.c... | [
"0.70970243",
"0.68676406",
"0.67812026",
"0.67545414",
"0.6734296",
"0.65990746",
"0.65978926",
"0.6557858",
"0.6508515",
"0.65047914",
"0.6498791",
"0.64547473",
"0.64314866",
"0.63693315",
"0.63684464",
"0.6361079",
"0.63554025",
"0.6333318",
"0.63311124",
"0.6299975",
"0.... | 0.7888399 | 0 |
Sets the field_name of this RuleSchemaFormulaPredict. | def field_name(self, field_name):
if field_name is None:
raise ValueError("Invalid value for `field_name`, must not be `None`") # noqa: E501
self._field_name = field_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _field_name(self) -> str:\n name = self._resolve_field_name()\n if name is None:\n # pylint: disable=consider-using-f-string\n raise FieldNameError(\n \"No field name found among: explicit name = {}, inferred name = {}\".format(\n self.__nam... | [
"0.5341695",
"0.532999",
"0.5216296",
"0.51585984",
"0.5066301",
"0.49899814",
"0.49779084",
"0.49732894",
"0.49636328",
"0.49229187",
"0.48497382",
"0.4823064",
"0.48209903",
"0.48200485",
"0.4792449",
"0.4792304",
"0.4792304",
"0.47809097",
"0.4776029",
"0.476963",
"0.47675... | 0.6722681 | 0 |
Sets the learning_period of this RuleSchemaFormulaPredict. | def learning_period(self, learning_period):
if learning_period is None:
raise ValueError("Invalid value for `learning_period`, must not be `None`") # noqa: E501
if learning_period is not None and not re.search(r'^[1-9][0-9]*(\\.[0-9]+)?(offset|seconds|minutes|hours|days|weeks|years|o|s|m|h|... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_learning_rate(self, ppl, epoch):\n if self.start_decay_at is not None and epoch >= self.start_decay_at:\n self.start_decay = True\n if self.last_ppl is not None and ppl > self.last_ppl:\n self.start_decay = True\n\n if self.start_decay:\n self.lr = s... | [
"0.5627167",
"0.56226665",
"0.56226665",
"0.5611432",
"0.54989994",
"0.549203",
"0.54495823",
"0.5449072",
"0.53970736",
"0.53570944",
"0.53349173",
"0.52981985",
"0.52200854",
"0.52163076",
"0.5195023",
"0.5176163",
"0.516374",
"0.51489663",
"0.5131003",
"0.5127366",
"0.5119... | 0.7627416 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, RuleSchemaFormulaPredict):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643"
] | 0.0 | -1 |
Retrieve the total amount due. | def retrieve_balance():
balance = worksheet.cell((39, 5)).value
return f"As of {current_date}, the account has a balance of ${balance[1:-1]}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount_due(self):\n queryset = self.supplyorderitem_set.filter(delivery_date__isnull=False).aggregate(\n amount_due=Sum(F('unit_price')*F('quantity_ordered'))\n )\n return queryset['amount_due'] or 0",
"def get_total_paid(self):\n return sum(self.paid)",
"def sum_tota... | [
"0.8130716",
"0.7755196",
"0.7352424",
"0.7319184",
"0.7303983",
"0.711112",
"0.6975155",
"0.6969885",
"0.69551706",
"0.6944296",
"0.69284517",
"0.6830025",
"0.6769518",
"0.6746931",
"0.6740555",
"0.673111",
"0.67182755",
"0.67121214",
"0.6678507",
"0.6678507",
"0.66601497",
... | 0.0 | -1 |
Endpoint for getting a list of all cars | def get(self):
return Car.browse() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_cars(self):\n return self.cars.get_all_cars()",
"def get_all_cars(self):\n\n all_cars = TheCar.objects.all()\n\n return all_cars",
"def getcars():\n cars = Car.query.filter(Car.isavailable == True)\n result = carsSchema.dump(cars)\n print(result)\n return jsonify(re... | [
"0.7310403",
"0.7133722",
"0.71078545",
"0.6881232",
"0.67476165",
"0.65886974",
"0.6499884",
"0.6488902",
"0.6485063",
"0.6439859",
"0.64354885",
"0.6413957",
"0.64052",
"0.63972396",
"0.63927674",
"0.638802",
"0.6379489",
"0.63568974",
"0.63452697",
"0.63383967",
"0.6301116... | 0.61970776 | 24 |
Return True if the queue is empty, False otherwise. | def empty(self):
return self.qsize() == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def empty(self) -> bool:\n if self.queue.empty():\n return True\n else:\n return False",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"... | [
"0.9267842",
"0.9238563",
"0.92341536",
"0.92329025",
"0.9230334",
"0.9230334",
"0.9095485",
"0.9084253",
"0.9046637",
"0.90436405",
"0.90432554",
"0.90319574",
"0.90316725",
"0.90071946",
"0.8950152",
"0.8950152",
"0.89496523",
"0.8875456",
"0.8860099",
"0.88068223",
"0.8764... | 0.82307285 | 35 |
Remove and return an item from the queue. If optional args block is true and timeout is None (the default), block if necessary until an item is available. | def get(self, block=True, timeout=None):
if block:
item = self.__db.blpop(self.key, timeout=timeout)
else:
item = self.__db.lrpop(elf.key)
if item:
item = item[1]
return item | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, timeout=None):\n item = super(ExclusiveQueue, self).pop(timeout)\n try:\n self.remove(item)\n except ValueError:\n pass\n return item",
"def pop(self, blocking = False, timeout = TIMEOUT_CURRENT):\n if len(self) == 0 and blocking:\n ... | [
"0.7551767",
"0.69671625",
"0.680111",
"0.6758908",
"0.6677427",
"0.6663086",
"0.6599485",
"0.659235",
"0.6538843",
"0.64599395",
"0.6398398",
"0.63001066",
"0.62743616",
"0.6183264",
"0.6154611",
"0.61407405",
"0.61362976",
"0.6085943",
"0.60333586",
"0.6010287",
"0.59911907... | 0.6669158 | 5 |
Get the Python dict representation of the dashboard object. | def _get_dashboard_data(self):
if self._dashboard_data is None:
dashboard_object = self._get_dashboard_object()
self._dashboard_data = serialize_json_safe(dashboard_object)
return self._dashboard_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard(self):\r\n return {}",
"def _get_dashboard_object(self):\n pass",
"def dashboard(self) -> api.Dashboard:\n return self._get_model(model=api.Dashboard)",
"def dict(self):\n return self.__dict__",
"def dict(self):\n return self.__dict__",
"def dict(self):\n ... | [
"0.7280029",
"0.7004404",
"0.66149163",
"0.65815216",
"0.65815216",
"0.65815216",
"0.65815216",
"0.65815216",
"0.65815216",
"0.65815216",
"0.650699",
"0.64979196",
"0.6496535",
"0.6492076",
"0.6479393",
"0.64595044",
"0.64580286",
"0.6432585",
"0.6432585",
"0.6432585",
"0.643... | 0.76183456 | 0 |
Gets the name of this AppOnboardingRequest. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_name(self):\n return self._app_name",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self): # pylint:disable=function-redefined\n return self._app_name",
"def application_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"application_name\"... | [
"0.63719016",
"0.63709223",
"0.63226414",
"0.63108015",
"0.63108015",
"0.629571",
"0.62495285",
"0.62314767",
"0.6224714",
"0.6224714",
"0.6224714",
"0.6224714",
"0.6200258",
"0.6183364",
"0.6166789",
"0.6113654",
"0.6108538",
"0.6090351",
"0.6081788",
"0.60766286",
"0.596010... | 0.57044595 | 72 |
Sets the name of this AppOnboardingRequest. | def name(self, name: str):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, application_name):\r\n self._name = application_name",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, ... | [
"0.6453866",
"0.6276426",
"0.6276426",
"0.621316",
"0.621316",
"0.621316",
"0.621316",
"0.621316",
"0.6192358",
"0.6182548",
"0.61527467",
"0.6130835",
"0.6130551",
"0.60990804",
"0.60941577",
"0.6049386",
"0.60458595",
"0.60458595",
"0.6045847",
"0.6045847",
"0.59979016",
... | 0.0 | -1 |
Gets the version of this AppOnboardingRequest. | def version(self) -> str:
return self._version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_application_version(self):\n return self.connector.request('GET', '/app/version')",
"def get_version(self):\n data = self._get('app_version')\n return data['version']",
"def version(self):\n return self.proto.details.appDetails.versionString",
"def app_version(self) -> str... | [
"0.72754467",
"0.7199704",
"0.70575416",
"0.68543327",
"0.68414134",
"0.6753886",
"0.671044",
"0.6676851",
"0.66657996",
"0.66556376",
"0.6651209",
"0.66025466",
"0.65829283",
"0.6550618",
"0.6527382",
"0.6493838",
"0.6473784",
"0.6466938",
"0.6466938",
"0.64618266",
"0.64542... | 0.6131204 | 65 |
Gets the provider of this AppOnboardingRequest. | def provider(self) -> str:
return self._provider | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provider(self):\n return self.provider",
"def get_provider(self):\r\n if self.provided_by:\r\n return list(self.provided_by)[0]",
"def get_provider(self, name=None):\n return self.gateway and self.gateway.provider or None",
"def provider(self) -> Provid... | [
"0.7165047",
"0.66273135",
"0.65813476",
"0.65613097",
"0.6551903",
"0.6551903",
"0.6455895",
"0.63596654",
"0.616431",
"0.5977149",
"0.5879094",
"0.5815424",
"0.577907",
"0.577907",
"0.57314867",
"0.5727109",
"0.57234025",
"0.5657729",
"0.559928",
"0.55651826",
"0.54997116",... | 0.6651841 | 1 |
Sets the provider of this AppOnboardingRequest. | def provider(self, provider: str):
if provider is None:
raise ValueError("Invalid value for `provider`, must not be `None`") # noqa: E501
self._provider = provider | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider(self, provider):\n\n self._provider = provider",
"def provider(self, provider: Provider) -> None:\n self._provider = provider",
"def set_provider(self, provider):\n \n check = self.check_provider(provider)\n if check is not None:\n self.default_provide... | [
"0.65132254",
"0.631406",
"0.61888784",
"0.6103051",
"0.59931517",
"0.59315324",
"0.56389064",
"0.5291666",
"0.5262108",
"0.5203177",
"0.5097328",
"0.5091542",
"0.5015505",
"0.50113255",
"0.4997808",
"0.49696907",
"0.49696907",
"0.486059",
"0.48574644",
"0.48547065",
"0.48494... | 0.6201182 | 2 |
Sets the app_package_path of this AppOnboardingRequest. | def app_package_path(self, app_package_path: str):
if app_package_path is None:
raise ValueError("Invalid value for `app_package_path`, must not be `None`") # noqa: E501
self._app_package_path = app_package_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_package_path(self) -> str:\n return self._app_package_path",
"def app_path(self, package):\n return self.adb.app_path(package)",
"def pkg_app_file_chooser(self):\n filename = tk.filedialog.askopenfilename()\n self._pkg_app_path_var.set(filename)",
"def set_application(self... | [
"0.64465624",
"0.63827646",
"0.55093116",
"0.54610795",
"0.52682877",
"0.50902385",
"0.508738",
"0.50395197",
"0.49932727",
"0.49582005",
"0.49404576",
"0.48935053",
"0.48232415",
"0.48193163",
"0.48184052",
"0.481399",
"0.47893766",
"0.47639367",
"0.47163978",
"0.46639314",
... | 0.6833444 | 0 |
Sets the user_defined_data of this AppOnboardingRequest. | def user_defined_data(self, user_defined_data: UserDefinedDatadef):
self._user_defined_data = user_defined_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_custom_data(self, user_custom_data):\n\n self._user_custom_data = user_custom_data",
"def user_defined_data(self) -> UserDefinedDatadef:\n return self._user_defined_data",
"def set_predefined_data(self, data: dict) -> None:\n\n metainfo = {\n self.META_KEYS[k]: v\n ... | [
"0.63544077",
"0.59203434",
"0.5415275",
"0.54122066",
"0.5386654",
"0.53805053",
"0.53210664",
"0.525836",
"0.52299565",
"0.5061025",
"0.49596122",
"0.49256986",
"0.49225923",
"0.48915115",
"0.4864411",
"0.47814584",
"0.47800875",
"0.47800875",
"0.47800875",
"0.47794256",
"0... | 0.7649699 | 0 |
Throw exception that PUT operation is not supported for orders. | def _order_update_not_supported():
pecan.abort(405, u._("Order update is not supported.")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_order_with_no_status(self):\n response = self.api_test_client.put('{}/orders/1'.format(\n self.BASE_URL), json={})\n\n self.assertEqual(response.status_code, 400)\n self.assertEqual(response_as_json(\n response)['message'], 'Bad request. Missing required p... | [
"0.71757704",
"0.685263",
"0.68411255",
"0.63777924",
"0.6330057",
"0.6239871",
"0.6233137",
"0.61859435",
"0.61753637",
"0.6033929",
"0.601806",
"0.6000161",
"0.5990502",
"0.59241134",
"0.590755",
"0.5848611",
"0.58351314",
"0.5782107",
"0.5769348",
"0.57612693",
"0.57255447... | 0.70926565 | 1 |
Set learning rate and momentum parameter for all updates. | def set_sgd_params(self, lr_1=0.01, lr_2=0.01, \
mom_1=0.9, mom_2=0.999):
zero_ary = np.zeros((1,))
# set learning rates
new_lr_1 = zero_ary + lr_1
self.lr_1.set_value(to_fX(new_lr_1))
new_lr_2 = zero_ary + lr_2
self.lr_2.set_value(to_fX(new_lr_2))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_params(self, learning_rate):\n\t\t#######################################################################\n\t\t# ** START OF YOUR CODE **\n\t\t#######################################################################\n\n\t\tfor layer in self._layers:\n\t\t\tlayer.update_params(learni... | [
"0.76748896",
"0.74913734",
"0.74661255",
"0.7452288",
"0.7452288",
"0.73510915",
"0.73496056",
"0.73333514",
"0.7277534",
"0.72529244",
"0.71398395",
"0.7136169",
"0.70598686",
"0.70545924",
"0.70306385",
"0.70156974",
"0.69949204",
"0.696616",
"0.69641256",
"0.69125664",
"0... | 0.0 | -1 |
Set the relative strength of l2 regularization on network params. | def set_lam_l2w(self, lam_l2w=1e-3):
zero_ary = np.zeros((1,))
new_lam = zero_ary + lam_l2w
self.lam_l2w.set_value(to_fX(new_lam))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_regularization_penalty(self):\n return self.l2 * (np.linalg.norm(self.weights)**2)",
"def l2_regularization(W, reg_strength):\n # TODO: Copy from the previous assignment\n loss = reg_strength*np.sum(W*W)\n grad = 2*reg_strength*W\n return loss, grad",
"def l2(parameter, bias=None, reg... | [
"0.7017099",
"0.67766094",
"0.6399385",
"0.6398067",
"0.62745535",
"0.6247732",
"0.61704993",
"0.6094297",
"0.6045476",
"0.60080147",
"0.59978867",
"0.5993538",
"0.59822834",
"0.5982153",
"0.5977694",
"0.5967052",
"0.5956056",
"0.593961",
"0.5936574",
"0.5933125",
"0.59192765... | 0.0 | -1 |
Convert an ImaKeyrings into its JSON representation; this does not include the tenant keyring | def to_json(self) -> Dict[str, str]:
obj = {}
for name, keyring in self.keyrings.items():
if name == "tenant_keyring":
continue
obj[name] = keyring.to_string()
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(obj: Dict[str, str]) -> \"ImaKeyrings\":\n ima_keyrings = ImaKeyrings()\n\n for name, keyring_str in obj.items():\n ima_keyring = ImaKeyring.from_string(keyring_str)\n if ima_keyring:\n ima_keyrings.keyrings[name] = ima_keyring\n\n return ima_... | [
"0.6252248",
"0.5878853",
"0.57270753",
"0.56128883",
"0.5574036",
"0.5550997",
"0.54971224",
"0.54101974",
"0.5390525",
"0.5302628",
"0.5300128",
"0.51985574",
"0.5166515",
"0.514141",
"0.5127374",
"0.5124328",
"0.51215804",
"0.5116573",
"0.51007956",
"0.50960356",
"0.509343... | 0.74908733 | 0 |
Convert an ImaKeyrings into its string representation; this does not include the tenant keyring | def to_string(self) -> str:
return json.dumps(self.to_json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(self) -> Dict[str, str]:\n obj = {}\n\n for name, keyring in self.keyrings.items():\n if name == \"tenant_keyring\":\n continue\n obj[name] = keyring.to_string()\n\n return obj",
"def _to_string(self):\r\n return u\"{course_key}+{BLOCK_... | [
"0.6535713",
"0.55866456",
"0.55175984",
"0.55030906",
"0.54918516",
"0.54778725",
"0.5454033",
"0.53885263",
"0.5341515",
"0.5283014",
"0.5267178",
"0.5218499",
"0.52103305",
"0.5206999",
"0.51695603",
"0.5152251",
"0.5150663",
"0.5115899",
"0.5097827",
"0.5087612",
"0.50719... | 0.0 | -1 |
Get the MAC address for a given IP. | def _arp(ip_address):
cmd = ['arp', '-n', ip_address]
arp = subprocess.Popen(cmd, stdout=subprocess.PIPE)
out, _ = arp.communicate()
match = re.search(r'(([0-9A-Fa-f]{1,2}\:){5}[0-9A-Fa-f]{1,2})', str(out))
if match:
return match.group(0)
_LOGGER.info('No MAC address found for %s', ip_ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mac(ip):\n ans, _ = srp(Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ip), timeout=3, verbose=0)\n if ans:\n return ans[0][1].src\n else:\n return None",
"def get_mac(ip):\n p = Ether(dst=\"ff:ff:ff:ff:ff:ff\") / ARP(op=1, pdst=ip)\n result = srp(p, verbose=False, iface=IFACE)[0]\n... | [
"0.8201867",
"0.8148509",
"0.80589664",
"0.756874",
"0.7459438",
"0.7267075",
"0.7223748",
"0.7032588",
"0.6921128",
"0.67374223",
"0.66615444",
"0.6650865",
"0.66147566",
"0.65929496",
"0.6584201",
"0.6584201",
"0.6578897",
"0.6561687",
"0.65256554",
"0.6515859",
"0.6492438"... | 0.67370504 | 10 |
Turn the pin to high/on. | def turn_on(self, **kwargs):
_LOGGER.error("DALI TURN ON")
self._state = True
if ATTR_BRIGHTNESS in kwargs:
_LOGGER.error(kwargs[ATTR_BRIGHTNESS])
bri = kwargs[ATTR_BRIGHTNESS]
if bri == 0:
self._state = False
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pin_on(self, pin):\n port_num = self._convert_pin_port(pin)\n if port_num:\n gpio.setcfg(port_num, gpio.OUTPUT)\n gpio.output(port_num, gpio.HIGH)",
"def set_pin(self):\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(self.pin, GPIO.OU... | [
"0.7796581",
"0.7778957",
"0.7704173",
"0.76834244",
"0.76218444",
"0.75514233",
"0.7351297",
"0.72946626",
"0.72617084",
"0.72604066",
"0.7247054",
"0.7184695",
"0.7131798",
"0.7096684",
"0.70917267",
"0.70745337",
"0.70731044",
"0.704346",
"0.7013155",
"0.7005344",
"0.69741... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.