query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
HTTP POST Test with Exception
def test_execute_monitor_exception(): message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_MONITOR_GZIP_PAYLOAD) with aioresponses() as mocked: mocked.get( TestData.JOB_MONITOR_URL, status=400, body="Bad Request in Monitor Call" ) with pytest.raises(Excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_post(self):\n Parameters = Parameters()\n response = self.client.open(\n '/error',\n method='POST',\n data=json.dumps(Parameters),\n content_type='application/json')\n self.assert200(response,\n 'Response body is ...
[ "0.75437254", "0.7387431", "0.736382", "0.7348007", "0.73016965", "0.7252912", "0.72147363", "0.7153243", "0.7135948", "0.7082639", "0.70808214", "0.705094", "0.705094", "0.7047066", "0.70229554", "0.7001681", "0.6995351", "0.69787353", "0.69771814", "0.69677734", "0.6958202"...
0.0
-1
Test to Monitor completion of job with huge artifacts
def test_execute_monitor_job_huge_artifact(): response_queue = queue.Queue() message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_MONITOR_GZIP_PAYLOAD) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.get( TestData.JOB_MONITOR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_get_huge_artifact():\n writer = SimpleWriter()\n work_queue = asyncio.Queue()\n await work_queue.put(TestData.JOB_GET_PAYLOAD)\n worker = tower_api_worker.TowerApiWorker(TestData.config, writer, work_queue)\n headers = {\"Content-Type\": \"application/json\"}\n with aioresponses() ...
[ "0.7460174", "0.648365", "0.6319169", "0.62829", "0.61046445", "0.60778874", "0.6062635", "0.6027667", "0.59981215", "0.59329385", "0.59142697", "0.58336353", "0.578648", "0.57611513", "0.57514536", "0.57494694", "0.57489073", "0.5745268", "0.57376176", "0.5732172", "0.570298...
0.74507254
1
Test for login of registereduser login
def test_registered_user_login(self): with self.client: # user registration user_response = register_user(self) response_data = json.loads(user_response.data.decode()) self.assertTrue(response_data['Authorization']) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registered_user_login(self):\n # register a user\n register_user(self, 'some', 'name', 'another@gmail.com', 'aaaAAA111')\n\n # test logging in registered user\n with self.client:\n response = login_user(self, 'another@gmail.com', 'aaaAAA111')\n data = json...
[ "0.8033014", "0.79924464", "0.79399383", "0.7833724", "0.78017163", "0.776357", "0.77335507", "0.768851", "0.7668031", "0.76247084", "0.76179594", "0.7608495", "0.75539863", "0.7530908", "0.7530903", "0.7516616", "0.7508375", "0.7488602", "0.7488602", "0.7488602", "0.7488602"...
0.7430738
22
Test for logout before token expires
def test_valid_logout(self): with self.client: # user registration user_response = register_user(self) register_data = json.loads(user_response.data.decode()) self.assertTrue(register_data['Authorization']) self.assertEqual(user_response.status_code, 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logout_revoked(self):\n response = self.client.post('/api/v2/auth/logout',\n headers=self.attendant_headers)\n response = self.client.post('/api/v2/auth/logout',\n headers=self.attendant_headers)\n self.assertEqual(...
[ "0.73224264", "0.72580457", "0.7179649", "0.71175355", "0.7113218", "0.7037501", "0.7025664", "0.70066994", "0.69830745", "0.6964461", "0.6911445", "0.6872836", "0.6853069", "0.68352586", "0.6818367", "0.6812245", "0.67766047", "0.6758459", "0.6741717", "0.6737063", "0.673314...
0.676158
17
Augment the interpolation set by adding new vector(s). This assumes that, on entry, the polynomial is not yet fully quadratic. If this is the case, the current interpolation set (and the associated polynomial degree) are increased by the number of columns in Ynew and a new factorization of the (possibly shifted) matrix...
def bcdfo_augment_Y_(Ynew=None,Y=None,whichmodel=None,shift_Y=None,Delta=None,normgx=None,kappa_ill=None,*args,**kwargs): # varargin = cellarray(args) # nargin = 7-[Ynew,Y,whichmodel,shift_Y,Delta,normgx,kappa_ill].count(None)+len(args) n,p1=size_(Y,nargout=2) if ((p1 >= ((n + 1) * (n + 2)) / 2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolV(y, x, newX):\r\n \r\n num = len(x)\r\n #if (num != len(y)):\r\n #//System.out.println(\"Toolbox.interpolV(): Old x and y must be same length\"); \r\n \r\n newNum = len(newX)\r\n #//System.out.println(\"interpolV: newNum \" + newNum + \" num \" + num); \r\n #newY = [0....
[ "0.6011343", "0.5605805", "0.5562307", "0.538923", "0.5325173", "0.5251498", "0.52312356", "0.522136", "0.51995504", "0.51713395", "0.5146502", "0.5122603", "0.5117475", "0.50976837", "0.50853515", "0.50842124", "0.50712323", "0.50667757", "0.5019727", "0.5012882", "0.5003421...
0.54528296
3
Emulate the Unix socketpair() function on Windows.
def socketpair(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0): # We create a connected TCP socket. Note the trick with setblocking(0) # that prevents us from having to create a thread. lsock = socket.socket(family, type, proto) lsock.bind(('localhost', 0)) lsock.listen(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def socket_pair():\n # Connect a pair of sockets\n port = socket_any_family()\n port.bind((\"\", 0))\n port.listen(1)\n client = socket(port.family)\n client.setblocking(False)\n client.connect_ex((loopback_address(port), port.getsockname()[1]))\n client.setblocking(True)\n server = port...
[ "0.67273897", "0.6674087", "0.5924282", "0.57430905", "0.5705649", "0.5667401", "0.5635149", "0.55424136", "0.5499504", "0.5472787", "0.54423577", "0.54059166", "0.54048026", "0.5359836", "0.53251463", "0.5322048", "0.53046817", "0.525587", "0.5185227", "0.5182713", "0.515538...
0.68180084
0
Tarkistaa kaikki oleelliset tapahtumat
def check_events(self): for event in pygame.event.get(): if event.type == pygame.QUIT: exit() if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: position = pygame.mouse.get_pos() self.left_click(position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def mezclar_bolsa(self):", "def reemplaza_tildes(palabra):", "def ikkuna(nimi, x_data, y_data, syote, funktio):\n nimi = ik.luo_ali_ikkuna(\"Spektri\")\n kirjas...
[ "0.66290903", "0.66290903", "0.66290903", "0.66290903", "0.66290903", "0.6196184", "0.61950195", "0.6100757", "0.6034432", "0.58694726", "0.5865293", "0.5747163", "0.5708588", "0.5689027", "0.568327", "0.5661756", "0.56537765", "0.56498486", "0.56357914", "0.5532134", "0.5486...
0.0
-1
Palauttaa highscoretietokannasta tiedot 5 parhaasta tuloksesta
def get_highscores(self): return self.database.get_high_scores(self.difficulty)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "async def tamere(self):\n tamere = [\n \"Ta mère est tellement grosse que pour la voir entièrement, on doit reculer de trois pas.\",\n \"Ta m...
[ "0.6231922", "0.6231922", "0.6231922", "0.6231922", "0.6231922", "0.6194761", "0.60714495", "0.60562885", "0.58499557", "0.5778292", "0.5772574", "0.5732355", "0.5729384", "0.57130736", "0.56883514", "0.56848365", "0.5657802", "0.5620992", "0.561474", "0.5608902", "0.55778235...
0.0
-1
Poistaa kyseisen vaikeustason tulokset tietokannasta
def erase_scores(self): self.database.erase_scores(self.difficulty)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def pohyb(seznam_tahu, seznam_ovoce, tah,radky, sloupce):\n\n x= seznam_tahu [len(seznam_tahu)-1][0] # [x,y] souradnice noveho tahu\n y= sezn...
[ "0.7226474", "0.7226474", "0.7226474", "0.7226474", "0.7226474", "0.624842", "0.6176056", "0.61458427", "0.6106077", "0.5944057", "0.5933873", "0.588906", "0.5826984", "0.5804058", "0.5788212", "0.5745355", "0.5726081", "0.5683553", "0.56713605", "0.5656053", "0.5656053", "...
0.0
-1
Muotoilee pelin suoritusajan oikeaan muotoon
def format_time(self, time): hours = time // 3600 time = time - hours*3600 minutes = time // 60 seconds = time - minutes*60 return ('%d:%d:%d' %(hours, minutes, seconds))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def preberi_pot(ukazi):", "def mezclar_bolsa(self):", "def ikkuna(nimi, x_data, y_data, syote, funktio):\n nimi = ik.luo_ali_ikkuna(\"Spektri\")\n kirjasto[nimi] = nimi\n piirtoalue, kuv...
[ "0.68885297", "0.68885297", "0.68885297", "0.68885297", "0.68885297", "0.64167506", "0.6310813", "0.62828916", "0.6154843", "0.61009777", "0.6084047", "0.59545404", "0.59264195", "0.58961594", "0.5849596", "0.5839589", "0.57758963", "0.57645625", "0.576313", "0.5693546", "0.5...
0.0
-1
Required property for paging indexing.
def paging_index(self): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_index(self):\r\n return (self.per_page * (self.page_number - 1)) + 1", "def paginated(self) -> global___Snippet.Paginated:", "def end_index(self):\r\n if self.page_number == self.num_pages:\r\n return self.total_count\r\n return self.page_number * self.per_page", "de...
[ "0.6568693", "0.6449987", "0.6436679", "0.6420659", "0.63921016", "0.6387182", "0.6372103", "0.63244283", "0.6296986", "0.6293287", "0.6256105", "0.6246576", "0.62288445", "0.6218717", "0.62127787", "0.6130625", "0.61163986", "0.6111341", "0.60654837", "0.60475534", "0.602246...
0.789019
0
Required property for paging results.
def paging_results(self): return 30
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagination(self):\n return self.__pagination", "def pagination(self):\n return self._pagination", "def paging_index(self):\n\n return 0", "def paginated(self) -> global___Snippet.Paginated:", "def get_paginate_data(self, *args, **kwargs):\n pass", "def rows_per_page(self):...
[ "0.7393641", "0.7259711", "0.7052853", "0.7042176", "0.703677", "0.6972491", "0.66814995", "0.65357864", "0.65357864", "0.65313524", "0.6496097", "0.6488124", "0.6482209", "0.64763427", "0.6459869", "0.64330477", "0.6398995", "0.6299724", "0.6278607", "0.62765026", "0.6229067...
0.7375352
1
Required property for query scheme.
def query_scheme(self): return 'https'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_query(self):\n pass", "def get_resource_query(self):\n pass", "def query(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"query\")", "def query(self) -> Optional[str]:\n return pulumi.get(self, \"query\")", "def generate_query(self):\n ...
[ "0.67166394", "0.67166394", "0.6389025", "0.63672054", "0.63242704", "0.62954164", "0.6269316", "0.6262128", "0.6200876", "0.6200876", "0.6200876", "0.6187836", "0.6176622", "0.6123253", "0.6110507", "0.6083631", "0.60716957", "0.6056268", "0.60363066", "0.60363066", "0.60359...
0.0
-1
Required property for the query path.
def query_path(self): return '/search/{query}/{page}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_path_query(self):\n return self._limit_path_query", "def get_resource_query(self):\n pass", "def get_resource_query(self):\n pass", "def get_query(self):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n if len(split) == 1: return \"\"\r\n else: return split[...
[ "0.6866704", "0.6247657", "0.6247657", "0.6202711", "0.618199", "0.6165729", "0.6132307", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.6062342", "0.5907455", "0.5873216", "0.5873216", "0...
0.5374146
79
Required first level page parser.
def parse(self, response): soup = self.get_soup(response.text) try: results = soup\ .find('table', {'id': 'searchResult'})\ .find_all('tr')[1:] except AttributeError: return for result in results: torrent = items.Torre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_parser(self, parser):", "def init_page_elements(self):\n pass", "def __init__(self, page):\n self.raw_page = page\n self.page = etree.HTML(page)", "def htmlParsePage(page):\n if 'parsedHtml' not in page:\n logging.debug('Parsing HTML')\n html = page['data']\n ...
[ "0.605375", "0.59048903", "0.58907366", "0.5659311", "0.56195307", "0.56143063", "0.55045754", "0.5494802", "0.5440153", "0.54351395", "0.5426048", "0.54208255", "0.5391511", "0.53913534", "0.5372941", "0.5361323", "0.5281354", "0.52811116", "0.5272923", "0.52644026", "0.5259...
0.0
-1
Print one search result
def print_res(self, result, index=None): if index is not None: print(str(index).rjust(3)+ " " + _c.bold + _c.blue + result["title"] + _c.reset) if result["description"]: print(" "*4 + "Description:\t", result["description"]) print( " "*4 + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSearchResults(results):\n Log.Debug('Search produced %d results:' % len(results))\n index = 0\n for result in results:\n Log.Debug(' ... %d: id=\"%s\", name=\"%s\", year=\"%s\", score=\"%d\".' %\n (index, result.id, result.name, str(result.year), result.score))\n index += 1", "def ...
[ "0.74747455", "0.7343217", "0.73021764", "0.71641445", "0.71477264", "0.713413", "0.713228", "0.685443", "0.66928583", "0.65810895", "0.6574132", "0.64810723", "0.6444007", "0.6401482", "0.6400616", "0.63686943", "0.6368081", "0.6359474", "0.6358512", "0.63321364", "0.6306986...
0.68869245
7
Print the complete list of search results
def print_result_list(self, results=None): if (results is None) and (self.interesting == 0): results = self.interesting elif len(self.interesting) == 0: # if there are no results print this and end this mehtod, # otherwise it would be attempted to iterate over an empt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSearchResults(results):\n Log.Debug('Search produced %d results:' % len(results))\n index = 0\n for result in results:\n Log.Debug(' ... %d: id=\"%s\", name=\"%s\", year=\"%s\", score=\"%d\".' %\n (index, result.id, result.name, str(result.year), result.score))\n index += 1", "def ...
[ "0.81321305", "0.77824473", "0.7734369", "0.75156295", "0.7425832", "0.73348534", "0.73276484", "0.72117054", "0.7205162", "0.718626", "0.7049182", "0.702477", "0.69989276", "0.695925", "0.69203043", "0.6878432", "0.68653154", "0.6860215", "0.68350136", "0.6801806", "0.678984...
0.7076319
10
Executes the search and parses the results
def search(self, query, offset=0): if query is not None: self.query = query self.offset = offset results = self.raw_search(query) self.interesting = self.parse_results(results) return self.interesting
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processSearchResult(self):", "def _main_search(args = None, stdout = None, stderr = None) :\n if stdout is None :\n stdout = sys.stdout\n if stderr is None :\n stderr = sys.stderr\n # Process arguments\n if args is None :\n parser = _makeParser_search()\n args = parser...
[ "0.75599813", "0.700076", "0.68714297", "0.67071056", "0.67039084", "0.6697776", "0.6683263", "0.6542941", "0.65388364", "0.65201473", "0.6502437", "0.6496094", "0.64136595", "0.64059746", "0.64054435", "0.64038557", "0.6393213", "0.63676757", "0.63626873", "0.6332658", "0.63...
0.0
-1
Execute the query in elasticsearch.
def raw_search(self, query=None): # update query # if query is None: # query = self.query if query is not None: self.query = query req_body = { "query": { "multi_match": { "query": self.query, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executeQuery(es_client, index_name, query):\n try:\n result = es_client.search(index=index_name, body=query)\n except:\n etype, evalue, etb = sys.exc_info()\n logger.error('The query %s failed. Exception: %s, Error: %s.' % (query, etype, evalue))\n sys.exit(255)\n return re...
[ "0.7587783", "0.67433023", "0.66669303", "0.66306055", "0.6555383", "0.6555383", "0.65475273", "0.6389873", "0.6386479", "0.6385622", "0.6379678", "0.63725394", "0.6310343", "0.6300546", "0.6210956", "0.620273", "0.62009937", "0.6181938", "0.61768275", "0.6172044", "0.6167643...
0.63179123
12
Parse elasticsearch results. Parse a search result returned from elasticsearch client to return an array of dicts containing only the interesting parts.
def parse_results(self, result): interesting = [] for item in result["hits"]["hits"]: source = item["_source"] meta = source.get("meta") title = "No title found" descr = None os_path = None highlight = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_search_results(fields, results):\n my_results = []\n for result in results:\n my_results.append(SearchAnimeResult(fields, result))\n return my_results", "def parse_query_results(self):\n # TODO: nicely parsed needs defining; may depend on query\n return self.json_result", ...
[ "0.6793492", "0.67013067", "0.6465043", "0.6334906", "0.62835765", "0.61902833", "0.6171834", "0.61566615", "0.6094304", "0.6094304", "0.6094278", "0.60831743", "0.6029349", "0.598892", "0.598892", "0.5942892", "0.5933647", "0.59039205", "0.58767045", "0.58719695", "0.5844716...
0.7748185
0
Test reconnect after restarting the remote impalad without using connect;
def test_auto_reconnect_after_impalad_died(self): # Use pexpect instead of ImpalaShell() since after using get_result() in ImpalaShell() # to check Disconnect, send_cmd() will no longer have any effect so we can not check # reconnect. impalad = ImpaladService(socket.getfqdn()) # Iterate over test v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconnecting(self) -> bool:", "def reconnect(self):\n\t\t# TODO: Make sure the remote devices are actually found?\n\t\tself.setup()\n\t\tself.patch()", "def reconnect(self):\n self.test_cmd()\n if not self.check_network: \n self.reset()\n attempt=0\n while not self.ch...
[ "0.74889195", "0.7229402", "0.71620506", "0.6919871", "0.69196284", "0.68877256", "0.6729152", "0.6725588", "0.66447777", "0.66320306", "0.6627751", "0.65981334", "0.6590967", "0.65798396", "0.6573456", "0.6514554", "0.65071476", "0.64965737", "0.64816004", "0.6480941", "0.64...
0.7763525
0
Compress image array using SVD decomposition.
def svd_compress(imArr, K=50): imArr_compressed = np.zeros(imArr.shape) # For each channel for ch in range(3): # -------------------- # TODO: # Compress the image array using SVD decomposition # hint: # 1. numpy.linalg.svd # 2. numpy.diag ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Compress(Image, ComponentCount):\n u, s, vh = np.linalg.svd(Image)\n prev = len(s)\n u = u[:, 0:ComponentCount]\n s = s[0:ComponentCount]\n vh = vh.transpose()\n vh = vh.conjugate()\n vh = vh[:, 0:ComponentCount]\n compression_scale = prev / len(s)\n return u, s, vh, compression_scal...
[ "0.7247275", "0.7078715", "0.6578006", "0.6345339", "0.61687267", "0.5876015", "0.58707947", "0.5862238", "0.58569723", "0.5771048", "0.5768918", "0.5745599", "0.5735815", "0.57188565", "0.5627075", "0.55328333", "0.5497116", "0.54893863", "0.54740596", "0.54589796", "0.54289...
0.8093388
0
CarpetBag constructor. Here we set the default, user changeable class vars.
def __init__(self): self.headers = {} self.user_agent = "" self.mininum_wait_time = 0 # Sets the minimum wait time per domain to make a new request in seconds. self.wait_and_retry_on_connection_error = 0 self.retries_on_connection_failure = 5 self.max_content_length = 20...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.bag = {}", "def __init__(self, min_cables):\n self.num_gearboxes = 1\n self.min_cables = min_cables\n first_gearbox_name = ''.join(('gearbox_', str(self.num_gearboxes - 1)))\n self.gearboxes = [gearbox.Gearbox(self.min_cables, \n ...
[ "0.69880384", "0.6282419", "0.6231458", "0.62254363", "0.61587554", "0.6150982", "0.6144921", "0.60666376", "0.60605055", "0.6039317", "0.5984164", "0.59337914", "0.5886399", "0.5879358", "0.5879358", "0.5800754", "0.57984865", "0.5793946", "0.57861817", "0.57804835", "0.5766...
0.0
-1
Wrapper for the Requests python module's get method, adds in extras such as headers and proxies where applicable.
def request(self, method, url, payload={}): response = self._make_request(method, url, payload) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _simple_proxy_request_get(*args, **kwargs):\n proxy = get_proxy_ip()\n kwargs[\"proxies\"] = kwargs.get(\n \"proxies\", {\"http\": \"http://{}\".format(proxy)}\n )\n kwargs[\"timeout\"] = kwargs.get(\"timeout\", 30)\n return proxy, requests.get(*args, **kwargs)", "def _get(self, *args, ...
[ "0.71442753", "0.6757665", "0.6743918", "0.67436904", "0.67419636", "0.6659667", "0.6634489", "0.6553517", "0.65462065", "0.6490329", "0.64791197", "0.6472546", "0.64400476", "0.64133185", "0.63676673", "0.63510203", "0.631481", "0.631481", "0.631481", "0.631481", "0.631481",...
0.0
-1
Wrapper for the Requests python module's get method, adds in extras such as headers and proxies where applicable.
def get(self, url, payload={}): response = self._make_request("GET", url, payload) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _simple_proxy_request_get(*args, **kwargs):\n proxy = get_proxy_ip()\n kwargs[\"proxies\"] = kwargs.get(\n \"proxies\", {\"http\": \"http://{}\".format(proxy)}\n )\n kwargs[\"timeout\"] = kwargs.get(\"timeout\", 30)\n return proxy, requests.get(*args, **kwargs)", "def _get(self, *args, ...
[ "0.7144753", "0.6756292", "0.67439926", "0.67437387", "0.674186", "0.6658925", "0.6634393", "0.65541553", "0.65459687", "0.6491375", "0.6479408", "0.6471713", "0.6438924", "0.6412158", "0.6368428", "0.6350515", "0.6313895", "0.6313895", "0.6313895", "0.6313895", "0.6313895", ...
0.0
-1
Wrapper for the Requests python module's post method, adds in extras such as headers and proxies where applicable.
def post(self, url, payload={}): response = self._make_request("POST", url, payload) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, *args, **kwargs):\n return self._requests_call(util.requests_post, *args, **kwargs)", "def post(self, *args, **kwargs):\n headers = self.post_headers\n headers.update(kwargs.get('headers', {}))\n kwargs['headers'] = headers\n return self._request('post', *args, **kwa...
[ "0.7467651", "0.71776015", "0.694739", "0.6892798", "0.68218106", "0.6781534", "0.6755269", "0.67273265", "0.666553", "0.665422", "0.6568363", "0.65595734", "0.6537142", "0.64915115", "0.64700633", "0.6351929", "0.63314396", "0.62755895", "0.6248504", "0.62426573", "0.6241555...
0.5863583
67
Wrapper for the Requests python module's put method, adds in extras such as headers and proxies where applicable.
def put(self, url, payload={}): response = self._make_request("PUT", url, payload) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, key, headers, value, metadata=None):", "def put(api, url, payload, headers=None, auth=_KERBEROS_AUTH, proxies=None,\n retries=_NUM_OF_RETRIES, timeout=None):\n return call(api, url, 'put', payload=payload,\n headers=headers, auth=auth, proxies=proxies, retries=retries,\n ...
[ "0.70477355", "0.7002686", "0.7001288", "0.6731391", "0.66986614", "0.6605708", "0.6603691", "0.64686245", "0.6456308", "0.64418286", "0.64264536", "0.64217067", "0.6388499", "0.6383755", "0.63758844", "0.63726044", "0.6346885", "0.6322193", "0.6313737", "0.6308605", "0.63012...
0.58273214
57
Wrapper for the Requests python module's DELETE method, adds in extras such as headers and proxies where applicable.
def delete(self, url, payload={}): response = self._make_request("DELETE", url, payload) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, method, uri, query_param, request_param, headers, **kwargs):\n raise NotImplementedError", "def __delete(self, url, headers=None):\n return self.__req(url, \"DELETE\", headers=headers)", "def httpDelete(self, url='', data='', params={}, headers={}):\n\n return self.httpReq...
[ "0.744012", "0.74162203", "0.7414859", "0.7401234", "0.73525935", "0.7351127", "0.73167765", "0.7314673", "0.7258438", "0.7249787", "0.7249375", "0.7150587", "0.7143384", "0.7123215", "0.7123215", "0.71142554", "0.69506896", "0.6939735", "0.69283307", "0.69222105", "0.6912497...
0.6563309
35
Sets a random, common browser's User Agent string as our own.
def use_random_user_agent(self, val=True): if val: self.random_user_agent = True self.user_agent = self.get_new_user_agent() return True else: self.random_user_agent = False self.user_agent = "" return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_user_agent(self):\n try:\n ua = UserAgent()\n return ua.random\n except:\n default_ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) \\\n AppleWebKit/537.36 (KHTML, like Gecko) \\\n Chrome/58.0.3029.110 Safari/537....
[ "0.78560746", "0.72309285", "0.72309285", "0.71486276", "0.70868874", "0.70747095", "0.701105", "0.68725276", "0.6840036", "0.66363144", "0.6564009", "0.6488725", "0.64323324", "0.6420053", "0.63857216", "0.6321986", "0.62934124", "0.6278669", "0.6197506", "0.6155631", "0.610...
0.7118063
4
Gets a new user agent string from the user_agent module, making sure that if one has already been selected, it's not reused.
def get_new_user_agent(self): new_user_agent = user_agent.generate_navigator()["user_agent"] if new_user_agent == self.user_agent: self.get_new_user_agent() return new_user_agent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent(self):\n ua_list = [\n 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101',\n 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122',\n 'Mozilla/5.0 (Windows NT 6.1; WOW64...
[ "0.7215996", "0.7215996", "0.7149297", "0.71108776", "0.69777226", "0.69335705", "0.6727817", "0.6658705", "0.66479695", "0.6638743", "0.6604619", "0.65992475", "0.65622", "0.6559405", "0.65542805", "0.6542164", "0.6525318", "0.65064514", "0.6436991", "0.63781244", "0.636557"...
0.7720028
0
Gets list of free public proxies and loads them into a list, currently just selecting from freeproxylist.
def get_public_proxies(self, continent=""): logging.debug("Filling proxy bag") try: payload = {} if continent: payload = { "continent": continent, } response = self._make_internal("proxies", payload) except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_proxies(self):\n url = 'https://free-proxy-list.net/'\n log.debug('Init proxies: Getting proxy list from web...')\n try:\n soup = BeautifulSoup(get(url).text, \"html5lib\")\n proxies = list()\n for tr in soup.select('#proxylisttable > tbody > tr'):\n ...
[ "0.7217486", "0.7077591", "0.6405665", "0.62468904", "0.62133044", "0.62101275", "0.61114556", "0.6029602", "0.6028249", "0.600311", "0.59931386", "0.59499425", "0.5934098", "0.5877785", "0.5833917", "0.5829708", "0.5739569", "0.57120496", "0.5706647", "0.57053596", "0.569671...
0.6028384
8
Gets proxies from freeproxylist.net and loads them into the self.proxy_bag. The first element in the proxy_bag is the currently used proxy.
def use_random_public_proxy(self, val=True, test_proxy=False): if not val: self.random_proxy_bag = False return False self.random_proxy_bag = True if not self.proxy_bag: self.logger.debug("Proxy Bag already built, not getting more.") self.proxy_ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_proxies(self):\n url = 'https://free-proxy-list.net/'\n log.debug('Init proxies: Getting proxy list from web...')\n try:\n soup = BeautifulSoup(get(url).text, \"html5lib\")\n proxies = list()\n for tr in soup.select('#proxylisttable > tbody > tr'):\n ...
[ "0.72937965", "0.7196858", "0.67574227", "0.6624441", "0.65301496", "0.65171295", "0.64778304", "0.6456618", "0.6407572", "0.6213248", "0.6183391", "0.61654454", "0.61571634", "0.6135114", "0.6114681", "0.60650444", "0.6063063", "0.6048914", "0.6020888", "0.59128374", "0.5872...
0.5091498
62
Grabs the next proxy inline from the self.proxy_bag, and removes the currently used proxy. If proxy bag is empty, raises the EmptyProxyBag error.
def reset_proxy_from_bag(self): if len(self.proxy_bag) == 0: self.logger.debug("Changing proxy") self.logger.warning("Proxy bag is empty! Cannot reset Proxy from Proxy Bag.") raise errors.EmptyProxyBag # Remove the current proxy from the proxy bag if one is set. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_proxy(self, proxied):\n\n val = self.proxy_map[proxied]\n\n try:\n del self.proxy_map[proxied]\n except KeyError:\n pass\n\n try:\n del self.proxy_map[val]\n del self.capability_map[val]\n except KeyError:\n pass",...
[ "0.6447425", "0.56950754", "0.56543666", "0.5635704", "0.5582781", "0.5565788", "0.55146444", "0.5378243", "0.53552455", "0.53185356", "0.5275862", "0.5275862", "0.51605374", "0.5089712", "0.5080257", "0.50010437", "0.49292418", "0.48987725", "0.48745558", "0.4850618", "0.484...
0.7331339
0
Sets CarpetBag up to not force a valid certificate return from the server. This exists mostly because I was running into some issues with self signed certs. This can be enabled/disabled at anytime through execution. WARNING Would not typically recommend using "force=True", unless retrying a request is extremely taxing ...
def use_skip_ssl_verify(self, val=True, force=False): if val: self.ssl_verify = False else: self.ssl_verify = True if force: self.force_skip_ssl_verify = True else: self.force_skip_ssl_verify = False return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_ssl_sync():\n return", "def setIgnoreCertificateErrors(self, ignore: bool) -> Awaitable[Dict]:\n return self.client.send(\n \"Security.setIgnoreCertificateErrors\", {\"ignore\": ignore}\n )", "def DisableSSLVerify():\n\n\t\ttry:\n\t\t\trequests.packages.urllib3.disable_war...
[ "0.59713656", "0.56941324", "0.5630117", "0.5615266", "0.55430776", "0.5537122", "0.54611325", "0.54584414", "0.53662133", "0.536494", "0.53507084", "0.5298348", "0.5288857", "0.52458143", "0.5203294", "0.5150623", "0.50940543", "0.5081254", "0.50494224", "0.50409704", "0.503...
0.70022976
0
Saves a file to a destination on the local drive. Good for quickly grabbing images from a remote site.
def save(self, url, destination, payload={}, overwrite=False): head_args = self._fmt_request_args("GET", self.headers, url, payload) head_args.pop("method") head_args["verify"] = False h = requests.head(**head_args) header = h.headers content_type = header.get("content-ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_save(self, file_path=None, delete_local=False, remote_target=None):\n if not file_path:\n file_path = self.fname\n\n f = File()\n if not remote_target:\n remote_target = self.remote.get('target', None)\n LOG.info(\"Saving picture %s to %s\" % (file_path,...
[ "0.7232098", "0.67532235", "0.6720935", "0.6588786", "0.64738685", "0.6401723", "0.6333125", "0.6333125", "0.6319053", "0.630946", "0.6303958", "0.6284717", "0.6284045", "0.6274221", "0.62252444", "0.621261", "0.6201603", "0.61563903", "0.61304194", "0.61274946", "0.6097225",...
0.6429915
5
Runs a search query on a search engine with the current proxy, and returns a parsed result set. Currently only engine supported is duckduckgo.
def search(self, query, engine="duckduckgo"): response = self.get("https://duckduckgo.com/html/?q=%s&ia=web" % query) if not response.text: return {} parsed = self.parse(response) results = parsed.duckduckgo_results() ret = { "response": response, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query):\n\n results = []\n url = _get_search_url(query)\n html = get_html(url)\n\n if html:\n soup = BeautifulSoup(html, \"html.parser\")\n divs = soup.findAll(\"div\", attrs={\"class\": \"web-result\"})\n\n for li in divs:\n res = DuckDuckGoResult()\n\n ...
[ "0.607996", "0.5939284", "0.5896712", "0.5882372", "0.588011", "0.588011", "0.5808758", "0.5807896", "0.5764619", "0.576326", "0.5741929", "0.57398915", "0.57386386", "0.5690749", "0.5687321", "0.56545633", "0.5652287", "0.5622823", "0.561794", "0.5617934", "0.5611579", "0....
0.68244994
0
Checks the Tor Projects page "check.torproject.org" to see if we"re running through a tor proxy correctly, and exiting through an actual tor exit node.
def check_tor(self): response = self.get("https://check.torproject.org") parsed = self.parse(response) title = parsed.get_title() if title == "Sorry. You are not using Tor.": self.logger.warning("Tor is NOT properly configured.") return False elif title ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_tor_connection():\n\n content = urlopen('https://check.torproject.org/').read()\n\n # <h1 class=\"off\"> - not using tor\n # <h1 class=\"not\"> - using tor without torbrowser\n # <h1 class=\"on\"> - using tor with torbrowser\n return content.find(b'class=\"off\"')==-1", "def use_tor_...
[ "0.7698107", "0.616715", "0.595581", "0.5895883", "0.5787492", "0.57005435", "0.5672086", "0.5658903", "0.5653415", "0.54754514", "0.54626065", "0.5460651", "0.54536825", "0.5420354", "0.53994656", "0.529183", "0.5284102", "0.52192754", "0.5185694", "0.51787347", "0.5136729",...
0.7982964
0
Parses a response from the scraper with the ParseResponse module which leverages Beautiful Soup.
def parse(self, response=None): if response: return ParseResponse(response) else: return ParseResponse(self.last_response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, response: BeautifulSoup):\n raise NotImplementedError", "def parse(response):\n # print(response.text.encode('utf-8'))\n soup = BeautifulSoup(response.text, 'lxml')\n title = soup.find('title')\n answer = title.string\n return answer", "def parse(self, ...
[ "0.8003153", "0.73388904", "0.73250556", "0.7090274", "0.7045075", "0.68957454", "0.6878527", "0.6812612", "0.67267257", "0.66705006", "0.6596709", "0.6586413", "0.65704715", "0.65361875", "0.6504611", "0.6480182", "0.64772415", "0.64772415", "0.6458449", "0.6453998", "0.6435...
0.6835449
7
Gets the current outbound IP address for scrappy and sets the self.outbound_ip var.
def get_outbound_ip(self): try: response = self._make_internal("ip") except errors.NoRemoteServicesConnection: logging.error("Unable to connect to Bad-Actor.Services") return False self.outbound_ip = response.json()["ip"] return self.outbound_ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDestinationIp(self):\n return self.destinationIp", "def outbound_ips(self) -> Optional[pulumi.Input['ManagedClusterLoadBalancerProfileOutboundIPsArgs']]:\n return pulumi.get(self, \"outbound_ips\")", "def effective_outbound_ips(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Resource...
[ "0.65082407", "0.6437389", "0.6435474", "0.6435474", "0.6221881", "0.6023555", "0.5941486", "0.5899906", "0.588379", "0.58644253", "0.5857071", "0.5842714", "0.58216196", "0.58026123", "0.5798135", "0.5795206", "0.5723156", "0.5683514", "0.56315017", "0.5624361", "0.5616303",...
0.79692715
0
Resets the User Agent String if using random user agent string (use_random_user_agent). Resets the proxy being used if (use_proxy_bag) and removes the current proxy from bag.
def reset_identity(self): if self.random_user_agent: self.user_agent = self.get_new_user_agent() if self.random_proxy_bag: self.reset_proxy_from_bag() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_proxy_from_bag(self):\n if len(self.proxy_bag) == 0:\n self.logger.debug(\"Changing proxy\")\n self.logger.warning(\"Proxy bag is empty! Cannot reset Proxy from Proxy Bag.\")\n raise errors.EmptyProxyBag\n\n # Remove the current proxy from the proxy bag if o...
[ "0.6677113", "0.6133902", "0.60278416", "0.5963965", "0.5923906", "0.58532196", "0.5831108", "0.5612078", "0.5601302", "0.54254353", "0.53612053", "0.5246809", "0.51402813", "0.51402813", "0.5134337", "0.5129917", "0.5127677", "0.508291", "0.508291", "0.5071725", "0.5058938",...
0.7169794
0
Tests the current public proxy to see if it is working. If it's not and the user is using proxy bag, we'll find a new one.
def test_public_proxy(self, retry_on_failure=True): logging.info("Testing Proxy: %s (%s)" % (self.proxy_bag[0]["ip"], self.proxy_bag[0]["country"])) self.use_skip_ssl_verify() self.headers = {"Content-Type": "application/json"} test_url = self.remote_service_api.replace("api", "test") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxy_check(self, proxy):", "def use_random_public_proxy(self, val=True, test_proxy=False):\n if not val:\n self.random_proxy_bag = False\n return False\n self.random_proxy_bag = True\n\n if not self.proxy_bag:\n self.logger.debug(\"Proxy Bag already buil...
[ "0.7733405", "0.7117575", "0.7017398", "0.6914103", "0.67402637", "0.66022635", "0.65853786", "0.65214443", "0.64226997", "0.6422141", "0.6399249", "0.63777775", "0.62158525", "0.6212572", "0.61993545", "0.6136303", "0.61237454", "0.6115175", "0.6093141", "0.60837007", "0.607...
0.7361702
1
Sets the headers to be sent over requests.
def set_header(self, key, value): self.headers[key] = value return self.headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_headers(self, headers: dict) -> None:\n self.headers = headers", "def _setHeaders(self):\r\n if not self.headers_set:\r\n self.headers_set = 1\r\n for key in self.headers_out.keys():\r\n self._response.setHeader(key, self.headers_out[key])\r\n ...
[ "0.8246647", "0.8006032", "0.7785143", "0.7695191", "0.7680939", "0.75357383", "0.7369062", "0.72112256", "0.7187827", "0.71655464", "0.7090714", "0.7006846", "0.69345015", "0.68933934", "0.68583345", "0.6776637", "0.6776637", "0.67607313", "0.6748814", "0.6748814", "0.673702...
0.6191695
55
Sets a header once for a request that returns successfully.
def set_header_once(self, key, value): self.one_time_headers.append(key) self.set_header(key, value) return self.headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['Authorization'] = response\n return response", "def _setHeaders(self):\r\n if not self.headers_set:\r\n self.headers_set = 1\r\n for key in self.headers_out.keys():\r\n self._response.setHeader(key, self.headers_out[k...
[ "0.63230705", "0.6204895", "0.61476135", "0.6105394", "0.6088791", "0.6088791", "0.6083404", "0.60628444", "0.60241616", "0.59696144", "0.59696144", "0.59665996", "0.59639955", "0.59607744", "0.5958105", "0.59537137", "0.59483665", "0.59483665", "0.59483665", "0.59483665", "0...
0.7179426
0
Sends usage stats to badactor.services, this helps rate the quality of proxy services so only the best proxies are selected.
def send_usage_stats(self, api_key, non_proxy_user_ip, val=True): self.send_usage_stats_val = val self.usage_stats_api_key = api_key self.non_proxy_user_ip = non_proxy_user_ip return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_usage_stats(self):\n self._usage.increment_usage_stats()", "async def update_stats(self):\r\n\r\n\t\twhile True:\r\n\t\t\tlogging.info('Attempting to post server count')\r\n\t\t\ttry:\r\n\t\t\t\tawait self.dblpy.post_server_count()\r\n\t\t\t\tlogging.info(f'Posted server count ({len(self.bot.gu...
[ "0.6004013", "0.5867979", "0.5660525", "0.5501437", "0.5475802", "0.5431179", "0.5430048", "0.53282905", "0.5311055", "0.5244435", "0.51665664", "0.5150761", "0.51297927", "0.51183045", "0.51158965", "0.50972825", "0.50897354", "0.50742394", "0.50494194", "0.50386304", "0.501...
0.6250957
0
Paginates a REST resource and returns all data and responses stitched together. Set the rest_pagination_vars for the bagger if they do not match the defaults below; self.paginatation_map = {
def rest_get_pages(self, url, payload={}, total=None): responses = [] response = self.get(url, payload) response_json = response.json() logging.debug("Getting page 1: %s" % (url)) pm_total_pages = self.paginatation_map.get("field_name_total_pages") total_pages = response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginated_handling(self) -> global___Snippet.PaginatedResponseHandling:", "def set_resource_pagination(self, data):\n self._resource_pagination = self._uni(data)", "def __paginate__(data, req):\n uri = req.uri\n\n links = list()\n links.append(dict(href=req.uri, rel='self'))\n\n...
[ "0.6588747", "0.6474309", "0.64005256", "0.63313496", "0.63313496", "0.6291761", "0.62640023", "0.61976", "0.6191848", "0.61610395", "0.61574394", "0.6142242", "0.6122189", "0.6051021", "0.60306555", "0.60105777", "0.5980218", "0.5891124", "0.5868496", "0.58454365", "0.584377...
0.6342649
3
Clocked decorator. Put this on a class or and individual function for it's timing information to be tracked.
def clocked(obj): _is_class = inspect.isclass(obj) _is_func = inspect.isfunction(obj) if not _is_class and not _is_func: raise Exception('unsupported type {}'.format(type(obj))) if _is_func: return _create_function_wrapper(obj, '{}.{}:{}'.format( obj.__module__, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_lock(f):\n\n @wraps(f)\n def wrapped(self, *args, **kw):\n with _locks[self.dev_id]:\n return f(self, *args, **kw)\n\n wrapped.__name__ = f.__name__\n wrapped.__doc__ = f.__doc__\n\n return wrapped", "def __call__(self, func):\n\n # set logger if it was not set ea...
[ "0.6340027", "0.6186961", "0.61114764", "0.60758936", "0.60413605", "0.5988032", "0.597996", "0.5961036", "0.5961036", "0.59519255", "0.5939299", "0.59245", "0.59235454", "0.5902219", "0.5901494", "0.5818448", "0.58109176", "0.5788927", "0.575371", "0.5718453", "0.57097805", ...
0.0
-1
removes any lines that are beyond the timeout.
def cull(self): now = time.time() self.lines = [line for line in self.lines if line.timestamp + self.timeout > now]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_timings(phrase_length, timings):\n extra_hits = np.argwhere(np.cumsum(timings) > int(phrase_length)).ravel()\n\n if len(extra_hits) != 0:\n all_to_end = np.min(extra_hits)\n del timings[all_to_end:]\n\n return timings", "def _trunc_lines_append(self):\n\t\tp = self._edit.get_buffe...
[ "0.6349527", "0.60249877", "0.5973775", "0.592355", "0.580673", "0.5727752", "0.569577", "0.56607836", "0.5555222", "0.5512689", "0.5511025", "0.5503078", "0.54648167", "0.54562956", "0.5428875", "0.54065245", "0.5386878", "0.5376456", "0.5360201", "0.5334302", "0.5333658", ...
0.7740447
0
If a line exists in the log that matches the line passed in, returns that line object, otherwise returns None. A line 'matches' if the text is the same, case insensitive and ignoring whitespace.
def getMatchingLine(self, line): tokens = map(str.lower, line.text.split()) # easy way to ignore case and whitespace for l in self.lines: if map(str.lower, l.text.split()) == tokens: return l # found a match return None # no matches found
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_line(file: str, line: str, logfile: str) -> Union[str, bool]:\n current_file = read_file_log(file, logfile)\n m = re_search(rf\"{line}\", current_file)\n if m is not None:\n return m.group(0)\n return False", "def match(line,keyword):\n line=line.lstrip()\n length=len(keyword)\n ...
[ "0.688188", "0.673705", "0.6683343", "0.6666241", "0.6652194", "0.66231227", "0.6491017", "0.6437934", "0.62715596", "0.61238337", "0.6111344", "0.60473675", "0.6031243", "0.6031243", "0.60291314", "0.5985005", "0.5979051", "0.5962767", "0.58837664", "0.5826029", "0.5768382",...
0.7682697
0
adds a line to the log and culls any stale lines.
def add(self, line): self.cull() self.lines.append(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_line_to_log(line = '\\n'):\n with open(logPath, 'a') as f:\n f.write(line + '\\n')", "def append(self, line):\n self.buffer.append(line)", "def append(self, line):\n self.ag.append(line)", "def add(self, line):\n if self.unique is not False and self.unique is not Tru...
[ "0.6821657", "0.63969713", "0.6210151", "0.616209", "0.6158731", "0.6155332", "0.6132655", "0.6109983", "0.60988694", "0.6074187", "0.60716707", "0.59934336", "0.5985421", "0.598461", "0.5966128", "0.5927086", "0.5926362", "0.59038687", "0.58802426", "0.586528", "0.5864172", ...
0.7312085
0
Adds support for localization in the logging. If ../nova/__init__.py exists, add ../ to Python search path, so that it will override what happens to be installed in /usr/(local/)lib/python...
def add_support_for_localization(): path = os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir) possible_topdir = os.path.normpath(path) if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) gettext.install('nova', unicode=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includeme(config):\r\n config.add_translation_dirs('faapp:locale', )\r\n config.add_subscriber('faapp.locale.add_renderer_globals', 'pyramid.events.BeforeRender')\r\n config.add_subscriber('faapp.locale.add_localizer', 'pyramid.events.NewRequest')", "def includeme(config):\n\n import patches\n ...
[ "0.6291162", "0.6224521", "0.5834338", "0.5764594", "0.5700114", "0.54782677", "0.5361436", "0.53607774", "0.53573674", "0.5319826", "0.5305797", "0.5224463", "0.5187609", "0.5176947", "0.51709914", "0.51578915", "0.51368284", "0.51174754", "0.5070859", "0.50612843", "0.50524...
0.8006806
0
Shuts down any services this program has started and shows results.
def _clean_up(): from tests.util import report report.update() if MAIN_RUNNER is not None: MAIN_RUNNER.on_exit() from tests.util.services import get_running_services for service in get_running_services(): sys.stderr.write("Stopping service ") for c in service.cmd: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_services(self):\n logger.info(\"Stopping services: %s\", self.services)\n for service in self.services:\n with hide(*fab_quiet):\n sudo('service %s stop' % service)", "def shutdown(self):\n\n self.log.debug(\"Shutting down %s application\" % self.app_name)\...
[ "0.6826566", "0.66662294", "0.62678224", "0.6248803", "0.620092", "0.6148632", "0.6085707", "0.60548437", "0.60259885", "0.6015684", "0.59887946", "0.59693664", "0.59467727", "0.5922419", "0.5919427", "0.59193456", "0.5896353", "0.58475703", "0.58460677", "0.5821398", "0.5817...
0.71973765
0
Grabs the doc abbreviated doc string.
def get_doc(cls_or_func): try: return cls_or_func.__doc__.split("\n")[0].strip() except (AttributeError, IndexError): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_doc(obj):\n if obj.__doc__:\n lines = obj.__doc__.strip(' \\n').splitlines()\n if lines:\n return lines[0]\n return None", "def DocString():\n return", "def get_doc_string(self) -> str:\n r = \"Undocumented\"\n if self.doc is not None: r = self.doc\n ...
[ "0.6761361", "0.6548515", "0.64841104", "0.62915885", "0.6196814", "0.61475074", "0.6146307", "0.60986847", "0.6060539", "0.6055384", "0.5931273", "0.5923651", "0.58720237", "0.5850356", "0.58332723", "0.58274835", "0.5825922", "0.5825922", "0.5821678", "0.580442", "0.5761034...
0.6336477
3
Collect all the tensors representing numbers into a single one. A tensor is understood to represent a number when its name is ``"$number"`` or ``$i``.
def collect_numbers(operator): new_tensors = [] number = 1 i_count = 0 is_complex = False for tensor in operator.tensors: if tensor.name == "$number": if tensor.content.imag != 0: is_complex = True number *= tensor.content elif tensor.name == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t2n(*tensors):\n data_logger.info('t2n({}:{}{})'\n .format(type(tensors).__name__, len(tensors),\n tuple(type(t).__name__ for t in tensors)))\n if len(tensors) == 1:\n return list(map(np.array, (tensors[0],)))[0]\n return list(map(np.array, tensor...
[ "0.5830372", "0.5825708", "0.54742587", "0.5431972", "0.537556", "0.52845967", "0.527925", "0.5261539", "0.5225615", "0.51534414", "0.51292926", "0.5127709", "0.5120891", "0.5111635", "0.51107", "0.5100971", "0.50926346", "0.50926244", "0.50767297", "0.5065638", "0.50638473",...
0.63753617
0
Collect all the tensors that are equal and return the correspondin powers.
def collect_powers(operator): new_tensors = [] symbols = {} for tensor in operator.tensors: if tensor.is_field or tensor.name[0] == "$" or tensor.exponent is None: new_tensors.append(tensor) else: # Previusly collected exponent for same base and indices pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_list():", "def power_set(min_a, max_a, min_b, max_b):\n terms = set()\n for a in range(min_a, max_a+1):\n for b in range(min_b, max_b+1):\n terms.add(a**b)\n return terms", "def find_powers(n):\n # find_powers(6) --> [1, 2, 3, 4]\n return list(takewhile(lambda x: len(...
[ "0.5841383", "0.57695866", "0.5709396", "0.57071817", "0.55391276", "0.552566", "0.5319521", "0.52974725", "0.5233139", "0.52156407", "0.5212223", "0.51918525", "0.5181133", "0.51268536", "0.51098937", "0.5108265", "0.508982", "0.5075821", "0.5069224", "0.50669616", "0.505801...
0.57459795
2
Collect the numeric factors and powers of tensors.
def collect_numbers_and_powers(op_sum): return OperatorSum([collect_numbers(collect_powers(op)) for op in op_sum.operators])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_powers(operator):\n new_tensors = []\n symbols = {}\n for tensor in operator.tensors:\n if tensor.is_field or tensor.name[0] == \"$\" or tensor.exponent is None:\n new_tensors.append(tensor)\n else:\n # Previusly collected exponent for same base and indices\...
[ "0.6194877", "0.59739333", "0.5796972", "0.5738471", "0.5723933", "0.5555627", "0.55091745", "0.5501143", "0.5443615", "0.5376346", "0.5366837", "0.5357874", "0.5326172", "0.52973676", "0.5268558", "0.5267875", "0.5267875", "0.52363956", "0.5230195", "0.5196431", "0.5187723",...
0.5216908
19
Remove all the Kroneker deltas, substituting them by the corresponding index contraction.
def remove_kdeltas(operator): for pos, tensor in enumerate(operator.tensors): if tensor.name == "kdelta": new_op = OperatorSum([operator.remove_tensor(pos)]) n = new_op.operators[0].max_index + 1 new_op = Operator([generic(n, n)]).replace_first("generic", new_op) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_from_index_operations(self, which, transforms):\n if len(transforms) == 0:\n transforms = which.properties()\n removed = np.empty((0,), dtype=int)\n for t in list(transforms):\n unconstrained = which.remove(t, self._raveled_index())\n removed = np.u...
[ "0.6080323", "0.6080323", "0.5911438", "0.5832008", "0.5655036", "0.56547284", "0.5560011", "0.5421335", "0.54032207", "0.53621566", "0.535159", "0.5328359", "0.53079796", "0.52951676", "0.5267197", "0.52522033", "0.52240103", "0.52159065", "0.5215549", "0.52150494", "0.52122...
0.6371044
0
Replace the first occurrence of ``pattern`` by ``replacement`` in ``operator``
def apply_rule(operator, pattern, replacement): new_op = operator.match_first(pattern) if new_op is None: return None return new_op.replace_first("generic", replacement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regexp_replace(\n self, pattern: Any, replacement: Any, flags: Optional[str] = None\n ) -> ColumnOperators:\n return self.operate(\n regexp_replace_op,\n pattern,\n replacement=replacement,\n flags=flags,\n )", "def replacement(cls, search_p...
[ "0.68356377", "0.66041344", "0.65621614", "0.60166216", "0.5761901", "0.55495423", "0.55282766", "0.55010945", "0.54934835", "0.5492451", "0.540084", "0.53719664", "0.53543186", "0.5350739", "0.53375554", "0.5324137", "0.5298707", "0.5288058", "0.52557033", "0.5247027", "0.52...
0.7630286
0
Apply all the given rules to the operator sum. With the adecuate set of rules this function can be used to express an effective lagrangian in a specific basis of operators
def apply_rules(op_sum, rules, max_iterations, verbose=True): for i in range(0, max_iterations): if verbose: sys.stdout.write( "\rApplying rules (iteration " + str(i + 1) + "/" + str(max_iterations) + ")") sys.stdout.flush() op_sum = app...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_rules(term: Term, rules):\n return functools.reduce(apply_rule, rules, term)", "def update_acc_by_rules(self) -> None:\n for rule, coeff in self.rules.items():\n acc_delta = rule(self) # can't call self.rule\n self.update_acc(acc_delta, coeff)", "def append_rules(self...
[ "0.64918065", "0.5928121", "0.5580742", "0.55390596", "0.5489015", "0.5442223", "0.5433671", "0.53886807", "0.53367096", "0.52972984", "0.52956265", "0.5274054", "0.52662563", "0.52547824", "0.52512914", "0.52508175", "0.5250347", "0.52071154", "0.51887256", "0.51873267", "0....
0.7162076
0
Collect operators that are equal except for a numeric coefficient and sum the numbers to get one.
def sum_numbers(op_sum): collection = [] for op in op_sum.operators: # Strip numeric coefficient off collected = False num = 1 n_removed = 0 op = collect_numbers(op) if op.tensors[0].name == "$number": num = op.tensors[0].content new_op = O...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_numbers_and_powers(op_sum):\n return OperatorSum([collect_numbers(collect_powers(op))\n for op in op_sum.operators])", "def collect_numbers(operator):\n new_tensors = []\n number = 1\n i_count = 0\n is_complex = False\n for tensor in operator.tensors:\n ...
[ "0.6688382", "0.6188537", "0.596569", "0.59612995", "0.5951762", "0.5869833", "0.5806779", "0.56662303", "0.55770713", "0.5569512", "0.5558289", "0.5472565", "0.5470783", "0.5468581", "0.54612523", "0.5448771", "0.5426006", "0.5417521", "0.5396", "0.5377994", "0.53439593", ...
0.74173737
0
Collect the coefficients of the given tensors. Usually, these tensors represent operators of a basis in which the effective lagrangian is expressed.
def collect_by_tensors(op_sum, tensor_names): collection = {} rest = [] for op in op_sum.operators: for pos, tensor in enumerate(op.tensors): if tensor.name in tensor_names: n = len(tensor.indices) collected = collection.get((tensor.name, n), OperatorSum()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coefficients(self) :\n raise NotImplementedError", "def coefficients(dataset):\r\n x = [row[0] for row in dataset]\r\n y = [row[1] for row in dataset]\r\n x_mean, y_mean = mean(x), mean(y)\r\n b1 = covariance(x, x_mean, y, y_mean) / variance(x, x_mean)\r\n b0 = y_mean - b1 * x_mean\r\n ...
[ "0.6101754", "0.5773054", "0.57480294", "0.55613613", "0.55299973", "0.5527433", "0.54970664", "0.5481875", "0.54661036", "0.54629374", "0.54475814", "0.54369503", "0.53957886", "0.53680116", "0.53680116", "0.536378", "0.5338263", "0.5321827", "0.53142375", "0.53029984", "0.5...
0.0
-1
Simplify the numeric and exponentiated symbolic tensors
def collect(op_sum, tensor_names, verbose=True): if verbose: sys.stdout.write("Collecting...") sys.stdout.flush() op_sum = collect_numbers_and_powers(op_sum) collection, rest = collect_by_tensors(op_sum, tensor_names) if verbose: sys.stdout.write("done.\n") return collection,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_simplify(tensor: Tensor):\n\n # Initial simplification.\n res = tensor.simplify()\n # This can possibly reduce the number of terms.\n res = res.merge_j()\n res = res.simplify_am()\n\n # Final trial.\n res = res.simplify().merge_j()\n\n return res", ...
[ "0.63793117", "0.6208861", "0.6036128", "0.56760955", "0.5664086", "0.5662808", "0.56466436", "0.56294143", "0.55664444", "0.554629", "0.55231744", "0.54127586", "0.54062766", "0.5404088", "0.5369835", "0.53176296", "0.5315434", "0.5312899", "0.5304617", "0.5287755", "0.52845...
0.0
-1
Returns a list of the category id's for Kaltura Queries
def getCategories(self): return self.categories.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self):\n cur = self.con.execute('select category from cc');\n return [d[0] for d in cur]", "def get_used():\r\n sql = text('''\r\n SELECT category.* FROM category, app\r\n WHERE app.category_id=category.id GROUP BY category.id\r\n ''')\r\n...
[ "0.71670383", "0.69010663", "0.68101406", "0.67174804", "0.6581345", "0.65724224", "0.65668017", "0.6469804", "0.64187425", "0.6387386", "0.6368754", "0.6350805", "0.63448954", "0.63308847", "0.6311787", "0.63045365", "0.6287502", "0.6286752", "0.6254095", "0.62417734", "0.62...
0.62255883
22
Sets the selected categories for this object in plone
def setCategories(self, categories): vocabulary = dict(self.getCategoryVocabulary()) self.categories = OrderedDict() for catId in categories: name = vocabulary.get(catId, None) if name is not None: self.categories[catId] = vocabulary[catId] els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_categories(self, categories: NounCategories):\n \n self._categories = categories", "def categories(self, categories):\n self._categories = categories", "def categories(self, categories):\n\n self._categories = categories", "def categories(self, categories):\n\n self._cate...
[ "0.7062292", "0.6979854", "0.6835223", "0.6835223", "0.6835223", "0.6835223", "0.6526289", "0.63506573", "0.6053344", "0.5994042", "0.5918202", "0.591194", "0.578655", "0.57847124", "0.5783679", "0.57616067", "0.5671423", "0.5657789", "0.5589376", "0.55749315", "0.55749315", ...
0.65979934
6
This gets the entire list of avaiable categories from the Kaltura server
def getCategoryVocabulary(self, parent=None): self._categoryVocabulary = vocabularies.getCategoryVocabulary(parent) return self._categoryVocabulary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)", "def get_categories():\n try:\n result = {\n \"success\": True,\n \"categories\": get_all_categories()\n }\n return jsonify(result)\n\n excep...
[ "0.7541937", "0.7360186", "0.72881097", "0.7280025", "0.7249102", "0.72179836", "0.7164439", "0.71403056", "0.7118207", "0.7113778", "0.70981675", "0.70935076", "0.70897126", "0.7061449", "0.70468557", "0.703794", "0.7023244", "0.7009942", "0.69304144", "0.685496", "0.6848355...
0.0
-1
given a kaltura video object, set the status on the media entry and update the server See KalturaClient.Core.KalturaEntryModerationStatus for enum definitions
def setModerationStatus(self, status): kSetStatus(self, status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multizone_new_media_status(self, group_uuid, media_status):\n _LOGGER.debug(\n \"[%s %s] Multizone %s media status: %s\",\n self.entity_id,\n self._cast_info.friendly_name,\n group_uuid,\n media_status,\n )\n self.mz_media_status[group...
[ "0.5763984", "0.56661105", "0.5640002", "0.5603017", "0.5533586", "0.5530165", "0.5488287", "0.5436343", "0.54348207", "0.542494", "0.542494", "0.5409558", "0.5373215", "0.53122604", "0.5302755", "0.52939594", "0.5281037", "0.5257494", "0.52451044", "0.52404845", "0.5238186",...
0.57743543
0
initializes the fields added to the form
def __init__(self, *args, **kwargs): user = None if 'user' in kwargs: user = kwargs.pop('user') super(PersonForm, self).__init__(*args, **kwargs) if user: self.fields['username'].initial = user.username self.fields['first_name'].initial = user.first_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initFields(self):\n pass", "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n placeholders = {\n \"first_name\": \"First Name\",\n \"last_name\": \"Last Name\",\n \"default_phone_num\": \"Phone Number\",\n \"default_pa...
[ "0.7249758", "0.7202305", "0.7121737", "0.7105337", "0.7087888", "0.70404404", "0.7030716", "0.702816", "0.7005563", "0.6940102", "0.6940102", "0.69289833", "0.6883948", "0.68787473", "0.685069", "0.6745392", "0.674058", "0.6722323", "0.6722193", "0.6678024", "0.66682804", ...
0.6303578
43
Verifies that the username is unique
def clean_username(self): c_d = self.cleaned_data if User.objects.exclude(id=c_d['id']).filter( username=c_d['username']): raise forms.ValidationError(u'The Username is already registered.') return c_d['username']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_username(cls, username):\n if not User.is_username_available(username):\n raise ValueError('Sorry, this username is already taken.')\n return username", "def test_username_not_unique(bot):\n expect_error(register, InputError, bot.username, \"abcdef\", \"a\", \"a\", \"a\")",...
[ "0.796508", "0.7895647", "0.78525686", "0.77994186", "0.7785906", "0.77718794", "0.7733905", "0.77335113", "0.76931953", "0.76837593", "0.76564556", "0.7647921", "0.7632286", "0.7627861", "0.7561594", "0.7534148", "0.7517587", "0.7462734", "0.7414341", "0.7398288", "0.7380973...
0.7259946
27
Verifies that the email is unique
def clean_email_address(self): c_d = self.cleaned_data if User.objects.exclude(id=c_d['id']).filter( email=c_d['email_address']): raise forms.ValidationError(u'The email is already registered.') return c_d['email_address']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_email(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n rv = self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.assertIn(b'Sorry email already exist', rv.data)", "def validate_unique_email(email):\n if AssociatedE...
[ "0.77355355", "0.76942474", "0.75334007", "0.75327843", "0.7430414", "0.7345387", "0.7316601", "0.72318655", "0.72308826", "0.72283435", "0.7225057", "0.71606964", "0.71580625", "0.7145288", "0.71169734", "0.71132576", "0.71028686", "0.7101186", "0.7093278", "0.7093278", "0.7...
0.6720548
51
Verifies that if the passwords are provided, they must be equal
def clean(self): c_d = super(PersonForm, self).clean() pass1 = c_d.get('new_password') pass2 = c_d.get('confirm_new_password') if pass1 and pass2 and (pass1 == pass2): return c_d if pass1: if not pass2: self._errors['confirm_new_password'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_salts_are_random(self):\n self.user.password = '123456'\n self.user2.password = '123456'\n self.assertTrue(self.user.password_hash != self.user2.password_hash)", "def test_check_password():\n assert check_password('Longpassword') == False\n assert check_password('1234...
[ "0.766248", "0.7600481", "0.7484382", "0.7422738", "0.7331831", "0.73223984", "0.72801626", "0.7256743", "0.7245396", "0.7192447", "0.7190816", "0.7179022", "0.7177944", "0.7142859", "0.7135221", "0.709479", "0.7085197", "0.70510113", "0.70506793", "0.70440084", "0.70105803",...
0.0
-1
saves the data to the corresponding Person and User objects This method also removes the image saved in the tmp directory and if a new avatar has been uploaded then the old avatar image is deleted.
def save(self, *args, **kwargs): c_d = self.cleaned_data if c_d.get('id') and c_d.get('avatar') and ( isinstance(c_d.get('avatar'), UploadedFile)): person = get_object_or_404(Person, id=c_d.get('id')) try: old_avatar = person.avatar.file.name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_avatar(self, _objectdata):\n\n #ToDo: should there be a separate Avatar() class?\n\n # if the object data pertains to us, update our data!\n if str(_objectdata.FullID) == str(self.agent.agent_id) or \\\n _objectdata.LocalID == self.agent.local_id:\n if _objec...
[ "0.6112822", "0.6094898", "0.5866212", "0.58051175", "0.5752679", "0.57102644", "0.5576271", "0.5566373", "0.5552704", "0.55019814", "0.54939103", "0.5479418", "0.5461823", "0.5397815", "0.53944284", "0.5382238", "0.53782207", "0.5372016", "0.5361807", "0.5339948", "0.5308686...
0.6435948
0
Save the shortened version of this hash for convenient retrieval.
def hash_save(db: Redis[bytes], hash: hash_t) -> None: db.zadd(HASH_INDEX, {str(hash): "0"})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save_last_short_url(url):\n pickle.dump(url, open(\"last_short.p\", \"wb\"))", "def encode(self, longUrl: str) -> str:\n while True:\n result = hashlib.sha256(longUrl.encode()).hexdigest()\n shortUrl = result[:7]\n if longUrl not in self.bucket.get(shortUrl):\...
[ "0.6251011", "0.6066748", "0.59095615", "0.59022635", "0.58882004", "0.5798605", "0.5686706", "0.5669395", "0.56014115", "0.55821836", "0.5579713", "0.55722886", "0.5561067", "0.5541973", "0.5522965", "0.55203974", "0.5514911", "0.5510686", "0.54868406", "0.54843676", "0.5478...
0.54102707
28
Save the shortened version of this hash for convenient retrieval.
def hash_load(db: Redis[bytes], short_hash: str) -> list[hash_t]: if len(short_hash) > 40: raise AttributeError(f"hash {short_hash} has length {len(short_hash)} > 40") data = db.zrangebylex(HASH_INDEX, f"[{short_hash}", "+") out = [] for key in data: k = key.decode() if k[: len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __save_last_short_url(url):\n pickle.dump(url, open(\"last_short.p\", \"wb\"))", "def encode(self, longUrl: str) -> str:\n while True:\n result = hashlib.sha256(longUrl.encode()).hexdigest()\n shortUrl = result[:7]\n if longUrl not in self.bucket.get(shortUrl):\...
[ "0.62499803", "0.6066372", "0.5909061", "0.59045076", "0.5887566", "0.57977223", "0.56868255", "0.5669783", "0.5600842", "0.55805355", "0.557722", "0.55713433", "0.55628705", "0.5543424", "0.5523475", "0.55194", "0.5514835", "0.5512322", "0.5485806", "0.54840094", "0.5480472"...
0.0
-1
A null (undefined) instance of `GXDMPPLY `
def null(cls): return GXDMPPLY()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null(cls):\n return GXMXD()", "def create(cls):\n ret_val = gxapi_cy.WrapDMPPLY._create(GXContext._get_tls_geo())\n return GXDMPPLY(ret_val)", "def nulltest():", "def X(self):\n return None if self.pX is None else self.pX.buf", "def __none_left_mult(x, y):\n if x is not N...
[ "0.691417", "0.5743294", "0.5559749", "0.5559652", "0.5553827", "0.5520381", "0.5518753", "0.5415572", "0.5325077", "0.5266724", "0.52546644", "0.52026594", "0.51994437", "0.51707566", "0.51635", "0.5159187", "0.5159187", "0.5145673", "0.51355654", "0.5121073", "0.51063466", ...
0.8087481
0
Check if this is a null (undefined) instance
def is_null(self): return self._internal_handle() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_null(self):\n return self.value is None", "def is_none(obj):\n return obj is None", "def isnull(obj):\n return _isnull(obj)", "def _check_undefined(self) -> PossibleResult[T]:\n if self.constructor == Undefined:\n if not self.obj is UNDEFINED:\n raise Dese...
[ "0.741575", "0.7338204", "0.69289905", "0.6886073", "0.6874409", "0.67742264", "0.67129105", "0.66607696", "0.6603184", "0.65387416", "0.6536862", "0.65172756", "0.6486907", "0.64756835", "0.64693266", "0.6455558", "0.6434825", "0.6400298", "0.63428843", "0.6332195", "0.63286...
0.7537869
3
Clear/remove all polygons from the `GXDMPPLY `.
def clear(self): self._clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_geometries(self):", "def clear(self):\n \n objects = self.get_geometry()\n\n for obj in objects:\n\n rs.DeleteObject(obj) \n \n return self", "def clear_selected_shapes(self):\n self.shapes_to_draw = []", "def remove_polygons(self, test):\n ...
[ "0.786491", "0.6843211", "0.66905844", "0.6605509", "0.6597619", "0.6539602", "0.653083", "0.63865715", "0.63609284", "0.6298013", "0.6277126", "0.61649215", "0.615071", "0.6099738", "0.60939336", "0.6085041", "0.6069512", "0.60571843", "0.60561174", "0.6042144", "0.6040081",...
0.0
-1
Creates a `GXDMPPLY ` object.
def create(cls): ret_val = gxapi_cy.WrapDMPPLY._create(GXContext._get_tls_geo()) return GXDMPPLY(ret_val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null(cls):\n return GXDMPPLY()", "def to_PDG(self):\n new = copy.copy(self)\n new._translator = CompiledFlux.pdg_to_corsika\n return new", "def gxpg(self):\n\n if self._pg is None:\n self._pg = self.gxvox.create_pg()\n return self._pg", "def null(cls):...
[ "0.53824943", "0.5201605", "0.5014627", "0.49037677", "0.48606914", "0.48266637", "0.47851714", "0.46996048", "0.46991435", "0.4689435", "0.46888694", "0.46641594", "0.4653608", "0.46237206", "0.46145096", "0.46035844", "0.4571648", "0.45689788", "0.45656684", "0.45648736", "...
0.8254729
0
Get the azimuth of a given polygon.
def get_azimuth(self, p, az): az.value = self._get_azimuth(p, az.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def azimuth(poly):\n num = len(poly) - 1\n vec = unit_normal(poly[0], poly[1], poly[num])\n vec_azi = np.array([vec[0], vec[1], 0])\n vec_n = np.array([0, 1, 0])\n # update by Santosh\n # angle2vecs gives the smallest angle between the vectors\n # so for a west wall angle2vecs will give 90\n ...
[ "0.8244406", "0.6871317", "0.6788706", "0.65504193", "0.64565736", "0.6429097", "0.6423646", "0.6257436", "0.59944844", "0.5986255", "0.589918", "0.5831737", "0.5831055", "0.580468", "0.5802006", "0.57969636", "0.5740495", "0.5732666", "0.5730908", "0.57142633", "0.568325", ...
0.65134627
4
Get the center, width and height of a given polygon.
def get_extents(self, p, x, y, z, w, h): x.value, y.value, z.value, w.value, h.value = self._get_extents(p, x.value, y.value, z.value, w.value, h.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getpolycenter(poly):\n polylength = len(poly)\n\n return (\n round(sum(x for x, y in poly) / polylength, 2),\n round(sum(y for x, y in poly) / polylength, 2)\n )", "def get_polygon_envelope(polygon, x_pixel_size, y_pixel_size):\n # retrieve polygon points\n poly_pts = list(polygo...
[ "0.7012818", "0.6842496", "0.66771466", "0.6603969", "0.6498189", "0.64886075", "0.64851624", "0.64365584", "0.63802075", "0.62211365", "0.62088794", "0.62022287", "0.6151652", "0.61108154", "0.609079", "0.60862786", "0.60758364", "0.6052586", "0.6007042", "0.6001934", "0.599...
0.0
-1
Get join lines for each vertex in a specific polygon.
def get_joins(self, p, vv): self._get_joins(p, vv)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_lines(polygons):\n lines = []\n for polygon in polygons:\n curr_lines = []\n for idx in range(0, len(polygon)):\n for idx_ in range(idx, len(polygon)):\n curr_line = Line(polygon[idx], polygon[idx_])\n curr_lines.append(curr_line)\n lin...
[ "0.70573825", "0.6279373", "0.6038568", "0.6018839", "0.59583443", "0.58983105", "0.58710766", "0.58538824", "0.58488405", "0.58219033", "0.57789993", "0.57606065", "0.5728503", "0.5688376", "0.5680345", "0.56682414", "0.56454587", "0.5643157", "0.55556434", "0.5551185", "0.5...
0.51438326
66
Get the normal vectors of a given polygon.
def get_normal_vectors(self, p, x1, y1, z1, x2, y2, z2, x3, y3, z3): x1.value, y1.value, z1.value, x2.value, y2.value, z2.value, x3.value, y3.value, z3.value = self._get_normal_vectors(p, x1.value, y1.value, z1.value, x2.value, y2.value, z2.value, x3.value, y3.value, z3.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_polygon(points, unitized=True):\n p = len(points)\n assert p > 2, \"At least three points required\"\n nx = 0\n ny = 0\n nz = 0\n o = centroid_points(points)\n a = subtract_vectors(points[-1], o)\n for i in range(p):\n b = subtract_vectors(points[i], o)\n n = cross_...
[ "0.75390875", "0.7363467", "0.69670284", "0.6897307", "0.68665844", "0.680491", "0.6699445", "0.6697294", "0.6618638", "0.65534496", "0.6481243", "0.6475138", "0.64325505", "0.6416771", "0.6388997", "0.6370575", "0.63250977", "0.63199365", "0.6296103", "0.62935674", "0.624232...
0.6499201
10
Get a specific polygon from a `GXDMPPLY ` object.
def get_poly(self, p, vv_x, vv_y, vv_z): self._get_poly(p, vv_x, vv_y, vv_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_polygon(element):\n polygon = element.find('%s/%s/%s/%s/%s' %\n (NRML04_AREA_GEOMETRY, gml.GML_POLYGON,\n gml.GML_EXTERIOR, gml.GML_LINEAR_RING,\n gml.GML_POS_LIST)).text\n\n polygon = gml._get_polygon_from_2DLinestring...
[ "0.6703642", "0.63523406", "0.614028", "0.5942457", "0.5932952", "0.5896069", "0.5845947", "0.5738889", "0.5665312", "0.5598119", "0.5585669", "0.5558638", "0.5539858", "0.55348516", "0.55201435", "0.5511093", "0.5466061", "0.54617816", "0.54557055", "0.54327834", "0.54144496...
0.5360446
28
Get the swing of a given polygon.
def get_swing(self, p, az): az.value = self._get_swing(p, az.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getshapepoly(self, polygon, compound=False):\n if self._resizemode == \"user\" or compound:\n t11, t12, t21, t22 = self._shapetrafo\n elif self._resizemode == \"auto\":\n l = max(1, self._pensize/5.0)\n t11, t12, t21, t22 = l, 0, 0, l\n elif self._resizemo...
[ "0.64437455", "0.6185662", "0.5685706", "0.5652875", "0.56313807", "0.54309624", "0.53854454", "0.5366449", "0.53624", "0.5352849", "0.53410876", "0.5323277", "0.5314206", "0.5281384", "0.52541447", "0.52481735", "0.5216022", "0.51984274", "0.51984274", "0.5149388", "0.512853...
0.4972347
38
Get a vertex location from a `GXDMPPLY ` object.
def get_vertex(self, p, v, x, y, z): x.value, y.value, z.value = self._get_vertex(p, v, x.value, y.value, z.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object_vertex(self, obj):\n return self.object_vertices[obj]", "def get_vertex(self, crs=None):\n if crs is None or crs==self.crs:\n return self.vertex\n else:\n return _reproject((self.x, self.y), self.crs, crs)", "def get_position(self):\n return self...
[ "0.61344016", "0.5935739", "0.58785844", "0.57558495", "0.5667856", "0.55996597", "0.55868006", "0.5563424", "0.55487293", "0.55252415", "0.5479728", "0.5465365", "0.5409073", "0.5393621", "0.5386095", "0.53791237", "0.53740734", "0.5357283", "0.53518486", "0.5350503", "0.535...
0.5343751
23
Get the number of joining lines in a `GXDMPPLY ` object.
def num_joins(self): ret_val = self._num_joins() return ret_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n nlines = self.get_endline() - self.get_startline() + 1\n if nlines < 0:\n nlines = 0\n return nlines", "def linecount(x):\n return sum(1 for char in x if char == \"\\n\")", "def line_length(self, dLine = 0):\n return self.buffer.line_length(self.li...
[ "0.63165355", "0.61866695", "0.61423755", "0.61377895", "0.6112688", "0.6096513", "0.58669215", "0.56837624", "0.567812", "0.56737816", "0.5636486", "0.56229013", "0.56187856", "0.5613963", "0.55824417", "0.55065787", "0.54742855", "0.5474092", "0.546939", "0.5442437", "0.542...
0.5205739
35
Get the number of polygons in a `GXDMPPLY ` object.
def num_polys(self): ret_val = self._num_polys() return ret_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_polygons(self):\n return len(self)", "def num_polygons(self):\n return len(self.polygons)", "def __len__(self):\n return self.num_polygons", "def get_numberOfProjections(self):\n self._nproj = len(self._projIndices)\n return self._nproj", "def n_rings(self) -> ir....
[ "0.7434427", "0.7408144", "0.72194934", "0.6211021", "0.6079197", "0.5899056", "0.5897916", "0.5860017", "0.5768126", "0.57630354", "0.57526094", "0.5693516", "0.56714535", "0.5668788", "0.5630838", "0.5614319", "0.56122553", "0.5602262", "0.55929655", "0.55879307", "0.558446...
0.60020804
5
Get the number of vertices in a polygon.
def num_vertices(self, p): ret_val = self._num_vertices(p) return ret_val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_vertices(triangles):\n return numpy.amax(numpy.reshape(triangles, -1)) + 1", "def get_vertices_count(self) -> int:\n # TODO: verify the following claim:\n raise NotImplementedError", "def vertexCount(self):\n return self._nVertices", "def return_num_vertices(self):\n ...
[ "0.7572902", "0.74221414", "0.7310573", "0.72970134", "0.7250358", "0.7250358", "0.7138585", "0.70983976", "0.70617354", "0.70446426", "0.7041562", "0.7037806", "0.70370406", "0.70282245", "0.69579816", "0.6942744", "0.6875427", "0.68084556", "0.6608874", "0.6490258", "0.6465...
0.72609687
4
Loads a Datamine polygon file.
def load(self, file): self._load(file.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_geojson(self, filename_or_url):", "def read_polygon_shapefile(filename):\n result = cpp_read_polygon_shapefile(filename)\n f_pos = Series(result[0], name=\"f_pos\")\n r_pos = Series(result[1], name=\"r_pos\")\n return (\n f_pos,\n r_pos,\n DataFrame({\"x\": result[2...
[ "0.6338089", "0.6252803", "0.6181816", "0.60731417", "0.5974311", "0.5928523", "0.5848612", "0.58414966", "0.5831295", "0.5798595", "0.5795797", "0.57524544", "0.57428813", "0.5741895", "0.5665737", "0.56273293", "0.5615985", "0.56041604", "0.5603526", "0.5588533", "0.558405"...
0.0
-1
Moves a vertex and any associated lines.
def move_vertex(self, p, v, x, y, z): self._move_vertex(p, v, x, y, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_vertices(self, vertices, code):\n for vertex in vertices:\n self.move_vertice(vertex, code)", "def move_vertex(region, vertex, new_vertex, vert_dict):\n # Skip useless moves\n if vertex == new_vertex:\n return\n # Update the original region\n new_vertex_list = [new_v...
[ "0.6833393", "0.66738605", "0.6340052", "0.5827739", "0.5708329", "0.5676819", "0.56136113", "0.55963665", "0.5486447", "0.542023", "0.5396874", "0.53677726", "0.53545994", "0.53276026", "0.5312396", "0.52726305", "0.52651775", "0.5254889", "0.5253261", "0.52463394", "0.52429...
0.7407235
0
Project a polygon onto a vertical plane.
def project_poly(self, p, xp, yp, zp, az, swing, vv_x, vv_y, vv_z): self._project_poly(p, xp, yp, zp, az, swing, vv_x, vv_y, vv_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertical_projection(self, tangent_vec, base_point, **kwargs):\n caller_name = sys._getframe().f_back.f_code.co_name\n if caller_name == \"horizontal_projection\":\n raise NotImplementedError\n\n return tangent_vec - self.horizontal_projection(tangent_vec, base_point)", "def pr...
[ "0.6195961", "0.61341", "0.5734049", "0.57337785", "0.5721817", "0.56993985", "0.5681704", "0.5631848", "0.5547163", "0.55328715", "0.55227035", "0.54876035", "0.54367954", "0.54365534", "0.5432413", "0.54247797", "0.5421689", "0.54175526", "0.54126215", "0.5399177", "0.53482...
0.5962685
2
Recover polygon locations from 2D locations on vertical plane.
def re_project_poly(self, p, xp, yp, zp, az, vv_x, vv_y, vv_x3, vv_y3, vv_z3): self._re_project_poly(p, xp, yp, zp, az, vv_x, vv_y, vv_x3, vv_y3, vv_z3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_path(x, y=None):\n\n if y is None:\n y = x\n\n return np.vstack([\n np.vstack([x, np.full_like(x, y[0])]).T,\n np.vstack([np.full_like(y, x[-1]), y]).T[1:],\n np.vstack([x, np.full_like(x, y[-1])]).T[::-1][1:],\n np.vstack([np.full_like(y, x[0]), y]).T[::-1][1:]...
[ "0.5979969", "0.5954031", "0.5939469", "0.5902364", "0.58006483", "0.5795708", "0.57271653", "0.57141864", "0.56478286", "0.5620588", "0.5546868", "0.5534738", "0.55341685", "0.55209863", "0.5518297", "0.5510692", "0.5507698", "0.5506871", "0.5487547", "0.5487539", "0.5450756...
0.0
-1
Save to a Datamine polygon file
def save(self, file): self._save(file.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_poly(self,ikfile,boresight,x,y,z): \n with open(ikfile, \"w\") as f:\n f.write(\"KPL/IK \\nComments. \\nMore comments. \\nMore comments.\\n\\\\begindata\\n\")\n f.write(\"INS-99999_FOV_SHAPE = 'POLYGON'\\n\")\n f.write(\"INS-99999_FOV_FRAME = 'CAMERA_FRAME'\\...
[ "0.69935197", "0.6767935", "0.6561594", "0.6418711", "0.6340867", "0.62345946", "0.61844146", "0.6182688", "0.6153138", "0.61515814", "0.6147663", "0.61328244", "0.6121449", "0.60852796", "0.60413384", "0.6029136", "0.60212547", "0.5979479", "0.5971337", "0.5961626", "0.59237...
0.0
-1
Set a specific polygon into a `GXDMPPLY ` object.
def set_poly(self, p, vv_x, vv_y, vv_z): self._set_poly(p, vv_x, vv_y, vv_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PolygonPatch(polygon, **kwargs):\n return PathPatch(PolygonPath(polygon), **kwargs)", "def set_geo(self, lon=None, lat=None):\n changed = False\n if not lon:\n lon = self.lon\n if not lat:\n lat = self.lat\n\n if not self.point and lon and lat:\n ...
[ "0.577355", "0.56017464", "0.5550407", "0.5432882", "0.54083717", "0.54041576", "0.53988194", "0.5366352", "0.5344979", "0.5342881", "0.5331345", "0.5315115", "0.5304908", "0.53024393", "0.529416", "0.5247422", "0.5247422", "0.5217033", "0.5207257", "0.52057105", "0.5195183",...
0.5893092
0
Establish an active and stable connexion session with the database.
def set_db_connexion(self, db_name='local_backup'): dbapi = pd.read_json(os.path.join(self.config_path, "db_access_credentials.json"), orient='index') # Let's create a connexion from the DBAPI variables connexion = 'mysql+mysqlconnector://{0}:{1}@{2}:{3}/{4}?auth_plugin={5}' conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\n\n assert not self.__is_connected\n\n self._db_engine = create_engine(self._database.url)\n\n from sqlalchemy import event\n\n if self._database.driver == 'sqlite':\n @event.listens_for(self._db_engine, \"connect\")\n def do_connect(dbapi_conne...
[ "0.70111114", "0.6944526", "0.6827514", "0.67787033", "0.67468804", "0.6721154", "0.6599657", "0.65946597", "0.6579148", "0.6566786", "0.6530919", "0.65090156", "0.65027946", "0.646757", "0.64328957", "0.642442", "0.6420416", "0.63758856", "0.63200074", "0.6317311", "0.630476...
0.0
-1
Loads all the tables and columns indicated in the 'table_properties.json' file.
def load_db_tables(self): self.list_of_tables = pd.read_json(os.path.join(self.config_path, self.db_config_file), orient='records')[self.report_type]['table'] # Loading tables from database for aux_index, table in enumerate(self.list_of_tables):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_tables():\n inf(\"Loading tables\")\n \n m_url = 'https://s3-us-west-2.amazonaws.com/boliek-public/animals/'\n \n pinners = Table('pinners', metadata, autoload=True)\n i = pinners.insert()\n i.execute({'name': 'Mary', 'email': 'mary@example.com'},\n {'name': 'John', 'emai...
[ "0.638267", "0.6109927", "0.60784876", "0.60767394", "0.59831834", "0.5930532", "0.592881", "0.5912661", "0.5858813", "0.58003217", "0.5800225", "0.5783026", "0.5745354", "0.5733871", "0.5620355", "0.5606268", "0.5604591", "0.5598335", "0.55940664", "0.55940664", "0.55940664"...
0.6360058
1
Takes the instructions contained in the 'report_config.json' configuration file and translates it into one single DataFrame taking into account the merge strategy specified in the previous configuration file.
def merge_tables(self): table_params = pd.read_json(os.path.join(self.config_path, self.db_config_file), orient='records')[self.report_type]['table'] self.trees = create_tree(table_params) for tree in self.trees: self._recursive_merge(tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n\n # create dataframes of relevant sections from the INP\n for ix, sect in enumerate(self.config['inp_sections']):\n if ix == 0:\n df = create_dataframeINP(self.inp.path, sect, comment_cols=False)\n else:\n df_other = create_dat...
[ "0.55674183", "0.55570614", "0.5482151", "0.5459528", "0.54411393", "0.54050994", "0.53489965", "0.5330514", "0.5304818", "0.52511984", "0.5240409", "0.5146737", "0.5112861", "0.5105909", "0.5098262", "0.5088004", "0.5065563", "0.50642633", "0.5055335", "0.50124764", "0.50093...
0.4833771
47
Replicates the tree's hierarchical merge structure using pandas DataFrames. Tree nodes represent database tables. Tree branches represent database joints. Merges are executed bottomup from the tree
def _recursive_merge(self, tree: Tree): # Keep record of the parent subtree parent = tree # Visit all child nodes: # 1) If child node is a leaf node, then merge parent node with child node # 2) If child node is a root node, then: # 2.1) Merge recursive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(self):\n collapsable = self.findSameSubtrees()\n\n dummy = GraphiusNode(-1, None)\n for i, node in self.nodes.items():\n dummy.addNeighbor(node)\n\n # Perform the merge\n self.mergeHelper(dummy, collapsable)\n\n # Regenerate trees\n newNodes = s...
[ "0.6471755", "0.6253537", "0.61979556", "0.59609455", "0.58390087", "0.5759789", "0.5619037", "0.5617006", "0.5607947", "0.55914813", "0.5580155", "0.55757487", "0.5564688", "0.5492073", "0.5438949", "0.54049015", "0.5393453", "0.5378428", "0.5347989", "0.53187037", "0.531251...
0.6259005
1
Merges the tables received as parameters and updates 'list_of_tables' with the resultant DataFrame.
def _merge_dataframes(self, left_node: Node, right_node: Node): left_dataframe = self._get_table(left_node.name) right_dataframe = self._get_table(right_node.name) join_id = 0 while left_node.inner_joins[join_id]['join_with'] != right_node.name: join_id += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfers_dataframe(tables_list):\r\n return pd.concat([pd.DataFrame(table[1:], columns=table[0]) for table in tables_list])", "def merge_tables(self):\r\n\r\n table_params = pd.read_json(os.path.join(self.config_path, self.db_config_file),\r\n orient='records')[s...
[ "0.6903812", "0.67269605", "0.6648147", "0.65687126", "0.6538397", "0.6148486", "0.61468905", "0.59784114", "0.59292185", "0.59101725", "0.59032935", "0.5883406", "0.58263016", "0.5786118", "0.5719547", "0.56752616", "0.56693965", "0.56541306", "0.56084347", "0.55986196", "0....
0.0
-1
Connect to the AMQP broker. Creates a new channel.
def connect(self): if self._connection is not None: self.logger.debug('Using allready existing connection [{}]'.format( self._connection)) # Create a new communication channel self._channel = self._connection.channel() return True try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_connection(self):\n if self.conn:\n raise Exception(\"Connection already open\")\n cfg = self.config[self.MODULE_NAME]['amqp']['connection']\n log.debug(str(cfg))\n self.conn = pika.AsyncoreConnection(pika.ConnectionParameters(\n credentials = pika.PlainCredentials(cfg['login']...
[ "0.7663311", "0.74569315", "0.73494196", "0.72351396", "0.7220851", "0.7121007", "0.7089945", "0.70042527", "0.69759655", "0.69444203", "0.69243073", "0.6822237", "0.6777999", "0.67424124", "0.67098606", "0.65386856", "0.65152943", "0.64662087", "0.6450038", "0.63871974", "0....
0.70205045
7
Force process amqp events, such as heartbeat packages.
def process_amqp_events(self): self.connection.process_data_events()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heartbeat_event(self, event):\r\n while not self.imm_jobs.empty():\r\n imm_job = self.imm_jobs.get_nowait()\r\n imm_job(self)\r\n \r\n if self.do_reconfigure:\r\n self.selmgr.reconfigure(self.current_consensus())\r\n self.do_reconfigure = False\r\n \r\n if self.run_all_jobs:\...
[ "0.57334954", "0.56041074", "0.56010824", "0.55979455", "0.5568188", "0.55039835", "0.5465826", "0.5444292", "0.5444292", "0.5444292", "0.5439717", "0.5411059", "0.5408663", "0.54069597", "0.53820825", "0.53328305", "0.53275687", "0.5296802", "0.52871495", "0.526257", "0.5261...
0.7338269
0
Create a new exchange.
def create_exchange(self, exchange_name, exchange_type, internal=None): self._channel.exchange_declare( exchange=exchange_name, durable=True, # Survive reboot passive=False, # Perform a declare or just to see if it exists internal=internal, # Can only be publis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exchange(self, exchangename, public_key, private_key, user_id, uid = None, pw = None):\n if not exchangename or not public_key or not private_key:\n raise Exception(\"Exchangename, public key and private key must be given\")\n else:\n return self.exch_repo.create(exch...
[ "0.7370517", "0.6457336", "0.643226", "0.6169629", "0.61339194", "0.6089777", "0.59855735", "0.59621066", "0.59481925", "0.5879927", "0.58365184", "0.57017606", "0.5689928", "0.5689928", "0.5655385", "0.55897355", "0.55276364", "0.55152327", "0.5488463", "0.53955394", "0.5384...
0.7666469
0