query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Verify that the receiver correctly handles successful multihop jobs
def test_multihop_receiver_on_success(vo, did_factory, root_account, caches_mock, metrics_mock): receiver_thread = threading.Thread(target=receiver, kwargs={'id_': 0, 'all_vos': True, 'total_threads': 1}) receiver_thread.start() try: src_rse = 'XRD1' src_rse_id = rse_core.get_rse_id(rse=src...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multihop_receiver_on_failure(vo, did_factory, replica_client, root_account, caches_mock, metrics_mock):\n receiver_thread = threading.Thread(target=receiver, kwargs={'id_': 0, 'all_vos': True, 'total_threads': 1})\n receiver_thread.start()\n\n try:\n src_rse = 'XRD1'\n src_rse_id = ...
[ "0.6279267", "0.61867285", "0.5969139", "0.5968029", "0.59320337", "0.589347", "0.58139", "0.5768133", "0.5751717", "0.5734699", "0.57074887", "0.56824577", "0.5675357", "0.56739825", "0.56538695", "0.5651469", "0.56380355", "0.56136626", "0.5596965", "0.5578065", "0.5570784"...
0.65378636
0
Integration test of the preparer/throttler workflow.
def test_preparer_throttler_submitter(rse_factory, did_factory, root_account, file_config_mock, core_config_mock, metrics_mock): src_rse, src_rse_id = rse_factory.make_rse(scheme='mock', protocol_impl='rucio.rse.protocols.posix.Default') dst_rse1, dst_rse_id1 = rse_factory.make_rse(scheme='mock', protocol_impl=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_test(self, func, *args, **kwargs):\n pass", "def test(self):\n return test_throttle_method()", "def testJobTRSetRandomRun(databases):\n\n class CustomGenerator(DataGenerator):\n chanceChainProduct = 0.4\n numTaskRunners = 5\n chanceTRFramework = 0.7\n ...
[ "0.59932137", "0.59894603", "0.59680325", "0.5961236", "0.59596145", "0.595309", "0.58936113", "0.5890901", "0.5886319", "0.5860065", "0.584749", "0.584278", "0.58363724", "0.58184135", "0.58139724", "0.5780692", "0.57532215", "0.57527906", "0.5749115", "0.5746729", "0.574326...
0.653352
0
Prepares the XRD RSEs for an overwrite_on_tape test. fakes that one xroot RSE is a tape destination (and rollbacks the change after the test) Return a factory which allows to upload/register/add_rule for two dids
def overwrite_on_tape_topology(rse_factory, did_factory, root_account, vo, file_factory): rse1 = 'XRD1' rse1_id = rse_core.get_rse_id(rse=rse1, vo=vo) rse2 = 'XRD3' rse2_id = rse_core.get_rse_id(rse=rse2, vo=vo) rse3 = 'XRD4' rse3_id = rse_core.get_rse_id(rse=rse3, vo=vo) def __generate_an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_multihops_same_intermediate_rse(rse_factory, did_factory, root_account, core_config_mock, caches_mock):\n # +------+ +------+ +------+ +------+ +------+\n # | | | | | | | | | |\n # | RSE1 +--->| RSE2 +--->| RSE3 +--->| RSE4 +--->| RSE5 |\n #...
[ "0.5887489", "0.5692312", "0.5588952", "0.5525843", "0.55244076", "0.548657", "0.51108813", "0.50846964", "0.50368524", "0.4976738", "0.48961604", "0.48882294", "0.48652807", "0.48602736", "0.4834495", "0.48098412", "0.47892126", "0.47837698", "0.47602794", "0.47538057", "0.4...
0.67898095
0
Create and upload real files to source and destination. Don't register it on destination. This way, fts will fail if overwrite = False If simulate_dst_corrupted is True, will upload a different file to destination, to simulate that it is corrupted
def __generate_and_upload_file(src_rse, dst_rse, simulate_dst_corrupted=False): local_file = file_factory.file_generator() did = did_factory.random_file_did() did_factory.upload_test_file(src_rse, path=local_file, **did) did_factory.upload_client.upload( [ { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overwrite_on_tape_topology(rse_factory, did_factory, root_account, vo, file_factory):\n\n rse1 = 'XRD1'\n rse1_id = rse_core.get_rse_id(rse=rse1, vo=vo)\n rse2 = 'XRD3'\n rse2_id = rse_core.get_rse_id(rse=rse2, vo=vo)\n rse3 = 'XRD4'\n rse3_id = rse_core.get_rse_id(rse=rse3, vo=vo)\n\n def...
[ "0.700196", "0.6252557", "0.62507075", "0.6083093", "0.5982149", "0.5853024", "0.58049345", "0.5701598", "0.56701756", "0.5618603", "0.5572697", "0.5523261", "0.5505248", "0.5502287", "0.5501598", "0.55005914", "0.5451989", "0.54514116", "0.5432832", "0.54321486", "0.54235744...
0.72678787
0
Ensure that overwrite is not set for transfers towards TAPE RSEs
def test_overwrite_on_tape(overwrite_on_tape_topology, caches_mock): rse1_id, rse2_id, rse3_id, did1, did2 = overwrite_on_tape_topology(did1_corrupted=False, did2_corrupted=True) all_rses = [rse1_id, rse2_id, rse3_id] submitter(once=True, rses=[{'id': rse_id} for rse_id in all_rses], group_bulk=10, partiti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overwrite_hops(overwrite_on_tape_topology, caches_mock, did_factory, file_factory):\n rse1_id, rse2_id, rse3_id, did1, did2 = overwrite_on_tape_topology(did1_corrupted=False, did2_corrupted=True)\n did_factory.upload_client.upload(\n [\n {\n 'path': file_factory.file...
[ "0.61044496", "0.6002369", "0.59951496", "0.5960979", "0.5931762", "0.5837875", "0.58369833", "0.58320355", "0.57500327", "0.5735235", "0.5722755", "0.571563", "0.5699335", "0.5663631", "0.5567735", "0.5546666", "0.5525861", "0.5514419", "0.54601634", "0.5448126", "0.54353076...
0.6298048
0
Ensure that we request overwrite of intermediate hops on multihop transfers towards TAPE RSEs
def test_overwrite_hops(overwrite_on_tape_topology, caches_mock, did_factory, file_factory): rse1_id, rse2_id, rse3_id, did1, did2 = overwrite_on_tape_topology(did1_corrupted=False, did2_corrupted=True) did_factory.upload_client.upload( [ { 'path': file_factory.file_generator...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overwrite_corrupted_files(overwrite_on_tape_topology, core_config_mock, caches_mock):\n rse1_id, rse2_id, rse3_id, did1, did2 = overwrite_on_tape_topology(did1_corrupted=True, did2_corrupted=True)\n all_rses = [rse1_id, rse2_id, rse3_id]\n\n class _FTSWrapper(FTSWrapper):\n @staticmethod\n...
[ "0.558939", "0.5548721", "0.55455595", "0.524568", "0.5092852", "0.5076279", "0.50690395", "0.5054944", "0.5048982", "0.50388175", "0.5008279", "0.4969457", "0.49644142", "0.49466103", "0.49013048", "0.48496333", "0.4841354", "0.48402858", "0.48364288", "0.4832221", "0.480883...
0.62804127
0
Test that submitter and poller call fts with correct certificates in multivo env
def test_multi_vo_certificates(file_config_mock, rse_factory, did_factory, scope_factory, vo, second_vo): _, [scope1, scope2] = scope_factory(vos=[vo, second_vo]) def __init_test_for_vo(vo, scope): src_rse, src_rse_id = rse_factory.make_rse(scheme='mock', protocol_impl='rucio.rse.protocols.posix.Defau...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_01_basics(self):\n\n self.ac.start()\n\n arg_dict = {\n \"cert\": os.path.join(self.cs_dir, self.get_cli_cert(\"src\")),\n \"key\": os.path.join(self.keys_dir, self.get_cli_key(\"src\")),\n \"dst\": self.durl,\n ...
[ "0.58199227", "0.5805059", "0.570264", "0.56927806", "0.568771", "0.5604449", "0.5598037", "0.55067015", "0.5504084", "0.5498982", "0.54972184", "0.54926276", "0.5492502", "0.5478508", "0.54717046", "0.5460335", "0.54358", "0.54354906", "0.54316694", "0.54170007", "0.54105514...
0.6473819
0
Demonstrates lenet on MNIST dataset
def evaluate_lenet5(dataset='mnist.pkl.gz', nkerns=[20, 50], batch_size=500): rng = numpy.random.RandomState(23455) datasets = load_data(dataset) train_set_x, train_set_y = datasets[0] valid_set_x, valid_set_y = datasets[1] test_set_x, test_set_y = datasets[2] # compute n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MNIST_data():\n\n # Pobieramy macierze numpy z cyframi\n # images[i,j,k] <=> piksel (j,k) z i-tego obrazka w zbiorze danych\n images, labels = get_MNIST_dataset(range(10), \"training\") #pierwszy argument to\n\n # a) Ilosc przykladow i rozmiary danych\n print \"Raw training data dimensions \", i...
[ "0.7114263", "0.6918745", "0.6859507", "0.6718894", "0.67088884", "0.66813", "0.66771555", "0.66229486", "0.6597695", "0.6492547", "0.64591664", "0.6383095", "0.636698", "0.6356136", "0.63402", "0.6279806", "0.6273015", "0.62261784", "0.6214414", "0.6202346", "0.6199214", "...
0.7104353
1
Assuming that e is an NxN expression, return the lower triangular part as a vector.
def vec(e): N = e.getShape().dim(0) rows = [i for i in range(N) for j in range(i,N)] cols = [j for i in range(N) for j in range(i,N)] vals = [ 2.0**0.5 if i!=j else 1.0 for i in range(N) for j in range(i,N)] return Expr.flatten(Expr.mulElm(e, Matrix.sparse(N,N,rows,cols,vals)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basis_vector_matrix(*e):\n return np.array(e).T", "def minimum_eigen_vector(x, num_steps, learning_rate, vector_prod_fn):\n x = tf.nn.l2_normalize(x)\n for _ in range(num_steps):\n x = eig_one_step(x, learning_rate, vector_prod_fn)\n return x", "def edge_vector(edge):\n v1, v2 = edge.verts\n ...
[ "0.6288495", "0.6025632", "0.59803706", "0.59170324", "0.5578252", "0.554264", "0.55426145", "0.545888", "0.5450306", "0.54380167", "0.5430265", "0.5418534", "0.5400798", "0.5389048", "0.5374389", "0.53610647", "0.535368", "0.53154343", "0.5296928", "0.52742046", "0.52679", ...
0.6366133
0
Loading sequence of W,T from file. Either x is a file path or sequence
def _load_wt_file(self, x): if type(x) == str: # Load file x = np.loadtxt(x) W = x[:self.dimY*self.dimX].reshape(self.dimY,self.dimX) W = W.transpose() # convention T = x[self.dimY*self.dimX:].reshape(self.dimY,self.dimY) # no need to tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(filename):\r\n wholeTract= nib.streamlines.load(filename) \r\n wholeTract = wholeTract.streamlines\r\n return wholeTract", "def load_sequence_of_play(filename):\r\n import xml.etree.ElementTree as ET\r\n return SequenceOfPlay(ET.parse(filename).getroot())", "def LoadBatch(filename):",...
[ "0.6521103", "0.62880707", "0.61003274", "0.59700245", "0.58200794", "0.5782038", "0.57089365", "0.56952393", "0.56798565", "0.5662613", "0.5611655", "0.5573968", "0.5550844", "0.5512312", "0.5477089", "0.54759026", "0.5463264", "0.54625565", "0.5447529", "0.5445265", "0.5423...
0.7215341
0
Compute average KLdivergence of all forecasters in a given time interval
def KL_apply(question): if not question.empty: average_forecast = question.groupby( ['Ordered.Bin.Number'] ).Forecast.mean().reset_index() forecasts = question.pivot_table( values='Forecast', index='Ordered.Bin.Number', columns='Forecaster.ID' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl_divergence(self) -> Tensor:\n return self.variational_strategy.kl_divergence().sum(dim=1).mean()", "def avg_spike_frequency_abf(abf, epoch):\n p0 = abf.sweepEpochs.p1s[epoch]\n p1 = abf.sweepEpochs.p1s[epoch+1]\n t = abf.sweepX[p0:p1]\n V = abf.sweepY[p0:p1]\n return avg_spike_freque...
[ "0.62259936", "0.5951375", "0.58842665", "0.58284074", "0.5805377", "0.57114524", "0.5686495", "0.55966306", "0.55640596", "0.553133", "0.55185944", "0.55090743", "0.54649633", "0.54555833", "0.54146105", "0.5384558", "0.5382205", "0.53703797", "0.536366", "0.5356504", "0.535...
0.63926786
0
Set the power to the specified value (in mW)
def set_power(self, power): print('Setting santec power to %.4f mW' % power) self.santec1.write("LP %.2f" % power) self.santec2.write("LP %.2f" % power) self.santec3.write("LP %.2f" % power) self.santec4.write("LP %.2f" % power)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_power(self, value):\n self.write(\":POW {}W\".format(value))", "def power(self, value: int):\n self._power = value", "def set_power(self, dbm=-30):\r\n self.write(\"POW \"+str(dbm))", "def set_power(self, dbm=-30):\r\n _debug('simq03b_api.set_power')\r\n \r\n ...
[ "0.8348846", "0.7548796", "0.74613696", "0.7346844", "0.7324469", "0.7324469", "0.725705", "0.72232807", "0.7219513", "0.7158136", "0.7115584", "0.7085621", "0.6954798", "0.6945102", "0.6909162", "0.68312705", "0.6814112", "0.6677769", "0.66506827", "0.6535626", "0.65175855",...
0.75894326
1
Gets pictures from Curiosity Rover on a given Martian sol, with a certain camera There may be multiple pages
def get_rover_pics(sol, camera=None, page=1): #Validation valid_cameras = [ 'FHAZ', 'RHAZ', 'MAST', 'CHEMCAM', 'MAHLI', 'MARDI', 'NAVCAM', 'PANCAM', 'MINITES' ] if camera and camera not in valid_cameras: raise Exception('Not a valid camera!') params = { 'sol': sol, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_photo(mesh, movement, resolution, cmap, plotter, camera, title=None, title_location=\"upper_edge\",\n background_photos=None,cam_noise_lambda=None, background_scale=1, title_color=\"black\"):\n return Mesh.get_many_photos(mesh, movement, resolution, cmap,\n ...
[ "0.6081622", "0.6015538", "0.6012094", "0.58689016", "0.5781275", "0.5739771", "0.5702185", "0.5680316", "0.556765", "0.55674064", "0.5559166", "0.5465669", "0.5456309", "0.5448997", "0.54273283", "0.54250425", "0.54247284", "0.5424507", "0.5420435", "0.5417016", "0.5371876",...
0.74917895
0
Return a new Cursor Object using the connection. If the database does not provide a direct cursor concept, the module will have to emulate cursors using other means to the extent needed by this specification. [4]
def cursor(self): if self._closed: raise Error('The connection to the database has been closed.') return Cursor(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cursor(self):\r\n cursor = self.connection.cursor()\r\n return cursor", "def get_cursor():\n cur = conn.cursor(cursor_factory=DictCursor)\n return cur", "def cursor():\n dbh = handle()\n return dbh.cursor()", "def cursor(self):\n if self.__connection is Non...
[ "0.78827614", "0.7587127", "0.75584066", "0.73682237", "0.7349129", "0.73291755", "0.7260006", "0.7240816", "0.7236439", "0.72060776", "0.71288323", "0.71187013", "0.7104072", "0.7073766", "0.70614487", "0.7044208", "0.7023463", "0.70225805", "0.69576836", "0.69546443", "0.69...
0.8004369
0
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. Modules are free to implement this method using multiple calls to the execute() method or by using array operations to have the database process the sequence as a whol...
def executemany(self, operation, seq_of_parameters): if self._closed: raise Error('The cursor has been closed.') if self.connection._closed: raise Error('The connection to the database has been closed.') for parameters in seq_of_parameters: self.execute(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _executeprepared(self, operation, parameters):\n # Create a statement handle\n p_statement = self._statement_cache.get_prepared_statement(operation)\n\n if p_statement.parameter_count != len(parameters):\n raise ProgrammingError(\"Incorrect number of parameters specified, expect...
[ "0.73606586", "0.73441", "0.66620415", "0.6475693", "0.63031626", "0.62294924", "0.6206333", "0.6151082", "0.607004", "0.6042311", "0.60204035", "0.6016212", "0.6000834", "0.5983184", "0.5975359", "0.5939904", "0.5913451", "0.5891441", "0.5879333", "0.58531886", "0.58390516",...
0.7611646
0
This can be used before a call to executeXXX() to predefine memory areas for the operation's parameters. sizes is specified as a sequence one item for each input parameter. The item should be a Type Object that corresponds to the input that will be used, or it should be an integer specifying the maximum length of a str...
def setinputsizes(self, sizes): if self._closed: raise Error('The cursor has been closed.') if self.connection._closed: raise Error('The connection to the database has been closed.') else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setinputsizes(self, sizes):\n pass", "def __init__(__self__, *,\n size: pulumi.Input[int]):\n pulumi.set(__self__, \"size\", size)", "def _assign_sizes(self):", "def set_tunable_parameters(self, input_type='default', reduced_size=64, **kwargs):\n self.logger.info(\"Se...
[ "0.6015532", "0.5730435", "0.56628126", "0.547357", "0.54327464", "0.5289766", "0.5288654", "0.5285771", "0.5240631", "0.5234483", "0.51926106", "0.5188808", "0.5132499", "0.50914514", "0.50674397", "0.49855158", "0.49674615", "0.49446407", "0.49392125", "0.4936378", "0.49280...
0.6343714
0
Set a column buffer size for fetches of large columns (e.g. LONGs, BLOBs, etc.). The column is specified as an index into the result sequence. Not specifying the column will set the default size for all large columns in the cursor. This method would be used before the executeXXX() method is invoked. Implementations are...
def setoutputsize(self, size, column=None): if self._closed: raise Error('The cursor has been closed.') if self.connection._closed: raise Error('The connection to the database has been closed.') else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setoutputsize(self, size, column=None):\n pass", "def setColumnWidth(self, column, newWidth = None):\n\t\t\t\tdef yieldWidths():\n\t\t\t\t\tfor i, row in enumerate(self.thing.iter_rows(), start = 1):\n\t\t\t\t\t\twidth = self.getCellWidth(i, column)\n\t\t\t\t\t\tif (width is not None):\n\t\t\t\t\t\t\t...
[ "0.5896796", "0.5542264", "0.53449637", "0.53362805", "0.53230387", "0.5317424", "0.5267313", "0.5227576", "0.5193941", "0.51717675", "0.5167473", "0.51413244", "0.5122026", "0.510181", "0.50983393", "0.50757354", "0.5060915", "0.50503165", "0.50124973", "0.499577", "0.499150...
0.6449317
0
Close the cursor now (rather than whenever __del__ is called). The cursor will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the cursor.
def close(self): if self.connection._closed: raise Error('The connection to the database has been closed.') if self._closed: raise Error('The cursor has already been closed.') else: self._closed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.cursor.close()", "def close(self):\r\n if self.cursor is None:\r\n return\r\n\r\n self.cursor.close()\r\n self.cursor = None\r\n self.app_id = None\r\n self.iden_id = None", "def _close_cursor(self, cursor):\n\t\twith warnings.catch_w...
[ "0.8026459", "0.7676936", "0.76766557", "0.76722026", "0.7462743", "0.73252213", "0.7285407", "0.72512263", "0.71218365", "0.70642406", "0.7033755", "0.69990253", "0.6927757", "0.6773506", "0.6741317", "0.67074233", "0.6701096", "0.66495186", "0.6593548", "0.6579718", "0.6537...
0.7831996
1
Merge multiple SDR images into a single HDR image after demosacing. This is a wrapper function that extracts metadata and calls the appropriate function.
def merge(files, do_align=False, demosaic_first=True, color_space='sRGB', wb=[1, 1, 1], saturation_percent=0.98, normalize=False): data = get_metadata(files, color_space, saturation_percent) if demosaic_first: HDR, num_sat = imread_demosaic_merge(files, data, do_align, saturation_percent) else: HDR, num_sat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_datasets(dslist):\n # We use a variant of our fast stitching routine\n # So first create a sorted list of angles and source files\n container = []\n print 'Passed %d datasets for merging ' % len(dslist)\n proc_info = \"\"\"This dataset was created by collating points from multiple datasets...
[ "0.62815243", "0.6218348", "0.62160033", "0.58797866", "0.58561873", "0.57963276", "0.5749888", "0.571183", "0.5645936", "0.56389517", "0.55614287", "0.552315", "0.55147547", "0.5478095", "0.5472695", "0.54527247", "0.54388314", "0.542696", "0.5388265", "0.5378135", "0.537185...
0.6486676
0
Bgrd = get_nc_BGrid_GFDL(grdfile) Load BGrid grid object for GFDL CM2.1 from netCDF grid file
def get_nc_BGrid_GFDL(grdfile, name='GFDL_CM2.1_North_Pacific', area='regional', \ xrange=(60,175), yrange=(120, 190), ystart=235): nc = pyroms.io.Dataset(grdfile) lon_t = nc.variables['geolon_t'][:] lat_t = nc.variables['geolat_t'][:] lon_uv = nc.variables['geolon_c'][:] lat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadGrid(self, grdfile):\n nc = Dataset(grdfile,'r')\n \n self.xv = nc.variables['xv'][:]\n self.yv = nc.variables['yv'][:]\n self.xp = nc.variables['xp'][:]\n self.yp = nc.variables['yp'][:]\n self.xe = nc.variables['xe'][:]\n self.ye = nc.variables['ye...
[ "0.68723994", "0.66056603", "0.65547323", "0.64402777", "0.616281", "0.61344266", "0.5933896", "0.59285045", "0.59139436", "0.58916956", "0.587016", "0.58692986", "0.58584356", "0.5805568", "0.57237524", "0.570327", "0.56910247", "0.5652674", "0.56325096", "0.56223077", "0.56...
0.7247142
0
Method properTimeInput returns whether the user entered a valid time
def properTimeInput(time_): if not time_.isdigit() or len(time_) > 4 or len(time_) < 4 or int(time_) > 2400 or int(time_) < 0 or int(time_[2])>5: print("'",time_, "' is an invalid input for the time. Use 24 hr format.\nExamples: 8 a.m = 0800, 1 p.m = 1300, 2:30 = 1430, 12:50 a.m = 0050\n") return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_is_valid(request, day, time, name):\n\n\tif ((day != '0' and day != '6') and time.hour == 21) or time.minute != 0:\n\t\treturn False\n\n\t# George's time\n\tif name != \"George Yeh\" and day == '6' and time.hour >= 9 and time.hour < 12:\n\t\treturn False\n\n\treturn True", "def valid_time(time):\n if...
[ "0.78156906", "0.76430243", "0.76430243", "0.74963695", "0.727451", "0.701177", "0.689384", "0.6890916", "0.67932993", "0.67757434", "0.67485106", "0.67383194", "0.6708769", "0.669873", "0.6616662", "0.65898037", "0.6587257", "0.65815306", "0.6560355", "0.6555645", "0.6541537...
0.8539093
0
Method properDayInput returns whether the user erntered a valid day
def properDayInput(day): possibleStrings = ["m","mon","monday","tu","tue","tues","tuesday","w", "we","wed","wednesday","th","tr","r", "thu","thur","thurs","thursday","f","fr", "fri","friday","sa","sat","saturday","su","sun","sunday"] validString = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_day():\n\twhile True:\n\t\t_day = input(\"Introduceti ziua: \")\n\t\ttry:\n\t\t\t_day = int(_day)\n\t\t\tif (not is_in_range(_day, 0, VALID_DAY)):\n\t\t\t\tprint(\"Ziua invalida.\")\n\t\t\telse:\n\t\t\t\tbreak\n\t\texcept ValueError:\n\t\t\tprint(\"Ziua invalida, introduceti un intreg.\")\n\treturn (_day)...
[ "0.72177476", "0.7162018", "0.70186716", "0.6874332", "0.68444574", "0.6799649", "0.67022496", "0.6678752", "0.6669538", "0.6626575", "0.6551671", "0.6516856", "0.6317545", "0.6277343", "0.6194926", "0.61726516", "0.61430144", "0.6137453", "0.61150825", "0.61132497", "0.60914...
0.75861144
0
Method displayClassList displays the ongoing list of classes, numbered
def displayClassList(showExtraOption): if len(classes) == 0: print("\nThere are no classes\n") delay() return print() outstr = "{0:<12} {1:^18.5} {2:>5}" print(outstr.format(" Class","Day","Time")) for i in range(0, len(classes), 1): print(str(i+1) + "." +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_classes():\n for obj in Classes.get_all_obj_list():\n print('\\033[33;1m[%s] [%s]校区 [%s]班级 学费[%s]\\033[0m'.center(60, '-') \\\n % (obj.school_nid.get_obj_by_uuid().name, obj.school_nid.get_obj_by_uuid().addr, \\\n obj.name, obj.tuition))", "def show_class(self,c):\...
[ "0.71469915", "0.6526368", "0.64634573", "0.6399989", "0.62757725", "0.6181238", "0.5977218", "0.5869728", "0.578967", "0.57455575", "0.56798834", "0.5679596", "0.5643068", "0.5642376", "0.55955905", "0.55777174", "0.5554064", "0.54997116", "0.54984796", "0.5498105", "0.54953...
0.6831478
1
Method add class takes user inputs and adds a class to the ongoing list of classes, sorted
def addClass(): print("\nEnter classes by day. For example enter all your Monday classes first, then Tuesday, etc.") print("When asked to put in class meeting times enter in 24 hr format. Example: 1:00 p.m = 1300 8:00 a.m = 0800") day = input("Day of Class: ") while not properDayInput(day): #W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_class(self, new_class):\n index = self._counter\n self._counter += 1\n for element in new_class:\n self._class_names[element] = index\n node = self.part[index].append(element)\n self._place[element] = node", "def process_class_list(self, module, class...
[ "0.7390039", "0.6293409", "0.6051495", "0.5877191", "0.58644205", "0.58146465", "0.5810419", "0.57066", "0.56604487", "0.5597816", "0.5594408", "0.5591665", "0.5577792", "0.55187804", "0.546726", "0.54580706", "0.54314536", "0.5428655", "0.53475636", "0.5345708", "0.53414875"...
0.70700693
1
Method edit class accepts user inputs to change fields of a userselected class in the list
def editClass(): noChangesMade = True #Keeps track if changes were made at all displayClassList(True) if len(classes) == 0: #if no classes, return return print("\nWhich class would you like to edit?") classIndex = input("Choice: ") while not properMenuChoice(classIndex): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(self):\n\n pass", "def edit(self, **kwargs):\n ...", "def edit():", "def edit_contact(self):\n edit_data = input(\"Enter the first name of user you want to edit\\n\")\n\n for contact in self.contact_list:\n if contact.first_name == edit_data:\n u...
[ "0.6598314", "0.6395565", "0.6206384", "0.59057254", "0.58150303", "0.5813324", "0.5805739", "0.57658625", "0.57134074", "0.5709039", "0.5703661", "0.5579027", "0.5497685", "0.54963166", "0.5485881", "0.54812586", "0.5473928", "0.54522747", "0.54284304", "0.5409104", "0.53649...
0.69180167
0
Method delete class deletes a userselected class from the ongoing list of classes
def deleteClass(): displayClassList(True) if len(classes) == 0: return print("\nWhich class would you like to delete?") classIndex = input("Choice: ") while not properMenuChoice(classIndex): classIndex = input("Please enter a valid menu choice: ") if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, class_name):\n\n return self.client.delete(Classes.PATH_CLASS_TEMPLATE.format(class_name=class_name))", "def do_destroy(self, arg):\n if len(arg) == 0:\n print(\"** class name missing **\")\n return\n coms = tuple(arg.split())\n if coms[0] not in...
[ "0.6809871", "0.6432882", "0.63366604", "0.63275844", "0.62082964", "0.61836684", "0.6160332", "0.6156988", "0.6125214", "0.61221415", "0.6102454", "0.6061765", "0.6025444", "0.5985825", "0.59802514", "0.5950053", "0.5929951", "0.59204936", "0.58836925", "0.58612436", "0.5852...
0.76067334
0
Method printSchedule prints a formated schedule to the Terminal
def printSchedule(): print("{0:^45}".format("Your Schedule:\n")) print(" Day Class Time") if(len(classes) == 0): print("\nThere are no classes\n") return for class_ in classes: print(class_.scheduleString()) print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSchedule(self):\n\t\tself.printWaiting()\n\t\tprint ' '.join(map(format,range(20),['2' for _ in range(20)]))\n\t\tprint \"\"", "def print_schedule(self):\n for entry in self.entries:\n print(entry.get_entry_string())", "def print_list(schedule):\n START_TIME = 0\n END_TIME = 1\...
[ "0.8127595", "0.7954059", "0.73060447", "0.7019486", "0.68429357", "0.6830832", "0.67173177", "0.66557765", "0.6581177", "0.6573826", "0.6553859", "0.64818215", "0.63623947", "0.63557285", "0.6313227", "0.62555295", "0.6238557", "0.6235394", "0.6199181", "0.6183564", "0.61498...
0.825305
0
Method genScheduleCSV prints a formated schedule to the Terminal and exports to a csv file
def genScheduleCSV(): try: printSchedule() save_class_list() print("\nSchedule generated, check working directory") except Exception as e: print("Exception found" + str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_class_list():\r\n try:\r\n classStringList.clear() #clear the classString List\r\n for i in range(0,len(classes)):\r\n classStringList.append(classes[i].csvRow()) #enter classes to the classStringList from the classes\r\n f = open(\"mySchedule.csv\", 'w', newline ='')\r\...
[ "0.63309157", "0.63027954", "0.6272687", "0.6155261", "0.61245793", "0.6047776", "0.60094565", "0.59290546", "0.59159285", "0.5870327", "0.5846131", "0.58076143", "0.5802007", "0.5800648", "0.578713", "0.5776152", "0.5773833", "0.5773768", "0.5768415", "0.5747529", "0.5747431...
0.85996705
0
Method load_class_list reads class information from a csv file and adds classes to the classes list and the classStringList
def load_class_list(): try: firstLine = True #keeping track of the first line in the csv file (the header) index = 0 if os.access("mySchedule.csv", os.F_OK): #If the file exists f = open("mySchedule.csv") for row in csv.reader(f): if firstLine: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_class_list(self, module, classes):", "def load_from_file_csv(cls):\n if path.exists(cls.__name__ + \".csv\") is False:\n return []\n with open(cls.__name__ + \".csv\", \"r\", newline='') as f:\n listofinstances = []\n reader = csv.DictReader(f)\n ...
[ "0.66627824", "0.64263815", "0.6320585", "0.63066614", "0.6295501", "0.6259383", "0.62000376", "0.61884654", "0.6180721", "0.60922486", "0.6062719", "0.60619515", "0.60037845", "0.59632725", "0.5914574", "0.58258075", "0.5812363", "0.57939637", "0.5776928", "0.5750722", "0.57...
0.8204866
0
Method save_class_list exports current information in the classes list to a csv
def save_class_list(): try: classStringList.clear() #clear the classString List for i in range(0,len(classes)): classStringList.append(classes[i].csvRow()) #enter classes to the classStringList from the classes f = open("mySchedule.csv", 'w', newline ='') csv.writer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file_csv(cls, list_objs):\n with open(cls.__name__ + \".csv\", \"w\", newline='') as f:\n if cls.__name__ == \"Rectangle\":\n fieldnames = ['id', 'width', 'height', 'x', 'y']\n elif cls.__name__ == \"Square\":\n fieldnames = ['id', 'size', 'x',...
[ "0.6824156", "0.679497", "0.66754794", "0.6620248", "0.6603461", "0.6543441", "0.6356623", "0.62391156", "0.6098659", "0.6059709", "0.60516226", "0.60439676", "0.6023683", "0.59847575", "0.594807", "0.5928933", "0.5911791", "0.5906582", "0.5900664", "0.58869207", "0.5883265",...
0.8075002
0
Method clearTerminal clears the Terminal for any OS
def clearTerminal(): os.system('cls' if os.name == 'nt' else 'clear')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_terminal(self):\n os.system('clear')", "def resetTerminal():\n sys.stdout.write('\\n\\n') # add a few blank lines\n sys.stdout.flush()\n if os.name == 'nt':\n os.system('cls')\n else:\n os.system('clear')", "def clear():\n\n # windows \n if os.name == \"nt\": \n...
[ "0.8650224", "0.8027377", "0.7552109", "0.75257945", "0.74613637", "0.745878", "0.74554735", "0.7451339", "0.7451339", "0.7451339", "0.7439368", "0.74361753", "0.7435025", "0.7435025", "0.7429302", "0.74284637", "0.7426968", "0.74216986", "0.7405859", "0.7401864", "0.7398269"...
0.8741407
0
Method delay delays for 2 seconds by calling time.sleep()
def delay(): time.sleep(2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay(seconds):\n\n # Perform the delay\n time.sleep(seconds)", "async def sleep(cls, delay: float) -> None:", "def sleep(self):\n time.sleep(0.2)", "def delay(ms: int, /) -> None:", "def wait(delay=2):\n time.sleep(delay)", "def _delay(self, n=None):", "def sleep(seconds):\r\n t...
[ "0.8206127", "0.80002713", "0.7910068", "0.7777698", "0.7647302", "0.763422", "0.75461113", "0.7504566", "0.7504566", "0.7499666", "0.7484212", "0.74510634", "0.7408911", "0.7404746", "0.7371981", "0.7316838", "0.7283153", "0.72631913", "0.7243154", "0.72041893", "0.71867824"...
0.8952803
0
Method mainLoop keeps the program going until the user decides to exit
def mainLoop(): clearTerminal() load_class_list() print("Class Scheduler Program by Cameron Zurmuhl") print("Lafayette College, Class of 2020") print("Email: zurmuhlc@lafayette.edu\n") while True: choice = mainMenuChoice() if choice is None: delay() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_loop(self):\n try:\n self.state_machine.set_state('wait')\n\n while True:\n events = list(reversed(pygame.event.get())) # Take all events, most recent first\n\n if self.find_quit_event(events):\n break\n\n if sel...
[ "0.7655049", "0.7512549", "0.7502741", "0.7455534", "0.74237436", "0.7375826", "0.727332", "0.7264046", "0.7217026", "0.7194721", "0.7161396", "0.70686316", "0.70659685", "0.7030019", "0.70148635", "0.7013023", "0.69647336", "0.6955067", "0.6947823", "0.6946313", "0.69018674"...
0.793783
0
Create OboOptionalAttrs or return None.
def _init_optional_attrs(optional_attrs): if optional_attrs is None: return None opts = OboOptionalAttrs.get_optional_attrs(optional_attrs) if opts: return OboOptionalAttrs(opts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, obo_file=OBO_FILE, optional_attrs=None):\n self.optobj = self._init_optional_attrs(optional_attrs) # OboOptionalAttrs or None\n self.format_version = None # e.g., \"1.2\" of \"format-version:\" line\n self.data_version = None # e.g., \"releases/2016-07-07\" from \"data-vers...
[ "0.6076875", "0.5928884", "0.59069616", "0.59017825", "0.5634378", "0.5530078", "0.5340581", "0.52882504", "0.52593064", "0.52090013", "0.51132935", "0.5093037", "0.50776744", "0.50472337", "0.50441504", "0.5007685", "0.500275", "0.49961215", "0.49829775", "0.49819085", "0.49...
0.8182207
0
Gets parent GO IDs up to k levels back
def get_k_parents(self, k = None): if k is None: return self.get_all_parents() else: k_parents = set() cur_parents = self.parents cur_parents_ids = [cur_parent.id for cur_parent in cur_parents] for i in range(0, k): k_parents.u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parents(self, go_id=None):\n rec = self.dict_go[go_id]\n set_parents = rec.get_all_parents()\n return set_parents", "def _get_parents(self):\n parents = []\n parent = self.parent\n while(parent):\n parents.append(parent)\n parent = parent.pa...
[ "0.6740107", "0.6590704", "0.65110725", "0.64462346", "0.6219877", "0.6115461", "0.6057378", "0.60571146", "0.60565615", "0.6040938", "0.6035474", "0.60345376", "0.6034505", "0.5995139", "0.59800035", "0.5976643", "0.5934511", "0.5923506", "0.5918514", "0.58731055", "0.585637...
0.7250033
0
Returns a set containing parents and relationship GO Terms.
def get_goterms_upper(self): # Requires GODag is created with 'relationship' in optional_attrs argument # pylint: disable=no-member return set.union(self.parents, *self.relationship.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_goterms_lower(self):\n # Requires GODag is created with 'relationship' in optional_attrs argument\n # pylint: disable=no-member\n return set.union(self.children, *self.relationship_rev.values())", "def relations(self):\n return set(self.triples()[\"relation\"])", "def find_p...
[ "0.7205081", "0.69444543", "0.691439", "0.65272766", "0.6383208", "0.6374926", "0.63622785", "0.63477033", "0.63416654", "0.6335229", "0.63303053", "0.6289184", "0.6276815", "0.62548405", "0.624102", "0.6234652", "0.61212283", "0.6087649", "0.6087368", "0.60715574", "0.607012...
0.726774
0
Returns a set containing children and reverserelationship GO Terms.
def get_goterms_lower(self): # Requires GODag is created with 'relationship' in optional_attrs argument # pylint: disable=no-member return set.union(self.children, *self.relationship_rev.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_goterms_upper(self):\n # Requires GODag is created with 'relationship' in optional_attrs argument\n # pylint: disable=no-member\n return set.union(self.parents, *self.relationship.values())", "def _get_children(self):\n return set()", "def children(self, taxon, taxonomy):\n\...
[ "0.7018476", "0.7015497", "0.6693456", "0.6552289", "0.6530311", "0.6424423", "0.6325786", "0.6248133", "0.62194085", "0.61937857", "0.6164341", "0.61638975", "0.61285734", "0.6123821", "0.6115087", "0.6100571", "0.60878086", "0.60534227", "0.60302037", "0.60205144", "0.60205...
0.7491547
0
Write hierarchy for a GO Term record.
def write_hier_rec(self, gos_printed, out=sys.stdout, len_dash=1, max_depth=None, num_child=None, short_prt=False, include_only=None, go_marks=None, depth=1, depth_dashes="-"): # Added by DV Klopfenstein goid = self.id # Shorte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(obj, handle, **kwargs):\n trees = list(obj)\n writer = NewickIO.Writer(trees)\n nexus_trees = [\n TREE_TEMPLATE % {\"index\": idx + 1, \"tree\": nwk}\n for idx, nwk in enumerate(\n writer.to_strings(plain=False, plain_newick=True, **kwargs)\n )\n ]\n tax_lab...
[ "0.5546483", "0.5536881", "0.5504827", "0.5468284", "0.5443513", "0.5434736", "0.5344939", "0.5320528", "0.53101194", "0.52966833", "0.5266934", "0.5233876", "0.52310437", "0.5212241", "0.51944035", "0.51603746", "0.51283133", "0.5121976", "0.5108549", "0.5087461", "0.5085598...
0.56535333
0
Read obo file. Store results.
def load_obo_file(self, obo_file, optional_attrs, load_obsolete, prt): reader = OBOReader(obo_file, optional_attrs) # Save alt_ids and their corresponding main GO ID. Add to GODag after populating GO Terms alt2rec = {} i = 0 for rec in reader: # Save record if: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, fileobj):\n raise NotImplementedError", "def read(self):", "def _read_data(self):", "def __iter__(self):\n # Wait to open file until needed. Automatically close file when done.\n with open(self.obo_file) as fstream:\n rec_curr = None # Stores current GO Term\n ...
[ "0.6180303", "0.5986327", "0.5855927", "0.57343435", "0.5720834", "0.57050353", "0.5640002", "0.55223525", "0.5502251", "0.54979974", "0.54961646", "0.54932064", "0.5422811", "0.5407113", "0.5407113", "0.53859", "0.5364427", "0.53560793", "0.5344812", "0.5327998", "0.53029215...
0.6070833
1
Convert GO IDs to GO Term record objects. Populate children.
def _populate_terms(self, optobj): has_relationship = optobj is not None and 'relationship' in optobj.optional_attrs # Make parents and relationships references to the actual GO terms. for rec in self.values(): # Given parent GO IDs, set parent GO Term objects rec.parents...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate_relationships(self, rec_curr):\n for relationship_type, goids in rec_curr.relationship.items():\n parent_recs = set([self[goid] for goid in goids]) \n rec_curr.relationship[relationship_type] = parent_recs # replace GO ID with GO Term record object\n for parent...
[ "0.5755125", "0.5338672", "0.5329722", "0.52761185", "0.5210634", "0.51479983", "0.5139184", "0.51210004", "0.5115062", "0.5050713", "0.5016776", "0.5008475", "0.5002104", "0.4972041", "0.49581307", "0.49481955", "0.49471813", "0.49283394", "0.49226198", "0.49141547", "0.4890...
0.7069697
0
Convert GO IDs in relationships to GO Term record objects. Populate children.
def _populate_relationships(self, rec_curr): for relationship_type, goids in rec_curr.relationship.items(): parent_recs = set([self[goid] for goid in goids]) rec_curr.relationship[relationship_type] = parent_recs # replace GO ID with GO Term record object for parent_rec in p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate_terms(self, optobj):\n has_relationship = optobj is not None and 'relationship' in optobj.optional_attrs\n # Make parents and relationships references to the actual GO terms.\n for rec in self.values():\n # Given parent GO IDs, set parent GO Term objects\n r...
[ "0.7713539", "0.5963961", "0.5717024", "0.5698482", "0.546695", "0.5437619", "0.5430837", "0.54162246", "0.53634787", "0.5328484", "0.53268766", "0.52261734", "0.52211857", "0.5174679", "0.5172715", "0.5164123", "0.513734", "0.5097313", "0.50481874", "0.504175", "0.50369143",...
0.7230565
1
Set level, depth and add inverted relationships.
def _set_level_depth(self, optobj): has_relationship = optobj is not None and 'relationship' in optobj.optional_attrs def _init_level(rec): if rec.level is None: if rec.parents: rec.level = min(_init_level(rec) for rec in rec.parents) + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_level(self):\n queue = []\n for node in self.node:\n if distance.euclidean(node.location, para.base) < node.com_ran:\n node.level = 1\n queue.append(node.id)\n while queue:\n for neighbor_id in self.node[queue[0]].neighbor:\n ...
[ "0.5710649", "0.5664993", "0.5536199", "0.5480017", "0.5424314", "0.52821314", "0.52650774", "0.5216432", "0.51938105", "0.5161485", "0.51139736", "0.5094936", "0.5065531", "0.505468", "0.50471", "0.49980313", "0.49617708", "0.49417603", "0.49165037", "0.49140632", "0.4912098...
0.77841955
0
Given a GO ID, return the int value.
def id2int(go_id): return int(go_id.replace("GO:", "", 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInt(self, addr: ghidra.program.model.address.Address) -> int:\n ...", "def getID(self) -> int:\n ...", "def get_int(self, item: str) -> int:\n return int(self[item])", "def id(self):\n if (len(self.value) > 1) and isinstance(self.value[1], int):\n return self.val...
[ "0.62385684", "0.621948", "0.62051165", "0.6159339", "0.615776", "0.6103479", "0.6071196", "0.5994222", "0.59450656", "0.5940004", "0.59305966", "0.59223413", "0.58303654", "0.58217436", "0.5805286", "0.57666236", "0.5742528", "0.5742528", "0.57226086", "0.5709645", "0.569556...
0.8050284
0
Returns all possible paths to the root node Each path includes the term given. The order of the path is top > bottom, i.e. it starts with the root and ends with the given term (inclusively).
def paths_to_top(self, term): # error handling consistent with original authors if term not in self: sys.stderr.write("Term %s not found!\n" % term) return def _paths_to_top_recursive(rec): if rec.level == 0: return [[rec]] paths =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_paths(t, entry):\n paths = []\n if t.label == entry:\n return [[entry]]\n for b in t.branches:\n for p in find_paths(b, entry):\n paths.append([t.label] + p)\n return paths", "def find_all_path(self, start, end, path=[]):\n path = path+[start]\n if star...
[ "0.5928094", "0.58579594", "0.5771403", "0.572775", "0.5664198", "0.56338614", "0.5608132", "0.5601973", "0.55823183", "0.55173934", "0.55136275", "0.55092233", "0.5503546", "0.5469566", "0.544573", "0.5440878", "0.5434561", "0.5434489", "0.5410268", "0.5402697", "0.5397204",...
0.6615518
0
Add the GO parents of a gene's associated GO IDs to the gene's association.
def update_association(self, association): bad_goids = set() # Loop through all sets of GO IDs for all genes for goids in association.values(): parents = set() # Iterate thru each GO ID in the current gene's association for goid in goids: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addGeneAssociation(self, *args):\n return _libsbml.FbcModelPlugin_addGeneAssociation(self, *args)", "def add_gene_ids(self, genes_list):\n orig_num_genes = len(self.genes)\n\n for g in list(set(genes_list)):\n if not self.genes.has_id(g):\n new_gene = GenePro(id...
[ "0.62660384", "0.6137538", "0.60173213", "0.59491855", "0.5879606", "0.5706948", "0.56995", "0.569761", "0.56316316", "0.5612094", "0.55072606", "0.5487092", "0.54207236", "0.5380436", "0.53702456", "0.5355048", "0.53539014", "0.5352989", "0.5327009", "0.53183895", "0.5301174...
0.6832396
0
Fetches all links to SOTU speeches from the essay page.
def get_links() -> list: headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36", "Accept": "text/html", "Accept-Encoding": "gzip, deflate", } p = re.compile(r'\d+.html') base_url = 'htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_speeches(sotu_links: dict):\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\",\n \"Accept\": \"text/html\",\n \"Accept-Encoding\": \"gzip, deflate\",\n }\n for name...
[ "0.6096879", "0.6059175", "0.6013439", "0.60043585", "0.5761647", "0.570113", "0.56948954", "0.565329", "0.55780137", "0.55446094", "0.55062586", "0.5449724", "0.5413576", "0.5397126", "0.537303", "0.5372341", "0.5364773", "0.5361135", "0.53572524", "0.534847", "0.532454", ...
0.66971195
0
Downloads all SOTU addresses as TXT files.
def download_speeches(sotu_links: dict): headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36", "Accept": "text/html", "Accept-Encoding": "gzip, deflate", } for name, link in sotu_links.it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download (url):\n path, url = url\n r = requests.get (url, stream = True)\n content = r.text\n #print (content)\n with open (path + '.txt', 'w') as f:\n f.write (content)", "def download_all(): #@save\n for name in DATA_HUB:\n download(name)", "def download(all):\n print...
[ "0.59053004", "0.587922", "0.5870572", "0.5778265", "0.57235277", "0.56239617", "0.56174624", "0.55523086", "0.55497265", "0.55383825", "0.5523424", "0.5518361", "0.5505957", "0.5397734", "0.53777903", "0.535254", "0.53073", "0.5300313", "0.5297862", "0.5297141", "0.5294974",...
0.60333025
0
The immutable annotation can be bypassed via synonyms
def test_synonym_annotation(self) -> None: syna = SynonymAnnotation(col_regular='a', col_immutable='b') # The columns behave as expected: assert syna.col_regular == 'a' assert syna.col_immutable == 'b' syna.col_regular = 'x' assert syna.col_regular == 'x' with pyt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_annotations(source: str, target: str) -> str:\n if isinstance(source, AnnotatedStr):\n if not isinstance(target, AnnotatedStr):\n target = AnnotatedStr(target)\n target.optional = source.optional\n target.exists = source.exists\n target.phony = source.phony\n ...
[ "0.59897065", "0.59733963", "0.5937297", "0.58056915", "0.575385", "0.5600894", "0.558813", "0.55193585", "0.5471302", "0.5451327", "0.54463136", "0.54463136", "0.5412678", "0.54107326", "0.53659195", "0.53585386", "0.5329973", "0.52853864", "0.52679074", "0.5257866", "0.5249...
0.6924903
0
Peer down handler. Cleans up the paths in global tables that was received from this peer.
def on_peer_down(self, peer): LOG.debug('Cleaning obsolete paths whose source/version: %s/%s', peer.ip_address, peer.version_num) # Launch clean-up for each global tables. self._table_manager.clean_stale_routes(peer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bg_clean_up_peer(self, peer):\n with self._peers_lock:\n del self._peers[peer.peer_id]\n del self._sock_to_peer[peer.socket]\n peer.close()\n peer = None", "def handle_link_down (self, port):\n for dest in self.hosts.keys():\n currPort = self.hosts[dest][0]...
[ "0.61131", "0.6081272", "0.58917975", "0.5844231", "0.58277273", "0.57862747", "0.5777576", "0.5760708", "0.5760111", "0.5760111", "0.5746705", "0.5727138", "0.56835914", "0.5668566", "0.56587297", "0.56587297", "0.56587297", "0.5655229", "0.56371796", "0.56203717", "0.561375...
0.794418
0
Returns list of peers in established state.
def get_peers_in_established(self): est_peers = [] for peer in self._peers.values(): if peer.in_established: est_peers.append(peer) return est_peers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peers():\n return flask.jsonify(api_utils.get_peer_conf_and_state())", "def peer_list_active(self):\n return self.client.call('GET', self.name + 'peer-list/active')", "def peer_list_reachable(self):\n return self.client.call('GET', self.name + 'peer-list/reachable')", "def get_peer_nodes...
[ "0.76069987", "0.7319591", "0.7274298", "0.71916944", "0.71916944", "0.7083651", "0.6903163", "0.6896505", "0.62460506", "0.5997698", "0.5910318", "0.5833534", "0.5781555", "0.57754815", "0.57457167", "0.5735629", "0.56861264", "0.56781614", "0.56751245", "0.5670917", "0.5651...
0.83943206
0
For given `peer` resend sent paths.
def resend_sent(self, route_family, peer): if peer not in self._peers.values(): raise ValueError('Could not find given peer (%s)' % peer) if route_family not in SUPPORTED_GLOBAL_RF: raise ValueError( 'Given route family (%s) is not supported.' % route_family ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comm_all_best_paths(self, peer):\n LOG.debug('Communicating current best path for all afi/safi except'\n ' 1/132')\n # We will enqueue best path from all global destination.\n for route_family, table in self._table_manager.iter:\n if route_family == RF_RTC_UC:\n...
[ "0.55400974", "0.5527805", "0.5385521", "0.5316282", "0.52486527", "0.5176147", "0.51740795", "0.5169025", "0.5047884", "0.49399987", "0.4920014", "0.49139652", "0.48995343", "0.48900852", "0.48659205", "0.48195505", "0.47898737", "0.47351354", "0.47132412", "0.47109663", "0....
0.69251496
0
Makes refresh request to all peers for given address family. Skips making request to peer that have valid RTC capability.
def req_rr_to_non_rtc_peers(self, route_family): assert route_family != RF_RTC_UC for peer in self._peers.values(): # First check if peer is in established state if (peer.in_established and # Check if peer has valid capability for given address # f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_route_refresh_request(self, peer_ip, *route_families):\n LOG.debug('Route refresh requested for peer %s and route families %s',\n peer_ip, route_families)\n if not SUPPORTED_GLOBAL_RF.intersection(route_families):\n raise ValueError('Given route family(s) % is not...
[ "0.6113738", "0.5776063", "0.541313", "0.5374841", "0.5218789", "0.5149429", "0.50723237", "0.49836946", "0.49206266", "0.48936272", "0.4839092", "0.48283538", "0.4768601", "0.4729838", "0.4675083", "0.46661487", "0.46600488", "0.46309865", "0.46273312", "0.46254832", "0.4617...
0.6712589
0
Request routerefresh for peer with `peer_ip` for given `route_families`. Will make routerefresh request for a given `route_family` only if such capability is supported and if peer is in ESTABLISHED state. Else, such requests are ignored. Raises appropriate error in other cases. If `peer_ip` is equal to 'all' makes refr...
def make_route_refresh_request(self, peer_ip, *route_families): LOG.debug('Route refresh requested for peer %s and route families %s', peer_ip, route_families) if not SUPPORTED_GLOBAL_RF.intersection(route_families): raise ValueError('Given route family(s) % is not supporte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_route_refresh(peer_ip):\n LOG.debug('Try to send route refresh to peer %s', peer_ip)\n json_request = flask.request.get_json()\n if 'afi' in json_request and 'safi' in json_request:\n if 'res' not in json_request:\n res = 0\n else:\n res = json_request['res']\n...
[ "0.6576246", "0.651089", "0.51476836", "0.44330993", "0.43338594", "0.4328826", "0.4319273", "0.43107876", "0.42995644", "0.42772868", "0.42183658", "0.42091832", "0.42060584", "0.41908076", "0.41816354", "0.41066763", "0.409145", "0.40811968", "0.40530893", "0.39563677", "0....
0.8223286
0
Shares/communicates current best rt_nlri paths with this peers. Can be used to send initial updates after we have established session with `peer` with which RTC capability is valid. Takes into account peers RTC_AS setting and filters all RT NLRIs whose origin AS do not match this setting.
def comm_all_rt_nlris(self, peer): # First check if for this peer mpbgp-rtc is valid. if not peer.is_mbgp_cap_valid(RF_RTC_UC): return neigh_conf = self._neighbors_conf.get_neighbor_conf(peer.ip_address) peer_rtc_as = neigh_conf.rtc_as # Iterate over all RT_NLRI dest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _collect_peers_of_interest(self, new_best_path):\n path_rts = new_best_path.get_rts()\n qualified_peers = set(self._peers.values())\n\n # Filter out peers based on RTC_AS setting if path is for RT_NLRI\n qualified_peers = self._rt_manager.filter_by_origin_as(\n new_best_p...
[ "0.68900126", "0.64145476", "0.5670051", "0.52405006", "0.49201214", "0.48695308", "0.48459294", "0.4836272", "0.4804749", "0.4720686", "0.46841615", "0.46329033", "0.46113852", "0.45804277", "0.45031074", "0.44983274", "0.44929075", "0.44098863", "0.43394423", "0.43062857", ...
0.7465844
0
Shares/communicates current best paths with this peers. Can be used to send initial updates after we have established session with `peer`.
def comm_all_best_paths(self, peer): LOG.debug('Communicating current best path for all afi/safi except' ' 1/132') # We will enqueue best path from all global destination. for route_family, table in self._table_manager.iter: if route_family == RF_RTC_UC: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comm_new_best_to_bgp_peers(self, new_best_path):\n # Filter based on standard community\n # If new best path has community attribute, it should be taken into\n # account when sending UPDATE to peers.\n comm_attr = new_best_path.get_pattr(BGP_ATTR_TYPE_COMMUNITIES)\n if comm_a...
[ "0.5883881", "0.57443553", "0.56123716", "0.5499878", "0.5477993", "0.5329888", "0.5321222", "0.52948636", "0.52582544", "0.516415", "0.50444376", "0.50317", "0.5019475", "0.499753", "0.49965003", "0.49741516", "0.4948319", "0.4933094", "0.49290287", "0.49048895", "0.49046937...
0.68576074
0
Communicates/enqueues given best path to be sent to all qualifying bgp peers. If this path came from iBGP peers, it is not sent to other iBGP peers. If this path has communityattribute, and if settings for recognize wellknow attributes is set, we do as per [RFC1997], and queue outgoing route only to qualifying BGP peer...
def comm_new_best_to_bgp_peers(self, new_best_path): # Filter based on standard community # If new best path has community attribute, it should be taken into # account when sending UPDATE to peers. comm_attr = new_best_path.get_pattr(BGP_ATTR_TYPE_COMMUNITIES) if comm_attr: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comm_all_best_paths(self, peer):\n LOG.debug('Communicating current best path for all afi/safi except'\n ' 1/132')\n # We will enqueue best path from all global destination.\n for route_family, table in self._table_manager.iter:\n if route_family == RF_RTC_UC:\n...
[ "0.7693337", "0.62346447", "0.575881", "0.55601615", "0.5535651", "0.5475796", "0.54713356", "0.53688544", "0.5191018", "0.51828367", "0.51666784", "0.5132194", "0.5109872", "0.50459236", "0.5044263", "0.5031913", "0.5028703", "0.50194", "0.49737486", "0.4973715", "0.4969356"...
0.68744844
1
Collect all peers that qualify for sharing a path with given RTs.
def _collect_peers_of_interest(self, new_best_path): path_rts = new_best_path.get_rts() qualified_peers = set(self._peers.values()) # Filter out peers based on RTC_AS setting if path is for RT_NLRI qualified_peers = self._rt_manager.filter_by_origin_as( new_best_path, qualif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comm_all_best_paths(self, peer):\n LOG.debug('Communicating current best path for all afi/safi except'\n ' 1/132')\n # We will enqueue best path from all global destination.\n for route_family, table in self._table_manager.iter:\n if route_family == RF_RTC_UC:\n...
[ "0.5596137", "0.5572386", "0.5414871", "0.53814036", "0.531134", "0.52629113", "0.5244464", "0.52352923", "0.5208997", "0.51961887", "0.5179847", "0.5147802", "0.5136036", "0.51277256", "0.5104832", "0.50553757", "0.5037936", "0.50375175", "0.5020352", "0.50006336", "0.500049...
0.6937274
0
Return whether or not user_input is valid.
def validate_user_input(user_input): responses = ['t', 'r', 'q'] return user_input in responses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isInputValid(self, input):\r\n pass", "def validate_input(user_input: str) -> bool:\n\n if not user_input.islower():\n return False\n\n if user_input.endswith(\"yeet\"):\n return False\n \n if \"q\" or \"Q\" in user_input: # Check if q is a letter\n return False\n \...
[ "0.7979359", "0.7343028", "0.6997487", "0.67979217", "0.6788595", "0.6761745", "0.67489755", "0.66954297", "0.6671437", "0.6651406", "0.6639176", "0.6602737", "0.6528035", "0.64938813", "0.6484191", "0.6462842", "0.6445494", "0.64428204", "0.6433951", "0.6424168", "0.6419654"...
0.80375767
0
Add donor and donation amount to donor dictionatry.
def add_donation(donor, donation_amount, donor_dict): donor_dict.setdefault(donor, []).append(donation_amount)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_donation(self):\n name = self.get_donor()\n # Update existing\n if name in self.all_donors:\n input_donation = int(input(\"Please enter a donation: \"))\n donations = int(self.r.hget(name, 'donations'))\n donations += input_donation\n\n self....
[ "0.7508495", "0.70032024", "0.68972236", "0.6864651", "0.6788043", "0.6714619", "0.6544379", "0.6538843", "0.65385973", "0.6519153", "0.64578503", "0.6412785", "0.63529754", "0.6223426", "0.60587966", "0.5997739", "0.59638566", "0.5864353", "0.5864353", "0.5851722", "0.580614...
0.8338865
0
Print email with donor name and donation amount.
def display_email(donor, donation_amount): print("\nDear {},\n Thank you for your generous donation of ${}. " "We here at the Seattle Toaster Enthusiasts Association " "will use the money to fund our annual pilgrimage to " "Stanley North Dakota, the toaster mecca of the midwest.\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_email(self):\n email_dict = {'donor_name':self.name,\n 'donation_amount':self.last_donation(),\n 'total_amount':self.total_donations()}\n\n # Create formatted email that can be copied & pasted\n email = ('\\n'.join(['Dear {donor_name},',''...
[ "0.7494052", "0.74666184", "0.70844775", "0.70617104", "0.69554836", "0.68940264", "0.6838346", "0.6830946", "0.6789356", "0.66041046", "0.65294826", "0.6522132", "0.6489182", "0.646513", "0.64368844", "0.6427846", "0.6380565", "0.6371538", "0.63009727", "0.6285065", "0.62678...
0.8131426
0
Return sorted list of donors.
def sort_donor_list(donor_list): sorted_list = sorted( donor_list, key=lambda donor: sum(donor_list[donor]), reverse=True) return sorted_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def donor_names(self):\n return list(self.donors)", "def list_donors(self):\n return [donor.name for donor in self.donors]", "def all_donors(self):\n return [item for item in self.r.keys()]", "def sort_donations(self):\n intermed_list = []\n for item in self.donations:\n ...
[ "0.71160483", "0.7068133", "0.7037995", "0.701818", "0.6718538", "0.6578298", "0.6562123", "0.6495291", "0.64889157", "0.64533186", "0.63100153", "0.62594986", "0.62133366", "0.620444", "0.61822283", "0.6161308", "0.61132234", "0.60947376", "0.60909027", "0.6063817", "0.60164...
0.72371894
0
calculates the minimum number of bits a cardinality fits in assume the max bits are 32
def number_bits_in_cardinality(self,card): return 32 - self.count_lead_zs(card)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bit_storing_size(n):\n return -((-n) // 8)", "def _get_nr_of_bits(self):\n return sum(self._size_var)", "def _num_32_bit_words_for_bit_fields(bit_fields):\n num_buckets, cur_bucket = 0, 0\n for field in bit_fields:\n if field.size + cur_bucket > 32:\n num_buckets += 1\n ...
[ "0.72264665", "0.6784838", "0.67456406", "0.6685689", "0.66846687", "0.6517849", "0.6465248", "0.6445661", "0.64269054", "0.6421126", "0.6415093", "0.64109385", "0.6407402", "0.6380993", "0.63640344", "0.6360561", "0.63488674", "0.6340697", "0.63147354", "0.6313916", "0.63111...
0.7505586
0
clone a source symbol to the current instance
def clone(self,source): self.cardinality = source.cardinality self.sax_character = source.sax_character self.wildcardbits = source.wildcardbits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n cdef SymbolTable result = SymbolTable.__new__(SymbolTable)\n result.table = new sym.SymbolTable(self.table[0])\n return result", "def copy_from(self, source):\n\t\tassert ltrace_func(TRACE_BASE)\n\t\tself.name = source.name", "def clone_from(self, source):\n\n if t...
[ "0.6922512", "0.69074273", "0.6616771", "0.6461163", "0.63648504", "0.6343204", "0.6225818", "0.6215719", "0.6205845", "0.6142562", "0.613019", "0.6129232", "0.6114464", "0.60964054", "0.6074465", "0.60679007", "0.6059474", "0.6058359", "0.6058359", "0.6058359", "0.60366386",...
0.7011077
0
Initialize a celeste source object from a celeste_df row
def init_celeste_source_from_df(self, celestedf_row, is_star=None): if is_star in [True, False]: celestedf_row.is_star = is_star params = du.celestedf_row_to_params(celestedf_row) src = self._source_type(params, model=self, imgs=self.images) # add on some more info for tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, df):\n self.df = df", "def __init__(self, df):\n self.original_data = df\n self.preprocessed_data = pd.DataFrame()", "def __init__(self, df):\n self.data = df", "def from_dataframe(cls, df, data_cls):\n pass", "def from_dataframe(cls, dataframe):\n ...
[ "0.6318052", "0.6287097", "0.6159056", "0.6123915", "0.5904711", "0.5873366", "0.5849374", "0.57739514", "0.57281756", "0.56613076", "0.5628908", "0.5582114", "0.558189", "0.558189", "0.5538221", "0.5534507", "0.55192184", "0.5515733", "0.55035", "0.55004627", "0.54787076", ...
0.80212986
0
add a field (run/camcol/field) image information to the model img_dict = fits image keyed by 'ugriz' band init_srcs = sources (tractor or celeste) initialized in this field
def add_field(self, img_dict): for k in img_dict.keys(): assert k in self.bands, "Celeste model doesn't support band %s"%k self.field_list.append(Field(img_dict))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_field(self, field_data):\n def_field = {'id':None,\n 'ref':None,\n 'posx':'0',\n 'posy':'0',\n 'size':'50',\n 'text_orientation':'H',\n 'visible':'V',\n 'text_a...
[ "0.5710676", "0.5497638", "0.54184586", "0.5361319", "0.5347474", "0.5263473", "0.524703", "0.5237913", "0.52199036", "0.5189451", "0.5172501", "0.51476794", "0.51453674", "0.5102692", "0.51013", "0.50968385", "0.5085219", "0.5065007", "0.50641096", "0.50515676", "0.50401753"...
0.7162582
0
return brightest sources (by source type, band)
def get_brightest(self, object_type='star', num_srcs=1, band='r', return_idx=False): fluxes = np.array([s.params.flux_dict[band] for s in self.srcs]) type_idx = np.where(self.source_types == object_type)[0] type_fluxes = fluxes[type_idx] type_idx = type_idx[np.argsort(type_flu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brightest_source(frq=151, sliced_list=catalog.srcs):\n max_obj = sliced_list[0]\n for gleam_obj in sliced_list:\n if gleam_obj.flux_by_frq[frq] > max_obj.flux_by_frq[frq]:\n max_obj = gleam_obj\n print(\"Largest flux value encountered:\", max_obj.flux_by_frq[frq])\n print(\"Name o...
[ "0.6607561", "0.6164541", "0.6067196", "0.57345235", "0.5640365", "0.5539922", "0.55218196", "0.54267144", "0.541707", "0.53260505", "0.528097", "0.5242749", "0.5182124", "0.5177732", "0.51603484", "0.5146035", "0.5126072", "0.5113353", "0.5108828", "0.50990474", "0.50806177"...
0.71598154
0
resample photons store sourcespecific images
def resample_photons(self, srcs, verbose=False): # first, clear out old sample images for src in srcs: src.clear_sample_images() # generate per-source sample image patch for each fits image in # this field. keep track of photons due to noise noise_sums = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Resampler(name):\n\n def resample_average(path, dsquery, dstile, image_format):\n for i in range(1, dstile.RasterCount+1):\n res = gdal.RegenerateOverview(dsquery.GetRasterBand(i), dstile.GetRasterBand(i), \"average\")\n if res != 0:\n raise ImageOutputException(\"RegenerateOverview() failed with er...
[ "0.6751509", "0.60750306", "0.601508", "0.60111654", "0.59917426", "0.58809173", "0.584998", "0.5743221", "0.57146", "0.569997", "0.56717074", "0.5639599", "0.5603953", "0.55748373", "0.55677515", "0.55628645", "0.55563945", "0.5553056", "0.55517864", "0.55487037", "0.5545530...
0.6748826
1
Given an initial source, "source" with a bounding box, find all sources in source_list where their bounding box intersects with "source"'s bounding box. Collect all sources that contribute to this source's background model image
def get_active_sources(source, source_list, image): def intersect(sa, sb, image): xlima, ylima = sa.bounding_boxes[image] xlimb, ylimb = sb.bounding_boxes[image] widtha, heighta = xlima[1] - xlima[0], ylima[1] - ylima[0] widthb, heightb = xlimb[1] - xlimb[0], ylimb[1] - ylimb[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sources(image):\n from scipy import ndimage\n from astropy.stats import mad_std\n\n img1 = image.copy().astype('float32')\n m, s = np.median(image), mad_std(image)\n src_mask = image > m + 3.0 * s\n # set the background to the min value of the sources\n img1[~src_mask] = img1[src_mask...
[ "0.63399184", "0.5802796", "0.54545987", "0.541729", "0.5401223", "0.5358", "0.5306327", "0.5305919", "0.52601194", "0.5211193", "0.52072334", "0.5139423", "0.51375467", "0.51334727", "0.51139283", "0.50835663", "0.505516", "0.5038187", "0.50375575", "0.50116676", "0.5009155"...
0.75503904
0
Check whether an email address is watching an object.
def check_watch(kls, id, email, event_type=None, locale=''): ct = ContentType.objects.get_for_model(kls) kwargs = {'content_type': ct, 'watch_id': id, 'email': email, 'locale': locale} if event_type: kwargs['event_type'] = event_type return EventWatch.uncached.filter(**kwargs).ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEmailUsed(self, email):\n\n\t\ttestq = {\"email\": email};\n\t\ttest_result = self.db.request(\"getOne\", testq);\n\n\t\tif test_result:\n\t\t\treturn True;\n\t\telse:\n\t\t\treturn False;", "def watching(self):\n return self.get() in self._refs", "def has_object_permission(self, request, view, ob...
[ "0.6107086", "0.61063015", "0.6095941", "0.59761345", "0.5868632", "0.58556944", "0.585292", "0.5732046", "0.5728863", "0.57023937", "0.5698885", "0.56671286", "0.5618365", "0.56150615", "0.5568204", "0.55669874", "0.55644435", "0.5563092", "0.55369306", "0.55316216", "0.5521...
0.6465527
0
Destroy a watch on an object. If watch does not exist, return False.
def destroy_watch(kls, id, email, event_type=None, locale=''): ct = ContentType.objects.get_for_model(kls) kwargs = {'content_type': ct, 'watch_id': id, 'email': email, 'locale': locale} if event_type: kwargs['event_type'] = event_type w = EventWatch.objects.filter(**kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_destroy(self) -> bool:\r\n raise NotImplementedError", "def destroy(self):\n return True", "def destroyExternal(self, remoteObject):\r\n if remoteObject == self.__obj:\r\n self.destroy()\r\n return True\r\n\r\n return False", "def cancel_watch():\n ...
[ "0.62754756", "0.5955956", "0.5868036", "0.5828437", "0.5735238", "0.5553308", "0.5533823", "0.5523336", "0.5507208", "0.5486196", "0.5424214", "0.5418747", "0.5418747", "0.5361335", "0.5355246", "0.5303378", "0.52623045", "0.5161526", "0.5125425", "0.5107519", "0.5049215", ...
0.5982804
1
Initializes the values dictionary for the specified section.
def __init__(self, section): self.values = section
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fill_section_dict(self, dictionary, section, keys=[], streams=1):\n\t\t# if there is no stream, we just place a note in the dictionary\n\t\tif streams == 0:\n\t\t\tdictionary[section] = 'No stream'\n\t\t\treturn dictionary\n\n\t\t# otherwise we have to fill one subdictionary per stream\t\t\n\t\tfor i in range...
[ "0.64017636", "0.6107499", "0.58912754", "0.57488894", "0.56328344", "0.5587617", "0.5584594", "0.54791665", "0.544328", "0.53737956", "0.5343547", "0.5333064", "0.5323612", "0.531561", "0.5300138", "0.52883494", "0.5287598", "0.52874094", "0.5277978", "0.52705735", "0.526756...
0.7376099
0
The correct class method to obtain the singleton instance of Config.
def get_instance(cls): if not cls._instance: cls._instance = Config() return cls._instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance", "def config():\n return Config()", "def config():\n return Config()", "def get_instance() -> Config:\n if not Config.__instance__:\n o...
[ "0.86490566", "0.78078085", "0.78078085", "0.77745426", "0.7647158", "0.7623508", "0.7582533", "0.74804014", "0.74308735", "0.73483384", "0.7274086", "0.71842724", "0.71819735", "0.71663284", "0.71663284", "0.71663284", "0.71663284", "0.71663284", "0.71663284", "0.71663284", ...
0.81780726
1
Resolves/Returns a value from a specified section and a key.
def resolve(self, section, key): return self.sections[section][key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self, in_section=str(), in_key=str()) -> Any:\n if in_section in self.__return_map.keys():\n if in_key in self.__return_map.get(in_section).keys():\n return self.__return_map.get(in_section).get(in_key)\n\n return None", "def __getitem__(self, key):\n ...
[ "0.6781236", "0.6736435", "0.6483189", "0.6275725", "0.6275108", "0.61450607", "0.61202466", "0.61098176", "0.6060869", "0.5912707", "0.58981955", "0.58779114", "0.5876569", "0.5857488", "0.58354527", "0.58303", "0.5821721", "0.577139", "0.57196397", "0.5710267", "0.5710064",...
0.8441994
0
Return a cfg dict containing a db prepopulated with 10 nearly identical factoids The only difference is id.
def cfg_10_identical_factoids(mockcfg): Factoid = mockcfg["db"].entities["Factoid"] with orm.db_session(): for i in range(1, 101): data = { "@id": "F{:03d}".format(11 - i), "createdBy": "Creator 1", "createdWhen": datetime.datetime(2015, 1, 1)....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_db():", "def defaultconfig(self):\r\n\r\n config_data = {\r\n \"path_to_database\": \"FUDB/FOLLOWUP.DB\",\r\n \"path_to_frontend\": \"FUDB/\",\r\n \"path_to_dcs_info\": \"FUDB/\",\r\n \"path_to_bin\": \"bin/\",\r\n \"pat...
[ "0.6318034", "0.5625199", "0.5595317", "0.5581888", "0.55571896", "0.5533229", "0.5471945", "0.5468151", "0.54543424", "0.5430461", "0.53637934", "0.5325484", "0.53159976", "0.5307205", "0.5294863", "0.5281337", "0.5266666", "0.5261725", "0.5257115", "0.5245701", "0.52363616"...
0.67613614
0
Provides the reactive frontend
def frontend(request: HttpRequest) -> HttpResponse: return render(request, "frontend/base.html", {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n self.render_front()", "def ui(self):\n return ui", "def main():\r\n return render_template(\"UI.html\")", "def controls():\n return render_template(\"controls/controls.html\")", "def get_frontend(self):\n servers = self.get_frontends()\n assert servers, \"...
[ "0.60004795", "0.58342993", "0.5755755", "0.56324667", "0.5516678", "0.55063325", "0.5504352", "0.5487491", "0.5487491", "0.54707456", "0.5466322", "0.5448678", "0.5448638", "0.5444742", "0.5438025", "0.54327214", "0.5402335", "0.53761554", "0.5369238", "0.5361649", "0.530071...
0.6215078
0
whatever arguments g is supplied, pass them through to f
def g(*args, **kwargs): print "*args :" print args print "**kwargs :" print kwargs return 2 * f(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g():", "def fG(self):\n pass", "def both(f, g):\n def say(score0, score1):\n return both(f(score0, score1), g(score0, score1))\n return say", "def f(a, b):", "def doubler_correct(f):\n def g(*args, **kwargs):\n \"\"\"whatever arguments g is supplied, pass them through to f...
[ "0.7128418", "0.6589972", "0.6545905", "0.6483205", "0.6384204", "0.6329086", "0.61682737", "0.61640275", "0.6125645", "0.60679084", "0.602055", "0.602055", "0.59499735", "0.5904644", "0.5897822", "0.5890254", "0.58226633", "0.5797996", "0.57459503", "0.5721009", "0.570922", ...
0.7366032
0
Sets the number of rows, and columns, also initializes the list of squares cleans
def __init__(self, rows: int = 1, columns: int = 2): super().__init__() self.__squares = [[Floor._clean for i in range(columns)] for j in range(rows)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.rows = None\n self.columns = None\n self.squares = None\n # max is useful as a way to track range for iteration, and also as a way\n # to track the maximum number in any spot.\n self.max = 0", "def __init__(self, size, given_cells):\n se...
[ "0.6878316", "0.68263984", "0.67410505", "0.66670257", "0.665368", "0.66346514", "0.6631932", "0.651728", "0.65080005", "0.65080005", "0.65080005", "0.65069294", "0.6500104", "0.6474858", "0.645611", "0.6451403", "0.64415956", "0.64415956", "0.6441014", "0.6431781", "0.641291...
0.7394635
0
Returns the list of squares
def squares(self) -> list: return self.__squares
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_squares(self):\n squares_lst = []\n row, col = 0, 0\n while row < self.board_size:\n while col < self.board_size:\n square = self.add_square(row, col)\n squares_lst.append(square)\n col += self.c_size\n row += self.r_s...
[ "0.8269525", "0.7885707", "0.78549707", "0.7667481", "0.76411295", "0.7637544", "0.7627698", "0.75142777", "0.74460745", "0.7321256", "0.7217469", "0.7084724", "0.7050701", "0.6999946", "0.6940583", "0.69208527", "0.6920305", "0.68529856", "0.6828635", "0.67976826", "0.674224...
0.83499897
0
Returns True if the floor of the room is dirty, otherwise False, if the row or column does not exist it throws an exception of type ErrorValue
def is_dirty(self, row: int, column: int) -> int: return 1 if self.__squares[row][column] == Floor._dirty else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self):\n if self.get_row() != -1 and self.get_column() != -1:\n return True\n else:\n return False", "def _check_occupied(self, col, row):\n if self.board[row - 1][col - 1] == EMPTY:\n return False\n else:\n return True", "def...
[ "0.6817107", "0.6212588", "0.6095775", "0.6038184", "0.60086036", "0.58937573", "0.5883348", "0.58525366", "0.5849999", "0.5797153", "0.57900304", "0.5774223", "0.5740969", "0.5708654", "0.57017034", "0.5701092", "0.5672823", "0.56613964", "0.5657549", "0.5624911", "0.5624911...
0.77172345
0
Cleans the floor of a room, if the row or column does not exist it throws an exception of type ErrorValue
def clean_square(self, row: int, column: int) -> None: self.__squares[row][column] = Floor._clean
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatePositionAndClean(self):\n #X direction (num. rows) wall limit is the width of rectangular room\n #Y direction (num. cols) wall limit is the height of rectangular room\n #So (0,0) is in bottom LEFT corner--since rows start at zero at BOTTOM, not top\n #direction works as you wo...
[ "0.5899042", "0.5685498", "0.5672632", "0.5614197", "0.55412954", "0.5491456", "0.5426389", "0.53508824", "0.5341952", "0.53339857", "0.5284222", "0.52741313", "0.52462304", "0.5235767", "0.5235078", "0.5192523", "0.51497644", "0.51288223", "0.512652", "0.51212054", "0.511169...
0.6362954
0
Converts the NodeXMLFormatter object to an instance of the Node model.
def to_model(self): node = Node.objects.get_or_create( name=self.name, description=self.description )[0] return node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_node(cls, obj):\n if isinstance(obj, cls):\n return obj\n elif is_string(obj):\n # Assume filepath.\n return FileNode(obj)\n elif obj is None:\n return obj\n else:\n raise TypeError(\"Don't know how to convert %s to Node inst...
[ "0.6461898", "0.59501135", "0.5938948", "0.5907918", "0.581737", "0.57266885", "0.57264614", "0.5676728", "0.5670979", "0.5602469", "0.55902135", "0.55887836", "0.5583109", "0.55772483", "0.5562262", "0.5556643", "0.55405396", "0.5535847", "0.5533974", "0.55142635", "0.549796...
0.6676547
0
Symmetrically pad image with constant ``pad_value`` to obtain square image.
def pad_to_square(img_t: torch.Tensor, pad_value: float = 0 ) -> Tuple[torch.Tensor, Tuple[int, int, int, int]]: if len(img_t.shape) == 3: _, height, width = img_t.shape elif len(img_t.shape) == 2: height, width = img_t.shape else: raise ValueError("Wrong image shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_to_square(image, min_size, **pad_kwargs):\n\n h, w = image.shape[:2]\n\n if h >= min_size and w >= min_size:\n return image\n\n top = bottom = left = right = 0\n\n if h < min_size:\n top = (min_size - h) // 2\n bottom ...
[ "0.7438983", "0.706913", "0.69397676", "0.6717907", "0.6487376", "0.644641", "0.63947856", "0.6394612", "0.6323862", "0.63060987", "0.62543195", "0.6251084", "0.6170857", "0.6157992", "0.61550736", "0.61489666", "0.6144223", "0.6112948", "0.605924", "0.60216105", "0.59898394"...
0.7703733
0
Interpolation to use for the resizing.
def interpolation(self) -> int: return self._interpolation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolation(self):\n return self._image.interpolation", "def interpolation(self):\n return self._interpolation", "def GetInterpolation(self, *args, **kwargs):\n pass", "def SetInterpolation(self, *args, **kwargs):\n pass", "def interpolate(self, image):\n return", ...
[ "0.6862421", "0.67051554", "0.66868347", "0.6675438", "0.65176684", "0.6433487", "0.6390173", "0.6389773", "0.6385963", "0.6005822", "0.5961178", "0.5899193", "0.58686846", "0.5786912", "0.57550836", "0.5739371", "0.57344615", "0.5728818", "0.57154495", "0.5625937", "0.562574...
0.6812813
1
Forward method in which to apply the trafo and thresholding. Prethreshold, modify, and postthreshold given mask(s). The thresholding is applied, if the corresponding
def __call__(self, masks: torch.Tensor) -> torch.Tensor: if self.pre_thresholder is not None: masks = self.pre_thresholder(masks) if not self.batch_wise: masks: torch.Tensor = masks.unsqueeze(0) modified_masks: torch.Tensor = self.trafo(masks) if not self.batch_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x, mask):\n context_vector, attn_weights = self.self_mha(x, x, x, mask)\n x = self.layer_norm1(\n F.dropout(x + context_vector, self.dropout, training=self.training))\n\n x = self.layer_norm2(\n F.dropout(x + self.ffn(x), self.dropout, training=self.trai...
[ "0.6316641", "0.624907", "0.57780576", "0.5774649", "0.5764702", "0.5745862", "0.57319003", "0.57285935", "0.56915194", "0.56798923", "0.56551117", "0.56172776", "0.5616601", "0.56086147", "0.5605365", "0.56027544", "0.5601907", "0.5597806", "0.5569607", "0.55548793", "0.5539...
0.6509515
0
Move ``tens`` tensor to the configured device.
def __call__(self, tens: torch.Tensor): return tens.to(self.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tensor(tens: Tensorable, device='cpu') -> torch.Tensor:\n if isinstance(tens, torch.Tensor):\n return tens\n return torch.Tensor(tens).to(device)", "def to(self, device):\n for item in self.data:\n if torch.is_tensor(item):\n item.to(item)\n else...
[ "0.5660149", "0.5313678", "0.52696735", "0.50786", "0.50667024", "0.5044768", "0.4843993", "0.4843944", "0.48334154", "0.48139262", "0.4801744", "0.47604313", "0.47573864", "0.4742376", "0.47310045", "0.47277507", "0.47152445", "0.4705565", "0.46590734", "0.46470731", "0.4607...
0.66221935
0
Get score for given integral image array.
def get_score(self, int_img): score = 0 if self.type == FeatureType.TWO_VERTICAL: first = ii.sum_region(int_img, self.top_left, (self.top_left[0] + self.width, int(self.top_left[1] + self.height / 2))) second = ii.sum_region(int_img, (self.top_left[0], int(self.top_left[1] + self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_score(arr, angle):\n data = inter.rotate(arr, angle, reshape=False, order=0)\n hist = np.sum(data, axis=1)\n score = np.sum((hist[1:] - hist[:-1]) ** 2)\n return score", "def get_score(self, solution: np.array) -> float:\n pass", "def _compute_score(img_binary: np.ndarray, s: float)...
[ "0.6570716", "0.61750484", "0.613723", "0.59677094", "0.5933514", "0.5926071", "0.5922975", "0.5788778", "0.57714677", "0.57675093", "0.5666342", "0.5610269", "0.56097615", "0.5585386", "0.55841637", "0.5576786", "0.5557623", "0.55392784", "0.55042106", "0.5503934", "0.549049...
0.6954179
0
Get vote of this feature for given integral image.
def get_vote(self, int_img): score = self.get_score(int_img) return self.weight * (1 if score < self.polarity * self.threshold else -1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getIntFeature(self):\n\n # create args\n valueToGet = c_int64()\n\n errorCode = VimbaDLL.featureIntGet(self._handle,\n self._name,\n byref(valueToGet))\n if errorCode != 0:\n raise VimbaE...
[ "0.57404464", "0.57267016", "0.56636065", "0.55443347", "0.55070406", "0.5464179", "0.5460809", "0.5402727", "0.5386541", "0.53574616", "0.5319061", "0.5227346", "0.5227346", "0.5212558", "0.5194332", "0.5168318", "0.50867814", "0.508197", "0.5074384", "0.5070799", "0.5053127...
0.7510949
0
Builds an initial dictionary, just with directory name and its size. Returns a dictionary with list as a value.
def builddictionary(dirlist): init_dictionary={} for string in dirlist: splitstring=string.split("\t") if len(splitstring) == 2: init_dictionary[splitstring[1].strip("\n")] = [int(splitstring[0]), 0] return init_dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_stat_dic(stat_id, data_directories):\n station_dic = {}\n total_dim = []\n for d,i in data_directories.items():\n files = os.listdir(i)\n for f in files:\n Id = f.split('_'+d)[0]\n if Id == stat_id:\n if d not ...
[ "0.64317083", "0.6129734", "0.59935033", "0.5906379", "0.5903641", "0.58926314", "0.5888912", "0.5844981", "0.58379143", "0.5773314", "0.5679448", "0.566208", "0.56548357", "0.56207246", "0.5608621", "0.5608046", "0.5601262", "0.55769926", "0.555732", "0.5555636", "0.55360043...
0.62564236
1
Cleans a dictionary up, removing parent directories with duplicate data for them, leaving only directories that changed.
def cleanup(dict): from itertools import groupby from operator import itemgetter tuplelist = [] for dirname, data in groupby(sorted(dict.items(),key=itemgetter(1)),key=itemgetter(1)): data = list(data) mx = max(data,key=lambda x:len(x[0])) tuplelist += [x for x in data if len(x[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_dictionary_clear(d):\n for key in list(d):\n if isinstance(d[key], dict):\n recursive_dictionary_clear(d[key])\n\n if d[key] == \"\" or d[key] == {}:\n del d[key]", "def data_clean_up(dict_of_dfs, outdir):\n # rvs_to_...
[ "0.63620996", "0.60965484", "0.5918594", "0.59049326", "0.5871248", "0.58565223", "0.5832315", "0.579622", "0.57943666", "0.57544166", "0.57085323", "0.5701595", "0.5678628", "0.56445706", "0.5629633", "0.56238925", "0.5622825", "0.5610778", "0.5609478", "0.5595599", "0.55888...
0.70737034
0
Prune features whose correlation score is above a given threshold.
def prune_corr_features(X_feat, threshold): feats = list(set(feat for f_set in X_feat for feat in f_set)) num_before = len(feats) step = 2000 for k in range(5): to_keep = set() random.shuffle(feats) for i in range(0, len(feats), step): size = min(step, len(feats) - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_correlated_features(x, threshold=0.9):\n x_copy = np.copy(x)\n \n corr_matrix = np.corrcoef(x_copy, rowvar=False)\n # Set to False highly correlated columns\n nb_col = len(corr_matrix)\n columns = np.full((nb_col,), True, dtype=bool)\n for i in range(nb_col):\n for j in range...
[ "0.71646625", "0.69492567", "0.66253006", "0.6593147", "0.6495919", "0.6414996", "0.632642", "0.62061864", "0.61500806", "0.61159605", "0.6099869", "0.60162574", "0.5921103", "0.5836404", "0.5829031", "0.5768273", "0.5731205", "0.5721981", "0.5694327", "0.5686231", "0.5667504...
0.76357895
0
Return a list of indices that will be affected when painting at the given position. If ``position`` is not specified, it is assumed to be the origin.
def indices(self, position=None): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position(self):\n return self._pos.to_list()", "def position_to_index(self, position, grid_size):\n x, y = position\n return x * grid_size + y", "def calcSubIndices(self, position):\n ratios = (position - self._minPosition)\n ratios /= self._halfDims\n subIndices =...
[ "0.6211723", "0.62090737", "0.6200937", "0.619704", "0.6058277", "0.6018042", "0.5992041", "0.5921562", "0.5854983", "0.5845575", "0.5837964", "0.58091956", "0.5769953", "0.5736498", "0.5736476", "0.57310563", "0.56805414", "0.566974", "0.5648781", "0.5648487", "0.5643726", ...
0.7316036
0
Verify the keystore file and directory
def _verify_keystore(self): keystore_uid = FileUtil(self.keystore_file).uid() if keystore_uid not in (-1, HostInfo.uid): raise IOError("not owner of keystore: %s" % self.keystore_file) keystore_dir = os.path.dirname(self.keystore_file) if FileUtil(keystore_dir).uid() != HostI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_opts(self):\n self.ca_cert_file = os.environ['HOME'] + '/.cat_installer/ca.pem'\n self.pfx_file = os.environ['HOME'] + '/.cat_installer/user.p12'\n if not os.path.isfile(self.ca_cert_file):\n print(Messages.cert_error)\n sys.exit(2)", "def verify (self, path...
[ "0.6201481", "0.5993226", "0.59332156", "0.58958596", "0.5819025", "0.57155925", "0.566656", "0.562736", "0.5623745", "0.5585482", "0.55580485", "0.5514019", "0.549556", "0.54786116", "0.54786116", "0.547791", "0.54653835", "0.5459613", "0.5443938", "0.54259336", "0.54120564"...
0.75544286
0
Get credential from keystore for given url
def get(self, url): auths = self._read_all() try: self.credential = auths[url] return self.credential["auth"] except KeyError: pass return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credential_get(uniqueID: str):\n\n cert = safeisland.certificate(uniqueID)\n return {\"payload\": cert}", "def get_ssl_certificate():", "def get_ssl_certificate() :", "def get_credential(self, key):\n return self.creds.get(key, '')", "def get_credentials(key):\n with open(\"credentials....
[ "0.6387216", "0.6368557", "0.6185664", "0.58744323", "0.5864043", "0.58523196", "0.5837761", "0.5830516", "0.5760828", "0.5742771", "0.5692614", "0.56781346", "0.5676719", "0.56597006", "0.5616557", "0.5609421", "0.56065726", "0.56043714", "0.56017315", "0.5596782", "0.558195...
0.6912512
0
Put credential in keystore for given url
def put(self, url, credential, email): if not credential: return 1 auths = self._read_all() auths[url] = {"auth": credential, "email": email, } self._shred() return self._write_all(auths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, credential):\n pass", "def set_credentials():", "def injectPassword(url, httpCredentials):\n url = urlparse(url)\n\n # Only do this for HTTP URLs for which we have credentials\n if (\n url.scheme.startswith(ProtocolType.HTTP.value)\n and url.hostn...
[ "0.6042651", "0.58238924", "0.5521307", "0.5515872", "0.5485544", "0.5354821", "0.5317913", "0.5234732", "0.523063", "0.5222448", "0.5218145", "0.51993984", "0.5184724", "0.51704127", "0.51523966", "0.5114277", "0.5083231", "0.50800633", "0.5076598", "0.5052661", "0.50402695"...
0.6396992
0
Delete credential from keystore for given url
def delete(self, url): self._verify_keystore() auths = self._read_all() try: del auths[url] except KeyError: return 1 self._shred() return self._write_all(auths)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_credential(credentials):\n credentials.delete_credentials()", "def _delete_credential(self, key):\n try:\n del self._data[key]\n except KeyError:\n pass\n self._write()", "async def delete_url(self, url: StrOrURL):\n await self.delete(self.create_...
[ "0.6958643", "0.6620609", "0.64928526", "0.6304529", "0.627589", "0.6181416", "0.6139326", "0.6083812", "0.59728557", "0.5962097", "0.5958842", "0.5955593", "0.59546417", "0.59232026", "0.58883035", "0.58883035", "0.58883035", "0.5882123", "0.5849173", "0.5834461", "0.5814376...
0.8057114
0
Checks if the given API response is an error, and then raises the appropriate exception.
def check_error(self, response): if type(response) is dict and response.has_key('status_code'): if response['status_code'] != 200: raise rocket.RocketAPIException(response['status_code'], response['status_text'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_api_error(self, response):\n code = response.status_code\n self.__log(f'Handling API error with status code {code}.', 'error')\n if code == 401:\n self.__log(f'Invalid credentials. Please make sure your token is correct.', 'error')\n raise InvalidCredentialsErr...
[ "0.8030815", "0.78007025", "0.7488525", "0.74808234", "0.74602336", "0.74405646", "0.742001", "0.7412156", "0.72705823", "0.7199109", "0.7192201", "0.71805555", "0.71575356", "0.71509993", "0.71265465", "0.7107663", "0.70696384", "0.70497006", "0.70292777", "0.6981177", "0.69...
0.79649657
1
Find the first text between given pair of tags, returns both the text and position
def find_text_in_tag(st, tag): if tag == "e1": st = st.replace("<e2>", "") st = st.replace("</e2>", "") elif tag == "e2": st = st.replace("<e1>", "") st = st.replace("</e1>", "") for i in range(len(st) - (len(tag)+2) + 1): # +2 is for < and > if st[i:i+len(tag)+2] ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_contents(html, *tags):\n # return the stuff in between the first tag found or None\n x = get_contents(html, *tags)\n if not x:\n return None\n return x[0]", "def find_start_end(text, start_text, end_text, start=0):\n # return (s, e) or None\n s = text.find(start_text, start...
[ "0.65704864", "0.64493614", "0.64232105", "0.6385036", "0.6361685", "0.62540066", "0.6239112", "0.6164878", "0.61506945", "0.61237997", "0.5998363", "0.5797227", "0.5793289", "0.57594854", "0.57333", "0.5728678", "0.5694469", "0.56718785", "0.5658322", "0.5646367", "0.5640704...
0.73444617
0
Make a data.com specific auth http request. Adds additional headers Raises BadAuthentication exception if the response is a 400 or 500level response.
def auth_http_request(method, uri, **kwargs): kwargs["headers"] = _get_datacom_headers(method, kwargs.get("headers")) logger.debug("auth request headers: %s" % kwargs["headers"]) resp = make_http_request(method, uri, **kwargs) if not resp.ok: raise BadAuthentication(resp.status_code, resp.ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_auth(self, http_request):\r\n pass", "def __call__(self, request):\n self._logger.debug(f'__call__, {request.url} adding Authorization header')\n request.headers[\"Authorization\"] = self._get_auth_value()\n request.register_hook(\"response\", self._handle_401)\n return...
[ "0.665069", "0.6581979", "0.6573325", "0.65479815", "0.6466093", "0.6465924", "0.6384124", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "0.6361779", "...
0.7463226
0
Install a mock Python script that can be called as an external program. text content of the script without the interpreter (!...) line path optional target path (including the script's file name) name optional script's file name, put it in a temporary directory on_path whether to make the script available on the binary...
def install(text, path=None, name=None, on_path=False, env=None): if path is not None: tmp_paths.append(path) file_ = open(path, 'w') elif name is not None: directory = tempfile.mkdtemp() tmp_paths.append(directory) path = os.path.join(directory, name) file_ = ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_start_script_tmp_py(tmp_path: Path) -> Path:\n tmp_file = shutil.copy(Path(pre_start_module.__file__), tmp_path)\n return Path(tmp_file)", "def pre_start_script_tmp_sh(tmp_path: Path) -> Path:\n tmp_file = tmp_path / \"prestart.sh\"\n with open(Path(tmp_file), \"x\") as f:\n f.write('e...
[ "0.62975913", "0.62420475", "0.5760374", "0.56799525", "0.5622587", "0.550792", "0.5498481", "0.5466002", "0.54401475", "0.54278964", "0.5374592", "0.5362588", "0.53110266", "0.5258041", "0.5247601", "0.52420473", "0.52388513", "0.52318", "0.52104723", "0.5209367", "0.5198645...
0.6845354
0
Scriptsrelated test teardown handler. Scripts created by the test are removed on teardown. The environment is reset to its state before the test run.
def teardown_scripts(test=None): for key, value in original_environ.iteritems(): if value is None: del os.environ[key] else: os.environ[key] = value original_environ.clear() for path in tmp_paths: if os.path.isdir(path): shutil.rmtree(path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n test_env_teardown()", "def tearDown(self):\n tests.utils.cleanup_environment()", "def tearDown(self):\n tests.utils.cleanup_environment()", "def teardown_test_env():\n if not keep_tmp_dirs:\n print('\\nCleaning up temporary directories...')\n ...
[ "0.7965651", "0.7953725", "0.7953725", "0.78178906", "0.74833065", "0.73717785", "0.7350228", "0.7350228", "0.7350228", "0.73106354", "0.7263392", "0.7243588", "0.7243588", "0.7243588", "0.72310805", "0.72310805", "0.71890324", "0.71890324", "0.71752936", "0.7117237", "0.7117...
0.79659957
0