query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Gets the current features_selection | def _get_features_selection(self):
self._validate_features_selection()
if self.features_selection == "auto":
if self._get_mode() == "Explain":
return False
if self._get_mode() == "Perform":
return True
if self._get_mode() == "Compete":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSelection(self):\n return self.selection",
"def GetSelection(self):\r\n\r\n return self.selection",
"def GetSelection(self):\r\n\r\n return self._current",
"def GetSelection(self):\n \n return self.selected",
"def get_selected_nodes(self):\n return self._sel... | [
"0.72452754",
"0.7188117",
"0.71176845",
"0.6940054",
"0.67970186",
"0.6783767",
"0.67610663",
"0.6721341",
"0.66002655",
"0.6589361",
"0.6549051",
"0.6549051",
"0.6516982",
"0.64433926",
"0.6428101",
"0.64220285",
"0.6418494",
"0.6352769",
"0.6308269",
"0.62836784",
"0.62610... | 0.7440437 | 0 |
Gets the current start_random_models | def _get_start_random_models(self):
self._validate_start_random_models()
if self.start_random_models == "auto":
if self._get_mode() == "Explain":
return 1
if self._get_mode() == "Perform":
return 5
if self._get_mode() == "Compete":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exploring_starts(self):\n def random_choice(l): return l[np.random.randint(len(l))]\n return map(random_choice, (self.env.states, self.env.moves))",
"def get_random_start(self):\n arr = np.zeros(self.dimension)\n n_fit_p = len(self.fit_parameters)\n n_nui_p = len(self.nuisance_para... | [
"0.61098045",
"0.5519804",
"0.5495816",
"0.5439313",
"0.5439313",
"0.54216105",
"0.53990346",
"0.53893465",
"0.53497064",
"0.53497064",
"0.5334331",
"0.53277075",
"0.5320885",
"0.5319373",
"0.53144366",
"0.5306886",
"0.52948534",
"0.5272874",
"0.52695197",
"0.5261325",
"0.524... | 0.80309975 | 0 |
Gets the current hill_climbing_steps | def _get_hill_climbing_steps(self):
self._validate_hill_climbing_steps()
if self.hill_climbing_steps == "auto":
if self._get_mode() == "Explain":
return 0
if self._get_mode() == "Perform":
return 2
if self._get_mode() == "Compete":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_steps(self):\n return self.steps",
"def get_steps(self):\n return self.steps",
"def get_steps(self):\n return self.steps",
"def getSteps( self ):\n\n return self.adb.get( 'steps' )",
"def getSteps():",
"def get_step(self):\n retur... | [
"0.72193843",
"0.71010685",
"0.70357335",
"0.66529846",
"0.652234",
"0.6352011",
"0.6352011",
"0.6341539",
"0.6029986",
"0.600624",
"0.59786874",
"0.594206",
"0.59252524",
"0.59252524",
"0.59252524",
"0.59252524",
"0.58734",
"0.58724695",
"0.58696485",
"0.5851444",
"0.5811696... | 0.7683898 | 0 |
Gets the current top_models_to_improve | def _get_top_models_to_improve(self):
self._validate_top_models_to_improve()
if self.top_models_to_improve == "auto":
if self._get_mode() == "Explain":
return 0
if self._get_mode() == "Perform":
return 2
if self._get_mode() == "Compete"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_models(self, return_scores=True):\n self.greater_score_is_better = is_greater_better(self.scoring_function)\n model_names = list(set([key.split('(')[0] for key in\n self.evaluated_individuals_.keys()]))\n models = OrderedDict({mo... | [
"0.6821835",
"0.6430581",
"0.629004",
"0.62063706",
"0.6155155",
"0.6126578",
"0.5943312",
"0.59303916",
"0.59013474",
"0.5836023",
"0.5798655",
"0.5795692",
"0.56650555",
"0.565281",
"0.56480753",
"0.5645917",
"0.56216484",
"0.55647224",
"0.55647224",
"0.55647224",
"0.555102... | 0.8301511 | 0 |
Gets the current boost_on_errors | def _get_boost_on_errors(self):
self._validate_boost_on_errors()
if self.boost_on_errors == "auto":
val = self._get_validation_strategy()
if val.get("validation_type", "") == "custom":
return False
if self._get_mode() == "Explain":
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_raise_on_error():\n global raise_on_error\n return raise_on_error",
"def back_err(self):\n return self._derived_properties[\"bkgd_err\"]",
"def get_errors(self):\n return {'loss': self.loss.data[0]}",
"def getB(self):\n return self.error",
"def getErrorHandler(self):\n ... | [
"0.6346581",
"0.6290803",
"0.61281234",
"0.60806453",
"0.59473616",
"0.5876309",
"0.585333",
"0.5807219",
"0.5801431",
"0.5784405",
"0.57784134",
"0.576894",
"0.57465225",
"0.57465225",
"0.57174766",
"0.5715621",
"0.5715621",
"0.5715621",
"0.5680192",
"0.56616455",
"0.5624751... | 0.7447873 | 0 |
Gets the current kmeans_features | def _get_kmeans_features(self):
self._validate_kmeans_features()
if self.kmeans_features == "auto":
if self._get_mode() == "Explain":
return False
if self._get_mode() == "Perform":
return False
if self._get_mode() == "Compete":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_features(self):\n return self._features",
"def features(self):\n return self._features",
"def features(self):\n\n return self._features",
"def get_features(self):\n if self.strokes is False:\n print('Isolating strokes')\n self.isolate_strokes()\n ... | [
"0.6775403",
"0.6481033",
"0.63745344",
"0.63635355",
"0.62884897",
"0.62546325",
"0.612313",
"0.6063174",
"0.5997075",
"0.5957198",
"0.5954714",
"0.5915384",
"0.58808947",
"0.58574826",
"0.58393997",
"0.58329165",
"0.5800852",
"0.57675624",
"0.57581013",
"0.57575",
"0.574253... | 0.7356534 | 0 |
Gets the current max_single_prediction_time | def _get_max_single_prediction_time(self):
self._validate_max_single_prediction_time()
if self.max_single_prediction_time is None:
if self._get_mode() == "Perform":
return 0.5 # prediction time should be under 0.5 second
return None
else:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_simulated_time(self):\n\n query = \"SELECT MAX(time) FROM patient_signal_values\"\n\n return self.mysql_obj.fetch_value(query)",
"def max_time(self):\n #{{{ function to return time of last sample\n\n if self.maxtime == -1:\n return stock.now()\n\n return ... | [
"0.713428",
"0.7000223",
"0.6750113",
"0.67000544",
"0.66799814",
"0.664459",
"0.6637974",
"0.65101796",
"0.64204127",
"0.63254064",
"0.63026834",
"0.62825453",
"0.62509656",
"0.6248696",
"0.6228762",
"0.6212105",
"0.61944056",
"0.6155345",
"0.614388",
"0.61273146",
"0.611953... | 0.903874 | 0 |
Gets the current optuna_time_budget | def _get_optuna_time_budget(self):
self._validate_optuna_time_budget()
if self.optuna_time_budget is None:
if self._get_mode() == "Optuna":
return 3600
return None
else:
if self._get_mode() != "Optuna":
# use only for mode Optu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def budget(self):\n return self._budget",
"def last_optime(self):\n return self._last_optime",
"def adoption_time(self):\n return self._adoption_time",
"def get_time_step_to_enqueue(self):\n return self.time_step_to_enqueue",
"def _get_total_time_limit(self):\n self._vali... | [
"0.6425248",
"0.6043277",
"0.5918131",
"0.57312304",
"0.56376636",
"0.55601627",
"0.55194855",
"0.54705125",
"0.5403898",
"0.53979033",
"0.539061",
"0.5377435",
"0.53700995",
"0.53586614",
"0.53013504",
"0.52734435",
"0.52604705",
"0.524631",
"0.5189846",
"0.5182123",
"0.5148... | 0.8460654 | 0 |
Gets the current optuna_init_params | def _get_optuna_init_params(self):
self._validate_optuna_init_params()
if self._get_mode() != "Optuna":
# use only for mode Optuna
return {}
return deepcopy(self.optuna_init_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInitParams(self):\n return {}",
"def _get_current_training_params(self):\n params = {}\n params[\"lyap_relu_params\"] = copy.deepcopy(\n self.lyapunov_hybrid_system.lyapunov_relu.state_dict())\n if not self.R_options.fixed_R:\n params[\"R_params\"] = self.R_op... | [
"0.67133015",
"0.6513982",
"0.64959013",
"0.64958394",
"0.644193",
"0.644193",
"0.64085335",
"0.6405476",
"0.6403037",
"0.63784325",
"0.63532674",
"0.63532674",
"0.63532674",
"0.63532674",
"0.6348272",
"0.6348272",
"0.6348272",
"0.6348272",
"0.6346435",
"0.6290466",
"0.624069... | 0.87101316 | 0 |
Gets the current optuna_verbose | def _get_optuna_verbose(self):
self._validate_optuna_verbose()
# use only for mode Optuna
if self._get_mode() != "Optuna":
return True
return deepcopy(self.optuna_verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_verbose(self):\n self._validate_verbose()\n return deepcopy(self.verbose)",
"def verbose(self):\n return self.conf.get(\"verbose\")",
"def verbose():\n return _verbose",
"def verbose(self):\n return self._verbose",
"def verbose(self):\n return self._verbose",
... | [
"0.78699535",
"0.7726708",
"0.7537154",
"0.746297",
"0.746297",
"0.746297",
"0.746297",
"0.7356259",
"0.73098314",
"0.7288619",
"0.71457535",
"0.70966977",
"0.7072135",
"0.70582813",
"0.66449106",
"0.65642446",
"0.65546435",
"0.650735",
"0.6440845",
"0.6396217",
"0.63302183",... | 0.8742914 | 0 |
Gets the current n_jobs | def _get_n_jobs(self):
self._validate_n_jobs()
return deepcopy(self.n_jobs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_n_jobs(self):\n return self.n_jobs",
"def effective_n_jobs(n_jobs=-1):\n if n_jobs == 1:\n return 1\n\n backend, backend_n_jobs = get_active_backend()\n if n_jobs is None:\n n_jobs = backend_n_jobs\n return backend.effective_n_jobs(n_jobs=n_jobs)",
"def get_num_jobs(sel... | [
"0.8941863",
"0.80259633",
"0.79868776",
"0.78013074",
"0.78005415",
"0.7614501",
"0.72230357",
"0.71267",
"0.70833606",
"0.703076",
"0.69810003",
"0.69787186",
"0.6843887",
"0.6817876",
"0.674785",
"0.666808",
"0.66524726",
"0.6553903",
"0.6538402",
"0.65348506",
"0.6515888"... | 0.84748805 | 1 |
Gets the current random_state | def _get_random_state(self):
self._validate_random_state()
return deepcopy(self.random_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand(self):\n return self.State.rand()",
"def getstate(self):\n return (self.baseseed, self.counter, self.randbits_remaining)",
"def rand(self):\n self.state = (self.a * self.state + self.c)\n return self.state",
"def _get_state(self):\n return self.__state",
"def _get_st... | [
"0.8123552",
"0.7858806",
"0.7808915",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"0.7497387",
"... | 0.8489528 | 0 |
Gets the fairness metric | def _get_fairness_metric(self):
self._validate_fairness_metric()
if self.fairness_metric == "auto":
if self._get_ml_task() == BINARY_CLASSIFICATION:
return "demographic_parity_ratio"
if self._get_ml_task() == REGRESSION:
return "group_loss_ratio"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fairness_threshold(self):\n if self.fairness_threshold == \"auto\":\n if self._get_ml_task() in [\n BINARY_CLASSIFICATION,\n MULTICLASS_CLASSIFICATION,\n ]:\n thresholds = {\n \"demographic_parity_difference\": 0.... | [
"0.67016745",
"0.5999203",
"0.59884006",
"0.58963954",
"0.56670684",
"0.5645477",
"0.54838866",
"0.5344908",
"0.53396153",
"0.5330606",
"0.53292984",
"0.5284739",
"0.52752274",
"0.5267313",
"0.52610236",
"0.5256685",
"0.52457917",
"0.52381456",
"0.5232188",
"0.52058727",
"0.5... | 0.68944013 | 0 |
Gets the fairness threshold | def _get_fairness_threshold(self):
if self.fairness_threshold == "auto":
if self._get_ml_task() in [
BINARY_CLASSIFICATION,
MULTICLASS_CLASSIFICATION,
]:
thresholds = {
"demographic_parity_difference": 0.1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FastConvergenceThreshold(self):\n\t\treturn self._get_attribute('fastConvergenceThreshold')",
"def threshold(self) -> float:\n return pulumi.get(self, \"threshold\")",
"def reward_threshold(self) -> Optional[float]:",
"def get_performance_threshold(self):\n\n if Test.performance_params: ret... | [
"0.6620242",
"0.62111634",
"0.604016",
"0.60012925",
"0.59756714",
"0.5927428",
"0.591201",
"0.5910259",
"0.5881854",
"0.5881854",
"0.5880676",
"0.58554536",
"0.5805405",
"0.578478",
"0.5761599",
"0.5743415",
"0.5742673",
"0.56985474",
"0.5683226",
"0.56465083",
"0.5641896",
... | 0.74255294 | 0 |
Gets privileged groups for fair training | def _get_privileged_groups(self):
if self.privileged_groups == "auto":
return []
else:
return deepcopy(self.privileged_groups) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_underprivileged_groups(self):\n if self.underprivileged_groups == \"auto\":\n return []\n else:\n return deepcopy(self.underprivileged_groups)",
"def test_get_groups(self):\n group0 = self.test_save('TestGroup0')\n group1 = self.test_save('TestGroup1')\n... | [
"0.7512295",
"0.6589516",
"0.65174836",
"0.6486006",
"0.63847315",
"0.63510704",
"0.63013774",
"0.63013774",
"0.62872154",
"0.628441",
"0.6190389",
"0.61468303",
"0.61449814",
"0.61140037",
"0.61140037",
"0.6090746",
"0.6036777",
"0.60114354",
"0.6006546",
"0.59940183",
"0.59... | 0.7552889 | 0 |
Gets underprivileged groups for fair training | def _get_underprivileged_groups(self):
if self.underprivileged_groups == "auto":
return []
else:
return deepcopy(self.underprivileged_groups) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_privileged_groups(self):\n if self.privileged_groups == \"auto\":\n return []\n else:\n return deepcopy(self.privileged_groups)",
"def get_groups_using_malware():\n global groups_using_malware\n\n if not groups_using_malware:\n groups_using_malware = rsh.... | [
"0.74663794",
"0.6593482",
"0.6520235",
"0.65086764",
"0.65086764",
"0.6437184",
"0.6431571",
"0.6334094",
"0.61589926",
"0.6144109",
"0.6134614",
"0.6120121",
"0.60976017",
"0.60939455",
"0.60939455",
"0.6093541",
"0.60102457",
"0.60085875",
"0.59747267",
"0.5969062",
"0.596... | 0.76907 | 0 |
Download log files from remote machines on local machine via ssh | def __download_via_ssh(cls, request, local_path):
hosts = request.POST.getlist('hosts[]')
logs = request.POST.getlist('logs[]')
if not os.path.exists(local_path):
os.makedirs(local_path)
for host_name in hosts:
host_object = Host.objects.get(host_name=host_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PullLogs(ssh, log_files, download_folder):\n for log_file in log_files:\n target_file = os.path.join(download_folder, os.path.basename(log_file))\n ssh.ScpPullFile(log_file, target_file)\n _DisplayPullResult(download_folder)",
"def ssh_download_files(data):\n with _ssh_connect() as ssh... | [
"0.73364204",
"0.6596629",
"0.6111099",
"0.60842896",
"0.6064838",
"0.6026996",
"0.60165",
"0.59927064",
"0.59570765",
"0.59108406",
"0.59068495",
"0.58801275",
"0.5834578",
"0.57861924",
"0.5749585",
"0.573902",
"0.5687385",
"0.56273234",
"0.5601198",
"0.5537666",
"0.5521412... | 0.7495217 | 0 |
Make an hashable representation of an object for hashlib | def hashable(obj):
return bytes(str(obj), "utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(obj):\n \n import hashlib\n import pickle\n \n sha = hashlib.sha256()\n sha.update(pickle.dumps(obj))\n \n return sha.hexdigest()",
"def hash_obj(self, obj):\r\n md5er = hashlib.md5()\r\n update_hash(md5er, obj)\r\n return md5er.hexdigest()",
"def make_hash... | [
"0.7611977",
"0.73950815",
"0.72174555",
"0.72113204",
"0.71887934",
"0.7181167",
"0.7116037",
"0.7108791",
"0.701039",
"0.70093346",
"0.6961172",
"0.691401",
"0.6912288",
"0.6907212",
"0.6874116",
"0.683543",
"0.6820438",
"0.67326635",
"0.67163974",
"0.6707556",
"0.66794527"... | 0.8125466 | 0 |
Ensure row data is valid This currently just checks that 2D arrays match the variable components. | def validate_row(row):
subkeys = [INDEP, DEP]
for subkey in subkeys:
for k, v in row[subkey].items():
if v is None:
continue
if np.ndim(v) > 1:
assert np.ndim(v) == 2
if 1 not in np.shape(v):
assert isinstance(k,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_data(self, row, col, value):\n\n return True",
"def check_row(row):\n \n if len(row) != _ncols:\n raise ValueError(\"Row contains {0} columns, expected {1}!\\n\\n{2}\\n\".format(len(row), _ncols, row))",
"def validate(self, row):\n raise NotImplementedError",
"def _val... | [
"0.69890326",
"0.6909129",
"0.6653121",
"0.6620799",
"0.6608853",
"0.6602894",
"0.65480334",
"0.6546582",
"0.65440375",
"0.6527276",
"0.649017",
"0.64542824",
"0.6438385",
"0.6417175",
"0.6406108",
"0.6311875",
"0.6278405",
"0.6260668",
"0.6255064",
"0.6238612",
"0.62377685",... | 0.7375959 | 0 |
Add a dictionary of dependent data | def add_dict(self, indep, dep):
dfull = {IND: len(self), INDEP: indep.copy(), DEP: dep}
validate_row(dfull)
check_objects(dfull)
if settings.CONVERT_SCALAR_ARRAYS:
scalarise(dfull)
if settings.PRINT_UPDATES:
print(self.show([dfull]))
self.append(df... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(\n self, indep, key=None, value=None, dep=None, keys=None, values=None, **kwargs\n ):\n if key is not None and value is not None:\n if isinstance(key, str):\n self.add_value(indep, key, value)\n elif isinstance(key, list):\n self.add_arra... | [
"0.6675702",
"0.64973605",
"0.6014381",
"0.60071164",
"0.5916942",
"0.58490884",
"0.5743055",
"0.57284117",
"0.5649685",
"0.5642036",
"0.5622459",
"0.5599008",
"0.5532404",
"0.55121297",
"0.5506236",
"0.55047566",
"0.5473821",
"0.5455027",
"0.5451647",
"0.5436743",
"0.5422243... | 0.69769204 | 0 |
Return a list of dictionaries that only contain values for keys | def exclusively(self, keys, lst=None):
minimal = self.minimal() if lst is None else lst
def make_exclusive(d, keys):
dct = {}
for k in keys:
if k in d:
dct[k] = d[k]
else:
dct[k] = -999
return dc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_filter(indict, key_list):\n \n return dict((key, value) for key, value in list(indict.items()) if key in key_list)",
"def _filter_keys(item, keys):\n return dict((k, v) for k, v in item.iteritems() if k in keys)",
"def exclude(m, keys):\n return {k: v for k, v in m.items() if k not in keys... | [
"0.7157758",
"0.6764101",
"0.67270654",
"0.6699573",
"0.6676822",
"0.6673541",
"0.6655425",
"0.66365665",
"0.66270673",
"0.6611581",
"0.6571578",
"0.65568775",
"0.6545871",
"0.6436229",
"0.6432588",
"0.6381771",
"0.63771033",
"0.6347461",
"0.63027394",
"0.62880474",
"0.628692... | 0.72772044 | 0 |
Merge this Box with one or more other Box instances | def merge(self, box, in_place=True):
if in_place:
self._merge(box)
else:
base = self.copy()
base._merge(box)
return base | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge(self, box_list):\n if isinstance(box_list, self.__class__):\n box_list = [box_list]\n for box in box_list:\n for row in box:\n row[IND] = len(self)\n self.append(row)\n self._combine(row)",
"def merge(self, other):\n\n ... | [
"0.68560404",
"0.6515574",
"0.64632297",
"0.63198626",
"0.6211465",
"0.62063205",
"0.6064046",
"0.5991924",
"0.5917754",
"0.5910379",
"0.5859801",
"0.58339703",
"0.58313894",
"0.57778674",
"0.5742428",
"0.57081246",
"0.5687884",
"0.56496143",
"0.563442",
"0.56266993",
"0.5626... | 0.7087718 | 0 |
Return unique key values | def unique(self, key, lst=None):
d = self.find(key, lst)
vals = set(d.values())
return sorted(list(vals)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_values(self):\n for key in self.metadb.unique_values():\n yield key, self.datadb[key]",
"def distinct(self, key):\n return self.database.command({'distinct': self.name,\n 'key': key})['values']",
"def _findUniqueMappingKeys(mapping):\n\n ... | [
"0.72342044",
"0.7174483",
"0.68495494",
"0.67468446",
"0.66601634",
"0.6650714",
"0.6622684",
"0.6563308",
"0.64356095",
"0.64118284",
"0.6411825",
"0.6408245",
"0.6370248",
"0.6339864",
"0.6293389",
"0.6292799",
"0.62809783",
"0.6236327",
"0.62303406",
"0.6222865",
"0.61984... | 0.7189072 | 1 |
The set methods must raise a ComponentsErrorEx in case of wrong mode | def test_wrong_mode(self):
self.assertRaises(ComponentErrorsEx, self.dp.setRewindingMode, 'FOO') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modifyNotValuableComponents(self):\n # Nothing to do\n pass",
"def set_comms_mode(self):",
"def magic_xmode(self,parameter_s = ''):\n\n new_mode = parameter_s.strip().capitalize()\n try:\n self.InteractiveTB.set_mode(mode = new_mode)\n print 'Exception repo... | [
"0.58727384",
"0.5831983",
"0.57986915",
"0.5704553",
"0.56496924",
"0.5616517",
"0.5566472",
"0.55448025",
"0.54887784",
"0.54351026",
"0.54308224",
"0.54267853",
"0.54206556",
"0.5400841",
"0.5366232",
"0.5362594",
"0.5343893",
"0.53403306",
"0.53249055",
"0.5301672",
"0.52... | 0.6587823 | 0 |
collect docker logs from servers $ command is $ log_collector.py | def main():
global tar_file_descr
help_msg = 'Usage: log_collector.py <all | host1[,host2,host3...]>'
hosts = []
if len(sys.argv) == 2:
if '-h' == sys.argv[1] or '--help' == sys.argv[1]:
print(help_msg)
sys.exit(0)
elif 'all' == sys.argv[1]:
# get log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docker_logs():\n local('docker logs {} -f'.format(project_name))",
"def do_logs(cs, args):\n opts = {}\n opts['id'] = args.container\n opts['stdout'] = args.stdout\n opts['stderr'] = args.stderr\n opts['since'] = args.since\n opts['timestamps'] = args.timestamps\n opts['tail'] = args.... | [
"0.73023754",
"0.66543895",
"0.6469975",
"0.6311792",
"0.6195516",
"0.619132",
"0.6190507",
"0.618653",
"0.6127707",
"0.6075922",
"0.60741675",
"0.60354525",
"0.60254896",
"0.59426993",
"0.59426993",
"0.59009355",
"0.58668494",
"0.58238095",
"0.58153385",
"0.57909554",
"0.577... | 0.6732043 | 1 |
Read in labels from digitStruct.mat file to create a dict of image file name and corresponding labels | def read_labels(digitstruct_file):
labels = dict()
for dsObj in tdqm(yieldNextDigitStruct(digitstruct_file), ncols=50):
image_labels = []
for bbox in dsObj.bboxList:
image_labels.append(bbox.label)
labels[dsObj.name] = image_labels
return labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_imagenet_as_dict(self):\n real_file_path = os.path.realpath(self.map_file)\n if not os.path.exists(real_file_path):\n raise IOError(\"map file {} not exists\".format(self.map_file))\n\n label_dict = {}\n with open(real_file_path) as fp:\n line = fp.readlin... | [
"0.7442581",
"0.67145514",
"0.6680717",
"0.66700083",
"0.6651974",
"0.6599294",
"0.65706545",
"0.6568262",
"0.65624034",
"0.65466106",
"0.6527709",
"0.65229243",
"0.65100825",
"0.6500305",
"0.649048",
"0.6466592",
"0.6466018",
"0.6442053",
"0.6429563",
"0.6409631",
"0.6398935... | 0.8415674 | 0 |
Construct a heap from a list of elements with priorities. Each element of the list must be in the form (Item, Priority). | def construct_heap(self, elems):
for e in elems:
self.n += 1
self.A.append(e)
self.pos[e[0]] = self.n
for i in range(self.n // 2, 0, -1):
self.combine(i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heap_sort(list):\n pass",
"def build_heap(self, items):\n for key in items:\n self.insert(key)",
"def __init__(self, list = []):\n # initialize empty heap\n self.heap = []\n\n # initialize heap with provided list\n for element in list:\n self.add(... | [
"0.6715845",
"0.6644555",
"0.66232336",
"0.6562983",
"0.6562983",
"0.6440951",
"0.64229244",
"0.64208883",
"0.64108974",
"0.63691944",
"0.6351629",
"0.63361603",
"0.632387",
"0.6306449",
"0.6306449",
"0.62739",
"0.62633675",
"0.62222654",
"0.6173713",
"0.6163355",
"0.61413926... | 0.6710219 | 1 |
Inserts the element elem with priority prio. | def insert(self, elem, prio):
self.n += 1
self.A.append( (e,w) )
self.pos[e] = self.n
i = self.n
p = i // 2
self.insert_loop(i, p) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_priority(self, elem, prio):\n pos = self.pos[elem]\n currPrio = self.A[pos][1]\n self.A[pos] = (elem, prio)\n if self.cmpFn(prio, currPrio):\n self.insert_loop(pos, pos // 2) # Up heapify\n else:\n self.combine(pos) # Down heapify",
"def enque... | [
"0.74379945",
"0.73325443",
"0.71752936",
"0.69993013",
"0.65939367",
"0.65610933",
"0.65355706",
"0.6510952",
"0.6450642",
"0.6369028",
"0.63523465",
"0.62270975",
"0.622298",
"0.6217232",
"0.6212362",
"0.6154356",
"0.6117256",
"0.61147964",
"0.6046682",
"0.5996028",
"0.5992... | 0.83393705 | 0 |
Changes the priority of the element elem to prio. | def change_priority(self, elem, prio):
pos = self.pos[elem]
currPrio = self.A[pos][1]
self.A[pos] = (elem, prio)
if self.cmpFn(prio, currPrio):
self.insert_loop(pos, pos // 2) # Up heapify
else:
self.combine(pos) # Down heapify | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPriority(self, p):\n self.priority = p",
"def _update_priority(self, task, prio, worker):\n task.priority = prio = max(prio, task.priority)\n for dep in task.deps or []:\n t = self._state.get_task(dep)\n if t is not None and prio > t.priority:\n self._... | [
"0.67719734",
"0.6752105",
"0.6318923",
"0.6283811",
"0.6121634",
"0.61172235",
"0.6071931",
"0.6042161",
"0.5969836",
"0.5969836",
"0.5969836",
"0.5935215",
"0.5908808",
"0.59068906",
"0.5899444",
"0.5884699",
"0.5880411",
"0.58484524",
"0.58209383",
"0.5818788",
"0.5729039"... | 0.81994 | 0 |
Gets the priority of an element. | def get_priority(self, elem):
pos = self.pos[elem]
return self.A[pos][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getpriority(self, name):\n\t\tif name not in self:\n\t\t\treturn None\n\t\treturn self.attributes[name].priority",
"def _get_priority(self):\n return self.__priority",
"def _get_priority(self):\n return self.__priority",
"def _get_priority(self):\n return self.__priority",
"def _get_priority(s... | [
"0.7882315",
"0.7649342",
"0.7649342",
"0.7649342",
"0.7649342",
"0.7647876",
"0.7647876",
"0.7504323",
"0.74972016",
"0.7453977",
"0.74093306",
"0.74017596",
"0.73951834",
"0.73866266",
"0.7357312",
"0.7357312",
"0.7357312",
"0.72419477",
"0.72419477",
"0.72419477",
"0.72419... | 0.8585831 | 0 |
Transcodes a file src to a file dest. | def transcode(self, src: Path, dest: Path) -> None:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copyFile( src, dest ):\n\tinFile = open( src, 'r' )\n\toutFile = open( dest, 'w' )\n\tfor line in inFile:\n\t\toutFile.write( line )\n\toutFile.close()\n\tinFile.close()",
"def compressFile(source, target):\n data = cake.filesys.readFile(source)\n try:\n data = zlib.compress(data, 1)\n except zlib.erro... | [
"0.6751052",
"0.6534881",
"0.61683327",
"0.6163265",
"0.61372477",
"0.6119148",
"0.60524434",
"0.602882",
"0.598594",
"0.5982905",
"0.5955934",
"0.59134305",
"0.5866599",
"0.585062",
"0.58318645",
"0.5749547",
"0.5694051",
"0.56439036",
"0.5634352",
"0.5634352",
"0.5634352",
... | 0.7879794 | 0 |
Takes an integer below 1001 and converts it into english text. Ignore spaces and hyphens as the instructions require. | def int2text(integer):
# Numbers 1-99 are handled by simply looking up words in the special_case
# dictionary.
if integer < 100:
return digit2text(integer)
elif integer < 1000:
# If exactly some hundred, then just return the word for the hundred's
# place and the word 'hundred'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def english(number):\r\n if number == 0:\r\n return 'zero'\r\n word = ''\r\n for step in itertools.count():\r\n number, rest = divmod(number, 1000)\r\n word = format_num(en3(rest), step) + word\r\n if number == 0:\r\n return word.strip()",
"def number2text(integer)... | [
"0.7711457",
"0.736089",
"0.6570956",
"0.65348077",
"0.6504594",
"0.6472066",
"0.6465786",
"0.6318002",
"0.63022107",
"0.6287715",
"0.6235496",
"0.6192539",
"0.61917514",
"0.6169387",
"0.6149354",
"0.6142758",
"0.61054987",
"0.60986495",
"0.60660845",
"0.60206014",
"0.5872346... | 0.7366785 | 1 |
Solves [a]{b} = {x} by Gauss elimination. | def gaussElimin(a,b):
a=float64(a)
b=float64(b)
n=len(b)
x=zeros((n,1),dtype=float)
for k in range(n-1):
for i in range(k+1,n):
l=float(a[i][k])/a[k][k]
a[i][k]=0
for j in range(k+1,n):
a[i][j]=a[i][j]-l*a[k][j]
b[i]=b[i]-l*b[k]
x[n-1]=float(b[n-1])/a[n-1][n-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_elimination(A, b):\n \n m, n = A.shape\n U = A.copy() \n b = b.copy()\n\n # forward sweep, reduce A to a upper triangular matrix\n for k in range(min(m, n)):\n swap = np.argmax(np.abs(U[k:, k])) + k\n if U[swap, k] == 0:\n raise ValueError('Singular matrix')\... | [
"0.7353518",
"0.71408343",
"0.71251684",
"0.70046204",
"0.6569199",
"0.64925224",
"0.6439031",
"0.63340366",
"0.62848866",
"0.6225892",
"0.6141184",
"0.61222094",
"0.6090073",
"0.6016392",
"0.5969952",
"0.5954091",
"0.59377366",
"0.5927988",
"0.59233207",
"0.59059817",
"0.583... | 0.7767935 | 0 |
Solves [L][U]{x} = b, where [a] = [L\U] is the matrix returned from LUdecomp. | def LUsolve(a,b):
b=float64(b)
n=len(b)
LU=LUdecomp(a)
y=zeros((n,1))
x=zeros((n,1))
y[0]=b[0]
for i in range(1,n):
sum=b[i]
for j in range(i):
sum=sum-LU[i][j]*y[j]
y[i]=sum
x[n-1]=float(y[n-1])/LU[n-1][n-1]
for i in range(n-2,-1,-1):
sum=y[i]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LU_solve(A, d, b):\n \n\n L, U = L1U(A, d)\n\n y = rforwardsolve(L, b, d)\n x = rbackwardsolve(U, y, d)\n\n return x",
"def lu_decom(A,b):\n # init\n n = len(b)\n L = np.eye(n)\n U = np.zeros((n,n))\n x = np.zeros(n)\n y = np.zeros(n)\n\n # decomposition A = LU\n\n U[0,... | [
"0.8204323",
"0.77781606",
"0.7435162",
"0.7326853",
"0.71451354",
"0.7074888",
"0.6962283",
"0.69174",
"0.6882864",
"0.6877735",
"0.68558407",
"0.6839501",
"0.67079276",
"0.6632435",
"0.6581103",
"0.6516492",
"0.6455007",
"0.63229835",
"0.62904537",
"0.62402534",
"0.6206865"... | 0.79200137 | 1 |
Constructs a Octave ResNet26 model. | def pre_act_oct_resnet26(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [2, 2, 2, 2], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet10(shortcut_type, num_classes, in_channels):\n model = ResNet(BasicBlock, [1, 1, 1, 1], shortcut_type, num_classes, in_channels)\n return model",
"def resnet34(shortcut_type, num_classes, in_channels):\n model = ResNet(BasicBlock, [3, 4, 6, 3], shortcut_type, num_classes, in_channels)\n ret... | [
"0.65736985",
"0.6366523",
"0.6366468",
"0.6340577",
"0.6290355",
"0.62448686",
"0.6211965",
"0.62079406",
"0.6202202",
"0.61859906",
"0.617765",
"0.6167639",
"0.6150246",
"0.6131579",
"0.61293316",
"0.6126124",
"0.60872185",
"0.60808474",
"0.60243255",
"0.6022623",
"0.601866... | 0.64773536 | 1 |
Constructs a Octave ResNet200 model. | def pre_act_oct_resnet200(pretrained=False, **kwargs):
model = PreActOctResNet(Bottleneck, [3, 24, 36, 3], **kwargs)
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet10(**kwargs):\n model = ResNet(BasicBlock, [1, 1, 1, 1], **kwargs)\n return model",
"def resnet18(**kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n return model",
"def resnet200(**kwargs):\n model = ResNet(Bottleneck, [3, 24, 36, 3], **kwargs)\n return model",
"def... | [
"0.6754732",
"0.6618465",
"0.65908283",
"0.63108593",
"0.63079596",
"0.62873125",
"0.62037766",
"0.61919415",
"0.61760974",
"0.61187875",
"0.6101522",
"0.60922974",
"0.6071278",
"0.6071278",
"0.6071278",
"0.6071278",
"0.6071278",
"0.60647464",
"0.6059056",
"0.6056413",
"0.602... | 0.66531056 | 1 |
The standard size of a tile sprite in 2D screen space. | def tile_size_2d(self):
return 32.0, 32.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cellsize_2d(self):\t\r\n return self.dx * self.dy",
"def pixelSize(self):\n br = self.sceneBoundingRect()\n if self.image is None:\n return 1,1\n return br.width()/self.width(), br.height()/self.height()",
"def get_pixel_size(self):\n p0 = core.PointF(0, 0)\n ... | [
"0.677379",
"0.6732188",
"0.6701107",
"0.6691744",
"0.6675488",
"0.66745335",
"0.666135",
"0.6641239",
"0.6588583",
"0.6561213",
"0.6488441",
"0.64793986",
"0.6465913",
"0.64484566",
"0.6422894",
"0.6421343",
"0.6418597",
"0.6404673",
"0.639991",
"0.6364815",
"0.63445616",
... | 0.79170084 | 0 |
Using the Command_Handler from command module to handle command. | def usingHandler(self, cmd):
self.command_handler.handle_command(cmd)
while msg_queue.empty() is False:
self.writeresponse(msg_queue.get()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _command(self, *cmd, handler=None):",
"def _command(self, handlers, args, msg):\n com, arg = self._command_split(args)\n if com in handlers.subcommands:\n msg.inc_handlers()\n self._command(handlers.subcommands[com], arg, msg)\n for handler in handlers.handlers:\n ... | [
"0.8338623",
"0.75426656",
"0.7504038",
"0.7325603",
"0.7277105",
"0.726302",
"0.71191317",
"0.7092065",
"0.70484436",
"0.6998338",
"0.6996647",
"0.6957424",
"0.6936447",
"0.6885723",
"0.683087",
"0.6806178",
"0.676416",
"0.6748807",
"0.6729248",
"0.6727872",
"0.67130303",
... | 0.77345246 | 1 |
Target method used by monitor thread, which polls vbmc status every 3s. If vbmc stops, ipmiconsole will stop. | def monitor(instance="default"):
global logger_ic
while True:
try:
with open("{}/{}/.{}-bmc.pid".format(
config.infrasim_home, instance, instance), "r") as f:
pid = f.readline().strip()
if not os.path.exists("/proc/{}".format(pid)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor(self, rms):\n pass",
"def monitor(self):\n while not self.terminated:\n try:\n if (time.time() - self.updated_time) < 5:\n messages = self.messages.copy()\n # procs = np.min([ len(messages), 9 ]) + 1\n ... | [
"0.6409184",
"0.627425",
"0.62064976",
"0.61520576",
"0.61488384",
"0.608878",
"0.6028219",
"0.60113215",
"0.58789355",
"0.586533",
"0.5813013",
"0.5793242",
"0.57749766",
"0.5774655",
"0.5764802",
"0.57504106",
"0.57363623",
"0.5703783",
"0.57020646",
"0.56902844",
"0.568184... | 0.65879107 | 0 |
Stop ipmiconsole of target instance specified by its name | def stop(instance="default"):
global logger_ic
logger_ic = infrasim_log.get_logger(LoggerType.ipmi_console.value, instance)
try:
file_ipmi_console_pid = "{}/{}/.ipmi_console.pid".\
format(config.infrasim_home, instance)
with open(file_ipmi_console_pid, "r") as f:
pid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n self.scion_sh('stop')",
"def processStop(name):\n imrclient.update_server_info()\n imrclient.process_stop(name)",
"def stop_notebook_instance(NotebookInstanceName=None):\n pass",
"def stop(self):\n if self.debug:\n print(\"%s stop\" % self.name)\n s... | [
"0.69108975",
"0.6825068",
"0.6671944",
"0.6663248",
"0.66268575",
"0.65905327",
"0.65741503",
"0.6553872",
"0.6435648",
"0.6377335",
"0.6354143",
"0.63085943",
"0.6253596",
"0.6247487",
"0.62375504",
"0.62224996",
"0.62192184",
"0.61786765",
"0.6176067",
"0.6176067",
"0.6176... | 0.6886424 | 1 |
Creates a handle to the Ceph Cluster. | def connect(ceph_config_file, timeout = CEPH_TIMEOUT):
handle = rados.Rados(conffile = ceph_config_file)
LOGGER.info("librados version: " + str(handle.version()))
LOGGER.info("Attempting to connect to: " +
str(handle.conf_get('mon initial members')))
handle.connect() #timeout shoudl be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ceph_info(handle, ceph_config, timeout):\n cluster = dict()\n\n cluster['status'] = ceph_mon_command(handle,\n 'status', timeout)\n cluster['version'] = shell_command('ceph -v') + b'\\n'\n\n # ceph versions command was introduced in mimic\n version = c... | [
"0.6605776",
"0.6418442",
"0.6327758",
"0.61983645",
"0.61876357",
"0.61836255",
"0.6062055",
"0.6059325",
"0.60109323",
"0.5957398",
"0.5952814",
"0.58882135",
"0.58059293",
"0.57884413",
"0.5772146",
"0.5749063",
"0.57396287",
"0.5687946",
"0.5676263",
"0.56761366",
"0.5651... | 0.6422216 | 1 |
Gather ceph monitor information | def get_monitor_info(handle, timeout):
mon_info = dict()
mon_info['stat'] = ceph_mon_command(handle, 'mon stat' , timeout)
mon_info['dump'] = ceph_mon_command(handle, 'mon dump' , timeout)
mon_info['map'] = ceph_mon_command(handle, 'mon getmap' , timeout)
mon_info['metadata'] = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_monitor_data(self):\n json = await self._api_call(\"app/monitors/%s/overview\" % self.sense_monitor_id)\n if \"monitor_overview\" in json and \"monitor\" in json[\"monitor_overview\"]:\n self._monitor = json[\"monitor_overview\"][\"monitor\"]\n return self._monitor",
... | [
"0.66455966",
"0.6420232",
"0.64127403",
"0.6299886",
"0.6260533",
"0.6227388",
"0.6212769",
"0.6193962",
"0.6172191",
"0.6142712",
"0.60478276",
"0.6043625",
"0.60359365",
"0.5971578",
"0.5969627",
"0.5957598",
"0.5948469",
"0.5928224",
"0.5919851",
"0.5902216",
"0.58823013"... | 0.7485646 | 0 |
GAther ceph device information | def get_device_info(handle, timeout):
device_info = dict()
device_info['ls'] = ceph_mon_command(handle, 'device ls', timeout)
return device_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_info(self) -> Dict[str, Any]:\n via_device = 'meter_adapter'\n if self.toon.gas.is_smart:\n via_device = 'electricity'\n\n return {\n 'name': 'Gas Meter',\n 'identifiers': {\n (DOMAIN, self.toon.agreement.id, 'gas'),\n },\n ... | [
"0.6951333",
"0.6848414",
"0.6711916",
"0.6700383",
"0.667151",
"0.66525185",
"0.6542051",
"0.6531767",
"0.6522371",
"0.6514975",
"0.64998937",
"0.64957225",
"0.6470811",
"0.6451061",
"0.6438751",
"0.6416084",
"0.64145595",
"0.6406177",
"0.63985395",
"0.63964",
"0.63928473",
... | 0.6898668 | 1 |
Gather ceph manager information | def get_manager_info(handle, timeout):
mgr_info = dict()
mgr_info['ls-modules'] = ceph_mon_command(handle, 'mgr module ls', timeout)
mgr_info['dump'] = ceph_mon_command(handle, 'mgr dump' , timeout)
mgr_info['metadata'] = ceph_mon_command(handle, 'mgr metadata' , timeout)
return mgr_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manager_info(self, manager):\n _, body = self.request('/v1.1/managers/active/%s' % manager, 'GET')\n return body",
"def get_ceph_info(handle, ceph_config, timeout):\n cluster = dict()\n\n cluster['status'] = ceph_mon_command(handle,\n 'status', time... | [
"0.65334594",
"0.6489982",
"0.6204253",
"0.60092634",
"0.6008082",
"0.5893398",
"0.5754568",
"0.5699375",
"0.56716347",
"0.5611492",
"0.5582611",
"0.5579014",
"0.5577621",
"0.5576179",
"0.55696046",
"0.5542833",
"0.55382943",
"0.55256027",
"0.5521256",
"0.55209965",
"0.551072... | 0.7890347 | 0 |
Ensure that graveyard_removal.py correctly removes the graveyard from an h5m file. | def test_default_graveyard_removal():
os.system("python svalinn_tools/graveyard_removal.py " + test_file_path + test_file)
size = os.path.getsize(test_file[:-4] + "_no_grave.h5m")
assert size == 5748780 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cleanup():\n os.remove(test_file[:-4] + \"_no_grave.h5m\")",
"def remove_group(self):\n try:\n with open_hdf5(self.file_name, mode=\"a\") as hdf_file:\n del hdf_file[self.h5_path]\n except KeyError:\n pass",
"def cleanup_file(name: str):\n if os... | [
"0.64098233",
"0.6114747",
"0.58413917",
"0.582247",
"0.57496554",
"0.56727177",
"0.5573327",
"0.5490028",
"0.54383737",
"0.53650856",
"0.53048605",
"0.5302251",
"0.5285933",
"0.5256595",
"0.52538306",
"0.5244757",
"0.5230618",
"0.5228572",
"0.5218584",
"0.5204441",
"0.516990... | 0.7458633 | 0 |
Ensure that graveyard_removal.py prints the correct entity handle for the graveyard volume. | def test_print_graveyard_removal(capfd):
os.system("python svalinn_tools/graveyard_removal.py " + test_file_path + test_file + " -p")
out, err = capfd.readouterr()
assert ("12682136550675318127" in out) == True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_volume(self):\n ctxt = context.get_admin_context()\n extra_specs = {}\n type_ref = volume_types.create(ctxt, 'hgst-1', extra_specs)\n volume = {'id': '1', 'name': 'volume1',\n 'display_name': '',\n 'volume_type_id': type_ref['id'],\n ... | [
"0.5670078",
"0.5624108",
"0.554459",
"0.5481827",
"0.5419034",
"0.53412575",
"0.5311965",
"0.52677137",
"0.518722",
"0.51854277",
"0.5156141",
"0.5146773",
"0.5126611",
"0.5102824",
"0.50757784",
"0.5075659",
"0.5067923",
"0.50451326",
"0.49824572",
"0.49812868",
"0.4970936"... | 0.6111419 | 0 |
Validate the regex patterns, but only partially while the user is still typing. Because the 'from' pattern will be where the user specifies captures, changing it also requires revalidating the substitution pattern. However if the user is still typing (as opposed to hitting enter to complete the input) we do the minimal... | def validateRegexFields(self, complete=False):
# Assume the patterns aren't valid.
self.m_validFromRe = False
self.m_validPatterns = False
### Validate the 'from' pattern
#
regexCtl = self.m_reFromCtl
subsCtl = self.m_reToCtl
regex, subs = regexCtl.V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onTextChange(self, event):\n\n self.validateRegexFields(complete=False)\n event.Skip()",
"def onHitEnterInFrom(self, event):\n\n self.validateRegexFields(complete=True)\n if self.m_validFromRe:\n self.m_reToCtl.SetFocus()",
"def __checkForPattern(self):\n if se... | [
"0.6140925",
"0.6094179",
"0.60423654",
"0.56661874",
"0.5438786",
"0.53020585",
"0.5268809",
"0.51951706",
"0.5172561",
"0.50293213",
"0.501354",
"0.49975908",
"0.49453467",
"0.49100548",
"0.49090192",
"0.48892468",
"0.48374686",
"0.48184943",
"0.47469115",
"0.46745083",
"0.... | 0.7344064 | 0 |
Refresh our list of what's on disk. | def updateDiskFileList(self):
if self.m_curPath:
# Get me just the files please.
for _, _, files in os.walk(self.m_curPath):
break
else:
files = []
files.sort()
if files != self.m_diskNames:
self.m_diskNames[:] = files
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self):\n self.config.read(self.filename)\n self.loadRecentFiles()",
"def update(self):\n if os.path.isdir(self.full_path):\n self.file_list = os.listdir(self.full_path)\n else:\n self.file_list = []",
"def refresh(self, list_of_tables):\n sel... | [
"0.71091926",
"0.7044655",
"0.700236",
"0.68334323",
"0.68334323",
"0.6765857",
"0.66914636",
"0.66914636",
"0.66914636",
"0.65789855",
"0.65704066",
"0.65704066",
"0.6506549",
"0.6506549",
"0.6505286",
"0.6480908",
"0.6439831",
"0.6422957",
"0.64214545",
"0.64141774",
"0.632... | 0.70745224 | 1 |
Uses the list of filesondisk and the regex patterns to build a list of what the directory will look like if we renamed the files. Because we're justusing a simple text list, we use symbols to show the user which filenames would change and whether they would produce any duplicates, substituting "." with "\1.txt". | def populateFileList(self):
self.m_fileList.SetForegroundColour(wx.NullColour)
# We'll need to track which file names are modified and which
# file names duped.
applicable, dupes = set(), set()
if not self.m_validPatterns:
# Regex's don't compile yet, just use the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_files(file_list, src_dir, pattern, rename=False):\n i = 0\n renamed = regex_group_split(file_list, pattern, False)\n renamed_w_path = [src_dir + fn for fn in renamed]\n orig_fp_list = orig_filepath_list(file_list, src_dir)\n\n for filename in file_list:\n if not (orig_fp_list[i] ==... | [
"0.62912023",
"0.6283787",
"0.61243826",
"0.61238414",
"0.6057",
"0.6056427",
"0.60261464",
"0.6002019",
"0.58697075",
"0.58516043",
"0.58399916",
"0.5831643",
"0.5815127",
"0.5750396",
"0.57445604",
"0.57320064",
"0.5677666",
"0.56666535",
"0.56408477",
"0.5636326",
"0.56356... | 0.6573242 | 0 |
When the user hits 'enter' in the 'from' field. | def onHitEnterInFrom(self, event):
self.validateRegexFields(complete=True)
if self.m_validFromRe:
self.m_reToCtl.SetFocus() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_enter():\n enter_event = QtGui.QKeyEvent(\n QEvent.KeyPress, Qt.Key_Enter, Qt.KeyboardModifiers())\n QtGui.QApplication.sendEvent(self, enter_event)",
"def hit_enter():\n keyboard.press_and_release('Enter')",
"def enter(self):\n\t\tself.actionObject().key_... | [
"0.6778405",
"0.6758216",
"0.67262506",
"0.6404956",
"0.6386746",
"0.63825494",
"0.63070136",
"0.62395203",
"0.6209298",
"0.62009835",
"0.61862344",
"0.61658704",
"0.616317",
"0.6027476",
"0.6005713",
"0.5913",
"0.5905714",
"0.58879393",
"0.58879393",
"0.58485764",
"0.5829572... | 0.7331321 | 0 |
When the user modifies the content of either regex field. | def onTextChange(self, event):
self.validateRegexFields(complete=False)
event.Skip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_field(self, **kwargs):\n if self.regex:\n if not 'regex' in self.field_args:\n self.field_args = self.field_args + ('regex', )\n self.field_klass = forms.RegexField\n return super(StringSetting, self).to_field(**kwargs)",
"def get_regex_mismatch_error_tex... | [
"0.59722745",
"0.58232623",
"0.5730046",
"0.5724786",
"0.5445473",
"0.53800493",
"0.53737646",
"0.53433657",
"0.53141534",
"0.5252366",
"0.52106875",
"0.52057683",
"0.5202676",
"0.515042",
"0.51475894",
"0.51414645",
"0.51303077",
"0.5116394",
"0.5103767",
"0.50991905",
"0.50... | 0.6521979 | 0 |
Returns the updated log_conf, taking into account new log files present on the instance as well as modifications made to the corresponding logentries host. | def update_instance_conf(log_paths, log_conf):
log_client = LogClient.Client(account_key)
instance_id, config = get_ssh_config(env.host)
if log_conf is None and len(log_paths)>0:
print 'log_conf is None'
log_conf = create_host_logs(log_client,instance_id,log_paths)
elif log_conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instance_log_conf(instance_id):\n # Retrieve current log config file\n log_conf_file = None\n\n filename = 'logentries_%s.conf'%instance_id\n rsyslog_conf_name = '/etc/rsyslog.d/%s'%filename\n local_conf_name = '/tmp/%s'%filename\n \n # Clean file present\n try:\n local('rm %... | [
"0.7078796",
"0.6454262",
"0.6153468",
"0.609547",
"0.6065723",
"0.6051836",
"0.60207915",
"0.6019159",
"0.59815073",
"0.59241617",
"0.5814336",
"0.58045876",
"0.5802499",
"0.5684129",
"0.56608063",
"0.5597701",
"0.5580219",
"0.55438983",
"0.55438983",
"0.54896456",
"0.542672... | 0.77249867 | 0 |
Given a distribution, given by the list p_list, returns the entropy of the distribution. | def entropy(p_list):
assert len(p_list) > 0
E = 0.0
for p in p_list:
if p == 0.0:
continue
E += p*math.log(p)
return E | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(l):\n\n probabilities = np.bincount(l) / len(l)\n with np.errstate(divide='ignore'): # ignore log(0) errors, we'll handle\n log_probabilities = np.log2(probabilities)\n log_probabilities[~np.isfinite(log_probabilities)] = 0\n return -np.sum(probabilities * log_probabilities)",
... | [
"0.75446194",
"0.73901826",
"0.7331276",
"0.7134225",
"0.70520824",
"0.7050444",
"0.69640076",
"0.6912087",
"0.68127155",
"0.68039405",
"0.6800982",
"0.6751854",
"0.6749378",
"0.6710503",
"0.6699265",
"0.6682273",
"0.6634976",
"0.6633226",
"0.6585759",
"0.6569177",
"0.6564183... | 0.83441865 | 0 |
For a list of dictionaries mapping values to counts, returns a cost used for DT splitting that is optimal at 0. Currently uses the negative of information gain. | def split_cost(label_count_list):
return -split_information_gain(label_count_list)
#this cost value is the misclassification error.
return split_misclassification_error(label_count_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(foods, foods_used):\n cost = 0.00\n for i, count in foods_used.items():\n cost += (foods[i]['serving_cost'] * count)\n return cost",
"def weighted_score(counters, lst, weight):\n if counters == None:\n counters = {}\n\n\n for item in lst:\n if item in counters:\n ... | [
"0.58399343",
"0.5823463",
"0.5779527",
"0.55471617",
"0.5469961",
"0.5425537",
"0.53996956",
"0.5383586",
"0.533916",
"0.5299643",
"0.52919436",
"0.5257763",
"0.52473646",
"0.52160746",
"0.52141124",
"0.52082145",
"0.51415884",
"0.5134601",
"0.5126979",
"0.5097489",
"0.50955... | 0.6280166 | 0 |
Given a list of values and associated labels, optimizes the best split threshold z where dividing the values into z has the lowest split cost. Returns a pair (z,cost) where cost is the split_cost of the threshold z. If nonelabels is given, this indicates the labels of missing values that must be passed down to both sub... | def best_split(values,labels,nonelabels=None):
assert len(values) >= 2
assert len(values) == len(labels)
N = len(values)
ilist = sorted((v,l) for (v,l) in zip(values,labels))
leftcount = defaultdict(int)
rightcount = defaultdict(int)
for v,l in ilist:
rightcount[l] += 1
bestindex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_cost(label_count_list):\n return -split_information_gain(label_count_list)\n #this cost value is the misclassification error.\n return split_misclassification_error(label_count_list)",
"def pick_best_split(self,db,labels,ids,features=None):\n idlabels = [labels[id] for id in ids]\n ... | [
"0.6308325",
"0.60905",
"0.586987",
"0.5617052",
"0.5437539",
"0.5403514",
"0.5329129",
"0.52851343",
"0.52182657",
"0.51694614",
"0.5163954",
"0.5138482",
"0.5117913",
"0.5107134",
"0.5100632",
"0.5094282",
"0.50677717",
"0.50626785",
"0.50522244",
"0.5046674",
"0.50465786",... | 0.7924888 | 0 |
Looks up the leaf node corresponding to the given entry. Does not handle missing values. | def lookup(self,entry):
if self.type == 'v':
return self
v = entry[self.feature]
assert v != None
if self.type == 's':
c = None
try:
c = self.children[v]
except KeyError:
#print "Unseen value for feature",sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_parent_node(self, entry, key):\r\n parent = entry\r\n keys = key.split(\".\")\r\n for k in keys:\r\n try:\r\n parent = parent[k]\r\n except:\r\n raise Exception(\"key \\\"\" + key + \"\\\" was not found in HAR file\")\r\n retu... | [
"0.6321155",
"0.62434244",
"0.61522406",
"0.6018858",
"0.601176",
"0.6007655",
"0.59877974",
"0.5881265",
"0.5834447",
"0.5798371",
"0.57872856",
"0.5778088",
"0.57707995",
"0.5761493",
"0.57495886",
"0.57285845",
"0.57001275",
"0.56570214",
"0.56385493",
"0.5637989",
"0.5608... | 0.6669498 | 0 |
Given a indexed database db, a list of labels (one for each id), and a list of ids to test, sets this node to the best label. | def pick_best_label(self,db,labels,ids):
self.type = 'v'
if len(labels) > 0:
self.value = vote([labels[id] for id in ids])
else:
self.value = None
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learn(self,db,labels):\n self.keys = db.keys[:]\n labelindex = -1\n if isinstance(labels,str):\n labelindex = db.keys.index(labels)\n assert labelindex >= 0,\"label does not exist in database keys\"\n labels = db.get_column(labelindex)\n elif isinsta... | [
"0.68891954",
"0.6300339",
"0.58898443",
"0.5635267",
"0.5226151",
"0.51870143",
"0.51595086",
"0.50911933",
"0.50677323",
"0.49870756",
"0.4969618",
"0.4949305",
"0.4914531",
"0.49075586",
"0.48753136",
"0.48677775",
"0.48287308",
"0.47792596",
"0.47701105",
"0.47633627",
"0... | 0.73168194 | 0 |
Given an index database db, a list of labels (one for each id), and a list of ids to train on, computes the optimal split value. It modifies this node to have the optimal split type and value, and then returns the quality of the split as computed by the split_cost function. If features != None, it is a list of availabl... | def pick_best_split(self,db,labels,ids,features=None):
idlabels = [labels[id] for id in ids]
if misclassification_error(idlabels) == 0:
#base case: no misclassifications
self.type = 'v'
self.value = idlabels[0]
return 0
best = None
bestCost... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_split_feature(self, data_set, target_feature, tree_features):\n\n if self.__criterion == 'entropy':\n feature_gains = {feature: self.__gain(data_set, feature, target_feature) for (feature) in tree_features}\n split_feature = max(feature_gains, key=feature_gains.get)\n ... | [
"0.59855705",
"0.57539624",
"0.5735463",
"0.57259667",
"0.5551452",
"0.55483556",
"0.5174804",
"0.5155585",
"0.5107157",
"0.50866544",
"0.50679135",
"0.5035721",
"0.50326467",
"0.5029078",
"0.50207394",
"0.4985602",
"0.49575225",
"0.4956578",
"0.4938984",
"0.49286735",
"0.490... | 0.7983181 | 0 |
Learns from a Database instance. Each entry is given a label. | def learn(self,db,labels):
self.keys = db.keys[:]
labelindex = -1
if isinstance(labels,str):
labelindex = db.keys.index(labels)
assert labelindex >= 0,"label does not exist in database keys"
labels = db.get_column(labelindex)
elif isinstance(labels,int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_data_to_db(labelled):\n add_query = sqlite3.connect(DB_PATH).cursor()\n add_query.execute(\n \"CREATE TABLE IF NOT EXISTS labels(text TEXT, label TEXT, score FLOAT)\")\n for entry in labelled:\n add_query.execute(\"\"\"INSERT INTO labels(text,label,score) VALUES(?,?,?)\"\"\",\n ... | [
"0.607027",
"0.5603955",
"0.52142614",
"0.51333624",
"0.51184493",
"0.5110511",
"0.50444543",
"0.50385123",
"0.50106204",
"0.50006604",
"0.49866673",
"0.49164563",
"0.48594052",
"0.48593736",
"0.48549092",
"0.48429736",
"0.4827033",
"0.48192468",
"0.4811291",
"0.48048383",
"0... | 0.6163972 | 0 |
Given a indexed database, greedily and recursively learns the split value for the subtree of the indicated node. Return value is the number of mistakes made by the decision tree. Missing values are handled properly as indicating a 'don't care' value that gets passed down to both sides of the tree. | def greedy_learn(self,node,db,labels,ids):
if node.depth >= self.maxdepth or len(ids) <= self.minexamples:
#terminate recursion
node.pick_best_label(db,labels,ids)
err = misclassification_error([labels[id] for id in ids])
if err > 0:
print "Reached... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_split( df, attribute, split ):\n mask = df[attribute] <= split\n \n # split the dataset on the split attribute\n dfl = df[mask]\n dfr = df[~mask]\n \n \n # calculate weighting factors for child\n weighting_factor_left = float(dfl.shape[0])/df.shape[0]\n weighting_factor_ri... | [
"0.55779785",
"0.5408219",
"0.5375125",
"0.52919394",
"0.5285259",
"0.5265397",
"0.523007",
"0.5206214",
"0.5131763",
"0.5119118",
"0.5102969",
"0.50822806",
"0.50254524",
"0.50055486",
"0.5000578",
"0.498862",
"0.49706918",
"0.4968559",
"0.49658915",
"0.49245366",
"0.4886081... | 0.5963019 | 0 |
Identifies the list of example indices that would follow the decision tree to node. | def identify_examples(self,db,labels,node):
path = []
while node.parent != None:
nkey = None
for (k,c) in node.parent().children.iteritems():
if c is node:
nkey = k
break
assert nkey != None
path.appe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_nodes_indexes(self) -> _TargetNodes:\n return self.__target_nodes_indexes",
"def reference_nodes_idx(self) -> Dict[str, torch.Tensor]:\n return self.node_idx_references",
"def get_34index_list(self):\n msk = self.load_mask()\n return [i for (i,v) in enumerate(msk) if v==1... | [
"0.65589315",
"0.63866156",
"0.6244448",
"0.6186481",
"0.60354745",
"0.5978617",
"0.5964173",
"0.5956777",
"0.589274",
"0.5866264",
"0.58425367",
"0.58398837",
"0.58153033",
"0.58101755",
"0.58045644",
"0.57759035",
"0.57590544",
"0.57380056",
"0.57340384",
"0.5718878",
"0.57... | 0.68075645 | 0 |
Same as greedy learn, but with a maximum number of nodes. Rather than a DFS, this uses a priority queue that at each step splits the node with the maximum improvement in misclassification error. At most maxnodes are in the resulting tree, and the depth is limited to maxdepth. Returns the total number of misclassificati... | def greedy_learn_search(self,db,labels):
queue = PriorityQueue()
dolowmem = (self.lowmem == True)
numidsets = 0
root_ids = range(len(labels))
queue.push((self.root,root_ids),len(labels))
numnodes = 1
deepest = 0
err = 0
while len(queue) > 0 and num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_count_max(self) -> int:\n return int(self.graph_tuple_stats.node_count_max or 0)",
"def max_node_count(self) -> int:\n return pulumi.get(self, \"max_node_count\")",
"def max_node_count(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_node_count\")",
"def max_nod... | [
"0.6156422",
"0.6155967",
"0.59827256",
"0.5911448",
"0.5853999",
"0.583166",
"0.5827011",
"0.5772355",
"0.5760408",
"0.570417",
"0.5690565",
"0.5642428",
"0.55889016",
"0.556948",
"0.5526726",
"0.5512847",
"0.5484053",
"0.54723763",
"0.54671174",
"0.5442169",
"0.54306436",
... | 0.62972176 | 0 |
Initializes the list. If entries is given, this initializes the entries of the list. If memoized = True, any lazy evaluated entries are saved after their first evaluation. | def __init__(self,entries=None,memoized=False):
if entries is not None:
self.entries = entries[:]
else:
self.entries = []
self.memoized = memoized | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, contents=()):\n self._data = [self._Item(k, v) for k,v in contents] # empty by default\n if len(self._data) > 1:\n self._heapify()",
"def init_all_entries(self) -> bool:\n raise NotImplementedError",
"def __init__(self, owner, entries=None):\n\n self.o... | [
"0.5535386",
"0.54829353",
"0.5454826",
"0.53897613",
"0.5307603",
"0.5187028",
"0.5180785",
"0.514409",
"0.50772923",
"0.5034808",
"0.5021943",
"0.5018495",
"0.49956906",
"0.49621394",
"0.49150985",
"0.49012715",
"0.4892579",
"0.48834223",
"0.48831782",
"0.48757192",
"0.4859... | 0.7950624 | 0 |
Given a training and testing dataset, builds a decision tree and tests it | def test_decision_tree(train,test,maxnodes=None):
tree = DecisionTree()
tree.maxnodes = maxnodes
errors = tree.learn(train,'label')
print "Decision tree makes",errors,"errors"
print "Depth",tree.depth(),"nodes",tree.numNodes()
if tree.numNodes() < 100:
tree.pprint()
if errors > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_and_evaluate_decision_tree(X_train, y_train, X_test, y_test):\n model = DecisionTreeClassifier(criterion='entropy')\n model.fit(X_train, y_train)\n y_pred = model.predict(X_train)\n y_heldPred = model.predict(X_test)\n acc_train = accuracy_score(y_train, y_pred)\n acc_heldOut = accuracy... | [
"0.71724963",
"0.6940502",
"0.6876765",
"0.6875179",
"0.68419737",
"0.68007624",
"0.671924",
"0.6693489",
"0.6642988",
"0.6619835",
"0.657808",
"0.6437057",
"0.6418784",
"0.63988245",
"0.6392599",
"0.63923985",
"0.6373904",
"0.63466936",
"0.6346446",
"0.6345242",
"0.63415146"... | 0.6959578 | 1 |
Test the template tag js_settings | def test_js_settings(mocker, rf):
mocker.patch(
"mitxpro.templatetags.js_interop.get_js_settings",
return_value={"data": "value"},
)
request = rf.get("/")
context = Context({"request": request})
template = Template(("{% load js_interop %}" "{% js_settings %}"))
rendered_templat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jssettings(self):\n self.update()\n return \"var %s = %s\" % (self.js_var_settings_name,\n json.dumps(self.settings))",
"def test_jssettings(self):\n settings_fullpath = os.path.join(dirs.get_main_js_dir(), \"mediabrute-settings.js\")\n \n i... | [
"0.6923433",
"0.6532566",
"0.6531576",
"0.6457588",
"0.6457588",
"0.6105654",
"0.6031209",
"0.60102826",
"0.5945879",
"0.5761625",
"0.57324207",
"0.5658938",
"0.5633526",
"0.5626261",
"0.5626261",
"0.55889726",
"0.5578439",
"0.5576125",
"0.5567976",
"0.5524449",
"0.54723006",... | 0.8117115 | 0 |
This function computes the fundamental matrix by computing the SVD of Ax = 0 ; 8point algorithm | def computeFundamentalMatrix(pts1, pts2):
A = np.empty((8, 9))
for i in range(len(pts1)-1):
x1 = pts1[i][0]
x2 = pts2[i][0]
y1 = pts1[i][1]
y2 = pts2[i][1]
A[i] = np.array([x1 * x2, x2 * y1, x2,
y2 * x1, y2 * y1, y2,
x1, y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svd0(A):\n M,N = A.shape\n if M>N: return sla.svd(A, full_matrices=True)\n else: return sla.svd(A, full_matrices=False)",
"def invert_L1_svd():",
"def visualize_svd():",
"def svd(self):\n U, s, Vh = la.svd(self)\n S = np.zeros(self.shape)\n np.fill_diagonal(S, s)\n return... | [
"0.66048837",
"0.6466162",
"0.6259937",
"0.6250825",
"0.62505597",
"0.62274474",
"0.6104567",
"0.6089218",
"0.6025379",
"0.5982765",
"0.597328",
"0.590215",
"0.58907986",
"0.58582675",
"0.58575904",
"0.584388",
"0.58408606",
"0.58376825",
"0.581499",
"0.58008623",
"0.5792866"... | 0.68444854 | 0 |
Leverages the 8point algorithm and implement RANSAC algorithm to find the inliers and the best fundamental matrix | def getInlierRANSAC(pts1, pts2):
# global finalFundamentalMatrix
iterations = 50
threshold = 0.01
max_count = 0
n = len(pts1)
finalFundamentalMatrix = np.zeros((3, 3))
for i in range(iterations):
count = 0
idx = random.sample(range(n - 1), 8)
left_pts = pts1[idx]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ransac(data, hypothesis, metric, sample_size, num_iter, inlier_thresh):\n N,d = data.shape\n best_frac, best_hypothesis, best_mask = 0, None, None\n for i in range(num_iter):\n js = np.random.choice(N,size=sample_size,replace=False)\n hypothesis_elements = data[js,:]\n H = hypothe... | [
"0.6203597",
"0.5916464",
"0.5894118",
"0.5867515",
"0.5715989",
"0.56956524",
"0.56905115",
"0.5686345",
"0.56403846",
"0.55984086",
"0.5590803",
"0.5577823",
"0.5559308",
"0.5542196",
"0.5525735",
"0.55202436",
"0.55189615",
"0.55174667",
"0.5481329",
"0.5479639",
"0.546803... | 0.699575 | 0 |
This function computes the essential matrix from the fundamental matrix. The E matrix is defined in normalized image coordinates | def getEssentialMatrix(K, F):
E = np.dot(K.T, np.dot(F, K))
u, s, v = np.linalg.svd(E)
# We correct the singular values of the E matrix
s_new = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]).reshape(3, 3)
final_E = np.dot(u, np.dot(s_new, v))
return final_E | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eigen_decomp(matrix):\n w = None\n v = None\n ### YOUR CODE HERE\n w,v=np.linalg.eig(matrix)\n ### END YOUR CODE\n return w, v",
"def P(self):\n self.eigenmatrix()",
"def Euler2Mat(e):\n x=e[0]\n y=e[1]\n z=e[2]\n s1=np.sin(x)\n s2=np.sin(y)\n s3=np.sin(z)\n c1... | [
"0.60159427",
"0.6003989",
"0.5936057",
"0.5899959",
"0.58792543",
"0.58560514",
"0.5814833",
"0.58042705",
"0.57690716",
"0.5768329",
"0.57617337",
"0.57117414",
"0.5709993",
"0.5708076",
"0.5683127",
"0.56726044",
"0.56690747",
"0.5665278",
"0.5657497",
"0.56303555",
"0.561... | 0.6334938 | 0 |
Given the essential matrix, we derive the camera position and orientation | def ExtractCameraPose(E):
u, s, v = np.linalg.svd(E, full_matrices=True)
w = np.array([[0, -1, 0],
[1, 0, 0],
[0, 0, 1]]).reshape(3, 3)
c1 = u[:, 2].reshape(3, 1)
r1 = np.dot(np.dot(u, w), v).reshape(3, 3)
c2 = -u[:, 2].reshape(3, 1)
r2 = np.dot(np.dot(u, w), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_camera_orientation(self):\n\n # Create the vector from the camera to the robot\n vector_x = self.robot_x - self.camera_x\n vector_y = self.robot_y - self.camera_y\n vector_z = self.robot_z - self.camera_z\n\n # Calculate yaw and pitch from this vector\n yaw = math.... | [
"0.6524759",
"0.64992476",
"0.6400119",
"0.62868214",
"0.6233258",
"0.62323457",
"0.6178379",
"0.6016908",
"0.6012133",
"0.60015947",
"0.5997646",
"0.59892434",
"0.5961536",
"0.5942139",
"0.59395564",
"0.5925271",
"0.5909638",
"0.58591086",
"0.58126867",
"0.581134",
"0.580240... | 0.7063537 | 0 |
This function returns the extrinsic parameter matrix | def getExtrinsicParameter(K, R, C):
t = np.dot(-R, C)
homogeneous_matrix = np.hstack((R.reshape(3, 3), t))
extrinsic_parameter = np.dot(K, homogeneous_matrix)
return extrinsic_parameter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_intrinsic_mat(params):\n return np.asarray(\n [\n [params[0], 0.0, params[1]],\n [0.0, params[2], params[3]],\n [0.0, 0.0, 1.0],\n ]\n )",
"def get_extrinsic_matrix(pose):\n batch_size, _ = pose.shape\n rot = pose[:,:3]\n trans = pose[:,3:]\n\... | [
"0.7331173",
"0.63358027",
"0.63124555",
"0.6310796",
"0.61443675",
"0.61443675",
"0.61398846",
"0.6122645",
"0.6090896",
"0.59263265",
"0.58786243",
"0.5862724",
"0.5847503",
"0.58337194",
"0.57778543",
"0.5750955",
"0.57484686",
"0.57484686",
"0.5668891",
"0.5660093",
"0.56... | 0.6725677 | 1 |
removes all Hydrogen atoms from instance | def remove_hydrogens(self) -> None:
for cid, c in self:
for rid, r in c:
for aid, a in r:
if a.element == 'H':
print('removing H at %s' % aid)
r.remove_atom(a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n del self.shx.atoms[self.index]",
"def strip(self):\n types = [type(self.strip),\n type(self.values),\n type(self.__ne__),\n type(self.__class__)]\n\n for attr in dir(self):\n if not type(getattr(self, attr)) in ty... | [
"0.6937832",
"0.6847128",
"0.6714238",
"0.6525774",
"0.64063466",
"0.63946915",
"0.62644595",
"0.6262052",
"0.6121503",
"0.60625106",
"0.60625106",
"0.6042291",
"0.6015206",
"0.5961813",
"0.5960132",
"0.592724",
"0.5911329",
"0.58740425",
"0.5869668",
"0.5853029",
"0.5847566"... | 0.7476278 | 0 |
collect a set of residues with memb_z within [15, 15] | def memb_residues(pdb: MyPDB) -> list():
result = []
for ch in pdb.chains.values():
for res in ch.values():
if res.memb_z is not None:
result.append(res)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subset_mz(self, mz):\n regions = self.boxes_mz.at(mz)\n it = BoxHolder()\n for r in regions:\n box = r.data\n it.add_box(box)\n return it",
"def get_subset(mlist,year):\n newlist = []\n for entry in mlist:\n if int(entry[0][:4]) > int(year):\... | [
"0.5860528",
"0.5294917",
"0.5274569",
"0.5238881",
"0.51128125",
"0.50799537",
"0.50743914",
"0.4973342",
"0.49630117",
"0.49471557",
"0.49072868",
"0.48891437",
"0.48831913",
"0.48573068",
"0.48536083",
"0.4842539",
"0.4838259",
"0.48302126",
"0.48269477",
"0.48252738",
"0.... | 0.59874827 | 0 |
Initializes indicating root Python module. The application will look for all `Resource` classes defined in the given root module. | def __init__(self, root):
self._root = root
if not self.get_resources():
raise Exception('Your application has no Resource.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, basedir=None):\n # ------------------------------------------------------------------------\n super(Resources, self).__init__()\n self.xInitialize(basedir or \"resources\")",
"def __init__(self):\n self.modules = {}",
"def init(self):\n\n self.loaded = False\n ... | [
"0.6172543",
"0.6130026",
"0.58406955",
"0.5820272",
"0.5808664",
"0.56877095",
"0.5673514",
"0.5664736",
"0.5635875",
"0.561636",
"0.5615964",
"0.559234",
"0.5569267",
"0.5522192",
"0.5514438",
"0.5474632",
"0.54634255",
"0.54632753",
"0.5462733",
"0.54501873",
"0.5443123",
... | 0.7221802 | 0 |
Unnormalize a given image. | def unnormalize(self, image, transpose=False):
return unnormalize(image, self.mean, self.std, transpose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise(image):",
"def normalize_image(img):\n arr = np.array(img)\n new_img = Image.fromarray(normalize(arr).astype('uint8'),'L')\n return new_img",
"def reverse_normalize(image):\n\n reverse = transforms.Normalize(mean=[-0.485 / 0.229, -0.456 / 0.224, -0.406 / 0.255],\n ... | [
"0.78914344",
"0.76616216",
"0.7482308",
"0.7246689",
"0.7187682",
"0.71326315",
"0.71250784",
"0.69919527",
"0.6929422",
"0.6927052",
"0.6911609",
"0.6908462",
"0.6908327",
"0.69034034",
"0.6890873",
"0.6881274",
"0.6876974",
"0.68578804",
"0.6824972",
"0.68119633",
"0.67838... | 0.7967136 | 0 |
Handle imbalanced dataset through sampler. | def create_class_imbalance_sampler(self):
count = [0] * len(self.classes)
for item in self.train_data.imgs:
count[item[1]] += 1
weight_per_class = [0.] * len(self.classes)
for i in range(len(self.classes)):
weight_per_class[i] = float(sum(count)) / float(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balanced_sampling(dat: pd.DataFrame, logger=None):\n if logger == None:\n logging.basicConfig(\n level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n logger = logging.getLogger(__name__)\n \n \n # upsampling\n logger.info('Start balanced s... | [
"0.62204057",
"0.61685914",
"0.5826256",
"0.5715278",
"0.5707387",
"0.5623797",
"0.561231",
"0.55672514",
"0.5549182",
"0.54543215",
"0.5443967",
"0.5442228",
"0.5435967",
"0.54301053",
"0.5364784",
"0.53321433",
"0.53314674",
"0.5326067",
"0.5314146",
"0.5309174",
"0.5304186... | 0.6245745 | 0 |
Get the selected locale from user settings. | def get_locale():
setting = Setting.query.filter(Setting.name == 'default_language').first()
if setting is not None:
return setting.value
# Return default language when none found
return 'en' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_locale():\n localLang = request.args.get('locale')\n supportLang = app.config['LANGUAGES']\n if localLang in supportLang:\n return localLang\n userId = request.args.get('login_as')\n if userId:\n localLang = users[int(userId)]['locale']\n if localLang in supportLang:\n ... | [
"0.7412174",
"0.7108176",
"0.69538045",
"0.69421023",
"0.68359756",
"0.67491263",
"0.67384523",
"0.6731309",
"0.650032",
"0.63808835",
"0.6361166",
"0.63441944",
"0.63441944",
"0.6340159",
"0.62725174",
"0.61259097",
"0.6097418",
"0.6096102",
"0.60663605",
"0.60374147",
"0.60... | 0.73380387 | 1 |
Decodes a Base58Check encoded key. | def from_b58check(key):
return HDKey.from_bytes(base58.b58decode_check(key))[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base58_decode(v: bytes) -> bytes:\n try:\n prefix_len = next(\n len(encoding[2])\n for encoding in base58_encodings\n if len(v) == encoding[1] and v.startswith(encoding[0])\n )\n except StopIteration:\n raise ValueError('Invalid encoding, prefix or le... | [
"0.65961087",
"0.6403686",
"0.6391344",
"0.63413113",
"0.6321229",
"0.6299899",
"0.61630493",
"0.6157103",
"0.61495435",
"0.60469747",
"0.600818",
"0.59588367",
"0.5914103",
"0.5791583",
"0.57892734",
"0.5774782",
"0.5729094",
"0.5713923",
"0.5695626",
"0.5672472",
"0.5671971... | 0.74329513 | 0 |
Generates either a HDPrivateKey or HDPublicKey from the underlying bytes. | def from_bytes(b):
if len(b) < 78:
raise ValueError("b must be at least 78 bytes long.")
version = int.from_bytes(b[:4], 'big')
depth = b[4]
parent_fingerprint = b[5:9]
index = int.from_bytes(b[9:13], 'big')
chain_code = b[13:45]
key_bytes = b[45:78]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_ecdh_key_pair() -> tuple[X25519PrivateKey, bytes]:\n private_key = X25519PrivateKey.generate()\n public_key_raw = private_key.public_key().public_bytes(\n serialization.Encoding.Raw, serialization.PublicFormat.Raw\n )\n return private_key, public_key_raw",
"def mk_keyobj_from_priv... | [
"0.6803569",
"0.6298475",
"0.6296541",
"0.61843973",
"0.6125002",
"0.6038086",
"0.6034926",
"0.6032014",
"0.6002514",
"0.5997152",
"0.598115",
"0.59766436",
"0.59530914",
"0.59374905",
"0.59370124",
"0.5930606",
"0.588195",
"0.5862614",
"0.5829133",
"0.5813407",
"0.58064556",... | 0.7741583 | 0 |
Whether or not this is a hardened node. Hardened nodes are those with indices >= 0x80000000. | def hardened(self):
# A hardened key is a key with index >= 2 ** 31, so
# we check that the MSB of a uint32 is set.
return self.index & 0x80000000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_leaf(self):\r\n return self.zero_son is None and self.one_son is None",
"def is_internal(self):\n if self.is_leaf() or self.is_semileaf():\n return False\n return True",
"def node_inode(self):\n return False",
"def node_inode(self):\n return False",
"d... | [
"0.62713253",
"0.60492986",
"0.5942298",
"0.5942298",
"0.5901078",
"0.57642645",
"0.5762194",
"0.5736317",
"0.57134473",
"0.5682844",
"0.5674507",
"0.5665041",
"0.56444204",
"0.5642746",
"0.56300306",
"0.55741334",
"0.55603236",
"0.55570173",
"0.55541235",
"0.5552279",
"0.552... | 0.68602026 | 0 |
Returns the key's fingerprint, which is the first 4 bytes of its identifier. | def fingerprint(self):
return self.identifier[:4] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fingerprint(public_key):\r\n\r\n return hashlib.new('ripemd160', hashlib.sha256(public_key).digest()).digest()[:4]",
"def fingerprint(self, key):\n base64_pub = self.base64_pub_encode(key)\n return SHA256.new(base64_pub.encode('utf-8')).digest()",
"def fingerprint(self):\n return se... | [
"0.77391666",
"0.76859707",
"0.7634195",
"0.7514036",
"0.7471615",
"0.7366445",
"0.7218066",
"0.71334374",
"0.70777875",
"0.7041138",
"0.68841106",
"0.68285894",
"0.6695113",
"0.6680278",
"0.66001993",
"0.66001993",
"0.66001993",
"0.65500057",
"0.6528393",
"0.6461605",
"0.642... | 0.7981021 | 0 |
Get inventory list from config files builds a NetworkRunner inventory object and a mac_map dictionary according to ansible inventory file yaml definition | def __init__(self):
self.inventory = {}
self.mac_map = {}
for conffile in CONF.config_file:
# parse each config file
sections = {}
parser = cfg.ConfigParser(conffile, sections)
try:
parser.parse()
except IOError as e:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n # endpdoint = \"restconf/data/ietf-interfaces:interfaces\"\n # endpoint = f\"restconf/data/ietf-interfaces:interfaces/interface={name}\"\n\n if len(argv) > 1:\n try:\n inventory = load_inventory(argv[1])\n except FileExistsError as err:\n print(\"FileEx... | [
"0.57955146",
"0.5357593",
"0.5309615",
"0.52972466",
"0.52823687",
"0.52815616",
"0.5225071",
"0.5193531",
"0.51922613",
"0.5180207",
"0.5171256",
"0.5163886",
"0.51440394",
"0.5126848",
"0.5065334",
"0.5064806",
"0.5061558",
"0.50566524",
"0.5048825",
"0.5046078",
"0.503131... | 0.6786082 | 0 |
Test case for get_liveness Get job service liveness | def test_get_liveness(self):
response = self.client.open('/api/v1//liveness',
method='GET',
content_type='application/json')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liveness():\n return '', 200",
"def test_get_refresh_job_status(self):\n pass",
"def liveness_probe():\n return \"I am still alive!\"",
"def test_estimate_liveness_batch(self):\n detection = self.detector.detectOne(VLImage.load(filename=SPOOF), detect68Landmarks=True)\n estimat... | [
"0.6060957",
"0.60050637",
"0.5874817",
"0.5739824",
"0.56933695",
"0.5687158",
"0.5626335",
"0.56105167",
"0.560023",
"0.55861163",
"0.55428433",
"0.5536615",
"0.55124384",
"0.54971635",
"0.5488803",
"0.5478777",
"0.5478777",
"0.54599184",
"0.54395",
"0.54195917",
"0.5348092... | 0.73525107 | 0 |
Test case for get_readiness Get job service readiness | def test_get_readiness(self):
response = self.client.open('/api/v1//readiness',
method='GET',
content_type='application/json')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_refresh_job_status(self):\n pass",
"def test_readiness_endpoint(self):\n url = f'{BASE_URL}/ready'\n response = requests.get(url)\n response_json = response.json()\n assert response.status_code == 503\n assert response_json['status'] == 503",
"def test_sta... | [
"0.72830915",
"0.6839322",
"0.6632437",
"0.65635777",
"0.63915956",
"0.63915956",
"0.6313089",
"0.6205987",
"0.61734414",
"0.61597115",
"0.614555",
"0.6124894",
"0.6102056",
"0.6053104",
"0.604147",
"0.60116535",
"0.59794265",
"0.59655803",
"0.5928916",
"0.5915668",
"0.588532... | 0.7425097 | 0 |
=============================================================== save_obj(obj, saved_name ) =============================================================== this function is used to save any python object to your hard desk | def save_obj(obj, saved_name ):
with open( saved_name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_obj(obj, name):\r\n with open('../pickle/' + name + '.pkl', 'wb') as fout:\r\n pickle.dump(obj, fout, pickle.HIGHEST_PROTOCOL)\r\n # end with\r",
"def save_obj(obj, name):\n \n with open(name + '.pkl', 'wb') as objec:\n pickle.dump(obj, objec)",
"def save_obj(obj,... | [
"0.83799785",
"0.83523476",
"0.834026",
"0.834026",
"0.8322952",
"0.8320533",
"0.81125903",
"0.805116",
"0.80221593",
"0.79732233",
"0.7954794",
"0.79475254",
"0.790895",
"0.78999376",
"0.7857288",
"0.7842152",
"0.7814447",
"0.7774819",
"0.76592255",
"0.7642796",
"0.76062477"... | 0.88148 | 0 |
=============================================================== load_obj(saved_name) =============================================================== this function is used to save any python object to your hard desk | def load_obj(saved_name):
with open( saved_name + '.pkl', 'rb') as f:
return pickle.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_obj(obj, saved_name ):\n with open( saved_name + '.pkl', 'wb') as f:\n pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)",
"def save_obj(obj, name):\n with open('../../data/' + name + '.pkl', 'wb') as f:\n pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)",
"def save_obj(obj, name):\n wit... | [
"0.81122315",
"0.7685448",
"0.7685448",
"0.7588679",
"0.75443125",
"0.74489355",
"0.74238276",
"0.7387553",
"0.730978",
"0.730978",
"0.7296159",
"0.7197405",
"0.71187323",
"0.7099137",
"0.7085125",
"0.7082581",
"0.70419323",
"0.70103645",
"0.70006555",
"0.6940859",
"0.6908531... | 0.82277983 | 0 |
=========================================================== DateFormatedSQL(x) =========================================================== this function converts the the date read from a list to a datetime format | def DateFormatedSQL(x):
x=[i[0] for i in x]
x1=[]
for i in x:
if len(i)==19:
x1.append(datetime.datetime(int(i[:4]),int(i[5:7]),int(i[8:10]),int(i[11:13]),int(i[14:16]),int(i[17:18]) ))
# elif len(i)==13:
# x1.append(datetime.datetime(int(i[:4]),int(i[5:7]),int(i[8... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_format_from_input_to_datetime(list_d_t_t):\n data_output = []\n\n for row in list_d_t_t:\n data_output.append([datetime.datetime.strptime(row[0] + \" \" + row[1], \"%Y-%m-%d %H:%M:%S\"),\n datetime.datetime.strptime(row[0] + \" \" + row[2], \"%Y-%m-%d %H:%M:%S\")]... | [
"0.66734904",
"0.65000284",
"0.6259414",
"0.59757656",
"0.5600508",
"0.5579302",
"0.5578522",
"0.5551475",
"0.5513122",
"0.54512274",
"0.5435365",
"0.52705914",
"0.52298",
"0.5214014",
"0.5199284",
"0.51939476",
"0.5177129",
"0.5144611",
"0.51139647",
"0.5111645",
"0.5084982"... | 0.7940835 | 0 |
=========================================================== dateformated(x) =========================================================== this function converts the the date read from a list to a datetime format | def DateFormated(x):
x1=[]
for i in x:
if len(i)==19:
x1.append(datetime.datetime(int(i[:4]),int(i[5:7]),int(i[8:10]),int(i[11:13]),int(i[14:16]),int(i[17:18]) ))
# elif len(i)==13:
# x1.append(datetime.datetime(int(i[:4]),int(i[5:7]),int(i[8:10]),int(i[11:13]),int(0),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_format_from_input_to_datetime(list_d_t_t):\n data_output = []\n\n for row in list_d_t_t:\n data_output.append([datetime.datetime.strptime(row[0] + \" \" + row[1], \"%Y-%m-%d %H:%M:%S\"),\n datetime.datetime.strptime(row[0] + \" \" + row[2], \"%Y-%m-%d %H:%M:%S\")]... | [
"0.73220545",
"0.6644235",
"0.64673054",
"0.63785565",
"0.6323779",
"0.63159305",
"0.6256937",
"0.6174311",
"0.5986844",
"0.58866596",
"0.5878423",
"0.58775616",
"0.58339506",
"0.579193",
"0.57800907",
"0.57769805",
"0.5757611",
"0.57572365",
"0.57409817",
"0.5732213",
"0.572... | 0.75249213 | 0 |
Check if a record exists matching the service pattern with the current host's ip | def record_exists(route53_zone, service_name, ip):
# Match records belonging to the service for particular service and
# environment.
match_regex = "{}\d+\.{}\.?".format(service_name, route53_zone.name)
for record in route53_zone.get_records():
match = re.match(match_regex, record.name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cusip_exists(record):\n cusips = helper.query_db('instruments', 'cusip')\n assert record['cusip'] in cusips",
"def name_matches_ip(name, ip, state):\n for client in state['clients']:\n if client['name'] == name:\n if client['ip'] == ip:\n return True\n el... | [
"0.6178328",
"0.6014736",
"0.59269434",
"0.58188164",
"0.56742144",
"0.56725705",
"0.56573004",
"0.5653265",
"0.56383586",
"0.56271714",
"0.5579105",
"0.5578969",
"0.55783236",
"0.5542878",
"0.55369085",
"0.55349123",
"0.5531589",
"0.5526352",
"0.5510327",
"0.5509592",
"0.548... | 0.7733625 | 0 |
Creates record with record_name and ip; updates record if it already exists with different ip does nothing if record already exists with same ip | def upsert_record(route53_zone, record_name, ip):
# Only upsert the dns record if it doesn't resolve to us.
try:
record_ip = socket.gethostbyname(record_name)
except socket.error:
# Ignore if we can't connect to the host
pass
else:
if ip == record_ip:
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_record(self, record_name, ip):\n if ((not hasattr(self, '_current_zone')) or (not self._current_zone)) or ((not hasattr(self, '_new_zone_version_number')) or (not self._new_zone_version_number)):\n raise GandiApiException(\"Can't update record, no cloned zone available.\")\n \n... | [
"0.72148836",
"0.66041684",
"0.62076926",
"0.6207673",
"0.5900262",
"0.58394516",
"0.58283144",
"0.57992715",
"0.57729447",
"0.5762532",
"0.57310665",
"0.5682131",
"0.5672659",
"0.5666608",
"0.5655603",
"0.5637485",
"0.56220573",
"0.56179416",
"0.560817",
"0.56004244",
"0.559... | 0.7590886 | 0 |
Create a new EC2 instance with specific parameters SecurityGroup (sg) and KeyPair (key) have to be previously created (see cassandgo initSG and cassandgo initKP) | def createInstance(ec2,ami,nb_nodes,placement,instance_type,key,sg,user_data=None):
reservation = ec2.run_instances(ami,min_count=nb_nodes,max_count=nb_nodes,placement = placement,key_name=key,security_groups=[sg],instance_type=instance_type,user_data=user_data)
instance = reservation.instances[0]
return i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_instance(ami, sg_name):\n instance = None\n ec2 = boto3.resource('ec2',region_name=\"us-east-1\")\n # TODO: Create an EC2 instance\n # Wait for the instance to enter the running state\n # Reload the instance attributes\n\n try:\n instance = ec2.create_instances(\n ImageId... | [
"0.7219868",
"0.68883014",
"0.67771643",
"0.6717516",
"0.67171246",
"0.66807824",
"0.6674608",
"0.66468847",
"0.65976626",
"0.6490849",
"0.6442486",
"0.63030493",
"0.62883216",
"0.6278427",
"0.6269443",
"0.61487126",
"0.61450726",
"0.61255866",
"0.6090022",
"0.6052359",
"0.60... | 0.7226294 | 0 |
List all instances for a specific region and zone | def listInstancesRegionZone(region,zone):
print "-"*80
print "# Region :",region," Zone", zone
print "-"*80
instances = getInstancesRegionZone(region,zone)
if instances:
for instance in instances:
print "[",instance.ami_launch_index,"]",instance.ip_address," (",instance.private_ip_address,") ",instance.insta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instances(self, region):\n try:\n conn = ec2.connect_to_region(region, **self.credentials)\n region_instances = []\n reservations = conn.get_all_reservations()\n for reservation in reservations:\n for instance in reservation.instances:\n ... | [
"0.73566705",
"0.7152035",
"0.69493294",
"0.6796809",
"0.67603457",
"0.6752783",
"0.6647198",
"0.6643667",
"0.64551127",
"0.64104474",
"0.6406182",
"0.6393634",
"0.63902986",
"0.6389321",
"0.63319427",
"0.629142",
"0.628562",
"0.6270777",
"0.6261531",
"0.6253145",
"0.621456",... | 0.82746065 | 0 |
Create all Cassandra security groups in all regions | def createAllSG():
for info in conf_HVM:
ec2 = boto.ec2.connect_to_region(info['region']+'-'+info['zone'])
createSG(ec2,'SG-Cassandra-'+info['region']+'-'+info['zone'],CASSANDRA_RULES) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_groups():\n groups = [\"iDRAC-Administrators\", \"iDRAC-Operators\", \"iDRAC-Readonly\"]\n group_priviledges = [\"0x000001ff\", \"0x000000f9\", \"0x00000001\"]\n for host in online_hosts:\n for index in [1,2,3]:\n print index,\" \", groups[index-1]\n with settings(w... | [
"0.65404814",
"0.641292",
"0.6315235",
"0.63037133",
"0.62225246",
"0.611194",
"0.6016119",
"0.589653",
"0.58127975",
"0.5788823",
"0.57725734",
"0.5730021",
"0.571415",
"0.56577706",
"0.56387746",
"0.55405027",
"0.54687124",
"0.5450472",
"0.54221886",
"0.5418091",
"0.5405399... | 0.71990424 | 0 |
Create all key pairs in all regions | def createAllKP():
if not os.path.exists(keysDir):
os.makedirs(keysDir)
for info in conf_HVM:
keyName = 'Key-'+info['region']+'-'+info['zone']
try:
os.remove(keysDir+'/'+keyName+'.pem')
except OSError:
pass
print "Key creation :",keyName
ec2 = boto.ec2.connect_to_region(info['region']+'-'+info['zone... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_keys():",
"def createAllSG():\n\tfor info in conf_HVM:\n\t\tec2 = boto.ec2.connect_to_region(info['region']+'-'+info['zone'])\n\t\tcreateSG(ec2,'SG-Cassandra-'+info['region']+'-'+info['zone'],CASSANDRA_RULES)",
"def setup_space_keys(cls):\n if cls.KEYS:\n return\n\n from pkg_re... | [
"0.65445393",
"0.6132496",
"0.60415924",
"0.5918604",
"0.59134144",
"0.587338",
"0.5822073",
"0.5657623",
"0.5650972",
"0.5635661",
"0.5604821",
"0.5563397",
"0.5509014",
"0.5504165",
"0.5494566",
"0.54587173",
"0.5435119",
"0.54258394",
"0.54082614",
"0.5393367",
"0.5384728"... | 0.7191877 | 0 |
Interpret for left != right | def _op_ne(self, left: Any, right: Any) -> BoolOrIter:
out = self._op_eq(left, right)
if isinstance(out, (numpy.ndarray, Series)):
neout = ~out
# neout[pandas.isna(out)] = numpy.nan
return neout
# out is always a numpy.ndarray
return not out # pragma:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(left, right):\n return (not (left == right))",
"def ne (x,y):\n\n return not (le(x,y) and le(y,x))",
"def nexact(cls, lhs, rhs):\n return lhs != rhs",
"def ne (self, other):\n return not (self == other) # opposite of eq",
"def _isLeft(P0, P1, P2):\n return... | [
"0.8098229",
"0.70341194",
"0.6655749",
"0.64999557",
"0.64726496",
"0.6470631",
"0.64697796",
"0.6455494",
"0.6385901",
"0.63324577",
"0.6331694",
"0.6274154",
"0.6211507",
"0.6198755",
"0.61944705",
"0.6193615",
"0.6182596",
"0.6180644",
"0.6173583",
"0.6173583",
"0.6162615... | 0.72011685 | 1 |
Recycle left right operands to each other | def _recycle_left_right(left: Any, right: Any) -> Tuple:
try:
left = recycle_value(left, length_of(right))
except DataUnrecyclable:
right = recycle_value(right, length_of(left))
return left, right | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arithmetize2(self, left: Any, right: Any, op: str) -> Any:\n op_func = getattr(operator, op)\n left, right = _recycle_left_right(left, right)\n return op_func(left, right)",
"def RewriteOR(self, left, right):\n return None",
"def __call__(self):\n return self._left() + self.... | [
"0.68653905",
"0.6566106",
"0.6530686",
"0.6372209",
"0.6346159",
"0.62722206",
"0.6268917",
"0.6268676",
"0.6260108",
"0.6258728",
"0.6246955",
"0.6224608",
"0.62071043",
"0.61998665",
"0.6179604",
"0.6081393",
"0.6077263",
"0.6012032",
"0.5989172",
"0.5984579",
"0.59795463"... | 0.6620655 | 1 |
returns the sparsity penalty on network activations combined as a sum | def get_sparsity_penalty(nnet, inputs, sparsity, mode="mean",
deterministic=False):
assert mode in ("mean", "l1")
rho = sparsity
penalty = 0
eps = 0.0001 # for numerical stability
for layer in nnet.all_layers:
if layer.isactivation:
activation = lasa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s_penalty(self, triples, nodes):\n\n s_index, p_index, o_index = split_spo(triples)\n\n s, p, o = nodes[s_index, :], self.relations[p_index, :], nodes[o_index, :]\n\n return s.pow(2).mean() + p.pow(2).mean() + o.pow(2).mean()",
"def penalty(self):\n assert len(self.weights) == len... | [
"0.67767024",
"0.62359196",
"0.6125899",
"0.60773647",
"0.5991481",
"0.596333",
"0.5899081",
"0.58852255",
"0.5814007",
"0.57617986",
"0.5758206",
"0.57509667",
"0.57433456",
"0.57304865",
"0.56787086",
"0.56762224",
"0.5659587",
"0.5657149",
"0.56555104",
"0.5648981",
"0.564... | 0.6444512 | 1 |
returns the offset to balance the polynomial parameters possible by the bias terms of the network. | def get_bias_offset(nnet):
offset = 0
L = len(nnet.trainable_layers)
for l in range(L-1):
layer = nnet.trainable_layers[l]
if layer.b is not None:
W_prod = T.eye(int(layer.b.shape.eval()[0]))
for k in range(1, L-1):
W_prod = T.dot(nnet.trainable_la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_bias(self) -> JTensor:\n p = self.params\n b = self.local_theta().b\n if p.forget_gate_bias != 0.0:\n b = b + self.get_adjustment()\n\n return b",
"def get_bias(self):",
"def bias(self):\n return self.mbmod.bias",
"def bias(self):\n return self._bias",
"def get_bias(... | [
"0.6315012",
"0.6108197",
"0.58673644",
"0.5829149",
"0.5699308",
"0.5665857",
"0.56237257",
"0.56060565",
"0.5575922",
"0.55285054",
"0.55088294",
"0.54091525",
"0.5405784",
"0.5395721",
"0.5392568",
"0.53660536",
"0.53445673",
"0.5333317",
"0.52875805",
"0.52750427",
"0.527... | 0.70303106 | 0 |
create a OCSVM loss for network given in argument with rho=1 fixed | def compile_update_ocsvm_rho_fixed(nnet, inputs, targets):
floatX = Cfg.floatX
C = Cfg.C
nu = Cfg.nu
if len(nnet.all_layers) > 1:
feature_layer = nnet.all_layers[-2]
else:
feature_layer = nnet.input_layer
final_layer = nnet.ocsvm_layer
trainable_params = lasagne.layers.get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_loss(self):\n\n with tf.name_scope(\"loss\"):\n \n # gini=(tf.nn.l2_loss( self.score))/100000\n gini = tf.losses.softmax_cross_entropy(self.score, 0*self.score)\n \n promo_prob=tf.reduce_sum(tf.multiply(self.score, self.cohort_weight),\n ... | [
"0.6449017",
"0.6109472",
"0.605694",
"0.5996417",
"0.593703",
"0.589075",
"0.5883496",
"0.58318764",
"0.5773389",
"0.5742824",
"0.5693317",
"0.569238",
"0.56884587",
"0.5637557",
"0.56182146",
"0.5615014",
"0.55934024",
"0.55804175",
"0.55716777",
"0.5567387",
"0.5556932",
... | 0.6604869 | 0 |
create a SVDD loss for network given in argument | def compile_update_svdd(nnet, inputs, targets):
floatX = Cfg.floatX
B = Cfg.B
C = Cfg.C
nu = Cfg.nu
# initialize R
if nnet.R_init > 0:
nnet.Rvar = shared(floatX(nnet.R_init), name="R")
else:
nnet.Rvar = shared(floatX(1), name="R") # initialization with R=1
# Loss
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tv_loss(x, name='tv_loss'):\n raise NotImplementedError(\"Please use tensorflow total_variation loss.\")",
"def loss_fn(self, targets, outputs, model):",
"def tv_loss(input: th.Tensor):\n input = tf.pad(input, (0, 1, 0, 1), \"replicate\")\n x_diff = input[..., :-1, 1:] - input[..., :-1, :-1]\n ... | [
"0.63613164",
"0.6158965",
"0.6017301",
"0.5997169",
"0.590424",
"0.5783352",
"0.57639736",
"0.5728302",
"0.5715514",
"0.5708102",
"0.5672599",
"0.56407714",
"0.5635773",
"0.5630035",
"0.56168777",
"0.5610483",
"0.5603815",
"0.55986285",
"0.5573956",
"0.5568347",
"0.55591923"... | 0.6577575 | 0 |
create autoencoder Theano update for network given in argument | def create_autoencoder(nnet):
floatX = Cfg.floatX
B = Cfg.ae_B
C = Cfg.ae_C
ndim = nnet.data._X_train.ndim
if ndim == 2:
inputs = T.matrix('inputs')
elif ndim == 4:
inputs = T.tensor4('inputs')
final_layer = nnet.all_layers[-1]
# Backpropagation
trainable_params =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_full_conv_autoencoder():\n input_img = Input(shape=(84, 84, 3))\n\n x = Convolution2D(48, 8, 8, activation='relu', border_mode='same', name='c1')(input_img)\n x = MaxPooling2D((2, 2), border_mode='same')(x)\n x = Convolution2D(32, 4, 4, activation='relu', border_mode='same', name='c2')(x)\n ... | [
"0.65535045",
"0.6422185",
"0.63456124",
"0.6290219",
"0.6285251",
"0.6273079",
"0.6235958",
"0.6228888",
"0.6139146",
"0.6119213",
"0.6110673",
"0.61030644",
"0.6072735",
"0.60715985",
"0.60660934",
"0.6034425",
"0.60192865",
"0.5931092",
"0.5930418",
"0.59202427",
"0.589814... | 0.719997 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.