query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Add a job to the redis queue.
def add_job(state, county, start, end, categories, status="submitted"): jid = _generate_jid() job_dict = _instantiate_job(jid, status, state, county, start, end, categories) _save_job(_generate_job_key(jid), job_dict) _queue_job(jid) return job_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, job):\r\n self.jobs.put(job)", "def add_job(self, job):\n with self._mutex:\n self._jobs.append(job)", "def put(self, job):\n self.queue.put(job)", "def put(self, job):\n self.queue.put(job)", "def addJob(self, job):\n self.jobs.append(job)\n ...
[ "0.8060162", "0.7568576", "0.75366694", "0.75366694", "0.7371036", "0.7272483", "0.72209376", "0.71882224", "0.71882224", "0.7073142", "0.6955013", "0.6886609", "0.68006307", "0.6666635", "0.6596627", "0.6591964", "0.6560641", "0.6530091", "0.6530091", "0.6529446", "0.6517097...
0.0
-1
Update the status of job with job id `jid` to status `status`.
def update_job_status(jid, new_status): rd.hset(_generate_job_key(jid), 'status', new_status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_job_status(jid, new_status):\n jrd.hset(_generate_job_key(jid), 'status', new_status)", "def update_job_status(self, job_id, status):\n\n if not (job_id and status):\n raise ValueError(\"Please provide both job_id and status\")\n\n job = self.get_mongo_util().get_job(job_id...
[ "0.8721243", "0.7878231", "0.7645582", "0.7384852", "0.7075129", "0.6978821", "0.6939226", "0.6873175", "0.6858812", "0.6784618", "0.67413497", "0.67406476", "0.67188567", "0.6665409", "0.66392183", "0.65370345", "0.64245987", "0.6391169", "0.627715", "0.6251563", "0.6248479"...
0.87232137
0
Overridden method resize the gride on window resize
def resizeEvent(self, event): self.resized.emit() return super(PiWndow, self).resizeEvent(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_parent_resize(self, event):\n #self.resize()\n #self.resize_scaled(drag_rootx=self.resize_frame.winfo_rootx())\n self.resize_scaled(current=MathStat.lerp(0,\n self.prop_frame.winfo_width(), self.last_right_bias))", "def ev_windowresized(self, event: WindowResized) -> None:"...
[ "0.77815837", "0.7722773", "0.7567626", "0.7532544", "0.7514508", "0.74756813", "0.74474376", "0.7378988", "0.72276026", "0.7209269", "0.7195889", "0.718926", "0.71728903", "0.71120715", "0.7109021", "0.7090584", "0.7055913", "0.6997535", "0.69884354", "0.6966881", "0.6963820...
0.77234805
1
Override to add menu quit option
def contextMenuEvent(self, event): cmenu = QMenu(self) quitAct = cmenu.addAction("Quit") fullScreenAct = cmenu.addAction("Toggle fullscreen") stretchAct = cmenu.addAction("Toggle stretch") coordAct = cmenu.addAction("Show/Hide coordinates") fixedAct = cmenu.addAction("Sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_quit(self, _):\n return MENU_QUIT", "def call_quit(self, _):\n return MENU_QUIT", "def call_quit(self, _):\n return MENU_QUIT", "def menu_quit():\n return \"Quit\"", "def menu_quit (self,widget,data):\n\t\tself.window.delete_event()", "def close_menu(self):\n self....
[ "0.796877", "0.796877", "0.796877", "0.7735466", "0.77321666", "0.7555846", "0.741132", "0.73684937", "0.73669523", "0.7299492", "0.72636914", "0.7231519", "0.71948457", "0.71870124", "0.7185896", "0.7180044", "0.71657205", "0.7153919", "0.7101463", "0.70664793", "0.69686836"...
0.0
-1
Main method to run through the whole App
def main(cls): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n app = App()\n app.run()", "def main():\n print(\"def main\")\n return APP.run()", "def main(self) -> None:\n pass", "def main(self):\r\n pass", "def main():\n CLI_APP.run()", "def main():\n game = RiichiMahjongApp()\n game.run()", "def main(args=None):\n ...
[ "0.8300956", "0.81900656", "0.8052384", "0.7838563", "0.7785631", "0.77737933", "0.7679321", "0.7656661", "0.7653337", "0.7653337", "0.7653337", "0.7552617", "0.7549081", "0.7526083", "0.7516162", "0.7516162", "0.75059444", "0.74852127", "0.74383587", "0.73998165", "0.7373391...
0.6950887
73
Defines Arguments required or used by App
def add_args(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_app_arguments(self, parser: argparse.ArgumentParser):\n pass", "def add_app_arguments(self, parser: argparse.ArgumentParser) -> None:\n pass", "def parse_arguments(args):", "def __add_arguments__(cls, parser):", "def _setup_arguments(self):\n\n self._parser.add_argument(\"-a\",...
[ "0.71056885", "0.710147", "0.69156283", "0.6902538", "0.68721867", "0.68429905", "0.68335724", "0.67964596", "0.678914", "0.66929156", "0.6691087", "0.66362906", "0.662802", "0.66185945", "0.66185945", "0.66185945", "0.66185945", "0.66185945", "0.66185945", "0.66185945", "0.6...
0.6286019
54
Set up environment for running App
def setup(self, app_args): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetupEnvironment(self):\n pass", "def setup_app(command, conf, vars):\n load_environment(conf.global_conf, conf.local_conf)", "def setup_env(app_dir, app_id, version, module_id, remote_api=False):\n # GCS library behaves differently when running under remote_api. It uses\n # SERVER_SOFTWARE to figu...
[ "0.77735794", "0.7658531", "0.73482674", "0.7297668", "0.72810507", "0.7076587", "0.70397806", "0.6979118", "0.69432473", "0.6939511", "0.6930946", "0.6922617", "0.69029605", "0.68811864", "0.6842588", "0.683703", "0.6788041", "0.6786686", "0.6783056", "0.67606914", "0.674754...
0.6391793
73
Clean up enviroment after running App
def teardown(self, log, info): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_cleanup(self):\n pass", "def clean_env():\n for key in ['FOO', 'THOR', 'IRON', 'NAME', 'PERSONAL_DIR']:\n os.environ.pop(key, None)", "def cleanUp(self):\r\n # All intermediates should be removed by app controller\r\n pass", "def tearDown(self):\n tests.utils.cle...
[ "0.84959", "0.74041283", "0.7400567", "0.7377725", "0.7377725", "0.72739476", "0.71907806", "0.7078228", "0.70513624", "0.6968929", "0.6930243", "0.69282866", "0.6912258", "0.6897339", "0.6874884", "0.68309194", "0.68106127", "0.67731655", "0.6758686", "0.6750522", "0.6737125...
0.0
-1
Download the adamlink datasets and temporarily store them.
def downloadDatasets(datasets: Iterable) -> Generator[tuple, None, None]: for ds in datasets: with urllib.request.urlopen(ds) as response: with tempfile.NamedTemporaryFile(delete=False) as tmp_file: shutil.copyfileobj(response, tmp_file) yield (response.url, tmp_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data_sets(ad_accounts: [adaccount.AdAccount]):\n download_account_structure(ad_accounts)\n download_ad_performance(ad_accounts)", "def download(self):\n\n with open(self.dataset_path) as dataset_file:\n dataset = json.load(dataset_file)\n\n path = \"\".join([POST_H...
[ "0.74381685", "0.68824774", "0.6869728", "0.68059516", "0.6786217", "0.67091084", "0.65922046", "0.64675885", "0.63986194", "0.6396679", "0.63534296", "0.6336414", "0.63112575", "0.62985814", "0.62788403", "0.62720466", "0.62082124", "0.6187086", "0.61367625", "0.6114654", "0...
0.6257395
16
Build Graph data for test
def setUpClass(cls): cur_dir = os.path.dirname(os.path.realpath(__file__)) meta_file = os.path.join(cur_dir, 'testdata/meta.json') graph_file = os.path.join(cur_dir, 'testdata/graph.json') output_file = os.path.join(cur_dir, 'testdata/graph.dat') builder = os.path.join(cur_dir, '../../../tools/bin/j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_graph(self):\n pass", "def build_graph(self):\n pass", "def populate_graph(self):", "def gen_graph(self):", "def build_graph(self):\n raise NotImplementedError", "def create_test_graph():\n return {\n 'A': ['C', 'B'],\n 'B': ['D', 'E'],\n ...
[ "0.7750782", "0.76177084", "0.7500452", "0.72003263", "0.71023947", "0.7084286", "0.7056565", "0.69963396", "0.697033", "0.6817334", "0.6764648", "0.67596906", "0.67366093", "0.672435", "0.672435", "0.6682008", "0.6677122", "0.65895766", "0.6538538", "0.64544636", "0.64355", ...
0.5778293
90
Test get sparse feature for nodes
def testGetNodeSparseFeature(self): op = ops.get_sparse_feature(tf.constant([1, 2, 3, 4], dtype=tf.int64), [0, 1], None, 2) with tf.Session() as sess: sparse_features = sess.run(op) features = [ sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features ] self.assertAll...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeSparseFeature(self):\n op = ops.get_edge_sparse_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1])\n with tf.Session() as sess:\n sparse_features = sess.run(op)\n features = [\n sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features\n ]\n ...
[ "0.73272765", "0.6820091", "0.67619544", "0.6610567", "0.64725614", "0.6449944", "0.64042735", "0.6263585", "0.6103143", "0.61015546", "0.60968196", "0.6084827", "0.6057236", "0.60563654", "0.60050356", "0.59953785", "0.5979681", "0.59236443", "0.59099656", "0.5838602", "0.58...
0.82523984
0
Test get sparse feature for edges
def testGetEdgeSparseFeature(self): op = ops.get_edge_sparse_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1]) with tf.Session() as sess: sparse_features = sess.run(op) features = [ sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features ] self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetNodeSparseFeature(self):\n op = ops.get_sparse_feature(tf.constant([1, 2, 3, 4], dtype=tf.int64), [0, 1], None, 2)\n with tf.Session() as sess:\n sparse_features = sess.run(op)\n features = [\n sess.run(tf.sparse_tensor_to_dense(sp)) for sp in sparse_features\n ]\n\n s...
[ "0.7218904", "0.63896483", "0.6371443", "0.6266918", "0.62178236", "0.61970073", "0.613634", "0.6091845", "0.5928558", "0.5921789", "0.59213215", "0.58553857", "0.5815543", "0.57850456", "0.57541674", "0.56809664", "0.5644477", "0.56365854", "0.55811906", "0.55731964", "0.556...
0.79959077
0
Test get binaray feature for nodes
def testGetBinaryFeature(self): op = ops.get_binary_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], 3) with tf.Session() as sess: binary_features = sess.run(op) self.assertAllEqual([['aa', 'eaa'], ['bb', 'ebb']], binary_features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeBinaryFeature(self):\n op = ops.get_edge_binary_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], 3)\n with tf.Session() as sess:\n binary_features = sess.run(op)\n self.assertAllEqual([['eaa', 'eaa'], ['ebb', 'ebb']], binary_features)", "def test_binops(self):",...
[ "0.67418295", "0.65028363", "0.5886723", "0.5849335", "0.5824959", "0.5815598", "0.5767881", "0.5749302", "0.56867933", "0.56607276", "0.5647841", "0.5642658", "0.56263286", "0.56138974", "0.559451", "0.5587335", "0.55846936", "0.5578987", "0.5569948", "0.55669355", "0.556448...
0.6703744
1
Test get binary feature for edges
def testGetEdgeBinaryFeature(self): op = ops.get_edge_binary_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], 3) with tf.Session() as sess: binary_features = sess.run(op) self.assertAllEqual([['eaa', 'eaa'], ['ebb', 'ebb']], binary_features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetBinaryFeature(self):\n op = ops.get_binary_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], 3)\n with tf.Session() as sess:\n binary_features = sess.run(op)\n self.assertAllEqual([['aa', 'eaa'], ['bb', 'ebb']], binary_features)", "def edge_ground(X):\n gradient_x = img_conv(X, k...
[ "0.68867505", "0.6366488", "0.6243037", "0.62199426", "0.6127697", "0.6102369", "0.6087157", "0.60346556", "0.59115744", "0.58970225", "0.5876137", "0.57994354", "0.57452404", "0.5710747", "0.57041126", "0.57013994", "0.56978977", "0.5695617", "0.565691", "0.56377554", "0.563...
0.8017388
0
Test get dense feature for nodes
def testGetDenseFeature(self): op = ops.get_dense_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], [2, 3], 3) with tf.Session() as sess: dense_features = sess.run(op) self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0]) self.assertAllClose([[4.5, 6.7, 8.9], [4.5, 6.7, 8.9]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetEdgeDenseFeature(self):\n op = ops.get_edge_dense_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], [2, 3])\n with tf.Session() as sess:\n dense_features = sess.run(op)\n self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0])\n self.assertAllClose([[4.5,...
[ "0.72559947", "0.67886496", "0.65579146", "0.64986455", "0.64469945", "0.6297318", "0.6294088", "0.6167789", "0.6160456", "0.6077242", "0.59941447", "0.5963346", "0.59530985", "0.5951871", "0.5840117", "0.5824145", "0.57557094", "0.5753232", "0.57435966", "0.57184446", "0.567...
0.78006595
0
Test get dense feature for edges
def testGetEdgeDenseFeature(self): op = ops.get_edge_dense_feature(tf.constant([[1, 2, 0], [2, 3, 1]], dtype=tf.int64), [0, 1], [2, 3]) with tf.Session() as sess: dense_features = sess.run(op) self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0]) self.assertAllClose([[4.5, 6.7, 8.9]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetDenseFeature(self):\n op = ops.get_dense_feature(tf.constant([1, 2], dtype=tf.int64), [0, 1], [2, 3], 3)\n with tf.Session() as sess:\n dense_features = sess.run(op)\n self.assertAllClose([[2.4, 3.6], [2.4, 3.6]], dense_features[0])\n self.assertAllClose([[4.5, 6.7, 8.9], [4.5, 6.7,...
[ "0.7243192", "0.69505996", "0.6386442", "0.63060486", "0.6300891", "0.6059663", "0.5921134", "0.58920044", "0.5870613", "0.58467954", "0.58444846", "0.5779876", "0.5760521", "0.5699653", "0.5684468", "0.5669936", "0.5648048", "0.5621084", "0.5606891", "0.5605643", "0.5564011"...
0.8108021
0
Load a plugin from a directory path rather than a python package within sys.path. This would either be ``myplugin.py`` or ``myplugin/__init__.py`` within the given ``plugin_dir``.
def _load_plugin_from_dir(self, plugin_name, plugin_dir): # FIX ME: `imp` is deprecated in Python 3.4 and will be going away # so we need to update forward compatibility for ``importlib``. # # See: https://github.com/datafolklabs/cement/issues/386 LOG.debug("attempting to load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_load_plugin(self, args) -> str:\n plugin_name = args.plugin_name\n current_dir = os.path.dirname(os.path.realpath(__file__))\n if not os.path.isfile(\"{}/{}.py\".format(current_dir, plugin_name)):\n return error(\"Plugin {} DNE\".format(plugin_name))\n\n # First, let'...
[ "0.6916508", "0.68514174", "0.6643727", "0.65699375", "0.6476672", "0.6329865", "0.6303747", "0.62341803", "0.6217344", "0.6157128", "0.61493677", "0.61439323", "0.6132839", "0.61202306", "0.6070565", "0.6015545", "0.594124", "0.58788246", "0.58368605", "0.58302", "0.58088845...
0.7679594
0
Load a plugin from a python package. Returns True if no ImportError is encountered.
def _load_plugin_from_bootstrap(self, plugin_name, base_package): full_module = '%s.%s' % (base_package, plugin_name) # If the base package doesn't exist, we return False rather than # bombing out. if base_package not in sys.modules: try: __import__(base_pac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_plugin(self, plugin):\n return imp.load_module(self._main_module, *plugin[\"info\"])", "def plugin_import(plugin):\n\n return importlib.import_module(plugin, package=\"directord\")", "def cli_load_plugin(self, args) -> str:\n plugin_name = args.plugin_name\n current_dir = os.pa...
[ "0.70234805", "0.68948036", "0.6878378", "0.6738148", "0.6616493", "0.66163725", "0.66088516", "0.65382975", "0.6505495", "0.6326678", "0.6311166", "0.62846106", "0.62615424", "0.62216526", "0.61738795", "0.61628515", "0.61538166", "0.61223394", "0.6082919", "0.60692656", "0....
0.7497673
0
Load a plugin whose name is ``plugin_name``. First attempt to load from a plugin directory (plugin_dir), secondly attempt to load from a bootstrap module (plugin_bootstrap) determined by ``CementApp.Meta.plugin_bootstrap``. Upon successful loading of a plugin, the plugin name is appended to the ``self._loaded_plugins l...
def load_plugin(self, plugin_name): LOG.debug("loading application plugin '%s'" % plugin_name) # first attempt to load from plugin_dirs for load_dir in self.load_dirs: load_dir = abspath(load_dir) if self._load_plugin_from_dir(plugin_name, load_dir): sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_plugin_from_dir(self, plugin_name, plugin_dir):\n\n # FIX ME: `imp` is deprecated in Python 3.4 and will be going away\n # so we need to update forward compatibility for ``importlib``.\n #\n # See: https://github.com/datafolklabs/cement/issues/386\n\n LOG.debug(\"attem...
[ "0.7045509", "0.68277836", "0.6615645", "0.65783507", "0.65219337", "0.6168164", "0.6166937", "0.6153133", "0.603769", "0.6017749", "0.6007957", "0.5936667", "0.5920107", "0.59188616", "0.58921534", "0.585424", "0.5792454", "0.57535785", "0.56395006", "0.5621667", "0.56081516...
0.7847527
0
Load a list of plugins. Each plugin name is passed to ``self.load_plugin()``.
def load_plugins(self, plugin_list): for plugin_name in plugin_list: self.load_plugin(plugin_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(plugin_list: list[str]) -> None:\n\n if plugin_list is None or len(plugin_list) == 0:\n raise PluginLoaderError(\"None or empty list passed plugin loader.\")\n\n try:\n plugin: IPlugin\n for plugin_file in plugin_list:\n plugin = importlib.impo...
[ "0.8064172", "0.7858561", "0.75934744", "0.7524198", "0.74683875", "0.7416607", "0.73836267", "0.7295292", "0.7247374", "0.7145177", "0.7036643", "0.69947654", "0.6944811", "0.6913434", "0.68554175", "0.6810764", "0.6804907", "0.67874926", "0.67491233", "0.67149556", "0.66665...
0.859365
0
List of plugins that have been loaded.
def get_loaded_plugins(self): return self._loaded_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n return self.rpc.call(MsfRpcMethod.PluginLoaded)['plugins']", "def get_plugins(self):\n return []", "def plugin_list(self):\r\n return get_module_list()", "def available_plugins():\n return PluginConnector.available_plugins()", "def getAvailablePlugins(self):\n ...
[ "0.8586829", "0.8316143", "0.8056693", "0.8050387", "0.79434705", "0.7777282", "0.7626144", "0.75808483", "0.7544936", "0.75321484", "0.7513205", "0.75094754", "0.7476133", "0.7441247", "0.7406904", "0.740663", "0.7388524", "0.73757917", "0.7358085", "0.7344863", "0.7317727",...
0.84580123
1
List of plugins that are enabled (not necessary loaded yet).
def get_enabled_plugins(self): return self._enabled_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_plugins(self):\n return []", "def available_plugins():\n return PluginConnector.available_plugins()", "def plugin_list(self):\r\n return get_module_list()", "def get_enabled_plugins(self):\n return [p for p in self.get_all_plugins if p[\"plugin_state\"] == \"enabled\"]", ...
[ "0.8339704", "0.8162594", "0.8157118", "0.81241125", "0.81090266", "0.79501456", "0.7901278", "0.7882036", "0.78794426", "0.77211344", "0.77055705", "0.7700278", "0.76569206", "0.7651718", "0.74794424", "0.745278", "0.7425413", "0.7393598", "0.738529", "0.7381147", "0.7367391...
0.821764
1
List of disabled plugins
def get_disabled_plugins(self): return self._disabled_plugins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_enabled_plugins(self):\n return [p for p in self.get_all_plugins if p[\"plugin_state\"] == \"enabled\"]", "def get_enabled_plugins(self):\n return self._enabled_plugins", "def get_plugins(self):\n return []", "def plugin_list(self):\r\n return get_module_list()", "def ge...
[ "0.7614633", "0.7553389", "0.75279945", "0.7443351", "0.7277866", "0.7091898", "0.70777154", "0.7022327", "0.6932261", "0.69020647", "0.689735", "0.68944365", "0.68162185", "0.6764687", "0.67471033", "0.67389685", "0.67251486", "0.66634655", "0.6657755", "0.66140616", "0.6560...
0.8493453
0
r"""GCP = great circle points from (lon1,lat1) > (lon2,lat2).
def gcp(lon1, lat1, lon2, lat2): Npt = 200 p1 = np.array(lonlat2xyz(lon1, lat1)) p2 = np.array(lonlat2xyz(lon2, lat2)) delta = p2 - p1 # length of the line: between 0 and 2, generally < 1 r = np.linalg.norm(delta) d = np.linspace(0, 1.0, int(Npt*r + 10)) # sample points along the line co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(p1, p2):\n # Note: GeoPy expects (latitude, longitude) pairs.\n return geopy.distance.great_circle(\n (p1.y, p1.x),\n (p2.y, p2.x)\n ).miles", "def pointfind2(plat, plon, lat, lon, pdif=1):\n\n\tdist_min = 1000000.\n\t\n\t\n\tfor i in range(lon.shape[0]):\n\t\tfor j in ran...
[ "0.6885366", "0.65239805", "0.63336706", "0.63148177", "0.6299968", "0.6127645", "0.61270505", "0.6075573", "0.60572517", "0.6042769", "0.60286987", "0.6018993", "0.59866035", "0.59788495", "0.59559065", "0.5934518", "0.5926352", "0.59001684", "0.58833873", "0.5822907", "0.58...
0.70047563
0
PIL.Image.open is used so that a io.BytesIO object containing the image data can be passed as img and parsed into an image. Passing a path to an image for img will also work.
def img_to_ubyte_array(img): ret_ = skimage.util.img_as_ubyte(np.array(PIL.Image.open(img))) return ret_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_image(image_path, mode=\"RGB\"):\n print(\"Opening image file in '%s'.\" % image_path)\n return Image.open(image_path).convert(mode)", "def _open_img(self, img_name):\n try:\n img = Image.open(img_name)\n photo = ImageTk.PhotoImage(img)\n return photo\n ...
[ "0.7110325", "0.68934494", "0.6716132", "0.66822517", "0.6659475", "0.6614402", "0.6606257", "0.6533214", "0.6515557", "0.650142", "0.64859694", "0.6377567", "0.63319105", "0.6281747", "0.6273836", "0.62536025", "0.62224233", "0.62190294", "0.6173084", "0.616993", "0.61516565...
0.0
-1
Features for a single channel nd image.
def _mutiscale_basic_features_singlechannel( img, intensity=True, edges=True, texture=True, sigma_min=0.5, sigma_max=16 ): # computations are faster as float32 img = np.ascontiguousarray(skimage.img_as_float32(img)) sigmas = np.logspace( np.log2(sigma_min), np.log2(sigma_max), nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_features(self, img: np.ndarray) -> np.ndarray:", "def single_img_features(img, color_space='RGB', spatial_size=(32, 32),\n hist_bins=32, orient=9,\n pix_per_cell=8, cell_per_block=2, hog_channel=0,\n spatial_feat=True, hist_feat...
[ "0.7577687", "0.7212518", "0.7211199", "0.7162164", "0.7162164", "0.69907665", "0.6800388", "0.67968893", "0.6743948", "0.6705404", "0.6700692", "0.66633826", "0.66087484", "0.6568413", "0.65589225", "0.6537809", "0.6533442", "0.6524532", "0.65154797", "0.65154797", "0.651121...
0.6377955
33
Local features for a single or multichannel nd image. Intensity, gradient intensity and local structure are computed at different scales thanks to Gaussian blurring.
def multiscale_basic_features( image, multichannel=True, intensity=True, edges=True, texture=True, sigma_min=0.5, sigma_max=16, ): if image.ndim >= 3 and multichannel: all_results = ( _mutiscale_basic_features_singlechannel( image[..., dim], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_local_features(self, img):\n kp, des = self.fe.detectAndCompute(img, None)\n return kp, des", "def _mutiscale_basic_features_singlechannel(\n img, intensity=True, edges=True, texture=True, sigma_min=0.5, sigma_max=16\n):\n # computations are faster as float32\n img = np.ascontiguou...
[ "0.67990077", "0.6613973", "0.63396823", "0.6160649", "0.6128696", "0.6065621", "0.6013167", "0.6010254", "0.5936788", "0.59249336", "0.5900749", "0.5875176", "0.5859288", "0.58407986", "0.58281446", "0.582494", "0.58235073", "0.5775383", "0.5749785", "0.5746906", "0.57443", ...
0.617441
3
Read a Featran settings file and return a list of settings
def settings(cls, settings_dir, settings_filename=None): # type: (str, str) -> List[Dict[str, Any]] f = cls.__get_featran_settings_file(settings_dir, settings_filename) with file_io.FileIO(f, "r") as fio: settings = json.load(fio) return settings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_settings():\n \n settings = OrdDic()\n settings.update(json.load(open(\"resources/files/settings.txt\", \"r\")))\n\n ## OLD WAY BELOW\n\n #r = open(\"resources/files/settings.txt\", \"r\", newline=\"\\n\")\n # for option in r.read().split('\\n'):\n # tr...
[ "0.7102021", "0.70868576", "0.7059203", "0.7037486", "0.69387", "0.6818304", "0.66388637", "0.6611855", "0.659556", "0.6580886", "0.652529", "0.65144247", "0.6462294", "0.6341641", "0.62923574", "0.62744516", "0.62440145", "0.6239939", "0.6227235", "0.62151223", "0.6198884", ...
0.7195697
0
Returns a list of Featran feature names. Optionally the list of names can be split into a dictionary keyed by the feature_splitter_fn
def names(cls, settings_path, feature_splitter_fn=None): # type: (str, Callable[[Any], str]) -> Union[List[str], Dict[str, List[str]]] settings = cls.settings(settings_path) if feature_splitter_fn: return cls.__split_names(settings, feature_splitter_fn) else: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFeatureNames(self):\n return [\"f100\", \"f103\", \"f104\"]", "def getFeatureNames(self):\n feature_names = super().getFeatureNames()\n feature_names.extend([\"f101\", \"f102\", \"f105\", \"fNum\", \"fCapStart\", \"fCapNoStart\"])\n return feature_names", "def get_feature_nam...
[ "0.7049553", "0.6839136", "0.6737428", "0.65986675", "0.64425224", "0.6388228", "0.63721794", "0.63689667", "0.63632655", "0.61932766", "0.61300004", "0.6118663", "0.6100661", "0.6003382", "0.59538436", "0.58812374", "0.5822164", "0.5791268", "0.57731825", "0.57671833", "0.57...
0.68379194
2
Reorders a numpy dictionary so that feature keys are in the same order as those in a Featran settings file.
def reorder_numpy_dataset(cls, dataset, # type: Iterator[Dict[str, np.ndarray]] settings_path # type: str ): # type: (...) -> Iterator[OrderedDict[str, np.ndarray]] feature_names = Featran.names(settings_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reorder_features(outputs: t.Dict[str, torch.Tensor]) -> t.Dict[str, torch.Tensor]:\r\n results = collections.OrderedDict()\r\n keys = outputs.keys()\r\n\r\n res_keys: t.List = sorted([key for key in keys if 'res' in key])\r\n p_keys: t.List = sorted([key for key in keys if 'p' in key], reverse=Tru...
[ "0.65474087", "0.60033643", "0.5774473", "0.5615092", "0.55150896", "0.5487108", "0.5471396", "0.544606", "0.5441302", "0.5424468", "0.5393674", "0.5364288", "0.5292287", "0.5273655", "0.5270219", "0.5205825", "0.5180123", "0.5159714", "0.5151066", "0.51053035", "0.5077025", ...
0.66269344
0
Reorders a pandas DataFrame so that feature columns are in the same order as those in a Featran settings file.
def reorder_dataframe_dataset(cls, dataset, # type: Iterator[pd.DataFrame] settings_path # type: str ): # type: (...) -> Iterator[pd.DataFrame] feature_names = Featran.names(settings_path) for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_cols(df):\n # print(df.columns)\n req_order = [df.columns.tolist()[-1]] + df.columns.tolist()[:-1]\n # print(req_order)\n df = df.loc[:, req_order]\n df = df.sort_values(by=['participant_id'], ignore_index=True)\n return df", "def reorder_columns(data: pd.DataFrame):\n return dat...
[ "0.66248345", "0.6539427", "0.63924694", "0.6261986", "0.62243295", "0.6177894", "0.61388737", "0.61321455", "0.6041618", "0.5983137", "0.59600985", "0.58889955", "0.5882089", "0.58378375", "0.5830742", "0.58172053", "0.5798357", "0.5798357", "0.57415587", "0.5627095", "0.561...
0.67649025
0
convert results into args string
def convert_mnist_experiment_result(experiment_result) -> str: import json r = json.loads(experiment_result) args = [] for hp in r: print(hp) args.append("%s=%s" % (hp["name"], hp["value"])) return " ".join(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args_str(self):", "def cmd_stru(args):", "def __get_xx_args_string(self, incremental_result):\n _method_name = '__get_xx_args_string'\n\n self._logger.entering(incremental_result, class_name=self._class_name, method_name=_method_name)\n result = incremental_result\n result = sel...
[ "0.74039584", "0.6882031", "0.6802783", "0.663221", "0.6511529", "0.64861894", "0.64485216", "0.64046276", "0.63612604", "0.63418686", "0.6198379", "0.6158517", "0.6143214", "0.60833436", "0.6049817", "0.60286", "0.5990509", "0.5984737", "0.59801614", "0.5975168", "0.59750706...
0.58414626
35
Checks that the configuration files and folders are in place
def check_configfiles(): return (all(os.path.isdir(x) for x in CONFIG_DIRS) and os.path.isfile(CONFIG_FILE) and os.path.isfile(LOG_CONFIG_FILE))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config(outconfig):\n self.log.info(\"Checking if all the necessary files exist.\")\n\n # Perform necessary checks\n\n log.info(\"All necessary files exist for {} configuration.\".format(outconfig[\"Flavor\"]))\n\n return", "def check_config(self):\n try:\n config_metadata ...
[ "0.70204234", "0.6993148", "0.6884687", "0.6799592", "0.6726835", "0.6586589", "0.6545135", "0.65264636", "0.64629805", "0.6429327", "0.6409544", "0.64075446", "0.6400497", "0.633978", "0.63244385", "0.63228256", "0.6288611", "0.62569356", "0.6242939", "0.6242394", "0.624128"...
0.6647694
5
Reads the configfile and creates a config object
def read_configfile(): configtp = namedtuple("Config", ["lb_user", "lb_pwd", "lb1", "lb2", "lb_dg", "lb_dg_partition", "ca", "ca_proxy", "cm_chain", "cm_key", "cm_renewal_days", "cm_delayed_days", "plugin"]) config = ConfigParser.ConfigPa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config(self, config_filename):", "def setup_config():\n\n config = configparser.ConfigParser()\n config.read(CONFIG_PATH)\n\n return config", "def load_config():\n config = ConfigParser()\n config.read(os.path.join(os.path.dirname(__file__), 'config.ini'))\n return config", "def re...
[ "0.80169415", "0.7498955", "0.7463582", "0.7454759", "0.74354273", "0.74055576", "0.7374665", "0.73646724", "0.7360179", "0.7355397", "0.73419696", "0.7310272", "0.7305367", "0.7267684", "0.72647136", "0.72591174", "0.72249806", "0.7202777", "0.7200117", "0.71822923", "0.7182...
0.7148986
22
Creates a default configfile
def create_configfile(): config = ConfigParser.ConfigParser() config.add_section('Common') config.set('Common', 'renewal days', 20) config.set('Common', 'delayed installation days', 5) config.set('Common', 'include chain', True) config.set('Common', 'account key', './config/key.pem') config....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_default_config(self):\n if not os.path.exists(self.__configfile):\n path=os.path.dirname(self.__configfile)\n try:\n os.makedirs(path)\n except:\n pass\n if os.path.exists(path):\n self.save(defaults=True)"...
[ "0.8211443", "0.81206053", "0.7971057", "0.7821638", "0.7639395", "0.7617047", "0.74709713", "0.7267118", "0.71462", "0.7127939", "0.7121289", "0.71167624", "0.7085077", "0.70598626", "0.70277184", "0.70277184", "0.7020035", "0.70012724", "0.6996297", "0.6888534", "0.6880605"...
0.6905977
19
Creates a default log config file Normally we just use the root logger, but if debug is specified, we create a separate logger for bigacme, and stops it from propagate to the root logger. Otherwise it will be flooded with suds logging
def create_logconfigfile(debug): config = ConfigParser.ConfigParser() config.add_section('loggers') if debug: config.set('loggers', 'keys', 'root, bigacme') else: config.set('loggers', 'keys', 'root') config.add_section('handlers') config.set('handlers', 'keys', 'fileHandler') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_logger_creator(config):\n cfg = config[\"logger_config\"].copy()\n cls = cfg.pop(\"type\")\n # Provide default for logdir, in case the user does\n # not specify this in the \"logger_config\" dict.\n logdir_ =...
[ "0.73750424", "0.702182", "0.68984103", "0.6830591", "0.68221974", "0.6803222", "0.67796206", "0.676728", "0.67659885", "0.6738408", "0.67314416", "0.67223585", "0.6712152", "0.6700481", "0.66865337", "0.6676777", "0.6672695", "0.6649287", "0.66484153", "0.6597267", "0.655657...
0.75977945
0
Creates an account key and returns it
def create_account_key(configuration): # Checking if the specified key file already exists if os.path.exists(configuration.cm_key): raise KeyAlreadyExistsError("Key file already exists") else: logger.debug("The key file does not exist. All good.") logger.info("Generating private key") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_key ():", "def create_account():\n account = w3.eth.account.create()\n return account", "def create_key() -> RSA.RsaKey:\n\n return RSA.generate(1024, Crypto.Random.new().read)", "def create_keypair(self):\n # NOTE: currently we rely on zmq for convenience, but we may use libnacl direc...
[ "0.78032374", "0.7157132", "0.69543934", "0.69367105", "0.68852895", "0.68446183", "0.68317956", "0.681742", "0.67559963", "0.6714517", "0.6675736", "0.66290426", "0.65603864", "0.6550275", "0.65238833", "0.64919317", "0.64716196", "0.64529395", "0.6433836", "0.6419056", "0.6...
0.6821286
7
Deletes the account key from disk
def delete_account_key(configuration): os.remove(configuration.cm_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_key_file():\n\n key_path = _get_path_to_key_file()\n\n if _search_for_key_file(key_path):\n try:\n os.remove(key_path)\n except OSError as e:\n raise NonRecoverableError(\n 'Unable to delete key pair: {0}.'\n .format(str(e)))", "...
[ "0.7390688", "0.7232279", "0.7135629", "0.7051478", "0.695327", "0.6949479", "0.6926622", "0.68914104", "0.68800974", "0.6865197", "0.67859584", "0.6766877", "0.6745468", "0.6686547", "0.6654138", "0.66517293", "0.66275847", "0.6625675", "0.65753704", "0.6574957", "0.65446925...
0.7831444
0
Return list of matched extensions for request
def get_matched_extensions(request): def _match(e): return e.obj if e.obj.matches(request) else None result = EXTENSION_MANAGER.map(_match) return filter(bool, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_request_extensions(self):\n return []", "def get_supported_extensions(ext=\".as\"):\n result = list(ext + x for x in LOADERS.keys())\n result.append(ext)\n return result", "def list_extensions(self, **_params):\r\n return self.get(self.extensions_path, params=_params)", "def ge...
[ "0.75951755", "0.7271211", "0.72127724", "0.7194703", "0.6986083", "0.6902174", "0.6794423", "0.6713986", "0.66939974", "0.66939974", "0.64852667", "0.64221865", "0.6406773", "0.6382086", "0.6368284", "0.63533074", "0.63501287", "0.6343359", "0.63414174", "0.63372016", "0.630...
0.80292445
0
Calls func immediately if API is already initialized. Otherwise, call is deferred until call to VOIP.initialize(). Any call to VOIP.shutdown() always clears list of previously deferred calls.
def callWhenInitialized(func): if _api: func() else: _initCallbacks.append(func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_once_when_loaded(self, function: Callable[[], None]) -> None:\n if self.is_loaded():\n function()\n else:\n self._call_once_loaded_callback.Register(function)", "async def wrapper(call: ServiceCall) -> None:\n entry = async_get_entry_for_service_call(ha...
[ "0.5526264", "0.5442476", "0.5366207", "0.52752405", "0.52704024", "0.5259977", "0.52292216", "0.517247", "0.51048285", "0.5088277", "0.5084857", "0.5078337", "0.5066153", "0.5066153", "0.50597996", "0.5033456", "0.5030401", "0.5030401", "0.5030401", "0.50179005", "0.49924242...
0.7787551
0
Task 1 Creating a blank image with width= 2 border_size + original_img.width and height = 2 border_size + original_img.height
def add_border(original_img,border_size): new_image=SimpleImage.blank(2 * border_size + original_img.width ,2 * border_size + original_img.height ) """ Task 2: Creating black border """ for y in range(new_image.height): for x in range(new_image.width): # converti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blanck_picture(img):\r\n blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)\r\n blank_image[0:, 0:] = 0, 0, 0\r\n return blank_image", "def blanck_picture(img):\r\n\r\n blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)\r\n blank_image[0:img.shape[0], 0:img.shape[1]] ...
[ "0.6714025", "0.66643125", "0.6648807", "0.6640605", "0.6602212", "0.65825695", "0.65742725", "0.6541321", "0.6522661", "0.65158063", "0.6493315", "0.6445736", "0.64126253", "0.63945997", "0.6369834", "0.63664925", "0.63554645", "0.63346535", "0.63316894", "0.6321211", "0.632...
0.7270797
0
Insert song data into songs table.
def __insert_song_data(cur, df): song_data = ( df.song_id.values[0], df.title.values[0], df.artist_id.values[0], (df.year.values[0]).item(), (df.duration.values[0]).item() ) cur.execute(song_table_insert, song_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __insert_songplay_data(cur, df):\n # for each songplay event, described by a row in the dataframe\n for index, row in df.iterrows():\n \n # get songid and artistid from song and artist tables\n cur.execute(song_select, (row.song, row.artist, row.length))\n results = cur.fetcho...
[ "0.73941624", "0.7331522", "0.7066406", "0.68631", "0.6647466", "0.6645665", "0.6616873", "0.65485114", "0.65401894", "0.65284353", "0.65230757", "0.65068346", "0.6503408", "0.65010774", "0.64738923", "0.64560986", "0.6448128", "0.64197713", "0.6394165", "0.63929015", "0.6354...
0.81044644
0
Insert artist data into artists table.
def __insert_artist_data(cur, df): artist_data = ( df.artist_id.values[0], df.artist_name.values[0], df.artist_location.values[0], (df.artist_latitude.values[0]).item(), (df.artist_longitude.values[0]).item() ) cur.execute(artist_table_insert, artist_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_artist(self, artist):\n\n insert_artist = 'INSERT INTO artists (name, email, artist_id) VALUES (?, ?, ?)'\n\n try:\n with sqlite3.connect(db_path) as conn:\n res = conn.execute(insert_artist, (artist.name, artist.email, artist.artist_id))\n new_id = r...
[ "0.7611701", "0.7460821", "0.72466445", "0.6892506", "0.664807", "0.6483982", "0.64573", "0.6429627", "0.6339579", "0.6308975", "0.6247855", "0.62155104", "0.61949694", "0.6127392", "0.6117658", "0.61147165", "0.60814154", "0.6041325", "0.6039622", "0.6022872", "0.60218924", ...
0.8167363
0
Reads a JSON song description file containing song data like artist, song duration, song name and more. Use this data to populate Sparkify songs and artists database tables.
def process_song_file(cur, filepath): # open song file df = pd.read_json(filepath,lines=True) # insert song record __insert_song_data(cur, df) # insert artist record __insert_artist_data(cur, df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_song_file(cur, filepath):\n\n df = pd.read_json(filepath, lines=True)\n\n song_data = df[['song_id', 'title',\n 'artist_id', 'year', 'duration']].values[0]\n cur.execute(song_table_insert, song_data)\n\n artist_data = df[['artist_id', 'artist_name', 'artist_location',\n ...
[ "0.6549911", "0.6497012", "0.6399922", "0.6382647", "0.63702226", "0.63260293", "0.6318441", "0.62333465", "0.6057228", "0.60279065", "0.60231286", "0.59848255", "0.5944067", "0.5818484", "0.5815019", "0.5814996", "0.58030635", "0.5800439", "0.57995254", "0.5778145", "0.57499...
0.65851
0
Insert date information into time table.
def __insert_time_data(cur, df): # convert timestamp column to datetime t = pd.to_datetime(df.ts, unit='ms') # create a dataframe with corresponding database values time_data = ( t, t.dt.hour.values, t.dt.day.values, t.dt.weekofyear.values, t.dt.month.values,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date_time(self):\n now = datetime.datetime.now()\n self.get_current().insert('insert', str(now.strftime(\"%I:%M %p %d-%m-%Y\")))", "def add_time(data, t):\n data['year'] = t.year\n data['month'] = t.month\n data['day'] = t.day\n data['hour'] = t.hour\n data['minute'] = t.min...
[ "0.6609031", "0.6235518", "0.6142989", "0.6069743", "0.5931244", "0.58743", "0.5769201", "0.5762199", "0.57264966", "0.57218134", "0.56859434", "0.5610331", "0.55671865", "0.5566922", "0.55216056", "0.5502776", "0.54993623", "0.5499289", "0.54931325", "0.543372", "0.54251844"...
0.6670788
0
Insert user information into users table.
def __insert_user_data(cur, df): # load user dataframe user_df = pd.concat([df.userId, df.firstName, df.lastName, df.gender, df.level], axis=1) # insert user records for i, row in user_df.iterrows(): cur.execute(user_table_insert, row) # free dataframe user_df = user_df.iloc[0:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user(self):\n query = \"INSERT INTO users (first_name, last_name, email, password) VALUES (%s, %s, %s, %s)\"\n self.cursor.execute(query,(\n self.first_name, \n self.last_name, \n self.email, \n self.password))", "def insert_user(self, post_data):...
[ "0.7612417", "0.7561503", "0.7542456", "0.75392294", "0.742284", "0.73895466", "0.72774315", "0.71704495", "0.70473075", "0.702759", "0.70222366", "0.69759357", "0.69349885", "0.6924435", "0.68881714", "0.6882677", "0.6828123", "0.6821116", "0.67747474", "0.6765868", "0.66644...
0.7006203
11
Given a table of songplay events, for each songlay event, search the songid and artistid on songs and artists database tables, populating the songplays table with the songplay data, the song and the artist IDs of the music being played.
def __insert_songplay_data(cur, df): # for each songplay event, described by a row in the dataframe for index, row in df.iterrows(): # get songid and artistid from song and artist tables cur.execute(song_select, (row.song, row.artist, row.length)) results = cur.fetchone() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_music_entity_tables():\n\tsession = get_session()\n\tclient = SpotifyAuthAPI()\n\n\tplaylists = get_playlists_to_process(session)\n\n\tplaylist_count = playlists.count()\n\n\tfor i, playlist in enumerate(playlists):\n\t\tprint \"populating playlist {} of {}\".format(i + 1, playlist_count)\n\n\t\tplayl...
[ "0.70601434", "0.6467758", "0.6230667", "0.6196121", "0.5981305", "0.59780943", "0.5847388", "0.5834742", "0.57726717", "0.57629967", "0.5731776", "0.5681712", "0.56512606", "0.5603103", "0.55705607", "0.5554595", "0.5541459", "0.5522053", "0.5501534", "0.5497537", "0.5495845...
0.7293666
0
Reads a log JSON file containing events information, extracts NextSong (music listening) events and populate Sparkify database time, user and songplay tables based on those events.
def process_log_file(cur, filepath): # open log file df = pd.read_json(filepath,lines=True) # filter by NextSong action - i.e. get only listening music events from the logs df = df[(df.page == "NextSong")] # insert time records __insert_time_data(cur, df) # insert user records ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_log_file(cur, filepath):\n \n # open log file\n \n df = pd.read_json(filepath, lines = True)\n \n # filter by NextSong action\n df = df[df['page']=='NextSong']\n # convert timestamp column to datetime\n t = pd.to_datetime(df.ts, unit='ms')\n df.ts = t\n \n # insert time data records\n tim...
[ "0.7561423", "0.7477982", "0.74513096", "0.74381816", "0.741829", "0.7271516", "0.7229341", "0.720813", "0.7200528", "0.7113342", "0.70735526", "0.70275384", "0.70199585", "0.6586218", "0.64044845", "0.6404326", "0.6375384", "0.6370329", "0.63279766", "0.6326236", "0.6226814"...
0.7314814
5
Navigate through the filepath directory structure executing func for each found file.
def process_data(cur, conn, filepath, func): # get all files matching extension from directory all_files = [] for root, dirs, files in os.walk(filepath): files = glob.glob(os.path.join(root,'*.json')) for f in files : all_files.append(os.path.abspath(f)) # get total number o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_filepath_forloop(self, line):\n self.E_str = \"do_filepath_forloop\"\n line = line.replace(\" \", \"\")\n line = line[line.find(\"filepath\")+5:]\n filepath_str, _ = gen_parse.get_str_between_delims(line, \"(\", \")\")\n filepath_str = gen_parse.rm_quotation_marks(filepat...
[ "0.67218715", "0.66513443", "0.65986365", "0.6515528", "0.6504862", "0.6493864", "0.6484869", "0.6478269", "0.6458165", "0.64525414", "0.64469856", "0.6413923", "0.6383521", "0.6328872", "0.63064617", "0.6239312", "0.6233519", "0.62263453", "0.6196501", "0.61833435", "0.61784...
0.61967534
19
Test the timeout and the sleeper
def main(): rospy.init_node('basic_functionalities') sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted']) with sm: sm.userdata.nav_to_poi_name = 'exit_door' sm.userdata.pose_current = None smach.StateMachine.add( 'go_to_exit', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSleeping(self):\n time.sleep(2 * 60)\n raise AssertionError('Test case should have timed out.')", "def assert_timeout(self) -> None:", "def test_timeoutReset(self):\n for i in range(3):\n self.circuit_breaker.failure()\n self.time.advance(29.0)\n available2...
[ "0.7250753", "0.7135159", "0.71165454", "0.70150924", "0.689752", "0.6870187", "0.6783064", "0.67632157", "0.6676872", "0.66453826", "0.66401076", "0.6591634", "0.6582464", "0.6562521", "0.6505061", "0.6480681", "0.6474474", "0.6465239", "0.6454785", "0.6444882", "0.64358234"...
0.0
-1
Do a basic test with a replay attack in terms of an invalid sign counter (less or equal the actual one)
def test_verify_post_with_replayed_data_fails(self): user = self.setup_testcase( id=2, devices=[self.DEVICE], set_session_user_id=True, set_session_challenge=self.LOGIN_CHALLENGE, ) device = user.webauthndata_set.first()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sign(self):\n funcs = ['sign', 'sign_', 'abs', 'abs_', 'relu', 'relu_']\n for func in funcs:\n tensor = get_random_test_tensor(max_value=1e4)\n if func != 'sign' and func != 'sign_':\n # Make sure we test with some entry, say entry (0, 0), being 0\n ...
[ "0.599407", "0.5874762", "0.5838339", "0.5687585", "0.5661372", "0.56381196", "0.56381196", "0.5631909", "0.56149876", "0.55700797", "0.5551063", "0.55283123", "0.5516935", "0.5511997", "0.54993457", "0.54896194", "0.54844016", "0.5448561", "0.543337", "0.5432345", "0.5420996...
0.50339323
81
Test that attribute templates are validated against given bounds.
def test_object_template_validation(): length_template = PropertyTemplate("Length", bounds=RealBounds(2.0, 3.5, 'cm')) dial_template = ConditionTemplate("dial", bounds=IntegerBounds(0, 5)) color_template = ParameterTemplate("Color", bounds=CategoricalBounds(["red", "green", "blue"])) with pytest.raises...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assert_bounds_are_valid(\n self, new_bounds: devices.PrimaryBounds\n ) -> None:\n correct_length = len(new_bounds) == self.nprimaries\n tuples_of_float = all(\n [\n isinstance(item, tuple) and isinstance(b, (float, np.floating))\n for item in ne...
[ "0.6381215", "0.6191196", "0.60321444", "0.59561", "0.594038", "0.58459795", "0.58178777", "0.5817579", "0.58098483", "0.57411844", "0.573926", "0.570897", "0.5658499", "0.56572485", "0.5657168", "0.5644796", "0.56357795", "0.55865157", "0.55815446", "0.5565243", "0.55587995"...
0.6241862
1
Test that an object and its attributes can both be assigned templates.
def test_template_assignment(): humidity_template = ConditionTemplate("Humidity", bounds=RealBounds(0.5, 0.75, "")) template = ProcessTemplate("Dry", conditions=[[humidity_template, RealBounds(0.5, 0.65, "")]]) ProcessSpec("Dry a polymer", template=template, conditions=[ Condition("Humidity", value=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_object_template_validation():\n length_template = PropertyTemplate(\"Length\", bounds=RealBounds(2.0, 3.5, 'cm'))\n dial_template = ConditionTemplate(\"dial\", bounds=IntegerBounds(0, 5))\n color_template = ParameterTemplate(\"Color\", bounds=CategoricalBounds([\"red\", \"green\", \"blue\"]))\n\n...
[ "0.69322157", "0.66817254", "0.6182613", "0.60178757", "0.59672934", "0.5823069", "0.5780402", "0.5737048", "0.571049", "0.5679045", "0.5598014", "0.5551784", "0.5528739", "0.5516997", "0.5516243", "0.5505534", "0.54870075", "0.54850197", "0.54847145", "0.5480541", "0.5468632...
0.5696904
9
Test the login endpoint /login/
def test_user_can_log_in(self): # create a user User.objects.create_user(username='john', email='juangathure@gmail.com', password='test_password') credentials = { "username": "john", "password": "test_pass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_view(self):\n response = self.client.get(url_for('users.login'))\n self.assertEqual(response.status_code, 200)", "def test_login_page(self):\n res = self.app.post('/login')\n self.assertEqual(res.status_code, 400)\n res = self.app.get('/login')\n self.asse...
[ "0.8492118", "0.8467027", "0.84442997", "0.83322906", "0.8263762", "0.8261837", "0.82603383", "0.81874233", "0.8131619", "0.81302047", "0.810418", "0.8067046", "0.8056185", "0.80473584", "0.8036182", "0.8010041", "0.79930484", "0.7990684", "0.798193", "0.79621756", "0.7957182...
0.7400871
86
Test the retrieve drinks enpoint /data/drinks"
def test_if_user_can_retrive_drinks(self): # take data from the ones extracted from the json file drinks = self.test_data["drinks"] save_drinks = [] for drink in drinks: drink = Drink(**drink) save_drinks.append(drink) Drink.objects.bulk_create(save_drink...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_response(drink):\n\n #create url\n drink2 = introcs.replace_str(drink,' ','%20')\n url = str('https://www.thecocktaildb.com/api/json/v1/'+APIKEY+'/search.php?s='+str(drink2))\n\n #query url\n result = introcs.urlread(url)\n\n #return result\n return result", "def test_get_offers(...
[ "0.62879044", "0.6248839", "0.61403203", "0.6029827", "0.595824", "0.5950868", "0.5855003", "0.5836545", "0.58276004", "0.58260334", "0.5825966", "0.58221614", "0.5807348", "0.58021325", "0.5796781", "0.5774858", "0.57394475", "0.5738574", "0.5729782", "0.5723868", "0.5719225...
0.6907348
0
Test the add data endpoint /data/data_collected/
def test_if_user_can_add_and_retrieve_data(self): # take the first three drinks drinks = self.test_data["drinks"][:3] # create drink objects from the json data drinks = [Drink(**i) for i in drinks] Drink.objects.bulk_create(drinks) data = self.test_data["data"][0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_data(self):\n pass", "def insert_data(self):\n # Make a connexion with a mock database\n self.generate_data_collection()", "def test_add(self):\n # Everything added will be deleted later in test_delete.\n first_name = 'Trevor'\n last_name = 'Harvey'\n ...
[ "0.65526533", "0.65504", "0.64901567", "0.64688575", "0.637096", "0.6353962", "0.63452864", "0.62429106", "0.62413156", "0.6223261", "0.6206434", "0.6182021", "0.61503667", "0.6114721", "0.6098006", "0.6083136", "0.60707694", "0.60618895", "0.60558987", "0.6031864", "0.602494...
0.7164119
0
Test the retrieve one, update and delete endpoint /data/record//
def test_if_user_can_update_data_added(self): drink_data = self.test_data["drinks"][0] # save a drink drink = Drink(**drink_data) drink.save() record_data = self.test_data["data"][0] data = Data( favorite_drink=drink, consumer_name=record_data["co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_record(self):\n pass", "def test_2_resource_records_actions(self):\n record_type = 'AAAA'\n name = 'test.example.com'\n ttl = 60\n rdata = {\n 'ip': '2001::1'\n }\n # create resource record\n resp = self.record.create_resource_record...
[ "0.75314", "0.70753974", "0.70284724", "0.6919171", "0.6824956", "0.68036014", "0.6784548", "0.6743884", "0.6614933", "0.6596713", "0.6578795", "0.65606844", "0.6389052", "0.6214669", "0.6118815", "0.6087305", "0.60797685", "0.6047278", "0.60294366", "0.59842926", "0.59555656...
0.5991204
19
Function that divides all elements of a matrix.
def matrix_divided(matrix, div): error1 = "matrix must be a matrix (list of lists) of integers/floats" new_matrix = [] if type(matrix) != list: raise TypeError(error1) if type(div) != int and type(div) != float: raise TypeError("div must be a number") if div == 0: raise Zero...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_divided(matrix, div):\n\n # ============== Some edge cases ====================\n # div is not an int or a float partner\n if (type(div) != int and type(div) != float):\n raise TypeError(\"div must be a number\")\n # Try a division by 0... sale mal\n elif (div == 0):\n raise...
[ "0.7311689", "0.71896356", "0.7183845", "0.7178796", "0.71675086", "0.71583325", "0.71013784", "0.7080898", "0.7075601", "0.7066555", "0.7058266", "0.7053959", "0.70452994", "0.7012356", "0.6993707", "0.6991848", "0.69855106", "0.6981618", "0.695724", "0.69552416", "0.6954866...
0.68245167
25
Method to retrieve the required the DHTK extension module.
def __init__(self, settings: object, client: object): # Retrieve required DHTK settings self.LOGS = settings.logger self.dataset = settings.dataset self.LOGS.info("DATASET: Instantiating Dataset object") # Load required module module = self._load_module(settings, client...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_module(self, settings: object, client: object) -> typing.Union[object, None]:\n # Log call\n self.LOGS.debug(f\"DATASET: Dataset._load_module({self.dataset}) method was called\")\n\n # Get extension path\n path = pathlib.Path(__file__).parents[1]\n path = path / \"exten...
[ "0.6801367", "0.6133761", "0.5998294", "0.5927281", "0.5913516", "0.58879644", "0.58594435", "0.58108467", "0.5806288", "0.5741612", "0.57151514", "0.5688068", "0.5666509", "0.5640602", "0.56163037", "0.55901855", "0.55893517", "0.5584299", "0.5584299", "0.5584299", "0.558429...
0.0
-1
Method to load the DHTK extension dataset required.
def _load_module(self, settings: object, client: object) -> typing.Union[object, None]: # Log call self.LOGS.debug(f"DATASET: Dataset._load_module({self.dataset}) method was called") # Get extension path path = pathlib.Path(__file__).parents[1] path = path / "extensions" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> None:", "def _load(self, dataset):\n raise NotImplementedError('Loader {} does not support loading datasets.'.format(self.type()))", "def load_dataset():\n\n\n train_dd_loader = DailyDialogLoader(PATH_TO_TRAIN_DATA, load=False)\n train_dataloader = DataLoader(train_dd_loader...
[ "0.6243584", "0.61764413", "0.61563146", "0.60021603", "0.5950557", "0.58355236", "0.5801461", "0.5773266", "0.5746743", "0.57125086", "0.5678682", "0.56555885", "0.56177497", "0.56078255", "0.5594913", "0.55427146", "0.5524298", "0.55231154", "0.5504544", "0.5504193", "0.549...
0.57780874
7
Merge changes introduced by notebooks local and remote from a shared ancestor base. Return new (partially) merged notebook and unapplied diffs from the local and remote side.
def merge_notebooks(base, local, remote, args=None): if args and args.log_level == "DEBUG": for (name, nb) in [("base", base), ("local", local), ("remote", remote)]: _logger.debug("%s In merge, input %s notebook:" % ("="*20, name)) buf = StringIO() pretty_print_notebook(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_get_diffbase(review_target, branch):\n return ['git', 'merge-base', review_target, branch]", "def merge(): #Status: WIP\r\n pass", "def merge_from(self, other):\n assert not self.is_final\n if self.parent is not None:\n assert other.parent is not None\n self.parent.merge_from(o...
[ "0.53412235", "0.5067476", "0.48546484", "0.47724307", "0.4723565", "0.4699313", "0.4685136", "0.46764392", "0.46666393", "0.46520692", "0.46505848", "0.46465474", "0.4643478", "0.46357703", "0.46177492", "0.46163565", "0.46112147", "0.4602513", "0.45935103", "0.4579357", "0....
0.72284716
0
Create the spark session and returns its object
def create_spark_session(): spark = SparkSession \ .builder \ .config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \ .getOrCreate() return spark
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()", "def create_spark_session():\n\n spark = SparkSession. builder.\\\n config(\"spark.jars.packages\", \"org.apache....
[ "0.86523557", "0.8286961", "0.82391435", "0.81481373", "0.7979438", "0.7950069", "0.7950069", "0.7950069", "0.7950069", "0.79482985", "0.7898484", "0.7879878", "0.78603834", "0.78490996", "0.7812462", "0.7810376", "0.77311814", "0.7722151", "0.76831895", "0.7608785", "0.75595...
0.79879576
9
extract songs data from input json files, transform it and load it to s3
def process_song_data(spark, input_data, output_data): # get filepath to song data file song_data = input_data + "song-data/*/*/*/*.json" # read song data file df = spark.read.json(song_data) # extract columns to create songs table songs_table = df.select("song_id", "title", "artist_id", "yea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(transcribe_bucket_name, mp3_bucket_name):\n\n s3 = boto3.resource('s3')\n for bucket in s3.buckets.all():\n if bucket.name == transcribe_bucket_name:\n for key in bucket.objects.all():\n if key.key.endswith('.json'):\n r = {}\n #...
[ "0.6824642", "0.6686416", "0.6517924", "0.64819294", "0.6422017", "0.6420865", "0.6412053", "0.6381231", "0.6357485", "0.6344805", "0.6336409", "0.6255654", "0.6250518", "0.62384814", "0.6234753", "0.62209773", "0.6219217", "0.6212057", "0.6147171", "0.6135364", "0.61273915",...
0.6525804
2
extract songs data from input json files, transform it and load it to s3
def process_log_data(spark, input_data, output_data): # get filepath to log data file log_data = input_data + "log-data/*/*/*.json" # read log data file df = spark.read.json(log_data) # filter by actions for song plays # rename the columns as per requirements df = df.filter("page='Next...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(transcribe_bucket_name, mp3_bucket_name):\n\n s3 = boto3.resource('s3')\n for bucket in s3.buckets.all():\n if bucket.name == transcribe_bucket_name:\n for key in bucket.objects.all():\n if key.key.endswith('.json'):\n r = {}\n #...
[ "0.68251455", "0.6686366", "0.6525705", "0.65178376", "0.64817154", "0.64219576", "0.6420597", "0.6412002", "0.6381185", "0.6357563", "0.634464", "0.63363487", "0.6255237", "0.6250076", "0.623816", "0.6234429", "0.6221176", "0.6219033", "0.62120044", "0.61469954", "0.6135466"...
0.0
-1
Extract the source data from s3 Transform the data using spark to create star schema Create fact table songplays Create dimention tables songs, time, artists, users Load the data back to s3 in parquet format
def main(): spark = create_spark_session() input_data = "s3a://udacitydenanodegree2020/" output_data = "s3a://udacitydenanodegree2020/output/" process_song_data(spark, input_data, output_data) process_log_data(spark, input_data, output_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_song_data(spark, input_data, output_data):\n \n # get filepath to all json file of song_data in S3 bucket\n song_data = input_data + \"song_data/*/*/*/*.json\"\n \n # read song data file\n df = spark.read.json(song_data)\n \n # print out the schema in tree format\n print(\"--...
[ "0.7314552", "0.7299476", "0.707618", "0.69829726", "0.6962383", "0.6855086", "0.6805144", "0.668518", "0.66836613", "0.6646393", "0.66457427", "0.6635227", "0.6628329", "0.66010725", "0.65811473", "0.6565799", "0.6554451", "0.6549181", "0.654528", "0.6536304", "0.65027755", ...
0.64933723
21
Assure that the partition has only the specified number of replicas, deleting any extras
def delete_replicas(self, target_count): while len(self.replicas) > target_count: self.remove_replica(self.replicas[-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_cluster_resource_quota(self):\n pass", "def test_delete_hyperflex_cluster_storage_policy(self):\n pass", "def deleteShards():\n os.popen('rm *_shard')", "def test_base_replica_repair_with_contention(self):\n self._base_replica_repair_test(fail_mv_lock=True)", "def nu...
[ "0.59140897", "0.590533", "0.5891525", "0.5885933", "0.5833488", "0.5766058", "0.57631654", "0.57603097", "0.56855255", "0.56625503", "0.56470937", "0.5603259", "0.5556599", "0.554412", "0.552986", "0.55177534", "0.5512172", "0.54553056", "0.5409592", "0.54087335", "0.5405373...
0.7159342
0
Given a position and a broker, make sure the broker is in the replica set for this partition at the given position.
def add_or_update_replica(self, position, new_broker): if len(self.replicas) > position: if self.replicas[position] == new_broker: # No change in the replica at this position return else: # New replica at this position. Swap it in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_replica_for_exchange(self, replica):\n pass", "def replicaof(self, *args, **kwargs) -> NoReturn:\n raise RedisClusterException(\"REPLICAOF is not supported in cluster mode\")", "def is_replica(self):\n if (\n self.replica\n and self.aip\n and no...
[ "0.5618285", "0.53380245", "0.52990556", "0.4901489", "0.4876627", "0.484487", "0.48137334", "0.47763926", "0.47661713", "0.4744803", "0.47381744", "0.4703642", "0.46730462", "0.46692634", "0.46577626", "0.46351507", "0.46206054", "0.4593262", "0.4572723", "0.45560184", "0.45...
0.59172034
0
This is the method that will be used to create a table.
def create_table(self, tableName, primaryKey=None, Nullable=None, colNames=None, ): queryString = f"CREATE TABLE [IF NOT EXISTS] {tableName} (" # will now loop throught colNames and will add them to the query string if colNames: for i in range(len(colNames)): queryStr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def create_table(self):\n self.db.query(f\"\"\"\n CREATE TABLE IF NOT EXISTS {self.table} (\n id INT UNSIGNED NOT NULL AUTO_INCREMENT,\n name VARCHAR(140) NOT NULL,\n PRIMARY KEY (id)\n )\n \...
[ "0.9126027", "0.8474568", "0.8471213", "0.8279364", "0.8260887", "0.8251538", "0.82465637", "0.8216601", "0.8202273", "0.81001127", "0.7998873", "0.7985946", "0.7944236", "0.7943698", "0.7943698", "0.79285306", "0.7927997", "0.7872659", "0.7830576", "0.7816202", "0.7774867", ...
0.0
-1
This function will make the string which then can be used to inert a single row in a postgresql database dataRow will be a list or tuple of values for the row
def insert_to_table(self, tableName, dataRow, colNames): queryString = f"INSERT INTO {tableName} VALUES " # building the Values list valueString = "" # looping for value in dataRow:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sql_statement_insert_data_for_row(datatable_row: ModelDatatableRow):\n if datatable_row is None:\n return None\n\n # sql = ''' INSERT INTO projects(name,begin_date,end_date)\n # VALUES(?,?,?) '''\n # begin of statement\n sql_statement = ''' INSERT INTO ''' + \\\n ...
[ "0.65210056", "0.63941914", "0.6315236", "0.6243704", "0.614621", "0.60923094", "0.6070728", "0.6046095", "0.5966439", "0.5945484", "0.584872", "0.580741", "0.57923657", "0.57514584", "0.57483816", "0.5747995", "0.5736275", "0.5713328", "0.56523144", "0.56324565", "0.5630656"...
0.56939214
18
This function will return only the first part of the column names query so that you can get the column names Will return "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "
def colNames_string(self): # SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'some_table'; return "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _columns(cursor, table):\n cursor.execute('''\n SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = %s\n ''', (table, ))\n return [column['column_name'] for column in cursor.fetchall()]", "def _get_column_names(self, query):\n\n try:\n ...
[ "0.7587509", "0.7528652", "0.7386827", "0.73188144", "0.7196022", "0.71589047", "0.7113789", "0.70294404", "0.7011823", "0.69226605", "0.69214416", "0.6867249", "0.68229336", "0.6776281", "0.6633766", "0.66171926", "0.64768475", "0.6472669", "0.6421773", "0.6416172", "0.64115...
0.75491923
1
Compiles the given vue.js template to javascript
def vue_template_compiler(source, options=None): options = options or {} res = NodeLikeInterpreter().evaljs( ('const compiler = require("vue-template-compiler");' 'var compiled = compiler.compile(dukpy.source);', 'var result = {"error": null, "output": compiled.render};' 'resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_template(template_file, data):\n from cStringIO import StringIO\n output_stream = StringIO()\n\n import xyaptu\n xcp = xyaptu.xcopier(data, ouf=output_stream)\n xcp.xcopy(template_file)\n\n output = output_stream.getvalue()\n return output", "def render(template, variables={}):\r...
[ "0.5720077", "0.5713875", "0.5637231", "0.5489268", "0.54380643", "0.5364401", "0.5290392", "0.5281405", "0.52704805", "0.52584887", "0.5253346", "0.5240135", "0.52134985", "0.5159162", "0.513993", "0.51194215", "0.5086437", "0.5069739", "0.50688916", "0.50660187", "0.5045320...
0.7864779
0
Create the default engine with the updated admin user.
def get_engine(username, password, ipaddress, database): #TODO(rnirmal):Based on permissions issues being resolved we may revert #url = URL(drivername='mysql', host='localhost', # query={'read_default_file': '/etc/mysql/my.cnf'}) global ENGINE if ENGINE: return ENGINE if databas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p_makeAdminUser(self):\n\n # If already in database, return\n if self.dbManager.userExists(C_ADMINISTRATOR_USERNAME):\n return\n # Store admin in database\n self.dbManager.createUser(C_ADMINISTRATOR_USERNAME, C_ADMINISTRATOR_PASSWORD, UserRole.ADMIN, defaultPacemakerParam...
[ "0.6500232", "0.64834094", "0.64834094", "0.6399901", "0.63858587", "0.63801724", "0.63244617", "0.6316277", "0.6223791", "0.61776435", "0.60490733", "0.6031327", "0.6013108", "0.5987109", "0.5925226", "0.59027827", "0.5820908", "0.58000505", "0.57981163", "0.5774134", "0.576...
0.0
-1
Event triggered when a connection is checked out from the pool.
def checkout(self, dbapi_con, con_record, con_proxy): try: try: dbapi_con.ping(False) except TypeError: dbapi_con.ping() except dbapi_con.OperationalError as ex: if ex.args[0] in (2006, 2013, 2014, 2045, 2055): raise ex....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connection_closed(self):", "def outConnectEvent(self):\r\n pass", "def connection_remote_closed(self, connection, pn_condition):\n assert len(self.receivers) == 0\n self.connection.close()", "def _on_connection_close(self):\n print(\"connection was closed, reconnecting...\"...
[ "0.6547985", "0.6265847", "0.6116575", "0.60326314", "0.6028223", "0.6025454", "0.59797263", "0.59635985", "0.5951496", "0.5941932", "0.5929791", "0.5929733", "0.58875734", "0.58794683", "0.5864301", "0.58534276", "0.58472264", "0.5845368", "0.5837708", "0.5824835", "0.578242...
0.0
-1
Conducts forward propagation using Dropout. X is a numpy.ndarray of shape (nx, m) containing the input data for the network. nx is the number of input features. m is the number of data points. weights is a dictionary of the weights and biases of the neural network. L the number of layers in the network. keep_prob is th...
def dropout_forward_prop(X, weights, L, keep_prob): cache = {} cache['A0'] = X for i in range(L): layer = str(i + 1) prev = str(i) w = 'W' + layer b = 'b' + layer a = 'A' + layer ap = 'A' + prev drop = 'D' + layer z = np.matmul(weights[w], cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout_forward_prop(X, weights, L, keep_prob):\n rnd = np.random.rand\n cache = {}\n cache[\"A0\"] = X\n for j in range(L):\n z = np.dot(weights[\"W\" + str(j+1)], cache[\n \"A\" + str(j)]) + (weights[\"b\" + str(j+1)])\n if j == L-1:\n \"\"\" The last layer use...
[ "0.8092365", "0.7698822", "0.7559529", "0.6820467", "0.6445729", "0.6243247", "0.61436987", "0.6070557", "0.6039815", "0.60051537", "0.5972164", "0.5904196", "0.588693", "0.58746326", "0.5862984", "0.5819266", "0.5816549", "0.57878774", "0.5781992", "0.5780524", "0.57765776",...
0.7797605
1
Metodo que corrige traducciones dobles
def filter(list_tweets): for index, item in enumerate(list_tweets): if isinstance(item, list): print(item) list_tweets[index] = item[0] return list_tweets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transact(self):", "def transact(self):", "def mezclar_bolsa(self):", "def cliquer_sur_unité(self):", "def agregar_bolsa(self, letra, cantidad):", "async def _conoscitore(self, ctx: commands.Context):\n responses = ['de facto, di facto', 'fanculizzati','Tra il lusco e il brusco,tra il serio e il...
[ "0.6388283", "0.6388283", "0.63224614", "0.6144349", "0.6089646", "0.60247314", "0.59354794", "0.5919143", "0.57281595", "0.5703051", "0.5703051", "0.5703051", "0.5703051", "0.5703051", "0.56882554", "0.56481594", "0.5588566", "0.5578385", "0.5560217", "0.55594224", "0.555324...
0.0
-1
Get all the runs for the scraper.
def getruns(scraper): # See https://scraperwiki.com/docs/api#getinfo d = json.load(urllib.urlopen( "https://api.scraperwiki.com/api/1.0/scraper/getinfo?format=jsondict&name=%(scraper)s&history_start_date=1999-01-01&quietfields=datasummary%&Ccode" % locals())) return d['runevents']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_runs(self):\n postresult = requests.get(\n f\"{self.proto}://{self.host}/ga4gh/wes/v1/runs\", headers=self.auth\n )\n return wes_reponse(postresult)", "def run_crawler(self) -> List[JobEventSchema]:\n print(f\"Ready for scraping, current task: {self.tasks}\")\n\n ...
[ "0.7532005", "0.715063", "0.6613536", "0.66062856", "0.6508605", "0.6476282", "0.64561427", "0.64347756", "0.6423604", "0.6418854", "0.6254022", "0.62132746", "0.6213171", "0.6151299", "0.61487746", "0.6111832", "0.6110533", "0.6108315", "0.6099887", "0.6094681", "0.60095054"...
0.63420653
10
Get all the runs for the scraper.
def getruns(scraper): # See https://scraperwiki.com/docs/api#getinfo d = json.load(urllib.urlopen( "https://api.scraperwiki.com/api/1.0/scraper/getinfo?format=jsondict&name=%(scraper)s&history_start_date=1999-01-01&quietfields=datasummary%&Ccode" % locals())) return d['runevents']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_runs(self):\n postresult = requests.get(\n f\"{self.proto}://{self.host}/ga4gh/wes/v1/runs\", headers=self.auth\n )\n return wes_reponse(postresult)", "def run_crawler(self) -> List[JobEventSchema]:\n print(f\"Ready for scraping, current task: {self.tasks}\")\n\n ...
[ "0.7533405", "0.71490407", "0.66140324", "0.66079205", "0.6507536", "0.64760375", "0.645748", "0.64353895", "0.6424077", "0.64174247", "0.625433", "0.6213806", "0.6211233", "0.6150878", "0.61471736", "0.61130846", "0.6110319", "0.6108903", "0.6099761", "0.6094916", "0.6011122...
0.63427573
11
Download a file's content.
def download_file(service, drive_file): download_url = drive_file['exportLinks']['text/plain'] if download_url: resp, content = service._http.request(download_url) if resp.status == 200: # print ('Status: %s' % resp) return content.decode('utf8') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file(client, file_id):\n\n file_content = client.file(file_id).content()\n print(file_content)", "def __download_file(self, filename):\r\n \r\n respons = requests.get(self.__url + filename, stream=True)\r\n save_filename = os.path.join(self.__folder, os.path.basename(filen...
[ "0.7790977", "0.776677", "0.7689683", "0.7534754", "0.747445", "0.7447734", "0.7396164", "0.7368094", "0.7356474", "0.7299338", "0.7298145", "0.7294272", "0.7198224", "0.7149062", "0.714651", "0.7115778", "0.71142143", "0.7096652", "0.7070044", "0.70048743", "0.70001113", "...
0.68261397
53
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials.
def get_credentials(): home_dir = os.path.expanduser('~') credential_dir = os.path.join(home_dir, '.credentials') if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, 'client_secret_OCR.json') st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_user_credentials(self, storage):\n # Set up a Flow object to be used if we need to authenticate.\n flow = client.flow_from_clientsecrets(\n self.client_secrets,\n scope=self.api_scopes,\n message=tools.message_if_missing(self.client_secrets))\n\n # Re...
[ "0.7571305", "0.7356556", "0.71548086", "0.711909", "0.70713574", "0.7026156", "0.6991323", "0.6962775", "0.69490343", "0.6940299", "0.6935988", "0.6906218", "0.6900573", "0.68998826", "0.6857519", "0.68309605", "0.6792369", "0.6785002", "0.67753786", "0.67753786", "0.6775378...
0.67332715
29
Shows basic usage of the Google Drive API. Creates a Google Drive API service object and outputs the names and IDs for up to 10 files.
def googleOCR(folderName, pdfList): credentials = get_credentials() http = credentials.authorize(httplib2.Http()) service = discovery.build('drive', 'v2', http=http) # create folder for year in file_metadata = { 'title': folderName, 'mimeType': 'application/vnd.google-apps.folder' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n store = file.Storage('token.json')\n creds = store.get()\n if not creds or creds.invalid:\n flow = client.flow_from_clientsecrets('credentials.json', SCOPES)\n creds = tools.run_flow(flow, store)\n service = build('drive', 'v2', http=creds.authorize(Http()))\n files_list ...
[ "0.68105245", "0.65864366", "0.6501047", "0.6232129", "0.6224263", "0.62239563", "0.6150333", "0.61083674", "0.6036366", "0.6022499", "0.5992012", "0.58437514", "0.5760239", "0.573155", "0.57297635", "0.57074565", "0.57030565", "0.5644897", "0.5633994", "0.5539862", "0.552196...
0.50121564
38
This is a function to get access to all of the scene properties that are registered in this library
def get_dimension_props(): props = eval("bpy.context.scene." + DIMENSION_PROPERTY_NAMESPACE) return props
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_properties():", "def getProperties():", "def properties(self):", "def properties(self):", "def properties(self):", "def get_properties(self):\n return self.properties", "def properties(self):\n return self.world.find(self.ehandle)", "def readProperties(self):\r\n print('not yet i...
[ "0.7351869", "0.7327352", "0.71004266", "0.71004266", "0.71004266", "0.6974189", "0.6969819", "0.6922483", "0.6798319", "0.6798036", "0.66491675", "0.6591777", "0.65880245", "0.6576353", "0.6570001", "0.6434748", "0.6434748", "0.63727653", "0.637045", "0.62892854", "0.6283141...
0.66263026
11
This is a function to get access to all of the scene properties that are registered in this library
def get_object_dimension_props(obj): props = eval("obj." + DIMENSION_PROPERTY_NAMESPACE) return props
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_properties():", "def getProperties():", "def properties(self):", "def properties(self):", "def properties(self):", "def get_properties(self):\n return self.properties", "def properties(self):\n return self.world.find(self.ehandle)", "def readProperties(self):\r\n print('not yet i...
[ "0.7351885", "0.73275936", "0.70996654", "0.70996654", "0.70996654", "0.697482", "0.6969456", "0.6921824", "0.67983496", "0.6797483", "0.6648637", "0.6626909", "0.6591761", "0.65885854", "0.6576122", "0.65711683", "0.64341086", "0.64341086", "0.63726294", "0.63711584", "0.628...
0.0
-1
Set Section Number for Assembly This collects the products on a wall and loops through the products increasing the count of the number of openings found. Then assigns the number to comment 2 of the part This can only be set for parts that have a integer assigned for the mv.opening_name property
def set_section_number(self, assembly): wall_bp = utils.get_wall_bp(assembly.obj_bp) product_bp = utils.get_bp(assembly.obj_bp, 'PRODUCT') if wall_bp: products = self.get_wall_products(wall_bp) adjusted_opening_number = 0 for product in products: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_library_section(self, path: list[str], material_id: int) -> int:\n next_index = next_object_key(self)\n new_section = Section()\n new_section.load_section_from_library(path, material_id)\n setattr(self, str(next_index), new_section)\n return next_index", "def add_custom...
[ "0.5174256", "0.49899268", "0.4913171", "0.48809946", "0.4871566", "0.48547396", "0.48413014", "0.47745255", "0.47412124", "0.47402564", "0.4733575", "0.47258484", "0.4708002", "0.4698902", "0.4694061", "0.46830198", "0.465838", "0.46321988", "0.46154633", "0.46126166", "0.46...
0.8266816
0
Get Sorted List of Products on a Wall
def get_wall_products(self, wall_bp): products = [] for child in wall_bp.children: props = props_closet.get_object_props(child) if props.is_closet or props.is_fixed_shelf_and_rod_product_bp: child.mv.comment = wall_bp.mv.name_object products.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_products():\n products = product.Product.query. \\\n order_by(desc(product.Product.likes)).all()[:6]\n context = {\n 'products': products\n }\n return render_template('stores/topstores.html', **context)", "def sort_products(param: str, querySet: QuerySet):\n products_list...
[ "0.5951398", "0.581583", "0.578056", "0.57139724", "0.56682044", "0.56030166", "0.5492769", "0.54736334", "0.5452253", "0.5443932", "0.54422987", "0.54090714", "0.5393291", "0.53909343", "0.5382308", "0.5372019", "0.5362841", "0.5352322", "0.5346223", "0.5342234", "0.5313254"...
0.7254866
0
Get Sorted List of Panels in a product
def get_product_panels(self, product_bp, panel_list): for child in product_bp.children: props = props_closet.get_object_props(child) if props.is_panel_bp: assembly = fd_types.Assembly(child) if common_closet_utils.part_is_not_hidden(assembly): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wall_panels(self, wall_bp):\n wall_panels = []\n products = self.get_wall_products(wall_bp)\n for product in products:\n product_panel_list = self.get_product_panels(product, [])\n for product_panel in product_panel_list:\n wall_panels.append(produc...
[ "0.6058318", "0.59466535", "0.5723221", "0.54906386", "0.54906386", "0.5452169", "0.5402853", "0.5379197", "0.53562945", "0.53431034", "0.53294426", "0.5325394", "0.53230935", "0.53167313", "0.5307443", "0.5296484", "0.5198259", "0.5186805", "0.51833737", "0.5181582", "0.5126...
0.7261949
0
Get Sorted List of Panels for a wall Returns List of Base Points
def get_wall_panels(self, wall_bp): wall_panels = [] products = self.get_wall_products(wall_bp) for product in products: product_panel_list = self.get_product_panels(product, []) for product_panel in product_panel_list: wall_panels.append(product_panel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_panels(rectangles):\n\n pairs = []\n for rect in rectangles:\n if (2 * rect[1][0] < rect[1][1]) or (rect[1][0] > 2 * rect[1][1]):\n if 2 * rect[1][0] < rect[1][1]:\n long_dim1 = 0\n elif rect[1][0] > 2 * rect[1][1]:\n long_dim1 = 1\n\n ...
[ "0.6349068", "0.5936909", "0.5917394", "0.5908087", "0.5884993", "0.5861732", "0.58608633", "0.58252734", "0.5817485", "0.5776837", "0.57392085", "0.571232", "0.57121414", "0.57106364", "0.5676142", "0.566193", "0.5654982", "0.5653337", "0.56288165", "0.562557", "0.5623271", ...
0.6852642
0
Return us an s3 location record type
def s3_location(self, value): info = urlparse(value) if info.scheme != "s3": raise ValueError("S3 location must be a valid s3 url\tgot={0}".format(value)) bucket = info.netloc if not bucket: raise ValueError("S3 location must be a valid s3 url\tgot={0}".format(va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_s3_location ( loc_param ) :\n return eval( 'boto.s3.connection.Location.' + loc_param )", "def type(self):\n return 's3_file'", "def internal_location_record_cls(self):\n return self.record_class_by_pid_type(INTERNAL_LOCATION_PID_TYPE)", "def get_storage_location(self):\n retur...
[ "0.67285526", "0.66356003", "0.60334647", "0.56955457", "0.5567557", "0.55667526", "0.55150425", "0.54151994", "0.5402438", "0.5402438", "0.53967667", "0.53815424", "0.5367676", "0.5351216", "0.5339426", "0.532673", "0.5300107", "0.52927417", "0.52732354", "0.52463055", "0.52...
0.628744
2
Copy a key from to
def copy_key(self, frm, to): frm_location = self.s3_location(frm) copy_source = { 'Bucket': frm_location.bucket, 'Key': frm_location.key[1:] } to_location = self.s3_location(to) bucket = self.get_bucket(to_location.bucket) log.info("Copying %s to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_key(self, key):\n # Get the TTL for the key\n ttl = self.src.ttl(key)\n\n # -2 means the key doesn't actually exist and is a lie\n if ttl == -2:\n # self.log.debug(f\"TTL -2: {key}\")\n return\n\n # -1 means the key has no expiration and we set it t...
[ "0.7891342", "0.71922034", "0.7077428", "0.6817545", "0.66453826", "0.64820206", "0.6481614", "0.6416798", "0.6412328", "0.63470095", "0.62531435", "0.6101375", "0.6060823", "0.6043063", "0.6036096", "0.60295564", "0.602396", "0.58916676", "0.5850373", "0.58423436", "0.581670...
0.7800135
1
Test /answer without auth
def test_info_id_resolution_without_auth(self): url = reverse_lazy('media:info_id_resolution', kwargs={'media_id': 1}) response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_test_no_auth():\n # Permission check is not applicable here\n return jsonify({\"answer\": 42})", "def test_post_answer_if_not_autheticated(self):\n response = self.post_answer()\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_successful_get_an_ans...
[ "0.7582349", "0.7361703", "0.7260031", "0.69266164", "0.68072885", "0.6653531", "0.6563085", "0.64960635", "0.63382673", "0.63281137", "0.6327597", "0.6309151", "0.6225421", "0.61988676", "0.6167933", "0.6137564", "0.6105888", "0.60713184", "0.6070654", "0.6038649", "0.603643...
0.0
-1
Test /answer without auth
def test_info_id_resolution_wrong_academy(self): url = reverse_lazy('media:info_id_resolution', kwargs={'media_id': 1}) response = self.client.get(url, **{'HTTP_Academy': 1}) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_test_no_auth():\n # Permission check is not applicable here\n return jsonify({\"answer\": 42})", "def test_post_answer_if_not_autheticated(self):\n response = self.post_answer()\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_successful_get_an_ans...
[ "0.7582349", "0.7361703", "0.7260031", "0.69266164", "0.68072885", "0.6653531", "0.6563085", "0.64960635", "0.63382673", "0.63281137", "0.6327597", "0.6309151", "0.6225421", "0.61988676", "0.6167933", "0.6137564", "0.6105888", "0.60713184", "0.6070654", "0.6038649", "0.603643...
0.0
-1
Test /answer without auth
def test_info_id_without_data(self): self.headers(academy=1) model = self.generate_models(authenticate=True, profile_academy=True, capability='read_media_resolution', role='potato') url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_test_no_auth():\n # Permission check is not applicable here\n return jsonify({\"answer\": 42})", "def test_post_answer_if_not_autheticated(self):\n response = self.post_answer()\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_successful_get_an_ans...
[ "0.7582349", "0.7361703", "0.7260031", "0.69266164", "0.68072885", "0.6653531", "0.6563085", "0.64960635", "0.63382673", "0.63281137", "0.6327597", "0.6309151", "0.6225421", "0.61988676", "0.6167933", "0.6137564", "0.6105888", "0.60713184", "0.6070654", "0.6038649", "0.603643...
0.0
-1
Clean the input buffer and get a name that's typed in.
def getName(): tcflush(sys.stdin, TCIFLUSH) name = input(" You say:\n ") updateNameDatabase(name) return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n name = input(\"What is your name? \")\n if len(name) > 0:\n self.name = name", "def input_name(self):\n return self.__input_name", "def get_name():\n return raw_input(\"What's your name? \")", "def get_name():\n print(\"\")\n name = input(\"Greet...
[ "0.6385", "0.6207764", "0.6180437", "0.61366755", "0.61346084", "0.61324376", "0.61028165", "0.6036705", "0.5994801", "0.5983757", "0.59797794", "0.5919747", "0.5912155", "0.5897724", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420867", "0.58420...
0.6812864
0
Take a name and if it isn't a recognised name, add it to the name list.
def updateNameDatabase(name): with open("knownPeople.txt") as f: knownPeople = f.readlines() f.close() knownPeople = [x.strip() for x in knownPeople] if name not in knownPeople: knownPeople.append(name) with open('knownPeople.txt', 'w') as f: for item in knownPeople: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_name(self, msg, name):\n try:\n names = self.get_local(msg, \"names\")\n except KeyError:\n names = set()\n names.add(name)\n self.set_local(msg, \"names\", names)", "def add_name(self, name: str) -> None:\n self._names.append(name)", "def addAl...
[ "0.7545186", "0.74242723", "0.7099524", "0.6930216", "0.680645", "0.67892146", "0.6694985", "0.6671088", "0.6663316", "0.64836437", "0.63005227", "0.6261965", "0.6252687", "0.6239113", "0.62194926", "0.62157387", "0.6181223", "0.614385", "0.6108032", "0.605013", "0.60497755",...
0.55037105
67
Clean the input buffer and get a question that's typed in. Check whether the question is valid and assign it a number.
def getQuestion(): tcflush(sys.stdin, TCIFLUSH) question = input(" You say:\n ") return validQuestion(question)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def q3(question):\r\n while True:\r\n try:\r\n q3 = int(input(\"3. What is Space Mountain's top speed? \"))\r\n except ValueError:\r\n print(\"Not an integer. Try again.\")\r\n else:\r\n return q3", "def query_number(question, default=1):\n if default i...
[ "0.61125576", "0.60552406", "0.60416114", "0.5948589", "0.58855236", "0.5854401", "0.5830539", "0.5826007", "0.5791179", "0.57606035", "0.5711347", "0.5687633", "0.5670047", "0.56182665", "0.56069666", "0.56068426", "0.5589072", "0.5507646", "0.5489154", "0.5453224", "0.53819...
0.68517786
0
Checks if the question is valid and either returns the idex of the answer or 1 if the question is invalid.
def validQuestion(question): with open("validQuestions.txt") as f: questions = f.readlines() questions = [x.strip() for x in questions] f.close() if question not in questions: return -1 else: return questions.index(question)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_answer(self):\n if not self.is_answered():\n return None\n\n if self.question_type == 6: # ArithmeticTask\n return self.option_id == self.sub_question_type % 3 + 1\n elif self.question_type == 8: # ImageTask\n return self.option_id == self.sub_...
[ "0.54407066", "0.54207426", "0.53760725", "0.5322238", "0.5310691", "0.5254964", "0.52356493", "0.51965064", "0.5154023", "0.51331747", "0.5088845", "0.50735825", "0.50370145", "0.501664", "0.5015551", "0.50013846", "0.5000354", "0.49814048", "0.4976692", "0.49745822", "0.496...
0.5770506
0
Takes the index of a valid question and answers it.
def answerQuestion(questionIndex): with open("validQuestionAnswers.txt") as f: answers = f.readlines() answers = [x.strip() for x in answers] f.close() say(answers[questionIndex])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_question(self, question: str, answers: List, correct_idx: int):\n\n print(f'Answering question \"{question}\"')\n\n if random.random() < self.accuracy:\n print('choosing the correct answer...')\n return answers[correct_idx]\n\n print('choosing the wrong answer....
[ "0.7261938", "0.66562337", "0.62853575", "0.6284653", "0.62221134", "0.621178", "0.61885947", "0.6133315", "0.61233443", "0.60936624", "0.609328", "0.60869336", "0.6070864", "0.6061757", "0.60096675", "0.5970721", "0.5932469", "0.5873908", "0.5851904", "0.5834502", "0.5830821...
0.7478638
0
Function to simulate the robot saying something.
def say(thing): print(' Robot says:\n ', thing, '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(self):\n if not self.raw:\n self.msg(\"Say what?\")\n return\n options = {\"is_pose\": True}\n speech = self.raw.lstrip(\" \")\n # calling the speech hook on the location\n speech = self.caller.location.at_say(speech)\n # Feedback for the obj...
[ "0.7130198", "0.69434243", "0.68653554", "0.6862429", "0.68530047", "0.68277746", "0.67506194", "0.6745897", "0.6740784", "0.6708938", "0.6704635", "0.6582257", "0.65500647", "0.6539492", "0.6502522", "0.6440188", "0.6378434", "0.6367629", "0.63538563", "0.6323134", "0.629302...
0.7752175
0
Helper function for creating the trigrams
def add_word_to_trigram(new_word): # Trigrams require 2 previous words # If we don't have those yet, then set them if len(prev_words) < 2: prev_words.append(new_word) return # If it exists, add the word to the list # If it doesn't exist, create it word_tuple = (prev_words[0], prev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_trigrams(texts,trigram_mod,bigram_mod):\n return [trigram_mod[bigram_mod[doc]] for doc in texts]", "def trigrams(sentence):\n return [word+'_'+sentence[i+1]+'_'+sentence[i+2] \n if word+'_'+sentence[i+1]+'_'+sentence[i+2] in word_ids else None \n for i, word in enumerate(...
[ "0.78931004", "0.74293214", "0.72607845", "0.71646607", "0.71187943", "0.70036316", "0.6999353", "0.69070417", "0.6794566", "0.6613024", "0.6599799", "0.6547115", "0.642052", "0.64193904", "0.6351694", "0.63362306", "0.6224206", "0.6223465", "0.6184638", "0.6131844", "0.60815...
0.0
-1
Separates 'line' by spaces, similar to the builtin 'split' function. However, it also treats punctuation as separate words.
def break_it_down(line): # Make a copy for us to play with words = str(line) # Strategy: Leverage the built-in split, by adding spaces # around punctuation # Supported punctuation: ; : , ? ! . " for p in (':', ';', ',', '?', '!', '.', '"'): words = words.replace(p, ' {p} '.format(p=p)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_words(line):\n return", "def split(line, skipspace=0):\n a = re.sub('\\s+',' ', line.strip()) ##normalize white's -> 1 space\n a = re.split('(\\s)', a) ##split/keep space\n for aa in a: ## for each PPH, convert it to SPH\n if aa==' ':\n ...
[ "0.7058087", "0.6917028", "0.6839836", "0.67597264", "0.66572416", "0.664746", "0.65869975", "0.6507391", "0.642199", "0.6243214", "0.6220661", "0.6123521", "0.6098219", "0.6062644", "0.6021635", "0.6019111", "0.59929484", "0.59677184", "0.5951733", "0.5949034", "0.59477687",...
0.7155448
0
Reads in a book and creates the trigrams
def read_in_book(): # Keep track of paragraphs new_lines = False with open(book_filename, 'r') as book: # Ignore the top of the file, it's all boilerplate # 'project gutenberg' stuff anyway line_it = iter(book) line = next(line_it) while line[:3] != "***": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(book, num):\n book_text = read_book_from_file(book)\n filtered_book = convert_book_to_list_of_words(book_text)\n trigram_dict = create_trigram_dict(filtered_book)\n return generate_text(trigram_dict, num)", "def make_trigrams(texts,trigram_mod,bigram_mod):\n return [trigram_mod[bigram_mod...
[ "0.68062276", "0.6260758", "0.6202152", "0.6153598", "0.5912411", "0.5798249", "0.5704431", "0.5645663", "0.5528312", "0.54867786", "0.5464841", "0.54393923", "0.5408576", "0.5360164", "0.5352898", "0.53275985", "0.53247416", "0.5324078", "0.5320836", "0.53150266", "0.5311325...
0.7397099
0