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
Given the solution saved in list, calculate the total cost of the solution. Write the solution to local in the required format.
def print_route_summary(self, solution, vehicle_type, if_write): result_summary = [[ '计划编号', '门店数', '配送总体积/m3', '配送总重量/t', '设定车速/km/h', '总车数', '总额定体积/m3', '总额定重量/t', '体积装载率/%', '重量装...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_and_save_solution(data, manager, routing, assignment):\n total_distance = 0\n total_load = 0\n routes = []\n for vehicle_id in range(data['num_vehicles']):\n route = []\n index = routing.Start(vehicle_id)\n plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id)\n ...
[ "0.60077643", "0.59991765", "0.5897307", "0.5896258", "0.5895152", "0.5890144", "0.5856607", "0.58172816", "0.5780239", "0.5713375", "0.5707637", "0.57038105", "0.57038105", "0.5679921", "0.5667275", "0.5651229", "0.5595291", "0.5590735", "0.55840975", "0.5565297", "0.5565179...
0.0
-1
To check if a route is feasible using given vehicle type, and return check result and route cost.
def check_violation(route, vehicle_type): if len(route) == 2: # [0, 0] route return True, 0, 0, 0 else: accu_res = [0, 0, 0] # 0-leaving time, 1-accumulated distance, 2-volume if vehicle_type == 2: veh_cap = small_veh elif vehicle_type == 3: veh_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_type(route):\r\n typ = 2\r\n vol_accu = 0 # accumulated volume\r\n\r\n if len(route) <= 2:\r\n return typ\r\n else:\r\n for i in range(1, len(route) - 1):\r\n cust0 = route[i]\r\n vol_accu += (num_demd[cust0][0] * bskt_vol + num_demd[cust0][1] * trsf_vol +...
[ "0.6641761", "0.6013915", "0.5916763", "0.5848608", "0.5837383", "0.5789502", "0.56984466", "0.56722516", "0.56595474", "0.5631287", "0.5621344", "0.5614399", "0.5525109", "0.55222577", "0.55129397", "0.5479792", "0.5474687", "0.5432638", "0.5411634", "0.54076946", "0.5397473...
0.77047276
0
Get the route location and customer location of a customer.
def cust_loc(sol, cust): cust_ind = [] # [route_loc, cust_loc] for i, rt in enumerate(sol): if cust in rt: cust_ind.append(i) cust_ind.append(rt.index(cust)) return cust_ind print('Costomer not in the solution: ', cust)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCustomer(self):\n return self.base.get(\"customer\", [])", "def getcarlocation(self) -> dict:\n return self.carlocation", "def get_location(self):\n return self.location", "def get_location(self):\n\t\treturn self.location", "def get_customer(self):\n return self._customer", ...
[ "0.62545425", "0.6043634", "0.604348", "0.60415626", "0.6030784", "0.6030784", "0.60060036", "0.5898835", "0.58679324", "0.58265114", "0.5819137", "0.57890815", "0.57604635", "0.5722256", "0.566059", "0.56328785", "0.5617918", "0.55987966", "0.5585464", "0.55814147", "0.55549...
0.5506791
23
Given a route, return the vehicle type of the route. Samll vehicle first, medium second, large last.
def route_type(route): typ = 2 vol_accu = 0 # accumulated volume if len(route) <= 2: return typ else: for i in range(1, len(route) - 1): cust0 = route[i] vol_accu += (num_demd[cust0][0] * bskt_vol + num_demd[cust0][1] * trsf_vol + (num_demd[cust0][2] + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n...
[ "0.6574357", "0.623225", "0.623225", "0.6055304", "0.59921247", "0.59921247", "0.59921247", "0.57707924", "0.57326573", "0.5594481", "0.5594481", "0.5594481", "0.55097127", "0.53885955", "0.5273151", "0.52576345", "0.52177763", "0.5201615", "0.51950127", "0.5176466", "0.51732...
0.77867645
0
Try to move 1 customer to anywhere it can be put, and see if the move can cut the total cost.
def shift_1_cust(self, sol_in1, cust, c_loc, curr_temp, sol_type1, sa_lns): route_ing = copy.deepcopy(sol_in1[c_loc[0]]) route_new = route_ing move_to_route = c_loc[0] orgn_type1 = sol_type1[c_loc[0]] origin_cost1 = check_violation(route_ing, orgn_type1)[1] route_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_3_cust(self, sol_in6, cust, c_loc, curr_temp, sol_type6, sa_lns):\r\n\r\n route_ing = copy.deepcopy(sol_in6[c_loc[0]])\r\n route_new = route_ing\r\n move_to_route = c_loc[0]\r\n orgn_type1 = sol_type6[c_loc[0]]\r\n cust_folw1 = route_ing[c_loc[1] + 1]\r\n cust_fo...
[ "0.6117333", "0.60589105", "0.5994203", "0.59595776", "0.5953622", "0.5933493", "0.59228426", "0.5878984", "0.58387893", "0.5838295", "0.58261937", "0.5800863", "0.5800339", "0.5784758", "0.5716828", "0.5699591", "0.5699348", "0.5658605", "0.563691", "0.5607451", "0.5571733",...
0.6281938
0
Try to move 2 consecutive customers to anywhere they can be put, see if they move can cut the total cost.
def shift_2_cust(self, sol_in2, cust, c_loc, curr_temp, sol_type2, sa_lns): route_ing = copy.deepcopy(sol_in2[c_loc[0]]) route_new = route_ing move_to_route = c_loc[0] orgn_type1 = sol_type2[c_loc[0]] cust_folw = route_ing[c_loc[1]+1] origin_cost1 = check_violatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_1_cust(self, sol_in1, cust, c_loc, curr_temp, sol_type1, sa_lns):\r\n\r\n route_ing = copy.deepcopy(sol_in1[c_loc[0]])\r\n route_new = route_ing\r\n move_to_route = c_loc[0]\r\n orgn_type1 = sol_type1[c_loc[0]]\r\n origin_cost1 = check_violation(route_ing, orgn_type1)[1...
[ "0.63458234", "0.6205083", "0.5944662", "0.5919286", "0.58585805", "0.5844579", "0.5750275", "0.5711178", "0.56468445", "0.56443506", "0.56095916", "0.5584599", "0.5448591", "0.5444054", "0.5442395", "0.54375905", "0.54311484", "0.5415993", "0.53907067", "0.53784865", "0.5372...
0.6756745
0
Try to move 3 consecutive customers to anywhere they can be put, see if they move can cut the total cost.
def shift_3_cust(self, sol_in6, cust, c_loc, curr_temp, sol_type6, sa_lns): route_ing = copy.deepcopy(sol_in6[c_loc[0]]) route_new = route_ing move_to_route = c_loc[0] orgn_type1 = sol_type6[c_loc[0]] cust_folw1 = route_ing[c_loc[1] + 1] cust_folw2 = route_ing[c_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movable_intraroute_customers(route, customers):\n mcust = []\n for c in range(route.ncustomers):\n if len(factible_route_positions(route.customers[c+1],\n route,customers)) > 1:\n mcust.append(c)\n return mcust", "def exchange_1_cust(self, sol...
[ "0.6071524", "0.60635555", "0.6033704", "0.58507174", "0.5694917", "0.54907", "0.54892546", "0.54756105", "0.54441667", "0.54237115", "0.539738", "0.5397061", "0.53634334", "0.5358302", "0.53474575", "0.53194606", "0.528759", "0.52711314", "0.525795", "0.52506185", "0.5243177...
0.67974746
0
Exchange the position of two customers(same route or not) if feasible, and see if it can cut the total cost.
def exchange_1_cust(self, sol_in3, cust, c_loc, curr_temp, sol_type3, sa_lns): route_ing = copy.deepcopy(sol_in3[c_loc[0]]) route_new_1 = route_ing route_new_2 = route_ing exch_to_route = c_loc[0] orgn_type1 = sol_type3[exch_to_route] origin_cost1 = check_violat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_2_cust(self, sol_in4, cust, c_loc, curr_temp, sol_type4, sa_lns):\r\n\r\n route_ing = copy.deepcopy(sol_in4[c_loc[0]])\r\n route_new_1 = route_ing\r\n route_new_2 = route_ing\r\n cust_folw = route_ing[c_loc[1] + 1]\r\n exch_to_route = c_loc[0]\r\n origin_cost1...
[ "0.69025654", "0.6613349", "0.6586741", "0.64510596", "0.61748725", "0.60695565", "0.583845", "0.5822859", "0.57592994", "0.56153905", "0.55894005", "0.5581832", "0.55210274", "0.55059487", "0.54630905", "0.54596806", "0.54371494", "0.5428905", "0.53805614", "0.5376348", "0.5...
0.6756957
1
Exchange 2 consecutive customers' position with another 2 customers' position, and see if it can cut cost.
def exchange_2_cust(self, sol_in4, cust, c_loc, curr_temp, sol_type4, sa_lns): route_ing = copy.deepcopy(sol_in4[c_loc[0]]) route_new_1 = route_ing route_new_2 = route_ing cust_folw = route_ing[c_loc[1] + 1] exch_to_route = c_loc[0] origin_cost1 = check_violation(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_2_cust(self, sol_in2, cust, c_loc, curr_temp, sol_type2, sa_lns):\r\n\r\n route_ing = copy.deepcopy(sol_in2[c_loc[0]])\r\n route_new = route_ing\r\n move_to_route = c_loc[0]\r\n orgn_type1 = sol_type2[c_loc[0]]\r\n cust_folw = route_ing[c_loc[1]+1]\r\n origin_cos...
[ "0.63171464", "0.6038648", "0.6019486", "0.5787042", "0.5624252", "0.5611005", "0.5577099", "0.5519468", "0.54916805", "0.54847175", "0.5430665", "0.54237324", "0.5396291", "0.53698677", "0.5358428", "0.5347584", "0.53337723", "0.53297913", "0.5312368", "0.5293557", "0.528052...
0.6249691
1
Neighborhood search based on 7 operators. In each iteration, select one operator randomly.
def lns_sa(self, sol_in, veh_type_in, cost_in): itr_cost = [] solu = copy.deepcopy(sol_in) solu_type = copy.deepcopy(veh_type_in) best_solu = sol_in best_val = cost_in tabu_list = [] random.seed(10) itr = 0 temp = initial_temp t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_operator(operators, weights, rnd_state):\n return rnd_state.choice(np.arange(0, len(operators)),\n p=weights / np.sum(weights))", "def random_neighbor(current_animal, grid_size, all_animals):\n all_neighbors = list_neighbors(current_animal.row, current_animal.col,\n ...
[ "0.59717697", "0.5790655", "0.57702667", "0.5675727", "0.56068516", "0.5596244", "0.55394137", "0.5518014", "0.5506138", "0.5501527", "0.54893243", "0.54508585", "0.5449837", "0.5449632", "0.54310656", "0.54117405", "0.54072756", "0.54062337", "0.5395119", "0.5391158", "0.537...
0.0
-1
ouverture de la connection db
def ouverture_connection(): #driver://username:password@host:port/database pg_db = create_engine('postgresql://alain:nostromos@localhost:5432/gites_wallons', convert_unicode=True, encoding='utf-8') connection = pg_db.connect() hebergements = connection...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect_db(self) -> None:", "def __init__(self):\n\n db.connection.close()", "def __init__(self):\r\n self.conn = create_connection(DATABASE_PATH)", "def _db_connection(self):\n pass", "def __init__(self):\n self._connection = get_db_connection()", "def __init__(self):\...
[ "0.74748695", "0.7453273", "0.74276954", "0.7418755", "0.73891157", "0.7326922", "0.7311703", "0.72639185", "0.7162829", "0.7160825", "0.7119574", "0.7119574", "0.7106822", "0.70802414", "0.70000356", "0.6978757", "0.6976131", "0.69594187", "0.6947704", "0.6945275", "0.691982...
0.0
-1
creation du fichier xml de destination ecriture de la phrase d'entete xml fermeture fichier
def creer_fichier(nom_file): fichier = open(nom_file, 'w') fichier.write("<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n") fichier.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saving_file(xml):\r\n\r\n xml_string = etree.tostring(xml)\r\n parsed = minidom.parseString(xml_string)\r\n with open(self.app_path + \"\\\\temp_\\\\\" + file_name + \".xml\", \"w\") as file:\r\n file.write(parsed.toprettyxml(indent=\" \"))", "def create...
[ "0.6573223", "0.6557936", "0.6554724", "0.6526124", "0.64474225", "0.6354408", "0.6259751", "0.6257362", "0.62307924", "0.61982656", "0.61907524", "0.618365", "0.61595833", "0.61466527", "0.61005646", "0.6085232", "0.6055169", "0.6042117", "0.6034879", "0.59065783", "0.590543...
0.7440519
0
ouverture du fichier en mode ajout
def ouvrir_fichier(nom_file): fichier_xml = open(nom_file, 'a') return fichier_xml
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ecrire_fichier(nom_du_fichier,texte) :\r\n with open(nom_du_fichier,\"w\") as fichier : #j'ouvre le fichier en mode w => write\r\n fichier.write(texte) #j'ecris la chaine dans le fichier\r", "def store(self, filename):", "def save(self, fname):\n pass", "def write(self, fname):\n ...
[ "0.6898106", "0.68603003", "0.6726738", "0.63661563", "0.6315698", "0.6294444", "0.62608826", "0.622624", "0.622624", "0.6175721", "0.60161173", "0.60036176", "0.5986812", "0.59839326", "0.5960327", "0.59474736", "0.5934486", "0.5932776", "0.59288394", "0.5912645", "0.5912645...
0.6033144
10
Solves the given system of |equations|. |equations| should be a list of lists of terms summing to 0. Each term should be a tuple of the form (coeff, var), where coeff is a number and var is a variable (string). Constants can be represented by (const, None). Returns a dictionary mapping the variables in the equations to...
def solve_equations(equations): # variables in the system of equations var_list = list(reduce(set.union, (set(var for coeff, var in eqn if var) for eqn in equations))) # number of variables num_vars = len(var_list) # the index of each variable in |var_list| var_index = dict(zip(var_list, range(num_var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_solvableEquations(equations: List):\n solvedEquations = []\n updatedUnknowns = set()\n\n for equation in equations:\n equation.update()\n if equation.isSolvable():\n solution = equation.solve()\n unknownAddress = list(solution.keys())[0]\n setattr_f...
[ "0.64777213", "0.6045988", "0.5746843", "0.5743898", "0.54364383", "0.54286045", "0.53808516", "0.5295969", "0.52503586", "0.5218554", "0.51738834", "0.51685405", "0.51086473", "0.5097052", "0.50915754", "0.50875384", "0.50407755", "0.50407755", "0.5009267", "0.49932858", "0....
0.80595094
0
Gives default department by checking if present in the context
def get_default_department_id(self, cr, uid, context=None): user_obj = self.pool.get('res.users').browse(cr,uid,uid).employee_ids if user_obj: dept_id = self.pool.get('res.users').browse(cr,uid,uid).employee_ids[0].department_id and self.pool.get('res.users').browse(cr,uid,uid).employee_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department(self):\n if \"department\" in self._prop_dict:\n return self._prop_dict[\"department\"]\n else:\n return None", "def department(self):\n if \"department\" in self._prop_dict:\n return self._prop_dict[\"department\"]\n else:\n ...
[ "0.727264", "0.727264", "0.6299022", "0.62791663", "0.6205959", "0.6025972", "0.59099317", "0.58730555", "0.5781836", "0.5762072", "0.57508874", "0.5684379", "0.5670995", "0.564136", "0.5601505", "0.5576277", "0.5553041", "0.55370617", "0.5526694", "0.55206823", "0.5495728", ...
0.8002562
0
Parsed content of Config file into Dictionary [client] > becomes primarykey with values as what follows host="host" user="un" > becomes secondary keyvalues password="pw" > becomse secondary keyvalues port="port"
def load_config_file(cfgFile): with open(cfgFile) as f: content = f.readlines() cfg = {} primary_key = 0 # has primary key been discovered (the string enclosed in bracket in config file) for line in content: if primary_key: if '=' in line: kv = line.split('=')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_dict_from_file(self, **kwargs):\r\n\r\n if not self.linux_handle.download(local_file='ipsec.conf', remote_file=self.conf_path, protocol='scp'):\r\n self.linux_handle.log(\"Downloading ipsec.conf file failed\")\r\n raise Exception(\"Downloading ipsec.conf file failed \")\r\n...
[ "0.6369596", "0.62699383", "0.62197447", "0.61826915", "0.61255795", "0.608884", "0.6068326", "0.60656905", "0.605204", "0.60274327", "0.60231185", "0.5968226", "0.5899399", "0.58986956", "0.5892832", "0.5862461", "0.585229", "0.57795405", "0.5766491", "0.5755049", "0.5753591...
0.6799325
0
Returns Dictionary of Credentials to Connect to Database Note, it's assumed configuration is in .my.cnf file in home directory
def get_host_connection_details(host_in): cfgFile = "~/.my.cnf" cfgFile = os.path.expanduser(cfgFile) cfg = load_config_file(cfgFile) return cfg[host_in]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credentials():\n\n username = os.environ.get('OS_USERNAME')\n password = os.environ.get('OS_PASSWORD')\n tenant_name = (os.environ.get('OS_TENANT_NAME') or\n os.environ.get('OS_PROJECT_NAME'))\n auth_url = os.environ.get('OS_AUTH_URL')\n\n config = configparser.RawConfigParser(...
[ "0.7193797", "0.7093677", "0.703026", "0.69783574", "0.68356663", "0.6755897", "0.67281365", "0.67027247", "0.6629779", "0.66020966", "0.6540259", "0.6498502", "0.6375657", "0.6310144", "0.629754", "0.62924415", "0.6250772", "0.62402374", "0.6232233", "0.6218107", "0.6201479"...
0.5931368
43
Loads sql statments in sql_fn and replaces variables based on supplied var_replace dictionary SQL statements are returned as string
def read_sql(sql_fn,var_replace): with open(sql_fn,'r') as sql: sql_stmts = sql.read() for key in var_replace: sql_stmts = sql_stmts.replace(key,var_replace[key]) return sql_stmts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_sql_from_file(conn, path, replace={}):\n with open(path, 'r') as f:\n query = [s.strip() + ';' for s in f.read().split(';')[:-1]]\n for s in query:\n for k, v in replace.items():\n s = s.replace(k, v)\n run_sql_from_string(conn, s)", "def replace_para...
[ "0.6825659", "0.6823968", "0.65025157", "0.6472315", "0.6245375", "0.6126365", "0.6013925", "0.59643203", "0.5952251", "0.5904826", "0.58467245", "0.5834276", "0.5786407", "0.575063", "0.57417893", "0.57417893", "0.5704225", "0.56946456", "0.5686", "0.56783825", "0.5657021", ...
0.8187875
0
Runs SQL Statements using SQL Alchemy
def execute_sql(sql_stmt, host_in='client'): #db = create_engine(host_in,'') #sql = sqltext(sql_stmt) #return db.execute(sql) with open('temp.sql','w') as sql: sql.write(sql_stmt) proc=sp.Popen("mysql < temp.sql",stdout=sp.PIPE, stderr=sp.PIPE, shell=True) out,err = proc.communicate() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_db_query(sql):\n with connect_sqlalchemy() as conn:\n return conn.execute(sql)", "def execute(self, sql):\n return self.db.execute(sql)", "def execute(self, sql, *args, **kwgs):\n curr = self.conn.cursor()\n curr.execute(sql, *args, **kwgs)\n self.conn.commit()\n ...
[ "0.76024103", "0.7044158", "0.7024362", "0.6994259", "0.68679607", "0.68651366", "0.6787083", "0.678563", "0.6776441", "0.6768197", "0.6768197", "0.6737674", "0.6731753", "0.6709835", "0.6693953", "0.668786", "0.6657934", "0.6648385", "0.66130596", "0.660817", "0.66062516", ...
0.6351884
35
Do some initialization stuff
def __init__(self): INSTALL_DIR = dirname(__file__) CONFIG_DIR = '/etc/Model2WADL/' logging.basicConfig(level=logging.ERROR) logging.config.fileConfig([join(CONFIG_DIR, 'logging.conf'), expanduser('~/.logging.conf'), 'logging.conf']) self.__log = logging.getLogger('thesis') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_init(self):\n\n pass", "def init():", "def initialise(self):", "def _real_initialize(self):\n pass", "def _manually_initialize(self) -> None:\n # XXX: maybe refactor, this is actually part of the public interface\n pass", "def init():\n pass", "def _post_init(self)...
[ "0.84622496", "0.8370624", "0.79567707", "0.78856564", "0.784712", "0.7770974", "0.77685636", "0.77416074", "0.77416074", "0.77416074", "0.77416074", "0.77416074", "0.77416074", "0.77416074", "0.77416074", "0.77298886", "0.76785505", "0.76785505", "0.76785505", "0.7674535", "...
0.0
-1
Method for getting the deuces score
def test_calculate_deuces(self): board = ['4h', '5h', '8h', '7h', '9c'] hand = ['2s', '3s'] deuces = calculate_deuces(board, hand) self.assertEqual(deuces[0], 7414) self.assertEqual(deuces[1], 'High Card')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depiction_score(self):\n\n collision_penalty = 1\n degenerated_penalty = 0.4\n\n bond_collisions = self.count_bond_collisions()\n degenerated_atoms = self.count_suboptimal_atom_positions(0.0, 0.5)\n\n score = (\n collision_penalty * bond_collisions\n + d...
[ "0.75957024", "0.6948524", "0.6946559", "0.69263655", "0.6824322", "0.66982114", "0.6693349", "0.66163933", "0.6587948", "0.6587948", "0.6587948", "0.656754", "0.6543698", "0.6531922", "0.6501064", "0.64593935", "0.64501256", "0.63708085", "0.63708085", "0.63708085", "0.63658...
0.6089424
36
Tells if the target is newer than the source. Return true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Return false if both exist and 'target' is the same age or younger than 'source'. Raise DistutilsFileError if 'source' does not exist.
def newer(source, target): if not os.path.exists(source): raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return True return os.stat(source).st_mtime > os.stat(target).st_mtime
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newer (source, target):\r\n\r\n if not os.path.exists (target):\r\n return 1\r\n\r\n from stat import ST_MTIME\r\n mtime1 = os.stat(source)[ST_MTIME]\r\n mtime2 = os.stat(target)[ST_MTIME]\r\n\r\n return mtime1 > mtime2", "def newer_group(sources, target, missing='error'):\n # If the...
[ "0.8297187", "0.7296959", "0.7276083", "0.71889526", "0.69265825", "0.67073405", "0.6665101", "0.65951735", "0.6554066", "0.6270341", "0.6233283", "0.62098014", "0.61658466", "0.6140355", "0.6124453", "0.6110864", "0.60843563", "0.5883249", "0.5821825", "0.58091307", "0.57776...
0.88327926
0
Return a string that identifies the current platform. By default, will return the value returned by sysconfig.get_platform(), but it can be changed by calling set_platform().
def get_platform(): global _PLATFORM if _PLATFORM is None: _PLATFORM = _sysconfig.get_platform() return _PLATFORM
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlatformName():\n if override_platform_name:\n return override_platform_name\n if IsWindows():\n return 'win32'\n if IsLinux():\n return 'linux'\n if IsMac():\n return 'mac'\n raise NotImplementedError('Unknown platform \"%s\".' % sys.platform)", "def current_platform() -> str:\n if sys.p...
[ "0.86419976", "0.86189526", "0.84946406", "0.84425676", "0.84221816", "0.8408329", "0.8267858", "0.8102998", "0.80069953", "0.79900736", "0.79565233", "0.79265183", "0.78920996", "0.78262705", "0.77958465", "0.7738521", "0.77015126", "0.7699097", "0.76611334", "0.765293", "0....
0.83564013
6
Sets the platform string identifier returned by get_platform(). Note that this change doesn't impact the value returned by sysconfig.get_platform() and is local to Distutils
def set_platform(identifier): global _PLATFORM _PLATFORM = identifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPlatform(self):\n\t\treturn None", "def platform(self, platform):\n # type: (string_types) -> None\n\n if platform is not None:\n if not isinstance(platform, string_types):\n raise TypeError(\"Invalid type for `platform`, type has to be `string_types`\")\n\n ...
[ "0.7211347", "0.7159676", "0.7013561", "0.6954458", "0.68570656", "0.6601686", "0.6520827", "0.6483991", "0.64623207", "0.64623207", "0.64210874", "0.6305744", "0.6305564", "0.6298814", "0.6271021", "0.62246704", "0.6183877", "0.60754293", "0.6066876", "0.6018605", "0.596566"...
0.81388736
0
Return 'pathname' as a name that will work on the native filesystem. i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them...
def convert_path(pathname): if os.sep == '/': return pathname if not pathname: return pathname if pathname[0] == '/': raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': raise ValueError("path '%s' cannot end with '/'" % pathname) path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _path(unix_path):\n return unix_path.replace(\"/\", os.path.sep)", "def normalized_file_path(path: str) -> str:\n # Convert Unix path to Windows path for WSL\n if PLATFORM == \"WSL\":\n return path.replace(\"/\", \"\\\\\")\n\n return path", "def nt_path_to_posix_path(path):\r\n path =...
[ "0.67207557", "0.6290176", "0.6238237", "0.6112074", "0.61115247", "0.606076", "0.5939797", "0.5932711", "0.59231985", "0.58520925", "0.58230126", "0.57967067", "0.5790922", "0.57871675", "0.57529", "0.57496727", "0.57496727", "0.5720282", "0.5685239", "0.566036", "0.56340814...
0.68549985
0
Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.
def change_root(new_root, pathname): if os.name == 'posix': if not os.path.isabs(pathname): return os.path.join(new_root, pathname) else: return os.path.join(new_root, pathname[1:]) elif os.name == 'nt': (drive, path) = os.path.splitdrive(pathname) if pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addPathPrefix(prefix, pathname):\n new_pathname = os.path.join(os.path.dirname(pathname), prefix + os.path.basename(pathname))\n return new_pathname", "def makepath(plname,root):\n if (root.endswith('/') and not plname[0] =='/' ) or ( not root.endswith('/') and plname[0] =='/') :\n return ro...
[ "0.6437045", "0.59677273", "0.5884409", "0.57894766", "0.5737389", "0.56540275", "0.5632758", "0.560187", "0.55786604", "0.55463153", "0.54867226", "0.5479389", "0.5465328", "0.5434634", "0.5426187", "0.5377088", "0.5376396", "0.52881503", "0.5265455", "0.5238494", "0.5189643...
0.77424914
0
Ensure that 'os.environ' has all the environment variables needed. We guarantee that users can use in config files, commandline options,
def check_environ(): global _environ_checked if _environ_checked: return if os.name == 'posix' and 'HOME' not in os.environ: import pwd os.environ['HOME'] = pwd.getpwuid(os.getuid())[5] if 'PLAT' not in os.environ: os.environ['PLAT'] = _sysconfig.get_platform() _en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_environment():\n reqs = ['NAME', 'RECIPIENT', 'SUBJECT', 'MESSAGE',\n 'MAILGUN_API_KEY', 'MAILGUN_DOMAIN']\n for req in reqs:\n if not os.getenv(req):\n logging.error('Environment variable ' + req + ' is not set')\n sys.exit(2)", "def _check_env():\n\tif o...
[ "0.7685037", "0.768269", "0.74665606", "0.7349859", "0.72101486", "0.7192757", "0.7188985", "0.7085273", "0.6954072", "0.692295", "0.6899005", "0.68856543", "0.6869819", "0.68643546", "0.68599814", "0.68545455", "0.68270725", "0.6821289", "0.6815573", "0.6815573", "0.6815573"...
0.8246562
0
Perform shell/Perlstyle variable substitution on 'string'. Every occurrence of '$' followed by a name is considered a variable, and variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/augmented to guarantee that it cont...
def subst_vars(s, local_vars): check_environ() def _subst(match, local_vars=local_vars): var_name = match.group(1) if var_name in local_vars: return str(local_vars[var_name]) else: return os.environ[var_name] try: return re.sub(r'\$([a-zA-Z_][a-zA-Z_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_vars(string, env_vars=None):\n if env_vars is None:\n env_vars = os.environ\n # create a replacement callback function that uses env_vars as it's first\n # argument, additional arguments will be added after it\n repl_callback = functools.partial(_var_repl, env_vars)\n return re.sub...
[ "0.7734589", "0.73284125", "0.6958385", "0.62611526", "0.61794424", "0.61206144", "0.6119231", "0.5942183", "0.5825754", "0.5727875", "0.5716061", "0.56829596", "0.56288034", "0.56126416", "0.56008154", "0.5499839", "0.5496333", "0.5489837", "0.54745865", "0.5474001", "0.5453...
0.8150585
0
Generate a useful error message from an EnvironmentError. This will generate an IOError or an OSError exception object. Handles Python 1.5.1 and 1.5.2 styles, and does what it can to deal with exception objects that don't have a filename (which happens when the error is due to a twofile operation, such as 'rename()' or...
def grok_environment_error(exc, prefix="error: "): # check for Python 1.5.2-style {IO,OS}Error exception objects if hasattr(exc, 'filename') and hasattr(exc, 'strerror'): if exc.filename: error = prefix + "%s: %s" % (exc.filename, exc.strerror) else: # two-argument functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_message():\n def get_os_release():\n \"\"\"Returns detailed OS release.\"\"\"\n if platform.linux_distribution()[0]:\n return \" \".join(platform.linux_distribution())\n elif platform.mac_ver()[0]:\n return \"%s %s\" % (platform.mac_ver()[0], platform.mac...
[ "0.6228609", "0.61467487", "0.6119618", "0.6091069", "0.6041068", "0.6019442", "0.60053355", "0.60053355", "0.60053355", "0.59858197", "0.59780866", "0.59780866", "0.59780866", "0.59780866", "0.59780866", "0.59780866", "0.59780866", "0.59780866", "0.5958574", "0.59230393", "0...
0.79304963
0
Split a string up according to Unix shelllike rules for quotes and backslashes.
def split_quoted(s): # This is a nice algorithm for splitting up a single string, since it # doesn't require character-by-character examination. It was a little # bit of a brain-bender to get it working right, though... if _wordchars_re is None: _init_regex() s = s.strip() words = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(s, posix=True):\n if isinstance(s, bytes):\n s = s.decode(\"utf-8\")\n return shlex.split(s, posix=posix)", "def shlex_split(str_to_split: str) -> List[str]:\n return shlex.split(str_to_split, comments=False, posix=False)", "def shlex_split(self, text):\n if six.PY2:\n ...
[ "0.78362286", "0.7329921", "0.7217792", "0.72064894", "0.71627724", "0.7052283", "0.705191", "0.67389745", "0.65934944", "0.65557235", "0.655108", "0.6530101", "0.64702815", "0.63966805", "0.6376275", "0.6368482", "0.6346435", "0.62923265", "0.62834394", "0.6271737", "0.62683...
0.6048011
26
Perform some action that affects the outside world. eg. by writing to the filesystem). Such actions are special because they are disabled by the 'dry_run' flag. This method takes care of all that bureaucracy for you; all you have to do is supply the function to call and an argument tuple for it (to embody the "external...
def execute(func, args, msg=None, verbose=0, dry_run=0): if msg is None: msg = "%s%r" % (func.__name__, args) if msg[-2:] == ',)': # correct for singleton tuple msg = msg[0:-2] + ')' log.info(msg) if not dry_run: func(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call(self, argstr, need_stderr, dry_run, **kwargs):", "def do_action(self, action, a=None, b=None):\n pass", "def do_write_and_execute(self, arg):\n self._print_func_result(self.phil.write_and_execute, arg)", "def fdo(var, wrapper, message):\n _say(wrapper, message, \"act\", action=True...
[ "0.62309545", "0.61508274", "0.59765947", "0.57593095", "0.5661502", "0.56445134", "0.5626379", "0.5622423", "0.55724055", "0.5541458", "0.5541458", "0.5447923", "0.54468924", "0.5399365", "0.53291225", "0.5303617", "0.5279443", "0.52664304", "0.524846", "0.5242269", "0.52091...
0.60439026
2
Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else.
def strtobool(val): val = val.lower() if val in ('y', 'yes', 't', 'true', 'on', '1'): return 1 elif val in ('n', 'no', 'f', 'false', 'off', '0'): return 0 else: raise ValueError("invalid truth value %r" % (val,))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strtobool(val: str) -> int:\n val = val.lower()\n if val in (\"y\", \"yes\", \"t\", \"true\", \"on\", \"1\"):\n return 1\n elif val in (\"n\", \"no\", \"f\", \"false\", \"off\", \"0\"):\n return 0\n else:\n raise ValueError(\"invalid truth value %r\" % (val,))", "def str_to_b...
[ "0.81975126", "0.8017742", "0.78834474", "0.78206813", "0.77842885", "0.77564293", "0.75404084", "0.7537402", "0.7356985", "0.73436004", "0.7292158", "0.7287533", "0.7237012", "0.72188634", "0.72188634", "0.7196758", "0.7194048", "0.71899515", "0.71899515", "0.71899515", "0.7...
0.81308395
1
Bytecompile a collection of Python source files to either .pyc or .pyo files in the same directory. 'py_files' is a list of files to compile; any files that don't end in
def byte_compile(py_files, optimize=0, force=0, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None): # nothing is done if sys.dont_write_bytecode is True if hasattr(sys, 'dont_write_bytecode') and sys.dont_write_bytecode: raise DistutilsByteCompileError('byte-compiling is di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyo():\n local('python -O -m compileall .')", "def pyo():\n local('python -O -m compileall .')", "def compile_coffeescript(*files):\r\n if not files:\r\n files = [\"`{}`\".format(coffeescript_files())]\r\n sh(cmd(\r\n \"node_modules/.bin/coffee\", \"--compile\", *files\r\n ))",...
[ "0.64949733", "0.64949733", "0.62953174", "0.6256713", "0.61585885", "0.6012568", "0.58619845", "0.58467686", "0.58408356", "0.5704187", "0.56957185", "0.5693709", "0.5662455", "0.5645903", "0.5611024", "0.5549595", "0.55396736", "0.5538459", "0.5522446", "0.5512065", "0.5488...
0.6693471
0
Return a version of the string escaped for inclusion in an RFC822 header, by ensuring there are 8 spaces space after each newline.
def rfc822_escape(header): lines = header.split('\n') sep = '\n' + 8 * ' ' return sep.join(lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tidy_string(s: str\n ) -> str:\n s = s.encode('ascii', errors='ignore').decode(FORMAT)\n s = s.replace(\"\\r\", \"\").replace(\"\\t\", \"\").replace('\\n', '') \n return s", "def beautify(text):\n text = re.sub('\\n{3,}', '\\n\\n', text)\n text = re.sub('\\n+$', '\\n', text)\n ...
[ "0.6096191", "0.5934842", "0.59084433", "0.59060633", "0.5887525", "0.5677352", "0.5667074", "0.56499064", "0.56388175", "0.55878687", "0.55177206", "0.5498205", "0.5489415", "0.54656357", "0.5455645", "0.54367644", "0.54303896", "0.5425611", "0.53949904", "0.538119", "0.5353...
0.7909112
0
Finds the ld version. The version scheme differs under Mac OSX.
def _find_ld_version(): if sys.platform == 'darwin': return _find_exe_version('ld -v', _MAC_OS_X_LD_VERSION) else: return _find_exe_version('ld -v')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n # this implementation avoids calling Foundation and will work on\n # non Apple OSes.\n vers = \"UNKNOWN\"\n build = \"\"\n # find the munkilib directory, and the version file\n munkilibdir = os.path.dirname(os.path.abspath(__file__))\n versionfile = os.path.join(munkilibdi...
[ "0.7059902", "0.6503561", "0.64812005", "0.64738697", "0.6416523", "0.6415537", "0.61217123", "0.6084685", "0.6074208", "0.6074208", "0.60129017", "0.60093343", "0.5987961", "0.59856707", "0.593912", "0.59271336", "0.59125006", "0.5905193", "0.58683425", "0.5782932", "0.57724...
0.8556363
0
Find the version of an executable by running `cmd` in the shell. `pattern` is a compiled regular expression. If not provided, default to _RE_VERSION. If the command is not found, or the output does not match the mattern, returns None.
def _find_exe_version(cmd, pattern=_RE_VERSION): from subprocess import Popen, PIPE executable = cmd.split()[0] if find_executable(executable) is None: return None pipe = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) try: stdout, stderr = pipe.stdout.read(), pipe.stderr.read() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n import subprocess\n from tempfile import NamedTemporaryFile\n proc = subprocess.Popen(lm_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n try:\n out, stderr = proc.communicate(timeout=15)\n except TimeoutError:\n proc.kill()\n outs, stderr = proc.commu...
[ "0.6729657", "0.64490074", "0.61166817", "0.58071357", "0.5795342", "0.5723984", "0.5637662", "0.5618396", "0.5613655", "0.55541384", "0.55272096", "0.54937875", "0.5464113", "0.5462051", "0.53953546", "0.5378721", "0.5374339", "0.5371101", "0.53526723", "0.5351424", "0.53498...
0.842616
0
Returns a tuple providing the versions of gcc, ld and dllwrap For each command, if a command is not found, None is returned. Otherwise a string with the version is returned.
def get_compiler_versions(): gcc = _find_exe_version('gcc -dumpversion') ld = _find_ld_version() dllwrap = _find_exe_version('dllwrap --version') return gcc, ld, dllwrap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gcc_ver(exe=\"gcc\"):\n cmd = [exe, '-v']\n major = -1\n minor = -1\n patch = -1\n raw = sub.check_output(cmd, stderr=sub.STDOUT).decode('ascii').lower().split('\\n')\n for line in raw:\n if line.startswith('gcc version'):\n tokens = line.split()\n # we obtain...
[ "0.6619813", "0.6580038", "0.64875406", "0.6457868", "0.64217746", "0.63849837", "0.6326838", "0.6278378", "0.624311", "0.61986893", "0.6176207", "0.6146404", "0.60950166", "0.60890126", "0.60757", "0.6046186", "0.60224766", "0.601256", "0.59944826", "0.599008", "0.59763354",...
0.7286158
0
Return true if 'target' is outofdate with respect to any file listed in 'sources'. In other words, if 'target' exists and is newer than every file in 'sources', return false; otherwise return true. 'missing' controls what we do when a source file is missing; the default ("error") is to blow up with an OSError from insi...
def newer_group(sources, target, missing='error'): # If the target doesn't even exist, then it's definitely out-of-date. if not os.path.exists(target): return True # Otherwise we have to find out the hard way: if *any* source file # is more recent than 'target', then 'target' is out-of-date and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newer(source, target):\n if not os.path.exists(source):\n raise DistutilsFileError(\"file '%s' does not exist\" %\n os.path.abspath(source))\n if not os.path.exists(target):\n return True\n\n return os.stat(source).st_mtime > os.stat(target).st_mtime", "...
[ "0.68539894", "0.6768285", "0.6579951", "0.6263332", "0.6170721", "0.6142411", "0.6040172", "0.60333484", "0.5950948", "0.5950353", "0.5943889", "0.5890367", "0.565034", "0.563318", "0.5581962", "0.5574001", "0.5522218", "0.54946536", "0.5422363", "0.5406527", "0.5402316", ...
0.7944473
0
Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.
def write_file(filename, contents): try: f = open(filename, "w") for line in contents: f.write(line + "\n") finally: f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_file ( file_name, contents ):\n vlog(4, 'Writing File: %s SIZE=%s' % (file_name, len(contents)))\n with open(file_name, 'w') as file:\n file.write(contents)", "def create_file(self, name: str, content: str) -> None:\n file_path = self.path + os.path.sep + name\n with open(fil...
[ "0.77899534", "0.76684856", "0.71358454", "0.69930136", "0.693178", "0.6923939", "0.6864247", "0.6858587", "0.6822739", "0.6776943", "0.668692", "0.66603667", "0.66357285", "0.65926784", "0.6588215", "0.65733767", "0.6520627", "0.6494413", "0.64839953", "0.6415318", "0.638367...
0.73091906
2
Returns True if path is a package (a dir with an __init__ file.
def _is_package(path): if not os.path.isdir(path): return False return os.path.isfile(os.path.join(path, '__init__.py'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsPackage(path):\n init_base_path = os.path.join(path, '__init__.py')\n return (os.path.isfile(init_base_path) or\n os.path.isfile(init_base_path + 'c') or\n os.path.isfile(init_base_path + 'o'))", "def _is_package(path):\n return (\n os.path.isdir(path)\n and os....
[ "0.9028623", "0.8911071", "0.8911071", "0.8750731", "0.8576869", "0.81681454", "0.803935", "0.76286083", "0.7427226", "0.7406388", "0.6980071", "0.6966034", "0.6936042", "0.6757917", "0.67051244", "0.6700581", "0.6627893", "0.6593783", "0.6561629", "0.6427087", "0.6419333", ...
0.89318365
1
Returns a dotted package name, given a subpath.
def _package_name(root_path, path): if not _under(path, root_path): raise ValueError('"%s" is not a subpath of "%s"' % (path, root_path)) return path[len(root_path) + 1:].replace(os.sep, '.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve_name(name, package, level):\n if not hasattr(package, 'rindex'):\n raise ValueError(\"'package' not set to a string\")\n dot = len(package)\n for x in xrange(level, 1, -1):\n try:\n dot = package.rindex('.', 0, dot)\n except ValueErr...
[ "0.680801", "0.68059653", "0.67358416", "0.67321527", "0.6679984", "0.647044", "0.6385544", "0.6206499", "0.60818356", "0.60691476", "0.60549533", "0.6032795", "0.60183483", "0.60061336", "0.5967444", "0.59654856", "0.59017694", "0.5867805", "0.5845933", "0.5839538", "0.58301...
0.8235141
0
Return a list all Python packages found recursively within directories 'paths' 'paths' should be supplied as a sequence of "crossplatform" (i.e. URLstyle) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '' can be used as a wildcard in the names, such...
def find_packages(paths=(os.curdir,), exclude=()): packages = [] discarded = [] def _discarded(path): for discard in discarded: if _under(path, discard): return True return False for path in paths: path = convert_path(path) for root, dirs, fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_packages(paths, extensions=['.py', '.ipynb'],\n include_imported_dependencies=False):\n if isinstance(paths, str):\n paths = [paths]\n\n all_packages = set()\n for path in paths:\n if os.path.isfile(path):\n basename, ext = os.path.splitext(path)\n ...
[ "0.7080239", "0.6244361", "0.61578315", "0.6144756", "0.60934895", "0.59585524", "0.59447527", "0.59435344", "0.58972776", "0.58844006", "0.5858805", "0.58424145", "0.5818661", "0.57693875", "0.5734302", "0.57293177", "0.56524205", "0.5640559", "0.5630103", "0.5587548", "0.55...
0.8303452
0
Resolve a name like ``module.object`` to an object and return it. Raise ImportError if the module or name is not found.
def resolve_name(name): parts = name.split('.') cursor = len(parts) module_name, rest = parts[:cursor], parts[cursor:] while cursor > 0: try: ret = __import__('.'.join(module_name)) break except ImportError: if cursor == 0: raise ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_object(object_string):\n (module_name, object_name) = object_string.rsplit(\".\", 1)\n \n try:\n module = import_module(module_name)\n except ImportError, exc:\n raise ValueError(\"Could not import module %s: %s\" % (module_name, exc))\n \n if not hasattr(module, object_...
[ "0.7823999", "0.74688756", "0.73092455", "0.72886926", "0.70330685", "0.70057213", "0.700463", "0.69914454", "0.69213706", "0.6860309", "0.6846219", "0.6799745", "0.6768096", "0.67213255", "0.64703375", "0.64163697", "0.6382579", "0.632128", "0.63104135", "0.63058966", "0.629...
0.6590673
14
Like os.path.splitext, but take off .tar too
def splitext(path): base, ext = posixpath.splitext(path) if base.lower().endswith('.tar'): ext = base[-4:] + ext base = base[:-4] return base, ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_ext(filepath):\n\t(fn, ext) = os.path.splitext(filepath)\n\tif ext=='.gz':\n\t\t(fn, ext) = os.path.splitext(fn)\n\t\text += '.gz'\n\treturn (fn, ext)", "def splitext( filename ):\n index = filename.find('.')\n if index == 0:\n index = 1+filename[1:].find('.')\n if index == -1:\n ...
[ "0.7256462", "0.7026987", "0.68934464", "0.6722942", "0.66994846", "0.66748786", "0.66710615", "0.66696054", "0.66661364", "0.6614728", "0.65565413", "0.6543803", "0.6525695", "0.64786565", "0.645979", "0.64352673", "0.64048153", "0.63310933", "0.6310813", "0.62845665", "0.62...
0.80011797
0
Unzip the file (zip file located at filename) to the destination location
def unzip_file(filename, location, flatten=True): if not os.path.exists(location): os.makedirs(location) zipfp = open(filename, 'rb') try: zip = zipfile.ZipFile(zipfp) leading = has_leading_dir(zip.namelist()) and flatten for name in zip.namelist(): data = zip.rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unzip_file(zip_file: str) -> None:\n destination = tempfile.mkdtemp(prefix='gaelo_pross_unzip_')\n with ZipFile(zip_file) as my_zip:\n for member in my_zip.namelist():\n filename = os.path.basename(member)\n # skip directories\n if not filen...
[ "0.7560769", "0.71218294", "0.70691943", "0.7064284", "0.6986608", "0.69839203", "0.6978512", "0.6965842", "0.6927749", "0.68626106", "0.68618494", "0.67718035", "0.6757544", "0.67043924", "0.6672114", "0.6653377", "0.6650897", "0.6649121", "0.6646617", "0.66026664", "0.65991...
0.64997977
24
Untar the file (tar file located at filename) to the destination location
def untar_file(filename, location): if not os.path.exists(location): os.makedirs(location) if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'): mode = 'r:gz' elif (filename.lower().endswith('.bz2') or filename.lower().endswith('.tbz')): mode = 'r:bz2' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def untar(file_path, target_dir=None, gzipped=True, verbose=False):\n return posix.untar(file_path, target_dir, gzipped, verbose)", "def unpack(filepath, target_dir, rm_tar=False):\n print(\"Unpacking %s ...\" % filepath)\n tar = tarfile.open(filepath)\n tar.extractall(target_dir)\n tar.close()\n ...
[ "0.73066616", "0.6867081", "0.6703305", "0.668635", "0.6596125", "0.659354", "0.6576849", "0.65655506", "0.6420614", "0.63635397", "0.6293247", "0.6277028", "0.6241549", "0.62173164", "0.6186047", "0.6114133", "0.6083221", "0.6079492", "0.60721684", "0.60675913", "0.60631365"...
0.6846308
2
Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)
def has_leading_dir(paths): common_prefix = None for path in paths: prefix, rest = split_leading_dir(path) if not prefix: return False elif common_prefix is None: common_prefix = prefix elif prefix != common_prefix: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areInSamePaths(path1, path2):\n return areSamePaths(os.path.dirname(path1), os.path.dirname(path2))", "def predicate(path):\n p = os.path.abspath(path)\n return any(p == d or p.startswith(d + os.path.sep)\n for d in directories)", "def _verify_prefix(prefix, f...
[ "0.68663764", "0.66934335", "0.6670413", "0.6565162", "0.6515844", "0.6405397", "0.6379137", "0.6338458", "0.6308368", "0.62838936", "0.62717277", "0.6256882", "0.6211285", "0.61961395", "0.6110255", "0.609404", "0.6081909", "0.60518205", "0.6041078", "0.6039395", "0.6034955"...
0.8242421
0
Run another program specified as a command list 'cmd' in a new process. 'cmd' is just the argument list for the new process, ie.
def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None): if os.name == 'posix': _spawn_posix(cmd, search_path, dry_run=dry_run, env=env) elif os.name == 'nt': _spawn_nt(cmd, search_path, dry_run=dry_run, env=env) elif os.name == 'os2': _spawn_os2(cmd, search_path, dry_run=dry_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cmd(cmd):\n print 'running: %s' % cmd\n return subprocess.call(cmd.split(), env=os.environ, shell=False)", "def run_subprocess(cmd):\n subprocess.Popen(cmd, stdin =subprocess.PIPE,\n stderr=subprocess.PIPE,\n stdout=subprocess.PIPE,\n ...
[ "0.7262526", "0.71265554", "0.7010283", "0.7000504", "0.6908534", "0.6869269", "0.6841811", "0.68051773", "0.6796315", "0.6784105", "0.67592525", "0.67530745", "0.6739195", "0.67327857", "0.66750276", "0.66750276", "0.66750276", "0.6611103", "0.6588122", "0.65379345", "0.6476...
0.5867709
84
Quote commandline arguments for DOS/Windows conventions. Just wraps every argument which contains blanks in double quotes, and returns a new argument list.
def _nt_quote_args(args): # XXX this doesn't seem very robust to me -- but if the Windows guys # say it'll work, I guess I'll have to accept it. (What if an arg # contains quotes? What other magic characters, other than spaces, # have to be escaped? Is there an escaping mechanism other than # quo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_arguments(args):\n if isinstance(args, str):\n args_list = [args]\n else:\n args_list = args\n\n quoted_args = []\n for a in args_list:\n qa = _double_up_quotes(a)\n if \" \" in qa or \"'\" in qa:\n qa = \"'\" + qa + \"'\"\n quoted_args.append(qa)...
[ "0.727529", "0.7251283", "0.72008514", "0.685263", "0.67948896", "0.6764882", "0.6530536", "0.6420306", "0.637898", "0.63067955", "0.6251415", "0.62015647", "0.6195781", "0.6184979", "0.6129439", "0.6106405", "0.6061542", "0.5926107", "0.5858475", "0.5774904", "0.5765774", ...
0.78102744
0
Tries to find 'executable' in the directories listed in 'path'. A string listing directories separated by 'os.pathsep'; defaults to os.environ['PATH']. Returns the complete filename or None if not found.
def find_executable(executable, path=None): if path is None: path = os.environ['PATH'] paths = path.split(os.pathsep) base, ext = os.path.splitext(executable) if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'): executable = executable + '.exe' if not os.path.isfil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_executable(executable, path=None):\n import os, os.path, sys\n if path is None:\n path = os.environ['PATH']\n paths = path.split(os.pathsep)\n extlist = ['']\n if os.name == 'os2':\n (base, ext) = os.path.splitext(executable)\n # executable files on OS/2 can have an arb...
[ "0.81355155", "0.7986788", "0.77614045", "0.7613142", "0.7569166", "0.752759", "0.7498395", "0.7452371", "0.74062175", "0.72964525", "0.72895", "0.72293276", "0.71495247", "0.7135998", "0.7095247", "0.6919757", "0.6804221", "0.67726207", "0.6695109", "0.6684318", "0.66028327"...
0.77899325
2
Returns rc file path.
def get_pypirc_path(): return os.path.join(os.path.expanduser('~'), '.pypirc')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rcfile(self, fname):\n rcfile = fname or os.environ.get('OPENERPRCSERVERS') or os.path.join(get_home_dir(), '.openerprc.servers')\n if not os.path.exists(rcfile):\n log = logging.getLogger('common.options')\n additional_info = \"\"\n log.warn('Config file %s ...
[ "0.71331835", "0.7019709", "0.66568166", "0.66568166", "0.6628477", "0.64366096", "0.6421254", "0.6325886", "0.63235766", "0.62920403", "0.6232412", "0.6197284", "0.61940944", "0.6176776", "0.61494607", "0.6144491", "0.6128805", "0.61062443", "0.6047619", "0.60329944", "0.599...
0.0
-1
Creates a default .pypirc file.
def generate_pypirc(username, password): rc = get_pypirc_path() f = open(rc, 'w') try: f.write(DEFAULT_PYPIRC % (username, password)) finally: f.close() try: os.chmod(rc, 0600) except OSError: # should do something better here pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_default_config(self, parser):\n parser.add_section('irc')\n parser.set('irc', 'channels', '')\n \n # create the full path, and the file\n try:\n os.makedirs(self.config_dir_path, mode=0700)\n except OSError:\n pass\n file_resource = ...
[ "0.6558019", "0.62628806", "0.58864355", "0.573295", "0.5716338", "0.5681678", "0.56687874", "0.5664316", "0.5623866", "0.5536374", "0.553043", "0.5503424", "0.5500698", "0.5489507", "0.5476311", "0.54706043", "0.5446161", "0.54202074", "0.5416349", "0.5378271", "0.5377565", ...
0.74003255
0
Reads the .pypirc file.
def read_pypirc(repository=DEFAULT_REPOSITORY, realm=DEFAULT_REALM): rc = get_pypirc_path() if os.path.exists(rc): config = RawConfigParser() config.read(rc) sections = config.sections() if 'distutils' in sections: # let's get the list of servers index_ser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, filename):\n pass", "def read(self, filename):\n pass", "def read():\n # TODO", "def read_from_file(self, filename: str) -> None:", "def read(path):", "def read_file(path_to_file):\n 8", "def read(self, filename):\n raise NotImplementedError", "def readFromFile...
[ "0.6292948", "0.6292948", "0.610795", "0.6085588", "0.6016745", "0.5967967", "0.58684736", "0.5663966", "0.56348854", "0.5612743", "0.5605343", "0.5467679", "0.54598063", "0.5443044", "0.5436253", "0.5435183", "0.5428531", "0.5419116", "0.54167354", "0.5408058", "0.5382331", ...
0.5551811
11
XXX might want to move it to the Metadata class.
def metadata_to_dict(meta): data = { 'metadata_version' : meta.version, 'name': meta['Name'], 'version': meta['Version'], 'summary': meta['Summary'], 'home_page': meta['Home-page'], 'author': meta['Author'], 'author_email': meta['Author-email'], 'licen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __metadata__(self):\n raise NotImplementedError", "def metadata(self): # -> None:\n ...", "def meta(self):\n raise NotImplementedError", "def metadata(self): # -> list[Unknown]:\n ...", "def metadata(self): # -> list[Unknown]:\n ...", "def _getMetadataName(self):\n ...
[ "0.8049945", "0.7873134", "0.7521149", "0.7037641", "0.7037641", "0.70305324", "0.6875122", "0.6575829", "0.6506809", "0.6497274", "0.6467443", "0.64535034", "0.64156395", "0.6365625", "0.6300879", "0.62689877", "0.6223585", "0.6208702", "0.6203031", "0.6131221", "0.61198187"...
0.0
-1
Wrapper function around the refactor() class which performs the conversions on a list of python files. Invoke 2to3 on a list of Python files. The files should all come from the build area, as the modification is done inplace.
def run_2to3(files, doctests_only=False, fixer_names=None, options=None, explicit=None): #if not files: # return # Make this class local, to delay import of 2to3 from lib2to3.refactor import get_fixers_from_package, RefactoringTool ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refactor_2to3(self, path):\n # self.logger.debug('Refactoring: %s' % path)\n source, encoding = self.refactoring_tool._read_python_source(path)\n\n source += '\\n' # Silence certain parse errors.\n tree = self.refactoring_tool.refactor_string(source, path)\n return str(tree)...
[ "0.6804691", "0.65736985", "0.6213052", "0.5742118", "0.529011", "0.5283378", "0.5246217", "0.51765335", "0.51484454", "0.51378375", "0.5068919", "0.50683546", "0.50638443", "0.50514895", "0.50448775", "0.4973271", "0.49656966", "0.49321887", "0.49237916", "0.4915581", "0.489...
0.73142666
0
Issues a call to util.run_2to3.
def run_2to3(self, files, doctests_only=False): return run_2to3(files, doctests_only, self.fixer_names, self.options, self.explicit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_2to3(files, doctests_only=False, fixer_names=None, options=None,\n explicit=None):\n\n #if not files:\n # return\n\n # Make this class local, to delay import of 2to3\n from lib2to3.refactor import get_fixers_from_package, Refacto...
[ "0.6248613", "0.6005194", "0.5644888", "0.5473579", "0.54017115", "0.5398377", "0.53385645", "0.5264664", "0.5233024", "0.5117116", "0.5111273", "0.51092243", "0.5096129", "0.5089467", "0.50623655", "0.5041441", "0.504088", "0.50230515", "0.50128806", "0.5006936", "0.49927324...
0.6521159
0
Verifies an input name is acceptable and returns a boolean
def isValidName(theString, minimum, maximum) : return theString.isalpha() == True \ and len(theString) >= minimum \ and len(theString) <= maximum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(name):\n return bool(name)", "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)", "def validate_name(name:str) -> bool:\r\n return name.isalpha() and name.count(\" \") == 0 and len(name) >= 2", "def check_name(name, al...
[ "0.84723276", "0.8086865", "0.80412364", "0.8000008", "0.7983366", "0.7967118", "0.7879373", "0.78629535", "0.7841387", "0.78324914", "0.7754868", "0.7720671", "0.76799494", "0.76105803", "0.7601347", "0.75737584", "0.7567341", "0.7541546", "0.7506352", "0.7467125", "0.744105...
0.70684606
40
Verifies an input is an integer
def isInteger(number) : try: int(number) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_input_is_int(self):\n try:\n int(self.input)\n except ValueError:\n return False\n else:\n return True", "def check_for_int(check):", "def is_int(num):\n return int(num) == num", "def is_int(n):\n try:\n int(n)\n return Tr...
[ "0.82832134", "0.8087058", "0.8012525", "0.8001059", "0.79113036", "0.78895354", "0.7804586", "0.77542686", "0.77329695", "0.77329695", "0.77250034", "0.7717381", "0.7696554", "0.7644891", "0.7641828", "0.7641031", "0.76327425", "0.75927633", "0.75806427", "0.7558416", "0.754...
0.7697185
12
This verifies that a vote input is in the allowable range and an integer
def voteInput(number): counter = False while counter == False: if isInteger(number) == True: number = int(number) if voteCheck(number) == True: counter = True else: print("\n\t\tPlease enter an integer between {} and {}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voteCheck(number):\n\n if number >= MIN_VOTES and number <= MAX_VOTES:\n return True\n else:\n return False\n number = input(\"\\n\\tEnter votes: \")", "def can_vote(age):\n return age >= 18", "def test_int_range_constraint_validation():\n\n # Test valid values OK\n minimum ...
[ "0.77959514", "0.6695749", "0.6464804", "0.6411491", "0.6398409", "0.62149966", "0.6200827", "0.61627644", "0.6154172", "0.6147981", "0.6123191", "0.61143726", "0.60961074", "0.609389", "0.6050309", "0.6048726", "0.6027478", "0.59727585", "0.5957029", "0.59548765", "0.5952279...
0.65654033
2
This verifies a vote input is in the allowable range
def voteCheck(number): if number >= MIN_VOTES and number <= MAX_VOTES: return True else: return False number = input("\n\tEnter votes: ")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_vote(age):\n return age >= 18", "def isRangeValid(self) -> bool:\n ...", "def isInRange(val, minv, maxv):\n\treturn val >= minv and val <= maxv", "def _validate_val_range(self, proposal):\n val_range = proposal[\"value\"]\n if len(val_range) != 2:\n raise traitlets....
[ "0.6918635", "0.64611727", "0.6432009", "0.63926494", "0.63070136", "0.6304111", "0.6279981", "0.62616414", "0.62209725", "0.62109786", "0.6138942", "0.6124066", "0.61222", "0.60989904", "0.60964143", "0.60828257", "0.6061203", "0.6046962", "0.60301083", "0.60255885", "0.5988...
0.7730605
0
Verifies an input is an integer
def isInteger(number) : try: int(number) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_input_is_int(self):\n try:\n int(self.input)\n except ValueError:\n return False\n else:\n return True", "def check_for_int(check):", "def is_int(num):\n return int(num) == num", "def is_int(n):\n try:\n int(n)\n return Tr...
[ "0.8282151", "0.80858546", "0.8013501", "0.80014825", "0.79122996", "0.78906196", "0.78041965", "0.77555907", "0.7734044", "0.7734044", "0.7725933", "0.771653", "0.769761", "0.76970065", "0.76447093", "0.76413727", "0.762986", "0.759283", "0.75803536", "0.755903", "0.7543939"...
0.7641636
15
Verifies an input team is acceptable and returns a boolean
def isValidTeamSize(size, minimum, maximum) : return isInteger(size) and int(size) >= minimum and int(size) <= maximum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def validate_team(\n self, team, battle_format, *, delay=0, lifespan=math.inf\n ):\n battle_format = utils.name_to_id(battle_format)\n team = team or \"null\"\n await self.upload_team(team, delay=delay, lifespan=lifespan)\n await self.add_output(\n \"|/vtm {}\...
[ "0.67006654", "0.6519993", "0.6371233", "0.63663113", "0.63397926", "0.6335435", "0.6324468", "0.6309282", "0.63051116", "0.6235396", "0.6210397", "0.6076636", "0.604586", "0.5996683", "0.5972928", "0.59400946", "0.5881027", "0.58694565", "0.58569884", "0.5838882", "0.5816535...
0.56892246
30
Generate a walk. Data is scaled.
def data_stream(self, x=[], y=[]): xy = np.zeros((self.numpoints,2)) i = 0 while True: xy[i,0]=x[i];xy[i,1]=y[i] i = (i+1) % self.numpoints yield np.c_[xy[:,0], xy[:,1]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_walks(self):\n return parallel_generate_walks(\n self.d_graph,\n self.walk_length,\n self.num_walks,\n 'Single process!',\n self.sampling_strategy,\n self.NUM_WALKS_KEY,\n self.WALK_LENGTH_KEY,\n self.NEIGH...
[ "0.66663945", "0.6405682", "0.6265293", "0.6117689", "0.6092473", "0.5745223", "0.5619902", "0.5509328", "0.54583424", "0.53986275", "0.53869194", "0.5381262", "0.52899885", "0.52703625", "0.5251284", "0.5199804", "0.519473", "0.51879054", "0.51849425", "0.51716924", "0.51651...
0.0
-1
Initial drawing of the scatter plot.
def setup_plot(self): x, y = next(self.stream).T c = None s = 100 self.scat = self.ax.scatter(x, y, c=c, s=s, vmin=0, vmax=1, cmap="jet", edgecolor="k") self.ax.axis([0, 16.5, 0, 5]) self.ax.set_ylab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter_points(self):\n self.plot(1)", "def display(self):\n scatter_plot(self.points, self.hull_points, self.color, self.title)", "def _plot_init(self):\n pass", "def _plot_init(self):\n pass", "def plot(self):\n pass", "def plot(self):\n\t\tself.plotOfXray()....
[ "0.74585426", "0.73261017", "0.70683897", "0.70683897", "0.6927139", "0.68062884", "0.67960775", "0.6748238", "0.66506225", "0.6636482", "0.66125983", "0.66119593", "0.66109604", "0.6603673", "0.6575989", "0.6570637", "0.65601707", "0.65601707", "0.6555383", "0.6548604", "0.6...
0.65309566
20
Update the scatter plot.
def update(self, i): data = next(self.stream) # Set x and y data... self.scat.set_offsets(data[:, :2]) # Set sizes... self.scat.set_sizes(np.ones(self.numpoints)*75) # Set colors.. self.scat.set_color('#22ff22') self.scat.set_edgecolor('#000000') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_plot():\n pass", "def plot_scatter_points(self):\n self.plot(1)", "def updatePlot(self):\n self.axes.clear()\n self.axes.plot(self.data[0], self.data[1], linestyle='-', color='gray')\n self.axes.plot(self.data[0], self.data[2], linestyle='-', color='blue')\n ...
[ "0.7740826", "0.74767625", "0.72773355", "0.72731286", "0.72731286", "0.72731286", "0.72731286", "0.72731286", "0.7249904", "0.719213", "0.70431316", "0.70192474", "0.69576174", "0.6951091", "0.68849194", "0.6822735", "0.6818633", "0.6798761", "0.67851746", "0.67265725", "0.6...
0.6020489
74
Thread based setInterval function (not safe)
def __set_interval(self, func, sec): def func_wrapper(): self.__set_interval(func, sec) func() t = threading.Timer(sec, func_wrapper) t.start() return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_repeatedly(interval, function, args):\n stopped = threading.Event()\n\n def loop():\n while not stopped.wait(interval):\n function(**args)\n\n threading.Thread(target=loop).start()\n\n # return the thread closing handle\n return stopped.set", "def __window_setInterval(se...
[ "0.698964", "0.6819769", "0.6527123", "0.649315", "0.64859796", "0.6402934", "0.615614", "0.61557084", "0.6069236", "0.6000457", "0.5991643", "0.5990496", "0.59238577", "0.59053993", "0.5846054", "0.58460337", "0.58256936", "0.58172244", "0.5805059", "0.5796818", "0.5796818",...
0.64601296
5
Replace the ``step()`` method of env with a tracing function that calls callbacks with an events time, priority, ID and its instance just before it is processed.
def trace(self): # noqa # pylint: disable=protected-access,invalid-name def get_wrapper(env_step): """Generate the wrapper for env.step().""" @wraps(env_step) def tracing_step(): # noqa """Call *__monitor* for the next event if one exist before ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tracing_step(): # noqa\n if len(self.__env._queue) > 0:\n t, prio, eid, event = self.__env._queue[0]\n self.__monitor(t, prio, eid, event)\n return env_step()", "def get_wrapper(env_step):\n @wraps(env_step)\n def trac...
[ "0.69365823", "0.6761876", "0.63075596", "0.63075596", "0.6298799", "0.60999227", "0.60761", "0.60579455", "0.6035825", "0.599109", "0.5944866", "0.5925591", "0.5841467", "0.58281803", "0.5821764", "0.5817346", "0.5761727", "0.5733629", "0.56965375", "0.56544715", "0.5641167"...
0.78040206
0
Generate the wrapper for env.step().
def get_wrapper(env_step): @wraps(env_step) def tracing_step(): # noqa """Call *__monitor* for the next event if one exist before calling ``env.step()``.""" if len(self.__env._queue) > 0: t, prio, eid, event = self.__env._queue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_impl(context):\n pass", "def step_impl(context):\n pass", "def step_env(self):\n raise NotImplementedError\n # Not needed for this homework", "def build_step(self):\n pass", "def build_step(self):\n pass", "def create_step(self, step):\n raise NotImplementedE...
[ "0.7603104", "0.7603104", "0.7298016", "0.68414867", "0.68414867", "0.6796575", "0.67370456", "0.67275393", "0.6685913", "0.66461134", "0.66308266", "0.6547733", "0.6471887", "0.6468438", "0.6309033", "0.6280767", "0.62707293", "0.62704575", "0.626339", "0.62190646", "0.61948...
0.66882384
8
Call __monitor for the next event if one exist before calling ``env.step()``.
def tracing_step(): # noqa if len(self.__env._queue) > 0: t, prio, eid, event = self.__env._queue[0] self.__monitor(t, prio, eid, event) return env_step()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(self): # noqa\n\n # pylint: disable=protected-access,invalid-name\n def get_wrapper(env_step):\n \"\"\"Generate the wrapper for env.step().\"\"\"\n @wraps(env_step)\n def tracing_step(): # noqa\n \"\"\"Call *__monitor* for the next event if ...
[ "0.67177457", "0.6353171", "0.61669993", "0.6071973", "0.59611213", "0.5918542", "0.58596504", "0.58400434", "0.58186984", "0.581662", "0.57855827", "0.57379687", "0.5727999", "0.5711669", "0.5704478", "0.567846", "0.567341", "0.5660299", "0.56587714", "0.5639612", "0.5639612...
0.6955955
0
set MHCI Database directory path
def __setMHCI_DB_Path(self, mhcidb_dirname): if not hasattr(self, "mhcIdb_path") or self.mhcIdb_path is None: cwd = self.getCWD() pre_dir, after = cwd.split(mhcidb_dirname) self.mhcIdb_path = self.joinPath(pre_dir,mhcidb_dirname ) print(("# MHCIDB workding path: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_db_file():\n\n return os.path.join(db_path, db_file)", "def get_database_directory(self):\n pass", "def setMHCIDBPath(self, mhcidb_dirname=\"MHCIDB\", data_dir=\"existing_data\"):\n self.__setMHCI_DB_Path(mhcidb_dirname)\n self.mhcIdb_existing_data_path = self.joinPath(self.mhcI...
[ "0.70672226", "0.683271", "0.66077834", "0.6452278", "0.64162743", "0.63795066", "0.62165344", "0.61757326", "0.6167116", "0.61049265", "0.60585093", "0.6023727", "0.60130346", "0.6011672", "0.5975978", "0.5875537", "0.58486605", "0.5841338", "0.5835576", "0.5833521", "0.5804...
0.74962735
0
set MHCIDB working directory path and there existing data
def setMHCIDBPath(self, mhcidb_dirname="MHCIDB", data_dir="existing_data"): self.__setMHCI_DB_Path(mhcidb_dirname) self.mhcIdb_existing_data_path = self.joinPath(self.mhcIdb_path, data_dir) self.mhcIdb_hla_path = self.joinPath(self.mhcIdb_existing_data_path, "hla" ) self.mhcIdb_pdb_path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setMHCI_DB_Path(self, mhcidb_dirname):\n if not hasattr(self, \"mhcIdb_path\") or self.mhcIdb_path is None:\n cwd = self.getCWD() \n pre_dir, after = cwd.split(mhcidb_dirname)\n self.mhcIdb_path = self.joinPath(pre_dir,mhcidb_dirname )\n print((\"# MHCIDB wo...
[ "0.7445844", "0.66888374", "0.6555975", "0.64608467", "0.6353928", "0.6310838", "0.6264556", "0.61646134", "0.61341184", "0.60911024", "0.601722", "0.58324337", "0.57763416", "0.5768574", "0.5744997", "0.5684497", "0.56657374", "0.5663596", "0.5662311", "0.5661884", "0.565863...
0.75485724
0
return the path of the file contains the alinged protein seqeuences of HLA gene A, B and C
def get_hla_aligned_seq_fp(self): fn_aln = "ClassI_prot.txt" return self.joinPath(self.mhcIdb_hla_path, fn_aln)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_path(self, protein_id: int):\n protein_name = self.files_refined[protein_id]\n path_protein = os.path.join(\n self.init_refined, protein_name, protein_name + \"_protein.pdb\"\n )\n path_ligand = os.path.join(\n self.init_refined, protein_name, protein_name...
[ "0.6313968", "0.6223646", "0.60979223", "0.6060333", "0.6025667", "0.6019102", "0.5903507", "0.576424", "0.5727223", "0.5694345", "0.5682708", "0.56573516", "0.56486446", "0.56058353", "0.5595129", "0.55100703", "0.54998416", "0.548543", "0.54813707", "0.5469157", "0.5459987"...
0.6534873
0
return existing pdbids' filename and path
def getMHCIPDBFpBin(self): fn = "mhcI_pdbs.bin" return self.joinPath(self.mhcIdb_pdb_path, fn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ida_exported_files():\n create_random_filename()\n dirname = os.path.dirname(idc.get_idb_path())\n file_path = os.path.join(dirname, GLOBAL_FILENAME)\n xml_file_path = file_path + \".xml\"\n bin_file_path = file_path + \".bytes\"\n\n return xml_file_path, bin_file_path", "def _get_path(...
[ "0.60885835", "0.6075756", "0.59418875", "0.5941825", "0.5934894", "0.5901739", "0.5876703", "0.585946", "0.5849226", "0.58439565", "0.5765243", "0.57085174", "0.56838", "0.5655282", "0.56437844", "0.5607454", "0.5591567", "0.5583104", "0.55698305", "0.5566367", "0.55472976",...
0.55431074
21
mhci_pdbs[pdbid] = [(chain_ids, chain_seq(xxx,...), [ligand chains]), ...]
def loadMHCIPDBInf(self): fp = self.getMHCIPDBFpBin() self.mhcI_pdbs = self.loadObj(fp) self.mhcI_pdbids = self.mhcI_pdbs.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdbChain_to_mdtrajChainid_li(chain,seg_to_chain,struc):\n chain = chain.upper()\n chain_segments=[seg for seg,chainval in seg_to_chain.items() if chainval==chain]\n if chain_segments:\n structable, bonds=struc.topology.to_dataframe()\n chainid_li=[]\n for segname in chain_segments...
[ "0.61442226", "0.59000146", "0.58840007", "0.57433015", "0.57347775", "0.571934", "0.57122654", "0.56994164", "0.5668878", "0.56548905", "0.5552011", "0.54910815", "0.5442244", "0.54237217", "0.54219043", "0.5414976", "0.53949857", "0.53885365", "0.5372654", "0.53628534", "0....
0.49685764
57
Initialize anything that is necessary for the driver to function
def init_host(self, host): if self._drv_nodes is None: self.set_nodes([nova_conf.host]) args = (drv_conf.tenant_id, drv_conf.client_id, drv_conf.client_secret, drv_conf.subscription_id) self.compute_client = utils.get_compute_client(*args) self.resource_clien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():", "def do_init(self):\n\n pass", "def initialise(self):", "def _initialize(self):\n pass", "def _initialize(self):\n pass", "def _initialize(self):\n pass", "def _manually_initialize(self) -> None:\n # XXX: maybe refactor, this is actually part of the publ...
[ "0.7925654", "0.7911239", "0.782324", "0.7790317", "0.7790317", "0.7790317", "0.7779702", "0.77655745", "0.7762842", "0.7762842", "0.7762842", "0.7762842", "0.7762842", "0.7759737", "0.7714685", "0.7714685", "0.7695942", "0.76908666", "0.7671591", "0.7671591", "0.7671591", ...
0.0
-1
Sets Driver's node list.
def set_nodes(self, nodes): self._drv_nodes = nodes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes(self, nodes):\n\n self._nodes = nodes", "def set_node_positions(self):", "def nodes(self, nodes_array):\n self.nodes_set = nodes_array", "def set_node(self, node):\n self.__node = node", "def set_nodes(self, nodes_list):\n try:\n self.node_from = nodes_list[...
[ "0.623272", "0.61300147", "0.58855206", "0.58536756", "0.58154875", "0.57913256", "0.57402974", "0.572732", "0.5669491", "0.5631962", "0.55938464", "0.55284536", "0.5516289", "0.5496053", "0.54852945", "0.54835105", "0.54743034", "0.5465144", "0.54392004", "0.5405577", "0.540...
0.7336902
0
Return the names of all the instances known to the virtualization layer, as a list.
def list_instances(self): instances = utils.list_instances(self.compute_client, drv_conf.resource_group) self._uuid_to_omni_instance.clear() instance_names = [] for instance in instances: openstack_id = None if instance.ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _instancelist(self):\n\n rv = []\n self.iname = {}\n for resv in self.conn.get_all_reservations():\n for inst in resv.instances:\n if inst.state != 'terminated':\n name = inst.tags.get('Name',None)\n rv.append([inst.id,inst.st...
[ "0.73283607", "0.72498333", "0.72159374", "0.71229815", "0.69062555", "0.68839556", "0.6839197", "0.6824386", "0.67755884", "0.67637473", "0.67236537", "0.6705025", "0.6691391", "0.6683105", "0.6653908", "0.6628568", "0.6607859", "0.6603153", "0.65869886", "0.65696645", "0.65...
0.70650893
4
Plug VIFs into networks.
def plug_vifs(self, instance, network_info): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plug_vifs(self, instance, network_info):\n for vif in network_info:\n self.vif_driver.plug(instance, vif)", "def plug_vifs(self, instance, network_info):\n for vif in network_info:\n self.vif_driver.plug(instance, vif)", "def plug_vifs(self, instance, network_info):\n ...
[ "0.8050093", "0.8050093", "0.8015814", "0.7835043", "0.77215666", "0.65305203", "0.64030856", "0.6391392", "0.63874394", "0.63874394", "0.6296223", "0.62635887", "0.6246917", "0.61610335", "0.5945676", "0.59314704", "0.5805514", "0.57461524", "0.5699191", "0.56898993", "0.567...
0.77472746
4
Unplug VIFs from networks.
def unplug_vifs(self, instance, network_info): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unplug_vifs(self, instance, network_info):\n for vif in network_info:\n self.vif_driver.unplug(instance, vif)", "def unplug_vifs(self, instance, network_info):\n for vif in network_info:\n self.vif_driver.unplug(instance, vif)", "def unplug_vifs(self, instance, network_i...
[ "0.8416761", "0.8416761", "0.81277955", "0.80877906", "0.63012815", "0.63012815", "0.6242752", "0.6063823", "0.60611725", "0.6007444", "0.59984434", "0.59591705", "0.5954171", "0.58688724", "0.582312", "0.58177847", "0.57877797", "0.57720387", "0.57616687", "0.5697653", "0.56...
0.7990012
4
Create a new instance/VM/domain on the virtualization platform. Once this successfully completes, the instance should be running (power_state.RUNNING). If this fails, any partial instance should be completely cleaned up, and the virtualization platform should be in the state that it was before this call began.
def spawn(self, context, instance, image_meta, injected_files, admin_password, network_info=None, block_device_info=None): vm_params = self._prepare_vm_params(instance, network_info, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn(self, instance):\n\n # Update state to inform the nova stack that the VE is launching\n db.instance_set_state(context.get_admin_context(),\n instance['id'],\n power_state.NOSTATE,\n 'launching')\n ...
[ "0.7116795", "0.6845141", "0.6554778", "0.653072", "0.64352477", "0.6421772", "0.6317792", "0.6291907", "0.6244887", "0.618312", "0.61242557", "0.61064357", "0.609262", "0.60475373", "0.6016337", "0.5976081", "0.59694284", "0.595499", "0.59324074", "0.59253114", "0.5908895", ...
0.58051974
24
Snapshot an image of the specified instance
def snapshot(self, context, instance, image_id, update_task_state): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshot(self, instance, name):\n # TODO(imsplitbit): Need to implement vzdump\n pass", "def get_snapshot(project, zone, instance):\n snapshot_disks(project, zone, *get_disks(instance))", "def take_snapshot(instance_id, objects_created, instance_name=None,\n public=False, ...
[ "0.7108288", "0.6922023", "0.6767384", "0.6702588", "0.6634366", "0.6420016", "0.6365674", "0.63577205", "0.6300057", "0.6296758", "0.62549734", "0.61733276", "0.61012477", "0.60931534", "0.6068985", "0.60444653", "0.5981253", "0.5933683", "0.5925053", "0.59189266", "0.591204...
0.7582861
0
Reboot the specified instance. After this is called successfully, the instance's state goes back to power_state.RUNNING. The virtualization platform should ensure that the reboot action has completed successfully even in cases in which the underlying domain/vm completed successfully even in cases in which the underlyin...
def reboot(self, context, instance, network_info, reboot_type, block_device_info=None, bad_volumes_callback=None): azure_name = self._get_omni_name_from_instance(instance) utils.restart_instance(self.compute_client...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot(self, instance):\n try:\n out, err = utils.execute('sudo', 'vzctl', 'restart',\n instance['id'])\n if err:\n LOG.error(err)\n except ProcessExecutionError:\n raise exception.Error('Failed to restart contain...
[ "0.7982594", "0.75822747", "0.75091374", "0.74159694", "0.72610754", "0.7043796", "0.69840145", "0.6827691", "0.68002975", "0.6799885", "0.6780365", "0.67224604", "0.66695243", "0.65631664", "0.6545103", "0.6498049", "0.64935803", "0.6489103", "0.6465656", "0.6421579", "0.640...
0.7489023
3
Retrieves the IP address of the host
def get_host_ip_addr(): return nova_conf.my_ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_ipaddress(self):\n\t\treturn call_sdk_function('PrlVirtNet_GetHostIPAddress', self.handle)", "def get_IP(): \n \n return socket.gethostbyname(socket.gethostname())", "def get_IP():\n\n return socket.gethostbyname(socket.gethostname())", "def host_ip(host):\n return host.cmd('ip add...
[ "0.85110253", "0.8367678", "0.82971036", "0.824306", "0.8131773", "0.8072522", "0.80218536", "0.79334825", "0.7873693", "0.78481156", "0.77755016", "0.77603847", "0.7753984", "0.7714975", "0.766268", "0.7662511", "0.76242584", "0.75887465", "0.7564115", "0.7562345", "0.755227...
0.8228822
4
Set root password on specified instance
def set_admin_password(self, instance, new_pass): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_root_password(self, *args, **kwargs):\r\n return execute(self._change_root_password, *args, **kwargs)", "def set_admin_password(self, instance, new_pass):\n pass", "def setpassword(self, pwd):\n pass", "def enable_root_user(self):\n uri = \"/instances/%s/root\" % self.i...
[ "0.7161256", "0.71291447", "0.7054025", "0.6816216", "0.6673506", "0.6653156", "0.6610863", "0.66039383", "0.6586424", "0.6568505", "0.65544045", "0.6523187", "0.6458683", "0.6452028", "0.644586", "0.6328441", "0.6323825", "0.63231397", "0.6321453", "0.6321453", "0.6321453", ...
0.6973785
3
Power off the specified instance.
def power_off(self, instance, timeout=0, retry_interval=0): azure_name = self._get_omni_name_from_instance(instance) utils.stop_instance(self.compute_client, drv_conf.resource_group, azure_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_off(self, instance, node=None):\n if not node:\n node = _get_baremetal_node_by_instance_uuid(instance['uuid'])\n pm = get_power_manager(node=node, instance=instance)\n pm.deactivate_node()\n if pm.state != baremetal_states.DELETED:\n raise exception.Insta...
[ "0.8163168", "0.778168", "0.74489874", "0.7349463", "0.7315433", "0.726085", "0.71212804", "0.71180135", "0.7100586", "0.69825584", "0.6973217", "0.69285697", "0.69209427", "0.68579257", "0.6851049", "0.68323034", "0.67938197", "0.67203593", "0.66902196", "0.66892743", "0.663...
0.7834359
1
Power on the specified instance.
def power_on(self, context, instance, network_info, block_device_info): azure_name = self._get_omni_name_from_instance(instance) utils.start_instance(self.compute_client, drv_conf.resource_group, azure_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_on(self, context, instance, network_info, block_device_info=None,\n node=None):\n if not node:\n node = _get_baremetal_node_by_instance_uuid(instance['uuid'])\n pm = get_power_manager(node=node, instance=instance)\n pm.activate_node()\n if pm.state !...
[ "0.71708614", "0.71564245", "0.6803959", "0.66371447", "0.6610328", "0.6603284", "0.65963256", "0.6575031", "0.65632343", "0.6525696", "0.6326837", "0.6247188", "0.61694384", "0.6168198", "0.61403644", "0.6054478", "0.60359627", "0.6026181", "0.59573036", "0.59512424", "0.594...
0.7114414
2
Deleting the specified instance
def soft_delete(self, instance): self.destroy(instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_instance(cls, args, config):\n if len(args) == 0:\n print \"Usage: molns instance delete INSTANCE_ID\"\n return\n try:\n instance_id = int(args[0])\n except ValueError:\n print \"instance ID must be a integer\"\n return\n ...
[ "0.8101496", "0.8059547", "0.7977949", "0.7879895", "0.78513724", "0.7765248", "0.76716346", "0.7619921", "0.76001656", "0.7567031", "0.7555083", "0.75265646", "0.7497402", "0.7492909", "0.7454431", "0.74533576", "0.744203", "0.7380438", "0.737432", "0.7363298", "0.73548996",...
0.7321301
22
Azure doesn't support pause and cannot save system state and hence we've implemented the closest functionality which is to poweroff the instance.
def pause(self, instance): self.power_off(instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def power_off(self):\n ...", "def suspend(self, context, instance):\n LOG.info(\"Suspending instance %s\" % instance.uuid)\n self.power_off(instance)", "def poweroff(self) -> None:\n pass", "def unpause(self, instance):\n self.power_on(\n context=None,\n ...
[ "0.69178873", "0.6913627", "0.6892047", "0.6817895", "0.67467296", "0.6689266", "0.66683525", "0.6530523", "0.6501536", "0.6460379", "0.6408786", "0.63833135", "0.6374186", "0.6365973", "0.6355397", "0.63161796", "0.6303939", "0.6271553", "0.62554705", "0.6237528", "0.6232611...
0.73265564
0
Since Azure doesn't support pause and cannot save system state, we had implemented the closest functionality which is to poweroff the instance. and powering on such an instance in this method.
def unpause(self, instance): self.power_on( context=None, instance=instance, network_info=None, block_device_info=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poweroff(self) -> None:\n pass", "def pause(self, instance):\n self.power_off(instance)", "async def power_off(self):\n ...", "def poweroff(self):\n raise NotImplementedError()", "async def power_on(self):\n ...", "def suspend(self, context, instance):\n LOG....
[ "0.7085959", "0.7023049", "0.69730014", "0.6920526", "0.6845593", "0.6776939", "0.673636", "0.67298234", "0.66635555", "0.6650689", "0.6584726", "0.6577588", "0.6556395", "0.6553188", "0.6517561", "0.6505881", "0.64334756", "0.6415571", "0.63366055", "0.6285882", "0.6254463",...
0.66322196
10
Azure doesn't support suspend and cannot save system state and hence Azure doesn't support suspend and cannot save system state and hence we've implemented the closest functionality which is to poweroff the instance.
def suspend(self, context, instance): LOG.info("Suspending instance %s" % instance.uuid) self.power_off(instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def power_off(self):\n ...", "def poweroff(self) -> None:\n pass", "def powerOff(self):\n self._sendCommand(self.SONY_CMD_ExtBackupCommunicator_ForcePowerOff, bufferSize=0)", "def poweroff(self):\n raise NotImplementedError()", "def power_off(vmname):\n\n _conn.lookupByName(v...
[ "0.6929162", "0.6777848", "0.66953474", "0.66884506", "0.66733646", "0.6653961", "0.6581523", "0.65645", "0.6513084", "0.6512412", "0.6495168", "0.64791274", "0.6453871", "0.6394145", "0.62952673", "0.62936836", "0.6290737", "0.62712413", "0.62297374", "0.6217458", "0.6208989...
0.70598346
0
Since Azure doesn't support resume and we cannot save system state, Since Azure doesn't support resume and we cannot save system state, we've implemented the closest functionality which is to power on the instance.
def resume(self, context, instance, network_info, block_device_info=None): LOG.info("Resuming instance %s" % instance.uuid) self.power_on(context, instance, network_info, block_device_info)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_on(self, context, instance, network_info, block_device_info):\n azure_name = self._get_omni_name_from_instance(instance)\n utils.start_instance(self.compute_client, drv_conf.resource_group,\n azure_name)", "def power_on(vmname):\n\n _conn.lookupByName(vmname...
[ "0.6904723", "0.6538291", "0.64492124", "0.6384998", "0.6321347", "0.62968606", "0.62499666", "0.62253034", "0.6220497", "0.6195912", "0.6123734", "0.6116155", "0.6062253", "0.6062095", "0.6025022", "0.5974641", "0.59555715", "0.5953936", "0.5952198", "0.5934965", "0.5905421"...
0.73453075
0
Destroy the specified instance from the Hypervisor. If the instance is not found (for example if networking failed), this function should still succeed. It's probably a good idea to log a warning in that case.
def destroy(self, context, instance, network_info, block_device_info=None, destroy_disks=True, migrate_data=None): LOG.info("Destroying instance %s" % instance.uuid) try: azure_name = self._get_om...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self, instance):\n # TODO(imsplitbit): This needs to check the state of the VE\n # and if it isn't stopped it needs to stop it first. This is\n # an openvz limitation that needs to be worked around.\n # For now we will assume it needs to be stopped prior to destroying it.\n...
[ "0.791352", "0.7301137", "0.70033085", "0.69593155", "0.683459", "0.6819016", "0.67927456", "0.6771135", "0.6731122", "0.67197967", "0.6718423", "0.66487736", "0.66037816", "0.6587685", "0.6587263", "0.6554243", "0.6551002", "0.65075696", "0.65006113", "0.6493354", "0.6481589...
0.65612006
15
Attach the disk to the instance at mountpoint using info.
def attach_volume(self, context, connection_info, instance, mountpoint, disk_bus=None, device_type=None, encryption=None): def _check_available_lun(data_disk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_volume(self, context, connection_info, instance, mountpoint,\n disk_bus=None, device_type=None, encryption=None):", "def attach_volume(self, instance_name, device_path, mountpoint):\n return True", "def _AttachDisk(self, idx, params, _):\n uuid = params.get(\"uuid\", N...
[ "0.75799954", "0.7112061", "0.70221376", "0.7012122", "0.68031716", "0.6700837", "0.6697146", "0.6559337", "0.6488255", "0.63370275", "0.61489516", "0.6141329", "0.60744673", "0.6069949", "0.6043172", "0.59649885", "0.59368604", "0.57600784", "0.57503486", "0.57471454", "0.57...
0.6979955
4
Detach the disk attached to the instance.
def detach_volume(self, connection_info, instance, mountpoint, encryption=None): volume_data = connection_info['data'] azure_name = self._get_omni_name_from_instance(instance) azure_instance = utils.get_insta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach(self):\r\n\r\n return self.driver.detach_volume(volume=self)", "def detach_volume(self, connection_info, instance, mountpoint,\n encryption=None):", "def detachDisk(positive, alias, vmName):\n logger.info(\"Detaching disk %s from vm %s\", alias, vmName)\n disk_attac...
[ "0.7421548", "0.73618275", "0.73364055", "0.7218049", "0.7153865", "0.7143531", "0.6999629", "0.6941956", "0.6916351", "0.6820316", "0.6759385", "0.674773", "0.673258", "0.66643745", "0.6635438", "0.6573193", "0.64687556", "0.6391935", "0.632404", "0.62807864", "0.6257149", ...
0.6795089
10
Replace the disk attached to the instance.
def swap_volume(self, old_connection_info, new_connection_info, instance, mountpoint, resize_to): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disk(self, disk):\n self._context[\"disk\"] = disk", "def setDisk(self, disk):\n self.__disk = disk", "def detachDiskFromMinipad(self , disk):\n return", "def _setDisk(self, disk):\n log_method_call(self, self.name, old=getattr(self.disk, \"name\", None),\n ...
[ "0.6687796", "0.6482982", "0.638375", "0.6367535", "0.6186862", "0.59743375", "0.59572583", "0.5792501", "0.5778626", "0.573332", "0.57177293", "0.5685649", "0.5658161", "0.56495345", "0.5643152", "0.5610682", "0.5607765", "0.5606744", "0.5603462", "0.5602964", "0.55971277", ...
0.54460233
32
Return data about VM diagnostics.
def get_diagnostics(self, instance): # Fake diagnostics return { 'cpu0_time': 17300000000, 'memory': 524288, 'vda_errors': -1, 'vda_read': 262144, 'vda_read_req': 112, 'vda_write': 5778432, 'vda_write_req': 488, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagnostics(self):\r\n # NB: should be not None for multiprocessing works\r\n return {}", "def compute_diagnostics(self) -> Dict[str, Any]:\n return {}", "def get_diagnostics(self) -> List[Diagnostic]:\n raise NotImplementedError", "def diagnostics(self, oid):\n path = ...
[ "0.7394385", "0.7127574", "0.68339425", "0.6612228", "0.64488685", "0.6354231", "0.61432654", "0.61270887", "0.604643", "0.6037903", "0.5928791", "0.5822542", "0.58160037", "0.5722499", "0.56864506", "0.5682793", "0.56672037", "0.560802", "0.5604313", "0.5590717", "0.55809945...
0.79608166
0
Return bandwidth usage counters for each interface on each running VM.
def get_all_bw_counters(self, instances): bw = [] return bw
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface_stats(self, instance_name, iface_id):\n return [0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L]", "def get_interfaces_counters(self):\n raise NotImplementedError", "def calculateTotalPerInterface(self):\n for intf, intfDict in self.activeNow.items():\n for _, bwDict in intfDict.it...
[ "0.6653468", "0.6365453", "0.6101461", "0.6080102", "0.5981753", "0.5973499", "0.5922819", "0.58377063", "0.58369577", "0.5773112", "0.5768719", "0.5759653", "0.57557994", "0.57509416", "0.5707604", "0.56886387", "0.5681633", "0.5632037", "0.56214297", "0.56150115", "0.561414...
0.551519
26
Return usage info for volumes attached to vms on a given host.
def get_all_volume_usage(self, context, compute_host_bdms): volusage = [] return volusage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volume_info(host, disk_object, dc_obj):\n host_resource = get_host_resource_by_name(host)\n\n vol_id = disk_object.get_image_id()\n sd_id = disk_object.get_storage_domains().get_storage_domain()[0].get_id()\n image_id = disk_object.get_id()\n sp_id = dc_obj.get_id()\n\n args = {\n ...
[ "0.64672023", "0.62748015", "0.6236638", "0.60684156", "0.5916731", "0.5862034", "0.5846422", "0.57962835", "0.57623684", "0.57531667", "0.56755435", "0.5626542", "0.56177384", "0.560629", "0.5597559", "0.55715716", "0.55710214", "0.55689335", "0.55505204", "0.553369", "0.552...
0.7157881
1
Simple Protocol for Independent Computing Environments
def get_spice_console(self, instance): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_operating_systems():\n pass", "def localhost():\n env.run = local\n env.cd = lcd\n env.deployment = 'local'", "def __init__(__self__, *,\n environment_id: pulumi.Input[str],\n host: pulumi.Input[str],\n organization_id: pulumi.Input[str],...
[ "0.56609195", "0.5631904", "0.5630082", "0.5496015", "0.54416645", "0.53605473", "0.53354585", "0.53211445", "0.53162044", "0.5308569", "0.53064585", "0.53024095", "0.52926004", "0.52633333", "0.52546513", "0.5245619", "0.5237053", "0.5224685", "0.5208633", "0.5198523", "0.51...
0.0
-1
Retrieve resource information. Updates compute manager resource info on ComputeNode table. This method is called when novacompute launches and as part of a periodic task that records results in the DB. Without real hypervisor, pretend we have lots of disk and ram.
def get_available_resource(self, nodename): if nodename not in self._drv_nodes: return {} supported_tuple = ('IA64', 'kvm', 'hvm') return { 'vcpus': drv_conf.max_vcpus, 'memory_mb': drv_conf.max_memory_mb, 'local_gb': drv_conf.max_disk_gb, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_available_resource(self, context):\n # ask hypervisor for its view of resource availability &\n # usage:\n resources = self.driver.get_available_resource()\n if not resources:\n # The virt driver does not support this function\n LOG.warn(_(\"Virt driver ...
[ "0.6798864", "0.6736824", "0.66807497", "0.6625143", "0.6363091", "0.60891324", "0.6001897", "0.59203047", "0.5692609", "0.56868356", "0.5680813", "0.56029063", "0.5568988", "0.55009604", "0.54992586", "0.5487162", "0.54465723", "0.5440649", "0.541904", "0.5378156", "0.537545...
0.5764905
8