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
Crea un Collage en el contexto dado..
def createCollage(context, title): id = idnormalizer.normalize(title, 'es') if not hasattr(context, id): context.invokeFactory('Collage', id=id, title=title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makecollage(sede='CU', cols=10):\n path = 'cuadrados/investigadores'\n # path2 = 'cuadrados/2015/tecnicos-academicos'\n # path2 = 'cuadrados/2015/posdoc'\n path2 = 'cuadrados/2015/catedras-conacyt'\n inv = glob.glob('{p}/{s}/*.png'.format(p=path, s=sede))\n tec = glob.glob('{p}/{s}/*.png'.for...
[ "0.68766683", "0.6762814", "0.59525716", "0.5918862", "0.5910416", "0.5878155", "0.58651066", "0.58593625", "0.5859291", "0.5844282", "0.5828084", "0.57804435", "0.5780162", "0.57572216", "0.5744071", "0.57435274", "0.57226247", "0.57212955", "0.5715581", "0.57041466", "0.567...
0.72571594
0
Search for user groups.
def search_user_groups(self, fields=None, q=None): params = {} if fields: params.update({"f": fields}) page_num = 1 page_size = 1 total = 2 if q: params['q'] = q while page_num * page_size < total: resp = self.sonarqube.make...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_groups_for_user(email):\n return [g['name'] for g in groups.find({\"users\":email})]", "def groupfinder(user_id, request):\n ret = DBSession.query(User).filter_by(user_id=user_id).all()\n if len(ret) == 0:\n return None\n user = ret[0]\n groups = [x.group_name for x in user.groups...
[ "0.73511565", "0.7229867", "0.69564825", "0.6768786", "0.67485344", "0.66775644", "0.6652841", "0.6642174", "0.6529533", "0.65077156", "0.649436", "0.64233947", "0.6402569", "0.63738227", "0.63667256", "0.63541615", "0.63374853", "0.6292058", "0.62379146", "0.62174886", "0.62...
0.723609
1
Search for users with membership information with respect to a group.
def search_users_belong_to_group(self, group_name, q=None, selected="selected"): params = { 'name': group_name, 'selected': selected } page_num = 1 page_size = 1 total = 2 if q: params.update({'q': q}) while page_num * page_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate_group_users(self, group):\n return self.ldap_connection.search_s(\"ou=Groups,dc=redhat,dc=com\",\n ldap.SCOPE_SUBTREE, 'cn={0}'.format(group))", "def get_membersof(self, kwargs):\n group = kwargs[\"group\"]\n verbose = kwargs.get(\"verbose\", False)\n\n results =...
[ "0.6998211", "0.69325197", "0.676143", "0.6479416", "0.64737964", "0.63965416", "0.6368332", "0.6332062", "0.63161606", "0.6253809", "0.6218875", "0.62114996", "0.61789787", "0.61596376", "0.6113587", "0.60647094", "0.60633683", "0.6047017", "0.6041411", "0.60082984", "0.6000...
0.706252
0
recursively load data from HDF5 archive as dict
def recursively_load_dict_contents_from_group(h5file: "h5py.File", path: str, ) -> dict: ans = {} for key, item in h5file[path].items(): if isinstance(item, h5py._hl.dataset.Dataset): ans[key] = item.value elif isinstance(item, h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_h5(fname: str, path: str='/') -> dict:\n try:\n with h5py.File(fname, 'r') as f:\n dataMap = recursively_load_dict_contents_from_group(f, path)\n except IOError as e:\n print(f\"Cannot open HDF5 file {fname}\")\n print(f\"IOError: {e}\")\n\n return dataMap", "def...
[ "0.6968012", "0.666257", "0.6494301", "0.64876926", "0.6245786", "0.61874425", "0.61830896", "0.61472404", "0.6113016", "0.60473657", "0.6032101", "0.60290885", "0.6004782", "0.5997622", "0.5910339", "0.58835894", "0.5868962", "0.58644664", "0.5778627", "0.576113", "0.5747034...
0.70195514
0
Set databases to the config.
def set_databases(cls, databases: Mapping[str, Mapping[str, str]]): cls.databases = {} for key, value in databases.items(): cls.databases[key] = DB(**value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def databases(self, databases):\n\n self._databases = databases", "def test_set_databases(self):\n Config.set_databases({\n 'default': {\n 'url': 'bolt://cypher-db:7687',\n 'username': 'neo4j',\n 'password': 'cypher',\n },\n ...
[ "0.7879601", "0.70607233", "0.70342577", "0.6877906", "0.6759398", "0.6695818", "0.66057783", "0.6509318", "0.6495244", "0.6427336", "0.6385031", "0.6367895", "0.6309594", "0.6296188", "0.62837166", "0.6261249", "0.62535596", "0.6239328", "0.6228934", "0.6201462", "0.6148669"...
0.7551629
1
count() ... GROUP is generally an aggregation query which we can ignore.
def test_ok_count_with_group(self): with self.patch_schema({}): sql = ( "SELECT count(*), userid " "FROM a GROUP BY userid ORDER BY id DESC") stmt = sqlparse.parse(sql)[0] assert False == self.has_order_by_count(stmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, query):", "def count(self):\n return self.query.count(with_limit_and_skip = True)", "def count():", "def count(self):\n return self._reduce_for_stat_function(F.count, only_numeric=False)", "def test_properties_count_group_by_group_by_and_sub_group_by_get(self):\n pass", "...
[ "0.7219811", "0.6666899", "0.6532083", "0.6493765", "0.63883334", "0.6325934", "0.6316171", "0.62548774", "0.61773735", "0.6151579", "0.61428106", "0.61418647", "0.61418647", "0.61418647", "0.61418647", "0.6135089", "0.6108271", "0.60754555", "0.604903", "0.60456365", "0.6033...
0.7070207
1
Generates set of indices corresponding to image timestamps for a traverse, where each timestamp corresponds to a camera pose that has regular spatial separation (threshold) from the previous entry.
def build_reference_keyframes(gt, threshold, attitude_weight): indices = [0] # first image in set of keyframes gt_curr = gt[0] for i in range(1, len(gt)): curr_diff = geometry.metric(gt_curr, gt[i], attitude_weight) if curr_diff > threshold: indices.append(i) gt_curr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamps():\n timestamps = ( # Index\n 1459516622.1, # 0\n 1459516622.2, # 1\n 1459516622.3, # 2\n 1459516623.0, # 3\n 1459516623.1, # 4\n 1459516623.3, # 5\n 1459516624.0, # 6\n )\n return timestamps", "def time_position(self):\n ...
[ "0.57435304", "0.56279707", "0.562145", "0.56119984", "0.5600088", "0.5466392", "0.54334027", "0.5393353", "0.5371978", "0.53091574", "0.52983636", "0.5274018", "0.523682", "0.5208011", "0.51840514", "0.5181177", "0.51792926", "0.51567894", "0.5152368", "0.514156", "0.5134001...
0.59570783
0
Gets the storage directory name from comments in the deck.
def getstoragename(deck): try: ff = open(deck,'r') except IOError: print "I don't know what you want. The file ",deck," doesn't exist and no" print "storage directory was specified." sys.exit(1) lines = ff.readlines() for l in lines: if l[:2] == storageflag: return string.strip(l[2:]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directory() -> str:\n return directory", "def get(self):\n return self.directory_name", "def media_folder_name(self):\n raise NotImplementedError", "def get_tilename_cache_dir():\n d=get_des_lensdir()\n return os.path.join(d, 'tilename_cache')", "def get_dsc(self):\n f...
[ "0.5949419", "0.58365834", "0.5787146", "0.5785506", "0.5699878", "0.5696329", "0.5674502", "0.5654507", "0.56495345", "0.5645469", "0.5593494", "0.55923265", "0.5551341", "0.5537683", "0.55354965", "0.5528091", "0.5507223", "0.5485414", "0.54704297", "0.54646844", "0.5464299...
0.70575356
0
Starts tcp forwarding from localhost to this android device.
def tcp_forward(self, host_port, device_port): if self._ssh_connection: # We have to hop through a remote host first. # 1) Find some free port on the remote host's localhost # 2) Setup forwarding between that remote port and the requested # device port ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self):\n self._server = socketserver.ThreadingTCPServer(\n server_address=('localhost', self._requested_local_port),\n RequestHandlerClass=self._create_handler(self._ssh_client, self._remote_host, self._remote_port),\n )\n\n threading.Thread(target=self.serve_for...
[ "0.71498317", "0.6632652", "0.6628745", "0.6466217", "0.6421084", "0.63712656", "0.6320088", "0.6276809", "0.62414116", "0.6239876", "0.61310124", "0.61066025", "0.6099552", "0.60854053", "0.6035161", "0.6026497", "0.59290177", "0.59099054", "0.58952796", "0.5886397", "0.5886...
0.72012234
0
Stop tcp forwarding a port from localhost to this android device.
def remove_tcp_forward(self, host_port): if self._ssh_connection: remote_port = self._ssh_connection.close_ssh_tunnel(host_port) if remote_port is None: logging.warning("Cannot close unknown forwarded tcp port: %d", host_port) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.udpSock.close()", "def adb_down(self, port):\n self.adb_transport = None\n self.check_adb([\"disconnect\", \"localhost:%d\" % port])\n\n # Wait until QEMU's forward has expired\n CONNECT_MAX_TRIES = 15\n connect_tries = 0\n while True:\n ...
[ "0.66260034", "0.6621228", "0.65551174", "0.65017307", "0.6328532", "0.6211881", "0.6129459", "0.6115368", "0.61125827", "0.60275656", "0.6024689", "0.5978611", "0.59650147", "0.5953296", "0.5901809", "0.58361506", "0.58220327", "0.58176476", "0.5798593", "0.57862943", "0.578...
0.7402272
0
Main for the program for getting image stats.
def main(): base_dir = '/home/sjimenez/imagenes_prueba' out_dir = '/home/sjimenez/easy_analysis' for _, _, files in os.walk(base_dir, topdown=False): for f in files: print('--------- {} ---------'.format(f)) act_dir = osp.join(base_dir, f) act_im = cv2.imread(act_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n try:\n pixid = sys.argv[1]\n except IndexError:\n print('Usage: python pixget.py [pixid] (save_path)')\n exit(1)\n\n # get the path\n if len(sys.argv) > 2:\n path = sys.argv[2]\n else:\n path = '.'\n\n imgInfoPool = []\n if get_image_url(pixid, ...
[ "0.750287", "0.74273145", "0.73017645", "0.7189856", "0.70992726", "0.68658555", "0.6838508", "0.6746876", "0.6710353", "0.66980433", "0.6696638", "0.6696638", "0.66524255", "0.6652286", "0.65606487", "0.6530245", "0.64840573", "0.64628685", "0.64628184", "0.6461972", "0.6441...
0.75601584
0
Get listing of all possible platform combinations matching current platform.
def get_platform_combinations(): mapped_osname = platform_map(g_osname) mapped_osarch = g_osarch ret = [mapped_osname] while True: ret += [mapped_osarch, mapped_osname + "-" + mapped_osarch] mapped_osarch = platform_map_iterate(mapped_osarch) if not mapped_osarch: break return sorted(ret, re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')", "def Platforms():\n return platforms", "def get_matched_platforms(self, platform):\n raise NotImplemented", "def list_platforms(self):\n re...
[ "0.75622964", "0.7488366", "0.73613954", "0.73313236", "0.70974034", "0.7095553", "0.68632317", "0.6859219", "0.6778722", "0.66186064", "0.6585389", "0.6424543", "0.6370951", "0.6341034", "0.6313573", "0.6301878", "0.6198991", "0.6172565", "0.6147571", "0.6089287", "0.6066857...
0.7619742
0
Tell if this platform value can be deconstructed.
def deconstructable(self): return isinstance(self.get(), int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_deconstructable(op):\n return isinstance(op, int) or (isinstance(op, PlatformVar) and op.deconstructable())", "def can_decode(self) -> bool:\n return self.has_keys()", "def hasVeryTrustedValue(self):", "def isCandela(self):\n return _libsbml.Unit_isCandela(self)", "def __bool__(self):...
[ "0.6636962", "0.6150115", "0.5750548", "0.562366", "0.55477697", "0.5522641", "0.5522641", "0.5522641", "0.5522641", "0.5522641", "0.5453119", "0.544889", "0.5223347", "0.5119111", "0.5110522", "0.51015323", "0.51014316", "0.5094647", "0.50879866", "0.50681114", "0.5033695", ...
0.62563837
1
Follow platform mapping chain as long as possible.
def platform_map(op): while True: found = platform_map_iterate(op) if not found: break op = found return op
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_mapping(self):\n pass", "def applyMapping(self):\n pass", "def platform_map_iterate(op):\n if op in g_platform_mapping:\n return g_platform_mapping[op]\n return None", "def before_map(self, map):\n map.connect('follow', '/api/2/follower',\n controller='ckanext.fol...
[ "0.58424115", "0.55173486", "0.54472727", "0.5261522", "0.5135511", "0.5132303", "0.51280195", "0.5088369", "0.5086267", "0.50705117", "0.5044355", "0.50413567", "0.5017268", "0.5014331", "0.49990448", "0.4991775", "0.49514335", "0.4947635", "0.49116352", "0.49049938", "0.489...
0.59635746
0
Destroy platform variable, replace with default.
def replace_platform_variable(name, op): if not name in g_platform_variables: raise RuntimeError("trying to destroy nonexistent platform variable '%s'" % (name)) g_platform_variables[name] = { "default" : op }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset(self, shell=None):\n\n try:\n del os.environ[self.name]\n except KeyError:\n pass \n\n if shell:\n print shell.unset_var(self.name)", "def deconfigure(self):\n\n self.platform.deconfigure()", "def reset(self, default=False):\n self.l...
[ "0.61455315", "0.5747292", "0.56950545", "0.56671906", "0.5634839", "0.5632845", "0.5619126", "0.5588645", "0.55831945", "0.5550126", "0.55369806", "0.5505869", "0.54561", "0.5446558", "0.5446433", "0.5441631", "0.54308134", "0.5430195", "0.54289174", "0.5427833", "0.54274786...
0.7975766
0
Get a blockformatted comment.
def format_block_comment(self, desc, length = 40): block_text = "" for ii in range(length): block_text += self.__comment block_text += "\n" ret = self.__comment if desc: ret += " " + desc + " " for ii in range(len(ret), length): ret += self.__comment return block_text + ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment(self) :\n\t\ttry :\n\t\t\treturn self._comment\n\t\texcept Exception as e:\n\t\t\traise e", "def get_comment(self, object_id):\n return self.get_object(\"comment\", object_id)", "def getCellComment(self, row, column):\n\n\t\t\t\tcell = self.getCell(row = row, column = column)\n\n\t\t\t\tretu...
[ "0.6385449", "0.6347358", "0.6281026", "0.6257816", "0.6255133", "0.6241518", "0.61567247", "0.61310744", "0.61288774", "0.61244726", "0.6034886", "0.6027813", "0.5979644", "0.59452105", "0.5886656", "0.5876463", "0.5869759", "0.58672285", "0.5858296", "0.5849893", "0.5842634...
0.6528774
0
Remove local labels that would seem to generate .bss, make a fake .bss section.
def generate_fake_bss(self, assembler, und_symbols = None, elfling = None): bss = AssemblerSectionBss() for ii in self.__sections: while True: entry = ii.extract_bss(und_symbols) if not entry: break if not entry.is_und_symbol(): bss.add_element(entry) if elf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_static_global_kernels(in_txt):\n in_txt = in_txt.replace(\" __global__ static\", \"__global__\")\n return in_txt", "def test_func_bss(self):\n cmd = \"deref $_bss()\"\n target = _target(\"bss\")\n self.assertFailIfInactiveSession(gdb_run_cmd(cmd, target=target))\n res = ...
[ "0.5737749", "0.53284585", "0.51598144", "0.50648993", "0.5011596", "0.46993774", "0.46559176", "0.46456394", "0.4562272", "0.45596406", "0.4553202", "0.45073906", "0.4504242", "0.44720018", "0.4470846", "0.44300961", "0.44195837", "0.44128838", "0.44101706", "0.44010052", "0...
0.6500512
0
Remove .rodata sections by merging them into the previous .text section.
def remove_rodata(self): text_section = None rodata_sections = [] ii = 0 while len(self.__sections) > ii: section = self.__sections[ii] if "text" == section.get_name(): text_section = section ii += 1 elif "rodata" == section.get_name(): if text_section: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_patches(self):\n content = []\n stretch = []\n for line in self.spec_content.section(\"%package\"):\n stretch.append(line)\n # Empty lines save the current stretch into content.\n if not line.strip():\n content += stretch\n ...
[ "0.5307896", "0.5291774", "0.5242135", "0.509778", "0.49013606", "0.48975566", "0.48528245", "0.4801628", "0.47888386", "0.47497547", "0.47475252", "0.47274816", "0.47202754", "0.46973", "0.4686235", "0.46843448", "0.46672067", "0.46656722", "0.46520713", "0.46265426", "0.459...
0.89822567
0
Replace constant with a replacement constant.
def replace_constant(self, src, dst): replace_count = 0 for ii in self.__sections: for jj in range(len(ii.content)): line = ii.content[jj] replaced = re.sub(r'(\$%s|\$%s)' % (src, hex(src)), r'$%s' % hex(dst), line) if line != replaced: ii.content[jj] = replaced ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute_constants(instruction, reg, constants_dict, define_all_constants=None):\n\n if define_all_constants == True:\n for entry in constants_dict:\n if disassembly.is_simple_name(constants_dict[entry]):\n constant(entry, constants_dict[entry])\n\n trace.substitute_con...
[ "0.632241", "0.63150865", "0.6306026", "0.6263133", "0.62514615", "0.6136195", "0.60648966", "0.60485715", "0.5976514", "0.59708226", "0.5933422", "0.58662874", "0.5841566", "0.583296", "0.5813409", "0.5798703", "0.5784918", "0.5779181", "0.5720387", "0.56878173", "0.56807095...
0.7767716
0
Write an output assembler file or append to an existing file.
def write(self, op, assembler): if isinstance(op, str): fd = open(op, "w") for ii in self.__sections: ii.write(fd) fd.close() if is_verbose(): print("Wrote assembler source file '%s'." % (op)) else: prefix = assembler.format_block_comment("Program") op.write(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_output_file(output: str, file_name: str):\n\tfile1 = open(file_name, 'w')\n\tfile1.write(output)\n\tfile1.close()", "def write_file(self):\n if self._write_file == None:\n return\n\n try:\n out = file(self._write_file, \"w\")\n except IOError, e:\n print e\n sys.exit(1)\n ...
[ "0.67702633", "0.6320942", "0.62518203", "0.611711", "0.6100334", "0.6090968", "0.6087451", "0.60622877", "0.60208917", "0.6002181", "0.5989003", "0.5966249", "0.5951496", "0.5943417", "0.58985364", "0.5889977", "0.58394814", "0.5837273", "0.58266217", "0.58245087", "0.582450...
0.6394714
1
Tell if this is an und symbol.
def is_und_symbol(self): return self.__und
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_symbol(p):\n return len(p) == 1 and p.isalpha()", "def is_unary(s):\n return s == '~'", "def strand_string(self):\n if self.is_forward():\n return '+'\n if self.is_reverse():\n return '-'\n return '.'", "def finalfrase(self, word):\n if word == '...
[ "0.56649464", "0.5608007", "0.5411157", "0.5397627", "0.52020967", "0.51948726", "0.51939255", "0.5176625", "0.5155214", "0.5150667", "0.5126848", "0.5054113", "0.5037562", "0.5035006", "0.5011951", "0.5006919", "0.49929306", "0.49915165", "0.49907055", "0.49584755", "0.49568...
0.7050442
0
Crunch popping before a jump.
def crunch_jump_pop(self, op): lst = self.want_line(r'\s*(jmp\s+%s)\s+.*' % (op)) if not lst: return ii = lst[0] jj = ii - 1 while True: if (0 > jj) or not re.match(r'\s*(pop\S).*', self.__content[jj], re.IGNORECASE): if is_verbose(): print("Erasing function footer befo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_jump(self):\n pass", "def pop():", "def crunch_entry_push(self, op):\n lst = self.want_label(op)\n if not lst:\n return\n ii = lst[0] + 1\n jj = ii\n stack_decrement = 0\n stack_save_decrement = 0\n reinstated_lines = []\n while True:\n current_line = self.__con...
[ "0.6293416", "0.6207409", "0.6092484", "0.60277784", "0.5811048", "0.580279", "0.57263976", "0.56509596", "0.5595956", "0.5595956", "0.557992", "0.55758035", "0.55721635", "0.55011654", "0.54987", "0.5436042", "0.54255927", "0.53707856", "0.53656447", "0.5344626", "0.53375363...
0.7855193
0
Extract a variable that should go to .bss section.
def extract_bss(self, und_symbols): # Test for relevant .globl element. found = self.extract_globl_object() if found: return AssemblerBssElement(found[0], found[1], und_symbols) found = self.extract_comm_object() if found: return AssemblerBssElement(found[0], found[1], und_symbols) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Var(key):\n return vars[key]", "def test_func_bss(self):\n cmd = \"deref $_bss()\"\n target = _target(\"bss\")\n self.assertFailIfInactiveSession(gdb_run_cmd(cmd, target=target))\n res = gdb_run_silent_cmd(cmd, target=target)\n self.assertNoException(res)\n self.a...
[ "0.5295398", "0.52878106", "0.48472604", "0.48412383", "0.48319158", "0.47887856", "0.47686186", "0.47586128", "0.47234666", "0.47140992", "0.46984103", "0.4696589", "0.46529248", "0.46182206", "0.46167955", "0.45962864", "0.45668268", "0.45593712", "0.45564422", "0.45431522", ...
0.57502925
0
Merge content with another section.
def merge_content(self, other): self.__content += other.__content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ec_merge(editorial_content, guide_content):\n guide_content['Cities'][0]['articles'] = editorial_content\n return guide_content", "def add_section(self, text: str) -> None:\n\n tag = r'''\\newpage\n \\section{%s}''' % (text)\n self.doc = self.doc + tag", "def _merge_summary_nodes...
[ "0.61161214", "0.58437955", "0.58373505", "0.5800004", "0.56656945", "0.5617657", "0.55564404", "0.54861325", "0.54853994", "0.5460029", "0.5446042", "0.54442024", "0.54410267", "0.5432354", "0.540712", "0.53758997", "0.53661466", "0.5361685", "0.5332325", "0.53060067", "0.52...
0.7070165
0
Remove all .align declarations, replace with desired alignment.
def minimal_align(self): desired = int(PlatformVar("align")) for ii in range(len(self.__content)): line = self.__content[ii] match = re.match(r'.*\.align\s+(\d+).*', line) if match: align = int(match.group(1)) # Due to GNU AS compatibility modes, .align may mean different thing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unaligned(self):\n new_alignment = Alignment()\n new_alignment.datatype = self.datatype\n for name, seq in self.items():\n new_seq = re.sub(_INDEL, '', str(seq))\n if new_seq != '':\n new_alignment[name] = new_seq\n return new_alignment", "def ...
[ "0.6770961", "0.6550604", "0.64577866", "0.62941873", "0.62106323", "0.6176111", "0.6172448", "0.6099402", "0.6016633", "0.5850998", "0.5850998", "0.5850998", "0.5692461", "0.5665289", "0.56117445", "0.56041044", "0.5600843", "0.5564419", "0.5538837", "0.5508957", "0.5502088"...
0.73775905
0
Replaces an entry point with given entry point name from this section, should it exist.
def replace_entry_point(self, op): lst = self.want_entry_point() if lst: self.__content[lst[0]] = "%s:\n" % op
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_endpoint(EndpointName=None, EndpointConfigName=None):\n pass", "def test_alias_entrypoint(self):\n with open(\".scuba.yml\", \"w\") as f:\n f.write(\n r\"\"\"\n image: na\n entrypoint: na_ep\n aliases:\n ...
[ "0.5490665", "0.5391417", "0.5349115", "0.5325284", "0.5289055", "0.52198935", "0.51733834", "0.5058328", "0.5053804", "0.505299", "0.5000067", "0.49599344", "0.4952115", "0.49332264", "0.49239028", "0.49123064", "0.48969954", "0.48368892", "0.48228133", "0.47860837", "0.4773...
0.6391498
0
Add symtab dynamic structure.
def add_dt_symtab(self, op): d_tag = AssemblerVariable(("d_tag, DT_SYMTAB = 6", PlatformVar("addr"), 6)) d_un = AssemblerVariable(("d_un", PlatformVar("addr"), op)) self.__data[0:0] = [d_tag, d_un] self.refresh_name_label()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_symbol_und(self, name):\n label_name = \"symtab_\" + name\n if osarch_is_32_bit():\n self.add_data((\"st_name\", 4, \"strtab_%s - strtab\" % (name)))\n self.add_data((\"st_value\", PlatformVar(\"addr\"), label_name, label_name))\n self.add_data((\"st_size\", PlatformVar(\"addr\"), Plat...
[ "0.6362586", "0.5779284", "0.5738966", "0.57271403", "0.55730987", "0.553745", "0.5474667", "0.54461443", "0.5424141", "0.5399855", "0.53758395", "0.5360219", "0.5336745", "0.53325546", "0.5331167", "0.52706957", "0.5239173", "0.518532", "0.5132292", "0.507238", "0.49839732",...
0.7083616
0
Add an empty symbol.
def add_symbol_empty(self): if osarch_is_32_bit(): self.add_data(("empty symbol", 4, (0, 0, 0, 0))) elif osarch_is_64_bit(): self.add_data(("empty symbol", 4, (0, 0))) self.add_data(("empty symbol", PlatformVar("addr"), (0, 0))) else: raise_unknown_address_size()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBlank(self, blankSymbol):\n self.blank = blankSymbol", "def set_empty_character(self, char):\n self.empty_char = char", "def _set_symbol(self, symbol, blank=False):\n self._symbols.add(symbol)\n\n try:\n assert self._blank_symbol == None or not blank\n i...
[ "0.68177724", "0.6747707", "0.6448765", "0.6284775", "0.62435395", "0.6232342", "0.595727", "0.59489596", "0.5939656", "0.59079325", "0.5849234", "0.578567", "0.5772135", "0.5769468", "0.5743586", "0.5723917", "0.56906825", "0.5664978", "0.5653811", "0.55847985", "0.5581753",...
0.8174951
0
Reconstruct data from bytestream.
def reconstruct(self, bytestream): self.__data = [] while 0 < len(bytestream): front = bytestream[0] bytestream = bytestream[1:] constructed = front.reconstruct(bytestream) if constructed: bytestream[:constructed] = [] self.__data += [front]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, data: bytes) -> bytes:\n ...", "def decode(data): #@NoSelf", "def FromBytes (cls, data):\n return cls (json.loads (zlib.decompress (data).decode ('utf-8')))", "def decode(self, raw_bytes, type_name):\n parse_tree = Serialization._parse_type(type_name)\n all_bytes ...
[ "0.63985074", "0.63860655", "0.6151244", "0.6138352", "0.61003554", "0.60790676", "0.60580057", "0.60467976", "0.6013262", "0.59836733", "0.5978583", "0.5973151", "0.5963986", "0.59135264", "0.5908491", "0.58985347", "0.5885291", "0.5865356", "0.5860283", "0.58582044", "0.585...
0.7810938
0
Add a name end label to last assembler variable.
def refresh_name_end_label(self): end_label = "%s_end" % (self.__name) for ii in self.__data: ii.remove_label_post(end_label) if 0 < len(self.__data): self.__data[-1].add_label_post(end_label)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_name(self, name):\n self._last_name = name", "def name_ends_with(self, name_ends_with):\n\n self._name_ends_with = name_ends_with", "def name_ends_with(self, name_ends_with):\n\n self._name_ends_with = name_ends_with", "def name_ends_with(self, name_ends_with):\n\n self._...
[ "0.5978127", "0.568512", "0.568512", "0.568512", "0.5587111", "0.5573424", "0.55302197", "0.55282223", "0.5480452", "0.5479978", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.54442114", "0.5408...
0.7061554
0
Get cumulative size of data.
def size(self): ret = 0 for ii in self.__data: ret += int(ii.get_size()) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.cumulative_length)", "def totalsize(self):\n return sum([sz for sz in self.iterate()])", "def get_size(self):\n cum_size = 0\n for stream in self.__streams.values():\n cum_size += sys.getsizeof(stream)\n for trace in stream:...
[ "0.7311951", "0.69841903", "0.69333625", "0.6806765", "0.67907125", "0.66829747", "0.66719043", "0.667019", "0.6664927", "0.6657343", "0.6629253", "0.66140056", "0.66115147", "0.6600715", "0.65852046", "0.6567605", "0.65446043", "0.653561", "0.651902", "0.651902", "0.651902",...
0.71465605
1
Check if command basename starts with given string.
def command_basename_startswith(self, op): return self.__command_basename.startswith(op)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startswith( self, prefix ):\n return len(self.commands) >= 1 and self.commands[0].startswith( prefix )", "def is_command(text):\n return text.startswith('/')", "def is_command(text):\n return text.startswith('/')", "def _check_output_prefix(arg: str) -> str:\n\n if \"/\" in arg:\n ...
[ "0.72253144", "0.67998976", "0.67998976", "0.66535866", "0.66329914", "0.65502524", "0.6536906", "0.646653", "0.64104015", "0.6329211", "0.62930506", "0.6272246", "0.6153429", "0.6124046", "0.61107683", "0.60880065", "0.60841614", "0.6043186", "0.60085547", "0.6006006", "0.59...
0.8494661
0
Generate linker command for given mode.
def generate_linker_flags(self): self.__linker_flags = [] if self.__command_basename.startswith("g++") or self.__command_basename.startswith("gcc"): self.__linker_flags += ["-nostartfiles", "-nostdlib", "-Xlinker", "--strip-all"] elif self.__command_basename.startswith("clang"): self.__linker_fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_linker_script(self, op):\n self.__linker_script = [\"-T\", op]", "def generate_loader(mode, symbols, definition, linker):\n if \"vanilla\" == mode:\n loader_content = generate_loader_vanilla()\n elif \"dlfcn\" == mode:\n loader_content = generate_loader_dlfcn(symbols, linker)\n else:\n loa...
[ "0.6596885", "0.641772", "0.6041522", "0.5697773", "0.5491994", "0.5429609", "0.5415643", "0.53792256", "0.5294863", "0.52706903", "0.5239786", "0.5228239", "0.5155496", "0.5110935", "0.50953645", "0.50810415", "0.4991087", "0.49551827", "0.49383572", "0.49110815", "0.4889896...
0.6435194
1
Generate link library list libraries.
def get_library_list(self): ret = [] prefix = "-l" if self.__command_basename.startswith("cl."): prefix = "/l" for ii in self.__libraries: ret += [prefix + ii] return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linking_library_dirs(self):", "def get_library_directory_list(self):\n ret = []\n prefix = \"-L\"\n if self.__command_basename.startswith(\"cl.\"):\n prefix = \"/L\"\n for ii in self.__library_directories:\n ret += [prefix + ii]\n if self.__command_basename.startswith(\"ld\"):\n ...
[ "0.7569129", "0.6613841", "0.652074", "0.6330234", "0.6287818", "0.6248012", "0.6148403", "0.6086897", "0.60510623", "0.6032309", "0.6001659", "0.5927498", "0.59087676", "0.5862256", "0.58266467", "0.5821591", "0.5795463", "0.5793022", "0.576368", "0.5722084", "0.57106745", ...
0.6631275
1
Get linker script from linker, improve it, write improved linker script to given file.
def generate_linker_script(self, dst, modify_start = False): (so, se) = run_command([self.__command, "--verbose"]) if 0 < len(se) and is_verbose(): print(se) match = re.match(r'.*linker script\S+\s*\n=+\s+(.*)\s+=+\s*\n.*', so, re.DOTALL) if not match: raise RuntimeError("could not extract s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_ld(binary, ld):\n if not os.access(ld, os.R_OK): \n log.failure(\"Invalid path {} to ld\".format(ld))\n return None\n \n \n if not isinstance(binary, ELF):\n if not os.access(binary, os.R_OK): \n log.failure(\"Invalid path {} to binary\".format(binary))\n ...
[ "0.58221275", "0.58221275", "0.5780126", "0.5402884", "0.5382903", "0.532417", "0.5264359", "0.5202828", "0.5195315", "0.48675692", "0.48544353", "0.48260802", "0.4807534", "0.48005167", "0.4782699", "0.4781398", "0.47573248", "0.47526115", "0.47063655", "0.469484", "0.465566...
0.71953833
0
Link a binary file with no bells and whistles.
def link_binary(self, src, dst): cmd = [self.__command, "--entry=" + str(PlatformVar("entry")), src, "-o", dst] + self.__linker_script (so, se) = run_command(cmd) if 0 < len(se) and is_verbose(): print(se) return so
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link(filename, existing_filename):\n CreateHardLinkW(filename, existing_filename, 0)", "def link_to_blob(self, path, csum):\n new_link = self.csum_to_path(csum)\n ensure_symlink(path, new_link)\n ensure_readonly(path)", "def _link_files(self, source, target):\n try:\n ...
[ "0.6388845", "0.6279944", "0.6199561", "0.6079843", "0.5971818", "0.5970337", "0.5765477", "0.5753267", "0.56908983", "0.5644778", "0.55818886", "0.55730486", "0.55449045", "0.5540602", "0.5527364", "0.5524032", "0.55118054", "0.55118054", "0.547036", "0.5463756", "0.5454393"...
0.6309473
1
Set libraries to link.
def set_libraries(self, lst): self.__libraries = lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linking_library_dirs(self):", "def _add_linking_libs(context, call):\n libs = getattr(call, \"libs\", ())\n if libs:\n context.add_linking_libs(libs)", "def add_installed_libraries(self, extra_libs = [\"SeleniumLibrary\",\n \"SudsLibrary\",\n ...
[ "0.7263", "0.6887429", "0.6095097", "0.59811467", "0.58669716", "0.5815462", "0.57655257", "0.57473934", "0.5678372", "0.56160223", "0.55990434", "0.5553304", "0.5519811", "0.549882", "0.5497282", "0.54855764", "0.54820925", "0.5480623", "0.547104", "0.545463", "0.5445427", ...
0.7587804
0
Use given linker script.
def set_linker_script(self, op): self.__linker_script = ["-T", op]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_linker_script(self, dst, modify_start = False):\n (so, se) = run_command([self.__command, \"--verbose\"])\n if 0 < len(se) and is_verbose():\n print(se)\n match = re.match(r'.*linker script\\S+\\s*\\n=+\\s+(.*)\\s+=+\\s*\\n.*', so, re.DOTALL)\n if not match:\n raise RuntimeError(...
[ "0.67338634", "0.5954857", "0.58903164", "0.5788863", "0.5541502", "0.5451127", "0.53574705", "0.53309166", "0.5252321", "0.5244923", "0.52308166", "0.5163479", "0.5154995", "0.51549536", "0.51517344", "0.5138007", "0.5119575", "0.51075006", "0.5105201", "0.5060925", "0.50596...
0.70828986
0
Add extra compiler flags.
def add_extra_compiler_flags(self, op): if is_listing(op): for ii in op: self.add_extra_compiler_flags(ii) elif not op in self.__include_directories and not op in self.__definitions: self.__compiler_flags_extra += [op]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_c_flags_hook(build_ext, ext):\n std_flag = get_c_std_flag(build_ext.compiler)\n if std_flag is not None:\n ext.extra_compile_args.append(std_flag)", "def build_extensions(self):\n c = self.compiler.compiler_type\n CF = [] ; LF=[]\n if \"CFLAGS\" in os.environ:\n ...
[ "0.74836534", "0.7367965", "0.7152665", "0.701099", "0.66113645", "0.65715456", "0.65700024", "0.65445083", "0.6536574", "0.6443013", "0.6413473", "0.6391317", "0.6361099", "0.6342047", "0.6252646", "0.6245584", "0.6136694", "0.61227715", "0.60874695", "0.60590255", "0.602490...
0.8035848
0
Compile and link a file directly.
def compile_and_link(self, src, dst): cmd = [self.get_command(), src, "-o", dst] + self.__compiler_flags + self.__compiler_flags_extra + self.__definitions + self.__include_directories + self.get_linker_flags() + self.get_library_directory_list() + self.get_library_list() (so, se) = run_command(cmd) if 0 < ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(prog_path: str, o_files: List[File]) -> File:\n print(\"linking\")\n os.system(\"gcc -o {prog_path} {o_files}\".format(\n prog_path=prog_path,\n o_files=' '.join(o_file.path for o_file in o_files),\n ))\n return File(prog_path)", "def compile(c_file: File) -> File:\n os.syst...
[ "0.70934415", "0.6419986", "0.6269629", "0.61277467", "0.5965609", "0.5766093", "0.5763048", "0.5762871", "0.5743079", "0.5739731", "0.56908655", "0.5612455", "0.55822873", "0.55192566", "0.5504286", "0.54711485", "0.5417758", "0.53987396", "0.5373693", "0.53700215", "0.53592...
0.6516065
1
Set include directory listing.
def set_include_dirs(self, lst): prefix = "-I" if self.command_basename_startswith("cl."): prefix = "/I" self.__include_directories = [] for ii in lst: if os.path.isdir(ii): new_include_directory = prefix + ii if new_include_directory in self.__compiler_flags_extra: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_dirs(self):", "def write_include_dir(self):\n\n incl_dir = self.tree.find(\n '//ns:ItemGroup/ns:ClCompile/ns:AdditionalIncludeDirectories',\n namespaces=self.ns\n )\n if incl_dir is None:\n incl_dir = self.tree.find(\n '//ns:ItemDef...
[ "0.7374883", "0.6594392", "0.63506", "0.6101728", "0.5895461", "0.56560236", "0.56539863", "0.56503475", "0.56135154", "0.55790496", "0.55583525", "0.5542389", "0.5540897", "0.55123377", "0.5502402", "0.5465527", "0.54548585", "0.5419882", "0.53815234", "0.5373388", "0.536843...
0.750736
0
Generate direct C code for data block.
def generate_c_data_block(self): ret = "static const uint8_t elfling_weights[] =\n{\n " for ii in range(len(self.__weights)): if 0 < ii: ret += ", " ret += "%i" % (self.__weights[ii]) ret += "\n};\n\nstatic const uint8_t elfling_contexts[] =\n{\n " for ii in range(len(self.__contex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdataBlock(self, data):\n pass", "def code_gen(self):\r\n\r\n if getattr(self, 'struct_code', False):\r\n return self.struct_code\r\n\r\n no_recycling = self.no_recycling\r\n\r\n self.consts = []\r\n\r\n c_support_code_apply = []\r\n c_init_code_apply = []...
[ "0.7005573", "0.62024033", "0.61392844", "0.61230695", "0.61161315", "0.6091142", "0.5992241", "0.58730257", "0.58634484", "0.58192754", "0.5806854", "0.57999635", "0.5767225", "0.5735275", "0.5726752", "0.5590004", "0.5576271", "0.5551059", "0.5547111", "0.55024576", "0.5494...
0.726828
0
Generate the C uncompressor source.
def generate_c_source(self): return template_elfling_source % (self.generate_c_data_block(), ELFLING_WORK, ELFLING_OUTPUT, ELFLING_UNCOMPRESSED, len(self.__contexts), ELFLING_WORK, self.get_input_offset(), ELFLING_OUTPUT, self.get_uncompressed_size(), ELFLING_UNCOMPRESSED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_csource(protocol):\n\tdef format_default(reg):\n\t\t\"\"\"Given a reg, return its default value formatted as a string for inclusion in\n\t\t a C source file.\"\"\"\n\t\tif reg.size == \"accum\":\n\t\t\treturn str(float(reg.default)) + \"k\"\n\t\telse:\n\t\t\treturn str(int(reg.default)) + \"L\"\n\n\ts = ...
[ "0.59454465", "0.58785355", "0.5848829", "0.57722485", "0.55959517", "0.55808365", "0.55285215", "0.55105907", "0.5494409", "0.5454238", "0.5445453", "0.54306823", "0.54146516", "0.5409412", "0.5409412", "0.54092675", "0.5394377", "0.5382933", "0.52863", "0.52561444", "0.5255...
0.65812814
0
Get contexts. Contains dummy data until compression has been ran.
def get_contexts(self): return self.__contexts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contexts(self):\n return self._contexts", "def _context_list(self):\r\n url = \"{}/contexts/\".format(self._org_url)\r\n contexts = self._request(url)\r\n if not contexts:\r\n LOGGER.warning(\"No contexts available\")\r\n return contexts", "def _list_contex...
[ "0.6483514", "0.64695656", "0.63560826", "0.63413453", "0.61699945", "0.6160704", "0.60463107", "0.60225725", "0.6003958", "0.60010916", "0.59905905", "0.59057885", "0.5879675", "0.5826964", "0.5801589", "0.5788998", "0.57804316", "0.5762242", "0.5740597", "0.5699966", "0.566...
0.6547918
0
Get the input offset for compressed data.
def get_input_offset(self): return ELFLING_PADDING + len(self.__data) - 4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset(self):\r\n return self.buf[0].unib[9:11]", "def data_offset(self):\n if self.raw_data_length() < 5 or self.raw_data_length() >= 0x80000000:\n return self.absolute_offset(0x8)\n else:\n return self.abs_offset_from_hbin_offset(self.unpack_dword(0x8))", "def offse...
[ "0.69077", "0.6709358", "0.6586098", "0.6417512", "0.6417512", "0.6417512", "0.6416744", "0.6392835", "0.6298947", "0.62934476", "0.62846375", "0.62827367", "0.62709135", "0.62709135", "0.62394994", "0.62202525", "0.62202525", "0.62202525", "0.62202525", "0.62202525", "0.6220...
0.72409153
0
Get uncompressed size. Contains dummy value until compression has been ran.
def get_uncompressed_size(self): return self.__uncompressed_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uncompressed_size(self):\n if not self.is_compressed():\n return self.size\n elif self.data is None:\n raise ValueError('Data not read from record')\n else:\n return unpack('<L', self.data[:4])[0]", "def layers_compressed_size(self):\n # don't ...
[ "0.7886322", "0.69341135", "0.69341135", "0.68565816", "0.67426556", "0.6714595", "0.66740876", "0.6636799", "0.6634702", "0.6556906", "0.6535948", "0.6521174", "0.6503995", "0.649082", "0.6467185", "0.64643013", "0.6449563", "0.6448163", "0.6442804", "0.6438369", "0.642947",...
0.84050584
0
Return the working area size required for decompression.
def get_work_size(self): # TODO: Extract this value from the source. return (4 << 20) * 16
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uncompressed_size(self):\n return self.__uncompressed_size", "def get_size(self):\n return get_dir_size(self.run_dir)", "def layers_compressed_size(self):\n # don't have this information at this point\n return None", "def layers_compressed_size(self):\n # don't have thi...
[ "0.7564378", "0.717562", "0.7097238", "0.7097238", "0.70418483", "0.69342893", "0.69038624", "0.68397677", "0.6810902", "0.68064135", "0.6790507", "0.67827547", "0.6782107", "0.6777959", "0.67622054", "0.67109233", "0.67109233", "0.67109233", "0.66994065", "0.6693589", "0.669...
0.7221565
1
Write elfling uncompressor source into given location.
def write_c_source(self, dst): wfd = open(dst, "wt") wfd.write(self.generate_c_source()) wfd.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressFile(source, target):\n data = cake.filesys.readFile(source)\n try:\n data = zlib.compress(data, 1)\n except zlib.error, e:\n raise EnvironmentError(str(e))\n cake.filesys.writeFile(target, data)", "def decompressFile(source, target):\n data = cake.filesys.readFile(source)\n try:\n dat...
[ "0.58486736", "0.57731014", "0.575945", "0.56708217", "0.5360059", "0.5327817", "0.5246071", "0.5181856", "0.51723146", "0.5161707", "0.51581824", "0.5149491", "0.51239574", "0.5120051", "0.51131177", "0.5099453", "0.5064303", "0.50597143", "0.5056892", "0.50547314", "0.50487...
0.59599763
0
Get linkable library object name.
def get_library_name(self, linker): return linker.get_library_name(self.__library.get_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def libraryName(self):\n return _osgAnimation.LinkVisitor_libraryName(self)", "def libraryName(self):\n ret=\"\"\n if self.kind == \"lib\":\n ret = self.name + \"Engine\"\n elif self.kind == \"exe\":\n ret = self.name + \"Exelib\"\n else:\n raise Invalid(\"Invalid kind of compon...
[ "0.7524092", "0.68183917", "0.66564393", "0.665176", "0.658395", "0.6520388", "0.65176934", "0.628592", "0.62624913", "0.6256311", "0.62168133", "0.61954725", "0.61433464", "0.6098662", "0.60864383", "0.6005712", "0.60008615", "0.59982854", "0.59896773", "0.59837055", "0.5938...
0.7746522
0
Add a symbol listing.
def add_symbols(self, lst): for ii in lst: self.__symbols += [Symbol(ii, self)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_symbol(self):\n default_state = \"New State\"\n default_file = \"New File\"\n\n row = self.tbl_symbols.rowCount()\n self.tbl_symbols.insertRow(row)\n self.lst_state_item = QtWidgets.QTableWidgetItem(default_state)\n self.tbl_symbols.setItem(row, 0, self.lst_state_i...
[ "0.6989854", "0.6865956", "0.660723", "0.639316", "0.622695", "0.61249983", "0.60747755", "0.60413384", "0.59673446", "0.5812816", "0.57787246", "0.56945974", "0.56945974", "0.5624428", "0.5591964", "0.5519615", "0.5482699", "0.54663914", "0.54119426", "0.54100776", "0.538688...
0.69459367
1
Analyze given preprocessed C source for symbol names.
def analyze_source(source, prefix): symbolre = re.compile(r"[\s:;&\|\<\>\=\^\+\-\*/\(\)\?]" + prefix + "([a-zA-Z0-9_]+)[\s\(]") results = symbolre.findall(source, re.MULTILINE) ret = set() for ii in results: symbolset = set() symbolset.add(ii) ret = ret.union(symbolset) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compilation_test(interp, source):\r\n print '*** Compiling symbols from file: %s ***' % util.within_VCode(source)\r\n interp.cleanup_dictionary()\r\n interp.parse_symbols_from_file(source)\r\n print '\\n\\nParsed symbols are: '\r\n interp.print_symbols()\r\n print 'Unresolved abbreviations ar...
[ "0.67080885", "0.6153262", "0.5814418", "0.5719669", "0.5673369", "0.5570332", "0.5499761", "0.54812646", "0.53433", "0.5330481", "0.5239203", "0.51465654", "0.5072792", "0.50553113", "0.50295335", "0.50116104", "0.49933404", "0.4964503", "0.49557436", "0.49133617", "0.491101...
0.6574527
1
Generate the loader code.
def generate_loader(mode, symbols, definition, linker): if "vanilla" == mode: loader_content = generate_loader_vanilla() elif "dlfcn" == mode: loader_content = generate_loader_dlfcn(symbols, linker) else: loader_content = generate_loader_hash(symbols) ret = template_loader % (definition, loader_cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_loader_vanilla():\n return template_loader_vanilla", "def main():\n load()\n\n print(generate())", "def __init__(self, loader, *args, **kw):\r\n self._loader = loader", "def test_loaders():\n\n tempdir = tempfile.mkdtemp()\n\n loader = \"\"\"\nfrom mindbender import api\n\ncl...
[ "0.703231", "0.6265693", "0.61514485", "0.607947", "0.60034734", "0.5944229", "0.590385", "0.59014887", "0.586205", "0.58546984", "0.5821652", "0.5813691", "0.5786931", "0.57738125", "0.57704836", "0.5762984", "0.57369405", "0.5683862", "0.565315", "0.56217235", "0.559276", ...
0.70129406
1
Generate dlopen/dlsym loader code.
def generate_loader_dlfcn(symbols, linker): dlfcn_string = "" current_lib = None for ii in symbols: symbol_lib = ii.get_library().get_name() if current_lib != symbol_lib: if current_lib: dlfcn_string += "\"\\0%s\\0\"\n" % (ii.get_library_name(linker)) else: dlfcn_string += "\"%...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dlopen(ffi, *names):\r\n for name in names:", "def generate_loader(mode, symbols, definition, linker):\n if \"vanilla\" == mode:\n loader_content = generate_loader_vanilla()\n elif \"dlfcn\" == mode:\n loader_content = generate_loader_dlfcn(symbols, linker)\n else:\n loader_content = generate_...
[ "0.6743788", "0.65739065", "0.589481", "0.55456424", "0.5506305", "0.5457755", "0.53003913", "0.5283254", "0.5245567", "0.5237008", "0.52004987", "0.51646227", "0.51506567", "0.51446915", "0.51446915", "0.5142", "0.50065887", "0.49771848", "0.49137747", "0.4912482", "0.488143...
0.70313996
0
Generate import by hash loader code.
def generate_loader_hash(symbols): return template_loader_hash % (str(PlatformVar("entry")), len(symbols))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_import(self) -> str:\n as_name = self.exported_parts[-1]\n if as_name == self.imported_name:\n import_line = 'from {} import {}'.format(self.imported_module,\n self.imported_name)\n else:\n import_line = 'from {} import {} as {}'.format(self....
[ "0.6368826", "0.6056805", "0.59183735", "0.57923025", "0.5725584", "0.57188", "0.56861246", "0.56043696", "0.5569258", "0.55647004", "0.5522381", "0.5495448", "0.5482359", "0.5467838", "0.5461166", "0.54400706", "0.5436573", "0.5402263", "0.53843963", "0.5384361", "0.5365209"...
0.6222189
1
Generate loader that actually leaves the loading to the operating system.
def generate_loader_vanilla(): return template_loader_vanilla
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_loader(mode, symbols, definition, linker):\n if \"vanilla\" == mode:\n loader_content = generate_loader_vanilla()\n elif \"dlfcn\" == mode:\n loader_content = generate_loader_dlfcn(symbols, linker)\n else:\n loader_content = generate_loader_hash(symbols)\n ret = template_loader % (definit...
[ "0.71871525", "0.5983045", "0.5961451", "0.5934998", "0.586735", "0.56366605", "0.56331116", "0.5628161", "0.5625195", "0.5625195", "0.5624558", "0.56025654", "0.55929106", "0.55756044", "0.550558", "0.5499187", "0.5489184", "0.5450847", "0.54393333", "0.54354197", "0.5419472...
0.6754671
1
Generate a listing of definitions from replacement symbols to real symbols.
def generate_symbol_definitions(mode, symbols, prefix, definition): direct = [] tabled = [] for ii in symbols: direct += [ii.generate_rename_direct(prefix)] tabled += [ii.generate_rename_tabled(prefix)] if "vanilla" == mode: tabled = direct return template_symbol_definitions % (definition, "\n".jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_definitions(cfg,regs):\n def_l = list()\n for reg in regs.keys():\n print \"Implementing register {}\".format(reg)\n reg_uc = reg.upper()\n reg_lc = reg.lower()\n r_prefix = get_reg_definition_prefix(cfg,reg_uc)\n def_l.append(get_def_reg_prop(cfg,regs,reg,'addr'))\...
[ "0.6253754", "0.57207364", "0.57070845", "0.5645775", "0.5594681", "0.5540883", "0.55383074", "0.5527827", "0.5484038", "0.54754853", "0.54686403", "0.5454651", "0.5453107", "0.5428926", "0.5340924", "0.53245693", "0.5310874", "0.53092027", "0.5226929", "0.5224155", "0.521388...
0.7459208
0
Generate the symbol struct definition.
def generate_symbol_struct(mode, symbols, definition): if "vanilla" == mode: return "" definitions = [] hashes = [] symbol_table_content = "" for ii in symbols: definitions += [" %s;" % (ii.generate_definition())] hashes += [" %s%s," % (ii.generate_prototype(), ii.get_hash())] if "dlfcn" != mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_symbol_definitions(mode, symbols, prefix, definition):\n direct = []\n tabled = []\n for ii in symbols:\n direct += [ii.generate_rename_direct(prefix)]\n tabled += [ii.generate_rename_tabled(prefix)]\n if \"vanilla\" == mode:\n tabled = direct\n return template_symbol_definitions % (defi...
[ "0.6592795", "0.6284734", "0.62783027", "0.62599087", "0.6218674", "0.6167318", "0.61141014", "0.6038876", "0.6027661", "0.5975935", "0.59138465", "0.5913415", "0.59072423", "0.58968693", "0.5878186", "0.58671486", "0.5857424", "0.58494", "0.58308095", "0.5823088", "0.5803287...
0.8197967
0
Compress a file to be a selfextracting filedumping executable.
def compress_file(compression, pretty, src, dst): str_tail = "sed 1d" str_cleanup = ";exit" if pretty: str_tail = "tail -n+2" str_cleanup = ";rm ~;exit" if "lzma" == compression: command = ["xz", "--format=lzma", "--lzma1=preset=9e,lc=1,lp=0,pb=0", "--stdout"] header = "HOME=/tmp/i;%s $0|lzcat>~...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(file, output, pw):\n try:\n bsc.compress_file(file, output, pw)\n print(Fore.GREEN + \"Compressed!\")\n except bsc.FrequencyOverflowException as err:\n print(err)\n except FileNotFoundError:\n print(Fore.RED + \"File not found!\")", "def _compress_meds_file(self,...
[ "0.67023677", "0.66475374", "0.6518508", "0.6500677", "0.6500677", "0.64690274", "0.6371242", "0.63292146", "0.62838733", "0.6268847", "0.6194923", "0.61634386", "0.61621195", "0.60887635", "0.60583115", "0.60181916", "0.6015426", "0.60129094", "0.59591305", "0.5947446", "0.5...
0.667614
1
Check if given file contains nothing but ASCII7 text.
def file_is_ascii_text(op): if not os.path.isfile(op): return False fd = open(op, "rb") while True: line = fd.readline() if 0 >= len(line): fd.close() return True try: line.decode("ascii") except UnicodeDecodeError: fd.close() return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_invalid_characters(filen=None,text=None):\n if filen is not None:\n with open(filen,'r') as fp:\n for line in fp:\n for c in set(line.replace('\\n','').replace('\\t','')):\n if ord(c) > 127 or ord(c) < 32:\n return True\n else...
[ "0.712013", "0.6904671", "0.6733931", "0.67135054", "0.653979", "0.6462879", "0.6434393", "0.6369581", "0.6297927", "0.6280197", "0.624629", "0.6143433", "0.61343205", "0.613207", "0.6131941", "0.6122098", "0.6101222", "0.609302", "0.60659623", "0.6049215", "0.6046928", "0....
0.7372012
0
Get the UND symbols required for this platform.
def get_platform_und_symbols(): ret = None if osname_is_freebsd(): ret = sorted(["environ", "__progname"]) if is_verbose(): print("Checking for required UND symbols... " + str(ret)) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbols(self):\n symbols = os.environ.get('SYMBOLS', 'btc,eth')\n if not symbols:\n return 'btc,eth'\n return symbols", "def get_symbol(self):\n return []", "def get_symbols(self):\n\n raise NotImplementedError('''\n Must implement get_symbols. C...
[ "0.6670518", "0.61906695", "0.6175396", "0.6017592", "0.5867967", "0.5810293", "0.57862127", "0.5780209", "0.5750767", "0.574499", "0.5611445", "0.55971366", "0.5560399", "0.54607", "0.5448527", "0.54335165", "0.5430834", "0.54075116", "0.54050577", "0.54002506", "0.5359577",...
0.7790484
0
Tell if given register is used for saving the stack.
def is_stack_save_register(op): return op.lower() in ('rbp', 'ebp')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sreg(vm, reg: str) -> True:\n data = getattr(vm.reg, reg).to_bytes(2, byteorder)\n\n if len(data) < vm.operand_size:\n data = zero_extend(data, vm.operand_size)\n\n vm.stack_push(data)\n if debug: print('push {}'.format(reg))\n\n return True", "def append_registe...
[ "0.64094424", "0.6045856", "0.5789085", "0.5498442", "0.54620486", "0.51971656", "0.51534945", "0.50828344", "0.49512288", "0.49207187", "0.48130372", "0.48066905", "0.47735444", "0.47558728", "0.47070596", "0.46895212", "0.46546757", "0.46495554", "0.4635646", "0.46200004", ...
0.7799724
0
Tell if a variable can be deconstructed.
def is_deconstructable(op): return isinstance(op, int) or (isinstance(op, PlatformVar) and op.deconstructable())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconstructable(self):\n return isinstance(self.get(), int)", "def _check_typevar(self) -> PossibleResult[T]:\n if _is_typevar(self.constructor): # type: ignore\n return Deserialize(\n obj=self.obj,\n constructor=(\n Union[self.constructo...
[ "0.63424873", "0.58244395", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5572131", "0.5569911", "0.5569911", "0.5569911", "0.5569911", "0.5569911", "0.5569911", "0.5569911", ...
0.737218
0
Tell if given parameter is a listing.
def is_listing(op): return isinstance(op, (list, tuple))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listing_available(self):\n portal_types = api.portal.get_tool(name='portal_types')\n self.assertTrue(LISTING_TYPE in portal_types)", "def is_list(self):\n answer = self._call('is_list')\n return answer.yes", "def _is_list(arg):\n if isinstance(arg, dict):\n return...
[ "0.63251656", "0.62851137", "0.6014475", "0.59768623", "0.596996", "0.59381306", "0.5913793", "0.5911448", "0.58627284", "0.5823204", "0.5808332", "0.57844067", "0.57690686", "0.5724059", "0.56870335", "0.5640725", "0.560178", "0.55769753", "0.55461746", "0.5522471", "0.54916...
0.66946316
0
Try to merge segments in a given list inplace.
def merge_segments(lst): ii = 0 while True: jj = ii + 1 if len(lst) <= jj: return lst seg1 = lst[ii] seg2 = lst[jj] if seg1.merge(seg2): if seg2.empty(): del lst[jj] else: ii += 1 else: ii += 1 return lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_sorth_in_place(num_list, start_index, end_index):\n pass", "def merge_segdb(segdbs):\n segdb = segdbs[0]\n for r in segdbs[1:]:\n segdb.extend(r)\n return segdb", "def merge_segdb(segdbs):\n segdb = segdbs[0]\n for r in segdbs[1:]:\n segdb.extend(r)\n return segdb",...
[ "0.68400085", "0.6219808", "0.6219808", "0.6182702", "0.6101852", "0.60207534", "0.59419256", "0.5934213", "0.5779504", "0.57361627", "0.57072043", "0.5665324", "0.55908716", "0.55839545", "0.5582212", "0.5499618", "0.5499561", "0.5477864", "0.5465583", "0.54623234", "0.54563...
0.75063485
0
Check if the architecture is 32bit.
def osarch_is_32_bit(): return osarch_match("32-bit")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_32bit(self):\n return self.machine in ['i386', 'i586', 'i686']", "def isIntelX86_32bit():\n return String(System.getProperty(\"os.arch\", \"null\").strip()).toLowerCase(Locale.ROOT) == \"x86\"", "def osarch_is_ia32():\n return osarch_match(\"ia32\")", "def check_architecture(target_arch...
[ "0.87861794", "0.8287579", "0.7667366", "0.6631346", "0.6533003", "0.6482042", "0.6453376", "0.64525235", "0.6358691", "0.63286805", "0.621909", "0.61760354", "0.6139206", "0.6103654", "0.600135", "0.59479225", "0.59356", "0.59154433", "0.59083915", "0.58433604", "0.58409554"...
0.87933964
0
Check if the architecture maps to amd64.
def osarch_is_amd64(): return osarch_match("amd64")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def osarch_is_64_bit():\n return osarch_match(\"64-bit\")", "def is_64bit(self):\n return self.machine == 'x86_64'", "def is64bit(self):\n return platform.machine().endswith('64')", "def osarch_is_ia32():\n return osarch_match(\"ia32\")", "def osarch_is_32_bit():\n return osarch_match(\"32-b...
[ "0.8025021", "0.7465681", "0.7423662", "0.70565116", "0.6870438", "0.6837684", "0.6761238", "0.6742715", "0.6653703", "0.66097385", "0.6589123", "0.651225", "0.65100527", "0.6505008", "0.6447491", "0.64349276", "0.64011943", "0.6374359", "0.63237715", "0.621926", "0.6161176",...
0.8490404
0
Check if the architecture maps to ia32.
def osarch_is_ia32(): return osarch_match("ia32")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def osarch_is_32_bit():\n return osarch_match(\"32-bit\")", "def isIntelX86_32bit():\n return String(System.getProperty(\"os.arch\", \"null\").strip()).toLowerCase(Locale.ROOT) == \"x86\"", "def is_32bit(self):\n return self.machine in ['i386', 'i586', 'i686']", "def host_arch_win():\n\n arch...
[ "0.79764456", "0.754886", "0.7496334", "0.71616673", "0.71413606", "0.6989674", "0.67247653", "0.6607921", "0.65574616", "0.65475184", "0.6511086", "0.6499318", "0.6452414", "0.63363063", "0.62966806", "0.6265306", "0.62568384", "0.6242454", "0.6238135", "0.6149152", "0.60745...
0.87544316
0
Check if osarch matches some chain resulting in given value.
def osarch_match(op): arch = g_osarch while True: if op == arch: return True arch = platform_map_iterate(arch) if not arch: break return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_usearch_supported_version(self):\r\n acceptable_version = [(5, 2, 236), (5, 2, 236)]\r\n self.assertTrue(which('usearch'),\r\n \"usearch not found. This may or may not be a problem depending on \" +\r\n \"which components of QIIME you plan to use...
[ "0.6367213", "0.62195045", "0.60445887", "0.59799755", "0.5933423", "0.5920836", "0.59034365", "0.576081", "0.56717974", "0.56225556", "0.55976266", "0.5576412", "0.55616945", "0.5492701", "0.54839325", "0.5475875", "0.5449723", "0.54415774", "0.54390186", "0.5423517", "0.540...
0.72579294
0
Check if the operating system name maps to FreeBSD.
def osname_is_freebsd(): return ("FreeBSD" == g_osname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def osname_is_linux():\n return (\"Linux\" == g_osname)", "def _detect_os():\n # TODO: Add pillar support for the apachectl location\n os_family = __grains__[\"os_family\"]\n if os_family == \"RedHat\":\n return \"apachectl\"\n elif os_family == \"Debian\" or os_family == \"Suse\":\n r...
[ "0.65397257", "0.639423", "0.6285547", "0.62502456", "0.6220589", "0.61542404", "0.61530375", "0.6147812", "0.61255646", "0.61193746", "0.607277", "0.6020914", "0.6017363", "0.59841204", "0.5980304", "0.59561485", "0.59561485", "0.5922335", "0.5896314", "0.5895452", "0.588619...
0.8153851
0
Check if the operating system name maps to Linux.
def osname_is_linux(): return ("Linux" == g_osname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsLinux():\n return os.name == 'posix' and os.uname()[0] == 'Linux'", "def is_linux():\n (sysname, nodename, release, version, machine) = os.uname()\n return sysname == 'Linux'", "def os_is_linux():\n return platform.system() == \"Linux\" and \"raspberrypi\" not in platform.uname()", "def is_l...
[ "0.835138", "0.8316263", "0.8022123", "0.80143887", "0.79304147", "0.7905155", "0.7767856", "0.77370155", "0.7406891", "0.7189041", "0.7058692", "0.7053116", "0.69886184", "0.6944053", "0.68928987", "0.67548347", "0.67075527", "0.66909796", "0.6689945", "0.66723007", "0.66026...
0.8750902
0
Common function to raise an error if os architecture address size is unknown.
def raise_unknown_address_size(): raise RuntimeError("platform '%s' addressing size unknown" % (g_osarch))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_architecture(target_architecture):\n if target_architecture == ARCH_16_BIT:\n # should be fine, most computers are at least 32 bit these days\n pass\n elif target_architecture == ARCH_32_BIT:\n # should be fine, most computers are at least 32 bit these days\n pass\n e...
[ "0.6216043", "0.6164201", "0.60389334", "0.58762014", "0.58726496", "0.5754266", "0.57486326", "0.5618807", "0.5610932", "0.5562206", "0.5427832", "0.5422256", "0.53858393", "0.53379935", "0.5321501", "0.5302871", "0.52763647", "0.52560973", "0.52488816", "0.52292514", "0.522...
0.87579626
0
Read information from an ELF file using readelf. Return as dictionary.
def readelf_get_info(op): ret = {} (so, se) = run_command(["readelf", "--file-header", "--program-headers", op]) match = re.search(r'LOAD\s+\S+\s+(\S+)\s+\S+\s+(\S+)\s+\S+\s+RWE', so, re.MULTILINE) if match: ret["base"] = int(match.group(1), 16) ret["size"] = int(match.group(2), 16) else: raise Ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read (path, elf_info):\n ehdr, phdrs, shdrs, syms, core_info = elf_info\n info = abbrev = strings = None\n for shdr in shdrs:\n if shdr['name'] == '.debug_info':\n info = shdr['offset'], shdr['size']\n if shdr['name'] == '.debug_abbrev':\n abbrev = shdr['offset'], s...
[ "0.6764478", "0.6653434", "0.63214916", "0.62573344", "0.62573344", "0.5895301", "0.5786551", "0.57283723", "0.5665498", "0.5654526", "0.56040245", "0.5558374", "0.5547578", "0.5532872", "0.5494092", "0.5483946", "0.5470607", "0.5454977", "0.5448657", "0.5438453", "0.5418031"...
0.7409814
0
Truncate file to size reported by readelf first PT_LOAD file size.
def readelf_truncate(src, dst): info = readelf_get_info(src) size = os.path.getsize(src) truncate_size = info["size"] if size == truncate_size: if is_verbose(): print("Executable size equals PT_LOAD size (%u bytes), no truncation necessary." % (size)) shutil.copy(src, dst) else: if is_verbos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncate(self, name, path, size_mb=100):\n self._assert_absolute_path_or_placeholder(path)\n self._run(name, ['truncate', path, size_mb])", "def truncateFile(fileNameString, tooBig=50000):\n if os.path.getsize(fileNameString) > tooBig:\n fh = open(fileNameString, 'rb+')\n fh.seek(-tooB...
[ "0.6274308", "0.62138194", "0.60734344", "0.59006006", "0.5865615", "0.5626861", "0.55363107", "0.5526327", "0.54728574", "0.5466813", "0.5441398", "0.5401576", "0.5393934", "0.5344767", "0.5340071", "0.5335007", "0.53346604", "0.5314491", "0.5305113", "0.53010637", "0.524428...
0.7540439
0
Add the serialized data of the FIFO to the current FIFO.
def addFIFO(self, fifo): if not isinstance(fifo, MessageFIFO): raise SerializationError('fifo is not of type MessageFIFO.') self._buf += fifo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, data):\n wasquiet = True if (self.tail == self.curr) else False\n\n # Assert the queue is clean\n qtail = self.base + \".\" + str(self.tail)\n print \"creating %s\" % qtail\n assert not os.path.exists(qtail)\n qt = open(qtail, \"w\")\n qt.write(data)\n...
[ "0.67765445", "0.62891406", "0.6266699", "0.61123335", "0.61053836", "0.6093126", "0.6093126", "0.60848975", "0.6042122", "0.6038454", "0.6031468", "0.60311306", "0.60111624", "0.598693", "0.59746945", "0.5947546", "0.5941868", "0.59387565", "0.5887869", "0.586139", "0.584956...
0.73013985
0
Get the FIFO containing the remaining data.
def getFIFO(self): return self._buf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_sm(self):\r\n while True:\r\n # wait to receive a read request\r\n req = yield self.r_in_pipe.get()\r\n # model read latency\r\n #for i in range(self.read_latency):\r\n yield self.wait_sys_clks(self.read_latency)\r\n # try to read hea...
[ "0.66020125", "0.636941", "0.6243222", "0.6241263", "0.62131983", "0.61683995", "0.61492604", "0.6086427", "0.6028599", "0.60279167", "0.59935087", "0.5981691", "0.592324", "0.5900166", "0.5897246", "0.5897135", "0.58534783", "0.58517134", "0.58464026", "0.5846327", "0.583631...
0.7588719
0
Run an Import volumes protocol.
def runImportVolumes(cls, pattern, samplingRate): cls.protImport = cls.newProtocol(ProtImportVolumes, filesPath=pattern, samplingRate=samplingRate ) cls.launchProtocol(cls.protImpor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runImportVolumes(cls, pattern, samplingRate):\n cls.protImport = cls.newProtocol(ProtImportVolumes,\n filesPath=pattern, samplingRate=samplingRate)\n cls.launchProtocol(cls.protImport)\n return cls.protImport", "def runImportVolumes(cls, pattern, s...
[ "0.6700931", "0.593778", "0.5748392", "0.57205707", "0.5583772", "0.5490887", "0.54509044", "0.5447382", "0.5324295", "0.52687997", "0.5265567", "0.5250754", "0.5248976", "0.52372926", "0.5228327", "0.5227594", "0.5198943", "0.5179943", "0.51258814", "0.5119059", "0.5092544",...
0.6724419
0
Searches and loads target files, and runs compile_target() on a multiprocessing pool with parallel number of processes. kwargs are passed to compile_target()
def compile_targets( inventory_path, search_paths, output_path, parallel, targets, labels, ref_controller, **kwargs ): # temp_path will hold compiled items temp_path = tempfile.mkdtemp(suffix=".kapitan") # enable previously compiled items to be reference in other compile inputs search_paths.append(t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_targets(target_path, search_path, output_path, parallel, **kwargs):\n # temp_path will hold compiled items\n temp_path = tempfile.mkdtemp(suffix='.kapitan')\n pool = multiprocessing.Pool(parallel)\n # append \"compiled\" to output_path so we can safely overwrite it\n compile_path = os.pa...
[ "0.7611597", "0.6306793", "0.62940884", "0.58295864", "0.5788407", "0.57844245", "0.5742887", "0.57425904", "0.563167", "0.5582882", "0.55530715", "0.55022043", "0.54764396", "0.54480064", "0.54415554", "0.5399857", "0.53903604", "0.5384933", "0.5383334", "0.53114545", "0.530...
0.65828514
1
generates the hashes for the inventory per target and jsonnet/jinja2 folders for caching purposes
def generate_inv_cache_hashes(inventory_path, targets, cache_paths): inv = inventory_reclass(inventory_path) cached.inv_cache = {} cached.inv_cache["inventory"] = {} cached.inv_cache["folder"] = {} if targets: for target in targets: try: cached.inv_cache["invento...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash_cache_dir():\n import hashlib\n\n out = OrderedDict(python_version=python_version)\n\n try:\n import shapely\n out['shapely_version'] = shapely.__version__\n out['shapely_file'] = shapely.__file__\n except ImportError:\n pass\n try:\n import fiona\n ...
[ "0.6252905", "0.6176074", "0.60525846", "0.59407264", "0.5780159", "0.57629067", "0.5743765", "0.57123625", "0.5704943", "0.56480265", "0.5576519", "0.5564995", "0.55591285", "0.5515075", "0.54973257", "0.54402876", "0.5406316", "0.5385892", "0.53748816", "0.5361973", "0.5348...
0.6933687
0
returns a list of targets that have changed since last compilation
def changed_targets(inventory_path, output_path): targets = [] inv = inventory_reclass(inventory_path) saved_inv_cache = None saved_inv_cache_path = os.path.join(output_path, "compiled/.kapitan_cache") if os.path.exists(saved_inv_cache_path): with open(saved_inv_cache_path, "r") as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_versioned_targets(self):\n return self._all_versioned_targets", "def changed_lines(self):\n return self._depot_tools_affected_file.ChangedContents()", "def all_targets(self):\n return self._combined_all_versioned_targets.targets", "def _findChangedFiles(self):\n changedFiles = []\n ...
[ "0.651309", "0.6258761", "0.6253191", "0.60317564", "0.6018183", "0.6012667", "0.60093343", "0.5952882", "0.59429854", "0.5908313", "0.58916074", "0.5861207", "0.5854379", "0.58358514", "0.5807557", "0.5793957", "0.5793749", "0.5751536", "0.5678192", "0.55927837", "0.55808717...
0.64954495
1
save the cache to .kapitan_cache for inventories per target and folders
def save_inv_cache(compile_path, targets): if cached.inv_cache: inv_cache_path = os.path.join(compile_path, ".kapitan_cache") # If only some targets were selected (-t), overwride only their inventory if targets: saved_inv_cache = None try: with open(in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_cache(self, cache_dir):\n if not self.is_numeric:\n raise ValueError(\"No need to save if not numeric\")\n if self.is_supervised:\n raise NotImplementedError(\"Caching not yet implemented for supervised views\")\n\n os.makedirs(cache_dir, exist_ok=True)\n ...
[ "0.6687014", "0.6357653", "0.6357653", "0.62382394", "0.6107235", "0.6071142", "0.6064555", "0.6043911", "0.6015711", "0.59889984", "0.5956329", "0.5944699", "0.59161955", "0.5908008", "0.59051275", "0.59036934", "0.58831966", "0.58814496", "0.58666223", "0.58105636", "0.5801...
0.6384612
1
returns a list of target objects from the inventory
def load_target_inventory(inventory_path, targets, ignore_class_notfound=False): target_objs = [] inv = inventory_reclass(inventory_path, ignore_class_notfound) # if '-t' is set on compile, only loop through selected targets if targets: targets_list = targets else: targets_list = in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inventory(self):\n from noc.inv.models.object import Object\n\n return list(Object.objects.filter(data__management__managed_object=self.id))", "def get_equipment_from_inventory(self):\n return [x for x in self.inventory if x.is_equip()]", "def get_items(self):\r\n item_list ...
[ "0.66646594", "0.6400104", "0.63535213", "0.63265866", "0.6249115", "0.6220788", "0.61163217", "0.6027944", "0.60244405", "0.5945409", "0.5845509", "0.58235216", "0.58093727", "0.5794532", "0.57840276", "0.57569575", "0.564555", "0.5616902", "0.5615412", "0.56006587", "0.5595...
0.6463107
1
returns a list of targets where the labels match, otherwise just return the original targets
def search_targets(inventory_path, targets, labels): if not labels: return targets try: labels_dict = dict(label.split("=") for label in labels) except ValueError: raise CompileError( "Compile error: Failed to parse labels, should be formatted like: kapitan compile -l en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weak_target(labels, lb_to_idx):\n classes_num = len(lb_to_idx)\n target = np.zeros(classes_num, dtype=np.bool)\n \n for label in labels: \n target[lb_to_idx[label]] = True\n \n return target", "def get_targets_in_sif_file(sif_file, targets):\n targets_in_network = set()\n ...
[ "0.6794866", "0.6330987", "0.62982833", "0.6244405", "0.6225661", "0.6219863", "0.61603016", "0.61477375", "0.6144679", "0.61355454", "0.61221814", "0.61208", "0.60842174", "0.6072561", "0.6072561", "0.59760493", "0.5964272", "0.59496695", "0.59479845", "0.59405035", "0.59384...
0.6621845
1
Compiles target_obj and writes to compile_path
def compile_target(target_obj, search_paths, compile_path, ref_controller, globals_cached=None, **kwargs): start = time.time() compile_objs = target_obj["compile"] ext_vars = target_obj["vars"] target_name = ext_vars["target"] if globals_cached: cached.from_dict(globals_cached) use_go_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_target_file(target_file, search_path, compile_path, **kwargs):\n target_obj = load_target(target_file)\n target_name = target_obj[\"vars\"][\"target\"]\n compile_obj = target_obj[\"compile\"]\n ext_vars = target_obj[\"vars\"]\n\n for obj in compile_obj:\n if obj[\"type\"] == \"jso...
[ "0.6938969", "0.6393394", "0.6184063", "0.6068946", "0.6038548", "0.6003388", "0.6001754", "0.5947439", "0.5947439", "0.5917713", "0.5882231", "0.57922107", "0.5785204", "0.57751805", "0.5770353", "0.57127386", "0.56718564", "0.5665527", "0.56055665", "0.56040466", "0.5573116...
0.70170283
0
Validates a target_obj Returns a dict object if target is valid Otherwise raises ValidationError
def valid_target_obj(target_obj, require_compile=True): schema = { "type": "object", "properties": { "vars": {"type": "object"}, "secrets": { "type": "object", "properties": { "gpg": { "type": "objec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_object(\n instance: typing.Dict[str, typing.Any],\n schema: typing.Dict[str, typing.Any],\n path: typing.List[str],\n allow_disabled_languages: bool = False,\n strict: bool = False\n) -> None:\n if not isinstance(instance, dict):\n raise ValidationError('i...
[ "0.62171096", "0.6001156", "0.57591707", "0.575532", "0.5733772", "0.56411314", "0.5617747", "0.5615655", "0.5585147", "0.553058", "0.5526695", "0.5526193", "0.5468064", "0.5455944", "0.54535174", "0.5433171", "0.54223514", "0.53966683", "0.53939015", "0.5350437", "0.5346648"...
0.62138116
1
validates compiled output according to schemas specified in the inventory
def schema_validate_compiled(args): if not os.path.isdir(args.compiled_path): logger.error("compiled-path %s not found", args.compiled_path) sys.exit(1) if not os.path.isdir(args.schemas_path): os.makedirs(args.schemas_path) logger.info("created schema-cache-path at %s", args.sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __validate_and_compile(self):\n self.__validate_file(self.__schema_path, \"RNG\")\n\n with open(self.__schema_path) as relax_file_handler:\n\n # Parse schema file\n relax_parsed = etree.parse(relax_file_handler)\n\n # Compile schema file\n self.__compil...
[ "0.60508657", "0.5941576", "0.5832469", "0.5825233", "0.5760917", "0.5735769", "0.5725864", "0.56981915", "0.5674754", "0.5668759", "0.5662746", "0.5638177", "0.558738", "0.55803496", "0.55803496", "0.55635273", "0.554399", "0.5518778", "0.55113345", "0.5502783", "0.5477271",...
0.6766683
0
validates given files according to kubernetes manifest schemas schemas are cached from/to cache_dir validate_data must be of structure ((kind, version), validate_files)
def schema_validate_kubernetes_output(validate_data, cache_dir): (kind, version), validate_files = validate_data KubernetesManifestValidator(cache_dir).validate(validate_files, kind=kind, version=version)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_validate_compiled(args):\n if not os.path.isdir(args.compiled_path):\n logger.error(\"compiled-path %s not found\", args.compiled_path)\n sys.exit(1)\n\n if not os.path.isdir(args.schemas_path):\n os.makedirs(args.schemas_path)\n logger.info(\"created schema-cache-path ...
[ "0.6146217", "0.58332783", "0.5775846", "0.5763498", "0.57307667", "0.5721632", "0.57025135", "0.56902677", "0.562497", "0.5574238", "0.55219996", "0.5516354", "0.5504929", "0.54983234", "0.54744905", "0.54682606", "0.5454606", "0.54233843", "0.5399741", "0.53893983", "0.5384...
0.7134256
0
Create an instance of a extended cookie auth helper.
def manage_addBlowfishExtendedCookieAuthHelper(self, id, title='', RESPONSE=None, **kw): self = self.this() o = BlowfishExtendedCookieAuthHelper(id, title, **kw) self._setObject(o.getId(), o) o = getattr(aq_base(self), id) if RESPONSE is not None: RE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_auth(self, auth_uri, username, password): # pylint: disable=no-self-use\n return authentication.SASTokenAuth.from_shared_access_key(auth_uri, username, password)", "def get_auth(self, name = \"memory\", *args, **kwargs):\r\n\r\n name_f = name.title() + \"Auth\"\r\n auth_c = geta...
[ "0.5534962", "0.5508125", "0.5505838", "0.54295474", "0.5385125", "0.53831095", "0.5326703", "0.5312027", "0.5280516", "0.5248176", "0.5247112", "0.52363616", "0.52252024", "0.5222013", "0.5209606", "0.51908714", "0.51908714", "0.51863885", "0.51863885", "0.5175987", "0.51670...
0.6502762
0
Converts note attributes into primitive values suitable for serialization and puts them into a dict.
def to_dict(self): note_dict = { 'body': self.body, 'tags': self.tags, 'created_at': self.serialize_timestamp(self.created_at), 'modified_at': self.serialize_timestamp(self.modified_at), 'id': self.id } assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_attributes(cls, attrs):\n return {}", "def get_attributes(self):\n \n retdict = {}\n retdict['s'] = str(self.s)\n if self.t != None:\n retdict['t'] = str(self.t)\n retdict['a'] = str(self.a)\n retdict['b'] = str(self.b)\n retdict['c'] = s...
[ "0.6584357", "0.65685606", "0.64389855", "0.64382225", "0.6255304", "0.62330365", "0.61789644", "0.61141866", "0.6090493", "0.601006", "0.6005998", "0.5983139", "0.59793574", "0.5948969", "0.58290493", "0.5824333", "0.5823959", "0.5823387", "0.58082896", "0.58010256", "0.5790...
0.7883424
0
Converts raw values from specified dict into a Note. The dict is expected to be suitable for serialization and therefore the values are expected to be of specific primitive types.
def from_dict(cls, note_dict): missing_properties = set(cls.SERIALIZED_ATTRIBUTE_TYPES.keys()) - set(note_dict.keys()) if len(missing_properties) > 0: raise MissingProperties("Some required properties are missing: {}".format(missing_properties)) for attribute in cls.SERIALIZED_ATTR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dct):\n if dct.pop('type') != cls.__name__:\n fmt = 'Can not construct Note from dict %s'\n raise ValueError(fmt % dct)\n\n return cls(**dct)", "def test_note_asdict(fake_note_with_video_attachment):\n\n note_id_value: str = str(uuid.uuid4())\n a_note ...
[ "0.6373305", "0.60763717", "0.55706406", "0.5515062", "0.54863644", "0.5454177", "0.5413132", "0.5362872", "0.5355194", "0.53317094", "0.5299219", "0.5276475", "0.525314", "0.5251607", "0.5246889", "0.5220936", "0.5183779", "0.5147675", "0.5110493", "0.51019055", "0.50993836"...
0.6084932
1
Return if this rule matches the URL. What to do if rule is matched is up to developer. Most likely ``.is_exception`` attribute should be taken in account.
def match_url(self, url, options=None): options = options or {} for optname in self.options: if optname == 'match-case': # TODO continue if optname not in options: raise ValueError("Rule requires option %s" % optname) if optname == '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match(cls, url, **kwargs):\n return url.scheme.startswith('http')", "def can_handle(self, url):\n return self.url_re.match(url)", "def valid_url(self):\r\n if self.resolver:\r\n return True\r\n return False", "def match_url(self, url):\n pass", "async def ...
[ "0.67038333", "0.66269815", "0.659574", "0.6460938", "0.63986295", "0.639346", "0.6384534", "0.6379115", "0.6294722", "0.62576455", "0.6237753", "0.6122963", "0.6062009", "0.60554934", "0.6047189", "0.60392106", "0.601946", "0.60114527", "0.59804016", "0.59565854", "0.5942004...
0.69961876
0
Return whether this rule can return meaningful result, given the `options` dict. If some options are missing, then rule shouldn't be matched against, and this function returns False.
def matching_supported(self, options=None): if self.is_comment: return False if self.is_html_rule: # HTML rules are not supported yet return False options = options or {} keys = set(options.keys()) if not keys.issuperset(self._options_keys): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_correct_options(options):\n\n has_correct = False\n\n for option in options:\n if option.get('correct') is True:\n has_correct = True\n\n if not has_correct:\n return c('error_need_correct')", "def is_valid(option_set):\n area = get_area(option_set)\n duration = ge...
[ "0.7036239", "0.6364745", "0.630673", "0.62812024", "0.62683153", "0.6259693", "0.6234793", "0.6227847", "0.60607165", "0.60000026", "0.589558", "0.5893934", "0.58001876", "0.5755991", "0.5750212", "0.56371593", "0.5628357", "0.5605693", "0.55971205", "0.55375344", "0.5512098...
0.7264887
0
Convert AdBlock rule to a regular expression.
def rule_to_regex(cls, rule): if not rule: raise ValueError("Invalid rule") # return rule # escape special regex characters rule = re.sub(r"([.$+?{}()\[\]\\])", r"\\\1", rule) # XXX: the resulting regex must use non-capturing groups (?: # for performance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_rule(rule):\n return rule_comment_re.sub('', rule).replace(\n '\\n', ' ').replace('\\r', ' ').strip()", "def AsRegEx(self):\n parts = _REGEX_SPLIT_PATTERN.split(self._value)\n result = u\"\".join(self._ReplaceRegExPart(p) for p in parts)\n\n return rdf_standard.RegularExpression(u\"(?i...
[ "0.60028386", "0.5896456", "0.5754062", "0.5652245", "0.5529864", "0.55073607", "0.54274225", "0.5402351", "0.54019326", "0.5382742", "0.529045", "0.5278679", "0.5197379", "0.5172343", "0.51128715", "0.5057039", "0.50542897", "0.5049484", "0.5018157", "0.49934858", "0.4962205...
0.70176774
0
Return if ``url``/``options`` are matched by rules defined by ``general_re``, ``domain_required_rules`` and ``rules_with_options``. ``general_re`` is a compiled regex for rules without options.
def _matches(self, url, options, general_re, domain_required_rules, rules_with_options): if general_re and general_re.search(url): return True rules = [] if 'domain' in options and domain_required_rules: src_domain = options['domain'] for dom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_url(self, url, options=None):\n options = options or {}\n for optname in self.options:\n if optname == 'match-case': # TODO\n continue\n\n if optname not in options:\n raise ValueError(\"Rule requires option %s\" % optname)\n\n ...
[ "0.7129203", "0.6051058", "0.59464043", "0.5634629", "0.54661834", "0.5397589", "0.52203137", "0.51650745", "0.51156276", "0.5050364", "0.503326", "0.50111085", "0.49953815", "0.49490905", "0.49296597", "0.4923371", "0.4901476", "0.48993343", "0.4895032", "0.48770002", "0.486...
0.8040253
0
>>> list(_domain_variants("foo.bar.example.com")) ['foo.bar.example.com', 'bar.example.com', 'example.com'] >>> list(_domain_variants("example.com")) ['example.com']
def _domain_variants(domain): parts = domain.split('.') for i in range(len(parts), 1, -1): yield ".".join(parts[-i:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_domain_names():\n pass", "def test_url_subdomain(self):\n subdomains = ct.url_subdomain(\"https://www.bad-actor.services/some/url-thats-long?debug=True\")\n assert isinstance(subdomains, list)\n assert len(subdomains) == 1\n subdomains = ct.url_subdomain(\"https://one.two....
[ "0.6952698", "0.66544926", "0.66040504", "0.62473667", "0.6226368", "0.61707515", "0.6165913", "0.61612034", "0.61486536", "0.6146426", "0.611569", "0.60654163", "0.601685", "0.5960854", "0.59547836", "0.5952119", "0.5932257", "0.59269583", "0.5906651", "0.5898534", "0.588539...
0.82758063
0
Return a compiled regex combined (using OR) from a list of ``regexes``. If there is nothing to combine, None is returned.
def _combined_regex(regexes, flags=re.IGNORECASE, use_re2=False, max_mem=None): joined_regexes = "|".join(r for r in regexes if r) if not joined_regexes: return None if use_re2: import re2 return re2.compile(joined_regexes, flags=flags, max_mem=max_mem) return re.compile(joined_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_patterns(patterns: List[str], anchor: Optional[str]):\n start = ending = ''\n if anchor == 'start':\n patterns = [pattern[1:] for pattern in patterns]\n start = '^'\n elif anchor == 'end':\n patterns = [pattern[:-1] for pattern in patterns]\n ...
[ "0.65466833", "0.6543757", "0.6527677", "0.63812244", "0.61269623", "0.6054715", "0.596002", "0.59238464", "0.5843365", "0.5740312", "0.56920046", "0.5609835", "0.55885106", "0.55553985", "0.549249", "0.54539585", "0.5328242", "0.52788854", "0.5275802", "0.5266", "0.5255594",...
0.8088685
0
Test for ``_create_occurrence`` method.
def test_create_occurrence(self): occurrence = self.event._create_occurrence(now()) self.assertEqual(type(occurrence), Occurrence, msg=( 'Method ``_create_occurrence`` did not output the right type.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_occurrence(self):\n pass", "def create_occurrence (self):\n return self.create_topic().create_occurrence(self.create_topic(),\n 'Occurrence')", "def test_create_activity_occurrence(self):\n pass", "def test_get_occurrenc...
[ "0.8785771", "0.77686906", "0.76116455", "0.7607634", "0.74747807", "0.7291894", "0.71222997", "0.65922505", "0.6575502", "0.6573013", "0.65273035", "0.63919514", "0.63775665", "0.6343548", "0.6275129", "0.61557657", "0.5846569", "0.5830806", "0.58046347", "0.56883883", "0.55...
0.87634647
1
Test for instantiation of the ``EventCategory`` model.
def test_instantiation(self): event_category = EventCategory() self.assertTrue(event_category)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create(self):\n self.assertTrue(Category.objects.exists())", "def test_create_category(self):\n pass", "def test_create_cat_object():\n from .scripts.initializedb import create_cat_object\n cat_object = create_cat_object(\"a\", \"b\", \"c\", \"c\")\n assert isinstance(cat_object...
[ "0.6978919", "0.6868121", "0.6853159", "0.65846586", "0.6305626", "0.6129511", "0.61253476", "0.6032864", "0.6030713", "0.6030447", "0.6020336", "0.60164493", "0.5996522", "0.59632874", "0.59564805", "0.59418356", "0.59381324", "0.59206843", "0.5914982", "0.5893996", "0.58798...
0.84762317
0
Test for instantiation of the ``EventRelation`` model.
def test_instantiation(self): event_relation = mixer.blend('calendarium.EventRelation') self.assertTrue(event_relation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_event_model_missing_creator(self):\n with self.assertRaises(ValidationError):\n e = Event(title=self.TITLE)\n e.save()", "def test_create_event_model(self):\n self.assertEqual(Event.objects(creator=self.USER).count(), 0)\n e = self.make_event()\n ...
[ "0.6306186", "0.61655146", "0.61491567", "0.60264367", "0.60044223", "0.5979797", "0.5867465", "0.57903147", "0.5728674", "0.57060075", "0.56505054", "0.5640494", "0.5633782", "0.5602823", "0.55417705", "0.5534599", "0.5491298", "0.54751986", "0.5472967", "0.54422176", "0.542...
0.7707252
0
Test for instantiation of the ``Occurrence`` model.
def test_instantiation(self): occurrence = Occurrence() self.assertTrue(occurrence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_occurrence(self):\n occurrence = self.event._create_occurrence(now())\n self.assertEqual(type(occurrence), Occurrence, msg=(\n 'Method ``_create_occurrence`` did not output the right type.'))", "def test_create_occurrence_without_event(self):\n Occurrence()", "de...
[ "0.7281463", "0.7146957", "0.6939361", "0.6078205", "0.60280645", "0.5968112", "0.5939474", "0.5871335", "0.58672935", "0.58392227", "0.5837775", "0.5699185", "0.5650896", "0.561712", "0.5564759", "0.5489304", "0.5464864", "0.5424573", "0.54069865", "0.53881294", "0.53848237"...
0.78691727
0
Test for the ``delete_period`` function.
def test_delete_period(self): occurrence = mixer.blend('calendarium.Occurrence') occurrence.delete_period('all') self.assertEqual(Occurrence.objects.all().count(), 0, msg=( 'Should delete only the first occurrence.')) event = mixer.blend( 'calendarium.Event', sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_grading_period_accounts(self):\r\n account_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = self.client.delete_grading_period_accounts(id, account_id)", "def test_delete_run(self):\n pass", "def test_delete_grading_period_courses(self):\r\n co...
[ "0.68405896", "0.62481505", "0.623054", "0.61977375", "0.6173269", "0.6088343", "0.60401374", "0.6039505", "0.60198873", "0.60012513", "0.5993746", "0.5993746", "0.5978295", "0.5962423", "0.59286535", "0.59221774", "0.59117955", "0.5903129", "0.59021676", "0.5900351", "0.5898...
0.6884714
0