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
reverse list recursively in place
def reverse_list_recursively_in_place(list1, first = 0, last = -1): while first <= len(list1) // 2 - 1: #midpoint #switch first and last indexes new_last_item = list1[0] new_first_item = list1[-1] list1[0] = new_first_item list1[-1] = new_last_item # print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_list_reverse(ls: list)->list:\n if ls:\n return recursive_list_reverse(ls[1:]) + [ls[0]]\n else:\n return []", "def reverse_list(self,list_):\r\n list_.reverse()", "def deep_reverse(L):\n for i in range(len(L)//2):\n temp = L[i]\n L[i] = L[-1-i]\n ...
[ "0.79495764", "0.77801186", "0.7754448", "0.771838", "0.77115774", "0.7684882", "0.7591863", "0.755835", "0.75560635", "0.7530132", "0.75075644", "0.7493267", "0.7485055", "0.74751544", "0.7416552", "0.73713726", "0.73528504", "0.73148113", "0.72934216", "0.72919154", "0.7289...
0.7817746
1
Load the item map.
def load_item_map(cache_file): with open(cache_file, 'rb') as f: full_item_map = pickle.load(f) return full_item_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadObjectMaps(self):\n path = os.path.join(self.dir,settings['mosh.modInfos.objectMaps'])\n if os.path.exists(path):\n self.objectMaps = compat.uncpickle(open(path,'rb'))\n else:\n self.objectMaps = {}", "def load_map(self, item, many, **kwargs):\n perform_p...
[ "0.675859", "0.6692576", "0.65858275", "0.63570035", "0.6262381", "0.6199254", "0.6183732", "0.615838", "0.61570543", "0.61013114", "0.6099455", "0.6059597", "0.60582393", "0.6053301", "0.6012088", "0.6006338", "0.59908515", "0.59538186", "0.59380835", "0.59299046", "0.592630...
0.7097264
0
This method calculated the amount to be invoices for the noninvoiced waybills till yesterday for the respective client 1. Creates a new document in the Kinko collection with a unique number, the summed amount, remittance date, and its type (rem/inv) 2. It updates all the packages for respective waybills with a unique k...
def get_invoice(self): # Check if unclosed invoice for the client exists old_inv = connection.Kinko.find_one({'cl': self.cl, 'tid': None, 'typ': TYPE_MAP[self.tab_type]}) inv_num = None # If it does, update its values and update packages ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_remittance(self):\n\n #kinko dict to be updated in Kinko Collection.\n kdict = {\n \"amt\": 0.0,\n \"cl\": unicode(self.cl),\n \"dt\": datetime.datetime.today(),\n \"typ\": TYPE_MAP[self.tab_type],\n \"range\": {\"lt\": self.q_dict[\"cs.s...
[ "0.6861218", "0.60004735", "0.59980756", "0.5988163", "0.5946835", "0.5899899", "0.5899816", "0.5890613", "0.58651483", "0.5863165", "0.5840776", "0.5698517", "0.566924", "0.5626834", "0.5604388", "0.55907977", "0.5565784", "0.5555804", "0.55287856", "0.5518123", "0.55039215"...
0.7550435
0
This method calculated the amount to be remitted for the nonremiited waybills till yesterday for the respective client 1. Creates a new document in the Kinko collection with a unique number, the summed amount, remittance date, and its type (rem/inv) 2. It updates all the packages for respective waybills with a unique k...
def get_remittance(self): #kinko dict to be updated in Kinko Collection. kdict = { "amt": 0.0, "cl": unicode(self.cl), "dt": datetime.datetime.today(), "typ": TYPE_MAP[self.tab_type], "range": {"lt": self.q_dict["cs.sd"].get("$lt", None), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_invoice(self):\n\n # Check if unclosed invoice for the client exists\n old_inv = connection.Kinko.find_one({'cl': self.cl, 'tid': None,\n 'typ': TYPE_MAP[self.tab_type]})\n\n inv_num = None\n # If it does, update its values and update ...
[ "0.67186534", "0.5586507", "0.55528224", "0.5514172", "0.538059", "0.53637886", "0.53169036", "0.527846", "0.52738786", "0.5263505", "0.5226892", "0.5223257", "0.51713914", "0.51250577", "0.5117633", "0.50834805", "0.50519705", "0.50476646", "0.49824288", "0.4977463", "0.4956...
0.75799775
0
From an array of int, return a list of molecules in string smile format
def int_to_smile(self, array): all_smi = [] for seq in array: new_mol = [self.indices_token[int(x)] for x in seq] all_smi.append(''.join(new_mol).replace(self.pad_char, '')) return all_smi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smiles(self) -> List[str]:\n return [d.smiles for d in self.data]", "def smiles_strings_to_nx(smiles_list):\n for smiles in smiles_list:\n mol = Chem.MolFromSmiles(smiles)\n yield rdkmol_to_nx(mol)", "def seqs_to_strs(self,id_array,remove_pads=True):\n l = self.seqs_to_toks(id_ar...
[ "0.57042253", "0.5686834", "0.56723243", "0.55803776", "0.55141926", "0.55028427", "0.5480086", "0.5367129", "0.53566885", "0.5318716", "0.52845377", "0.5283816", "0.5263514", "0.5246917", "0.5243534", "0.52299476", "0.5201045", "0.5196917", "0.5134557", "0.5112735", "0.51111...
0.7319746
0
Do some sanitization of input values, primarily to handle universal Mac builds.
def sanitize(info): if "processor" in info and info["processor"] == "universal-x86-x86_64": # If we're running on OS X 10.6 or newer, assume 64-bit if release[:4] >= "10.6": # Note this is a string comparison info["processor"] = "x86_64" info["bits"] = 64 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _SanitizeFlags( flags ):\n\n sanitized_flags = []\n saw_arch = False\n for i, flag in enumerate( flags ):\n if flag == '-arch':\n saw_arch = True\n continue\n elif flag.startswith( '-arch' ):\n continue\n elif saw_arch:\n saw_arch = False\n continue\n\n sanitized_flags.a...
[ "0.59757644", "0.59576803", "0.59011555", "0.581404", "0.5755058", "0.574118", "0.569153", "0.5663873", "0.56021625", "0.5522437", "0.54933524", "0.54594034", "0.5449084", "0.5404257", "0.53815454", "0.5305666", "0.5299065", "0.52946764", "0.5275609", "0.52411515", "0.5185293...
0.6668525
0
Gets the formatted string for the given message and level
def __get_formatted(message, level): if USE_COLOR and LEVELS[level] > 0: return __termcode(LEVELS[level]) + "[" + level + "] " + message + __termcode(0) else: return "[" + level + "] " + message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_string(self, level=None):\r\n\r\n log_lines = [f\"Name:{str(self.name)} Level:{str(level)}\"]\r\n for key, item in self.log.items():\r\n log_lines.append(f\"{key}:\")\r\n if item:\r\n for entry in item:\r\n if not level or (entry[\"l...
[ "0.72109514", "0.69333214", "0.67888343", "0.67071587", "0.66704714", "0.6617118", "0.6483268", "0.64497614", "0.6385933", "0.63662285", "0.6292827", "0.6161045", "0.61400044", "0.6077894", "0.59353787", "0.5904985", "0.58995754", "0.58934224", "0.5888085", "0.58858615", "0.5...
0.845347
0
Define abstract properties for both python 2 and 3.
def abstractproperty(func): if sys.version_info > (3, 3): return property(abc.abstractmethod(func)) return abc.abstractproperty(func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def properties(self):\n raise NotImplementedError", "def property( self, prop ):\n raise NotImplementedError(\"property\")", "def property(self, p_int): # real signature unknown; restored from __doc__\n pass", "def __init__(self, default = None, mode = READWRITE, type = None, **keywords):\n ...
[ "0.64884824", "0.60393596", "0.5874964", "0.5710309", "0.56086016", "0.56086016", "0.56086016", "0.55072594", "0.5447174", "0.54269207", "0.5398312", "0.5391957", "0.53898686", "0.5359482", "0.53026587", "0.5237206", "0.5230219", "0.5226385", "0.5175884", "0.51616794", "0.515...
0.66796464
0
Call function func with the given arguments and measure its runtime. The runtime will be added to the given attribute of target where argument is a `.` separated string of arguments.
def measure_time(target, attribute, func, *args, **kwargs): attributes = attribute.split(".") attribute = attributes.pop() target = reduce(getattr, attributes, target) start = timer() try: return func(*args, **kwargs) finally: value = getattr(target, attribute) setattr(ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def function_timer(*args, **kwargs):\n start = time.time()\n value = func(*args, **kwargs)\n end = time.time()\n runtime = end - start\n msg = f\"The runtime for {func.__name__} took {runtime} seconds to complete\"\n #print(msg.format(func=func.__name__, time=runtime))\n ...
[ "0.57882303", "0.57415146", "0.5612517", "0.5539378", "0.52954704", "0.5283783", "0.5269495", "0.5261044", "0.5222241", "0.5210989", "0.5206082", "0.52054775", "0.5195117", "0.50997907", "0.5082651", "0.5075976", "0.50697565", "0.50665057", "0.50556636", "0.50423306", "0.5033...
0.72311646
0
Decorator to time function calls for propagator statistics. The runtime will be added to the given attribute of the class where argument is a `.` separated string of arguments.
def measure_time_decorator(attribute): def wrapper(func): # pylint: disable=missing-docstring return lambda self, *args, **kwargs: measure_time(self, attribute, func, self, *args, **kwargs) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_time(target, attribute, func, *args, **kwargs):\n attributes = attribute.split(\".\")\n attribute = attributes.pop()\n target = reduce(getattr, attributes, target)\n start = timer()\n try:\n return func(*args, **kwargs)\n finally:\n value = getattr(target, attribute)\n ...
[ "0.7534839", "0.6231821", "0.61773103", "0.6176697", "0.6158052", "0.6152932", "0.6101193", "0.60959005", "0.6045913", "0.6026659", "0.60261434", "0.602388", "0.5975237", "0.5956906", "0.5946628", "0.59316015", "0.5926556", "0.592418", "0.59098065", "0.58966374", "0.5845815",...
0.71144843
1
Remove each element from `rng` for which `pred` evaluates to true by swapping them to the end of the sequence. The function returns the number of elements retained.
def remove_if(rng, pred): j = 0 for i, x in enumerate(rng): if pred(x): continue if i != j: rng[i], rng[j] = rng[j], rng[i] j += 1 return j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(pred):\n def _remove_xducer(step):\n def _remove_step(r=Missing, x=Missing):\n if r is Missing: return step()\n if x is Missing:\n return step(r)\n return step(r, x) if not pred(x) else r\n return _remove_step\n return _remove_xducer", ...
[ "0.5970162", "0.59182113", "0.57885057", "0.55329347", "0.5454982", "0.54516405", "0.51788163", "0.5175403", "0.5148423", "0.51355696", "0.50446457", "0.50325125", "0.50101095", "0.49965248", "0.49878272", "0.49708146", "0.49496216", "0.4939983", "0.491285", "0.48891592", "0....
0.7627244
0
Add `x` to the container if it is not yet contained in it. Returns true if the element has been inserted.
def add(self, x): if x not in self: self._seen.add(x) self._list.append(x) return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_and_check(self, item) -> bool:\n with Monitor.acquire(self):\n if item in self:\n return False\n self.add(item)\n return True", "def insert(self, val: int) -> bool:\n value = val not in self.container\n self.container.add(val)\n ...
[ "0.6574289", "0.6406276", "0.6176388", "0.6175435", "0.6101265", "0.59782714", "0.59693474", "0.5949207", "0.5902992", "0.5888482", "0.5870574", "0.5865175", "0.5842358", "0.5765446", "0.57439584", "0.57295156", "0.5722953", "0.571187", "0.56991863", "0.56947184", "0.56614125...
0.762855
0
Calls `add` for each element in sequence `i`.
def extend(self, i): for x in i: self.add(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iadd__(self,l):\r\n\t\t\r\n\t\treturn self.add(l)", "def add(self, i: int, v: int) -> None:\n while i < self.size:\n self.tree[i] += v\n i += self._lsb(i)", "def add(iA, iB):\n for i in range(iB):\n iA = iA + 1", "def __iadd__(self, n):\n return _elas.SwigP...
[ "0.67145497", "0.6391441", "0.6183374", "0.6156977", "0.61194927", "0.60891455", "0.6081877", "0.6078607", "0.6052341", "0.60405576", "0.6029281", "0.6011339", "0.596099", "0.59275514", "0.5920897", "0.59182566", "0.5909194", "0.59057415", "0.58765775", "0.5851381", "0.582996...
0.74557316
0
Return a shallow copy the interval set.
def copy(self): return IntervalSet(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return sppasInterval(self.__begin.copy(), self.__end.copy())", "def copy(self) -> 'RangeSet':\n return RangeSet(self)", "def copy(self):\n return State([r[:] for r in self.values], empty_loc=self.empty_loc)", "def copy(self):\n r = SubsSet()\n r.rewrites =...
[ "0.782539", "0.73891133", "0.6887479", "0.67976564", "0.6712033", "0.66005105", "0.64806855", "0.6475658", "0.6470166", "0.6459816", "0.6395403", "0.6345681", "0.63421625", "0.6339084", "0.6339084", "0.6339084", "0.6339084", "0.6339084", "0.6339084", "0.6339084", "0.6339084",...
0.8764039
0
Enumerate values in interval set.
def enum(self): for l, u in self: for i in range(l, u): yield i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self.intervals)", "def define_intervals(self):\n i = 5 # a step of increment\n interval_sum = self.min_step\n interval_list = [self.min_step]\n while interval_sum < self.max_step:\n interval_sum += i\n interval_list.appen...
[ "0.69566256", "0.6433727", "0.6418818", "0.63067067", "0.6279782", "0.61818784", "0.6124339", "0.6082397", "0.59000796", "0.5859385", "0.5797253", "0.57746845", "0.5756905", "0.575292", "0.571635", "0.5710421", "0.56925124", "0.5690799", "0.5649945", "0.56464094", "0.5637407"...
0.6592169
1
Use this decorator to indicate that a method should be processed on a separate thread.
def process_in_thread(method): def decorator(*args, **kwargs): t = Thread(target=method, args=args, kwargs=kwargs) t.daemon = True t.start() return decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_async(method):\n Thread(target=method, args=[]).start()", "def add_thread_method(self, name, method):\n self._thread_methods[name]=lambda *args,**kwargs: self.call_in_thread_sync(method,args=args,kwargs=kwargs,sync=True,same_thread_shortcut=True)", "def as_thread(func):\n\n @functools.wrap...
[ "0.68301105", "0.68078923", "0.63745445", "0.63690734", "0.63447434", "0.62381506", "0.618413", "0.6136808", "0.6108393", "0.6068357", "0.6033108", "0.5995384", "0.5950495", "0.5918171", "0.5842467", "0.5800451", "0.5776357", "0.5662081", "0.5632969", "0.5624797", "0.55989593...
0.7689661
0
Generates child files down to self.max_depth, or until each file is smaller than self.tree.max_count. Parent files are removed, unless self.tree.remove = False
def generate_tree(self, max_depth = None): if max_depth is None: max_depth = self.tree.max_depth else: max_depth -= 1 if max_depth == 0: return self.generate_children() if self.tree.remove: os.unlink(self.source_filename) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_children(self):\n\n if self.children is not None:\n return\n\n print \"Generating children for %s (%s rows)\" % (self.bbox, self.count)\n\n self.children = [QuadtreeNode(self.tree, b)\n for b in self.bounds.get_children()]\n\n with utils.m...
[ "0.6010041", "0.5836431", "0.57371813", "0.56483114", "0.5641806", "0.5576006", "0.55196524", "0.5509881", "0.54571646", "0.542463", "0.54010165", "0.5393021", "0.53782785", "0.5376667", "0.5301386", "0.5278174", "0.52506757", "0.52343464", "0.51845247", "0.516611", "0.515400...
0.7806446
0
Generate tiles for all levels, assuming the tree has been generated using generate_tree() first.
def generate_tiles(self): if self.children: for child in self.children: child.generate_tiles() print "Generating tile for %s using child tiles" % self.bbox self.generate_tile_from_child_tiles() else: print "Generating tile for %s using sour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_levels(self):\r\n level = (self.root,)\r\n while level:\r\n yield level\r\n level = tuple(child for node in level for child in node.children)", "def build_tiles(cls):\n\n LOGGER.debug(\"Building tiles\")\n\n for tile_id in tiledata.TILE_DATA:\n ...
[ "0.6773084", "0.6445318", "0.63912463", "0.6275767", "0.62191564", "0.6206787", "0.61906976", "0.61900455", "0.61658823", "0.6162017", "0.61371034", "0.60971314", "0.60847485", "0.6053197", "0.60261416", "0.6024769", "0.59947485", "0.5968127", "0.59367687", "0.59113675", "0.5...
0.7792559
0
SerieSwitch.from_dict_to_list('hello {m}', m=['m', 'M'], R=['R', 'L']})
def from_kwargs_to_list(txt, *args, **kwargs): # beware: 'txt' not in kwargs if args: raise ValueError('No args') return SerieSwitch.from_dict_to_list(txt, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_for_switch(mapping):\n return {key[0]: value for key, value in mapping.items()}", "def get_switch_stringlist(self):\n return text_switch", "def test_cast_list(self):\n categories = {\"asdfa\": 0.1, 2: 0.2, 3.0: 0.3, \"lalala\": 0.4}\n dim = Categorical(\"yolo\", categories)\...
[ "0.51592755", "0.5109508", "0.5103702", "0.5020427", "0.49642718", "0.4960588", "0.49204865", "0.49078488", "0.4905823", "0.48816594", "0.48805374", "0.48683953", "0.48520425", "0.48484737", "0.48294616", "0.48026213", "0.47579768", "0.47465935", "0.47428975", "0.47129363", "...
0.6347163
0
name="a | c | d & a | d & e", tags=['d', 'a'] > True
def match(self, name, tags): or_exprs, tags = self.get_compiled(name, tags) # or_exprs = [{'a'}, {'c'}, {'d', 'a'}, {'d', 'e'}] return any(and_expr <= tags for and_expr in or_exprs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, name, tags):\n return name.lower() in tags", "def is_tagged(self,tag_name,element):\n return (tag_name in self.tag2elements.keys()) and (element in self.tag2elements[tag_name])", "def match(self, name, tags):\n S, tags = self.get_compiled(name, tags)\n return bool(S & ta...
[ "0.63840264", "0.63666916", "0.61455053", "0.6141979", "0.6090986", "0.6078109", "0.5904636", "0.5666137", "0.56578386", "0.56374", "0.5605534", "0.55663633", "0.55603385", "0.5537095", "0.55329055", "0.55057234", "0.54970735", "0.54853636", "0.54659826", "0.5458518", "0.5429...
0.6780111
0
returns all xml comment[name] that match for a student for that qid matricule="123456", qid="2" > ["a", "notb", "notd"] given and 'a' and 'c' were ticked on the copy
def make_tags(self, faq, matricule, qid) -> list: # for that matricule, find out which comments are ticked (eg. A, C) proj, sid = next((proj, proj.Matricule(matricule).to('AmcStudentId')) for proj in self.projects_by_serie.values() if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_answers(xml):\n answers = []\n i = 0\n\n try:\n for xml_cond in xml.findall(\".//{http://www.imsglobal.org/xsd/ims_qtiasiv1p2}conditionvar\"):\n i += 1\n value, minvalue, maxvalue = None, None, None\n if xml_cond.find(\"{http://www.imsglobal.org/xsd/ims_qtia...
[ "0.5490322", "0.5191696", "0.51593035", "0.5107898", "0.5086407", "0.5031571", "0.5006698", "0.4994813", "0.4990181", "0.4853096", "0.48174155", "0.4813027", "0.48111695", "0.47781536", "0.47757685", "0.4684971", "0.46740764", "0.4671768", "0.4657725", "0.4593421", "0.4558492...
0.5610078
0
Attempt to decode the op_return value (if there is one) as a UTF8 string.
def message(self): if self.op_return is None: return None return bytearray.fromhex(self.op_return).decode('utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_op_return(op_return_hex):\n return binascii.unhexlify(op_return_hex[4:])", "def decode_to_string(self, value):\n #if python3 or python 2.7\n ret = bytearray(value).decode(encoding='UTF-8')\n #if python2.7\n #ret = str(bytearray(value))\n return ret", "def de...
[ "0.7116519", "0.6584167", "0.6458927", "0.6294479", "0.62370384", "0.61930853", "0.6184339", "0.6064527", "0.6043354", "0.6038292", "0.5953588", "0.5853893", "0.5780751", "0.5752925", "0.5690608", "0.56889737", "0.5611481", "0.5602474", "0.55830264", "0.55677", "0.55389047", ...
0.68522495
1
Plot the top 16 images (index 0~15) of self.x for visualization.
def show(self): r = 4 f, axarr = plt.subplots(r, r, figsize=(8,8)) counter = 0 for i in range(r): for j in range(r): temp = self.x[counter,:] counter += 1 img = self.x[counter,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotImages(x):\r\n # 5.1 Create figure-window and axes\r\n _, ax = plt.subplots(nrows = 2, ncols= 3)\r\n # 5.2\r\n ax[0,0].imshow(x[0, :].reshape(75,75))\r\n ax[0,1].imshow(x[1, :].reshape(75,75))\r\n ax[0,2].imshow(x[2, :].reshape(75,75))\r\n ax[1,0].imshow(x[3, :].reshape(75,75))\r\n ...
[ "0.67497605", "0.66891253", "0.6667198", "0.64912814", "0.63734514", "0.6347886", "0.63363266", "0.62914264", "0.6209395", "0.6188897", "0.61845297", "0.612044", "0.6096826", "0.60775787", "0.6062876", "0.6033897", "0.6026951", "0.5987115", "0.59776926", "0.5958177", "0.59081...
0.7417209
0
Translate self.x by the values given in shift.
def translate(self, shift_height, shift_width): # TODO: Implement the translate function. Remember to record the value of the number of pixels translated. # Note: You may wonder what values to append to the edge after the translation. Here, use rolling instead. For # example, if you translate 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Translate(shift_x, shift_y): \n shifted = numpy.matrix([[1.0, 0.0, 1.0 ],\n [0.0, 1.0, 1.0 ],\n [shift_x, shift_y, 1.0 ]]) \n return shifted", "def translateX(shift: float) -> Callable:\n return lambda img: T...
[ "0.73167753", "0.6710237", "0.6670916", "0.65991664", "0.656922", "0.65240043", "0.6521222", "0.6419087", "0.63078797", "0.61142635", "0.6071079", "0.6048051", "0.60323596", "0.6000569", "0.6000489", "0.5993015", "0.5993015", "0.5993015", "0.5993015", "0.59659946", "0.5950393...
0.71160156
1
Rotate self.x by the angles (in degree) given.
def rotate(self, angle=0.0): # TODO: Implement the rotate function. Remember to record the value of # rotation degree. self.rotDegree = angle self.x = rotate(self.x, angle = angle, axes=(0, 1), reshape=False, output=None, order=3, mode='constant', cval=0.0, prefilte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_x(self, angle: float):\n self.vertices = list(\n Matrix44.x_rotate(angle).transform_vertices(self.vertices)\n )\n return self", "def rotate_x(self, angle):\n angle *= np.pi / 180\n return self.transform(np.matrix([[1, 0, 0],\n ...
[ "0.7256782", "0.7236289", "0.7092168", "0.7089826", "0.6841103", "0.6765832", "0.6758413", "0.67209244", "0.66838914", "0.6680822", "0.6680822", "0.66588503", "0.6651625", "0.6643821", "0.66434747", "0.66346294", "0.6634281", "0.6632839", "0.66316897", "0.662466", "0.659218",...
0.7339246
0
Flip self.x according to the mode specified
def flip(self, mode='h'): # TODO: Implement the flip function. Remember to record the boolean values is_horizontal_flip and # is_vertical_flip. if mode == 'h': self.is_horizontal_flip = True self.x = np.flipud(self.x) elif mode == 'v': self.is_vertical...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip(self):", "def set_flipped(self, x, y):\n self.pieces[x + (y * self.width)].set_flipped()", "def flip(self, x, y):\n self.pieces[x + (y * self.width)].flip()", "def set_flip(self, val):\n self.flip = val", "def flip(self):\n self.width, self.height = self.height, self.wi...
[ "0.74587405", "0.72549", "0.7090721", "0.6938638", "0.69142723", "0.68012464", "0.68012464", "0.67602396", "0.6720959", "0.6718812", "0.66909707", "0.66376746", "0.6618198", "0.6614594", "0.6561056", "0.64791644", "0.63954175", "0.6380168", "0.63543123", "0.62199646", "0.6204...
0.8233759
0
Assumes other is an intSet Returns a new intSet containing elements that appear in both sets.
def intersect(self, other): # Initialize a new intSet commonValueSet = intSet() # Go through the values in this set for val in self.vals: # Check if each value is a member of the other set if other.member(val): commonValueSet.insert(val) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect(self, other):\n result = IntSet()\n map(result.insert, [e for e in self.vals if e in other.vals])\n return result", "def union(self, other):\n # initialize new Set from the elements in the first Set\n union_set = Set(self.get_elements())\n\n # add every ele...
[ "0.8098754", "0.7192479", "0.70789164", "0.7060793", "0.6989002", "0.69188017", "0.681181", "0.67463404", "0.67290884", "0.6716298", "0.6682506", "0.6642335", "0.6616468", "0.65950423", "0.6530908", "0.6502224", "0.6470346", "0.6464375", "0.6446177", "0.6383388", "0.6308485",...
0.7586969
1
MotherNaming(s[,pref=None]) > string return the CaMeLeD s. If prefix is not None, return pref+CaMeLeD.
def MotherNaming(s, pref=None): l=s.split("_") l=["%s%s" % (i[0].upper(),i[1:]) for i in l] return (pref or "") + "".join(l)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_naming(ty,target):\n de = ty.description(target)\n de = de[0].upper() + de[1:] + \".\"\n return de", "def _prefix(self):\n name = self.__class__.__name__\n return name[:2] + ''.join(c for c in name if c.isupper())[1:]", "def middle_name(self):\n if \"middleName\" in sel...
[ "0.54010755", "0.53821015", "0.5374781", "0.5364191", "0.5352992", "0.53332883", "0.5309742", "0.530138", "0.5295499", "0.5292221", "0.5278639", "0.52386063", "0.52210087", "0.5214467", "0.52093595", "0.5207389", "0.51927143", "0.51854455", "0.5171591", "0.5161241", "0.515984...
0.7748496
0
If we decorate a view function with jsonify, we wrap our success message around it and return the jsonified data. If we catch a werkzeug HTTPException, we pull the status code out of it, and return the response with the found code.
def jsonify(func): @functools.wraps(func) def convert(*args, **kwargs): success = True code = 200 # default status code - success! try: result = func(*args, **kwargs) if isinstance(result, BaseResponse): return result except exc.H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_response(f):\n \n def wrapped(*args, **kwargs):\n result = f(*args, **kwargs)\n \n response = HttpResponse(json.dumps(result))\n \n if type(result) == dict and \"error\" in result:\n response.status_code = 500\n \n \n return ...
[ "0.7471078", "0.7241357", "0.72072464", "0.7033884", "0.7024659", "0.7009069", "0.69039536", "0.68860555", "0.68472606", "0.68463826", "0.6784867", "0.6762237", "0.6720648", "0.6696755", "0.6681512", "0.6672209", "0.6613562", "0.6606762", "0.6599482", "0.65899205", "0.6561198...
0.748698
0
handle the signature of the directive
def handle_signature(self, sig, signode): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_signature(self, sig, signode):\n\n sig_match = rust_arg_re.match(sig.strip())\n print(\"sig\", sig)\n name = sig_match.group(\"var\")\n typ = sig_match.group(\"type\")\n\n signode += addnodes.desc_name(name, name)\n signode += nodes.Text(': ', ': ')\n sig...
[ "0.65632194", "0.6266912", "0.6251505", "0.61905", "0.6131009", "0.6024999", "0.6001828", "0.59720373", "0.5942335", "0.5924921", "0.5737488", "0.5647833", "0.5443242", "0.5436877", "0.5415011", "0.5415011", "0.54087687", "0.5402887", "0.53215337", "0.5303726", "0.5303726", ...
0.6934738
0
handle the signature of the directive
def handle_signature(self, sig, signode): sig_match = rust_arg_re.match(sig.strip()) print("sig", sig) name = sig_match.group("var") typ = sig_match.group("type") signode += addnodes.desc_name(name, name) signode += nodes.Text(': ', ': ') signode += self._build_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_signature(self, sig, signode):\n raise NotImplementedError", "def handle(self, directive, data):\n raise NotImplementedError", "def signature(function):\n pass", "def _get_directive_name(self):", "def signature(self) -> global___SnippetSignature:", "def handle_signature(self, ...
[ "0.6935874", "0.6266169", "0.62525886", "0.6188378", "0.613172", "0.60251826", "0.60022503", "0.5973138", "0.5942249", "0.5926573", "0.57371014", "0.5649248", "0.5442702", "0.5437488", "0.5414473", "0.5414473", "0.54097617", "0.5403058", "0.53217155", "0.5304859", "0.5304859"...
0.6563454
1
Generator function to convert a PIL image to 16bit 565 RGB bytes.
def image_to_data(image): pixels = image.convert('RGB').load() width, height = image.size for y in range(height): for x in range(width): r,g,b = pixels[(x,y)] color = rgb(r, g, b) yield (color >> 8) & 0xFF yield color & ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_pixels_8bit(image):\n\n w, h = image.size\n for y in range(h):\n for x in range(w):\n value = pack_argb8(image.getpixel((x, y)))\n yield value\n\n raise StopIteration", "def _pack_bitmap(self, w, h, image):\n CHUNKS = math.ceil(w / 8)\n img_bytes =...
[ "0.620823", "0.5748702", "0.5568134", "0.54716986", "0.5466298", "0.54249287", "0.5348286", "0.5305571", "0.530067", "0.5288059", "0.5280445", "0.52762127", "0.5229831", "0.5223723", "0.5220092", "0.51701254", "0.51684964", "0.51524526", "0.51485884", "0.5146951", "0.5143614"...
0.6660582
0
Write the display buffer or provided image to the hardware. If no image parameter is provided the display buffer will be written to the hardware. If an image is provided, it should be RGB format and the same dimensions as the display hardware.
def display(self, image=None): # By default write the internal buffer to the display. if image is None: image = self.buffer # Set address bounds to entire display. self.setAddress() # Convert image to array of 16bit 565 RGB data bytes. # Unfortunate that this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, image):\n raise NotImplementedError()", "def write_image(self, image_name, image):\n raise NotImplementedError", "def write_image(self, img, extname=None, extver=None,\n compress=None, tile_dims=None, header=None):\n\n self.create_image_hdu(img,\n ...
[ "0.63725543", "0.5921246", "0.5748485", "0.57308406", "0.56836385", "0.56755084", "0.5623533", "0.5613797", "0.5610224", "0.5601889", "0.55958885", "0.55772126", "0.55553955", "0.55395144", "0.55384105", "0.55384105", "0.55108064", "0.5503784", "0.55027187", "0.55027187", "0....
0.7294294
0
Clear the image buffer to the specified RGB color (default black).
def clear(self, color=(0,0,0)): width, height = self.buffer.size self.buffer.putdata([color]*(width*height))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self, *args):\n\n black = (0, 0, 0) # default\n\n if len(args) == 0:\n colour = black\n elif len(args) == 1:\n colour = args[0]\n elif len(args) == 3:\n colour = args\n else:\n raise ValueError('Pixel arguments must be given ...
[ "0.74264044", "0.7001992", "0.68183446", "0.67490363", "0.6591455", "0.64442015", "0.6412805", "0.6224743", "0.62203544", "0.62005705", "0.6143208", "0.5934447", "0.5922529", "0.58492565", "0.5807059", "0.5781866", "0.5771528", "0.5742031", "0.5732281", "0.5732281", "0.572022...
0.79759204
0
Return a PIL ImageDraw instance for 2D drawing on the image buffer.
def draw(self): return ImageDraw.Draw(self.buffer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Draw(im, mode=None):\r\n # try:\r\n # return im.getdraw(mode)\r\n # except AttributeError:\r\n # return ImageDraw(im, mode)\r\n return ImageDraw(im)", "def get_image(self):\n image = Image.new('1', (8, 16))\n draw = ImageDraw.Draw(image)\n for x in xrange(8):\n ...
[ "0.6389655", "0.57493675", "0.5472395", "0.5449045", "0.54278857", "0.5398147", "0.5348836", "0.53315246", "0.5250177", "0.5240005", "0.5211034", "0.516861", "0.51537", "0.5129788", "0.51280314", "0.50953037", "0.5077803", "0.502071", "0.5018067", "0.49811712", "0.49748406", ...
0.67710567
0
Path to the AGASC directory. This returns the ``AGASC_DIR`` environment variable if defined, otherwise ``$SKA/data/agasc``.
def default_agasc_dir(): if 'AGASC_DIR' in os.environ: out = Path(os.environ['AGASC_DIR']) else: out = Path(os.environ['SKA'], 'data', 'agasc') return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_awg_dir():\n path = os.path.join(get_pycqed_appdata_dir(), 'awg')\n os.makedirs(path, exist_ok=True)\n return path", "def fasta_dir(self):\n return op.join(self.root_dir, 'fasta')", "def getapache_srcdir():\n return os.getenv(\"APACHESRC\")", "def get_apk_path():\n ROOT_...
[ "0.6418201", "0.61758137", "0.6166837", "0.6136397", "0.59707874", "0.5955374", "0.582124", "0.57593846", "0.55971885", "0.5539885", "0.55095124", "0.5486886", "0.54800457", "0.5461718", "0.54264665", "0.5392617", "0.53507036", "0.53011197", "0.52564883", "0.5245962", "0.5216...
0.8444948
0
Default main AGASC file ``agasc_dir() / miniagasc.h5``.
def default_agasc_file(): return str(default_agasc_dir() / 'miniagasc.h5')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_agasc_dir():\n if 'AGASC_DIR' in os.environ:\n out = Path(os.environ['AGASC_DIR'])\n else:\n out = Path(os.environ['SKA'], 'data', 'agasc')\n return out", "def usage():\n print(\"Usage: python3 c_header_md5.py <dir>\")", "def main():\n \n #set the ascii file to proce...
[ "0.62173706", "0.5726781", "0.51244116", "0.50897306", "0.5072571", "0.50148606", "0.49755955", "0.49443632", "0.4941215", "0.49040723", "0.48829412", "0.48630935", "0.4838869", "0.48384476", "0.4802338", "0.48023137", "0.47763175", "0.46913803", "0.46896473", "0.4677688", "0...
0.8564386
0
In all the commotion, you realize that you forgot to seat yourself. At this point, you're pretty apathetic toward the whole thing, and your happiness wouldn't really go up or down regardless of who you sit next to. You assume everyone else would be just as ambivalent about sitting next to you, too. So, add yourself to ...
def part_2(rules: Rules) -> int: rules_with_myself = add_myself(rules) happiness, _ = max(generate_arrangements(rules_with_myself)) print(f"part 2: optimal arrangement (including myself) brings {happiness} happiness") return happiness
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rules():", "def strategy_guide(filename):\n score = 0\n # Iterate over the lines of the file\n with open(filename, \"rt\", encoding=\"utf-8\") as filetoread:\n for line in filetoread:\n # opponent, player = line.split()\n # print(line.rstrip())\n result =...
[ "0.5988185", "0.59467393", "0.58248025", "0.5769023", "0.5765674", "0.5708403", "0.56677014", "0.566604", "0.56337285", "0.56142676", "0.5497646", "0.5450096", "0.5431667", "0.54168177", "0.54032874", "0.5379399", "0.5354841", "0.53537786", "0.53376514", "0.5321833", "0.52973...
0.619388
0
Shows the list of loginattempts by time.
def list_user_login(request): return render(request, "tracking/listUserLog.html", { "userlogs": list(UserLogin.objects.order_by('-Timestamp')), })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_login_attempts(self):\n print(f\"User {self.last_name} tried login attempt(s) on {self.login_attempts} occasions\")", "def reste_login_attempts(self):\n self.login_attempts = 0", "def draw_attempts(attempts: int):\r\n arcade.draw_text(\r\n \"Attempts: \" + str(attempts), 350, WI...
[ "0.7090305", "0.5892397", "0.58800006", "0.5869522", "0.586239", "0.5823817", "0.5738141", "0.56670755", "0.56670755", "0.56513715", "0.55682987", "0.5564782", "0.5564782", "0.5564782", "0.5564782", "0.5564782", "0.5564782", "0.5564782", "0.5551437", "0.5530131", "0.5503736",...
0.6010337
1
Called by form while it submitting
def form_submit(self, request: http.Request): self._on_form_submit(request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_submit(self):\n return self.form.validate_on_submit()", "def process_form_submit(self, request, form, child, parent=None):\n raise NotImplementedError", "def _resubmit_button_fired(self):\n self.resubmit()", "def form_valid(self, form):\n form.save()\n return super...
[ "0.71759564", "0.69677734", "0.6778415", "0.66359043", "0.65777516", "0.65763426", "0.655524", "0.64827317", "0.6439871", "0.6397709", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "0.62841755", "...
0.7440579
0
Set UID of the widget
def uid(self, value): self._uid = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uid(self, uid):\n\n self._uid = uid", "def uid(self, uid):\n\n self._uid = uid", "def uid(self, uid):\n\n self._uid = uid", "def uid(self, uid):\n\n self._uid = uid", "def set_identifier(self, uid):\n\n self.uid = uid\n\n self.set_unique_metadata('DC', 'identif...
[ "0.7112814", "0.7112814", "0.7112814", "0.7112814", "0.64198923", "0.6380505", "0.6347161", "0.614451", "0.6132184", "0.5929571", "0.592638", "0.5887621", "0.5827817", "0.5755276", "0.57488", "0.57178825", "0.56604", "0.56604", "0.5640939", "0.56255454", "0.55648524", "0.55...
0.7340654
0
Get placeholder of the widget
def placeholder(self): return self._placeholder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeholder(self) -> str | None:\n return self._underlying.placeholder", "def get_widget(self):\r\n return None", "def get_widget(self):\n\t\treturn None", "def get_embedding_placeholder(self):\n return self.embedding_layer.get_embedding_placeholder()", "def make_placeholder(fig: F...
[ "0.7746183", "0.6962415", "0.69038194", "0.6694811", "0.6139663", "0.6066051", "0.60534257", "0.5959178", "0.59587246", "0.5915539", "0.5852626", "0.58431995", "0.58197486", "0.5800924", "0.5797766", "0.5797444", "0.5718738", "0.565468", "0.562401", "0.55115473", "0.5505512",...
0.8032802
0
Get has_messages property of the widget
def has_messages(self) -> bool: return self._has_messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_messages(self, value: bool):\n self._has_messages = value", "def has_message_available(self):\n return not self.feedback_log.empty()", "def get_messages(self):\r\n return self.messages", "def get_status_messages(self):\n return self.data[\"allMessagesForFrontend\"][\"messa...
[ "0.6465423", "0.6324197", "0.63199866", "0.6221711", "0.61114615", "0.6108976", "0.6105681", "0.58858025", "0.58858025", "0.58858025", "0.58443534", "0.58033097", "0.57874036", "0.57827586", "0.573829", "0.573829", "0.573829", "0.5719146", "0.5707117", "0.5673174", "0.5668842...
0.75046647
0
Set has_messages property of the widget
def has_messages(self, value: bool): self._has_messages = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_messages(self) -> bool:\n return self._has_messages", "def messages(self, messages):\r\n\r\n self._messages = messages", "def messages(self, messages):\n self._messages = messages", "def flag_messages(self, org, messages):\n pass", "def display_message(self, message):\n ...
[ "0.6579301", "0.6165718", "0.605717", "0.60542905", "0.5929934", "0.5929934", "0.59017116", "0.5875109", "0.5875109", "0.5875109", "0.5792854", "0.5779761", "0.5734331", "0.5730583", "0.57003075", "0.5694786", "0.5671058", "0.5532576", "0.55273634", "0.55226135", "0.55211437"...
0.7356048
0
Set has_success property of the widget
def has_success(self, value: bool): self._has_success = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indicate_success(self):\n pass", "def success(self, success):\n self._success = success", "def showTestSuccess(self, test):\n #self._setTestButtonColor(test.id(), self.SUCCESS_COLOR)\n self.test_buttons[test.id()].setState('success')\n self.update_idletasks()\n ret...
[ "0.72147864", "0.7165877", "0.678792", "0.6762581", "0.6747431", "0.6712996", "0.665892", "0.6548164", "0.64763373", "0.639729", "0.63920414", "0.63784343", "0.6370113", "0.63188165", "0.63071966", "0.62605023", "0.6186061", "0.61316663", "0.6112824", "0.6078806", "0.5925388"...
0.72651744
0
Get has_warning property of the widget
def has_warning(self) -> bool: return self._has_warning
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_warning(self) -> bool:\n return not self.get_warning()", "def is_warning(self) -> bool:\n return not self.get_warning()", "def has_warnings_active(self) -> bool:", "def has_warnings(self) -> bool:", "def isWarning(self):\n return _libsbml.XMLError_isWarning(self)", "def warn(s...
[ "0.748246", "0.748246", "0.73751265", "0.7055091", "0.6928742", "0.67840916", "0.6772239", "0.6746873", "0.6743896", "0.66362774", "0.66165125", "0.6578441", "0.64981973", "0.6457567", "0.6400714", "0.6396353", "0.6380984", "0.6379839", "0.6255768", "0.622124", "0.6199615", ...
0.7673583
0
Set has_warning property of the widget
def has_warning(self, value: bool): self._has_warning = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_warning(self, text):\n if self.warning_panel:\n self.warning_panel.disable()\n self.warning_panel = None\n self.warning_panel = WarningPanel(self, text)", "def has_warning(self) -> bool:\n return self._has_warning", "def is_warning(self) -> bool:\n ret...
[ "0.72188807", "0.7132413", "0.70143336", "0.70143336", "0.7008226", "0.6995131", "0.6712466", "0.66723037", "0.6656456", "0.6561328", "0.6558266", "0.6546669", "0.6468561", "0.6423147", "0.6416835", "0.6407806", "0.64015454", "0.6399567", "0.63735914", "0.6317695", "0.6308147...
0.7391669
0
Set has_error property of the widget
def has_error(self, value: bool): self._has_error = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_error(self, has_error):\n\n self._has_error = has_error", "def show_error(self, error):\n if (error == \"\"):\n self.ui.errorLabel.setText(\"\")\n else:\n self.ui.errorLabel.setText(\"<span style=\\\"font-weight:600; color:#ff0000;\\\">{0}</span>\".format(error)...
[ "0.7368072", "0.699724", "0.6874446", "0.6844955", "0.6761945", "0.67018133", "0.66589975", "0.66546184", "0.6630775", "0.65374136", "0.65041155", "0.64988786", "0.6482549", "0.6464522", "0.64479315", "0.6431164", "0.64277655", "0.6413317", "0.63987714", "0.63213897", "0.6302...
0.73448485
1
Set help string of the widget
def help(self, value: str): self._help = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_text(self, help_text):\n self._help_text = help_text", "def SetShortHelp(self, s):\r\n\r\n self.short_help = s", "def setHelpText( self, cCtrlName, cHelpText ):\n self.setControlModelProperty( cCtrlName, \"HelpText\", cHelpText )", "def add_help(text):\n global default_text\n...
[ "0.7599668", "0.75344115", "0.750446", "0.7316718", "0.72220814", "0.720402", "0.71970075", "0.71454084", "0.7121287", "0.7077999", "0.70707047", "0.70490396", "0.70082474", "0.70052934", "0.69836986", "0.69836986", "0.69675845", "0.6938421", "0.69244206", "0.6892952", "0.688...
0.7996435
0
Get child widget by uid
def get_child(self, uid: str): if not self.has_child(uid): raise RuntimeError("Widget '{}' doesn't contain child '{}'.".format(self.uid, uid)) for w in self._children: if w.uid == uid: return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, uid, default=None):\n item = self._registry.get(uid, default)\n if not item:\n logger.debug(\n \"Can't find plugin widget with uid `%s` in `%s` registry\",\n uid,\n self.__class__\n )\n return item", "def get_wi...
[ "0.6680623", "0.6405964", "0.6376366", "0.6319116", "0.6287394", "0.61849874", "0.6136786", "0.6063684", "0.6048443", "0.6031012", "0.5980837", "0.5978733", "0.595957", "0.5871477", "0.58363163", "0.5819267", "0.5800626", "0.5781544", "0.5775968", "0.57716477", "0.5696547", ...
0.8382884
0
Add single validation rule
def add_rule(self, rule: validation.rule.Rule): self._rules.append(rule) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rule(self, rule) -> None:\n self.add_rules([rule])", "def add_rule(self, rule):\n self.rule.append(rule)", "def addRule(self, *args):\n return _libsbml.Model_addRule(self, *args)", "def add_rule(self, rule):\n \n self.rules.append(rule)", "def add_rule(self, rule:...
[ "0.6737993", "0.670168", "0.6697824", "0.65529305", "0.650502", "0.6472671", "0.6472671", "0.64662516", "0.64335275", "0.64335275", "0.63634306", "0.6242663", "0.6166137", "0.61482376", "0.6146549", "0.6128067", "0.6086094", "0.6085264", "0.60778064", "0.601937", "0.598388", ...
0.6747155
0
Validate the widget's rules
def validate(self): for rule in self.get_rules(): rule.validate(self.get_val())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n ...", "def validate(self):", "def validate(self):", "def validate(self):\n pass", "def validate(self):\n pass", "def validate(self):\n pass", "def validate(self):\n pass", "def validate(self):\n pass", "def validate(self):\n pas...
[ "0.7155671", "0.715229", "0.715229", "0.70098543", "0.70098543", "0.70098543", "0.70098543", "0.70098543", "0.70098543", "0.70098543", "0.70098543", "0.69748527", "0.6894612", "0.68886787", "0.68837595", "0.6808162", "0.6757504", "0.6663833", "0.6552026", "0.6530128", "0.6527...
0.72672886
0
Translate a string into plural form.
def t_plural(cls, partial_msg_id: str, num: int = 2) -> str: return lang.t_plural(cls.resolve_msg_id(partial_msg_id), num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluralize(cls, singular):\n plural = singular\n if not singular or singular.strip() == ''\\\n or singular[-2:] in ('es', 'ds', 'ts', 'ms', 'hs', 'ps')\\\n or singular == 'stuff':\n pass\n elif singular[-1:] in ('s', 'x') or singular[...
[ "0.7105934", "0.7033801", "0.701947", "0.68946844", "0.6862388", "0.6861455", "0.68470025", "0.680656", "0.6804145", "0.6783632", "0.6759445", "0.65388405", "0.64694625", "0.64654136", "0.6358805", "0.63274246", "0.62578046", "0.624652", "0.6182742", "0.6105269", "0.59491765"...
0.7326963
0
Gives the fibonacci number at max_num in the sequence, starting at 0.
def fibonacci(max_num): # base case if max_num <= 1: return 1 else: # moving toward base case # calling itself recursively return fibonacci(max_num - 1) + fibonacci(max_num - 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci_sequence(max):\n term = fibonacci_term(0)\n f = []\n i = 1\n while term < max:\n f.append(term)\n term = fibonacci_term(i)\n i += 1\n return f", "def fibonacci(n):", "def generateFibonacci(upper_bound):\n fibs = [0]\n latest = 1\n while latest < upper_...
[ "0.82454664", "0.72755474", "0.72547036", "0.71419305", "0.7062736", "0.69519484", "0.69198763", "0.69005096", "0.68875295", "0.6868263", "0.6847889", "0.68334925", "0.6822688", "0.68197864", "0.6818521", "0.67989063", "0.6790079", "0.6769191", "0.67606544", "0.67540085", "0....
0.8734438
0
Converts a base 10 number to a given base up to 16 and returns the result as a string.
def convert_base(num, to_base): digits = '0123456789ABCDEF' result = '' if num < to_base: return digits[num] else: result += convert_base(num/to_base, to_base) + str(digits[num % to_base]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_base(num, n):\r\n new_num_string = ''\r\n current = num\r\n while current != 0:\r\n remainder = current % n\r\n if remainder > 9:\r\n remainder_string = HEX_CHARS[remainder]\r\n elif remainder >= 36:\r\n remainder_string = '('+str(remainder)+')'\r\n ...
[ "0.7296235", "0.7156206", "0.7094581", "0.69260496", "0.69048107", "0.69045806", "0.68753", "0.68708", "0.68516225", "0.6806556", "0.6805811", "0.67296964", "0.6681154", "0.6625235", "0.6613191", "0.6561083", "0.6535204", "0.652886", "0.6512611", "0.6505458", "0.64382976", ...
0.742156
0
Plot diagram on the server (plotly)
def plot_graph(self, dataset): data = self.data diagrams = [] for time_stamp, data_tag in dataset: data_x, data_y = [], [] for item in data: data_x.append(item[time_stamp]) data_y.append(item[data_tag]) diagrams.append(Scatter(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_graph(self) -> None:", "def plot_graph():\n name = request.args.get('instance')\n name = str(name)\n distance = request.args.get('distance')\n path = request.args.get('path')\n if name == 'Custom':\n coords = request.args.get('coords')\n coords = str(coords)\n nodes =...
[ "0.7041846", "0.6837544", "0.6675694", "0.65988076", "0.6448052", "0.64137185", "0.6412793", "0.64123386", "0.6342509", "0.6265307", "0.6258301", "0.62533534", "0.6247368", "0.6230237", "0.6224757", "0.6215587", "0.6206613", "0.61823153", "0.61784214", "0.6174016", "0.6165213...
0.7183997
0
Get stack secrets from AWS Secrets Manager
def get_secrets(session, secret_id): secretsmanager = session.client('secretsmanager') secrets = json.loads(secretsmanager.get_secret_value(SecretId=secret_id)['SecretString']) formatted_secrets = [] for (key, value) in secrets.items(): skipped_secrets = [ # cloudformation doesn't need these, so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secrets(token):\n try:\n return get_keycloak_client().userinfo(token)['attributes'].get('secrets')\n except KeycloakError as ke:\n logger.error(\"Keycloak error: {0}\").format(ke)\n raise exceptions.TransferError\n except KeyError as ke:\n logger.error(\"Secrects not fo...
[ "0.687092", "0.6862838", "0.67613345", "0.67612904", "0.6738275", "0.6707533", "0.6665517", "0.6653283", "0.6589323", "0.6560593", "0.65263146", "0.64855266", "0.6449559", "0.6406883", "0.63925076", "0.639028", "0.6369368", "0.63691497", "0.6348001", "0.6340888", "0.6338398",...
0.7030895
0
Deploy the stack using CloudFormation
def deploy_stack(session, secrets): with open('scripts/cf_stack.yml') as template: template_data = template.read() try: cloudformation = session.client('cloudformation') stack = cloudformation.update_stack( StackName=STACK_NAME, TemplateBody=te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_stack():\n build = \"sam build --use-container --manifest src/images/requirements.txt\"\n local(build)\n\n #package = f\"sam package --template-file template.yaml --output-template-file \\\n # packaged.yaml --s3-bucket {env.bucket_name} --region {env.aws_region}\"\n #local(pack...
[ "0.8165916", "0.73479223", "0.7197478", "0.7171656", "0.7069109", "0.69530916", "0.6910017", "0.6910017", "0.6910017", "0.680107", "0.6724394", "0.6635059", "0.66068864", "0.6604662", "0.65353376", "0.65143925", "0.647648", "0.6431885", "0.6402537", "0.63864774", "0.6371378",...
0.7620237
1
get_artifacts retrieves a list of artifacts from the selected date range that are listed in artifact_names
def get_artifacts(token, artifact_names, start, end): artifacts = [] page = 1 retry_limit = 3 while True: req = Request(URL + f"&page={page}") req.add_header("Accept", "application/vnd.github.v3+json") req.add_header("Authorization", f"token {token}") with urlopen(req) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_artifacts(arn=None, type=None, nextToken=None):\n pass", "def get_artifacts(self): # noqa\n return []", "def ListArtifacts(context=None):\n args = artifact_pb2.ApiListArtifactsArgs()\n\n items = context.SendIteratorRequest(\"ListArtifacts\", args)\n return utils.MapItemsIterator(\n ...
[ "0.62851334", "0.6113135", "0.6064954", "0.59905976", "0.59526086", "0.5909345", "0.58020896", "0.5793897", "0.5789094", "0.56654173", "0.5651046", "0.5628597", "0.55909586", "0.5543793", "0.55070513", "0.5492238", "0.5491012", "0.5450362", "0.5435418", "0.54337335", "0.54229...
0.74535733
0
run_curl downloads an artifact file It returns True if the response was a 200 If there was an exception is returns False and the error, as well as printing it to stderr
def run_curl(token, url, filename): with open(filename, "wb") as f: c = pycurl.Curl() headers = [ "Accept: application/vnd.github.v3+json", f"Authorization: token {token}", ] options = { pycurl.FOLLOWLOCATION: 1, pycurl.MAXREDIRS: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download():\n try:\n cli.run(\n [URL, '--output', TEMP_DIR],\n )\n except SystemExit:\n return None", "def download():\n \"\"\"\n \"The book p.79 have error.\n \"https://github.com/login/oauth/authorize?client_id=7e0a3cd836d3e544dbd9&redirect_uri=https%3A%2F%2Fg...
[ "0.6837836", "0.65569276", "0.6459137", "0.6098042", "0.60824317", "0.60367334", "0.6025276", "0.59450996", "0.5937624", "0.59262097", "0.59234077", "0.5850303", "0.5835884", "0.5819191", "0.58178324", "0.5811782", "0.58065355", "0.58063036", "0.57906973", "0.57856756", "0.57...
0.66907537
1
download_artifacts downloads the artifacts as uniquely named files If there is a problem downloading an artifact it is skipped and not added to the returned list. It returns a list of tuples containing the artifact name, the artifact name with the updated date appended (eg. logsrhel820220401), and the filename of the z...
def download_artifacts(token, artifacts): zipfiles = [] for a in artifacts: updated_at = datetime.fromisoformat(a["updated_at"][:-1]) datename = a["name"]+updated_at.strftime("-%Y-%m-%d") filename = datename + ".zip" if os.path.exists(filename): zipfiles.append((a["na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_artifacts(self):\n for artifact_set in self._sets:\n for artifact in artifact_set.artifacts:\n artifact.download(self._cache_dir)", "def download_artifacts(self, artifact_path, dst_path=None):\n from mlflow.exceptions import MlflowException\n from mlflo...
[ "0.6780798", "0.6433715", "0.62294877", "0.6091567", "0.6024875", "0.5957833", "0.5931542", "0.5791437", "0.5782672", "0.5776921", "0.57510954", "0.5663708", "0.56491435", "0.56146324", "0.55540717", "0.5554006", "0.5544768", "0.5540744", "0.5530617", "0.55126387", "0.5495113...
0.78509545
0
extract_logs unzips the archive into a temporary directory This directory is deleted when the object goes out of scope
def extract_logs(f): tdir = tempfile.TemporaryDirectory(prefix="kstest-log-", dir="/var/tmp/") with zipfile.ZipFile(f) as zf: zf.extractall(tdir.name) # Return the object so that the temporary directory isn't deleted yet return tdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive_logs():\n logging.info('Archive start...')\n\n for log_dir in filter(dir_filter, os.listdir('logs')):\n path = 'logs/{}'.format(log_dir)\n archive_files = filter(lambda x: '.log.' in x, os.listdir(path))\n zip_file_name = '{}/{}.zip'.format(\n path,\n st...
[ "0.6675291", "0.6493526", "0.6453004", "0.6287662", "0.6278826", "0.6237546", "0.6147812", "0.602612", "0.6011046", "0.5996023", "0.5976501", "0.5959513", "0.59492356", "0.59304875", "0.58803034", "0.5847064", "0.5837065", "0.58243597", "0.5759916", "0.5704672", "0.5689957", ...
0.7979836
0
Build kstestlist if it is missing This is a list of the expected tests, and it is used to help detect when tests are totally missing from the results.
def generate_test_list(tdir): # Skip this if it already exists if os.path.exists(os.path.join(tdir.name, "kstest-list")): return kstest_log = os.path.join(tdir.name, "kstest.log") with open(kstest_log) as f: for line in f.readlines(): if not line.startswith("Running tests: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_tests(session):\n print('The following samples do not have tests:')\n for sample in set(ALL_SAMPLE_DIRECTORIES) - set(ALL_TESTED_SAMPLES):\n print('* {}'.format(sample))", "def getValidTests(sourceTree):\n\n tests = getSections()\n newTests = tests[:]\n\n # [main] is reserved fo...
[ "0.6030283", "0.59854925", "0.58058256", "0.5795929", "0.57791466", "0.5722242", "0.5687415", "0.56257826", "0.56237376", "0.5608819", "0.5591155", "0.55739754", "0.5551726", "0.5548339", "0.55373514", "0.5535107", "0.55278736", "0.5514099", "0.551295", "0.5512868", "0.549971...
0.66218716
0
rebuild_logs recreates kstest.log with timestamps It does this by appending all the individual kstest.log files, which do contain timestamps, into a new kstest.log
def rebuild_logs(tdir): # Remove the old log with no timestamps kstest_log = os.path.join(tdir.name, "kstest.log") os.unlink(kstest_log) # Find all the test's kstest.log files and append them to kstest.log with open(kstest_log, "w") as ksf: for log in glob(os.path.join(tdir.name, "*", "kste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive_test_logs(days, archive_path, all_logs):\n for day in days.keys():\n daydir = datetime.strptime(day, \"%Y%m%d\").strftime(\"%m-%d-%Y\")\n for scenario in days[day].keys():\n # temporary log directories are stored by scenario + date\n datename = scenario + \"-\" + ...
[ "0.573933", "0.547223", "0.5444321", "0.5343939", "0.5266146", "0.5255325", "0.5246738", "0.52280587", "0.52257246", "0.51725656", "0.5171732", "0.5162436", "0.51595473", "0.51341885", "0.5128186", "0.51131237", "0.5106127", "0.5093791", "0.50519955", "0.5046666", "0.50312054...
0.8305941
0
Check the tests for success, failing, missing, or flakes success after first failing
def check_tests(tests): success = [] missing = [] failed = {} flakes = {} # The goal is to sort the tests into good/failed and record the ones # that passed after first failing in flakes for t in tests: name = t["name"] if t["success"]: # Tests should never have ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_01(self):\n if True:\n self.fail()", "def test_xfailed_but_passed():\n pass", "def _check(self):\n if self.action_on_failure not in self.ACTION_ON_FAILURE:\n raise type_utils.TestListError(\n 'action_on_failure must be one of \"NEXT\", \"PARENT\", \"STOP\"')\...
[ "0.7447249", "0.7277911", "0.7173201", "0.7139381", "0.7075159", "0.70683914", "0.7002783", "0.6999085", "0.690736", "0.689293", "0.6890888", "0.6885783", "0.68525404", "0.68422467", "0.68081737", "0.67695063", "0.67480874", "0.6727176", "0.6727176", "0.67243105", "0.669963",...
0.7422339
1
Return the directory of the logs for the test The logfile path should start with /var/tmp/kstest but this finds the kstest no matter what the leading path elements are.
def kstest_logdir(tmpdir, test): logfile = test["logfile"] for e in logfile.split(os.path.sep): if e.startswith("kstest-"): return os.path.join(tmpdir, e) raise RuntimeError(f"No kstest-* directory found in {logfile}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_dir():\n base_dir = os.path.realpath(cfg.CONF.ruiner.log_dir.rstrip('/'))\n return os.path.join(base_dir, test_start_time_tag())", "def find_logs():\n dirname = os.path.normpath('./logs')\n d = 1\n\n while d < 5:\n if os.path.exists(dirname):\n ...
[ "0.80356836", "0.7846771", "0.71328664", "0.70817816", "0.706733", "0.6993162", "0.69646066", "0.695999", "0.69549584", "0.6926094", "0.68190086", "0.6809121", "0.67710567", "0.6690169", "0.66255903", "0.6602562", "0.6601385", "0.65971583", "0.6596945", "0.6586818", "0.655515...
0.8751071
0
Store the logs from the failed/flaky tests for archiving
def archive_test_logs(days, archive_path, all_logs): for day in days.keys(): daydir = datetime.strptime(day, "%Y%m%d").strftime("%m-%d-%Y") for scenario in days[day].keys(): # temporary log directories are stored by scenario + date datename = scenario + "-" + datetime.strptim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logs(self):\n # Purge all logs\n log_dir = self.test_config['LOG_DIR']\n pattern = re.compile('^nginx-access-ui.log-(?P<day_of_log>\\d{8})(\\.gz)?$')\n logs = [f for f in os.listdir(log_dir) if re.search(pattern, f)]\n map(os.remove, logs)\n\n # Try to make report...
[ "0.6937015", "0.65690154", "0.63970125", "0.6395984", "0.6333514", "0.6305316", "0.62999034", "0.6236932", "0.622326", "0.61978394", "0.6197243", "0.6155044", "0.6001327", "0.5977333", "0.5946991", "0.5939338", "0.5938523", "0.5921103", "0.59054327", "0.58942145", "0.58875066...
0.7180109
0
Process the logfiles into a data structure
def process_logs(logs): all_data = {} for log in logs: with open(log) as f: data = json.load(f) scenario = data[0].get("scenario", None) if scenario is None: # No scenario name, no way to organize the data continue # Use th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_logs(self, log_file, start_time):\n self.__init__()\n files = sorted(glob.glob(log_file + '*'))\n self.set_start_time(start_time)\n for path in files:\n try:\n self.process_log_file(path)\n except Exception:\n logging.excep...
[ "0.70984405", "0.6926333", "0.6860853", "0.68394643", "0.6788565", "0.6727531", "0.6643383", "0.6623963", "0.6591322", "0.65743077", "0.6561653", "0.6520253", "0.6498934", "0.6496492", "0.6476143", "0.641656", "0.63953924", "0.63196033", "0.62846935", "0.62767667", "0.6264513...
0.69821584
1
Test the weekly summary on a single directory Instead of pulling artifacts from github use a single directory with kstest.log.json and the log directories.
def test_summary(args, path): log = os.path.join(path, "kstest.log.json") with open(log) as f: data = json.load(f) scenario = data[0].get("scenario", None) if not scenario: raise RuntimeError("No scenario found in %s" % log) # The json log filename needs to be in the form of <sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(args, json_logs, all_logs):\n all_data = process_logs(json_logs)\n if args.debug:\n print(json.dumps(all_data))\n\n buf = io.StringIO()\n\n start = args.start.strftime(\"%m/%d/%Y %H:%M:%S\")\n end = args.end.strftime(\"%m/%d/%Y %H:%M:%S\")\n print(f\"Test Summary Report: {start...
[ "0.6431939", "0.6247189", "0.60818046", "0.59794647", "0.59474444", "0.5818806", "0.5749665", "0.5744989", "0.5685495", "0.56652904", "0.5640439", "0.5622271", "0.5571859", "0.55644435", "0.54774284", "0.5467077", "0.5453178", "0.5449334", "0.54212785", "0.5403824", "0.539632...
0.64155436
1
Gather inputs, requires mvip, user, password, called in connect_cluster
def get_inputs(): parser = argparse.ArgumentParser() parser.add_argument('-m', type=str, required=True, metavar='mvip', help='MVIP name or IP') parser.add_argument('-u', type=str, required=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n mvip, user, user_pass, mvip_node = get_inputs()\r\n payload = build_payload()\r\n headers, url = build_auth(mvip, user, user_pass, mvip_node)\r\n response_json = connect_cluster(headers, url, payload)\r\n paired_vols = get_replication_status(response_json)\r\n payload = get_vol_st...
[ "0.66470206", "0.63491094", "0.6090336", "0.5548277", "0.5507625", "0.5255818", "0.5231798", "0.52297187", "0.5209007", "0.52013713", "0.51971656", "0.51877546", "0.51562357", "0.5097037", "0.50876987", "0.5076763", "0.5070966", "0.5059021", "0.5032493", "0.5030775", "0.50285...
0.734666
0
Gather the networking information for virtual networks Looks at the subnet and determines the block size for use in find_block
def find_net_info(sfe): print("-" * 20 + " find_net_info started") virt_net = sfe.list_virtual_networks() json_virt_net = virt_net.to_json() #pprint(json_virt_net) virt_mask = json_virt_net['virtualNetworks'][0]['netmask'] svip = json_virt_net['virtualNetworks'][0]['svip'] # Break the netma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_info(self) -> dict:\n \n network_info_url = self.network + bf_network_informations_url\n \n response = query_blockfrost(network_info_url, self.api_key, self.proxies)\n \n return response", "def get_nets_other(self, response):\n\n nets = []\n\n #...
[ "0.63088715", "0.62128544", "0.61159784", "0.59739673", "0.59598607", "0.59193575", "0.59048516", "0.58998084", "0.58414185", "0.584055", "0.5834888", "0.58308357", "0.58269083", "0.58223736", "0.5790425", "0.57656413", "0.575994", "0.57408524", "0.57342845", "0.5718532", "0....
0.7445673
0
returnError Helper function to format & return error messages & codes
def returnError(msg, errcode): logger.warning("[FLASKWEB] Returning error code %d, `%s`" % (errcode, msg)) if request.headers['Accept'] == 'application/json': return msg, errcode else: return render_template("error.html", message=msg, code=errcode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_error_return(logger, e):\n if not isinstance(e, GFedv2BaseError): # convert unknown errors into GFedv2ServerError\n e = GFedv2ServerError(str(e))\n # do some logging\n logger.error(e)\n logger.error(traceback.format_exc())\n return { 'code' : e.code, 'output' ...
[ "0.6734954", "0.66007185", "0.64535177", "0.6392332", "0.63505596", "0.63263667", "0.6324137", "0.6323087", "0.6286403", "0.6266832", "0.62397146", "0.62365645", "0.62346655", "0.62246764", "0.62246764", "0.62246764", "0.62246764", "0.62246764", "0.62246764", "0.62246764", "0...
0.73820394
0
/trace Debugging response. Returns the client's HTTP request data in json
def trace(): logger.debug('[FLASKWEB /trace] Trace debug request') output = {} output['args'] = request.args output['form'] = request.form output['method'] = request.method output['url'] = request.url output['client_ip'] = request.remote_addr output['headers'] = {k: str(v) for k,v in request.headers.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_request_response(request_response: json):\n print(\"Printing response:\")\n print(json.dumps(request_response, indent=4))", "def recieve_information_from_client():\r\n client_data = request.forms.get('json')\r\n client_data_dict = json.loads(client_data)\r\n return client_data_dict", "...
[ "0.6629236", "0.6249275", "0.6205618", "0.6190564", "0.61868846", "0.6139369", "0.61106044", "0.6067987", "0.6066992", "0.6038221", "0.6009513", "0.59663624", "0.59579146", "0.5954386", "0.5929317", "0.59011734", "0.5900961", "0.58964413", "0.58666855", "0.584764", "0.5842262...
0.7278556
0
Redirect to uploadApp (/apps)
def uploadAppRedir(): logger.debug('[FLASKWEB /app] Redirect to /apps') return uploadApp()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage_redirect():\n return redirect('/upload_file')", "def uploadApp():\n if request.method == 'POST':\n logger.debug(\"[FLASKWEB /apps] POST request to upload new application\")\n file = request.files['file']\n if file:\n name = secure_filename(file.filename)\n path ...
[ "0.7388384", "0.6542541", "0.6166222", "0.6160123", "0.5989462", "0.59579355", "0.5895255", "0.5875443", "0.5824586", "0.580535", "0.5780292", "0.5753175", "0.57265717", "0.5722321", "0.57081956", "0.57006425", "0.5697", "0.5694428", "0.5694428", "0.5694428", "0.5692574", "...
0.8083105
0
/apps, /app Application Level interface POST Upload new application
def uploadApp(): if request.method == 'POST': logger.debug("[FLASKWEB /apps] POST request to upload new application") file = request.files['file'] if file: name = secure_filename(file.filename) path = os.path.join(webapp.config['UPLOADED_APPS_DEST'], name) if not os.pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uploadAppRedir():\n logger.debug('[FLASKWEB /app] Redirect to /apps')\n return uploadApp()", "def archiveApp(appName, appUID):\n logger.debug('[FLASKWEB /app/<appName>/<appUID>] %s Request for App Archive `%s`, UID=`%s`' % (request.method, appName, appUID))\n applist = [a['name'] for a in db.getAllApps...
[ "0.71810454", "0.66552866", "0.6518143", "0.64690244", "0.6459349", "0.6444021", "0.6435947", "0.6331888", "0.61352396", "0.6041626", "0.5994621", "0.594027", "0.59069973", "0.58992696", "0.5880521", "0.5849524", "0.5844412", "0.58206266", "0.57350886", "0.57200146", "0.57166...
0.77869135
0
/apps/ Specific Application Level interface GET Display all versions for given application
def getApp(appName): logger.debug('[FLASKWEB /apps/<appName>] GET request for app, `%s`' % appName) applist = [a['name'] for a in db.getAllApps()] if appName in applist: versionList = db.getVersions(appName) if request.headers['Accept'] == 'application/json': return jsonify(dict(name=appName, versi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_versions(request):\n # Why is this getting a single app_status since it's M2M currently?\n apps = Application.objects.values('id', 'acronym', 'release', 'app_status__name').order_by('acronym', 'release')\n acro_vers = OrderedDict()\n for app in apps:\n acro = app.pop('acronym')\n...
[ "0.72549623", "0.7047828", "0.69148934", "0.69063747", "0.67983884", "0.6790738", "0.650549", "0.64699817", "0.6457606", "0.6393148", "0.63736606", "0.6332517", "0.6253601", "0.6241046", "0.6213439", "0.62082475", "0.61838937", "0.61288184", "0.6113324", "0.6107098", "0.61019...
0.7293476
0
/apps// Specific Application Level interface POST (Upload archive data (C++, Source, etc....)
def archiveApp(appName, appUID): logger.debug('[FLASKWEB /app/<appName>/<appUID>] %s Request for App Archive `%s`, UID=`%s`' % (request.method, appName, appUID)) applist = [a['name'] for a in db.getAllApps()] uname = AppID.getAppId(appName, appUID) # if appName not in applist: # logger.warning("Archive re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload():\n storeapps = APP.config[\"storage\"]\n binary = request.data\n\n # Add compatibility with POST requests\n if 'file' in request.files:\n binary = request.files['file'].read()\n\n logging.debug(\"Received file with size: %i\", len(binary))\n\n try:\n app = nativeapps.ap...
[ "0.69470954", "0.68472046", "0.6520792", "0.6266478", "0.619796", "0.6085875", "0.60120636", "0.5959014", "0.58974946", "0.58400166", "0.57916546", "0.57383716", "0.5696889", "0.5674359", "0.56729335", "0.5669212", "0.566515", "0.565947", "0.56565726", "0.56480646", "0.564524...
0.7113232
0
/delete/app/ POST Deletes an app from the web server
def deleteApp(appName): logger.debug('[FLASKWEB /delete/app/<appName>] Request to delete App `%s`', appName) applist = [a['name'] for a in db.getAllApps()] if appName not in applist: return returnError("Application %s does not exist" % appName, 404) logger.info("[FLASKWEB] DELETING all versions of app, `...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_application(self, method=\"POST\", short_name=\"sampleapp\"):\r\n if method == \"POST\":\r\n return self.app.post(\"/app/%s/delete\" % short_name,\r\n follow_redirects=True)\r\n else:\r\n return self.app.get(\"/app/%s/delete\" % short_n...
[ "0.79714966", "0.7803956", "0.7701067", "0.7624749", "0.741058", "0.7185991", "0.7005183", "0.69657683", "0.69562256", "0.6893769", "0.6751926", "0.6721188", "0.667433", "0.6642517", "0.6581911", "0.64642406", "0.6459213", "0.64284325", "0.6405002", "0.63883865", "0.6361073",...
0.7815879
1
Redirect createJob using the latest uploaded application version
def createJobLatest(appName): logger.debug('[FLASKWEB /jobs/<appName>] Redirect to current version of /jobs/%s' % appName) app = db.getApp(appName) if app: return createJob(appName, app['uid']) else: return returnError("Application %s does not exist" % appName, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_version():\n return redirect(url_for(\"base_blueprint.version\"), code=301)", "def replayJob(appName, jobId):\n global dispatcher\n joblist = db.getJobs(jobId=jobId)\n oldjob = None if len(joblist) == 0 else joblist[0]\n if oldjob:\n logger.info(\"[FLASKWEB] REPLAYING %s\" % jobId),\n ...
[ "0.62061787", "0.57394415", "0.5688691", "0.5687288", "0.5673416", "0.5658529", "0.5651011", "0.55267835", "0.55201745", "0.54961264", "0.5463519", "0.54309285", "0.5351755", "0.53293854", "0.5322989", "0.5322989", "0.5313083", "0.5267564", "0.52459973", "0.5230121", "0.52146...
0.82975733
0
/jobs/ /jobs//<appUID Launch a new K3 Job POST Create new K3 Job
def createJob(appName, appUID): logger.debug('[FLASKWEB /jobs/<appName>/<appUID>] Job Request for %s' % appName) global dispatcher applist = [a['name'] for a in db.getAllApps()] if appName in applist: if request.method == 'POST': logger.debug("POST Request for a new job") # TODO: Get user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n data, errors = JobSchema().loads(request.data)\n\n if errors:\n return Response().send(\n data=None, status=400, code=\"bad_request\", message=errors\n )\n return self.job.create(request.json)", "def create_job(api_instance, job):\n a...
[ "0.70126164", "0.6977595", "0.6593558", "0.656247", "0.65051025", "0.6479202", "0.6465646", "0.6434851", "0.64250505", "0.63821256", "0.6313119", "0.6285152", "0.6159158", "0.6148709", "0.613675", "0.6134416", "0.6117276", "0.61007994", "0.603425", "0.60235155", "0.6014143", ...
0.74424857
0
/jobs//<appUID/replay Replay a previous K3 Job POST Create new K3 Job
def replayJob(appName, jobId): global dispatcher joblist = db.getJobs(jobId=jobId) oldjob = None if len(joblist) == 0 else joblist[0] if oldjob: logger.info("[FLASKWEB] REPLAYING %s" % jobId), # Post new job request, get job ID & submit time thisjob = dict(appName=oldjob['appName'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createJob(appName, appUID):\n logger.debug('[FLASKWEB /jobs/<appName>/<appUID>] Job Request for %s' % appName)\n global dispatcher\n applist = [a['name'] for a in db.getAllApps()]\n if appName in applist:\n if request.method == 'POST':\n logger.debug(\"POST Request for a new job\")\n # TO...
[ "0.63891685", "0.59505343", "0.5819279", "0.5595873", "0.5586276", "0.5533534", "0.5521168", "0.551605", "0.5493336", "0.54673713", "0.53895426", "0.53681237", "0.53586406", "0.5327805", "0.5304244", "0.52509314", "0.5239014", "0.5180497", "0.51631284", "0.51589257", "0.51474...
0.7379785
0
/jobs///archive Endpoint to receive & archive files GET returns curl command POST Accept files for archiving here
def archiveJob(appName, jobId): job_id = str(jobId).encode('utf8', 'ignore') if job_id.find('.') > 0: job_id = job_id.split('.')[0] jobs = db.getJobs(jobId=job_id) job = None if len(jobs) == 0 else jobs[0] if job == None: return returnError ("Job ID, %s, does not exist" % job_id, 404) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def web_archive_batch():\n\n try:\n auth_check()\n except Exception as e:\n return flask.redirect(str(e))\n\n batch = set()\n\n if 'archiveFile' in flask.request.files:\n file = flask.request.files['archiveFile']\n if file.filename != '':\n if file and allowed_fil...
[ "0.62682414", "0.6050477", "0.5976037", "0.5931036", "0.59232175", "0.57310224", "0.57185495", "0.56906337", "0.5687743", "0.5680585", "0.56737316", "0.5616715", "0.55977964", "0.55920976", "0.55861956", "0.5573569", "0.5540376", "0.55101144", "0.54710925", "0.54672074", "0.5...
0.7034068
0
/delete/jobs POST Deletes list of K3 jobs
def deleteJobs(): deleteList = request.form.getlist("delete_job") for jobId in deleteList: job = db.getJobs(jobId=jobId)[0] path = os.path.join(webapp.config['UPLOADED_JOBS_DEST'], job['appName'], jobId) shutil.rmtree(path, ignore_errors=True) db.deleteJob(jobId) return redirect(url_for('listJobs'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_jobs(self, job_id_list: list, notify=True) -> requests.Response:\n\n data = {\n \"jobs\": {job_id: {} for job_id in job_id_list},\n \"notify\": notify\n }\n\n response = self._api_call(method=\"POST\", endpoint=DELETE_JOBS_ENDPOINT, data=data)\n return r...
[ "0.72517926", "0.7216985", "0.7191567", "0.6989324", "0.6714646", "0.66727203", "0.6578269", "0.65221786", "0.6512429", "0.645183", "0.63243544", "0.6239923", "0.61781204", "0.6162181", "0.6134404", "0.6114399", "0.60376817", "0.6028643", "0.6023379", "0.6003606", "0.5910971"...
0.7746231
0
/compileservice/up POST Starts compile service
def compServiceUp(): global compileService if request.method == 'POST' and compileService.isDown(): settings = dict(webaddr=webapp.config['ADDR']) settings['branch'] = request.form.get('branch', 'development') gitpull = request.form.get('gitpull', True) settings['gitpull'] = gitpull if isinstance(g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compServiceDown():\n global compileService\n compileService.goDownGracefully()\n\n if request.headers['Accept'] == 'application/json':\n return jsonify(compileService.getItems()), 200\n else:\n return render_template(\"compile.html\", status=compileService.state.name, hostlist=compileService.getAllNo...
[ "0.60339296", "0.5787484", "0.5781877", "0.569347", "0.56297934", "0.560184", "0.5576611", "0.5459656", "0.5452569", "0.53992975", "0.53816533", "0.53451663", "0.5338978", "0.5282002", "0.52634275", "0.5253601", "0.5209992", "0.51840377", "0.51657754", "0.5136154", "0.5120858...
0.72183615
0
/compileservice/stop GET Stop compile service Immediately
def compServiceStop(): global compileService compileService.goDown() if request.headers['Accept'] == 'application/json': return jsonify(compileService.getItems()), 200 else: return render_template("compile.html", status=compileService.state.name, hostlist=compileService.getAllNodes())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def net_service_stop(self):\n\t\treturn Job(SDK.PrlSrv_NetServiceStop(self.handle)[0])", "def request_stop(self):\n self._messaged.emit((\"stop\",None,0,None))", "def StopControlService(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method...
[ "0.67854434", "0.6543786", "0.65099126", "0.64723563", "0.64453495", "0.64407885", "0.64386785", "0.6430939", "0.64280087", "0.6418222", "0.6372063", "0.63691664", "0.63691664", "0.63691664", "0.63691664", "0.63331056", "0.63227165", "0.6299738", "0.6299738", "0.6269771", "0....
0.8382495
0
/compileservice/down GET Shuts down compile service gracefully
def compServiceDown(): global compileService compileService.goDownGracefully() if request.headers['Accept'] == 'application/json': return jsonify(compileService.getItems()), 200 else: return render_template("compile.html", status=compileService.state.name, hostlist=compileService.getAllNodes())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compServiceStop():\n global compileService\n compileService.goDown()\n\n if request.headers['Accept'] == 'application/json':\n return jsonify(compileService.getItems()), 200\n else:\n return render_template(\"compile.html\", status=compileService.state.name, hostlist=compileService.getAllNodes())", ...
[ "0.78819036", "0.6057772", "0.5369525", "0.5359142", "0.5334728", "0.5300166", "0.51834327", "0.509531", "0.5063676", "0.49991748", "0.49903345", "0.4986896", "0.49565965", "0.4946209", "0.49380755", "0.49257234", "0.49210507", "0.488892", "0.483382", "0.4826962", "0.4803493"...
0.82170296
0
Retrieves the compiler output from local file
def getCompilerOutput(uname): fname = os.path.join(webapp.config['UPLOADED_BUILD_DEST'], uname, 'output').encode('utf8') if os.path.exists(fname): stdout_file = open(fname, 'r') output = unicode(stdout_file.read(), 'utf-8') stdout_file.close() return output else: return returnE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile(c_file: File) -> File:\n os.system(\"gcc -c {c_file}\".format(c_file=c_file.path))\n return File(c_file.path.replace('.c', '.o'))", "def extractSourceFile(command, include_path):\n\n # Accommodate ccache. With ccache, a parent process will be exec'ed using\n # a program name like \"g++\"...
[ "0.61253697", "0.6004812", "0.5961432", "0.59196764", "0.5915549", "0.5875961", "0.58237535", "0.5823168", "0.58161634", "0.5805516", "0.5803559", "0.57913345", "0.5787488", "0.5775031", "0.5764481", "0.5764481", "0.5740405", "0.56882834", "0.5686424", "0.5648886", "0.5622130...
0.72793233
0
/compilestatus Short list of active jobs & current statuses
def getCompileStatus(): logger.debug("[FLASKWEB] Retrieving current active compilation status") jobs = compileService.getActiveState() title = "Active Compiling Tasks" if jobs else "NO Active Compiling Jobs" if request.headers['Accept'] == 'application/json': return jsonify(jobs), 200 else: return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_status(self, args):\n status = self._leet.job_status\n\n for job in self.finished_jobs:\n status.append({\"id\" : job.id,\n \"hostname\" : job.machine.hostname,\n \"plugin\": job.plugin_instance.LEET_PG_NAME,\n ...
[ "0.7485856", "0.71819055", "0.6772618", "0.67635375", "0.6743584", "0.6611612", "0.661093", "0.65832114", "0.6580076", "0.6564021", "0.6507004", "0.6499971", "0.6499667", "0.6470909", "0.6448955", "0.64290154", "0.641899", "0.64137024", "0.6395831", "0.6363976", "0.6340454", ...
0.78731376
0
/compilelog Connects User to compile log websocket
def getCompileLog(): if webapp.config['COMPILE_OFF']: return returnError("Compilation Features are not available", 400) logger.debug("[FLASKWEB] Connecting user to Compile Log WebSocket") with open(webapp.config['COMPILELOG'], 'r') as logfile: output = logfile.read().split('<<<<< Compiler Service Initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userLog(self, logStr):\n if self.ioLoopInst is not None:\n cmd = {'cmd': 'userLog', 'value': logStr}\n self._sendMessageToWeb(cmd)\n else:\n print(\"UserLog: \" + logStr)", "def log(self, message):", "def startLogFiles():\n #global techLog\n global userl...
[ "0.58150077", "0.5551424", "0.5545616", "0.5480717", "0.5419397", "0.54177004", "0.53048635", "0.52875733", "0.52770406", "0.52488154", "0.5214932", "0.5155167", "0.5142982", "0.5141608", "0.5107448", "0.5084005", "0.50734335", "0.5057425", "0.50423586", "0.50382155", "0.5037...
0.7277295
0
/compile//kill GET Kills an active compiling tasks (or removes an orphaned one from DB)
def killCompile(uid): if webapp.config['COMPILE_OFF']: return returnError("Compilation Features are not available", 400) complist = db.getCompiles(uid=uid) if len(complist) == 0: complist = db.getCompiles(uid=AppID.getUID(uid)) if len(complist) == 0: return returnError("Not currently tracking the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def killJobs(self, blTaskName, rng):\n return self._genericCommand('kill', blTaskName, rng)", "def kill(self):\n self.running = False\n\n if self.pool is not None:\n self.pool.close()\n# self.pool.terminate()\n# self.pool.join()\n self.pool = None\...
[ "0.6577573", "0.58930326", "0.58642083", "0.5795121", "0.57689875", "0.57680047", "0.56957734", "0.56957734", "0.5638272", "0.55884564", "0.5561735", "0.55447894", "0.5437745", "0.53695047", "0.5341119", "0.52808255", "0.5263868", "0.5248779", "0.5234595", "0.522232", "0.5220...
0.71067876
0
/delete/compiles POST Deletes list of inactive compile jobs
def deleteCompiles(): if webapp.config['COMPILE_OFF']: return returnError("Compilation Features are not available", 400) deleteList = request.form.getlist("delete_compile") for uid in deleteList: logger.info("[FLASKWEB /delete/compiles] DELETING compile job uid=" + uid) job = db.getCompiles(uid=uid)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteJobs():\n deleteList = request.form.getlist(\"delete_job\")\n for jobId in deleteList:\n job = db.getJobs(jobId=jobId)[0]\n path = os.path.join(webapp.config['UPLOADED_JOBS_DEST'], job['appName'], jobId)\n shutil.rmtree(path, ignore_errors=True)\n db.deleteJob(jobId)\n return redirect(url_...
[ "0.6223757", "0.6060431", "0.60233647", "0.591999", "0.58957446", "0.5893301", "0.5743494", "0.57135904", "0.5646302", "0.562132", "0.55886865", "0.55761784", "0.5512032", "0.5500743", "0.54805", "0.54593086", "0.5458417", "0.54489094", "0.5417335", "0.5396576", "0.5388319", ...
0.85347015
0
Load the data from the specified json file. When merge=True the data will be added to the current data (used for merging sheets) Duplicates will be overwritten by the last load file
def load_json(self,sample_sheet_location,merge=False): with open(sample_sheet_location) as f: if merge: for k,v in json.load(f).items(): if k not in self.data: self.data[k] = v else: self.data[k]....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_from_json(self, filename):\n with open(filename, 'r') as f:\n self.data = json.load(f, object_pairs_hook=OrderedDict)", "def load(self):\n if not self.exist:\n self.create()\n\n with open(self.file_path, encoding=Config.ENCODING) as file:\n self....
[ "0.6773935", "0.6736309", "0.66317624", "0.6423052", "0.6398992", "0.6196788", "0.6137418", "0.61019915", "0.60886925", "0.6066136", "0.6013959", "0.6002845", "0.5987701", "0.5967316", "0.593252", "0.59312344", "0.5905701", "0.5893028", "0.5886807", "0.58817136", "0.5874322",...
0.7985104
0
Get the well to index mapping for the supplied layout
def layout_well2index(self, layout_name): return {k:tuple(v) for k,v in self['well2coord'][self['layout_format'][layout_name]].items()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index2well(self, layout_name: str) -> dict:\n return {v:k for k,v in self['well2index'][self['layout_format'][layout_name]].items() }", "def get_index_from_well(self, well):\n pass", "def layout_method_mapper(self):\n return {\n \"kamada_kawai_layout\": kamada_kawai_layout,\...
[ "0.7496455", "0.6372463", "0.58999753", "0.5649408", "0.5591524", "0.5395", "0.5260546", "0.5252853", "0.52322894", "0.5229908", "0.5173371", "0.5148311", "0.5147562", "0.5130854", "0.5120828", "0.5115123", "0.51135224", "0.51135224", "0.510836", "0.50952727", "0.50927615", ...
0.76162016
0
Remove all libraries with the given mark
def drop_mark(self, mark): if type(mark) is list: for m in mark: self.drop_mark(m) return to_prune = [] for sample, _mark in self['marks'].items(): if mark==_mark: to_prune.append(sample) self.drop_library(to_prune)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_packages(self, packages):", "def remove():\n run('pew rm {0}'.format(package_name()))", "def remove(self, packages):\n raise NotImplementedError()", "def test_marking_removal(self):\n container = stixmarx.new()\n package = container.package\n red_marking = generate_m...
[ "0.68892354", "0.5882527", "0.58262473", "0.5785015", "0.5709579", "0.5657923", "0.56453353", "0.5636149", "0.5626729", "0.5624144", "0.5619381", "0.55941844", "0.55660397", "0.5560287", "0.55479944", "0.5519364", "0.5512151", "0.5511013", "0.5477144", "0.54574794", "0.542009...
0.7137152
0
Merchant Benchmark This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response.
def postmerchant_benchmark_with_http_info(self, merchant_benchmarkpost_payload, **kwargs): all_params = ['merchant_benchmarkpost_payload'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def benchmark(self):\n logger.info(self.benchmark.__doc__)\n return self.run(self.benchmark_profile())", "def postmerchant_benchmark(self, merchant_benchmarkpost_payload, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.postmer...
[ "0.57964253", "0.56427693", "0.5378593", "0.5085103", "0.5032316", "0.4949648", "0.49344343", "0.47874528", "0.47683173", "0.47250286", "0.4648016", "0.4639908", "0.4631494", "0.45932716", "0.4573163", "0.44536352", "0.44227803", "0.44188625", "0.4417919", "0.44099665", "0.44...
0.6901023
0
Connects to the Harmony and sets current activity.
def set_current_activity(client, activity_label): id = activities_by_name[activity_label] func = client.start_activity(id) status = run_in_loop_now('start_activity', func) return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def __aenter__(self) -> \"SwitcherBridge\":\n await self.start()\n return self", "async def set_activity(self, msg, activity=None, *args):\n await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=activity))", "def SetActiveObject(self):", "a...
[ "0.5868898", "0.5614163", "0.5601169", "0.5549711", "0.5397546", "0.5313285", "0.5309634", "0.525346", "0.52082306", "0.52082306", "0.52082306", "0.52082306", "0.52041733", "0.5197606", "0.5148741", "0.5138663", "0.5135171", "0.51275975", "0.51231676", "0.5122233", "0.5114829...
0.57127523
1
Take a one input and return True if the passed input is either the number or string 2, False otherwise.
def is_two(x): if x == 2 or (str(x)).lower()== 'two': return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_string_or_number():\n assert is_string_or_number(None) is None\n assert is_string_or_number(1) is None\n assert is_string_or_number(1.1) is None\n assert is_string_or_number('1.1') is None\n assert is_string_or_number([])", "def CheckNumber(userInput):\n try:\n float(userInput)\n r...
[ "0.66593695", "0.66323376", "0.65800893", "0.6558143", "0.6488803", "0.63728076", "0.63511187", "0.6306291", "0.62999403", "0.62864095", "0.6235815", "0.62298054", "0.6203008", "0.619559", "0.6187751", "0.6183473", "0.61489064", "0.6144142", "0.61315644", "0.6126231", "0.6119...
0.69269484
0
return True if the passed string is a consonant, False otherwise. Use you is_vowel function to accomplish this.
def is_consonant(x): if is_vowel(x) == True: return False elif len(x) > 1 or type(x) == int: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_consonant(self, word, i):\n if word[i] in self.vowels:\n return False\n if word[i] == \"y\":\n if i == 0:\n return True\n else:\n return not self._is_consonant(word, i - 1)\n return True", "def is_consonant(text):\n re...
[ "0.76797634", "0.75874084", "0.7104711", "0.6914478", "0.68440557", "0.664726", "0.6641825", "0.65674835", "0.6514367", "0.6367673", "0.6332619", "0.6327926", "0.6313698", "0.63045555", "0.6298614", "0.61498755", "0.612227", "0.61087847", "0.61087847", "0.61087847", "0.610878...
0.81560314
0
Accept a string that is a number that contains commas in it as input, and return as number as output. 1. if want to check that input is string type, if false print "Please enter a string" return boolean False value 2. else reassign x to a copy with replace method to change commas to underscores. This will allow python ...
def handle_commas(x): if type(x) != str: print ("Please enter a string") return False else: x = float(x.replace(",","")) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comma_separated_int(s):\n\n s = s.replace(',','')\n return int(s)", "def is_number(value):\n try:\n float(value.replace(',', ''))\n except ValueError:\n return False\n return True", "def string_to_digit(string, output):\n string = strip_space(string)\n if not string[0].is...
[ "0.6456841", "0.62302864", "0.6201075", "0.60826397", "0.60624504", "0.6061707", "0.5982972", "0.5977725", "0.5946921", "0.59380096", "0.5930463", "0.588775", "0.58409303", "0.58380115", "0.5825016", "0.58159345", "0.5809624", "0.5802421", "0.58023137", "0.5790378", "0.577046...
0.7331774
0
Bot senaryolarinin uygulandigi ve kontrol edilebilecek yer. Butun islem reply metodu icerisinde gerceklesiyor.
def reply(self, message): self.logger.info("message came as {}".format(message)) message = message.lower() if message in ["start over", "get started", "hello", "hi", "say hello"]: self.params = "" self.readyseteatparams = "" # self.api.send_text_facebook( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bot_answer(update, context):\n question = update.message.text\n answer = go_bot(question)\n print(question, answer)\n print(stats)\n print()\n update.message.reply_text(answer)", "def responder(update, context):\n minuscula=update.message.text\n minuscula=(minuscula.lower())\n minu...
[ "0.65169686", "0.6455028", "0.6444912", "0.64101493", "0.6408967", "0.63412786", "0.63196516", "0.6316005", "0.63001895", "0.62888986", "0.6274115", "0.6271994", "0.62562877", "0.62512314", "0.62356675", "0.62319505", "0.62315035", "0.62236863", "0.6179687", "0.6163741", "0.6...
0.6547518
0