query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Test for graph threshlding using global cost efficiency (GCE) on OMSTs (extract all MSTs).
def test_graphs_threshold_omst_global_cost_efficiency(): # the function is optmized at the 3rd OMST. # Groundtruth expected = np.load("groundtruth/graphs_threshold/omst_gce.npy") # Data graph = np.load("sample_data/graphs_threshold/graph.npy") # Run _, CIJtree, _, _, _, _, _, _ = threshol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_omst_global_cost_efficiency2():\n # the function is optmized at the 3rd OMST, so it is going to yeild the same results\n # as the exhaustive search\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/omst_gce.npy\")\n\n # Data\n graph = np.load(\"sample...
[ "0.79985285", "0.7497226", "0.62382823", "0.5841657", "0.5809271", "0.58082795", "0.57625425", "0.5664338", "0.5620274", "0.56043947", "0.5597901", "0.55592453", "0.5536385", "0.55205554", "0.55058116", "0.5488807", "0.5447505", "0.5446787", "0.5415955", "0.5395625", "0.53925...
0.7873814
1
Test for graph threshlding using global cost efficiency (GCE) on OMSTs (extract the first five MSTs).
def test_graphs_threshold_omst_global_cost_efficiency2(): # the function is optmized at the 3rd OMST, so it is going to yeild the same results # as the exhaustive search # Groundtruth expected = np.load("groundtruth/graphs_threshold/omst_gce.npy") # Data graph = np.load("sample_data/graphs_thr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_graphs_threshold_omst_global_cost_efficiency():\n # the function is optmized at the 3rd OMST.\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/omst_gce.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_threshold/graph.npy\")\n\n # Run\n _, CIJtree, _, _, _,...
[ "0.7837865", "0.7225295", "0.60356164", "0.58807117", "0.58703625", "0.5838802", "0.58160937", "0.572131", "0.5690975", "0.56728786", "0.5653771", "0.5638937", "0.55792546", "0.55695164", "0.5542509", "0.55252403", "0.5513242", "0.5506854", "0.54791296", "0.54750746", "0.5465...
0.79966146
0
Test for graph thresholding based on the economical method.
def test_graphs_threshold_eco(): # Groundtruth expected_filt = np.load("groundtruth/graphs_threshold/eco_filtered.npy") expected_bin = np.load("groundtruth/graphs_threshold/eco_binary.npy") # Data graph = np.load("sample_data/graphs_threshold/graph2.npy") # Run filterted, binary, _ = thre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, threshold=0.5):\n pass", "def apply_thresholding(x):\n return x > threshold_otsu(x)", "def test_graphs_threshold_global_cost_efficiency():\n\n # Groundtruth\n expected = np.load(\"groundtruth/graphs_threshold/gce.npy\")\n\n # Data\n graph = np.load(\"sample_data/graphs_...
[ "0.6416092", "0.63370824", "0.62137026", "0.6199239", "0.6188419", "0.6137018", "0.6124308", "0.6087063", "0.6036492", "0.6019357", "0.60054135", "0.59911543", "0.5983166", "0.59308624", "0.59052336", "0.59034336", "0.5896829", "0.588666", "0.58629286", "0.5836026", "0.580677...
0.657838
0
Returns True if and only if `expr` contains only correctly matched delimiters, else returns False.
def check_delimiters(expr): delim_openers = '{([<' delim_closers = '})]>' ### BEGIN SOLUTION s = Stack() for c in expr: if c in delim_openers: s.push(c) elif c in delim_closers: try: t = s.pop() if delim_openers.fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_delimiters(expr):\n s = Stack()\n newExpr = expr.replace(\" \", \"\")\n if len(newExpr) ==1:\n return False\n else:\n for c in newExpr:\n if c in delim_openers:\n s.push(c)\n elif c in delim_closers:\n toCheck = delim_openers[d...
[ "0.7133583", "0.6683183", "0.62793124", "0.6187382", "0.6016125", "0.5943181", "0.582906", "0.5734482", "0.572137", "0.57109636", "0.5685574", "0.56454945", "0.56169343", "0.55317014", "0.5522385", "0.55221826", "0.5514102", "0.54350483", "0.5418066", "0.5408045", "0.53892976...
0.7151421
0
Returns the postfix form of the infix expression found in `expr`
def infix_to_postfix(expr): # you may find the following precedence dictionary useful prec = {'*': 2, '/': 2, '+': 1, '-': 1} ops = Stack() postfix = [] toks = expr.split() ### BEGIN SOLUTION opp = {'*', '/','+', '-'} for x in toks: if str.isdigit(x): post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infix_to_postfix(expr):\n ops = Stack()\n postfix = []\n toks = expr.split()\n def tests(chr):\n if chr.isdigit():\n postfix.append(chr)\n\n elif chr == '(':\n ops.push('(')\n\n elif ops.peek() == '(' or ops.empty():\n ops.push(chr)\n\n e...
[ "0.81900203", "0.7801753", "0.76920533", "0.7429643", "0.7404279", "0.7347274", "0.7156811", "0.7048756", "0.6956311", "0.6874034", "0.68503463", "0.67862564", "0.67233485", "0.6722634", "0.6648669", "0.6607104", "0.65920854", "0.6575015", "0.65612596", "0.65422934", "0.64984...
0.7979371
1
Determines whether or not a project exists at the specified path
def project_exists(response: 'environ.Response', path: str) -> bool: if os.path.exists(path): return True response.fail( code='PROJECT_NOT_FOUND', message='The project path does not exist', path=path ).console( """ [ERROR]: Unable to open project. The specif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(repo_path):\n\n if not ProjectRepo.existing_git_repository(repo_path):\n cprint(' - Project is missing', 'red')", "def is_project_created(path):\n project_id = None\n try:\n with open(\"%s%sproject\"\n % (path, os.sep)) as project_file:\n proj...
[ "0.781922", "0.77002376", "0.6944617", "0.6784362", "0.66010505", "0.65764564", "0.65411824", "0.6539585", "0.65192175", "0.64994127", "0.6494861", "0.6490263", "0.6452931", "0.64370346", "0.6418735", "0.6405294", "0.63952315", "0.63933635", "0.63204074", "0.62900877", "0.628...
0.85413456
0
Convert phrase to a vector by aggregating it's word embeddings. Just take an average of vectors for all tokens in the phrase with some weights.
def get_phrase_embedding(phrase): vector = np.zeros([model.vector_size], dtype='float32') # 1. lowercase phrase phrase = phrase.lower() # 2. tokenize phrase phrase_tokens = tokenizer.tokenize(phrase) # 3. average word vectors for all words in tokenized phrase, skip ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sentence_average_w2v(sent, word_to_vec, embedding_dim):\n sum_vec = np.zeros((embedding_dim,))\n known_tokens = 0\n for token in sent.text:\n if (token in word_to_vec.dict):\n known_tokens += 1\n sum_vec += word_to_vec[token]\n if (known_tokens != 0):\n retur...
[ "0.7514688", "0.72182834", "0.7089494", "0.702476", "0.69361097", "0.6867072", "0.6737069", "0.6620378", "0.6577739", "0.6555899", "0.6496128", "0.6492713", "0.63574034", "0.6309373", "0.6279589", "0.62726533", "0.62423867", "0.62186897", "0.62141794", "0.62009865", "0.618895...
0.76256436
0
.iso639 | .iso639 Search ISO 6391, 2 and 3 for a language code.
def iso639(phenny, input): response = "" thisCode = str(input.group(1)).lower() if thisCode == "None": thisCode = random.choice(list(phenny.iso_data.keys())) #ISOcodes[random.randint(0,len(ISOcodes)-1)] #random.choice(ISOcodes) else: if len(thisCode) > 3: # so that w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_name(iso_code):\n if iso_code not in LANGUAGES_BY_CODE:\n try:\n lang = iso639.languages.get(part3=iso_code)\n except KeyError:\n lang = None\n\n if lang:\n # we only show up to the first semi or paren\n lang = re.split(r\";|\\(\"...
[ "0.70005405", "0.66463333", "0.6645652", "0.6610556", "0.6142019", "0.60717714", "0.6025807", "0.59968865", "0.5969312", "0.5852153", "0.5746316", "0.5722876", "0.5703971", "0.56456345", "0.5644901", "0.5622933", "0.558205", "0.5573778", "0.5565431", "0.55480707", "0.55263364...
0.6822768
1
Print last `n` lines of file
def file_tail(filename, n): result = '' with open(filename, 'r') as f: for line in (f.readlines()[-n:]): result += line return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tail(filepath, n):\n with open(filepath) as file_fd:\n lines = ''.join(file_fd.readlines())\n lines = lines.splitlines()[-n:]\n return lines", "def tail(fname, n):\n try:\n f = open(fname, 'r')\n except IOError:\n print \"IOError: No such file or directory: '\" + f...
[ "0.7867674", "0.75946647", "0.75466275", "0.75340295", "0.749208", "0.7458377", "0.74379706", "0.73325574", "0.7127996", "0.7094037", "0.7092303", "0.703745", "0.6764117", "0.67202204", "0.6649864", "0.6596833", "0.6591324", "0.6550445", "0.6541051", "0.6526451", "0.64327246"...
0.822962
0
Get the disks file names from the domain XML description.
def GetFilesToBackup(domainXml): disks = root.findall("./devices/disk/source") files = [] for disk in disks: files.append(disk.get("file")) return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disks(self):\n # root node\n root = ElementTree.fromstring(self.libvirt_domain.XMLDesc())\n\n # search <disk type='file' device='disk'> entries\n disks = root.findall(\"./devices/disk[@device='disk']\")\n\n # for every disk get drivers, sources and targets\n driver...
[ "0.70366144", "0.60827386", "0.6071412", "0.60200167", "0.58255386", "0.57854563", "0.5739114", "0.5662612", "0.5511752", "0.55094075", "0.5422538", "0.54208255", "0.5409883", "0.53792715", "0.53779566", "0.5372456", "0.5366111", "0.5341019", "0.53092587", "0.52980816", "0.52...
0.6748915
1
Reads a CSV file for a catalog into a long format Python dictionary. The first line is assumed to be the header line, and must contain the field 'item_name'.
def _read_csv_to_dictionary_list(file_name): catalog_list = [] with open(file_name) as csvfile: reader = csv.DictReader(csvfile) for item in reader: catalog_list.append(item) return catalog_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(file):\n \n dictionary = {}\n csv_fp = csv.reader(file)\n #L[46] = manufacturer, L[63] = year\n #L[4]= city mileage, L[34]=highway mileage\n for line in csv_fp:\n #Skip the headings and the year 2017\n if (not (line[46] == 'make')) and (not (line[63] == '2017')):\n ...
[ "0.63216645", "0.62248164", "0.62061137", "0.6192558", "0.6182252", "0.6102906", "0.60775477", "0.60724336", "0.6050117", "0.60413975", "0.6032285", "0.6017968", "0.5999429", "0.59157795", "0.5901393", "0.5890702", "0.58753383", "0.5854863", "0.58544135", "0.5853177", "0.5830...
0.6988612
0
This function will return Grid size of UI based on difficulty level.
def get_grid_size(game_level): grid_length = 0 grid_width = 0 minecount = 0 if game_level == DifficultyLevel.BeginnerLevel: grid_length = GridSize.BeginnerLength grid_width = GridSize.BeginnerWidth minecount = 10 elif game_level == DifficultyLevel.IntermediateLevel: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid_width(self):\n # replace with your code\n return 0", "def get_grid_width(self):\r\n # replace with your code\r\n return self._grid_width", "def get_grid_width(self):\r\n # replace with your code\r\n return self._grid_width", "def get_grid_width(self):\n ...
[ "0.7599145", "0.7387938", "0.7387938", "0.73785955", "0.73785955", "0.73658544", "0.7362196", "0.7362196", "0.73549694", "0.73397446", "0.7320358", "0.7320358", "0.7248299", "0.71656466", "0.7147601", "0.7137378", "0.70814574", "0.7061186", "0.70521265", "0.7037405", "0.70374...
0.7612548
0
This function updates the timer lcd
def timer_change(self): if self.time < 999: self.time += 1 self.time_lcd.display(self.time) else: self.timer.stop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_timer(self):\r\n frmt_time = \"%d:%02d\" % (self.time_minutes, self.time_seconds)\r\n self.time_seconds += 1\r\n if self.time_seconds == 60:\r\n self.time_seconds = 0\r\n self.time_minutes += 1\r\n\r\n self.mainWidget.statusLabel.setText(\"{} {} --- {} {...
[ "0.76056844", "0.71149886", "0.70156574", "0.69157463", "0.68125004", "0.6781015", "0.67532974", "0.67068124", "0.6642209", "0.66009486", "0.65852726", "0.658475", "0.6575836", "0.65547466", "0.6551715", "0.65476876", "0.6518006", "0.64748704", "0.64519894", "0.6446896", "0.6...
0.76348394
0
This function handles the left click action on each of the grid cell. It will also handle the actions required
def handle_left_click(self): if not self.game_in_progress: return if self.first_click: self.first_click = False self.timer.start(1000) sender = self.sender() row = 0 col = 0 for row in range(self.rows): for col in range(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(self):\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n self.running = False\n if event.type == pygame.MOUSEBUTTONDOWN:\n self.set_selected(self.mouse_on_grid())\n if self.get_selected() is not None and event.type ...
[ "0.68467045", "0.6845051", "0.67083263", "0.66543925", "0.66423655", "0.6475575", "0.6378554", "0.6321787", "0.62958163", "0.6274282", "0.6253774", "0.6249839", "0.6205736", "0.6193917", "0.61531395", "0.61405647", "0.61154956", "0.610005", "0.6096469", "0.6071234", "0.605045...
0.70425814
0
This function handles the right click action on grid cell.
def handle_right_click(self): if not self.game_in_progress: return if self.first_click: self.first_click = False self.timer.start(1000) sender = self.sender() row = 0 col = 0 for row in range(self.rows): for col in range(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_right_click(self, pixel):\n position = self.pixel_to_position(pixel)\n index = self.position_to_index(position, self._grid_size)\n\n self._board.flag_cell(index)\n self.draw_board(self._board)", "def OnLabelRightClick(self, evt):\n \n self.actRow = evt.Row\n ...
[ "0.7525203", "0.6962284", "0.6924462", "0.6863856", "0.68567437", "0.6788664", "0.6637235", "0.66249645", "0.65822953", "0.65635735", "0.65635735", "0.65568894", "0.65074617", "0.64916843", "0.6483928", "0.6479727", "0.6405769", "0.6323705", "0.6301398", "0.6299117", "0.62538...
0.7056489
1
This function displays help about game This function will pop up message box to user
def game_help(self): QtGui.QMessageBox.about(self, "How to Play game", "<b>How to Play</b><br>" "The rules in Minesweeper are simple:<br><br>" "<b>1.</b> Uncover a mine and that's end of game <br>" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help():\n messagebox.showinfo(title='How to Use', message=\"It's really easy.\")", "def help():\n print \"Help comes to those who ask\"", "def helpHelp(self):\r\n QtGui.QMessageBox.about(self, \"Help me!\",\"\"\"\r\n <p> Program sucks and you need help?\r\n <p>Email: \r\...
[ "0.789727", "0.7568061", "0.7517027", "0.7386369", "0.7310226", "0.7303696", "0.72714776", "0.71972084", "0.71936107", "0.71525615", "0.7152087", "0.7150587", "0.7049491", "0.7043867", "0.7041325", "0.7036719", "0.70153403", "0.70116055", "0.69836533", "0.69385743", "0.690119...
0.87623113
0
This function helps in changing game level When user clicks on change game level from File menu this function will change height and width of grid.
def change_game_level(self, change_level): global CURRENT_GAME_LEVEL file_object = open("Level.txt", "w") file_object.write(str(change_level)) file_object.close() CURRENT_GAME_LEVEL = change_level if change_level == DifficultyLevel.BeginnerLevel: grid_length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupLevel(self):\n\n self.state = GameState.SETUP\n\n # vado a leggere il dizionario corrispondente\n # al numero di livello corrente facendo in modo\n # che se il numero di livello richiesto non esiste\n # carico quello più vicino a quello richiesto\n if self.levelIn...
[ "0.6549542", "0.65455246", "0.5846803", "0.5705636", "0.56784075", "0.56639093", "0.56557", "0.5648059", "0.56119126", "0.55274254", "0.5508719", "0.54641163", "0.54441774", "0.5439524", "0.54059404", "0.5385119", "0.53591174", "0.5351808", "0.5346402", "0.5331341", "0.532824...
0.70741254
0
Parse ``define``'s of constants and of types.
def parse_defines(self): for line in self.header.splitlines(): if line.lower().startswith("#define"): _, line = line.strip().split(None, 1) # remove #define if " " in line: symbol, value = line.split(None, 1) if value.isdigit():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_define_variable(self):\n self.assertEqual(['define', 'test', '\"test\"'],\n grammar._DEFINE_VAR.parseString(\"#define test \\\"test\\\"\").asList())\n\n self.assertEqual(['define', 'test', \"f(w,x)\"],\n grammar._DEFINE_VAR.parseString(\"#defin...
[ "0.636398", "0.57366693", "0.5598086", "0.55355525", "0.53910017", "0.53386915", "0.5338318", "0.53181356", "0.52843934", "0.51965386", "0.5190159", "0.5169622", "0.51104206", "0.504494", "0.50343925", "0.50150555", "0.5005637", "0.49932948", "0.49319997", "0.4893059", "0.489...
0.7308531
0
Cast a ctypes object or byref into a Python object.
def deref(obj): try: return obj._obj.value # byref except AttributeError: try: return obj.value # plain ctypes except AttributeError: return obj # plain python
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_pyobj(space, w_obj, w_userdata=None, immortal=False):\n assert not is_pyobj(w_obj)\n if w_obj is not None:\n py_obj = w_obj._cpyext_as_pyobj(space)\n if not py_obj:\n py_obj = create_ref(space, w_obj, w_userdata, immortal=immortal)\n #\n # Try to crash here, inst...
[ "0.6561695", "0.6400061", "0.6284424", "0.6150552", "0.6112126", "0.5926656", "0.58083993", "0.58023477", "0.57096577", "0.56859213", "0.56555754", "0.55901396", "0.5577375", "0.5572786", "0.55587715", "0.55309314", "0.5499725", "0.54556036", "0.5441602", "0.54098374", "0.539...
0.7112424
0
Add a method with specific success codes.
def _set_success_codes(self, fname, success_codes): func = getattr(self._dll, fname) argtypes, func.argtuple_t, restype = self._fundecls[fname] argtypes = [argtype if not (isinstance(argtype, type(ctypes.POINTER(ctypes.c_int))) and argtype._type_.__module__ != "ct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_status_code(runner, return_value):\n if isinstance(return_value, Mapping):\n status_code = return_value.get('statusCode')\n if status_code:\n runner.resource['metadata']['status_code'] = status_code", "def add_status_code(code):\n def class_decorator(cls):\n cls.sta...
[ "0.6259414", "0.6249232", "0.61892796", "0.6104332", "0.60523224", "0.60154104", "0.5901302", "0.58486927", "0.5820936", "0.5702256", "0.56624115", "0.56536525", "0.562311", "0.55835485", "0.5566436", "0.554873", "0.5535785", "0.5483932", "0.54706943", "0.54671884", "0.546718...
0.6456779
0
Return nth value of the modified Tribonnaci sequence Expand the sequence if necessary
def get_tribonnaci(self, n): if n not in self.numbers: current_n = max(self.numbers) while current_n < n: current_n += 1 self.numbers[current_n] = self.numbers[current_n - 1] + \ self.numbers[current_n - 2] + \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lucas(n):\n if n == 0:\n return 2\n elif n == 1:\n return 1\n else:\n nth = lucas(n-1) + lucas(n-2)\n return nth", "def solve(n, seq):\n\n return sum(seq) - (n-1) * (n-2) / 2", "def nth(n, seq):\n try:\n return seq[n]\n except TypeError:\n return ...
[ "0.6478033", "0.6209465", "0.6194479", "0.6160907", "0.61453307", "0.61131483", "0.6061283", "0.5964612", "0.59022593", "0.58862644", "0.5838626", "0.5835178", "0.5829389", "0.582663", "0.5818929", "0.5817166", "0.58149713", "0.58006334", "0.57880753", "0.5778549", "0.577671"...
0.68224144
0
This is a hook for providing more complex voting once logical reasoning has been performed.
def _vote(self, team): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opinion_vote(mode, verbose, revision):\n judge = VotingJudge(mode, revision)\n flags = judge.vote()\n if verbose is True:\n click.echo(\"Vote resulted in %i flags:\" % len(flags))\n for f in flags:\n format_flag(f)", "def process_VOTED(self, msg):\n\n result = parseYe...
[ "0.6289021", "0.5948813", "0.58756876", "0.5792382", "0.5758893", "0.5732524", "0.57292676", "0.5664396", "0.5635303", "0.5612909", "0.5588355", "0.55865514", "0.5553387", "0.5463278", "0.5462347", "0.54601604", "0.5458112", "0.54575557", "0.54467076", "0.5443048", "0.5429653...
0.6151692
1
Get the argument parser for passing times.
def get_parser_times(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "start_time", action="store", type=pandas.Timestamp) parser.add_argument( "end_time", action="store", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--date\", \"-d\", help=\"Date of this lab session\")\n parser.add_argument(\"--time-in\", \"-ti\", help=\"Time string representing the time lab began\")\n parser.add_argument(\"--time-out\", \"-to\", help=\"Time string repre...
[ "0.6568716", "0.59897435", "0.59649503", "0.5915204", "0.5913862", "0.5864289", "0.5827687", "0.5750248", "0.57498866", "0.57411927", "0.57269704", "0.56963646", "0.56855893", "0.5682023", "0.5682023", "0.56393063", "0.56157017", "0.56120384", "0.5598651", "0.55702114", "0.55...
0.74796635
0
Checks if Python version is supported by Cuckoo.
def check_python_version(): version = sys.version.split()[0] if version < "2.6" or version >= "3": raise CuckooStartupError("You are running an incompatible version of Python, please use 2.6 or 2.7")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.7637709", "0.7555077", "0.72389746", "0.7111935", "0.70349747", "0.7027567", "0.70126307", "0.70126307", "0.70126307", "0.70080096", "0.6967738", "0.68840957", "0.6819389", "0.6783709", "0.676768", "0.6756775", "0.6746007", "0.67407185", "0.6651795", "0.66268104", "0.65999...
0.795639
0
Checks if dependencies are installed.
def check_dependencies(): check_python_version() dependencies = ["sqlite3"] for dependency in dependencies: try: __import__(dependency) except ImportError as e: raise CuckooStartupError("Unable to import \"%s\"" % dependency) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dependencies(self):\n imgmin = exists('imgmin')\n image_optim = exists('image_optim')\n\n if not imgmin or not image_optim:\n puts(p('Dependencies have not been installed:'))\n\n message = 'imgmin - https://github.com/rflynn/imgmin'\n message = s('✓ ...
[ "0.793422", "0.7930604", "0.7912953", "0.78336424", "0.76999456", "0.76947135", "0.7686539", "0.7666271", "0.76288325", "0.7572292", "0.75151587", "0.7492932", "0.74447614", "0.74242735", "0.73918897", "0.736468", "0.7360159", "0.7314458", "0.72915107", "0.7267136", "0.725657...
0.82182187
0
Checks if config files exist.
def check_configs(): configs = [os.path.join(CUCKOO_ROOT, "conf", "cuckoo.conf"), os.path.join(CUCKOO_ROOT, "conf", "reporting.conf")] for config in configs: if not os.path.exists(config): raise CuckooStartupError("Config file does not exist at path: %s" % config) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_configfiles():\n return (all(os.path.isdir(x) for x in CONFIG_DIRS) and\n os.path.isfile(CONFIG_FILE) and os.path.isfile(LOG_CONFIG_FILE))", "def __check_config(self):\n if not os.path.exists(self.__config_path):\n return False\n else:\n return True", ...
[ "0.8346882", "0.78028643", "0.77522177", "0.77137613", "0.7490861", "0.72511786", "0.7087832", "0.7071221", "0.70583725", "0.7033269", "0.7024421", "0.69919306", "0.69578743", "0.6946059", "0.6932018", "0.68946105", "0.6867093", "0.6830978", "0.6827687", "0.6827188", "0.67988...
0.8165395
1
Randomly transform image data. Given an input image list (possibly multimodal) and an optional corresponding segmentation image list, this function will perform data augmentation with
def data_augmentation(input_image_list, segmentation_image_list=None, number_of_simulations=10, reference_image=None, transform_type='affineAndDeformation', noise_model='additivegaussian', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_augmentation(image, aug):\n if (aug == \"random_crop\") and (random.randint(0,1)):\n image = random_crop(image) \n if (aug == \"random_rotation\") and (random.randint(0,1)): \n image = random_rotation(image) \n if (aug == \"random_flip\") and (random.randint(0,1)): \n image =...
[ "0.6911291", "0.6776172", "0.6606806", "0.6512269", "0.64750767", "0.64673746", "0.6444081", "0.62625486", "0.6222153", "0.62075675", "0.61686075", "0.6148961", "0.6134152", "0.61139226", "0.6082042", "0.6072987", "0.605287", "0.6020677", "0.6015514", "0.6012553", "0.6000056"...
0.7687681
0
Returns an ``Iterable`` containing all the instances in the specified dataset. If ``self.lazy`` is False, this calls ``self._read()``, ensures that the result is a list, then returns the resulting list. If ``self.lazy`` is True, this returns an object whose ``__iter__`` method calls ``self._read()`` each iteration. In ...
def read(self, *args, **kwargs) -> Iterable[Instance]: lazy = getattr(self, 'lazy', None) if lazy is None: logger.warning("DatasetReader.lazy is not set, " "did you forget to call the superclass constructor?") if lazy: return _LazyInstances(lam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self._datasets)", "def __iter__(self) -> Iterator:\n return iter(self.get_data_loader())", "def __iter__(self) -> Union[Iterator[int], Iterator[Tuple[int, Any]]]:\n self.size = self._data._dataset_size\n if (not self._data._fully_cached or\n ...
[ "0.7040597", "0.6643148", "0.6294192", "0.62414855", "0.61743397", "0.61443645", "0.60582954", "0.6047906", "0.59985113", "0.5981316", "0.5973242", "0.59701633", "0.5944178", "0.5882069", "0.58764064", "0.58696884", "0.5857583", "0.5841389", "0.58389926", "0.5835787", "0.5801...
0.8134299
0
Test the login page elements like button, username field and password field is loded properly or not.
def test_login_page_elements(self): response = self.client.get(reverse('users:login')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'users/login.html') self.assertContains(response, ' <input type="text" name="username"') self.assertContains(respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login(self):\n url_extend = 'user_auth/login/'\n self.browser.get(self.url + url_extend)\n\n # enter the username and password.\n username_field = self.browser.find_element_by_name('user_name')\n username_field.send_keys('user4')\n password_field = self.browser.fi...
[ "0.81608397", "0.7807469", "0.7750099", "0.7648665", "0.7499904", "0.74693316", "0.7445929", "0.7401844", "0.7391671", "0.73524094", "0.73394597", "0.7300667", "0.72945255", "0.7244298", "0.7213896", "0.7185873", "0.7171691", "0.7159399", "0.7155342", "0.7133687", "0.7129667"...
0.8222996
0
Check for valid username and invalid password should not be able to login
def test_valid_username_invalid_password(self): response = self.client.post(reverse('users:login'), {'username': self.user['username'], 'password': '1sfsdf'}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', None, ERROR_MSG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_authentication(self, username, password):\n return self.user_table[username]['pwd'] == password", "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def check_auth(username, password, expected_user, expected_pw):\n ...
[ "0.7802883", "0.778277", "0.7756373", "0.7752627", "0.7586923", "0.75375336", "0.7489758", "0.7483796", "0.74812096", "0.7474361", "0.74624926", "0.7450919", "0.74466735", "0.7442546", "0.74277145", "0.7423208", "0.74196374", "0.74130267", "0.7404624", "0.7398643", "0.7396676...
0.7786559
1
Check for blank username and blank password should not be able to login
def test_blank_username_blank_password(self): response = self.client.post(reverse('users:login'), {'username': '', 'password': ''}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', 'username', 'This field is required.') self.assertFormError(response, 'fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_empty_username(self):\n self.client.post('api/v2/auth/signup', json=self.user,\n headers={'Content-Type': 'application/json'})\n\n res_other = self.client.post('/api/v2/auth/login', json={\n 'username': None, 'password': 'mikemike...
[ "0.7467626", "0.7417053", "0.73873866", "0.73845154", "0.7267287", "0.7184474", "0.7178433", "0.7175828", "0.7163327", "0.71527857", "0.71351755", "0.71197534", "0.70886356", "0.7087536", "0.70774215", "0.7072684", "0.7067899", "0.70463395", "0.7042235", "0.7033119", "0.70229...
0.76699674
0
Retrieves all info needed for worker and puts it into a dictionary
def get_task_worker(self): start, end = self.get_block() return { 'task_id':self.id, 'finished':self.finished, 'free_block':(start != end), 'keyword':self.keyword, 'chars':self.chars, 'algorithm':self.algorithm, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_worker_metadata(self) -> Dict[str, Any]:\n response = await self._client.get(\"collections/views/aggregate-worker-metadata\")\n response.raise_for_status()\n return response.json()", "def get_information(self):\n info_dict = dict()\n info_dict['run'] = self._runN...
[ "0.678594", "0.6314804", "0.61548144", "0.60795724", "0.6061691", "0.60179424", "0.60070586", "0.6003615", "0.6000852", "0.5975921", "0.5956673", "0.59529394", "0.5952804", "0.59031546", "0.5901462", "0.58881104", "0.58605975", "0.58536565", "0.58536565", "0.5828623", "0.5828...
0.6506152
1
Gets the Updated job template right now changes from active to inactive.
def get_updated_jobtemplate(self): return self.response_json
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Updated(self):\n return self._get_attr('Updated')", "def getChanges():", "def last_status_update(self):\n try:\n return StatusUpdate.objects.filter(section=self).latest(\"created_at\")\n except StatusUpdate.DoesNotExist:\n return None", "def changes(self) -> dic...
[ "0.5720681", "0.5635518", "0.5623788", "0.5566456", "0.55534095", "0.5552222", "0.5476115", "0.5407608", "0.5343847", "0.5331713", "0.53309363", "0.5325143", "0.5319297", "0.5319297", "0.5319297", "0.5319297", "0.5312014", "0.5278158", "0.52175415", "0.52158743", "0.52158743"...
0.73913294
0
Display all videos in a playlist with a given name.
def show_playlist(self, playlist_name): if self.playlists[playlist_name.lower()]!=[]: print(f"Showing playlist: {playlist_name}") for i in self.playlists[playlist_name.lower()]: videos = self._video_library.get_all_videos() templist = [] d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_playlist(self, playlist_name):\n if playlist_name.lower() not in self._playlists:\n print(f\"Cannot show playlist {playlist_name}: Playlist does not exist\")\n return\n playlist = self._playlists[playlist_name.lower()]\n print(f\"Showing playlist: {playlist_name}...
[ "0.795203", "0.7930741", "0.7693881", "0.7545777", "0.74915266", "0.68660384", "0.6755695", "0.6657861", "0.6496447", "0.62669796", "0.6146096", "0.6144877", "0.6072285", "0.6068287", "0.6064832", "0.60442716", "0.6008929", "0.59817594", "0.5926295", "0.59068966", "0.59018767...
0.7973328
0
Display all the videos whose titles contain the search_term.
def search_videos(self, search_term): videos = self._video_library.get_all_videos() temp_list = [] for vid in videos: # Convoluted way to display tags in required format tags = "[" for tag in vid.tags: tags = tags + tag + " " tags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_videos(self, search_term):\n results = []\n for video in self._video_library.get_all_videos():\n if search_term.lower() in video.title.lower() and video.flag is None:\n results.append(video)\n self.output_search_results(results, search_term)", "def search...
[ "0.8331212", "0.79130685", "0.78181237", "0.7745555", "0.7296771", "0.71350473", "0.6829117", "0.65758127", "0.6539812", "0.65275896", "0.6482727", "0.6481391", "0.64698297", "0.640734", "0.638748", "0.6354398", "0.63542914", "0.63518894", "0.6330999", "0.6296946", "0.6252102...
0.8280379
1
Display all videos whose tags contains the provided tag.
def search_videos_tag(self, video_tag): videos = self._video_library.get_all_videos() temp_list = [] for vid in videos: # Convoluted way to display tags in required format tags ="[" for tag in vid.tags: tags = tags + tag + " " tag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_videos_tag(self, video_tag):\n results = []\n for video in self._video_library.get_all_videos():\n if video_tag.lower() in video.tags and video.flag is None:\n results.append(video)\n self.output_search_results(results, video_tag)", "def search_videos_tag...
[ "0.8045308", "0.7540733", "0.7481872", "0.73584425", "0.68464065", "0.67552704", "0.63414866", "0.61289597", "0.6046852", "0.59463876", "0.5857648", "0.58262694", "0.5813439", "0.58052194", "0.57624304", "0.57576835", "0.57258624", "0.5666013", "0.5597602", "0.5587654", "0.55...
0.77634656
1
Get current active operational dataset in TLVS format, or None.
async def get_active_dataset_tlvs(self) -> bytes | None: return await self.api.get_active_dataset_tlvs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_get_active_dataset_tlvs(hass: HomeAssistant) -> bytes | None:\n if DOMAIN not in hass.data:\n raise HomeAssistantError(\"OTBR API not available\")\n\n data: OTBRData = hass.data[DOMAIN]\n return await data.get_active_dataset_tlvs()", "def _get_data(self):\n c = Connector(se...
[ "0.64140606", "0.53788054", "0.5368342", "0.5340623", "0.5304488", "0.5285245", "0.5271362", "0.52568066", "0.525625", "0.52145404", "0.5213808", "0.5200595", "0.51775974", "0.51763356", "0.514455", "0.5142501", "0.5142501", "0.5139437", "0.5129725", "0.5113209", "0.50932395"...
0.65660226
0
Create an active operational dataset.
async def create_active_dataset( self, dataset: python_otbr_api.OperationalDataSet ) -> None: return await self.api.create_active_dataset(dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n\n dataset_id = \"{}.airflow\".format(client.project)\n dataset = bigquery.Dataset(dataset_id)\n dataset.location = \"US\"\n dataset = client.create_dataset(dataset, exists_ok=True)\n print(\"Created dataset {}.{}\".format(client.project, dataset.dataset_id))\n return datas...
[ "0.7311756", "0.6959166", "0.6920446", "0.67189634", "0.67153424", "0.6510759", "0.6500872", "0.64714384", "0.6467696", "0.64092255", "0.64085776", "0.6398017", "0.6389895", "0.6304472", "0.62450254", "0.623023", "0.62095875", "0.6189691", "0.6167886", "0.6153979", "0.6152047...
0.7764948
0
Warn user if insecure default network settings are used.
def _warn_on_default_network_settings( hass: HomeAssistant, entry: ConfigEntry, dataset_tlvs: bytes ) -> None: dataset = tlv_parser.parse_tlv(dataset_tlvs.hex()) insecure = False if ( network_key := dataset.get(tlv_parser.MeshcopTLVType.NETWORKKEY) ) is not None and bytes.fromhex(network_ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insecure(self) -> bool:\n return self._insecure", "def set_insecure(self, bool_value=True):\n self.insecure = bool_value\n self._geturl.insecure = bool_value", "def insecure(self, insecure: bool):\n\n self._insecure = insecure", "def no_network_access_check(user):\n return ...
[ "0.6017677", "0.6015723", "0.591362", "0.58963645", "0.5826089", "0.580664", "0.5791929", "0.5757958", "0.5702233", "0.5702233", "0.5658171", "0.5645198", "0.5638157", "0.5638157", "0.5621047", "0.5604798", "0.55833834", "0.55188936", "0.5460819", "0.5445649", "0.5445649", ...
0.79430103
0
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.data.pop(DOMAIN) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):\n unload_ok = await hass.config_entries.async_unloa...
[ "0.697284", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601", "0.6469397"...
0.6888074
1
Get current active operational dataset in TLVS format, or None. Returns None if there is no active operational dataset. Raises if the http status is 400 or higher or if the response is invalid.
async def async_get_active_dataset_tlvs(hass: HomeAssistant) -> bytes | None: if DOMAIN not in hass.data: raise HomeAssistantError("OTBR API not available") data: OTBRData = hass.data[DOMAIN] return await data.get_active_dataset_tlvs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_active_dataset_tlvs(self) -> bytes | None:\n return await self.api.get_active_dataset_tlvs()", "def _get_data(self):\n response = self._get_raw_data()\n if response is None:\n # error has already been logged\n return None\n\n if response.startswith(...
[ "0.6278388", "0.51822865", "0.50992644", "0.50317097", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647",...
0.6420956
0
This function is the_cats_ass. That's an overstatement. This is an understatement. See what I did there? What _you_ can do here is save the sys.ENVIRONMENT by reducing printed waste. Mew.
def the_cats_ass(): return __cat_whisperer()[Cat.ASS]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tuxedo_cat():\n return __cat_whisperer(colors=True, coat='tuxedo_colorz', logo_colorz='dark_logo_colorz')[Cat.ASS]", "def env_cleanup(self):\n pass", "def _create_extra_environment(self):\n return {}", "def calico_kitty():\n return __cat_whisperer(colors=True, coat='calico_colorz', lo...
[ "0.5378321", "0.5314823", "0.51957476", "0.5176816", "0.50836897", "0.5041659", "0.50129634", "0.5007439", "0.49973828", "0.49863762", "0.4961463", "0.4959659", "0.49336305", "0.492728", "0.48846954", "0.48724553", "0.48644373", "0.48611596", "0.48404202", "0.48205215", "0.48...
0.616136
0
You really shouldn't be poking cats. But if you insist, it is recommended to bring catnip as it's not unusual for cats to attack dicks who poke them.
def poke_the_cat(where, catnip=False): if not catnip: from random import randint class BadCat(InterruptedError): pass if randint(1, 10) == 7: mew = "You attempt to poke the cat but it attacks. " \ "Maybe if you gave it some catnip?" rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schrodingers_cat(peek=False):\n from random import choice, randint\n if peek:\n if randint(1, 10) % 2 == 0:\n # RIP\n return \"Nothing at all\"\n else:\n return poke_the_cat(Cat.LEGS, catnip=True)\n else:\n garbled_cries = \"mew meow wokka beocat e...
[ "0.61793715", "0.5548466", "0.52614313", "0.5206707", "0.5189093", "0.5179284", "0.5168439", "0.51067805", "0.51002204", "0.5057231", "0.5049274", "0.4982071", "0.49557567", "0.4942977", "0.4941298", "0.48946017", "0.48391628", "0.48205256", "0.47957787", "0.47827622", "0.471...
0.66019756
0
Peek in the box for a 50/50 shot of retrieving your desired output, while the other half of the time the cat is dead and the function returns nothing at all. If you decide not to peek, the cat being neither dead nor alive responds with random nonsense.
def schrodingers_cat(peek=False): from random import choice, randint if peek: if randint(1, 10) % 2 == 0: # RIP return "Nothing at all" else: return poke_the_cat(Cat.LEGS, catnip=True) else: garbled_cries = "mew meow wokka beocat ekkie".split() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_peek_shows_value_of_current_tail(dq_3):\n assert dq_3.peek() == 'ragtime'", "def poke_the_cat(where, catnip=False):\n if not catnip:\n from random import randint\n\n class BadCat(InterruptedError):\n pass\n\n if randint(1, 10) == 7:\n mew = \"You attempt ...
[ "0.5551094", "0.5481319", "0.54402834", "0.52876055", "0.5216225", "0.5209968", "0.5209621", "0.51197696", "0.509371", "0.50888205", "0.5036659", "0.5000694", "0.49975404", "0.4992409", "0.4970316", "0.49431387", "0.49377355", "0.49363643", "0.4902926", "0.48842472", "0.48525...
0.6159067
0
Thread that polls to get the current force on the FSR. Populates the self._average_force value.
def _force_loop(self): NUM_SAMPLES = 10.0 # Get the initial readings time.sleep(1) readings = [] for i in range(0, int(NUM_SAMPLES)): readings.insert(0, self._sensor.value) time.sleep(self._sampling_rate) self._average_force = sum(r for r in read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n lastbeat = time.time()\n averages = []\n for x in range(self.keep_amount):\n averages.append(1)\n while self.run:\n cur_amount = len(averages)\n if self.keep_amount != cur_amount:\n if self.keep_amount < cur_amount:\n ...
[ "0.6141744", "0.57550305", "0.5539875", "0.551071", "0.54476047", "0.5357573", "0.53213555", "0.5257272", "0.52194697", "0.5190291", "0.51847667", "0.51847667", "0.5159389", "0.5158231", "0.51533365", "0.51522845", "0.5108973", "0.5106741", "0.5078752", "0.5078129", "0.506391...
0.71686685
0
Find a natural gutter between start and stop, inclusive.
def get_gutter(start_obj, stop_obj): log.debug(f'get_gutter({start_obj.group(0)}, {stop_obj.group(0)})') start = start_obj.end(0) stop = stop_obj.start(0)-1 gutters = list() for column in range(start, stop+1): if all(line.rjust(column+1)[column] == ' ' for line in lines): gutters.append(column) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNiceExtentsBySpacing(minval,maxval,spacing,tolerance):\n pass", "def find_midpoint(start, end):\n mid = (start + end) / 2\n return int(mid)", "def gutter_spacing(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"gutter_spacing\")", "def gutter_spacing(self) -> Optional[...
[ "0.6075604", "0.57111067", "0.57065743", "0.57065743", "0.57065743", "0.55262905", "0.5473661", "0.5458969", "0.538811", "0.5384582", "0.5346922", "0.5319414", "0.5292439", "0.51302606", "0.5105891", "0.51037973", "0.5075034", "0.5074723", "0.5058725", "0.50488275", "0.498400...
0.80115026
0
Returns a list of request names of requests in runningopen state
def getRunningOpen(self, teamName): result = [] for request in self.status: if self.status[request] == 'running-open': result.append(request) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetRequestsByState(self, state):\n requests_dir = self._spool_state_dirs[state]\n return sorted(os.listdir(requests_dir))", "def get_available_request(self):\n for med in self.__state.__class__.__dict__:\n if med.startswith('request_'): yield med", "def get_requests(self):\n\t\tsel...
[ "0.69532305", "0.67579085", "0.6556441", "0.65352577", "0.6497508", "0.64858216", "0.6394398", "0.6211951", "0.60207194", "0.60156894", "0.59925896", "0.5909057", "0.5878461", "0.58699447", "0.58357877", "0.57668465", "0.57654035", "0.576168", "0.5757679", "0.5750489", "0.566...
0.7229156
0
Function for rendering the home page
def render_home(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n return render_template('home_page.html')", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def home()...
[ "0.88329524", "0.86391366", "0.8630416", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.8602575", ...
0.88435775
0
Function for rendering an existing session page
def render_player_session(id): sess = get_player_session(id) if sess: pass #return render_template("session.html") else: pass #some kind of 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginPage():\n\n state = ''.join(random.choice(string.ascii_uppercase + string.digits)\n \t for x in xrange(32))\n login_session['state'] = state\n return render_template('login.html', STATE=state)", "def index():\n print(\"Inside index()\")\n if \"display_name\" not in session:\...
[ "0.68190837", "0.6669858", "0.66534925", "0.6565649", "0.65498805", "0.6485435", "0.63670814", "0.635986", "0.6321983", "0.6302406", "0.62669337", "0.6244736", "0.62421983", "0.62421983", "0.62374693", "0.6187892", "0.6185891", "0.6181225", "0.61790746", "0.61767036", "0.6166...
0.7415087
0
Function for rendering a DM session page
def render_DM_session(id): sess = get_DM_session(id) if sess: pass else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_player_session(id):\r\n\tsess = get_player_session(id)\r\n\tif sess:\r\n\t\tpass\r\n\t\t#return render_template(\"session.html\")\r\n\telse:\r\n\t\tpass\t\t\r\n\t\t#some kind of 404\r", "def loginPage():\n\n state = ''.join(random.choice(string.ascii_uppercase + string.digits)\n \t fo...
[ "0.69160146", "0.6585566", "0.6536112", "0.62708634", "0.6269151", "0.6269151", "0.62596005", "0.6238901", "0.61822796", "0.6137672", "0.6050705", "0.603166", "0.6014789", "0.59822565", "0.59557796", "0.59547424", "0.5920551", "0.589151", "0.58809185", "0.5834792", "0.5823835...
0.7526199
0
Return user properties from OGDS. Always returns a minimal set of the properties 'ogg.user.userid' and 'ogg.user.title' even when no ogdsuser is found.
def _collect_properties(self): properties = { 'userid': self.user_id, 'title': self.get_fullname() } if not self.ogds_user: return properties for attribute_name in self.ogds_user_attributes: value = getattr(self.ogds_user, attribute_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_user_gql(data):\n return {\n \"pk\": int(data[\"id\"]),\n \"username\": data[\"username\"],\n \"full_name\": data[\"full_name\"],\n \"is_private\": data[\"is_private\"],\n \"profile_pic_url\": data[\"profile_pic_url\"],\n \"is_verified\": data.get(\"is_verif...
[ "0.64163625", "0.59113324", "0.58720744", "0.58373237", "0.569525", "0.558774", "0.5474033", "0.5464169", "0.54381526", "0.5365471", "0.53464866", "0.53319556", "0.53300774", "0.5273262", "0.5270092", "0.5262506", "0.52574897", "0.5255697", "0.5240036", "0.5235572", "0.522683...
0.7212165
0
Calls functions in each NN file to get results. Starts with python, calls run file for c++ versions
def get_results(): #Get python results import mnist_nn import mnist_nn_gpu mnist_nn.save_results() mnist_nn_gpu.save_results() #Get cpp results import subprocess subprocess.call(['c++//./run.sh'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cpp(self):", "def main():\n\n config = None\n\n try:\n args = get_args()\n config = process_config(args.config)\n raise RuntimeError(\"Missing or invalid arguments\")\n except Exception as e:\n logging.error(\"Failed\", exc_info=e)\n\n print(\"Create the data gener...
[ "0.65926754", "0.6401703", "0.63215774", "0.63125354", "0.6269683", "0.62658095", "0.6245949", "0.6243756", "0.622921", "0.62033784", "0.61332804", "0.6127914", "0.61143494", "0.6087046", "0.60750556", "0.6072328", "0.606391", "0.6054718", "0.6037091", "0.6021028", "0.6000744...
0.668048
0
Create tables Start with Times table, load in the data and put into useful lists. Load lists into numpy array, then create cell text. Create columns, column colors, then create the table and save it. Repeat for accuracy table.
def create_tables(times, accuracies, batch_sizes): #Get time data p_cpu_times = list(times[0].values()) p_gpu_times = list(times[1].values()) c_cpu_times = list(times[2].values()) c_gpu_times = list(times[3].values()) #Get differences in times p_diff_times = [a - b for a, b in zip(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_display_data_table():\n\n for ccd in range(0, 10):\n for node in range(0, 4):\n file = 'ccd' + str(ccd) + '_' + str(node)\n infile = data_dir + file\n outfile = web_dir + 'Data/' + file\n\n f = open(infile, 'r')\n data = [lin...
[ "0.69752", "0.6746598", "0.66616607", "0.657273", "0.6527887", "0.6494611", "0.6466136", "0.6444683", "0.64372617", "0.63944316", "0.63084507", "0.63014144", "0.6282424", "0.62796277", "0.62533253", "0.6238252", "0.62094986", "0.61975396", "0.61698943", "0.6117473", "0.611501...
0.7961645
0
Create accuracy plots for each batch size Load in accuracy information into useful lists, then create a plot. Each plot has the accuracy for all 4 datasets listed
def create_batch_plots(accuracies, batch_sizes): #Get accuracy data p_cpu_accuracy = list(accuracies[0].values()) p_gpu_accuracy = list(accuracies[1].values()) c_cpu_accuracy = list(accuracies[2].values()) c_gpu_accuracy = list(accuracies[3].values()) #Create plot for each batch size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_plot(LS_sizes, data_fun):\r\n\r\n opt_neigh = []\r\n\r\n #plot of optimal n_neighbors as a function of the LS size\r\n\r\n for size in LS_sizes:\r\n\r\n acc = []\r\n neighbors_values = np.arange(1,size+1,1)\r\n\r\n # For a given LS size, plots of accuracy(n_neighbors)\r\n...
[ "0.73184514", "0.7299639", "0.70774925", "0.69942814", "0.6946279", "0.6922432", "0.68750584", "0.6874822", "0.6822587", "0.6822159", "0.67851657", "0.6782538", "0.6775013", "0.6749557", "0.6698696", "0.6659146", "0.6657379", "0.6631417", "0.6601273", "0.6561536", "0.6523589"...
0.78852516
0
Enables some of the global JAX flags for debugging.
def enable_jax_debugging_flags(): # Enable the NaN-checker behavior to cause JAX to hard-break on the first # occurrence of a NaN. jax.config.update('jax_debug_nans', True) # Enable the compilation logger to check whether or not we're accidentally # causing a lot of re-compilation (inspect logs for excessiv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_debug(flag):\n global debug\n debug = flag\n XLM.XLM_Object.debug = flag\n XLM.xlm_library.debug = flag\n XLM.ms_stack_transformer.debug = flag\n XLM.stack_transformer.debug = flag\n XLM.excel2007.debug = flag", "def setDebug():\n\tglobal debug\n\tdebug = True", "def _pma_set_debug...
[ "0.7106474", "0.6122721", "0.6115534", "0.59994066", "0.59944767", "0.599425", "0.5859546", "0.5831815", "0.57899874", "0.574849", "0.5723658", "0.57184064", "0.5690623", "0.56572646", "0.56189394", "0.56183857", "0.55708146", "0.55087733", "0.55059654", "0.549461", "0.549309...
0.84278125
0
Parse an input specs into a jax.ShapeDtypeStruct.
def input_spec_to_jax_shape_dtype_struct( spec: Union[Tuple[Tuple[int, ...], jnp.dtype], Tuple[int, ...]], batch_size: Optional[int] = None) -> jax.ShapeDtypeStruct: spec = tuple(spec) if len(spec) == 2 and isinstance(spec[0], collections.abc.Iterable): shape = (batch_size,) + tuple(spec[0][1:]) if batc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_spec (spec_file):\n spec_object = None\n spec_name = spec_file.replace(\".\", \"_\")\n params = []\n default_params = {}\n int_conversion = []\n namedtuple = False\n delimiter = \"\\n\"\n\n spec_file = open(spec_file, \"r\")\n spec = spec_file.readlines()\n spec_file.close()...
[ "0.53998345", "0.5399715", "0.53511655", "0.52155787", "0.5175422", "0.50308526", "0.4997735", "0.4945539", "0.48813435", "0.48683077", "0.4854738", "0.485412", "0.4849468", "0.48474205", "0.4809551", "0.47939855", "0.4788989", "0.47868943", "0.47620076", "0.4761896", "0.4733...
0.6715354
0
Load dataset from file '../data/dataset.txt' and transfer to a list.
def load_data(): with open('../data/dataset.txt', 'r') as data_file: return data_file.read().split('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_datasets(filepath):\n\n data_file = open(filepath, 'r')\n data_list = data_file.readlines()\n data_file.close()\n\n return data_list", "def load_data(path_dataset):\n data = read_txt(path_dataset)[1:]\n return preprocess_data(data)", "def load_data(text_file) -> list:\n\n file = o...
[ "0.7310075", "0.7081436", "0.69368184", "0.6830235", "0.681044", "0.6765116", "0.6706157", "0.6666456", "0.6652845", "0.6651481", "0.664702", "0.6612349", "0.660296", "0.65759784", "0.6559554", "0.65574807", "0.65524375", "0.6543727", "0.6543159", "0.6526245", "0.651906", "...
0.8187677
0
Load stop words from file '../data/stop_words.txt' and transfer to a list.
def load_stop_words(): with open('../data/stop_words.txt', 'r') as stop_words_file: return stop_words_file.read().split()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stop_words() -> list:\r\n with open(f'{ENGINE}/stop_words.txt', 'r') as i:\r\n stop_words = i.read().splitlines()\r\n stop_words = list(map(lambda x: x.upper(), stop_words)) # Force all stop words to UPPER case.\r\n return stop_words", "def load_stop_list():\n stop_list = []\n ...
[ "0.86854786", "0.85702604", "0.82870823", "0.8085797", "0.8026547", "0.80048776", "0.7859866", "0.7739571", "0.75412995", "0.75381225", "0.7501206", "0.74701536", "0.7468609", "0.7460182", "0.7407307", "0.7407307", "0.7407307", "0.7394937", "0.7389229", "0.7364115", "0.734005...
0.8828992
0
Generate a label list according to the first word in each line of dataset.
def generate_labels(): label_set = set([]) for data in load_data(): label = data.split(' ', 1)[0] label_set.add(label) labels = list(label_set) labels.sort() return labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_labels(datasets):\n # Split by words\n x_text = datasets['data']\n x_text = [clean_str(sent) for sent in x_text]\n # Generate labels\n labels = [0, 1, 2, 3, 4]\n print(len(x_text))\n for i in range(len(x_text)):\n label = [0 for j in datasets['target_names']] \n ...
[ "0.67625064", "0.67520624", "0.67273957", "0.6714275", "0.6602932", "0.64764017", "0.6445512", "0.6442318", "0.64260095", "0.64215446", "0.6377378", "0.63764703", "0.63636106", "0.62697333", "0.6204013", "0.6184638", "0.616843", "0.6156621", "0.6108328", "0.6107273", "0.60736...
0.7592209
0
Write labels to file '../data/labels.txt', each line is a label
def write_labels(): with open('../data/labels.txt', 'w') as labels_file: labels = generate_labels() labels_file.write('\n'.join(labels))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_labels(self, labels: List[str], labels_path: Path):\n labels_path.write_text(escape_line_delimited_texts(labels))", "def _write_labels(self, labels: List[str], labels_path: Path):\n labels_path.write_text(escape_line_delimited_texts(labels))", "def SaveLabels(filepath, labels):\n # ...
[ "0.8117613", "0.8117613", "0.7926602", "0.78796244", "0.77901435", "0.7717908", "0.75571084", "0.73993284", "0.7089501", "0.70833546", "0.70000726", "0.6994793", "0.6964666", "0.69481635", "0.68660444", "0.68279904", "0.6752153", "0.66779125", "0.6638492", "0.6627301", "0.661...
0.92478794
0
Generate corpus from dataset, remove label from every question.
def generate_corpus(): data = load_data() questions = [s.split(' ', 1)[1].lower() for s in data] return questions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_text_classifier_del_training_samples_all(self):\n pass", "def create_corpus(df):\r\n corpus=[]\r\n for tweet in tqdm(df['text']):\r\n words=[word.lower() for word in word_tokenize(tweet) if((word.isalpha()==1))]\r\n corpus.append(words)\r\n return corpus", "def test_text_...
[ "0.6179051", "0.61695355", "0.612701", "0.60080475", "0.5991426", "0.5968233", "0.5966245", "0.5962449", "0.5961979", "0.5824949", "0.58028716", "0.57764983", "0.5754227", "0.57507855", "0.5742542", "0.57408285", "0.57311505", "0.57246226", "0.5599109", "0.5594712", "0.558772...
0.7546315
0
Write vocabulary to '../data/vocabulary.txt', each line contains a word and its frequency.
def write_vocabulary(): with open('../data/vocabulary.txt', 'w') as vocabulary_file: vocabulary = generate_vocabulary() word_count = sum(vocabulary.values()) print(word_count) vocabs_str = [("%s %d" % (key, value)) for key, value in vocabulary.items()] vocabulary_file.write('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_vocab(vocab, path, encoding=\"Utf-8\"):\n with open(path, \"w\", encoding=encoding) as fout:\n for word, freq in vocab:\n fout.write(\"%s\\t%d\\n\" % (word, freq))", "def write_vocabulary(vocab_processor, outfile):\n vocab_size = len(vocab_processor.vocabulary_)\n with open(outfil...
[ "0.77696854", "0.76118624", "0.75237185", "0.74841684", "0.7428175", "0.7263195", "0.7193403", "0.7069946", "0.6974747", "0.6899833", "0.67634916", "0.67428726", "0.67143416", "0.66633344", "0.6374416", "0.63653886", "0.6339275", "0.6330938", "0.6319669", "0.631088", "0.62634...
0.8666452
0
Returns variable value from launch params
def get_action_var_val_from_launch_params(launch_vars, var_name): filtered_launch_vars = list( filter( lambda e: e["name"] == var_name, launch_vars, ) ) if len(filtered_launch_vars) > 1: LOG.error( "Unable to populate runtime editables: Multiple ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParameter(self, value):\n if value in self.commandLineDefaults:\n return self.commandLineDefaults[value]\n if value in self.defaults:\n return self.defaults[value]\n return None", "def get_parm_value(parameters, name, env_name, default_value):\n value = parame...
[ "0.65366197", "0.6387033", "0.6228277", "0.6148368", "0.6089504", "0.59744775", "0.5972712", "0.59664136", "0.59335375", "0.5925959", "0.58825845", "0.58721554", "0.58434135", "0.5822617", "0.5805199", "0.57746196", "0.576227", "0.5749721", "0.5739871", "0.57335603", "0.57299...
0.7026889
0
Returns patch arguments or variable data
def get_patch_runtime_args( app_uuid, deployments, patch_payload, ignore_runtime_variables, runtime_params_file ): patch_name = patch_payload["name"] patch_args = {} patch_args["patch"] = patch_payload patch_args["variables"] = [] attrs_list = patch_payload["attrs_list"] if ignore_runtim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_data(self):\n return get_json()", "def patch(self):\n return self._get(\"patch\")", "def arguments(self):\n return parse_arguments(self['data'])", "def punkte(self):\n return self.args", "def view_patch():\n\n return jsonify(\n get_dict(\"url\", \"args\", \"f...
[ "0.6376717", "0.635689", "0.5775939", "0.57362425", "0.5714351", "0.56508195", "0.55597174", "0.55584913", "0.54944223", "0.5489795", "0.5393315", "0.5366492", "0.53662485", "0.53613627", "0.5359275", "0.5359163", "0.5354778", "0.53506154", "0.53359705", "0.53352034", "0.5322...
0.64711076
0
Download runlogs, given runlog uuid and app name
def download_runlog(runlog_id, app_name, file_name): client = get_api_client() app = _get_app(client, app_name) app_id = app["metadata"]["uuid"] if not file_name: file_name = "runlog_{}.zip".format(runlog_id) res, err = client.application.download_runlog(app_id, runlog_id) if not err:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_run_logs(id_, **kwargs):\n run = get_run_object(id_)\n check_run_permission(run, kwargs[\"token_info\"])\n query = \"ilyde-run-{}\".format(run.id)\n return query_elasticsearch(query)", "def download_workflow_log_files(repo, github_token, workflow_run_id, data_root_dir):\n headers = {...
[ "0.64194244", "0.59884953", "0.5788865", "0.57788175", "0.5744236", "0.5743501", "0.5706302", "0.5553888", "0.5492111", "0.5492111", "0.5474755", "0.5382931", "0.53668857", "0.53567404", "0.52949184", "0.5284501", "0.5284132", "0.52608335", "0.522752", "0.5216262", "0.5213479...
0.77006644
0
Add an auto configured output to the layout This will place the output in a sensible location in the layout. The coordinates of the output in the layout may adjust dynamically when the layout changes. If the output is already in the layout, it will become auto configured. If the position of the output is set such as wi...
def add_auto(self, output: Output) -> None: lib.wlr_output_layout_add_auto(self._ptr, output._ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_add(self._ptr, output._ptr, lx, ly)", "def move(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)", "def output(self, layout: Optional[dict] = None) -> Outp...
[ "0.70198876", "0.63294667", "0.5761119", "0.56359804", "0.5577666", "0.55675364", "0.55489993", "0.5502449", "0.54143834", "0.53270626", "0.5263954", "0.5225019", "0.5154998", "0.5103272", "0.5067622", "0.50329566", "0.4984036", "0.49752924", "0.49733323", "0.49177164", "0.49...
0.80270034
0
Determine coordinates of the output in the layout Given x and y in layout coordinates, adjusts them to local output coordinates relative to the given reference output.
def output_coords(self, output: Output) -> tuple[float, float]: ox = ffi.new("double *") oy = ffi.new("double *") lib.wlr_output_layout_output_coords(self._ptr, output._ptr, ox, oy) return ox[0], oy[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_position(layout):\n\n if layout.children:\n toyplot_vertical_align = layout.style[\"-toyplot-vertical-align\"]\n # Align the first line's baseline with the anchor.\n if toyplot_vertical_align == \"first-baseline\":\n offset_y = 0\n # Ali...
[ "0.6292434", "0.60976356", "0.60090214", "0.5698411", "0.567165", "0.5587634", "0.5562373", "0.5496815", "0.54904616", "0.5438968", "0.5402502", "0.53729147", "0.53563195", "0.53547263", "0.53337777", "0.53318155", "0.53305453", "0.5305409", "0.5298191", "0.5286754", "0.52553...
0.6738363
0
Use the output layout in a context manager
def __enter__(self) -> OutputLayout: return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_layout(self):\n return", "def layout(self):\n pass", "def _generate_layout(self):\n\n pass", "def output(self, layout: Optional[dict] = None) -> OutputWidget:\n return OutputWidget(self, layout)", "def create_layout( self ):", "def context(subcontext=None) -> None:\n ...
[ "0.64091706", "0.6069155", "0.5997315", "0.5928173", "0.58884573", "0.5709779", "0.5672082", "0.5537715", "0.5532014", "0.5498159", "0.548384", "0.5475992", "0.5458588", "0.54453886", "0.53986293", "0.53619075", "0.53441685", "0.5322948", "0.53207755", "0.5281953", "0.5273164...
0.719726
0
Get the output at the specified layout coordinates. Returns None if no output matches the coordinates.
def output_at(self, x: float, y: float) -> Output | None: output_ptr = lib.wlr_output_layout_output_at(self._ptr, x, y) if output_ptr == ffi.NULL: return None return Output(output_ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_coords(self, output: Output) -> tuple[float, float]:\n ox = ffi.new(\"double *\")\n oy = ffi.new(\"double *\")\n lib.wlr_output_layout_output_coords(self._ptr, output._ptr, ox, oy)\n\n return ox[0], oy[0]", "def get_output_by_name(self, name):\n for var in self.outpu...
[ "0.6571606", "0.5839956", "0.56035906", "0.54842794", "0.5437366", "0.5349081", "0.5301348", "0.5281909", "0.51899874", "0.5155416", "0.5151213", "0.51356196", "0.51304936", "0.5116058", "0.5116058", "0.5091115", "0.5090367", "0.5016866", "0.5016222", "0.49573547", "0.4944155...
0.7370843
0
Add the output to the layout at the specified coordinates. If the output is already part of the output layout, this moves the output.
def add(self, output: Output, lx: int, ly: int) -> None: lib.wlr_output_layout_add(self._ptr, output._ptr, lx, ly)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, output: Output, lx: int, ly: int) -> None:\n lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)", "def add_node_output_locations(self, xy,epsgIN,start,end,step): \n nodeIds = self.grid.get_node_output_locations(xy,epsgIN)\n if(elementIds != []):\n se...
[ "0.6960685", "0.60513806", "0.60398746", "0.5813254", "0.575669", "0.56998533", "0.56029904", "0.5567559", "0.54616624", "0.5377717", "0.53622025", "0.5348922", "0.5346724", "0.5326581", "0.53180915", "0.5304156", "0.5291399", "0.52477604", "0.51817405", "0.5181331", "0.51578...
0.7201141
0
Move an output to specified coordinates.
def move(self, output: Output, lx: int, ly: int) -> None: lib.wlr_output_layout_move(self._ptr, output._ptr, lx, ly)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to(self, destination_coords):\n self.x = destination_coords[0]\n self.y = destination_coords[1]\n return", "def move(self, coordinates, direction):\n pass", "def instantiate_output_move(row, col, row_idx_bitwidth, col_idx_bitwidth):\n group_name = py_ast.CompVar(\n ...
[ "0.66784644", "0.64650375", "0.63968575", "0.6348587", "0.6258059", "0.6240109", "0.62277734", "0.62160134", "0.61788344", "0.6122616", "0.60436296", "0.60330397", "0.60210365", "0.59689134", "0.5945228", "0.59423894", "0.59325606", "0.5914747", "0.58816713", "0.5859127", "0....
0.7212036
0
Remove an output from the layout.
def remove(self, output: Output) -> None: lib.wlr_output_layout_remove(self._ptr, output._ptr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_layout(self, layout: Layout):\n self.layouts.pop(layout, None)", "def removeLayout(self, *args):\n return _libsbml.LayoutModelPlugin_removeLayout(self, *args)", "def removeOutput(self, *args):\n return _libsbml.Transition_removeOutput(self, *args)", "def destroy(self):\n ...
[ "0.7089926", "0.68975186", "0.6884714", "0.6528211", "0.63225365", "0.6296304", "0.6290189", "0.6283299", "0.62830955", "0.62702155", "0.626779", "0.62561774", "0.62509525", "0.6069614", "0.6065491", "0.6051975", "0.60506624", "0.5988264", "0.5982314", "0.59661174", "0.585206...
0.849233
0
Get the box of the layout for the given reference output in layout coordinates. If `reference` is None, the box will be for the extents of the entire layout. If the output isn't in the layout, the box will be empty.
def get_box( self, reference: Output | None = None, dest_box: Box | None = None ) -> Box: if reference: reference_ptr = reference._ptr else: reference_ptr = ffi.NULL if not dest_box: dest_box = Box(ptr=ffi.new("struct wlr_box *")) lib.wlr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(self):\n if not isinstance(self.ref_cell, Cell):\n return None\n if self.rotation is None or self.rotation % 90 == 0:\n cell_bbox = self.ref_cell.get_bounding_box()\n if cell_bbox is None:\n return None\n polygons = self....
[ "0.5901545", "0.58824706", "0.5489302", "0.5370161", "0.53481007", "0.5327489", "0.5279537", "0.5278215", "0.5267045", "0.51329285", "0.51328117", "0.5108612", "0.5098542", "0.5029901", "0.49236295", "0.49177372", "0.48856136", "0.48354876", "0.47964993", "0.47919694", "0.479...
0.7389529
0
Get the closest point on this layout from the given point from the reference output. If reference is NULL, gets the closest point from the entire layout.
def closest_point( self, lx: float, ly: float, reference: Output | None = None ) -> tuple[float, float]: if reference: reference_ptr = reference._ptr else: reference_ptr = ffi.NULL dest_lx = ffi.new("double *") dest_ly = ffi.new("double *") li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_point(self, point, maxdist=0.0, return_param=False):\n return self.xyz", "def closest_point_to(self, x):\n x = np.array(x)\n v = self.p1 - self.p0\n b = self.p0 - x\n\n t = -np.dot(v, b) / np.dot(v, v)\n if (0 <= t <= 1):\n closest = t*(self.p1 - s...
[ "0.68781555", "0.6766535", "0.6657588", "0.66149604", "0.6594103", "0.65055597", "0.64913166", "0.6426414", "0.64132017", "0.63651127", "0.62755954", "0.624393", "0.6239674", "0.62271637", "0.6206133", "0.60887647", "0.6084108", "0.60477453", "0.60337806", "0.6023641", "0.601...
0.76994383
0
Sets the current_state to the initial_state (0) and sets input_symbol to None.
def reset (self): self.currentState = self.initialState self.inputSymbol = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_state(self):\n self.state = self.start_state.copy()", "def _reset_for_new_walk(self):\n # Starting State\n self.state = State('start', 0, 1, 0, 0, self.state_space_parameters.input_size, 0, 0, False)\n\n # Architecture String\n self.state_list = [self.state.copy()]",...
[ "0.65661925", "0.64960563", "0.6418424", "0.6401293", "0.6351065", "0.6345368", "0.6306686", "0.62734896", "0.6161061", "0.6148739", "0.6071161", "0.60412455", "0.6023714", "0.6023049", "0.6021861", "0.6006364", "0.598042", "0.5976253", "0.5970858", "0.5970858", "0.5970858", ...
0.83541876
0
This sets the default transition. This defines an action and next_state if the FSM cannot find the input symbol provided by the user and the current state in the transition list. The default transition can be removed by setting the attribute defaultTransition to None. In this case, for default the nextState will be the...
def setDefaultTransition (self, action, nextState): if nextState is not None: self.defaultTransition = (action, nextState) else: self.defaultTransition = (action, self.initialState)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTransition (self, inputSymbol, state):\n\n if (inputSymbol, state) in self.stateTransitions:\n return self.stateTransitions[(inputSymbol, state)]\n elif self.defaultTransition is not None:\n return self.defaultTransition\n else:\n raise ExceptionFSM ('Tr...
[ "0.5937508", "0.58190686", "0.5759606", "0.57087535", "0.5651682", "0.565062", "0.5649066", "0.56352", "0.5580734", "0.5491866", "0.5468211", "0.5421407", "0.53243065", "0.52767915", "0.5274182", "0.5246616", "0.5239235", "0.5184615", "0.51798594", "0.5175904", "0.5171481", ...
0.77794313
0
This method returns the tuples (action, next state) given an inputSymbol and state.
def getTransition (self, inputSymbol, state): if (inputSymbol, state) in self.stateTransitions: return self.stateTransitions[(inputSymbol, state)] elif self.defaultTransition is not None: return self.defaultTransition else: raise ExceptionFSM ('Transition is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_state(self, state, action):\n pass", "def p(self, next_state, state, action):\n\n return self._p[state, next_state, action]", "def process (self, inputSymbol):\n \n self.inputSymbol = inputSymbol\n (self.action, self.nextState) = self.getTransition (self.inputSymbol,...
[ "0.7005093", "0.6508219", "0.6507524", "0.6235809", "0.6222719", "0.6205359", "0.6205105", "0.60368776", "0.5969271", "0.5955513", "0.59514", "0.59455127", "0.5928941", "0.5909269", "0.5861482", "0.58402", "0.5836453", "0.58101356", "0.58081824", "0.58023584", "0.5797929", ...
0.6625956
1
This is the main method that process user input. This cause the FSM to change state and call an action. This method calls getTransition() to find the correct action and nextState associated with the inputSymbol and currentState. This method processes one complete input symbol.
def process (self, inputSymbol): self.inputSymbol = inputSymbol (self.action, self.nextState) = self.getTransition (self.inputSymbol, self.currentState) if self.action is not None: self.action (self) self.memoryState.append(self.currentState) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(self, symbol, *args, **kwargs):\n if self.__state is None:\n raise ValueError(\"FSM state is undefined\")\n try:\n transition = self.__get_state_attr(self._transition_prefix)\n except AttributeError:\n raise Exception(\"unable to find transition funct...
[ "0.7126944", "0.6313032", "0.6273754", "0.6034373", "0.5996154", "0.5985508", "0.59294426", "0.58302075", "0.58178115", "0.5808534", "0.57349867", "0.5706727", "0.5656725", "0.5618711", "0.56094056", "0.5534585", "0.5453117", "0.5448634", "0.54410994", "0.5429249", "0.5428419...
0.80351883
0
Lookup all of the IP addresses for a given AWS instance name. Multiple instances with the same name is a result of instances belonging to an auto scale group. Useful when an action needs to happen to all machines in an auto scale group.
def machine_lookup_all(session, hostname, public_ip = True): client = session.client('ec2') response = client.describe_instances(Filters=[{"Name":"tag:Name", "Values":[hostname]}, {"Name":"instance-state-name", "Values":["running"]}]) addresses = [] ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_instances_by_name_mask(self, mask_name):\n\n instances = []\n\n instance_list = self.nova_cli.servers.list()\n logger.info('Instances list is {0}'.format(instance_list))\n logger.info(\n 'Expected instance name should inlude {0}'.format(mask_name))\n\n for ins...
[ "0.690664", "0.684622", "0.6602771", "0.61565304", "0.6142604", "0.60926044", "0.60590464", "0.60518944", "0.60219425", "0.60186154", "0.6005966", "0.5953812", "0.5896932", "0.5894132", "0.5887551", "0.5881828", "0.5880497", "0.58594406", "0.58584875", "0.5843627", "0.5772551...
0.6998335
0
Lookup the public DNS for a given AWS RDS instance name.
def rds_lookup(session, hostname): client = session.client('rds') response = client.describe_db_instances(DBInstanceIdentifier=hostname) item = response['DBInstances'] if len(item) == 0: print("Could not find DNS for '{}'".format(hostname)) return None else: return item[0][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_public_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_instances(\n Filters=[{\"Name\": \"tag:Name\", \"Values\": [hostname]},\n {\"Name\": \"instance-state-name\", \"Values\": [\"runn...
[ "0.7454354", "0.6793534", "0.64854825", "0.638419", "0.637897", "0.63712627", "0.63638", "0.6352668", "0.62254494", "0.6122659", "0.60128444", "0.59898543", "0.59575254", "0.59271836", "0.58951855", "0.58788455", "0.5849263", "0.58443725", "0.5781869", "0.5759335", "0.5698314...
0.780593
0
Locate an item in a list based on a predicate function.
def _find(xs, predicate): for x in xs: if predicate(x): return x return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(func, list_seq):\n for list_item in list_seq:\n if func(list_item):\n return list_item", "def list_find(f, items):\n for i, x in enumerate(items):\n if f(x):\n return i\n return None", "def finditem(func, seq):\n return next((item for item in seq if func...
[ "0.7345009", "0.7329399", "0.69864964", "0.68509775", "0.6848589", "0.6835385", "0.6782268", "0.67755824", "0.631964", "0.63177335", "0.62872744", "0.6159832", "0.60666436", "0.60513777", "0.60492444", "0.60366356", "0.59750605", "0.59668785", "0.5961629", "0.595214", "0.5874...
0.7533438
0
Terminate all of the instances for an ASG, with the given timeout between each termination.
def asg_restart(session, hostname, timeout, callback=None): client = session.client('ec2') resource = session.resource('ec2') response = client.describe_instances(Filters=[{"Name":"tag:Name", "Values":[hostname]}, {"Name":"instance-state-name", "Values":["ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate_all(self):\n self._stop_all('terminate')", "def terminate_instances(self, ids):\n self.conn.terminate_instances(instance_ids=ids)", "def terminate_instances(self, props):\n return self._vm_async_apply(props, 'delete')", "def terminate_instance_in_asg(instance_id):\n if n...
[ "0.6357317", "0.6248194", "0.6084295", "0.59850127", "0.5979804", "0.5917791", "0.5914561", "0.58749413", "0.5839589", "0.5790333", "0.5714129", "0.56740266", "0.56631154", "0.5644305", "0.5632723", "0.5591108", "0.557721", "0.5561397", "0.55381894", "0.5480454", "0.5472366",...
0.6897586
0
Lookup the Group name for the ASG creating the EC2 instances with the given hostname
def asg_name_lookup(session, hostname): if session is None: return None client = session.client('autoscaling') response = client.describe_auto_scaling_groups() if len(response['AutoScalingGroups']) == 0: return None else: # DP NOTE: Unfortunatly describe_auto_scaling_groups(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instanceid_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_instances(\n Filters=[{\"Name\": \"tag:Name\", \"Values\": [hostname]}])\n\n item = response['Reservations']\n if len(item) == 0:\n retur...
[ "0.63809437", "0.63582885", "0.62746876", "0.62431866", "0.61943334", "0.6136143", "0.6110822", "0.6015477", "0.5964197", "0.5958102", "0.59372044", "0.5880964", "0.583179", "0.57972753", "0.57745284", "0.57554305", "0.57206607", "0.57174826", "0.5665552", "0.5599069", "0.559...
0.7942209
0
Lookup the Id for the VPC with the given domain name.
def vpc_id_lookup(session, vpc_domain): if session is None: return None client = session.client('ec2') response = client.describe_vpcs(Filters=[{"Name": "tag:Name", "Values": [vpc_domain]}]) if len(response['Vpcs']) == 0: return None else: return response['Vpcs'][0]['VpcId']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keystone_v3_domain_id(self, domain_name):\n LOG_OBJ.debug(\"Get the domain ID.\")\n\n _url = \"http://\" + self.host_ip + \":35357/v3/domains?name=\" + \\\n str(domain_name)\n _headers = {'x-auth-token': self.cloud_admin_info[\"token_domain\"],\n 'conte...
[ "0.7072395", "0.66890675", "0.62828547", "0.60626096", "0.60512835", "0.60456634", "0.60456634", "0.5988567", "0.5966641", "0.5933054", "0.5929906", "0.5865763", "0.5865732", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.5855496", "0.583406", "0.5822499"...
0.81332946
0
Lookup the Id for the Subnet with the given domain name.
def subnet_id_lookup(session, subnet_domain): if session is None: return None client = session.client('ec2') response = client.describe_subnets(Filters=[{"Name": "tag:Name", "Values": [subnet_domain]}]) if len(response['Subnets']) == 0: return None else: return response['Sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keystone_v3_domain_id(self, domain_name):\n LOG_OBJ.debug(\"Get the domain ID.\")\n\n _url = \"http://\" + self.host_ip + \":35357/v3/domains?name=\" + \\\n str(domain_name)\n _headers = {'x-auth-token': self.cloud_admin_info[\"token_domain\"],\n 'conte...
[ "0.62816155", "0.6252993", "0.61216253", "0.6116545", "0.57401055", "0.56873554", "0.5656026", "0.5638093", "0.56223834", "0.5614454", "0.5596863", "0.5574551", "0.55497974", "0.5529772", "0.5517432", "0.5475204", "0.5445243", "0.5445243", "0.54308754", "0.54301274", "0.54301...
0.7532417
0
Lookup the Id for the AMI with the given name. If ami_name ends with '.boss', the AMI_VERSION environmental variable is used to either search for the latest commit hash tagged AMI ('.bossh') or for the AMI with the specific tag ('.boss').
def ami_lookup(session, ami_name, version = None): if session is None: return None specific = False if ami_name.endswith(".boss"): ami_version = os.environ["AMI_VERSION"] if version is None else version if ami_version == "latest": # limit latest searching to only version...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ami_by_name ( ec2_conn, ami_name ) :\n amis = ec2_conn.get_all_images( filters = { \"name\": [ ami_name ] } )\n for ami in amis :\n return ami", "def get_ami_by_id ( ec2_conn, ami_id ) :\n amis = ec2_conn.get_all_images( image_ids = [ ami_id ] )\n for ami in amis :\n return ami", "d...
[ "0.6669751", "0.5976176", "0.58265173", "0.5811249", "0.5770496", "0.56842625", "0.56431633", "0.56096363", "0.5589823", "0.55881256", "0.5372395", "0.53390926", "0.5291101", "0.5243476", "0.51454204", "0.5121465", "0.50918853", "0.5083589", "0.5083099", "0.507428", "0.506357...
0.74430376
0
Lookup the Ids for all of the VPC Security Groups.
def sg_lookup_all(session, vpc_id): if session is None: return NoneDict() client = session.client('ec2') response = client.describe_security_groups(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]) if len(response['SecurityGroups']) == 0: return NoneDict() else: sgs = NoneD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sg_ids(vpc):\n list = [i.id for i in vpc.security_groups.all()]\n return list", "def vpc_security_group_ids(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"vpc_security_group_ids\")", "def vpc_security_group_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]...
[ "0.776428", "0.7407091", "0.7198566", "0.7198566", "0.68077105", "0.68063724", "0.67918974", "0.6652626", "0.66312367", "0.66312367", "0.63980854", "0.6179441", "0.6063443", "0.5990153", "0.59719115", "0.59415746", "0.5895164", "0.58848244", "0.5872261", "0.5848759", "0.58404...
0.7723206
1
Lookup the Id for the VPC Security Group with the given name.
def sg_lookup(session, vpc_id, group_name): if session is None: return None client = session.client('ec2') response = client.describe_security_groups(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}, {"Name": "tag:Name", "Values": [group_name]}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sg_id(sg_name):\n print()\n print(\"Searching for SG ID\")\n client = boto3.client('ec2')\n all_sg = client.describe_security_groups()\n print(sg_name)\n grp_id = \"None\"\n for sec_grp in all_sg['SecurityGroups']:\n print(sec_grp['GroupName'])\n if sg_name == sec_grp['Gr...
[ "0.7680698", "0.7084317", "0.6718247", "0.66819984", "0.66819984", "0.6648008", "0.6648008", "0.6557056", "0.65039665", "0.6483536", "0.6483536", "0.6401095", "0.63624", "0.62879884", "0.62802815", "0.6271635", "0.62600183", "0.60661876", "0.6065279", "0.5980223", "0.5909057"...
0.81316435
0
Lookup the Id for the VPC Route Table with the given name.
def rt_lookup(session, vpc_id, rt_name): if session is None: return None client = session.client('ec2') response = client.describe_route_tables(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}, {"Name": "tag:Name", "Values": [rt_name]}]) if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_id(self, tag_name):\n response = await self.describe(tag_name)\n if response['RouteTables']:\n return response['RouteTables'][0][\"RouteTableId\"]\n else:\n raise RtbDoesntExists", "def transit_router_route_table_id(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.7265778", "0.6650314", "0.6650314", "0.65430045", "0.65120596", "0.64262307", "0.6146517", "0.60185033", "0.56920457", "0.5620676", "0.5594443", "0.5552543", "0.5518078", "0.5444758", "0.54276913", "0.5355043", "0.5323631", "0.5280393", "0.5248865", "0.52361125", "0.522494...
0.7589303
0
Name the default Route Table that is created for a new VPC. Find the default VPC Route Table and give it a name so that it can be referenced latter. Needed because by default the Route Table does not have a name and rt_lookup() will not find it. The default VPC Route Table is determined as the first Route Table without...
def rt_name_default(session, vpc_id, new_rt_name): client = session.client('ec2') response = client.describe_route_tables(Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]) rt_id = None for rt in response['RouteTables']: nt = _find(rt['Tags'], lambda x: x['Key'] == 'Name') if nt is None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rt_lookup(session, vpc_id, rt_name):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_route_tables(Filters=[{\"Name\": \"vpc-id\", \"Values\": [vpc_id]},\n {\"Name\": \"tag:Name\", \"Values\":...
[ "0.6255291", "0.5958707", "0.5942567", "0.58998066", "0.5847473", "0.5646883", "0.5562245", "0.5402062", "0.54012924", "0.5368249", "0.5318241", "0.52420455", "0.5207002", "0.51904994", "0.5187961", "0.516698", "0.51573324", "0.5153503", "0.5133534", "0.51282156", "0.5078571"...
0.84361637
0
Lookup the names of valid Key Pair. If the SSH_KEY enviro variable is defined and points to a valid keypair, that keypair name is returned. Else all of the keypairs are printed to stdout and the user is prompted to select which keypair to use.
def keypair_lookup(session): if session is None: return None client = session.client('ec2') response = client.describe_key_pairs() # If SSH_KEY exists and points to a valid Key Pair, use it key = os.environ.get("SSH_KEY", None) # reuse bastion.py env vars if key is not None: k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_key_pair(ec2, kp_name):\n if not [i for i in ec2.get_all_key_pairs() if str(i).split(':')[1] == kp_name]:\n sys.stderr.write(\"Key pair: {} does not exist, please import_key_pair prior to running.\\n\".format(kp_name))\n sys.exit(1)", "def key_pair_name(self) -> Optional[pulumi.Input[s...
[ "0.6621088", "0.61450076", "0.61450076", "0.6030742", "0.5993051", "0.5961809", "0.58859694", "0.5711315", "0.55931115", "0.5490621", "0.54890466", "0.5479529", "0.54452103", "0.5428441", "0.54208297", "0.5379685", "0.5375169", "0.53638816", "0.53498614", "0.5281988", "0.5258...
0.78218615
0
Look up instance id by hostname (instance name).
def instanceid_lookup(session, hostname): if session is None: return None client = session.client('ec2') response = client.describe_instances( Filters=[{"Name": "tag:Name", "Values": [hostname]}]) item = response['Reservations'] if len(item) == 0: return None else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHostKey(instance):\n return instance['hostname']", "def get_instance_id(self):\n return \"{0}-{1}\".format(self._vc_name, self._host)", "def instance_public_lookup(session, hostname):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.des...
[ "0.7457449", "0.7274183", "0.7065669", "0.7018674", "0.69828963", "0.6804619", "0.6804448", "0.66520125", "0.665048", "0.66439986", "0.65985245", "0.6568026", "0.654998", "0.6524222", "0.65042883", "0.65042883", "0.65042883", "0.64500105", "0.6423488", "0.6423488", "0.6423488...
0.8307429
0
Looks up the ARN for a SSL Certificate
def cert_arn_lookup(session, domain_name): if session is None: return None client = session.client('acm') response = client.list_certificates() for certs in response['CertificateSummaryList']: if certs['DomainName'] == domain_name: return certs['CertificateArn'] if c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssl_certificate_arn(environment):\n name = Constants['SslCertificateName'][environment]\n\n certificates = ACM.list_certificates(CertificateStatuses=[ 'ISSUED' ])['CertificateSummaryList']\n arns = [ c['CertificateArn'] for c in certificates if c['DomainName'] == name ]\n\n if len(arns) == 0:\n...
[ "0.7575733", "0.67465764", "0.64577544", "0.64160997", "0.628164", "0.6254604", "0.6073698", "0.5756983", "0.5599451", "0.5599451", "0.5599451", "0.5577368", "0.5577368", "0.5577027", "0.5553289", "0.5553289", "0.5549295", "0.5541539", "0.550942", "0.5448711", "0.5382661", ...
0.7114357
1
Lookup the Public DNS name for a EC2 instance
def instance_public_lookup(session, hostname): if session is None: return None client = session.client('ec2') response = client.describe_instances( Filters=[{"Name": "tag:Name", "Values": [hostname]}, {"Name": "instance-state-name", "Values": ["running"]}]) item = resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rds_lookup(session, hostname):\n\n client = session.client('rds')\n response = client.describe_db_instances(DBInstanceIdentifier=hostname)\n\n item = response['DBInstances']\n if len(item) == 0:\n print(\"Could not find DNS for '{}'\".format(hostname))\n return None\n else:\n ...
[ "0.7093993", "0.6950115", "0.69366145", "0.6753267", "0.6640436", "0.66227126", "0.6474817", "0.6400321", "0.6302448", "0.62650925", "0.6223052", "0.6206862", "0.61611843", "0.6119791", "0.60280055", "0.6024374", "0.6014244", "0.6009959", "0.5994625", "0.5985246", "0.59798884...
0.77868897
0
Lookup cloudfront public domain name which has hostname as the origin.
def cloudfront_public_lookup(session, hostname): if session is None: return None client = session.client('cloudfront') response = client.list_distributions( MaxItems='100' ) items = response["DistributionList"]["Items"] for item in items: cloud_front_domain_name = item["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host(self):\n if self.url.startswith(\"dns:\"):\n return self.url[4:]\n else:\n return urlparse(self.url).hostname", "def get_domain():\n domain=\"\"\n for item in re.split(\"\\.\", env.host)[1:]:\n domain = domain + \".\" + item\n return domain.lstrip(\".\...
[ "0.7322436", "0.71760046", "0.7071095", "0.7029442", "0.7000298", "0.69341964", "0.6933069", "0.6917955", "0.6914039", "0.6898984", "0.6894848", "0.6891883", "0.6890801", "0.6877511", "0.681708", "0.6752261", "0.6731664", "0.6730647", "0.6730647", "0.67285687", "0.6695391", ...
0.82743466
0
Lookup the Public DNS name for a ELB
def elb_public_lookup(session, hostname): if session is None: return None client = session.client('elb') responses = client.describe_load_balancers() hostname_ = hostname.replace(".", "-") for response in responses["LoadBalancerDescriptions"]: if response["LoadBalancerName"].star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rds_lookup(session, hostname):\n\n client = session.client('rds')\n response = client.describe_db_instances(DBInstanceIdentifier=hostname)\n\n item = response['DBInstances']\n if len(item) == 0:\n print(\"Could not find DNS for '{}'\".format(hostname))\n return None\n else:\n ...
[ "0.7090508", "0.6931591", "0.66295487", "0.6527898", "0.64692634", "0.6408615", "0.6370166", "0.6294847", "0.62296087", "0.6155501", "0.61130655", "0.60973746", "0.6082369", "0.6069316", "0.60271686", "0.5922691", "0.59071743", "0.58485824", "0.58454686", "0.58105326", "0.579...
0.82099265
0
Lookup up SNS topic ARN given a topic name
def sns_topic_lookup(session, topic_name): if session is None: return None client = session.client('sns') response = client.list_topics() topics_list = response['Topics'] for topic in topics_list: arn_topic_name = topic["TopicArn"].split(':').pop() if arn_topic_name == topic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_topic_arn(topic_name):\n # https://stackoverflow.com/a/37723278/1558022\n sts_client = boto3.client('sts')\n account_id = sts_client.get_caller_identity().get('Account')\n\n return f'arn:aws:sns:eu-west-1:{account_id}:{topic_name}'", "def get_full_topicarn ( base_topicarn, topicname ) :\n ...
[ "0.79431546", "0.72963053", "0.7135237", "0.7135237", "0.7130573", "0.6910786", "0.69055796", "0.6537543", "0.65364784", "0.646367", "0.6283038", "0.59111613", "0.5876922", "0.5643607", "0.56244606", "0.55634636", "0.5465788", "0.54464096", "0.54258615", "0.5421659", "0.53438...
0.8113506
0
Delete all of the SQS Queues that start with the given domain name
def sqs_delete_all(session, domain): client = session.client('sqs') resp = client.list_queues(QueueNamePrefix=domain.replace('.','-')) for url in resp.get('QueueUrls', []): client.delete_queue(QueueUrl=url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_test_queues(prefix=TEST_NAME_PREFIX, region_name=None):\n sqs = boto3.resource('sqs', region_name=region_name)\n num_queues = 0\n try:\n for queue in sqs.queues.all():\n if re.match(r'.+%s\\d+' % TEST_NAME_PREFIX, queue.url):\n queue.delete()\n num...
[ "0.7308705", "0.6090805", "0.60719943", "0.5983654", "0.59769964", "0.59579396", "0.5926879", "0.5807085", "0.57812786", "0.57787776", "0.57786417", "0.57765925", "0.57747895", "0.5687993", "0.5681951", "0.56519437", "0.5629436", "0.5589249", "0.5585626", "0.55741715", "0.556...
0.83173805
0
Lookup up SQS url given a name.
def sqs_lookup_url(session, queue_name): client = session.client('sqs') resp = client.get_queue_url(QueueName=queue_name) return resp['QueueUrl']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_name(self, name):\n self.name = name\n self._stream_from_name()\n return self.URL", "def get_by_url(self, url, pool_name=None):\n\t\tif not pool_name:\n\t\t\treturn self.pool[url]\n\t\treturn getattr(self, pool_name)[url]", "def image_url(self, name):\r\n s3_key = self._gen...
[ "0.570739", "0.56668997", "0.55974376", "0.55352825", "0.55016017", "0.54813766", "0.5397629", "0.53500366", "0.5313121", "0.53008205", "0.5254056", "0.5221821", "0.52081007", "0.52081007", "0.5193847", "0.5184935", "0.5153158", "0.5135208", "0.5130682", "0.5095509", "0.50650...
0.75557625
0
Requests a certificate in the AWS Certificate Manager for the domain name
def request_cert(session, domain_name, validation_domain): if session is None: return None client = session.client('acm') validation_options = [ { 'DomainName': domain_name, 'ValidationDomain': validation_domain }, ] response = client.request_certific...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(domain):\n if not domain:\n logger.error(\n \"ctl:info:generate\", \"Choose a fully-qualified domain name of the \"\n \"certificate. Must match a domain present on the system\"\n )\n domain = click.prompt(\"Domain name\")\n try:\n client().certifi...
[ "0.71145135", "0.68516237", "0.68167555", "0.6727174", "0.63520133", "0.62255585", "0.6130389", "0.61267835", "0.5947188", "0.5946464", "0.587936", "0.5868433", "0.5864199", "0.5861729", "0.5860213", "0.58348227", "0.5812201", "0.5778908", "0.57471037", "0.5649767", "0.564291...
0.7149025
0