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
For reasons which remain mysterious, sometimes 3pt functions have a funny minussign issue where the global sign of the correlator seems to flip on every other configuration [1, 1, 1, 1, ...]. This problem seems mostly to afflict the currents SS and V4V4. for a=0.057 fm. As a quick fix, this function simply flips all th...
def fix_signs(data): for key in data.keys(): if not isinstance(key, int): continue data[key] = np.sign(data[key]) * data[key] return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixed_signs(popt1, popt2):\n if np.sign(popt1[0]) != np.sign(popt2[0]):\n print(\"Changing signs ...\")\n if popt2[2] < 0:\n popt2[2] += np.pi\n else:\n popt2[2] -= np.pi\n popt2[0] *= -1\n return popt1, popt2", "def inverse_cubic ( a , b , c , d ) :\n\...
[ "0.57120335", "0.57069165", "0.5665084", "0.56563234", "0.56420267", "0.5597039", "0.558212", "0.5470205", "0.5409758", "0.54012525", "0.5371877", "0.53650755", "0.5341073", "0.53110296", "0.5292289", "0.5264125", "0.52405894", "0.5228127", "0.5203397", "0.51954865", "0.51869...
0.4920369
85
Sanitizes data, removing NaNs.
def sanitize_data(data): # Make sure the same number of configurations appear everywhere nconfigs = np.inf for datum in data.values(): nconfigs = min(nconfigs, datum.shape[0]) for key, datum in data.items(): data[key] = datum[:nconfigs, :] # Locate rows with NaNs nan_rows = {loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaning (data):", "def _clean(self, dataset):\n # Replace missing values with numpy's NaN. The missing value is\n # usually 1e+20, but values can be like 1.0000002e+20, which is\n # different. Ergo the inequality.\n for var in dataset.data_vars.itervalues():\n if 'mi...
[ "0.72095513", "0.7197617", "0.70000994", "0.69318545", "0.6781053", "0.6743792", "0.66840655", "0.6664436", "0.6555098", "0.6551438", "0.6426552", "0.6402216", "0.6369444", "0.6368515", "0.6343947", "0.6335381", "0.6258854", "0.62364805", "0.6227007", "0.62197906", "0.6194067...
0.67749304
5
Locates rows in which NaNs appear.
def locate_nan_rows(arr): # Count the number of NaNs in each row nan_counts = np.sum(~np.isfinite(arr), axis=1) # Trigger on a NaN appearing anywhere in a line/row nans, = np.where(nan_counts > 1) return frozenset(nans)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nan_cells(traces):\n # Find all cells with NaNs\n nancells = []\n ncells = -1\n for cs in traces:\n if len(traces[cs]) > 0:\n ncells = np.shape(traces[cs])[1]\n ns = np.sum(np.sum(np.invert(np.isfinite(\n traces[cs])), axis=2), axis=0)\n vals ...
[ "0.692097", "0.6758517", "0.6730393", "0.66897637", "0.6636106", "0.65987986", "0.6463813", "0.6380045", "0.6338059", "0.6218934", "0.62157136", "0.6210175", "0.61391306", "0.61234987", "0.61117244", "0.6083047", "0.60659695", "0.60418135", "0.60125595", "0.60119325", "0.6011...
0.82622176
0
Removes NaNs from an array.
def remove_nans(arr, nan_rows=None): # Remove NaNs nconfigs, nt = arr.shape if nan_rows is None: mask = np.isfinite(arr) else: mask = np.array([n for n in np.arange(nconfigs) if n not in nan_rows]) return arr[mask].reshape(-1, nt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonans(array):\n return array[~np.isnan(array)]", "def removeNans(data):\n for i in data[:]:\n ind = data.index(i)\n for j in i:\n if np.isnan(j):\n data.remove(i)\n break\n return data", "def remove_nans(arr):\n not_nan = [i for i in range...
[ "0.78905934", "0.78404194", "0.74783874", "0.74409246", "0.73462254", "0.7201247", "0.7103013", "0.6913308", "0.6729393", "0.6642251", "0.65878254", "0.658656", "0.65164775", "0.64850163", "0.6472401", "0.64723283", "0.6434866", "0.63835776", "0.63802016", "0.63366616", "0.62...
0.7346792
4
Reads all the required correlators for analyzing the specified form factor.
def read_data(basenames, engine, apply_alias=True, sanitize=True): if apply_alias: # Map to descriptive names like 'source' or 'sink' aliases = alias.get_aliases(basenames) # Further map to conventional names like 'sink' --> 'heavy-light' name_map = alias.apply_naming_convention(alia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_conformers (mol, pathname, method='RDKit') :\n dcdfilename = os.path.join(pathname,'%s.dcd'%(method))\n dcd = DCDTrajectoryFile(dcdfilename)\n nsteps = dcd.get_length()\n \n # Read in the corresponding energies\n enfilename = os.path.join(pathname,'energies%s.dat'...
[ "0.5742529", "0.57119286", "0.56531143", "0.5551746", "0.5414467", "0.5333389", "0.5320997", "0.511367", "0.5086831", "0.5001198", "0.49262065", "0.49061906", "0.48587188", "0.4858185", "0.4841816", "0.48377192", "0.47953272", "0.4786497", "0.47704387", "0.47638413", "0.47627...
0.0
-1
Reads all the required correlators for analyzing the specified form factor.
def get_form_factor_data(form_factor_id, engines, apply_alias=True, sanitize=True): query = ( "SELECT ens_id, RTRIM(name, '-_fine') as BASENAME, corr_type " "FROM junction_form_factor AS junction " "JOIN correlator_n_point AS corr ON (corr.corr_id = junction.corr_id) " "WHERE (form_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_conformers (mol, pathname, method='RDKit') :\n dcdfilename = os.path.join(pathname,'%s.dcd'%(method))\n dcd = DCDTrajectoryFile(dcdfilename)\n nsteps = dcd.get_length()\n \n # Read in the corresponding energies\n enfilename = os.path.join(pathname,'energies%s.dat'...
[ "0.5739342", "0.5708731", "0.5649536", "0.5551953", "0.5332437", "0.5318923", "0.5113234", "0.5086433", "0.50001854", "0.49243063", "0.49031723", "0.4858186", "0.4855305", "0.48401818", "0.48351", "0.47942215", "0.4785276", "0.47679418", "0.4762849", "0.47604662", "0.47504118...
0.5413274
4
Sanitizes the dict 'record' for writing to 'table', i.e., restricts to keys which appear as columns of table.
def sanitize_record(record, table): try: columns = table.columns except AttributeError: columns = vars(table) return {key: value for key, value in record.items() if key in columns}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sanitise_fields(self, record):\n sanitised = {}\n for k, v in record.items():\n new_key = k.replace('(', '_').replace(')', '_')\n sanitised[new_key] = v\n return sanitised", "def clean_record(self):\n _dict = {\n key: value for (key, value) in sel...
[ "0.7768705", "0.65373653", "0.62795115", "0.60765547", "0.6009481", "0.59517825", "0.5927419", "0.5893116", "0.5849048", "0.584391", "0.5767355", "0.57646644", "0.57419175", "0.5702649", "0.5685503", "0.5644447", "0.55450684", "0.54949075", "0.54631734", "0.54530233", "0.5444...
0.8198284
0
Wrapper for converting dicts to text for postgres
def to_text(adict): new_dict = {} for key, val in sorted(adict.items()): new_dict[key] = str(val) return '$delim${{{0}}}$delim$'.format(str(new_dict))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_values_to_text(d):\n body = []\n def recur(d):\n for v in d.values():\n if type(v) == dict:\n recur(v)\n elif v != \"\" and type(v) != bool:\n body.append(str(v))\n recur(d)\n # print(f\"dict to text {d['_id']} success\")\n return \...
[ "0.6902144", "0.6586813", "0.65270615", "0.65223277", "0.6398619", "0.6283189", "0.6252355", "0.6237735", "0.6220598", "0.6182699", "0.61574626", "0.6133545", "0.61325866", "0.6065518", "0.6054474", "0.6040889", "0.5983564", "0.5966978", "0.5941365", "0.5927485", "0.59232146"...
0.59344244
19
Reshapes arrays of amplitudes which may have been flattened.
def rebuild_params(params, nstates): params['Vnn'] = params['Vnn'].reshape(nstates.n, nstates.m) params['Vno'] = params['Vno'].reshape(nstates.n, nstates.mo) params['Von'] = params['Von'].reshape(nstates.no, nstates.m) params['Voo'] = params['Voo'].reshape(nstates.no, nstates.mo) return params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_stimulus(stimulus):\n n, h, w = stimulus.shape\n return stimulus.reshape((n, h * w))", "def flatten_layers(data):\n return data.reshape((data.shape[0], data.shape[1], -1))", "def flatten_numpy(ndarray):\n return np.reshape(ndarray, (-1,), 'F')", "def flatten_image(inputs):\n ...
[ "0.67002964", "0.6306067", "0.6293077", "0.6222935", "0.6164062", "0.60751826", "0.6065569", "0.602171", "0.5941782", "0.5935112", "0.5917867", "0.58548456", "0.5837408", "0.5832657", "0.58044416", "0.5792405", "0.57879394", "0.5758043", "0.5734841", "0.57341933", "0.5718947"...
0.0
-1
Parse a string representation of a dictionary, e.g.,
def parse_string_dict(dict_as_string): new_dict = ast.literal_eval(dict_as_string[1:-1]) new_dict = {key: parse_string(val) for key, val in new_dict.items()} return new_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_dict(txt):\n pairs = txt[txt.index('{')+1:txt.rindex('}')].split(',') # need to inplement a correct split by comma\n d = {}\n for p in pairs:\n if p:\n splt = p.split(':')\n key = splt[0].strip()\n value = splt[1].strip()\n if value[0] == '{':\n...
[ "0.6813349", "0.67471504", "0.65554583", "0.6505521", "0.6483303", "0.6417136", "0.63636893", "0.629334", "0.6261636", "0.62039405", "0.6178307", "0.6155987", "0.6088658", "0.6058405", "0.60359", "0.60221696", "0.5994995", "0.5986573", "0.59692", "0.5951037", "0.59507596", ...
0.79582787
0
Parse a string representation of an array of gvars into an array of gvars. This operation arises frequently, for example, when reading from the various "glance" tables, which store preprocessed data.
def parse_string(str_arr): def to_arr(str_arr): """ Switch to list. """ row = str_arr.replace(']', '').\ replace('[', '').\ replace('{', '').\ replace('}', '').\ replace('\n', '').split() if '+-' in row: row = kludge_gvars(row) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(arr_str):\n return arr_str.rstrip().replace(' ', '').split(',')[:-1]", "def convert_strings_to_array(strings):\n row_strings = strings.split(\"\\n\")\n new_array = np.array([[float(i) for i in row_string.split(\",\")] for row_string in row_strings])\n shape = new_array.shape\n if shape[1...
[ "0.63184726", "0.5962173", "0.5946905", "0.593627", "0.59265995", "0.5860213", "0.579188", "0.56896275", "0.5681272", "0.5645227", "0.5643714", "0.56135464", "0.5585567", "0.5552104", "0.5551407", "0.5538226", "0.5523727", "0.5477755", "0.5459959", "0.5417494", "0.5411672", ...
0.79506093
0
Occasionally, gvars get rendered to strings as, e.g., 4e06 + 1 instead of 0.000006(1.0). This makes a complete mess of trying to parse the a list of gvar which has been turned into a string, e.g., '[1(2) 1 + 2 0.003(2)]', since the usual str.split() separates '1 + 2' > ['1','+','2']. This function is a kludge which wor...
def kludge_gvars(mangled): # Loop in reverse looking for '+-', but don't run off the end for idx in range(len(mangled) - 1)[::-1]: if mangled[idx + 1] == '+-': reunited = ' '.join(mangled[idx:idx + 3]) # Throw away the used elements... for _ in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_string(str_arr):\n def to_arr(str_arr):\n \"\"\" Switch to list. \"\"\"\n row = str_arr.replace(']', '').\\\n replace('[', '').\\\n replace('{', '').\\\n replace('}', '').\\\n replace('\\n', '').split()\n\n if '+-' in row:\n r...
[ "0.73184675", "0.5792925", "0.56992584", "0.56166935", "0.5463357", "0.53742534", "0.5349036", "0.53430367", "0.5340777", "0.5338637", "0.53287876", "0.5321281", "0.531979", "0.5301091", "0.5295797", "0.5219765", "0.5208033", "0.516347", "0.51579887", "0.5147878", "0.51474804...
0.6465308
1
Upsert the content of a DataFrame into a db table
def upsert(engine, table_name, dataframe): # Reflect table from db metadata = sqla.MetaData(bind=engine) table = sqla.Table( table_name, metadata, autoload=True, autoload_with=engine) # Unpackage DataFrame records = [] for _, row in dataframe.iterrows(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_data(df, database, table, db_uri):\n try:\n engine = sqlalchemy.create_engine(db_uri)\n df = create_hash_id(df)\n\n def create_insert_sql(x):\n cols = \"`\" + \"`,`\".join(list(df.columns)) + \"`\"\n values = \"\\'\" + \"\\',\\'\".joi...
[ "0.72344434", "0.71951675", "0.715494", "0.7140779", "0.70340526", "0.7006468", "0.6899513", "0.6865268", "0.6854902", "0.68426687", "0.67907673", "0.6712339", "0.6708589", "0.670759", "0.67042094", "0.66936225", "0.6693597", "0.66493917", "0.6645235", "0.659", "0.657526", ...
0.7500038
0
Writes the dictionary 'src' to the table named 'table_name'.
def write(engine, table_name, src, return_id=True, do_update=False): query = build_upsert_query(engine, table_name, src, do_update=do_update) LOGGER.debug(query) engine.execute(query) if return_id: return fetch_id(engine, table_name, src)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_table(source_table, destination_table, db='default'):\n try:\n with connections[db].cursor() as cursor:\n cursor.execute('CREATE TABLE IF NOT EXISTS %s LIKE %s;' % (destination_table, source_table))\n except:\n pass", "def _schema_write(self, table: Tab...
[ "0.59626514", "0.5931484", "0.5827578", "0.5823976", "0.57344264", "0.57290435", "0.56961876", "0.5692005", "0.56391126", "0.56303656", "0.5589605", "0.5557386", "0.55331343", "0.5516523", "0.55136675", "0.5495206", "0.54833347", "0.5448401", "0.54384375", "0.5437824", "0.539...
0.62851363
0
Fetch id from database given a query with error handling.
def fetch_id(engine, table_name, src): # Helper functions def get_unique_columns(table): """ Gets the unique columns from the table's contraints. """ for constraint in table.constraints: if isinstance(constraint, sqla.UniqueConstraint): return constraint.columns ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(cls, query=None, **kwargs):\n cursor = cls.query(query, fields={\"_id\": 1}, **kwargs)\n if cursor.count() == 1:\n return cursor.next()[\"_id\"]\n raise ValueError(\"Invalid query: %s\" % query)", "def fetch_user_id(name):\n queryset = run_query(f\"SELECT id from use...
[ "0.7172135", "0.644114", "0.6332213", "0.6237609", "0.61626285", "0.6117308", "0.61019564", "0.6088524", "0.60715276", "0.6059735", "0.6011916", "0.5988451", "0.5945333", "0.5928132", "0.59242356", "0.59193295", "0.59062016", "0.589972", "0.5899575", "0.5889629", "0.58710647"...
0.57880425
25
Gets the unique columns from the table's contraints.
def get_unique_columns(table): for constraint in table.constraints: if isinstance(constraint, sqla.UniqueConstraint): return constraint.columns # We should never get this far. # All tables in my db should have unique constraints assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_cols(self):\n return list(set([coord[1] for coord in self.landscape]))", "def get_attr_cols(self):\n all_cols = np.arange(self.col_count)\n attr_cols = np.setdiff1d(all_cols, self.time_cols)\n return attr_cols", "def constraints(self):\n ans = self.execute(self.com...
[ "0.65937907", "0.6296229", "0.6262106", "0.62196285", "0.61645097", "0.6027742", "0.6019557", "0.5972942", "0.59648323", "0.59523666", "0.5932074", "0.59089965", "0.5894359", "0.5856457", "0.58301574", "0.5824588", "0.5823334", "0.5823334", "0.5815539", "0.5815517", "0.580525...
0.85034263
0
Gets the name of the primary key column.
def get_id_name(table): primary_key_columns = table.primary_key.columns.items() if len(primary_key_columns) == 1: name, _ = primary_key_columns[0] return name # We should never get this far. # All tables in my db should have a single primary key column ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pk_column_name(cls):\n return cls._meta.pk_column_name", "def primary_key(cls):\n\n if cls.__from_class__:\n cls = cls.__from_class__\n return cls.__table__.primary_key.columns.values()[0].name", "def get_primary_key(cls) -> str:\n return inspect(cls).primary_key[...
[ "0.8489972", "0.8386202", "0.8166243", "0.7895862", "0.7800656", "0.75968707", "0.73416424", "0.7309249", "0.7292977", "0.7266723", "0.71143186", "0.71024054", "0.7098094", "0.7098094", "0.70875776", "0.7059059", "0.697482", "0.68769145", "0.671848", "0.6676967", "0.6653327",...
0.75963014
6
Builds a raw SQL query for "upserting" data into the database.
def build_upsert_query(engine, table_name, src_dict, do_update=False): def _for_pgsql(value, dtype): """ Converts a python datatype to the appropriate string (including, e.g., \ the necessary single quotes and/or brackets ) for use in a raw \ postgresql query. Args: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_upsert_sql(mon_loc):\n mon_loc_db = [(k, _manipulate_values(v, k in TIME_COLUMNS)) for k, v in mon_loc.items()]\n all_columns = ','.join(col for (col, _) in mon_loc_db)\n all_values = ','.join(value for (_, value) in mon_loc_db)\n update_query = ','.join(f\"{k}={v}\" for (k, v) in mon_loc...
[ "0.6856745", "0.62934977", "0.6097199", "0.6094336", "0.6082441", "0.6049717", "0.59614617", "0.5931908", "0.5901273", "0.57127017", "0.56941617", "0.56601083", "0.56386846", "0.557427", "0.55658185", "0.55294424", "0.5524274", "0.5510159", "0.5497966", "0.54956716", "0.54865...
0.72920215
0
Converts a python datatype to the appropriate string (including, e.g., \ the necessary single quotes and/or brackets ) for use in a raw \ postgresql query.
def _for_pgsql(value, dtype): if dtype.startswith(('int', 'float', 'double', 'numeric')): if value is None: return "Null" elif str(value).lower() == 'nan': return "'nan'" elif dtype.endswith('[]'): value = ', '.join([str(v) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typecast(dtype: Any) -> str:\n if dtype is int:\n return \"Int64\"\n elif dtype is float:\n return \"Float64\"\n elif dtype is bool:\n return \"bool\"\n return \"string\"", "def escapeinput_data_for_sql(self, value, sql_type):\n\t\t# print value\n\...
[ "0.72594017", "0.7176732", "0.70983726", "0.701285", "0.7011267", "0.69050854", "0.6897729", "0.6891294", "0.66907203", "0.65747005", "0.65560377", "0.6526946", "0.6434319", "0.6389201", "0.6378415", "0.6377122", "0.6342456", "0.6311862", "0.62993383", "0.6254328", "0.6250282...
0.7943686
0
Gets a list of values for use in a raw SQL query, e.g., INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...); This function returns a string "value1, value2, ..."
def _get_values(uprow, types): tmp_uprow = {k: _for_pgsql(v, types[k]) for k, v in uprow.items()} mappable = ",".join(["{" + str(k) + "}" for k in uprow.keys()]) values = mappable.format(**tmp_uprow) return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sqllist(values):\n items = []\n items.append('(')\n for i, v in enumerate(values):\n if i != 0:\n items.append(', ')\n items.append(sqlparam(v))\n items.append(')')\n return SQLQuery(items)", "def select_fields_as_sql(self):\n fields = '*'\n if self._fie...
[ "0.680914", "0.63399404", "0.6291423", "0.6278056", "0.627433", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0.62332934", "0...
0.5523545
65
Gets a list of "set pairs" for use in a raw SQL query, e.g., INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...) ON CONFLOCT (column1) DO UPDATE SET column1=value1, column2=value2 This function returns a string "column1=value1, column=value2
def _get_set_pairs(uprow, types): pairs = [] for key, val in uprow.items(): pairs.append("{0}={1}".format(key, _for_pgsql(val, types[key]))) return ", ".join(pairs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_sql_update_set_formatted_string(keys_list: List[str]):\n\n return \", \".join([f\"{key} = :{key}\" for key in keys_list])", "def sql_filtered_insert(table, set_columns, values):\n for index in range(len(set_columns) - 1, -1, -1):\n if values[index] is None:\n del set_columns[...
[ "0.60592306", "0.5937135", "0.5752619", "0.55114925", "0.5503095", "0.5496429", "0.546202", "0.5449382", "0.5340713", "0.5311094", "0.5305011", "0.52147573", "0.51948994", "0.5189435", "0.51842463", "0.5181503", "0.51571256", "0.5146145", "0.51329595", "0.5124207", "0.5090333...
0.7233016
0
Fetches a list of correlators matching the specified form factor.
def fetch_basenames(engine, form_factor): for key in ['current', 'm_mother', 'm_daughter', 'm_spectator', 'momentum']: if key not in form_factor: raise KeyError(f"Required key '{key}' is missing.") def abspath(dirname): return os.path.join(pathlib.Path(__file__).parent.absolute(), d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_corr_ids(engine, basename):\n query = (\n \"SELECT id AS correlator_id \"\n \"FROM correlators \"\n f\"WHERE name LIKE '{basename}%%';\")\n corr_ids = pd.read_sql_query(query, engine)['correlator_id']\n return corr_ids", "def _all_word_forms(self):\n all_word_forms = ...
[ "0.5065303", "0.49833453", "0.48512962", "0.48390126", "0.47684383", "0.47402024", "0.47051248", "0.46746743", "0.46732098", "0.46706173", "0.46581146", "0.4630977", "0.46242094", "0.461068", "0.46085858", "0.46028313", "0.46000963", "0.45869887", "0.4582591", "0.45775443", "...
0.5916252
0
Gets the spatial size of the lattice in the configuration
def get_ns(name): ensembles = conventions.ensembles mask = (ensembles['name'] == name) return utils.extract_unique(ensembles[mask], 'ns')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_size(self):\n return self._grid_size", "def getGridSize(self):\n # This is set by the mosaic module, but other modules need to\n # know the values to take the proper size grid.\n return self.grid_size", "def get_size(self):\n return self._surf.get_size()", "def wor...
[ "0.7054524", "0.69292253", "0.6899915", "0.6797421", "0.67868155", "0.6740568", "0.6701795", "0.6697216", "0.666068", "0.66537803", "0.66386664", "0.65317744", "0.64973646", "0.64768213", "0.644282", "0.6411037", "0.6410956", "0.64063424", "0.6390087", "0.63867396", "0.638506...
0.0
-1
Gets the temporal size of the lattice in the configuration
def get_nt(name): ensembles = conventions.ensembles mask = (ensembles['name'] == name) return utils.extract_unique(ensembles[mask], 'nt')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return _lattice.length(self._accelerator.lattice)", "def n(self):\n return self._time_axis.size", "def get_dimension_length(self):\n pass", "def t_length(self):\n w = h = 2 # Width and height of grid\n return sqrt(min(abs(self.x), w - abs(self.x))**2 +\...
[ "0.67341226", "0.64097065", "0.64090985", "0.6357382", "0.6334442", "0.62465215", "0.6212314", "0.6049741", "0.6035457", "0.60146296", "0.6009893", "0.5996161", "0.5976587", "0.5967657", "0.59429544", "0.59422684", "0.59361935", "0.5925494", "0.59207046", "0.59144056", "0.589...
0.0
-1
Gets the conventional sign associated with a matrix element / form factor.
def get_sign(current): signs = conventions.form_factor_signs mask = (signs['spin_taste_current'] == current) return utils.extract_unique(signs[mask], 'sign')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSign(self):\n return _libsbml.Input_getSign(self)", "def SIGN(A):\r\n return np.sign(A)", "def _get_significance_matrix(self) -> np.array:\n if self.author == 'yarkoni':\n if self.signf == 0.05:\n return self.corr_05\n if self.signf == 0.01:\n ...
[ "0.63887745", "0.63612455", "0.63400894", "0.6329764", "0.6299611", "0.62754524", "0.6029659", "0.6012176", "0.59190845", "0.5728139", "0.570455", "0.5564154", "0.55042964", "0.54584146", "0.54216564", "0.5362895", "0.53505296", "0.5350341", "0.5348498", "0.52633065", "0.5259...
0.58625495
9
Gets the bare quark mass from a table given an alias (e.g., '1.0 m_light').
def get_mq(a_fm, description, quark_alias): quark = conventions.quark_masses mask = utils.bundle_mask(quark, a_fm=a_fm, description=description, alias=quark_alias) return utils.extract_unique(quark[mask], 'mq')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mass(elem):\n return mass[get_num(elem)]", "def get_mass(atomic_symbol: str) -> float:\n\n if atomic_symbol in _masses.keys():\n return _masses[atomic_symbol]\n\n else:\n return 0", "def get_partmasses_from_snapshot(snapFile: str, obj, ptype: str, physicalUnit: bool=True, verbose...
[ "0.56075037", "0.53349143", "0.51502955", "0.5109111", "0.5106616", "0.50786525", "0.5076463", "0.5056412", "0.5054362", "0.5034129", "0.49788535", "0.49532908", "0.4943248", "0.494091", "0.49403346", "0.49308905", "0.48798323", "0.48783863", "0.48378706", "0.48201647", "0.48...
0.46212307
37
Gets an alias for a quark mass (e.g., '1.0 m_light') from a table.
def get_alias(a_fm, description, quark_mass): quark = conventions.quark_masses mask = utils.bundle_mask(quark, a_fm=a_fm, description=description, mq=quark_mass) return utils.extract_unique(quark[mask], 'alias')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _masses_string(self):\n return_str = 'Masses\\n\\n'\n for at in self.atom_types:\n return_str += '{} {:9.5f} # {}\\n'.format( at.atom_type_index, float(at.mass), at.label)\n return_str += '\\n'\n return return_str", "def loc_massmet(mass):\n return np.interp(mass, ma...
[ "0.52080846", "0.50464433", "0.49144888", "0.48627576", "0.48407552", "0.4818113", "0.48110572", "0.47752094", "0.47583362", "0.47391355", "0.47382006", "0.47375157", "0.47296125", "0.47048503", "0.46953273", "0.4686729", "0.4680874", "0.46636742", "0.4646696", "0.46301967", ...
0.65231496
0
Gets an ensemble name (e.g., 'l3248f211b580m002426m06730m8447allHISQ') from a table.
def get_ensemble(a_fm, description): ens = conventions.ensembles mask = utils.bundle_mask(ens, a_fm=a_fm, description=description) return utils.extract_unique(ens[mask], 'name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"table_name\")", "def table_name() -> str:\n pass", "def get_ensemble_id(model):\n if 'object' in model and 'ensemble_id' in model['object']:\n return \"ensemble/%s\" % model['object']['ensemble_id']", "def get_ens...
[ "0.61864436", "0.6047924", "0.5984704", "0.5963371", "0.58675086", "0.57766485", "0.57766485", "0.57766485", "0.57165825", "0.56507856", "0.5600414", "0.55020577", "0.54538095", "0.54127026", "0.54070127", "0.53957826", "0.53616095", "0.53559667", "0.5337466", "0.5336691", "0...
0.55460835
11
Test that variant libraries load and initialize.
def test_load_variant(variant): try: f = fvs.FVS(variant) except ImportError: pytest.skip('No variant library: {}'.format(variant)) return None except: raise assert f.variant == variant assert not f.fvslib is None f = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load_libs(self):\n script = 'var %s = {foo: \"foo\"};' % _global\n\n with js_file(script) as path:\n utils.load_libs([path])\n\n self.assertEqual('foo', utils.run_script('%s.foo' % _global))\n self.assertEqual('true', utils.run_script('delete %s.foo' % _global))", ...
[ "0.63410246", "0.6289428", "0.60788304", "0.6077451", "0.60713", "0.6050606", "0.6022049", "0.5979783", "0.59417397", "0.59394777", "0.589408", "0.589276", "0.58614826", "0.583448", "0.58229786", "0.58219177", "0.5816688", "0.5816469", "0.57959235", "0.57952666", "0.57904017"...
0.7319842
0
Reads the slither.txt file and returns these three columns as numpy
def read_slithertxt(filename: os.PathLike) -> tuple: reg_statistics = list() consume = False with open(filename, "r") as f: for line in f: if not consume: if line.startswith(" FromLine"): reg_statistics.append(line) consume = True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_read(file_name):\n \n #open specified file in read mode\n in_file = open(file_name, \"r\")\n \n #create data lists\n sp_length_v3 = []\n sp_period_v3 = [] \n\n #save header to string and split into list\n header_string = in_file.readline()\n header_v3 = header_string.split...
[ "0.67732704", "0.66469187", "0.65621084", "0.655657", "0.6525634", "0.6487795", "0.6455106", "0.6452941", "0.64487594", "0.6442892", "0.63788307", "0.6374876", "0.6372156", "0.63671476", "0.6366139", "0.632144", "0.6305059", "0.6282006", "0.6272563", "0.6251759", "0.62306505"...
0.0
-1
Read text files generated by slither. Calculate the error magnitude from the control points. The local minima and maxima of the plotted points are found. These points are interpolated, to create 2 functions. Statistics about the difference between these two fuctions are generated to give information about the jitter co...
def Polyfit(slither_file: os.PathLike, plot=False) -> tuple: (xline, lineoffsets, sampoffsets) = read_slithertxt(slither_file) magnitudes = np.hypot(lineoffsets, sampoffsets) poly_deg = 6 if np.size(xline) > 40000: poly_deg = 12 coefficients = P.polyfit(xline, magnitudes, poly_deg) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Read_file(filename):\n\n #Extracts the value of n from the name\n n = int(filename[17:-4])\n\n with open(filename, 'r') as infile:\n\n \t#Storing the error values within the function\n Error_S = [] #Special\n Error_G = [] #General\n\n infile.readline()\n\n #Stores ...
[ "0.64246786", "0.61717594", "0.58892775", "0.58662647", "0.57032037", "0.5685859", "0.5669828", "0.5594534", "0.5551455", "0.5520788", "0.54848605", "0.5474506", "0.5474458", "0.5474393", "0.54718345", "0.5460056", "0.5457734", "0.5430146", "0.5417541", "0.5411267", "0.539409...
0.5681415
6
Main scripting function for plotting our data.
def main(): # Get dataset and create pandas dataframe f_data = "../data/dataset.xlsx" df = pd.read_excel(f_data) # Get variables for indices years = list(set(df["Year"][3:])) years_arr = df["Year"][3:] # Get values from dataset population = df["Population.1"][3:] auto_commuters = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot():\n pass", "def plot_data(self):", "def main():\n style.use(\"ggplot\")\n start = datetime.datetime(2020, 1, 1)\n end = datetime.datetime(2020, 4, 17)\n\n create_csv(start, end)\n data_frame = read_csv()\n plot_data(data_frame)", "def main():\n df_data = import_clean_process...
[ "0.78420514", "0.77196044", "0.76682806", "0.7593646", "0.74905694", "0.74766713", "0.7274394", "0.7098579", "0.706427", "0.70011044", "0.69995123", "0.6999315", "0.6981316", "0.6978493", "0.69263273", "0.68902665", "0.6822756", "0.68207484", "0.6800787", "0.68002826", "0.677...
0.0
-1
Set the sudoku matrix with values generated or load from txt or csv files
def __init__(self, source=None): self.sudoku_matrix = [] if (source == None): generator = Generator() dificult = self.get_cells_to_hide(self.difficult) self.sudoku_matrix = generator.get_matrix() self.sudoku_matrix_solved = copy.copy(self.sudoku_matrix) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill(self, file = None):\n\t\tif file == None:\n\t\t\tself.prefill = {}\n\t\telse:\n\t\t\tf = open('sudoku.txt')\n\t\t\tself.prefill = f.read()\n\t\t\tf.close()\n\t\tfor u in range(2* self.N**2,3* self.N**2):\n\t\t for val in range(self.N**2):\n\t\t self.setValue(val+1,0,0,self.unitlist[u][val])\...
[ "0.7043627", "0.66455054", "0.64732325", "0.6458863", "0.637063", "0.6319863", "0.6227423", "0.6161337", "0.6151844", "0.61392516", "0.60924405", "0.6086447", "0.60792553", "0.60476714", "0.60335016", "0.60113776", "0.5956608", "0.594877", "0.5907189", "0.59059143", "0.587779...
0.5978981
16
Set a new sudoku matrix with new matrix
def set_sudoku_matrix(self, matrix): self.sudoku_matrix = matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_sudoku(size):\r\n def mutate_list_1(lst, size):\r\n \"\"\"Helper function for removing part of a list from the beginning and add it to the end.\"\"\"\r\n count = 0\r\n while count < size:\r\n elem = lst[0]\r\n lst.remove(elem)\r\n lst.append(elem)\r...
[ "0.6697235", "0.6546988", "0.6452423", "0.6357415", "0.6334121", "0.6234853", "0.6204221", "0.61754245", "0.60981035", "0.6080238", "0.6060617", "0.5981177", "0.59771913", "0.59540534", "0.5935847", "0.59132874", "0.5873409", "0.5855094", "0.5833647", "0.5826307", "0.5797247"...
0.75624293
0
Return the Cell object in the row and column position
def get_cell(self, row, column): return self.sudoku_matrix[row][column]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_from_xy(self,x,y):\n return self.cell_array.item((x,y))", "def cell(self):\n return self._cell", "def getCell(self, row, column):\n\t\t\t\t\n\t\t\t\tif ((row is None) or (column is None)):\n\t\t\t\t\traise NotImplementedError()\n\n\t\t\t\treturn self.thing[self.convertColumn(row = row, colum...
[ "0.78056264", "0.7625454", "0.7583768", "0.74747694", "0.7398449", "0.7367573", "0.73494375", "0.7321168", "0.7258564", "0.7245528", "0.7196293", "0.71352375", "0.7028381", "0.70115393", "0.6975928", "0.6946422", "0.69435024", "0.6932324", "0.6905336", "0.68930906", "0.688538...
0.7386752
5
Set with new value Cell object in the row and column position
def set_cell_value(self, row, column, value): self.sudoku_matrix[row][column].set_cell_value(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cell(self, x, y, val):\n pass", "def set_cell(self, x, y, val):\n pass", "def set_cell(self, pos, value):\n\t\tpos = Point(pos)\n\t\tif not self.valid(pos):\n\t\t\traise KeyError('Invalid cell position: {0}'.format(pos))\n\t\tself.data[pos.x + pos.y * self.dims.width] = value", "def set...
[ "0.8293057", "0.8293057", "0.79259425", "0.79001033", "0.7870597", "0.78485376", "0.7747513", "0.7586554", "0.7506569", "0.7437959", "0.74364275", "0.74095404", "0.74095404", "0.73955786", "0.73923177", "0.73893034", "0.7361191", "0.73232293", "0.7284463", "0.72421306", "0.72...
0.76059854
7
Return a row specific from matrix
def get_row(self, row): return self.sudoku_matrix[row]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_row(A: Matrix, i: int) -> Vector:\n return A[i]", "def get_row(A: Matrix, i: int) -> Vector:\n return A[i]", "def get_row(A: Matrix, i: int) -> Vector:\n return A[i]", "def get_row(A: Matrix, i: int) -> Vector:\n return A[i] # A[i] is already the ith row", "def row(self, ind...
[ "0.7620132", "0.7620132", "0.7620132", "0.75379324", "0.72218317", "0.7033033", "0.69706535", "0.6771026", "0.66477305", "0.6589646", "0.6560662", "0.6540562", "0.65198225", "0.6476951", "0.64755523", "0.64604014", "0.6311625", "0.6293031", "0.6271344", "0.6238107", "0.617952...
0.74290156
4
Print the sudoku matrix in the console
def print_sudoku_matrix(self): row_list = 'ABCDEFGHI' print " 1 2 3 4 5 6 7 8 9 " for i in range(9): if i % 3 == 0: print " +-------+-------+-------+" var = row_list[i] + " " for j in range(9): if j % 3 == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_sudoku_solution(solution):\n for row in range(9):\n for col in range(9):\n print solution['%d-%d' % (row, col)][0],\n if col == 2 or col == 5:\n print '|',\n print\n if row == 2 or row == 5:\n print '------+-------+------'", "def p...
[ "0.76974213", "0.7565851", "0.742648", "0.7263379", "0.70990515", "0.7066005", "0.70275044", "0.70215726", "0.69965345", "0.69322765", "0.6923831", "0.689935", "0.68883264", "0.6876396", "0.6810913", "0.678954", "0.6756092", "0.6743901", "0.6702986", "0.66843426", "0.6683793"...
0.8277411
0
Hide cell in the Sudoku Matrix
def hide_values_in_matrix(self, difficult): row = random.randint(0, 8) column = random.randint(0, 8) if (difficult != 0): self.sudoku_matrix[row][column].set_cell_visibility(True) self.sudoku_matrix[row][column].set_cell_value(0) self.hide_values_in_matrix(dif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hide_numbers(self):\n global counter\n\n # num of attempts allow for more blocks to be removed\n attempts = self._difficulty\n\n while attempts > 0:\n # selecting random cell and rotational counterpart\n row = randint(0, 8)\n col = randint(0, 8)\n ...
[ "0.65699524", "0.64596504", "0.6226179", "0.6132422", "0.6060004", "0.5992399", "0.59386015", "0.58700484", "0.5865002", "0.5862993", "0.58458006", "0.5845631", "0.5832931", "0.5831914", "0.58127666", "0.57925963", "0.5776719", "0.57695794", "0.5753077", "0.5743643", "0.57357...
0.81077296
0
Return the number of cells to hide in the sudoku matrix
def get_cells_to_hide(self, level): level = LEVEL[level] bottom = level[BOTTOM] top = level[TOP] return random.randint(bottom, top)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden_size(self) ->int:\n return self._cell.hidden_size", "def get_nr_of_misplaced_tiles(board):\n result = 0\n\n for idx, val in enumerate(board):\n if idx != val:\n result += 1\n\n return result", "def num_tiles(self):\n return self.num_row_tiles * self.num_col_tiles...
[ "0.6851427", "0.67683876", "0.6442625", "0.64257145", "0.63657075", "0.62987983", "0.6287048", "0.62678534", "0.6261129", "0.6133854", "0.6108344", "0.6097024", "0.6078523", "0.6043076", "0.60241365", "0.60180855", "0.60180855", "0.60180855", "0.60180855", "0.6002305", "0.600...
0.59856254
23
Return a sudoku matrix
def get_sudoku_matrix(self): return self.sudoku_matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sudoku(self)->list:\n grid = [[None for x in range(9)] for row in range(9)]\n for row in range(0,9):\n for column in range(0,9):\n if row <= 2 and column <=2:\n grid[row][column] = cell.Cell(0)\n elif row <= 2 and 3 <= column <= 5...
[ "0.7414889", "0.73049223", "0.6996909", "0.69424963", "0.6888324", "0.6766059", "0.670372", "0.6643427", "0.65220934", "0.65055496", "0.6481994", "0.64216775", "0.6404281", "0.63746357", "0.63286084", "0.6325936", "0.6321227", "0.62994", "0.6287115", "0.6272716", "0.6261372",...
0.79606533
0
Return a sudoku matrix solved
def get_sudoku_matrix_solved(self): return self.sudoku_matrix_solved
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_sudoku(sudoku):\n # Define the solution matrix that represents the sudoku puzzle\n solution = Matrix(9, 9, 1, 9)\n\n # Set up the model\n model = Model()\n\n # Set the constraints for the filled in cells\n for i in xrange(0, 9):\n for j in xrange(0, 9):\n if sudoku[i, ...
[ "0.77757585", "0.77223897", "0.7591495", "0.70577496", "0.7051063", "0.69597095", "0.6938633", "0.6924226", "0.68827355", "0.6863994", "0.68432903", "0.6843008", "0.68340075", "0.68323416", "0.68165493", "0.67729443", "0.6767388", "0.67517245", "0.66757387", "0.6663423", "0.6...
0.7767136
1
Method that compare if two SudokuMatrix object are equals
def __eq__(self, other_sudoku_matrix): equals = False for row in range(9): for col in range(9): if int(self.get_cell(row, col).get_cell_value()) == int( other_sudoku_matrix.get_cell(row, col).get_cell_value()): equals = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not issubclass(type(other), Matrix):\n return False\n\n if self.rows != other.rows or self.columns != other.columns:\n return False\n\n return self.data == other.data", "def __eq__(self, other):\r\n return self.id_map == other.id_map...
[ "0.76117563", "0.74743104", "0.7445452", "0.74154025", "0.73595923", "0.7285003", "0.72529274", "0.71656305", "0.71012837", "0.7078154", "0.7041093", "0.7036643", "0.7032445", "0.70261645", "0.697155", "0.6970848", "0.69523555", "0.69491196", "0.693337", "0.6912804", "0.68703...
0.8493141
0
Upload raw data to S3 bucket.
def upload_to_s3(s3_path, local_path): # Connect to s3 using aws access key try: s3 = boto3.client('s3', aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"), aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY")) logger.info("AWS S3 C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_data_to_s3(data: dict, bucket_name: str, object_key: str) -> None:\n uploader = S3Uploader(bucket_name)\n with tempfile.NamedTemporaryFile(mode=\"w+\") as local_file:\n json.dump(data, local_file, cls=FancyJsonEncoder, indent=\" \", sort_keys=True)\n local_file.write(\"\\n\")\n ...
[ "0.74685735", "0.7427481", "0.7208468", "0.7153383", "0.7142303", "0.70791346", "0.70186585", "0.7013935", "0.69651985", "0.69235253", "0.68543494", "0.6688864", "0.6676884", "0.66754943", "0.66526854", "0.66480595", "0.6605558", "0.6580974", "0.65795255", "0.65679586", "0.65...
0.0
-1
Download the contents of a folder directory
def _download_s3_folder(s3, bucket_name, s3_store_path, local_dir): bucket = s3.Bucket(bucket_name) for obj in bucket.objects.filter(Prefix=s3_store_path): target = os.path.join(local_dir, os.path.relpath(obj.key, s3_store_path)) if not os.path.exists(os.path.dirname(target)): os.mak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downloadFromFolder(page, foldername):\n p = session.get(page)\n soup = BeautifulSoup(p.content, 'html.parser')\n allLinks = soup.find_all(\"a\", href=lambda href: href and \"viewContent\" in href)\n\n folderExists = os.path.isdir(foldername)\n if not folderExists:\n os.mkdir(foldername)\n...
[ "0.73303354", "0.72371423", "0.7218754", "0.71139175", "0.7106033", "0.7054894", "0.70338887", "0.7030627", "0.7004934", "0.69976723", "0.6853534", "0.68197316", "0.6810022", "0.6791774", "0.6779699", "0.67460555", "0.673998", "0.673998", "0.67339975", "0.67309266", "0.672915...
0.61547947
83
Download raw data from S3 bucket.
def download_from_s3(s3_path, local_path): # Connect to s3 using aws access key try: s3 = boto3.resource('s3', aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"), aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY")) logger.info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_download(path):\n with s3_read(path):\n # Reading the file will cache the file locally.\n pass", "def s3_read_data(self):\n\n self.k.open()\n self.k.read()", "def download(bucket, key):\n validate_bucket_name(bucket)\n validate_key_name(key)\n client = get_client()\n\n ...
[ "0.7604857", "0.7338547", "0.7127144", "0.7111299", "0.7058137", "0.70307565", "0.7017735", "0.69529027", "0.6855166", "0.6800091", "0.6793414", "0.6792256", "0.6792256", "0.67667466", "0.66777736", "0.66755164", "0.6660485", "0.66556364", "0.6653632", "0.6616154", "0.6606225...
0.0
-1
Create HYPER_FILE from SCHEMA_FILE and load with metadata query results
def create_extract(): with open(SCHEMA_FILE, "r") as f: SCHEMA = yaml.safe_load(f) with open(TOKEN_FILE, "r") as f: TOKEN = yaml.safe_load(f) hc = HyperCreator(SCHEMA, HYPER_FILE) ts = Tableau(TOKEN["server"], TOKEN["site"], TOKEN["name"], TOKEN["value"]) for table in SCHEMA["tabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_schema(self, cypher_file):\n if len(self.graph.nodes) > 0:\n msg = \"Cypher file specified but the graph is not empty. Aborting.\"\n raise ValueError(msg)\n cyp = open(cypher_file, 'r').read()\n self.graph.run(cyp)", "def schema_load(filename):\n print(uc...
[ "0.59176916", "0.59136146", "0.5844736", "0.57159436", "0.5710448", "0.56559134", "0.5615624", "0.55509704", "0.55457634", "0.5543642", "0.5458917", "0.54457504", "0.5437242", "0.5436896", "0.5408508", "0.54038095", "0.53769493", "0.53524965", "0.5347491", "0.53469646", "0.53...
0.6245237
0
Replace current extract in TDSX_FILE with HYPER_FILE
def update_datasource(): ds = Datasource(TDSX_FILE) ds.replace_extract(HYPER_FILE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hxlreplace():\n run_script(hxlreplace_main)", "def replace_extract(self, file_path):\n tmp_file = shutil.copy2(self.path, \"tmpzip\")\n with ZipFile(tmp_file) as src, ZipFile(self.path, \"w\") as dst:\n for src_info in src.infolist():\n _, src_tail = path.split(src_...
[ "0.56128925", "0.52839655", "0.51912695", "0.51302993", "0.5060519", "0.5014787", "0.4933431", "0.48355338", "0.48326963", "0.48252073", "0.4821674", "0.4805997", "0.4800545", "0.4786376", "0.47716513", "0.47544852", "0.4748637", "0.4746096", "0.47163612", "0.46886548", "0.46...
0.6904954
0
Returns dynamic parameters for the CloudFormation Stack to use.
def handler(event, context): status = cfnresponse.FAILED physical_resource_id = None response_data = {} try: # Start with the default parameters. response_data.update(event["ResourceProperties"]["DefaultParams"]) # Then override with any values from the secret. secret ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_stack_parameters(config):\n params_list = []\n for k, v in config.iteritems():\n params = {}\n params['ParameterKey'] = k\n params['ParameterValue'] = v\n params_list.append(params)\n\n return params_list", "def getStackParameters(self, stackId):\n result = {}\n ...
[ "0.65977055", "0.65422225", "0.6452291", "0.5996952", "0.5995743", "0.5958775", "0.59024173", "0.5901457", "0.5877718", "0.58506066", "0.5813036", "0.5763953", "0.5754946", "0.5750032", "0.5730209", "0.57167464", "0.56996757", "0.56972235", "0.5693405", "0.56848246", "0.56779...
0.0
-1
Gets the current desired count of the specified ECS Service.
def get_desired_count(cluster_name, service_name): response = ecs_client.describe_services( cluster=cluster_name, services=[service_name], ) for service in response["services"]: return service["desiredCount"] raise Exception( f"desiredCount not found for cluster: {cluster_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_count(self) -> str:\n return pulumi.get(self, \"service_count\")", "def retrieve_num_instances(service):\n instance_counts = service[\"instance-counts\"]\n return instance_counts[\"healthy-instances\"] + instance_counts[\"unhealthy-instances\"]", "def eventcount(self):\n return ...
[ "0.74331915", "0.6553271", "0.6328588", "0.5801972", "0.57700175", "0.5674347", "0.5674174", "0.5630112", "0.5587021", "0.553864", "0.55281293", "0.54909825", "0.5474824", "0.5431807", "0.54288244", "0.5426716", "0.54190874", "0.54064065", "0.5393235", "0.5391078", "0.5391078...
0.78649575
0
fonction qui calcul le seuil de tolerance prend les donnees a en parametre et la mediane
def get_mad(a, med): diff = (a - med[:, np.newaxis])**2 sq_diff = np.sqrt(diff) mad = np.median(sq_diff, axis = 1) return (mad)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_tolerance(wt):\n return 1 - wt", "def tolerance(self):\n return self.params['tolerance']", "def get_tolerances(self) -> Tuple[float, float]:\n return self.rtol, self.atol", "def test_michalewicz(self):\n fun = get_problem('michalewicz', dimension=2, lower=0, upper=np.pi)\n ...
[ "0.68709344", "0.6462297", "0.64004385", "0.635599", "0.62701774", "0.6162784", "0.61371195", "0.6136667", "0.6120092", "0.61070514", "0.6045578", "0.60306966", "0.6030039", "0.5962673", "0.5942221", "0.591645", "0.58894676", "0.5852954", "0.5838215", "0.58184797", "0.5812917...
0.0
-1
verification du depassement de seuil pour un spike et minimum local
def ct_bis(env, a, median, mad): b1 = (a.T < median - env.threshold * mad).T b2 = a[:, :a.shape[1] - 1] < a[:, 1:] b3 = a[:, 1:] < a[:, :a.shape[1] - 1] b1[:, :a.shape[1] - 1] = b1[:, :a.shape[1] - 1] & b2 b1[:, 1:] = b1[:, 1:] & b3 return (b1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convergence_check(self):\n air = self.air_alias.val\n flue_gas = self.fuel_alias.val + '_fg'\n fuel = self.fuel_alias.val\n\n for c in self.outl:\n if not c.fluid.val_set[air]:\n if c.fluid.val[air] > 0.95:\n c.fluid.val[air] = 0.95\n ...
[ "0.6288135", "0.6231721", "0.62251914", "0.6162475", "0.6085016", "0.60526705", "0.59460515", "0.59039253", "0.5828911", "0.58102417", "0.58088464", "0.5799586", "0.5769411", "0.57632905", "0.575154", "0.5748736", "0.57336825", "0.57308424", "0.5723363", "0.5720721", "0.57201...
0.0
-1
renvoi un tableau de boolean pour chaque instant s'il y a eu un spike qui satisfait les criteres de selection ou non
def get_spike(env, a, x = 0, y = 0): median = cal_median(a) mad = get_mad(a, median) spike_list = np.sum(ct_bis(env, a, median, mad), axis = 0) ##peut etre ignore spike_list[np.where(spike_list > 0)[0]] = 1 return (spike_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bool_value(self, event):\n\n self.undo_add()\n\n key_list = list(self.patch.engine.misc_data.keys())\n key = key_list[self.selected_index]\n data = self.patch.engine.misc_data[key]\n\n if self.ValueEnabled.GetValue():\n self.patch.misc[key] = data['on']\n ...
[ "0.5957239", "0.5956969", "0.59057784", "0.57213926", "0.5620331", "0.5620331", "0.5612405", "0.55703354", "0.5553161", "0.55510205", "0.554422", "0.55274475", "0.55022377", "0.54819643", "0.5456845", "0.5416689", "0.5408392", "0.5395505", "0.5378022", "0.53698826", "0.533776...
0.0
-1
renvoi les dates ou il y a eu un spike
def seperate_time(sp): ind = np.where(sp > 0)[0] return (ind)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_secdate(self):\r\n \r\n # Since 2017\r\n self.start_date = datetime.datetime(2017,1,1) + (datetime.datetime(2017,12,31) - datetime.datetime(2017,1,1))/2 \r\n self.end_date = datetime.datetime(2050,1,1)\r\n self.ktime = (self.end_date - self.start_date).days + 1\r\n ...
[ "0.6197489", "0.58004963", "0.57762253", "0.56973433", "0.5592801", "0.55258477", "0.54911166", "0.54818195", "0.54533905", "0.54003006", "0.53746724", "0.53456396", "0.5334183", "0.5324276", "0.53205246", "0.5310596", "0.5308153", "0.5307318", "0.5307277", "0.5307091", "0.52...
0.0
-1
renvoi les dates de spike qui marquent la fin d'un block
def get_block(env, sp, ti): ind = ti.copy() blc = np.zeros(ind.shape[0], dtype = np.int64) blc[:blc.shape[0] - 1] = ind[1:] - ind[: ind.shape[0] - 1] x = blc < env.space_block ind[x] = 0 ind[ind.shape[0] - 1] = sp.shape[0] - 1 ind = ind[np.where(ind != 0)[0]] return (ind)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateivofromevents(self, date, configuration):\n# print('UPDATE IVO FROM EVENTS', self._ivonumber)\n self._configdate = configuration.getdate()\n self._configopening = configuration.getopeningtime()\n\n timeblockdata = []\n for event in self._events:\n\n# print('E...
[ "0.5873051", "0.56689876", "0.5628953", "0.5595941", "0.5532073", "0.541149", "0.54082453", "0.54029214", "0.5399044", "0.5399044", "0.53868926", "0.5339806", "0.5336823", "0.532788", "0.5314164", "0.52965796", "0.52955675", "0.5281599", "0.52708185", "0.5269084", "0.5244126"...
0.0
-1
divise les bloc si leur taille est trop grande
def divide_block(env, blc): t = 0 size = env.size_block div = np.zeros(blc[-1] / size + blc.shape[0]) print(div.shape) index = 0 for k in blc: while k - t > size: t += size if k - t > size: div[index] = t index += 1 div[index] = k index += 1 t = k div = div[np.where(div)] return (div)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetScaleBlocks(width):\n\n rord=numpy.log10(abs(width)/2.0)\n nrord=rord % 1\n\n if nrord < numpy.log10(2):\n spc=0.2*pow(10,numpy.floor(rord))\n smallspc=spc\n bigspc=5*spc\n newspc=[0,smallspc,smallspc*2,smallspc*3,smallspc*4,smallspc*5]\n elif nrord < numpy.log10(5):\...
[ "0.5597102", "0.5440409", "0.5413998", "0.5407248", "0.53982776", "0.53873897", "0.53426784", "0.53319544", "0.5323098", "0.52931225", "0.52336675", "0.52102226", "0.52063864", "0.52051187", "0.519937", "0.5191247", "0.5171056", "0.51698107", "0.51631874", "0.5141693", "0.513...
0.5479173
1
renvoi un array a deux dimmension contenant les dates de debut et de fin de chaque bloc
def begin_end(env, blc): b_e = np.empty((blc.shape[0], 2)) inf = 0 p = 0 win = env.win_over b_e[0, 0] = inf if blc[0] + win <= blc[-1]: b_e[0, 1] = blc[0] + win else: b_e[0, 1] = blc[-1] if blc.shape[0] == 1: b_e[0, 1] = blc[0] return (b_e) for k in range(1, blc.shape[0] - 1): inf = blc[k - 1] - win...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_date_array_from_arrow(self):\n date = arrow.now()\n date_array = stock_helper.get_date_array_for_fetcher(date)\n self.assertEqual(len(date_array), 3)\n self.assertEqual(date_array[0], 2017)\n self.assertEqual(date_array[1], 5)\n self.assertEqual(date_array[2], 1)"...
[ "0.6417453", "0.6115352", "0.60171443", "0.59402215", "0.5927255", "0.5912798", "0.5893558", "0.5804538", "0.5781077", "0.5774268", "0.57163817", "0.5650595", "0.5646739", "0.56325835", "0.56310445", "0.5630453", "0.5607219", "0.5597933", "0.55879205", "0.5575852", "0.5535902...
0.0
-1
word 2 tuple by char_id
def word2tuple(word, char_id): tup = [] for c in word: if str(c) in char_id: tup.append(char_id[c]) else: tup.append(len(char_id)) return tuple(tup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_2_words(wordid_list, id2word):\n word_list = []\n for word_id in wordid_list:\n word_list.append(id2word[word_id])\n return word_list", "def create_word(char_list):", "def word_to_tuple(word):\n # since strings are sequences of letters\n # `sorted` will automatically convert a st...
[ "0.6389353", "0.6234126", "0.6034827", "0.59308624", "0.58816594", "0.5818911", "0.5749407", "0.57084274", "0.5694023", "0.56378114", "0.5637573", "0.5630778", "0.5624193", "0.55718493", "0.5571338", "0.5556244", "0.55537975", "0.55537975", "0.55444837", "0.5500204", "0.54980...
0.77017784
0
we are going to split out the domain from the url and lookup the ip address then we get both whois ip and domain name info
def get_whois(doc): #extract domain info domain = tldextract.extract(doc['url']).registered_domain hostname = doc['url'].split('/')[2] doc['hostname'] = hostname doc['ip'] = '' doc['whois'] = {} try: #lookup ip address doc['ip'] = socket.gethostbyname(hostname) except:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def WhoisLocation(url):\n location=[]\n location_str_list=[]\n try: # first try this\n #trying with pythonwhois to see if the location exists\n obj=pythonwhois.get_whois(url)\n for key in obj['contacts']['registrant']:\n location.append(obj['contacts']['registrant'][key])\n ...
[ "0.68971765", "0.68036586", "0.67154217", "0.666049", "0.6616179", "0.6454138", "0.6347413", "0.6310537", "0.6232186", "0.6190189", "0.61824244", "0.615423", "0.6112629", "0.60812247", "0.60718006", "0.60692465", "0.6044799", "0.6040898", "0.6024612", "0.5985132", "0.59559214...
0.6846455
1
We are going to see if ssl is available and if so get the certificate and parse out subject name, issuer, creation and expiration
def get_certinfo(doc): #set a two second default timeout to recieve a cert socket.setdefaulttimeout(2) doc['ssl'] = {} try: cert = ssl.get_server_certificate((doc['hostname'], 443)) #sometimes certs come back as unicode so cast to str() aka ascii cert = M2Crypto.X509.load_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ssl_certificate() :", "def get_ssl_certificate():", "def create_ssl_cert_request ( ssl_hostnames ) :\n first_hostname = ssl_hostnames[ 0 ]\n csr_filename = get_ssl_csr_filename( first_hostname )\n key_filename = get_ssl_key_filename( first_hostname )\n openssl_cnf = \"\"\"\n[req]\ndistinguished...
[ "0.78750485", "0.7820022", "0.6408302", "0.638627", "0.62366855", "0.62240607", "0.6215628", "0.61550677", "0.6098767", "0.6065729", "0.60538214", "0.60320854", "0.60295534", "0.6029417", "0.6029417", "0.60182774", "0.60069615", "0.5910515", "0.59044826", "0.59044826", "0.589...
0.7089423
2
We are going to use a headless browser to hit the target homepage and enumerate all of the other urls that we hit, cookies and the page source
def interrogate_homepage(doc): socket.setdefaulttimeout(30) doc['browser'] = {} #empty page empty = u'<html><head></head><body></body></html>' #set the path to our compiled phantomjs phantomjs = '/phantom_bin/bin/phantomjs' #set server args to ignore certificate errors serv_arg = ['-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_homepage(url):\n response = requests.get(url, timeout=10)\n soup = BeautifulSoup(response.content, 'html.parser')\n return soup", "async def main():\n #launching the browser in headless mode\n browser = await launch({'headless': True})\n page = await browser.ne...
[ "0.66040343", "0.63707286", "0.633517", "0.62551135", "0.625036", "0.62199724", "0.6212913", "0.61651903", "0.6112558", "0.6048476", "0.60329455", "0.59965056", "0.59907174", "0.5961944", "0.5914689", "0.5893945", "0.5886431", "0.5857849", "0.58555067", "0.5851134", "0.583850...
0.69595367
0
this will parse the eve log and get some information from it and add it to our document. We are just going to get the signature name for now
def get_ids_logs(doc): doc['ids'] = [] with open('/var/log/suricata/eve.json', 'r') as f: for line in f: #lets go ahead and deserialize the log and pull out sig field sig = json.loads(line)['alert']['signature'] #blergh, too lazy to comment out of suricata, or chang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_log(self):\n self.stack = []\n diff = self.diff(self.original, self.doc)\n entry = {\"_id\": utils.get_iuid(),\n \"doctype\": constants.DOCTYPE_LOG,\n \"docid\": self.doc[\"_id\"],\n \"diff\": diff,\n \"timestamp\": utils....
[ "0.58203495", "0.55198073", "0.54499614", "0.5366643", "0.536272", "0.5305847", "0.5242875", "0.51955664", "0.515198", "0.51442206", "0.5136993", "0.51346636", "0.5060666", "0.5046243", "0.5008593", "0.5006592", "0.49796999", "0.49733102", "0.49716076", "0.49515978", "0.49404...
0.5648422
1
this is a helper function to get urls requested when rendering homepage will be used for creating /etc/hosts and stunnel entries
def ssl_intercept(doc): urls = doc['browser']['urls'] tmp = [] for url in urls: tmp.append(url.split('/')[2]) return list(set(tmp))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getURLs():", "def get_urls():\r\n return []", "def get_urls(self):\n urls = []\n params = ['<{}>'.format(x) for x in self.args]\n args_length = len(self.args) - len(self.defaults)\n for i in range(len(self.defaults) + 1):\n index = -i if i > args_length else No...
[ "0.7614329", "0.70642847", "0.6896669", "0.6747725", "0.6640546", "0.6608533", "0.6482091", "0.6468303", "0.6438259", "0.6435391", "0.63892967", "0.6359961", "0.6334762", "0.6241428", "0.6237928", "0.6205748", "0.61159337", "0.6099023", "0.6097726", "0.60959667", "0.6093588",...
0.0
-1
this function will just combine all of the logic to create our doc and post to elasticsearch
def main(url, ip): doc = {'url' : url} #get the whois and domain info print('[*] Getting whois') doc = get_whois(doc) #only continue checking stuff if we can actually resolve the address if doc['ip'] != '': #get ssl information if available print('[*] Get certificate informatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(body):\n es = Elasticsearch([ELASTIC_SEARCH_HOST], http_auth=ELASTIC_SEARCH_AUTH, scheme=\"https\", port=ELASTIC_SEARCH_PORT)\n\n # Create Index If not present on host\n if not es.indices.exists('newdata'):\n es.indices.create('newdata')\n\n # Create Document in index\n entry = es.in...
[ "0.7086311", "0.6749128", "0.67328435", "0.64781183", "0.6445723", "0.64351314", "0.6410705", "0.64022684", "0.6379337", "0.6359832", "0.632842", "0.6286253", "0.62509793", "0.6244488", "0.62146986", "0.61849344", "0.61809087", "0.6175163", "0.6111917", "0.60644335", "0.60556...
0.5938289
29
Create 4 Event seeds
def run(): speak_event = Event() speak_event.information = 'Speaking about javascript frameworks: Vue, React, and Angular' speak_event.user_id = 4 speak_event.title = 'Javascript Frameworks' speak_event.type = 'speaker' db.session.add(speak_event) speak_b_event =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_events():\n import datetime\n import random\n # let's have each event occur once between 3 and 6 pm, \n # some day in the next month, and then recur for the next 1 to 8 weeks\n\n now = datetime.datetime.now().replace(minute=0, second=0)\n\n for program in Program.objects.all():\n ...
[ "0.6245705", "0.61975515", "0.6145312", "0.5989297", "0.5918478", "0.5883885", "0.58586174", "0.5817821", "0.5813418", "0.57380867", "0.5726106", "0.56680244", "0.5625041", "0.56240445", "0.5605142", "0.55938345", "0.55614495", "0.55397695", "0.5513484", "0.55061316", "0.5502...
0.5142168
67
Compute a the cocitation graph using a citation network
def cocite(G,min_citations = 2): if not G.is_directed(): msg = "The cocitation algorithm requires a directed citation graph as an input." raise nx.NetworkXError(msg) #assert type(G) == nx.classes.digraph.DiGraph edges = {} #for each node for n in G.nodes(): # for each out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neato_graph_from_corpus( corpus, max_nodes ) :\n\n O, row_dois, column_dois = cites_matrix( corpus )\n neato_cooccurrence_graph( O, column_dois )\n return None\n\n \n v = total_occurrences( O ) \n nv = v.astype( float32 ) / v.max()\n C = cooccurrence_matrix ( O )\n nC = normalized_coocc...
[ "0.63316435", "0.6326704", "0.62020963", "0.60203207", "0.5940459", "0.5838418", "0.5737226", "0.5707589", "0.56594205", "0.55725867", "0.5538882", "0.55271745", "0.54878485", "0.546096", "0.54601884", "0.5455653", "0.5437921", "0.5426384", "0.5410883", "0.5399209", "0.538272...
0.73921865
0
Find arguments suitable for forest.parse_args.parse_args e.g. bokeh serve args [ARGS] or forest [ARGS]
def parse_forest_args(argv=None): if argv is None: argv = sys.argv if "bokeh" in os.path.basename(argv[0]): i = argv.index("--args") return argv[i + 1 :] else: _, argv = forest.cli.main.parse_args(argv) return argv[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def _parse_args():\n args = sys.argv[1:]\n cmd_parser = argparse.ArgumentParser()\n cmd_parser.add_argument(\n '--produce-sub',\n dest='produce_sub',\n help='Produce submision file',\n default=False,\n action='store_true',\n )\n cmd_...
[ "0.7618636", "0.70508236", "0.7009241", "0.70071197", "0.69731104", "0.6911572", "0.6889888", "0.6851242", "0.6837971", "0.6809132", "0.6802966", "0.6788127", "0.6716655", "0.670859", "0.6699846", "0.6699645", "0.6676694", "0.6676029", "0.6669289", "0.6668221", "0.6665668", ...
0.75391984
1
Function called when a session is closed (e.g. tab closed or time out)
def on_session_destroyed(session_context): if data.AUTO_SHUTDOWN: import sys sys.exit( "\033[1;31mThe session has ended - tab closed or timeout. \n\n --- Terminating the Forest progam and relinquishing control of port. ---\033[1;00m" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_session_closed(self):\n self.session = None", "def on_session_closed(self, session):\n if session.id in self.sessions:\n del self.sessions[session.id]", "def on_exit(session):\n session.close()", "def on_session_finish(context):\n pass", "def on_session_ended():\n #...
[ "0.8020736", "0.789403", "0.76076025", "0.74092615", "0.73737943", "0.73737943", "0.71039575", "0.7012102", "0.6958117", "0.69281614", "0.6910894", "0.6883136", "0.68078315", "0.68078315", "0.68078315", "0.68078315", "0.68078315", "0.68078315", "0.68078315", "0.68078315", "0....
0.7789867
2
Enables global stackwisevirtual on target device
def configure_global_stackwise_virtual(device, domain=None): # build a list of commands to send # Add stackwise-virtual as first element in the list # Add domain only if domain argument has been provided command_list = ['stackwise-virtual'] if domain: command_list.append(f'domain {domain}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unconfigure_global_stackwise_virtual(device):\n # Single command 'no stackwise-virtual' will remove configuration\n command = 'no stackwise-virtual'\n try:\n output = device.configure(command)\n except SubCommandFailure:\n raise SubCommandFailure('Failed to remove global stackwise-vir...
[ "0.68342483", "0.6480229", "0.60656047", "0.597289", "0.58074814", "0.5528802", "0.55048174", "0.5476486", "0.5420422", "0.5391336", "0.53740263", "0.5351046", "0.5321348", "0.5261659", "0.5255115", "0.5211061", "0.5154982", "0.5148179", "0.51353693", "0.5134788", "0.50914985...
0.7372025
0
Disable global stackwisevirtual on target device
def unconfigure_global_stackwise_virtual(device): # Single command 'no stackwise-virtual' will remove configuration command = 'no stackwise-virtual' try: output = device.configure(command) except SubCommandFailure: raise SubCommandFailure('Failed to remove global stackwise-virtual') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unconfigure_global_dual_active_recovery_reload_disable(device):\n # build a list of commands to send\n # Add stackwise-virtual as first element in the list\n # Enables dual-active recovery-reload\n command_list = ['stackwise-virtual']\n command_list.append(f'no dual-active recovery-reload-disabl...
[ "0.706992", "0.68339354", "0.64037496", "0.6261719", "0.5786086", "0.5731109", "0.57200205", "0.5654615", "0.5543812", "0.5446901", "0.5438316", "0.5315058", "0.52804273", "0.52761424", "0.52732956", "0.52600944", "0.5244586", "0.52351683", "0.5188351", "0.518542", "0.5179736...
0.79329497
0
Enables global stackwisevirtual on target device
def configure_stackwise_virtual_interfaces(device, svl_links): # build a list of commands to send # Add stackwise-virtual as first element in the list # Add domain only if domain argument has been provided command_list = [] for interface, link_id in svl_links.items(): command_list.append(f'i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_global_stackwise_virtual(device, domain=None):\n # build a list of commands to send\n # Add stackwise-virtual as first element in the list\n # Add domain only if domain argument has been provided\n command_list = ['stackwise-virtual']\n if domain:\n command_list.append(f'domain ...
[ "0.7372025", "0.68342483", "0.6480229", "0.60656047", "0.597289", "0.5528802", "0.55048174", "0.5476486", "0.5420422", "0.5391336", "0.53740263", "0.5351046", "0.5321348", "0.5261659", "0.5255115", "0.5211061", "0.5154982", "0.5148179", "0.51353693", "0.5134788", "0.50914985"...
0.58074814
5
Disable global stackwisevirtual on target device
def unconfigure_stackwise_virtual_interfaces(device, svl_links, timeout=60): # Single command 'no stackwise-virtual' will remove configuration' dialog = Dialog([ Statement( pattern=r"WARNING\: Unconfiguring last active port\, this may result in stack-split\. Are you sure\? \[yes\/no\]\:", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unconfigure_global_stackwise_virtual(device):\n # Single command 'no stackwise-virtual' will remove configuration\n command = 'no stackwise-virtual'\n try:\n output = device.configure(command)\n except SubCommandFailure:\n raise SubCommandFailure('Failed to remove global stackwise-vir...
[ "0.79329896", "0.7070052", "0.6834306", "0.6404434", "0.62599164", "0.5786762", "0.5731222", "0.57185566", "0.55447024", "0.5446781", "0.5438783", "0.53161603", "0.5280518", "0.52745193", "0.527212", "0.526138", "0.52463883", "0.5234619", "0.51890075", "0.5187541", "0.5179514...
0.5653971
8
Enables interface as dualactivedetection interface on target device
def configure_stackwise_virtual_dual_active_interfaces(device, dad_links): # build a list of commands to send command_list = [] output = '' for interface in dad_links: command_list.append(f'interface {interface}') command_list.append(f'stackwise-virtual dual-active-detection') try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self):\n # Netmiko reports enable and config mode as being enabled\n if not self.native.check_enable_mode():\n self.native.enable()\n # Ensure device is not in config mode\n if self.native.check_config_mode():\n self.native.exit_config_mode()\n\n ...
[ "0.59566253", "0.58459336", "0.58459336", "0.58156496", "0.5751097", "0.5745842", "0.55513084", "0.55439985", "0.55354583", "0.55209297", "0.54976976", "0.54834133", "0.5471087", "0.5468166", "0.5451829", "0.5439863", "0.5418576", "0.54149604", "0.5405614", "0.5400771", "0.53...
0.6329942
0
Disables interface as dualactivedetection interface on target device
def unconfigure_stackwise_virtual_dual_active_interfaces(device, dad_links): # build a list of commands to send command_list = [] output = '' for interface in dad_links: command_list.append(f'interface {interface}') command_list.append(f'no stackwise-virtual dual-active-detection') t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_radio(self):\n self.acquire_response(b'AT*R0')", "def test_multi_ap_disabled_on_ap(dev, apdev):\n run_multi_ap_association(dev, apdev, 0, wait_connect=False)\n ev = dev[0].wait_event([\"CTRL-EVENT-DISCONNECTED\",\n \"CTRL-EVENT-CONNECTED\"],\n ...
[ "0.66088223", "0.6341192", "0.63072246", "0.6244302", "0.62327534", "0.61326903", "0.6128818", "0.60196", "0.59937257", "0.59796137", "0.5866469", "0.5817195", "0.5772791", "0.5772595", "0.57619154", "0.5754597", "0.5747553", "0.5739801", "0.57308346", "0.57193846", "0.571036...
0.65191627
1
Enables global stackwisevirtual dualactive recovery reload on target device
def configure_global_dual_active_recovery_reload_disable(device): # build a list of commands to send # Add stackwise-virtual as first element in the list # Disables dual-active recovery-reload command_list = ['stackwise-virtual'] command_list.append(f'dual-active recovery-reload-disable') try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unconfigure_global_dual_active_recovery_reload_disable(device):\n # build a list of commands to send\n # Add stackwise-virtual as first element in the list\n # Enables dual-active recovery-reload\n command_list = ['stackwise-virtual']\n command_list.append(f'no dual-active recovery-reload-disabl...
[ "0.7184057", "0.58807933", "0.57247466", "0.56831115", "0.5650668", "0.5400074", "0.53629565", "0.5327328", "0.5324608", "0.5303408", "0.5283625", "0.52727073", "0.5241073", "0.5214699", "0.5210306", "0.5202273", "0.52008003", "0.51674765", "0.51405495", "0.51349705", "0.5121...
0.7698362
0
Enables global stackwisevirtual dualactive recovery reload on target device
def unconfigure_global_dual_active_recovery_reload_disable(device): # build a list of commands to send # Add stackwise-virtual as first element in the list # Enables dual-active recovery-reload command_list = ['stackwise-virtual'] command_list.append(f'no dual-active recovery-reload-disable') tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_global_dual_active_recovery_reload_disable(device):\n # build a list of commands to send\n # Add stackwise-virtual as first element in the list\n # Disables dual-active recovery-reload\n command_list = ['stackwise-virtual']\n command_list.append(f'dual-active recovery-reload-disable')\...
[ "0.769706", "0.588012", "0.5724654", "0.56823856", "0.56489444", "0.53998864", "0.5360985", "0.5327254", "0.5325075", "0.53030884", "0.5281263", "0.52710766", "0.5242105", "0.52126044", "0.5210789", "0.5200721", "0.52006316", "0.516452", "0.5139679", "0.5134392", "0.5118748",...
0.7182636
1
Enables portchannel interface as pagp dualactivedetection interface on target device
def configure_stackwise_virtual_dual_active_pagp(device, port_channel): # build a list of commands to send command_list = ['stackwise-virtual'] command_list.append(f'dual-active detection pagp') if port_channel: command_list.append(f'dual-active detection pagp trust channel-group {port_channel}'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unconfigure_stackwise_virtual_dual_active_pagp(device, port_channel):\n # build a list of commands to send\n command_list = ['stackwise-virtual']\n if port_channel:\n command_list.append(f'no dual-active detection pagp trust channel-group {port_channel}')\n try:\n output = device.conf...
[ "0.65177065", "0.61992884", "0.60917014", "0.6039055", "0.5977526", "0.5824682", "0.56919676", "0.56499", "0.5644209", "0.5620075", "0.5562014", "0.5530952", "0.5519772", "0.5477032", "0.54757065", "0.54713", "0.54712033", "0.54548246", "0.54346675", "0.5419358", "0.5413673",...
0.72997487
0
Disables portchannel interface as pagp dualactivedetection interface on target device
def unconfigure_stackwise_virtual_dual_active_pagp(device, port_channel): # build a list of commands to send command_list = ['stackwise-virtual'] if port_channel: command_list.append(f'no dual-active detection pagp trust channel-group {port_channel}') try: output = device.configure(comma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_cable_ports(cid):\n\n SQL.execute('''\n SELECT \n cpid,\n guid,\n port,\n hca\n FROM \n cable_ports \n WHERE\n cid = ?\n ''',(\n cid,\n ))\n\n for row in SQL.fetchall(): \n if row['hca']:\n ...
[ "0.6764529", "0.6580187", "0.654981", "0.6532149", "0.6376193", "0.60966444", "0.6051892", "0.60355073", "0.60077417", "0.59775054", "0.59527487", "0.59240466", "0.59167486", "0.59125966", "0.5908374", "0.5862209", "0.58325285", "0.5819661", "0.58103955", "0.5798171", "0.5784...
0.72111315
0
Create the base project folder named `.wcscanner` This folder will contain projects folders
def create_base_projects_folder(): if '.wcscanner' not in os.listdir(context.__BASE_PATH__): os.mkdir(context.__PROJECTS_PATH__, mode=0o777) log.info("Base folder '.wcscanner' created in %s", context.__BASE_PATH__) else: log.info("Base folder '.wcscanner' already in %s", context.__BASE_P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_project_folder(self):\n\t\tif not os.path.exists(self.segment_path):\n\t\t\tfileutil.makedirs(self.segment_path)", "def create_project_dir():\r\n with settings(warn_only=True):\r\n run('mkdir -p %s/packages' % (env.path,))\r\n run('mkdir %s/log' % (env.path,))\r\n run('mkdir -p...
[ "0.6659889", "0.6641856", "0.64917487", "0.6437589", "0.6368039", "0.6359022", "0.63302505", "0.6301878", "0.62901366", "0.6244791", "0.62232673", "0.6204468", "0.6195332", "0.6174261", "0.61507595", "0.61412406", "0.6134815", "0.6131861", "0.6122213", "0.61108935", "0.609937...
0.8622508
0
Function used to create projects folder and the projects configuration files In the case where the name `test` exist, project `test_1` will be created
def create_project(project_name, description="", picture_per_rotation=15, picture_res="1640x1232"): create_base_projects_folder() project_name = project_name.replace(' ', '_') folders = os.listdir(context.__PROJECTS_PATH__) folders_same_name_size = len(list(filter(re.compile(r'^' + project_name + '_\d+$...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateProject(projectName='project'):\r\n projectName = input('''The project's name: ''')\r\n if not os.path.exists(projectName):\r\n os.mkdir(projectName)\r\n else:\r\n print('There is a file with the same name.')\r\n\r\n for dir in ['OPT', 'SCF', 'PHO']:\r\n if not os.path.ex...
[ "0.73885065", "0.7328125", "0.7328125", "0.7328125", "0.7235373", "0.7061831", "0.7015908", "0.6838026", "0.67617476", "0.6717228", "0.67142004", "0.6703364", "0.66713214", "0.66160923", "0.6609687", "0.6588031", "0.65660274", "0.6559736", "0.6549805", "0.65429026", "0.651005...
0.6468131
22
Retrieve the list of created projects
def list_projects(): if '.wcscanner' not in os.listdir(context.__BASE_PATH__): return [] return os.listdir(context.__PROJECTS_PATH__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n res = self.conn.cursor().execute(\"SELECT * FROM projects\")\n return res.fetchall()", "def project_list(self):\n try:\n ids = self.request[api.DATA][api.DATA][\"ids\"]\n return self._get_keystone_projects(ids)\n except Exception as e:\n...
[ "0.79283595", "0.7908697", "0.7908396", "0.78941816", "0.7875574", "0.7859581", "0.77052057", "0.7676825", "0.7626563", "0.76032645", "0.759214", "0.758812", "0.7564736", "0.7551614", "0.7544565", "0.75317365", "0.75284606", "0.7523725", "0.7517504", "0.7493248", "0.7475668",...
0.70631915
41
Update the project configuration file when needed
def update_project_data(project_name): project_path = context.__PROJECTS_PATH__+ '/' + project_name f = open(project_path+'/.project', 'r') project_data = json.load(f) f.close() image_count = len(os.listdir(project_path)) - 2 if image_count > 0: img = Image.open('{}/{}.jpg'.format(pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.save_config_file()", "def conf_update(self):\n pass", "def update_conf_file():\n filepath = remote_dir + \"/apache2/conf/httpd.conf\"\n fabric.contrib.files.sed(filepath, 'myproject', project_name)", "def configure_project():\n pass", "def use_config_file(sel...
[ "0.765402", "0.72598565", "0.69606566", "0.6790165", "0.67658454", "0.673011", "0.6683166", "0.6625269", "0.65561616", "0.6422709", "0.6373702", "0.6351545", "0.6332332", "0.6305905", "0.6299341", "0.6283506", "0.62604874", "0.62492776", "0.6245192", "0.6230782", "0.6205202",...
0.63203716
13
Seek and merge configuration files of all created projects
def get_projects_data(): wcscanner_path = context.__BASE_PATH__ + '/.wcscanner' data = [] for project in os.listdir(wcscanner_path): if (os.path.isdir(os.path.join(wcscanner_path, project))): update_project_data(project) project_path = '{}/{}'.format(wcscanner_path, project)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_projects(self):\n self._read_directory()\n print(self._filenames)\n for filename in self._filenames:\n project = self._make_project(self._read_project(filename))\n self.projects.append(\n (int(project.get_id()), project)\n )\n s...
[ "0.66411144", "0.65127", "0.63070935", "0.6264717", "0.6264717", "0.6264717", "0.62445647", "0.6196251", "0.6097174", "0.60413", "0.59326434", "0.5904823", "0.58877045", "0.58714056", "0.58672506", "0.58647454", "0.58565235", "0.58438635", "0.579216", "0.57822955", "0.5770177...
0.55323225
45
Function to remove a project entirely
def remove_single_project(project_name): p = subprocess.Popen('rm -rf {}/{}'.format(context.__PROJECTS_PATH__, project_name), shell=True) p.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_project(self):\n pass", "def delete_project(arn=None):\n pass", "def destroy(config, args):\n log = logging.getLogger('kraftwerk.destroy')\n if confirm(\"Remove project %s from node %s along with all services and data?\" % \n (args.project.name, args.node.hostname)):\...
[ "0.78088254", "0.7433542", "0.71992093", "0.7100344", "0.6999118", "0.69928163", "0.69796044", "0.69558465", "0.6908469", "0.68370533", "0.679688", "0.6792618", "0.6792618", "0.67563593", "0.6748435", "0.6722493", "0.6663393", "0.665515", "0.66471046", "0.6595111", "0.6583630...
0.7941272
0
Dev function used to remove all projects
def __remove_all_projects__(): p = subprocess.Popen('rm -rf {}/.wcscanner/*'.format(context.__BASE_PATH__), shell=True) p.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_project(self):\n pass", "def cleanUp(self):\n import evoware.fileutil as F\n F.tryRemove(self.f_project, verbose=(self.VERBOSITY>1), tree=1)", "def clean(self):\n\n if not self.__projects:\n return\n\n Console.info(\"Cleaning session...\")\n ...
[ "0.78051233", "0.7530776", "0.7457813", "0.73433113", "0.7220841", "0.70927864", "0.7014415", "0.7013246", "0.70059735", "0.70059735", "0.6994109", "0.69718444", "0.6850931", "0.68286365", "0.67603636", "0.6698705", "0.66784424", "0.6565345", "0.65251285", "0.6489362", "0.643...
0.8361376
0
Dev method used to remove the base directory of the application
def __remove_base_directory__(): p = subprocess.Popen('rm -rf {}/.wcscanner'.format(context.__BASE_PATH__), shell=True) p.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_basepath(self, basepath):\n\n # remove leading '/' from basepath so it doesn't screw stuff up\n target = self.install_dir / basepath.lstrip('/')\n\n try:\n # move all contents to the mod-root\n for f in target.iterdir():\n f.rename(self.install_d...
[ "0.6996567", "0.66437256", "0.6626104", "0.65613693", "0.65441066", "0.65218043", "0.6485134", "0.6461955", "0.6430868", "0.63802505", "0.63655853", "0.6357699", "0.6335903", "0.6290628", "0.62636834", "0.62542003", "0.62300324", "0.62172204", "0.6212399", "0.6205832", "0.620...
0.8166111
0
Create a new revision for each instance of the requested model
def create_revisions_for(model): total = model.objects.count() for idx, obj in enumerate(model.objects.iterator()): with create_revision(): obj.save() if idx % 100 == 0: logger.info('Created revision for %s: %s / %s', model._meta.verbose_name, idx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NewRevision(self, ids=[], default=None):\n newID, newIndex = [ False, 0 ]\n \n thisContext={ 'internal_writing':True, 'new_revision':True, }\n for tmpObject in self.browse(getListIDs(ids)):\n latestIDs = self.GetLatestIds( [(tmpObject.engineering_code, tmpObject.engineeri...
[ "0.64780706", "0.6246466", "0.6127586", "0.60455424", "0.6027535", "0.5952222", "0.5776394", "0.5773421", "0.572619", "0.5694227", "0.5680662", "0.55927366", "0.55635387", "0.55238825", "0.54905146", "0.53948104", "0.53815556", "0.5357851", "0.53216803", "0.5307395", "0.52862...
0.8095211
0
Given a sequence of (app_label, model_name) pairs, determine which are still Django models and registered with reversions
def reversion_models(model_pairs): for app_label, model_name in model_pairs: try: model = apps.get_model(app_label, model_name) if reversion.is_registered(model): yield model else: logger.warn("Model not registered with reversions %s %s", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_models(self, app_label, *models):\n for model in models:\n # Store as 'name: model' pair in a dictionary\n # in the app_models dictionary\n model_name = model._meta.model_name\n model_dict = self.app_models.setdefault(app_label, SortedDict())\n ...
[ "0.637576", "0.6375394", "0.630516", "0.6215255", "0.61491334", "0.6054366", "0.5984944", "0.58667654", "0.5846883", "0.58225566", "0.5815786", "0.5760193", "0.5675553", "0.5650057", "0.5580755", "0.55793256", "0.5577224", "0.5542611", "0.5505628", "0.5505628", "0.5504065", ...
0.73699176
0
A post_migrate signal handler which creates revisions for models listed in appropriately annotated migrations.
def create_versions_after_migration(**kwargs): migrations = [migration for migration, rollback in kwargs.get('plan', []) if not rollback] models: Set[Any] = set() for migration in migrations: models.update(getattr(migration, 'REVISED_MODELS', [])) with transa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_post_migrate(*args, **kwargs):\n global IN_MIGRATIONS\n IN_MIGRATIONS = False", "def post_migrations(self):", "def model_pre_migrate(*args, **kwargs):\n global IN_MIGRATIONS\n IN_MIGRATIONS = True", "def test_migrating_with_post_migrate_function(self):\n yield self.mk_simple_mode...
[ "0.7168965", "0.68205076", "0.60526645", "0.57672065", "0.5748166", "0.5628349", "0.5577539", "0.55665785", "0.5546331", "0.5457541", "0.5434504", "0.541682", "0.5385622", "0.5384686", "0.5284687", "0.5222851", "0.51773095", "0.5169075", "0.51123387", "0.51044285", "0.5022356...
0.703361
1
bsort simple sorting algorithm that uses any comparison function seq a list to be sorted cmp a function for comparing two elements of seq
def bsort(seq, cmp): sorted = False # assume the seq is not sorted to start with while not sorted: sorted = True # assume it's already sorted correctly for index, value in enumerate(seq): # for every element in seq if index > 0: # past the first.. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(values, comp_func):\n\n \"\"\"\n 昇順\n comp_func = lambda a, b: a if a<b else b\n\n 降順\n comp_func = lambda a, b: a if a>b else b\n\n 偶数昇順、奇数昇順\n comp_func = lambda a, b: a if \\\n a % 2 == 0 and b % 2 == 1 else \\\n (b if b%2==0 an...
[ "0.69906473", "0.6801239", "0.6798643", "0.669693", "0.6635075", "0.6605437", "0.6601416", "0.65782595", "0.6566951", "0.65586644", "0.64441836", "0.6396774", "0.6370208", "0.63533443", "0.63462526", "0.63443625", "0.6331016", "0.6276416", "0.6274445", "0.62692845", "0.625380...
0.77790433
0
Interprets the input line as command line arguments to the ``law`` executable and runs it in a subprocess using bash. Output and error streams are piped to the cell.
def law(self, line): line = line.strip() if not line: logger.error(r"the command passed to %law must not be empty") return # build the full command cmd = "law " + line if line_cmd: cmd = "{} && {}".format(line_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\targs = sys.argv[1:]\n\t# If stdin is not empty (being piped to)\n\tif not sys.stdin.isatty():\n\t\targs += sys.stdin.readlines()\n\tcommand = Main()\n\tcatch = lnk.errors.Catch(1)\n\tcatch.catch(command.main, args, standalone_mode=False)", "def ilaw(self, line):\n line = line.strip()\n ...
[ "0.611102", "0.60783684", "0.57162184", "0.5651651", "0.54892546", "0.5464681", "0.5447054", "0.54450333", "0.53893256", "0.5328231", "0.53135204", "0.529671", "0.5282843", "0.5277602", "0.52730775", "0.52728844", "0.52728844", "0.52692133", "0.52558976", "0.5254265", "0.5190...
0.6947543
0
Interprets the input line as command line arguments to the ``law`` executable, but rather than invoking it in a subprocess, it is evaluated interactively (or inline, thus the i) within the running process. This is especially useful for programmatically running tasks that were defined e.g. in the current notebook.
def ilaw(self, line): line = line.strip() if not line: logger.error(r"the command passed to %ilaw must not be empty") return argv = shlex.split(line) prog = argv.pop(0) # prog must be a valid law cli prog if prog n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def law(self, line):\n line = line.strip()\n if not line:\n logger.error(r\"the command passed to %law must not be empty\")\n return\n\n # build the full command\n cmd = \"law \" + line\n if line_cmd:\n cmd = \"{} &...
[ "0.6847528", "0.571055", "0.55922145", "0.5512899", "0.55023026", "0.54896945", "0.54449004", "0.54421085", "0.54222596", "0.5415045", "0.53889924", "0.5385756", "0.5385756", "0.53805405", "0.5373572", "0.5373572", "0.5373572", "0.5373572", "0.5373572", "0.5373572", "0.537357...
0.6991963
0
register_magics(init_cmd=None, init_fn=None, line_cmd=None, line_fn=None, log_level=None) Registers the two IPython magic methods ``%law`` and ``%ilaw`` which execute law commands either via a subprocess in bash (``%law``) or interactively / inline within the running process (``%ilaw``). init_cmd can be a shell command...
def register_magics(*args, **kwargs): ipy = None magics = None try: ipy = get_ipython() except NameError: logger.error("no running notebook kernel found") # create the magics if ipy: magics = create_magics(*args, **kwargs) # register it if ipy and magics: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_magics(ipython):\n ipython.register_magic_function(\n _start_magic,\n magic_kind=\"line\",\n magic_name=\"tensorboard\",\n )", "def load_ipython_extension(ipython):\n\n for module in _MAGICS:\n ipython.register_magic_function(\n getattr(module, 'magic'),\n ...
[ "0.7008458", "0.6217587", "0.5964256", "0.58934474", "0.56525946", "0.5644433", "0.5603719", "0.5478493", "0.546413", "0.5450855", "0.5428396", "0.53762233", "0.52367175", "0.52102613", "0.52080494", "0.5177763", "0.5166397", "0.5158223", "0.5103159", "0.5101145", "0.5062271"...
0.6953809
1
CSIIsilonSpec defines the desired state of CSIIsilon
def __init__(__self__, *, driver: 'outputs.CSIIsilonSpecDriver'): pulumi.set(__self__, "driver", driver)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver(self) -> 'outputs.CSIIsilonSpecDriver':\n return pulumi.get(self, \"driver\")", "def __init__(__self__, *,\n common: 'outputs.CSIIsilonSpecDriverCommon',\n config_version: str,\n replicas: int,\n auth_secret: Optional[str] = None,\...
[ "0.5846621", "0.5841295", "0.51959497", "0.49822912", "0.4924128", "0.49084496", "0.4894449", "0.48541084", "0.4831767", "0.4813849", "0.476087", "0.47559026", "0.47226313", "0.46790582", "0.4671698", "0.4648874", "0.46272394", "0.46069556", "0.460521", "0.46032214", "0.45957...
0.6181904
0
Driver is the specification for the CSI Isilon Driver
def driver(self) -> 'outputs.CSIIsilonSpecDriver': return pulumi.get(self, "driver")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n driver: 'outputs.CSIIsilonSpecDriver'):\n pulumi.set(__self__, \"driver\", driver)", "def __init__(__self__, *,\n driver: 'outputs.CSIVXFlexOSSpecDriver'):\n pulumi.set(__self__, \"driver\", driver)", "def driver(self) -> 'outputs.CSIVXF...
[ "0.7755355", "0.6638118", "0.659107", "0.6575005", "0.6453641", "0.64318734", "0.62873507", "0.6273736", "0.61924016", "0.6038243", "0.5645263", "0.5640794", "0.5625848", "0.5540442", "0.5512617", "0.5436864", "0.5334795", "0.5277546", "0.5276694", "0.5274879", "0.52567095", ...
0.78547376
0
Driver is the specification for the CSI Isilon Driver
def __init__(__self__, *, common: 'outputs.CSIIsilonSpecDriverCommon', config_version: str, replicas: int, auth_secret: Optional[str] = None, controller: Optional['outputs.CSIIsilonSpecDriverController'] = None, force_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver(self) -> 'outputs.CSIIsilonSpecDriver':\n return pulumi.get(self, \"driver\")", "def __init__(__self__, *,\n driver: 'outputs.CSIIsilonSpecDriver'):\n pulumi.set(__self__, \"driver\", driver)", "def __init__(__self__, *,\n driver: 'outputs.CSIVXFlexOSSpe...
[ "0.7853294", "0.7756133", "0.6638708", "0.65893567", "0.6573269", "0.6430521", "0.62873906", "0.6271603", "0.6188997", "0.6037872", "0.5646707", "0.56383497", "0.5626469", "0.5540958", "0.5513143", "0.543732", "0.53369087", "0.5277772", "0.5277438", "0.5271323", "0.5257272", ...
0.64546055
5
Common is the common specification for both controller and node plugins
def common(self) -> 'outputs.CSIIsilonSpecDriverCommon': return pulumi.get(self, "common")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common(self):", "def common(self, common):\n self._common = common", "def common(self) -> 'outputs.CSIVXFlexOSSpecDriverCommon':\n return pulumi.get(self, \"common\")", "def common(self) -> 'outputs.CSIUnitySpecDriverCommon':\n return pulumi.get(self, \"common\")", "def common():\n...
[ "0.7031099", "0.641698", "0.63550955", "0.6248245", "0.59394777", "0.58848166", "0.58519924", "0.58260953", "0.5724181", "0.5442481", "0.54260516", "0.53022933", "0.52545476", "0.52545476", "0.5181858", "0.5153853", "0.5066204", "0.5065994", "0.5035849", "0.5005502", "0.49931...
0.6123763
4
ConfigVersion is the configuration version of the driver
def config_version(self) -> str: return pulumi.get(self, "config_version")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_config_version(self):\n return self._get_param(\"ConfigVersion\")", "def get_config_version(config):\n return 2 if is_v2_config(config) else 1", "def configversion(self, args):\n print(CONFIG_VERSION)", "def productVersion( self ):\n return Config.ProductVersion", "def ...
[ "0.7028426", "0.6824842", "0.68103474", "0.61671114", "0.61632943", "0.5905669", "0.5839637", "0.5696008", "0.5659997", "0.55798566", "0.55448544", "0.5508866", "0.55024767", "0.5405574", "0.5395576", "0.5393082", "0.5381021", "0.5331651", "0.5284632", "0.5284632", "0.5284632...
0.70424426
1
Replicas is the count of controllers for Controller plugin
def replicas(self) -> int: return pulumi.get(self, "replicas")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_replicas():\n\n tf_replicator = get_tf_replicator()\n\n if tf_replicator:\n return tf_replicator.num_replicas_in_sync\n elif tf.distribute.has_strategy():\n return tf.distribute.get_strategy().num_replicas_in_sync\n else:\n # I'm assuming replicas and shards are always equal until someone ...
[ "0.6779487", "0.652515", "0.63903236", "0.633039", "0.62465656", "0.62465656", "0.6225653", "0.6089452", "0.6044615", "0.6033277", "0.60150945", "0.60065347", "0.5897805", "0.5868112", "0.5853733", "0.5828359", "0.5775845", "0.5618973", "0.5611121", "0.5611121", "0.55873203",...
0.70805544
0
AuthSecret is the name of the credentials secret for the driver
def auth_secret(self) -> Optional[str]: return pulumi.get(self, "auth_secret")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_secret(self) -> str:", "def secret(self):\n return self._secret", "def secret(self) -> str:\n return pulumi.get(self, \"secret\")", "def secret(self) -> str:\n return pulumi.get(self, \"secret\")", "def pull_secret(self):\n return self._pull_secret", "def pull_secre...
[ "0.6323842", "0.62277025", "0.61372435", "0.61372435", "0.6120714", "0.6120714", "0.6079962", "0.60155314", "0.5946268", "0.59420717", "0.58244205", "0.57821745", "0.57658476", "0.5765793", "0.57578164", "0.5710769", "0.56896", "0.5686426", "0.56813496", "0.56813496", "0.5677...
0.7148475
0