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 |
|---|---|---|---|---|---|---|
This method returns all the indexes of the structural degrees of freedom with prescribed structural displacement or rotation boundary conditions. Returns array Indexes of the structural degrees of freedom with prescribed displacement or rotation boundary conditions. See also | def get_prescribed_indexes(self):
global_prescribed = []
for node in self.preprocessor.nodes.values():
if node.there_are_prescribed_dofs:
starting_position = node.global_index * DOF_PER_NODE_STRUCTURAL
dofs = np.array(node.get_prescribed_dofs_bc_indexes()) + s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dofidxs(self):\n return [const['dofidxs'] for i, const in self._constraints_df.iterrows()]",
"def _forest_field_indices(self):\n return self._ffi",
"def get_interior_index_set(self, boundary_conditions, function_space):\n # Find dofs affected by the boundary conditions\n bc_dof... | [
"0.6066924",
"0.5851021",
"0.5827604",
"0.5765778",
"0.5701344",
"0.56607735",
"0.55012983",
"0.5470869",
"0.54646784",
"0.54432195",
"0.5433236",
"0.54290736",
"0.541105",
"0.5364479",
"0.5356482",
"0.5332357",
"0.5330989",
"0.5322781",
"0.5293932",
"0.52892774",
"0.52890277... | 0.5126911 | 30 |
This method returns all the indexes of the structural free degrees of freedom. Returns array Indexes of the structural free degrees of freedom. See also | def get_unprescribed_indexes(self):
total_dof = DOF_PER_NODE_STRUCTURAL * len(self.preprocessor.nodes)
all_indexes = np.arange(total_dof)
return np.delete(all_indexes, self.prescribed_indexes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _forest_field_indices(self):\n return self._ffi",
"def get_free_dofs(self) -> list[int]:\n\n return flatten([node.get_free_dofs() for node in self.nodes])",
"def _dofidxs(self):\n return [const['dofidxs'] for i, const in self._constraints_df.iterrows()]",
"def get_multi_index(self):\... | [
"0.6092286",
"0.60663605",
"0.5843998",
"0.5636328",
"0.56291795",
"0.56203204",
"0.56124604",
"0.56039643",
"0.5593074",
"0.55248857",
"0.548614",
"0.54805106",
"0.547745",
"0.5477423",
"0.5444121",
"0.54346514",
"0.54334396",
"0.5412587",
"0.5405666",
"0.53947544",
"0.53787... | 0.5093968 | 47 |
Generate the tree from the tokenized expression. If the expression is specified then it will create an empty node. | def __init__(self, str_exp=None, kind=None, scanner=None):
self.kind = None
self.name = 'undef'
self.attr = None
self.child = None
self.left = None
self.right = None
self.code = None
if str_exp is not None:
logging.debug('========== EXP in ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expression_to_tree(expression):\n\n # break string into tokens, parsing parenthesized sub-expressions\n\n tokens = []\n current_token = \"\"\n in_quotes = False\n paren_count = 0\n paren_start = None\n\n for i, c in enumerate(expression):\n\n if c in QUOTES and paren_count == 0:\n ... | [
"0.69048524",
"0.66578627",
"0.66505224",
"0.66154623",
"0.6516242",
"0.637458",
"0.6297931",
"0.62246966",
"0.615678",
"0.60913074",
"0.60854226",
"0.58762366",
"0.57972497",
"0.57709223",
"0.5740734",
"0.57072634",
"0.5636426",
"0.561761",
"0.55882114",
"0.55802286",
"0.555... | 0.5334351 | 35 |
Test if a sampler is a sampler. | def is_sampler(self, sampler):
self.assertIsInstance(sampler, types.GeneratorType)
for _ in range(10):
sample = next(sampler)
self.assertIsInstance(sample, np.ndarray)
self.assertEqual(
sample.shape,
(
self._dim,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_replacement_sampler_in_dataloader(self) -> None:\n if not (isinstance(self.data_loader.sampler, RandomSampler)\n or isinstance(self.data_loader.batch_sampler, RandomSampler)):\n raise Exception(\"No random sampler in dataloader.\")",
"def isSampleObject(self, object):\... | [
"0.6487716",
"0.6239702",
"0.6071334",
"0.5824105",
"0.57438046",
"0.5637683",
"0.56301665",
"0.5627417",
"0.5556969",
"0.55180275",
"0.549736",
"0.5476762",
"0.5411314",
"0.5396686",
"0.53884774",
"0.5386999",
"0.53665626",
"0.5300988",
"0.52941096",
"0.52634144",
"0.5255154... | 0.6866357 | 0 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / float(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.79997694",
"0.79955804",
"0.7947871",
"0.79360676",
"0.79129595",
"0.7897813",
"0.7879448",
"0.786082",
"0.786082",
"0.78540397",
"0.78501374",
"0.78499055",
"0.78404397",
"0.7835427",
"0.7828328",
"0.78253037",
"0.78049725",
"0.78017557",
"0.77822274",
"0.77789044",
"0.77... | 0.0 | -1 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / float(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.7999196",
"0.79947",
"0.79473937",
"0.79354537",
"0.7913194",
"0.78966844",
"0.7878534",
"0.7859884",
"0.7859884",
"0.785311",
"0.7849083",
"0.7848823",
"0.7839278",
"0.7834349",
"0.7827535",
"0.78242946",
"0.78038883",
"0.7800734",
"0.7780845",
"0.7778246",
"0.7775117",
... | 0.0 | -1 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / float(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.7998953",
"0.79943913",
"0.7946874",
"0.79344404",
"0.79131955",
"0.7896219",
"0.78781104",
"0.78595",
"0.78595",
"0.78530246",
"0.7848679",
"0.78483564",
"0.78388304",
"0.7833984",
"0.7827247",
"0.7823944",
"0.78033894",
"0.7800449",
"0.7780714",
"0.77779824",
"0.77747816... | 0.0 | -1 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / float(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.79997665",
"0.7994706",
"0.79475737",
"0.7934998",
"0.7913634",
"0.7896726",
"0.7878541",
"0.7859916",
"0.7859916",
"0.7853559",
"0.78490734",
"0.7848768",
"0.7839314",
"0.7834349",
"0.7827535",
"0.7824364",
"0.7803889",
"0.7800838",
"0.77811784",
"0.7778509",
"0.7775202",... | 0.0 | -1 |
Initialize a blank array for multiclump slicing. Default fill values are NaN for floats, 1 for ints, and 0 otherwise. This is useful for automatically flagging when clumps do not exist ARGUMENTS | def _init_array(self, nClumps, nt=0, dim=0, dtype=float, units=None):
shape = [nClumps]
if nt > 1:
shape.append(nt)
if dim > 1:
shape.append(dim)
if np.issubdtype(dtype, float):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _empty(self, *dims, **kwargs):\n size = []\n dtypes = []\n for d in dims:\n size.append(len(self[d]))\n dtypes.append(self[d].dtype)\n dtype = kwargs.pop('dtype', numpy.result_type(*dtypes))\n fv = kwargs.pop('fill_value')\n return numpy.full(size... | [
"0.62284017",
"0.611563",
"0.6100028",
"0.59471333",
"0.5923663",
"0.5878857",
"0.586171",
"0.58162785",
"0.57347393",
"0.5692664",
"0.5684951",
"0.56657207",
"0.56584793",
"0.564607",
"0.5634828",
"0.56072086",
"0.560283",
"0.5585701",
"0.5582964",
"0.5537316",
"0.5530378",
... | 0.62666464 | 0 |
printerr writes to stderr | def test_printerr_happy_path(self, mocked_stderr):
generic.printerr('some error')
self.assertEqual(mocked_stderr.write.call_count, 1)
self.assertEqual(mocked_stderr.flush.call_count, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printerr(msg):\n print(msg, file=sys.stderr)",
"def printerr(*args, **kwargs):\n console_print(sys.stderr, *args, **kwargs)",
"def print_err(err):\n return stdout.write(err.args[0])",
"def print_err(msg):\n print(msg, file=sys.stderr)",
"def printerr(message):\n sys.stderr.write('{}\\n'.... | [
"0.82864",
"0.8041003",
"0.8022133",
"0.8019844",
"0.80050313",
"0.7841724",
"0.77624345",
"0.77589464",
"0.76486796",
"0.76457334",
"0.75262105",
"0.73065746",
"0.72625804",
"0.7261832",
"0.72144836",
"0.72080123",
"0.7180818",
"0.7133281",
"0.7132144",
"0.70857334",
"0.7082... | 0.6567107 | 41 |
Test config update from dictionary | def test_config_update(get_config):
cfg = get_config(Config, {'test': 'main'})
update_from = {"name": "new_name"}
cfg.update(update_from)
assert cfg.data.get('name') == "new_name", "config was not updated" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_config_change():\n clean_tables()\n config = set_configuration()\n assert config['age']['value'] == \"72\"\n assert config['retainUnsent']['value'] == \"False\" \n\n config = update_configuration(age=0, retain_unsent=True) \n assert config['age']['value'] == \"0\" \n assert config['re... | [
"0.74898773",
"0.7109476",
"0.6999652",
"0.6836589",
"0.6806701",
"0.6787579",
"0.6738938",
"0.659535",
"0.6564691",
"0.64921737",
"0.649149",
"0.6481108",
"0.6478928",
"0.64774114",
"0.6417979",
"0.6383675",
"0.63836306",
"0.63741744",
"0.6363116",
"0.63425964",
"0.6327325",... | 0.77892286 | 0 |
The immutable ID of this data collection endpoint resource. This property is READONLY. | def immutable_id(self) -> Optional[str]:
return pulumi.get(self, "immutable_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EndpointSetId(self):\n return self._get_attribute('endpointSetId')",
"def Id(self):\n return self._id",
"def pure_id(self):\n return self._pure_id",
"def endpoint_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_id\")",
"def endpoint_id(self) -> pulumi.Ou... | [
"0.6724009",
"0.6355908",
"0.6354153",
"0.630098",
"0.630098",
"0.630098",
"0.6292441",
"0.62902385",
"0.6275968",
"0.6263533",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.6262435",
"0.... | 0.68815535 | 0 |
The kind of the resource. | def kind(self) -> Optional[str]:
return pulumi.get(self, "kind") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_kind(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_kind\")",
"def kind(self):\n return self.get_data(\"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
"def kind(self) -> str:\n return pulumi.get(self, \"kind\")",
... | [
"0.8420585",
"0.8050319",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"0.8045995",
"... | 0.7883268 | 31 |
The geolocation where the resource lives. | def location(self) -> str:
return pulumi.get(self, "location") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\n return self.location",
"def get_location(self):\r\n return self.__location",
"def getLocation(self):\n return self._Location",
"def geolocation(self):\n return self.get_property('geolocation', Geoloca... | [
"0.8262594",
"0.8205832",
"0.81662714",
"0.8057481",
"0.7970885",
"0.794221",
"0.79067963",
"0.7890446",
"0.7890446",
"0.7869041",
"0.78084195",
"0.7742241",
"0.7629831",
"0.7602376",
"0.7592794",
"0.75908977",
"0.75857115",
"0.7579328",
"0.7557103",
"0.74403054",
"0.74403054... | 0.7566804 | 28 |
The name of the resource. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_name(self):\n return self._resource_name",
"def name(self):\n return self.raw_resource[\"name\"]",
"def name(self):\n\n return self.resource[\"metadata\"][\"name\"]",
"def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")",
"def ... | [
"0.87985206",
"0.87725735",
"0.84720314",
"0.8307528",
"0.8307528",
"0.80756086",
"0.80756086",
"0.80756086",
"0.80756086",
"0.80756086",
"0.77087325",
"0.7644283"
] | 0.7562753 | 64 |
The resource provisioning state. This property is READONLY. | def provisioning_state(self) -> str:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provisioning_state(self) -> Optional[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> Optional[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> Optional[str]:\n return pulumi.get(self, \"provisioning_st... | [
"0.80196357",
"0.80196357",
"0.80196357",
"0.80196357",
"0.80196357",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7946048",
"0.7687355",
"0.7687355",
"0.7616092"... | 0.82298404 | 13 |
The type of the resource. | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(cls):\n pass",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pu... | [
"0.87906647",
"0.8584323",
"0.8584323",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8426089",
"0.8225315",
"0.79590267",
"0.7784924",
"0.77586514",
"0.7719484",
"0.7688179",
"0.7683107",
"0.76714844",
"0.76522225",
"0.7639158",
"0.76372916",
"0.76365036",
"0.761944... | 0.78331804 | 38 |
Normalize a 2D matrix on an axis. | def normalize_matrix_on_axis(m, axis=0, copy=True):
if axis == 0:
ret = m / np.sqrt(np.sum(m ** 2, axis=axis))
elif axis == 1:
ret = normalize_matrix_on_axis(m.T).T
else:
raise Exception('Only for 2D array.')
if copy:
ret = ret.copy()
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(X, axis=-1, order=2):\n l2 = np.atleast_1d(np.linalg.norm(X, order, axis))\n l2[l2 == 0] = 1\n return X / np.expand_dims(l2, axis)",
"def _normalize_matrix_on_axis(m, axis=0):\n if m.ndim > 2:\n raise ValueError(\n \"This function only accepts 2D arrays. \"\n ... | [
"0.7502926",
"0.7461525",
"0.7425477",
"0.73569936",
"0.7334126",
"0.7313735",
"0.7280307",
"0.72589785",
"0.7193776",
"0.7133624",
"0.7021105",
"0.6998982",
"0.6986054",
"0.6973652",
"0.6973652",
"0.6973652",
"0.69469905",
"0.6935014",
"0.69304264",
"0.6906828",
"0.68913996"... | 0.76275796 | 0 |
Get a directed graph where joints are edges between links. Returns | def graph(self):
graph = nx.DiGraph()
for name, joint in self.joints.items():
graph.add_edge(*joint.connects, joint=name)
return graph | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joint_graph(graph, nodes):\n # TODO\n joint_graph = nodes = None\n\n return joint_graph, nodes",
"def make_join_graph(parsed_join_clauses):\n g = nx.Graph()\n for t1, c1, t2, c2 in parsed_join_clauses:\n g.add_node(t1)\n g.add_node(t2)\n if not g.has_edge(t1, t2):\n ... | [
"0.69948316",
"0.64479834",
"0.63919884",
"0.6047201",
"0.6022175",
"0.5972246",
"0.59327275",
"0.5930729",
"0.5929726",
"0.58937323",
"0.588772",
"0.58630854",
"0.58156633",
"0.580984",
"0.57771915",
"0.573594",
"0.57354623",
"0.5714326",
"0.56863064",
"0.5684077",
"0.567313... | 0.7767198 | 0 |
Turns a string of a list into an actual list | def parse1DList(self,string):
string = string.replace("[","")
string = string.replace("]","")
string = string.split(",")
for i in xrange(len(string)):
string[i] = float(string[i])
string = list(string)
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list(string, dtype):\n # l = string.replace('[', '').replace(']', '').replace(' ', '').split(',')\n s = string.replace(' ', '') # remove all spaces first\n if s[0] == '[': # it's not only a single item\n s = s[1:-1] # remove [ and ] from start and end only\n else: # it's just a single... | [
"0.78283715",
"0.7762626",
"0.74203455",
"0.7348647",
"0.7312794",
"0.72003484",
"0.69802773",
"0.697887",
"0.6965602",
"0.6954991",
"0.69541836",
"0.6941367",
"0.6939793",
"0.68909806",
"0.6885284",
"0.68751466",
"0.6845077",
"0.6837753",
"0.68285555",
"0.6826062",
"0.682297... | 0.71884066 | 6 |
Get the model units. | def get_units(self):
return str(self._modeler.GetModelUnits()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def units(self):\n return self._units",
"def units(self):\n return self._units",
"def unit_of_measurement(self):\n return self._units",
"def units(self):\n return self.__class__.get_setting_units(self.key, **self.get_kwargs())",
"def units(self):\n pass",
"def get_units... | [
"0.8271184",
"0.8271184",
"0.7889019",
"0.78001606",
"0.77874124",
"0.77309424",
"0.76147455",
"0.75978965",
"0.7584519",
"0.75765306",
"0.75716513",
"0.7513318",
"0.7505374",
"0.74957365",
"0.7479566",
"0.74708873",
"0.74449486",
"0.7415912",
"0.7358296",
"0.7322458",
"0.730... | 0.88093436 | 0 |
The total number of candidates fundraising for this election. | def candidate_count(self):
return self.candidate_set.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def election_count(self):\n return self.candidate_set.values(\"election_id\").distinct().count()",
"def num_attendees(self):\r\n n = sum([c.qty for c in self.contribution_set.all()])\r\n return n",
"def get_number_of_unrelaxed_candidates(self):\n return len(self.__get_ids_of_all_unr... | [
"0.7073377",
"0.70278937",
"0.66166615",
"0.6607756",
"0.65101784",
"0.63865083",
"0.63746923",
"0.63719064",
"0.6359638",
"0.63576174",
"0.6322995",
"0.6322995",
"0.6322995",
"0.6256551",
"0.62516165",
"0.6237446",
"0.6215507",
"0.6205254",
"0.61953455",
"0.6184409",
"0.6180... | 0.7054283 | 1 |
The total number of candidates who have fundraised for this office. | def candidate_count(self):
return self.candidate_set.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def office_count(self):\n return self.candidate_set.values(\"office_id\").distinct().count()",
"def num_attendees(self):\r\n n = sum([c.qty for c in self.contribution_set.all()])\r\n return n",
"def election_count(self):\n return self.candidate_set.values(\"election_id\").distinct()... | [
"0.75335944",
"0.7176265",
"0.66906095",
"0.6303418",
"0.62411845",
"0.62336326",
"0.6221777",
"0.622036",
"0.621463",
"0.6181431",
"0.61428916",
"0.6124173",
"0.61037636",
"0.6095675",
"0.6087165",
"0.60761976",
"0.606081",
"0.6056233",
"0.6054563",
"0.6054563",
"0.6054563",... | 0.6701513 | 3 |
Return individual lines. Remove comments and whitespace, convert to lowercase, and split on semicolons. | def parse_lines(contents):
# Nested comments not handled.
in_comment = False
stripped_contents = ""
for char in contents.lower():
if char == "{":
in_comment = True
elif char == "}":
in_comment = False
elif not in_comment and not char.isspace():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitlines(self) -> List[String]:\n pass",
"def Split_to_Lines(self):\r\n\r\n line = []\r\n word = \"\"\r\n comment = False\r\n String = False\r\n for i in range(0, len(self.Code)):\r\n if self.Code[i] == '\\n':\r\n if word != '':\r\n ... | [
"0.68980956",
"0.63097143",
"0.62692696",
"0.62305224",
"0.6210981",
"0.6124547",
"0.6102486",
"0.6080312",
"0.6079866",
"0.6021133",
"0.6005922",
"0.5993551",
"0.59906685",
"0.5974093",
"0.59527856",
"0.5945818",
"0.59429497",
"0.58701724",
"0.5860921",
"0.5760778",
"0.57522... | 0.64032716 | 1 |
return the data at a particular index >>> circ = CircularArray() >>> circ.add_item("aiden") >>> circ.add_item("kelly") >>> circ.add_item("leslye") >>> circ.get_by_index(1) 'kelly' >>> circ = CircularArray() >>> circ.add_item("ashley") >>> circ.add_item("colleen") >>> circ.get_by_index(2) >>> circ = get_sample_array() >... | def get_by_index(self, index):
# index doesn't exist the list
if index >= len(self.array):
return None
# the easy case -- it doesn't go off the end of the list
if index + self.head < len(self.array):
return self.array[index + self.head]
# the fun case: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n return self.array[index]",
"def __getitem__(self, index):\n return self.data[index[0] - 1][index[1] - 1]",
"def get_item(array, index):\n row, column = index\n return array[row][column]",
"def __getitem__(self, index):\n item = self.data[index]\n ... | [
"0.6273042",
"0.6072118",
"0.60561794",
"0.60520285",
"0.60339665",
"0.60339665",
"0.6018544",
"0.6000313",
"0.5999151",
"0.59860337",
"0.59400594",
"0.5937006",
"0.5897199",
"0.58144164",
"0.5786829",
"0.57597226",
"0.5734701",
"0.57253313",
"0.57237166",
"0.56953335",
"0.56... | 0.58292 | 13 |
Method returns a representation of the object | def __str__(self):
return f'''
Device: {self._device}
Serial number: {self._serial_num}''' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(sel... | [
"0.80400974",
"0.79229546",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7787714",
"0.77482677",
"0.7717977",
"0.7700611",
"0.7667509",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76... | 0.0 | -1 |
Method returns a representation of the object | def __str__(self):
return f'''
{super().__str__()}
Brand: {self._breand}
Pover: {self._power} (W)
''' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(sel... | [
"0.80400974",
"0.79229546",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7787714",
"0.77482677",
"0.7717977",
"0.7700611",
"0.7667509",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76... | 0.0 | -1 |
Method returns a representation of the object | def __str__(self):
return f'''
{super().__str__()}
Brand: {self._breand}
Pover: {self._power} (W)
Speed: {self._speed} (rpm)
''' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(sel... | [
"0.80400974",
"0.79229546",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7787714",
"0.77482677",
"0.7717977",
"0.7700611",
"0.7667509",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76... | 0.0 | -1 |
Method returns a representation of the object | def __str__(self):
return f'''
{super().__str__()}
Brand: {self._breand}
Pover: {self._power} (W)
Nozzle: {self._nozzle} (pieces)
''' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(self.__dict__)",
"def __repr__(self):\n return str(sel... | [
"0.80400974",
"0.79229546",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7836983",
"0.7787714",
"0.77482677",
"0.7717977",
"0.7700611",
"0.7667509",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76657116",
"0.76... | 0.0 | -1 |
Insert padding data into given number by shifting it left. | def pad_number(n, a, b):
padded = shift_left(n, 8, a)
padded = shift_left(padded, 8, b)
crc = checksum(padded)
padded = shift_left(padded, 32, crc)
return padded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(number, width=0):\n return str(number).zfill(width)",
"def int_padding(length, val, direction=\">\"):\n return '{0:0{direction}{fill}}'.format(val, direction=direction, fill=length)",
"def pad_left(data, padding_char, length):\n if is_null_or_empty(padding_char):\n padding_char = DEFAUL... | [
"0.67090017",
"0.6532337",
"0.647791",
"0.6267167",
"0.613713",
"0.6109831",
"0.60522926",
"0.6049757",
"0.60178894",
"0.6017372",
"0.60166913",
"0.5925722",
"0.59184074",
"0.587888",
"0.5867888",
"0.58315134",
"0.58097804",
"0.5805009",
"0.58030605",
"0.5781101",
"0.5768435"... | 0.6235919 | 4 |
Test the PUT method. | def test_put_method(self):
self.getPage('/blah', method='PUT')
self.assertStatus('200 OK')
self.assertHeader('Content-Type', 'application/json')
self.assertBody('{"mystring": "blah"}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_can_do_put_request(self):\n response = self.httpbin_4.test_requests_put_method()\n self.assertEqual(response.request.method, 'PUT')\n self.assertEqual(response.status_code, 200)",
"def test_put(self):\n url, port = self.server.address\n\n #couple of basic POSTs\... | [
"0.85877097",
"0.85714173",
"0.85418063",
"0.83625424",
"0.8127313",
"0.8006147",
"0.7963857",
"0.7956125",
"0.7853267",
"0.7820533",
"0.7782905",
"0.76700926",
"0.7544995",
"0.75160265",
"0.74992406",
"0.74841666",
"0.74839896",
"0.74256426",
"0.7393465",
"0.7389871",
"0.735... | 0.89865553 | 0 |
Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text. | def open_and_read_file(file_path):
# your code goes here
f = open(file_path, "r")
text = f.read()
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string",
"def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text",
... | [
"0.8069684",
"0.8048225",
"0.8014232",
"0.7990818",
"0.7864469",
"0.7799647",
"0.7679429",
"0.7659341",
"0.7613945",
"0.7606904",
"0.7571046",
"0.7539764",
"0.75299084",
"0.7503712",
"0.75027317",
"0.74994993",
"0.74130434",
"0.7370997",
"0.7362886",
"0.7327873",
"0.72931725"... | 0.79218066 | 4 |
Return a subset of the values in ``from_dict`` rekeyed according to the mapping in ``key_mapping``. The key mapping dict has the format of ``key_mapping[new_key] = old_key``. | def normalize_dict(from_dict: Dict[str, Any], key_mapping: Dict[str, str]) -> Dict[str, Any]:
to_dict = {}
for new_key, old_key in key_mapping.items():
if old_key in from_dict:
to_dict[new_key] = from_dict[old_key]
return to_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_dict_by_key(\n original, key_map, fill_in=False, whitelist=[], blacklist=[]\n): # pylint: disable=dangerous-default-value\n converted = {}\n for converted_key in key_map:\n original_key = key_map[converted_key]\n\n converted[converted_key] = recursive_key_lookup(original_key, or... | [
"0.6294335",
"0.61497164",
"0.5872547",
"0.58184403",
"0.58047754",
"0.57590306",
"0.5689401",
"0.5647787",
"0.55922145",
"0.55408245",
"0.55361944",
"0.5521147",
"0.5517788",
"0.5508796",
"0.54645795",
"0.5431564",
"0.5390481",
"0.5383376",
"0.5377988",
"0.5367651",
"0.53299... | 0.6338231 | 0 |
Creates the learning rate decay operation in tensorflow using inverse time decay | def learning_rate_decay(alpha, decay_rate, global_step, decay_step):
return tf.train.inverse_time_decay(
alpha, global_step, decay_step, decay_rate, staircase=True
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n gd = tf.train.inverse_time_decay(alpha, global_step, decay_step,\n decay_rate, staircase=True)\n return gd",
"def learning_rate_decay(a, d_rate, g_step, d_step):\n return tf.train.inverse_time_deca... | [
"0.8174351",
"0.81259096",
"0.8008134",
"0.7984625",
"0.7971926",
"0.7890018",
"0.73276323",
"0.7191058",
"0.71012914",
"0.7084778",
"0.7044523",
"0.6952808",
"0.67888",
"0.67820376",
"0.6780566",
"0.67494446",
"0.67429787",
"0.6699048",
"0.66444916",
"0.65989226",
"0.6592173... | 0.7972559 | 4 |
Compute different metrics by evaluating the model | def compute(self) -> None:
self.model.eval()
with torch.no_grad():
for (input, target, _) in self.loader:
# self.model = self.model.train(False) # TEST @lacoupe
output, _ = self.model(input)
output = (output ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_evaluate(model,x_train,n_y_array,x_val, vald_array):\n\n scores = model.evaluate(x_train, n_y_array, verbose=1)\n\n scores2 = model.evaluate(x_val, vald_array, verbose=1)\n\n\n print(\"for traininf set\")\n\n print(\"%s: %.2f%%\" % (model.metrics_names[1], scores[1]*100))\n\n print(\"%s: %... | [
"0.7915814",
"0.7677685",
"0.75339603",
"0.73629975",
"0.7350467",
"0.73103106",
"0.7284141",
"0.7282785",
"0.7280201",
"0.7278868",
"0.72723305",
"0.7263158",
"0.72572243",
"0.72396654",
"0.7206446",
"0.71496516",
"0.7133435",
"0.7120527",
"0.7119146",
"0.709922",
"0.7069758... | 0.7356347 | 4 |
SearchForm.get_location() Returns the name of the location macthing the user's request from the cleaned form data. | def get_location(self):
return self.cleaned_data['location'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_location(self):\n location = self.cleaned_data['location']\n\n matching_ids = get_all_matching_location_ids(location)\n if len(matching_ids) > 1:\n raise forms.ValidationError(\"Ooops. We couldn't understand which location you're interested in.\")\n elif not matchin... | [
"0.6832222",
"0.67788726",
"0.67788726",
"0.67788726",
"0.6756092",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
"0.6675557",
... | 0.8136648 | 0 |
Iterate on all strings in an arbitrarily nested list of strings. | def each_string(*args: Strings) -> Iterator[str]:
for strings in args:
if isinstance(strings, str):
yield strings
elif strings is not None:
yield from each_string(*strings) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_formatted_strings(self, iterable_strings):\n for string in iterable_strings:\n yield self.get_formatted_string(string)",
"def flatten(nested_iterable):\n\n for item in nested_iterable:\n if hasattr(item, '__iter__') and not isinstance(item, str):\n for i in flatten... | [
"0.65793145",
"0.63970727",
"0.6353363",
"0.6333464",
"0.6195272",
"0.6044461",
"0.6020785",
"0.59775263",
"0.596384",
"0.5901864",
"0.585626",
"0.5797652",
"0.574214",
"0.56994134",
"0.56507313",
"0.5591592",
"0.55439496",
"0.55299896",
"0.5490388",
"0.5481418",
"0.546045",
... | 0.688186 | 0 |
Parse a boolean command line argument. | def str2bool(string: str) -> bool:
if string.lower() in ["yes", "true", "t", "y", "1"]:
return True
if string.lower() in ["no", "false", "f", "n", "0"]:
return False
raise argparse.ArgumentTypeError("Boolean value expected.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_bool(arg):\n if arg == 'True':\n return True\n elif arg == 'False':\n return False\n else:\n raise argparse.ArgumentTypeError(\"Expected 'True' or 'False'.\")",
"def parse_bool(bool_arg):\n if bool_arg.lower() in ('yes', 'true', 't', 'y', '1'):\n return True\n ... | [
"0.87144613",
"0.83708346",
"0.78528637",
"0.77807605",
"0.77176136",
"0.7650715",
"0.7649914",
"0.76056224",
"0.757852",
"0.75627315",
"0.75627315",
"0.75344324",
"0.7529257",
"0.75246346",
"0.75246346",
"0.75246346",
"0.75246346",
"0.7480213",
"0.7456864",
"0.7456864",
"0.7... | 0.7379418 | 23 |
Whether this action has any additional information over its predecessor. | def is_empty(self) -> bool:
return self.command is None and not self.required | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_previous(self) -> bool:\n return self.published_before().count() != 0",
"def has_previous(self):\n if self.idx < len(self.nodes):\n return True\n else:\n return False",
"def __nonzero__(self):\n return self.has_prev or self.has_next",
"def __ne__(self... | [
"0.6520556",
"0.64765453",
"0.6467706",
"0.6207601",
"0.617638",
"0.61699885",
"0.6167544",
"0.6167544",
"0.61505055",
"0.611732",
"0.60413027",
"0.60301787",
"0.6021845",
"0.59887165",
"0.59871054",
"0.5954118",
"0.5945062",
"0.59301275",
"0.58917195",
"0.5888835",
"0.588138... | 0.0 | -1 |
Log a ``WARN`` level ``message``. | def warning(message: str, *args: Any) -> None:
Logger.log(logging.WARN, message, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warn(self, message: str):\n self.log(Level.WARNING, message)",
"def warn(cls, message):\n print('[WARN] {0}'.format(message))",
"def warn(self, message):\n return self.log(\"WARNING\", message)",
"def log_warn(self, msg):\n self.log(msg, level=LOG_WARN)",
"def msg_warn(messa... | [
"0.8376178",
"0.8276455",
"0.808854",
"0.79118264",
"0.7782443",
"0.7750673",
"0.7676036",
"0.76257956",
"0.75946784",
"0.7525559",
"0.7508434",
"0.74902016",
"0.74224967",
"0.74100924",
"0.7252978",
"0.7231269",
"0.7215687",
"0.71263504",
"0.71249545",
"0.7022568",
"0.700737... | 0.79980624 | 3 |
Return the list of expanded outputs of the current step. These contain the concrete names for pattern outputs, except for the names of dynamic outputs. | def outputs() -> List[str]:
return Invocation.current.expanded_outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputs(self):\n\n outputs = []\n for arg in self.arguments:\n if arg.OUT:\n outputs.append(arg)\n\n return outputs",
"def output_names(self):\n return []",
"def _list_outputs(self):\n outputs = self._outputs().get()\n\n out_dir = os.path.... | [
"0.688724",
"0.65974444",
"0.64932126",
"0.6460088",
"0.63931566",
"0.6391884",
"0.638777",
"0.63820463",
"0.63808155",
"0.62329984",
"0.6230487",
"0.6229286",
"0.62048364",
"0.61316204",
"0.609064",
"0.6071835",
"0.60701376",
"0.6065256",
"0.6065256",
"0.6065256",
"0.6065256... | 0.7987929 | 0 |
Sends a 401 response that enables basic auth | def authenticate():
return flask.Response('Login required.', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.7613103 | 42 |
get the colormap of given band | def colormap(self, band_idx=1):
if band_idx < 1 or band_idx > self.dataset.RasterCount:
raise IndexError("band index is out of range")
ct = self.dataset.GetRasterBand(band_idx).GetColorTable()
if ct is None:
return None
colormap = []
for i in range(ct.Get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def get_colormap(self):\n return colors.colormaps[self.name]",
"def cmap(self):\n return self.pixels.get_cmap()",
"def create_colormap(seg_map):\n\tcolormap = np.zeros((256, 3), dtype=int)\n\tind = np.arange(256, dtype=int)\... | [
"0.65328604",
"0.65328604",
"0.6514024",
"0.63640875",
"0.6345589",
"0.63450545",
"0.63450545",
"0.63418263",
"0.63418263",
"0.63418263",
"0.6317684",
"0.6315992",
"0.6315992",
"0.61892176",
"0.6156784",
"0.6119668",
"0.6100243",
"0.60578686",
"0.60410696",
"0.5925074",
"0.59... | 0.76654273 | 0 |
create a matrix that transforms a vector from space to outer plane space | def _prepare_outer_matrix(self):
self._mat_plane = numpy.array([
self._scaling[0], 0, 0, 0,
0, self._scaling[1], 0, 0,
0, 0, 1, 0,
self.i_border[0], -self.i_border[1], 0, 1
], dtype=numpy.float32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def householder(vector):\n identity_mat = np.eye(len(vector))\n v = vector[np.newaxis]\n denominator = np.matmul(v, v.T)\n numerator = np.matmul(v.T, v)\n rot_mat = identity_mat - (2 * numerator / denominator)\n return rot_mat",
"def project_onto_plane(vect):\n x, y, z = vect\n \n retu... | [
"0.71119857",
"0.6774908",
"0.66030794",
"0.6502478",
"0.6458526",
"0.64265585",
"0.6391106",
"0.6275782",
"0.6238817",
"0.6231082",
"0.6207642",
"0.62022746",
"0.61553717",
"0.615349",
"0.61062413",
"0.60995245",
"0.6071083",
"0.6068581",
"0.5985908",
"0.5970755",
"0.5949688... | 0.66490567 | 2 |
creates a matrix that transforms a vector from space to the plot plane space | def _prepare_plot_matrix(self):
tx = self.i_border[0]+self.o_wh[1]*self.i_origin[0]/self.i_axis[0]*self._scaling[0]
ty = -self.i_border[1]-(self.o_wh[1]-self.o_wh[1]*self.i_origin[1]/self.i_axis[1])*self._scaling[1]
sx = (self.o_wh[0])*self._scaling[0]/self.i_axis[0]
sy = (self.o_wh[1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_onto_plane(vect):\n x, y, z = vect\n \n return (x, y, 0.)",
"def degree_vector_to_matrix(vector):\n return np.diag(vector)",
"def vector_space(a, alpha):\n x, y = meshgrid(linspace(-2, 2, num=20), linspace(-2, 2, num=20))\n fx, fy = stuartLandau([x, y], a, alpha)\n gx, gy = no... | [
"0.6453259",
"0.6226417",
"0.6164372",
"0.6147781",
"0.6106238",
"0.6098371",
"0.597902",
"0.5969319",
"0.59591454",
"0.58951426",
"0.5877033",
"0.58404404",
"0.5836117",
"0.5828331",
"0.58204055",
"0.58184475",
"0.5782616",
"0.5781672",
"0.57318515",
"0.5712016",
"0.5709605"... | 0.53530794 | 78 |
Returns the model of the connected gauge controller. | def _get_model(self):
assert self.serial_connection.isOpen()
self.serial_connection.write('TID' + self.CR + self.LF)
acknowledgement = self.serial_connection.readline(25)
self._check_acknowledgement(acknowledgement)
self.serial_connection.write(self.ENQ)
model = self.se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model(self):\n return self._device.device_data[self._uuid]['model']",
"def model(self):\n return self._bulb_device.model or self.capabilities.get(\"model\")",
"def model(self):\n return self.device.settings[\"device\"][\"type\"]",
"def model(self):\n return self.device.setting... | [
"0.69398266",
"0.67882097",
"0.6534406",
"0.6534406",
"0.6524891",
"0.6386251",
"0.63809085",
"0.6353057",
"0.6298797",
"0.62878853",
"0.6260077",
"0.6247794",
"0.6221294",
"0.6187981",
"0.61848146",
"0.61840546",
"0.6162854",
"0.6108005",
"0.6080803",
"0.60742354",
"0.607255... | 0.5675162 | 65 |
Return true if environment requires discrete actions. | def discrete_actions(self) -> bool:
return self.actions.discrete | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discrete_action(self) -> bool:\n raise NotImplementedError()",
"def __bool__(self):\n return bool(self._actions)",
"def can_make_action(self) -> bool:\n return not(self.has_pending_action or self.is_dead())",
"def is_monoid_action(self) :\n return True",
"def is_github_actio... | [
"0.74849385",
"0.6305506",
"0.6180438",
"0.6154286",
"0.6054392",
"0.60006016",
"0.5996252",
"0.5922564",
"0.5910156",
"0.58958954",
"0.58938026",
"0.579769",
"0.5775318",
"0.57660115",
"0.57386607",
"0.56987786",
"0.56759787",
"0.5675378",
"0.56700087",
"0.56655425",
"0.5635... | 0.7679346 | 0 |
Generates a precision recall curve for the given prediction probabilities. | def plotPRC(yscore, true, datasets, title, outfile):
fig = plt.figure()
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.0])
plt.xlabel('Recall')
plt.ylabel('Precision')
plt.title(title)
for i in range(len(datasets)):
precision, recall, _ = precision_recall_curve(true[i], yscore[i][:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_recall(y_true, y_prob, ARGS):\n average_precision = average_precision_score(y_true, y_prob)\n if ARGS.graphs:\n precision, recall, _ = precision_recall_curve(y_true, y_prob)\n plt.style.use('ggplot')\n plt.clf()\n plt.plot(recall, precision,\n label='... | [
"0.75181687",
"0.7326186",
"0.7209196",
"0.7071125",
"0.7049241",
"0.7025263",
"0.6862308",
"0.6852375",
"0.6832241",
"0.67923445",
"0.6764712",
"0.6699479",
"0.66852456",
"0.66688484",
"0.6663009",
"0.6630437",
"0.6615672",
"0.6602273",
"0.6550906",
"0.65410817",
"0.64833343... | 0.0 | -1 |
Returns the number of LEDs currently handled by the device. an integer corresponding to the number of LEDs currently handled by the device On failure, throws an exception or returns YColorLedCluster.ACTIVELEDCOUNT_INVALID. | def get_activeLedCount(self):
# res
if self._cacheExpiration <= YAPI.GetTickCount():
if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
return YColorLedCluster.ACTIVELEDCOUNT_INVALID
res = self._activeLedCount
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_maxLedCount(self):\n # res\n if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YColorLedCluster.MAXLEDCOUNT_INVALID\n res = self._maxLedCount\n return res",... | [
"0.694767",
"0.6788073",
"0.61796284",
"0.6032646",
"0.6009376",
"0.57938445",
"0.57562095",
"0.5735826",
"0.57259834",
"0.57259834",
"0.5724395",
"0.5671994",
"0.5667819",
"0.5666617",
"0.56052023",
"0.5598604",
"0.5574723",
"0.55736",
"0.5566945",
"0.55458945",
"0.55458945"... | 0.803843 | 0 |
Returns the maximum number of LEDs that the device can handle. an integer corresponding to the maximum number of LEDs that the device can handle On failure, throws an exception or returns YColorLedCluster.MAXLEDCOUNT_INVALID. | def get_maxLedCount(self):
# res
if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):
if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
return YColorLedCluster.MAXLEDCOUNT_INVALID
res = self._maxLedCount
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blinkSeqMaxCount(self):\n # res\n if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YColorLedCluster.BLINKSEQMAXCOUNT_INVALID\n res = self._blinkSeqMaxCount\n ... | [
"0.67650723",
"0.67182416",
"0.66908765",
"0.6613771",
"0.6603505",
"0.65159684",
"0.6508156",
"0.65017694",
"0.6476271",
"0.6468042",
"0.6468042",
"0.6468042",
"0.6468042",
"0.6468042",
"0.6433843",
"0.64336395",
"0.6389009",
"0.63729227",
"0.6370919",
"0.6370919",
"0.634098... | 0.838825 | 0 |
Returns the maximum number of sequences that the device can handle. an integer corresponding to the maximum number of sequences that the device can handle On failure, throws an exception or returns YColorLedCluster.BLINKSEQMAXCOUNT_INVALID. | def get_blinkSeqMaxCount(self):
# res
if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):
if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
return YColorLedCluster.BLINKSEQMAXCOUNT_INVALID
res = self._blinkSeqMaxCount
return r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blinkSeqMaxSize(self):\n # res\n if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YColorLedCluster.BLINKSEQMAXSIZE_INVALID\n res = self._blinkSeqMaxSize\n ... | [
"0.7556203",
"0.68697345",
"0.68636465",
"0.6835044",
"0.6818291",
"0.6818291",
"0.6818291",
"0.6818291",
"0.6818291",
"0.66824573",
"0.65957814",
"0.64771557",
"0.6382837",
"0.6377933",
"0.636717",
"0.6361396",
"0.6311039",
"0.62977314",
"0.6296719",
"0.62575406",
"0.6254348... | 0.83373666 | 0 |
Returns the maximum length of sequences. an integer corresponding to the maximum length of sequences On failure, throws an exception or returns YColorLedCluster.BLINKSEQMAXSIZE_INVALID. | def get_blinkSeqMaxSize(self):
# res
if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):
if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:
return YColorLedCluster.BLINKSEQMAXSIZE_INVALID
res = self._blinkSeqMaxSize
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_seq_len() -> int:\n return 8",
"def get_blinkSeqMaxCount(self):\n # res\n if self._cacheExpiration == datetime.datetime.fromtimestamp(86400):\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YColorLedCluster.BLINKSEQMAXCOUNT_INVALID\n... | [
"0.79745924",
"0.7580911",
"0.7380262",
"0.7116022",
"0.6972388",
"0.68231165",
"0.6815797",
"0.67752486",
"0.67059684",
"0.66731143",
"0.66698563",
"0.65907395",
"0.6561259",
"0.6559373",
"0.6544106",
"0.64834744",
"0.6465013",
"0.6452643",
"0.6397232",
"0.6386169",
"0.63793... | 0.7963011 | 1 |
Return the default MXNet mode | def get_default_MXNet_mode():
return MXNET_DEFAULT_MODE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_device():\n return MXNET_DEFAULT_DEVICE",
"def network_mode(self) -> Optional[pulumi.Input[Union[str, 'NetworkMode']]]:\n return pulumi.get(self, \"network_mode\")",
"def isDefaultMode():\n\treturn 0",
"def default_mode(self) -> Optional[pulumi.Input[int]]:\n return pulumi.ge... | [
"0.7108911",
"0.6583049",
"0.63834816",
"0.6352034",
"0.6280394",
"0.60361785",
"0.6001621",
"0.5952137",
"0.5866211",
"0.5866211",
"0.58469784",
"0.5796179",
"0.5779889",
"0.5772722",
"0.5772722",
"0.5756286",
"0.5756104",
"0.5734902",
"0.5720484",
"0.57125235",
"0.5710573",... | 0.94785005 | 0 |
Returns if the word is in the trie. | def search(self, word):
if not word:
return False
if word[0] not in self.trie:
return False
cur = self.trie[word[0]]
for char in word[1:]:
if char not in cur.nexts:
return False
cur = cur.nexts[char]
return (cur and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.838632",
"0.8150416",
"0.8123471",
"0.7830664",
"0.77935004",
"0.7792806",
"0.77642965",
"0.7753436",
"0.7747724",
"0.7711298",
"0.76816714",
"0.7677101",
"0.7664614",
"0.76506114",
"0.76338875",
"0.7628353",
"0.76114196",
"0.7577657",
"0.75695884",
"0.756079",
"0.75591743... | 0.7856802 | 3 |
Test reading and writing skycorr files. | def test_skycorr_rw(self):
from ..skycorr import SkyCorr
from ..io.skycorr import read_skycorr, write_skycorr
nspec, nwave = 5,10
wave = np.linspace(4000.,8000,nwave)
dwave = 0.02*np.random.uniform(size=(nspec, nwave))
dlsf = 0.1*np.random.uniform(size=(nspec, nwave))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skycorr_pca_rw(self):\n from ..skycorr import SkyCorrPCA\n from ..io.skycorr import read_skycorr_pca, write_skycorr_pca\n nspec, nwave = 5,10\n wave = np.linspace(4000.,8000,nwave)\n dwave_mean = 0.02*np.random.uniform(size=(nspec, nwave))\n dwave_eigenvectors = ... | [
"0.6668062",
"0.6404881",
"0.61078554",
"0.60682267",
"0.6041646",
"0.5971637",
"0.58480126",
"0.5841975",
"0.58369446",
"0.5787703",
"0.57855725",
"0.57526827",
"0.5738222",
"0.57332444",
"0.5714798",
"0.5708744",
"0.5702368",
"0.5690616",
"0.56835365",
"0.5674624",
"0.56591... | 0.7754107 | 0 |
Test reading and writing skycorr files. | def test_skycorr_pca_rw(self):
from ..skycorr import SkyCorrPCA
from ..io.skycorr import read_skycorr_pca, write_skycorr_pca
nspec, nwave = 5,10
wave = np.linspace(4000.,8000,nwave)
dwave_mean = 0.02*np.random.uniform(size=(nspec, nwave))
dwave_eigenvectors = 0.02*np.ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skycorr_rw(self):\n from ..skycorr import SkyCorr\n from ..io.skycorr import read_skycorr, write_skycorr\n nspec, nwave = 5,10\n wave = np.linspace(4000.,8000,nwave)\n dwave = 0.02*np.random.uniform(size=(nspec, nwave))\n dlsf = 0.1*np.random.uniform(size=(nspec... | [
"0.7754107",
"0.6404881",
"0.61078554",
"0.60682267",
"0.6041646",
"0.5971637",
"0.58480126",
"0.5841975",
"0.58369446",
"0.5787703",
"0.57855725",
"0.57526827",
"0.5738222",
"0.57332444",
"0.5714798",
"0.5708744",
"0.5702368",
"0.5690616",
"0.56835365",
"0.5674624",
"0.56591... | 0.6668062 | 1 |
Checks and verifies that a profile ID exists in an account. | def _verify_profile(self, account_id: str, profile_id: str) -> str:
profile = self.__ingest_profile
if profile_id and self.__ip.ProfileExists(account_id=account_id, profile_id=profile_id):
profile = profile_id
elif self.__ingest_profile=='':
response = self.__ip.GetDefaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_profile_id(profile_id):\n\n if profile_id.startswith('profile-'):\n raise Exception(\"Please specify the profile_id WITHOUT \"\n \"the 'profile-' prefix!\")\n\n if not len(profile_id.split(':')) == 2:\n raise Exception(\"Invalid profile id '%s'\" % profile_id)",... | [
"0.7265466",
"0.7050018",
"0.6820358",
"0.6754577",
"0.6754577",
"0.6724524",
"0.6663727",
"0.64377546",
"0.6430571",
"0.6290764",
"0.6219675",
"0.6121918",
"0.6109837",
"0.60463494",
"0.60305077",
"0.6017357",
"0.59510756",
"0.59183073",
"0.5891092",
"0.5888226",
"0.58774894... | 0.7317047 | 0 |
Constructor Method for the TuringMachine class. Sets up variables that are needed later on | def __init__(self):
#self.loadedTape = DataTape()
#self.tapes = [self.loadedTape, DataTape()] # Does not work properly, appears that the second data tape is mutated
# when the first data tape is loaded. The first is mutated as well.
self.loadedTape = DataTape()
self.states = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.time_limit = None\n self.time_step = None\n self.robot = None\n self.humans = None\n self.global_time = None\n self.human_times = None\n # reward function\n self.discomfort_dist = None\n # simulation configuration\n se... | [
"0.73410964",
"0.69445926",
"0.68720084",
"0.6869775",
"0.68136144",
"0.6763863",
"0.67504984",
"0.67310053",
"0.6712768",
"0.66694045",
"0.6667731",
"0.6658742",
"0.66506886",
"0.66325516",
"0.66000026",
"0.65972173",
"0.6576965",
"0.6576548",
"0.6553791",
"0.6550713",
"0.65... | 0.0 | -1 |
Getter method for fcoe_intf_port_type, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_port_type (fcoeportmodetype) | def _get_fcoe_intf_port_type(self):
return self.__fcoe_intf_port_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_port_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'VF': {'... | [
"0.8051056",
"0.7792575",
"0.72288275",
"0.6150293",
"0.6041543",
"0.5484577",
"0.5432866",
"0.5409918",
"0.5325901",
"0.5197365",
"0.50707614",
"0.49854872",
"0.49697575",
"0.49144801",
"0.4713405",
"0.4644835",
"0.45584172",
"0.45415306",
"0.45038918",
"0.44763583",
"0.4409... | 0.72871447 | 2 |
Setter method for fcoe_intf_port_type, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_port_type (fcoeportmodetype) | def _set_fcoe_intf_port_type(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'VF': {'value': 1}},)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_config_port_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'... | [
"0.8143382",
"0.6781612",
"0.67553",
"0.6368622",
"0.58498234",
"0.57556593",
"0.5675639",
"0.56633955",
"0.5351211",
"0.52635765",
"0.50058377",
"0.4891032",
"0.47703785",
"0.47498578",
"0.46451467",
"0.44948608",
"0.44908768",
"0.44524834",
"0.4349633",
"0.42428276",
"0.423... | 0.8444425 | 0 |
Getter method for fcoe_intf_config_port_type, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_config_port_type (fcoeportmodetype) | def _get_fcoe_intf_config_port_type(self):
return self.__fcoe_intf_config_port_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_config_port_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'... | [
"0.80586994",
"0.7515186",
"0.68059886",
"0.58515155",
"0.5750963",
"0.5223202",
"0.49555752",
"0.4912697",
"0.48633355",
"0.48253986",
"0.47907642",
"0.47013754",
"0.46200275",
"0.43577003",
"0.43428892",
"0.42911908",
"0.42132613",
"0.41622323",
"0.41622323",
"0.41503733",
... | 0.7450858 | 2 |
Setter method for fcoe_intf_config_port_type, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_config_port_type (fcoeportmodetype) | def _set_fcoe_intf_config_port_type(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'VF': {'value'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_port_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'VF': {'... | [
"0.7813417",
"0.6931443",
"0.63029116",
"0.6015535",
"0.5471565",
"0.52631664",
"0.5173173",
"0.50886434",
"0.4956939",
"0.49567676",
"0.4794857",
"0.45545697",
"0.42893758",
"0.42875946",
"0.42641783",
"0.4244385",
"0.40125144",
"0.39792937",
"0.39531386",
"0.3944323",
"0.39... | 0.831486 | 0 |
Getter method for fcoe_intf_port_state, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_port_state (fcoeportstatetype) | def _get_fcoe_intf_port_state(self):
return self.__fcoe_intf_port_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_port_state(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'Up|Down|up|down'}), is_leaf=True, yang_name=\"fcoe-intf-port-state\", rest_name=\"fcoe-intf-port-... | [
"0.839921",
"0.6130078",
"0.599514",
"0.58590853",
"0.5714413",
"0.5183843",
"0.51007974",
"0.48696274",
"0.486906",
"0.45845592",
"0.45627075",
"0.4558156",
"0.4547087",
"0.4543771",
"0.45131266",
"0.45033073",
"0.44825566",
"0.44661865",
"0.43900543",
"0.43886185",
"0.43705... | 0.65548116 | 1 |
Setter method for fcoe_intf_port_state, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_port_state (fcoeportstatetype) | def _set_fcoe_intf_port_state(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'Up|Down|up|down'}), is_leaf=True, yang_name="fcoe-intf-port-state", rest_name="fcoe-intf-port-state", parent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_port_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'VF': {'... | [
"0.6246456",
"0.61275166",
"0.60526997",
"0.580206",
"0.56974936",
"0.5137762",
"0.5063434",
"0.49713424",
"0.49670932",
"0.48840812",
"0.48549578",
"0.48379532",
"0.48231882",
"0.48131737",
"0.47669077",
"0.4766393",
"0.47096592",
"0.4689305",
"0.46871912",
"0.46848094",
"0.... | 0.87347686 | 0 |
Setter method for fcoe_intf_enode_bind_type, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_enode_bind_type (fcoebindingtype) | def _set_fcoe_intf_enode_bind_type(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'Dynamic': {'va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_port_bind_type(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'Dy... | [
"0.7875618",
"0.727677",
"0.67206055",
"0.5603325",
"0.5596447",
"0.50949895",
"0.4880322",
"0.4846305",
"0.48265213",
"0.4757227",
"0.42057988",
"0.41865024",
"0.4074426",
"0.4068658",
"0.40506583",
"0.40251076",
"0.40210083",
"0.39868963",
"0.39502248",
"0.39433393",
"0.391... | 0.8535458 | 0 |
Getter method for fcoe_intf_last_counters_cleared, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_last_counters_cleared (fcoecountersdateandtimetype) | def _get_fcoe_intf_last_counters_cleared(self):
return self.__fcoe_intf_last_counters_cleared | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_fcoe_intf_last_counters_cleared(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'\\\\d{4}-\\\\d{2}-\\\\d{2}\\\\s\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{6}'}), is_leaf=Tru... | [
"0.8274621",
"0.52389777",
"0.44434273",
"0.43921548",
"0.4346704",
"0.42941597",
"0.41779447",
"0.41679916",
"0.41601384",
"0.40750092",
"0.40740252",
"0.40740252",
"0.40740252",
"0.40740252",
"0.40011933",
"0.3986707",
"0.39643925",
"0.39578238",
"0.39565837",
"0.39411446",
... | 0.7203896 | 1 |
Setter method for fcoe_intf_last_counters_cleared, mapped from YANG variable /brocade_fcoe_ext_rpc/fcoe_get_interface/output/fcoe_intf_list/fcoe_intf_last_counters_cleared (fcoecountersdateandtimetype) | def _set_fcoe_intf_last_counters_cleared(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}\\.\\d{6}'}), is_leaf=True, yang_name="fcoe-intf-last-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fcoe_intf_last_counters_cleared(self):\n return self.__fcoe_intf_last_counters_cleared",
"def _set_fcoe_intf_time_since_last_change(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_... | [
"0.67858267",
"0.5287048",
"0.44685853",
"0.43154597",
"0.42330733",
"0.42330733",
"0.42330733",
"0.42330733",
"0.42104033",
"0.42034432",
"0.4159518",
"0.40540287",
"0.40423533",
"0.4024306",
"0.40170476",
"0.3982044",
"0.39757675",
"0.3963731",
"0.39186558",
"0.39063835",
"... | 0.8400588 | 0 |
Read a chunk of arbitrary size from the underlying iterator. To get a chunk of an specific size, use read() | def next_chunk(self):
if self._unconsumed:
data = self._unconsumed.pop()
else:
data = self._iterator.next() # Might raise StopIteration
self._pos += len(data)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def read_chunk(self, size: int = ...) -> bytes:\n ...",
"def read_chunk(fobj, chunk_size = 2048):\n\twhile True:\n\t\tchunk = fobj.read(chunk_size)\n\t\tif not chunk:\n\t\t\treturn\n\t\tyield chunk",
"def chunk_reader(fobj, chunk_size=1024):\r\n while True:\r\n chunk = fobj.read(chunk_si... | [
"0.749934",
"0.7420739",
"0.7403747",
"0.7403747",
"0.73796785",
"0.73646635",
"0.731802",
"0.7266194",
"0.7259843",
"0.7108085",
"0.70661503",
"0.7035308",
"0.70068985",
"0.6972675",
"0.69584864",
"0.6949584",
"0.6914474",
"0.69100386",
"0.6908513",
"0.69002676",
"0.6886174"... | 0.6752034 | 27 |
Get filename from filepath, without extension | def get_filename(filepath):
# Get only the name of the file
filename_ext = os.path.basename(filepath)
# Get the name of the file without the extnesion
filename = os.path.splitext(filename_ext)[0]
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename_from_path(filepath: str) -> str:\n return filepath.split(\"/\")[-1]",
"def getFileName(filepath):\n return os.path.splitext(os.path.basename(filepath))[0]",
"def get_filename(filepath):\n return os.path.basename(filepath)",
"def filePathToFileName(path):\n return os.path.splitext(o... | [
"0.896356",
"0.8794762",
"0.8759393",
"0.8550618",
"0.8506747",
"0.8473875",
"0.84506947",
"0.84304595",
"0.83893317",
"0.8367549",
"0.83488387",
"0.8344622",
"0.8342417",
"0.8300334",
"0.82982105",
"0.82934964",
"0.8199376",
"0.8113464",
"0.80903083",
"0.8065202",
"0.8010373... | 0.86336505 | 3 |
Get current Jikji app instance (singleton) | def getinstance() :
return Jikji.instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(self):\r\n return self._app",
"def app(self):\n return self.__app",
"def get_app(self):\n return Application()",
"def get_app():\n return ApplicationContainer()",
"def get_app(self):\n # First see to connection stack\n ctx = stack.top\n if ctx is not None:\n ... | [
"0.7022946",
"0.6909585",
"0.6885378",
"0.6865627",
"0.6752412",
"0.6739761",
"0.6727853",
"0.670524",
"0.6684982",
"0.6680608",
"0.6640918",
"0.6605816",
"0.6587714",
"0.6579802",
"0.6395235",
"0.6362863",
"0.634971",
"0.6318337",
"0.62827474",
"0.62785834",
"0.6264188",
"... | 0.7870882 | 0 |
Produces a ModuleMesh that is a meshview on a flat module. | def viewOnFlatLayer(layer, dimensions, name = None):
assert max(dimensions) > 1, "At least one dimension needs to be larger than one."
def slicer():
nbunits = reduce(lambda x, y: x*y, dimensions, 1)
insize = layer.indim // nbunits
outsize = layer.outdim // nbunits
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_simpleMesh(self, forceNew = True, skin = False,connect=True,reverseNormal = None,\n deleteHistory=False,loftMode = None ):#'evenCubic'\n _str_func = 'create_simpleMesh'\n log.debug(\"|{0}| >> forceNew: {1} | skin: {2} \".format(_str_func,forceNew,skin)+ '-'*80)\n log.debug... | [
"0.5927819",
"0.5724367",
"0.542731",
"0.5423166",
"0.536348",
"0.5336982",
"0.5306488",
"0.52730125",
"0.5247342",
"0.5201148",
"0.5181533",
"0.5158294",
"0.5146272",
"0.5115982",
"0.5094372",
"0.5084909",
"0.50497425",
"0.5045938",
"0.5037771",
"0.50356483",
"0.502613",
"... | 0.6692638 | 0 |
Explicit definition of the \dot{P_C}=0 nullcline as a function of R | def PcNull(R):
return S*(r2*(K2**B2/(K2**B2 + A**B2))*(R*M)/(K3 + R*M) - gc)/((1+R)*gc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def C(self,X):\n return(\n 0\n )",
"def P0(self):\n if not self.isVaild():\n pass\n temp = ((self.r()**self.C)*self.C) / \\\n (math.factorial(self.C)*(self.C - self.r()))\n temp2 = 0\n for i in range(0, self.C):\n temp3 = ((sel... | [
"0.6183162",
"0.6056789",
"0.60293084",
"0.59416825",
"0.57429683",
"0.5669706",
"0.54638755",
"0.5449276",
"0.5433907",
"0.5428692",
"0.542195",
"0.54043114",
"0.53605354",
"0.53248286",
"0.53247005",
"0.53193086",
"0.5318277",
"0.5265432",
"0.5265432",
"0.5259762",
"0.52592... | 0.7142484 | 0 |
Returns the currently set maximum value (possibly None). | def _get_minimum_value(self):
if hasattr(self, '_minimum_value'):
return self._minimum_value
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_maximum_value(self):\n if hasattr(self, '_maximum_value'):\n return self._maximum_value\n return None",
"def _get_maximum(self):\n return self._maximum",
"def max_value(self) -> Optional[int]:\n return self._max_value",
"def get_max_value(self):\n max_va... | [
"0.88843125",
"0.85860467",
"0.8434912",
"0.8421805",
"0.83940834",
"0.836873",
"0.8240477",
"0.8231998",
"0.8142923",
"0.8142889",
"0.8142889",
"0.8139409",
"0.8139409",
"0.8116432",
"0.81082994",
"0.80477697",
"0.80477697",
"0.8030885",
"0.8020046",
"0.7968676",
"0.7968676"... | 0.0 | -1 |
Returns the currently set maximum value (possibly None). | def _get_maximum_value(self):
if hasattr(self, '_maximum_value'):
return self._maximum_value
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_maximum(self):\n return self._maximum",
"def max_value(self) -> Optional[int]:\n return self._max_value",
"def get_max_value(self):\n max_value = max(self.values)\n return max_value",
"def get_max(self):\n return self._max",
"def get_max(self):\n return se... | [
"0.85860467",
"0.8434912",
"0.8421805",
"0.83940834",
"0.836873",
"0.8240477",
"0.8231998",
"0.8142923",
"0.8142889",
"0.8142889",
"0.8139409",
"0.8139409",
"0.8116432",
"0.81082994",
"0.80477697",
"0.80477697",
"0.8030885",
"0.8020046",
"0.7968676",
"0.7968676",
"0.79242283"... | 0.88843125 | 0 |
Draws an ATLAS stamp on the plot, with an optional categorization label. It is recommended that you construct the Plot with plot_header = True in order to make space for the label. | def draw_atlas_label(self,
luminosity,
atlas_label = None,
custom_label = None,
#ks_test = None,
sqrt_s = 13):
# Change context to the plot pad
self._plot.cd()
# Create t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_plot(self):\n\n self.scat = self.config.ax.scatter(self.lons[0, 0], self.lats[0, 0], c=self.z[0,0]\n # , vmax=self.vmax\n # , vmin=self.vmin\n # ,cmap='coolwarm'\n ... | [
"0.56773174",
"0.56621134",
"0.56262916",
"0.56035256",
"0.5463994",
"0.54572076",
"0.54562086",
"0.5413711",
"0.53690505",
"0.5334882",
"0.53057516",
"0.5299678",
"0.5295519",
"0.5293242",
"0.5280161",
"0.52774656",
"0.5276829",
"0.52705336",
"0.52685344",
"0.52595264",
"0.5... | 0.622134 | 0 |
Alter a schedule specified by `schedule_id`, using data from `body`. | def update_schedule(connection, id, body, fields=None, error_msg=None):
# id to eventId conversion - API Problem
if 'event' in body:
body['event']['eventId'] = body['event'].pop('id')
response = connection.put(
url=f'{connection.base_url}/api/schedules/{id}',
json=body,
par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_schedule(schedule_name):\n data = flask.request.data\n\n try:\n new_schedule = json.loads(data)\n except json.decoder.JSONDecodeError as e:\n return 'Could not parse request', 400\n\n if not 'commands' in new_schedule:\n return 'Expecting sche... | [
"0.7354776",
"0.7090472",
"0.6640301",
"0.6558381",
"0.6478293",
"0.63841724",
"0.6233958",
"0.6232261",
"0.622503",
"0.618329",
"0.6052349",
"0.60507196",
"0.5979977",
"0.59755456",
"0.59755456",
"0.58944255",
"0.5835383",
"0.58063114",
"0.57333946",
"0.5717815",
"0.5650378"... | 0.7712626 | 0 |
Returns an encoder stack with a bidirectional RNN, and a variable number of unidirectional forward RNNs. | def get_recurrent_encoder(config: RecurrentEncoderConfig, prefix: str) -> 'Encoder':
# TODO give more control on encoder architecture
encoder_seq = EncoderSequence([], config.dtype)
if config.conv_config is not None:
encoder_seq.append(ConvolutionalEmbeddingEncoder, config=config.conv_config,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _encode_back(self):\n with tf.variable_scope('passage_encoding'):\n self.sep_p_encodes, _ = rnn('bi-lstm', self.p_emb, self.p_length, self.hidden_size)\n with tf.variable_scope('question_encoding'):\n self.sep_q_encodes, _ = rnn('bi-lstm', self.q_emb, self.q_length, self.hid... | [
"0.62921214",
"0.6152014",
"0.6146975",
"0.61363024",
"0.5964755",
"0.58740026",
"0.5870952",
"0.5852826",
"0.584824",
"0.583192",
"0.5823621",
"0.5765163",
"0.5760164",
"0.5715746",
"0.5669614",
"0.5657765",
"0.5648189",
"0.56349456",
"0.5593638",
"0.5574034",
"0.5567483",
... | 0.57248735 | 13 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return self.config.num_embed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return self.encoders[-1].get_num_hidden() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self):
return self.num_hidden | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self):
return self.rnn_config.num_hidden | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return self.rnn_config.num_hidden | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return self.config.model_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Return the representation size of this encoder. | def get_num_hidden(self) -> int:
return self.output_dim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sizeof(self):\n\n return self.__format_length__",
"def size(self):\n\n return str(self.size)",
"def encoded_length(self):\n return self._encoded_length",
"def encoded_length(self):\n return self._encoded_length",
"def get_representation_size(self):\n raise NotImplemen... | [
"0.79590875",
"0.7866396",
"0.78656197",
"0.78656197",
"0.78209794",
"0.77256167",
"0.7675482",
"0.7661071",
"0.76324844",
"0.7620493",
"0.7613925",
"0.7605913",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.7603256",
"0.75979304",
"0.75979304",
"0.7595728",
"0.75947... | 0.0 | -1 |
Test that apply() unwraps tensors from the PennyLane version of NumPy into standard NumPy arrays (or floats) | def test_apply_unwrap_tensor():
dev = _aws_device(wires=1)
a = anp.array(0.6) # array
b = np.array(0.5, requires_grad=True) # tensor
operations = [qml.RY(a, wires=0), qml.RX(b, wires=[0])]
rotations = []
circuit = dev.apply(operations, rotations)
angles = [op.operator.angle for op in ci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_apply(buffer, window, out):\n buffer = np.array(buffer, dtype=np.float32)\n windows.apply(buffer, window)\n assert_almost_equal(buffer, np.array(out))",
"def check_numpy(x):\n if isinstance(x, torch.Tensor):\n x = x.detach().cpu().numpy()\n x = np.asarray(x)\n assert isinstance(... | [
"0.6168927",
"0.6074523",
"0.59755695",
"0.5941053",
"0.5852421",
"0.57503957",
"0.5671111",
"0.56408507",
"0.5554108",
"0.5526539",
"0.5504762",
"0.54822814",
"0.54719603",
"0.54283196",
"0.54266405",
"0.5399018",
"0.53985965",
"0.5382649",
"0.5381062",
"0.53508204",
"0.5346... | 0.6427505 | 0 |
Tests that QPUs can not be instantiated with 0 shots | def test_qpu_0_shots():
_aws_device(wires=2, shots=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_qpu_default_shots():\n dev = _aws_device(wires=2, shots=None)\n assert dev.shots == AwsDevice.DEFAULT_SHOTS_QPU\n assert not dev.analytic",
"def test_specific_qubit_pauli_error_gate_100percent(self):\n qr = QuantumRegister(2, 'qr')\n cr = ClassicalRegister(2, 'cr')\n circui... | [
"0.7581652",
"0.67088866",
"0.66683674",
"0.6629296",
"0.6621476",
"0.6586297",
"0.65550697",
"0.6550297",
"0.64997643",
"0.64091253",
"0.63097745",
"0.630529",
"0.62902224",
"0.62881327",
"0.6277001",
"0.6250644",
"0.622557",
"0.6197892",
"0.6173236",
"0.6171491",
"0.6166997... | 0.79683083 | 0 |
x float tensor of shape [batch, seq_len, d_model]. | def forward(self, x: torch.Tensor):
x = self.linear1(x)
x = torch.relu(x)
x = self.linear2(x)
x = self.dropout(x)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n #batch_size = x.shape[0]\n out = self.model(x)\n return out",
"def forward_tensor(self, x):\n pass",
"def call(self, x):\n return tf.expand_dims(x, axis=self._axis)",
"def forward(self, x: torch.Tensor) -> torch.Tensor:\n return self.model(x)"... | [
"0.6446506",
"0.64428467",
"0.6336393",
"0.62963545",
"0.6293684",
"0.62800884",
"0.62632227",
"0.62191164",
"0.6195653",
"0.6181104",
"0.6143407",
"0.61284506",
"0.6114006",
"0.6105606",
"0.6090656",
"0.60760707",
"0.60760707",
"0.6071021",
"0.6062217",
"0.6058594",
"0.60496... | 0.0 | -1 |
Decoder with no encoderdecoder attention. | def __init__(
self,
d_model: int,
nheads: int,
ff_dim: int,
bias: bool = False,
dropout: float = 0.2,
):
super().__init__()
self.d_model = d_model
self.nheads = nheads
self.ff_dim = ff_dim
self.norm1 = nn.LayerNorm(d_model)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self,\n decoder_input,\n encoder_output,\n encoder_decoder_attention_bias,\n decoder_self_attention_bias,\n hparams,\n cache=None,\n nonpadding=None,\n losses=None):\n del losses\n # TODO(dehghani): ena... | [
"0.71551603",
"0.71526474",
"0.7087195",
"0.7040449",
"0.69701254",
"0.6661029",
"0.6492162",
"0.6482781",
"0.64456064",
"0.63679385",
"0.6230319",
"0.6205093",
"0.6202365",
"0.6101765",
"0.6094369",
"0.60764",
"0.6049317",
"0.6041653",
"0.6011802",
"0.6002954",
"0.5995679",
... | 0.0 | -1 |
src tensor of shape [batch, src_len, d_model]. trg tensor of shape [batch, trg_len]. masks tensors of shape [batch, src/trg_len]. | def forward(
self, src: torch.Tensor, trg: torch.Tensor, trg_mask: torch.Tensor = None
):
if trg_mask is None:
trg_mask = trg.new_ones(trg.size(0), 1, 1, trg.size(1))
trg_mask = (
trg_mask.float()
* torch.tril(trg_mask.new_ones(trg.size(1), trg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, trg, enc_src, src_mask):\n\n # trg = [batch size, trg len, hid_dim]\n # enc_src = [batch size, src len, hid dim]\n # src_mask = [batch size, 1, 1, src len]\n\n batch_size = trg.shape[0]\n trg_len = trg.shape[1]\n device = trg.device\n\n trg_mask = ... | [
"0.67183626",
"0.65506434",
"0.65410197",
"0.6527903",
"0.6474584",
"0.63583034",
"0.6174872",
"0.61451703",
"0.609807",
"0.60844886",
"0.6068216",
"0.6045314",
"0.60416436",
"0.58707994",
"0.58375835",
"0.5706309",
"0.56968117",
"0.56968117",
"0.56958866",
"0.56877655",
"0.5... | 0.7043651 | 0 |
Checks if the passed object is an instance of PanoptesPluginContext | def valid_panoptes_plugin_context(cls, context):
return context and isinstance(context, PanoptesPluginContext) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_P(self):\n return isinstance(self,P)",
"def check(self, context):\r\n return context.config.preset is not None",
"def verify_type(self, obj):\n return isinstance(obj, self.type_)",
"def is_plugin_data(cls, attributes):\n return attributes.get('metadata', {}).get('class') ==... | [
"0.60661125",
"0.58273405",
"0.5664702",
"0.5534895",
"0.5478102",
"0.5464704",
"0.5458923",
"0.5446103",
"0.5419161",
"0.53293157",
"0.53253907",
"0.5320412",
"0.53070647",
"0.52944535",
"0.52437514",
"0.52066964",
"0.52066964",
"0.52066964",
"0.51984173",
"0.51903284",
"0.5... | 0.8560241 | 0 |
Basic constructor for the map primitive | def __init__(self, data, resolution, top_left_pose):
self.data = data
self.resolution = resolution
self.top_left_pose = top_left_pose | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init___0(self, map):\n super(LongObjectHashMap, self).__init__()\n self.__init__()\n putAll(map)",
"def __init__(self):\n self.map = [None] * 103",
"def __init__(self):\n self.map = {}",
"def __init__(self):\n self.map = defaultdict(list)",
"def __init__(self... | [
"0.76419413",
"0.76188797",
"0.752662",
"0.74930096",
"0.7461971",
"0.74615866",
"0.7261055",
"0.71733224",
"0.7148753",
"0.7133767",
"0.71126103",
"0.70883733",
"0.7082782",
"0.698769",
"0.6954992",
"0.6951003",
"0.6903234",
"0.6901209",
"0.6850771",
"0.6808656",
"0.67641115... | 0.0 | -1 |
Attempts to get any existing layer items | def _existingLayerItems(self, layer):
if layer is None:
return None
elif not isinstance(layer, int) or layer < 0:
raise ValueError("Invalid layer number requested (%s)" % (layer))
else:
return self._layer_items.get(layer, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layers(self, content_retriever):\n pass",
"def get_layers(self, content_retriever):\n pass",
"def test_layer_API(self):\n\n # Exceptions\n exclude = ['get_topN', 'get_bins',\n 'get_geotransform',\n 'get_nodata_value',\n '... | [
"0.6044332",
"0.6044332",
"0.59457266",
"0.5930599",
"0.5883651",
"0.58722234",
"0.5736728",
"0.5678872",
"0.56253475",
"0.5535645",
"0.5523494",
"0.5516176",
"0.53959376",
"0.53693944",
"0.5305345",
"0.5287448",
"0.52849513",
"0.5275673",
"0.5268572",
"0.5265903",
"0.5263545... | 0.77434623 | 0 |
Keep the words given by the index, discard the others. | def keep_words(self, idx):
print('{} words have been removed'.format(self.data.shape[1] - len(idx)))
self.data = self.data[:, idx]
self.vocab = [self.vocab[i] for i in idx] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_index_from_word(self,word,index):\r\n\r\n # with shelf\r\n if self.using_shelf:\r\n\r\n if word in self.word_dict:\r\n\r\n self.word_dict[word].discard(str(index))\r\n\r\n\r\n #with database\r\n if self.using_database:\r\n\r\n value_tuple... | [
"0.70964223",
"0.67362326",
"0.6478225",
"0.61909133",
"0.61036986",
"0.6103299",
"0.6055491",
"0.59667224",
"0.5945954",
"0.58509797",
"0.58509004",
"0.5845882",
"0.5828585",
"0.5750246",
"0.5740832",
"0.5734754",
"0.5731833",
"0.57256293",
"0.57241994",
"0.5720679",
"0.5706... | 0.7574333 | 0 |
Check if input is Sequence/Mapping of DataArrays | def _is_DataArrays(data):
if isinstance(data, (Dataset, DataArray)):
return True
if isinstance(data, Mapping):
for da in data.values():
if not isinstance(da, DataArray):
raise TypeError("Please provide List/Mapping of DataArrays")
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_sequence_like(self, data):\n return hasattr(data, \"__iter__\") and hasattr(data, \"__getitem__\")",
"def is_sequence(arg):\n\n # np.float{16,32,64} and np.int types have __getitem__ defined\n # this is a long-standing bug in NumPy and unlikely to be fixed\n # todo: backport to qmmlpack, ... | [
"0.69071925",
"0.65686095",
"0.64295447",
"0.638452",
"0.63047",
"0.6232553",
"0.62203234",
"0.621806",
"0.6190134",
"0.61846906",
"0.616345",
"0.61288524",
"0.60988694",
"0.60488075",
"0.6021936",
"0.59689575",
"0.5963893",
"0.5953377",
"0.5940061",
"0.588992",
"0.5876231",
... | 0.7664965 | 0 |
Check if two DataArrays are actually the same object | def _id_of_DataArrays_equal(da1, da2):
if id(da1) == id(da2):
raise ValueError(
f"Cannot add the same object ({da1.name}) twice! Create a copy first."
)
if id(da1.values) == id(da2.values):
raise ValueError(
f"DataArrays {da1.name} and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_to_same_memory(a, b):\n return a.data == b.data",
"def __eq__(self, other):\n if type(other) != type(self):\n return False\n # Check the properties inherited from Data\n if not super(DataND, self).__eq__(other):\n return False\n if other.axes != self... | [
"0.7411421",
"0.7320676",
"0.7313426",
"0.71965325",
"0.7184788",
"0.71106595",
"0.7065235",
"0.7051908",
"0.70444745",
"0.7034551",
"0.70208997",
"0.7015334",
"0.7014282",
"0.69433284",
"0.6926412",
"0.6918636",
"0.69100344",
"0.6909162",
"0.6896321",
"0.6892489",
"0.6852135... | 0.804266 | 0 |
Returns a copy of this dataset. | def copy(self) -> "Dataset":
return deepcopy(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return Dataset(self._data.copy(), self.gene_meta.copy(), self.n_genes)",
"def _shallow_clone_dataset(self: TAvalancheDataset) -> TAvalancheDataset:\n dataset_copy = copy.copy(self)\n dataset_copy._flat_data = self._flat_data._shallow_clone_dataset()\n return dataset_... | [
"0.8857337",
"0.82170564",
"0.8131767",
"0.79133457",
"0.7808679",
"0.7549012",
"0.7549012",
"0.7549012",
"0.7549012",
"0.7540313",
"0.7540313",
"0.7540313",
"0.7502626",
"0.7484705",
"0.7474548",
"0.7474548",
"0.74715805",
"0.7460092",
"0.7440346",
"0.7440346",
"0.7440346",
... | 0.9074816 | 0 |
Return a new Dataset whose data is given by integer indexing along the specified dimension(s). The spatial parameters available depend on the dims | def isel(self, idx=None, axis=0, **kwargs):
res = [da.isel(idx=idx, axis=axis, **kwargs) for da in self]
return Dataset(data=res, validate=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset_index(\n dataset: xr.Dataset, time_dataset_index: xr.Dataset\n) -> xr.Dataset:\n dataset_index = xr.Dataset()\n n_steps = len(next(iter(time_dataset_index.values())))\n for dim, var in dataset.items():\n if set(var.dims).intersection(time_dataset_index.keys()):\n time_... | [
"0.6478632",
"0.628727",
"0.6144092",
"0.6098765",
"0.60866433",
"0.60715306",
"0.60066354",
"0.5991912",
"0.59387374",
"0.590088",
"0.57965875",
"0.57598543",
"0.57264274",
"0.5723095",
"0.5700616",
"0.5670162",
"0.56694627",
"0.5651681",
"0.5651372",
"0.5646153",
"0.5637619... | 0.58314294 | 10 |
Return a new Dataset whose data is given by selecting index labels along the specified dimension(s). In contrast to Dataset.isel, indexers for this method should use labels instead of integers. | def sel(
self,
**kwargs,
) -> "Dataset":
res = [da.sel(**kwargs) for da in self]
return Dataset(data=res, validate=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indice(*args, **kwargs) -> Dataset:\n log.deprecation_warning(old=\"icclim.indice\", new=\"icclim.index\")\n return index(*args, **kwargs)",
"def load_data_from_inds(data_set, inds):\n\n data = torch.cat([data_set[ind_][0].unsqueeze_(0) for ind_ in inds], 0)\n labels = torch.cat([torch.from_numpy... | [
"0.6403845",
"0.62546545",
"0.62271094",
"0.61380714",
"0.6017653",
"0.5663151",
"0.5646254",
"0.5644117",
"0.5622867",
"0.5588687",
"0.55874145",
"0.5536909",
"0.552302",
"0.5478834",
"0.5449994",
"0.54461396",
"0.5429619",
"0.54257214",
"0.53976583",
"0.5384586",
"0.5380403... | 0.55643296 | 11 |
Compute the qth quantile of the data along the specified axis. Wrapping np.quantile | def quantile(self, q, *, axis=0, **kwargs) -> "Dataset":
return self._quantile(q, axis=axis, func=np.quantile, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...):\n ...",
"def quantile(self, axis: str = 'rows', q: float = 0.5) -> 'DataFrame':\n if not utils.is_number(q):\n raise TypeError('`q` must be ... | [
"0.7494937",
"0.7309685",
"0.6968797",
"0.6904502",
"0.6880963",
"0.68196636",
"0.68166226",
"0.6816248",
"0.66577446",
"0.6647553",
"0.6601084",
"0.65913415",
"0.65878165",
"0.6561251",
"0.6499777",
"0.64836454",
"0.6477691",
"0.64760286",
"0.64487004",
"0.64157647",
"0.6347... | 0.7994218 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.