query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Update rt_import_table with current import table data.
def getImportTableData(self): def imp_cb(ea, name, ord): """ Import enumeration callback function. used by idaapi.enum_import_names . """ tmpImports.append([self.current_module_name, ea, name, ord]) return True # Contains static import table...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_import_and_file(self, import_, request, reupload):\n with transaction.atomic():\n # update all parameters from the request. Since this is a re-upload,\n # and essentially the same as creating a new import, we'll allow\n # redefinition of any user-editable paramet...
[ "0.5915137", "0.58620447", "0.5678288", "0.56135076", "0.55647236", "0.55594844", "0.55472755", "0.5461735", "0.5411304", "0.5343037", "0.5324755", "0.53226554", "0.5316948", "0.53051794", "0.5296203", "0.52784353", "0.5259197", "0.52571213", "0.52548677", "0.52499926", "0.52...
0.5641551
3
Import enumeration callback function. used by idaapi.enum_import_names .
def imp_cb(ea, name, ord): tmpImports.append([self.current_module_name, ea, name, ord]) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_enum_parse(self, ctx):\n return None", "def test_check_enumtype(self):\n self.cursor.execute(self.imp_seg)\n insert = \"\"\"\n INSERT INTO imports.import_segment(\n avancement, statut, id_import)\n VALUES (\n 'Tracé arrêté','VV', 2);\n \"\"\"...
[ "0.5975272", "0.5569344", "0.54526323", "0.5431298", "0.5389418", "0.53656834", "0.5266544", "0.5242703", "0.52237386", "0.510992", "0.5063832", "0.5057315", "0.5028027", "0.50233865", "0.49697566", "0.49682066", "0.49666214", "0.4952617", "0.4941182", "0.4929306", "0.4907129...
0.52747524
6
Find the function location in the IAT table based on its runtime address
def find_func_iat_adrs(self, ea): if ea in self.rt_import_table: (module_name, iat_ea, name, ord) = self.rt_import_table[ea] return iat_ea, module_name return None, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getprocaddress(self, func):\n for _, f, n in self.exports():\n if str(n or '') == func:\n return f\n return None", "def getFunctionAt(self, entryPoint: ghidra.program.model.address.Address) -> ghidra.program.model.listing.Function:\n ...", "def get_function_lo...
[ "0.6508826", "0.64521825", "0.6380106", "0.63773316", "0.6261593", "0.61946326", "0.6187166", "0.61593807", "0.6145786", "0.60551775", "0.59359384", "0.58871233", "0.57870525", "0.5758408", "0.575537", "0.5674694", "0.5614836", "0.55986655", "0.557276", "0.5558949", "0.555036...
0.5854501
12
Checks the given ea and returns True if the function is an imported function (loacted in IAT)
def is_func_imported(self, ea): # If address is located in IAT if ea in self.rt_import_table: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_module(self, ea, mod_name):\n if ea in self.rt_import_table:\n (module, ea, name, ord) = self.rt_import_table[ea]\n if module == mod_name:\n return True\n\n return False", "def is_already_import_function(self, fn):\n if isinstance(fn, basestri...
[ "0.72709537", "0.7194983", "0.67754626", "0.64962727", "0.6480057", "0.6466913", "0.643993", "0.63932014", "0.6297886", "0.6242692", "0.6204381", "0.6190035", "0.6064494", "0.60241413", "0.60094076", "0.59370065", "0.59034634", "0.58287877", "0.58248556", "0.5818206", "0.5816...
0.8698025
0
Check if function at ea is part of the imported module
def is_func_module(self, ea, mod_name): if ea in self.rt_import_table: (module, ea, name, ord) = self.rt_import_table[ea] if module == mod_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_imported(self, ea):\n # If address is located in IAT\n if ea in self.rt_import_table:\n return True\n\n return False", "def is_already_import_function(self, fn):\n if isinstance(fn, basestring):\n for descriptor in self.import_entries:\n ...
[ "0.7575263", "0.7161951", "0.7142891", "0.706428", "0.7060444", "0.6887674", "0.67523146", "0.6639057", "0.6610212", "0.6580285", "0.6576476", "0.65758574", "0.6548188", "0.652603", "0.64948887", "0.6486134", "0.64257395", "0.6387661", "0.6354225", "0.6353084", "0.63428366", ...
0.83145916
0
Check if module has loaded functions in the IAT
def is_loaded_module(self, module_name): for (module, ea, name, ord) in self.rt_import_table.values(): if module == module_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_func_imported(self, ea):\n # If address is located in IAT\n if ea in self.rt_import_table:\n return True\n\n return False", "def is_loaded(self):\n return os.path.exists(IPMIService.IPMI_DEV)", "def module_present(module, load=True):\n with open('/proc/modules',...
[ "0.6796747", "0.67405146", "0.6614088", "0.6595028", "0.6520298", "0.64521915", "0.6437729", "0.63793755", "0.63466257", "0.6292399", "0.62761927", "0.62409914", "0.6231317", "0.61804575", "0.6164748", "0.61443764", "0.60850936", "0.60510194", "0.6034376", "0.6029556", "0.601...
0.69943684
0
Print the debug imports
def print_debug_imports(self): for dbgImp in self.rt_import_table: (module_name, ea, name, ord) = self.rt_import_table[dbgImp] idaapi.msg("ModuleName - %s,\t\tFunctionName - %s,\t\t Address in IAT - %s,\t\t Real address - %s\n" % (module_name, name, hex(ea), hex(db...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printImported():\r\n ll = sorted([mod for mod in sys.modules if mod.find('pubsub') >= 0])\r\n\r\n py2and3.print_('\\n'.join(ll))", "def debug():", "def log_imported_packages(self):\n imported_packages_dict = self.get_imported_packages()\n\n res_str = \"\\n\".join(f\"{module}: {version_n...
[ "0.69145983", "0.68204194", "0.6735605", "0.6709566", "0.6446388", "0.64422834", "0.63457614", "0.6312722", "0.6241582", "0.6180094", "0.6085222", "0.6037665", "0.6033095", "0.600908", "0.5980291", "0.59514123", "0.5940747", "0.59297377", "0.59286475", "0.5924386", "0.59223",...
0.8112144
0
return part of dataframe. google api allows on 100 coordinates in one request
def split_df(data: pd.DataFrame, start: int, stop: int) -> pd.DataFrame: df = data.iloc[start:stop, :].copy() df['coord'] = df.apply(lambda x: f"{x['stopLat']}, {x['stopLon']}", axis=1) return df.sort_values('coord')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGPSrecords(t_start,t_end):\n client=connectionDB()\n query = '''\n select device_id as user,x as lon,y as lat,datetime\n from cadi360-sac.kovid_dev.records\n where datetime>=@t_start and datetime<=@t_end and x!=y and x is not null;\n '''\n job_config = bq.QueryJo...
[ "0.64067936", "0.60682946", "0.6056974", "0.59641236", "0.59271675", "0.587147", "0.58632284", "0.5834412", "0.5827075", "0.5723605", "0.5723053", "0.5699515", "0.56841433", "0.567559", "0.5663438", "0.5655374", "0.5646891", "0.5600372", "0.56001914", "0.5598874", "0.5590615"...
0.5584263
21
return list of splited dataframes
def prepare_stops_to_request(df: pd.DataFrame) -> list: return [split_df(df, i, i + 100) for i in range(0, len(df), 100)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_by_filename(\n df: pd.DataFrame):\n data = namedtuple('data', ['filename', 'object'])\n gb = df.groupby('filename')\n return [data(filename, gb.get_group(x)) for filename, x in zip(gb.groups.keys(), gb.groups)]", "def splitting_df(dataframe):\n dataframe = dataframe.dropna()\n index ...
[ "0.6931345", "0.6758762", "0.6697154", "0.6572435", "0.6540929", "0.640965", "0.6394982", "0.63716984", "0.6367447", "0.63674307", "0.63355523", "0.6308027", "0.62738186", "0.625152", "0.61773694", "0.61694336", "0.61681116", "0.6078391", "0.6028715", "0.6028631", "0.6020443"...
0.66597307
3
requests to google api in loop by splited dataframes
def google_api_request(dfs_splited: list, time: datetime.datetime) -> list: return [get_time_of_travel( ORIGINS_COORD, desttination['coord'].to_list(), time) for desttination in dfs_splited]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data(base_url,\n lista_anni,\n lista_inquinanti):\n \n # Inizializziamo la lista dei df ognuno dei quali corrisponde ad un inquinante\n df_template = pd.DataFrame(columns=['jd','h','1','2','3','4','5','6','7','8','9','10','11','13','14','15','16','38','39','4...
[ "0.6280463", "0.6077709", "0.5982123", "0.5944906", "0.58843803", "0.5806659", "0.57939994", "0.5791003", "0.57313496", "0.5685324", "0.5681774", "0.5666028", "0.5626639", "0.5623092", "0.56218714", "0.55747604", "0.5573529", "0.55312276", "0.5520171", "0.5489067", "0.5487217...
0.5099913
87
extract time from google api answers add results to splited dataframes
def add_times_of_travels(dfs_splited: list, time: datetime.datetime) -> list: results = google_api_request(dfs_splited, time) logger.debug("Ready answer for request") print(results) travel_times = [[i.get('duration', {}).get('value') for i in result['rows'][0]['elements']] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_mql_timeseries_data(response):\n lkeys = response['timeSeriesDescriptor'].get('labelDescriptors', [])\n # (fixme): Is there a better way to fetch and extract this data?\n for result in response.get('timeSeriesData', []):\n data = {}\n lvalues = result.get('labelValues', [])\n ...
[ "0.6128631", "0.56953675", "0.5649638", "0.56355083", "0.56123745", "0.5559543", "0.5550473", "0.5539186", "0.5497718", "0.5465875", "0.54352415", "0.54233277", "0.5397615", "0.53968203", "0.5377205", "0.5354905", "0.5308679", "0.528548", "0.5274197", "0.5265269", "0.5255181"...
0.6170402
0
save data from requests to csv file
def save_times_data(time: datetime.datetime): df = pd.read_csv(STOPS_3CITY, index_col=0) logger.debug("Data readed") dfs_splited = prepare_stops_to_request(df) logger.debug("Dataframe prepared to request") dfs_with_times = add_times_of_travels(dfs_splited, time) logger.debug("Added times of tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_dataset_csv(request):\n\n response = csv_export(request,Dataset)\n return response", "def send_csv_reply(self, request, result, tags):\n request.setHeader('Content-disposition', 'attachment; filename=%s.csv' % \n result[0]['uuid'])\n if tags[0][0]:\n ...
[ "0.6901091", "0.6867677", "0.6726861", "0.6717445", "0.671433", "0.66691685", "0.6638603", "0.6592587", "0.65718293", "0.65369505", "0.6473569", "0.6468159", "0.6452776", "0.6426813", "0.64249146", "0.63594216", "0.63071746", "0.630669", "0.629797", "0.6273114", "0.6273114", ...
0.0
-1
Create a source from path. `cached` flag activates caching. This can be used to optimize performance if no changes are expected on the filesystem after the source was created. This is usually the case with static generation (as opposed to dynamic preview). If `settings.ini` in the source contains `[paths]` section with...
def create_source(path, cached=False): source = FileSource(path) try: config = source.read_config() ap = config.get('paths', 'additional-paths').strip() additional_paths = [_f for _f in ap.split() if _f] except (configparser.NoSectionError, configparser.NoOptionError, IOError): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_path(cls, path):\n if not os.path.exists(path):\n raise ValueError(\"Invalid path: {}\".format(path))\n\n slist = cls()\n for f in glob.glob(path + '/*.fits'):\n slist.append(cls.source_class.from_file(f))\n\n return slist", "def _get_local_src(self, pat...
[ "0.581367", "0.55751705", "0.5530774", "0.5507068", "0.54484135", "0.5272039", "0.52171546", "0.52124417", "0.51219", "0.5066204", "0.50386703", "0.5028943", "0.5028943", "0.5023799", "0.50104564", "0.49704832", "0.49593455", "0.49291563", "0.49159428", "0.4871208", "0.486494...
0.83463293
0
Context manager for keeping the original request data.
def keep_request_data(context): attr_to_value = preserve_attributes( context, [k for k, _ in default_request_data()]) yield restore_attributes(context, attr_to_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_request(self, req):\n req.context = self.make_context(req)", "def _stash_request_info(request, subject_id, method, version):\n request.environ['api.cache.subject_id'] = subject_id\n request.environ['api.cache.method'] = method\n request.environ['api.cache.version'] = versi...
[ "0.7468367", "0.65382993", "0.64844984", "0.6480656", "0.63075584", "0.63048005", "0.62223434", "0.6155639", "0.6112914", "0.6082265", "0.6061507", "0.60148966", "0.5995146", "0.5915906", "0.58799344", "0.5822937", "0.5812772", "0.57544523", "0.57509345", "0.5732875", "0.5718...
0.76473796
0
a decorator to keep a copy of a list of attributes of the context before execute_steps and put the value back aftwards
def keep_attributes(context, *attributes): attr_to_value = preserve_attributes(context, attributes) yield restore_attributes(context, attr_to_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_step(step_impl):\n @functools.wraps(step_impl)\n def wrapped(context, *args, **kwargs):\n with keep_request_data(context):\n returned = step_impl(context, *args, **kwargs)\n return returned\n return wrapped", "def wrappedFn(*args, **kw):\n setCurrent(context)\n f...
[ "0.59297305", "0.5901005", "0.582973", "0.57201135", "0.55795956", "0.55504346", "0.55504346", "0.54695153", "0.5366268", "0.5347289", "0.5329794", "0.5302937", "0.52942616", "0.52918065", "0.52745414", "0.5274194", "0.5261473", "0.52610093", "0.52361965", "0.52287334", "0.52...
0.55476534
7
a decorator for a step definition which keeps the original request data
def clean_step(step_impl): @functools.wraps(step_impl) def wrapped(context, *args, **kwargs): with keep_request_data(context): returned = step_impl(context, *args, **kwargs) return returned return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_impl(context):\n pass", "def step_impl(context):\n pass", "def step(self, func, *args):\n @wraps(func)\n def cached_func(*args):\n \"\"\"Step wise cache function\"\"\"\n try: # fails if cache is not instantiated or if it is None\n value = self....
[ "0.6607942", "0.6607942", "0.6182455", "0.60113436", "0.59532183", "0.58945876", "0.5787957", "0.57758397", "0.57647324", "0.5693262", "0.56900024", "0.5578022", "0.5553434", "0.5513645", "0.5507526", "0.5473006", "0.5470868", "0.54328907", "0.54222167", "0.54109013", "0.5410...
0.78688955
0
Copy the data to different keys and reset the value to default. subsequent steps
def reset_request_data(context): for name, default in default_request_data(): setattr(context, name, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore_default(self):\n self._data = self._default", "def DefaultData():\n return copy.deepcopy(DEFAULT_DATA)", "def reset(self):\n self.data = self._defaults", "def _add_missing_keys(self):\n for k, v in self.defaults.items():\n if k not in self.data:\n ...
[ "0.71549267", "0.68383586", "0.67272043", "0.62640214", "0.62245035", "0.61204815", "0.61100584", "0.60556036", "0.6049608", "0.6048596", "0.6044746", "0.6024124", "0.6011444", "0.6009135", "0.5993145", "0.59137905", "0.5899196", "0.5864622", "0.583439", "0.58194613", "0.5812...
0.60246813
11
Execute steps with the keep_request_data context manager. Useful for calling execute_steps during request build up.
def clean_execute_steps(context, steps_text, save_response_data=None): with keep_request_data(context): context.reset_request_data() context.execute_steps(steps_text) if save_response_data: setattr(context, save_response_data, context.response_object.get('data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_step(step_impl):\n @functools.wraps(step_impl)\n def wrapped(context, *args, **kwargs):\n with keep_request_data(context):\n returned = step_impl(context, *args, **kwargs)\n return returned\n return wrapped", "def handle_execution(self, data, *args, **kwargs):\n ...
[ "0.62266123", "0.51828146", "0.51828146", "0.51276684", "0.5112461", "0.5001797", "0.49459624", "0.49085695", "0.48658034", "0.48318595", "0.47813115", "0.4757837", "0.47547454", "0.4702506", "0.47013927", "0.46367842", "0.46156824", "0.46095034", "0.46075216", "0.4599945", "...
0.6666166
0
Executes the code before all the tests are run
def before_all(context): set_services(context) context.api = {} context.repositories = {} for service, location in context.services.items(): url = urlparse.urlparse(location) api = API(url.scheme + '://' + url.netloc, async=False) try: context.api[service] = getattr(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_run_tests(cls):\n pass", "def do_before(self):\r\n pass", "def setUp(self):\r\n print('---------------------------------------------\\n')\r\n print('STARTING TEST...')", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "de...
[ "0.8087113", "0.7518904", "0.7508176", "0.7462158", "0.7369487", "0.73578703", "0.7343755", "0.7340046", "0.7339334", "0.7284059", "0.72680444", "0.7267455", "0.72261834", "0.71994185", "0.71851027", "0.71804404", "0.71804404", "0.71801525", "0.7139647", "0.7138644", "0.71386...
0.0
-1
Generate a version number string from the specified parts
def generate_version(parts): version = '.'.join([str(part) for part in parts[0:2]]) if len(parts) > 3: version += parts[3] if len(parts) > 4: version += str(parts[4]) return version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_version(self, version, num_of_digits):\n version = \"{}\".format(version).replace(\".\", \"\").replace(\" \", \"\").strip()\n num_of_digits_to_add = (num_of_digits - len(version))\n version += (\"0\" * num_of_digits_to_add)\n version = int(version)\n return version", ...
[ "0.73418146", "0.71678543", "0.7095713", "0.69950414", "0.6820756", "0.67819726", "0.6705109", "0.66558605", "0.6654782", "0.6620144", "0.65936625", "0.6525427", "0.652354", "0.6509772", "0.650463", "0.64316434", "0.64076847", "0.6388761", "0.63629085", "0.63157195", "0.63157...
0.8655365
0
is_compatible_with(same_version) should return True
def test_equal(scraper): assert scraper.is_compatible_with(punters_client.__version__) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_compatible_version(self, version: str) -> bool:\n return compatible_go_version(compiler_version=self.version, target_version=version)", "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version...
[ "0.76063025", "0.73663646", "0.7263448", "0.7193975", "0.70702976", "0.7024495", "0.7013835", "0.69321775", "0.6871281", "0.68417925", "0.67524064", "0.67198217", "0.665712", "0.6595801", "0.65513986", "0.65497744", "0.6530806", "0.65013665", "0.64934397", "0.6492665", "0.647...
0.6841602
10
is_compatible_with(new_major_version) should return False
def test_major(scraper, version_parts): new_version_parts = list(version_parts) new_version_parts[0] = int(new_version_parts[0]) + 1 assert scraper.is_compatible_with(generate_version(new_version_parts)) is False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.7419889", "0.72994316", "0.7186177", "0.7178467", "0.7003777", "0.6935396", "0.69221586", "0.68922585", "0.68405575", "0.68239206", "0.6777351", "0.6765998", "0.6757105", "0.6688952", "0.66813433", "0.6674605", "0.66677177", "0.66594785", "0.6655677", "0.65978026", "0.6574...
0.7109872
4
is_compatible_with(new_minor_version) should return True
def test_minor(scraper, version_parts): new_version_parts = list(version_parts) new_version_parts[1] = int(new_version_parts[1]) + 1 assert scraper.is_compatible_with(generate_version(new_version_parts)) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.7431041", "0.7178158", "0.7127145", "0.703042", "0.6996341", "0.69099504", "0.6851447", "0.6850589", "0.6769176", "0.6769176", "0.6756499", "0.6756499", "0.6756499", "0.6756499", "0.6734679", "0.6699222", "0.66385555", "0.6627716", "0.66248006", "0.66018736", "0.65530646",...
0.72599
1
is_compatible_with(new_patch_version) should return True
def test_patch(scraper, version_parts): new_version_parts = list(version_parts) new_version_parts[2] = int(new_version_parts[2]) + 1 assert scraper.is_compatible_with(generate_version(new_version_parts)) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compatible_version(self):\n note_version = self.py_version\n py_version = sys.version_info\n if note_version[0] != py_version[0]:\n return False\n if len(note_version) > 1 and note_version[1] > py_version[1]:\n return False\n return True", "def python_...
[ "0.71203923", "0.709437", "0.7029229", "0.6806851", "0.6690878", "0.6670734", "0.6650424", "0.66464555", "0.6637667", "0.66017705", "0.65836996", "0.65563416", "0.65185434", "0.64751756", "0.64673984", "0.64471287", "0.6443312", "0.64148366", "0.6394978", "0.6340778", "0.6311...
0.7072563
2
is_compatible_with(new_pre_release_version) should return True
def test_pre_release(scraper, version_parts): new_version_parts = list(version_parts) if len(new_version_parts) > 4: new_version_parts[4] = int(new_version_parts[4]) + 1 elif len(new_version_parts) > 3: new_version_parts.append(1) else: new_version_parts.extend(['a', 1]) as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.69594973", "0.69137317", "0.68093014", "0.68081164", "0.6790292", "0.67893136", "0.6782805", "0.6780227", "0.6761403", "0.6713203", "0.6705038", "0.6672537", "0.6574082", "0.6568607", "0.6520334", "0.65041685", "0.6493881", "0.64645916", "0.64434403", "0.6436773", "0.64286...
0.7485356
0
Plays FizzBuzz. Prints Fizz if number is a multiple of 3. Prints Buzz if its a multiple of 5. Prints FizzBuzz if its a multiple of both 3 and 5 or 15. Else Prints The Number Itself. >>> fizz_buzz(1,7) '1 2 Fizz 4 Buzz Fizz 7 ' >>> fizz_buzz(1,0)
def fizz_buzz(number: int, iterations: int) -> str: if not isinstance(iterations, int): raise ValueError("iterations must be defined as integers") if not isinstance(number, int) or not number >= 1: raise ValueError( """starting number must be and integer and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizz_buzz(num):\n \n if ((num%3 == 0) and (num%5 == 0)):\n print(\"fizzbuzz\")\n elif num%3 == 0:\n print(\"fizz\")\n elif num%5 == 0:\n print(\"buzz\")\n else:\n print(num)", "def fizz_buzz(number: int):\n if number % 3 == 0 and number % 5 == 0:\n return ...
[ "0.8507365", "0.8470485", "0.8325514", "0.8104233", "0.79256225", "0.765522", "0.764915", "0.7628422", "0.7582326", "0.7572446", "0.7536319", "0.74917835", "0.7278464", "0.7265207", "0.7253029", "0.7226124", "0.7212974", "0.69019777", "0.6897921", "0.68879646", "0.66973746", ...
0.74849206
12
Checks if the string representation of i has a palindrome.
def has_palindrome(i, start, length): s = str(i)[start:start+length] return s[::-1] == s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_palindrome(s):\n return s[::-1] == s", "def is_palindrome_v1(s):\n return reverse(s) == s", "def isPalindrome(s):\r\n return isPal(toChars(s))", "def isPalindrome(string):\n for i in range(len(string)//2):\n if string[i] != string[(i*-1)-1]:\n return False\n return ...
[ "0.8114155", "0.8076034", "0.806918", "0.80685186", "0.8034092", "0.8011662", "0.7984324", "0.79701346", "0.7967069", "0.7956594", "0.7931917", "0.7908397", "0.787151", "0.7822591", "0.7818453", "0.78144264", "0.7814022", "0.78086764", "0.774382", "0.77328235", "0.77241296", ...
0.79356164
10
Checks if the integer (i) has the desired properties.
def check(i): return (has_palindrome(i, 2, 4) and has_palindrome(i+1, 1, 5) and has_palindrome(i+2, 1, 4) and has_palindrome(i+3, 0, 6))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, i):\n return self.__qp[i] != -1", "def isAttribute(self, p_int): # real signature unknown; restored from __doc__\n return False", "def checkIfThereIsData(self, i):\n _, amountOfThings = self.weaviate.Get(\"/\" + i)\n if len(amountOfThings[i]) == 0:\n re...
[ "0.5835308", "0.574011", "0.57373244", "0.5660355", "0.5572718", "0.5551574", "0.553951", "0.5532166", "0.5510792", "0.55001837", "0.5464281", "0.54312027", "0.54216486", "0.5411652", "0.53876966", "0.53804594", "0.5376361", "0.5373734", "0.5371286", "0.53499705", "0.5319617"...
0.0
-1
Enumerate the sixdigit numbers and print any winners.
def check_all(): i = 100000 while i <= 999996: if check(i): print(i) i = i + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eg_six():\n\n for rx in (stats.tiles(stats.scottKnot([creation.RX([101, 100, 99, 101, 99.5, 101, 100, 99, 101, 99.5], \"rx1\"), creation.RX([101, 100, 99, 101, 100, 101, 100, 99, 101, 100], \"rx2\"), creation.RX([101, 100, 99.5, 101, 99, 101, 100, 99.5, 101, 99], \"rx3\"), creation.RX([101, 100, 99, 101, 10...
[ "0.6002012", "0.5909295", "0.58463585", "0.5792474", "0.5789559", "0.57514817", "0.5671586", "0.5595201", "0.55814606", "0.5575328", "0.5573297", "0.5567866", "0.5508778", "0.5494734", "0.54946303", "0.5463247", "0.5457922", "0.54554546", "0.5450795", "0.5441073", "0.542757",...
0.4983409
99
Create a kame object, at the goku's current position.
def __init__(self, ai_settings, screen, goku): super(Kame, self).__init__() self.screen = screen # Create kame rect at (0, 0), then set correct position. self.image = pygame.image.load('kame.bmp') self.rect = self.image.get_rect() self.rect.centerx = goku.rect.cen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, pos):\n self.pos = pos", "def create_new_game(self):\r\n global game_instance\r\n game_instance = game.Game()\r\n game_instance.set_word(db.get_random_word())\r\n print(\"\\n---------NEW GAME---------\")\r\n self.current_word = \"----\"", "def new_object(s...
[ "0.6158132", "0.56564254", "0.5597445", "0.5542725", "0.5536095", "0.547559", "0.5472001", "0.54485244", "0.54428244", "0.54231924", "0.5421016", "0.53994715", "0.53900766", "0.5383519", "0.53785133", "0.53648984", "0.53644687", "0.53632104", "0.5360074", "0.5340445", "0.5326...
0.6344389
0
Move the kame up the screen.
def update(self): # Update the decimal position of the kame. self.y -= self.speed_factor # Update the rect position. self.rect.y = self.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_up(self):\n if self.center.y < (self.screen_height - (self.height / 2)):\n self.center.y += 5", "def move_up(self):\n self.move_step(-1)", "def up(self):\n self.move(0, 1)", "def move_up(self):\n self.move_measurement(-1)", "def move_up(self):\n #if us...
[ "0.8090584", "0.79983824", "0.79516095", "0.7819243", "0.780271", "0.77326506", "0.7703528", "0.761254", "0.7515465", "0.74919164", "0.74353284", "0.7427749", "0.74245286", "0.7419067", "0.72939706", "0.71948296", "0.71851563", "0.71603477", "0.71450174", "0.71259904", "0.709...
0.0
-1
Draw the kame to the screen.
def draw_kame(self): #pygame.draw.rect(self.screen, self.color, self.rect, self.image) self.screen.blit(self.image, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, screen):", "def draw():", "def draw(self):\n\n State.screen.draw()", "def draw(self):\n self.screen.fill(BACKGROUND_COLOR)\n self.cannon.draw(self.screen)\n self.objects.draw(self.screen)", "def draw():\n screen.fill((0, 0, 0))\n alien.draw()", "def draw(sel...
[ "0.8225329", "0.7920574", "0.78136766", "0.77745014", "0.7760726", "0.76907307", "0.7579652", "0.75666505", "0.75666505", "0.75666505", "0.75666505", "0.7559235", "0.75204027", "0.75066805", "0.7476456", "0.74355596", "0.7426095", "0.7424709", "0.7421482", "0.7412151", "0.740...
0.8383208
0
Calculate Maximum Depth From Point Cloud
def fus_points2depth(points): max_z = 0.0 min_z = 0.0 for point in points: if point[2] > max_z: max_z = point[2] if point[2] < min_z: min_z = point[2] return abs(max_z-min_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_depth_val():\n data = SUNRGBDTrainDataset(True)\n return max([data[0][i][-1].flatten().item() for i in range(len(data))])", "def get_max_dmag_from_depth(depth):\n return 2.5 * np.log10(depth)", "def convert_pointcloud_to_depth(pointcloud, camera_intrinsics):\r\n\r\n\tassert (pointcloud.sha...
[ "0.71776944", "0.6876848", "0.66646206", "0.637755", "0.6343945", "0.63234144", "0.62752146", "0.61729157", "0.61499417", "0.6110589", "0.6092262", "0.60468256", "0.6045397", "0.6032402", "0.6016253", "0.60043883", "0.5986041", "0.5979987", "0.5952362", "0.59416324", "0.59258...
0.69405186
1
Connect the samples and plot the results.
def test_and_plot_results(self, end, nb_samples): self.test(end, nb_samples) self.plot_results()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_and_plot(self):\n fig = plt.figure()\n ax = plt.axes(projection = '3d')\n ax.plot_surface(self.X, self.Y, self.sample(), cmap = plt.cm.jet, rstride = 2, cstride = 2, linewidth = 1)\n plt.show()", "def sample_plot(self, sample_pre, sample_post, circle_size=10.0):\n co...
[ "0.6899476", "0.6625663", "0.6500045", "0.64235145", "0.64233994", "0.638161", "0.6358623", "0.6316563", "0.626138", "0.62011486", "0.6196088", "0.618245", "0.6165358", "0.604993", "0.60285133", "0.6001211", "0.59983706", "0.5995903", "0.5995727", "0.59925264", "0.5990759", ...
0.5982989
21
Generate nb_samples random states in the state space and tries to them to the same end state. Then generate calcultation and trajectory times and euclidian distance.
def test(self, end, nb_samples): samples = self.irepa.sample(nb_samples) print('Start in 2 seconds') time.sleep(2) for i, state in enumerate(samples): sys.stdout.write("\r{}%".format( round(100*float(i)/len(samples), 0))) sys.stdout....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_sample_from_state(self, state):\n\n res = []\n for e in range(self.n_emissions):\n cdf = np.cumsum(self.B[e][state, :])\n res.append((cdf > np.random.rand()).argmax())\n return np.asarray(res)", "def random_state(\n shape=(50, 50),\n time_ste...
[ "0.66748285", "0.6663933", "0.6628541", "0.65802824", "0.6540975", "0.6481998", "0.6442309", "0.6438231", "0.6438231", "0.6406305", "0.6406305", "0.6398187", "0.6374575", "0.63287216", "0.631714", "0.6289932", "0.6271172", "0.62309885", "0.6224919", "0.6224919", "0.6224919", ...
0.56092185
81
Generate some random tweet text.
def mock_tweet(): count = random.randint(70, 140) return ''.join([random.choice(string.letters) for i in xrange(count)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomePlainText():\n randomPlainTextArray = [random.choice('0123456789abcdef')\n for n in range(24)]\n randomPlainText = \"\".join(randomPlainTextArray)\n return randomPlainText", "def create_random_text(word_count=10):\n sample_text_lst = TEXT_BASE_RUS.replace...
[ "0.7336123", "0.72017545", "0.69617206", "0.6955046", "0.6792115", "0.6696469", "0.66487026", "0.66219026", "0.6560906", "0.6504597", "0.6492525", "0.6492525", "0.6491351", "0.64229876", "0.63740075", "0.6317993", "0.63130176", "0.6288164", "0.62670004", "0.62655485", "0.6264...
0.7941552
0
truven 1. multihot feature list of list
def Create_truven(object): def __init__(self, is_train = True, **config): print(2) pass ''' self.is_train = is_train filename = config['train_file'] if is_train else config['test_file'] batch_size = config['batch_size'] self.admis_dim = config['input_dim'] self.max_length = config['max_length'] wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_multilabel_as_multihot(label_list,label_size):\n result=np.zeros(label_size)\n #set those location as 1, all else place as 0.\n result[label_list] = 1\n return result", "def transform_multilabel_as_multihot(label_list,label_size):\n result=np.zeros(label_size)\n #set those locatio...
[ "0.712355", "0.712355", "0.6953274", "0.6635199", "0.65758747", "0.64931434", "0.64726764", "0.6445082", "0.64443076", "0.6413668", "0.64002377", "0.6397476", "0.63867146", "0.6245102", "0.62362224", "0.62224424", "0.6177844", "0.6135584", "0.6131204", "0.6109852", "0.6075764...
0.0
-1
Shows basic usage of the Gmail API. Lists the user's Gmail labels.
def main(): token = 'C:/Users/asif.rouf/PycharmProjects/pythonProject/AX_Admin_portal/Test/utils/google-api-token.json' credential = 'C:/Users/asif.rouf/PycharmProjects/pythonProject/AX_Admin_portal/Test/utils/google-api-credentials.json' creds = None # The file token.json stores the user's access and r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels():\n\n logging.info(\"Getting metadata about labels\")\n\n labels = []\n\n if len(args.labels) == 0:\n logging.warning(\"No labels specified, assuming all labels. If you have a lot of labels in your inbox you could hit API limits quickly.\")\n results = GMAIL_CLIENT.users().la...
[ "0.6945762", "0.679617", "0.6724848", "0.6434719", "0.6335645", "0.6275607", "0.6236837", "0.57496095", "0.5672538", "0.55909437", "0.5572119", "0.55695736", "0.5569079", "0.55664", "0.555801", "0.5552047", "0.549878", "0.5496704", "0.54652035", "0.54633766", "0.5420082", "...
0.5508061
16
POSTs the updated properties for a ZFS object to the webservice. zfsobjs is a list of AbstractZFS objects hostname is the hostname of this computer server is the zfs monitor server's hostname
def post_update(zfsobjs, hostname=HOSTNAME, server=ZFSMON_SERVER): ZFS_LOG = logging.getLogger("zfsmond.http") updated = dict() snapshots = False for obj in zfsobjs: # Check if this is a pool or a dataset, and POST to the appropriate resource if obj.type == 'pool': rescollect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def salesforce_collection_update(self, objects):\n for obj in objects:\n assert obj[\n \"id\"\n ], \"Should be a list of objects with Ids returned by Salesforce Collection Insert\"\n if STATUS_KEY in obj:\n del obj[STATUS_KEY]\n\n assert ...
[ "0.5676521", "0.5214823", "0.4971102", "0.4907723", "0.48414955", "0.47924596", "0.4694975", "0.46478626", "0.4644769", "0.4640716", "0.4635108", "0.4612122", "0.4593009", "0.45898503", "0.45867512", "0.45853955", "0.45830682", "0.45690647", "0.4535591", "0.45307365", "0.4529...
0.73352444
0
Gets the active ZFS pools by calling `zpool list` and parsing the output. Returns a list of ZPool objects populated with the properties returned by zpool list H o all.
def get_pools(): poolinfostr = fork_and_get_output("zpool list -H -o all".split()) header = get_zpool_header() poolinfo = poolinfostr.splitlines() poolobjs = [] for poolstr in poolinfo: poolobjs.append(DataZFS(poolstr, header, 'pool')) return poolobjs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pools():\n command = 'zpool list -H'\n try:\n p = subprocess.Popen(command.split(' '), stdout=subprocess.PIPE)\n except OSError:\n raise Exception('No ZFS tools found!')\n zpout, zperr = p.communicate()\n if p.returncode:\n raise Exception(\"Error executing '%s': %d\" % ...
[ "0.80878156", "0.73042035", "0.7050812", "0.67753637", "0.66770947", "0.65869814", "0.6562786", "0.6554524", "0.64835596", "0.644007", "0.6365196", "0.6321016", "0.62798274", "0.6219247", "0.619906", "0.6135923", "0.6128194", "0.6082088", "0.60160434", "0.59826976", "0.597930...
0.84037024
0
Gets the active ZFS mounted filesystems by calling `zfs list` and parsing the output.
def get_datasets(FIELDS='all'): dsinfostr = fork_and_get_output("zfs list -H -o {0}".format(FIELDS).split()) header = get_zfs_ds_header() dsinfo = dsinfostr.splitlines() dsobjs = [] for dsstr in dsinfo: dsobjs.append(DataZFS(dsstr, header, 'dataset')) return dsobjs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mounts(self):\n return [m.split()[0] for m in self.xlist(\"get-mounts\")[1]]", "def mounts(self) -> list[str]:\n _args: list[Arg] = []\n _ctx = self._select(\"mounts\", _args)\n return _ctx.execute_sync(list[str])", "def fs_get_disk_list(self):\n\t\treturn Job(SDK.PrlSrv_FsG...
[ "0.68106353", "0.6750382", "0.65955144", "0.65537035", "0.6542032", "0.61288875", "0.612883", "0.61275744", "0.61085606", "0.6083076", "0.60523486", "0.6024202", "0.60162604", "0.60019654", "0.59784144", "0.59784144", "0.59640676", "0.58309805", "0.5808027", "0.57728165", "0....
0.0
-1
Gets the snapshot history for each filesystem.
def get_snapshots(FIELDS='all'): snapinfostr = fork_and_get_output("zfs list -t snapshot -H -o {0}".format(FIELDS).split()) header = get_zfs_snap_header() snapinfo = snapinfostr.splitlines() snapobjs = [] for snapstr in snapinfo: snapobjs.append(DataZFS(snapstr, header, 'snapshot')) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(self) -> List[SnapshotLogEntry]:\n return self.metadata.snapshot_log", "def get_history(cls, api, history):\n api_base = api.split('/')[-1]\n cursor = cls.history_index.cursor()\n cursor.execute(\n \"select filename from history where api=? and ymdh=?;\",\n ...
[ "0.7113116", "0.65943146", "0.63602525", "0.62651694", "0.6222953", "0.6212407", "0.62096435", "0.6189401", "0.612036", "0.60395813", "0.60019016", "0.5997727", "0.5913819", "0.5906997", "0.5905802", "0.5893282", "0.5885002", "0.58840567", "0.587063", "0.58678246", "0.5860876...
0.6106158
9
Gets the status of each zpool by calling `zpool status` and and parsing the output.
def get_pool_status(): pools_status = split_status_pools(fork_and_get_output("zpool status".split())) pools = [] for p in pools_status: pools.append(status.PoolStatus(p)) return pools
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zpool_status(p):\n # Input file\n f = '/'.join([p, 'zfs/zpool-status-dv.out'])\n check_path(f)\n\n status = {}\n\n # Match empty lines\n empty = re.compile('^\\s*$')\n\n # Match multiple underscores\n underscore = re.compile('^__')\n\n # Match dashes\n dash = re.compile('^--')\n\n...
[ "0.7154575", "0.63748884", "0.63549304", "0.6191073", "0.61175615", "0.60634863", "0.59149086", "0.5862941", "0.58497596", "0.5841862", "0.58097893", "0.5675924", "0.5670489", "0.5643654", "0.55874443", "0.5561089", "0.5522858", "0.55055994", "0.54882914", "0.54734266", "0.54...
0.82554597
0
Our model_fn for ResNet to be used with our Estimator.
def resnet_model_fn(features, labels, mode, params): tf.summary.image('images', features, max_outputs=6) network = resnet_model.imagenet_resnet_v2( params['resnet_size'], _LABEL_CLASSES, params['data_format']) if params['optimizer'] == 'kfac': with kfac_layer_collection() as lc: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _model_fn(features, labels, mode, config):\n return _transformer_model_fn(\n features=features,\n labels=labels,\n mode=mode,\n head=head_lib._regression_head_with_mean_squared_error_loss(\n label_dimension=label_dimensio...
[ "0.7539371", "0.7372965", "0.73378205", "0.7212622", "0.7001108", "0.69828886", "0.69495374", "0.69107336", "0.68893576", "0.686631", "0.68361133", "0.67221636", "0.6690993", "0.6689671", "0.6683788", "0.66071296", "0.6598074", "0.65847665", "0.6500494", "0.64868957", "0.6433...
0.60793436
45
Check if this is the 'max context' doc span for the token. Because of the sliding window approach taken to scoring documents, a single token can appear in multiple documents.
def _check_is_max_context(doc_spans, cur_span_index, position): best_span_index = get_best_span_index(doc_spans, position) return cur_span_index == best_span_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_is_max_context(doc_spans, cur_span_index, position):\n\n # Because of the sliding window approach taken to scoring documents, a single\n # token can appear in multiple documents. E.g.\n # Doc: the man went to the store and bought a gallon of milk\n # Span A: the man went to the\n # Spa...
[ "0.81666505", "0.81666505", "0.80861664", "0.76825464", "0.7549702", "0.7522705", "0.6171613", "0.59147215", "0.56549305", "0.5647985", "0.5500991", "0.5489646", "0.54532236", "0.5427922", "0.5393629", "0.53854585", "0.5348451", "0.5320114", "0.52660835", "0.52506053", "0.525...
0.7938717
3
For a particular position, identify which doc_span gives the most context around token Helper function for _check_is_max_context; see _check_is_max_context for more details
def get_best_span_index(doc_spans, position): best_score = None best_span_index = None for (span_index, doc_span) in enumerate(doc_spans): end = doc_span.start + doc_span.length - 1 if position < doc_span.start: continue if position > end: continue num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_is_max_context(doc_spans, cur_span_index, position):\n # Because of the sliding window approach taken to scoring documents, a single\n # token can appear in multiple documents. E.g.\n # Doc: the man went to the store and bought a gallon of milk\n # Span A: the man went to the\n # Span B...
[ "0.8147791", "0.8138653", "0.8138653", "0.79635817", "0.7945915", "0.79245776", "0.7805608", "0.61704695", "0.593335", "0.5877751", "0.5864793", "0.58527213", "0.5708804", "0.5672883", "0.56393576", "0.563058", "0.5599426", "0.5517616", "0.55091864", "0.54559445", "0.54369414...
0.67853326
7
Split on whitespace so that different tokens may be attributed to their original position.
def split_into_words(context_text): doc_tokens = [] char_to_word_offset = [] prev_is_whitespace = True for c in context_text: if is_whitespace(c): prev_is_whitespace = True else: if prev_is_whitespace: doc_tokens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_whitespace_tokens(line):\n in_quote = False\n token = \"\"\n token_start = 0\n for i, char in enumerate(line):\n if char == ' ':\n if len(token) > 0:\n yield (token_start, token)\n token = \"\"\n else:\n if len(token) == 0:\n ...
[ "0.7045275", "0.7043285", "0.6918881", "0.6867487", "0.6867487", "0.6867487", "0.6785408", "0.65652114", "0.6562608", "0.6476699", "0.6449644", "0.6437914", "0.6350325", "0.63445187", "0.628646", "0.626875", "0.6266772", "0.62245923", "0.622136", "0.618018", "0.6175212", "0...
0.62430656
17
Some features are obtained from hashmap to reduce CPU memory use
def __getitem__(self, idx): feature = self.features[idx] if self.mode == INFERENCE_MODE: return ( np.array(feature.input_ids), np.array(self.segment_mask_id_to_segment_mask[feature.segment_ids]), np.array(self.input_mask_id_to_input_mask[featur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}", "def _extract_features(self, times):\n times[1] = time()\n data = {n:self._extract_feature(f) for (n,f) in self.features.items()} \n times[2] = time()\...
[ "0.6999594", "0.69160664", "0.65042967", "0.64083487", "0.62740165", "0.61803263", "0.6055717", "0.6055717", "0.5988632", "0.59712344", "0.59592384", "0.59561235", "0.59530663", "0.59529215", "0.5922952", "0.5921372", "0.5908347", "0.58759946", "0.5870978", "0.5823859", "0.58...
0.0
-1
Get docspans which are sliding window spans from a document
def get_docspans(all_doc_tokens, max_tokens_for_doc, doc_stride): _DocSpan = collections.namedtuple("DocSpan", ["start", "length"]) doc_spans = [] start_offset = 0 while start_offset < len(all_doc_tokens): length = len(all_doc_tokens) - start_offset if length > ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_windows(doc, hws=5):\n length = len(doc)\n assert length > 2*hws, 'doc is too short!'\n\n inside = [(w, doc[(i - hws):i] + doc[(i + 1):(i + hws + 1)]) for i, w in enumerate(doc[hws:-hws], hws)]\n\n # for words that are near the beginning or\n # the end of a doc tuples are slightly different\...
[ "0.6421841", "0.6292646", "0.61049014", "0.605424", "0.586118", "0.5850682", "0.58369684", "0.5816199", "0.57881117", "0.5637001", "0.56275266", "0.5521826", "0.5488609", "0.5459688", "0.5427386", "0.5427386", "0.5425122", "0.5402091", "0.540079", "0.53969455", "0.5393235", ...
0.6968376
0
Check if there is sufficient memory to prevent system from being unresponsive Otherwise system can become unresponsive as memory is slowly filled up, possibly leading to system unable to kill process Interrupts run if CPU memory use is more than 75%, to leave some capacity for model loading
def check_if_sufficient_memory(): percent_memory = psutil.virtual_memory().percent if percent_memory > 75: raise ValueError('Please use a device with more CPU ram or a smaller dataset')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_out_of_memory(self) -> bool:\n return pulumi.get(self, \"device_out_of_memory\")", "def stop_loading(self):\n return psutil.virtual_memory()[2] >= self.max_memory", "def stop_loading(self):\n return psutil.virtual_memory()[2] >= self.max_memory", "def memory_check(self) -> boo...
[ "0.7235018", "0.6932394", "0.6932394", "0.69066733", "0.68662536", "0.6822102", "0.6819577", "0.68071353", "0.678367", "0.655549", "0.65075845", "0.6478597", "0.64649934", "0.64479524", "0.6308393", "0.6290874", "0.6234317", "0.6231586", "0.6203869", "0.61822873", "0.6178238"...
0.7906733
0
Find distance between doc_span and answer_span to determine if doc_span is likely to be useful for the answer Helper function to filter out doc_spans that may not be helpful
def get_average_dist_to_tok_start_and_end(doc_span, tok_start_position, tok_end_position): center_answer = (tok_start_position + tok_end_position) // 2 dist_to_start = abs(doc_span.start - center_answer) dist_to_end = abs(doc_span.start + doc_span.length - 1 - center_answer) return (dist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, orig_answer_text):\n tok_answer_text = \" \".join(tokenizer.tokenize(orig_answer_text))\n\n for new_start in range(input_start, input_end + 1):\n for new_end in range(input_end, new_start - 1, -1):\n text_span = \" \".j...
[ "0.69372", "0.689471", "0.68938667", "0.6884405", "0.6841682", "0.5997177", "0.58838403", "0.5759059", "0.5718888", "0.5689685", "0.5618187", "0.56090003", "0.5574064", "0.55383235", "0.55383235", "0.5473617", "0.5470104", "0.5465339", "0.5443799", "0.5420908", "0.53889644", ...
0.5417549
20
Filters out doc_spans, which might not be relevant to answering question, which can be helpful when document is extremely long leading to many doc_spans with no answers
def keep_relevant_docspans(doc_spans, tok_start_position, tok_end_position, mode): if mode == 'all': return doc_spans elif mode == 'only_positive': if tok_start_position in [-1, None] or tok_end_position in [-1, None]: return [] else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_invalid_sents(doc):\n def is_valid(sent):\n tag_counts = Counter([pos[0] for pos in sent['pos_tags']])\n num_subjects = tag_counts['NOUN'] + tag_counts['PROPN'] \\\n + tag_counts['PRON']\n num_predicates = tag_counts['VERB'] + tag_counts['AUX']\n comp...
[ "0.62472975", "0.5847748", "0.583575", "0.57769537", "0.57591414", "0.57234687", "0.56612074", "0.5646727", "0.56322473", "0.55924857", "0.55790424", "0.5574625", "0.55640864", "0.5542045", "0.55394304", "0.55327314", "0.5477125", "0.54676485", "0.5460647", "0.54581726", "0.5...
0.71136427
0
Loads a data file into a list of `InputBatch`s.
def convert_examples_to_features( self, examples: List[object], tokenizer: object, max_seq_length: int, doc_stride: int, max_query_length: int, has_groundtruth: bool, ): unique_id = 1000000000 features = [] text_to_tokens_dict = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LoadBatch(filename):", "def load_batch(fpath, label_key='labels'):\n f = open(fpath, 'rb')\n if sys.version_info < (3,):\n d = cPickle.load(f)\n else:\n d = cPickle.load(f, encoding='bytes')\n # decode utf8\n d_decoded = {}\n for k, v in d.items():\n d_d...
[ "0.7116717", "0.6971949", "0.6867253", "0.66187465", "0.65909564", "0.6522058", "0.6507134", "0.6502703", "0.6472176", "0.64224887", "0.64197946", "0.64197946", "0.6409885", "0.6405037", "0.638099", "0.6297901", "0.62916416", "0.6273321", "0.6232164", "0.6228044", "0.62100035...
0.0
-1
Computes the exact and f1 scores from the examples and the model predictions
def get_raw_scores(self, preds: Dict[str, str]): exact_scores = {} f1_scores = {} for example in self.examples: qas_id = example.qas_id gold_answers = [answer["text"] for answer in example.answers if normalize_answer(answer["text"])] if not gold_answers: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f1_score_model(self, model, X, y):\n\n prediction = model.predict_classes(X)\n f1_macro = f1_score(y, prediction, average='macro')\n f1_micro = f1_score(y, prediction, average='macro')\n print(\"f1_macro: \", f1_score(y, prediction, average='macro'))\n print(\"f1_micro: \", f...
[ "0.7489836", "0.7446351", "0.73071194", "0.71985704", "0.7156627", "0.7144628", "0.7108001", "0.7088692", "0.7040526", "0.69682926", "0.6933514", "0.68788725", "0.6875764", "0.6874872", "0.68435127", "0.6840598", "0.6836643", "0.6836643", "0.68322575", "0.6823149", "0.6802116...
0.66141135
54
Saves the passed posts object in a file.
def save_posts(posts): with open(FILE_NAME, 'wb') as f: pickle.dump(posts, f, pickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_post(name, elements, status, current_section):\n\n try:\n\n # dealing with Posts\n if status == 4:\n extract_and_write_posts(elements, name)\n return\n\n except:\n print(\"Exception (save_to_file)\", \"Status =\",\n str(status), sys.exc_info()[...
[ "0.72536314", "0.638276", "0.6335936", "0.6335127", "0.6221393", "0.6173248", "0.61729234", "0.6126923", "0.6124318", "0.6120573", "0.6114257", "0.610687", "0.60994494", "0.6076865", "0.6076818", "0.60569996", "0.6044865", "0.60265523", "0.60211146", "0.60089844", "0.60016584...
0.76258934
0
Reads and returns the saved posts from file.
def load_posts(): with open(FILE_NAME, 'r') as f: return pickle.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_post_to_file(country_name: str, post: dict, data_path: str, order: int):\n\n logging.info(f\"[READ POST] Reading post\")\n\n raw_title = post['title']['rendered']\n raw_content = post['content']['rendered']\n\n cleaned_title = clean_html(raw_title)\n cleaned_content = clean_html(raw_content...
[ "0.6364917", "0.6275716", "0.6200789", "0.60762805", "0.5990724", "0.592687", "0.58093065", "0.5789136", "0.5750821", "0.5750821", "0.5740415", "0.5698358", "0.5657045", "0.5597588", "0.5574151", "0.5571945", "0.5571484", "0.5565915", "0.55373085", "0.55215144", "0.5486186", ...
0.7953246
0
Queries the Product Hunt API, sorts and returns the list of posts.
def get_todays_posts(): return sorted(requests.get(TODAY_URL).json()['hunts'], key=lambda post: post['rank'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_posts():\n url = app.config['POSTS_ENDPOINT']\n response = requests.get(url, params={})\n if response.status_code == 200:\n return parse_posts(response.json())\n raise RuntimeError('Error in retrieving posts.')", "def get(self):\n return get_all_posts()", "def list():\n\n p...
[ "0.6443327", "0.64023525", "0.63965803", "0.609261", "0.6078676", "0.6009153", "0.59817547", "0.595344", "0.5912195", "0.58770806", "0.58570176", "0.5808449", "0.57762986", "0.57613033", "0.5755018", "0.57533497", "0.57342225", "0.5722693", "0.5719726", "0.5706099", "0.569451...
0.57208765
18
Opens the permalink for post at rank rank in default browser.
def browse_rank(posts, rank): if rank > len(posts): click.secho(('\n\tCannot get that rank. Currently %d products have been hunted ' 'with Spear.\n' % len(posts)), fg="red") return url = BASE_URL + posts[int(rank)-1]['permalink'] webbrowser.open(url, new=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(num, rank):\n\n file_existed = os.path.isfile(FILE_NAME)\n\n if rank:\n rank = int(rank)\n \n # if a rank is passed, we assume the user wants to open the product at the\n # rank. But if the local file doesn't exist, we query the API, and retry.\n if rank and file_existed:\n browse_rank(load_po...
[ "0.6182857", "0.56361544", "0.5530104", "0.5205971", "0.5201647", "0.5197045", "0.5194299", "0.5138884", "0.51208854", "0.50970227", "0.50923043", "0.5067071", "0.5056936", "0.5035746", "0.50017977", "0.49854454", "0.49836594", "0.4968917", "0.49597406", "0.49532667", "0.4942...
0.78006464
0
Neatly prints all passed posts to the console.
def print_posts(posts): click.echo() for post in posts: click.secho('%d. ' % post['rank'], nl=False) click.secho('%s\t' % post['title'], bold=True, fg="red", nl=False) click.secho('%s' % post['tagline'], fg="yellow") click.echo()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_post():\n print('| | |'),", "def print(self, *args, **kwargs):\n print(*args, **kwargs)", "def debug_print(self, *args, **kwargs):\n print(\"APP_DEBUG_PRINT\", args, kwargs)", "def debug_print(self, *content):\n if self.debug:\n print(*content)...
[ "0.7115943", "0.6441518", "0.63706803", "0.62422836", "0.62408924", "0.6211438", "0.6161924", "0.6133616", "0.61010075", "0.6070248", "0.60621244", "0.6029152", "0.60103685", "0.5993028", "0.5993028", "0.5993028", "0.5993028", "0.59749794", "0.59646165", "0.59468657", "0.5929...
0.7119509
0
A CLI to Product Hunt that shows (top num) products from today and/or open the product at rank rank in web browser.
def main(num, rank): file_existed = os.path.isfile(FILE_NAME) if rank: rank = int(rank) # if a rank is passed, we assume the user wants to open the product at the # rank. But if the local file doesn't exist, we query the API, and retry. if rank and file_existed: browse_rank(load_posts(), rank) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browse_rank(posts, rank):\n \n if rank > len(posts):\n click.secho(('\\n\\tCannot get that rank. Currently %d products have been hunted '\n 'with Spear.\\n' % len(posts)), fg=\"red\")\n return\n\n url = BASE_URL + posts[int(rank)-1]['permalink']\n webbrowser.open(url, new=2)", "def...
[ "0.6422924", "0.63026744", "0.6276584", "0.5543545", "0.5516952", "0.5511337", "0.54465324", "0.5428419", "0.5425493", "0.53986984", "0.53925085", "0.5377301", "0.53724325", "0.5367898", "0.5367296", "0.53623855", "0.5357946", "0.53442305", "0.53405285", "0.5338121", "0.53332...
0.60728276
3
Get the indexes on the table using a new cursor.
def get_constraints(model): with connection.cursor() as cursor: return connection.introspection.get_constraints(cursor, model._meta.db_table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_indices(self):\n\n def query(rel): \n return \"\"\"SELECT pg_class.relname, pg_index.indkey\n FROM pg_class, pg_index\n WHERE (pg_index.indexrelid = pg_class.oid)\n AND (pg_index.indrelid = (SELECT pg_class.oid FROM pg_class WHERE p...
[ "0.6800074", "0.6452354", "0.63777584", "0.6295344", "0.62760967", "0.6267213", "0.6204597", "0.6202955", "0.61729", "0.61649823", "0.6136951", "0.60915583", "0.5978674", "0.5976947", "0.59670347", "0.59374946", "0.5933559", "0.5931247", "0.58822095", "0.5880325", "0.5842626"...
0.0
-1
Construct a table name by optionally adding a table name prefix.
def _table_name(self, name: AnyStr) -> bytes: name = ensure_bytes(name) if self.table_prefix is None: return name return self.table_prefix + self.table_prefix_separator + name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket_to_tablename(prefix, bucket):\n return prefix + bucket", "def table_name() -> str:\n pass", "def prefix():\r\n class TableA(tables.Table):\r\n name = tables.Column()\r\n\r\n class Meta:\r\n prefix = \"x\"\r\n\r\n assert \"x\" == TableA([]).prefix\r\n\r\n c...
[ "0.6983316", "0.6868761", "0.66902655", "0.6644392", "0.6616669", "0.6526214", "0.65251964", "0.64713275", "0.644586", "0.62785625", "0.6139798", "0.6098526", "0.6013983", "0.5979652", "0.58623594", "0.5846383", "0.58428425", "0.5842715", "0.57911444", "0.57911444", "0.579114...
0.7101793
0
Create and open the underlying client to the HBase instance. This method can safely be called more than once.
async def open(self) -> None: if self.client is not None: return # _refresh_thrift_client opened the transport logger.debug(f"Opening Thrift transport to {self.host}:{self.port}") self.client = await self._client_factory(**self.client_kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_heat_client(self):\n\n print \"\\t* Generating heat client\"\n # request a new auth token from keystone\n keystone = ksclient.Client(auth_url=self.auth_url,\n username=self.username,\n password=self.password,\n ...
[ "0.6232724", "0.6101125", "0.608096", "0.6044116", "0.58246213", "0.5690355", "0.5668486", "0.56504655", "0.5605735", "0.5569847", "0.5556541", "0.5535542", "0.5521138", "0.54744536", "0.5422871", "0.53894156", "0.53798336", "0.53746945", "0.535874", "0.5340033", "0.53263265"...
0.6804419
0
Close the underlying client to the HBase instance. This method can be safely called more than once. Note that the client is destroyed after it is closed which will cause errors to occur
def close(self) -> None: if self.client is None: return if logger is not None: # If called from __del__(), module variables may no longer exist. logger.debug(f"Closing Thrift transport to {self.host}:{self.port}") self.client.close() self.client = No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnecetion(self):\n client.close()", "def close_ssh_client(self):\n self.ssh_client.close()", "def close(self):\n self.shutdown()\n self._client.close()", "async def close(self) -> None:\n\n if self._client:\n await self._client.__aexit__()", "def close(s...
[ "0.71063393", "0.6860559", "0.6856127", "0.6839546", "0.6762218", "0.6728074", "0.6604954", "0.6489788", "0.6444724", "0.64077437", "0.6398559", "0.63399166", "0.6217777", "0.6193713", "0.6177189", "0.6150679", "0.614646", "0.6129677", "0.61130965", "0.60951537", "0.6062458",...
0.715433
0
Return a list of table names available in this HBase instance.
async def tables(self) -> List[bytes]: names = await self.client.getTableNames() # Filter using prefix, and strip prefix from names if self.table_prefix is not None: prefix = self._table_name(b'') offset = len(prefix) names = [n[offset:] for n in names if n.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tables(self) -> List[str]:\n return self.dynamodb_client.list_tables()[\"TableNames\"]", "def get_table_names(self):\n return self.engine.table_names()", "def get_tables(self):\n return list(self._metadata['tables'].keys())", "def list_tables(self):\n return LIST_TABLES(d...
[ "0.8007392", "0.77783185", "0.7701616", "0.76757056", "0.7655505", "0.76370215", "0.75866014", "0.75735855", "0.7444133", "0.74050945", "0.73407847", "0.7325878", "0.7299059", "0.7193484", "0.71326184", "0.7120677", "0.70863867", "0.70375466", "0.7023705", "0.69402367", "0.68...
0.78835815
1
Delete the specified table.
async def delete_table(self, name: AnyStr, disable: bool = False) -> None: if disable and await self.is_table_enabled(name): await self.disable_table(name) await self.client.deleteTable(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_table(self, db, table_name):\n pass", "def delete_table(table_name: str, **db_kwargs) -> None:\n client = boto3.client(\"dynamodb\", **db_kwargs)\n client.delete_table(TableName=table_name)\n log.info(\"Table %s has been deleted\", table_name)", "def delete_table(self, name: str) ->...
[ "0.8149698", "0.80803883", "0.8062236", "0.7985449", "0.7985449", "0.7971576", "0.7836116", "0.7702302", "0.76736337", "0.76590925", "0.76508814", "0.7580074", "0.75614613", "0.7554784", "0.75464904", "0.7518427", "0.7448561", "0.74042565", "0.74024796", "0.73500586", "0.7339...
0.6492718
58
Enable the specified table.
async def enable_table(self, name: AnyStr) -> None: await self.client.enableTable(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def is_table_enabled(self, name: AnyStr) -> None:\n return await self.client.isTableEnabled(self._table_name(name))", "async def disable_table(self, name: AnyStr) -> None:\n await self.client.disableTable(self._table_name(name))", "def lock_table(self):\n\n self.status = 'Locked'", ...
[ "0.6090106", "0.59843993", "0.596103", "0.59515077", "0.59515077", "0.58426434", "0.5697303", "0.5694458", "0.56662244", "0.5645401", "0.56410295", "0.56244045", "0.55909985", "0.5585736", "0.55567956", "0.5556704", "0.55556947", "0.55556947", "0.55487466", "0.5543933", "0.55...
0.82251936
0
Disable the specified table.
async def disable_table(self, name: AnyStr) -> None: await self.client.disableTable(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_table(self, name: AnyStr, disable: bool = False) -> None:\n if disable and await self.is_table_enabled(name):\n await self.disable_table(name)\n\n await self.client.deleteTable(self._table_name(name))", "def disable(ctx):\n\n port_info = {}\n port_info['FLEX_COUNTE...
[ "0.66882545", "0.64297634", "0.6220911", "0.62085795", "0.6183498", "0.59963304", "0.59899276", "0.596315", "0.5847089", "0.5841651", "0.5817108", "0.5815603", "0.58142066", "0.5812355", "0.58106613", "0.5808945", "0.5808786", "0.580826", "0.5758325", "0.57542515", "0.5750066...
0.8292084
0
Return whether the specified table is enabled.
async def is_table_enabled(self, name: AnyStr) -> None: return await self.client.isTableEnabled(self._table_name(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_table(self, table):\n return table in self.get_table_list(\".\" in table)", "def check_table(self, table_name: str) -> bool:\n try:\n if self.engine.dialect.has_table(self.engine.connect(), table_name):\n return self.get_input(table_name)\n return False\...
[ "0.6898622", "0.6342821", "0.63032", "0.63032", "0.63032", "0.63032", "0.63032", "0.63032", "0.6272063", "0.62631357", "0.62483656", "0.6229805", "0.62060714", "0.61975765", "0.61830944", "0.61462283", "0.6129225", "0.61281174", "0.6115581", "0.61123234", "0.60770994", "0.6...
0.7990121
0
Compact the specified table.
async def compact_table(self, name: AnyStr, major: bool = False) -> None: name = self._table_name(name) if major: await self.client.majorCompact(name) else: await self.client.compact(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_table(self, table: Table):\n self._requires_table(table)\n table.clear()", "def empty_table(self, table):\n print(\"Emptying {0}...\".format(table))\n query = \"TRUNCATE TABLE {0} RESTART IDENTITY CASCADE;\".format(table)\n cursor = connection.cursor()\n cursor...
[ "0.5847997", "0.56457794", "0.5574597", "0.5566873", "0.55524355", "0.55139095", "0.546884", "0.5467198", "0.5423969", "0.54100394", "0.5380569", "0.53520906", "0.5315048", "0.52778924", "0.52724254", "0.5204866", "0.51722646", "0.51642877", "0.5143855", "0.50638324", "0.5055...
0.7088064
0
Compares received's attributes with expected's kwargs.
def attrs_eq(received, **expected): for k, v in expected.iteritems(): eq_(v, getattr(received, k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attrs(self):\n for self_attr, wrapper_attr in [(\"reactor\", \"_reactor\"),\n (\"client\", \"_client\")]:\n self.assertIdentical(getattr(self, self_attr),\n getattr(self.wrapper, wrapper_attr))", "def test_attribute...
[ "0.6576146", "0.6564596", "0.6462569", "0.6408045", "0.6395285", "0.6344218", "0.6291002", "0.6240182", "0.62239105", "0.61092496", "0.607779", "0.6026101", "0.6014606", "0.60038954", "0.5952767", "0.5885488", "0.5867236", "0.58600116", "0.5829513", "0.58288026", "0.5824071",...
0.7866361
0
Assert `text` starts with `substring`.
def starts_with(text, substring): assert text.startswith(substring), "%r doesn't start with %r" % (text, substring)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_start_check_at_beginning_of_string(self):\n first_letter = \"a\"\n s = \"abcdef\"\n self.assertEqual(__, re.search(first_letter, s).group())", "def test_match_must_start_at_the_beginning(self):\n third_letter = \"c\"\n s = \"abcdef\"\n self.assertEqual(__,...
[ "0.6829674", "0.65287787", "0.64003766", "0.63065535", "0.6265803", "0.62448704", "0.6170393", "0.6124493", "0.6100281", "0.6091578", "0.6072728", "0.603758", "0.60315865", "0.60313207", "0.60114366", "0.5978914", "0.59746695", "0.5931409", "0.5912524", "0.588778", "0.5864748...
0.8459681
0
Patch email_utils.send_messages with this in your tests to check what happens when an email fails to send.
def send_mail_raise_smtp(messages): raise SMTPRecipientsRefused(recipients=messages[0].recipients())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_failed_email(self):\n self.assertEqual(send_email(\"testtestcom\", \"test\", \"test\"), 'There was an error sending')", "def test_bademail(mock_smtp):\n \n msg_values = {'sender': 'dummy@moc.org',\n 'receiver': 'newuser1@moc.org',\n 'subject': 'Test Message...
[ "0.8086304", "0.72468615", "0.7125777", "0.70968163", "0.6704975", "0.66328955", "0.65558076", "0.65207565", "0.64956194", "0.6488341", "0.64816576", "0.64691323", "0.64597386", "0.6456591", "0.6455369", "0.63600177", "0.6334171", "0.6328927", "0.63200766", "0.6319092", "0.62...
0.6960675
4
Make a request, but prepend a locale if there isn't one already.
def request(self, **request): # Fall back to defaults as in the superclass's implementation: path = request.get('PATH_INFO', self.defaults.get('PATH_INFO', '/')) locale, shortened = split_path(path) if not locale: request['PATH_INFO'] = '/%s/%s' % (settings.LANGUAGE_CODE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_request(self, request):\n if 'HTTP_ACCEPT_LANGUAGE' in request.META:\n # Preserve the browser provided language just in case,\n # the underscore prefix means that you probably shouldn't be using it anyway\n request.META['_HTTP_ACCEPT_LANGUAGE'] = request.META['HTTP...
[ "0.62489927", "0.6160046", "0.5985905", "0.57638955", "0.5707318", "0.5645025", "0.56072253", "0.54957044", "0.54901606", "0.5485183", "0.5457616", "0.5453435", "0.5262661", "0.52122664", "0.5199306", "0.5167903", "0.5166903", "0.5107756", "0.5095502", "0.50909346", "0.502625...
0.69697094
0
Return the absolute path to the migration script folder.
def _migrations_path(): return join(dirname(dirname(dirname(sumo.__file__))), 'migrations')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migration_directory(self) -> str:\n\n with package_resources.path(\n f\"PyFunceble.data.{PyFunceble.cli.storage.ALEMBIC_DIRECTORY_NAME}\",\n \"__init__.py\",\n ) as file_path:\n result = os.path.split(file_path)[0]\n\n if PyFunceble.storage.CONFIGURATION.cl...
[ "0.771517", "0.7598042", "0.73491156", "0.72787374", "0.7230808", "0.6944726", "0.68556404", "0.6811978", "0.6753096", "0.669813", "0.6693428", "0.667507", "0.66400284", "0.66386336", "0.66133446", "0.6611378", "0.6556615", "0.65509653", "0.6544871", "0.6544871", "0.6486247",...
0.8255686
0
Assert that the numeric prefixes of the DB migrations are unique.
def test_unique(self): leading_digits = re.compile(r'^\d+') seen_numbers = set() path = self._migrations_path() for filename in listdir(path): match = leading_digits.match(filename) if match: number = match.group() if number in seen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prefix(self):\n self.chck_triple('prefix')", "def test_strip_column_prefix():\n assert strip_column_prefix(\"ts_some_name\") == \"some_name\"\n assert strip_column_prefix(\"some_name\") == \"some_name\"\n # only the prefix may be stripped\n assert strip_column_prefix(\"ts_some_ts_name...
[ "0.6097303", "0.6040116", "0.5913195", "0.58292675", "0.58030826", "0.57863855", "0.56782293", "0.5632286", "0.5627914", "0.55827665", "0.55247986", "0.55160433", "0.55130035", "0.5502277", "0.5491454", "0.5479071", "0.5462152", "0.54441065", "0.5438034", "0.5420087", "0.5418...
0.7371309
0
Make sure each created table uses the InnoDB engine and UTF8.
def test_innodb_and_utf8(self): # Heuristic: make sure there are at least as many "ENGINE=InnoDB"s as # "CREATE TABLE"s. (There might be additional "InnoDB"s in ALTER TABLE # statements, which are fine.) path = self._migrations_path() for filename in sorted(listdir(path)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_db_schema_utf8(\n instance: Recorder, table_object: type[DeclarativeBase], schema_errors: set[str]\n) -> None:\n table_name = table_object.__tablename__\n if (\n f\"{table_name}.4-byte UTF-8\" in schema_errors\n or f\"{table_name}.utf8mb4_unicode_ci\" in schema_errors\n ):\n ...
[ "0.62925166", "0.62717134", "0.61080253", "0.60827583", "0.5985917", "0.59618616", "0.59618616", "0.59530646", "0.5951511", "0.5904364", "0.5888538", "0.5878991", "0.5784848", "0.57627964", "0.5762103", "0.57413745", "0.5698418", "0.5692719", "0.5662284", "0.56588584", "0.565...
0.7256668
0
Decorate a model maker to add a `save` kwarg. If save=True, the model maker will save the object before returning it.
def with_save(func): @wraps(func) def saving_func(*args, **kwargs): save = kwargs.pop('save', False) ret = func(*args, **kwargs) if save: ret.save() return ret return saving_func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_auto_save(func: Callable):\n\n @wraps(func)\n def _wrapped(self, *args, **kwargs):\n return_val = func(self, *args, **kwargs)\n if self.auto_save:\n self.save_metadata()\n return return_val\n\n return _wrapped", "def save_model(self, *args, **kwargs):\n rais...
[ "0.6469919", "0.5738694", "0.572271", "0.52655745", "0.52434915", "0.5209758", "0.51709205", "0.5067467", "0.50492924", "0.50204456", "0.5005135", "0.49688715", "0.49463245", "0.49134701", "0.4888065", "0.48869237", "0.48869237", "0.48869237", "0.48597857", "0.48505533", "0.4...
0.7034841
0
Shorthand for 'assert a == b, "%s %r != %r" % (msg, a, b)'
def eq_msg(a, b, msg=None): assert a == b, (str(msg) or '') + ' (%r != %r)' % (a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_eq(a, b, msg=None):\n assert a == b, msg or __safe_error(\"!=\", a, b)", "def eq_(a, b, msg=None):\n assert a == b, msg or \"%r != %r\" % (a, b)", "def eq_(a, b, msg=None):\n assert a == b, msg or \"%r != %r\" % (a, b)", "def assert_equal(self, first, second, msg=\"\"):\r\n assert ...
[ "0.83698875", "0.8356181", "0.8356181", "0.811656", "0.79593253", "0.78908986", "0.7779416", "0.76180196", "0.7557509", "0.7538832", "0.75304806", "0.75184023", "0.7504325", "0.7337403", "0.72703254", "0.72698164", "0.7241174", "0.7221724", "0.7213975", "0.7142231", "0.708558...
0.83424985
3
Create a list of requirements from given items.
def _do_install_prepare_reqs(self, action): def _make_req(string): try: return Requirement(string) except Exception: raise YAMLException( "Could not parse requirement {!r} from {!r}", string, act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reconstruct_requirements(req_records):\n recs = [req_record[\"r\"] for req_record in req_records]\n return [Requirement(rec[\"class\"], {k: v for k, v in rec.items() if k != \"class\"})\n for rec in recs]", "def requirements(self):\n requirements = []\n return requirements", ...
[ "0.6201311", "0.6112178", "0.6092989", "0.5920086", "0.58888817", "0.58846074", "0.5810434", "0.5724193", "0.56695217", "0.5665077", "0.5657579", "0.56431586", "0.5634644", "0.5563239", "0.549878", "0.54696786", "0.54629296", "0.5439147", "0.54229116", "0.54197514", "0.537487...
0.61878824
1
Compose a list of requirements and then run the resolver to install them.
def _do_install(self, provider, items): requirements = self._do_install_prepare_reqs(items) result = self._run_resolver(requirements, provider) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install():\n verun('pip install -r {0}'.format(requirements))", "def install_deps():\n default = open('requirements.txt', 'r').readlines()\n new_pkgs = []\n links = []\n for resource in default:\n if 'git+https' in resource:\n pkg = resource.split('#')[-1]\n links....
[ "0.7091497", "0.701064", "0.6956623", "0.6933346", "0.6859309", "0.6836508", "0.6801119", "0.6783575", "0.66986865", "0.66677105", "0.66422904", "0.6584691", "0.65672284", "0.6542947", "0.65090275", "0.6437916", "0.64319324", "0.6423555", "0.6406795", "0.637428", "0.6311549",...
0.62042755
27
General tests for all Ext versions
def test_common(self): tree = self.cix_tree self.assertTrue(tree is not None) self.assertTrue(tree.tag == "codeintel" and tree.get("version") == "2.0") self.assertTrue(len(tree.getchildren()) == 1 and tree.getchildren()[0].tag == "file") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version(self):\n pass", "def tests():", "def test_version():\n versions = ((2, 7, 16), (3, 5, 7), (3, 6, 8), (3, 7, 3))\n assert sys.version_info[:3] in versions", "def test_checkers_integration():\n for project in AVAILABLE_CHECKERS.values():\n assert project.get_latest_versi...
[ "0.71570426", "0.6804025", "0.675813", "0.6638585", "0.6624765", "0.66244006", "0.654903", "0.6520928", "0.6506511", "0.6494773", "0.64919657", "0.6491584", "0.6479722", "0.6469396", "0.6451712", "0.6445549", "0.6402264", "0.6395714", "0.6377462", "0.63308865", "0.63209367", ...
0.5866798
96
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SetElectromotorsControlRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.ctrl is None: self.ctrl = actuators_canopen.msg.ElectromotorsState() else: self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794351", "0.7719884", "0.7719884", "0.7686347", "0.76253426", "0.7562994", "0.74395365", "0.7416649", "0.73515975", "0.730761", "0.7279932", "0.72373426", "0.72264934", "0.7223775", "0.7223775", "0.72189564", "0.72111243", "0.72111243", "0.72111243", "0.72111243", "0.7211...
0.0
-1
serialize message into buffer
def serialize(self, buff): try: _x = self buff.write(_struct_3I.pack(_x.ctrl.header.seq, _x.ctrl.header.stamp.secs, _x.ctrl.header.stamp.nsecs)) _x = self.ctrl.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self, buff):\n try:\n _x = self\n buff.write(_struct_2d2q14dq.pack(_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x.ret))\n _x = self.msg\n ...
[ "0.6972838", "0.6802016", "0.6796291", "0.67317253", "0.66948694", "0.66847515", "0.6658851", "0.6626311", "0.66227144", "0.6618303", "0.6607444", "0.65361035", "0.6529462", "0.65220654", "0.64863104", "0.6467052", "0.64530367", "0.6438432", "0.6427743", "0.6426063", "0.63947...
0.0
-1
unpack serialized message in str into this message instance
def deserialize(self, str): try: if self.ctrl is None: self.ctrl = actuators_canopen.msg.ElectromotorsState() end = 0 _x = self start = end end += 12 (_x.ctrl.header.seq, _x.ctrl.header.stamp.secs, _x.ctrl.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, str):\n try:\n end = 0\n _x = self\n start = end\n end += 152\n (_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x.ret,) = _stru...
[ "0.7633603", "0.74642533", "0.732128", "0.73038477", "0.72709143", "0.7223599", "0.72191226", "0.7175671", "0.71700495", "0.709591", "0.7095633", "0.70419884", "0.70281994", "0.6962232", "0.6956503", "0.6955446", "0.69451785", "0.6942254", "0.6942078", "0.6912403", "0.6894626...
0.0
-1
serialize message with numpy array types into buffer
def serialize_numpy(self, buff, numpy): try: _x = self buff.write(_struct_3I.pack(_x.ctrl.header.seq, _x.ctrl.header.stamp.secs, _x.ctrl.header.stamp.nsecs)) _x = self.ctrl.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') lengt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(se)\n except TypeError as te: self._check_types(te)", "def serialize_numpy(self, buff, numpy):\n try:\n _x = self\n buff.write(_struct_2d2q14dq.pack(_x.tcp, _x.ori, _x.zone, _x.vacuum, ...
[ "0.7994329", "0.7972612", "0.7893365", "0.785495", "0.7740611", "0.7677824", "0.7657543", "0.7626826", "0.75874037", "0.7565361", "0.75626636", "0.75620574", "0.7558187", "0.75431186", "0.7534563", "0.7527763", "0.75262064", "0.75172293", "0.75110817", "0.749996", "0.7497972"...
0.6728073
96
unpack serialized message in str into this message instance using numpy for array types
def deserialize_numpy(self, str, numpy): try: if self.ctrl is None: self.ctrl = actuators_canopen.msg.ElectromotorsState() end = 0 _x = self start = end end += 12 (_x.ctrl.header.seq, _x.ctrl.header.stamp.secs, _x.ctrl.header.stamp.nsecs,) = _struct_3I.unpack(str[start:en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize_numpy(self, str, numpy):\n try:\n end = 0\n _x = self\n start = end\n end += 152\n (_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x....
[ "0.80890095", "0.797653", "0.79170173", "0.7906179", "0.78933936", "0.7831413", "0.78118503", "0.7809794", "0.7784528", "0.77587944", "0.77402115", "0.77145755", "0.7714233", "0.7696594", "0.7692612", "0.7685888", "0.7672912", "0.76391083", "0.76368344", "0.7628863", "0.76240...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SetElectromotorsControlResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.result is None: self.result = 0 else: self.result = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77941823", "0.7721771", "0.7721771", "0.76875746", "0.7627467", "0.75655127", "0.7441343", "0.7418733", "0.7351187", "0.73081994", "0.72794753", "0.72372985", "0.7227603", "0.7225375", "0.7225375", "0.72188306", "0.7213351", "0.7213351", "0.7213351", "0.7213351", "0.721335...
0.0
-1
serialize message into buffer
def serialize(self, buff): try: buff.write(_struct_B.pack(self.result)) except struct.error as se: self._check_types(se) except TypeError as te: self._check_types(te)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self, buff):\n try:\n _x = self\n buff.write(_struct_2d2q14dq.pack(_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x.ret))\n _x = self.msg\n ...
[ "0.6972838", "0.6802016", "0.6796291", "0.67317253", "0.66948694", "0.6658851", "0.6626311", "0.66227144", "0.6618303", "0.6607444", "0.65361035", "0.6529462", "0.65220654", "0.64863104", "0.6467052", "0.64530367", "0.6438432", "0.6427743", "0.6426063", "0.63947827", "0.63715...
0.66847515
5
unpack serialized message in str into this message instance
def deserialize(self, str): try: end = 0 start = end end += 1 (self.result,) = _struct_B.unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, str):\n try:\n end = 0\n _x = self\n start = end\n end += 152\n (_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x.ret,) = _stru...
[ "0.7633603", "0.74642533", "0.732128", "0.73038477", "0.72709143", "0.7223599", "0.7175671", "0.71700495", "0.709591", "0.7095633", "0.70419884", "0.70281994", "0.6962232", "0.6956503", "0.6955446", "0.69451785", "0.6942254", "0.6942078", "0.6912403", "0.6894626", "0.68897164...
0.72191226
6
serialize message with numpy array types into buffer
def serialize_numpy(self, buff, numpy): try: buff.write(_struct_B.pack(self.result)) except struct.error as se: self._check_types(se) except TypeError as te: self._check_types(te)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize_numpy(self, buff, numpy):\n try:\n pass\n except struct.error as se: self._check_types(se)\n except TypeError as te: self._check_types(te)", "def serialize_numpy(self, buff, numpy):\n try:\n _x = self\n buff.write(_struct_2d2q14dq.pack(_x.tcp, _x.ori, _x.zone, _x.vacuum, ...
[ "0.79946846", "0.79733205", "0.7894134", "0.78557587", "0.767947", "0.7658682", "0.7627832", "0.75884074", "0.75668263", "0.7563204", "0.7563108", "0.75591797", "0.7544295", "0.75356185", "0.7529538", "0.7527064", "0.7518283", "0.751168", "0.750116", "0.74992543", "0.74847126...
0.7741082
4
unpack serialized message in str into this message instance using numpy for array types
def deserialize_numpy(self, str, numpy): try: end = 0 start = end end += 1 (self.result,) = _struct_B.unpack(str[start:end]) return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize_numpy(self, str, numpy):\n try:\n end = 0\n _x = self\n start = end\n end += 152\n (_x.tcp, _x.ori, _x.zone, _x.vacuum, _x.workx, _x.worky, _x.workz, _x.workq0, _x.workqx, _x.workqy, _x.workqz, _x.toolx, _x.tooly, _x.toolz, _x.toolq0, _x.toolqx, _x.toolqy, _x.toolqz, _x....
[ "0.8090556", "0.79776967", "0.79184276", "0.7907259", "0.789463", "0.7832683", "0.7812846", "0.7810829", "0.7785181", "0.7760294", "0.77407515", "0.7715958", "0.77152807", "0.7697747", "0.7693529", "0.76734644", "0.76398456", "0.7637652", "0.7630051", "0.7625139", "0.76175505...
0.76866287
15
Construct data sets for SysRem
def sysrem_data_prepare(obs, sigs, ms_obs=True, ms_feat=False): nds = len(obs) nobs = len(obs[0]) # Residuals and STDs rij = np.zeros( (nobs, nds) ) sm = np.zeros( (nobs, nds) ) if len(obs) != len(sigs): raise(ValueError("Obs and sigs must have the same length.")) for n in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collectData(self):\n\n self.data.datahash = {} # dict of system data\n\n vmstat_dict = self._getvmstat()\n if vmstat_dict:\n self.data.datahash.update(vmstat_dict)\n\n uptime_dict = self._getuptime()\n if uptime_dict:\n self.data.datahash....
[ "0.6231608", "0.6201638", "0.6089105", "0.5982996", "0.5916175", "0.58389336", "0.5805325", "0.5794087", "0.5770292", "0.57400566", "0.5706636", "0.5654017", "0.5647484", "0.5647071", "0.5630673", "0.5623479", "0.5600253", "0.55999434", "0.5591246", "0.5584346", "0.5576154", ...
0.0
-1
Subtract current model from residuals In matrix notation Tamuz et al. write (Eq. 6) R' = R c a^T. The operation here implemented corresponds to (R' = R c^T)^T > R'^T = R^T a c^T (where ^T is the transpose, R is a matrix and a and c are vectors). Returns
def sysrem_update_rij(rij, a, c): return rij - np.outer(a,c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual_of(self, z):\n return np.subtract(z, self.HJacob(self.x)@self.x_prior)", "def residual_of(self, z):\n raise \"Not implemented yet\"\n return z - dot(self._H, self._x)", "def back_substitution(self):\r\n for col in range(self.SIZE - 1, -1, -1):\r\n self.check_...
[ "0.597161", "0.57674617", "0.5653328", "0.5619851", "0.5587978", "0.55241704", "0.5420099", "0.53882575", "0.5380549", "0.5333551", "0.53246033", "0.5320975", "0.5320975", "0.5320975", "0.53125983", "0.5295911", "0.5267064", "0.52474755", "0.5243254", "0.52172714", "0.5211965...
0.59686255
1
Implementation of the SysRem algorithm. SysRem was described by
def __init__(self, obs, sigs, ms_obs=True, ms_feat=False, a0=None, ms_warn=True): # Convert into list of arrays if 2d array if isinstance(obs, np.ndarray) and (obs.ndim == 2): obs = [obs[::,i] for i in range(obs.shape[1])] if isinstance(sigs, np.ndarray) and (sigs.ndim == 2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rem(a, b):\n return a % b", "def rem(self, a, b):\n raise NotImplementedError", "def rem(self, a, b):\n return a % b", "def rem(self, a, b):\n return a % b", "def fn(mask, rem):\n if not mask: return 0 # done \n ans = inf \n for i, x in enumerate...
[ "0.5365042", "0.53464013", "0.5335688", "0.5335688", "0.5281327", "0.52548957", "0.5081097", "0.49769276", "0.48923093", "0.4859301", "0.4846898", "0.48468667", "0.4845998", "0.48315325", "0.48149613", "0.4801941", "0.479971", "0.4781277", "0.47734118", "0.47720233", "0.47485...
0.0
-1
Get model corresponding to a,c vector
def get_model(self, last=True, a=None, c=None): if (a is not None) and (c is not None) and (not last): return np.outer(a, c) elif last and (a is None) and (c is None): if len(self.rijs) == 0: raise(PE.PyAValError("Last model requested, but no model exists...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recognition_model(self, x, c):\n x = self.encoder(x)\n c = self.conditional(c)\n temp = self.recog_head(x + c)\n mu = self.mu(temp)\n logvar = self.logvar(temp)\n return mu, logvar", "def recognition_model(self, x, c):\n x = self.encoder(x)\n c = self.c...
[ "0.5943117", "0.5943117", "0.59274226", "0.5790551", "0.57192355", "0.56776786", "0.5629956", "0.5623865", "0.55425984", "0.5500118", "0.5482155", "0.54582584", "0.5437091", "0.5437091", "0.54246694", "0.5345569", "0.5322276", "0.527424", "0.5258969", "0.5258677", "0.52557236...
0.6103821
0
Get the cumulative model (sum of all available models)
def get_cumulative_model(self): cm = None for ac in self.ac: if ac[0] is None: continue m = self.get_model(last=False, a=ac[0], c=ac[1]) cm = m if cm is None else cm+m return cm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cumulative_mig(model):\r\n return sum(cumulative_mig_list)", "def cum_sum(self):\n\n # create cdo command and runit\n cdo_command = \"cdo -timcumsum\"\n run_this(cdo_command, self, output=\"ensemble\")", "def total_models_produced(self):\n return self._total_models_produced", "def...
[ "0.7080301", "0.62270474", "0.5775094", "0.5704546", "0.55656356", "0.5501783", "0.5465801", "0.53405565", "0.5286122", "0.5220785", "0.5193036", "0.5148923", "0.51433724", "0.51247233", "0.5121645", "0.51210314", "0.51171476", "0.50669336", "0.50564367", "0.5048346", "0.5048...
0.8100918
0
Create a graph and run Dijikstra algorithm to find shortest path to all the nodes from the source node. Dijikstra algorithm does not work with negative weights.
def main(): # create graph (DIRECTED), add nodes # create graph, add nodes api = GraphAPI() graph = api.init_graph(graph_type=GraphTypes.DIRECTED) api.add_node(graph, "A") api.add_node(graph, "B") api.add_node(graph, "C") api.add_node(graph, "D") api.add_node(graph, "E") api.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dijkstra(graph, source):\n\n if not isinstance(graph, WeightedGraph):\n raise TypeError('dijkstra_heap(graph, source): graph must be a WeightedGraph object')\n if source not in graph.Keys:\n raise ValueError('dijkstra_heap(graph, source): source must be a key of the graph but {} is not a ke...
[ "0.7634346", "0.7473723", "0.7436281", "0.742487", "0.7390997", "0.73245585", "0.72784936", "0.72725034", "0.7163718", "0.7157089", "0.70738053", "0.70538944", "0.7051962", "0.7050298", "0.70453733", "0.7039171", "0.7029212", "0.7005062", "0.7002129", "0.6975575", "0.6929758"...
0.7355143
5
for the input for indri document retrieval when all the claim and entity have been lower cased
def create_entity_claim_input_file_doc_ret(): claim_doc = open(r"C:\study\technion\MSc\Thesis\Y!\rawClaim_SW.txt").read().strip() "remove the stop words from the claims" SW_doc = r"C:\study\technion\MSc\Thesis\Y!\stopWords.xml" stopWords_list = [] claims_no_SW_dict = {} with open(SW_doc, 'r') as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform_to_lowercase(self, doc: str):\n processed_tweet = doc.lower()\n return processed_tweet", "def lower_case_really():", "def search_entity(self, name_filter):\n name_filter=name_filter.lower()\n model_reader=oc.delegator.getModelReader()\n names=model_reader.getEn...
[ "0.6237965", "0.62361765", "0.6010704", "0.5874474", "0.5844636", "0.5814212", "0.5812037", "0.5754486", "0.5722984", "0.56905735", "0.56733185", "0.5665827", "0.56259596", "0.5613765", "0.55999416", "0.5576687", "0.5573347", "0.5565344", "0.5532522", "0.55220807", "0.5493951...
0.0
-1
from the documents retrieved, score= exp(score) and then normalize according to sum normalization file is an input file claim num, alpha, beta for each alpha beta, create and than add to it the different claims' doc scores
def normalize_doc_scores(): # doc_res_files_path = base_path+r"claimLM_docLM_doc_ret_output" claims_file_counters_dict = {} #for each claim numas key, have the val a counter - if not 110 per claim -> problem! doc_res_files_path = linux_base_path+"/claimLM_docLM_doc_ret_output" # doc_res_files_path = bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_sen_scores_corpus_smoothing():\n param_len = 10*11# for alpha*beta =110 \n k_len = 1\n# sen_res_files_path = linux_base_path+r\"/claimLM_senLM_sen_ret_output_corpus_smoothing_corpus_beta_\"+str(corpus_beta)\n sen_res_files_path = base_path+r\"\\claimLM_senLM_sen_ret_output_corpus_smooth...
[ "0.71356165", "0.65784204", "0.63003385", "0.61383694", "0.5840401", "0.5776091", "0.5764244", "0.5727677", "0.57261246", "0.572611", "0.57091475", "0.568436", "0.56770676", "0.5667565", "0.5643428", "0.561692", "0.5612546", "0.5585787", "0.5582222", "0.55724305", "0.55332166...
0.75903165
0