query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Save FakeEstimator as a pickle file.
def pickle_fake_estimator(): estimator = FakeEstimator() data = FakeEstimatorData() estimator.fit(*data.train_data) estimator.dump(filepath="src/tests/fixtures/fake_estimator.pkl")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(estimator, path):\n saver = tf.train.Saver()\n if \"/\" not in path:\n path = \"./\" + path\n saver.save(estimator.sess, path + \".ckpt\")\n\n save_dr = directRanker()\n for key in estimator.get_params():\n # ToDo: Need to be fixed to also restore t...
[ "0.73382103", "0.6851615", "0.6810691", "0.668939", "0.66407794", "0.6580065", "0.6522132", "0.6510801", "0.6498043", "0.64909166", "0.64886314", "0.6478784", "0.64755905", "0.6462266", "0.6444365", "0.6418511", "0.6401637", "0.6400303", "0.6362861", "0.63624704", "0.6355044"...
0.86677164
0
batch_add_documents Create document reference objects for array of MPIRecord.as_dict() data. Commits all records without checking existance. Batch failes as a group.
def batch_add_documents(rows: tuple, client: firestore.Client, context: Context = None) -> bool: if len(rows) < 1: return logger.debug('Beginning batch add.') batch = client.batch() col = client.collection(config.FIRESTORE_IDENTITY_POOL) batch_size = 0 for row in rows: doc_id =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_documents(self, documents):\n\t\t\n\t\t# flag for StopIteration exceptions\n\t\tmore_documents = True\n\t\t# loop while there are still documents in the iterator\n\t\twhile more_documents:\n\t\t\t# increment batch number\n\t\t\tbatch = len(self.batch_stats) + 1\n\t\t\t# count sentences\n\t\t\tsentences_cou...
[ "0.71297807", "0.63890344", "0.6205511", "0.62011063", "0.6165369", "0.61505246", "0.61075395", "0.60913295", "0.60707134", "0.60265774", "0.60081816", "0.59751964", "0.59018975", "0.58996", "0.5872084", "0.5869931", "0.58174", "0.5784422", "0.57613033", "0.5746739", "0.57002...
0.6805723
1
Returns an image with a circle of the specified color centered at r_center, c_center with the specified radius.
def add_circle(self, r_center, c_center, radius, color=BLUE, image=np.full((640, 480, 3), BLACK)): circle = np.fromfunction(lambda r, c, _: (r - r_center) ** 2 + (c - c_center) ** 2 <= radius ** 2, image.shape) return np.where(circle, color, image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circle(self, center_x, center_y, radius, color):\n x = radius - 1\n y = 0\n d_x = 1\n d_y = 1\n err = d_x - (radius << 1)\n while x >= y:\n self.pixel(center_x + x, center_y + y, color)\n self.pixel(center_x + y, center_y + x, color)\n ...
[ "0.8228878", "0.8219178", "0.78154874", "0.77515244", "0.7704967", "0.7702225", "0.7552532", "0.7519485", "0.7491249", "0.73533434", "0.73278445", "0.7312186", "0.72614354", "0.72606254", "0.72138095", "0.71855444", "0.7162798", "0.7146958", "0.71364766", "0.7134207", "0.7110...
0.85644984
0
Get a list of open sessions.
def sessions(self): logger.debug("Get sessions") return self._raw_api.sessions.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sessions(self):\n\n return self.all_sessions", "def sessions(self):\n return utils.listItems(self, '/status/sessions')", "def get_sessions(self):\n return self.current_sessions", "def sessions(self):\n return list(Session.get_sessions(self))", "def fusion_api_get_active_...
[ "0.7853016", "0.77553767", "0.77518004", "0.7727921", "0.75773144", "0.7455665", "0.741976", "0.7377184", "0.7322953", "0.7199167", "0.715005", "0.71093184", "0.7080419", "0.7011158", "0.7001538", "0.693306", "0.690886", "0.68052894", "0.6741219", "0.6715986", "0.6661043", ...
0.7775884
1
Get a list of supported formats.
def formats(self): logger.debug("Get formats") return self._raw_api.formats.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFormats(self):\n return self.formats", "def available_formats() -> List[str]:\n formats = [p.stem for p in Path(TEMPLATES_PATH).glob(f'*{TEMPLATE_SUFFIX}')]\n return formats", "def available_input_formats():\n input_formats = []\n # Extensions.\n for v in pkg_resources.iter_entry_p...
[ "0.7628514", "0.7482992", "0.74505144", "0.7406129", "0.73903966", "0.736377", "0.7168442", "0.71440804", "0.706311", "0.6965525", "0.6930943", "0.67716444", "0.6651676", "0.6586174", "0.65663487", "0.6469767", "0.6390743", "0.62885785", "0.6242604", "0.62181723", "0.61240023...
0.8049191
0
Get a list of supported platforms.
def platforms(self): logger.debug("Get platforms") return self._raw_api.platforms.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')", "def Platforms():\n return platforms", "def list_platforms(self):\n return self.do_rpc('list_platforms')", "def platforms(self) -> Any:\n\n ...
[ "0.8321638", "0.83141357", "0.82153684", "0.8204822", "0.78935903", "0.752682", "0.74458444", "0.7411531", "0.7306375", "0.72029763", "0.6981389", "0.6900798", "0.68045926", "0.67164314", "0.66271263", "0.66118366", "0.6587778", "0.6573889", "0.6560201", "0.6551199", "0.65415...
0.84801334
0
Get information about current license.
def license(self): # noqa: A003 logger.debug("Get license") return self._raw_api.license.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_license(self) -> APIReturn:\n return await self._request(\"GET\", \"/getLicense\")", "def get_license_info(self):\n\t\treturn Job(SDK.PrlSrv_GetLicenseInfo(self.handle)[0])", "def get_license_info():\n query = {\"type\": \"op\", \"cmd\": \"<request><license><info></info></license></requ...
[ "0.8214946", "0.80912066", "0.7857505", "0.78251725", "0.76007545", "0.7399088", "0.7384157", "0.7029123", "0.6977761", "0.6942977", "0.69038343", "0.6888699", "0.68289286", "0.6823185", "0.6798642", "0.6784194", "0.67120636", "0.6692922", "0.669096", "0.66794705", "0.6653374...
0.8265865
0
Get sample by ID or get a filtered list of samples.
def samples(self, sample_id=None, count=None, offset=None, md5=None, sha1=None, sha256=None, format_name=None, format_group_name=None): if sample_id: logger.debug("Get sample") return self._raw_api.samples.get(sample_id) logger.debug("Get list of samples") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample_by_id():\n sample_id = demisto.getArg('id')\n r = req('GET', SUB_API + 'samples/' + sample_id)\n sample = sample_to_readable(r.json().get('data'))\n md = tableToMarkdown('ThreatGrid - Sample', [sample], [\n 'ID', 'Filename', 'State', 'Status', 'MD5', 'SHA1', 'SHA256', 'OS', 'Submi...
[ "0.70065355", "0.6553457", "0.6441145", "0.6247066", "0.62334746", "0.6158406", "0.60942227", "0.6072785", "0.60477775", "0.60387766", "0.5957173", "0.5942522", "0.59190357", "0.59012043", "0.5900346", "0.5863744", "0.5834125", "0.58205307", "0.5815694", "0.58094805", "0.5808...
0.6953402
1
Get analysis by ID or get a filtered list of analyses.
def analyses(self, analysis_id=None, count=None, offset=None, format_group_name=None): if analysis_id: logger.debug("Get analysis") return self._raw_api.analyses.get(analysis_id) logger.debug("Get analysis list") data = filter_data( count=count, o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_analysis_by_id():\n sample_id = demisto.getArg('id')\n r = req('GET', SUB_API + 'samples/' + sample_id + '/analysis.json')\n ec, hr = extract_data_from_analysis_json(json.loads(r.content), sample_id, demisto.getArg('limit'))\n demisto.results([\n {\n 'Type': entryTypes['note']...
[ "0.6959838", "0.64478153", "0.6266589", "0.59796053", "0.57639056", "0.56505173", "0.5608305", "0.5591888", "0.5532414", "0.5420308", "0.53395915", "0.5314211", "0.52453977", "0.52236027", "0.522152", "0.5218806", "0.51473", "0.5111401", "0.5110683", "0.5110463", "0.50595576"...
0.74896353
0
replace the old value of the given index with the given new value. This replaces the old value of the given index with the given new value in O(logN). This is like "list[index] = value".
def replace(self, index, value): index += self.n self.data[index] = value index //= 2 while index > 0: self.data[index] = self.func(self.data[2*index], self.data[2*index+1]) index //= 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replaceItemOfIndex(itemsList, value, index):\n itemsList[index] = value", "def _update_value_at(self, index, value):\n node = self._get_node_at(index)\n if node is None:\n raise IndexError('List index out of range.')\n node.value = value", "def __setitem__(self, index, valu...
[ "0.7702102", "0.691884", "0.68381226", "0.6370257", "0.6290709", "0.6285079", "0.6284737", "0.6281314", "0.62617064", "0.6227603", "0.6210204", "0.6208601", "0.62000424", "0.61767346", "0.61727077", "0.61219776", "0.6119389", "0.61171716", "0.61106485", "0.608936", "0.6009382...
0.71812755
1
get the folded value of values in a segment [l, r). This get the folded value of values in a segment [l, r) in O(logN). If func is add, it returns the sum of values in [l, r).
def folded(self, l, r): left_folded = self.e right_folded = self.e l += self.n r += self.n while l < r: if l % 2: left_folded = self.func(left_folded, self.data[l]) l += 1 if r % 2: r -= 1 ri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foldl1(self, start, end, fn):\n\n if start > end:\n raise ValueError(\"End needs to be after start!\")\n val = self.get(start)\n start_ix = self._trace.bisect_right(start)\n end_ix = self._trace.bisect_left(end)\n for lvl in self._trace.values()[start_ix:end_ix]:\n...
[ "0.6194322", "0.53477794", "0.5318277", "0.52472675", "0.5210651", "0.5190393", "0.51515216", "0.51253724", "0.5068718", "0.50246084", "0.5006381", "0.4994088", "0.49633646", "0.49520078", "0.4907899", "0.48883545", "0.48571184", "0.48537755", "0.483924", "0.4836054", "0.4826...
0.6321064
0
Ensure the awards endpoint lists the right number of awards
def test_award_list(self): resp = self.client.get('/api/v1/awards/') self.assertEqual(resp.status_code, 200) self.assertTrue(len(resp.data) >= 2) self.assertEqual(self.client.get('/api/v1/awards/fain/ABCD').status_code, 200) self.assertEqual(self.client.get('/api/v1/awards/uri/A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def awards(self) -> str:\n return self._awards", "def check_num_anchors(self):\n return True", "def num_anchors_per_location(self):\n pass", "def create_awards(request):\n auction = request.validated['auction']\n auction.status = 'active.qualification'\n now = get_now()\n auction.awa...
[ "0.57266897", "0.5483273", "0.5429415", "0.5409491", "0.53649867", "0.53170073", "0.53033745", "0.5262545", "0.5203604", "0.5109399", "0.50259197", "0.5017115", "0.4921486", "0.491657", "0.48900056", "0.48645133", "0.48635513", "0.48569393", "0.4851628", "0.48419982", "0.4841...
0.6013599
0
Ensure the awards endpoint summary lists the right number of awards
def test_award_list_summary(self): resp = self.client.get('/api/v1/awards/summary/') self.assertEqual(resp.status_code, 200) self.assertTrue(len(resp.data) > 2) self.assertEqual(self.client.get('/api/v1/awards/summary/fain/ABCD').status_code, 200) self.assertEqual(self.client.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_award_list(self):\n resp = self.client.get('/api/v1/awards/')\n self.assertEqual(resp.status_code, 200)\n self.assertTrue(len(resp.data) >= 2)\n\n self.assertEqual(self.client.get('/api/v1/awards/fain/ABCD').status_code, 200)\n self.assertEqual(self.client.get('/api/v1/a...
[ "0.5895589", "0.57376325", "0.57162523", "0.54106843", "0.53648967", "0.5339986", "0.532358", "0.5282755", "0.5235086", "0.51905", "0.51833016", "0.5171945", "0.5147353", "0.50078136", "0.5000443", "0.4969957", "0.49352717", "0.49300224", "0.49298853", "0.49057478", "0.488022...
0.59551114
0
Create spectral connectivity node
def connectivity(band, method, sfreq): from neuropype_ephy.interfaces.mne.spectral import SpectralConn # if not method: # method = ('imcoh',) freq_bands = [list(t) for t in band] sp_conn = pe.Node(interface=SpectralConn(), name='sp_conn') # sp_conn.inputs.con_method = con_method sp_conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,\n name,\n vertices_location,\n connectivity,\n connectivity_ids=None,\n connectivity_label=None,\n connectivity_label_metadata=None,\n connectivity_colormap = None,\n connector_size=2.6,\n ...
[ "0.67670476", "0.5854593", "0.5674578", "0.5581929", "0.5566483", "0.54728717", "0.5455519", "0.5379166", "0.53610444", "0.53368825", "0.5333542", "0.5301085", "0.5300956", "0.5285234", "0.52525663", "0.5233461", "0.5230975", "0.52303", "0.520685", "0.51999414", "0.5196441", ...
0.6799282
0
MCache is used to store the A record value of Dozens API Server.
def __init__(self): if Config.USEMEMCACHED is True: self.mc = MCache(server = Config.MEMCACHED_SERVER, username = Config.MEMCACHED_USERNAME, password = Config.MEMCACHED_PASSWORD) else: self.mc = None self.api = D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cache(self, key_path, content, t_mserver):\n\t\tif key_path not in self.cache:\n\t\t\tself.cache[key_path] = {'time_validated': int(time.time()),\n\t\t\t\t\t\t\t\t\t't_mclient' : int(t_mserver),\n\t\t\t\t\t\t\t\t\t'content': content}\t\n\t\t\tprint(\"self.cache[key_path]: \",self.cache[key_path]['content']...
[ "0.666757", "0.63701355", "0.6317664", "0.6274594", "0.6257314", "0.6168455", "0.60931593", "0.60383594", "0.5955871", "0.5938162", "0.5922552", "0.59224766", "0.5846034", "0.58344096", "0.5826743", "0.58214843", "0.58152014", "0.5799307", "0.57869583", "0.5776415", "0.577641...
0.64260286
1
Extract A record from DNS records. The DNS records is exepected to DozensAPI json format. The count of A records must be 1 or 0. If the count is more than 2, Excexption is generated. When there is A record, this function will return the A record data as DozensAPI json format. When there is not A record, this function w...
def extract_A_records(self, records): a_records = [] for record in records: if record["type"] == "A": a_records.append(record) #Check the results of Arecords if len(a_records) > 1: raise Exception() # "A" record should be a one. elif a_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dns_A_record(self, zone_name):\n a_record = None\n\n a_record = self._get_cache(zone_name) # check memcached server\n if a_record is not None:\n return a_record\n\n r = self.api.get_records(zone_name) # Retrive A record from Dozens\n a_record = self.extract_A...
[ "0.64882845", "0.59541893", "0.5931158", "0.57507885", "0.5603081", "0.5553549", "0.5537335", "0.54833275", "0.5480888", "0.5462507", "0.5408061", "0.5406709", "0.53831667", "0.53762805", "0.53634554", "0.5338866", "0.52616525", "0.5245402", "0.5242817", "0.52296525", "0.5203...
0.6898025
0
Retrieve the A record data from DozensAPI server. If you set the config of MEMCACHED true, the A record value is may stored in memcached server. After checking the memcache server, if there is no data in memcached server, this function retrieve the A record data from DozensDNS server and store the result to memcached.
def get_dns_A_record(self, zone_name): a_record = None a_record = self._get_cache(zone_name) # check memcached server if a_record is not None: return a_record r = self.api.get_records(zone_name) # Retrive A record from Dozens a_record = self.extract_A_records(r["r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getdnsrecord(self, kasserver):\n assert (\n kasserver.get_dns_record(\"www.example.com\", \"A\") == self.RESPONSE_PARSED[0]\n )", "def dns(self, **kwargs):\n self.logger.debug(f\"Get RealTime DNS data\")\n url_path = 'dns'\n body = self._make_body(kwargs)\n ...
[ "0.5961021", "0.5613025", "0.56087595", "0.54690444", "0.5385303", "0.5382801", "0.5366064", "0.534499", "0.53158635", "0.53024185", "0.5297675", "0.52715516", "0.51835185", "0.5151787", "0.51191556", "0.5110879", "0.5082143", "0.50809014", "0.5074147", "0.50627124", "0.50533...
0.70113283
0
Get IP Address by hostname. Hostname is expected to Heroku app name. eg)myApp.herokuapp.com
def get_heroku_host_ip(self, host): if "herokuapp.com" not in host: raise Exception() # host must point to the default heroku domain ipaddr = socket.gethostbyname(host) return ipaddr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host_ip(hostname: str) -> str:\n try:\n return socket.gethostbyname(hostname)\n except socket.gaierror:\n return \"No record found.\"", "def get_IP(): \n \n return socket.gethostbyname(socket.gethostname())", "def get_IP():\n\n return socket.gethostbyname(socket.gethostname()...
[ "0.7667937", "0.74938697", "0.7425735", "0.7336092", "0.7263189", "0.72536325", "0.7227122", "0.71724534", "0.7157417", "0.71420085", "0.7123974", "0.7098501", "0.7063284", "0.7035026", "0.7014025", "0.6998652", "0.69947135", "0.6940966", "0.6934668", "0.6934668", "0.69317067...
0.8207045
0
Update A records in DozensDNS Server. Check the current IP Address for heroku application. If the current IP is different from the A record's in DNS, this function update the A records in the DozensDNS server. If there is no A record in DozensDNS Server, this function will create new A record in the sever. If there is ...
def ip_update(self, custom_domain, heroku_host): update_pattern = None resultmsg = "TargetHost:%s Result:" % custom_domain new_dns_a_record = None dns_a_record = self.get_dns_A_record(custom_domain) heroku_host_ip = self.get_heroku_host_ip(heroku_host) #Store A record t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_A_record(self, heroku_host_ip, dns_a_record):\n r = self.api.post_update_record(\n record_id = dns_a_record.get('id'),\n prio = dns_a_record.get('prio'),\n content = heroku_host_ip,\n ttl = dns_a_record.get('ttl'))\n dns_a_record ...
[ "0.7341025", "0.6478545", "0.63869625", "0.6069963", "0.59283805", "0.5864257", "0.5788555", "0.5780303", "0.5750479", "0.574086", "0.57190037", "0.5619039", "0.5509928", "0.5505138", "0.54753983", "0.5473577", "0.5399942", "0.5287928", "0.52335286", "0.5204053", "0.51953053"...
0.67744726
1
The function creates a number of nodes, saves them in a list and prints them
def creating_nodes_and_print(num, name_intro, list_of_nodes): for i in range(num): new_node = Node(name_intro + str(i)) # Create an instance of Node list_of_nodes.append(new_node) # Adds to the node list print(new_node)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_nodes(self):", "def gen_nodes(self):\n self.nodes = []\n for i in range(self.num_nodes):\n self.nodes.append(Node(self.fk))", "def createNodes(self, size):\n\t\tnodeList = []\n\t\tfor i in range(size) :\n\t\t\tnodeList.append(Node(str(i)))\n\t\treturn nodeList", "def node_...
[ "0.7466744", "0.7275964", "0.72589964", "0.6911592", "0.6847661", "0.6837318", "0.6747895", "0.6738364", "0.6738364", "0.6738364", "0.6738364", "0.6738364", "0.6738364", "0.6343166", "0.6280992", "0.62633145", "0.62631696", "0.62473625", "0.61987567", "0.6194838", "0.6182446"...
0.8407329
0
The function analyzes the data regarding the neighbors, edges and their weight for each node
def analyze_edges_and_weight(list_of_nodes): edges_info = [] for node in list_of_nodes: n_edge_of_node = len(node.neighbors) # Counts the kys in the dictionary 'Node.neighbors' total_weight_of_node = sum(list(map(lambda x: node.neighbors[x], node.neighbors))) # Sums values of the dict no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateWeights(self):\n return self.distances #En lo que encontramos una funcion que represente", "def wsngraph():\n G = nx.Graph()\n G.add_node(1)\n G.add_node(2)\n G.add_node(3)\n G.add_node(4)\n G.add_node(5)\n G.add_node(6)\n G.add_node(7)\n G.add_node(8)\n G.add_n...
[ "0.6473937", "0.6138236", "0.6136202", "0.60525703", "0.5963872", "0.59432304", "0.59043986", "0.59019846", "0.59019846", "0.59019846", "0.5812297", "0.5776103", "0.5746642", "0.5731295", "0.5704617", "0.5704617", "0.56922364", "0.5691607", "0.5691224", "0.5677097", "0.567593...
0.6829425
0
The function uses the is_reachable method and sorts all nodes in the graph by the number of reachable nodes
def sort_nodes_by_n_reachable(graph): list_of_node_and_reachables_tups = [] # stores the number of reachable nodes per node # The following for loop finds the number of reachable nodes per node for node_to_test in graph.nodes: n_reachable = 0 # The following for loop checks each node if it i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topo_sort(self):\n # TODO: detect cycles\n self.find_reachable_nodes()\n # save list of nodes in topo order\n self.nodes = []\n # assign each node an id field incrementally\n cur_id = 0\n # count visited outgoing edges for each node\n unvisited = {}\n ...
[ "0.6335384", "0.61379105", "0.6006211", "0.5997051", "0.5985431", "0.593495", "0.5928122", "0.58856964", "0.5834879", "0.5784768", "0.5773082", "0.5765771", "0.57285345", "0.5722739", "0.5718495", "0.57121277", "0.5699702", "0.5690813", "0.5680672", "0.56779754", "0.5666135",...
0.82089627
0
The function takes each pair of nodes in the graph, checks its shortest path, and among all these paths takes the one with the highest weight
def pair_nodes_with_max_weight_in_shortest_path(graph): list_pairs_with_shortest_path = [] # The following for loop takes each pair, and adds the weight of their shortest path to the list for frm_name in graph.nodes: for to_name in graph.nodes: if frm_name != to_name: # Irrelevant becaus...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lovliest_path(G):\n m = 0\n ma = None\n mb = None\n for node in G.keys():\n for conn in G[node].keys():\n if G[node][conn] > m:\n m = G[node][conn]\n ma = node\n mb = conn\n print \"found lovli...
[ "0.7312624", "0.6879673", "0.6771265", "0.6603056", "0.65079486", "0.6505377", "0.64837456", "0.6426843", "0.63986903", "0.6381536", "0.63687336", "0.6360288", "0.6347375", "0.6311119", "0.62680966", "0.6224735", "0.6215535", "0.6208431", "0.61889064", "0.6181805", "0.6164838...
0.8300811
0
This function parses a file with travels, finds the edges between regions and the mean duration per edge. The creates neighbors list per region, to be used for creating the Node and Graph classes Input
def get_nodes_and_weight_from_file(file, template_start, template_end): with open(file, "rt") as f: data = f.readlines() edge_list = [] # This list stores the tuples of valid start and end regions edge_duration_dict = {} # Per tuple as key, the dict stores durations per travel as value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file():\n global distances_between_cities\n global number_of_cities\n global unvisited_cities\n\n text_file = open(sys.argv[1].strip('\\r'))\n distances_between_cities = [[int(i) for i in line.strip(\"\\r\\n\").split()[1:]] for line in text_file.readlines()[1:]]\n number_of_cities = l...
[ "0.56921136", "0.5598792", "0.55037755", "0.54969597", "0.5465953", "0.54112494", "0.539906", "0.5350883", "0.53445816", "0.52837235", "0.5271165", "0.5270994", "0.525987", "0.5209131", "0.5199933", "0.5196412", "0.51833653", "0.5157456", "0.5131556", "0.51030296", "0.5096454...
0.7151302
0
The function creates a non directional graph, based on a file the contains connections and disconnections between nodes that represent people.
def create_social_graph(file): social_graph = NonDirectionalGraph("SocialGraph") with open(file, "rt") as f: data = f.readlines() n_friendship = 0 # Represents the number of friendships in the graph in each iteration highest_n_friendship = 0 # Captures the highest record of n_friendship ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_graph(file_name):\n graph = MyGraph()\n with open(file_name, 'r') as fin:\n line = fin.readline().replace('\\n', '')\n while line != \"\":\n vals = line.split(':')\n graph.add_node(vals[0], pos=(int(vals[1]),int(vals[2])))\n line = fin.readline().repla...
[ "0.74040085", "0.710524", "0.690142", "0.6873128", "0.6872683", "0.67700577", "0.67607445", "0.6675571", "0.6608897", "0.6538241", "0.643296", "0.64157456", "0.6414096", "0.6400483", "0.63674825", "0.63652694", "0.6337388", "0.6321549", "0.63072866", "0.6305385", "0.6300312",...
0.7854268
0
The function takes a graph, and searches for the longest uncycled path, first between each pair of nodes, and then totally. The function does not check twicw the same pair (starttoend and endtostart) to save half of the checks
def find_maximal_path(graph): maximal_path_in_graph = [] # This is where the maximal path in the graph is stored (updates) checked_pairs = set() # In order not to check a pair twice, the set stores the already checked pairs (and the # reversed order of the tuple for node_start in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_longest_paths(nodes, graph):\n paths = []\n distances = []\n possible_paths = list(combinations(nodes, r=2))\n for node1, node2 in possible_paths:\n try:\n path = nx.shortest_path(graph, node1, node2, \"weight\")\n except Exception,e:\n path = []\n if ...
[ "0.6854989", "0.6636664", "0.6597567", "0.642048", "0.6393343", "0.63764566", "0.6370171", "0.63676625", "0.6300104", "0.6225427", "0.6216028", "0.6190653", "0.6186506", "0.6174548", "0.61220235", "0.6088715", "0.6087405", "0.6080199", "0.607993", "0.60702384", "0.60700697", ...
0.6781792
1
This function recommends a friend for node_name, based on the highest common friends between them. The suggested friend cannot be one of his connections
def suggest_friend(graph, node_name): suggested_friends = [] # This is where all the potential suggested friends (from second degree) are stored checked_node = set() # Here are already checked second neighbors, not to repeat the check for first_neighbor_name in graph.nodes[node_name].neighbors.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_friends(self):\n query = read_query('content exploration/best_friends')\n response = self._submit_query(query)\n return [(elem['name']['value'], elem['num_chat']['value'].split('/')[-1]) for elem in response]", "def get_common_friends(user, friends, friends_of_friends, data):\n ...
[ "0.5935797", "0.5875457", "0.58732486", "0.58219296", "0.5614356", "0.5534889", "0.5525859", "0.5515391", "0.5442631", "0.5442461", "0.5439348", "0.54223126", "0.5372181", "0.5364131", "0.53427404", "0.5330447", "0.53270787", "0.53195536", "0.53089476", "0.52980304", "0.52682...
0.83844733
0
Run methods for notification of users added or removed
def run_user_notifs(self): try: from iemlav import users self.userLogger = users.IemlAVUserLogger(self.cred['debug']) if not pynput_status: self.get_by_mice() else: while 1: # Starting user notifs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcastChange(self,user_ids):\n userChanged=user_main.getUserPool().userChanged\n map(userChanged,user_ids)", "def user_changes(self, user, what=None):\n pass", "def get_user_notifications(self, login):", "def onUsersUpdate(self, api, users):\n if users != None:\n ...
[ "0.6331052", "0.6226341", "0.62257934", "0.6151774", "0.61087763", "0.6077913", "0.6076656", "0.6060096", "0.60361874", "0.5993007", "0.5963449", "0.5963449", "0.5962914", "0.5947339", "0.5939572", "0.5913608", "0.5811119", "0.5785538", "0.578182", "0.5764597", "0.5759411", ...
0.6332763
0
load dcgan from checkpoint file
def load_dcgan(ckpt_url): netD = Discriminator() netG = Generator() criterion = nn.BCELoss(reduction='mean') netD_with_criterion = WithLossCellD(netD, netG, criterion) netG_with_criterion = WithLossCellG(netD, netG, criterion) optimizerD = nn.Adam(netD.trainable_params(), learning_rate=cfg.le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, file):\n \"\"\"Load \"\"\"\n chkpnt = torch.load(file)\n self.load_state_dict(chkpnt['model_state_dict'])", "def load_D( self, D_checkpoint):\n checkpoint = torch.load(D_checkpoint)\n self.D.load_state_dict(checkpoint['dnet'])\n self.dis_optim.l...
[ "0.6464165", "0.62305546", "0.61493516", "0.6056901", "0.6038648", "0.60300136", "0.5942893", "0.5905391", "0.585963", "0.58460504", "0.58259493", "0.58259493", "0.58124506", "0.57944924", "0.5783259", "0.577299", "0.57669246", "0.57235426", "0.56993556", "0.569691", "0.56958...
0.6827346
0
load discriminator layers from dcgan model
def load_discriminator(dcgan_net): netD_trained = dcgan_net.myTrainOneStepCellForD.network.netD for m in netD_trained.discriminator.cells_and_names(): if m[0] == '0': print(m[0], m[1]) conv_1 = m[1] elif m[0] == '1': print(m[0], m[1]) leakyReLU_1 =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dcgan(ckpt_url):\n netD = Discriminator()\n netG = Generator()\n\n criterion = nn.BCELoss(reduction='mean')\n\n netD_with_criterion = WithLossCellD(netD, netG, criterion)\n netG_with_criterion = WithLossCellG(netD, netG, criterion)\n\n optimizerD = nn.Adam(netD.trainable_params(), learni...
[ "0.71224385", "0.6810334", "0.67994285", "0.67843485", "0.6737191", "0.6736243", "0.6602327", "0.6585844", "0.6575293", "0.653446", "0.6508168", "0.64640576", "0.64385873", "0.6397815", "0.638816", "0.63873684", "0.63734776", "0.63600385", "0.6336868", "0.6285398", "0.62454",...
0.7726415
0
Build token types and paddings, trim if needed, and pad if needed.
def build_tokens_types_paddings_from_text(row, tokenizer, max_seq_length): title_ids = tokenizer.tokenize(row['title']) context_ids = tokenizer.tokenize(row['text']) # Appending the title of the context at front extended_context_ids = title_ids + [tokenizer.sep_id] + context_ids context_ids, cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tokens(self):\n self.advance()\n while self.__token != \"\":\n self.__tokens.append(self.token_type())\n self.advance()", "def build_tokens_types_paddings_from_ids(text_ids, max_seq_length,\n cls_id, sep_id, pad_id):\n enc_i...
[ "0.6928678", "0.6210445", "0.609712", "0.6043583", "0.5532718", "0.5516193", "0.5512428", "0.5458469", "0.53578734", "0.5324736", "0.5320236", "0.5258206", "0.5235083", "0.5231013", "0.51703656", "0.51268417", "0.5022243", "0.50036293", "0.4974646", "0.49722788", "0.49659318"...
0.641009
1
Take the targets df, make the freq table and make an in memory sqlite db with fts enabled
def __init__(self, con, freq_dict): self.target_con = con self.freq_dict = freq_dict self.max_results = 100 self.get_records_sql = """ SELECT * FROM fts_target WHERE fts_target MATCH '{}' limit {}; """
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_frequencies(df_corpus, wdir, min_MFF, max_MFF, mode, names_MFF):\n # Normalization of the frequencies by the sum of the text\n df_corpus = df_corpus.loc[:].div(df_corpus.sum(axis='columns'), axis=\"index\")\n if mode == \"train\":\n # If we are doing a training corpus, it is easier\n ...
[ "0.5940074", "0.58037204", "0.5782124", "0.5527683", "0.5508991", "0.5495813", "0.5483393", "0.54375607", "0.54201233", "0.5359833", "0.53295547", "0.5308266", "0.5292841", "0.5286229", "0.5269359", "0.5249203", "0.5242109", "0.5242082", "0.52413666", "0.5226437", "0.5213824"...
0.6332065
0
Returns the size of the board.
def get_size(self): return len(self.board)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height(self):\n return self.board.shape[0]", "def width(self):\n return self.board.shape[1]", "def size(self):\n return self.__row_count * self.__col_count", "def __len__(self):\r\n return len(self.board)", "def columns(self) -> int:\n return self.__squares[0].__len__...
[ "0.77425593", "0.7734428", "0.7411177", "0.7266193", "0.72311884", "0.7142193", "0.7142193", "0.7134262", "0.70937717", "0.70343477", "0.6986015", "0.6986015", "0.6986015", "0.6986015", "0.6986015", "0.6986015", "0.6986015", "0.6980608", "0.6934503", "0.6934503", "0.69234544"...
0.9068898
0
If it's a generator, it is many.
def test__is_many_generator(self): a_generator = (a for a in []) is_many = BaseResource._is_many(a_generator) self.assertTrue(is_many)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_many(self) -> bool: # pragma: no cover\n pass", "def isgenerator(object):\r\n return isinstance(object, types.GeneratorType)", "def semigroup_generators(self):", "def __iter__(self):\n yield from self.gen", "def maybe_generator(obj):\n if isinstance(obj, types.GeneratorType):\n ...
[ "0.6508499", "0.63016146", "0.611471", "0.6112385", "0.59977794", "0.5991074", "0.59794354", "0.5939048", "0.59286696", "0.5906717", "0.58976305", "0.5894856", "0.58644503", "0.5845088", "0.5845088", "0.5845088", "0.5845088", "0.58189493", "0.5813614", "0.57954556", "0.578238...
0.7830569
0
If it's a list with more than one element, it is many.
def test__is_long_list(self): is_many = BaseResource._is_many([1, 2]) self.assertTrue(is_many)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_many(self) -> bool: # pragma: no cover\n pass", "def _is_list(self):\n # TODO\n if self.is_int():\n return self.int() == 0\n else:\n return self.size_words() == 2 and self.tag() == 0 and self.field(1)._is_list()", "def multiple_elements(self) -> bool:\n return self.max ...
[ "0.71569556", "0.66823655", "0.6501297", "0.6467443", "0.63625574", "0.63625574", "0.6198399", "0.6191042", "0.61020756", "0.6101056", "0.6082181", "0.6053375", "0.60043806", "0.5998302", "0.59963846", "0.5916119", "0.59062046", "0.58648705", "0.5853546", "0.58478904", "0.584...
0.6776673
1
If messages is a list, its length must be the same as runnables.
def test__run_many_messages_list_different_length(self): # Set up class OneResource(BaseResource): def process(self, message): pass api = Mock() api.endpoint = 'http://an_endpoint' OneResource.init(api, 'one_route') session = ObjectId('57b5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_iterable(self):\r\n msg_list = messages.MessageList()\r\n\r\n # Adds 3 Message objects to the list.\r\n msg_list.push(messages.StringMessage(\"a\"))\r\n msg_list.push(messages.StringMessage(\"b\"))\r\n msg_list.push(messages.StringMessage(\"c\"))\r\n\r\n self.a...
[ "0.61787325", "0.6085011", "0.6085011", "0.6020412", "0.58944976", "0.58544415", "0.58284813", "0.5805563", "0.57721657", "0.57610315", "0.5738075", "0.5675412", "0.56745607", "0.55899686", "0.5562885", "0.5527184", "0.55035615", "0.54345846", "0.54305166", "0.5426993", "0.53...
0.71237516
0
If runnable is a list call _run_many.
def test_invoke_runnable_list(self): # Set up class OneResource(BaseResource): def process(self, message): pass api = Mock() api.endpoint = 'http://an_endpoint' OneResource.init(api, 'one_route') session = ObjectId('57b599f8ab1785652bb879a7...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_joblist(self):\n\n for message in self.message_list:\n self.run_job(message)", "def process_method_on_list(method_to_run, items):\n all_items = []\n if items is not None:\n if SUPPORTS_POOL:\n pool = ThreadPool()\n try:\n all_items = poo...
[ "0.59092027", "0.5808369", "0.5725129", "0.5672681", "0.5538673", "0.5538673", "0.5538673", "0.5538673", "0.5538673", "0.5509467", "0.5508982", "0.542526", "0.5420903", "0.5410775", "0.54094464", "0.540279", "0.54011595", "0.53725994", "0.5368649", "0.53611326", "0.53485775",...
0.6849847
0
load word vectors from glove model using glovepython.
def _load_glove_vec(fname, vocab): print 'load glove...' word_vecs = {} cnt = 0 l = open(fname,'r').readline() embedding_size = len(l.strip().split()) -1 print 'embedding vector size: %d'%(embedding_size) with open(fname, "r") as f: for l in f: stemp = l.strip().split(' '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_word2vec_model():\n logging.basicConfig(\n format='%(asctime)s : %(levelname)s : %(message)s', \n level=logging.INFO)\n model_path = '/playpen/home/tongn/GoogleNews-vectors-negative300.bin'\n model = KeyedVectors.load_word2vec_format(fname=model_path, binary=True)\n return model"...
[ "0.7708036", "0.7583501", "0.7504706", "0.7439781", "0.7438736", "0.7438736", "0.7431742", "0.7378308", "0.7316868", "0.7308221", "0.7280708", "0.7224026", "0.72156906", "0.7189282", "0.714228", "0.7131309", "0.70774806", "0.70693535", "0.70650214", "0.7049387", "0.70325935",...
0.7791399
0
Method to stop playback. This is only needed when duration is not given or is set to 0 (infinite).
def stop(self): if logging.getLogger().getEffectiveLevel() != 10: try: self._player.terminate() except AttributeError as e: # Make things a bit more user friendly and allow a stop command even if not playing if str(e) == "'Player' object has no attribute ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self,event=None):\r\n # If no video data\r\n if self.isEmpty():\r\n return\r\n if self.hasAudio:\r\n mixer.music.stop()\r\n self.state = VideoPlayer.State.STOPPED\r\n self.progress = 0\r\n self.startTimestamp = time.time()", "def _control_s...
[ "0.6796279", "0.66797805", "0.6664449", "0.6587871", "0.6576716", "0.65679044", "0.6517465", "0.64919347", "0.64916724", "0.64866215", "0.6429682", "0.63845956", "0.63810694", "0.6344538", "0.6323479", "0.6236714", "0.6176756", "0.61766297", "0.6157775", "0.6123047", "0.60847...
0.6830536
0
Singleprocessor task for a group of samples. Generates uniform random x and y arrays of size total_count, on the interval [0,1), and returns the number of the resulting (x,y) pairs which lie inside the unit circle.
def inside_circle(total_count): host_name = MPI.Get_processor_name() print("Rank {} generating {:n} samples on host {}.".format( rank, total_count, host_name)) x = np.float64(np.random.uniform(size=total_count)) y = np.float64(np.random.uniform(size=total_count)) radii = np.sqrt(x*x + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inside_circle(total_count):\n\n x = np.float32(np.random.uniform(size=total_count))\n y = np.float32(np.random.uniform(size=total_count))\n\n radii = ##\n\n count = ##\n\n return count", "def random_points_generator(trials_per_node=0):\r\n points_fallen_inside_circle = 0\r\n # draw a pai...
[ "0.66110563", "0.59076697", "0.58090293", "0.5685215", "0.5672169", "0.55870235", "0.554438", "0.5482595", "0.5475451", "0.5421202", "0.54175615", "0.538964", "0.5371516", "0.5363779", "0.5329019", "0.5329019", "0.5312256", "0.53067034", "0.5279262", "0.5252629", "0.5225447",...
0.7334936
0
Initializes an instance of MetadataCredentials.
def __init__(self, metadata_service): super(MetadataCredentials, self).__init__( access_token=metadata_service.auth_token, client_id=None, client_secret=None, refresh_token=None, token_expiry=None, token_uri=None, user_agent=None ) self._metadata_serv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, credentials=None, certificate=None):\n\n if credentials is not None:\n self.credentials = credentials\n if certificate is not None:\n self.certificate = certificate", "def __init__(\n self,\n creds=None,\n credential_path=\"\",\n ...
[ "0.65065444", "0.6434571", "0.6363235", "0.61029804", "0.60670245", "0.6028387", "0.5996291", "0.5965212", "0.5936263", "0.59021777", "0.58863246", "0.58491945", "0.58183575", "0.5805833", "0.5758375", "0.5758375", "0.5758375", "0.5758375", "0.5756703", "0.57336897", "0.57059...
0.75160396
0
Returns the probability assigned to given topic aggregated over each time step as a pd.Series
def get_topic_history(data, bow_corpus, topic_ID, lda_model, timestep_code='1A', agg=np.mean): agg_results = {} for time_step, data in data.resample(timestep_code, on='year'): # Get indices for data in this range indices = data.index.tolist() # G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topic_prob_in_timestep(bow_subset, lda_model, topic_ID):\r\n # Progress\r\n print(multiprocessing.current_process().name)\r\n \r\n # Get list of topic probs for docs in this timestep\r\n topic_probs = [\r\n get_topic_prob(bow_doc, topic_ID, lda_model) \r\n for bow_doc in bow_su...
[ "0.6865681", "0.5982996", "0.57867515", "0.5783651", "0.5699759", "0.568712", "0.56765324", "0.55558556", "0.5544064", "0.5537381", "0.55294305", "0.5484351", "0.54800683", "0.5408434", "0.54004264", "0.5391381", "0.5383783", "0.53732336", "0.5339577", "0.533726", "0.5329032"...
0.6340927
1
Returns topic prob of topic of interest for a single bow rep of a doc
def get_topic_prob(bow_doc, topic_ID, lda_model): topic_dist = lda_model.get_document_topics( bow_doc, minimum_probability=1e-15 ) return topic_dist[topic_ID][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_prob(self, doc, cat):\n features = self.get_features(doc) \n # Multiply the probabilities of all the features together\n p = Decimal(1)\n for f in features:\n p *= Decimal(str(self.weighted_prob(f, cat, self.feature_prob))) \n return p", "def get_word_proba...
[ "0.7303322", "0.66347116", "0.66114235", "0.6491379", "0.64574456", "0.63266635", "0.6299438", "0.627845", "0.625532", "0.62171155", "0.61435694", "0.6093518", "0.6082761", "0.60543555", "0.5978481", "0.5955836", "0.59395784", "0.5912609", "0.5907879", "0.58773595", "0.585397...
0.73615897
0
Returns the probability assigned to a topic in a timestep
def get_topic_prob_in_timestep(bow_subset, lda_model, topic_ID): # Progress print(multiprocessing.current_process().name) # Get list of topic probs for docs in this timestep topic_probs = [ get_topic_prob(bow_doc, topic_ID, lda_model) for bow_doc in bow_subset ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topic_prob(bow_doc, topic_ID, lda_model):\r\n topic_dist = lda_model.get_document_topics(\r\n bow_doc, \r\n minimum_probability=1e-15\r\n )\r\n return topic_dist[topic_ID][1]", "def p_topic_given_document(self, topic, d, alpha=0.1):\n return ((self.document_topic_counts[d][t...
[ "0.6655611", "0.6495051", "0.6455591", "0.6398546", "0.6266299", "0.61556786", "0.60627687", "0.6058794", "0.598973", "0.5987455", "0.5918111", "0.591495", "0.58980274", "0.5861957", "0.58305615", "0.58125174", "0.58008075", "0.5798812", "0.57529175", "0.57474715", "0.5741699...
0.71519953
0
Takes a temperature and returns a string with degrees and celcius symbols.
def format_temperature(temp): ## ## return (f"{temp}{DEGREE_SYBMOL}") ##
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_temperature(temp):\n temp = str(temp)\n DEGREE_SYBMOL = u\"\\N{DEGREE SIGN}C\"\n return f\"{temp}{DEGREE_SYBMOL}\"", "def format_temperature(temp):\n return f\"{temp}{DEGREE_SYBMOL}\"", "def format_temperature(temp):\n return f\"{temp:.1f}{DEGREE_SYBMOL}\"", "def temperature():\n ...
[ "0.825129", "0.7985022", "0.7526332", "0.71210754", "0.69396746", "0.67530304", "0.6694927", "0.6642228", "0.6522825", "0.6516941", "0.6500728", "0.6482368", "0.64816546", "0.6478142", "0.63859034", "0.632466", "0.6319468", "0.6316163", "0.62887985", "0.62887985", "0.62887985...
0.799034
1
Converts an temperature from farenheit to celcius
def convert_f_to_c(temp_in_farenheit): ## ## celsiustemp = round((temp_in_farenheit - 32) * 5/9, 1) ## return celsiustemp ##
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toCelsius(farenheit):\r\n return (farenheit - 32)*5 / 9", "def convert_f_to_c(temp_in_farenheit):\n celcius_temp = round(float((temp_in_farenheit) - 32)*(5/9),1)\n return(celcius_temp)", "def fahr_to_celsius(temp):\n tempInCel = (temp - 32) * 5/9\n return tempInCel", "def fahrenheit_to_cel...
[ "0.830021", "0.8297017", "0.80692166", "0.79537153", "0.7942571", "0.7892793", "0.7855298", "0.76708984", "0.76708984", "0.76596004", "0.76268816", "0.76258016", "0.7607577", "0.7480153", "0.74674547", "0.7450151", "0.7429527", "0.7273003", "0.7255737", "0.7115664", "0.708591...
0.8497081
0
generates the saml auth token from a credentials file
def samltoken(fp, stsurl='https://ciam-dev-chic.custodix.com/sts/services/STS'): if fp.is_file(): tree = ET.ElementTree() dom = tree.parse(str(fp)) authdata = ET.tostring(dom, encoding='utf-8') # send the xml in the attachment to https://ciam-dev-chic.custodix.com/sts/services/STS ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_from_file(self, credentials):\n self._gauth.LoadCredentialsFile(credentials)", "def get_jwt_token_from_secret_file(self, filename):\n # pylint: disable=consider-iterating-dictionary\n if filename in self.jwt_tokens.keys():\n # token for that file was checked alre...
[ "0.6188859", "0.6001558", "0.59343034", "0.5919648", "0.59060717", "0.5891007", "0.5818392", "0.58023375", "0.57875603", "0.57850313", "0.577085", "0.5725612", "0.569635", "0.5687031", "0.56395584", "0.56359315", "0.56092304", "0.55995744", "0.559102", "0.55836886", "0.558210...
0.62695426
0
get the full url given the resource, making sure it's the provided type
def parseUrl(self, resource, type): try: rId = int(resource) resource = "%s/%s" % (type, rId) except: pass assert type in resource return self.fullUrl(resource)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_url(self, url_type='lookup', resource_obj=None, **kwargs):\n\n valid_urls = [\n url for url in self.model._meta['urls']\n if getattr(url, url_type, False)\n ]\n for url in valid_urls:\n field_values = {\n var: getattr(resource_obj, ...
[ "0.74285483", "0.6979784", "0.68713063", "0.67960596", "0.679588", "0.6779543", "0.66733855", "0.66405416", "0.6560991", "0.6471441", "0.640658", "0.63943154", "0.6361849", "0.633354", "0.6256609", "0.62234885", "0.62014234", "0.6201349", "0.6168805", "0.6163019", "0.61621016...
0.8078824
0
download the zipfile into the given file (fp)
def downloadZip(self, resource, fp): self._stayAlive() res = self.s.get(self.fullUrl(resource), stream = True) if res.ok: with fp.open('wb') as f: shutil.copyfileobj(res.raw, f) return res.status_code else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(url, to):\n filename = url.rstrip('/').split('/')[-1] + '.zip'\n r = requests.get(url, stream=True)\n\n outpath = os.path.join(to, filename)\n\n with open(outpath, 'wb') as fd:\n for chunk in r.iter_content(1024 * 1024):\n fd.write(chunk)\n\n return outpath", "def __...
[ "0.6496693", "0.6394923", "0.63468695", "0.63352424", "0.6330106", "0.6326624", "0.6282395", "0.62378174", "0.61928636", "0.6181251", "0.6123998", "0.61208844", "0.61109394", "0.61055654", "0.610251", "0.6100509", "0.6061935", "0.605026", "0.60320956", "0.6029584", "0.601738"...
0.78951824
0
download the object into a ZIP file based on the object name and the working directory
def downloadObject(self, obj, workingDir=None): fp = Path(obj.name).with_suffix('.zip') if workingDir: fp = Path(workingDir, fp) return self._download(self.fullUrl(obj.downloadUrl), fp.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_zip(self):\n shutil.make_archive(self.name, 'zip', self.name)", "def download_object(self, path, dest):\n bucket, key = self.split_name(path)\n if os.path.isdir(dest):\n dest = os.path.join(dest, os.path.basename(key))\n assert os.path.exists(os.path.dirname(dest))...
[ "0.65129644", "0.63209397", "0.6315694", "0.6255888", "0.610737", "0.6074313", "0.60563844", "0.60391337", "0.60115075", "0.59982306", "0.5990009", "0.5985237", "0.5983045", "0.5964314", "0.5963276", "0.5958171", "0.5957527", "0.5947341", "0.5937034", "0.5929791", "0.59258795...
0.79074097
0
retrieves list of objects (restricting to idList if provided)
def getObjects(self, idList=None): if idList is None: idList = '' if idList in ['', 'published', 'unpublished']: return self.iterateAllPaginated('objects/%s' % idList, func=vsdModels.APIObject._create) items = [] for curId in idList: items.append(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self, *ids):", "def get_objects(self, ids, **args):\n args[\"ids\"] = \",\".join(ids)\n return self.request(\"\", args)", "def get_objects(self,ids):\n return model.objects.filter(pk__in=ids).order_by(search_field)", "def get_objects(self, ids, **args):\n args[\"id...
[ "0.7371993", "0.7265386", "0.71968645", "0.7057545", "0.686739", "0.68592834", "0.6821666", "0.6821666", "0.67964786", "0.6745977", "0.6685808", "0.6615264", "0.6587336", "0.658148", "0.65171057", "0.6492949", "0.64912236", "0.64615655", "0.64209723", "0.6409958", "0.6376445"...
0.73249984
1
Parse a selfUrl and get the resource type and id
def getResourceTypeAndId(self, url): return url.rsplit('/', 2)[-2:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseUrl(self, resource, type):\n try:\n rId = int(resource)\n resource = \"%s/%s\" % (type, rId)\n except:\n pass\n assert type in resource\n return self.fullUrl(resource)", "def get_id(self, resource):\n try:\n return resource.h...
[ "0.6509553", "0.5958048", "0.5911433", "0.58574283", "0.58574283", "0.58574283", "0.58574283", "0.566358", "0.55966455", "0.55953467", "0.5557819", "0.5546575", "0.54229236", "0.5408582", "0.54036415", "0.53553975", "0.53545934", "0.5348073", "0.53469896", "0.53204465", "0.53...
0.62881255
1
Generate the folder object and the file names in a directory tree by walking the tree either topdown or bottomup. For each directory in the tree rooted at directory top (including top itself), it yields a 3tuple (folderObject, dirnames, containedOnbjects). compare to os.walk
def walkFolder(self, folder, topdown=True): if isinstance(folder, basestring): folderObject = self.getFolder(folder) else: folderObject = folder dirs = folderObject.childFolders containedObjects = folderObject.containedObjects if dirs is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk(self, mtop, topdown=True):\n dirents = self.ls(mtop)\n\n mdirs, mnondirs = [], []\n for dirent in sorted(dirents.values(), key=itemgetter(\"name\")):\n if dirent[\"type\"] == \"directory\":\n mdirs.append(dirent)\n else:\n mnondirs.a...
[ "0.6875915", "0.6852678", "0.6835407", "0.6799996", "0.6649015", "0.6647518", "0.66352415", "0.6596622", "0.6585325", "0.64546007", "0.6426719", "0.63063455", "0.6298362", "0.6272581", "0.6255868", "0.62102675", "0.6159212", "0.6088159", "0.6078259", "0.6066512", "0.6043497",...
0.7331804
0
check if a local file is part of an object
def checkFileInObject(self, obj, fp): containted = False ## Haso of all files filehash = self.getObjectFilesHash(obj) ## Local hash BLOCKSIZE = 65536 hasher = hashlib.sha1() with fp.open('rb') as afile: buf = afile.read(BLOCKSIZE) while ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_discord_file(obj):\n return (obj.__class__.__name__) == \"File\"", "def isFileObject(fileObj):\n if sys.version_info[0] == 2:\n return isinstance(fileObj, file)\n else:\n # for python 3:\n # has read() method for:\n # io.IOBase\n # io.BytesIO\n # io.Strin...
[ "0.7632552", "0.71362424", "0.6969902", "0.6960444", "0.6951221", "0.6930327", "0.6919381", "0.691638", "0.688917", "0.6888178", "0.683486", "0.67828417", "0.66091996", "0.66070116", "0.6603137", "0.6542781", "0.6523632", "0.6514912", "0.6508364", "0.6504222", "0.6476494", ...
0.764774
0
return a APIFile object
def getFile(self, resource): resource = self.parseUrl(resource, 'files') res = self.getRequest(resource) fObj = vsdModels.File(**res) return fObj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_api():\n return get_api_client(cloudsmith_api.FilesApi)", "def __init__(self, api=None):\n self.file = open(OUTPUT_FILE, \"w\")", "def api(self) -> \"FilebaseApi\": # noqa: F821\n return self._api", "def file(self):\n file = BytesIO(b\"the_file\")\n file.name = \"the...
[ "0.6897276", "0.67225176", "0.67204946", "0.6646939", "0.6549329", "0.65173244", "0.64367795", "0.6433195", "0.6359759", "0.6332976", "0.63315344", "0.6300249", "0.62832355", "0.62466896", "0.6133988", "0.6125135", "0.6124198", "0.6111793", "0.6099367", "0.608178", "0.6079432...
0.6917533
0
return a list of file objects contained in an object
def getObjectFiles(self, obj): filelist = list() fileurl = 'objects/{0}/files'.format(obj.id) fl = self.iterateAllPaginated(fileurl) for f in fl: res = self.getFile(f['selfUrl']) filelist.append(res) return filelist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFilesFromObjectList(self, objects):\n file_list = []\n for obj in objects:\n gen = self.driver.download_object_as_stream(obj)\n file_as_bytes = next(gen)\n file_list.append(file_as_bytes)\n\n return file_list", "def get_object_list(self, url):\n ...
[ "0.7284186", "0.72739387", "0.7017978", "0.6976794", "0.6942861", "0.6841341", "0.68174464", "0.6669899", "0.6669899", "0.6669899", "0.6666729", "0.65921056", "0.65770656", "0.65490675", "0.654181", "0.6455588", "0.643071", "0.63409305", "0.6301331", "0.6297293", "0.6258359",...
0.7972586
0
Extract VSDID and selfUrl of the related Object Version of the file after file upload
def fileObjectVersion(self, data): # data = json.loads(data) f = data['file'] obj = data['relatedObject'] fSelfUrl = f['selfUrl'] return obj['selfUrl'], self.getOID(obj['selfUrl'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.id = 0\n self.file_name = \"\"\n self.content_type = \"\"\n self.versions = []\n self.folder = Folder()\n self.url = \"\" \n\n self.upload_doc = []\n self.description = \"\" \n self.tags = \"\" \n self.notify = 0", "...
[ "0.5735021", "0.5663863", "0.56068516", "0.54852545", "0.540756", "0.5406285", "0.5368167", "0.53607047", "0.5351831", "0.53350747", "0.532876", "0.53284246", "0.53054315", "0.52892995", "0.5285639", "0.5279972", "0.5256943", "0.5255613", "0.52548236", "0.52423656", "0.522781...
0.7820019
0
retrieve the unpublished objects as list of APIObject
def getAllUnpublishedObjects(self, resource='objects/unpublished'): objects = list() for item in self.iterateAllPaginated(resource, vsdModels.APIObject): obj = self.getObject(item.selfUrl) objects.append(obj) return objects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getObjects(self, idList=None):\n\n if idList is None:\n idList = ''\n if idList in ['', 'published', 'unpublished']:\n return self.iterateAllPaginated('objects/%s' % idList, func=vsdModels.APIObject._create)\n\n items = []\n for curId in idList:\n it...
[ "0.6346986", "0.6099099", "0.6057543", "0.6032295", "0.59707284", "0.5960054", "0.5935628", "0.5934386", "0.5924819", "0.58518374", "0.5846364", "0.58338064", "0.58148676", "0.57930326", "0.57917947", "0.5777385", "0.57490057", "0.57436234", "0.5725297", "0.56734204", "0.5673...
0.7804396
0
searches the list of unpublished objects and returns the newest object
def getLatestUnpublishedObject(self): res = self.getRequest('objects/unpublished') if len(res['items']) > 0: obj = self.getObject(res['items'][0].get('selfUrl')) return obj else: print('you have no unpublished objects') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_post(self):\r\n try:\r\n return self.post_set.latest('post_date')\r\n except Post.DoesNotExist:\r\n return None", "def last(self):\n if self.ordered:\n queryset = self.reverse()\n else:\n self._check_ordering_first_last_queryset_a...
[ "0.618301", "0.6064789", "0.5991853", "0.59184533", "0.59038097", "0.58988184", "0.5764467", "0.5684088", "0.5681222", "0.567747", "0.56429756", "0.56429476", "0.56047225", "0.55762416", "0.5576162", "0.5562956", "0.55388516", "0.551964", "0.5508075", "0.54976684", "0.5492313...
0.7785084
0
return a list of folder object contained in a folder
def getContainedFolders(self, folder): folderlist = list() if folder.childFolders: for fold in folder.childFolders: basic = vsdModels.APIBase(**fold) f = self.getFolder(basic.selfUrl) folderlist.append(f) return folderlist ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ListFolder(self, path): # real signature unknown; restored from __doc__\n pass", "def listFolders(folderRoot):\n return os.listdir(folderRoot)", "def list_folder(dbx, folder, subfolder):\r\n path = '/%s/%s' % (folder, subfolder.replace(os.path.sep, '/'))\r\n while '//' in path:\r\n p...
[ "0.78207153", "0.7440853", "0.7422651", "0.7340798", "0.7334856", "0.73109907", "0.7310674", "0.72149456", "0.71660143", "0.71307665", "0.712432", "0.7052318", "0.7007686", "0.697091", "0.6951473", "0.6949417", "0.6946215", "0.69262725", "0.6921022", "0.6894899", "0.6889431",...
0.7561675
1
retrieve a list of modalities objects (APIModality)
def getModalityList(self): modalities = list() modalities = list(self.iterateAllPaginated('modalities'), vsdModels.Modality) return modalities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_modalities(self, client_id):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT m.* \r\n FROM CLIENT_MODALITY AS cm\r\n JOIN MODALITY AS m ON cm.modality_id=m.id\r\n WHERE cm.client_id={}\"\"\".form...
[ "0.66782856", "0.6570258", "0.5710376", "0.5457667", "0.54282176", "0.538596", "0.5384188", "0.5356139", "0.5300874", "0.5298627", "0.5254213", "0.5237381", "0.52334994", "0.5227232", "0.52123344", "0.5209616", "0.5209478", "0.5192843", "0.51361936", "0.51336956", "0.5115998"...
0.75061184
0
retrieve a modalities object (APIModality)
def getModality(self, resource): resource = self.parseUrl(resource, 'modalities') res = self.getRequest(resource) return vsdModels.Modality(**res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_modalities(self, client_id):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT m.* \r\n FROM CLIENT_MODALITY AS cm\r\n JOIN MODALITY AS m ON cm.modality_id=m.id\r\n WHERE cm.client_id={}\"\"\".form...
[ "0.64560014", "0.63513154", "0.5551539", "0.5281688", "0.5161464", "0.50686157", "0.50573426", "0.5001412", "0.48889267", "0.48715913", "0.47732472", "0.47575238", "0.47572672", "0.4751382", "0.47457725", "0.47272426", "0.47203636", "0.47049737", "0.47049737", "0.47049737", "...
0.76320595
0
Retrieve an ontology item object (APIOntology)
def getOntologyItem(self, resource, oType=0): if isinstance(resource, int): resource = 'ontology/{0}/{1}'.format(resource, oType) res = self.getRequest(resource) onto = vsdModels.Ontology(**res) return onto
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ontology(base_iri='emmo-inferred.owl', verbose=False, name=None):\n\n if (not base_iri.endswith('/')) and (not base_iri.endswith('#')):\n base_iri = '%s#'%base_iri\n if base_iri in default_world.ontologies:\n onto = default_world.ontologies[base_iri]\n else:\n onto = MyOntology(default_world, b...
[ "0.62648773", "0.61448085", "0.6022093", "0.5892326", "0.56354654", "0.55691826", "0.55053633", "0.5482119", "0.5480763", "0.54797596", "0.5454518", "0.5449672", "0.54465944", "0.5425294", "0.5413002", "0.5405129", "0.53786016", "0.5373754", "0.5367159", "0.533208", "0.533208...
0.7689067
0
retrieve a list of the available licenses (License)
def getLicenseList(self): res = self.getRequest('licenses') licenses = list() if res: for item in iter(res['items']): lic = vsdModels.License(**item) licenses.append(lic) return licenses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_licenses(licenses):\n #print(\"Available licenses:\\n\")\n for license in licenses:\n print(\"{0}: {name} {ver} ({url})\".format(license, **licenses[license]))", "def licenses(self) -> Sequence[str]:\n return pulumi.get(self, \"licenses\")", "def list(logger, client):\n logger.i...
[ "0.8148514", "0.804869", "0.8045838", "0.77339166", "0.7700894", "0.7651444", "0.7569039", "0.7470753", "0.74475163", "0.7332718", "0.719196", "0.7012625", "0.6985721", "0.68097776", "0.6782339", "0.663189", "0.662744", "0.6576966", "0.6506075", "0.64953965", "0.64143324", ...
0.8437527
0
retrieve a license (License)
def getLicense(self, resource): if isinstance(resource, int): resource = 'licenses/{0}'.format(resource) res = self.getRequest(resource) if res: license = vsdModels.License(**res) return license else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_license(self) -> APIReturn:\n return await self._request(\"GET\", \"/getLicense\")", "def license(self): # noqa: A003\n logger.debug(\"Get license\")\n return self._raw_api.license.get()", "def get_license():\n repo_fs()\n return LICENSE", "def License(self, default=...
[ "0.83791554", "0.80421203", "0.76620686", "0.7393601", "0.73816514", "0.7251297", "0.71648616", "0.7025995", "0.700755", "0.6947478", "0.6830355", "0.6815448", "0.6798157", "0.67863375", "0.67857665", "0.6733599", "0.67113596", "0.66986835", "0.6637599", "0.6557392", "0.65526...
0.81830335
1
retrieve a list of the available base object rights (ObjectRight)
def getObjectRightList(self): res = self.getRequest('object_rights') permission = list() if res: for item in iter(res['items']): perm = vsdModels.ObjectRight(**item) permission.append(perm) return permission
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rights(self):\n return [right.right_id for right in self.rights if right]", "def getObjectUserRights(self, obj):\n\n rights = None\n if obj.objectUserRights:\n rights = list()\n for item in obj.objectUserRights:\n res = self.getRequest(item['selfU...
[ "0.712786", "0.7089831", "0.6917758", "0.67858636", "0.6594029", "0.62074476", "0.61338055", "0.60746765", "0.5999794", "0.5987924", "0.5983283", "0.587646", "0.5756844", "0.5732203", "0.5574732", "0.5502778", "0.5482969", "0.543072", "0.5401567", "0.53698283", "0.5358535", ...
0.7633075
0
retrieve a object rights object (ObjectRight)
def getObjectRight(self, resource): if isinstance(resource, int): resource = 'object_rights/{0}'.format(resource) res = self.getRequest(resource) if res: perm = vsdModels.ObjectRight(**res) return perm else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getObjectRightList(self):\n\n res = self.getRequest('object_rights')\n permission = list()\n\n if res:\n for item in iter(res['items']):\n perm = vsdModels.ObjectRight(**item)\n permission.append(perm)\n\n return permission", "def getObject...
[ "0.7037815", "0.69113785", "0.66132474", "0.6478508", "0.6354705", "0.6263067", "0.6187105", "0.611192", "0.598026", "0.5911036", "0.58837354", "0.58593535", "0.5843691", "0.58032084", "0.5797323", "0.57955974", "0.57886785", "0.5736882", "0.5734178", "0.5722555", "0.57138735...
0.8109306
0
get the list of attaced group rights of an object
def getObjectGroupRights(self, obj): rights = None if obj.objectGroupRights: rights = list() for item in obj.objectGroupRights: res = self.getRequest(item['selfUrl']) right = vsdModels.ObjectGroupRight() right.set(obj=res) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_permissions(self, obj=None):\n pass", "def get_group_permissions (self):\n return [] # likewise with the other permission defs", "def get_group_permissions (self):\n return [] # likewise with the other permission defs", "def get_group_permissions(self, user_obj, obj=None):\...
[ "0.7341937", "0.6864114", "0.6864114", "0.6740766", "0.653664", "0.65130913", "0.64812547", "0.6477055", "0.6389794", "0.6374435", "0.63620865", "0.63197297", "0.6318735", "0.62682337", "0.62379545", "0.6199528", "0.6196616", "0.6179769", "0.6166244", "0.6160722", "0.6146359"...
0.7447492
0
get the list of attaced user rights of an object
def getObjectUserRights(self, obj): rights = None if obj.objectUserRights: rights = list() for item in obj.objectUserRights: res = self.getRequest(item['selfUrl']) right = vsdModels.ObjectUserRight() right.set(obj=res) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getObjectRightList(self):\n\n res = self.getRequest('object_rights')\n permission = list()\n\n if res:\n for item in iter(res['items']):\n perm = vsdModels.ObjectRight(**item)\n permission.append(perm)\n\n return permission", "def get_all_p...
[ "0.70506513", "0.7044817", "0.674412", "0.66550535", "0.6582285", "0.6538706", "0.6514556", "0.6497708", "0.6424469", "0.64219844", "0.6406456", "0.6349164", "0.6313921", "0.6273566", "0.62652504", "0.62258893", "0.6195123", "0.6189146", "0.61542296", "0.6152912", "0.6149175"...
0.73595506
0
the permission defined in userRights or groupRights are pushed to the Database
def postObjectRights(self, obj, target): if target == 'user': for item in obj.userRights: res = self.postRequest( 'object-user-rights', data=item.to_struct() ) else: for item in obj.groupRights: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpermissions(self, lvl):\n\n admingroup = Group.objects.get(name=self.comicsite.admin_group_name())\n participantsgroup = Group.objects.get(name=self.comicsite.participants_group_name())\n everyonegroup = Group.objects.get(name=\"everyone\")\n\n\n\n self.persist_if_needed()\n ...
[ "0.65527606", "0.6091564", "0.6077611", "0.60715884", "0.60538054", "0.6032868", "0.6027165", "0.5958302", "0.594668", "0.5945888", "0.58827436", "0.5875304", "0.58493745", "0.5833792", "0.58064276", "0.5803476", "0.57993937", "0.57962805", "0.57857287", "0.5753586", "0.57360...
0.62362343
1
add an object link
def addLink(self, obj1, obj2): link = vsdModels.ObjectLink(object1=obj1, object2=obj2) link.validate() return self.postRequest('object-links', data=link.to_struct())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_link(self, link):\n raise NotImplementedError", "def link(self, link):\n\n self.container['link'] = link", "def add_object(self, obj):\n\t\tself.objects.append(obj)", "def add_link(self, **kwgs):\n self.links.append(kwgs)", "def add_link():\n return True", "def add_link(se...
[ "0.75428367", "0.71409744", "0.70418257", "0.70363736", "0.69445634", "0.691815", "0.68548703", "0.6738741", "0.67250776", "0.67101526", "0.6686237", "0.6653033", "0.66132724", "0.65916646", "0.65824544", "0.6576468", "0.6567573", "0.65630406", "0.65486926", "0.6502428", "0.6...
0.79535985
0
creates the folders based on the filepath if not already existing, starting from the rootfolder
def createFolderStructure(self, rootfolder, filepath, parents): fp = filepath.resolve() folders = list(fp.parts) folders.reverse() ##remove file from list if fp.is_file(): folders.remove(folders[0]) for i in range(parents, len(folders)): folders....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_folder(file_path):\r\n file_base = os.path.dirname(file_path)\r\n if not os.path.exists(file_base):\r\n try:\r\n os.makedirs(file_base)\r\n except OSError as e:\r\n if e.errno != errno.EEXIST:\r\n raise", "def make_folders(path):\n path = ex...
[ "0.731695", "0.725792", "0.72279733", "0.703249", "0.6936954", "0.6924302", "0.6894177", "0.67963517", "0.679626", "0.6765007", "0.67557585", "0.6746403", "0.67418563", "0.67418563", "0.67203724", "0.6714765", "0.6702095", "0.6700762", "0.6693856", "0.66250753", "0.6620848", ...
0.74823
0
The function gets a evenlengthed list. The function returns a string that contains the list elements in the even indices seperated by comma and space, and the last element with 'and' before it.
def format_list(my_list): return ", ".join(my_list[::2]) + (" and " + my_list[-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_list(my_list):\n \n new_list = my_list[2: -1]\n new_list = new_list[: : 2]\n new_list = [my_list[0]] + new_list\n new_list = new_list + [\"and \" + my_list[-1]]\n \n string = ', '.join(new_list)\n print(string)", "def splitOddEven(barcode):\r\n oddstring=''\r\n evenstring...
[ "0.6412524", "0.61935115", "0.61223555", "0.6063723", "0.6032353", "0.59142214", "0.58411044", "0.58024925", "0.57419395", "0.57343924", "0.5701189", "0.5639615", "0.56252486", "0.56207967", "0.56192833", "0.5612589", "0.5568677", "0.55552465", "0.55198985", "0.5503945", "0.5...
0.6621036
0
Speed Creation domainsList eg. domainsList = {
def Create(self, domainsList) : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dos_create_service_domain_list(self):\n # create a huge list of domain\n self.reset_defaults()\n for k in range(1, 30000):\n self.domain_list.append({\"domain\": \"w.t%s.com\" % k})\n\n # send MAX_ATTEMPTS requests\n for k in range(1, self.MAX_ATTEMPTS):\n ...
[ "0.7218668", "0.7067372", "0.6945346", "0.66760194", "0.6622009", "0.6552269", "0.63571876", "0.6346421", "0.6265136", "0.6249274", "0.61284405", "0.6120937", "0.6116728", "0.6115618", "0.6064757", "0.6048518", "0.6038209", "0.5990459", "0.5946945", "0.59090585", "0.58821195"...
0.77564573
0
Set domains list domainsList
def SetDomainsList(self, domainsList) : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domains(self, domains):\n\n self._domains = domains", "def set_search_domains(self, hSearchDomainsList):\n\t\tcall_sdk_function('PrlVmCfg_SetSearchDomains', self.handle, conv_handle_arg(hSearchDomainsList))", "def set_search_domains(self, hSearchDomainsList):\n\t\tcall_sdk_function('PrlVmDevNet_SetS...
[ "0.75513875", "0.72079676", "0.71593475", "0.6790948", "0.63841087", "0.6356782", "0.63379514", "0.62171674", "0.61697847", "0.6081243", "0.6076982", "0.59963924", "0.5991392", "0.59268284", "0.5923071", "0.58900553", "0.5889306", "0.58590835", "0.5848813", "0.584483", "0.581...
0.90291613
0
Evaluate the substituted equations for a set of variables 'var'=gLambda at coupling constant g
def evaluate(self,var,g=None): if (g==None):g=self.g assert(len(var)==self.n) res=np.zeros(self.n+1) for i in range(self.n): res[i]=var[i]**2+2.*var[i]-self.N*(self.n-self.N)*g**2*self.gamma-g*np.sum([self.XXZ.Z(i,j)*(var[i]-var[j]) for j in range(self.n) if j!=i]) res[self.n]=np.sum(var)+2.*s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Lambda_g(self):\n self.setUp()\n tmp = np.arange(1, 49).reshape(3, 2, 4, 2)\n g1 = np.broadcast_to(tmp[..., None], tmp.shape + (2,)).swapaxes(1, -1)\n f = .02 * np.arange(1, 25).reshape(3, 2, 4)\n Lambda_g1 = self.E_func.Lambda_g(g1, f)\n Lambda_g1_ = np.array([[0...
[ "0.6032315", "0.59267586", "0.5891226", "0.5854001", "0.5850733", "0.57926357", "0.57749236", "0.5763364", "0.5717151", "0.5703841", "0.5696219", "0.5679694", "0.5676101", "0.5646024", "0.5606608", "0.5584366", "0.55506504", "0.55449533", "0.55319333", "0.55283713", "0.552602...
0.665985
0
Calculate the Jacobian for the set of nonlinear equations for a set of variables 'var' at coupling constant g
def jacobian(self,var,g=None): if (g==None):g=self.g jac=np.zeros([self.n+1,self.n]) for i in range(self.n): for j in range(self.n): if(i==j): jac[i][j]=2.*(var[i]+1.)-g*np.sum([self.XXZ.Z(i,k) for k in range(self.n) if k!=i]) else: jac[i][j]=g*self.XXZ.Z(i,j) for i in range(self.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobian_g(self, x, out=None, **kwargs):\n return self._base_nlp.jacobian_d(x, out=out)", "def jacobian_numba(coordinates, points, jac, greens_function):\n east, north, upward = coordinates[:]\n point_east, point_north, point_upward = points[:]\n for i in prange(east.size):\n for j in ...
[ "0.68869615", "0.6872691", "0.6812956", "0.67845374", "0.67837775", "0.6703014", "0.65997356", "0.6577793", "0.6561505", "0.64711225", "0.6469743", "0.6467769", "0.64675164", "0.64600825", "0.64172935", "0.64127475", "0.6284378", "0.6281795", "0.62582254", "0.62582254", "0.62...
0.8245887
0
Taylor expansion of the variables at coupling constant g_temp to g_temp+g_step, solves a set of linear equations for the derivatives
def taylor_expansion(self,g_temp,g_step,var): A=np.zeros([self.n+1,self.n]) for i in range(self.n): A[self.n][i]=1 for j in range(self.n): if(i==j): A[i][j]=2.*var[i]+2.+g_temp*np.sum([self.XXZ.Z(k,i) for k in range(self.n) if k!=i]) else: A[i][j]=-g_temp*self.XXZ.Z(j,i) #First d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def taylor_exp_3(y0, t, f, jac, hess, df_dt=None, d2f_dt2=None, d2f_dtdu=None, verbose=True, krylov_subspace_dim=None,\n **_):\n try:\n n, d = len(t), len(y0)\n y = np.zeros((n, d))\n except TypeError:\n n, d = len(t), 1\n y = np.zeros((n,))\n if verbose is Fals...
[ "0.6420513", "0.6404558", "0.63731045", "0.6150823", "0.6085563", "0.5920966", "0.58915144", "0.57942736", "0.5757926", "0.57549196", "0.5738749", "0.5736298", "0.5723483", "0.5695296", "0.56188375", "0.5611098", "0.5603462", "0.554219", "0.55353177", "0.55290955", "0.5515724...
0.8345397
0
NewtonRaphson method for solving the equations iteratively at fixed coupling constant
def newtonraphson(self,g_temp,var_init): n_step=0 error=np.linalg.norm(self.evaluate(var_init,g_temp)) while (error > 1e-12 and n_step < 50): #Improve solution while error is too large and the number of steps does not exceed a limit J_inv=np.linalg.pinv(self.jacobian(var_init,g_temp)) var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newton_raphson(f,x0,iterations): \n current = x0\n fdash = differentiate_polynomial(f)\n print(fdash)\n for i in range(iterations): \n current = current - evaluate_polynomial(f,current)/evaluate_polynomial(fdash,current)\n return current", "def my_Newton( fct, df_dx, x0):\r\n xn...
[ "0.75901395", "0.72022825", "0.70756906", "0.7065068", "0.6972108", "0.6962475", "0.6933637", "0.68662655", "0.6858316", "0.6854925", "0.68258876", "0.68225884", "0.67929447", "0.67292964", "0.6726125", "0.6693297", "0.6690442", "0.66554135", "0.66542137", "0.6627791", "0.662...
0.7456614
1
Solve the equations iteratively starting from the weakcoupling limit Weakcoupling limit approximation at g=g_init, increases in steps g_steps untill g_fin is reacher evol=True returns the solutions at each value of g movingGrid=True calculates the rapidities (can be slow)
def solve(self,init=None,g_init=1e-3,g_step=5e-3,g_fin=None,evol=False,movingGrid=False): if(g_fin==None): g_fin=self.g #Check if all signs are correct if(g_fin<0): if(g_step>0): g_step*=-1. if(g_init>0): g_init*=-1. else: if(g_step<0): g_step*=-1. if(g_init<0): g_step*=-1. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(\n self,\n projections: Projections,\n initial_squad: Squad,\n next_gw: int = None,\n force_chips: Dict[int, str] = None,\n force_players: Dict[str, list] = None,\n force_transfers: Dict[int, dict] = None,\n price_cha...
[ "0.6709253", "0.6684995", "0.66322875", "0.66319263", "0.6578014", "0.65271807", "0.6505981", "0.6505981", "0.65038013", "0.6477246", "0.64529824", "0.6394935", "0.6360995", "0.6255382", "0.622708", "0.6225847", "0.62110275", "0.6203672", "0.6184578", "0.617959", "0.6112065",...
0.73474497
0
Check a collision between this collider and a circle_collider
def __circle_collision(self, circle): raise Exception('--- This methods have not been implemented yet! Use circle_collider instead ---')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collide(b1,b2):\n if mag(b1.pos-b2.pos) < (b1.radius + b2.radius - .05):\n return True", "def circles_collide(x1: float, y1: float, r1: float, x2: float, y2: float, r2: float) -> bool:\n return distance_between_sq(x1, y1, x2, y2) <= (r1 + r2)**2", "def collide(self, pos):\n\t\tpass", "def co...
[ "0.72852224", "0.722615", "0.7212075", "0.71784496", "0.71547246", "0.7051162", "0.70509756", "0.7047996", "0.6977463", "0.69646543", "0.69488585", "0.6932847", "0.6904241", "0.68944705", "0.6884977", "0.68361413", "0.67926204", "0.6744885", "0.6744648", "0.67329663", "0.6713...
0.8406119
0
Check a collision between this collider and a polygon_collider
def __polygon_collision(self, polygon): raise Exception('--- This methods have not been implemented yet! Use circle_collider instead ---')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_collide(self):\r\n for raindrop in self.overlapping_sprites:\r\n raindrop.handle_collide()", "def collide(self, x, y):\n return self._rect.collidepoint(x, y)", "def check_collide(self):\n\n\t\tfor pizza in self.overlapping_sprites:\n\t\t\tpizza.handle_collide()", "def handl...
[ "0.66050434", "0.6576733", "0.6543093", "0.65242314", "0.65103084", "0.6486815", "0.64661604", "0.64578265", "0.64428675", "0.6434337", "0.6418962", "0.6396551", "0.63414603", "0.63292813", "0.6323187", "0.63230956", "0.6286891", "0.62583", "0.62581766", "0.62557834", "0.6242...
0.82957095
0
Read in cluster list as pandas dataframe
def get_cluster_list(): cluster_list_command = ["pcluster", "list", "--region", AWS_REGION] cluster_list_returncode, cluster_list_stdout, cluster_list_stderr = run_subprocess_proc(cluster_list_command, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_cluster(self):", "def cluster_list_table_format(result):\n table = []\n for item in result:\n table.append(cluster_show_table_format(item))\n return table", "def matching_clusterization(self):\n result = []\n self.reclustering(self.groups.copy(deep=True), result)\n ...
[ "0.5922096", "0.5827965", "0.5815109", "0.5805391", "0.58024824", "0.5776842", "0.57016134", "0.5682666", "0.56633455", "0.56253135", "0.56154746", "0.5537989", "0.5537647", "0.55322796", "0.5515195", "0.5497974", "0.5487741", "0.5484938", "0.5480415", "0.54707307", "0.546099...
0.6281922
0
Retrieve the Creator tag from the master instance id tags
def get_creator_tag(master_id): resource = boto3.resource("ec2") ec2instance = resource.Instance(master_id) # Check "tags" is an attribute of the instance. if getattr(ec2instance, "tags", None) is None: return None # Iterate through the list of tags for tag in ec2instance.tags: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_creator_for_instance(self, instance_id):\n return self.get_tag_for_instance(instance_id, 'Creator')", "def creator(self) -> str:\n return pulumi.get(self, \"creator\")", "def creator(self) -> str:\n return pulumi.get(self, \"creator\")", "def creator(self):\n return self._...
[ "0.727921", "0.6220973", "0.6220973", "0.6158549", "0.6158549", "0.5853644", "0.58088547", "0.5783263", "0.5765727", "0.5744853", "0.5724607", "0.57190967", "0.5616335", "0.55406326", "0.55125874", "0.55059767", "0.54770386", "0.5471709", "0.54610825", "0.5422734", "0.5403569...
0.8312702
0
Print the dataframe of available clusters
def print_df(cluster_df): import sys cluster_df.to_string(sys.stdout, index=False, header=True) # Print an empty line to finish print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_clusters(self):\n cluster_ids = [\n self.controller.cluster and self.controller.cluster['id']\n ]\n self.print_list(\n ('id', 'name', 'status'), self.controller.get_clusters(),\n lambda x: cluster_ids.index(x['id'])\n )", "def show(self, noteb...
[ "0.71907526", "0.6780652", "0.6763549", "0.6645736", "0.66420937", "0.6566875", "0.650947", "0.64789224", "0.6474507", "0.6408008", "0.6339435", "0.62509495", "0.6243073", "0.6203789", "0.6188357", "0.61372566", "0.6129242", "0.61056006", "0.61003476", "0.60922045", "0.608077...
0.72072905
0
From the cluster list collect the id of the head node, given the pcluster has completed
def get_headnode_from_pcluster_row(pd_series): if pd_series['Status'] in CFN_STATUSES["completed"]: return get_master_ec2_instance_id_from_pcluster_id(pd_series["Name"]) return np.nan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getClusterVmNextId(self):\n data = self.connect('get','cluster/nextid',None)\n return data", "def loadHeadId(self):\n rec = self.db.selectById(self.tableName, 1)\n if rec:\n self.headId = rec['childId']\n return self.headId\n print('Error! No first sub...
[ "0.65144104", "0.58564246", "0.5826293", "0.57110935", "0.57000333", "0.56768346", "0.56768346", "0.56768346", "0.56768346", "0.5641271", "0.5636543", "0.56087506", "0.5573553", "0.5545308", "0.55144787", "0.54887104", "0.5468036", "0.5468036", "0.5468036", "0.5468036", "0.54...
0.66679394
0
Calculate theta based on the current word/topic assignments.
def theta_topic(self): f1 = self.ndk+self.alpha f2 = np.sum(self.ndk, axis=1, keepdims=True)+self.nTopics*self.alpha return f1/f2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theta(self):\n self.eigenvalues()", "def theta():\n pass", "def assign_value_to_theta(self, sess):\n import tensorflow as tf\n\n assert self.initialised, \"This model must be initialised (self.initialisation()).\"\n\n keys = sorted(self.variables.keys())\n keys = [ key...
[ "0.66956997", "0.6611424", "0.64778316", "0.6310948", "0.6310948", "0.62044585", "0.60539144", "0.5939173", "0.5927611", "0.5864055", "0.5863997", "0.5862854", "0.5859326", "0.58344203", "0.5759381", "0.57539654", "0.5736971", "0.57292384", "0.5688546", "0.56844264", "0.56480...
0.71368414
0
Calculate phi based on the current word/topic assignments.
def phi_topic(self): f1 = self.nkw+self.beta f2 = np.sum(self.nkw, axis=1, keepdims=True)+self.VT*self.beta return f1/f2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi(self):\n if self._phi is None:\n self._phi = self.phi0 + 2*self.resamp*self.distributions.uniform(-0.5, 0.5)\n return self._phi", "def phi(self):\n if self._phi is None:\n self._phi = self.phi0 + self.distributions.uniform(-1, 1) * self.resamp\n return se...
[ "0.6896222", "0.6847485", "0.67891663", "0.66557586", "0.6577817", "0.6482565", "0.625704", "0.625704", "0.6252444", "0.62167186", "0.62102365", "0.61620206", "0.59927046", "0.59645325", "0.5960944", "0.59219116", "0.5886697", "0.5875844", "0.5862109", "0.5846129", "0.5827925...
0.7683339
0
Print topics and associated opinions. The top words and weights are printed.
def print_topics_and_opinions(self, top=10): for i in range(self.nTopics): print u'Topic {}: {}'. \ format(i, self.print_topic(self.topics.loc[:, i].copy(), top)) print for p in range(self.nPerspectives): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_topics(self, num_topics=10, num_words=10):\n\n topic_modeler = LatentDirichletAllocation(n_topics=num_topics, learning_method='online')\n\n topic_modeler.fit(self.comments_vectorized)\n\n word_list = self.vectorizer.get_feature_names()\n\n for topic_number, topic in enumerate(...
[ "0.76025414", "0.7457827", "0.71928906", "0.695014", "0.69406545", "0.6867727", "0.6830164", "0.67960405", "0.67719203", "0.6601551", "0.6544563", "0.65309024", "0.6502598", "0.6470318", "0.6402206", "0.63069516", "0.62976444", "0.62757355", "0.622309", "0.6159452", "0.612707...
0.82016975
0
To fetch list of axes.text for values.
def get_value_texts(self): return self.value_texts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_texts(self, name, text_key=None, axis_edit=None):\n return self._get_valuemap(name, 'texts', text_key, axis_edit)", "def axesNames(self, data, info):\n return []", "def get_data(self):\n return [self.axes]", "def values(cls) -> t.List[t.Union[str, NameTitle]]:\n return l...
[ "0.72078097", "0.6636069", "0.635647", "0.62667525", "0.61955905", "0.6176036", "0.61550343", "0.60656846", "0.6057318", "0.6034372", "0.6009947", "0.60059285", "0.5977157", "0.5959997", "0.5949789", "0.59454685", "0.59388447", "0.59383094", "0.59039736", "0.58950335", "0.588...
0.71309286
1
To fetch list of axes.text for comparisonvalues.
def get_compare_value_texts(self): return self.compare_value_texts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def axesNames(self, data, info):\n return []", "def get_value_texts(self):\n return self.value_texts", "def value_texts(self, name, text_key=None, axis_edit=None):\n return self._get_valuemap(name, 'texts', text_key, axis_edit)", "def axesnames(self):\n return self._axesnames", ...
[ "0.66068846", "0.6176891", "0.60335445", "0.602217", "0.59022635", "0.5866322", "0.5859791", "0.5807858", "0.5799165", "0.57758737", "0.573451", "0.56957084", "0.56816286", "0.5662143", "0.5635967", "0.56228346", "0.5589806", "0.5581521", "0.55531543", "0.5527119", "0.5525091...
0.6764697
0
Method that returns the document's text with inline annotated entities.
def annotated_text_(self): cur_annotation_idx = 0 text_idx = 0 annotated_line = "" while cur_annotation_idx < len(self.annotations): # Iteratively append chunks of text plus the annotation. cur_annotation = self.annotations[cur_annotation_idx] annotate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text():\n return {\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n \"type\": \"Annotation\",\n \"body\": {\n \"creator\": \"user\",\n \"type\": \"TextualBody\",\n \"value\": \"string\"\n },\n \"generator\": {\n \"homepage...
[ "0.6507757", "0.64337516", "0.63814616", "0.63080055", "0.6208468", "0.61557955", "0.6154789", "0.6103356", "0.6087257", "0.6081146", "0.608023", "0.60686827", "0.6052397", "0.60248005", "0.6019707", "0.60034186", "0.596998", "0.5962832", "0.5953897", "0.59334487", "0.5932522...
0.6929426
0
Exponentially decay `param` by `decay_factor` iff it's above `min_val`.
def exponential_decay(param: float, decay_factor: float, min_val: float) -> float: if param > min_val: param *= decay_factor param = max(param, min_val) return param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_exp_decay(x, y):\n def _func(z, z0):\n return np.exp(-z/z0)\n popt, pcov = curve_fit(_func, x, y)\n return popt[0]", "def decay(time_, max_time, coeff):\n threshold = max_time - time_\n if threshold < 0:\n threshold = 0\n return 1 + threshold * coeff / max_time", "def _g...
[ "0.58101505", "0.5791618", "0.57722825", "0.5735606", "0.56865597", "0.5681912", "0.56657505", "0.55780464", "0.5535104", "0.5507767", "0.5490597", "0.5479432", "0.5427863", "0.537628", "0.5362313", "0.53506184", "0.5341741", "0.53301334", "0.5326169", "0.53009635", "0.529676...
0.8493756
0
Download the json for a thread
def download_json(self): # create directories for threads and images if they don't exist if not self.path.is_dir(): self.path.mkdir(parents=True) if not self.images_path.is_dir(): self.images_path.mkdir(parents=True) # open file, send request and write data to a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(self):\n api_call = f\"https://a.4cdn.org/{self.board}/thread/{self.id}.json\"\n # Custom header value is necessary to avoid 403 errors on 4chan.org\n # 4channel works just fine without\n req = Request(api_call, headers={'User-Agent': '4chan Archiver'})\n resp_json =...
[ "0.68326145", "0.6567181", "0.6303404", "0.6286296", "0.625388", "0.6248871", "0.61168677", "0.5906232", "0.5853302", "0.5809002", "0.5742326", "0.57400095", "0.5739581", "0.5739581", "0.570179", "0.5692709", "0.56374764", "0.5593317", "0.5567973", "0.555799", "0.555799", "...
0.758948
0
Download the images from a thread
def download_images(self): # download the json for the thread self.download_json() # open the json file with self.file.open('r', encoding="utf-8") as json_file: # load into data data = json.load(json_file) # grab the posts from posts = da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_images_jpg(self):\n self.show_as_waiting(True)\n self.download_images('JPEG')\n self.show_as_waiting(False)", "def download_images(pages):\n try:\n pool = Pool(conf.MAX_PROCESS)\n pool.map_async(get_image_from_page, pages)\n pool.close()\n pool.joi...
[ "0.7307015", "0.72446394", "0.7043487", "0.698779", "0.6949376", "0.69421124", "0.68793184", "0.6801221", "0.67547476", "0.6524939", "0.65117484", "0.64744747", "0.643315", "0.6393154", "0.6374442", "0.6373721", "0.6345761", "0.63369495", "0.63358384", "0.63280475", "0.632164...
0.79116493
0
Start the timing of the request time.
def start(): request.start = time.time()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\r\n self.start_time = time.time()", "def start(self):\n self.start_time = time.time()", "def start_timer(self):\n self.start_time = time.time()", "def _start_clock(self):\n self._start = time.time()", "def StartTimer(self):\n self._start_time = time.time()", "d...
[ "0.7720264", "0.75917804", "0.7528696", "0.7513407", "0.74317956", "0.74064845", "0.7377842", "0.7218977", "0.71554947", "0.71116245", "0.6987768", "0.6987768", "0.6854743", "0.6813835", "0.6813835", "0.6813835", "0.6813835", "0.6813835", "0.6800484", "0.67803353", "0.6761011...
0.7993334
0
End the timing of the request time, and insert the time into the page result.
def end(response): if isinstance(response.response, ClosingIterator): return response diff = time.time() - request.start del request.start if response.response: response.response[0] = response.response[0].replace('__EXECUTION_TIME__', '{:.3}'.format(diff)) response.headers["con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closer(response):\n response.out.write('</div><div class=\"footer\">')\n response.out.write('<b>%4f seconds</b></div>' % (time.time() - response.starttime))\n response.out.write('</body></html>')", "def process_response(self, request, response):\n if self.start_ts:\n query = {'ts':...
[ "0.64275336", "0.6084924", "0.5919839", "0.58820456", "0.5864094", "0.5850844", "0.58503205", "0.5823064", "0.5800993", "0.5710937", "0.5707425", "0.5688121", "0.5645215", "0.56425273", "0.5628307", "0.5564796", "0.5548687", "0.55467105", "0.5515172", "0.535992", "0.5357605",...
0.643744
0
(Open File for reading) > list of str Return a list containing every second line (with leading and trailing whitespace removed) in report, starting with the first line.
def every_second_line(report): f = report result = [] for line in f: result.append(line.strip()) f.readline()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fileLinesToList(filename) :\n o = []\n with open(filename, \"r\") as fi :\n for l in fi :\n if l.strip() != \"\" :\n o.append(l.strip())\n return o", "def readAllfromFile(self):\n with open(self._fname, 'r') as f:\n lines = f.readlines()\n ...
[ "0.61941373", "0.61434084", "0.5999291", "0.5984989", "0.5981414", "0.59720355", "0.5964615", "0.59289414", "0.5918693", "0.5912837", "0.5900002", "0.588699", "0.5880019", "0.5879181", "0.58216643", "0.58104074", "0.58020204", "0.5799684", "0.5735998", "0.5735638", "0.5734667...
0.79135364
0
Generador vecinos de un estado, todas las 2 permutaciones
def vecinos(self, estado): x = list(estado) for i, j in combinations(range(self.n), 2): self.swap(x, i, j) yield tuple(x) self.swap(x, i, j)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vecino_aleatorio(self, estado):\n vecino = list(estado)\n i, j = sample(range(self.n), 2)\n self.swap(vecino, i, j)\n return tuple(vecino)", "def generador_v(vector_n, constante):\n\n v = []\n\n for x in range(len(vector_n)):\n nv = vector_n[x] // constante # // = Di...
[ "0.66977173", "0.62305146", "0.614835", "0.5997338", "0.5979395", "0.5922358", "0.58675134", "0.57571846", "0.5755349", "0.5742527", "0.5703132", "0.5674635", "0.5651771", "0.5631324", "0.56215817", "0.5616803", "0.5615318", "0.5586805", "0.555398", "0.5532561", "0.553", "0...
0.74007934
0
Genera un vecino de un estado intercambiando dos posiciones en forma aleatoria.
def vecino_aleatorio(self, estado): vecino = list(estado) i, j = sample(range(self.n), 2) self.swap(vecino, i, j) return tuple(vecino)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vecinos(self, estado):\n x = list(estado)\n for i, j in combinations(range(self.n), 2):\n self.swap(x, i, j)\n yield tuple(x)\n self.swap(x, i, j)", "def generatePos(self):\n self.pos = np.zeros((self.num_points, 2), dtype='int32')\n self.pos[:, 1]...
[ "0.6281271", "0.62621206", "0.62401843", "0.610117", "0.60642004", "0.5911816", "0.5840506", "0.5826892", "0.57856935", "0.5774624", "0.57405335", "0.57052314", "0.56569535", "0.5637528", "0.56317884", "0.55818075", "0.55736655", "0.5528272", "0.5464983", "0.54622465", "0.545...
0.67458135
0