query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return an expiration time | def _expiration(timeout, time_format=None):
if timeout == "now":
return time_util.instant(time_format)
else:
# validity time should match lifetime of assertions
return time_util.in_a_while(minutes=timeout, time_format=time_format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"def expiration_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"expiration_time\")",
"def expiration_time(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"expiration_time\")",
... | [
"0.8529616",
"0.8280426",
"0.80853397",
"0.80313957",
"0.7956723",
"0.7844437",
"0.7844437",
"0.7844437",
"0.7829668",
"0.7770442",
"0.7770442",
"0.7729396",
"0.76086843",
"0.75939333",
"0.7579523",
"0.7578817",
"0.7573692",
"0.75603133",
"0.75563383",
"0.75563383",
"0.755520... | 0.7685644 | 12 |
r"""Computes the Dice similarity coefficient (DSC) between two boolean 1D arrays. The Dice similarity coefficient between `u` and `v`, is | def dice_similarity(u: np.ndarray, v: np.ndarray) -> np.float64:
u_and_v = np.bitwise_and(u != 0, v != 0)
u_abs_and_v_abs = np.abs(u).sum() + np.abs(v).sum()
dice_score = 0
if u_abs_and_v_abs != 0:
dice_score = 2.0 * np.float64(u_and_v.sum()) / np.float64(u_abs_and_v_abs)
return dice_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dice_similarity_compiled():\n vector1 = np.array([1, 1, 0, 0])\n vector2 = np.array([1, 1, 1, 1])\n score11 = dice_similarity(vector1, vector1)\n score12 = dice_similarity(vector1, vector2)\n score22 = dice_similarity(vector2, vector2)\n\n assert score12 == 2 * 2/6, \"Expected different ... | [
"0.6186498",
"0.6031475",
"0.5987119",
"0.5915501",
"0.5913461",
"0.5890209",
"0.58428323",
"0.5826878",
"0.5803438",
"0.57838595",
"0.5783051",
"0.5778408",
"0.57632315",
"0.5746457",
"0.5701787",
"0.56907266",
"0.56478417",
"0.55589324",
"0.552098",
"0.5518145",
"0.55039036... | 0.69947106 | 0 |
Set 404 NOT FOUND | def banner_not_found(self):
self.set_status(404)
self.write('Not found') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleStatus_404(self):\n log.err('HTTP Error 404')",
"def not_found():\n return HttpError(404)",
"def send404(self):\n\t\tself.send_error(404, \"File not found\")",
"def not_found(environ, start_response):\n start_response('404 NOT FOUND', [('Content-Type', 'text/plain')])\n return [str.... | [
"0.778058",
"0.77576625",
"0.7643999",
"0.75638664",
"0.7482062",
"0.7439135",
"0.74390876",
"0.74213547",
"0.7395345",
"0.73346186",
"0.7332186",
"0.7322774",
"0.731717",
"0.7303636",
"0.7250451",
"0.7228008",
"0.72197217",
"0.7199549",
"0.7199549",
"0.718771",
"0.7184457",
... | 0.70723367 | 46 |
The identity block is the block that has no conv layer at shortcut. Arguments | def identity_block(input_tensor, kernel_size, filters, stage, block):
filters1, filters2, filters3 = filters
if K.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn' + str(stage) + block + '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.71272004",
"0.7022438",
"0.6910338",
"0.68836653",
"0.68505627",
"0.6847176",
"0.68221945",
"0.6821999",
"0.680346",
"0.6799615",
"0.67849326",
"0.67714536",
"0.67158884",
"0.67146987",
"0.67137283",
"0.6664201",
"0.6624224",
"0.66078824",
"0.65984523",
"0.65485924",
"0.65... | 0.662218 | 17 |
conv_block is the block that has a conv layer at shortcut Arguments | def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)):
filters1, filters2, filters3 = filters
if K.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
conv_name_base = 'res' + str(stage) + block + '_branch'
bn_name_base = 'bn' + str(stage)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def conv_block(input, filters, phase=phase):\r\n\r\n conv_block = tf.layers.conv2d(\r\n inputs=input,\r\n filters=filters,\r\n kernel_s... | [
"0.7534373",
"0.7484754",
"0.7364931",
"0.7221862",
"0.7208933",
"0.72065777",
"0.72024804",
"0.7186877",
"0.7177842",
"0.71731704",
"0.7160109",
"0.71575546",
"0.71567076",
"0.7151018",
"0.71302116",
"0.7105076",
"0.70989263",
"0.70727605",
"0.7059039",
"0.70296305",
"0.7029... | 0.69167703 | 27 |
set the compagny_name of the current object | def set_compagny_name(self, compagny_name):
if check_data_exist(compagny_name) is True:
self.compagny_name = compagny_name.text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self,name):\r\n self._name = __name",
"def setName(self, *args):\n return _libsbml.Compartment_setName(self, *args)",
"def __set_name__(self, cls, name):\n pass",
"def set_name(self, name):\n\t\tself.name_ = name",
"def name(self, name):\n self.__name = name",
"de... | [
"0.7157931",
"0.7147771",
"0.7078883",
"0.69655985",
"0.6932785",
"0.69032013",
"0.69024086",
"0.6902033",
"0.68994534",
"0.6867718",
"0.6855847",
"0.6814017",
"0.6814017",
"0.6814017",
"0.6814017",
"0.6782805",
"0.6779095",
"0.6779095",
"0.6779095",
"0.6779095",
"0.6779068",... | 0.7398819 | 0 |
Return name of state group. | def name(self):
return self.prefix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def getName(self):\n return _libsbml.Group_getName(self)",
"def group_name(self):\n\n return self._group_name",
"def get_group_name(self):\n return self.groupname",
"def state_name(self):\n return s... | [
"0.78997743",
"0.7751281",
"0.75898474",
"0.7483801",
"0.74289334",
"0.74023914",
"0.7274556",
"0.71709013",
"0.71709013",
"0.71474487",
"0.7077211",
"0.7037616",
"0.7037616",
"0.6920441",
"0.6902182",
"0.68966734",
"0.68509156",
"0.67977303",
"0.6752657",
"0.6752657",
"0.674... | 0.0 | -1 |
Yields SAT variables generated from this state group. | def variables(self):
for state in self.states:
yield self.assert_state(state)
yield self.deassert_state(state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variableIter(self):\n for (para, start), variable in self.variables.iteritems():\n yield para, start, variable",
"def variables(self):\n for name in self._nodes:\n if isinstance(self._nodes[name], RandomVariable):\n yield name",
"def prepare_for_sat(self):... | [
"0.69743395",
"0.6883712",
"0.65445423",
"0.64204246",
"0.62265545",
"0.6154628",
"0.6037124",
"0.5999404",
"0.599858",
"0.5831236",
"0.57868844",
"0.5706464",
"0.56882715",
"0.56753033",
"0.56417716",
"0.56308204",
"0.56123686",
"0.5606789",
"0.5563119",
"0.55613166",
"0.550... | 0.77531016 | 0 |
Tries to determine the Chimera indices of the nodes in G. See chimera_graph for a definition of a Chimera graph and Chimera indices. Only works for singletile Chimera graphs. | def find_chimera_indices(G):
# if the nodes are orderable, we want the lowest-order one.
try:
nlist = sorted(G.nodes)
except TypeError:
nlist = G.nodes()
n_nodes = len(nlist)
# create the object that will store the indices
chimera_indices = {}
# ok, let's first check for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodeid_to_index(G):\n\n d = {node_id: i for i, node_id in enumerate(G.nodes)}\n\n return d",
"def hoggar_indices():\n return list(product([0,1], repeat=6))",
"def findIndices(g):\r\n change = [0]\r\n seen = [g[0]]\r\n for i in range(1, len(g)):\r\n if not g[i] in seen:\r\n ... | [
"0.6657941",
"0.6035419",
"0.5730564",
"0.57111025",
"0.5694183",
"0.56615144",
"0.56031746",
"0.5573093",
"0.5508316",
"0.54342",
"0.5429854",
"0.54185075",
"0.5397645",
"0.5396681",
"0.53806823",
"0.53753614",
"0.5330184",
"0.53139323",
"0.5297875",
"0.52876",
"0.5284932",
... | 0.8524277 | 0 |
Internal utility method; retrieve a subobject from a JSON object/array; returns an empty object if key is not present | def getJSONObject(self, json, key):
toReturn = {}
if json is not None:
toReturn = json.get(key, {})
return toReturn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(\n obj: Union[JSONArray, JSONObject], # pylint: disable=unsubscriptable-object\n key: Union[int, str, FlatKey], # pylint: disable=unsubscriptable-object\n default=MISSING,\n) -> JSONType:\n if isinstance(key, Iterable) and not isinstance(key, str):\n key = tuple(key)\n else:\n ... | [
"0.66176945",
"0.61424273",
"0.61349213",
"0.6088905",
"0.6072604",
"0.60557",
"0.6012335",
"0.6006855",
"0.6006855",
"0.6006855",
"0.6006855",
"0.6006855",
"0.59171164",
"0.59031755",
"0.58909124",
"0.5797176",
"0.5766557",
"0.576179",
"0.574668",
"0.5726246",
"0.5702363",
... | 0.58949363 | 16 |
Return the vertical proportion that has been explicitly set for the row with the given index. It is an error to call this if `has_row_proportion(index)` returns False. | def get_row_proportion(self, index):
assert self.has_row_proportion(index)
return self._proportions[1][index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_row_proportion(self, index):\n\n return index in self._proportions[1]",
"def get_column_proportion(self, index):\n\n assert self.has_column_proportion(index)\n return self._proportions[0][index]",
"def set_row_proportion(self, index, proportion):\n\n if not (self.has_row_pro... | [
"0.77072453",
"0.7701299",
"0.7321596",
"0.70033276",
"0.6793394",
"0.6534067",
"0.62665695",
"0.5894355",
"0.55736285",
"0.5277371",
"0.5207475",
"0.5162436",
"0.5049307",
"0.50331205",
"0.49892026",
"0.49165678",
"0.4898905",
"0.48089084",
"0.47684935",
"0.46787283",
"0.466... | 0.8411929 | 0 |
Return the horizontal proportion that has been explicitly set for the column with the given index. It is an error to call this if `has_column_proportion(index)` returns False. | def get_column_proportion(self, index):
assert self.has_column_proportion(index)
return self._proportions[0][index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row_proportion(self, index):\n\n assert self.has_row_proportion(index)\n return self._proportions[1][index]",
"def has_column_proportion(self, index):\n\n return index in self._proportions[0]",
"def set_column_proportion(self, index, proportion):\n\n if not (self.has_column_... | [
"0.77472883",
"0.73532116",
"0.7238665",
"0.6822433",
"0.6575121",
"0.6405669",
"0.58670044",
"0.58117044",
"0.57667106",
"0.56129205",
"0.55716354",
"0.55469793",
"0.5306125",
"0.5209739",
"0.5108251",
"0.501729",
"0.49276683",
"0.48146495",
"0.47788283",
"0.47654563",
"0.47... | 0.8294248 | 0 |
Explicitly set a horizontal proportion for the column with the given index. It will override the horizontal proportions associated with any cell added to that column. | def set_column_proportion(self, index, proportion):
if not (self.has_column_proportion(index)
and proportion == self.get_column_proportion(index)):
self._proportions[0][index] = proportion | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_row_proportion(self, index, proportion):\n\n if not (self.has_row_proportion(index)\n and proportion == self.get_row_proportion(index)):\n self._proportions[1][index] = proportion",
"def set_default_proportions(self, column_proportion=-1., row_proportion=-1.):\n\n ... | [
"0.7463202",
"0.69893706",
"0.6842438",
"0.6782281",
"0.65914124",
"0.63122076",
"0.6134949",
"0.6073575",
"0.58654046",
"0.5772014",
"0.56560874",
"0.5550161",
"0.5541183",
"0.5474241",
"0.5454414",
"0.5273148",
"0.50336933",
"0.50092375",
"0.48601335",
"0.48528978",
"0.4843... | 0.8036727 | 0 |
Generate a PyTorch Tensor of uniform random noise. | def sample_noise(batch_size, dim):
temp = torch.rand(batch_size, dim) + torch.rand(batch_size, dim)*(-1)
return temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_noise(sample_size, latent):\r\n\treturn Variable(torch.randn(sample_size, latent))",
"def get_noise(n_samples, noise_dims):\n return torch.randn(n_samples, noise_dims).to(device)",
"def randn(self, *args, **kwargs):\n # TODO: Put this in torch.cuda.randn\n return torch.empty(*args, **k... | [
"0.78607744",
"0.7439445",
"0.7192883",
"0.7162179",
"0.7150802",
"0.6852673",
"0.68526524",
"0.67748046",
"0.6741003",
"0.6680159",
"0.6671221",
"0.66515356",
"0.66226083",
"0.6617532",
"0.66072696",
"0.6583869",
"0.6484449",
"0.64814436",
"0.6417874",
"0.6327954",
"0.631956... | 0.7294348 | 2 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
)
)
if unload_ok:
has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.69729054",
"0.688811",
"0.6779906",
"0.67475253",
"0.6689114",
"0.6657885",
"0.66162664",
"0.6603484",
"0.65926456",
"0.65596145",
"0.6541213",
"0.65076923",
"0.65076923",
"0.65076923",
"0.65076923",
"0.6497813",
"0.6493226",
"0.6486651",
"0.6486651",
"0.6486651",
"0.64866... | 0.64597934 | 26 |
r""" Calculate the diameter representing an inclosed sphere. The maximum is very difficult to caluclate for irregular polygons with more than 4 faces so an average distance from the pore centroid to the throat centroid is an approximation | def centroids(network,
geometry,
**kwargs):
Np = geometry.num_pores()
value = _sp.zeros(Np)
pore_map = geometry.map_pores(geometry.pores(),geometry._net)
for geom_pore,net_pore in pore_map:
net_throats = geometry._net.find_neighbor_throats(net_pore)
geom_throats... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diameter(self):\n return self.radius * 2",
"def diameter(self):\n return self.radius * 2",
"def diameter(self):\n return 2 * self.radius",
"def get_diameter(self) -> float:\r\n \r\n return (self.box[3] - self.box[1] + self.box[2] - self.box[0]) / 2",
"def radius(self... | [
"0.712678",
"0.712678",
"0.7029265",
"0.6926693",
"0.6790634",
"0.6676335",
"0.661085",
"0.65456617",
"0.6542527",
"0.65210044",
"0.6393097",
"0.6369409",
"0.6353976",
"0.6333664",
"0.62392086",
"0.621692",
"0.6207583",
"0.61876357",
"0.61876357",
"0.6185845",
"0.6154718",
... | 0.0 | -1 |
Return the name of the sensor. | def name(self):
return self._sensor.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.sensor][0]}\"",
"def name(self):\n return f\"{self.... | [
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
"0.7467876",
"... | 0.91896784 | 0 |
Return the state attributes of the sensor. | def device_state_attributes(self): # Can be remove from 0.99
return self._attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self) ... | [
"0.841935",
"0.8250326",
"0.82437867",
"0.82437867",
"0.82012314",
"0.81700313",
"0.81700313",
"0.8159924",
"0.8159924",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"0.81466115",
"... | 0.8026349 | 24 |
Return a unique identifier for this sensor. | def unique_id(self):
return f"sma-{self._sensor.key}-{self._sensor.name}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self):\n return self.device_id + '_' + self._sensor_type",
"def unique_id(self):\n id = \"{}{}{}\".format(\n DOMAIN, self._account, self.sensorName.lower().replace(\" \", \"\")\n )\n return id",
"def unique_id(self) -> str:\n return get_frigate_entity... | [
"0.89518833",
"0.8736766",
"0.8265032",
"0.822934",
"0.8163052",
"0.80765367",
"0.8025028",
"0.7976767",
"0.7944212",
"0.79329187",
"0.7922121",
"0.7903247",
"0.78308314",
"0.7809602",
"0.7777067",
"0.77506226",
"0.7746131",
"0.77068925",
"0.7704749",
"0.7704749",
"0.76739955... | 0.8403973 | 2 |
Return a set with all rules that this rule depends on. | def get_children(self, current_rule) -> Set:
dependencies = set()
rules = self.rules[current_rule]
for rule in rules:
for r in rule:
dependencies.add(r)
return dependencies | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rules(self) -> FrozenOrderedSet[Union[Callable, Rule]]:\n return self._rules",
"def get_all_rules(self):\n\n rules = set()\n for a_dict in self.get_dicts():\n rules = keywords.union(a_dict['rules'])\n return sorted(keywords)",
"def get_rules(self):\n rules = []... | [
"0.7516741",
"0.6892689",
"0.68103385",
"0.668143",
"0.6667766",
"0.6536532",
"0.6489662",
"0.64737177",
"0.64503264",
"0.6383532",
"0.63595927",
"0.6307675",
"0.6265947",
"0.62521154",
"0.6208379",
"0.6200408",
"0.61484313",
"0.6137293",
"0.61020184",
"0.60536444",
"0.600773... | 0.75873446 | 0 |
Get a request or raise a NoObject exception. | def get_request(request_id=None, workload_id=None, session=None):
try:
if not request_id and workload_id:
request_ids = get_request_ids_by_workload_id(workload_id)
if request_ids and len(request_ids) > 1:
raise exceptions.IDDSException("More than one request with the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, request_obj):\n return self._execute_action(request_obj, 'GET')",
"def get_request(self):\n url = self.get_url()\n r = requests.get(url)\n r.raise_for_status()\n return r",
"def _get(self, request_obj):\n return self._execute_action(request_obj, [Abstrac... | [
"0.70239514",
"0.67389417",
"0.6664441",
"0.64666516",
"0.6407963",
"0.6383334",
"0.6383334",
"0.63753647",
"0.6261814",
"0.6222001",
"0.61916023",
"0.6179692",
"0.61665297",
"0.61595196",
"0.6149147",
"0.6149147",
"0.6149147",
"0.6149147",
"0.6149147",
"0.6149147",
"0.614914... | 0.0 | -1 |
test case for list_subnets | def test_list_subnets(self):
print(self.the_client.list_subnets()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_network_subnets_get(self):\n pass",
"def test_list_host_subnet(self):\n pass",
"def list_subnet(self):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/subnets\"\n _headers = {'Content-type': 'application/json',\n 'x-auth-token': self.pr... | [
"0.8641722",
"0.81305766",
"0.76616037",
"0.76107717",
"0.7391433",
"0.7340475",
"0.7326471",
"0.71373",
"0.7130789",
"0.71132153",
"0.7041052",
"0.70338523",
"0.70009273",
"0.698873",
"0.6943558",
"0.6918958",
"0.6892937",
"0.6892937",
"0.6885471",
"0.6862652",
"0.6850329",
... | 0.90414274 | 0 |
test case for get_subnet | def test_get_subnet(self):
self.assertEqual(
type(self.the_client.get_subnet(subnet_id)),
baidubce.bce_response.BceResponse) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_host_subnet(self):\n pass",
"def test_aws_service_api_network_subnets_get(self):\n pass",
"def test_list_host_subnet(self):\n pass",
"def test_create_host_subnet(self):\n pass",
"def test_create_subnet(self):\n client_token = generate_client_token()\n ... | [
"0.84196514",
"0.8066653",
"0.79388773",
"0.77881706",
"0.7599941",
"0.75039417",
"0.7357256",
"0.7343284",
"0.7299323",
"0.7204138",
"0.71839964",
"0.7011758",
"0.69543284",
"0.6928814",
"0.69263834",
"0.68968976",
"0.6894507",
"0.68873",
"0.6863575",
"0.6861364",
"0.6829695... | 0.8425625 | 0 |
Asks the structured mask handler to resolve dependent masks in the model. | def resolve_structured_mask(self):
assert self._scheduler.enable_structured_masking
self._structured_mask_handler.resolve_dependent_structured_mask() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_structured_mask(self):\n assert self._scheduler.enable_structured_masking\n self._structured_mask_handler.populate_dependent_structured_mask_to_operand()\n self._structured_mask_handler.report_structured_sparsity(self._config.get(\"log_dir\", \".\"))",
"def reset_independent_str... | [
"0.59795004",
"0.5483798",
"0.5323584",
"0.525908",
"0.5236944",
"0.5194646",
"0.51364815",
"0.5128196",
"0.5106535",
"0.5034842",
"0.5010966",
"0.49962148",
"0.4981131",
"0.49742624",
"0.49739072",
"0.4968418",
"0.4949729",
"0.49482593",
"0.4939101",
"0.4906457",
"0.48872688... | 0.7284754 | 0 |
Test the trie node init method, lookup value with no input values. | def test_trie_node_init_no_values_one():
from trie import Node
test_case = Node()
assert test_case.lookup == {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trie_node_init_inputs_one():\n from trie import Node\n test_case = Node(\"a\", True)\n assert test_case.lookup[\"a\"] == []",
"def test_trie_node_init_no_values_two():\n from trie import Node\n test_case = Node()\n assert test_case.end is False",
"def test_trie_node_init_inputs_two()... | [
"0.83532614",
"0.7702699",
"0.7306068",
"0.70250255",
"0.6871894",
"0.68496495",
"0.68375146",
"0.68240327",
"0.6792723",
"0.6746613",
"0.67042917",
"0.67042917",
"0.66111046",
"0.6605288",
"0.6605288",
"0.6586855",
"0.6586855",
"0.65249133",
"0.64677805",
"0.64677805",
"0.64... | 0.8281036 | 1 |
Test the trie node init method, lookup value with appropriate input. | def test_trie_node_init_inputs_one():
from trie import Node
test_case = Node("a", True)
assert test_case.lookup["a"] == [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trie_node_init_no_values_one():\n from trie import Node\n test_case = Node()\n assert test_case.lookup == {}",
"def test_trie_node_init_inputs_two():\n from trie import Node\n test_case = Node(\"a\", True)\n assert test_case.end is True",
"def test_trie_class_init():\n from trie i... | [
"0.7649997",
"0.7308923",
"0.7176811",
"0.6930904",
"0.67308426",
"0.6643685",
"0.660373",
"0.65935534",
"0.6581707",
"0.6581707",
"0.64600796",
"0.6421951",
"0.63766456",
"0.63766456",
"0.6362924",
"0.6334893",
"0.6334893",
"0.6334893",
"0.6334893",
"0.6319275",
"0.6265327",... | 0.81978494 | 0 |
Test the trie node init method, end value with appropriate input. | def test_trie_node_init_inputs_two():
from trie import Node
test_case = Node("a", True)
assert test_case.end is True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trie_node_init_no_values_two():\n from trie import Node\n test_case = Node()\n assert test_case.end is False",
"def test_trie_node_init_inputs_one():\n from trie import Node\n test_case = Node(\"a\", True)\n assert test_case.lookup[\"a\"] == []",
"def test_trie_node_init_no_values_on... | [
"0.7730197",
"0.74995536",
"0.70786244",
"0.6775027",
"0.6725298",
"0.668548",
"0.6680993",
"0.6661344",
"0.6645949",
"0.6645949",
"0.6623407",
"0.65746355",
"0.6571673",
"0.6561272",
"0.6561272",
"0.6465058",
"0.6444544",
"0.64328706",
"0.6426842",
"0.6426842",
"0.6426842",
... | 0.79648393 | 0 |
Test that the Trie class inits correctly. | def test_trie_class_init():
from trie import Trie
test_case = Trie()
assert test_case.root.lookup == {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n #initialize the root of Trie\n self._dict = TrieNode('/')",
"def __init__(self):\r\n self.trie = Trie()",
"def __init__(self):\n self.trie = Trie()",
"def __init__(self):\n self.trie = TrieNode()",
"def __init__(self):\n self.trie = TrieNode()... | [
"0.7501956",
"0.74852765",
"0.7436087",
"0.7255765",
"0.7255765",
"0.7211225",
"0.71979225",
"0.7197518",
"0.7194155",
"0.7177734",
"0.71754056",
"0.71658176",
"0.7102576",
"0.7077024",
"0.7058083",
"0.7058083",
"0.70542675",
"0.70322394",
"0.70322394",
"0.70322394",
"0.70322... | 0.77873504 | 0 |
Gets the loader resolver. | def getResolver(self):
pass; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loader(self):\n return self.loader_class()",
"def resolver(self):\n return self._resolver",
"def get_loader(self) -> BaseLoader:\n return FileSystemLoader(getattr(self, \"cwd\"))",
"def loader(self):\r\n return self._loader",
"def resolver ( self ):\n return self._resol... | [
"0.7412756",
"0.7184654",
"0.7138766",
"0.7133028",
"0.7121689",
"0.70757586",
"0.7057547",
"0.6980895",
"0.670182",
"0.631103",
"0.6197598",
"0.6122083",
"0.5924822",
"0.5924822",
"0.5797434",
"0.57965946",
"0.5750693",
"0.56556094",
"0.56200546",
"0.5569091",
"0.55645347",
... | 0.6390528 | 9 |
Constructor. LoaderInterface[] $loaders An array of loaders | def __init__(self, loaders = None):
if loaders is None:
loaders = list();
self.__loaders = list();
for loader in list(loaders):
self.addLoader(loader); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_loaders(self, loaders):\n # type: (List[AbstractTemplateLoader]) -> None\n self.runtime_configuration_builder.add_loaders(loaders)",
"def _init_loaders(self):\n @self.loaders_wrapper(\"nx2nx\")\n def get_nx2nx_loader(extractor, stream, transformers, graph):\n \"\"\"... | [
"0.7126605",
"0.6806202",
"0.6384365",
"0.6323118",
"0.6217296",
"0.5977542",
"0.5893152",
"0.58740646",
"0.5816445",
"0.57874745",
"0.57847667",
"0.57287186",
"0.5679922",
"0.56760406",
"0.56425554",
"0.5627128",
"0.5613179",
"0.55325824",
"0.5511157",
"0.5458071",
"0.545102... | 0.8647711 | 0 |
Returns a loader able to load the resource. mixed $resource A resource string $type The resource type LoaderInterface|False A LoaderInterface instance | def resolve(self, resource, resourceType = None):
for loader in self.__loaders:
if loader.supports(resource, resourceType):
return loader;
return False; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(self, resource, resourceType=None):\n if self.supports(resource, resourceType):\n return self;\n\n if self._resolver is None:\n loader = False;\n else:\n loader = self._resolver.resolve(resource, resourceType);\n\n if loader is False:\n ... | [
"0.6763033",
"0.6298111",
"0.6179125",
"0.61083937",
"0.5919506",
"0.59088504",
"0.5873452",
"0.5684471",
"0.5649836",
"0.5645879",
"0.5618907",
"0.56163675",
"0.5602245",
"0.5595989",
"0.55787945",
"0.5535665",
"0.5495051",
"0.54501784",
"0.54296356",
"0.54214597",
"0.538906... | 0.64681834 | 1 |
Returns the registered loaders. | def getLoaders(self):
return self.__loaders; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_plugin_loaders():\n mgr = stevedore.EnabledExtensionManager(namespace=PLUGIN_NAMESPACE,\n check_func=_auth_plugin_available,\n invoke_on_load=True,\n propagate_map_e... | [
"0.7714946",
"0.70735335",
"0.70482886",
"0.70099086",
"0.67619073",
"0.66490954",
"0.6565417",
"0.6504638",
"0.64695877",
"0.6434186",
"0.6369179",
"0.6367745",
"0.6360343",
"0.6286084",
"0.62806255",
"0.6202601",
"0.6198658",
"0.6185609",
"0.61698836",
"0.61341745",
"0.6115... | 0.8486463 | 0 |
Given an axisaligned normal, return the matching side. | def __getitem__(self, item: Union[Vec, Tuple[float, float, float]]) -> 'Side':
if item == (1, 0, 0):
return self.east
elif item == (-1, 0, 0):
return self.west
elif item == (0, 1, 0):
return self.north
elif item == (0, -1, 0):
return self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direction(a, b):\r\n\tdiff_y = b[0] - a[0]\r\n\tdiff_x = b[1] - a[1]\r\n\r\n\tif diff_y != 0 and diff_x != 0:\r\n\t\treturn 'diagonal'\r\n\r\n\treturn 'vertical' if diff_y != 0 else 'horizontal'",
"def normal(axis_direction, axis_origin, point):\n # transform input into numpy arrays\n axis_directio... | [
"0.56034356",
"0.53610194",
"0.5314936",
"0.5314936",
"0.5294048",
"0.5272727",
"0.52477425",
"0.52107817",
"0.520213",
"0.5122449",
"0.51039296",
"0.5099674",
"0.50900507",
"0.5088534",
"0.5060466",
"0.5058247",
"0.5054107",
"0.50445133",
"0.5029519",
"0.50140023",
"0.500013... | 0.0 | -1 |
Remove an entity from the map. After this is called, the entity will no longer be exported. The object still exists, so it can be reused. | def remove_ent(self, item: 'Entity') -> None:
try:
self.entities.remove(item)
except ValueError:
pass # Already removed.
_remove_copyset(self.by_class, item['classname'].casefold(), item)
_remove_copyset(self.by_target, item['targetname'].casefold() or None, ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self) -> None:\n self.map.remove_ent(self)",
"def remove_entity(self, ent):\n self.tiles[ent.position[x]][ent.position[y]].remove_entity(ent)",
"def remove_entity(self, entity_id):\n self.gameworld.remove_entity(entity_id)",
"def remove_entity(self, entity):\n #if entit... | [
"0.78202176",
"0.74304336",
"0.71102947",
"0.7018589",
"0.7017857",
"0.6930453",
"0.67642224",
"0.66838807",
"0.6534248",
"0.6306396",
"0.6193649",
"0.61735034",
"0.6129487",
"0.6091967",
"0.60916",
"0.6082649",
"0.6078599",
"0.60415316",
"0.6002049",
"0.59940225",
"0.5977434... | 0.64070076 | 9 |
Generate the strings needed to define this brush. disp_multiblend controls whether displacements produce their multiblend data (added in ASW), or if it is stripped. include_groups specifies if visgroup/group values are included. This is not allowed inside brush entities. | def export(
self,
buffer: IO[str],
ind: str = '',
disp_multiblend: bool = True,
include_groups: bool = True,
) -> None:
if self.hidden:
buffer.write(ind + 'hidden\n' + ind + '{\n')
ind += '\t'
buffer.write(ind + 'solid\n')
buffe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n\n # can't use backslash in f-string\n newline = \"\\n\"\n\n options = self.options\n kwoptions = self.kwoptions\n\n # add background to options\n if self.background:\n options.append(\"show background rectangle\")\n kwoptions.upda... | [
"0.549216",
"0.545694",
"0.5354765",
"0.5287387",
"0.52081305",
"0.5150297",
"0.51182324",
"0.5090748",
"0.5088726",
"0.5071802",
"0.5048376",
"0.5034623",
"0.50331444",
"0.5007325",
"0.50020015",
"0.4969055",
"0.49648565",
"0.49521682",
"0.4937567",
"0.49263352",
"0.49189362... | 0.5267197 | 4 |
Move this solid by the specified vector. | def translate(self, diff: AnyVec) -> None:
for s in self.sides:
s.translate(diff) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self):\n vector = vectors[compass.index(self.heading)]\n x = self.position[0] + vector[0]\n y = self.position[1] + vector[1]\n self._check_move(x, self.plateau[0])\n self._check_move(y, self.plateau[1])\n return replace(self, position=(x, y))",
"def add(self, ve... | [
"0.67013836",
"0.6550828",
"0.6477519",
"0.6473777",
"0.6444337",
"0.6439776",
"0.6370973",
"0.6341416",
"0.6303924",
"0.6293098",
"0.62463677",
"0.6183897",
"0.6154268",
"0.61382514",
"0.6118287",
"0.6062566",
"0.6051841",
"0.6045004",
"0.6008494",
"0.6001662",
"0.59827065",... | 0.0 | -1 |
Return a duplicate of this axis. | def copy(self) -> 'UVAxis':
return UVAxis(
x=self.x,
y=self.y,
z=self.z,
offset=self.offset,
scale=self.scale,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return _libsbml.Dimensions_clone(self)",
"def duplicate(self):\n\n return Note(self.nbr, self.length, self.vel)",
"def duplicate(self):\n\t\treturn Graph(self.vertices[:], self.edges[:])",
"def copy(self):\n return Vector(self.x, self.y)",
"def copy(self):\n r... | [
"0.68724525",
"0.67555803",
"0.6702183",
"0.66050535",
"0.65862596",
"0.6577613",
"0.6577613",
"0.65279365",
"0.6493448",
"0.6470691",
"0.64055353",
"0.64055353",
"0.64055353",
"0.64055353",
"0.63621116",
"0.6327797",
"0.6325716",
"0.6325716",
"0.6325716",
"0.6325716",
"0.632... | 0.68670523 | 1 |
Return the number of vertexes in each direction of a displacement. | def disp_size(self) -> int:
if self.disp_power == 0:
return 0
return 2 ** self.disp_power + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self):\n num_vert = 0\n num_edg = 0\n for vertex in self.vertices():\n num_vert += 1\n num_edg += len(self.neighbors(vertex))\n return (num_vert, num_edg)",
"def vertex_count(self):\n return len(self._outgoing)",
"def vertex_count(self) -> int:\... | [
"0.6905237",
"0.6901684",
"0.6900021",
"0.68896735",
"0.6844001",
"0.68057996",
"0.6711818",
"0.6637723",
"0.6623712",
"0.6619569",
"0.6617022",
"0.66137826",
"0.66137826",
"0.6577625",
"0.6576364",
"0.65214247",
"0.6520994",
"0.6496821",
"0.64646906",
"0.6464681",
"0.6425703... | 0.0 | -1 |
Return the displacement vertex at this position. | def __getitem__(self, pos: Tuple[int, int]) -> DispVertex:
if self.disp_pos == 0 or self._disp_verts is None:
raise ValueError('This face is not a displacement!')
size = self.disp_size
x, y = pos
if 0 <= x < size and 0 <= y < size:
return self._disp_verts[size * y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displacement(self):\n return np.array(self.get_current_cartesian_position().position) - self.initial_position",
"def displacement(self):\n return self[0].distance(self[-1])",
"def get_vertex(self):\n V = circumcenter(self.Cents)\n return V",
"def vector(self) -> Vector... | [
"0.74906343",
"0.6712016",
"0.65100694",
"0.63818544",
"0.6264405",
"0.62334114",
"0.62286353",
"0.6180492",
"0.61804277",
"0.6161386",
"0.61407316",
"0.6131828",
"0.6079784",
"0.6059197",
"0.60143095",
"0.60143095",
"0.59377486",
"0.5926139",
"0.5925063",
"0.59207225",
"0.58... | 0.60656846 | 13 |
Compute the unit vector which extends perpendicular to the face. | def normal(self) -> Vec:
# The three points are in clockwise order, so compute differences
# in the clockwise direction, then cross to get the normal.
point_1 = self.planes[1] - self.planes[0]
point_2 = self.planes[2] - self.planes[1]
return Vec.cross(point_1, point_2).norm() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicular(self):\n return tuple.__new__(Vec2, (-self[1], self[0]))",
"def perpendicular_axis(vec):\n axis = vec.rotate(-math.pi / 2) # rotate vector -90 degrees\n axis = axis.norm() # turn axis vector into unit vector\n return axis",
"def normal(self) -> Vec:\n return abs(self.... | [
"0.7345459",
"0.72554266",
"0.7238237",
"0.72371686",
"0.713183",
"0.7115976",
"0.70421237",
"0.70163774",
"0.68714964",
"0.6837116",
"0.6822367",
"0.6792408",
"0.6766157",
"0.66791135",
"0.66228014",
"0.6597251",
"0.65926963",
"0.65553856",
"0.6534584",
"0.6526057",
"0.65098... | 0.64393115 | 22 |
Return a vector representing the center of this entity's brushes. | def get_origin(self) -> Vec:
if self.is_brush():
bbox_min, bbox_max = self.get_bbox()
return (bbox_min + bbox_max) / 2
else:
return Vec.from_str(self['origin']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(self):\n return self._lower + 0.5 * (self._upper - self._lower)",
"def center(self):\n return (self.upper_right + self.lower_left) * 0.5",
"def center(self):\n return np.sum(self.bbox, 0) / 2",
"def center(self):\n return np.array([0,0,1/self.C+self.pos()])",
"def cen... | [
"0.70370865",
"0.68867695",
"0.6761202",
"0.66716886",
"0.6622085",
"0.64934367",
"0.6490168",
"0.6482936",
"0.64565635",
"0.64484215",
"0.64484215",
"0.6391717",
"0.6359918",
"0.63296527",
"0.63296527",
"0.6314632",
"0.6268905",
"0.6258488",
"0.623954",
"0.6217588",
"0.62038... | 0.6316903 | 15 |
Return the value of an integer key. Equivalent to int(fixup[key]), but with a default value if missing or invalid. | def int(self, key: str, def_: Union[builtins.int, T] = 0) -> Union[builtins.int, T]:
try:
return int(self.get(key))
except (ValueError, TypeError):
return def_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSetInt(self, key: str, default: int | None = None) -> int:\n value = self.parsedConfig.getint(key, default)\n self.parsedConfig[key] = str(value)\n return value",
"def _parse_int(node, key):\n element = node.get(key)\n if element is not None:\n return int(element)\n el... | [
"0.7026486",
"0.68746656",
"0.6727073",
"0.6688775",
"0.66609466",
"0.6600007",
"0.656848",
"0.6564509",
"0.64328885",
"0.638416",
"0.6372382",
"0.63638324",
"0.6331046",
"0.62608707",
"0.6218942",
"0.62079877",
"0.61749816",
"0.61558366",
"0.6145867",
"0.6143345",
"0.6139964... | 0.7426472 | 0 |
Return the value of an integer key. Equivalent to float(fixup[key]), but with a default value if missing or invalid. | def float(self, key: str, def_: Union[builtins.float, T] = 0.0) -> Union[builtins.float, T]:
try:
return float(self.get(key))
except (ValueError, TypeError):
return def_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key: tuple) -> float:\n s, a = key\n return self.store.get(s, dict()).get(a, 0)",
"def int(self, key: str, def_: Union[builtins.int, T] = 0) -> Union[builtins.int, T]:\n try:\n return int(self.get(key))\n except (ValueError, TypeError):\n re... | [
"0.66795385",
"0.6638733",
"0.6422203",
"0.6274081",
"0.62669045",
"0.62352",
"0.6153381",
"0.61507285",
"0.6083427",
"0.60755116",
"0.60058737",
"0.5936561",
"0.5903529",
"0.5821778",
"0.581035",
"0.5805537",
"0.579569",
"0.57676125",
"0.5745585",
"0.57277596",
"0.5724304",
... | 0.63865393 | 3 |
Yield each key, value pair. | def __iter__(self) -> Iterator[Tuple[str, str]]:
for fixup in self._mapping._fixup.values():
yield fixup.var, fixup.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for key, value in self.read():\n yield key, value",
"def __iter__(self):\n\n # For each key in set of keys\n for key in self.keys_set:\n\n # Yield that key and associated value\n yield key, self.__getitem__(key)",
"def iteritems(self):\n ... | [
"0.8104699",
"0.7646156",
"0.75825214",
"0.75788873",
"0.74507576",
"0.73695886",
"0.73388445",
"0.72998494",
"0.72998494",
"0.72263587",
"0.7211884",
"0.7190543",
"0.7179359",
"0.71670926",
"0.7124975",
"0.7086928",
"0.7066419",
"0.7060719",
"0.70430154",
"0.7027951",
"0.694... | 0.0 | -1 |
Generate a userfriendly representation of this output. | def __str__(self) -> str:
st = "<Output> "
if self.inst_out:
st += f'instance:{self.inst_out};'
st += f'''{self.output} -> {self.target or '""'} -> '''
if self.inst_in:
st += f"instance:{self.inst_in};"
st += self.input
if self.params and not self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return (\"UUID: \" + str(self.uuid) + \"\\n\"\n \"Data: \" + str(self.data) + \"\\n\" +\n \"Tex: \" + str(self.texOutput) + \"\\n\")",
"def __str__(self):\n return_string = self.name + \"\\n\" + str(self.traits)\n\n return return_string",
... | [
"0.74146885",
"0.73675555",
"0.7281887",
"0.72626257",
"0.7260892",
"0.7249344",
"0.7223034",
"0.72220933",
"0.72183424",
"0.71889335",
"0.71791637",
"0.7166406",
"0.71647143",
"0.71501476",
"0.71196014",
"0.711416",
"0.7108531",
"0.71016276",
"0.70843035",
"0.70828104",
"0.7... | 0.7248752 | 6 |
Return the parameter needed to create this output via AddOutput. This assumes the target instance uses Prefix fixup, if inst_in is set. | def gen_addoutput(self, delim: str = ',') -> str:
if self.inst_out:
raise ValueError('Inst_out is not useable in AddOutput.')
if self.inst_in:
target = self.target + '-' + self.inst_in
else:
target = self.target
return (
f'{self.output} {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp_in(self) -> str:\n if self.inst_in:\n return 'instance:' + self.inst_in + ';' + self.input\n else:\n return self.input",
"def output_param(self, name):\n return self._output_params.get(name, None)",
"def _get_parameter_based_output_prefix(self):\n\n # A... | [
"0.5667785",
"0.56356645",
"0.5626118",
"0.5469224",
"0.54640526",
"0.5328074",
"0.5328074",
"0.5285569",
"0.5246858",
"0.5181701",
"0.51765513",
"0.5176066",
"0.51512295",
"0.51444393",
"0.51444393",
"0.5136174",
"0.5130297",
"0.5111306",
"0.5101912",
"0.5099648",
"0.5098803... | 0.522572 | 9 |
Tranform a SELECT query into a pandas dataframe | def postgresql_to_dataframe(conn, select_query, column_names):
cursor = conn.cursor()
try:
cursor.execute(select_query)
except (Exception, psycopg2.DatabaseError) as error:
print("Error: %s" % error)
cursor.close()
return 1
# Naturally we get a list of tupples
tu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataframe(q):\n cnx = create_engine(postgres_str)\n query = q\n return pd.read_sql_query(query, cnx)",
"def query_to_df(query):\n df = pd.DataFrame(query.all())\n df.columns = [x['name'] for x in query.column_descriptions]\n return df",
"def query(self, sql):\n df = pd.read_sql... | [
"0.79762584",
"0.7822271",
"0.7589444",
"0.7503097",
"0.74686986",
"0.7419794",
"0.74029183",
"0.7385047",
"0.73736376",
"0.7365452",
"0.7304104",
"0.72722423",
"0.7230403",
"0.7154723",
"0.7134806",
"0.7100471",
"0.7084662",
"0.7043809",
"0.7005405",
"0.6906012",
"0.68822664... | 0.7636532 | 2 |
Convert a date string into a date | def date_or_none(date_str: str | None | dt.date | dt.datetime) -> dt.date | None:
if not date_str:
return None
if isinstance(date_str, dt.datetime):
return date_str.date()
if isinstance(date_str, dt.date):
return date_str
if " " in date_str and len(date_str) > 10:
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d",
"def string_to_date(date_string):\n\n return date(int(date_string[:4]),\n ... | [
"0.8477198",
"0.84150696",
"0.83582664",
"0.80926466",
"0.80760074",
"0.8068413",
"0.80664134",
"0.803284",
"0.80066967",
"0.79743564",
"0.7958178",
"0.7949154",
"0.79337865",
"0.7898942",
"0.785914",
"0.78530514",
"0.78296304",
"0.78067225",
"0.77565277",
"0.77520996",
"0.77... | 0.66092384 | 94 |
Adjust an ICMS V1 naive datetime to an aware UTC datetime. | def adjust_icms_v1_datetime(dt_val: dt.datetime) -> dt.datetime:
if timezone.is_aware(dt_val):
raise ValueError(f"Unable to adjust an aware datetime value: {dt_val}")
# ICMS V1 datetime values are created using this:
# https://docs.oracle.com/database/121/SQLRF/functions207.htm#SQLRF06124
# Th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omniscient_datetime(*args):\n d = original_datetime(*args)\n if settings.USE_TZ:\n d = timezone.make_aware(d, timezone.utc)\n return d",
"def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)",
"def set... | [
"0.66613626",
"0.660819",
"0.6551577",
"0.65092283",
"0.64795005",
"0.6391901",
"0.63373566",
"0.6148513",
"0.61240906",
"0.61155766",
"0.6104395",
"0.60721123",
"0.5953961",
"0.5918971",
"0.590164",
"0.5884675",
"0.5872631",
"0.587223",
"0.5855576",
"0.58399624",
"0.5829039"... | 0.7463266 | 0 |
Convert a date to a timezone aware datetime | def date_to_timezone(date: dt.date | None) -> dt.datetime | None:
if not date:
return None
return dt.datetime.combine(date, dt.time.min, tzinfo=dt.timezone.utc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_convert_to_timezone(date, timezone_string):\n # if the given date does not have a timezone, use the system's timezone\n if date.tzinfo is None:\n date = date_make_timezone_aware(date)\n\n timezone_object = pytz_timezone_object(timezone_string)\n converted_date = date.astimezone(timezone... | [
"0.7391486",
"0.7149283",
"0.69549114",
"0.6901931",
"0.68639946",
"0.68222183",
"0.67444336",
"0.67269826",
"0.6629915",
"0.659761",
"0.6526245",
"0.6468863",
"0.6460838",
"0.63649005",
"0.6363153",
"0.63179046",
"0.6284399",
"0.62652165",
"0.62606364",
"0.6225987",
"0.62243... | 0.7342465 | 1 |
Returns a string of the given file size in the most appropriate format. | def pretty_print_file_size(size: float) -> str:
for x in ["bytes", "KB", "MB", "GB", "TB"]:
if size < 1024.0:
return f"{size:3.1f} {x}"
size /= 1024.0
return str(size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_size_str(size):\n if size < 128: return f'{size}B' # only show bytes for really small < 0.1 KB sizes\n if size < (1024*1024): return f'{size/1024:.1f}KB'\n if size < (1024*1024*1024): return f'{size/(1024*1024):.1f}MB'\n return f'{size/(1024*1024):.2}GB'",
"def getFileSizeString(size):\n... | [
"0.83866894",
"0.8280175",
"0.77343327",
"0.76731956",
"0.7641781",
"0.76329756",
"0.7362881",
"0.72343534",
"0.7189519",
"0.7171513",
"0.7165996",
"0.7154652",
"0.7128407",
"0.7127016",
"0.7119947",
"0.7112643",
"0.709136",
"0.7088633",
"0.70675665",
"0.70652544",
"0.7018539... | 0.80788887 | 2 |
Returns the reward buffer. The reward buffer contains the cumulative rewards of the most recent episodes completed by agents using this trainer. | def reward_buffer(self):
return self._reward_buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward_buffer(self) -> Deque[float]:\n return self._reward_buffer",
"def get_reward_list(self):\n return self._gameRewards",
"def get_reward_list(self):\n return self._gameRewards",
"def listRewards(self):\n return self.get_json('/reward')",
"def get_reward(self):\n\t\t# ret... | [
"0.76794326",
"0.6832287",
"0.6832287",
"0.65216917",
"0.63627493",
"0.632469",
"0.6271871",
"0.62538517",
"0.62330455",
"0.61603427",
"0.61603427",
"0.6105127",
"0.60543734",
"0.60350794",
"0.6032215",
"0.6023099",
"0.6000359",
"0.59960735",
"0.59627277",
"0.5948658",
"0.594... | 0.80748844 | 0 |
Adds experiences to each agent's experience history. | def add_experiences(self, curr_all_info: AllBrainInfo, next_all_info: AllBrainInfo, take_action_outputs):
curr_info = curr_all_info[self.brain_name]
next_info = next_all_info[self.brain_name]
for agent_id in curr_info.agents:
self.training_buffer[agent_id].last_brain_info = curr_inf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_experiences(\n self,\n curr_all_info: AllBrainInfo,\n next_all_info: AllBrainInfo,\n take_action_outputs: ActionInfoOutputs,\n ) -> None:\n raise UnityTrainerException(\n \"The process_experiences method was not implemented.\"\n )",
"def add_experie... | [
"0.6781335",
"0.6708857",
"0.6388721",
"0.63648564",
"0.6343078",
"0.6294998",
"0.6218591",
"0.61871463",
"0.61506855",
"0.61465883",
"0.60356694",
"0.6025953",
"0.59708184",
"0.59178925",
"0.5909306",
"0.58893466",
"0.58333874",
"0.57447135",
"0.5726695",
"0.56941456",
"0.56... | 0.56275696 | 23 |
Computes discounted sum of future rewards for use in updating value estimate. | def discount_rewards(r, gamma=0.99, value_next=0.0):
discounted_r = np.zeros_like(r)
running_add = value_next
for t in reversed(range(0, r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _discounted_cumsum(self, rewards, rate=None):\n # HINT1: note that each entry of the output should now be unique,\n # because the summation happens over [t, T] instead of [0, T]\n # HINT2: it is possible to write a vectorized solution, but a solution\n # using a for loop is also fin... | [
"0.7462175",
"0.73983705",
"0.71932304",
"0.7150695",
"0.70557845",
"0.6931184",
"0.68214566",
"0.6785478",
"0.6768839",
"0.6743024",
"0.6694214",
"0.668374",
"0.6677737",
"0.666717",
"0.6662684",
"0.6659934",
"0.66545933",
"0.6653859",
"0.6636681",
"0.6625439",
"0.6592249",
... | 0.6381669 | 25 |
Schedule a spider for running. | def run_spider_on_zyte(spider_name):
print(f'Running spider {spider_name}...')
data = dict(project=project_id, spider=spider_name)
response = requests.post('https://app.scrapinghub.com/api/run.json', data=data, auth=(api_key, ''))
return response.json()['jobid'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_spiders():\n hour_limit = 3600 # in seconds\n\n settings = get_project_settings()\n\n # Uncomment the following block of code if you want to test the manager on\n # the \"onepagetest\" to make sure the manager is working.\n \"\"\"\n settings[\"HTTPCACHE_ENABLED\"] = 1\n settings[\"HTT... | [
"0.62516487",
"0.6250014",
"0.6128202",
"0.6072007",
"0.5960454",
"0.59500855",
"0.59486175",
"0.5944319",
"0.58715975",
"0.5866906",
"0.5856253",
"0.5836075",
"0.5829845",
"0.58126545",
"0.57973534",
"0.57447875",
"0.56963515",
"0.56754017",
"0.5668069",
"0.56605095",
"0.565... | 0.6077622 | 3 |
Gets the group id from tag string. For example, tag string of is 0, is 1. Assumes single digit group id. | def get_tag_group(tag):
group_id = 0 if len(tag) <= 3 else int(tag[-2])
return group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_id(namespace: str, identifier: str) -> int:\n return Murmur3().get_group_id(namespace, identifier)",
"def getIntGroup(self, groupname, default=None):\n try: return int(self.match.group(groupname))\n except: return default",
"def group_id(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.6373822",
"0.63270396",
"0.6202159",
"0.6202159",
"0.6202159",
"0.61833686",
"0.61833686",
"0.6182429",
"0.6179196",
"0.6154245",
"0.61117744",
"0.60874534",
"0.60530096",
"0.60301864",
"0.6002371",
"0.5920009",
"0.5889342",
"0.583211",
"0.5819333",
"0.5774211",
"0.5768097... | 0.8640907 | 0 |
Substitutes synonyms and skips optional parts stochastically. | def skip_and_replace_phrases(text):
# For each text in [], replace it with '' with probability 0.5.
matches = re.findall('(\[[ \w]*\])', text)
for match in matches:
if random.uniform(0, 1) > 0.5:
text = text.replace(match, '')
else:
text = text.replace(match, match[1:-1])
# Remove empty sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __synonym_replacement(self, tokenized_sentence: list) -> str:\n sentence_length = len(tokenized_sentence)\n # Initialize the return string\n new_sentence = \"\"\n # Some variables to keep track of changes and attempted changes\n has_changed = False\n attempts = 0\n ... | [
"0.60334045",
"0.58286697",
"0.5696642",
"0.56221277",
"0.5576227",
"0.55449843",
"0.55057245",
"0.54163086",
"0.53624094",
"0.53417444",
"0.5268799",
"0.52558357",
"0.5197509",
"0.51352805",
"0.51267296",
"0.5099654",
"0.508055",
"0.50655043",
"0.50630283",
"0.50606424",
"0.... | 0.56073666 | 4 |
Localizes time range. Uses pytz.utc if None provided. | def localize_time_range(begin: datetime, end: datetime, tz: Any = None) -> Tuple[datetime, datetime]:
if tz is None:
tz = pytz.utc
return tz.localize(begin), tz.localize(end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_time)",
"def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_time)",
"def localize_utc(value):\n if isinstance(value, datetime):\n return value.replace(tzinfo=tzutc()).astimezone(tzlocal())\n else:\n ... | [
"0.64231133",
"0.64231133",
"0.62801033",
"0.59496087",
"0.59496087",
"0.59496087",
"0.593333",
"0.5916679",
"0.5876896",
"0.5795391",
"0.5795391",
"0.57584757",
"0.56330955",
"0.55727774",
"0.5543789",
"0.5513335",
"0.5403623",
"0.5372817",
"0.53276944",
"0.53239137",
"0.529... | 0.6700571 | 0 |
Returns day number of the last day of the month | def get_last_day_of_month(today: Optional[datetime] = None) -> int:
if today is None:
today = datetime.utcnow()
return monthrange(today.year, today.month)[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_month_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=1) + timedelta(days=-1)).strftime(\r\n '%d-%m-%Y')",
"def last_day_of_month(year, month):\n last_days = [31, 30, 29, 28, 27]\n for i in last_days:\n try:\n end = datetime.datetime(year, month,... | [
"0.8061986",
"0.765962",
"0.749665",
"0.74932134",
"0.74932134",
"0.72882366",
"0.71625197",
"0.7078296",
"0.70766854",
"0.69909984",
"0.68496794",
"0.6839274",
"0.6825078",
"0.6773425",
"0.669678",
"0.6684739",
"0.66285187",
"0.6625195",
"0.6607631",
"0.6607631",
"0.66048366... | 0.7735169 | 1 |
Returns endofmonth (last microsecond) of given datetime (or current datetime UTC if no parameter is passed). | def end_of_month(today: Optional[datetime] = None, n: int = 0, tz: Any = None) -> datetime:
if today is None:
today = datetime.utcnow()
last_day = monthrange(today.year, today.month)[1]
end = today.replace(day=last_day, hour=0, minute=0, second=0, microsecond=0) + timedelta(hours=24)
while n > 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_end_month(month):\n return datetime(2020, month, 28)",
"def floor_end_month(date):\n return datetime(date.year, date.month, 1) + timedelta(days=-1)",
"def make_last_month_period(dt=None):\n if not dt:\n dt = datetime.utcnow()\n dt = dt.replace(day=1) - timedelta(days=1)\n return d... | [
"0.6662939",
"0.6374338",
"0.63418275",
"0.63308567",
"0.6298345",
"0.60815924",
"0.59849864",
"0.5971846",
"0.5971846",
"0.5962434",
"0.59056014",
"0.5762969",
"0.57542294",
"0.5699086",
"0.55827105",
"0.5309063",
"0.52974486",
"0.5269707",
"0.52374125",
"0.51313806",
"0.512... | 0.63816714 | 1 |
Returns current month begin (inclusive) and end (exclusive). | def this_month(today: Optional[datetime] = None, tz: Any = None) -> Tuple[datetime, datetime]:
if today is None:
today = datetime.utcnow()
begin = datetime(day=1, month=today.month, year=today.year)
end = begin + timedelta(days=32)
end = datetime(day=1, month=end.month, year=end.year)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_month(year, month):\n start = datetime.datetime(year, month, 1)\n if month == 12:\n end = datetime.datetime(year+1, 1, 1)\n else:\n end = datetime.datetime(year, month+1, 1)\n print(start)\n print(end)\n return start, end",
"def get_cur... | [
"0.7435324",
"0.7102786",
"0.65651596",
"0.6564616",
"0.6540308",
"0.648224",
"0.6398185",
"0.6296972",
"0.6256908",
"0.6189677",
"0.61825716",
"0.61825716",
"0.61730886",
"0.61665356",
"0.6153892",
"0.6117878",
"0.6089671",
"0.608964",
"0.6085676",
"0.608143",
"0.6015994",
... | 0.6545516 | 4 |
Returns next month begin (inclusive) and end (exclusive). | def next_month(today: Optional[datetime] = None, tz: Any = None) -> Tuple[datetime, datetime]:
if today is None:
today = datetime.utcnow()
begin = datetime(day=1, month=today.month, year=today.year)
next_mo = begin + timedelta(days=32)
begin = datetime(day=1, month=next_mo.month, year=next_mo.ye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_month(self, startdate, fmt=None):\n days_in_start_month = calendar.monthrange(startdate.year, startdate.month)[1]\n first_day_next_month = startdate + datetime.timedelta(days=(days_in_start_month - startdate.day + 1))\n days_in_next_month = calendar.monthrange(first_day_next_month... | [
"0.7529329",
"0.74048036",
"0.73977035",
"0.7330703",
"0.7297776",
"0.71172684",
"0.6977355",
"0.68949395",
"0.6891694",
"0.6785408",
"0.6643347",
"0.6559359",
"0.6544955",
"0.65406394",
"0.6354867",
"0.63523775",
"0.63155586",
"0.62580174",
"0.6225133",
"0.619294",
"0.618588... | 0.7152153 | 5 |
Returns last month begin (inclusive) and end (exclusive). | def last_month(today: Optional[datetime] = None, tz: Any = None) -> Tuple[datetime, datetime]:
if today is None:
today = datetime.utcnow()
end = datetime(day=1, month=today.month, year=today.year)
end_incl = end - timedelta(seconds=1)
begin = datetime(day=1, month=end_incl.month, year=end_incl.y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_month():\n return datetime.now() + relativedelta(months=-1)",
"def get_end_month(month):\n return datetime(2020, month, 28)",
"def end_month(d):\n return date(d.year, d.month, monthrange(d.year, d.month)[1])",
"def calendar_month(year, month):\n start = datetime.datetime(year, month,... | [
"0.76772696",
"0.75726247",
"0.7498446",
"0.71543896",
"0.7114918",
"0.70409894",
"0.68245804",
"0.6802495",
"0.6769956",
"0.67558724",
"0.6664495",
"0.6663772",
"0.65920866",
"0.6558664",
"0.65145755",
"0.65101635",
"0.64774644",
"0.64166045",
"0.6344741",
"0.6344741",
"0.63... | 0.7177171 | 3 |
Adds + n months to datetime. Clamps days to number of days in given month. | def add_month(t: datetime, n: int = 1) -> datetime:
t2 = t
for count in range(abs(n)): # pylint: disable=unused-variable
if n > 0:
t2 = datetime(year=t2.year, month=t2.month, day=1) + timedelta(days=32)
else:
t2 = datetime(year=t2.year, month=t2.month, day=1) - timedelta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_add_months(date, num_months):\n\tyear, month, day = date.timetuple()[:3]\n\n\tmonth += num_months\n\t\n\tif num_months > 0:\n\t\twhile month > 12:\n\t\t\tmonth -= 12\n\t\t\tyear += 1\n\telif num_months < 0:\n\t\twhile month < 1:\n\t\t\tmonth += 12\n\t\t\tyear -= 1\n\n\tmonth_max_days = calendar.monthrange... | [
"0.70895267",
"0.6576987",
"0.6546194",
"0.6387567",
"0.6367219",
"0.6279551",
"0.6242054",
"0.6133495",
"0.61128676",
"0.603671",
"0.60151464",
"0.59764016",
"0.59675056",
"0.593315",
"0.58846956",
"0.58331037",
"0.5831814",
"0.57893217",
"0.5752229",
"0.56820554",
"0.559690... | 0.78311133 | 0 |
Iterates over time range in one month steps. Clamps to number of days in given month. | def per_month(start: datetime, end: datetime, n: int = 1):
curr = start.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
while curr < end:
curr_end = add_month(curr, n)
yield curr, curr_end
curr = curr_end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_months(start_ym=None, end_ym=None):\n if not start_ym:\n start_ym = settings.TIMESTAMP_PARTITIONING_START_YM\n\n months = xrange(\n resolve_month(start_ym) - 1,\n resolve_month(end_ym),\n )\n\n for ym in months:\n yield (\n ym / 12,\n (ym % 12)... | [
"0.6925419",
"0.69041425",
"0.6595275",
"0.63988465",
"0.6350863",
"0.6328509",
"0.62974316",
"0.6217649",
"0.61874706",
"0.6156391",
"0.61332166",
"0.6119941",
"0.6022349",
"0.5983429",
"0.5908165",
"0.5903265",
"0.58456177",
"0.5845543",
"0.5819545",
"0.5813137",
"0.5810131... | 0.7319945 | 0 |
generated source for method equals | def equals(cls, mobEffect, type_):
typeV = PotionEffectType.getById(MobEffectList.getId(mobEffect))
return typeV == type_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pass",
"def __eq__(self, *args):\r\n pas... | [
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.81492925",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864",
"0.80947864"... | 0.0 | -1 |
Check that any two models are the same, within some tolerance on parameters (using the same defaults as numpy.assert_allclose()). This is constructed like a test, rather than returning True/False, in order to provide more useful information as to how the models differ when a test fails (and with more concise syntax). I... | def compare_models(model1, model2, rtol=1e-7, atol=0., check_inverse=True):
from astropy.modeling import Model
from numpy.testing import assert_allclose
if not (isinstance(model1, Model) and isinstance(model2, Model)):
raise TypeError('Inputs must be Model instances')
if model1 is model2:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_model(expected_model, actual_model):\n assert (expected_model == actual_model), \\\n \"Not Compare model: Expected model:\\n {0}\\nActual model:\\n {1}\".format(expected_model, actual_model)",
"def assert_wrappers_equal(first, second):\n assert first.sk_params == second.sk_params\n asse... | [
"0.63689244",
"0.63092273",
"0.6269261",
"0.61893076",
"0.6188457",
"0.61813647",
"0.5926327",
"0.58567405",
"0.5831332",
"0.5644095",
"0.55974054",
"0.55643445",
"0.5549982",
"0.5546784",
"0.55456275",
"0.5524733",
"0.54774165",
"0.5447716",
"0.54474646",
"0.54100126",
"0.53... | 0.7824851 | 0 |
Check the number of extensions is equal | def numext(self):
numext1, numext2 = len(self.ad1), len(self.ad2)
if numext1 != numext2:
return [f'{numext1} v {numext2}'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_19_file_extensions_within_type(self):\n print (self.test_19_file_extensions_within_type.__doc__)\n\n stats_maker = StatsMakerFiles()\n r = stats_maker.view_file_extensions_within_type(file_type=FILE_TYPE_OCTET_STREAM)\n\n num_unique_extensions = r.result_data.get('number_unique... | [
"0.69758666",
"0.6770841",
"0.65320885",
"0.6478731",
"0.64035475",
"0.6346884",
"0.63190526",
"0.62474406",
"0.6222597",
"0.6189669",
"0.6121807",
"0.610644",
"0.6102101",
"0.60269034",
"0.60267955",
"0.600096",
"0.5966684",
"0.5957307",
"0.5953261",
"0.5898092",
"0.5883638"... | 0.0 | -1 |
Check both ADs have REFCATs (or not) and that the lengths agree | def refcat(self):
refcat1 = getattr(self.ad1, 'REFCAT', None)
refcat2 = getattr(self.ad2, 'REFCAT', None)
if (refcat1 is None) ^ (refcat2 is None):
return [f'presence: {refcat1 is not None} v {refcat2 is not None}']
elif refcat1 is not None: # and refcat2 must also exist
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ad_validation(ad_1, ad_2) -> bool:\n\n return ad_1.country_code == ad_2.country_code and ad_1.location != ad_2.location",
"def is_longer(dna1, dna2):\n return len(dna1)> len(dna2)",
"def test_check_cds_2(self):\n self.eval_flags[\"check_locus_tag\"] = False\n import_genome.check_cds... | [
"0.6146601",
"0.58536965",
"0.5844514",
"0.567206",
"0.55963874",
"0.5572446",
"0.5557235",
"0.55461645",
"0.55093193",
"0.5496513",
"0.5468655",
"0.5456424",
"0.5428245",
"0.54078436",
"0.5405297",
"0.53693944",
"0.53665125",
"0.53330016",
"0.5312884",
"0.52806175",
"0.52782... | 0.7313001 | 0 |
Compare the important stuff of two CoordinateFrame instances | def compare_frames(frame1, frame2):
for attr in ("naxes", "axes_type", "axes_order", "unit", "axes_names"):
assert getattr(frame1, attr) == getattr(frame2, attr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_equal(self, a, b):\n return a.X[0] == b.X[0]",
"def similar(self, other):\r\n if self.rows == other.rows and self.columns == other.columns:\r\n return True\r\n else:\r\n return False",
"def __eq__(self, other):\n\t\treturn self._coords == other._coords",
"def... | [
"0.65195554",
"0.65125394",
"0.64381635",
"0.63909864",
"0.63909864",
"0.63800895",
"0.63582647",
"0.6337919",
"0.6313654",
"0.63097775",
"0.6297227",
"0.62909174",
"0.6273678",
"0.62713313",
"0.6256502",
"0.62220603",
"0.6217315",
"0.6205207",
"0.61789995",
"0.6168253",
"0.6... | 0.74175 | 0 |
Format the errordict into a str for reporting | def format_errordict(self, errordict):
errormsg = f'Comparison between {self.ad1.filename} and {self.ad2.filename}'
for k, v in errordict.items():
errormsg += f'\nComparison failure in {k}'
errormsg += '\n' + ('-' * (22 + len(k))) + '\n'
errormsg += '\n '.join(v)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def err_str(err):\n return \"\".join(format_exception_only(type(err), err))",
"def _exc_info_to_string(self, err, test):\n\t\texctype, value, tb = err\n\t\t# Skip test runner traceback levels\n\t\twhile tb and self._is_relevant_tb_level(tb):\n\t\t\ttb = tb.tb_next\n\n\t\tif exctype is test.failureException:\n... | [
"0.76151246",
"0.7046702",
"0.6990551",
"0.69691956",
"0.6833569",
"0.6790905",
"0.67520744",
"0.671792",
"0.66131985",
"0.6607746",
"0.66072387",
"0.6598907",
"0.65784776",
"0.65077096",
"0.65047884",
"0.64777404",
"0.64646214",
"0.64639825",
"0.6455091",
"0.643918",
"0.6431... | 0.7790065 | 0 |
Closes the file from which this object is derived. | def close(self):
self._file.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.__file.close()",
"def close_file(self):\r\n self.file.close()",
"def close(self):\n self.__file_object.close()",
"def close_file(self):\n self.file.close()",
"def close_file(self):\n self.file.close()",
"def close(self, **kw) -> None:\n su... | [
"0.8169762",
"0.81381303",
"0.8108455",
"0.80741054",
"0.80741054",
"0.79432005",
"0.79349285",
"0.79349285",
"0.7857377",
"0.7817707",
"0.7812313",
"0.7810391",
"0.7810391",
"0.780888",
"0.780888",
"0.78017175",
"0.7781091",
"0.7753327",
"0.77330726",
"0.7722938",
"0.7718582... | 0.79055184 | 9 |
Changes the password of the current user to a new one. | def change_password(token, old_password, new_password):
session = get_session_by_token(token)
if not session['success']:
return session
response = get_user_data_by_email(token, session['data']['user'], include_hash=True)
if 'data' not in response:
return response
userdata = respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_password(self, user, password):\n user.password = hashers.make_password(password)",
"def change_password(self):\n self.test_user.set_password(self.create_user_data()['password1'])\n self.test_user.save()",
"def change_password(self, new_pass):\n self.manager.change_user_p... | [
"0.837107",
"0.8335148",
"0.8323289",
"0.82965386",
"0.8165989",
"0.8143805",
"0.81350857",
"0.7974857",
"0.79412884",
"0.79344594",
"0.7934352",
"0.7914097",
"0.7890049",
"0.7842429",
"0.7825144",
"0.78223044",
"0.77807075",
"0.7717251",
"0.76989275",
"0.7696063",
"0.7635987... | 0.0 | -1 |
Truthy if not the zero vector. | def __bool__(self):
return any(c != 0 for c in self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero_vector(vector:tuple)->bool:\n return vector[0] == 0 and vector[1] == 0",
"def isVecZero(vec):\n trues = [isZero(e) for e in vec]\n return all(trues)",
"def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False",
"def test_no... | [
"0.7632398",
"0.7524885",
"0.7201833",
"0.7165247",
"0.7076034",
"0.7055286",
"0.7033663",
"0.695245",
"0.69038767",
"0.68736935",
"0.68564457",
"0.6845433",
"0.68249846",
"0.6805154",
"0.6782051",
"0.67678994",
"0.67580914",
"0.67562973",
"0.6732995",
"0.67170256",
"0.670491... | 0.6445583 | 36 |
Get the vector's magnitude. | def norm(self):
return math.sqrt(self.norm2()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude(self): # @todo @caution check: something wrong?\n\n return (math.sqrt(reduce(lambda x, y: x+y,\n [x**2 for x in self.vector])))",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v))",
"def ma... | [
"0.8641972",
"0.8271863",
"0.7947286",
"0.7846755",
"0.78456944",
"0.7842078",
"0.78415513",
"0.78415513",
"0.77945095",
"0.7735293",
"0.76466644",
"0.7613115",
"0.7595197",
"0.7405495",
"0.738108",
"0.7360774",
"0.7310202",
"0.72610843",
"0.72456694",
"0.72437173",
"0.721633... | 0.5891225 | 70 |
Get a normalized version of the vector with unit magnitude. | def normalize(self):
norm = self.norm()
if norm == 0:
raise ValueError("Can't normalize zero vector")
return self / norm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized(self):\n try:\n m = abs(self)\n return self / m\n except ZeroDivisionError as e:\n raise Exception(\"Attempted to normalize a zero vector, return a unit vector at zero degrees\") from e\n # return Vector(1, 0)",
"def normalize(self):\n\n ... | [
"0.813952",
"0.8055391",
"0.8037188",
"0.7966013",
"0.79522556",
"0.79190695",
"0.7888774",
"0.7886404",
"0.7886404",
"0.7886404",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
"0.7880622",
... | 0.75734437 | 36 |
Calculate the dot product of this vector with another. | def dot(self, other):
return self.x * other.x + self.y * other.y + self.z * other.z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
"def dot(a, b):\n return np.vdot(a.arr,b.arr)",
"def dotProduct(v1, v2):\n n1 = norm... | [
"0.8563248",
"0.8389777",
"0.83234906",
"0.8268986",
"0.8190749",
"0.8067794",
"0.8057262",
"0.80563754",
"0.8034659",
"0.80326515",
"0.8019145",
"0.80191404",
"0.8016654",
"0.80086285",
"0.80086285",
"0.80056286",
"0.79975283",
"0.79749787",
"0.7972522",
"0.79643035",
"0.795... | 0.7980999 | 17 |
Calculate the cross product of this vector with another. | def cross(self, other):
return Vector3(
self.y * other.z - self.z * other.y,
self.z * other.x - self.x * other.z,
self.x * other.y - self.y * other.x,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(a, b):\n #return np.cross(a,b)\n\n return vector(a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0])",
"def cross(v1, v2):\n return np.cross(v1, v2)",
"def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n ... | [
"0.82756424",
"0.81018275",
"0.8056286",
"0.80000496",
"0.7952007",
"0.78036964",
"0.77978474",
"0.7727899",
"0.7609021",
"0.7605595",
"0.759602",
"0.75841004",
"0.75663066",
"0.7542149",
"0.75367236",
"0.7531522",
"0.7515781",
"0.75117683",
"0.7486229",
"0.74310374",
"0.7393... | 0.71361285 | 34 |
Does the actual roll | def execute(self):
self.raw_roll = randint(1, 100)
val = self.get_roll_value_for_traits()
val += self.get_roll_value_for_knack()
val -= self.get_roll_value_for_rating()
val += self.raw_roll
self.result_value = val
# we use our raw roll and modified toll to determi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll():\n pass",
"def roll(self):\n return self._roll",
"def roll(self):\n return self._roll",
"def roll(self):\n self.rolled = random.randint(1, 6)\n return self.rolled",
"def record_roll(self, roll):\n if roll == 1:\n self.turn_over = True\n ... | [
"0.8277908",
"0.7421485",
"0.7421485",
"0.73920804",
"0.7366502",
"0.7236303",
"0.7136064",
"0.7057909",
"0.70100033",
"0.69665796",
"0.6942163",
"0.69401604",
"0.690852",
"0.6890049",
"0.6778191",
"0.6766259",
"0.6759411",
"0.6747916",
"0.6713867",
"0.6697484",
"0.66629493",... | 0.6733233 | 18 |
Show that an error is thrown when the url does not match. | def test_handle_no_url_match(self):
with self.assertRaises(Resolver404):
with mock.patch(self.view) as view:
self.handler.handle(self.request, '/no/match/')
self.assertFalse(view.called) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def test_errors(self):\n rc = self.app.get('/this_should_not_exist', follow_redirects=True)\n assert b'404 error :(' in rc.data",
"def error_bad_url(self):\n self._error(400, \"Bad Request\")",
"def error_not_foun... | [
"0.7313851",
"0.7123442",
"0.7092571",
"0.70738393",
"0.6973",
"0.6973",
"0.6973",
"0.6973",
"0.6973",
"0.6973",
"0.6973",
"0.69689023",
"0.69584477",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6914954",
"0.6857714",
"0.6... | 0.0 | -1 |
Calculates content hashes of a ZIP file. | def get_zip_hashes(zip_obj):
hashes = []
for info in zip_obj.infolist():
content = zip_obj.read(info.filename)
content_hash = hashlib.sha1(content).hexdigest()
hashes.append('%s %s' % (info.filename, content_hash))
return "\n".join(hashes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_file_in_zip(zip_handler, file_path_in_zip, algorithm=\"sha1\"):\n block_size = 64 * 1024\n hasher = getattr(hashlib, algorithm)()\n with zip_handler.open(file_path_in_zip, \"r\") as file_handler:\n while True:\n data = file_handler.read(block_size)\n if not data:\n ... | [
"0.7017196",
"0.6835334",
"0.6670016",
"0.650914",
"0.6492896",
"0.6438525",
"0.6418386",
"0.64088875",
"0.63279164",
"0.6277263",
"0.6253647",
"0.6228739",
"0.6227629",
"0.62113535",
"0.62072885",
"0.61782587",
"0.612604",
"0.60918695",
"0.60671943",
"0.60651815",
"0.6041579... | 0.7206272 | 0 |
Creates a function that is used to evaluate a Kafka partition offset to determine if the offset is at, above or below the desired location (based on the target_date). | def get_offset_check_function(consumer, tp, target_date, margin):
def check_offset(offset, consumer=consumer, tp=tp, target_date=target_date, margin=margin):
consumer.seek(tp, offset)
message = next(consumer)
change = change_from_kafka_message(message)
diff = (change.metadata.publis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_date_offset(user_date, offset):\n return",
"def contains_offset(self, offset):\n return (offset >= self.offset) and (offset < self.offset + self.filesize)",
"def is_within(point, surface, offset):\r\n return (point[0] >= offset[0] and point[0] < offset[0] + surface.get_width() \\\... | [
"0.57737184",
"0.5564777",
"0.5436592",
"0.52854806",
"0.5274272",
"0.5224924",
"0.5129814",
"0.5052004",
"0.50355065",
"0.50219536",
"0.49874434",
"0.49764383",
"0.4976427",
"0.4973301",
"0.49641156",
"0.49542627",
"0.4933793",
"0.4910174",
"0.4878772",
"0.48149323",
"0.4806... | 0.79233074 | 0 |
Return the first production lot id found for the given product. | def _get_produce_line_prodlot_id(self, cr, uid, product_id, context=None):
# Note: First my intention was to use the move_brw.prodlot_id to get
# the prodlot_id but this field is not set, I imagine that is set
# before the move is consumed.
context = context or {}
prodlot_obj = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"product_id\")",
"def _get_product_id(device_dict):\n return device_dict['product_id'].split('x')[-1]",
"def _get_product(self):\n try:\n return self.activities[industry.MANUFACTURING].products[0].typeID\n... | [
"0.67179745",
"0.66997916",
"0.66016084",
"0.65951157",
"0.65427047",
"0.6540412",
"0.64352834",
"0.64295214",
"0.6345327",
"0.61985445",
"0.6163914",
"0.6163914",
"0.6163914",
"0.6163914",
"0.6119616",
"0.61128914",
"0.60990113",
"0.60706604",
"0.60053134",
"0.59962183",
"0.... | 0.7434941 | 0 |
Create a view that returns a single post object based on the post ID (pk) and render it to the 'productdetails.html' template. Or return a 404 error if the product is not found | def product_details(request, pk):
products = get_object_or_404(Product, pk=pk)
product_creator = products.prod_creator_id
return render(request, 'productdetails.html',
{'products': products, 'pk': pk,
'product_creator': product_creator}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_detail_view(request, pk=None, *args, **kwargs):\n # instance = Product.objects.get(pk=pk)\n # Using in-built get_object_or_404 error\n # instance = get_object_or_404(Product, pk=pk)\n\n # # Our own version of 404\n # try:\n # instance = Product.objects.get(pk=pk)\n # except Pro... | [
"0.7974818",
"0.7345668",
"0.73193264",
"0.71377814",
"0.7114973",
"0.70001626",
"0.6926922",
"0.68892765",
"0.6835013",
"0.67916894",
"0.67440355",
"0.67417216",
"0.667863",
"0.6660725",
"0.65763843",
"0.65734696",
"0.6503744",
"0.6468969",
"0.64465237",
"0.6444313",
"0.6405... | 0.68804604 | 8 |
Ensures the resulting URL string does not contain extra / characters | def transform_url(result):
import re
result = re.sub('//', '/', result)
result = re.sub('/', '//', result, count=1)
return encode_url_path(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _proper_url(self, url):\n if self.base_url not in url:\n url = self.base_url + url\n url = re.sub(r'(?<!https:)//', '/', url)\n if not url.endswith('/') and '?' not in url:\n url = url + '/'\n if url.endswith('?'):\n url = url[:-1]\n return ur... | [
"0.74731445",
"0.74381614",
"0.7179211",
"0.7026125",
"0.69187653",
"0.69086885",
"0.68894166",
"0.68866336",
"0.68586695",
"0.68376344",
"0.6796416",
"0.6771455",
"0.67684734",
"0.6713917",
"0.6700313",
"0.66913533",
"0.66341144",
"0.6616475",
"0.6605955",
"0.6563187",
"0.65... | 0.0 | -1 |
Ensures the resulting URL string does not contain extra / characters | def transform_url_without_encode(result):
import re
result = re.sub('//', '/', result)
result = re.sub('/', '//', result, count=1)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _proper_url(self, url):\n if self.base_url not in url:\n url = self.base_url + url\n url = re.sub(r'(?<!https:)//', '/', url)\n if not url.endswith('/') and '?' not in url:\n url = url + '/'\n if url.endswith('?'):\n url = url[:-1]\n return ur... | [
"0.74731445",
"0.74381614",
"0.7179211",
"0.7026125",
"0.69187653",
"0.69086885",
"0.68894166",
"0.68866336",
"0.68586695",
"0.68376344",
"0.6796416",
"0.6771455",
"0.67684734",
"0.6713917",
"0.6700313",
"0.66913533",
"0.66341144",
"0.6616475",
"0.6605955",
"0.6563187",
"0.65... | 0.6417428 | 30 |
The identity block is the block that has no conv layer at shortcut. Arguments | def identity_block(self, input_tensor, kernel_size, filters, stage, block):
filters1, filters2, filters3 = filters # this indicates the number of filter (here, assume that all filter number are same)
bn_axis = self.channel_last # number of classes being classified
# names for the layers
conv_name_ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.71272004",
"0.7022438",
"0.6910338",
"0.68836653",
"0.68505627",
"0.6847176",
"0.68221945",
"0.6821999",
"0.680346",
"0.6799615",
"0.67849326",
"0.67714536",
"0.67158884",
"0.67146987",
"0.67137283",
"0.6664201",
"0.6624224",
"0.662218",
"0.662218",
"0.66078824",
"0.659845... | 0.653479 | 23 |
A block that has a conv layer at shortcut. Arguments | def conv_block(self,
input_tensor,
kernel_size,
filters,
stage,
block,
strides=(2, 2)):
# number of filters
filters1, filters2, filters3 = filters
# number of classification categories
bn_axis = self.channel_last
# names for the layers
conv_name_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def _convolution_block(self, X, filters, f, s, stage, block):\n\n\t\tconv_layer_name = 'res' + str(stage) + block + '_branch'\n\t\tbn_layer_name = 'bn' + str(stage) + block + ... | [
"0.72210574",
"0.6797653",
"0.67508686",
"0.673468",
"0.6702727",
"0.66709983",
"0.66706705",
"0.6638113",
"0.6602907",
"0.6602907",
"0.65983295",
"0.65591985",
"0.6556552",
"0.6553555",
"0.6531844",
"0.65101147",
"0.6479069",
"0.6421294",
"0.64118993",
"0.6391051",
"0.638352... | 0.650745 | 16 |
Perform an HTTP PATCH request. | def patch(self, url, body=None, headers=None):
return self._request('PATCH', url, body, headers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def httpPatch(self, url='', data='', params={}, headers={}):\n\n return self.httpRequest('PATCH', url, data, params, headers)",
"def patch(self, *args, **kwargs):\n self.request(\"patch\", *args, **kwargs)",
"def patch(url, data=None, **kwargs):\n\n return request('patch', url, data=data, **kw... | [
"0.8329257",
"0.7756308",
"0.76320416",
"0.7625852",
"0.76054317",
"0.75642097",
"0.74693507",
"0.744146",
"0.74068755",
"0.73661274",
"0.73661274",
"0.73661274",
"0.73264575",
"0.7326405",
"0.7311184",
"0.72812384",
"0.728001",
"0.7225638",
"0.7219676",
"0.7202235",
"0.71999... | 0.77140266 | 2 |
The derivative of W_T with respect to P_T. | def f_W_T_to_P_T_pc(v, P_0, r_f, d, s, T, wealth, phi, n_s, n_o, K):
P_T = f_P_T(v, P_0, r_f, d, s, T)
if P_T > K:
value = n_s * math.exp(d * T) + n_o
else:
value = n_s * math.exp(d * T)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient(w, x, t):\n return 2 * np.dot(x.T, (nn(x, w) - t))",
"def _dddx(t, x, ivp):\n evl = ivp.rhs(t, x)\n try:\n jac = ivp.jacobian(t, x)\n except NotImplementedError:\n jac = np.zeros((len(x), len(x)))\n try:\n hess = ivp.hessian(t, x)\n except NotImplementedError:\... | [
"0.65375483",
"0.65025",
"0.6480832",
"0.640303",
"0.6390341",
"0.6292212",
"0.6262896",
"0.61908424",
"0.61646825",
"0.61302775",
"0.6112749",
"0.6078279",
"0.60668373",
"0.5939563",
"0.59066236",
"0.5896433",
"0.5894032",
"0.5886297",
"0.5885044",
"0.5884938",
"0.58641535",... | 0.0 | -1 |
The derivative of W_T_gc with respect to P_T. | def f_W_T_to_P_T_gc(u, P_0, r_f, d, s, T, wealth, alpha_0, alpha_1):
(beta_0, beta_1, beta_2) = f_beta(P_0, r_f, d, s, T)
P_T = f_P_T(u, P_0, r_f, d, s, T)
ln_P_T = f_ln_P_T(u, P_0, r_f, d, s, T)
if ln_P_T > - beta_1 / (2 * beta_2):
W_T = f_W_T_gc(u, P_0, r_f, d, s, T, wealth, alpha_0,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gravity_gradients(self, p):\n Le = self._Le(p)\n wf = self._wf(p)\n EeLe = np.einsum(\"i...,i\", self.Ee, Le)\n FfWf = np.einsum(\"i...,i\", self.Ff, wf)\n return G * self.d * (EeLe - FfWf)",
"def _dy(self, T):\n return self._h(np.diff(T)) * self._a / self._m / self.... | [
"0.6794619",
"0.637221",
"0.63193417",
"0.623542",
"0.62265015",
"0.6222893",
"0.61940587",
"0.6163799",
"0.61549056",
"0.6126956",
"0.6107949",
"0.60712385",
"0.60261005",
"0.6016174",
"0.59792864",
"0.59751594",
"0.5955798",
"0.595314",
"0.5942191",
"0.5934634",
"0.5906119"... | 0.57160836 | 39 |
Tests that a pack can successfully be serialized. | def test_generic_serializer_serialize_pack_success(self):
# generate a pack
expansion = get_expansion('dgm')
pack = expansion.generate_pack()
cards_to_serialize = pack.cards + pack.cards
serializer = GenericSerializer()
serialized_cards = serializer.serialize(cards_to_se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_messagepack_serialization(self, molecule):\n serialized = molecule.to_messagepack()\n molecule_copy = Molecule.from_messagepack(serialized)\n assert molecule == molecule_copy",
"def test_messagepack_serialization(self, molecule):\n serialized = molecule.to_messagepack()\n ... | [
"0.6534766",
"0.65118027",
"0.6332285",
"0.6269341",
"0.6258264",
"0.62242544",
"0.6068551",
"0.6053453",
"0.59832007",
"0.5841819",
"0.58165383",
"0.57593757",
"0.573778",
"0.57360065",
"0.5727602",
"0.5707216",
"0.5692922",
"0.5686336",
"0.5670091",
"0.56348705",
"0.5599274... | 0.7405161 | 0 |
Return a datetime64[ns] dtype appropriate for the given timezone. | def tz_to_dtype(
tz: tzinfo | None, unit: str = "ns"
) -> np.dtype[np.datetime64] | DatetimeTZDtype:
if tz is None:
return np.dtype(f"M8[{unit}]")
else:
return DatetimeTZDtype(tz=tz, unit=unit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column_type(cls, **kwargs: Any) -> Any:\n return sqlalchemy.DateTime(timezone=kwargs.get(\"timezone\", False))",
"def dtype(self) -> np.dtype[np.datetime64] | DatetimeTZDtype: # type: ignore[override] # noqa: E501\n return self._dtype",
"def dt_tz_convert(self, tz):\n return Date... | [
"0.6301232",
"0.6083288",
"0.59989625",
"0.5832516",
"0.578011",
"0.5740185",
"0.5587477",
"0.5578127",
"0.55500245",
"0.54395026",
"0.54076415",
"0.53926456",
"0.53353477",
"0.5329517",
"0.53061455",
"0.5289082",
"0.52338064",
"0.5184325",
"0.5177501",
"0.5097094",
"0.508908... | 0.7662654 | 0 |
Return the timezone. Returns datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None Returns None when the array is tznaive. Examples | def tz(self) -> tzinfo | None:
# GH 18595
return getattr(self.dtype, "tz", None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"timezone\")",
"def timezonize(tz):\n \n # Checking if somthing is a valid pytz object is hard as it seems that they are spread around the pytz package.\n #\n # Option 1): Try to convert if string or unicode, otherwi... | [
"0.6375735",
"0.6341218",
"0.6338876",
"0.6277758",
"0.6243123",
"0.6221838",
"0.61643785",
"0.616111",
"0.6121772",
"0.6106131",
"0.6064919",
"0.6050747",
"0.60307485",
"0.60062337",
"0.59792596",
"0.59484994",
"0.59221077",
"0.5917777",
"0.5902208",
"0.58885646",
"0.5885577... | 0.668904 | 0 |
Alias for tz attribute | def tzinfo(self) -> tzinfo | None:
return self.tz | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timezone():\n \n pass",
"def dt_tz(self):\n return DateTimeDefault.register(pandas.Series.dt.tz)(self)",
"def tz(self, tz: float) -> 'Component':\n return self.translate(tz=tz)",
"def tz(self) -> tzinfo | None:\n # GH 18595\n return getattr(self.dtype, \"tz\", None)",
"... | [
"0.749239",
"0.7462807",
"0.72663677",
"0.70225495",
"0.6990886",
"0.6790277",
"0.6712177",
"0.6654952",
"0.66297376",
"0.6615592",
"0.654573",
"0.65134346",
"0.6511299",
"0.64753777",
"0.6260131",
"0.6234343",
"0.6176759",
"0.6176759",
"0.6176759",
"0.6145225",
"0.6143204",
... | 0.6560644 | 10 |
Returns True if all of the dates are at midnight ("no time") | def is_normalized(self) -> bool:
return is_date_array_normalized(self.asi8, self.tz, reso=self._creso) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_midnight(dt):\n\n return dt.hour == 0 and dt.minute == 0 and dt.second == 0",
"def is_all_dates(self) -> bool:\n return False",
"def filter_dates(date):\n if not (date.weekday() in [5, 6] or (date.hour > 22 and date.minute > 30)):\n return True\n else:\n return False",
"d... | [
"0.7688362",
"0.70254517",
"0.68399775",
"0.67922556",
"0.6791004",
"0.67015994",
"0.6692767",
"0.64654934",
"0.6396687",
"0.63352245",
"0.63242596",
"0.6258639",
"0.619943",
"0.6184474",
"0.6151096",
"0.6132137",
"0.6114746",
"0.6104789",
"0.6062508",
"0.6060295",
"0.6047526... | 0.0 | -1 |
Convert to an i8 (unixlike nanosecond timestamp) representation while keeping the local timezone and not using UTC. This is used to calculate timeofday information as if the timestamps were timezonenaive. | def _local_timestamps(self) -> npt.NDArray[np.int64]:
if self.tz is None or timezones.is_utc(self.tz):
# Avoid the copy that would be made in tzconversion
return self.asi8
return tz_convert_from_utc(self.asi8, self.tz, reso=self._creso) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_pydatetime(self) -> npt.NDArray[np.object_]:\n return ints_to_pydatetime(self.asi8, tz=self.tz, reso=self._creso)",
"def normalize(self) -> Self:\n new_values = normalize_i8_timestamps(self.asi8, self.tz, reso=self._creso)\n dt64_values = new_values.view(self._ndarray.dtype)\n\n ... | [
"0.58840024",
"0.5763834",
"0.56061006",
"0.5294559",
"0.52764213",
"0.5248776",
"0.51396626",
"0.5122489",
"0.50670046",
"0.5018777",
"0.5012174",
"0.5000596",
"0.49955812",
"0.4970701",
"0.49602035",
"0.48889202",
"0.48594642",
"0.4856",
"0.48190355",
"0.48072642",
"0.48058... | 0.6827103 | 0 |
Localize tznaive Datetime Array/Index to tzaware Datetime Array/Index. This method takes a time zone (tz) naive Datetime Array/Index object and makes this time zone aware. It does not move the time to another time zone. This method can also be used to do the inverse to create a time zone unaware object from an aware ob... | def tz_localize(
self,
tz,
ambiguous: TimeAmbiguous = "raise",
nonexistent: TimeNonexistent = "raise",
) -> Self:
nonexistent_options = ("raise", "NaT", "shift_forward", "shift_backward")
if nonexistent not in nonexistent_options and not isinstance(
nonexi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tz_localize(\n self, tz, axis=0, level=None, copy=True, ambiguous=\"raise\", nonexistent=\"raise\"\n ):\n new_labels = (\n pandas.Series(index=self.get_axis(axis))\n .tz_localize(\n tz,\n axis=axis,\n level=level,\n ... | [
"0.6879427",
"0.65996295",
"0.6474189",
"0.62335974",
"0.6133624",
"0.6126858",
"0.59418315",
"0.5876781",
"0.57568926",
"0.5715336",
"0.5547248",
"0.5484418",
"0.5482106",
"0.53685176",
"0.53430974",
"0.52387893",
"0.5138029",
"0.5127277",
"0.5093108",
"0.50786674",
"0.50781... | 0.57498586 | 9 |
Return an ndarray of ``datetime.datetime`` objects. Returns numpy.ndarray Examples >>> idx = pd.date_range('20180227', periods=3) >>> idx.to_pydatetime() array([datetime.datetime(2018, 2, 27, 0, 0), datetime.datetime(2018, 2, 28, 0, 0), datetime.datetime(2018, 3, 1, 0, 0)], dtype=object) | def to_pydatetime(self) -> npt.NDArray[np.object_]:
return ints_to_pydatetime(self.asi8, tz=self.tz, reso=self._creso) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datetime_xs(df):\n\n # check the column exists\n if 'date' not in df.columns:\n raise RuntimeError(\"Couldn't find column 'date' in input df\")\n\n # safely read date column and convert to datetime objects\n try:\n xs = [datetime.datetime.strptime(d, '%Y-%m-%d').date() for d in df... | [
"0.6508443",
"0.6277837",
"0.61979455",
"0.61461204",
"0.60343194",
"0.60087067",
"0.59924036",
"0.59293836",
"0.59129393",
"0.5762552",
"0.56969523",
"0.56468767",
"0.5641823",
"0.5585818",
"0.5568617",
"0.5568617",
"0.54392445",
"0.5428687",
"0.54037637",
"0.5387729",
"0.53... | 0.6962984 | 0 |
Check that a dtype, if passed, represents either a numpy datetime64[ns] dtype or a pandas DatetimeTZDtype. | def _validate_dt64_dtype(dtype):
if dtype is not None:
dtype = pandas_dtype(dtype)
if dtype == np.dtype("M8"):
# no precision, disallowed GH#24806
msg = (
"Passing in 'datetime64' dtype with no precision is not allowed. "
"Please pass in 'datet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_date_dtype(df, col_name):\n dtype = df.dtypes[col_name]\n return np.issubdtype(dtype, np.datetime64) or np.issubdtype(dtype, np.timedelta64)",
"def has_datetime_type(obj: _std_typing.Any) -> bool:\n return obj.dtype == sc.DType.datetime64",
"def _uses_datetimeblock(dtype: Union[np.dtype, Extens... | [
"0.76788133",
"0.737047",
"0.73670727",
"0.7185629",
"0.6849195",
"0.6548745",
"0.64651287",
"0.6295393",
"0.6231784",
"0.6216203",
"0.621153",
"0.61591727",
"0.615515",
"0.614426",
"0.61196387",
"0.61114883",
"0.6096707",
"0.6093525",
"0.6084236",
"0.60720134",
"0.60635585",... | 0.8244485 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.