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 |
|---|---|---|---|---|---|---|
r"""Compute the output of a linear layer. | def forward(ctx, A, W, b=None):
ctx.save_for_backward(A, W, b)
return torch.matmul(A, W.T) + (b if b is not None else 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear(x,output_dim):\n w=tf.get_variable(\"w\", [x.get_shape()[1], output_dim])\n b=tf.get_variable(\"b\", [output_dim], initializer=tf.constant_initializer(0.0))\n return tf.nn.xw_plus_b(x,w,b)",
"def linear(x, n_output, name=None, activation=None, reuse=None):\n\tprint('##Start linear##')\n\tif len(x.g... | [
"0.7213798",
"0.70892876",
"0.696493",
"0.66992986",
"0.6674015",
"0.6674015",
"0.66593486",
"0.66119796",
"0.6595454",
"0.65917253",
"0.65233433",
"0.6507848",
"0.65016234",
"0.6433543",
"0.6366506",
"0.63618094",
"0.6340412",
"0.6328408",
"0.6291966",
"0.62913454",
"0.62856... | 0.0 | -1 |
r"""Applies the sigmoid function elementwise to ``Z``. | def forward(ctx, Z):
ctx.save_for_backward(Z)
return 1. / (1. + torch.exp(-Z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(Z):\n\n A = 1 / (1 + np.exp(-Z))\n\n return A",
"def sigmoid(z):\r\n \r\n return 1.0 / (1.0+np.exp(-z))",
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def sigmoid(self, z):\n return 1 / (1 + np.exp(-z))",
"def sigmoid(z):\n\treturn 1.0/(1.0+np.exp(-z))",
"def si... | [
"0.8287348",
"0.8128875",
"0.81049514",
"0.8090079",
"0.8077359",
"0.79981047",
"0.7996011",
"0.7989291",
"0.79889256",
"0.7972748",
"0.79694295",
"0.7961432",
"0.79567045",
"0.7941996",
"0.7927172",
"0.7923021",
"0.7917617",
"0.7904141",
"0.7903342",
"0.7858465",
"0.7857274"... | 0.0 | -1 |
Evaluate a tensor. Takes care of the variations between graphs produced with and without resource variables when determining the name of the operation to run. | def _eval(self, tensor):
name = tensor if isinstance(tensor, str) else tensor.name
index = "0"
if ":" in name:
name, index = name.split(":")
if variable_scope.resource_variables_enabled():
name = name + "/Read/ReadVariableOp"
return self.evaluate(name + ":" + index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _evaluate(tensor):\n if context.executing_eagerly():\n return tensor.numpy()\n return ops.get_default_session().run(tensor)",
"def __call__(self, in_tensor):\n return self.evaluate(in_tensor)",
"def run_op_node(input_data, op_fun, *args):\n runtime = get_runtime()\n comp_args = []... | [
"0.70626074",
"0.66995996",
"0.5918291",
"0.584094",
"0.5816497",
"0.5801724",
"0.57763773",
"0.5745237",
"0.5728183",
"0.5655665",
"0.5647421",
"0.56424975",
"0.561995",
"0.5610754",
"0.55959916",
"0.5574136",
"0.55692333",
"0.55690277",
"0.5543135",
"0.55420953",
"0.5522697... | 0.7994263 | 0 |
Create and save a user with the given username, email, and password. | def _create_user(self, **fields):
email = fields.pop('email')
password = fields.get('password1')
if not email:
raise ValueError("Email address is required")
email = self.normalize_email(email)
user = self.model(email=email, **fields)
user.set_password(password... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.85967624",
"0.8440654",
"0.84264034",
"0.8423257",
"0.84063315",
"0.8393488",
"0.83878005",
"0.8341707",
"0.8334409",
"0.8332718",
"0.83224976",
"0.8288854",
"0.82819235",
"0.827502",
"0.8269521",
"0.8267577",
"0.81637603",
"0.8159258",
"0.8158126",
"0.81423306",
"0.813671... | 0.7885976 | 86 |
Test that when at the root node, the builder cannot move up to a parent. | def test_cannot_move_up_on_root():
builder = TreeBuilder()
builder.create_root(0)
with pytest.raises(ValueError):
builder.move_to_parent() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_operate_on_rootless():\n builder = TreeBuilder()\n\n with pytest.raises(ValueError):\n builder.move_to_root()\n\n with pytest.raises(ValueError):\n builder.move_to_parent()\n\n with pytest.raises(ValueError):\n builder.build()",
"def test_parent_assigment():\n ... | [
"0.80656445",
"0.76942825",
"0.76755255",
"0.7234567",
"0.69586444",
"0.68467796",
"0.68467796",
"0.6786187",
"0.67849195",
"0.6755974",
"0.667053",
"0.66338646",
"0.65786994",
"0.655644",
"0.6553044",
"0.6545688",
"0.65415907",
"0.64951444",
"0.64194375",
"0.62602377",
"0.61... | 0.8599833 | 0 |
Returns a value from the environ if not found None | def get_from_environ(key: str, default: Any = None) -> str:
return os.environ.get(key, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(key:str):\n value = environ.get(key)\n if value == None or len(str(value)) == 0:\n raise ValueError('Missing env: '+key)\n return value",
"def environment_value(self, name):\n if not os.environ.has_key(name):\n return None\n return os.environ[name]",
"def maybe_envi... | [
"0.8427169",
"0.78881174",
"0.7684489",
"0.7656262",
"0.7378371",
"0.7303838",
"0.72640556",
"0.7244024",
"0.7195593",
"0.7187488",
"0.6996409",
"0.696521",
"0.6931788",
"0.6893517",
"0.6852815",
"0.68523973",
"0.68098325",
"0.6804754",
"0.6804754",
"0.67927414",
"0.67871755"... | 0.7455593 | 4 |
Assert that variadic_addition will calculate the sum of one argument. | def test_variadic_addition_identity(self):
self.assertIdentity(variadic_addition) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_variadic_addition_takes_arbitrary_arguments(self):\n self.assertEqual(\n variadic_addition(1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15), 90\n )",
"def test_add():\n l = [1, 2, 3, 4]\n assert s7.add(*l) == sum(l)\n assert s7.add(100, 200) == 300\n assert s7.add(1.0, 2.0... | [
"0.8388786",
"0.732367",
"0.70822567",
"0.67872864",
"0.6695529",
"0.6589702",
"0.6503258",
"0.63732165",
"0.63460994",
"0.6308285",
"0.62551105",
"0.62551105",
"0.62551105",
"0.6245928",
"0.62261504",
"0.6217164",
"0.61945015",
"0.61721706",
"0.61636084",
"0.6118056",
"0.611... | 0.7746421 | 1 |
Derivative of the sigmoid function. | def sigmoid_prime(self, z):
return self.sigmoid(z)*(1-self.sigmoid(z)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_der... | [
"0.8474031",
"0.8449428",
"0.83956724",
"0.8347549",
"0.8347549",
"0.8298076",
"0.80540663",
"0.7752118",
"0.7706634",
"0.7497549",
"0.74651986",
"0.7451908",
"0.7400593",
"0.7383443",
"0.7382016",
"0.73468137",
"0.73205775",
"0.7308369",
"0.71908224",
"0.71130663",
"0.709060... | 0.0 | -1 |
Compute softmax values for each sets of scores in x. | def softmax(x):
sf = np.exp(x)
sf = sf / np.sum(sf, axis=0)
return sf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7797849",
"0.77619886",
"0.776157",
"0.775872",
"0.76596135",
"0.76596135",
"0.76596135",
"0.76596135",
"0.7586109",
"0.7431844",
"0.74070084",
"0.7393994",
"0.7358404",
"0.7317217",
"0.7268679",
"0.72625685",
"0.7261825",
"0.7256399",
"0.7229374",
"0.7214238",
"0.72015005... | 0.0 | -1 |
Automatically used test fixture. Returns the application instanceundertest with a valid app context. | def app(request, bundles):
unchained._reset()
options = request.keywords.get('options', None)
if options is not None:
options = {k.upper(): v for k, v in options.kwargs.items()}
app = AppFactory.create_app(TEST, bundles=bundles + [
'flask_unchained.bundles.api',
'flask_unchained.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application(self):\n if not ApplicationFixture._test_app:\n app = self.APP_CLASS()\n app.run_tests()\n ApplicationFixture._test_app = app\n return ApplicationFixture._test_app",
"def app(request) -> Application:\n global fixture\n if fixture is None:\n ... | [
"0.8229665",
"0.77517885",
"0.76738375",
"0.76550806",
"0.76550806",
"0.76550806",
"0.7606498",
"0.75622696",
"0.7492555",
"0.74473107",
"0.7395727",
"0.7337389",
"0.73343986",
"0.7300206",
"0.72882015",
"0.7240712",
"0.7208225",
"0.7191826",
"0.7150085",
"0.7027735",
"0.6980... | 0.0 | -1 |
Load config from yaml and save it in the config instance for global access | def load_config(cls, path) -> "__Config":
unused_input = []
cfg = cls.get_config()
with open(path, 'r') as stream:
input_config = yaml.safe_load(stream)
for key, val in input_config.items():
if key in cfg.__dict__.keys(): # save all keys from yaml that ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config():\n global config\n with open('config.yml', 'r') as file:\n config = yaml.load(file)",
"def get_cfg_from_yaml(self):\n try:\n with open(self.parsed_cfg_path, 'r') as cfg_yaml:\n self.from_yaml_cfg_dict = yaml.load(cfg_yaml)\n except Exception as exc:\... | [
"0.7837642",
"0.7560857",
"0.74684334",
"0.7433986",
"0.732899",
"0.72980505",
"0.72698826",
"0.72456163",
"0.71487606",
"0.7145049",
"0.7140125",
"0.7127902",
"0.7107965",
"0.7076843",
"0.7030257",
"0.7017999",
"0.70123",
"0.7004554",
"0.6978879",
"0.6972185",
"0.6962203",
... | 0.7093497 | 13 |
Handle special conversions from yaml input to a needed formats (i.e. splitting of lists) | def __set_special_config_values(cfg: __Config, config: dict) -> "__Config":
cfg.file_name_plane_masks = lambda i: str(i) + config['file_name_plane_mask_suf']
cfg.file_name_planercnn_image = lambda i: str(i) + config['file_name_planercnn_image_suf']
cfg.dir_results = f"{cfg.edge_detection_type}" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(input_path, output_path):\n save_plist(fix_data(load_yaml(input_path)), output_path)",
"def fix_data(yaml_data):\n if isinstance(yaml_data, list):\n return [ fix_data(item) for item in yaml_data ]\n if isinstance(yaml_data, dict):\n return { str(key): fix_data(yaml_data[key]) for key in yaml... | [
"0.59312576",
"0.58612114",
"0.5806065",
"0.57241744",
"0.56119037",
"0.559588",
"0.55898786",
"0.55414873",
"0.55237",
"0.5372691",
"0.53628504",
"0.53414845",
"0.5340044",
"0.5303953",
"0.52994215",
"0.52956086",
"0.5260427",
"0.5216376",
"0.5205074",
"0.5198229",
"0.518418... | 0.0 | -1 |
Test that a ValueError is raised if the number of filtering thresholds does not match the number of inputs. | def test_wrong_number_of_filter_thresholds(self, threshold, n_inputs):
with pytest.raises(ValueError, match="If multiple filter_thresholds are provided"):
coefficients(self.dummy_fn, n_inputs, 2, True, filter_threshold=threshold) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_data_over_specifying_percentiles(self):\n msg = \"Cannot specify both no_of_percentiles and percentiles\"\n with self.assertRaisesRegex(ValueError, msg):\n Plugin().process(self.cube, no_of_percentiles=3, percentiles=[25, 50, 75])",
"def test_invalid_filter_shape(self):\r\... | [
"0.65735257",
"0.6527854",
"0.64310807",
"0.64217633",
"0.6373864",
"0.6349007",
"0.6343449",
"0.6284737",
"0.626901",
"0.6247218",
"0.6184793",
"0.6180708",
"0.61522615",
"0.6136882",
"0.61206365",
"0.60906637",
"0.60882515",
"0.6014135",
"0.59994555",
"0.5978101",
"0.596705... | 0.78769076 | 0 |
Get the original content of the record | def get_content(self) -> dict:
return self.__content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content(self):\n return self.original.content",
"def getOriginal(self,):\n\t\treturn self.original;",
"def get_raw_data(self):\n return self.content",
"def record(self):\r\n return self._record",
"def contents(self):\n return self._data[:]",
"def serialize(self):\n ... | [
"0.7346124",
"0.68440586",
"0.66728055",
"0.6607294",
"0.66009665",
"0.6546696",
"0.65346885",
"0.6501923",
"0.63668644",
"0.63537383",
"0.63537383",
"0.63107395",
"0.62645787",
"0.62445724",
"0.6230589",
"0.6204916",
"0.6178013",
"0.61338687",
"0.6116896",
"0.6110234",
"0.61... | 0.0 | -1 |
Descarrega quantidade q de mercadoria de tipo m. | def unload(t, m, q):
for i in range(len(t)-1,-1,-1):
wagon = t[i]
if wagon[0] == m:
sub = q if wagon[1] >= q else wagon[1]
wagon[1] -= sub
q -= sub
if wagon[1] == 0:
del t[i]
if q == 0:
return 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drop_units(q):\n try:\n return q.magnitude\n except:\n return q",
"def __float__(self):\n return self.q[0]",
"def M(self, q):\n\n # check for function in dictionary\n if self._M is None:\n self._M = self._calc_M()\n parameters = tuple(q)\n ... | [
"0.59588253",
"0.5955158",
"0.57766813",
"0.5771213",
"0.5715782",
"0.56833005",
"0.55756694",
"0.55608565",
"0.5541552",
"0.5541552",
"0.55163884",
"0.55125165",
"0.54853994",
"0.54330796",
"0.5413882",
"0.5412439",
"0.5408189",
"0.5373485",
"0.5369357",
"0.53633475",
"0.535... | 0.0 | -1 |
Gets the path of the hwmon directory for the CPU, depending on architecture. | def get_hwmon_dir(architecture):
hwmons = listdir("/sys/class/hwmon")
for hwmon in hwmons:
name_file = open("/sys/class/hwmon/" + hwmon + "/name")
name = name_file.read().strip()
if(name == "coretemp" or name == "cpu_thermal"):
# The name file seems to always... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_path():\n\n path = rs.DocumentPath()\n name = rs.DocumentName()\n \n if gc.operating_system == \"mac\":\n\n path = path[:-len(name)] + \"_system.dat\"\n\n elif gc.operating_system == \"win\":\n\n i = path.rfind(\"\\\\\")\n\n path = path[:i] + \"/_system.dat\" \n\n... | [
"0.58475286",
"0.5715946",
"0.5705581",
"0.5703303",
"0.56880635",
"0.56794685",
"0.56205666",
"0.55710655",
"0.5570294",
"0.5537565",
"0.5529088",
"0.5529088",
"0.55217963",
"0.55210656",
"0.55130935",
"0.55007106",
"0.5495716",
"0.548964",
"0.54728615",
"0.5468049",
"0.5443... | 0.85837257 | 0 |
Sets the spectator to the same transform as the scene camera. | def move_spectator(self) -> None:
spectator = self.carla_world.get_spectator()
if spectator is not None and self.scene_camera is not None:
spectator.set_transform(self.scene_camera.get_transform()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_camera(self, camera=None):\n if camera is not None:\n self._camera = camera\n self.shared_program.frag['camtf'] = self._camera.transform\n self.update()",
"def set_transform(self, tf):\n self.camera.SetTransform(tf)",
"def camera(self):\n self.spect... | [
"0.6693841",
"0.66800976",
"0.64893913",
"0.6344048",
"0.6251404",
"0.6172365",
"0.6122815",
"0.61193395",
"0.6099135",
"0.6093104",
"0.6051362",
"0.6020996",
"0.59894603",
"0.59174716",
"0.58880925",
"0.5878636",
"0.5878628",
"0.58343166",
"0.58264905",
"0.5802502",
"0.57766... | 0.82007277 | 0 |
Fill input_neurons, connections and weights. | def build_model(self):
for link in self.links:
# if from neuron is input to graph, add it to input_neurons set
if self.is_input_neuron(link.from_neuron_id):
self.input_neurons.add(link.from_neuron_id)
# add weight to neuron
if link.to_neuron_id not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n self._q_neuron.h(self._weights) \n self._q_neuron.x(self._weights)",
"def init_weights(self, input_size=None, min_w=WEIGHT_MIN,\n max_w=WEIGHT_MAX):\n if input_size is None:\n input_size = self.INPUT_SIZE\n\n # Add a bias weight... | [
"0.6922085",
"0.65574825",
"0.65548414",
"0.6432655",
"0.638703",
"0.6355265",
"0.63380504",
"0.6245074",
"0.6233093",
"0.62165856",
"0.6196188",
"0.61734307",
"0.6107525",
"0.6087016",
"0.6066833",
"0.60574853",
"0.60570484",
"0.6044387",
"0.6037842",
"0.6036587",
"0.6014161... | 0.6002942 | 21 |
Check if all inputs are initialized. | def check(self, input_neuron_ids, operations):
for input_neuron_id in input_neuron_ids:
if not self.is_input_neuron(input_neuron_id) and input_neuron_id not in operations:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_initialized(self) -> bool:\n return len(self) > 0",
"def is_initialized(self) -> bool:\n return (\n (self._exchange_params_by_currency_id is not None)\n and (self._utility_params_by_good_id is not None)\n and (self._transaction_fees is not None)\n )",... | [
"0.7155936",
"0.7022412",
"0.6944451",
"0.6889416",
"0.6787919",
"0.6779226",
"0.6707976",
"0.66438425",
"0.6642688",
"0.65858096",
"0.65681076",
"0.65224695",
"0.6513835",
"0.6378538",
"0.6378391",
"0.6349154",
"0.6322953",
"0.6277625",
"0.6260629",
"0.62543523",
"0.6239616"... | 0.0 | -1 |
Check if 'neuron_id' neuron is output of graph. | def is_output_neuron(self, neuron_id):
for neuron in self.neurons:
if neuron.neuron_id == neuron_id:
if neuron.neuron_type == NeuronType.OUTPUT:
return True
else:
return False
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsOutputNode(self) -> bool:\n return self._isoutput",
"def is_input_neuron(self, neuron_id):\n for neuron in self.neurons:\n if neuron.neuron_id == neuron_id:\n if neuron.neuron_type == NeuronType.INPUT:\n return True\n else:\n ... | [
"0.6803226",
"0.65187585",
"0.64247227",
"0.5959485",
"0.58313245",
"0.58175683",
"0.55500925",
"0.55288786",
"0.55288786",
"0.54958236",
"0.548239",
"0.5438185",
"0.54235095",
"0.5401488",
"0.5381885",
"0.5344562",
"0.53232133",
"0.52948266",
"0.52546155",
"0.52187455",
"0.5... | 0.8887838 | 0 |
Presents the impedance image as a matplotlib plot. | def show_image(self, mask=np.ones((32, 32), dtype=bool)):
image = np.copy(self.__image)
image[~mask] = 0
plt.imshow(image, aspect="auto")
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n\t\tself.plotOfSpect().plot()",
"def _plot(self):\r\n fig = plt.figure()\r\n\r\n # Take out second component of intensity if needed\r\n # if self._vna.isTwoComponents():\r\n # intensitySimplified = []\r\n # for i in range(len(self._intensity)):\r\n ... | [
"0.71757454",
"0.7069358",
"0.70326424",
"0.6797299",
"0.66540664",
"0.6649923",
"0.6649877",
"0.6641772",
"0.6579315",
"0.65746015",
"0.65706444",
"0.6557098",
"0.65474236",
"0.65076804",
"0.645055",
"0.645055",
"0.645055",
"0.6423081",
"0.6389563",
"0.63769984",
"0.63727075... | 0.0 | -1 |
Normalize a quaternion and return the angle and axis params metrology object | def angle_and_axis(basis):
q = matrix.col(basis.orientation).normalize()
return q.unit_quaternion_as_axis_and_angle(deg=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def QuatNormalize(wxyz):\n return wxyz/rigmech.QuatMag(wxyz)",
"def normalize(q):\n quaternion = q[0]\n norm = 1/np.sqrt((q[0,0]**2)+(q[0,1]**2)+(q[0,2]**2)+(q[0,3]**2))\n #q = norm*q\n #print('norm =', norm)\n '''q[0,0] = norm*q[0,0]\n q[0,1] = norm*q[0,1]\n q[0,2] = norm*q[0,2]\n ... | [
"0.69806147",
"0.695885",
"0.6355016",
"0.6323433",
"0.6288712",
"0.62210345",
"0.61655045",
"0.6087717",
"0.6079813",
"0.60514957",
"0.59941876",
"0.5927876",
"0.5924707",
"0.58999366",
"0.5896174",
"0.58830637",
"0.5868482",
"0.5856674",
"0.57758343",
"0.5760341",
"0.574608... | 0.54842 | 37 |
Creates an external reference from the given instruction. instruction the instruction operandIndex the operand index on the instruction libraryName the name of the library being referred externalLabel the name of function in the library being referred externalAddr the address of the function in the library being referr... | def createExternalReference(self, instruction: ghidra.program.model.listing.Instruction, operandIndex: int, libraryName: unicode, externalLabel: unicode, externalAddr: ghidra.program.model.address.Address, refType: ghidra.program.model.symbol.RefType) -> ghidra.program.model.symbol.Reference:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createExternalReference(self, instruction: ghidra.program.model.listing.Instruction, operandIndex: int, libraryName: unicode, externalLabel: unicode, externalAddr: ghidra.program.model.address.Address) -> ghidra.program.model.symbol.Reference:\n ...",
"def createExternalReference(self, data: ghidra.pr... | [
"0.87265146",
"0.72131056",
"0.6449024",
"0.61487925",
"0.60750306",
"0.6015299",
"0.5728191",
"0.5526734",
"0.53574234",
"0.48581973",
"0.4724259",
"0.47221014",
"0.4610276",
"0.4562738",
"0.45174286",
"0.4422584",
"0.44051036",
"0.43972808",
"0.4387322",
"0.43597233",
"0.43... | 0.8897761 | 0 |
Finds the first occurrence of the byte starting from the address. If the start address is null, then the find will start from the minimum address of the program. start the address to start searching value the byte to search for the first address where the byte was found | def find(self, start: ghidra.program.model.address.Address, value: int) -> ghidra.program.model.address.Address:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findBytes(self, start: ghidra.program.model.address.Address, byteString: unicode) -> ghidra.program.model.address.Address:\n ...",
"def searchBytes(self, needle, start_address=0, end_address=None):\n if start_address % 8:\n raise InputStreamError(\n \"Unable to search ... | [
"0.7684179",
"0.671259",
"0.6681241",
"0.6663498",
"0.6631953",
"0.6589137",
"0.6444344",
"0.6444344",
"0.6444344",
"0.63786626",
"0.6363347",
"0.6025047",
"0.6010249",
"0.598586",
"0.58571136",
"0.5827753",
"0.58260363",
"0.5787293",
"0.57830197",
"0.5758782",
"0.5749183",
... | 0.7353447 | 1 |
Finds the first occurrence of the byte array sequence starting from the address. If the start address is null, then the find will start from the minimum address of the program. start the address to start searching values the byte array sequence to search for the first address where the byte was found, or null if the by... | def find(self, start: ghidra.program.model.address.Address, values: List[int]) -> ghidra.program.model.address.Address:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findBytes(self, start: ghidra.program.model.address.Address, byteString: unicode) -> ghidra.program.model.address.Address:\n ...",
"def findBytes(self, start: ghidra.program.model.address.Address, byteString: unicode, matchLimit: int, alignment: int) -> List[ghidra.program.model.address.Address]:\n ... | [
"0.7610344",
"0.6906941",
"0.6847389",
"0.68451124",
"0.68314576",
"0.6481463",
"0.6454282",
"0.5965639",
"0.5957974",
"0.5928105",
"0.58109456",
"0.5749604",
"0.5678065",
"0.56771994",
"0.5615114",
"0.5615114",
"0.5615114",
"0.56086063",
"0.55819035",
"0.5539475",
"0.5514472... | 0.5986277 | 7 |
Returns the defined data after the specified data or null if no data exists. data preceeding data the defined data after the specified data or null if no data exists | def getDataAfter(self, data: ghidra.program.model.listing.Data) -> ghidra.program.model.listing.Data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataBefore(self, data: ghidra.program.model.listing.Data) -> ghidra.program.model.listing.Data:\n ...",
"def after(self,p):\r\n \r\n current = self.tail #test from the tail node\r\n \r\n if p == current: #if the tail node = p\r\n return 'null' #there cannot be... | [
"0.6330083",
"0.5869026",
"0.5868395",
"0.58567077",
"0.5699867",
"0.5693346",
"0.5595454",
"0.5493963",
"0.5408712",
"0.5387112",
"0.53542656",
"0.5330714",
"0.53301686",
"0.5301835",
"0.5296236",
"0.52721006",
"0.5197284",
"0.5168569",
"0.51626754",
"0.51546884",
"0.5115191... | 0.7079639 | 0 |
Returns the EOL comment at the specified address. The comment returned is the raw text of the comment. Contrastingly, calling { GhidraScriptgetEOLCommentAsRendered(Address)} will return the text of the comment as it is rendered in the display. address the address to get the comment the EOL comment at the specified addr... | def getEOLComment(self, address: ghidra.program.model.address.Address) -> unicode:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setEOLComment(self, address: ghidra.program.model.address.Address, comment: unicode) -> bool:\n ...",
"def ast_eol_comment(cls, source):\n x = QTRegEx.EOL_COMMENT.search(source)\n if x:\n x = x.group(1).strip()\n return x",
"def GetEOLChar(self):\n m_id = self.... | [
"0.613984",
"0.60569876",
"0.57944787",
"0.5420539",
"0.54104763",
"0.5302519",
"0.51999146",
"0.50140053",
"0.50017864",
"0.49963728",
"0.49786046",
"0.49392855",
"0.487796",
"0.48645896",
"0.48497188",
"0.48276246",
"0.47933087",
"0.47920048",
"0.47890398",
"0.47745374",
"0... | 0.80111694 | 0 |
Returns the nonfunction namespace with the given name contained inside the specified parent namespace. Pass null for namespace to indicate the global namespace. parent the parent namespace, or null for global namespace namespaceName the requested namespace's name the namespace with the given name or null if not found | def getNamespace(self, parent: ghidra.program.model.symbol.Namespace, namespaceName: unicode) -> ghidra.program.model.symbol.Namespace:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace(self):\n name = self._name if self._name is not None else '<unnamed>'\n if self._parent is None:\n return name\n return '.'.join([self._parent.namespace, name])",
"def prefixForNamespace (self, namespace):\n pfxs = self.__inScopePrefixes.get(namespace)\n ... | [
"0.58934504",
"0.5573258",
"0.5546954",
"0.55426323",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5481534",
"0.5445565",
... | 0.7320554 | 0 |
Returns the next nondefault primary symbol defined after the given symbol. symbol the symbol to use as a starting point the next nondefault primary symbol | def getSymbolAfter(self, symbol: ghidra.program.model.symbol.Symbol) -> ghidra.program.model.symbol.Symbol:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_symbol(self):\r\n try:\r\n return self.rule.rightside[self.position]\r\n except IndexError:\r\n return None",
"def getSymbolBefore(self, symbol: ghidra.program.model.symbol.Symbol) -> ghidra.program.model.symbol.Symbol:\n ...",
"def resolve_symbol(self, symbo... | [
"0.6791333",
"0.66894335",
"0.6456969",
"0.6284626",
"0.62626696",
"0.615903",
"0.6131903",
"0.6094906",
"0.6085728",
"0.5935433",
"0.5836635",
"0.5812803",
"0.58067584",
"0.5806348",
"0.57906795",
"0.57865864",
"0.5655314",
"0.5638283",
"0.56314355",
"0.5613195",
"0.5597356"... | 0.69825155 | 0 |
Returns the PRIMARY symbol at the specified address, or null if no symbol exists. address the symbol address the PRIMARY symbol at the specified address, or null if no symbol exists | def getSymbolAt(self, address: ghidra.program.model.address.Address) -> ghidra.program.model.symbol.Symbol:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSymbolAt(self, address: ghidra.program.model.address.Address, name: unicode) -> ghidra.program.model.symbol.Symbol:\n ...",
"def getSymbolAt(self, address: ghidra.program.model.address.Address, name: unicode, namespace: ghidra.program.model.symbol.Namespace) -> ghidra.program.model.symbol.Symbol:\n... | [
"0.7118037",
"0.69664484",
"0.6934358",
"0.6779083",
"0.6627822",
"0.6524853",
"0.64565396",
"0.6299099",
"0.6273917",
"0.6176535",
"0.5900066",
"0.5848714",
"0.5844718",
"0.58184236",
"0.577251",
"0.5723215",
"0.5671811",
"0.55998236",
"0.555378",
"0.5506501",
"0.54620534",
... | 0.7498988 | 0 |
Returns the symbol with the specified address and name, or null if no symbol exists. address the symbol address name the symbol name the symbol with the specified address and name, or null if no symbol exists Since the same label name can be at the same address if in a different namespace, this method is ambiguous. Use... | def getSymbolAt(self, address: ghidra.program.model.address.Address, name: unicode) -> ghidra.program.model.symbol.Symbol:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSymbolAt(self, address: ghidra.program.model.address.Address, name: unicode, namespace: ghidra.program.model.symbol.Namespace) -> ghidra.program.model.symbol.Symbol:\n ...",
"def getSymbolAt(self, address: ghidra.program.model.address.Address) -> ghidra.program.model.symbol.Symbol:\n ...",
... | [
"0.8543169",
"0.8059816",
"0.73156196",
"0.70097697",
"0.6767718",
"0.6752568",
"0.6725872",
"0.6598749",
"0.6469485",
"0.63727325",
"0.635471",
"0.62335163",
"0.6111809",
"0.6063753",
"0.60246027",
"0.59156114",
"0.5914255",
"0.5818512",
"0.58126324",
"0.5704142",
"0.5614748... | 0.83530015 | 1 |
Returns the previous nondefault primary symbol defined before the given symbol. symbol the symbol to use as a starting point the previous nondefault primary symbol | def getSymbolBefore(self, symbol: ghidra.program.model.symbol.Symbol) -> ghidra.program.model.symbol.Symbol:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_symbol(self):\r\n if self.position == 0:\r\n return None\r\n return self.rule.rightside[self.position-1]",
"def getSymbolBefore(self, address: ghidra.program.model.address.Address) -> ghidra.program.model.symbol.Symbol:\n ...",
"def getSymbolAfter(self, symbol: ghid... | [
"0.7149908",
"0.7057071",
"0.6860729",
"0.60245156",
"0.57987744",
"0.5740305",
"0.565969",
"0.5576915",
"0.5576642",
"0.5552749",
"0.55387074",
"0.5532993",
"0.55312043",
"0.5488226",
"0.5456294",
"0.5441495",
"0.5435977",
"0.54265016",
"0.5386329",
"0.53825027",
"0.532813",... | 0.8077678 | 0 |
Returns a list of all the symbols with the given name in the given namespace. name the name of the symbols to retrieve. namespace the namespace containing the symbols, or null for the global namespace. a list of all the symbols with the given name in the given namespace. | def getSymbols(self, name: unicode, namespace: ghidra.program.model.symbol.Namespace) -> List[ghidra.program.model.symbol.Symbol]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSymbol(self, name: unicode, namespace: ghidra.program.model.symbol.Namespace) -> ghidra.program.model.symbol.Symbol:\n ...",
"def get_symbol(self, name, include_stab=False, fuzzy=False): # pylint: disable=arguments-differ\n result = []\n for sym in self.symbols:\n\n if sym.... | [
"0.6175663",
"0.5840355",
"0.57483524",
"0.5426379",
"0.5353111",
"0.5346719",
"0.52792764",
"0.52465034",
"0.5242173",
"0.5199163",
"0.49872243",
"0.4956325",
"0.4953265",
"0.4941523",
"0.4894663",
"0.48839074",
"0.48797667",
"0.4856329",
"0.4833302",
"0.48122814",
"0.479823... | 0.802945 | 0 |
filter boxes that has score smaller than threshold | def yolo_filter_boxes(box_confidence: torch.Tensor, boxes: torch.Tensor, box_class_probs: torch.Tensor, threshold: float=.6):
batch_size, num_anchors, _, conv_height, conv_width = box_confidence.shape
box_scores = box_confidence * box_class_probs
box_classes = torch.argmax(box_scores, dim=2, keepdim=True... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_boxes(self, min_score, boxes, scores, classes):\n n = len(classes)\n idxs = []\n for i in range(n):\n if scores[i] >= min_score:\n idxs.append(i)\n \n filtered_boxes = boxes[idxs, ...]\n filtered_scores = scores[idxs, ...]\n fil... | [
"0.7665852",
"0.75487936",
"0.7507825",
"0.72497696",
"0.720242",
"0.6917024",
"0.6892944",
"0.6862352",
"0.6843755",
"0.68054396",
"0.68054396",
"0.67897505",
"0.66567194",
"0.6593515",
"0.65733504",
"0.6560851",
"0.6532275",
"0.64954346",
"0.6458464",
"0.64407855",
"0.64195... | 0.6337917 | 22 |
Test that the delete cases will not delete the cases in dryrun mode | def test_delete_cases_with_dry_run(cli_runner, base_context, base_store: Store, helpers, caplog):
# GIVEN a database with a case
case_obj = helpers.add_case(base_store)
case_id = case_obj.internal_id
sample = helpers.add_sample(base_store)
helpers.add_relationship(store=base_store, case=case_obj, sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_case(self):\n pass",
"def test_delete_run(self):\n pass",
"def test_delete(self):\n pass",
"def test_delete1(self):\n pass",
"def test_delete_no_target(self):\n # login as library manager\n self.authenticate(self.user)\n\n # remove all works\... | [
"0.80769163",
"0.7961243",
"0.72582936",
"0.7074489",
"0.70567155",
"0.70036924",
"0.6998968",
"0.6951286",
"0.6896803",
"0.6825236",
"0.6816766",
"0.6739138",
"0.6710673",
"0.6662743",
"0.66344184",
"0.6621065",
"0.6616519",
"0.6612717",
"0.6605979",
"0.6579803",
"0.65721023... | 0.79310447 | 2 |
Given a matrix of number values, normalize them so that a column sums to 1. | def normalize_matrix(matrix):
nrows = matrix.shape[0]
for col in xrange(matrix.shape[1]):
tot = float(sum(matrix[:,col]))
for row in xrange(nrows):
try:
matrix[row][col] = matrix[row][col]/tot
except ZeroDivisionError:
pass
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(input_matrix):\n\n row_sums = input_matrix.sum(axis=1)\n try:\n assert (np.count_nonzero(row_sums)==np.shape(row_sums)[0]) # no row should sum to zero\n except Exception:\n raise Exception(\"Error while normalizing. Row(s) sum to zero\")\n new_matrix = input_matrix / row_sum... | [
"0.7700347",
"0.76937604",
"0.756896",
"0.7331542",
"0.7152201",
"0.7131932",
"0.71012294",
"0.69983745",
"0.6818826",
"0.6818233",
"0.67679644",
"0.6751211",
"0.6596699",
"0.6595785",
"0.656642",
"0.6537499",
"0.6512866",
"0.65080035",
"0.6505867",
"0.65034187",
"0.6479857",... | 0.7848991 | 0 |
Function to convert a document to a sequence of words and returns a list | def text_to_wordlist(text, remove_stopwords=True):
text = re.sub("[^a-zA-Z]"," ", text)
words = text.lower().split()
if remove_stopwords:
stops = set(stopwords.words("english"))
words = [w for w in words if not w in stops]
b=[]
stemmer = english_stemmer
for word in words:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docs_to_list(documents):\n \n texts = [] \n for doc in documents:\n texts.append(doc.split())\n print ((\"The collection of documents contains {} documents\").format(len(texts)))\n return texts",
"def txt_to_word_list(text):\r\n return [w for w in text.split()]",
"def tokenize(docu... | [
"0.7170209",
"0.6887493",
"0.66005576",
"0.65981084",
"0.65715927",
"0.652522",
"0.64660454",
"0.6453031",
"0.6432074",
"0.63567215",
"0.6354902",
"0.63389206",
"0.62874836",
"0.6284675",
"0.6282173",
"0.6270023",
"0.6256448",
"0.6236804",
"0.62314737",
"0.62290454",
"0.62191... | 0.61522865 | 29 |
Initialises the sensor and enables all measurement parameters. See AtlasI2C's (super class) __init__ method for more information. | def __init__(self,
address: int = 100,
moduletype: str = 'EC',
name: str = 'Atlas_EC_sensor',
bus: int = 1) -> None:
# The .initialise method is called in AtlasI2C __init__
# to initialise the sensors.
super().__init__(mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._read_calibration_data()\n self.configure_sensor(\n TemperatureOversamplings.x08,\n PressureOversamplings.x16,\n HumidityOversamplings.x08,\n IIRFilterCoefficients.FC_003,\n 250,\n 250)",
"def __init__(self... | [
"0.7845792",
"0.7606045",
"0.72833455",
"0.7201857",
"0.71302646",
"0.71291983",
"0.7098983",
"0.70801467",
"0.6971887",
"0.69636655",
"0.69636565",
"0.6954733",
"0.69105434",
"0.690402",
"0.6874347",
"0.68508506",
"0.6831174",
"0.6827517",
"0.68186814",
"0.68120044",
"0.6808... | 0.68389744 | 16 |
Explicitly returns the total dissolved solids measurement. | def get_tds(self) -> float:
try:
datalist = self.get_data()
data = datalist[1]
if data.endswith('\x00'):
data = data.rstrip('\x00')
return float(data)
else:
return float(data)
except Exception as err:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dilutionneeded(self) -> float:\n return self.stock*1.0/self.final",
"def get_fuel_total_saved (self):\n #~ print self.lost_heat_recovery\n #~ print self.intertie_offset_generation_fuel_used\n #~ print self.pre_intertie_generation_fuel_used\n #~ gen_eff = self.cd[\"diesel ge... | [
"0.6529836",
"0.6011122",
"0.59037113",
"0.58882004",
"0.58798367",
"0.5844591",
"0.580448",
"0.5773368",
"0.5756803",
"0.5729787",
"0.5667339",
"0.5657882",
"0.56354713",
"0.5595755",
"0.55272204",
"0.5501631",
"0.5491182",
"0.54693073",
"0.54688644",
"0.5458824",
"0.5443795... | 0.0 | -1 |
Explicitly returns the salinity measurement. | def get_salinity(self) -> float:
try:
datalist = self.get_data()
data = datalist[2]
if data.endswith('\x00'):
data = data.rstrip('\x00')
return float(data)
else:
return float(data)
except Exception as err:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_salinity(self):\n params = self.parameters.keys()\n if 'seawater_salinity' in params:\n return\n else:\n if 'water_specific_conductance' in params:\n T = 25.0\n cond = self.data['water_specific_conductance'].rescale(\n ... | [
"0.760306",
"0.5587526",
"0.5300624",
"0.5255387",
"0.52513635",
"0.52203405",
"0.52034074",
"0.5162999",
"0.51577854",
"0.515597",
"0.50914776",
"0.50687623",
"0.5066604",
"0.5053226",
"0.504799",
"0.5038065",
"0.50285316",
"0.5027283",
"0.5007004",
"0.496554",
"0.49261078",... | 0.7601538 | 1 |
Initialises the sensor and enables all measurement parameters. See AtlasI2C's (super class) __init__ method for more information. | def __init__(self,
address: int = 97,
moduletype: str = 'DO',
name: str = 'Atlas_DO_sensor',
bus: int = 1) -> None:
# The .initialise method is called in AtlasI2C __init__
# to initialise the sensors.
super().__init__(addre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._read_calibration_data()\n self.configure_sensor(\n TemperatureOversamplings.x08,\n PressureOversamplings.x16,\n HumidityOversamplings.x08,\n IIRFilterCoefficients.FC_003,\n 250,\n 250)",
"def __init__(self... | [
"0.78472203",
"0.7606708",
"0.7284979",
"0.7203293",
"0.71310127",
"0.7130854",
"0.7100856",
"0.7082016",
"0.6971095",
"0.69658184",
"0.69632506",
"0.69555503",
"0.6911671",
"0.6904986",
"0.6874802",
"0.6851362",
"0.6839328",
"0.6832115",
"0.6828661",
"0.68184614",
"0.6812309... | 0.6459062 | 38 |
Explicitly returns the dissolved oxygen measurement. | def get_do(self) -> float:
try:
datalist = self.get_data()
data = datalist[0]
if data.endswith('\x00'):
data = data.rstrip('\x00')
return float(data)
else:
return float(data)
except Exception as err:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oxygen(self):\n index = self.var_index(3)\n return self.var_data(index)",
"def get_dispersion_virial(self):\n if self._dispersion_virial is None:\n self._dispersion_virial = self._get_potential(self._system._dispersion)\n return self._dispersion_virial",
"def oxygen_a... | [
"0.6885519",
"0.64309716",
"0.5605628",
"0.55727637",
"0.54383785",
"0.5405203",
"0.5381485",
"0.53641456",
"0.534154",
"0.531464",
"0.5292176",
"0.5291588",
"0.52827483",
"0.5280829",
"0.52319384",
"0.52185345",
"0.5200969",
"0.5181798",
"0.51625675",
"0.5154534",
"0.5154534... | 0.0 | -1 |
Test deleting selected points appropriately sets self._value Rewrite of test_move | def test_move(self, data, moving_indices, move_offset):
assume(np.max(moving_indices) < data.shape[0])
unmoved = copy(data)
layer = Points(data)
move_offset = move_offset[: data.shape[1]]
layer._move(moving_indices, list(np.zeros(data.shape[1])))
layer._move(moving_ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deleting_selected_value_changes(self, data, delete_indices, value):\n assume(np.max(delete_indices) < data.shape[0])\n\n delete_indices = set(delete_indices)\n\n layer = Points(data)\n\n ###\n layer._value = value\n layer.selected_data = delete_indices\n\n ... | [
"0.7307506",
"0.6426495",
"0.6357649",
"0.62664276",
"0.60979724",
"0.6059317",
"0.59759307",
"0.59188384",
"0.58752334",
"0.58727556",
"0.5840528",
"0.5825067",
"0.57859707",
"0.5696689",
"0.56769335",
"0.5652956",
"0.5629492",
"0.56145257",
"0.5607111",
"0.55676585",
"0.556... | 0.53934395 | 33 |
Test setting layer opacity. Rewrite of test_opacity | def test_opacity(self, data, opacity_first, opacity_second):
layer = Points(data)
assert layer.opacity == 1.0
layer.opacity = opacity_first
assert layer.opacity == opacity_first
layer = Points(data, opacity=opacity_first)
assert layer.opacity == opacity_first
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _opacity(self):\n item = self.item()\n return 255 if item is None else item.getColor().alpha()",
"def opacity( self ):\n if ( self.isIsolateHidden() ):\n return 0.1\n \n opacity = super(XNode, self).opacity()\n layer = self.layer()\n if ( layer ):\n... | [
"0.6738789",
"0.6504551",
"0.64268667",
"0.6392363",
"0.630561",
"0.6244044",
"0.6160838",
"0.61147153",
"0.6098059",
"0.6053272",
"0.60126334",
"0.6004274",
"0.5933818",
"0.58957654",
"0.5846547",
"0.5846546",
"0.5839202",
"0.5818461",
"0.58132416",
"0.5718951",
"0.56912255"... | 0.8052617 | 0 |
Create a queue on the AMQP broker. | def create_queue(queue_name: str,
durable: bool = True,
auto_delete: bool = False,
priorities: int = 0,
extra_properties: Optional[dict] = None,
server_url: Optional[str] = None):
method_arguments: dict = {
'type': 'queue',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)",
"def create_queue(self):\n queue_name = self.generate_name()\n try:\n queue = self.sqs.create_queue(QueueName=queue_name)\n except Excepti... | [
"0.7759953",
"0.76620424",
"0.74547446",
"0.7429228",
"0.7178029",
"0.7092181",
"0.70384204",
"0.6845889",
"0.66713524",
"0.6627267",
"0.6616343",
"0.660781",
"0.66019297",
"0.65967005",
"0.6575529",
"0.6512098",
"0.64877474",
"0.64667577",
"0.64409876",
"0.64339656",
"0.6416... | 0.7877893 | 0 |
Delete a queue on the AMQP broker. | def delete_queue(queue_name: str, server_url: Optional[str] = None):
rpc = RemoteProcedure(handle_QMF2_exception,
'qmf.default.direct', server_url)
delete_queue_message = create_QMF2_method_invoke(
get_broker_id(server_url),
'delete', {
'type': 'queue',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_queue(client, vhost, queue):\n client.delete_queue(vhost, queue)",
"def delete_queue(self, queue_name):\n amqp_session = self.__broker.getAmqpSession()\n amqp_session.queue_delete(queue_name)",
"def delete_queue(self, queue_name: str) -> None:\n if queue_name is None:\n ... | [
"0.82714295",
"0.82505196",
"0.7890872",
"0.7628092",
"0.7511307",
"0.7469112",
"0.73099965",
"0.7265564",
"0.7256086",
"0.721045",
"0.70689774",
"0.70460916",
"0.70426184",
"0.6875064",
"0.67025673",
"0.6665003",
"0.66619",
"0.6634253",
"0.6565379",
"0.6474421",
"0.64101213"... | 0.8067389 | 2 |
Get square of distance between two points. | def distance2(pnt1, pnt2):
return vtk.vtkMath().Distance2BetweenPoints(pnt1, pnt2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSquareDistance(p1, p2):\n dx = p1[0] - p2[0]\n dy = p1[1] - p2[1]\n\n return dx * dx + dy * dy",
"def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n return np.sqrt(np.sum(np.square(point1 - point2)))",
"def square_distance(a, b):\n return np.sum((a-b)**2)",
"def ... | [
"0.81768996",
"0.8067343",
"0.80050296",
"0.7846344",
"0.7824697",
"0.7808076",
"0.7787563",
"0.7758734",
"0.7727676",
"0.7725046",
"0.77139354",
"0.76792496",
"0.76538515",
"0.7629471",
"0.7613899",
"0.75866926",
"0.75758594",
"0.7572667",
"0.7556853",
"0.75537413",
"0.75418... | 0.0 | -1 |
Is the given coordinate pair part of the active piece | def active_piece_contains(self, coords):
return coords in self.active_piece | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_piece(self, piece_coords):\n for piece in self.game_pieces:\n if piece_coords[0] == piece.x and piece_coords[1] == piece.y:\n return True\n return False",
"def contains(self, coord):\n # print(coord, self.position, self.size)\n return (0 <= coord[0] - ... | [
"0.76000845",
"0.7163134",
"0.69195896",
"0.6903677",
"0.6842184",
"0.68064684",
"0.6801216",
"0.6784371",
"0.67597187",
"0.67326784",
"0.673139",
"0.67246735",
"0.6704293",
"0.669905",
"0.6688759",
"0.6688759",
"0.66738254",
"0.664887",
"0.6647306",
"0.66369826",
"0.66253597... | 0.7501437 | 1 |
gets the remainder of the column/row above the given empty cell | def get_column(self, coords, direction):
column = []
x = coords[0]
y = coords[1]
if direction == "down":
# x, 0-y
for i in range(y):
column.append((x, i))
elif direction == "right":
# 0-x, y
for i in range(x):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_empty_cell(self):\n for row in range(len(self.grid)):\n for col in range(len(self.grid[0])):\n if self.grid[row][col] == 0:\n return (row, col)\n return None",
"def find_next_empty_cell(grid):\n for i, row in enumerate(grid):\n for... | [
"0.7481746",
"0.7114454",
"0.67013234",
"0.6699966",
"0.6622391",
"0.64713335",
"0.6275769",
"0.62751794",
"0.6237867",
"0.6218996",
"0.6191269",
"0.61250126",
"0.61220396",
"0.605921",
"0.6053533",
"0.605102",
"0.6016683",
"0.6012835",
"0.60045093",
"0.5979188",
"0.5955467",... | 0.0 | -1 |
Yield successive tuples of slices defining patches of size `patch_size` from an array of dimensions `image_size`. The iteration starts from position `start_pos` in the array, or starting at the origin if this isn't provided. Each patch is chosen in a contiguous grid using a rwomajor ordering. | def iter_patch_slices(
image_size: Sequence[int],
patch_size: Sequence[int] | int,
start_pos: Sequence[int] = (),
overlap: Sequence[float] | float = 0.0,
padded: bool = True,
) -> Generator[tuple[slice, ...], None, None]:
# ensure patch_size has the right length
patch_size_ = get_valid_patc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_patch_position(\n image_size: Sequence[int],\n patch_size: Sequence[int] | int | np.ndarray,\n start_pos: Sequence[int] = (),\n overlap: Sequence[float] | float | Sequence[int] | int = 0.0,\n padded: bool = False,\n):\n\n # ensure patchSize and startPos are the right length\n ndim = l... | [
"0.79494125",
"0.78087676",
"0.77887726",
"0.76846087",
"0.75430304",
"0.74918747",
"0.7249222",
"0.71247375",
"0.69680864",
"0.69318867",
"0.6909812",
"0.6898304",
"0.6818335",
"0.661632",
"0.6593302",
"0.65002316",
"0.6497946",
"0.6409765",
"0.6404261",
"0.63914025",
"0.635... | 0.83764684 | 0 |
Enumerate all slices defining ND patches of size `patch_size` from an `image_size` input image. | def dense_patch_slices(
image_size: Sequence[int], patch_size: Sequence[int], scan_interval: Sequence[int], return_slice: bool = True
) -> list[tuple[slice, ...]]:
num_spatial_dims = len(image_size)
patch_size = get_valid_patch_size(image_size, patch_size)
scan_interval = ensure_tuple_size(scan_interval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_patch_slices(\n image_size: Sequence[int],\n patch_size: Sequence[int] | int,\n start_pos: Sequence[int] = (),\n overlap: Sequence[float] | float = 0.0,\n padded: bool = True,\n) -> Generator[tuple[slice, ...], None, None]:\n\n # ensure patch_size has the right length\n patch_size_ = ... | [
"0.7469868",
"0.7403781",
"0.7036501",
"0.6862141",
"0.6742089",
"0.6596665",
"0.65735835",
"0.65036523",
"0.64497256",
"0.64474744",
"0.6357949",
"0.63469946",
"0.6300832",
"0.62972224",
"0.6189399",
"0.6175041",
"0.6127527",
"0.60534996",
"0.6023363",
"0.60180706",
"0.59890... | 0.7299419 | 2 |
Yield successive tuples of upper left corner of patches of size `patch_size` from an array of dimensions `image_size`. The iteration starts from position `start_pos` in the array, or starting at the origin if this isn't provided. Each patch is chosen in a contiguous grid using a rwomajor ordering. | def iter_patch_position(
image_size: Sequence[int],
patch_size: Sequence[int] | int | np.ndarray,
start_pos: Sequence[int] = (),
overlap: Sequence[float] | float | Sequence[int] | int = 0.0,
padded: bool = False,
):
# ensure patchSize and startPos are the right length
ndim = len(image_size)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_patch_slices(\n image_size: Sequence[int],\n patch_size: Sequence[int] | int,\n start_pos: Sequence[int] = (),\n overlap: Sequence[float] | float = 0.0,\n padded: bool = True,\n) -> Generator[tuple[slice, ...], None, None]:\n\n # ensure patch_size has the right length\n patch_size_ = ... | [
"0.76095116",
"0.73907936",
"0.73022735",
"0.7009488",
"0.69722086",
"0.69101614",
"0.6772371",
"0.66692054",
"0.66471446",
"0.66047215",
"0.65790373",
"0.6522832",
"0.65132904",
"0.65106493",
"0.6433519",
"0.6314024",
"0.62763387",
"0.6177838",
"0.615064",
"0.61351013",
"0.6... | 0.78211236 | 0 |
Yield successive patches from `arr` of size `patch_size`. The iteration can start from position `start_pos` in `arr` but drawing from a padded array extended by the `patch_size` in each dimension (so these coordinates can be negative to start in the padded region). If `copy_back` is True the values from each patch are ... | def iter_patch(
arr: NdarrayOrTensor,
patch_size: Sequence[int] | int = 0,
start_pos: Sequence[int] = (),
overlap: Sequence[float] | float = 0.0,
copy_back: bool = True,
mode: str | None = NumpyPadMode.WRAP,
**pad_opts: dict,
) -> Generator[tuple[NdarrayOrTensor, np.ndarray], None, None]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_patch(\n arr: np.ndarray, patch_size, start_pos=(), copy_back: bool = True, mode: str = \"wrap\", **pad_opts,\n):\n # ensure patchSize and startPos are the right length\n patch_size = get_valid_patch_size(arr.shape, patch_size)\n start_pos = ensure_tuple_size(start_pos, arr.ndim)\n\n # pad ... | [
"0.83385926",
"0.68494123",
"0.6806408",
"0.6449312",
"0.63380164",
"0.6212348",
"0.60338795",
"0.6004707",
"0.5822879",
"0.57809365",
"0.5778019",
"0.5760178",
"0.57520765",
"0.5708167",
"0.5698727",
"0.560494",
"0.5602756",
"0.5590409",
"0.5579679",
"0.55707896",
"0.5552527... | 0.8053652 | 1 |
Given an image of dimensions `image_size`, return a patch size tuple taking the dimension from `patch_size` if this is not 0/None. Otherwise, or if `patch_size` is shorter than `image_size`, the dimension from `image_size` is taken. This ensures the returned patch size is within the bounds of `image_size`. If `patch_si... | def get_valid_patch_size(image_size: Sequence[int], patch_size: Sequence[int] | int | np.ndarray) -> tuple[int, ...]:
ndim = len(image_size)
patch_size_ = ensure_tuple_size(patch_size, ndim)
# ensure patch size dimensions are not larger than image dimension, if a dimension is None or 0 use whole dimension
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_valid_patch_size(dims, patch_size):\n ndim = len(dims)\n\n try:\n # if a single value was given as patch size, treat this as the size of the patch over all dimensions\n single_patch_size = int(patch_size)\n patch_size = (single_patch_size,) * ndim\n except TypeError: # raised... | [
"0.72585624",
"0.64543897",
"0.6345915",
"0.6267646",
"0.6211953",
"0.6186627",
"0.6083222",
"0.60726315",
"0.6042673",
"0.6015231",
"0.5989551",
"0.5926834",
"0.5903823",
"0.5815533",
"0.5795002",
"0.5792771",
"0.57279307",
"0.5701962",
"0.56920725",
"0.5666246",
"0.5649929"... | 0.8026187 | 0 |
collate a sequence of meta tensor sequences/dictionaries into a single batched metatensor or a dictionary of batched metatensor | def collate_meta_tensor(batch):
if not isinstance(batch, Sequence):
raise NotImplementedError()
elem_0 = first(batch)
if isinstance(elem_0, MetaObj):
collated = default_collate(batch)
collated.meta = default_collate([i.meta or TraceKeys.NONE for i in batch])
collated.applied_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_collate(batch):\n error_msg = \"batch must contain tensors, numbers, dicts or lists; found {}\"\n elem_type = type(batch[0])\n if isinstance(batch[0], torch.Tensor):\n out = None\n matched = True\n for dim in range(batch[0].dim()):\n lst = list(map(lambda x: x.si... | [
"0.66727114",
"0.656687",
"0.6550184",
"0.6498206",
"0.64383245",
"0.6423776",
"0.6359105",
"0.62719196",
"0.62543476",
"0.6188792",
"0.6178307",
"0.61409694",
"0.61102676",
"0.6102395",
"0.6079725",
"0.6063359",
"0.6062056",
"0.6031711",
"0.6028925",
"0.6018516",
"0.5989578"... | 0.7449555 | 0 |
To make column norm of `affine` the same as `scale`. If diagonal is False, returns an affine that combines orthogonal rotation and the new scale. This is done by first decomposing `affine`, then setting the zoom factors to `scale`, and composing a new affine; the shearing factors are removed. If diagonal is True, retur... | def zoom_affine(affine: np.ndarray, scale: np.ndarray | Sequence[float], diagonal: bool = True):
affine = np.array(affine, dtype=float, copy=True)
if len(affine) != len(affine[0]):
raise ValueError(f"affine must be n x n, got {len(affine)} x {len(affine[0])}.")
scale_np = np.array(scale, dtype=floa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zoom_affine(affine, scale, diagonal: bool = True):\n affine = np.array(affine, dtype=float, copy=True)\n if len(affine) != len(affine[0]):\n raise ValueError(\"affine should be a square matrix\")\n scale = np.array(scale, dtype=float, copy=True)\n if np.any(scale <= 0):\n raise ValueE... | [
"0.7144264",
"0.5994049",
"0.59912354",
"0.5915723",
"0.5384092",
"0.5365139",
"0.53525025",
"0.5346628",
"0.5248908",
"0.5242017",
"0.5241914",
"0.52233315",
"0.51467407",
"0.5132126",
"0.5115379",
"0.5028426",
"0.50227356",
"0.50128067",
"0.501081",
"0.50019133",
"0.4982473... | 0.7194488 | 0 |
Utility function to create the path to the output file based on the input filename (file name extension is not added by this function). | def create_file_basename(
postfix: str,
input_file_name: PathLike,
folder_path: PathLike,
data_root_dir: PathLike = "",
separate_folder: bool = True,
patch_index=None,
makedirs: bool = True,
) -> str:
# get the filename and directory
filedir, filename = os.path.split(input_file_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_output_path(self, filename):\n return os.path.join(self._output_directory, filename)",
"def GetOutputFilename(fname):\n return os.path.join(outdir, fname)",
"def generate_filename_template_path(output_dir, filename_template):\n if output_dir:\n os.makedirs(output_dir, exist_ok=Tru... | [
"0.80713165",
"0.7545049",
"0.75357234",
"0.7490637",
"0.7469464",
"0.7441909",
"0.7311841",
"0.7255293",
"0.7114725",
"0.7039403",
"0.70251167",
"0.7008828",
"0.6984196",
"0.69794345",
"0.69582504",
"0.69459087",
"0.694561",
"0.69338363",
"0.6927307",
"0.6916664",
"0.6905873... | 0.0 | -1 |
Verify whether the specified file or files format match supported suffixes. If supported suffixes is None, skip the verification and return True. | def is_supported_format(filename: Sequence[PathLike] | PathLike, suffixes: Sequence[str]) -> bool:
filenames: Sequence[PathLike] = ensure_tuple(filename)
for name in filenames:
full_suffix = "".join(map(str.lower, PurePath(name).suffixes))
if all(f".{s.lower()}" not in full_suffix for s in suffi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_file(suffixes, file_name):\n (root, ext) = os.path.splitext(file_name)\n\n if len(ext) > 1:\n return ext in suffixes\n else:\n return False",
"def suffix(file_, suffix_list_):\n array = map(file_.endswith, suffix_list_)\n if True in array:\n return True\n else:... | [
"0.69784456",
"0.67100275",
"0.64887327",
"0.6449378",
"0.634938",
"0.6344075",
"0.629082",
"0.6284534",
"0.6277648",
"0.6269668",
"0.6258417",
"0.61554825",
"0.61156213",
"0.6112069",
"0.6106395",
"0.6100045",
"0.60399705",
"0.60377836",
"0.6035617",
"0.60219514",
"0.5989528... | 0.81980205 | 0 |
Split the dataset into N partitions. It can support shuffle based on specified random seed. Will return a set of datasets, every dataset contains 1 partition of original dataset. And it can split the dataset based on specified ratios or evenly split into `num_partitions`. | def partition_dataset(
data: Sequence,
ratios: Sequence[float] | None = None,
num_partitions: int | None = None,
shuffle: bool = False,
seed: int = 0,
drop_last: bool = False,
even_divisible: bool = False,
):
data_len = len(data)
datasets = []
indices = list(range(data_len))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(data, n):\n splits = []\n remaining = data.copy(deep=True)\n for i in range(n):\n split = remaining.sample(frac=1/(n-i), random_state=10)\n splits.append(split)\n remaining = remaining.drop(split.index)\n return splits",
"def split_dataset(dataset, n, seed=0):\n ... | [
"0.8035845",
"0.7541925",
"0.75256866",
"0.71053505",
"0.70321155",
"0.69524515",
"0.6929069",
"0.6902361",
"0.6869064",
"0.68228483",
"0.67978007",
"0.67956656",
"0.67927235",
"0.6634464",
"0.66020584",
"0.65911126",
"0.6509427",
"0.64511895",
"0.64485747",
"0.64369565",
"0.... | 0.77777785 | 1 |
Split the dataset into N partitions based on the given class labels. It can make sure the same ratio of classes in every partition. | def partition_dataset_classes(
data: Sequence,
classes: Sequence[int],
ratios: Sequence[float] | None = None,
num_partitions: int | None = None,
shuffle: bool = False,
seed: int = 0,
drop_last: bool = False,
even_divisible: bool = False,
):
if not issequenceiterable(classes) or len(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evenly_partition_dataset(data, labels, nb_teachers):\n\n # This will floor the possible number of batches\n batch_len = int(len(data) / nb_teachers)\n\n nclasses = len(labels[0])\n print(\"Start Index Selection\")\n data_sel = [data[labels[:, j] == 1] for j in range(nclasses)]\n print(\"End I... | [
"0.7412675",
"0.72059125",
"0.71223164",
"0.70392096",
"0.69679093",
"0.687541",
"0.6796814",
"0.6775578",
"0.6769134",
"0.6577703",
"0.6537985",
"0.6506913",
"0.65016305",
"0.64822894",
"0.6432169",
"0.6425278",
"0.6384299",
"0.6359757",
"0.6347446",
"0.6339992",
"0.63344896... | 0.7283174 | 1 |
Remove keys from a dictionary. Operates inplace so nothing is returned. | def remove_keys(data: dict, keys: list[str]) -> None:
for k in keys:
_ = data.pop(k, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_keys(_dict, keys):\n if not _dict:\n return None\n new = dict(_dict)\n for key in keys:\n new.pop(key, None)\n return new",
"def remove_keys_from_dict(dictionary, keys):\n\n # Copy dictionary\n dictionary_updated = dictionary.copy()\n try:\n [dictionary_update... | [
"0.7702204",
"0.7679476",
"0.7594327",
"0.7517008",
"0.7404991",
"0.7317242",
"0.72781634",
"0.71914756",
"0.7176107",
"0.70159024",
"0.7003817",
"0.6998237",
"0.687918",
"0.6852007",
"0.682197",
"0.6749733",
"0.66833574",
"0.6672038",
"0.66512823",
"0.655683",
"0.65497905",
... | 0.69166064 | 12 |
Sets the sdas_data_id of this SDASDataItem. | def sdas_data_id(self, sdas_data_id):
self._sdas_data_id = sdas_data_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sdas_data_date(self, sdas_data_date):\n\n self._sdas_data_date = sdas_data_date",
"def data_type_id(self, data_type_id):\n\n self._data_type_id = data_type_id",
"def set_id(self, ssc_id):\r\n self.ssc_id = ssc_id",
"def __setitem__(cls, data_id, value):\n\n cls._data[data_id] ... | [
"0.6699536",
"0.63754785",
"0.63176346",
"0.61991006",
"0.6078317",
"0.593118",
"0.5913244",
"0.5801437",
"0.57967544",
"0.5795115",
"0.5772528",
"0.57507575",
"0.5714229",
"0.57091844",
"0.5699439",
"0.56918204",
"0.56918204",
"0.56918204",
"0.56918204",
"0.56918204",
"0.569... | 0.87012404 | 0 |
Sets the ip_address of this SDASDataItem. | def ip_address(self, ip_address):
if ip_address is not None and len(ip_address) > 15:
raise ValueError("Invalid value for `ip_address`, length must be less than or equal to `15`") # noqa: E501
self._ip_address = ip_address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAddress(self, ip_address):\n # type: (str)->None\n\n self._validator.validate_one(\n 'address', VALID_OPTS['address'], ip_address)\n self._ifAttributes['address'] = ip_address",
"def ip_address(self, ip_address):\n\n self._ip_address = ip_address",
"def ip_address(... | [
"0.7661221",
"0.761322",
"0.761322",
"0.761322",
"0.72511315",
"0.72511315",
"0.7208579",
"0.71828866",
"0.71387005",
"0.70421726",
"0.69928086",
"0.6838448",
"0.6749682",
"0.6671813",
"0.66513443",
"0.663458",
"0.6620775",
"0.65760857",
"0.65539277",
"0.65151095",
"0.6428808... | 0.61909866 | 25 |
Sets the entry_id of this SDASDataItem. | def entry_id(self, entry_id):
self._entry_id = entry_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def setEntry(self, entry):\n assert self.entry is None, \"An entry was already set for this DirectEntryScroll element\"\n self.entry = entry\n self.entry.reparentTo(self.canvas)\n\n self.entry.bind(DGG.CURSORMOVE, self.cursorMove)... | [
"0.6341967",
"0.62597954",
"0.6084978",
"0.6053302",
"0.60458577",
"0.6043118",
"0.600955",
"0.60055286",
"0.5999228",
"0.5999184",
"0.59812003",
"0.59582436",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",
"0.5931165",... | 0.8142852 | 2 |
Sets the megabyte of this SDASDataItem. | def megabyte(self, megabyte):
self._megabyte = megabyte | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDiskSize(self, size):\n # remove 1Mb from total size for safety\n value = size - (1024 * 1024)\n self.__diskSize = value / 1024",
"def set_data_size(self, num_bytes):\n self.model.data_size = num_bytes\n self.refresh_memory()",
"def set_size(self, size):\n self.... | [
"0.68708116",
"0.66938597",
"0.65642905",
"0.63858694",
"0.6377818",
"0.63328904",
"0.62221557",
"0.61555517",
"0.6106749",
"0.6093289",
"0.6024751",
"0.6015819",
"0.5989989",
"0.59407854",
"0.5932335",
"0.58555514",
"0.5834163",
"0.58276266",
"0.58276266",
"0.58276266",
"0.5... | 0.77519506 | 0 |
Sets the charge of this SDASDataItem. | def charge(self, charge):
self._charge = charge | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge(self, charge):\n self._charge = charge",
"def setCharge(self, *args):\n return _libsbml.Species_setCharge(self, *args)",
"def set_charge(self, type, charge):\n assert type < self.num_atom_types + 1\n assert type > 0\n self.charges[type] = charge",
"def setCharge(... | [
"0.7667928",
"0.72723967",
"0.7070988",
"0.7005275",
"0.6432749",
"0.63790935",
"0.62391114",
"0.59905964",
"0.5951452",
"0.59148175",
"0.5629941",
"0.56050706",
"0.5566352",
"0.54825246",
"0.54792345",
"0.5476642",
"0.5476642",
"0.5476642",
"0.5476642",
"0.5428004",
"0.54052... | 0.7620613 | 1 |
Sets the allowance of this SDASDataItem. | def allowance(self, allowance):
self._allowance = allowance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_values_only(self, allow_values_only):\n\n self._allow_values_only = allow_values_only",
"def SetAntLimit(cls, value=0):\n cls.antLimit = value",
"def allowed(self, allowed):\n if allowed is None:\n raise ValueError(\"Invalid value for `allowed`, must not be `None`\") ... | [
"0.55410415",
"0.5529423",
"0.5474473",
"0.53398967",
"0.5307561",
"0.53070784",
"0.52534974",
"0.52091706",
"0.51384974",
"0.51256305",
"0.51193553",
"0.51060885",
"0.50906086",
"0.508949",
"0.5043256",
"0.5018262",
"0.49875677",
"0.4978538",
"0.49645144",
"0.4956916",
"0.49... | 0.6983909 | 0 |
Sets the plan_allowance of this SDASDataItem. | def plan_allowance(self, plan_allowance):
self._plan_allowance = plan_allowance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowance(self, allowance):\n\n self._allowance = allowance",
"def plan(self, plan):\n\n self._plan = plan",
"def allowed(self, allowed):\n if allowed is None:\n raise ValueError(\"Invalid value for `allowed`, must not be `None`\") # noqa: E501\n\n self._allowed = al... | [
"0.69908667",
"0.62394124",
"0.550686",
"0.5367739",
"0.5338905",
"0.52827895",
"0.52454233",
"0.52302635",
"0.5230122",
"0.5157627",
"0.50841755",
"0.50533646",
"0.50533646",
"0.50533646",
"0.5023552",
"0.5019936",
"0.5019514",
"0.5004312",
"0.4968703",
"0.49635765",
"0.4962... | 0.8344894 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SDASDataItem):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8089204",
"0.8089204",
"0.8055265",
"0.7983358",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Converts minutes to seconds | def minutes_to_seconds(minutes) -> int:
return int(minutes) * 60 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes_to_seconds( minutes: str ) -> int:\r\n return int(minutes)*60",
"def minutes_to_seconds(minutes):\n return minutes * 60",
"def calculate_seconds_in_minutes(minutes):\n return int(minutes * 60)",
"def to_seconds(hours, minutes, seconds):\n return hours*60**2 + minutes*60 + seconds",
... | [
"0.8549494",
"0.84785414",
"0.80083776",
"0.7914541",
"0.78572327",
"0.78556967",
"0.76842797",
"0.75222194",
"0.74389696",
"0.73869646",
"0.73535633",
"0.7332998",
"0.7256638",
"0.7185759",
"0.7169081",
"0.7161754",
"0.71508414",
"0.7141182",
"0.71352524",
"0.71087193",
"0.7... | 0.8317549 | 2 |
Converts hours to minutes | def hours_to_minutes(hours) -> int:
return int(hours) * 60 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours_to_minutes( hours: str ) -> int:\r\n return int(hours)*60",
"def _to_minutes(seconds):\n return '%d:%d' % divmod(seconds, 60)",
"def calculate_minutes(time):\n return int(time / 60)",
"def minutes_in(sec):\r\n return int((sec - (hours_in(sec)*3600))//60)",
"def minutesToTime(minutes... | [
"0.84540313",
"0.74863845",
"0.7402691",
"0.7098389",
"0.6988618",
"0.6976897",
"0.69415545",
"0.6936566",
"0.69166374",
"0.6905955",
"0.69033235",
"0.6894749",
"0.68662024",
"0.6827582",
"0.68189",
"0.6797913",
"0.67737",
"0.673519",
"0.6730592",
"0.66768885",
"0.6558566",
... | 0.82949305 | 1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. (This function is copied from the scikit docs.) | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
plt.figure(figsize=(20,20))
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
plt.xticks(tick_marks, classes, rotation=45)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8291989",
"0.81920296",
"0.81415135",
"0.81236696",
"0.81125116",
"0.81097114",
"0.80973935",
"0.8077484",
"0.80750555",
"0.8047463",
"0.80427694",
"0.80398923",
"0.80297303",
"0.80285287",
"0.8023669",
"0.80235004",
"0.80231833",
"0.80224186",
"0.8017731",
"0.80036813",
"... | 0.0 | -1 |
Returns 'before' cursor (starting previous page before this cursor). | def before(self):
if self._first_item:
if self.items_count <= self.page_limit and self._items_count_before_first_item > 0:
return self._first_item
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous(self):\n if self.cursor.pref:\n self.cursor = self.cursor.pref\n return self.cursor\n return None",
"def before_cursor_next(self, cursor):\n pass",
"def before(self):\n return self._before",
"def before(self, p):\n node = self._validate(p)... | [
"0.70095104",
"0.6941818",
"0.6879406",
"0.666764",
"0.6628074",
"0.6493142",
"0.6463557",
"0.64119244",
"0.64035255",
"0.6378273",
"0.634591",
"0.6330457",
"0.63239235",
"0.6310472",
"0.6309198",
"0.6279411",
"0.6252887",
"0.6219331",
"0.6198758",
"0.6178431",
"0.616012",
... | 0.6254301 | 16 |
timestamp using current format. | def timestamp(self, time_msecs):
fmt = self.app.settings['timestampformat']
mins_secs = msecs_to_mins_and_secs(time_msecs) # String
delimiter = ":"
if "." in mins_secs:
delimiter = "."
mins = int(mins_secs.split(delimiter)[0])
secs = mins_secs.split(delimite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def get_timestamp():\n return datetime.now().strftime(TIMESTAMP_FORMAT)",
"def timestamp():\n return datetime.now().strftime('%H:%M:%S %m-%d')",
"def timestamp_now():\n return datetime.now().strftime(\"%A, %B %d, %Y, %I:%... | [
"0.83291346",
"0.81256396",
"0.8047594",
"0.8035585",
"0.8018654",
"0.7962717",
"0.7949168",
"0.7917471",
"0.7904424",
"0.7898713",
"0.78831744",
"0.78697157",
"0.78327155",
"0.7817194",
"0.78093076",
"0.77800506",
"0.77706516",
"0.7753781",
"0.7686227",
"0.7614327",
"0.75855... | 0.0 | -1 |
This just creates the following actors. It does not fill them. | def _create_caero_actors(self, ncaeros, ncaeros_sub, ncaeros_cs, has_control_surface):
if self.has_caero:
gui = self.gui
gui.create_alternate_vtk_grid(
'caero', color=YELLOW_FLOAT, line_width=3, opacity=1.0,
representation='toggle', is_visible=True, is_pic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actor():\n return Actor()",
"def draw_actors(self, actors): \n for actor in actors:\n self.draw_actor(actor)",
"def _init_agents(self):\n self.agents = [Agent(e=0.1, a=0.1, row=self.row, col=self.col) for i in range(2)]",
"def prepare_actors(self, object):\n actors = [\n ... | [
"0.6340813",
"0.6303262",
"0.6182203",
"0.6154471",
"0.6132606",
"0.6019555",
"0.58870983",
"0.5826896",
"0.5824235",
"0.576806",
"0.5750554",
"0.56811816",
"0.5676929",
"0.5675778",
"0.56479996",
"0.5639074",
"0.5635884",
"0.5599083",
"0.5583953",
"0.55633336",
"0.55478925",... | 0.5058511 | 90 |
Tests if function raises a ``ValueError`` when input is not a clique | def test_input_not_clique(self, dim):
with pytest.raises(ValueError, match="Input subgraph is not a clique"):
clique.grow([0, 1], nx.empty_graph(dim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_c_1_error_on_not_clique_input(self, dim):\r\n A = np.ones((dim, dim)) - np.eye(dim)\r\n A = nx.Graph(A)\r\n A.remove_edge(0, 1)\r\n S = [0, 1]\r\n\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n clique.c_1(S, A)",
"def test_... | [
"0.76886195",
"0.7487438",
"0.7447898",
"0.6724923",
"0.6268918",
"0.6190527",
"0.60438484",
"0.601841",
"0.5992472",
"0.59716725",
"0.58854884",
"0.5861587",
"0.57661337",
"0.57562804",
"0.5755303",
"0.5751841",
"0.5729346",
"0.5704541",
"0.5681301",
"0.56762403",
"0.5649068... | 0.7596812 | 1 |
Test if function performs correct swap operation when degreebased node selection is used. Input graph is a lollipop graph, consisting of a fully connected graph with a single additional node connected to just one of the nodes in the graph. Additionally, a connection between node ``0`` and ``dim 1`` is removed as well a... | def test_swap_degree(self, dim):
graph = nx.lollipop_graph(dim, 1)
graph.remove_edge(0, dim - 1)
graph.remove_edge(0, dim - 2)
s = list(range(dim - 2))
result = set(clique.swap(s, graph, node_select="degree"))
expected = set(range(1, dim - 2)) | {dim - 1}
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_swap_degree_tie(self, dim, monkeypatch):\r\n graph = nx.complete_graph(dim)\r\n graph.remove_edge(0, dim - 1)\r\n graph.remove_edge(0, dim - 2)\r\n s = set(range(dim - 2))\r\n\r\n patch_random_choice_1 = functools.partial(patch_random_choice, element=0)\r\n patch_... | [
"0.72277945",
"0.6895802",
"0.6846461",
"0.64114034",
"0.5975586",
"0.59694546",
"0.58667487",
"0.5620263",
"0.5519469",
"0.5441941",
"0.5419078",
"0.5384317",
"0.53593534",
"0.53046864",
"0.52979726",
"0.52630633",
"0.5258916",
"0.52561563",
"0.52396065",
"0.52265584",
"0.52... | 0.78765476 | 0 |
Tests if function raises a ``ValueError`` when input is not a clique | def test_input_not_clique(self, dim):
with pytest.raises(ValueError, match="Input subgraph is not a clique"):
clique.swap([0, 1], nx.empty_graph(dim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_c_1_error_on_not_clique_input(self, dim):\r\n A = np.ones((dim, dim)) - np.eye(dim)\r\n A = nx.Graph(A)\r\n A.remove_edge(0, 1)\r\n S = [0, 1]\r\n\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n clique.c_1(S, A)",
"def test_... | [
"0.76886195",
"0.7596812",
"0.7447898",
"0.6724923",
"0.6268918",
"0.6190527",
"0.60438484",
"0.601841",
"0.5992472",
"0.59716725",
"0.58854884",
"0.5861587",
"0.57661337",
"0.57562804",
"0.5755303",
"0.5751841",
"0.5729346",
"0.5704541",
"0.5681301",
"0.56762403",
"0.5649068... | 0.7487438 | 2 |
Tests if function raises a ``ValueError`` when input is not a clique | def test_input_valid_subgraph(self, dim):
with pytest.raises(ValueError, match="Input is not a valid subgraph"):
clique.swap([0, dim], nx.empty_graph(dim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_c_1_error_on_not_clique_input(self, dim):\r\n A = np.ones((dim, dim)) - np.eye(dim)\r\n A = nx.Graph(A)\r\n A.remove_edge(0, 1)\r\n S = [0, 1]\r\n\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n clique.c_1(S, A)",
"def test_... | [
"0.76886195",
"0.7596812",
"0.7487438",
"0.7447898",
"0.6724923",
"0.6268918",
"0.6190527",
"0.601841",
"0.5992472",
"0.59716725",
"0.58854884",
"0.5861587",
"0.57661337",
"0.57562804",
"0.5755303",
"0.5751841",
"0.5729346",
"0.5704541",
"0.5681301",
"0.56762403",
"0.5649068"... | 0.60438484 | 7 |
Tests if function raises a ``ValueError`` when input is not a clique | def test_c_0_error_on_not_clique_input(self, dim):
A = np.ones((dim, dim)) - np.eye(dim)
A = nx.Graph(A)
A.remove_edge(0, 1)
S = [0, 1]
with pytest.raises(ValueError, match="Input subgraph is not a clique"):
clique.c_0(S, A) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_c_1_error_on_not_clique_input(self, dim):\r\n A = np.ones((dim, dim)) - np.eye(dim)\r\n A = nx.Graph(A)\r\n A.remove_edge(0, 1)\r\n S = [0, 1]\r\n\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n clique.c_1(S, A)",
"def test_... | [
"0.76886195",
"0.7596812",
"0.7487438",
"0.6724923",
"0.6268918",
"0.6190527",
"0.60438484",
"0.601841",
"0.5992472",
"0.59716725",
"0.58854884",
"0.5861587",
"0.57661337",
"0.57562804",
"0.5755303",
"0.5751841",
"0.5729346",
"0.5704541",
"0.5681301",
"0.56762403",
"0.5649068... | 0.7447898 | 3 |
Tests if function raises a ``ValueError`` when input is not a clique | def test_c_1_error_on_not_clique_input(self, dim):
A = np.ones((dim, dim)) - np.eye(dim)
A = nx.Graph(A)
A.remove_edge(0, 1)
S = [0, 1]
with pytest.raises(ValueError, match="Input subgraph is not a clique"):
clique.c_1(S, A) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_input_not_clique(self, dim):\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n clique.grow([0, 1], nx.empty_graph(dim))",
"def test_input_not_clique(self, dim):\r\n with pytest.raises(ValueError, match=\"Input subgraph is not a clique\"):\r\n ... | [
"0.7596812",
"0.7487438",
"0.7447898",
"0.6724923",
"0.6268918",
"0.6190527",
"0.60438484",
"0.601841",
"0.5992472",
"0.59716725",
"0.58854884",
"0.5861587",
"0.57661337",
"0.57562804",
"0.5755303",
"0.5751841",
"0.5729346",
"0.5704541",
"0.5681301",
"0.56762403",
"0.5649068"... | 0.76886195 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# get user input for city (chicago, new york city, washington).
# ask user to determine city
while True:
city = input("choose city you want to explore from ('chicago', 'new york city', 'washington')")
if cit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.59896076 | 30 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA[city])
df['Start Time']=pd.to_datetime(df['Start Time'])
df['End Time']=pd.to_datetime(df['End Time'])
df['month']=df['Start Time'].dt.month
df['day_of_week']=df['Start Time'].dt.day_name()
if month.lower() !='all':
mon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.75361586 | 86 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
#display the most common month
common_month = df['month'].mode()[0]
print('most common month:',common_month)
#display the most common day of week
common_day = df['day_of_week'].mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.8023676",
"0.8022362",
"0.79149705",
"0.7825905",
"0.78213924",
"0.7813664",
"0.7765152",
"0.77395964",
"0.7735777",
"0.7733763",
"0.76860064",
"0.7668081",
"0.7651128",
"0.7644099",
"0.7639373",
"0.7636164",
"0.7624668",
"0.7622597",
"0.76122236",
"0.7599646",
"0.75829977... | 0.7245135 | 63 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
#display most commonly used start station
common_start_station=df['Start Station'].mode()[0]
print('most common used start station:',common_start_station)
#display most commonly us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.6784949 | 99 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
#display total travel time
total_travel_time =df['Trip Duration'].sum()
print('total travel time in sec :' ,total_travel_time) #total_duration in sec
print('total travel time in min:' ,total_tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7556165 | 95 |
Return whether a module is a package. | def is_package(self, fullmodname):
submodname, is_package, relpath = self._get_info(fullmodname)
return is_package | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_module_or_package(path):\r\n is_module = osp.isfile(path) and osp.splitext(path)[1] in ('.py', '.pyw')\r\n is_package = osp.isdir(path) and osp.isfile(osp.join(path, '__init__.py'))\r\n return is_module or is_package",
"def _is_package(path):\n return (\n os.path.isdir(path)\n an... | [
"0.80535513",
"0.78657234",
"0.78657234",
"0.7863555",
"0.779715",
"0.76951444",
"0.76184493",
"0.75872517",
"0.756777",
"0.7436889",
"0.7331395",
"0.721741",
"0.71787107",
"0.7157707",
"0.71200323",
"0.70975304",
"0.70178944",
"0.69892263",
"0.69616795",
"0.6941185",
"0.6879... | 0.81605804 | 0 |
Return a client instance for automated testing. | def test_client_factory():
app = make_app(blueprints.api_server, settings.TestingConfig)
return app.test_client() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client():\n\n client = Client()\n return client",
"def get_integration_testing_client():\n management_domain = os.environ.get('KONG_MANAGEMENT')\n username = os.environ.get('KONG_USERNAME')\n password = os.environ.get('KONG_PASSWORD')\n\n return Client(management_domain, username=username, ... | [
"0.8045767",
"0.77997583",
"0.77433056",
"0.7656228",
"0.7641419",
"0.7520417",
"0.75203586",
"0.74942946",
"0.74618745",
"0.7349399",
"0.7330974",
"0.7322112",
"0.7322112",
"0.731086",
"0.73106176",
"0.73106176",
"0.7304921",
"0.73031384",
"0.7243374",
"0.7243374",
"0.724337... | 0.6858382 | 45 |
Return an api server instance configured for production. | def api_factory(global_config, **local_conf):
return make_app(blueprints.api_server, settings.ProductionConfig) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_dev_factory(global_config, **local_conf):\n\treturn make_app(blueprints.api_server, settings.DevelopmentConfig)",
"def get_server(self):\n server_class = self.get_server_class()\n validator_class = self.get_validator_class()\n return server_class(validator_class(), token_expires_in=o... | [
"0.6606793",
"0.65736616",
"0.6070765",
"0.60243964",
"0.60239685",
"0.58958644",
"0.58680475",
"0.58626735",
"0.5836196",
"0.58335143",
"0.5782362",
"0.5723617",
"0.57047355",
"0.56752384",
"0.5661472",
"0.5655064",
"0.56511575",
"0.56458884",
"0.5631329",
"0.55981135",
"0.5... | 0.6710677 | 0 |
Return a developer portal instance configured for production. | def doc_factory(global_config, **local_conf):
return make_app(blueprints.developer_portal, settings.ProductionConfig) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DEVELOPER(cls):\n\n return DataCenter.Environment(\"https://developer.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())",
"def PRODUCTION(cls):\n\n return DataCenter.Environment(\"https://www.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())",
"def production():\... | [
"0.67466635",
"0.63730246",
"0.63570607",
"0.6346892",
"0.623092",
"0.6137237",
"0.6008309",
"0.57692844",
"0.57441765",
"0.57372195",
"0.5696684",
"0.55788594",
"0.5541568",
"0.55378085",
"0.5528574",
"0.5429082",
"0.5398692",
"0.53962576",
"0.53935",
"0.53841543",
"0.533572... | 0.55325973 | 14 |
Return an api server instance configured for development. | def api_dev_factory(global_config, **local_conf):
return make_app(blueprints.api_server, settings.DevelopmentConfig) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_factory(global_config, **local_conf):\n\treturn make_app(blueprints.api_server, settings.ProductionConfig)",
"def init(server_host_and_port):\n global __obj_starter_api\n __obj_starter_api = PrivateApi(api_url=server_host_and_port)",
"def get_server(self):\n server_class = self.get_server_... | [
"0.6671756",
"0.6581727",
"0.643036",
"0.63919234",
"0.6083142",
"0.60792255",
"0.5994747",
"0.594437",
"0.59168744",
"0.58545095",
"0.5843012",
"0.58408314",
"0.5744367",
"0.5720217",
"0.5694042",
"0.5686774",
"0.5677295",
"0.56732553",
"0.5672785",
"0.5670191",
"0.56663054"... | 0.7329425 | 0 |
Return a developer portal instance configured for development. | def doc_dev_factory(global_config, **local_conf):
return make_app(blueprints.developer_portal, settings.DevelopmentConfig) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DEVELOPER(cls):\n\n return DataCenter.Environment(\"https://developer.zohoapis.eu\", cls().get_iam_url(), cls().get_file_upload_url())",
"def developer_portal_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"developer_portal_url\")",
"def developer_portal_url(self) -> pul... | [
"0.699764",
"0.64781564",
"0.6467211",
"0.6297486",
"0.59238523",
"0.590994",
"0.5880834",
"0.5808602",
"0.5779816",
"0.5767217",
"0.5745334",
"0.56450045",
"0.55581516",
"0.54712623",
"0.54580355",
"0.5423588",
"0.5422899",
"0.5419092",
"0.54117984",
"0.539909",
"0.5370844",... | 0.6504536 | 1 |
Returns agent indices of your opponents. This is the list of the numbers of the agents (e.g., red might be 1, 3, 5) | def getOpponents(self, gameState):
if self.red:
return gameState.getBlueTeamIndices()
else:
return gameState.getRedTeamIndices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opponents(self, game_state):\n if self.red:\n return game_state.get_blue_team_indices()\n else:\n return game_state.get_red_team_indices()",
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def agentCounter(gameSt... | [
"0.7104835",
"0.7008432",
"0.6828103",
"0.6527755",
"0.64284533",
"0.62731737",
"0.6188407",
"0.614679",
"0.60366625",
"0.5979433",
"0.59617287",
"0.58752364",
"0.5856375",
"0.5828954",
"0.5786396",
"0.57304686",
"0.5727151",
"0.57168114",
"0.5705933",
"0.56977034",
"0.568972... | 0.7004699 | 2 |
Returns agent indices of your team. This is the list of the numbers of the agents (e.g., red might be the list of 1,3,5) | def getTeam(self, gameState):
if (self.red):
return gameState.getRedTeamIndices()
else:
return gameState.getBlueTeamIndices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def agentCounter(gameState, index, depth):\n if index == gameState.getNumAgents():\n return [depth-1, 0]\n else:\n return [depth, index]",
"def agent_locs_id... | [
"0.7164669",
"0.6938745",
"0.68448013",
"0.67928",
"0.63852847",
"0.6328744",
"0.6288408",
"0.62356496",
"0.609378",
"0.5930781",
"0.5915748",
"0.59083325",
"0.5845465",
"0.58239853",
"0.5792074",
"0.57735556",
"0.57503515",
"0.5748193",
"0.5714828",
"0.569344",
"0.5684362",
... | 0.6316888 | 6 |
Returns how much you are beating the other team by in the form of a number that is the difference between your score and the opponents score. This number is negative if you're losing. | def getScore(self, gameState):
if (self.red):
return gameState.getScore()
else:
return gameState.getScore() * -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n #import pdb; pdb.set_trace()\n return ((self.team1.get_cur_hp() / self.team1.get_total_hp()) - \n (self.team2.get_cur_hp() / self.team2.get_total_hp()))",
"def _get_reward(self, player_score, opponent_score):\n return player_score - opponent_score",
"def c... | [
"0.7424586",
"0.7321318",
"0.6932206",
"0.6909637",
"0.68919015",
"0.6880854",
"0.6812142",
"0.67689925",
"0.67247224",
"0.65772206",
"0.65552396",
"0.6538314",
"0.6508036",
"0.6489396",
"0.6489396",
"0.6489396",
"0.6475355",
"0.6464941",
"0.64627945",
"0.64436823",
"0.644029... | 0.6207119 | 36 |
Always return True. This is a way to tell if the user has been authenticated in templates. | def is_authenticated(self):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return True #self.authenticated",
"def is_authenticated(self, request, **kwargs):\r\n return True",
"def is_authenticated(self):\r\n return self.authenticated",
"def is_authenticated(self):\n return False",
"def is_authenticated(self):\n retu... | [
"0.81529313",
"0.8115903",
"0.80314094",
"0.79943705",
"0.78800297",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.786801",
"0.78162265",
"0.7801013",
"0.7766671",
"0.774480... | 0.8270089 | 6 |
Construct a base class with model operators already constructed. | def _trainedmodel(continuous, modelform, Vr, m=20):
if continuous == "inferred":
ModelClass = roi._core.InferredContinuousROM
elif continuous:
ModelClass = roi._core._ContinuousROM
else:
ModelClass = roi._core._DiscreteROM
n,r = Vr.shape
c, A, H, Hc, G, Gc, B = _get_operator... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_operators(self):\n self.relationship_operator = Operators.RelationshipOperator(self)\n self.infection_operator = Operators.InfectionOperator(self)\n self.time_operator = Operators.TimeOperator(self)",
"def __init__(self):\n super(OperatorCodegen, self).__init__()",
"def __i... | [
"0.7125911",
"0.670557",
"0.64603883",
"0.63755906",
"0.6345859",
"0.6162554",
"0.61624366",
"0.6031369",
"0.6018657",
"0.6010784",
"0.60077786",
"0.59984505",
"0.5993563",
"0.5993563",
"0.5993563",
"0.5993563",
"0.5993563",
"0.59911346",
"0.59874314",
"0.59841746",
"0.596513... | 0.0 | -1 |
Loads the precomputed features. Returns a pytorch Dataset | def features_dataset(features_pickle_path, train=True):
if train:
start = 0
stop = 48000
else:
start = 48000
stop = 50000
features = pd.read_hdf(features_pickle_path, start=start, stop=stop).values
labels = torch.zeros(features.shape[0]).float()
features = torch.fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadData(self):\n batch_size = 256\n \n #if self.conv_sg == True:\n # batch_size = 1 \n \n download = True\n root = self.root + self.dataset\n if self.dataset == \"MNIST\": \n transform = transforms.Compose([transforms.ToTensor(), tra... | [
"0.6820949",
"0.68088937",
"0.6686694",
"0.6672536",
"0.66682124",
"0.6589981",
"0.65488917",
"0.654359",
"0.6529167",
"0.6510187",
"0.64377886",
"0.64067507",
"0.63958514",
"0.6332203",
"0.63305515",
"0.6278722",
"0.6268895",
"0.62533474",
"0.62101513",
"0.61962646",
"0.6187... | 0.7273538 | 0 |
Create multivariate normal that only has non zero values in the covariance matrix on the diagonal. | def __init__(self, multiplicity, in_features, cardinality, dropout=0.0):
super(IndependentNormal, self).__init__(multiplicity, in_features, dropout)
self.gauss = Normal(
multiplicity=multiplicity, in_features=in_features, dropout=dropout
)
self.prod = Product(in_features=in_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multivariate_normal(x, d, mean, covariance):\n x_m = x - mean\n return (1. / (np.sqrt((2 * np.pi)**d * np.linalg.det(covariance))) * \n np.exp(-(np.linalg.solve(covariance, x_m).T.dot(x_m)) / 2))",
"def matrix_normal(M,U,V):\n return numpy.random.multivariate_normal(M.ravel(), np.kron(V, ... | [
"0.6690383",
"0.6398805",
"0.6395239",
"0.63508075",
"0.6242023",
"0.62295985",
"0.612385",
"0.6107862",
"0.60748297",
"0.6002314",
"0.5931019",
"0.5908809",
"0.58191496",
"0.581867",
"0.5716339",
"0.5706515",
"0.5696974",
"0.5691822",
"0.5682732",
"0.56755406",
"0.5665674",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.