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
Return disk obj from disk attachment obj
def get_disk_obj_from_disk_attachment(disk_attachment): return get_disk_obj(disk_attachment.get_id(), 'id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disk_attachment(name, disk, attr='id', object_type='vm'):\n disk_list = get_disk_attachments(name, object_type=object_type)\n disk_id = None\n if attr == 'name' or attr == 'alias':\n for disk_obj in disk_list:\n disk_obj_alias = get_disk_obj(\n disk_obj.get_id(), a...
[ "0.74053216", "0.6793077", "0.6505615", "0.62658155", "0.6190773", "0.61779624", "0.59081876", "0.59013236", "0.5899676", "0.58538806", "0.58369386", "0.5775959", "0.576744", "0.57462335", "0.56462747", "0.56462747", "0.5566617", "0.55492383", "0.5525881", "0.55177563", "0.55...
0.8071707
0
Return disk obj list from disk attachments list
def get_disk_list_from_disk_attachments(disk_attachments): return [ get_disk_obj_from_disk_attachment(disk_attachment) for disk_attachment in disk_attachments ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disk_attachments(name, object_type='vm', get_href=False):\n api = get_api(object_type, \"%ss\" % object_type)\n obj = api.find(name)\n return DISK_ATTACHMENTS_API.getElemFromLink(obj, get_href=get_href)", "def getObjDisks(name, get_href=True, is_template=False):\n response = get_disk_attachme...
[ "0.6690214", "0.6335851", "0.6259155", "0.59162986", "0.58995736", "0.58648187", "0.58527523", "0.582788", "0.58202004", "0.5820131", "0.5785615", "0.57774895", "0.5740484", "0.5735309", "0.5713783", "0.56764907", "0.563066", "0.56279755", "0.5622251", "0.5558199", "0.5538795...
0.77885747
0
Get disk attachments objects or hrefs from a vm or template
def get_disk_attachments(name, object_type='vm', get_href=False): api = get_api(object_type, "%ss" % object_type) obj = api.find(name) return DISK_ATTACHMENTS_API.getElemFromLink(obj, get_href=get_href)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getObjDisks(name, get_href=True, is_template=False):\n response = get_disk_attachments(\n name, 'template' if is_template else 'vm', get_href\n )\n if get_href:\n return response\n return get_disk_list_from_disk_attachments(response)", "def get_disk_attachment(name, disk, attr='id',...
[ "0.69518954", "0.6364521", "0.62688756", "0.6195739", "0.6097033", "0.59367794", "0.57009", "0.5675643", "0.56053907", "0.55326456", "0.55198544", "0.55018055", "0.5492309", "0.54542166", "0.5448821", "0.54335314", "0.53960615", "0.537463", "0.5373918", "0.53636795", "0.53573...
0.78496575
0
Returns a disk attachment object
def get_disk_attachment(name, disk, attr='id', object_type='vm'): disk_list = get_disk_attachments(name, object_type=object_type) disk_id = None if attr == 'name' or attr == 'alias': for disk_obj in disk_list: disk_obj_alias = get_disk_obj( disk_obj.get_id(), attribute='i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disk_obj_from_disk_attachment(disk_attachment):\n return get_disk_obj(disk_attachment.get_id(), 'id')", "def prepare_disk_attachment_object(disk_id=None, **kwargs):\n disk = kwargs.pop(\"disk\", None)\n disk_obj = disk if disk else prepare_ds_object(\"Disk\", id=disk_id)\n return prepare_ds_o...
[ "0.779783", "0.72560024", "0.6928796", "0.6578346", "0.6403104", "0.63818413", "0.6339139", "0.63055414", "0.6187242", "0.6176985", "0.61555827", "0.61421245", "0.6115087", "0.6013763", "0.6011736", "0.6002136", "0.591897", "0.5893593", "0.58661467", "0.58532095", "0.5836235"...
0.75038487
1
Get all disks in the system except the OVF store disks
def get_non_ovf_disks(): return [ d.get_id() for d in get_all_disks() if ( d.get_alias() != ENUMS['ovf_disk_alias'] ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_disks():\n return DISKS_API.get(abs_link=False)", "def get_all_disk():\n\t\tdisks = []\n\t\tdisks_lines = linux.exe_shell(\"lsblk -o NAME,VENDOR|grep -P '^sd.*[A-Z]'\")\n\t\tfor line in disks_lines.splitlines():\n\t\t\tdisk_t = line.split()\n\t\t\tif len(disk_t) > 1 and \"LSI\" not in disk_t[1]:\n...
[ "0.73597276", "0.7200828", "0.69137365", "0.6862478", "0.6828824", "0.6764747", "0.6552665", "0.65480185", "0.65238166", "0.6423896", "0.63987154", "0.6374826", "0.63124114", "0.6271041", "0.62678945", "0.6261637", "0.62305725", "0.61843395", "0.6136389", "0.6070867", "0.6056...
0.7961894
0
Get the qcow_version info from disk name or id
def get_qcow_version_disk(disk_name, attribute='name'): return get_disk_obj(disk_name, attribute).get_qcow_version()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_disk_info(resource_group_name, disk_name):\n show_disk_command = 'az disk show -g {g} -n {name} --query [sku.name,location,osType,hyperVGeneration] -o json'.format(g=resource_group_name, name=disk_name)\n disk_info = loads(_call_az_command(show_disk_command))\n # Note that disk_info will always...
[ "0.59442717", "0.5840063", "0.57724935", "0.5763192", "0.56448805", "0.5523646", "0.54851925", "0.54775894", "0.54669577", "0.54666495", "0.5381811", "0.53117114", "0.52990836", "0.52868456", "0.5284956", "0.52782893", "0.5276385", "0.5264113", "0.52572054", "0.52468705", "0....
0.7662928
0
Return the disks contained in a snapshot
def get_snapshot_disks_by_snapshot_obj(snapshot): return DISKS_API.getElemFromLink(snapshot)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disks():\n\n if system() != \"Windows\":\n raise OSError(\"For use with Windows platforms.\")\n\n logicaldisks=run(\n [\"wmic\", \"logicaldisk\", \"get\", \"name\"],\n capture_output=True\n )\n\n return findall(\"[A-Z]:\", str(logicaldisks.stdout...
[ "0.6811599", "0.68013054", "0.672062", "0.657291", "0.65141135", "0.64920574", "0.6439014", "0.64347744", "0.64077145", "0.6335327", "0.63346064", "0.63235974", "0.631117", "0.62916005", "0.627171", "0.6241496", "0.6225746", "0.6225603", "0.62238884", "0.6167665", "0.61405224...
0.79499185
0
Returns all disksnapshots objects list in the given storage domain
def get_storage_domain_diskssnapshots_objects(storagedomain, get_href=False): from art.rhevm_api.tests_lib.low_level.storagedomains import ( get_storage_domain_obj ) storage_domain_object = get_storage_domain_obj(storagedomain) return DISK_SNAPSHOT_API.getElemFromLink( storage_domain_obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_storage_domains(cohesity_client):\n storage_domain_list = cohesity_client.view_boxes.get_view_boxes()\n for domain in storage_domain_list:\n exported_res_dict[\"Storage Domains\"].append(domain.name)\n return storage_domain_list", "def get_snapshots(FIELDS='all'):\n snapinfostr = fork_...
[ "0.6704098", "0.6653081", "0.6420554", "0.6378387", "0.62653655", "0.61300075", "0.6005906", "0.59770525", "0.5968691", "0.59580076", "0.5947921", "0.5879047", "0.5876216", "0.5772094", "0.57576305", "0.57467604", "0.57035834", "0.5662695", "0.5657524", "0.56540245", "0.56525...
0.7705549
0
Check if certain disk is attached to VM as Read Only
def get_read_only(vm_name, disk_id): return get_disk_attachment(vm_name, disk_id).get_read_only()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_mounted_system(self):\n res = self.su_cmd('touch /system/.dwarf_check')\n if res == '':\n res = self._do_adb_command('shell ls -la /system')\n if '.dwarf_check' in res:\n res = self.su_cmd('rm /system/.dwarf_check')\n if res == '':\n ...
[ "0.68377024", "0.6680292", "0.6422407", "0.6302423", "0.5968654", "0.59454435", "0.59246737", "0.5899567", "0.58853364", "0.5862699", "0.5862699", "0.58550006", "0.58550006", "0.5846145", "0.58454525", "0.5780733", "0.57160926", "0.56951934", "0.5689234", "0.5687709", "0.5667...
0.7584012
0
Wait for an event of successful/failed sparsify event starting from the last start sparsify event in the system.
def wait_for_sparsify_event(disk_id, success=True): import art.rhevm_api.tests_lib.low_level.events as ll_events disk_name = get_disk_obj(disk_alias=disk_id, attribute='id').get_name() start_sparsify_query = "\"Started to sparsify %s\"" % disk_name finished_sparsify_query = ( "%s sparsified succ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def waitUntilSuccess():", "def wait_for_event(self, event):\n\n\t\tif event == 5:\n\t\t\toutcome = self.wait_for_saccade_start()\n\t\telif event == 6:\n\t\t\toutcome = self.wait_for_saccade_end()\n\t\telif event == 7:\n\t\t\toutcome = self.wait_for_fixation_start()\n\t\telif event == 8:\n\t\t\toutcome = self.wai...
[ "0.61228937", "0.57435817", "0.5658563", "0.55395555", "0.55395555", "0.55395555", "0.55395555", "0.5474974", "0.54738116", "0.5424017", "0.5409089", "0.52819955", "0.52727515", "0.52532136", "0.52388525", "0.52307796", "0.5214139", "0.52131623", "0.5210483", "0.52062255", "0...
0.7065584
0
Invoke sparsify action on disk.
def sparsify_disk(disk_id, storage_domain_name, wait=True): if not do_disk_action( 'sparsify', disk_id=disk_id, target_domain=storage_domain_name, wait=wait ): return False return wait_for_sparsify_event(disk_id) if wait else True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparsify_model(path_to_model, sparsified_model_dump_path):\n sparsity_levels = [sl / 10 for sl in range(0, 10)]\n sparsity_levels += [0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0]\n\n norms = [\"L1\", \"L2\"]\n sparse_block_shapes = [(1, 1), (1, 4)]\n\n device = torch.device('cuda')...
[ "0.54346603", "0.51681167", "0.51676154", "0.47499394", "0.46290654", "0.45078585", "0.44578275", "0.44389233", "0.44310507", "0.44083863", "0.44033685", "0.43932283", "0.43796688", "0.43533888", "0.43257746", "0.43140608", "0.42917594", "0.427881", "0.426788", "0.4243454", "...
0.5380593
1
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def keras_precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.7490921", "0.72890615", "0.7158933", "0.7153277", "0.7066191", "0.698819", "0.696778", "0.69555235", "0.6834697", "0.6818974", "0.6810516", "0.68061554", "0.68061554", "0.68061554", "0.68061554", "0.68061554", "0.68061554", "0.6786765", "0.6758681", "0.6758681", "0.6758681...
0.691368
8
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def keras_recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.7605524", "0.74488467", "0.7404089", "0.7280915", "0.72097343", "0.7165874", "0.7157609", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.71317255", "0.71007556", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.7097...
0.6768482
54
returns count of true positives
def keras_true_postives(y_true, y_pred): return K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_true(seq, pred=lambda x: x):\n ret = 0\n for x in seq:\n if pred(x):\n ret += 1\n return ret", "def count(x):\n return sum(np.asarray(x).astype(bool))", "def get_nTruePositive(atrank, was_retrieved, gt_ranks):\n TP = (np.logical_and(was_retrieved, gt_ranks <= atrank))...
[ "0.7289422", "0.71675485", "0.69936395", "0.69574404", "0.6895888", "0.6877534", "0.6872219", "0.6864182", "0.68405914", "0.68072814", "0.675919", "0.6754181", "0.6744057", "0.6733884", "0.6703661", "0.6695663", "0.6688471", "0.66098624", "0.65757424", "0.6558943", "0.6523603...
0.0
-1
Refresh the routing table
def refresh(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh_table(self):\n self._column_selected()\n self._table_selected()\n self._column_selection_change()\n self.refresh_column_list()\n self.refresh_table_list()\n self.refresh_table()", "def refresh(self) -> None:\n pass", "def refresh(self) -> None:\n ...
[ "0.62884986", "0.62584835", "0.62584835", "0.62584835", "0.62575024", "0.62315863", "0.62027854", "0.6158251", "0.6158251", "0.61570215", "0.61530703", "0.6113206", "0.6086956", "0.6081516", "0.60719234", "0.6031992", "0.5962185", "0.5955436", "0.59503174", "0.59503174", "0.5...
0.638114
1
Attempt to add the given node to the routing table.
def addNode(self, node: dht.node.Node): bucket = self._findBucket(node) if bucket == None: raise Exception("Found no bucket for given id") if not node in bucket: # We do not have this node on our routing table yet; # attempt to add it. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(self, node):", "def _add_node(self, node: int) -> None:\r\n self.nodes.add(node)", "def add_node (self, node):\n self.network.add_node(node.id)\n self.network.node[node.id] = node", "def add(self, nodeLoc):\n self.table[self.getHashIndex(nodeLoc)] = True", "def add_node(sel...
[ "0.7356876", "0.71309835", "0.7125489", "0.7123913", "0.7108166", "0.7067707", "0.70652515", "0.7004943", "0.70035964", "0.6994578", "0.6977097", "0.69619924", "0.69286156", "0.69099814", "0.68835133", "0.688126", "0.6873235", "0.6852162", "0.68456715", "0.6845571", "0.684557...
0.7837554
0
Find the appropriate bucket for the given node
def _findBucket(self, node): for bucket in buckets: if bucket.inRange(node): return bucket #if bucket.low <= node and node <= bucket.high: # return bucket return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, node):\n j = self._hash_function(node)\n bucket = self._T[j]\n if bucket is None:\n raise KeyError(node)\n return bucket[node]", "def findBucket(conn, bucketName):\n for cand in conn.get_all_buckets():\n if cand.name == bucketName:\n ...
[ "0.69149685", "0.6786792", "0.6786792", "0.65305567", "0.64101285", "0.64010876", "0.6354371", "0.62193334", "0.6108624", "0.60978067", "0.59703565", "0.59660417", "0.59175164", "0.58907247", "0.57858413", "0.57837915", "0.5781839", "0.57607853", "0.57242984", "0.5691928", "0...
0.86419946
0
Find a node with the given ID in the routing table.
def findNode(self, target: hash.hash.Hash): for bucket in self.buckets: if bucket.inRange(nodeID): for node in bucket: if node.hash == target: return node return None return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_by_id(self, id):\r\n for n in self.nodes:\r\n if n.id==id:\r\n return n\r\n return None", "def get_node(self, id):\n\t\t# No node with given id\n\t\tif id not in self.nodes:\n\t\t\traise ValueError\n\n\t\treturn self.nodes[id]", "def node_by_id(self, identif...
[ "0.77740204", "0.7206807", "0.7191673", "0.71355134", "0.6939725", "0.6789084", "0.6789084", "0.67159384", "0.6714518", "0.66511506", "0.66078824", "0.6586867", "0.65801555", "0.65516347", "0.65383166", "0.6499607", "0.6481805", "0.6459096", "0.6454446", "0.64475805", "0.6392...
0.65580726
13
Find the K nodes in the routing table closest to the given target ID.
def findClosestNodes(self, target: hash.hash.Hash): # TODO: make more efficient # See: http://stackoverflow.com/questions/30654398/implementing-find-node-on-torrent-kademlia-routing-table nodes = [] for bucket in self.buckets: nodes = nodes + bucket.nodes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_neighbor(data_set, target):\n \n tree = KDT(data_set)\n k = tree.k\n p = KDTNode(target)\n \n def KDsearch(current, target, neighbor, distance):\n \"\"\"The actual nearest neighbor search algorithm.\n Inputs:\n current (KDTNode): the node to examine.\n ...
[ "0.65448064", "0.63752544", "0.6327887", "0.6252531", "0.62341696", "0.6202399", "0.6175748", "0.6170855", "0.61633563", "0.6134241", "0.6043866", "0.60149163", "0.6012577", "0.601178", "0.59670776", "0.596042", "0.5876144", "0.5814865", "0.5796329", "0.5743522", "0.57418907"...
0.7600108
0
Remove the given bucket from the routing table, split the bucket in two buckets each spanning halve the original bucket's ID space, redistribute the nodes to the appropriate buckets and add the buckets to the routing table.
def _splitBucket(self, bucket): idx = self.buckets.index(bucket) self.buckets.pop(idx) middle = int(bucket.low + (bucket.high - bucket.low)/2) bucketLow = Bucket(bucket.low, middle, bucket.refreshed) bucketHigh = Bucket(middle+1, bucket.high, refreshed.refreshed) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_group_bucket():\n pass", "def delete_bucket_replication(Bucket=None):\n pass", "def delete_bucket(Bucket=None):\n pass", "def remove(self, key: int) -> None:\n hashKey = key % 1000\n prev = node = self.bucket[hashKey]\n if not node: return\n if node.pair[0]...
[ "0.65343845", "0.62422407", "0.5784059", "0.55969435", "0.5557828", "0.5495421", "0.5392276", "0.5360948", "0.53419083", "0.5333039", "0.52992237", "0.529006", "0.528266", "0.52823454", "0.5254394", "0.5252794", "0.5247381", "0.5245212", "0.5236542", "0.5232374", "0.5227516",...
0.70319253
0
Creates a call status class based on the monitoring backend
def create_call_status(job, internal_storage): monitoring_backend = job.config['lithops']['monitoring'] Status = getattr(lithops.worker.status, '{}CallStatus' .format(monitoring_backend.capitalize())) return Status(job, internal_storage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def createStatus(self, *args, **kwargs):\n\n return await self._makeApiCall(self.funcinfo[\"createStatus\"], *args, **kwargs)", "def status_api(config: dict, **kwargs):\n cfg = Config.from_dict(config)\n return status(cfg=cfg, **kwargs)", "def __init__(self: \"Status\") -> None:\n rai...
[ "0.6328769", "0.61205095", "0.5998343", "0.59102756", "0.589642", "0.5886395", "0.5878291", "0.5816793", "0.5735519", "0.57342607", "0.5676877", "0.56198055", "0.5617202", "0.56133866", "0.55926067", "0.5591889", "0.5588031", "0.5572215", "0.55713326", "0.55615175", "0.555670...
0.7931719
0
Adds data to the call status
def add(self, key, value): self.status[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_status(self, data_status):\n self._data_status = data_status", "def _update(self, data):\n self.status = data['status']\n self.progress = data['progress']", "def on_status_update(self, data):\n # TODO: Update User/Client object with this info\n print ('Status Update:...
[ "0.6703632", "0.6460163", "0.64132553", "0.63857377", "0.6221046", "0.5999626", "0.59384936", "0.5932582", "0.5912309", "0.58537126", "0.5842071", "0.5836314", "0.5786333", "0.5786333", "0.5781686", "0.5773513", "0.57712543", "0.57564306", "0.57522506", "0.57460487", "0.57411...
0.6094674
5
Sends the init event
def send_init_event(self): self.status['type'] = '__init__' self._send()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize(self):\n self.send_init_command()", "def onInit(self):\n pass", "def on_start(self):\n self.init()", "def onInit(*args):", "def onInit(*args):", "def onInit(*args):", "def onInit(*args):", "def do_init(self):\n\n pass", "def init():\n pass", "def on_in...
[ "0.7990824", "0.752718", "0.7522999", "0.7409211", "0.7409211", "0.7409211", "0.7409211", "0.7294225", "0.7091037", "0.70493495", "0.7023764", "0.69746894", "0.6971314", "0.6968194", "0.6942409", "0.6934815", "0.69088274", "0.6777505", "0.67478627", "0.6718694", "0.6697049", ...
0.84639376
0
Sends the finish event
def send_finish_event(self): self.status['type'] = '__end__' self._send()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __finish(self):\n self.finished.emit()", "def notify_finish_event(self):\n self.notify(self._finish_event_type())", "def finish(self):\r\n self.start_finish()\r\n self.wait_finish()", "def finished(self):\n\t\telog(\"finished\")", "def finish():\n pass", "def finish...
[ "0.8138743", "0.8032189", "0.795691", "0.79205817", "0.79074085", "0.78841597", "0.78116596", "0.7794982", "0.7794982", "0.7794982", "0.7794982", "0.77801937", "0.77801937", "0.7775521", "0.7747547", "0.7747547", "0.76819074", "0.76054335", "0.7594948", "0.7494719", "0.747283...
0.85653186
0
Send the status event to the Object Storage
def _send(self): executor_id = self.status['executor_id'] job_id = self.status['job_id'] call_id = self.status['call_id'] act_id = self.status['activation_id'] if self.status['type'] == '__init__': init_key = create_init_key(executor_id, job_id, call_id, act_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def status(self, context):\n await self.send_message(context, await self.status_msg_packed(context))", "def stream_status_event(self, event):\r\n pass", "def send_status(self):\n self.data = {\n 'value': '',\n 'state': self.state,\n }\n event_manager.d...
[ "0.6683783", "0.65931225", "0.6503897", "0.6461758", "0.6425266", "0.64044696", "0.6364719", "0.62688065", "0.62618816", "0.62457633", "0.62457633", "0.62457633", "0.62457633", "0.62457633", "0.62457633", "0.62457633", "0.62374526", "0.62141013", "0.61624694", "0.61624694", "...
0.62138724
18
Creates a rabbitmq channel
def _create_channel(self): self.connection = pika.BlockingConnection(self.pikaparams) self.channel = self.connection.channel() try: yield self.channel finally: self.channel.close() self.connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_channel(self, *args, **kwargs):\n logger.debug('creating channel -> connection.channel(%r, %r)' % (args, kwargs))\n if self.enabled:\n channel = self.connection.channel(*args, **kwargs)\n self._channels.append(channel)\n return channel\n else:\n ...
[ "0.6965309", "0.6961965", "0.6816173", "0.677381", "0.6700797", "0.66709477", "0.6623135", "0.6535521", "0.6417157", "0.64106596", "0.6331395", "0.63303983", "0.629796", "0.6273608", "0.6238281", "0.6203227", "0.6195236", "0.6161008", "0.6128137", "0.6108893", "0.6088668", ...
0.68163145
2
Send the status event to RabbitMQ
def _send(self): dmpd_response_status = json.dumps(self.status) drs = sizeof_fmt(len(dmpd_response_status)) status_sent = False output_query_count = 0 queues = [] executor_keys = self.job.executor_id.split('-') for k in range(int(len(executor_keys)/2)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_status(self, status):\n log.debug(\"Received status: %d\", status.id)", "def update_status(self) -> None:\n try:\n (rc, mid) = self.mqttc.publish(\n self.config.status_topic, json.dumps(self.status), qos=0, retain=False\n )\n if rc == mqtt.MQTT...
[ "0.67014754", "0.6644843", "0.656761", "0.65212625", "0.6509642", "0.6360998", "0.6242415", "0.6156373", "0.6141874", "0.60254884", "0.6022589", "0.6010731", "0.59253484", "0.59211844", "0.59180665", "0.59022945", "0.58412826", "0.5822756", "0.57633454", "0.5761859", "0.57569...
0.6350432
6
5x5conv filter preserves fmap dimensions if stride=1 exactly halves fmap dimensions if stride=2 requires padding=2, dilation=1, kernel_size=5 becomes depthwise convolution when in_planes = out_planes = groups
def conv5x5(in_planes, out_planes, stride=1, groups=1): return nn.Conv2d(in_planes, out_planes, kernel_size=5, stride=stride, groups=groups, padding=2, dilation=1, bias=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv5x5(in_planes, out_planes, stride=1, groups=1, dilation=1):\n\n return nn.Conv2d(in_planes, out_planes, kernel_size=5, stride=stride,\n padding=2, groups=groups, bias=False, dilation=dilation)", "def conv5x5(in_planes, out_planes, stride=1):\n return nn.Conv2d(in_planes, out_pla...
[ "0.8039668", "0.7764517", "0.73641586", "0.6590056", "0.65151554", "0.6472721", "0.6244569", "0.6239202", "0.61814755", "0.6160284", "0.6126702", "0.61187077", "0.6105487", "0.6101732", "0.60931444", "0.6072241", "0.6063233", "0.60537577", "0.60482925", "0.6038803", "0.603043...
0.80006856
1
3x3conv filter preserves fmap dimensions if stride=1 exactly halves fmap dimensions if stride=2 requires padding=dilation=1, kernel_size=3 becomes depthwise convolution when in_planes = out_planes = groups
def conv3x3(in_planes, out_planes, stride=1, groups=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, groups=groups, padding=1, dilation=1, bias=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv3x3(in_planes, out_planes, stride=1, dilation=1, padding=1):\n return nn.Conv2d(in_planes,\n out_planes,\n kernel_size=3,\n stride=stride,\n padding=padding,\n dilation=dilation,\n bia...
[ "0.77772915", "0.7751898", "0.7708785", "0.7708785", "0.7708785", "0.7696468", "0.76708174", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "0.76697737", "...
0.7554087
29
1x1conv filter preserves fmap dimensions if stride=1 exactly halves fmap dimensions if stride=2 requires padding=0, dilation=arbitray, kernel_size=1
def conv1x1(in_planes, out_planes, stride=1, groups=1): return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, groups=groups, padding=0, dilation=1, bias=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv1d(inputs,\n filters,\n kernel_size,\n strides=1,\n padding='same',\n data_format='channels_last',\n dilation_rate=1,\n activation=None,\n use_bias=True,\n kernel_initializer=None,\n bias_initializer=tf.zero...
[ "0.7300866", "0.7138331", "0.71194696", "0.7032545", "0.69492996", "0.69445014", "0.6809509", "0.672445", "0.6707945", "0.6687769", "0.6620993", "0.6569498", "0.6568114", "0.655137", "0.65487254", "0.6481412", "0.64568436", "0.6451584", "0.639098", "0.639065", "0.6356954", ...
0.6952819
4
build a stack of blocks
def _make_stack(self, block, num_layers, inplanes, outplanes, kernel_size=3, SE=False, expansion=3, stride=1): norm_layer = self._norm_layer act_layer = self._act_layer downsample = None # if stride > 1 # or if block input planes != block output planes (only...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_stack(self, block, planes, blocks, stride=1, dilate=False):\n\n norm_layer = self._norm_layer\n downsample = None\n previous_dilation = self.dilation\n\n # use dilation instead of striding if true\n if dilate:\n self.dilation *= stride\n stride = 1...
[ "0.6453076", "0.6413551", "0.6280478", "0.6205604", "0.6200286", "0.61282814", "0.6105402", "0.6089504", "0.6055599", "0.59682417", "0.5961837", "0.5952528", "0.5947952", "0.59477377", "0.59387773", "0.5916841", "0.5901226", "0.5894852", "0.5885826", "0.5881532", "0.58651316"...
0.6464052
0
Abstractor generator to build mnasnet variants
def _mnasnet(arch, block, layers, expansions, kernel_sizes, SE, dropout=0, pretrained=False, progress=False, **kwargs): model = MnasNet(block, layers=layers, expansions=expansions, kernel_sizes=kernel_sizes, SE=SE, dropout=dropout, **kwargs) if pretrained: if arch in mod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_net(nz=100):\n\tif opts.celeba:\n\t\tgen = get_gen_celebA(nz=nz)\n\t\tdis = get_dis_celebA(nz=nz)\n\n\tif opts.mnist:\n\t\tgen = get_gen_mnist(nz=nz)\n\t\tdis = get_dis_mnist(nz=nz)\n\n\treturn gen, dis", "def build_net(nz=100):\n\tif opts.celeba:\n\t\tgen = get_wgen_celebA(nz=nz)\n\t\tdis = get_wdis_c...
[ "0.659483", "0.64153004", "0.62674147", "0.60343355", "0.599451", "0.5994099", "0.5979143", "0.597632", "0.5852224", "0.58314294", "0.5810607", "0.57891184", "0.57889193", "0.57866716", "0.57839763", "0.5780712", "0.57617676", "0.57607645", "0.5757919", "0.5713101", "0.570409...
0.52728844
77
mnasneta1 w.t. 3x3MBconv3 block only
def mnasneta1_3x3mbconv3(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mnasneta1_3x3mbconv3se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3],\n kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
[ "0.65041816", "0.6349424", "0.6302337", "0.6283698", "0.6271896", "0.6270381", "0.62482214", "0.6165075", "0.61650103", "0.6118518", "0.6074425", "0.60461146", "0.5950486", "0.5944868", "0.592626", "0.5922896", "0.5890219", "0.5874022", "0.5871335", "0.5861999", "0.5842724", ...
0.6551719
0
mnasneta1 w.t. 3x3MBconv3SE block only
def mnasneta1_3x3mbconv3se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inception_block_1a(X):\n\n X_3x3 = Conv2D(96, (1, 1), data_format='channels_first', name='inception_3a_3x3_conv1')(X)\n X_3x3 = BatchNormalization(axis=1, epsilon=0.00001, name='inception_3a_3x3_bn1')(X_3x3)\n X_3x3 = Activation('relu')(X_3x3)\n X_3x3 = ZeroPadding2D(padding=(1, 1), data_format='ch...
[ "0.6229205", "0.6224902", "0.6176674", "0.61410236", "0.61265373", "0.6025587", "0.6011592", "0.59494674", "0.5935188", "0.58263266", "0.581069", "0.57841295", "0.5780811", "0.5777833", "0.5774311", "0.5756034", "0.57487005", "0.5735444", "0.5735444", "0.57328737", "0.572618"...
0.645728
0
mnasneta1 w.t. 5x5MBconv3 block only
def mnasneta1_5x5mbconv3(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mnasneta1_5x5mbconv3se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3],\n kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
[ "0.6580992", "0.6524809", "0.64358896", "0.6420319", "0.639647", "0.6387695", "0.6360615", "0.63517386", "0.62656593", "0.61908257", "0.6137714", "0.61336964", "0.61318547", "0.6123348", "0.61172646", "0.60345227", "0.6031906", "0.6017946", "0.6014714", "0.6014486", "0.600384...
0.66056234
0
mnasneta1 w.t. 5x5MBconv3SE block only
def mnasneta1_5x5mbconv3se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[3, 3, 3, 3, 3, 3], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
[ "0.6417066", "0.63162094", "0.62862533", "0.6282772", "0.62645257", "0.62633777", "0.6236479", "0.6060194", "0.59885466", "0.5915113", "0.5875557", "0.5869749", "0.5859015", "0.58565146", "0.58363396", "0.5828402", "0.5815745", "0.5803984", "0.5789562", "0.57847863", "0.57744...
0.66267586
0
mnasneta1 w.t. 3x3MBconv6 block only
def mnasneta1_3x3mbconv6(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mnasneta1_3x3mbconv6se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6],\n kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
[ "0.6497341", "0.62858516", "0.6241714", "0.62130415", "0.62099636", "0.61729336", "0.6155735", "0.6155116", "0.61449134", "0.61261827", "0.60924345", "0.60896015", "0.60837203", "0.60367846", "0.60332847", "0.59898615", "0.59516066", "0.59444976", "0.58755845", "0.5873228", "...
0.6507609
0
mnasneta1 w.t. 3x3MBconv6SE block only
def mnasneta1_3x3mbconv6se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[3, 3, 3, 3, 3, 3], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
[ "0.62559426", "0.61565256", "0.61362463", "0.6130783", "0.6099492", "0.60563445", "0.60303664", "0.60301816", "0.59409606", "0.5915859", "0.58603007", "0.58568764", "0.5853717", "0.5841832", "0.5811412", "0.5799647", "0.5791486", "0.5767362", "0.57564116", "0.5756015", "0.573...
0.6361786
0
mnasneta1 w.t. 5x5MBconv6 block only
def mnasneta1_5x5mbconv6(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[False, False, False, False, False, False], dropout=0, pretrained=pretraine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mnasneta1_5x5mbconv6se(pretrained=False, progress=False, **kwargs):\n return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6],\n kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True],\n dropout=0, pretrained=pretr...
[ "0.6570107", "0.6452104", "0.6403361", "0.6281001", "0.6181994", "0.61439276", "0.6123263", "0.6106863", "0.6076191", "0.6075117", "0.60421383", "0.59789044", "0.5971289", "0.5951675", "0.59458995", "0.5943738", "0.5920389", "0.5881937", "0.5872571", "0.58522433", "0.5844439"...
0.6571941
0
mnasneta1 w.t. 5x5MBconv6SE block only
def mnasneta1_5x5mbconv6se(pretrained=False, progress=False, **kwargs): return _mnasnet('mnasneta1', MBConv, layers=[2, 3, 4, 2, 3, 1], expansions=[6, 6, 6, 6, 6, 6], kernel_sizes=[5, 5, 5, 5, 5, 5], SE=[True, True, True, True, True, True], dropout=0, pretrained=pretrained, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Unet4(shape, nb_filters=32, exp=1, kernel_size=3, initialization=\"glorot_uniform\", activation=\"relu\", sigma_noise=0, output_channels=1, drop=0.0, regularization=None):\n \n \n input_layer = Input(shape=shape)\n\n conv1 = ConvBlock(input_layer, nb_filters=nb_filters, kernel_size=kernel_size, ini...
[ "0.6385848", "0.6249216", "0.6237148", "0.61455214", "0.60191464", "0.5987267", "0.59708", "0.5924136", "0.5916637", "0.5866943", "0.58421737", "0.5832506", "0.57936084", "0.57807344", "0.5772715", "0.57676303", "0.5728045", "0.5723477", "0.57012206", "0.5695109", "0.56872606...
0.6513848
0
Create Dataset subclass on cityscapes dataset
def __init__(self, dataset_dir, mode='train', transforms=None): self.dataset = dataset_dir self.transforms = transforms require_file = ['trainImages.txt', 'trainLabels.txt', 'valImages.txt', 'valLabels.txt', 'testImages.txt', 'testLabels.txt'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, name_dataset, reduce=False):\n dataset = TUDataset(root='data/TUDataset', name=name_dataset)\n if reduce:\n new_dataset = []\n for i in tqdm(range(len(dataset))):\n aux_g...
[ "0.7318747", "0.7070812", "0.705741", "0.69346154", "0.6801784", "0.67992985", "0.6797068", "0.675288", "0.67364866", "0.6648119", "0.6614223", "0.6611031", "0.65885764", "0.65562135", "0.6517669", "0.65067214", "0.6500058", "0.64421076", "0.64387065", "0.6411031", "0.6365106...
0.0
-1
Each click is a draw procedure of progressbar
def click(self, current_idx, max_idx, total_length=40): if self.start_time is None: self.start_time = time.time() else: self.time = time.time()-self.start_time self.iter_per_sec = 1/self.time perc = current_idx * total_length // max_idx # print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(self, id):", "def progress(self, id):", "def start_progress_bar(self):\r\n self.progress[\"value\"] = self.progress_step", "def click(self, current_idx, max_idx, total_length=40):\n if self.start_time is None:\n self.start_time = time.time()\n else:\n s...
[ "0.6712944", "0.6712944", "0.6455383", "0.6349425", "0.6248907", "0.623432", "0.62110394", "0.6133025", "0.61327195", "0.6115931", "0.6104515", "0.60967094", "0.6051502", "0.6050927", "0.6048382", "0.60173786", "0.60168135", "0.60089123", "0.60078853", "0.5996723", "0.5992577...
0.634649
4
Train network in one epoch
def train_one_epoch(self): print('Training......') # set mode train self.network.train() # prepare data train_loss = 0 transform = transforms.Compose([Rescale(params.rescale_size), RandomCrop(params.image_size), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def train_network(self):\n if self.trainData:\n if self.verbose:\n print('Started training...')\n\n for epoch in range(135):\n pass\n # save the model\n else:\n if self.verbose:\n print('...
[ "0.82824796", "0.8055997", "0.8048307", "0.7817191", "0.7769677", "0.7769677", "0.7763317", "0.77395475", "0.77395475", "0.77395475", "0.77395475", "0.76849425", "0.76146334", "0.7610671", "0.76098144", "0.7594007", "0.75639296", "0.7560547", "0.75248325", "0.7521596", "0.749...
0.72923744
30
Train network in one epoch
def train_one_epoch_Image_display(self): print('Training......') # set mode train self.network.train() # prepare data train_loss = 0 transform = transforms.Compose([Rescale(params.rescale_size), RandomCrop(params.image_size)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def train_network(self):\n if self.trainData:\n if self.verbose:\n print('Started training...')\n\n for epoch in range(135):\n pass\n # save the model\n else:\n if self.verbose:\n print('...
[ "0.82824796", "0.8055997", "0.8048307", "0.7817191", "0.7769677", "0.7769677", "0.7763317", "0.77395475", "0.77395475", "0.77395475", "0.77395475", "0.76849425", "0.76146334", "0.7610671", "0.76098144", "0.7594007", "0.75639296", "0.7560547", "0.75248325", "0.7521596", "0.749...
0.0
-1
Train network in n epochs, n is defined in params.num_epoch
def Train(self): self.init_epoch = self.epoch if self.epoch >= self.params.num_epoch: WARNING('Num_epoch should be smaller than current epoch. Skip training......\n') else: for _ in range(self.epoch, self.params.num_epoch): self.epoch += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_epoch(self) -> None:\n ct = self.config.training\n total_games = self._get_total_games()\n print(f\"Total Games: {total_games}\")\n train_size = int(0.9 * total_games)\n dataset_wrapper = DatasetWrapper(self.config)\n self.agent.model.fit(\n dataset_wr...
[ "0.8037295", "0.7758647", "0.75962085", "0.75962085", "0.75962085", "0.75962085", "0.75714374", "0.7540141", "0.74431837", "0.7384807", "0.73812366", "0.73749375", "0.73365843", "0.7268623", "0.7260551", "0.72534686", "0.72494113", "0.7239514", "0.7197271", "0.7189299", "0.71...
0.75088245
8
Validate network in one epoch every m training epochs, m is defined in params.val_every
def val_one_epoch(self): # TODO: add IoU compute function print('Validating:') # set mode eval self.network.eval() # prepare data val_loss = 0 transform = transforms.Compose([Rescale(params.rescale_size), RandomCrop(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n for epoch in range(self.current_epoch, self.config.optim.epochs):\n self.current_epoch = epoch\n self.train_one_epoch()\n if epoch % self.config.optim.val_freq == 0:\n self.validate()\n if self.config.optim.auto_schedule:\n ...
[ "0.7012529", "0.6712566", "0.6634519", "0.66330165", "0.65505785", "0.65329415", "0.64883864", "0.6478595", "0.6439809", "0.64243096", "0.6405489", "0.6376898", "0.6370973", "0.6366237", "0.63403463", "0.63386166", "0.6328227", "0.6316734", "0.63133085", "0.6312873", "0.63044...
0.6059921
72
Test network on test set
def Test(self): print('Testing:') # set mode eval torch.cuda.empty_cache() self.network.eval() transform = transforms.Compose([Rescale(params.rescale_size), RandomCrop(params.image_size), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_networks(self):\n pass", "def test_get_network(self):\n pass", "def test_add_network(self):\n pass", "def test_network(self, weights, env, episodes, seed, network=None, timeout=None):\n return self.run(\n backend_test_network, weights, #model creation params\n ...
[ "0.7709253", "0.766705", "0.76468885", "0.72682196", "0.72389966", "0.7237901", "0.70490324", "0.7011708", "0.6988405", "0.6976039", "0.6922201", "0.6874676", "0.6809783", "0.67838174", "0.6749974", "0.67477125", "0.6737391", "0.6720299", "0.6698853", "0.66430515", "0.6619775...
0.61850464
50
Load checkpoint from given path
def load_checkpoint(self): if self.params.resume_from is not None and os.path.exists(self.params.resume_from): try: LOG('Loading Checkpoint at %s' % self.params.resume_from) ckpt = torch.load(self.params.resume_from) self.epoch = ckpt['epoch'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_checkpoint(self, path):\n print(f'# loading trainer state from {path}')\n checkpoint = torch.load(path)\n self.load(checkpoint)", "def load_checkpoint(self, checkpoint_path=None):\n if checkpoint_path is None:\n checkpoint_path = self.get_latest_path()\n\n ...
[ "0.8472037", "0.8207521", "0.8078739", "0.80417454", "0.8021047", "0.78864264", "0.78864264", "0.78626573", "0.77807134", "0.7747032", "0.7730386", "0.7687754", "0.76852953", "0.76597154", "0.7643286", "0.76346713", "0.75836706", "0.75511175", "0.7546135", "0.7546135", "0.752...
0.750894
21
Load ImageNet pretrained model into MobileNetv2 backbone, only happen when no checkpoint is loaded
def load_model(self): if self.ckpt_flag: LOG('Skip Loading Pre-trained Model......') else: if self.params.pre_trained_from is not None and os.path.exists(self.params.pre_trained_from): try: LOG('Loading Pre-trained Model at %s' % self.params.pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model():\r\n model = MobileNetV2(weights=\"imagenet\")\r\n print(\"Model loaded\")\r\n return model", "def load_model(self):\n self.pred_net.load((self.save_path / \"iqn_pred_net\").absolute().as_posix())\n self.target_net.load((self.save_path / \"iqn_target_net\").absolute().as_posix())"...
[ "0.8060752", "0.7502474", "0.70105195", "0.70047826", "0.69656646", "0.69574654", "0.6884236", "0.6866858", "0.68493474", "0.6838054", "0.68307084", "0.6810942", "0.6784349", "0.6778722", "0.6778722", "0.6765091", "0.6763571", "0.67604506", "0.67532", "0.6735666", "0.67249376...
0.7511762
1
Initializes the model parameters
def initialize(self): for m in self.modules(): if isinstance(m, nn.Conv2d) or isinstance(m, nn.Linear): nn.init.xavier_normal_(m.weight) if m.bias is not None: nn.init.constant_(m.bias, 0) elif isinstance(m, nn.BatchNorm2d): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find_params()", "def _initialize_model_params(self):\n\n if 'model' not in self._raw_data_dict:\n raise Error('The \"model\" key is not found in the configuration file. Looks like the parse...
[ "0.80695194", "0.76851785", "0.76821965", "0.7545501", "0.7528178", "0.7339219", "0.7300383", "0.7282966", "0.7273018", "0.71888137", "0.71834874", "0.71642864", "0.7144462", "0.7081531", "0.70701426", "0.6986343", "0.6899933", "0.6889639", "0.68878675", "0.68588096", "0.6831...
0.0
-1
Adjust learning rate at each epoch
def adjust_lr(self): learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power for param_group in self.opt.param_groups: param_group['lr'] = learning_rate print('Change learning rate into %f' % (learning_rate)) self.summary_wri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(self, epoch):\n lr = self.lr * (0.5 ** (epoch // 2))\n for param_group in self.optimizer.param_groups:\n param_group['lr'] = lr", "def adjust_learning_rate(optimizer, epoch):\n lr = opt.lr * (0.5 ** (epoch // opt.step))\n return lr", "def adjust_learning...
[ "0.82811373", "0.82739276", "0.8209765", "0.81924576", "0.8177442", "0.81709737", "0.8161613", "0.8161521", "0.8161521", "0.8161521", "0.81576496", "0.8155148", "0.8144319", "0.81242913", "0.81204253", "0.8119406", "0.81193167", "0.81014806", "0.81010354", "0.8084342", "0.808...
0.78228253
74
Plot train/val loss curve
def plot_curve(self): x1 = np.arange(self.init_epoch, self.params.num_epoch+1, dtype=np.int).tolist() x2 = np.linspace(self.init_epoch, self.epoch, num=(self.epoch-self.init_epoch)//self.params.val_every+1, dtype=np.int64) plt.plot(x1, self.train_loss, label='train_loss'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss():\n df = pd.read_csv('data/loss.csv', encoding='utf-8')\n loss = df['loss'].values\n val_loss = df['val_loss'].values\n x = [i for i in range(1, len(loss) + 1)]\n\n plt.plot(x, loss, label='Train loss')\n plt.plot(x, val_loss, label='Val loss')\n\n plt.xlabel('Epochs')\n plt....
[ "0.8248865", "0.80044657", "0.7913672", "0.7894027", "0.7888984", "0.7629496", "0.76258636", "0.7564437", "0.75305593", "0.7529871", "0.7517523", "0.75074285", "0.7466194", "0.74021125", "0.73700374", "0.7361953", "0.7360696", "0.7335114", "0.7294053", "0.727845", "0.72673714...
0.8301858
0
Calculate the mean of a array of numbers
def mean(x): return sum(x) / len(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean(arr) -> float:\n return sum(arr) / len(arr)", "def mean(array: list) -> float:\n\n arr_sum = 0\n\n for element in array:\n arr_sum = arr_sum + element\n\n return arr_sum/len(array)", "def numpy_mean(arr):\n return arr.mean()", "def har_mean(array):\n return ((sum([1/x for x ...
[ "0.87606966", "0.85268366", "0.85233974", "0.8274031", "0.82146907", "0.80741704", "0.79949546", "0.79847866", "0.79569256", "0.793238", "0.791512", "0.7903941", "0.789539", "0.7891862", "0.7879156", "0.78524417", "0.78519106", "0.782101", "0.7765533", "0.772178", "0.769152",...
0.7925486
10
Calculate standard deviation of an array
def sd(x): x_mean = mean(x) return ( sum((x_i - x_mean) ** 2 for x_i in x) / (len(x) - 1) ) ** 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def std_deviation(array):\n if not array or len(array) == 1:\n return 0\n\n average = AGGREGATES['mean_arithmetic'](array)\n variance = map(lambda x: (x-average)**2,array)\n stdev = AGGREGATES['mean_arithmetic'](variance)\n return math.sqrt(stdev)", "def stdDev(data):\r\n sum = 0\r\n ...
[ "0.8669356", "0.81316155", "0.8062711", "0.8052935", "0.7987648", "0.7987648", "0.7927426", "0.79054976", "0.79046595", "0.78608817", "0.78518933", "0.7846879", "0.78435576", "0.78228223", "0.781802", "0.78024614", "0.7781382", "0.7781382", "0.77810156", "0.771873", "0.765266...
0.72569
43
The Toeplitz matrix has constant diagonals.
def toeplitz(x): t = [] for i in range(len(x)): row = [] for j in range(len(x)): if i < j: row.append(x[j-i]) elif i == j: row.append(x[0]) else: row.append(x[i-j]) t.append(row) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal(self) -> Float[Array, \" N\"]:\n return self.value * jnp.ones(self.size)", "def isToeplitz(mat):\n for j in range(row):\n if not checkDiag(mat, 0, j):\n return False\n for i in range(1, col):\n if not checkDiag(mat, i, 0):\n return False\n return T...
[ "0.62676716", "0.6266232", "0.613042", "0.6112422", "0.61040246", "0.6100329", "0.6073321", "0.60201347", "0.5982387", "0.5972561", "0.59333605", "0.5925948", "0.5909227", "0.58895856", "0.5888152", "0.5822885", "0.5821087", "0.5819602", "0.58082443", "0.57974136", "0.5779733...
0.54448724
71
Calculate the joint variability of two variables i.e. covariance
def covariance(x, y): x_mean = mean(x) y_mean = mean(y) diff_x_mean = (x_i - x_mean for x_i in x) diff_y_mean = (y_i - y_mean for y_i in y) sum_xy_diff = sum(a * b for a, b in zip(diff_x_mean, diff_y_mean)) return sum_xy_diff / (len(x) - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance(self,pt0,pt1):\n #raise Exception()\n cov = self.nugget\n for vario in self.variograms:\n cov += vario.covariance(pt0,pt1)\n return cov", "def _compute_covariance(self, lc1, lc2):\n return np.cov(lc1.counts, lc2.counts)[0][1]", "def covariance(x, y):...
[ "0.68456185", "0.6779219", "0.66804487", "0.6630194", "0.66221744", "0.6596901", "0.65743625", "0.65582716", "0.65548736", "0.6517841", "0.6517084", "0.6497815", "0.6491016", "0.6422042", "0.6419357", "0.6400981", "0.634437", "0.6315123", "0.6296129", "0.62880516", "0.624717"...
0.6074326
27
Calculate Correlation Coefficient between two variables
def correlation(x, y): return covariance(x, y) / (sd(x) * sd(y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_correlation(var1,var2):\n v1 = np.array(var1)\n v2 = np.array(var2)\n mat = np.c_[(v1,v2)]# np.vstack((v1,v2)) #\n corr = np.corrcoef(mat.T)\n return corr[0][1]", "def cc_coefficient(x, y):\n cor = np.sum( (x-np.mean(x)) * (y-np.mean(y)) )\n norm = sqrt( np.sum((x-np.mean(x))*...
[ "0.7461769", "0.73848504", "0.7332929", "0.7231304", "0.71898985", "0.7142193", "0.713656", "0.7073794", "0.7073794", "0.7036407", "0.69969076", "0.69699264", "0.6955766", "0.694734", "0.69415706", "0.69234127", "0.68381864", "0.6812766", "0.68118644", "0.67918605", "0.678676...
0.7383107
2
Generate nth lag of the time series data
def lag(data, num=None): if isinstance(num, int): return data[num:] if num >= 0 else data[:num] else: raise ValueError('Pass value of lag number as integer')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_idx_lag(idx_start, ar_iteration, forecast_cycle, input_k):\n return idx_start + (forecast_cycle * ar_iteration) + input_k", "def time_to_n_previous(df, cols, dummy_col, generated_feature_name, params={'n':1,'fillna':np.nan}):\n n = int(params['n'])\n if n > 0:\n n = -n\n params['n'] = ...
[ "0.6778768", "0.66660744", "0.65963405", "0.6136632", "0.60988307", "0.6074531", "0.6021351", "0.59936017", "0.5961061", "0.5947427", "0.5897162", "0.58862215", "0.58510196", "0.5801945", "0.57820016", "0.5744532", "0.5713435", "0.5681517", "0.5538467", "0.54915", "0.5410246"...
0.6294916
3
Compute Auto Correlation on the data
def auto_covariance(data, lags=None): lags = lags if lags else len(data) - 1 cov_values = [] for cur_lag in range(lags): cov_values.append(covariance(lag(data, cur_lag), lag(data, -1 * cur_lag))) return cov_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_correlation(data):\n pass", "def auto_correlation(arr):\n return cross_correlation(arr, arr)", "def autocorrelation(df,maxt,step,vari,acquisiton_time,division_time):\n maxt = int(maxt/acquisiton_time)\n step = int(step/acquisiton_time)\n df = connect_cells(df,vari)\n return np.v...
[ "0.77627933", "0.76994526", "0.74304914", "0.7421058", "0.7421058", "0.7407018", "0.7145963", "0.7098841", "0.70748496", "0.70619804", "0.70239776", "0.698502", "0.69356364", "0.6874571", "0.6849858", "0.6828862", "0.6816599", "0.681261", "0.6808504", "0.676099", "0.6759347",...
0.0
-1
Callback for the authentication scheme, which will provide username
def _cred_callback(self, cred, user_data): for credential in cred: if credential[0] == libvirt.VIR_CRED_AUTHNAME: credential[4] = self._key elif credential[0] == libvirt.VIR_CRED_PASSPHRASE: credential[4] = self._secret return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_login(self, username):", "def on_login(self, username):", "def user():\n\treturn request.authorization.username if zk.get_http_login() else zk.get_username()", "def auth_username(self, auth_username):\n\n self._auth_username = auth_username", "def username(self) -> str:", "def username(self...
[ "0.73498386", "0.73498386", "0.723469", "0.7176616", "0.7074089", "0.7074089", "0.70671904", "0.7026488", "0.6986468", "0.6936504", "0.6849732", "0.68100667", "0.6807583", "0.6806926", "0.6768851", "0.67406124", "0.6706946", "0.66755676", "0.66549337", "0.65592164", "0.654641...
0.0
-1
Start a stopped node.
def ex_start_node(self, node): # NOTE: This method is here for backward compatibility reasons after # this method was promoted to be part of the standard compute API in # Libcloud v2.7.0 return self.start_node(node=node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_node(self, **kwargs):\n # project_name, node_name\n\n try:\n if kwargs['project_name'] in self.data:\n project_name = kwargs['project_name']\n project_id = self.data[project_name]['project_id']\n if kwargs['node_name'] in self.data[pro...
[ "0.6175125", "0.58125246", "0.5782543", "0.5709254", "0.5606345", "0.5585785", "0.5553387", "0.54930484", "0.5489367", "0.5465326", "0.5459416", "0.54412687", "0.5434321", "0.5397947", "0.53963757", "0.5390883", "0.5380287", "0.5379175", "0.53741014", "0.5371947", "0.5304699"...
0.6000319
1
Shutdown a running node.
def ex_shutdown_node(self, node): # NOTE: This method is here for backward compatibility reasons after # this method was promoted to be part of the standard compute API in # Libcloud v2.7.0 return self.stop_node(node=node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self, *args):\n return _SALOMERuntime.PythonNode_shutdown(self, *args)", "def shutdown(self, *args):\n return _SALOMERuntime.SalomeNode_shutdown(self, *args)", "def shutdown(self, *args):\n return _SALOMERuntime.PyFuncNode_shutdown(self, *args)", "def shutdown_cluster(self):...
[ "0.7727168", "0.7475943", "0.6891909", "0.6848749", "0.66376257", "0.65689564", "0.6558753", "0.65107524", "0.6493353", "0.6489545", "0.6476291", "0.6473011", "0.64638007", "0.63882613", "0.63882613", "0.6359667", "0.63425624", "0.6339701", "0.6338911", "0.6336146", "0.630652...
0.7461503
2
Suspend a running node.
def ex_suspend_node(self, node): domain = self._get_domain_for_node(node=node) return domain.suspend() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspendVirtualMachine(self,node,vmid):\n post_data = None\n data = self.connect('post',\"nodes/%s/qemu/%s/status/suspend\" % (node,vmid), post_data)\n return data", "def suspend(self):\n\t\treturn Job(SDK.PrlVm_Suspend(self.handle)[0])", "def suspend(host=None,time=10):\r\n if host:...
[ "0.6543371", "0.6413404", "0.63032746", "0.61525834", "0.6133355", "0.60711706", "0.6034479", "0.5965572", "0.5920459", "0.58596003", "0.58546805", "0.56954277", "0.5682778", "0.5622784", "0.56010187", "0.55234486", "0.5516325", "0.5430145", "0.54232126", "0.5413509", "0.5355...
0.6554416
0
Resume a suspended node.
def ex_resume_node(self, node): domain = self._get_domain_for_node(node=node) return domain.resume() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resumeVirtualMachine(self,node,vmid):\n post_data = None\n data = self.connect('post',\"nodes/%s/qemu/%s/status/resume\" % (node,vmid), post_data)\n return data", "def resume(self , curThread ):\n self._suspended.resume(curThread)", "def resume(self):\n\n self.shm_command...
[ "0.72103184", "0.71227336", "0.70465106", "0.7040253", "0.69475436", "0.68769264", "0.67811257", "0.67507756", "0.67507756", "0.67507756", "0.67441076", "0.6708512", "0.67020583", "0.6683198", "0.6675391", "0.6651222", "0.6561431", "0.6520871", "0.6501453", "0.6501453", "0.64...
0.6668796
15
Retrieve Node object for a domain with a provided uuid.
def ex_get_node_by_uuid(self, uuid): domain = self._get_domain_for_uuid(uuid=uuid) node = self._to_node(domain=domain) return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node(uuid, **fields):\n try:\n with session_for_read() as session:\n res = session.query(model.Node).filter_by(\n uuid=uuid, **fields).one()\n return model.Node(uuid=res.uuid, version_id=res.version_id,\n state=res.state, started_a...
[ "0.73299086", "0.70159495", "0.70025486", "0.6854524", "0.6605886", "0.5908822", "0.58769524", "0.58602464", "0.5852138", "0.57863677", "0.5778645", "0.5746345", "0.573596", "0.57004017", "0.56440103", "0.56256723", "0.5552938", "0.5542634", "0.5524711", "0.5483632", "0.54819...
0.85098386
0
Retrieve Node object for a domain with a provided name.
def ex_get_node_by_name(self, name): domain = self._get_domain_for_name(name=name) node = self._to_node(domain=domain) return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_domain_for_name(self, name):\n domain = self.connection.lookupByName(name)\n return domain", "def get_node(self, name):\n\n assert name in self.nodes\n return self.nodes[name]", "def get_node_by_name(self, name):\n\n for node in self.nodes:\n if node.name ...
[ "0.7113652", "0.6740635", "0.6728727", "0.6652932", "0.6599187", "0.65716195", "0.6494387", "0.6490278", "0.6489191", "0.6455513", "0.6446057", "0.64404565", "0.64146894", "0.6349402", "0.6293593", "0.62350583", "0.62033457", "0.61973226", "0.6163783", "0.6153157", "0.6134103...
0.841673
0
Take a screenshot of a monitoring of a running instance.
def ex_take_node_screenshot(self, node, directory, screen=0): if not os.path.exists(directory) or not os.path.isdir(directory): raise ValueError("Invalid value for directory argument") domain = self._get_domain_for_node(node=node) stream = self.connection.newStream() mime_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def screenshot(filename):\n call([\"screencapture\", \"Screenshot for\" + strftime(\"%Y-%m-%d %H:%M:%S\", gmtime()) + filename +\".jpg\"])", "def screenshot(self):\n self.context.draw.window.screenshot(self.filename)", "def screen_shot(self):\n screen_size = '{}x{}@{}x{}/0'.format(self.screen[...
[ "0.6728345", "0.64198095", "0.6378234", "0.63380975", "0.6227363", "0.622478", "0.61470014", "0.61042076", "0.6074524", "0.6072982", "0.6070944", "0.6062109", "0.605779", "0.6057014", "0.59980696", "0.59894395", "0.5984302", "0.59826916", "0.59790766", "0.5963612", "0.5958021...
0.0
-1
Return a system hostname on which the hypervisor is running.
def ex_get_hypervisor_hostname(self): hostname = self.connection.getHostname() return hostname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname():\n return socket.gethostname()", "def get_hostname():\n\thostname = socket.gethostname()\n\n\treturn hostname", "def hostname(self) -> str:\n _args: list[Arg] = []\n _ctx = self._select(\"hostname\", _args)\n return _ctx.execute_sync(str)", "def get_hostname():\n hos...
[ "0.8208617", "0.8037137", "0.8012449", "0.79964304", "0.7980484", "0.79791266", "0.79482585", "0.7933461", "0.7856743", "0.7811493", "0.77951044", "0.77097285", "0.76754904", "0.7673008", "0.7661361", "0.7646124", "0.7639138", "0.76167923", "0.7588144", "0.75737196", "0.75471...
0.87602705
0
Retrieve hypervisor system information.
def ex_get_hypervisor_sysinfo(self): xml = self.connection.getSysinfo() etree = ET.XML(xml) attributes = ["bios", "system", "processor", "memory_device"] sysinfo = {} for attribute in attributes: element = etree.find(attribute) entries = self._get_entrie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hypervisor_info(self):\n try:\n req = Request(self.compute_url +\n \"/os-hypervisors/detail\" )\n self._upgrade_to_authenticated_request(req)\n resp = urlopen(req)\n content = resp.read().decode('utf-8')\n encoded = json...
[ "0.7540559", "0.72924674", "0.7231328", "0.72079253", "0.7133061", "0.6733231", "0.6650252", "0.6599447", "0.6597166", "0.6572756", "0.6566554", "0.65332323", "0.6496247", "0.6453271", "0.640171", "0.6376914", "0.6345654", "0.6250193", "0.6224385", "0.62230563", "0.61986095",...
0.799808
0
Retrieve IP addresses for the provided domain.
def _get_ip_addresses_for_domain(self, domain): result = [] if platform.system() != "Linux": # Only Linux is supported atm return result if "///" not in self._uri: # Only local libvirtd is supported atm return result mac_addresses = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIPs(self, domain = \"localhost\"):\n # convert 'domain' to string, in case of erroneous type being passed\n domain = str(domain)\n\n # Kind warning for those who entered an IP address instead of a domain\n try: \n inet_aton(domain)\n print(\"Warning: an IP a...
[ "0.83984834", "0.77371424", "0.6798919", "0.6587187", "0.6285699", "0.61892295", "0.60301226", "0.6003413", "0.5995572", "0.598294", "0.5933315", "0.5922509", "0.59050184", "0.5893697", "0.5892688", "0.5844683", "0.584002", "0.58137757", "0.57702386", "0.57578325", "0.5728746...
0.79961646
1
Parses network interface MAC addresses from the provided domain.
def _get_mac_addresses_for_domain(self, domain): xml = domain.XMLDesc() etree = ET.XML(xml) elems = etree.findall("devices/interface[@type='network']/mac") result = [] for elem in elems: mac_address = elem.get("address") result.append(mac_address) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_mac_addr_table(self, cmd_output, mac_regex):\n lines = ensure_string(cmd_output).split(\"\\n\")\n\n arp_table = defaultdict(list)\n for line in lines:\n match = mac_regex.match(line)\n\n if not match:\n continue\n\n groups = match.grou...
[ "0.5997182", "0.5887761", "0.55770844", "0.54802185", "0.5151093", "0.5078019", "0.5072644", "0.5054249", "0.5025796", "0.5004441", "0.4980744", "0.4979718", "0.4964348", "0.49386275", "0.4900247", "0.48874563", "0.48327222", "0.4825868", "0.4825868", "0.4825868", "0.4825868"...
0.76599824
0
Return libvirt domain object for the provided node.
def _get_domain_for_node(self, node): domain = self.connection.lookupByUUIDString(node.uuid) return domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_domain(self, name=None, domain_id=None):\n try:\n if name != None:\n domain = self.conn.lookupByName(name)\n elif domain_id != None:\n domain = self.conn.lookupByNamtoprettyxmle(domain_id)\n \n self.logger.debug('Get libv...
[ "0.6646178", "0.6326023", "0.60190666", "0.5995111", "0.591567", "0.5859711", "0.58435315", "0.57714146", "0.5689236", "0.5660096", "0.564347", "0.5614556", "0.5580412", "0.5555476", "0.55462366", "0.54826355", "0.5459767", "0.5392127", "0.5384954", "0.535872", "0.53121495", ...
0.80289376
0
Return libvirt domain object for the provided uuid.
def _get_domain_for_uuid(self, uuid): domain = self.connection.lookupByUUIDString(uuid) return domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ex_get_node_by_uuid(self, uuid):\n domain = self._get_domain_for_uuid(uuid=uuid)\n node = self._to_node(domain=domain)\n return node", "def _get_domain(self, name=None, domain_id=None):\n try:\n if name != None:\n domain = self.conn.lookupByName(name)\n ...
[ "0.65978694", "0.6287508", "0.62544394", "0.61970353", "0.60169226", "0.57897735", "0.57860833", "0.57860833", "0.5771408", "0.5730028", "0.5638017", "0.5603881", "0.55803794", "0.55803794", "0.55660874", "0.55613136", "0.55560535", "0.5535921", "0.54868644", "0.5468099", "0....
0.8054554
0
Return libvirt domain object for the provided name.
def _get_domain_for_name(self, name): domain = self.connection.lookupByName(name) return domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_domain(self, name=None, domain_id=None):\n try:\n if name != None:\n domain = self.conn.lookupByName(name)\n elif domain_id != None:\n domain = self.conn.lookupByNamtoprettyxmle(domain_id)\n \n self.logger.debug('Get libv...
[ "0.7728729", "0.6781407", "0.6676108", "0.66732156", "0.64450073", "0.6421315", "0.6407042", "0.6315708", "0.62968487", "0.62832683", "0.62424284", "0.6150704", "0.60960394", "0.6010242", "0.5997326", "0.5948612", "0.58892924", "0.5876968", "0.5854081", "0.5805325", "0.576580...
0.7796097
0
Sets up the regexp for parsing out IP addresses from the 'arp an' command and pass it along to the parser function.
def _parse_ip_table_arp(self, arp_output): arp_regex = re.compile(r".*?\((.*?)\) at (.*?)\s+") return self._parse_mac_addr_table(arp_output, arp_regex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback(self, pkt):\n if ARP in pkt:\n self.parse_ip(pkt.sprintf(\"%ARP.psrc%\"))\n if TCP in pkt or UDP in pkt:\n self.parse_ip(pkt.sprintf(\"%IP.src%\"))\n self.parse_ip(pkt.sprintf(\"%IP.dst%\"))", "def arp_parse(data):\n\t# Iteratize pkt\n\tpkt = packet.Pac...
[ "0.6047332", "0.5977841", "0.58359456", "0.55522436", "0.549954", "0.54692423", "0.5399935", "0.53717846", "0.5354695", "0.5282927", "0.52803683", "0.5258503", "0.5195545", "0.51795524", "0.51735955", "0.5168112", "0.5160153", "0.5160032", "0.5127986", "0.5110216", "0.5108020...
0.67209846
0
Sets up the regexp for parsing out IP addresses from the 'ip neighbor' command and pass it along to the parser function.
def _parse_ip_table_neigh(self, ip_output): ip_regex = re.compile(r"(.*?)\s+.*lladdr\s+(.*?)\s+") return self._parse_mac_addr_table(ip_output, ip_regex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, parser, namespace, values, option_string=None):\n ip_split = values.split(\",\")\n [ip_address(ip) for ip in ip_split]\n setattr(namespace, self.dest, ip_split)", "def parse_ip(self, ip):\n if not ip in self.ip_list:\n try:\n ip_address = i...
[ "0.59346735", "0.5507849", "0.5420339", "0.540353", "0.53581053", "0.5341133", "0.53306186", "0.53253126", "0.52746946", "0.5222205", "0.5208916", "0.5197301", "0.5188588", "0.51674026", "0.51580864", "0.5143807", "0.5061729", "0.49728638", "0.49534848", "0.49212003", "0.4916...
0.55468833
1
Parse the command output and return a dictionary which maps mac address to an IP address.
def _parse_mac_addr_table(self, cmd_output, mac_regex): lines = ensure_string(cmd_output).split("\n") arp_table = defaultdict(list) for line in lines: match = mac_regex.match(line) if not match: continue groups = match.groups() i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac_address_table(self):\n\n mac_address_table = []\n command = '/interface bridge host print terse'\n\n output = self._send_command(command)\n\n for host in parse_terse_output(output):\n mac_address_table.append({\n 'mac': cast_mac(host.get('mac-addres...
[ "0.6518071", "0.6207442", "0.6205289", "0.6143003", "0.6007293", "0.59642804", "0.59295213", "0.5820728", "0.5768313", "0.5717903", "0.56790775", "0.5641952", "0.56189096", "0.56146896", "0.55993295", "0.5571131", "0.556581", "0.5563868", "0.55427015", "0.55418855", "0.552968...
0.69882375
0
Use BFS to find the shortest path use level ={} to keep track of distance of each node use parent = {} to back track and trace it out
def find_shortest_path(self, start, end): if start==None: return visited = {} distance = {start:0} parent = {start:None} queue = deque() queue.append(start) while queue: cn = queue.popleft() for n in self.adjacencylist[cn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs(self, queue, target, targetx,\n targety): # finds BFS path to the finish. if there is no path, will return nothing\n\n '''\n 1. So we have a parent matrix\n 2. This records the parent\n 3. We have a dictionary of cell: parents'''\n if self.map1[queue[0][0]][qu...
[ "0.69503415", "0.6943903", "0.6853803", "0.68397886", "0.6801403", "0.675973", "0.6747544", "0.6738333", "0.6723769", "0.6721417", "0.6716232", "0.67153084", "0.67074156", "0.6693994", "0.66901886", "0.6654073", "0.66488194", "0.66420025", "0.66287", "0.6627181", "0.6569387",...
0.6980737
0
Read the next expression from src, a Buffer of tokens. >>> lines = ['(+ 1', '(+ 23 4)) ('] >>> src = Buffer(tokenize_lines(lines)) >>> print(scheme_read(src)) (+ 1 (+ 23 4))
def scheme_read(src): if src.current() is None: raise EOFError if val == 'nil': return nil elif val not in DELIMITERS: # ( ) ' . return val elif val == '(': return read_tail(src) else: raise SyntaxError('unexpected token: {0}'.format(val))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(source_code):\n tokens = tokenize(source_code)\n return read(tokens)", "def read_from_tokens(tokens):\n if len(tokens) == 0:\n raise SyntaxError(\"unexpected EOF while reading\")\n token = tokens.pop(0)\n if \"(\" == token:\n res = []\n while tokens[0] != \")\":\n ...
[ "0.6343479", "0.6047994", "0.5913599", "0.5844269", "0.5784189", "0.5618982", "0.54318804", "0.5407249", "0.53160536", "0.525312", "0.52294385", "0.521524", "0.5187013", "0.51560414", "0.5153102", "0.51475793", "0.51185143", "0.5095528", "0.50852764", "0.5074779", "0.5058327"...
0.71613556
0
Return the remainder of a list in src, starting before an element or ). >>> read_tail(Buffer(tokenize_lines([')']))) nil >>> read_tail(Buffer(tokenize_lines(['2 3)']))) Pair(2, Pair(3, nil)) >>> read_tail(Buffer(tokenize_lines(['2 (3 4))']))) Pair(2, Pair(Pair(3, Pair(4, nil)), nil))
def read_tail(src): if src.current() is None: raise SyntaxError('unexpected end of file') if src.current() == ')': src.pop() return nil first = scheme_read(src) rest = read_tail(src) return Pair(first, rest)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(self, line, head, tail):\n data = None\n rest = line\n begin = line.find(head)\n if begin != -1:\n line = line[begin + len(head):]\n end = line.find(tail)\n if end != -1:\n data = line[:end]\n rest = line[end + len(...
[ "0.62023", "0.5961643", "0.5870388", "0.5625115", "0.559991", "0.55696696", "0.55203354", "0.5368489", "0.5332481", "0.5304666", "0.5293615", "0.5290877", "0.5275637", "0.5255011", "0.52535564", "0.51826555", "0.5160872", "0.5157932", "0.51445717", "0.5142943", "0.51237637", ...
0.7980613
0
Initializes the topic model
def __init__(self, min_topics, max_topics, step): super(TopicOptimizer, self).__init__() self.min_topics = min_topics self.max_topics = max_topics self.step = step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, topic):\n self.topic = topic", "def __init__(self):\n self.topics = {}", "def __init__( self, weights, topics ):\n\n # Number of topics and dictionary size\n self.W, self.K = topics.shape\n assert( self.W > self.K )\n\n self.topics = topics\n ...
[ "0.75878173", "0.7326735", "0.7317074", "0.7296003", "0.7248847", "0.7173298", "0.70417184", "0.67718774", "0.6764849", "0.6759086", "0.6741697", "0.66902506", "0.66195655", "0.65756196", "0.65608066", "0.65159005", "0.6511945", "0.64816284", "0.6464826", "0.64429224", "0.643...
0.60266024
28
Fit a variety of topic models for different numbers of topics. The numbers used will be determined by a range (min and max) and a step. Find topic coherence for each model.
def fit_lda_model(self): self.id2word = corpora.Dictionary(self.documents) self.id2word.filter_extremes(no_below=20, no_above=0.5) corpus = [self.id2word.doc2bow(text) for text in self.documents] coherence_c_v = [] coherence_u_mass = [] print("Fitting models") for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(self):\n scores = []\n n_topics = np.arange(self.topic_range[0], self.topic_range[1]+1)\n print('Running optimization with topic range from {0} to {1}'.format(\n self.topic_range[0],self.topic_range[1]))\n self._preproc()\n\n # Perform LDA for topic_range\n for n in n_topics:\n ...
[ "0.63703626", "0.62087965", "0.6204962", "0.61349803", "0.608499", "0.5989786", "0.5946524", "0.5907935", "0.5877469", "0.5873318", "0.5872744", "0.5869438", "0.5868765", "0.583939", "0.5822398", "0.58161837", "0.5772709", "0.57665807", "0.5752155", "0.57429004", "0.5717003",...
0.6008207
5
Query FS_IMMUTABLE_FL This queries the `FS_IMMUTABLE_FL` flag on a specified file. Arguments fd Filedescriptor to operate on. Returns bool Whether the `FS_IMMUTABLE_FL` flag is set or not. Raises OSError If the underlying ioctl fails, a matching `OSError` will be raised.
def ioctl_get_immutable(fd: int): if not isinstance(fd, int) or fd < 0: raise ValueError() flags = array.array('L', [0]) fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True) return bool(flags[0] & FS_IMMUTABLE_FL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ioctl_toggle_immutable(fd: int, set_to: bool):\n\n if not isinstance(fd, int) or fd < 0:\n raise ValueError()\n\n flags = array.array('L', [0])\n fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True)\n if set_to:\n flags[0] |= FS_IMMUTABLE_FL\n else:\n flags[0] &= ~FS_IMMUTABLE_FL\n...
[ "0.6428742", "0.47341985", "0.47216454", "0.46669763", "0.45207182", "0.4378003", "0.43503478", "0.43097138", "0.4301548", "0.42695826", "0.4249345", "0.42367932", "0.42250556", "0.42015633", "0.4192277", "0.41917893", "0.41803315", "0.4150465", "0.41474935", "0.41474935", "0...
0.77494645
0
Toggle FS_IMMUTABLE_FL This toggles the `FS_IMMUTABLE_FL` flag on a specified file. It can both set and clear the flag. Arguments fd Filedescriptor to operate on. set_to Whether to set the `FS_IMMUTABLE_FL` flag or not. Raises OSError If the underlying ioctl fails, a matching `OSError` will be raised.
def ioctl_toggle_immutable(fd: int, set_to: bool): if not isinstance(fd, int) or fd < 0: raise ValueError() flags = array.array('L', [0]) fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True) if set_to: flags[0] |= FS_IMMUTABLE_FL else: flags[0] &= ~FS_IMMUTABLE_FL fcntl.ioctl(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ioctl_get_immutable(fd: int):\n\n if not isinstance(fd, int) or fd < 0:\n raise ValueError()\n\n flags = array.array('L', [0])\n fcntl.ioctl(fd, FS_IOC_GETFLAGS, flags, True)\n return bool(flags[0] & FS_IMMUTABLE_FL)", "def setblocking(fd, flag):\n\n # get the file's current flag settin...
[ "0.6070557", "0.52018124", "0.5024385", "0.49306548", "0.4926993", "0.48649842", "0.48337775", "0.47418475", "0.46019533", "0.45977533", "0.4591028", "0.44767058", "0.44018012", "0.43646082", "0.43338102", "0.43089062", "0.4275479", "0.42734283", "0.42591506", "0.4255107", "0...
0.84549505
0
Flush the block device buffer cache
def ioctl_blockdev_flushbuf(fd: int): if not isinstance(fd, int) or fd < 0: raise ValueError(f"Invalid file descriptor: '{fd}'") fcntl.ioctl(fd, BLK_IOC_FLSBUF, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flush_buffer(self):\n pass", "def flush_cache(cls, ):\n cls.Lock.acquire()\n cls.UsbDevices.clear()\n cls.Lock.release()", "def flushBuffer():\n\tif settings.dry_run or settings.force_sync == True:\n\t\treturn\n\tif settings.debug:\n\t\tsettings._counters['flush'] += 1\n\t\n\ts...
[ "0.7081398", "0.6893348", "0.6864084", "0.6713913", "0.665602", "0.66431576", "0.65686864", "0.654049", "0.65044904", "0.63975775", "0.6374572", "0.63352764", "0.6334813", "0.6282437", "0.6246429", "0.6223837", "0.62095356", "0.619371", "0.6190789", "0.61903197", "0.6178602",...
0.65906996
6
Check if the format of the address is correct
def check_address(address): if isinstance(address, tuple): check_host(address[0]) check_port(address[1]) elif isinstance(address, string_types): if os.name != 'posix': raise ValueError('Platform does not support UNIX domain sockets') if not (os.path.exists(address) or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_address(address:str) -> bool:\r\n return True", "def check_address_format(address):\n if len(address) != 42 or address[:2] != '0x':\n return False\n\n for ch in address[2:]:\n if ch not in \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\":\n return ...
[ "0.82177687", "0.79817265", "0.7651787", "0.7630282", "0.7612801", "0.7433106", "0.7264066", "0.71584415", "0.71504545", "0.7072251", "0.7065381", "0.6987671", "0.6986897", "0.6980683", "0.68900055", "0.6835669", "0.6785993", "0.66338646", "0.66106343", "0.6594888", "0.657915...
0.63521343
38
Check if the format of the addresses is correct
def check_addresses(address_list, is_remote=False): assert all(isinstance(x, (tuple, string_types)) for x in address_list) if (is_remote and any(isinstance(x, string_types) for x in address_list)): raise AssertionError('UNIX domain sockets not allowed for remote' 'addresses'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_address(address:str) -> bool:\r\n return True", "def check_address_format(address):\n if len(address) != 42 or address[:2] != '0x':\n return False\n\n for ch in address[2:]:\n if ch not in \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\":\n return ...
[ "0.7787939", "0.75446767", "0.7526343", "0.74971163", "0.7478834", "0.7314134", "0.72621024", "0.7069135", "0.69369406", "0.6921365", "0.6828588", "0.672975", "0.67043686", "0.66648024", "0.6653773", "0.6570521", "0.6569215", "0.65385824", "0.653023", "0.65150857", "0.6477595...
0.59907985
68
Attach or create a new logger and add a console handler if not present
def create_logger(logger=None, loglevel=None, capture_warnings=True, add_paramiko_handler=True): logger = logger or logging.getLogger( 'sshtunnel.SSHTunnelForwarder' ) if not any(isinstance(x, logging.Handler) for x in logger.handlers): l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _instanciate_logger(self):\n\t\tself._logger = logging.getLogger('main')\n\t\tself._logger.setLevel(logging.DEBUG)\n\t\tself._logger.addHandler(logging.StreamHandler())", "def setup_logger() -> None:\n LOGGER.setLevel(logging.DEBUG)\n formatter = logging.Formatter('%(levelname)s \\t|%(asctime)s \\t| %(...
[ "0.7261235", "0.6893646", "0.68242097", "0.6810163", "0.67782706", "0.67508376", "0.67505354", "0.6727781", "0.67172164", "0.6708509", "0.6685061", "0.66731167", "0.6657821", "0.6657768", "0.6647187", "0.66101193", "0.657088", "0.6562323", "0.65511745", "0.6544634", "0.652947...
0.63571763
46
Add a handler to an existing logging.Logger object
def _add_handler(logger, handler=None, loglevel=None): handler.setLevel(loglevel or DEFAULT_LOGLEVEL) if handler.level <= logging.DEBUG: _fmt = '%(asctime)s| %(levelname)-4.3s|%(threadName)10.9s/' \ '%(lineno)04d@%(module)-10.9s| %(message)s' handler.setFormatter(logging.Formatter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file_handler_to_logger(logger):\n # This makes \n if AppState().log_file is None:\n return\n\n # Create file handler which logs even DEBUG messages.\n fh = logging.FileHandler(AppState().log_file)\n\n # Set logging level for this file.\n fh.setLevel(logging.DEBUG)\n\n # Create f...
[ "0.730158", "0.7083873", "0.70768595", "0.69950664", "0.67779076", "0.67307496", "0.6639868", "0.6612778", "0.6585183", "0.65658885", "0.6468931", "0.64650214", "0.6443481", "0.64255625", "0.63551295", "0.63521326", "0.634116", "0.63212717", "0.63015157", "0.62598276", "0.625...
0.74555445
0
Add a console handler for paramiko.transport's logger if not present
def _check_paramiko_handlers(logger=None): paramiko_logger = logging.getLogger('paramiko.transport') if not paramiko_logger.handlers: if logger: paramiko_logger.handlers = logger.handlers else: console_handler = logging.StreamHandler() console_handler.setForma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_cmd_logger():\n logger.setLevel(logging.DEBUG)\n ch = logging.StreamHandler()\n formatter = ColoredFormatter('%(log_color)s[%(levelname)8s] %(message)s%(reset)s')\n ch.setLevel(level=logging.DEBUG)\n ch.setFormatter(formatter)\n logger.addHandler(ch)", "def setup_logger_console(log_l...
[ "0.62692356", "0.61782694", "0.61622053", "0.60665613", "0.601746", "0.59057075", "0.58986324", "0.58926237", "0.5885338", "0.58700985", "0.58597547", "0.58551115", "0.58316165", "0.57992226", "0.5792013", "0.57112014", "0.56644404", "0.56620884", "0.56540704", "0.5643124", "...
0.72201777
0
Remove dictionary keys whose value is None
def _remove_none_values(dictionary): return list(map(dictionary.pop, [i for i in dictionary if dictionary[i] is None]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dict_.iteritems() \\\r\n if value is not None)\r\n return res", "def _drop_none_values(dictionary: Dict) -> Dict:\n return {key: value for key, value in dictionary.items() if value is not None...
[ "0.82933813", "0.8234842", "0.81453615", "0.7987498", "0.7972441", "0.79094595", "0.78908825", "0.7887798", "0.77657074", "0.7746054", "0.7739094", "0.76895493", "0.7611383", "0.75638944", "0.753068", "0.742391", "0.7329428", "0.7286233", "0.72591496", "0.72389627", "0.723101...
0.7719699
11
Check if a tunnel is up (remote target's host is reachable on TCP target's port)
def local_is_up(self, target): try: check_address(target) except ValueError: self.logger.warning('Target must be a tuple (IP, port), where IP ' 'is a string (i.e. "192.168.0.1") and port is ' 'an integer (i.e. 40000)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tunnel_up(self):\n return self._ssh_host != None and self._ssh_port != None", "def _check_tunnel(self, _srv):\n if self.skip_tunnel_checkup:\n self.tunnel_is_up[_srv.local_address] = True\n return\n self.logger.info('Checking tunnel to: {0}'.format(_srv.remote_addre...
[ "0.801123", "0.7985775", "0.70843214", "0.68882746", "0.6626013", "0.6624897", "0.65708685", "0.6550372", "0.65094507", "0.6393429", "0.63864475", "0.6384578", "0.63547724", "0.63359576", "0.633327", "0.63322264", "0.629426", "0.62896645", "0.627957", "0.62696373", "0.6269469...
0.7619186
2
Check that if all tunnels are established and populates
def check_tunnels(self): skip_tunnel_checkup = self.skip_tunnel_checkup try: # force tunnel check at this point self.skip_tunnel_checkup = False for _srv in self._server_list: self._check_tunnel(_srv) finally: self.skip_tunnel_check...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_tunnel(self, _srv):\n if self.skip_tunnel_checkup:\n self.tunnel_is_up[_srv.local_address] = True\n return\n self.logger.info('Checking tunnel to: {0}'.format(_srv.remote_address))\n if isinstance(_srv.local_address, string_types): # UNIX stream\n s...
[ "0.6775253", "0.66485655", "0.64152706", "0.638992", "0.62913436", "0.62176776", "0.6206469", "0.61653435", "0.6158915", "0.5879251", "0.58663124", "0.57571006", "0.57403094", "0.5739101", "0.57283133", "0.57218915", "0.56847924", "0.5672672", "0.5664348", "0.5653754", "0.564...
0.767064
0
Check if tunnel is already established
def _check_tunnel(self, _srv): if self.skip_tunnel_checkup: self.tunnel_is_up[_srv.local_address] = True return self.logger.info('Checking tunnel to: {0}'.format(_srv.remote_address)) if isinstance(_srv.local_address, string_types): # UNIX stream s = socket.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tunnel_up(self):\n return self._ssh_host != None and self._ssh_port != None", "def check_tunnels(self):\n skip_tunnel_checkup = self.skip_tunnel_checkup\n try:\n # force tunnel check at this point\n self.skip_tunnel_checkup = False\n for _srv in self._ser...
[ "0.76572174", "0.68320966", "0.6712594", "0.66211444", "0.65298826", "0.6516994", "0.6469484", "0.64455706", "0.6440732", "0.642409", "0.64158744", "0.64121675", "0.640858", "0.6397321", "0.6368237", "0.63668215", "0.63547385", "0.6343381", "0.6332009", "0.62437207", "0.62311...
0.7658537
0
Make SSH Handler class
def _make_ssh_forward_handler_class(self, remote_address_): class Handler(_ForwardHandler): remote_address = remote_address_ ssh_transport = self._transport logger = self.logger return Handler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, settings, server=None):\n print(\"SSH Action Handler Started\")\n self.server = server\n self.active_ssh_tasks = {}\n self.key_location = settings[\"ssh_key_location\"]\n self.server_addr = settings[\"ssh_server_addr\"]\n self.server_username = settings[...
[ "0.6786921", "0.664092", "0.5964434", "0.59032935", "0.5826504", "0.5811605", "0.5802258", "0.57916", "0.57681113", "0.57595307", "0.56702554", "0.5632079", "0.5591133", "0.5555422", "0.5547671", "0.5513227", "0.54987305", "0.547998", "0.54228693", "0.5409541", "0.54088503", ...
0.7127526
0
Make SSH forward proxy Server class
def _make_ssh_forward_server(self, remote_address, local_bind_address): _Handler = self._make_ssh_forward_handler_class(remote_address) try: forward_maker_class = self._make_stream_ssh_forward_server_class \ if isinstance(local_bind_address, string_types) \ el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kvargs):\n self.proxy_host = kvargs.get('proxy_host')\n self.proxy_user = kvargs.get('proxy_user')\n self.proxy_password = kvargs.get('proxy_password')\n self.proxy_port = kvargs.get('proxy_port')\n self.proxy_ssh_key_file = kvargs.get('proxy_ssh_key')...
[ "0.7106363", "0.70660514", "0.6869265", "0.6866874", "0.67542416", "0.67281854", "0.66319937", "0.66259706", "0.65863454", "0.6447036", "0.64140695", "0.6208045", "0.61953837", "0.61937344", "0.603836", "0.5995457", "0.5974067", "0.59585327", "0.59581494", "0.5957244", "0.595...
0.6935557
2
Read ssh_config_file and tries to look for user (ssh_username), identityfile (ssh_pkey), port (ssh_port) and proxycommand (ssh_proxy) entries for ssh_host
def _read_ssh_config(ssh_host, ssh_config_file, ssh_username=None, ssh_pkey=None, ssh_port=None, ssh_proxy=None, compression=None, logger=None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_config(self, sshconfig=\"~/.ssh/config\"):\n rpath = os.path.realpath(os.path.expanduser(sshconfig))\n try:\n os.stat(rpath)\n except OSError:\n return\n\n try:\n with codecs.open(rpath, \"rb\", \"utf-8\") as f:\n clines = f.read...
[ "0.6473108", "0.64405686", "0.6379368", "0.5951086", "0.5951086", "0.58582616", "0.58304334", "0.57917017", "0.5772919", "0.57614845", "0.57045346", "0.56750584", "0.563401", "0.5628457", "0.5615216", "0.5609538", "0.5607589", "0.5602402", "0.55837905", "0.557609", "0.5556947...
0.7810559
0
Load public keys from any available SSH agent
def get_agent_keys(logger=None): paramiko_agent = paramiko.Agent() agent_keys = paramiko_agent.get_keys() if logger: logger.info('{0} keys loaded from agent'.format(len(agent_keys))) return list(agent_keys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loaded_keys(self):\n\n keys = {}\n\n cmd = ['ssh-add', '-l']\n p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)\n (stdout, stderr) = [str(x, 'utf-8') for x in p.communicate()]\n\n if p.returncode == 1:\n line = stdout.split('\\n')[0].strip()\n if lin...
[ "0.75607955", "0.73097134", "0.7197751", "0.69344604", "0.67005086", "0.65384454", "0.6444275", "0.64237195", "0.6405875", "0.6390682", "0.6375272", "0.63109237", "0.628123", "0.62718284", "0.6259708", "0.6244121", "0.6227433", "0.6215734", "0.61653936", "0.61179155", "0.6117...
0.631428
11
Load public keys from any available SSH agent or local .ssh directory.
def get_keys(logger=None, host_pkey_directories=None, allow_agent=False): keys = SSHTunnelForwarder.get_agent_keys(logger=logger) \ if allow_agent else [] if host_pkey_directories is None: host_pkey_directories = [DEFAULT_SSH_DIRECTORY] paramiko_key_types = {'rsa': para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_keys(self, keys):\n paths = []\n for key in keys:\n if isinstance(key, SSHKeyFile):\n if not key.is_loaded:\n paths.append(key.path)\n elif isinstance(key, str):\n paths.append(key)\n\n if paths:\n self....
[ "0.73089355", "0.7063689", "0.6927479", "0.6879048", "0.683818", "0.6770156", "0.6724969", "0.67144984", "0.6709331", "0.6627027", "0.6571654", "0.6545336", "0.6542647", "0.6494547", "0.63725674", "0.6328786", "0.62305385", "0.6208962", "0.6202283", "0.61332744", "0.6112847",...
0.6186234
19
Fill local_binds with defaults when no value/s were specified, leaving paramiko to decide in which local port the tunnel will be open
def _consolidate_binds(local_binds, remote_binds): count = len(remote_binds) - len(local_binds) if count < 0: raise ValueError('Too many local bind addresses ' '(local_bind_addresses > remote_bind_addresses)') local_binds.extend([('0.0.0.0', 0) for x in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_forward(\n self, remote_host, remote_port, local_host=\"0.0.0.0\", local_port=44556\n ):\n tunnel = SSHTunnelForwarder(\n (self.hostname, self.port),\n ssh_username=self.user,\n ssh_pkey=get_pkey(self.issho_conf[\"ID_RSA\"]),\n remote_bind_addr...
[ "0.579129", "0.5754728", "0.55586314", "0.5536749", "0.5503512", "0.54927737", "0.54771763", "0.54581785", "0.54327863", "0.5351175", "0.5337139", "0.5322381", "0.5304873", "0.5271184", "0.52708703", "0.5213023", "0.5150957", "0.512968", "0.5124702", "0.5117299", "0.5079624",...
0.610802
0