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
Parse loaded ammo packet after firing weapon to get amount left. Implements autoreloading by sending an empty reload packet once the loaded ammo is 0.
def handle_loaded_ammo(data: bytes) -> Tuple[bytes, str]: weapon_name_length = struct.unpack('H', data[:2])[0] weapon_name = data[2:2+weapon_name_length].decode(helpers.ENCODING) loaded_ammo = struct.unpack('I', data[2+weapon_name_length:2+weapon_name_length+4])[0] # noqa: E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_reload(data: bytes) -> Tuple[bytes, str]:\n try:\n weapon_name_length = struct.unpack('H', data[:2])[0]\n weapon_name = data[2:2+weapon_name_length].decode(helpers.ENCODING)\n ammo_name_length = struct.unpack('H',\n data[2+weapon_name_lengt...
[ "0.6259794", "0.58762985", "0.55822694", "0.5278703", "0.507096", "0.49732047", "0.4869085", "0.48412865", "0.48208162", "0.48206604", "0.47543898", "0.47513166", "0.47376245", "0.4736578", "0.47344047", "0.47061676", "0.4654247", "0.46230495", "0.4613993", "0.4606527", "0.45...
0.780836
0
Route packet data handlers to parse into readable information.
def parse(data: bytes, port: int, origin: helpers.ConnectionType): # Ignore packets from master server... game server is more interesting if port == helpers.MASTER_PORT: return # Iteratively parse packet data until nothing is left to parse reads = 0 while len(data) >= 2: reads += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __packetHandler(self, hdr, data):\n\t\tif self.quit: raise SystemExit('capture on interface stoped.')\n\n\t\tdecoded_data = self.decoder.decode(data)\n\t\t(src, dst, data) = self.__getHeaderInfo(decoded_data)\n\t\tfor item in regex_links.finditer(str(data)):\n\t\t\tif not item: continue\n\t\t\t#pos = item.star...
[ "0.66796184", "0.6432901", "0.64061546", "0.62714857", "0.6132332", "0.59966666", "0.59490126", "0.59236974", "0.5914968", "0.59031445", "0.59025717", "0.5844497", "0.58147085", "0.5788655", "0.57704127", "0.57663685", "0.5764335", "0.5756174", "0.5756174", "0.5756174", "0.57...
0.6362068
3
Tests that get_connection calls psftp.Connection with the correct values
def test_get_connection_settings(self, connection_mock): # pylint: disable=no-self-use connection = get_connection() connection_mock.assert_called_once_with( host=EXAMS_SFTP_HOST, port=int(EXAMS_SFTP_PORT), username=EXAMS_SFTP_USERNAME, password=EXAMS_SFT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_connection_established(self):\n module = MagicMock()\n connection = slxos.get_connection(module)\n self.assertEqual(connection, module.slxos_connection)", "def test_get_connection_new(self, connection):\n socket_path = \"little red riding hood\"\n module = MagicMoc...
[ "0.72463953", "0.69269234", "0.6732456", "0.6695619", "0.6427103", "0.63837254", "0.6339699", "0.63005483", "0.62540317", "0.62194014", "0.62133", "0.6174514", "0.616663", "0.6124214", "0.61124814", "0.6091434", "0.6076851", "0.60266703", "0.6018473", "0.60139763", "0.6008917...
0.7967671
0
Tests that get_connection ImproperlyConfigured if settings.{0} is not set
def test_get_connection_missing_settings(self, settings_key, connection_mock): kwargs = {settings_key: None} with self.settings(**kwargs): with self.assertRaises(ImproperlyConfigured) as cm: get_connection() connection_mock.assert_not_called() assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_settings(self):\n if not self.app.config['SIMPLE_DOMAINS']:\n raise ConfigurationError('You must specify at least one SimpleDB domain to use.')\n\n if not (self.app.config['AWS_ACCESS_KEY_ID'] and self.app.config['AWS_SECRET_ACCESS_KEY']):\n raise ConfigurationError('Y...
[ "0.649657", "0.6454777", "0.6415557", "0.64093715", "0.6342447", "0.6325495", "0.63240635", "0.6275803", "0.6271064", "0.62406033", "0.62391704", "0.6227631", "0.6218934", "0.61725026", "0.6149161", "0.6049156", "0.6045454", "0.60177803", "0.6005816", "0.5928027", "0.5928027"...
0.76731056
0
Smoothing should be a number, bbox_x = [minx, maxx]
def get_res(smoothing, bbox_x, bbox_y): def res(bbox, sm): return int((bbox_x[1] - bbox_x[0])/sm) return [res(bbox_x, smoothing), res(bbox_y, smoothing)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth(y, box_pts):\r\n box = np.ones(box_pts)/box_pts\r\n y_smooth = np.convolve(y, box, mode='same')\r\n return y_smooth", "def smooth(y, box_pts):\n box = np.ones(box_pts) / box_pts\n y_smooth = np.convolve(y, box, mode='same')\n return y_smooth", "def smooth(y, box_pts):\n box = np...
[ "0.57198817", "0.56598175", "0.56598175", "0.56491804", "0.5611589", "0.54865634", "0.5460925", "0.5432702", "0.536268", "0.53520083", "0.5329537", "0.5329224", "0.5327849", "0.5318262", "0.5299387", "0.52045935", "0.51921636", "0.51901954", "0.51788276", "0.5169787", "0.5165...
0.6321506
0
DG is the datagrid, and sound is a callable function that returns the sound speed (see toomre.py). res_elem gives the size of the resolution element in simulation units (used to convert the mass in a pixel to surface density) It automatically masks regions where there are no particles, which can be used through cmap.se...
def get_toomre_Q(DG, sound, res_elem): area = res_elem**2 gas_sd = DG.gas_data['masses']/area star_sd = DG.star_data['masses']/area gas_v = DG.gas_data['velocities'] # note this is actually v/r gas_d = DG.gas_data['densities'] # Surface density reasoning see 1503.07873v1 gas_q = toom.Q_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toomre_Q_r(DG, sound, res_elem, max_radius):\n # Yes, this is very slow.\n radii = np.arange(res_elem, max_radius, res_elem)\n toomre_Q = []\n\n for rad in radii:\n toomre_Q.append(fid.toomre_Q_gas(DG, rad, res_elem, sound))\n\n return toomre_Q", "def simulated_dph(grbdir,typ,t_src,alph...
[ "0.52552176", "0.5182895", "0.51682216", "0.5144233", "0.50311786", "0.49805695", "0.49099684", "0.4887669", "0.48485103", "0.4843213", "0.48011786", "0.47985935", "0.47597227", "0.4748434", "0.47479472", "0.46964255", "0.4680623", "0.46685237", "0.46675152", "0.46445018", "0...
0.61697304
0
Plots the toomre Q as a function of R using fiducial.toomre_Q_gas.
def toomre_Q_r(DG, sound, res_elem, max_radius): # Yes, this is very slow. radii = np.arange(res_elem, max_radius, res_elem) toomre_Q = [] for rad in radii: toomre_Q.append(fid.toomre_Q_gas(DG, rad, res_elem, sound)) return toomre_Q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def QQplot(self,using,dx=0.0001,Nquants=101):\n pits = self.PIT(using=using,dx=dx)\n quants = np.linspace(0.,100.,Nquants)\n QTheory = quants/100.\n Qdata = np.percentile(pits,quants)\n plt.figure(figsize=(10,10))\n plt.plot(QTheory,Qdata,c='b',linestyle='-',linewidth=3,la...
[ "0.67181885", "0.6210467", "0.6088371", "0.60317993", "0.5906622", "0.5897689", "0.5897626", "0.5887337", "0.587172", "0.58703184", "0.5851816", "0.5803449", "0.57945967", "0.5771487", "0.5690627", "0.56888986", "0.5652575", "0.5644636", "0.5644306", "0.56415474", "0.5621411"...
0.51743644
100
Plots the surface density as a function of R using fiducial.surface_density.
def sd_r(DG, res_elem, max_radius, errors=False): # Yes, this is very slow. radii = np.arange(res_elem, max_radius, res_elem) sd = [] for rad in radii: sd.append(fid.surface_density(DG, rad, res_elem, errors)) return sd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fresnel(self, substrate=None, surface=None, **kwargs):\n if substrate is None and surface is None:\n raise TypeError(\"Fresnel-normalized reflectivity needs substrate or surface\")\n F = self.fresnel(substrate=substrate, surface=surface)\n #print(\"substrate\", substrate, \...
[ "0.6303191", "0.6291726", "0.59687424", "0.59391516", "0.59239244", "0.5818692", "0.5805483", "0.5783749", "0.5768261", "0.57641035", "0.5749173", "0.57469916", "0.5733663", "0.57034355", "0.56764144", "0.5663654", "0.5653423", "0.5634998", "0.5628341", "0.55745983", "0.55558...
0.0
-1
Finds the number of particles within the bin radii, useful for seeing how the disk stabalises (does it transport mass into the centre?)
def n_particles_bins(DG, bins=[0, 0.5, 3, 10, 100]): radii = fid.rss(DG.gas['Coordinates'][()]) hist, bin_edges = np.histogram(radii, bins) return hist, bin_edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computation_gr(particles,p_types,dist,i,j,nbins, rmax):\n i=np.where(p_types == i)[0][0]\n j=np.where(p_types == j)[0][0]\n\n\n if len(p_types)>1:\n #indexes to delete if there is more than one type of particles\n i_axis0=[]\n i_axis1=[]\n for k in range(len(p_types)):\n ...
[ "0.7237319", "0.7176436", "0.63535374", "0.6320189", "0.6278159", "0.61981356", "0.6194995", "0.6141035", "0.61394185", "0.61316097", "0.61302745", "0.6105756", "0.6071953", "0.6067629", "0.6005089", "0.5995811", "0.59784985", "0.59109277", "0.59025335", "0.58659625", "0.5864...
0.74232644
0
Checks that fetch_inventory_and_error adds entries to database_inv_sig and that the execution time is smaller when fetching an already existing entry
def test_fecth_inventory_and_error(): # build for key in divHretention.database_inv_sig: # ensuring an empty database del divHretention.database_inv_sig[key] # test test_time = 1e3 start_time = time.time() inv, sig = divHretention.fetch_inventory_and_error(test_time) long_ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_inventory_and_error(time):\n if time in database_inv_sig.keys(): # fetch in database\n inv_T_c_local = database_inv_sig[time][\"inv\"]\n sig_inv_local = database_inv_sig[time][\"sig\"]\n else: # if time is not in the database\n GP = estimate_inventory_with_gp_regression(time=...
[ "0.6221308", "0.5411542", "0.53102636", "0.5308235", "0.5300307", "0.5236339", "0.52021307", "0.51916313", "0.5173078", "0.5142627", "0.5137326", "0.5120869", "0.5109939", "0.50971144", "0.5077694", "0.5074573", "0.5023493", "0.49574175", "0.49436677", "0.49277782", "0.492769...
0.7170764
0
Checks that compute_inventory runs correctly
def test_compute_inventory(): T = [1000] c_max = [1e20] time = 1e3 inv, sig = divHretention.compute_inventory(T, c_max, time) assert len(inv) == len(sig) assert len(inv) == len(T)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_inventory(self):\n pass", "def test_get_dealer_active_inventory(self):\n pass", "def test_fecth_inventory_and_error():\n # build\n for key in divHretention.database_inv_sig:\n # ensuring an empty database\n del divHretention.database_inv_sig[key]\n\n # test\...
[ "0.6818076", "0.63204855", "0.6264373", "0.61825716", "0.61619246", "0.61434335", "0.6123214", "0.60767823", "0.5987047", "0.59677404", "0.59621096", "0.59617424", "0.5866379", "0.5864086", "0.5852474", "0.5762252", "0.57233906", "0.5713749", "0.56915", "0.5668413", "0.564253...
0.6829671
0
Checks that compute_inventory raises a TypeError when a float is given
def test_compute_inventory_float(): T = 1000 c_max = 1e20 time = 1e3 with pytest.raises(TypeError): inv, sig = divHretention.compute_inventory(T, c_max, time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_float(check):", "def test_float(self):\n self.assertFalse(validate_measure_input('0.0', self.measures))\n self.assertFalse(validate_measure_input('1.0', self.measures))\n self.assertFalse(validate_measure_input('1.1', self.measures))", "def test_float_type(self):\n\n i...
[ "0.6769449", "0.6288506", "0.6269468", "0.61832154", "0.6129997", "0.61288977", "0.60953104", "0.60848355", "0.60641825", "0.6039481", "0.60373956", "0.6024941", "0.6017565", "0.60068446", "0.5970356", "0.5923205", "0.58845717", "0.5883388", "0.5840277", "0.5804445", "0.57976...
0.7702364
0
Runs compute_c_max with isotope H and checks that the correct value is produced
def test_compute_c_max_h(): # build T = np.array([600, 500]) E_ion = np.array([20, 10]) E_atom = np.array([30, 40]) angles_ion = np.array([60, 60]) angles_atom = np.array([60, 60]) ion_flux = np.array([1e21, 1e20]) atom_flux = np.array([2e21, 2e20]) # run c_max = divHretention.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compute_c_max_output():\n # build\n T = np.array([600, 500])\n E_ion = np.array([20, 10])\n E_atom = np.array([30, 40])\n angles_ion = np.array([60, 60])\n angles_atom = np.array([60, 60])\n ion_flux = np.array([1e21, 1e20])\n atom_flux = np.array([2e21, 2e20])\n\n # run\n ou...
[ "0.7804228", "0.7230941", "0.71904975", "0.6807927", "0.64462936", "0.6286616", "0.6217312", "0.6186257", "0.6168397", "0.6108435", "0.61060095", "0.6064953", "0.6030965", "0.5990423", "0.59639454", "0.5931527", "0.59088767", "0.5885161", "0.58844084", "0.5855641", "0.5847799...
0.7624501
1
Runs compute_c_max with isotope D and checks that the correct value is produced
def test_compute_c_max_D(): # build T = np.array([600, 500]) E_ion = np.array([20, 10]) E_atom = np.array([30, 40]) angles_ion = np.array([60, 60]) angles_atom = np.array([60, 60]) ion_flux = np.array([1e21, 1e20]) atom_flux = np.array([2e21, 2e20]) # run c_max = divHretention.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compute_c_max_output():\n # build\n T = np.array([600, 500])\n E_ion = np.array([20, 10])\n E_atom = np.array([30, 40])\n angles_ion = np.array([60, 60])\n angles_atom = np.array([60, 60])\n ion_flux = np.array([1e21, 1e20])\n atom_flux = np.array([2e21, 2e20])\n\n # run\n ou...
[ "0.7668764", "0.7432257", "0.70756537", "0.6916304", "0.66039973", "0.633388", "0.6233156", "0.6231558", "0.62197894", "0.6086765", "0.6010786", "0.59821117", "0.595326", "0.5884363", "0.58655345", "0.5859344", "0.5851879", "0.5801701", "0.5789719", "0.5774218", "0.5764772", ...
0.7500105
1
Runs compute_c_max with isotope T and checks that the correct value is produced
def test_compute_c_max_D(): # build T = np.array([600, 500]) E_ion = np.array([20, 10]) E_atom = np.array([30, 40]) angles_ion = np.array([60, 60]) angles_atom = np.array([60, 60]) ion_flux = np.array([1e21, 1e20]) atom_flux = np.array([2e21, 2e20]) # run c_max = divHretention.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compute_c_max_output():\n # build\n T = np.array([600, 500])\n E_ion = np.array([20, 10])\n E_atom = np.array([30, 40])\n angles_ion = np.array([60, 60])\n angles_atom = np.array([60, 60])\n ion_flux = np.array([1e21, 1e20])\n atom_flux = np.array([2e21, 2e20])\n\n # run\n ou...
[ "0.7702256", "0.71932334", "0.71172863", "0.7053916", "0.6803086", "0.6108694", "0.60986686", "0.60772854", "0.6043313", "0.5908919", "0.58666736", "0.5822828", "0.58205795", "0.57687205", "0.5768652", "0.574486", "0.57408726", "0.57109356", "0.5690617", "0.5688739", "0.56839...
0.70892555
3
Runs compute_c_max and checks that the correct output
def test_compute_c_max_output(): # build T = np.array([600, 500]) E_ion = np.array([20, 10]) E_atom = np.array([30, 40]) angles_ion = np.array([60, 60]) angles_atom = np.array([60, 60]) ion_flux = np.array([1e21, 1e20]) atom_flux = np.array([2e21, 2e20]) # run output = divHreten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cmax(self):\n cbca_obj = aggregation.AbstractAggregation(**{'aggregation_method': 'cbca',\n 'cbca_intensity': 5., 'cbca_distance': 3})\n\n cv_aggreg = cbca_obj.cost_volume_aggregation(self.ref, self.sec, self.cv)\n\n # Check if the cal...
[ "0.71956396", "0.6706909", "0.6666093", "0.6654545", "0.6497787", "0.64847076", "0.6446621", "0.64427555", "0.6440773", "0.63409734", "0.6231431", "0.6216798", "0.62037325", "0.6184099", "0.6173182", "0.6159964", "0.61472124", "0.6138057", "0.61080885", "0.6080764", "0.605942...
0.81507987
0
Manage Swift via Ansible.
def __init__(self, module): self.state_change = False self.swift = None # Load AnsibleModule self.module = module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n # the AnsibleModule object will be our abstraction for working with Ansible.\n # This includes instantiation, a couple of common attr that will be the\n # args/params passed to the execution, as well as if the module\n # supports check mode\n module = AnsibleModule(\n argument...
[ "0.6122633", "0.6030492", "0.5812134", "0.5787609", "0.57281595", "0.5663922", "0.56353635", "0.5586648", "0.5523833", "0.5495302", "0.54669803", "0.5455809", "0.5376465", "0.5346679", "0.53452", "0.5293638", "0.52751994", "0.51794976", "0.5168042", "0.515281", "0.51024795", ...
0.4748538
49
Run the command as its provided to the module.
def command_router(self): command_name = self.module.params['command'] if command_name not in COMMAND_MAP: self.failure( error='No Command Found', rc=2, msg='Command [ %s ] was not found.' % command_name ) action_command = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _run_command(self, command, *args, **kwargs):\n pass", "def runCommand(command):\n None", "def runCommand(self): \\\n # pylint: disable=no-self-use", "def run_command(self, command_class):\n command_class(*self.__args, **self.__kwargs).run()", "def run_command(self, comm...
[ "0.7937833", "0.78587466", "0.75955945", "0.756567", "0.74442255", "0.74007905", "0.7366492", "0.7320338", "0.73121434", "0.7274841", "0.7091718", "0.7034497", "0.7010086", "0.7002347", "0.6920718", "0.69022954", "0.6897668", "0.6892139", "0.6886554", "0.6878139", "0.6853127"...
0.0
-1
Return a dict for our Ansible facts.
def _facts(facts): return {'swift_facts': facts}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provides_facts():\n return {\n \"domain\": \"The domain name configured at the [edit system \"\n \"domain-name] configuration hierarchy.\",\n \"fqdn\": \"The device's hostname + domain\",\n }", "def facts(self): # pylint: disable=invalid-overridden-method\n return {}", "d...
[ "0.72143894", "0.6945958", "0.6938341", "0.6432432", "0.62723744", "0.61998487", "0.6169367", "0.61409837", "0.60772204", "0.59841335", "0.5809634", "0.57634574", "0.5564063", "0.55350655", "0.5498731", "0.5497586", "0.5489451", "0.5477204", "0.54573256", "0.54452604", "0.538...
0.75194734
0
Return a dict of all variables as found within the module.
def _get_vars(self, variables, required=None): return_dict = {} for variable in variables: return_dict[variable] = self.module.params.get(variable) else: if isinstance(required, list): for var_name in required: check = return_dict.get(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self) -> VariableDict:\n if self.scope is None:\n raise ValueError(\"Can't access variables on unbound modules\")\n return self.scope.variables()", "def all_globals_dict(self):\n return self.module_node.used_vars", "def get_module_vars(module) -> dict:\n d = vars(module)\n ...
[ "0.80303377", "0.7857847", "0.77473795", "0.7700179", "0.74316436", "0.7353162", "0.734481", "0.73278284", "0.7315233", "0.7311219", "0.719996", "0.71393794", "0.7136584", "0.6901495", "0.6869826", "0.68584687", "0.68422496", "0.6815592", "0.6794536", "0.67105013", "0.6702792...
0.0
-1
Return a Failure when running an Ansible command.
def failure(self, error, rc, msg): self.module.fail_json(msg=msg, rc=rc, err=error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _runCommandRaiseIfFail (self, command, killTimeout = DEAFULT_KILL_TIMEOUT, warningTimeout = DEAFULT_WARNING_TIMEOUT, shell=False):\n (rc,outText,errText) = self._runCommand(command, killTimeout = killTimeout, warningTimeout = warningTimeout, shell = shell)\n if rc != 0:\n self._log(\"r...
[ "0.66795486", "0.65976524", "0.6389595", "0.6222639", "0.62007946", "0.61881346", "0.6126354", "0.60725", "0.59932435", "0.5951842", "0.5944273", "0.5928022", "0.5900878", "0.587125", "0.58610773", "0.5858124", "0.57924086", "0.57778597", "0.57738113", "0.5772637", "0.5766052...
0.0
-1
Load environment or sourced credentials. If the credentials are specified in either environment variables or in a credential file the sourced variables will be loaded IF the not set within the ``module.params``.
def _env_vars(self, cred_file=None, section='default'): if cred_file: parser = ConfigParser.SafeConfigParser() parser.optionxform = str parser.read(os.path.expanduser(cred_file)) for name, value in parser.items(section): if name == 'OS_AUTH_URL': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadenv(self):\n logging.debug('Loading OpenStack authentication information from environment')\n # Grab any OS_ found in environment\n for var in os.environ:\n if var[0:3] == 'OS_':\n value = os.environ[var]\n # Don't print out password or token to...
[ "0.6508687", "0.6438341", "0.6277127", "0.6266207", "0.6249797", "0.618712", "0.615878", "0.61461294", "0.6112473", "0.6100724", "0.5858952", "0.58386284", "0.57719797", "0.57441735", "0.57082015", "0.5674215", "0.56662875", "0.5662995", "0.5652891", "0.56504303", "0.5598469"...
0.656147
0
Return a swift client object.
def _authenticate(self): cred_file = self.module.params.pop('config_file', None) section = self.module.params.pop('section') self._env_vars(cred_file=cred_file, section=section) required_vars = ['login_url', 'login_user', 'login_password'] variables = [ 'login_url', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_swiftclient():\n swift_conn = swiftclient.client.Connection(\n authurl=os.environ.get(\"OS_AUTH_URL\"),\n user=os.environ.get(\"OS_USERNAME\"),\n key=os.environ.get(\"OS_PASSWORD\"),\n tenant_name=os.environ.get(\"OS_TENANT_NAME\"),\n auth_version=\"2.0\",\n )\n ...
[ "0.7893938", "0.7739125", "0.74001366", "0.7178873", "0.6955415", "0.672381", "0.66489995", "0.66284853", "0.65308505", "0.64999723", "0.6425883", "0.6331547", "0.6284708", "0.62681353", "0.62681353", "0.626153", "0.6256632", "0.624945", "0.6239199", "0.62355477", "0.6215337"...
0.0
-1
Upload an object to a swift object store.
def _upload(self, variables): required_vars = ['container', 'src', 'object'] variables_dict = self._get_vars(variables, required=required_vars) container_name = variables_dict.pop('container') object_name = variables_dict.pop('object') src_path = variables_dict.pop('src') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _put_object(self, sha: str) -> None:\n data = git.encode_object(sha)\n path = self._object_path(sha)\n self._trace(\"writing: %s\" % path)\n retries = 0\n mode = dropbox.files.WriteMode.overwrite\n\n if len(data) <= CHUNK_SIZE:\n while True:\n ...
[ "0.6730462", "0.6696284", "0.66696876", "0.6654185", "0.6636817", "0.6436489", "0.63662285", "0.6357225", "0.63389313", "0.63029313", "0.6297057", "0.6283346", "0.62567437", "0.6248196", "0.62060946", "0.61957824", "0.61772907", "0.6157573", "0.6127972", "0.6127851", "0.61256...
0.67648774
0
Upload an object to a swift object store.
def _download(self, variables): required_vars = ['container', 'src', 'object'] variables_dict = self._get_vars(variables, required=required_vars) container_name = variables_dict.pop('container') object_name = variables_dict.pop('object') src_path = variables_dict.pop('src') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _upload(self, variables):\n required_vars = ['container', 'src', 'object']\n variables_dict = self._get_vars(variables, required=required_vars)\n\n container_name = variables_dict.pop('container')\n object_name = variables_dict.pop('object')\n src_path = variables_dict.pop('s...
[ "0.67648774", "0.6730462", "0.6696284", "0.66696876", "0.6654185", "0.6636817", "0.6436489", "0.63662285", "0.6357225", "0.63389313", "0.63029313", "0.6297057", "0.6283346", "0.62567437", "0.6248196", "0.62060946", "0.61957824", "0.61772907", "0.6157573", "0.6127972", "0.6127...
0.0
-1
Upload an object to a swift object store. If the ``object`` variable is not used the container will be deleted. This assumes that the container is empty.
def _delete(self, variables): required_vars = ['container'] variables_dict = self._get_vars(variables, required=required_vars) container_name = variables_dict.pop('container') object_name = variables_dict.pop('object', None) if object_name: self.swift.delete_object(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_object(self, account, container, object, content):#put a file to server\n \n pass", "def _put_object(self, sha: str) -> None:\n data = git.encode_object(sha)\n path = self._object_path(sha)\n self._trace(\"writing: %s\" % path)\n retries = 0\n mode = dropb...
[ "0.67020744", "0.66643083", "0.6661164", "0.66486055", "0.6503703", "0.6399018", "0.63822097", "0.63181806", "0.6305095", "0.6227648", "0.6211451", "0.61800945", "0.6143172", "0.61404926", "0.6110785", "0.61086416", "0.6094046", "0.6037624", "0.6001474", "0.5982218", "0.59451...
0.0
-1
Ensure a container exists. If it does not, it will be created.
def _create_container(self, container_name): try: container = self.swift.head_container(container_name) except client.ClientException: self.swift.put_container(container_name) else: return container
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_container_if_missing(container, swift_conn, options):\n try:\n swift_conn.head_container(container)\n except swift_client.ClientException, e:\n if e.http_status == httplib.NOT_FOUND:\n add_container = config.get_option(options,\n 'swift_store...
[ "0.73393464", "0.71082866", "0.6982969", "0.69364905", "0.6810107", "0.6559245", "0.65530443", "0.63620865", "0.6323742", "0.62845564", "0.6264618", "0.6248145", "0.6152857", "0.61038315", "0.60116714", "0.5990125", "0.59747225", "0.59611005", "0.5951962", "0.59108293", "0.59...
0.72043264
1
Create a new container in swift.
def _create(self, variables): required_vars = ['container'] variables_dict = self._get_vars(variables, required=required_vars) container_name = variables_dict.pop('container') container_data = self._create_container(container_name=container_name) if not container_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_container(self, container_name):\n try:\n container = self.swift.head_container(container_name)\n except client.ClientException:\n self.swift.put_container(container_name)\n else:\n return container", "def create_container(ContainerName=None, Tags...
[ "0.76552296", "0.7373795", "0.7320431", "0.7217572", "0.72172135", "0.69913363", "0.69071484", "0.69071484", "0.69071484", "0.69071484", "0.69071484", "0.6800663", "0.6746355", "0.67215234", "0.6651625", "0.65681994", "0.6481768", "0.6460958", "0.64321005", "0.6422703", "0.64...
0.67536926
12
Return a list of objects or containers. If the ``container`` variable is not used this will return a list of containers in the region.
def _list(self, variables): variables_dict = self._get_vars(variables) container_name = variables_dict.pop('container', None) filters = { 'marker': variables_dict.pop('marker', None), 'limit': variables_dict.pop('limit', None), 'prefix': variables_dict.pop('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers_list(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"containers_list\")", "def containers_list(self) -> Sequence[str]:\n return pulumi.get(self, \"containers_list\")", "def GetContainerObjects(self, uri, container, limit=-1, marker=''):\n self...
[ "0.65765995", "0.6506004", "0.64702266", "0.64582855", "0.6384543", "0.63612443", "0.63428164", "0.6331476", "0.6304003", "0.62802684", "0.60924065", "0.6083706", "0.607962", "0.60648423", "0.60313654", "0.60128826", "0.60080975", "0.6007813", "0.60019404", "0.59762454", "0.5...
0.53550875
62
Print Chris is from Seattle, and he likes chocolate cake, mango fruit, greek salad, and lasagna pasta
def DictFunction(): print "{name} is from {city}, and he likes {cake} cake, {fruit} fruit, {salad} salad and {pasta} pasta".format(**food_prefs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authors():\n print(\"\"\"\\n WanderersTeam:\\n\n Alicja Olejniczak\\n\n Bartosz Zawadzki\\n\n Klaudia Slawinska\\n\\n\"\"\")", "def favorite_book(title):\n\tprint(title + \" is one of my favorite book.\")", "def favorite_book(title):\n print(title + \" is one of my favorite books.\")", "...
[ "0.64738035", "0.6302907", "0.624528", "0.61403084", "0.61069465", "0.60959166", "0.60587376", "0.60419333", "0.6021289", "0.60074294", "0.6003992", "0.5977753", "0.59705454", "0.59211165", "0.59161156", "0.58986", "0.5893306", "0.5884335", "0.58643585", "0.58636147", "0.5825...
0.0
-1
Build a dictionary of numbers from zero to fifteen and the hexadecimal equivalent
def DictFunction2(): print "Create Second Dictionary" NumberDict = dict(zip((i for i in range(16)), (hex(i) for i in range(16)))) print NumberDict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_probabilities(self):\n return {hex(key): value for key, value in self.items()}", "def int2hex(n: int) -> str:", "def test_int_to_hex():\n hex_values = ['61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f',\n '70', '71', '72', '73', '74', '7...
[ "0.6906895", "0.662318", "0.6495815", "0.62746984", "0.62481356", "0.6218296", "0.6171378", "0.61579126", "0.6128711", "0.6069626", "0.60268325", "0.60072726", "0.5870963", "0.5868089", "0.5852337", "0.580648", "0.5801199", "0.5781645", "0.57676095", "0.57466954", "0.57459706...
0.7334854
0
Create new dictionary with count of occurances of the letter 'a' in the values
def DictFunction3(): print "Create Third Dictionary" Dictionary3 = {key:value.count("a") for key, value in food_prefs.iteritems()} print Dictionary3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_letter_counts(str_):\n return dict(Counter(str_))", "def fancy_count(sentence, alphabet):\n sentence = sentence.lower()\n\n # create dictionary of all letters set to 0\n letter_count = {}\n for char in alphabet:\n letter_count[char] = 0\n\n for char in sentence:\n if char ...
[ "0.7384723", "0.7241107", "0.72289795", "0.7112849", "0.7073047", "0.70122933", "0.70028853", "0.69830054", "0.6877522", "0.6857994", "0.68517244", "0.67922866", "0.67898136", "0.6766413", "0.6762099", "0.6697972", "0.66954625", "0.6632788", "0.65830594", "0.65805227", "0.655...
0.71267396
3
create a few sets with numbers divisible by 2, 3, 4 and test if they're subsets of each other
def SetFunction(): s2 = [] s3 = [] s4 = [] s2 = { i for i in range(21) if i%2 == 0} s3 = { i for i in range(21) if i%3 == 0} s4 = { i for i in range(21) if i%4 == 0} s2 = set(s2) s3 = set(s3) s4 = set(s4) print s3.issubset(s2) print s4.issubset(s2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_example(self):\n\n solution = Solution()\n\n nums = [1, 2, 3]\n\n expected_output = [\n (3,),\n (1,),\n (2,),\n (1, 2, 3),\n (1, 3),\n (2, 3),\n (1, 2),\n ()\n ]\n actual_output = sol...
[ "0.69097584", "0.64683", "0.6412315", "0.6408911", "0.62525964", "0.62090695", "0.6167503", "0.6090646", "0.6082563", "0.60608363", "0.60449654", "0.60165566", "0.59783715", "0.5973267", "0.5971005", "0.5965851", "0.59292936", "0.5929147", "0.59095657", "0.5892798", "0.586843...
0.6884488
1
This strategy always tries to steer the hunter directly towards where the target last said it was and then moves forwards at full speed. This strategy also keeps track of all the target measurements, hunter positions, and hunter headings over time, but it doesn't do anything with that information.
def next_move(hunter_position, hunter_heading, target_measurement, max_distance, OTHER = None): # This function will be called after each time the target moves. # The OTHER variable is a place for you to store any historical information about # the progress of the hunt (or maybe some localization informati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warm_up(self):\n self.velocity = self.steering_behaviours.calculate()\n self.pos += self.velocity\n self.pos = Point(int(self.pos.x), int(self.pos.y))\n if not self.is_moving():\n if self.steering_behaviours.target == self.soccer_field.ball.pos:\n # let's g...
[ "0.7139936", "0.7001866", "0.697465", "0.65336674", "0.65109694", "0.6359429", "0.60754806", "0.60304415", "0.59477687", "0.5936428", "0.5919734", "0.5891667", "0.5789955", "0.5778767", "0.57660544", "0.5735114", "0.5714579", "0.5646112", "0.5636291", "0.5635955", "0.56281716...
0.7422416
0
Computes distance between point1 and point2. Points are (x, y) pairs.
def distance_between(point1, point2): x1, y1 = point1 x2, y2 = point2 return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(point1, point2):\n x1, y1 = point1[0], point1[1]\n x2, y2 = point2[0], point2[1]\n\n dx = x1 - x2\n dy = y1 - y2\n\n return math.sqrt(dx * dx + dy * dy)", "def distance(point1, point2):\n x1, y1 = point1[0], point1[1]\n x2, y2 = point2[0], point2[1]\n\n dx = x1 - x2\n dy =...
[ "0.88610005", "0.88610005", "0.8693368", "0.8686376", "0.8618346", "0.85804534", "0.85682094", "0.85268563", "0.8521425", "0.85053766", "0.8500647", "0.8492139", "0.8465121", "0.8436353", "0.84099597", "0.83729374", "0.8337183", "0.83143616", "0.8294023", "0.824947", "0.82340...
0.8416987
17
Returns True if your next_move_fcn successfully guides the hunter_bot to the target_bot. This function is here to help you understand how we will grade your submission.
def demo_grading_visual(hunter_bot, target_bot, next_move_fcn, OTHER = None): max_distance = 0.97 * target_bot.distance # 1.94 is an example. It will change. separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target caught = False ctr = 0 #For Visualiza...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def demo_grading(hunter_bot, target_bot, next_move_fcn, OTHER = None):\n max_distance = 0.97 * target_bot.distance # 0.98 is an example. It will change.\n separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target\n caught = False\n ctr = 0\n\n # We will...
[ "0.70005906", "0.68623173", "0.61078924", "0.60495454", "0.6014709", "0.6005667", "0.5992259", "0.5964676", "0.59299344", "0.5917285", "0.58971447", "0.58940476", "0.58895284", "0.5878928", "0.5818303", "0.5813238", "0.57803", "0.57598203", "0.57322454", "0.5726657", "0.57266...
0.60720396
3
Returns True if your next_move_fcn successfully guides the hunter_bot to the target_bot. This function is here to help you understand how we will grade your submission.
def demo_grading(hunter_bot, target_bot, next_move_fcn, OTHER = None): max_distance = 0.97 * target_bot.distance # 0.98 is an example. It will change. separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target caught = False ctr = 0 # We will use your n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def demo_grading(hunter_bot, target_bot, next_move_fcn, OTHER=None):\n max_distance = 0.98 * target_bot.distance # 0.98 is an example. It will change.\n separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target\n caught = False\n ctr = 0\n\n # We will...
[ "0.68620497", "0.61089545", "0.60718143", "0.60501325", "0.6016241", "0.6005791", "0.5993357", "0.59653", "0.5931018", "0.591706", "0.5897315", "0.58952403", "0.5891687", "0.58798397", "0.581872", "0.5814012", "0.5781461", "0.5760628", "0.5734404", "0.57288635", "0.57284474",...
0.700028
0
This maps all angles to a domain of [pi, pi]
def angle_trunc(a): while a < 0.0: a += pi * 2 return ((a + pi) % (pi * 2)) - pi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angel(coordinates):\n x = coordinates[0]\n y = coordinates[1]\n\n if x == 0:\n if y < 0:\n return 0\n else:\n return math.pi\n\n if y == 0:\n if x < 0:\n return (3 * math.pi) / 2\n else:\n return math.pi / 2\n\n if x >= ...
[ "0.61565316", "0.6148735", "0.60716665", "0.6023468", "0.58448666", "0.580475", "0.57348394", "0.5715825", "0.570667", "0.5691184", "0.5686273", "0.56674665", "0.56426394", "0.5639741", "0.56358296", "0.5620914", "0.5591179", "0.5588097", "0.5580936", "0.5576069", "0.55752575...
0.0
-1
Returns the angle, in radians, between the target and hunter positions
def get_heading(hunter_position, target_position): hunter_x, hunter_y = hunter_position target_x, target_y = target_position heading = atan2(target_y - hunter_y, target_x - hunter_x) heading = angle_trunc(heading) return heading
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_to(self, target_pos):\n return angle_to(self.tonp(), target_pos.tonp())", "def _angle_of_attack(self, rel_wind, blade_chord):\n # blade_chord_vector - (relative_wind + pi)\n # rel_oposite = rel_wind.rotated(math.pi)\n aoa_rad = rel_wind.theta - blade_chord.theta\n aoa...
[ "0.70849824", "0.7078092", "0.69498146", "0.68233067", "0.6816026", "0.6716919", "0.6716865", "0.66994107", "0.6624106", "0.66036713", "0.6584936", "0.6542871", "0.651355", "0.6493879", "0.6482985", "0.6479435", "0.64647853", "0.6453982", "0.6453617", "0.6434811", "0.64185977...
0.7280507
1
This strategy always tries to steer the hunter directly towards where the target last said it was and then moves forwards at full speed. This strategy also keeps track of all the target measurements, hunter positions, and hunter headings over time, but it doesn't do anything with that information.
def naive_next_move(hunter_position, hunter_heading, target_measurement, max_distance, OTHER): if not OTHER: # first time calling this function, set up my OTHER variables. measurements = [target_measurement] hunter_positions = [hunter_position] hunter_headings = [hunter_heading] OTHE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_move(hunter_position, hunter_heading, target_measurement, max_distance, OTHER = None):\n # This function will be called after each time the target moves.\n\n # The OTHER variable is a place for you to store any historical information about\n # the progress of the hunt (or maybe some localization ...
[ "0.7422522", "0.71384156", "0.69746", "0.65342647", "0.6511456", "0.63600004", "0.60755944", "0.6029829", "0.5946977", "0.5934847", "0.59193313", "0.58899665", "0.5789365", "0.57793736", "0.5766214", "0.57347125", "0.57136446", "0.564554", "0.56365865", "0.5635139", "0.562752...
0.7001819
2
Create an expression that performs a bit_resize operation.
def __init__(self, policy: TypePolicy, byte_size: int, flags: int, bin: TypeBinName): self._children= ( byte_size, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not None and 'bit_write_flags' in policy else {_Keys.VALUE_KEY: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_resize_shrink_only_does_not_allow_grow(self):\n ops = [bitwise_operations.bit_resize(self.test_bin_ones, 10, resize_flags=aerospike.BIT_RESIZE_SHRINK_ONLY)]\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_resize_grow_o...
[ "0.6922631", "0.6909361", "0.6681375", "0.6603762", "0.64570487", "0.6332391", "0.60686153", "0.6006298", "0.5908143", "0.58692855", "0.58166003", "0.57911617", "0.5775828", "0.5702905", "0.5628201", "0.5595511", "0.5592623", "0.55296236", "0.5500643", "0.5472287", "0.5452781...
0.0
-1
Create an expression that performs a bit_insert operation.
def __init__(self, policy: TypePolicy, byte_offset: int, value: TypeBitValue, bin: TypeBinName): self._children= ( byte_offset, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not None and 'bit_write_flags' i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_insert(self):\n value = bytearray([3])\n ops = [bitwise_operations.bit_insert(self.test_bin_zeroes, 0, 1, value, None)]\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connection.get(self.test_key)\n expected_result = bytearray([3] * 1 + [0]...
[ "0.67807436", "0.6448426", "0.6034178", "0.59307504", "0.5917258", "0.5752034", "0.5562549", "0.54536104", "0.54467744", "0.5382355", "0.537402", "0.52561325", "0.5252593", "0.52311665", "0.5224208", "0.5199526", "0.514907", "0.49270168", "0.49195787", "0.4901359", "0.489613"...
0.4710057
44
Create an expression that performs a bit_remove operation.
def __init__(self, policy: TypePolicy, byte_offset: int, byte_size: int, bin: TypeBinName): self._children= ( byte_offset, byte_size, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not None and 'bit_write_flags' in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_operator(self, operator):", "def unset_bit(x, k):\n\n return x & ~(1 << k)", "def bitwise_not(self) -> ColumnOperators:\n\n return self.operate(bitwise_not_op)", "def bitwise_not(data):\n return _make.bitwise_not(data)", "def negate_gate(wordlen, input='x', output='~x'):\n neg =...
[ "0.6197947", "0.58955663", "0.5812892", "0.5728761", "0.5639292", "0.5631981", "0.55821234", "0.55046034", "0.55026513", "0.54843146", "0.5444043", "0.54361147", "0.5401561", "0.53989094", "0.5378487", "0.5364079", "0.5355936", "0.5345044", "0.53304154", "0.5330255", "0.53008...
0.0
-1
Create an expression that performs a bit_set operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: TypeBitValue, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bit(x, k):\n\n return x | (1 << k)", "def _setBitOn(x, bitNum):\n _checkInt(x, minvalue=0, description='input value')\n _checkInt(bitNum, minvalue=0, description='bitnumber')\n\n return x | (1 << bitNum)", "def set_bit(num, i):\n return num | (1 << i)", "def setbit(integer, nth_bit):\n...
[ "0.6800389", "0.66288704", "0.6569991", "0.63089657", "0.61611575", "0.60769445", "0.6026884", "0.59027255", "0.57982314", "0.57942975", "0.57637644", "0.57124186", "0.570507", "0.5697443", "0.55956405", "0.55918807", "0.55709124", "0.55584514", "0.55380493", "0.55228287", "0...
0.5123361
50
Create an expression that performs a bit_or operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: TypeBitValue, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_broadcast_logical_or(node, **kwargs):\n return create_basic_op_node('Or', node, kwargs)", "def bitwise_or(lhs, rhs):\n return _make.bitwise_or(lhs, rhs)", "def __or__(self, other):\n return self.fam.c_binop('or', self, other)", "def logical_or(lhs, rhs):\n return _make.logical_or(...
[ "0.80659", "0.7843274", "0.763645", "0.7567968", "0.7446107", "0.7244978", "0.72408646", "0.72372735", "0.7231532", "0.7207228", "0.7189701", "0.70211726", "0.6986054", "0.6958112", "0.69306743", "0.6854517", "0.68253106", "0.67964035", "0.675363", "0.6744484", "0.67175674", ...
0.0
-1
Create an expression that performs a bit_xor operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: TypeBitValue, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitwise_xor(lhs, rhs):\n return _make.bitwise_xor(lhs, rhs)", "def convert_broadcast_logical_xor(node, **kwargs):\n return create_basic_op_node('Xor', node, kwargs)", "def logical_xor(lhs, rhs):\n return _make.logical_xor(lhs, rhs)", "def xor(self, *args):\n return Xor(self, *args)", "d...
[ "0.7913012", "0.7810059", "0.777166", "0.75815725", "0.74781734", "0.739165", "0.72742724", "0.71705776", "0.7109025", "0.7107489", "0.70656574", "0.6966163", "0.69309705", "0.6838935", "0.67839915", "0.67461693", "0.67445135", "0.6610322", "0.65795684", "0.65759873", "0.6498...
0.0
-1
Create an expression that performs a bit_and operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: TypeBitValue, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_broadcast_logical_and(node, **kwargs):\n return create_basic_op_node('And', node, kwargs)", "def bitwise_and(lhs, rhs):\n return _make.bitwise_and(lhs, rhs)", "def __and__(self, other):\n return self.fam.c_binop('and', self, other)", "def logical_and(lhs, rhs):\n return _make.logi...
[ "0.8029316", "0.77271277", "0.7573422", "0.74109995", "0.7238391", "0.72202826", "0.7193802", "0.7142285", "0.71088", "0.7053074", "0.70362556", "0.7018703", "0.7014636", "0.6995239", "0.6963951", "0.6953723", "0.6924821", "0.68981755", "0.68698686", "0.6849435", "0.6842038",...
0.0
-1
Create an expression that performs a bit_not operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not None and 'bit_write_flags' in pol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_logical_not(node, **kwargs):\n return create_basic_op_node('Not', node, kwargs)", "def bitwise_not(self) -> ColumnOperators:\n\n return self.operate(bitwise_not_op)", "def bitwise_not(data):\n return _make.bitwise_not(data)", "def _logical_not(x):\n x_ = _static_value(x)\n if x_ is...
[ "0.8291718", "0.8025437", "0.7939715", "0.7931004", "0.79039174", "0.78656775", "0.7626227", "0.7485029", "0.7382852", "0.7300236", "0.7135752", "0.7104964", "0.70491827", "0.69546676", "0.68969405", "0.6851508", "0.6793803", "0.6777295", "0.67439646", "0.6684032", "0.6644488...
0.0
-1
Create an expression that performs a bit_lshift operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, shift: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, shift, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitwise_lshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_lshift_op, other)", "def __lshift__(self, other: Any) -> ColumnOperators:\n return self.operate(lshift, other)", "def test_bit_lshift_wrap(self):\n ops = [bitwise_operations.bit_lshift(self.test_bin_on...
[ "0.7837686", "0.751117", "0.74644315", "0.7382873", "0.7275201", "0.70378315", "0.6920777", "0.6768447", "0.6757356", "0.6608792", "0.6593422", "0.65773314", "0.6550301", "0.64820445", "0.64774114", "0.6370811", "0.6322138", "0.63025385", "0.62852126", "0.62482995", "0.624352...
0.0
-1
Create an expression that performs a bit_rshift operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, shift: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, shift, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitwise_rshift(self, other: Any) -> ColumnOperators:\n\n return self.operate(bitwise_rshift_op, other)", "def __rshift__(self, other: Any) -> ColumnOperators:\n return self.operate(rshift, other)", "def right_shift(lhs, rhs):\n return _make.right_shift(lhs, rhs)", "def test_rshift():\n ...
[ "0.7762508", "0.74970305", "0.7455829", "0.7426104", "0.7302537", "0.707718", "0.69714475", "0.69056976", "0.68996406", "0.68556833", "0.6794089", "0.67355347", "0.67355347", "0.672669", "0.65197617", "0.6486874", "0.64320886", "0.6431392", "0.6368876", "0.6357023", "0.635357...
0.0
-1
Create an expression that performs a bit_add operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: int, action: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if pol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_elementwise_add(node, **kwargs):\n return create_basic_op_node('Add', node, kwargs)", "def convert_addn(node, **kwargs):\n return create_basic_op_node('Sum', node, kwargs)", "def addExpr( ):\n\n\ttok = tokens.peek( )\n\tif debug: print (\"addExpr: \", tok)\n\tleft = term( )\n\ttok = tokens.pe...
[ "0.6935396", "0.6835701", "0.6810184", "0.6654774", "0.6556789", "0.64933574", "0.64732003", "0.642986", "0.63743997", "0.6340457", "0.6332203", "0.63122857", "0.63055485", "0.62063044", "0.61765563", "0.60989314", "0.6082975", "0.6081034", "0.60645497", "0.60386664", "0.6035...
0.0
-1
Create an expression that performs a bit_subtract operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: int, action: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if pol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(lhs, rhs):\n return _make.subtract(lhs, rhs)", "def __neg__(self):\n return UnaryMinus(self)", "def __sub__(self, tc):\n tc = TwosComplement(tc)._negative()\n return self.__add__(tc)", "def convert_rminus_scalar(node, **kwargs):\n return scalar_op_helper(node, 'Sub', **kwargs)...
[ "0.688093", "0.638413", "0.628304", "0.6185212", "0.61846507", "0.61706173", "0.6110241", "0.60539246", "0.6012194", "0.60120875", "0.59931296", "0.59558046", "0.59483063", "0.58855635", "0.5842812", "0.58317006", "0.58317006", "0.58298236", "0.5825538", "0.5821956", "0.58001...
0.0
-1
Create an expression that performs a bit_set_int operation.
def __init__(self, policy: TypePolicy, bit_offset: int, bit_size: int, value: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, _GenericExpr(_ExprOp._AS_EXP_BIT_FLAGS, 0, {_Keys.VALUE_KEY: policy['bit_write_flags']} if policy is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bit(num, i):\n return num | (1 << i)", "def setbit(integer, nth_bit):\n if nth_bit < 0:\n raise ValueError('Negative bit number.')\n mask = 1 << nth_bit\n integer |= mask\n return integer", "def _setBitOn(x, bitNum):\n _checkInt(x, minvalue=0, description='input value')\n _c...
[ "0.7172845", "0.7071299", "0.6996261", "0.6478151", "0.6442206", "0.587155", "0.58227414", "0.57447827", "0.5722029", "0.57136786", "0.5684771", "0.561247", "0.5610311", "0.5610311", "0.55673844", "0.5565577", "0.55562353", "0.549789", "0.54833925", "0.54772556", "0.54618686"...
0.48643878
87
Create an expression that performs a bit_get operation.
def __init__(self, bit_offset: int, bit_size: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, bin if isinstance(bin, _BaseExpr) else BlobBin(bin) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bit(self, num, bit, mask=1):\n return (int(num) >> bit) & mask", "def bitget(x, n):\n return (x >> n) & 1", "def bit_get(val, idx):\n return (val >> idx) & 1", "def test_bit_get(self):\n ops = [bitwise_operations.bit_get(self.five_255_bin, 0, 8)]\n\n _, _, result = self.as...
[ "0.66518205", "0.66284764", "0.6467441", "0.646483", "0.62851703", "0.61526334", "0.6145217", "0.60870713", "0.6061558", "0.5987528", "0.59804726", "0.59667635", "0.582507", "0.5778166", "0.5770776", "0.5721062", "0.564916", "0.5616602", "0.5609393", "0.55928046", "0.55837244...
0.0
-1
Create an expression that performs a bit_count operation.
def __init__(self, bit_offset: int, bit_size: int, bin: TypeBinName): self._children= ( bit_offset, bit_size, bin if isinstance(bin, _BaseExpr) else BlobBin(bin) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_count_seven(self):\n ops = [bitwise_operations.bit_count(self.count_bin, 20, 9)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n assert result[\"count\"] == 7", "def scalar_countbit0(self, dst, src):\n return self._scalar_single_func('bcnt0', dst, src)...
[ "0.6958435", "0.6800831", "0.6766446", "0.6605323", "0.65289205", "0.63949585", "0.62969285", "0.62676376", "0.6203577", "0.6174338", "0.61641127", "0.6152869", "0.61487997", "0.61253786", "0.61012816", "0.6058338", "0.5996102", "0.59959066", "0.59667265", "0.5954613", "0.595...
0.0
-1
Create an expression that performs a bit_lscan operation.
def __init__(self, bit_offset: int, bit_size: int, value: bool, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, bin if isinstance(bin, _BaseExpr) else BlobBin(bin) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_lscan_across_bytes(self):\n value = False\n ops = [bitwise_operations.bit_lscan(self.test_bin_ones, 7, 8, value)]\n\n expected_value = 1\n _, _, result = self.as_connection.operate(self.test_key, ops)\n assert result[self.test_bin_ones] == expected_value", "def tes...
[ "0.7377734", "0.7376834", "0.64785206", "0.6305342", "0.6245718", "0.6221031", "0.60329276", "0.5878427", "0.5763757", "0.5591125", "0.556362", "0.5461654", "0.5425429", "0.5408112", "0.54060286", "0.5375804", "0.5368857", "0.53673947", "0.5322728", "0.5293587", "0.52884406",...
0.0
-1
Create an expression that performs a bit_rscan operation.
def __init__(self, bit_offset: int, bit_size: int, value: bool, bin: TypeBinName): self._children= ( bit_offset, bit_size, value, bin if isinstance(bin, _BaseExpr) else BlobBin(bin) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_rscan(self):\n value = True\n ops = [bitwise_operations.bit_rscan(self.count_bin, 32, 8, value)]\n\n expected_value = 7\n _, _, result = self.as_connection.operate(self.test_key, ops)\n assert result[self.count_bin] == expected_value", "def test_bit_rscan_across_by...
[ "0.73722756", "0.7123739", "0.6476123", "0.6422384", "0.6286704", "0.6213678", "0.6163916", "0.6123847", "0.59847647", "0.56713074", "0.5640068", "0.5616066", "0.559042", "0.55706114", "0.55619276", "0.5500495", "0.54848737", "0.5359882", "0.5350318", "0.5305912", "0.52698845...
0.0
-1
Create an expression that performs a bit_get_int operation.
def __init__(self, bit_offset: int, bit_size: int, sign: bool, bin: TypeBinName): self._children= ( bit_offset, bit_size, 1 if sign else 0, bin if isinstance(bin, _BaseExpr) else BlobBin(bin) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bit_get_int(self):\n ops = [bitwise_operations.bit_get_int(self.five_255_bin, 0, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 255\n assert result[\"255\"] == expected_result", "def _get_bit(self, num, bit, mask=1):\n re...
[ "0.6835684", "0.661834", "0.65293485", "0.64192855", "0.64075273", "0.6252161", "0.62103236", "0.6052161", "0.60228956", "0.6003339", "0.6002954", "0.59244627", "0.591648", "0.5909823", "0.59023297", "0.588688", "0.58775413", "0.58517396", "0.5824543", "0.5817838", "0.5772067...
0.0
-1
Gets the stress_test_number param from user params. Gets the stress_test_number param. If absent, returns default 100.
def get_stress_test_number(self): return int(self.user_params.get("stress_test_number", 100))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trial_param(self, trial_id: int, param_name: str) -> float:\n raise NotImplementedError", "def getintparam(name, default=None, stash=None, params=None):\n v = getparamlist(name, stash=stash, params=params)\n if len(v) > 0: return int(v[0])\n return default", "def param_num(self, *, incl...
[ "0.5574652", "0.54855615", "0.54105365", "0.5292212", "0.5292212", "0.52149796", "0.51648545", "0.5153553", "0.51269835", "0.51085144", "0.509756", "0.5092859", "0.50264287", "0.50162494", "0.49809265", "0.49752045", "0.49556142", "0.49453557", "0.49236017", "0.49203673", "0....
0.83593583
0
Extract all kmers in a dictionary
def getKmers(seq, k): kmd = {} for i in range(len(seq)+1-k): kmer = seq[i:i+k] kmd[kmer] = kmd.get(kmer,0) + 1 return kmd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getKmers(self):\n return self.kmers", "def all_kmers(k):\n for i in range(0, 4 ** k):\n res = number_to_kmer(i, k)\n yield res", "def kmerIter(self):\n for kmer in self.kmers:\n yield kmer", "def find_kmers(in_fasta, k):\n n= len(in_fasta)-k+1\n kmers=[]\n ...
[ "0.6415671", "0.6051745", "0.59529454", "0.59208405", "0.57847667", "0.57838696", "0.5771246", "0.5671854", "0.5633063", "0.55975264", "0.55547315", "0.5530963", "0.5470354", "0.5455308", "0.54361653", "0.5431904", "0.54048306", "0.5357971", "0.5357511", "0.5335223", "0.53057...
0.0
-1
Given a sequence (let's say from a context window), extract its components under the assumption that each "word" in the sequence is a triplet, and triplets may overlap on the last base
def get_triplet_composition(seq): out = [] for i in range(len(seq)): if i+3 > len(seq): break out.append(seq[i:i+3]) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clts(sequence):\n return [_token2clts(segment)[1] for segment in sequence]", "def bipa(sequence):\n return [_token2clts(segment)[0] for segment in sequence]", "def get_complementary_sequence(sequence):\n\n complementary_sequence = ''\n for char in sequence:\n complementary_sequence = com...
[ "0.64476144", "0.5610308", "0.5590001", "0.55161774", "0.5455728", "0.5424268", "0.5388733", "0.5383343", "0.5379006", "0.5371296", "0.53479505", "0.5318797", "0.5318797", "0.52970743", "0.5292962", "0.5259284", "0.52484095", "0.5230913", "0.52165705", "0.52094585", "0.520305...
0.7335
0
Opens marker file and adds all markers to dictionary with
def open_markers(filename): markers = {} try: with open(filename, "r") as f: lines = f.readlines() cur_marker = "" cur_marker_name = "" for i in range(len(lines)): if i >= 7: cur_line = lines[i] if cu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readMarkers(self,markerfile):\n with open(markerfile,'r') as fin:\n count = 0\n for line in fin:\n if line.startswith('#'): continue\n l = line.strip().split()\n if len(l) == 0: continue\n if len(l) == 6: chrom,name,distan...
[ "0.6890485", "0.6529261", "0.59296936", "0.56526536", "0.564885", "0.5543642", "0.5540649", "0.5503927", "0.54962057", "0.5492501", "0.5430475", "0.5408602", "0.5362851", "0.5325515", "0.5323305", "0.532094", "0.52844286", "0.5238507", "0.5233728", "0.52186966", "0.5215181", ...
0.73693407
0
Calculates chisquared values based on amount of a and b in the marker data. Markers with chisquared value > 3.84 are discarded.
def chi_squared(markers): new_markers = {} for marker in markers: line = markers[marker][0] a = line.count("a") b = line.count("b") length = a + b expect_a = length / 2 expect_b = length / 2 chisq = pow((a - expect_a), 2) / expect_a + pow((b - expect_b), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chisquare_value(self):\n x2 = np.sum((np.absolute(self.observed - self.expected) - (0.5 * self.continuity_correction)) ** 2 /\n self.expected)\n\n return x2", "def f(a):\n b = a * 2\n while b.norm().asscalar() < 1000:\n b = b * 2\n if b.sum()....
[ "0.56620073", "0.56429327", "0.558835", "0.5531059", "0.546065", "0.5427781", "0.53272873", "0.53119254", "0.527172", "0.52057266", "0.51861894", "0.517939", "0.51749146", "0.5146191", "0.51202285", "0.51165134", "0.50929654", "0.50773597", "0.50755304", "0.5072139", "0.50703...
0.7073684
0
Calculates recombination frequency between all combinations of two markers.
def rec_freq(markers): keys = list(markers.keys()) rf_pairs = {} for i in range(len(markers)): for j in range(i + 1, len(markers)): m1 = markers[keys[i]][0] m2 = markers[keys[j]][0] tot_len = 0 score = 0 if len(m1) != len(m2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_count(freq1: typing.List[int], freq2: typing.List[int]) -> int:\n count = 0\n for i in range(26):\n count += min(freq1[i], freq2[i])\n return count", "def joint_frequencies_combo(self, alleles):\n\n representations = [1 << i for i in range(len(alleles))]\n\n intrenal_hap_...
[ "0.64678943", "0.592945", "0.58793336", "0.5876366", "0.5795837", "0.5719026", "0.5665673", "0.5658172", "0.56559056", "0.56537145", "0.5625105", "0.55932873", "0.5565763", "0.55539304", "0.5537769", "0.55084366", "0.5466326", "0.543985", "0.54315937", "0.5410862", "0.5395903...
0.64783263
0
Find the shortest total distance between markers. Distance calculated from one marker to the next.
def refine_location(markers_filtered, rf_pairs): for marker in markers_filtered: print(marker) Fork([marker], 0, rf_pairs) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_distance(self):\n distance = 0\n\n for segment in self.data:\n segment_distance = 0\n\n last_lon = None\n last_lat = None\n\n for point in segment:\n current_lon = point[\"lon\"]\n current_lat = point[\"lat\"]\n\n ...
[ "0.6502733", "0.6387455", "0.6371121", "0.6283363", "0.6257417", "0.6197359", "0.6194713", "0.6193755", "0.6191361", "0.61838603", "0.6156287", "0.61511534", "0.6123849", "0.60808194", "0.6075393", "0.6075393", "0.6075393", "0.6075393", "0.6075393", "0.60579216", "0.6048354",...
0.0
-1
Calculates the distances between a list of markers from the first marker.
def calc_distances(marker_list, rf_pairs): final_distance = [[marker_list[0], 0]] for i in range(1, len(marker_list)): cur_markers = [marker_list[i-1], marker_list[i]] for rf_pair in rf_pairs: if rf_pair[0] in cur_markers and rf_pair[1] in cur_markers: final_distance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distances(coords: List[Tuple[float, float]]) -> List[Dict]:\n miles = 0\n od = []\n for idx in range(len(coords)):\n if idx == 0:\n continue\n dist = distance(coords[idx], coords[idx - 1]).miles\n miles = miles + dist\n od.append(\n {\n ...
[ "0.6635253", "0.6633621", "0.6571341", "0.6439199", "0.62930983", "0.62800103", "0.61445427", "0.6096219", "0.60502046", "0.5957475", "0.5946086", "0.5938248", "0.5932937", "0.5882029", "0.5876757", "0.5874259", "0.5873279", "0.5872944", "0.58673966", "0.5867383", "0.5850922"...
0.72004944
0
Full list found. Now check if it is actually the shortest.
def finish(self): global min_list global min_dist if self.cur_dist < min_dist or min_dist == -1: min_dist = self.cur_dist min_list = self.cur_list print(min_dist, min_list) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findShortestPath(self):\r\n pass", "def shortest(self):\n shortest = None\n if self._vectors:\n shortest = self._vectors[0]\n min_len = shortest.length2\n for vector in self._vectors:\n len = vector.length2\n if len < min_len...
[ "0.6475514", "0.6365441", "0.63459575", "0.61859703", "0.60304636", "0.60141885", "0.5954746", "0.5906815", "0.5904987", "0.5890308", "0.58686185", "0.58453614", "0.5833286", "0.5798172", "0.5754024", "0.5747666", "0.57359844", "0.56891704", "0.5682455", "0.56631476", "0.5659...
0.6082406
4
Use information contained in `self.global_conf` to initialize `self.backend`
def initialize_indexer_backend(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, backend: Optional[str] = None, /, **kwargs: Any) -> None:\n if not backend:\n try:\n backend = self.__default_backend__\n except AttributeError:\n raise ValueError(\n \"You must specify which backend to use as first po...
[ "0.7175587", "0.7041029", "0.666908", "0.6623005", "0.660457", "0.6530635", "0.6500303", "0.646168", "0.6329612", "0.6201695", "0.6158904", "0.60973597", "0.6094856", "0.6090621", "0.6057456", "0.6021307", "0.60022587", "0.5979645", "0.59773564", "0.5965741", "0.59560794", ...
0.6148598
11
Returns `start` value for next update.
def get_next_batch_start(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStart(self) -> long:\n ...", "def _get_start(self):\n return self._start", "def get_start(self):\n return self._start", "def getStart(self):\n return self._start", "def start(self) -> int:\n return self._start", "def start(self) -> int:\n return self._star...
[ "0.739649", "0.7064436", "0.68245465", "0.6676903", "0.66056633", "0.66056633", "0.6592888", "0.65598243", "0.6430151", "0.6349943", "0.6324474", "0.63227063", "0.62436086", "0.623221", "0.6228547", "0.61917645", "0.61786246", "0.6167536", "0.61516684", "0.6147106", "0.609265...
0.5973918
33
Should index a batch in the form of a list of (id,url,other_data)
def index_batch(self,batch): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_index(data):\n\n def bulk_api_string(item):\n return f\"{{\\\"index\\\":{{}}\\n{json.dumps(item)}\"\n\n body = '\\n'.join([bulk_api_string(item) for item in data]) + '\\n'\n\n return make_request(\n requests.post,\n url=f\"{connection.hostname}:{connection.port}/{connection.i...
[ "0.6773513", "0.67076516", "0.647827", "0.6319573", "0.6210303", "0.6172807", "0.61597866", "0.612366", "0.61061996", "0.61003715", "0.61003715", "0.60762066", "0.607391", "0.607391", "0.6039906", "0.59697026", "0.5969402", "0.59238076", "0.5890065", "0.5853608", "0.5772766",...
0.74032223
0
Test case for add_provisioning_request Add a provisioning request
def test_add_provisioning_request(self): body = PortProvisionRequest() response = self.client.open('/api/provisioning/port', method='POST', data=json.dumps(body), content_type='application/json') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_provisioning_request():\n if connexion.request.is_json:\n discovery = PortProvisionRequest.from_dict(connexion.request.get_json())\n return discovery.save()", "async def test_create(self):\n expected = {\n 'id': 'id'\n }\n profile = {\n 'name': ...
[ "0.7253028", "0.6238011", "0.61264265", "0.5709561", "0.563654", "0.5516715", "0.54224616", "0.5400144", "0.5395249", "0.53915054", "0.53854346", "0.5357447", "0.534008", "0.53295773", "0.5326414", "0.5318304", "0.53048795", "0.5283525", "0.5275277", "0.52693397", "0.5260181"...
0.75894356
0
Test case for delete_provisioning_request Deletes a port provisioning request
def test_delete_provisioning_request(self): response = self.client.open('/api/provisioning/port/{requestId}'.format(requestId='requestId_example'), method='DELETE') self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_provisioning_request(requestId):\n doc = PortProvisionRequest.get(id=requestId)\n\n if doc:\n print(doc)\n doc.delete()\n return {\"status\": \"deleted\"}\n else:\n return 'Not Found', 404", "async def test_delete(self):\n rsps = respx.delete(f'{PROVISIONING...
[ "0.8210428", "0.6664818", "0.6417803", "0.6305171", "0.6026843", "0.6005614", "0.60023606", "0.5943052", "0.5932378", "0.59317976", "0.59317976", "0.5874001", "0.58608633", "0.57793397", "0.57621557", "0.57589376", "0.57544667", "0.57511425", "0.5744601", "0.5734947", "0.5723...
0.8789912
0
Test case for get_provisioning_request_by_id get provisioning request by ID
def test_get_provisioning_request_by_id(self): response = self.client.open('/api/provisioning/port/{requestId}'.format(requestId='requestId_example'), method='GET') self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_provisioning_request_by_id(requestId):\n doc = PortProvisionRequest.get(id=requestId)\n if doc:\n return doc\n else:\n return 'Not Found', 404", "async def test_retrieve_one(self):\n expected = {\n '_id': 'id',\n 'name': 'name',\n 'version': ...
[ "0.750531", "0.6248161", "0.61184204", "0.5848939", "0.577084", "0.57675457", "0.5723609", "0.5676751", "0.5654506", "0.5619345", "0.5601689", "0.55897456", "0.55897456", "0.55712306", "0.5539029", "0.5444288", "0.54233503", "0.54105175", "0.5407941", "0.53651434", "0.5340627...
0.8449092
0
Test case for get_requests List server connectivity requests
def test_get_requests(self): response = self.client.open('/api/provisioning/port', method='GET') self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_servers(self):\n response = self.client.open(\n '/v1/servers',\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))", "def test_http_request(self):\n\n response = requests.get(self.live_se...
[ "0.6687752", "0.6559068", "0.64146256", "0.62880325", "0.62294745", "0.61838835", "0.6169326", "0.61663264", "0.6153799", "0.6117643", "0.6065051", "0.6059946", "0.6022924", "0.60025907", "0.5994368", "0.5990659", "0.5976886", "0.59657145", "0.5963672", "0.5962847", "0.595164...
0.6894288
0
An object containing data needed to render a single page.
def __init__( self, name: str, content: Optional[str] = None, metadata: Optional[dict] = None, content_format: str = "md", ): self.name = name self.content = "" if content is None else content self.template: Optional[str] self.content_format = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_page():\n\n return render_template('Data_Page.html')", "def data_page():\n return render_template(\"data.html\")", "def data():\n return render_template(\n 'data.html',\n title='data',\n year=datetime.now().year,\n message='my data page.'\n )", "def create_pag...
[ "0.6835279", "0.6735784", "0.62492377", "0.61720943", "0.61464643", "0.6137057", "0.6096375", "0.6096375", "0.60185796", "0.60086054", "0.5997644", "0.5932834", "0.59194976", "0.5868205", "0.5849704", "0.5824797", "0.5808225", "0.5803879", "0.5798995", "0.5791781", "0.5782209...
0.0
-1
Fetch a page attribute, first trying the page class attributes, then page ctx, and lastly resorting to a default. e.g. `page.get("foo", "bar")` checks for `page.foo`, then `page.ctx["foo"]`, and falls back to `"bar"`.
def get(self, key: str, default: Any = None) -> Any: return getattr(self, key, self.ctx.get(key, default))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _safe_getattr(value, attr, default):\n try:\n return getattr(value, attr)\n except Exception:\n return default", "def get_cached_attr(obj, attr, default=_UNSPECIFIED):\n cache = get_cache(obj)\n try:\n return cache.values[attr]\n except KeyError as err:\n if default...
[ "0.57307297", "0.57164514", "0.5626412", "0.5604301", "0.55283195", "0.55158997", "0.5512732", "0.54869676", "0.5456371", "0.5433508", "0.5404067", "0.5398676", "0.5381506", "0.534176", "0.5315778", "0.5279999", "0.5242483", "0.52385646", "0.52170396", "0.5214979", "0.5209925...
0.5526034
5
Get mean/std and optional min/max of scalar x across MPI processes.
def statistics_scalar(x, with_min_and_max=False): x = np.array(x, dtype=np.float32) global_sum, global_n = np.sum(x), len(x) mean = global_sum / global_n global_sum_sq = np.sum((x - mean) ** 2) std = np.sqrt(global_sum_sq / global_n) # compute global std if with_min_and_max: global_mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mean_and_log_std(self, x):\n mean = self._mean_module(x)\n return mean, self._log_std", "def xminmax ( self ) :\n return self.xvar.minmax()", "def statistics_from_array(x: numpy.ndarray):\n try:\n return x.mean(), x.std(), x.max(), x.min()\n except AttributeError:\n ...
[ "0.6554827", "0.6272912", "0.61888236", "0.61567163", "0.6144852", "0.6117041", "0.6077917", "0.60632807", "0.60149676", "0.59918183", "0.5950541", "0.5950353", "0.59191823", "0.59150267", "0.5868738", "0.58552974", "0.58083874", "0.5788024", "0.5781067", "0.5763779", "0.5750...
0.6846514
0
parse a kallisto abundance.tsv file, return dict transcriptId > est_tpm Does not return a value for transcripts where est_tpm is 0
def parseKallisto(fname): logging.debug("parsing %s" % fname) ifh = open(fname) ifh.readline() d = {} for line in ifh: fs = line.rstrip("\n").split("\t") if fs[tpmColumnIndex]=="0" and not addZeros: continue d[fs[0]] = float(fs[tpmColumnIndex]) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_trflp(lines):\r\n\r\n sample_ids = []\r\n otu_ids = []\r\n data = []\r\n non_alphanum_mask = re.compile('[^\\w|^\\t]')\r\n # not sure why the above regex doesn't cover the following regex...\r\n dash_space_mask = re.compile('[_ -]')\r\n\r\n for i, line in enumerate(lines):\r\n ...
[ "0.576154", "0.5523585", "0.54649943", "0.54580283", "0.5412821", "0.5332087", "0.52648944", "0.52553064", "0.52298635", "0.5176947", "0.5138724", "0.5133539", "0.5120489", "0.5109864", "0.50941163", "0.5062895", "0.5057512", "0.50502867", "0.5025302", "0.50223887", "0.501085...
0.62047464
0
given a list of cellNames and a list of transcript > count dictionaries, write out a matrix with transcript > counts in columns
def outputBigMatrix(cellNames, results, outFname, isGene=False): logging.info("Writing data to file %s" % outFname) ofh = open(outFname, "w") # write header if isGene: ofh.write("#gene\t%s\n" % "\t".join(cellNames)) else: ofh.write("#transcript\t%s\n" % "\t".join(cellNames)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_count_matrix(filename, output_dir):\n\n import os\n import json\n\n word_tag_output = \"tag_word_count.json\"\n bigram_matrix_name = \"bigram_count.json\"\n unigram_matrix_name = \"unigram_count.json\"\n trigram_matrix_name = \"trigram_count.json\"\n\n sub_dir = os.path.join(output_...
[ "0.6228252", "0.5873816", "0.58383214", "0.57617635", "0.54583514", "0.54458195", "0.54176295", "0.54138976", "0.53219235", "0.5272027", "0.5245677", "0.5184741", "0.5132777", "0.5129691", "0.51268375", "0.5118446", "0.511654", "0.5109872", "0.510377", "0.50655836", "0.504090...
0.63610333
0
given a list of dict transcript > tpm, and a map transcript > gene, map all transcripts to genes and return a list of gene > sum of tpms If we have no gene ID, drop the transcript entirely.
def sumTransToGene(transDictList, transFile): transToGene = parseDict(transFile, stripDot=True) logging.info("Mapping %d transcript IDs to gene IDs" % len(transToGene)) newRes = [] noMapTransIds = set() for transCounts in transDictList: geneCounts = defaultdict(float) for transId, c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatenate_GO_TPM_data(self, TPM_dict, *filtered_GO_dicts):\n\n dictionary = {}\n for i in filtered_GO_dicts:\n tmp_dict = {}\n for k, v in i.iteritems():\n tmp_dict[k] = map(\n lambda x: x + ':{0}'.format(TPM_dict[k] / len(v)), v\n ...
[ "0.59052914", "0.5718111", "0.57166183", "0.5713127", "0.5624114", "0.55903983", "0.5565028", "0.5310848", "0.53084624", "0.5292143", "0.5210532", "0.5177025", "0.514381", "0.51284915", "0.5062096", "0.5026479", "0.5016952", "0.5011995", "0.49969754", "0.49333945", "0.4902291...
0.69606656
0
search for all .log files in inDir. Use the basename of these files as the cell ID and write a .tab file that can be joined with tagStormJoinTab
def writeStats(inDir, outFname): ofh = open(outFname, "w") ofh.write("meta\tkallistoProcReads\tkallistoAlnReads\tkallistoEstFragLen\n") inFnames = glob.glob(join(inDir, "log", "*.log")) print("Parsing %d logfiles and writing to %s" % (len(inFnames), outFname)) for inFname in inFnames: cellI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _consolidate_mp_logs(self):\n for i, fn in enumerate(self.logfiles):\n with open(fn) as f:\n logger.info(\"Log from thread {0}:\\n{1}\".format(i, f.read()))\n open(fn, \"w\").write(\"\")", "def process( self ):\n\t\t\n\t\tprint( self._query[\"header\"], file = self...
[ "0.60109663", "0.5980887", "0.5845361", "0.57589185", "0.5735338", "0.5727873", "0.5720456", "0.5708987", "0.57078874", "0.5705761", "0.569623", "0.5652323", "0.56071275", "0.55337006", "0.5523969", "0.5521873", "0.54926217", "0.5482447", "0.54397047", "0.53959006", "0.535031...
0.56878835
11
Records a param measurement and returns it.
def measure(self, timestamp, param): if param in self.faulty: value = random.randint(*self.FAULTY[param]) else: value = self.patient.measure(param) self.__buffer[param].append(Measurement(timestamp, value)) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trial_param(self, trial_id: int, param_name: str) -> float:\n raise NotImplementedError", "def get_last_measurement(self, param):\n return self.__buffer[param][-1]", "def get_measurements(self, param):\n return tuple(self.__buffer[param])", "def log_param(self, name: str, value):...
[ "0.64668816", "0.61866486", "0.61315846", "0.5945125", "0.59324706", "0.579286", "0.578003", "0.5778229", "0.57359004", "0.5732038", "0.57237446", "0.5661884", "0.5656225", "0.5632293", "0.56025463", "0.5585704", "0.55407315", "0.5513971", "0.5506482", "0.5504652", "0.5486406...
0.64251155
1
Gets param last measurment.
def get_last_measurement(self, param): return self.__buffer[param][-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_percept(self):\n return self.percept", "def last_fmeasure(self):\n return self.get_fvalue(self.last_position())", "def param(self):\n return self._param", "def getLatestMeasurement(self): \n return self.measurement[len(self.measurement)-1]", "def get_output(self, las...
[ "0.69294596", "0.6815849", "0.67619956", "0.673588", "0.67033076", "0.66313666", "0.6617073", "0.6605436", "0.65295345", "0.648252", "0.6449733", "0.64441687", "0.6424671", "0.6354086", "0.63483137", "0.6319382", "0.63120097", "0.62854356", "0.62735873", "0.6260872", "0.62413...
0.83966666
0
Gets param measurement history.
def get_measurements(self, param): return tuple(self.__buffer[param])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value_history(self):\n return self.value_history", "def get_history(self):\n return self.history", "def QueryHistory(self):\n return []", "def get_history(self):\r\n\r\n return self.board_history", "def get_history(self, key=None):\n val = self.history.values.get(key, Non...
[ "0.6811209", "0.67130274", "0.66165745", "0.66004103", "0.6565337", "0.6544022", "0.647307", "0.64544094", "0.64544094", "0.6441658", "0.6383974", "0.62936336", "0.6232605", "0.6222799", "0.6200624", "0.61882216", "0.61823297", "0.6181561", "0.6181561", "0.6178861", "0.617717...
0.5698082
61
Clears param measurement history and returns it.
def pop_measurements(self, param): return tuple(self.__buffer.pop(param, ()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\r\n self.perception_history = []", "def clear(self):\r\n\r\n\t\tself.state_history = []\r\n\t\tself.error_history = []\r\n\t\tself.output_history = []\r\n\t\tself.sample_times = []\r\n\t\t\r\n\t\tself.LastOutputValue = 0.0\r\n\t\tself.OutputValue = 0.0", "def clear(self):\r\n\r\n\t\tsel...
[ "0.65336", "0.6388343", "0.6388343", "0.6330898", "0.6003027", "0.5963498", "0.59180695", "0.5913176", "0.5882348", "0.58490103", "0.5802703", "0.5779025", "0.570259", "0.5687213", "0.56749874", "0.566047", "0.5630011", "0.56093997", "0.55822796", "0.5558977", "0.55002195", ...
0.5967601
5
Sends list of texts to Perspective API for analysis and returns their toxicity scores
def processRequest(data): text, key, lang = data[0], data[1], data[2] prob = profanityCheck(text) if prob >= 0.7: return {text: prob} print("Analysing text %s, of the language %s" % (text, lang)) return {text: makePerspectiveRequest(text, key, lang)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze(self, text):\n\n score = 0.0;\n\n words = text.split(' ')\n # match each word in either the positives or negatives list adding or subtracting 1 from the score if present\n for word in words:\n for w in self.positives:\n if w == word.lower():\n ...
[ "0.6157069", "0.6134014", "0.61130375", "0.6072768", "0.60495025", "0.60198337", "0.60086817", "0.5962274", "0.5915401", "0.5893758", "0.5850687", "0.58502686", "0.5850262", "0.58496475", "0.58414406", "0.5832228", "0.58258724", "0.579906", "0.57907945", "0.57819635", "0.5761...
0.0
-1
Initial profanity check using profanity_check
def profanityCheck(text): return predict_prob([text])[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_tokens_with_profanity():\n list_responses = ['test this code', ' for bad words', 'such as shit']\n check = edurate_gensim.create_tokens(list_responses)\n assert check == [['test', 'code'], ['bad', 'words']]\n assert (\"shit\" in check) is False", "def verify():", "def main():\n f...
[ "0.5606062", "0.54521835", "0.5415538", "0.5389216", "0.53835446", "0.53203183", "0.52006304", "0.51796556", "0.512445", "0.51217043", "0.5049988", "0.49923262", "0.496746", "0.4898047", "0.48900947", "0.48552576", "0.48544675", "0.4842774", "0.48151883", "0.48013282", "0.480...
0.60663515
0
Handles getting all the docs from an indexing endpoint. Currently this is changing from signpost to indexd, so we'll use just indexd_client now. I.E. test to a common interface this could be multiply our
def index_client(indexd_server): setup_database() try: user = create_user("admin", "admin") except Exception: # assume user already exists, try using username and password for admin user = ("admin", "admin") client = Gen3Index(indexd_server.baseurl, user, service_location="") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_get_documents():\n ids = flask.request.json\n if not ids:\n raise UserError(\"No ids provided\")\n if not isinstance(ids, list):\n raise UserError(\"ids is not a list\")\n\n with blueprint.index_driver.session as session:\n # Comment it out to compare against the eager loa...
[ "0.7291482", "0.6927285", "0.6873265", "0.6749499", "0.67426723", "0.67186725", "0.66929305", "0.66858107", "0.65927804", "0.6580147", "0.6526985", "0.6492798", "0.6461985", "0.64394915", "0.64383346", "0.64383346", "0.64383346", "0.64383346", "0.64383346", "0.64383346", "0.6...
0.57927597
74
Returns a DrsClient. This will delete any documents, aliases, or users made by this client after the test has completed. Currently the default user is the admin user Runs once per test.
def drs_client(indexd_server): try: user = create_user("user", "user") except Exception: user = ("user", "user") client = DrsClient(baseurl=indexd_server.baseurl, auth=user) yield client clear_database()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_drf_client(admin_user):\n client = APIClient()\n client.force_authenticate(user=admin_user)\n return client", "def client(self):\n\n if self._client is None:\n self._client = self._get_client()\n return self._client", "def get_client(self):\n return self.clien...
[ "0.62618375", "0.5801828", "0.57856905", "0.57658434", "0.5730438", "0.5724532", "0.56575555", "0.5643841", "0.5600832", "0.5596945", "0.5596945", "0.5586577", "0.55524814", "0.55345035", "0.55280924", "0.55232245", "0.5517509", "0.5496027", "0.54853994", "0.545057", "0.54008...
0.61927664
1
Leave a pseudobreakpoint somewhere to ask the user if they could pls submit their stacktrace to cmyui <3.
def point_of_interest(): for fi in inspect.stack()[1:]: if fi.function == '_run': # go all the way up to server start func break file = Path(fi.filename) # print line num, index, func name & locals for each frame. log(f'[{fi.function}() @ {file.name} L{fi.li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idb_excepthook(type, value, tb):\n if hasattr(sys, \"ps1\") or not sys.stderr.isatty():\n sys.__excepthook__(type, value, tb)\n else:\n traceback.print_exception(type, value, tb)\n print\n pdb.pm()", "def user_line(self, frame):\r\n if \"__exc_tuple__\" in frame.f_loc...
[ "0.65019894", "0.6455395", "0.6343934", "0.630251", "0.60566014", "0.5991123", "0.5979481", "0.5967686", "0.5958487", "0.5929866", "0.5861889", "0.585582", "0.58339113", "0.58295304", "0.5801602", "0.576527", "0.57283694", "0.5718463", "0.5703827", "0.5689396", "0.56830066", ...
0.52895606
59
send 200 OK response, and set server.stop to True
def do_QUIT(self): self.send_response(200) self.end_headers() self.server.stop = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serve(self):\n\t\tself.keep_running=1\n\t\tif self.debug:\n\t\t\tprint \"server started\"\n\t\ttry:\n\t\t\twhile self.keep_running:\n\t\t\t\tself.handle_request()\n\t\tfinally:\n\t\t\tif self.debug:\n\t\t\t\tprint \"server finished\"\n\t\t\tself.keep_running=0\n\t\t\tself.close()", "def send_200_resp(self, r...
[ "0.6593527", "0.6580389", "0.65228635", "0.6458139", "0.6449098", "0.62513536", "0.6202599", "0.6198447", "0.6197758", "0.6183017", "0.6144795", "0.61393744", "0.6138087", "0.6123219", "0.61206925", "0.6105918", "0.61005306", "0.60456544", "0.6036564", "0.60222226", "0.601354...
0.71259165
0
emulate post request with get handler, we don't need the data
def do_POST(self): self.do_GET()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, *args, **kwargs):\n return self.get(request, *args, **kwargs)", "def get(self):\n self.post()", "def post(self, *args, **kwargs):\n return self.handle_post_request()", "def post(self, request):\n pass", "def get(self):\n self.post()", "def get(self):...
[ "0.78131866", "0.7791229", "0.7586552", "0.7522953", "0.7506268", "0.7506268", "0.74753666", "0.7460196", "0.7440879", "0.73348796", "0.7301347", "0.7189343", "0.7170561", "0.7170561", "0.7170561", "0.7170561", "0.7170561", "0.7170561", "0.7170561", "0.7170561", "0.7170561", ...
0.81476486
0
Parse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.http_request_headers. Return True for success, False for failure; on failure, an error is sent back.
def parse_request(self): self.command = None # set in case of error on the first line self.request_version = version = self.default_request_version self.close_connection = 1 requestline = self.raw_requestline # hack: quick and dirty fix for doubled request with bad data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_request(self):\r\n # HTTP/1.1 connections are persistent by default. If a client\r\n # requests a page, then idles (leaves the connection open),\r\n # then rfile.readline() will raise socket.error(\"timed out\").\r\n # Note that it does this based on the value given to settime...
[ "0.6622271", "0.64777374", "0.63694507", "0.60598505", "0.59718955", "0.590743", "0.57738644", "0.5756934", "0.5742927", "0.555604", "0.55017346", "0.5494741", "0.54922587", "0.5484244", "0.5446223", "0.54096335", "0.53933066", "0.5307045", "0.5289728", "0.52803946", "0.52673...
0.7992387
0
Handle one request at a time until stopped.
def serve_forever(self, unused_parameter=0.5): self.stop = False while not self.stop: self.handle_request()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n while self.running:\n self.handle_request()", "def run(self):\n while True:\n req = self._requests.get()[1]\n req.start()\n logging.info('Running request %s', req)", "def process_request_thread(self):\n while True:\n t...
[ "0.7609261", "0.71269566", "0.69555724", "0.6718361", "0.6676004", "0.6669508", "0.6668242", "0.6592521", "0.657124", "0.65122896", "0.65122896", "0.65122896", "0.6483223", "0.6456908", "0.6451984", "0.6424715", "0.6336171", "0.6316808", "0.6310098", "0.63058025", "0.629759",...
0.7465852
1
Evaluate a zeus command.
def _evaluate_command(self, cmd): self.logger.info("got command: %s", cmd) l = shlex.split(cmd) if cmd.startswith("rexec"): # download and (not) execute file if len(l) > 1: try: requests.get(l[1], headers=self.http_request_headers, timeout=s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_calc(self, event, command, usercommand):\n try:\n result = str(self.parser.eval(usercommand.arguments))\n response = '*** Calc: {}'.format(escape(result))\n except:\n fail = '*** Could not evaluate expression.'\n\n if self.wolfram:\n ...
[ "0.58909124", "0.5809447", "0.5563043", "0.5480157", "0.54527706", "0.5421429", "0.5387347", "0.53854555", "0.5365444", "0.5356302", "0.5340314", "0.5340152", "0.53319216", "0.5320519", "0.53050506", "0.5298058", "0.52844733", "0.527939", "0.52775794", "0.52462417", "0.524558...
0.52935076
16
Generate machine id based on default adapters mac address.
def _generate_machine_id(self): mach_id = "machine_" try: gws = netifaces.gateways() # get all gateways default = gws['default'] # get the default gw adapter = default[2][1] # get the adapter identifier real_adapter = netifaces.ifaddresses(adapter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_mac(topology_id):\n tid = int(topology_id)\n global mac_counter\n global used_macs\n base = '52:54:00:00:00:00'\n ba = base.split(':')\n ba[2] = '%02x' % int(tid / 256)\n ba[3] = '%02x' % int(tid % 256)\n ba[4] = '%02x' % int(len(used_macs[topology_id]) / 256)\n ba[5] = '%0...
[ "0.6963345", "0.6941117", "0.6941117", "0.6683865", "0.6677888", "0.6657878", "0.6549006", "0.65344495", "0.6532284", "0.6504228", "0.6499489", "0.64969695", "0.6482017", "0.64627934", "0.645557", "0.6432604", "0.6382546", "0.6377715", "0.63437086", "0.63416886", "0.6336635",...
0.86592156
0
Push a file to cnc server with optional rc4 encryption.
def push_file_to_server(cnc_bot, filename, content, encryption_key=None): c = content if encryption_key is not None: c = rc4.encrypt(c, encryption_key, salt_length=0) # encrypt content via rc4 cfg = {'filename': filename, 'content': c} cnc_bot.host_orders(cPickle.dumps(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swift_push_file(job_log_dir, file_path, swift_config):\n with open(file_path, 'r') as fd:\n name = os.path.join(job_log_dir, os.path.basename(file_path))\n con = swiftclient.client.Connection(\n authurl=swift_config['authurl'],\n user=swift_config['user'],\n ke...
[ "0.61895895", "0.6184544", "0.56849754", "0.56627935", "0.56338185", "0.55360377", "0.55232894", "0.5497455", "0.5397069", "0.5368183", "0.530934", "0.530456", "0.5285475", "0.5281322", "0.52686185", "0.52633834", "0.5241551", "0.5230669", "0.5227321", "0.52060777", "0.518867...
0.73508626
0
Used to write new data to the server.
def host_orders_impl(self, orders): d = cPickle.loads(orders) if isinstance(d, dict): if 'filename' in d: if 'content' in d: try: with open(d['filename'], 'wb') as f: f.write(d['content']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data():", "def Update(self, data):\n self.Write(data)", "def write(self, data):\n raise NotImplementedError()", "def _write(self, data):\n self._writer.write(data)", "def _write(self, data):\n self.db.append(data)\n\n with open(self.DB_FILE, 'w') as outfile:\n ...
[ "0.7282807", "0.71940196", "0.71869445", "0.71663594", "0.71236485", "0.7120922", "0.7026153", "0.69983983", "0.69676775", "0.69672966", "0.68950635", "0.6883189", "0.6869431", "0.6848901", "0.68415284", "0.6838425", "0.68285793", "0.6823931", "0.6797712", "0.6795741", "0.676...
0.0
-1
Given a short_lineage, return the full lineage required to find exact lineage match within ID3C.
def get_full_lineage(short_lineage): lineage_map = { 'h1n1pdm': 'Influenza.A.H1N1', 'h3n2': 'Influenza.A.H3N2', 'vic': 'Influenza.B.Vic', 'yam': 'Influenza.B.Yam' } return lineage_map[short_lineage]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_similarity(long, short):\n similarity1 = 0\n similarity2 = 0\n for i in range(len(long)-len(short)+1):\n a = 0\n part = long[i:i+len(short)]\n for j in range(len(part)):\n if part[j] == short[j]:\n a += 1\n if a == len(short):\n sim...
[ "0.53577715", "0.5188768", "0.49944058", "0.4973644", "0.49226177", "0.48873967", "0.48870274", "0.4741497", "0.4731417", "0.47129855", "0.46796983", "0.46796364", "0.4671364", "0.46615598", "0.46497273", "0.46433398", "0.45880193", "0.45723385", "0.45651704", "0.45559737", "...
0.77502173
0
Generate the full URL for the API endpoint to get sequences of a specific lineage and segment
def generate_full_url(base_url, lineage, segment): params = "/".join([lineage, segment]) return urljoin(base_url, params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_api_request_uri(self, http_method=\"GET\"):\n return self.urlobject_single.format(self._cb.credentials.org_key, self._model_unique_id)", "def _build_api_request_uri(self, http_method=\"GET\"):\n return self.urlobject_single.format(self._cb.credentials.org_key, self._model_unique_id)", ...
[ "0.6077605", "0.6077605", "0.60385835", "0.5938474", "0.5882254", "0.58656865", "0.584668", "0.58432865", "0.58013654", "0.5792573", "0.5782247", "0.5776951", "0.5737987", "0.5737983", "0.56899506", "0.56754565", "0.56720304", "0.5663998", "0.56569654", "0.56523454", "0.56231...
0.70681363
0