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
Validates if the type is from a source file
def _validate_source(self, tipo): self.source_type = True self._get_source(tipo) return self.source_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _source_is_valid_filename(self):\n filename = self.source\n if not filename_is_valid(filename):\n raise BadFilenameError(f\"{repr(filename)} must be a valid filename.\")\n return True", "def check_source(self,source): \n\n kind = None\n if os.path.exists(sourc...
[ "0.7174766", "0.66878134", "0.6357702", "0.6338886", "0.6260916", "0.6251716", "0.62056655", "0.6107927", "0.60888946", "0.6074954", "0.59980786", "0.5981854", "0.59323364", "0.5921084", "0.5913373", "0.5882852", "0.5839688", "0.5823543", "0.58104795", "0.58091897", "0.580363...
0.7357
0
Validates if the type is a built in type
def _validate_built_in(self, tipo): self.source_type = False self.source_file = "builtin" return tipo in self.c_built_ins or self._match_array(tipo, self.c_built_in_array_types)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_type(self):\n return True", "def CheckType(self, *args, **kwargs):\n pass", "def checkType(self, value):\n pass", "def is_builtin_type(tp):\n return hasattr(__builtins__, tp.__name__) and tp is getattr(__builtins__, tp.__name__)", "def has_numeric_type(obj: _std_typing.Any) ->...
[ "0.657619", "0.6365678", "0.63017386", "0.62287676", "0.6220979", "0.61753297", "0.59689057", "0.5967265", "0.590851", "0.587344", "0.5867401", "0.5852356", "0.5839391", "0.57862073", "0.57775766", "0.572234", "0.57068986", "0.5701822", "0.57003397", "0.56933826", "0.56298506...
0.6947822
0
Gets the source file of the type received
def _get_source(self, tipo): if self._match_array(tipo, self.c_array_types): tipo = tipo.strip()[:-4] db = Database() query = "SELECT type_source FROM types WHERE type_name = '" + tipo + "' ORDER BY type_id" self.source_file = list(db.execute_query(query)) if self.so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source_file(self):\n return self.get_attribute(\"source_file\")", "def _read_source(self):\n \n if self.fileType == FTPythonCompiled or \\\n self.fileType == FTCompiledModule:\n return None\n \n filename = Filename(self.filename)\n filename.s...
[ "0.73272264", "0.7236559", "0.7223953", "0.7102479", "0.70602846", "0.6986089", "0.6823715", "0.6752897", "0.6727875", "0.667203", "0.6652456", "0.65614897", "0.6507218", "0.6507218", "0.6507218", "0.6505893", "0.64898735", "0.64537156", "0.6451514", "0.6401143", "0.63930005"...
0.7374549
0
Gets all types from the database and adds their arrays types for regex
def _get_types(self): db = Database() self.c_built_ins = list(map(lambda tup: tup[0], db.select_built_types())) self.c_built_in_array_types = r'^(' + '|'.join(self.escaped(self.c_built_ins)) + ')\[[0-9]*\]' self.c_types = list(map(lambda tup: tup[0], db.select_types())) self.c_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_types():\n\n return ...", "def type_array():\n return []", "def initTypes(self):\n self.types = [ty.NoneType]*self.numcols()\n for k,row in enumerate(self.data):\n for i in range(self.numcols()):\n val = row[i]\n typ = self.types[i]\n if not val is None:\n ...
[ "0.6146519", "0.6131372", "0.60792404", "0.60579497", "0.6030948", "0.6011866", "0.588906", "0.58150595", "0.58094645", "0.5729863", "0.5726068", "0.56859285", "0.5676487", "0.56462157", "0.5631576", "0.5625601", "0.562282", "0.5574887", "0.5560313", "0.54822886", "0.5478746"...
0.75914145
0
Get the total number of twitter shares for the given URL
def twitter_shares_for_url(url): score = 0 response = requests.get(TWITTER_URL % url) response_dict = json.loads(response.text) try: score = int(response_dict['count']) except KeyError: pass return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_shares_for_url(url):\n score = 0\n response = requests.get(FB_URL % url)\n response_dict = json.loads(response.text)\n try:\n if type(response_dict) == dict:\n score = int(response_dict['shares'])\n except KeyError:\n pass\n return score", "def how_many_ent...
[ "0.739951", "0.7072477", "0.6942618", "0.67430437", "0.669603", "0.65858954", "0.64467835", "0.6400534", "0.63503003", "0.63372844", "0.6166291", "0.60952526", "0.606697", "0.6055716", "0.6029988", "0.59516454", "0.5950518", "0.5934856", "0.5897824", "0.5864289", "0.5856458",...
0.85031635
0
Get the total number of facebook shares/likes/comments for the given URL
def facebook_shares_for_url(url): score = 0 response = requests.get(FB_URL % url) response_dict = json.loads(response.text) try: if type(response_dict) == dict: score = int(response_dict['shares']) except KeyError: pass return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_shares_for_url(url):\n score = 0\n response = requests.get(TWITTER_URL % url)\n response_dict = json.loads(response.text)\n try: \n score = int(response_dict['count'])\n except KeyError:\n pass\n return score", "def how_many_entries(URL):\n\treturn len(get_lottery_numb...
[ "0.7676567", "0.6868698", "0.6840944", "0.6612578", "0.6485453", "0.639028", "0.6354728", "0.63326406", "0.6316389", "0.62877893", "0.6265372", "0.61706656", "0.6138156", "0.6113998", "0.6080651", "0.6044069", "0.5964712", "0.5929078", "0.587874", "0.58615655", "0.58345157", ...
0.7924688
0
Request User RDR API token and return as a header
def get_token(): token = getpass.getpass('Paste in your RDR API token and press Enter:') return {'Authorization': 'token ' + token}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UserToken(self) -> object:", "def __call__(self, r):\n r.headers[\"x-aims-auth-token\"] = self._token\n return r", "def auth_token(self):", "async def token(request: Request):\n return get_token()", "def _request_token(self):\n params = {\n 'grant_type': 'client_crede...
[ "0.69176465", "0.6896574", "0.68764466", "0.68598497", "0.6855822", "0.678444", "0.6733792", "0.67233014", "0.67170846", "0.6641916", "0.6633266", "0.6607942", "0.65470153", "0.65324295", "0.65324295", "0.6527949", "0.65198976", "0.6503413", "0.6484114", "0.6461325", "0.64546...
0.79591274
0
Check that documentation exists for all classes and methods in the BaseModel
def check_documentation(self): self.assertIsNotNone(BaseModel.__doc__) self.assertIsNotNone(__init__.__doc__) self.assertIsNotNone(__str__.__doc__) self.assertIsNotNone(save.__doc__) self.assertIsNotNone(to_dict.__doc__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_method_docs(self):\n for func in dir(BaseModel):\n self.assertTrue(len(func.__doc__) > 0)", "def test_method_docs(self):\n for func in dir(Base):\n self.assertTrue(len(func.__doc__) > 0)", "def test_method_docs(self):\n for func in dir(User):\n sel...
[ "0.84785515", "0.8169618", "0.773754", "0.7697662", "0.7697662", "0.7630952", "0.75558263", "0.75516903", "0.75432193", "0.7476511", "0.740801", "0.73941696", "0.7197659", "0.71362513", "0.7084509", "0.7054553", "0.7039922", "0.70288074", "0.69457877", "0.69297904", "0.682718...
0.82588404
1
Test that instance and attributs created.
def test_instance_created(self): base_model = BaseModel() self.assertIsInstance(base_model, BaseModel) self.assertTrue(hasattr(base_model, "created_at")) self.assertTrue(hasattr(base_model, "updated_at"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_attributes(self):\n pass", "def test_attributes(self):\n self.assertTrue(hasattr(User()), \"email\")\n self.assertTrue(hasattr(User()), \"password\")\n self.assertTrue(hasattr(User()), \"first_name\")\n self.assertTrue(hasattr(User()), \"last_name\"...
[ "0.7426661", "0.7251162", "0.7231642", "0.7208298", "0.7120515", "0.71079254", "0.7095642", "0.7079545", "0.7036153", "0.7019149", "0.7018042", "0.6919388", "0.68862736", "0.68728644", "0.6859673", "0.68308794", "0.6810888", "0.6808403", "0.6781981", "0.6777138", "0.6773772",...
0.72945344
1
Test that id attribute is a string type.
def test_id_type(self): base_model = BaseModel() self.assertTrue(base_model.id, str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_party_info_id_is_string(self):\n self.party_test_data[\"id\"] = \"1\"\n response = validate_party_info(self.party_test_data)\n self.assertDictEqual(\n response, {\"message\": \"id must be a number\", \"code\": 400})", "def test_graphid_str():\n id1 = _ir.Graph...
[ "0.6963385", "0.6949618", "0.68238723", "0.67725116", "0.6750169", "0.6725657", "0.6655507", "0.66454315", "0.66347706", "0.65763247", "0.653278", "0.6509737", "0.6498133", "0.6469768", "0.64576846", "0.6448819", "0.64243674", "0.6359721", "0.6355913", "0.63335735", "0.629412...
0.7409998
0
Loads a positive samples dataset.
def load_positive_dataset( filenames, positive_batch_size, walk_length ): positive_example_parser = PositiveExampleParser(walk_length) ds = tf.data.Dataset.from_tensor_slices(filenames) ds = ds.shuffle(len(filenames)) ds = ds.interleave( tf.data.TFRecordDataset, cycle_length=tf.data.AUTOTUNE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_rand_data(positive_data, negative_file):\n if isinstance(positive_data, pathlib.Path):\n pos_recs = io.read_example_file(positive_data)\n kmer = None\n x_data = []\n y_data = []\n for rec in pos_recs:\n if kmer is None:\n kmer = len(rec)\n ...
[ "0.65644485", "0.6306578", "0.6272619", "0.6269299", "0.62478495", "0.62195635", "0.6171813", "0.61380607", "0.61123437", "0.6110873", "0.6110666", "0.60558224", "0.60301673", "0.5961915", "0.59596187", "0.5941354", "0.591559", "0.58811194", "0.5848775", "0.58427143", "0.5793...
0.7315732
0
Inject random uniform negative sampling into the tf.data.Data pipeline. This function assumes the input node id space has been compressed on [0, num_nodes1].
def add_uniform_random_negatives( ds, num_nodes, num_negs_per_pos, ): negative_sampler = RandomUniformNegativeSampler(num_nodes, num_negs_per_pos) return ds.map( negative_sampler, deterministic=False, num_parallel_calls=tf.data.AUTOTUNE )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_uniform_negative_sampling(\n self, num_samples, exclude_self_loops=True, replace=False, etype=None\n ):\n raise NotImplementedError(\n \"global_uniform_negative_sampling not implemented yet\"\n )", "def negative_sampling(batch, num_nodes, head_corrupt_prob, device='c...
[ "0.6388557", "0.63630354", "0.6349355", "0.6115627", "0.59418845", "0.5849411", "0.5791008", "0.5723457", "0.57226485", "0.5696797", "0.55771077", "0.5544813", "0.5534957", "0.5519084", "0.5518299", "0.5464507", "0.54560405", "0.5447778", "0.5434709", "0.5386394", "0.535264",...
0.7174944
0
Initialize expected edge score callable.
def __init__( self, weights, edge_score_norm ): self.weights = weights self.edge_score_norm = edge_score_norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.default_score = 1500\n self.run_past_matches()", "def add_expected_edge_score(\n ds,\n weights = None,\n edge_score_norm = None,\n):\n expected_edge_score_fn = ComputeExpectedEdgeScore(\n weights=weights, edge_score_norm=edge_score_norm\n )\n return ds.ma...
[ "0.61444855", "0.58688575", "0.5817042", "0.5780675", "0.5768685", "0.5757947", "0.5743625", "0.5650008", "0.55043674", "0.5430825", "0.53724885", "0.53686875", "0.5354529", "0.53527963", "0.5348763", "0.53159153", "0.5303172", "0.5300855", "0.52992296", "0.5286402", "0.52774...
0.66461796
0
Compute the expected edge score in a tf.data.Dataset pipeline.
def add_expected_edge_score( ds, weights = None, edge_score_norm = None, ): expected_edge_score_fn = ComputeExpectedEdgeScore( weights=weights, edge_score_norm=edge_score_norm ) return ds.map( expected_edge_score_fn, deterministic=False, num_parallel_calls=tf.data.AUTOTUNE, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, dataset):\n success = 0\n for sample, labelVector, label in dataset.tests:\n if self.guessLabel(sample) == label:\n success += 1\n return success / len(dataset.tests)", "def test(self,dataset):\n outputs = self.use(dataset)\n \n ...
[ "0.5868432", "0.5804118", "0.5604701", "0.5572564", "0.5557639", "0.55111897", "0.54969054", "0.54935503", "0.54147166", "0.5386387", "0.5364733", "0.5354639", "0.5340932", "0.5336755", "0.53274107", "0.52688366", "0.52666795", "0.5254729", "0.5227079", "0.5219288", "0.521817...
0.6958535
0
Function that creates a layer of a neural network using dropout
def dropout_create_layer(prev, n, activation, keep_prob): dropout = tf.keras.layers.Dropout(keep_prob) initializer = tf.keras.initializers.VarianceScaling(scale=2.0, mode=("fan_avg")) tensor = tf.layers.Dense(units=n, activation=activation, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout_create_layer(prev, n, activation, keep_prob):\n init = tf.contrib.layers.variance_scaling_initializer(mode=\"FAN_AVG\")\n regularizer = tf.layers.Dropout(keep_prob)\n layer = tf.layers.Dense(n, activation, name='layer',\n kernel_initializer=init,\n ...
[ "0.79813516", "0.79749966", "0.79588413", "0.77203673", "0.7542827", "0.69821", "0.6851639", "0.6841965", "0.6837162", "0.6801356", "0.67816114", "0.6757854", "0.67416865", "0.6729997", "0.6726304", "0.6685408", "0.6658301", "0.6623727", "0.65991193", "0.6575248", "0.6566104"...
0.7984123
0
Test case for perturb_light_post
def test_perturb_light_post(self): Parameters = Parameters() response = self.client.open('/perturb/light', method='POST', data=json.dumps(Parameters), content_type='application/json') self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light_post():\n return 'do some magic!'", "def test_v2_recognize_post(self):\n pass", "def test_preview_post(self):\n pass", "def test_01_lighting(self):", "def test_post(self):\n pass", "def test_post_foods(self):\n pass", "def test_post_chain(self):\n pass", ...
[ "0.6273439", "0.61584926", "0.6124221", "0.6123598", "0.6081772", "0.5967958", "0.57352376", "0.5663575", "0.55650115", "0.5526727", "0.5511092", "0.5493493", "0.5425493", "0.5420247", "0.54196167", "0.54137146", "0.54070103", "0.535447", "0.53538716", "0.5353705", "0.5353204...
0.73107374
0
Test case for perturb_nodefail_post
def test_perturb_nodefail_post(self): Parameters = Parameters2() response = self.client.open('/perturb/nodefail', method='POST', data=json.dumps(Parameters), content_type='application/json') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n pass", "def test_post_foods(self):\n pass", "def test_post_user_post(self):\n pass", "def test_post_nveto_pmts(self):\n pass", "def test_post_users_post(self):\n pass", "def test_meme_post(self):\n pass", "def test_falsepositive_post(clie...
[ "0.6223876", "0.6194101", "0.60459375", "0.5875066", "0.580688", "0.5789453", "0.5782498", "0.5747264", "0.57107925", "0.5676912", "0.5651326", "0.5645974", "0.5628373", "0.56243896", "0.56034243", "0.55947196", "0.5586521", "0.5579983", "0.5533444", "0.5519166", "0.5505662",...
0.72945184
0
Test case for perturb_sensor_post
def test_perturb_sensor_post(self): Parameters = Parameters1() response = self.client.open('/perturb/sensor', method='POST', data=json.dumps(Parameters), content_type='application/json') s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posture_sensor(axis):\n\n\treturn 0.0", "def test_v2_recognize_post(self):\n pass", "def test_post_nveto_pmts(self):\n pass", "def test_post(self):\n pass", "def test_perturb_light_post(self):\n Parameters = Parameters()\n response = self.client.open('/perturb/light',...
[ "0.62284666", "0.61769617", "0.61114275", "0.6066413", "0.6058273", "0.6038081", "0.6013419", "0.59221935", "0.5913397", "0.5791709", "0.5743958", "0.5741532", "0.57246625", "0.56956095", "0.5694378", "0.56339407", "0.5623249", "0.5616754", "0.55963886", "0.5570535", "0.55563...
0.74900186
0
Test case for start_post
def test_start_post(self): response = self.client.open('/start', method='POST') self.assert200(response, "Response body is : " + response.data.decode('utf-8'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_start(self):", "def postRun(self):\n pass", "def test_post_foods(self):\n pass", "def test_post_chain(self):\n pass", "def test_pre_post_hooks(self):\n os.makedirs('/tmp/localhost/pacha_pre')\n os.makedirs('/tmp/localhost/pacha_post')\n pre_script = open('...
[ "0.68975425", "0.6403606", "0.637713", "0.6272492", "0.62314767", "0.6226821", "0.61784506", "0.6160411", "0.61236924", "0.61070204", "0.60702914", "0.6066153", "0.6056459", "0.6001246", "0.5988173", "0.5985869", "0.5971692", "0.5942194", "0.592411", "0.59074134", "0.5894891"...
0.67104954
1
Decompress a version 2 |isphx| |objects.inv| bytestring. The ``prefixed comment lines are left unchanged, whereas the
def decompress(bstr): from sphobjinv.error import VersionError def decompress_chunks(bstrm): """Handle chunk-wise zlib decompression. Internal function pulled from intersphinx.py@v1.4.1: https://github.com/sphinx-doc/sphinx/blob/1.4.1/sphinx/ ext/intersphinx.py#L79-L124. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompression_inversion():\n dna_seq, bin_seq, comp_seq, file_comp = binary_to_seq()\n \n #bwt reconstruction\n table = [\"\"] * len(dna_seq)\n\n for i in range(0,len(dna_seq),1):\n table = [dna_seq[i] + table[i] for i in range(0,len(dna_seq))]\n table = sorted(table)\n \n or...
[ "0.5888223", "0.5502837", "0.5424519", "0.536672", "0.5231765", "0.51033384", "0.5085953", "0.5083021", "0.50662005", "0.5064565", "0.50488174", "0.50346035", "0.50332385", "0.5032891", "0.49965194", "0.49812", "0.4970292", "0.4947941", "0.4939645", "0.49302527", "0.491472", ...
0.6612812
0
Handle chunkwise zlib decompression.
def decompress_chunks(bstrm): decompressor = zlib.decompressobj() for chunk in iter(lambda: bstrm.read(BUFSIZE), b""): yield decompressor.decompress(chunk) yield decompressor.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __handle_decompression(self, x):\n if self.__compress:\n return zlib.decompress(x)\n return x", "def decompress(self, chunk):\n # print(self.decompressor.eof)\n data = self.data_rem + self.decompressor.decompress(chunk)\n if data != 0: # 0 is common -- waiting f...
[ "0.7118643", "0.67064387", "0.6677865", "0.64686584", "0.6440493", "0.6267104", "0.6194696", "0.6151859", "0.61371183", "0.60886365", "0.5969301", "0.5932353", "0.5825925", "0.5823723", "0.57676226", "0.57182044", "0.5700565", "0.56917506", "0.56883323", "0.5676933", "0.56642...
0.67375636
1
Compress a version 2 |isphx| |objects.inv| bytestring. The ``prefixed comment lines are left unchanged, whereas the
def compress(bstr): from sphobjinv.re import pb_comments, pb_data # Preconvert any DOS newlines to Unix s = bstr.replace(b"\r\n", b"\n") # Pull all of the lines m_comments = pb_comments.findall(s) m_data = pb_data.finditer(s) # Assemble the binary header comments and data # Comments a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression(s):", "def compress(string):", "def compress(string):", "def minify(self, instream=None, outstream=None):\n if instream and outstream:\n self.ins, self.outs = instream, outstream\n write, read = self.outs.write, self.ins.read\n space_strings = (\"abcdefghijklmn...
[ "0.6200748", "0.5795547", "0.5795547", "0.5694651", "0.5488601", "0.54419625", "0.52394843", "0.5149879", "0.51008606", "0.50720423", "0.5039412", "0.5019694", "0.50164264", "0.49088472", "0.48949203", "0.48806614", "0.48785192", "0.48468518", "0.48353478", "0.47938463", "0.4...
0.6379106
0
Initialize Random Aisle Turn Planning Environment
def __init__(self, params=None, draw_new_turn_on_reset=True, seed=None, rng=None): if rng is None: self._rng = np.random.RandomState() else: self._rng = rng self.seed(seed) self._draw_new_turn_on_reset = draw_new_turn_on_reset turn_params = self._draw_ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(config_data):\r\n\tglobal ENVIRONMENT\r\n\tENVIRONMENT = environment.Environment(config_data)\r\n\tglobal RANDOMIZER\r\n\tRANDOMIZER = random.Random(ENVIRONMENT.RANDOM_SEED)", "def env_init(self, env_info={}):\n self.dealer_sticks = env_info['dealer_sticks']\n self.random = np.random...
[ "0.6809258", "0.6527752", "0.65045786", "0.6440916", "0.6395903", "0.6345576", "0.6324104", "0.63214934", "0.6316323", "0.6313524", "0.6302462", "0.6299416", "0.6295126", "0.6281707", "0.62258595", "0.62184834", "0.6212118", "0.6184338", "0.61777526", "0.617674", "0.6131005",...
0.6900067
0
Render humanfriendly representation of the environment on the screen.
def render(self, mode='human'): return self._env.render(mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n self.env.render()", "def print_environment(self):\n for row in self._environment:\n row_str = str(row)\n row_str = row_str.replace(\"1\", WALL_CHAR) # replace the wall character\n row_str = row_str.replace(\"0\", SPACE_CHAR) # replace the space...
[ "0.71039", "0.6857693", "0.6618085", "0.6551396", "0.6551047", "0.64666295", "0.6464315", "0.6456744", "0.64073837", "0.63556534", "0.6303891", "0.62704504", "0.6236559", "0.62345666", "0.61942595", "0.6150356", "0.6078246", "0.6057098", "0.59710336", "0.59363306", "0.5929867...
0.7360606
0
Set the state of the environment
def set_state(self, state): self._env.set_state(state)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_state(self, state: Any) -> None:\n raise NotImplementedError(\n 'This environment has not implemented `set_state()`.'\n )", "def set_state( self ):", "def set_state(self,state):\n self.__state = state", "def set_state(self, state: int):", "def set_state(self, state):\n se...
[ "0.775866", "0.71706814", "0.7000711", "0.69824713", "0.6887541", "0.6811404", "0.67558724", "0.67558724", "0.6751002", "0.6751002", "0.6751002", "0.67418766", "0.6701546", "0.66864103", "0.6668853", "0.6658395", "0.6655376", "0.6646257", "0.6635708", "0.66354346", "0.6602075...
0.8133813
0
Draw random turn params
def _draw_random_turn_params(self): return TurnParams( main_corridor_length=self._rng.uniform(10, 16), turn_corridor_length=self._rng.uniform(4, 12), turn_corridor_angle=self._rng.uniform(-3./8. * np.pi, 3./8.*np.pi), main_corridor_width=self._rng.uniform(0.5, 1.5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw():", "def displays_simulated_draws(teams):\n for gm in simulate_draw(teams):\n a, b = random.sample(gm, len(gm))\n print(a + ' plays ' + b)", "def draw(self, prev_draw):\n # Std deviations for each parameter, the mean is the current location\n # strike = .375\n # ...
[ "0.63053244", "0.6206119", "0.6170635", "0.6111213", "0.60476", "0.58930886", "0.5834677", "0.58296067", "0.5817917", "0.5810731", "0.57860786", "0.5779151", "0.5707258", "0.5678884", "0.56681675", "0.5666285", "0.5665232", "0.5638739", "0.5636986", "0.55949897", "0.55801195"...
0.7826701
0
Extract egocentric map and path from rich observation
def _extract_egocentric_observation(self, rich_observation): costmap = rich_observation.costmap robot_pose = self._env.get_robot().get_pose() ego_costmap = extract_egocentric_costmap( costmap, robot_pose, resulting_origin=(self._egomap_x_bounds[0], self._egom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_observation(self, observation):", "async def extract(extraction: ExtractIoT = Body(...)):\n return await extract_iot_info(extraction.observationGEPid)", "def observation_spec(self) -> Dict[str, Any]:", "def get_maps_and_info(instrument,target,real=True):\n\n fitsfile, wtfile, wtext, wtisrms, t...
[ "0.53896475", "0.538363", "0.5369645", "0.53657037", "0.5295483", "0.52724487", "0.5242972", "0.5231173", "0.5210506", "0.518422", "0.51653486", "0.5143357", "0.51364905", "0.5133104", "0.5113382", "0.5092927", "0.50694853", "0.50680524", "0.50666475", "0.50190717", "0.501889...
0.6956817
0
Lazy parsing for tags.
def _parse_tags(self): tokens = self.tags_str[1:].split(";") self._tags = { k.strip(): v for token in tokens for k, v in [token.split("=")] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __load_tags(self) -> None:\n self.tags = TagHelper.TagHelper.generate_tag_object(self)\n self.tag_helper = TagHelper.TagHelper(self)\n self.tag_helper.fetch()", "def _parse(self):\n pass", "def parse(self):\n # type: () -> Tag\n logger.debug('%s- PARSING %r ...',\n...
[ "0.6087255", "0.606255", "0.5939629", "0.59376216", "0.5901145", "0.58523226", "0.57989115", "0.5741723", "0.5724223", "0.5670417", "0.56653446", "0.5650643", "0.5639909", "0.5615475", "0.56015426", "0.56015295", "0.5550556", "0.55390203", "0.55202204", "0.551727", "0.5501033...
0.65277654
0
Main listen loop. First ensures the client is connected. Following that it will receive messages every second and call the handler function.
def _listen(self): if not self.is_connected: self.connect() while True: data = self.recv() ping = PING_RE.match(data) if ping: self.handle_ping(ping.group(1)) else: result = self.handle_message(data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self):\n\n\t\twhile self.running:\n\t\t\t#Wait for server to inform you there is data\n\t\t\tself.rxEvt.wait()\n\t\t\t\n\t\t\ttry:\n\t\t\t\t#See if recieved packet is actually latest from client\n\t\t\t\tif self.rxData[len(self.rxData)-1][0] >= self.rxLatest:\n\n\t\t\t\t\t#Update latest and pass data to...
[ "0.7163178", "0.7101105", "0.70704645", "0.70392704", "0.7014954", "0.6987148", "0.69827545", "0.69654167", "0.6959276", "0.69496423", "0.6935791", "0.6933899", "0.6805457", "0.6783247", "0.6733517", "0.6721874", "0.67114395", "0.66532797", "0.6644218", "0.6641891", "0.663286...
0.72264385
0
Accepts an event and function and registers that function as an event handler to be called. If unique is set to true then all other handlers will be removed.
def register_handler(self, event, fn, unique=False): if event not in self._registry or unique: self._registry[event] = [fn] else: self._registry[event].append(fn) return fn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_handler(handler_list, handler_function):\n if not handler_function in handler_list:\n handler_list.append(handler_function)", "def remove_handler ( handler_list, handler_function ):\n if handler_function in handler_list:\n handler_list.remove ( handler_function )", "def remove_handl...
[ "0.61025476", "0.59412354", "0.5800009", "0.57303625", "0.56922853", "0.5680919", "0.5680616", "0.56299525", "0.5576375", "0.5543136", "0.5539306", "0.5448126", "0.54352283", "0.54179275", "0.53875613", "0.53859687", "0.5323548", "0.5247661", "0.5241168", "0.5234807", "0.5210...
0.8152895
0
Square distance between two points
def getSquareDistance(p1, p2): dx = p1[0] - p2[0] dy = p1[1] - p2[1] return dx * dx + dy * dy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square_distance(a, b):\n return np.sum((a-b)**2)", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def squaredDistanceTo(self,other):\n if not isinstance(other,Point):\n return \n return (self.longitude - othe...
[ "0.8207809", "0.79346263", "0.79335433", "0.7888952", "0.78792894", "0.78788394", "0.77205765", "0.7705187", "0.7704593", "0.76567906", "0.76294553", "0.7594146", "0.759352", "0.7592034", "0.75713253", "0.7539518", "0.75374764", "0.7510769", "0.74904907", "0.74767816", "0.747...
0.81086874
1
Square distance between point and a segment
def getSquareSegmentDistance(p, p1, p2): x = p1[0] y = p1[1] dx = p2[0] - x dy = p2[1] - y if dx != 0 or dy != 0: t = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy) if t > 1: x = p2[0] y = p2[1] elif t > 0: x += dx * t ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_point_distance_sq(x1, y1, x2, y2, px, py):\n pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)\n if pd2 == 0:\n # Points are coincident.\n x = x1\n y = y2\n else:\n # parameter of closest point on the line\n u = ((px - x1) * (x2 - x1) + (py - y1) * (y2 - y1...
[ "0.7261841", "0.7215121", "0.70107514", "0.6947209", "0.6826218", "0.67984754", "0.67480034", "0.674772", "0.6688991", "0.6647381", "0.6625328", "0.6616702", "0.6609095", "0.66068155", "0.65624976", "0.6546278", "0.654217", "0.65414524", "0.6527714", "0.6502948", "0.6501181",...
0.79682696
0
Get the tuple of terms for the expression.
def terms(self) -> Tuple[Term, ...]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subterms(expr):\n av_expr = []\n expr_types = []\n if isinstance(expr, Term):\n if expr.subterms:\n for s in expr.subterms:\n new_av, new_type = get_subterms(s)\n av_expr += new_av\n expr_types += new_type\n new_type = expr....
[ "0.647298", "0.61515206", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.60976434", "0.5987887", "0.5973798", "0.5957526", "0.59206617", "0.59174365", "0.5865378", "0.5857667", "0.58289665", "0.5821594", "0.5...
0.77597904
0
Get the strength for the constraint.
def strength(self) -> float: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strength(self) -> int:\n return self._strength", "def get_strength(self):\n return 10 - self.get_agility()", "def getStrength(self):\n return self.st", "def strength(self):\n return self._characterStrength", "def wireless_signal_strength(self) -> int:\n return self.da...
[ "0.82051545", "0.7667124", "0.7541932", "0.7447134", "0.7258923", "0.71684384", "0.691986", "0.6821158", "0.6821158", "0.6741986", "0.6716075", "0.6702248", "0.66739076", "0.66509944", "0.6636615", "0.66351014", "0.6630416", "0.6595347", "0.6595347", "0.6559752", "0.6553531",...
0.7714425
1
Indicate if the constraint is violated in teh current state of the solver.
def violated(self) -> bool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_solve(self):\n return self._solution[\"status\"] == \"optimal\"", "def is_violated(self,\n env\n ):\n flag = any([con.is_violated(env) for con in self.constraints])\n return flag", "def did_solve(self) -> bool:\n return self._solution.in...
[ "0.6838856", "0.67668086", "0.6675701", "0.6579404", "0.6507886", "0.6476085", "0.64347845", "0.64196366", "0.6398619", "0.6398219", "0.6360409", "0.63215375", "0.62700886", "0.62589514", "0.6256994", "0.6239568", "0.6239568", "0.6239568", "0.6204424", "0.6169917", "0.6128140...
0.6972864
0
Add a constraint to the solver.
def addConstraint(self, constraint: Constraint, /) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_constraint(self, constraint):\n self.constraints.append(constraint)", "def add_constraint(self, constraint, problem):\n problem += constraint", "def add_constraint(self, constraint):\n self.add_constraint_sig(\n ConstraintSignature.from_constraint(constraint))", "def a...
[ "0.87985", "0.82704854", "0.81800866", "0.8103364", "0.78763974", "0.786862", "0.77562666", "0.7679017", "0.7477127", "0.72092175", "0.6854777", "0.6796005", "0.67493266", "0.66699165", "0.66609436", "0.6658133", "0.6465529", "0.6420988", "0.63664913", "0.6347508", "0.6340390...
0.8379397
1
Remove a constraint from the solver.
def removeConstraint(self, constraint: Constraint, /) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeConstraint(self, *args):\n return _libsbml.Model_removeConstraint(self, *args)", "def remove_unary_constraint(self, var):\n\n del self.__constraints[var]", "def remove_constraint(self, ckey):\n if ckey not in self.constraints:\n raise KeyError(\"Constraints not found o...
[ "0.810242", "0.736013", "0.7136567", "0.6523253", "0.6508286", "0.62838775", "0.6093966", "0.5729907", "0.5685232", "0.5625882", "0.5598013", "0.55776215", "0.5545995", "0.5490618", "0.54739165", "0.5366814", "0.5360331", "0.5359054", "0.5336542", "0.53097224", "0.5308916", ...
0.84921664
0
Check whether the solver contains a constraint.
def hasConstraint(self, constraint: Constraint, /) -> bool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ok(self, solution):\n if self.constraints is not None:\n for constraint in self.constraints:\n if not constraint(solution):\n return False\n return True", "def check(self, description: Description) -> bool:\n return any(expr.check(description)...
[ "0.6957611", "0.6770339", "0.657151", "0.65704596", "0.65324944", "0.64978004", "0.64342904", "0.6314827", "0.62542844", "0.62457246", "0.62406987", "0.6196094", "0.6195927", "0.6191132", "0.6178599", "0.6165657", "0.6138303", "0.6100073", "0.6052501", "0.6017266", "0.6007907...
0.8009248
0
Add an edit variable to the solver.
def addEditVariable( self, variable: Variable, strength: float | Literal["weak"] | Literal["medium"] | Literal["strong"] | Literal["required"], /, ) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AddVariable(self, e):\n if (not self.mainparent.file_loaded):\n msg = \"An input file must be loaded before a variable can be added\"\n ShowMessage(msg, kind='warn')\n return\n if (self.mainparent.namelist is None):\n msg = \"Use the menu to select a na...
[ "0.64234287", "0.6350159", "0.62870806", "0.6123998", "0.6122984", "0.6077169", "0.6002064", "0.5964363", "0.58960193", "0.5823518", "0.5767504", "0.5740521", "0.5720519", "0.5711642", "0.5709939", "0.56424177", "0.56014955", "0.56014955", "0.5598345", "0.55962414", "0.554856...
0.7281414
0
Remove an edit variable from the solver.
def removeEditVariable(self, variable: Variable, /) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveVariable(self, e):\n if (not self.mainparent.file_loaded):\n msg = \"An input file must be loaded before a variable can be removed\"\n ShowMessage(msg, kind='warn')\n return\n if (self.mainparent.namelist is None):\n msg = \"Use the menu to select...
[ "0.709667", "0.70457697", "0.6613823", "0.6406519", "0.6381402", "0.6376103", "0.6275775", "0.62489516", "0.62125254", "0.6199002", "0.61320275", "0.60112524", "0.59791046", "0.5941001", "0.5921473", "0.5905575", "0.58055615", "0.57890695", "0.5786958", "0.57321537", "0.56841...
0.8514975
0
Check whether the solver contains an edit variable.
def hasEditVariable(self, variable: Variable, /) -> bool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_edit(self):\n return self._tag == 'edit'", "def _islocked(self, solver):\n var_obj = solver._getvariableobject(self._lits[0]._varsymbol)\n return var_obj._reason == self", "def _check_is_editable(self, raise_error: bool = True) -> bool:", "def has_unapplied_change(self):\n ...
[ "0.65310585", "0.62080866", "0.59841144", "0.5965039", "0.58547854", "0.581514", "0.5814936", "0.57922244", "0.57811207", "0.5727156", "0.571551", "0.5715355", "0.5713563", "0.5700901", "0.56940854", "0.56854814", "0.5610542", "0.5607082", "0.55650896", "0.5553979", "0.554554...
0.859018
0
Suggest a desired value for an edit variable.
def suggestValue(self, variable: Variable, value: int | float, /) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doEdit(var, value, target):\n currentValue = target.get(var, \"\")\n newValue = Simplifier.simplify(str(value).replace(f\"{{{var}}}\", str(currentValue)))\n target[var] = newValue", "def hasEditVariable(self, variable: Variable, /) -> bool:\n ...", "def addEditVariable(\n ...
[ "0.6225559", "0.5840995", "0.57989776", "0.566775", "0.564406", "0.5536214", "0.552429", "0.5520721", "0.5495398", "0.548905", "0.5487052", "0.5478344", "0.5437658", "0.53702086", "0.5302936", "0.529029", "0.5274059", "0.5272355", "0.5268632", "0.52568996", "0.52362555", "0...
0.7521129
0
Update the values of the solver variables.
def updateVariables(self) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variational_update(self):\n with self.elbo_check('update_p_allele_swap'):\n self.model.update_p_allele_swap()\n\n with self.elbo_check('p_cn'):\n self.model.update_p_cn()\n\n with self.elbo_check('p_breakpoint'):\n self.model.update_p_breakpoint()\n\n ...
[ "0.78219795", "0.6875862", "0.6868184", "0.6728285", "0.6440298", "0.6354795", "0.63009286", "0.6288933", "0.6267929", "0.6261375", "0.6238679", "0.6225903", "0.619492", "0.6188318", "0.61875445", "0.6155223", "0.6141217", "0.6110255", "0.6103633", "0.60810226", "0.6073726", ...
0.8186827
0
Dump a representation of the solver internals to a string.
def dumps(self) -> str: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self):\n outputs = [\"Code object : %s\" % self.name]\n outputs.append(\" Type : %s\" % self.object_type)\n for source_line in self.source:\n # Each line is a (line_number, code) pair\n outputs.append('%d: %s' % source_line)\n return \"\".join(outputs)", ...
[ "0.6393379", "0.6346621", "0.6346621", "0.6346621", "0.6346621", "0.6346621", "0.63439035", "0.63305646", "0.6322037", "0.630833", "0.6270693", "0.6254364", "0.6253063", "0.6247455", "0.6234791", "0.6192907", "0.6162206", "0.6138039", "0.6115575", "0.6099004", "0.6084559", ...
0.64815027
0
Sorts agents in order of distance to exit and then steps
def step(self): try: self.agents.sort(key=lambda x: x.dist) except Exception as e: print(e) for agent in self.agents: try: agent.step() except Exception as e: print(e) # Removes agents if they reach ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_agents(self, receiver=False, dynamic=True, k_shot=100):\n if self.params.single_pool:\n att = \"agents\"\n else:\n att = \"receivers\" if receiver else \"senders\"\n\n values, agents = self.get_convergence(att, dynamic=dynamic, k_shot=k_shot)\n\n values, a...
[ "0.6424549", "0.5797548", "0.5749146", "0.5707727", "0.5688502", "0.5681127", "0.56057686", "0.5604621", "0.5581702", "0.55416", "0.5444374", "0.5414818", "0.54056305", "0.5363604", "0.535584", "0.53327334", "0.53223974", "0.531155", "0.5286359", "0.5276795", "0.52739495", ...
0.7006281
0
Return cns rates given current amounts and times.
def cns_growth(amounts, times): # Cannot have negative amounts. np.maximum(0, amounts, out=amounts) # Amounts of nutrients and signal. nutrients = amounts[1::3] signal = amounts[2::3] # Sums of nutrient and signal diffusion for each culture. N_diffusions = [sum([n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def currency_rate(self, init):\r\n\r\n curr = CurrencyRates()\r\n curr_rate = curr.get_rates(init)\r\n return curr_rate", "def get_rates(table_id):\n fields = [\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]\n for pos, name in enumerate(rates_key_list):\n full_table...
[ "0.6445556", "0.59917367", "0.5946631", "0.5928228", "0.5858746", "0.5849902", "0.58388346", "0.58326066", "0.582417", "0.5822325", "0.5817143", "0.5806064", "0.5782706", "0.5740727", "0.57022756", "0.56581366", "0.5615599", "0.5607085", "0.5595835", "0.5535526", "0.5507106",...
0.6665384
0
Solve ODEs return amounts of C, N, and S. Args
def solve_model(init_amounts, times, neighbourhood, params): # init_amounts should be an array of length 3*no_cultures. growth_func = make_cns_model(params, neighbourhood) sol = odeint(growth_func, init_amounts, times) return np.maximum(0, sol)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\n \n # getting the time values\n self.days_list = np.linspace(self.tbeg,self.tend,self.npoints)\n\n # calling the odeint method to solve the diff. equations\n self.x = odeint(self.diff_eq,self.x0,self.days_list,args = (self.par,))\n '''\n Its import...
[ "0.65359825", "0.6483115", "0.64567894", "0.6359236", "0.6359236", "0.6305119", "0.6279612", "0.624384", "0.624384", "0.620836", "0.61754686", "0.61529833", "0.6134762", "0.61208355", "0.6006851", "0.6000006", "0.591367", "0.58675253", "0.58667505", "0.5836892", "0.5803838", ...
0.6487347
1
Return a list of initial amounts for a plate of cultures. C0(t=0), N0(t=0), S0(t=0), C1(t=0), N1(t=0), S1(t=0), ...
def gen_amounts(no_cultures): # Init amounts C = 0.01 N = 1.0 S = 0.0 init_amounts = np.array([C, N, S]*no_cultures) return init_amounts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_params(no_cultures):\n # C(t=0), N(t=0), S(t=0)\n amounts_guess = [0.2, 0.2, 0.0]\n # kn, ks\n kn_ks_guess = [0.05, 0.15]\n # b, a\n ba_guess = [0.05, 0.05]\n # r\n r_guess = [1.0]\n # Initial guess: C(t=0), N(t=0), S(t=0), kn, ks, r0, b0, a0, r1, b1, a1, ...\n init_guess = ...
[ "0.55219096", "0.5385107", "0.5018085", "0.49799418", "0.49191824", "0.48951185", "0.48377317", "0.47833404", "0.4754465", "0.4754262", "0.47362298", "0.47036442", "0.46850875", "0.46764535", "0.46720383", "0.46401772", "0.46339273", "0.46326676", "0.46132654", "0.46128994", ...
0.7039029
0
Return a list of parameters for a plate of cultures. kn, ks, b, a, r0, r1,...
def gen_params(no_cultures): # Plate level kn = 0.1 # Nutrient diffusion ks = 0.1 # Signal diffusion b = 0.05 # Signal on cells effect constant a = 0.05 # Signal secretion constant # Culture level # Growth rate constant r_mean = 1.0 r_var = 1.0 r_params = [max(0.0, ga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_params(no_cultures):\n # C(t=0), N(t=0), S(t=0)\n amounts_guess = [0.2, 0.2, 0.0]\n # kn, ks\n kn_ks_guess = [0.05, 0.15]\n # b, a\n ba_guess = [0.05, 0.05]\n # r\n r_guess = [1.0]\n # Initial guess: C(t=0), N(t=0), S(t=0), kn, ks, r0, b0, a0, r1, b1, a1, ...\n init_guess = ...
[ "0.5976923", "0.55013466", "0.54302174", "0.5388124", "0.5377809", "0.53411776", "0.53370297", "0.5298361", "0.5278777", "0.527762", "0.51606", "0.51551294", "0.5150958", "0.5150958", "0.5078802", "0.50615203", "0.505898", "0.50523794", "0.50341755", "0.5031404", "0.50216895"...
0.67783684
0
[Convert h5 format to pb format.]
def h5_to_pb(h5_model, output_dir, model_name, out_prefix="output_", log_tensorboard=True): if osp.exists(output_dir) == False: os.mkdir(output_dir) out_nodes = list() ## get all tensor node. for i in range(len(h5_model.outputs)): out_nodes.append(out_prefix+str(i+1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_tfhub_to_hdf5(module_path, hdf5_path, redownload=False):\n if os.path.exists(hdf5_path) and (not redownload):\n print('Loading BigGAN hdf5 file from:', hdf5_path)\n return h5py.File(hdf5_path, 'r')\n\n print('Loading BigGAN module from:', module_path)\n tf.reset_default_graph()\n hub.Module(modu...
[ "0.527529", "0.51770395", "0.51024234", "0.5089918", "0.5052479", "0.5030369", "0.5016858", "0.5008035", "0.50007695", "0.49961153", "0.49935907", "0.49308708", "0.49289745", "0.49001303", "0.48981425", "0.4875177", "0.4868831", "0.4868831", "0.48586088", "0.4850094", "0.4842...
0.6827597
0
Set whether to send notifications when the bot sends a message. Type must be a valid bool.
async def botmsg(self, ctx, type: bool): async with self.config.toggles() as toggles: if type: toggles["botmessages"] = True await ctx.send("Bot message notifications have been enabled.") else: toggles["botmessages"] = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_send_notifications(self, should_send_notifications):\n\n self._should_send_notifications = should_send_notifications", "def send_notification(self) -> bool:\n return pulumi.get(self, \"send_notification\")", "def messaging(self, value: bool):\n if type(value) is not bool:\n ...
[ "0.6579429", "0.64653814", "0.6341227", "0.623584", "0.602172", "0.5769642", "0.5700407", "0.54719055", "0.5462543", "0.5430192", "0.53722763", "0.53162813", "0.5313708", "0.52769345", "0.5265116", "0.5232281", "0.52090377", "0.52077585", "0.5204658", "0.5199213", "0.5195312"...
0.7142687
0
PMs a person. Separate version of [p]dm but allows for guild owners.
async def pm(self, ctx, user_id: int, *, message: str): user = discord.utils.get(ctx.bot.get_all_members(), id=user_id) e = discord.Embed(colour=discord.Colour.red(), description=message) if ctx.bot.user.avatar_url: e.set_author( name=f"Message from {ctx.author} | {c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def randping(self, ctx):\r\n while True:\r\n memb = random.choice(ctx.guild.members)\r\n if not memb.bot:\r\n break\r\n memb = memb.mention\r\n await ctx.send(memb)", "async def _cmdf_pmdemo(self, substr, msg, privilege_level):\n pm_target = ms...
[ "0.60254604", "0.6020542", "0.5969101", "0.5890048", "0.5866165", "0.5721119", "0.56611", "0.5643012", "0.56312406", "0.56143034", "0.55847985", "0.5548511", "0.5529169", "0.55290586", "0.5485741", "0.54630214", "0.5460722", "0.5450062", "0.5420809", "0.54016817", "0.5394587"...
0.6300239
0
Calculates the number of partial permutations from choosing k objects from n.
def partial_permutations(n, k): return int((factorial(n) / factorial(n - k)) % 1000000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute(n: int, k: int) -> int:\n\n # no possible permutations if k > n\n if n < k:\n return 0\n\n # if faster, compute n! and (n - k)! and return their quotient\n fact_count = len(_factorial_sequence)\n if n - fact_count <= k:\n return factorial(n) // factorial(n - k)\n\n # com...
[ "0.7203634", "0.7119452", "0.70608026", "0.70467895", "0.70372283", "0.7015955", "0.6947298", "0.6819329", "0.6799878", "0.673416", "0.6731151", "0.6650088", "0.6587087", "0.6585141", "0.65712756", "0.65712756", "0.6558613", "0.6530832", "0.6522122", "0.6487943", "0.64616823"...
0.8272892
0
Creates the default linear reward vector.
def create_reward_vector(agent, locations, move_actions): world = agent.world features = [] features.append(ValueComparisonLinearRewardFeature( 'Before Middle', world, get_mission_seconds_key(), MISSION_PHASE_END_TIMES[MISSION_PHASES.index(MIDDLE_STR)], '<')) features.append(ValueCompar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_reward_function(self):\n K = -3\n self.reward = np.array([[10, 0, K],\n [0, 2, 0],\n [K, 0, 10]])", "def get_reward_function(self):\n R_fn = np.zeros(self.n_states)\n R_fn[0] = 1.0\n\n return R_fn", ...
[ "0.6391603", "0.5751985", "0.5715384", "0.568441", "0.56771886", "0.5656485", "0.56491154", "0.56046534", "0.558367", "0.55834746", "0.5544051", "0.5543079", "0.55340093", "0.5489055", "0.5452966", "0.5449944", "0.5437043", "0.5437043", "0.5437043", "0.5437043", "0.5437043", ...
0.6202688
1
Turns a letter into a Tensor
def letterToTensor(letter): tensor = torch.zeros(1, n_letters) tensor[0][letterToIndex(letter)] = 1 return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineToTensor(line):\n tensor = torch.zeros(len(line), 1, n_letters)\n for li, letter in enumerate(line):\n tensor[li][0][letterToIndex(letter)] = 1\n return tensor", "def line_to_tensor(line):\n tensor = torch.zeros(len(line), 1, N_LETTERS)\n for i, letter in enumerate(line):\n t...
[ "0.64119494", "0.6373253", "0.63140494", "0.6135908", "0.5773303", "0.57655656", "0.5722509", "0.565925", "0.5652155", "0.5638708", "0.56304514", "0.5627755", "0.55935884", "0.5584604", "0.5558846", "0.55528367", "0.55242634", "0.5516812", "0.5464028", "0.5413787", "0.5373766...
0.78227603
0
Turn a line into a , or an array of onehot letter vectors
def lineToTensor(line): tensor = torch.zeros(len(line), 1, n_letters) for li, letter in enumerate(line): tensor[li][0][letterToIndex(letter)] = 1 return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hot(line):\n out = []\n encoder_dict ={'A':[1,0,0,0], 'T':[0,1,0,0], 'G':[0,0,1,0], 'C':[0,0,0,1]}\n for item in line:\n if item in encoder_dict.keys():\n out.append(encoder_dict[item])\n \n return out", "def line_to_tensor(line):\n tensor = torch.zeros(len(line), 1, N_LET...
[ "0.68965566", "0.6828636", "0.67513114", "0.65067405", "0.64747554", "0.64476997", "0.64084214", "0.6390813", "0.6383318", "0.6362804", "0.6342562", "0.6274923", "0.61785287", "0.6162013", "0.6133142", "0.60965675", "0.6083475", "0.6074911", "0.60216206", "0.6021185", "0.5996...
0.6863159
1
returns the topk as a python list
def topk(vec, k): vec = torch.topk(vec, k) return vec.view(-1).data.tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k(self, k = 1):\n\t if self.shapley_rank == {}:\n\t \treturn []\n\n\t n = self.nodes\n\t topknodes = []\n\t i = 0\n\t count = 0\n\t while count < k and not i == n:\n\t if self.shapley_rank[i][0] not in topknodes and not self.is_adj(self.shapley_rank[i][0], topknodes):\n\t ...
[ "0.77150583", "0.72737426", "0.7167068", "0.7126576", "0.69863576", "0.6976342", "0.6928498", "0.691504", "0.6901922", "0.6885117", "0.68374413", "0.68118733", "0.680315", "0.67922145", "0.67872065", "0.67760825", "0.6761339", "0.6759984", "0.6756176", "0.6687926", "0.6678856...
0.7822952
0
Small modification to NLTK wordpunct_tokenize Because NLTK's won't split on '_' or numbers
def wordpunct_space_tokenize(sent): return _rts.tokenize(sent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n lowers = text.lower()\n trans = {ord(c): None for c in string.punctuation}\n no_punctuation = lowers.translate(trans)\n trans_dig = {ord(c): None for c in string.digits}\n no_digits = no_punctuation.translate(trans_dig)\n tokens = nltk.word_tokenize(no_digits)\n return to...
[ "0.7712767", "0.72001827", "0.7181687", "0.7161656", "0.7132496", "0.70764285", "0.70704037", "0.7032159", "0.69968474", "0.69790226", "0.6895941", "0.6881979", "0.6864515", "0.6852213", "0.6835276", "0.6835098", "0.68190706", "0.68102664", "0.68017775", "0.67969924", "0.6770...
0.79126287
0
Pads sequences to the same length. This function transforms a list of `num_samples` sequences (lists of integers) into a 2D Numpy array of shape `(num_samples, num_timesteps)`. `num_timesteps` is either the `maxlen` argument if provided, or the length of the longest sequence otherwise. Sequences that are shorter than `...
def pad_sequences(sequences, maxlen=None, dtype='int32', padding='pre', truncating='pre', value=0.): if not hasattr(sequences, '__len__'): raise ValueError('`sequences` must be iterable.') lengths = [] for x in sequences: if not hasattr(x, '__len__'): raise Valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_sequences(sequences, maxlen, nb_sequences, dtype='int32', value=-1):\n\n x = (numpy.ones((nb_sequences, maxlen)) * value).astype(dtype)\n for idx, s in enumerate(sequences):\n trunc = s[:maxlen]\n\n x[idx, :len(trunc)] = trunc\n\n return x", "def pad_sequences(sequences, pad_func, ...
[ "0.7471271", "0.67566997", "0.67072976", "0.66779023", "0.66278654", "0.65295887", "0.650013", "0.64562035", "0.6307838", "0.6280524", "0.6270285", "0.62512267", "0.6229984", "0.6229984", "0.6159027", "0.61498684", "0.6144117", "0.61333627", "0.612565", "0.6052647", "0.604610...
0.73416483
1
Return the bounding box for the detector named by detector_name
def getBBox(self, detector_name): if not hasattr(self, '_bbox_cache'): self._bbox_cache = {} if detector_name not in self._bbox_cache: dm_bbox = self._camera[detector_name].getBBox() dm_min = dm_bbox.getMin() dm_max = dm_bbox.getMax() cam_bbox...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_bounding_box(self, detections, confidence):\n for detection in detections[0,0,:,:]:\n if detection[2] >= confidence:\n return detection[3:]\n \n return None", "def get_bounding_box(current_building_contour):\n x, y, w, h, = cv.boundingRect(current_bu...
[ "0.7028546", "0.6829419", "0.6681781", "0.6559363", "0.6423608", "0.63875675", "0.6367719", "0.6355639", "0.6313133", "0.6251408", "0.62188524", "0.62188524", "0.62008065", "0.61064327", "0.60991025", "0.6090719", "0.60672337", "0.6029417", "0.59934515", "0.59825635", "0.5976...
0.7981458
0
Return the central pixel for the detector named by detector_name
def getCenterPixel(self, detector_name): if not hasattr(self, '_center_pixel_cache'): self._center_pixel_cache = {} if detector_name not in self._center_pixel_cache: centerPoint = self._camera[detector_name].getCenter(FOCAL_PLANE) centerPixel_dm = self._camera[d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCenter(self):\r\n pixels = np.argwhere(self.array)\r\n center = np.mean(pixels.astype(np.float32), axis=0)\r\n return np.round(center).astype(np.int)", "def image_detect_and_compute(detector, img_name):\n img_building = cv2.imread(img_name)\n img_building = cv2.cvtColor(img_buil...
[ "0.572003", "0.55691594", "0.55031574", "0.5454181", "0.544494", "0.5401254", "0.5376782", "0.5376375", "0.53569335", "0.53231966", "0.5309906", "0.53090906", "0.5295075", "0.5234978", "0.52261496", "0.52249765", "0.52246815", "0.52100796", "0.5191619", "0.5191416", "0.513519...
0.77297044
0
Determine if the file is a module file or not
def is_module(filename): if not os.path.exists(filename): return None if filename.endswith('.py'): # Assume the file is a module file return PY_MODULEFILE regex = re.compile(re.escape(r'#%Module')) if regex.search(open(filename).readline()): return TCL_MODULEFILE ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isModule(self, name):\n return os.path.isfile(self.modulePath(name))", "def is_module(path: str) -> bool:\n return os.path.isfile(path) and path.endswith(\".py\")", "def is_module(path):\n\n fname, ext = os.path.splitext(path)\n if ext == \".py\":\n return True\n elif os.path.exists(o...
[ "0.8152463", "0.76952493", "0.7634162", "0.7339122", "0.72603613", "0.7139575", "0.7038043", "0.6913322", "0.6871568", "0.68685377", "0.68355376", "0.6802501", "0.67394763", "0.6729375", "0.6658551", "0.6602656", "0.64620227", "0.6458042", "0.63445204", "0.6326728", "0.627040...
0.8024567
1
Shows the given player state
def show_player_state(self, player): player_str = 'Player: {}'.format(player.name) sys.stdout.write(colorama.Fore.MAGENTA) print('-'*len(player_str)) print(player_str) print('-'*len(player_str)) sys.stdout.write(colorama.Fore.GREEN) print('Money: {}'.format(player...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_state_cmd(self):\n self.__display(self.state)", "def show_state(self):\n print(\"I don't know how to show_state.\")", "def show_state(self):\n print \"I don't know how to show_state.\"", "def play(self, state,currentplayer):\n\t\tpass", "def display_state(self):\n # ...
[ "0.7000268", "0.6939277", "0.69268537", "0.65638065", "0.6558412", "0.6334996", "0.6256778", "0.6218465", "0.61820346", "0.608532", "0.60844004", "0.60499954", "0.6033119", "0.601433", "0.5987219", "0.59533286", "0.59390986", "0.5934072", "0.5925529", "0.5902319", "0.5900755"...
0.7200516
0
Shows what's available at the market.
def show_market(self, player): print('Market') print('------') cards_available = self.game.market.cards_available() for card in sorted(cards_available.keys()): count = cards_available[card] if card.cost > self.game.current_player.money: sys.stdout....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_available_items(self):\n count = 0\n print(\"Available Items:\")\n for item in self.item_list.values():\n if item.check_availability():\n count += 1\n print(item)\n if count == 0:\n print(\"No items are available\")", "de...
[ "0.67145365", "0.64778763", "0.61161697", "0.5976981", "0.5969115", "0.59324163", "0.5921184", "0.5916237", "0.58744943", "0.58716655", "0.58602667", "0.5826337", "0.58036655", "0.57779056", "0.5777871", "0.57509786", "0.57448083", "0.57387096", "0.5732155", "0.56839144", "0....
0.7280584
0
Wrap a main function for proper twisted encapsulation and getting proper error feedback on the command line.
def wrapMain(func): def handleError(error): if error.type == SystemExit: log.msg('SystemExit: %s' % error.value) elif error.type == usage.UsageError: log.msg(error.value) else: error.printTraceback() log.startLoggingWithObserver(logObserver, setStdout...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\targs = sys.argv[1:]\n\t# If stdin is not empty (being piped to)\n\tif not sys.stdin.isatty():\n\t\targs += sys.stdin.readlines()\n\tcommand = Main()\n\tcatch = lnk.errors.Catch(1)\n\tcatch.catch(command.main, args, standalone_mode=False)", "def run_main():\n main(sys.argv)", "def main():\n\n ...
[ "0.6933514", "0.687035", "0.6811248", "0.679248", "0.67894083", "0.67428195", "0.67428195", "0.67428195", "0.67428195", "0.67428195", "0.67428195", "0.67428195", "0.67428195", "0.6659562", "0.664494", "0.6573229", "0.6573229", "0.6573229", "0.6573229", "0.6564385", "0.6564385...
0.73457754
0
The lenght value of a string can be defined up to 5 bytes. Only lower 7 bits hold the lenght value. The most significant bit defines if there is another bit following the previous one with rest of the lenght value.
def _get_correct_string_size(self, fd): # store the lenght value bits size_bits = [] # the value can have max 5 bytes for _ in range(5): size = self.read_bytes_to_int(fd, 1) # if the length value is less then 128 it means its the last # byte with the l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_string_length(self):\n return int(self.read('H')[0])", "def bitSizeOf(_bitPosition, value: str) -> int:\n\n return getBitSizeOfString(value)", "def bit_length(self, ???):", "def strlen(val): \n return len(val)", "def getLength(string):\n return (0)", "def getPaddedLength(string): ...
[ "0.72196877", "0.6779729", "0.67583966", "0.6676609", "0.66286904", "0.6593438", "0.65872055", "0.64979684", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", "0.63490206", ...
0.6823601
1
get all failed host, type_t default FC
def get_failed_dev(failed_dev_list, type_t="FC"): result_list = [] try: if failed_dev_list: for dev_info in failed_dev_list: type_temp = dev_info.get('type') if type_temp == type_t: host = dev_info.get('host') result_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hosts_retry(self, target, listener_type):", "def get_hosts_fanout_retry(self, target, listener_type):", "def get_info_hosts():\n print(\"\\nMapeando...\")\n host_ip = socket.gethostbyname(socket.gethostname()).split('.')\n base_ip = \".\".join(host_ip[0:3]) + '.'\n host_validos = []\n re...
[ "0.6331516", "0.5805751", "0.577447", "0.57282597", "0.57145804", "0.56072086", "0.5584547", "0.55580807", "0.54957795", "0.5411283", "0.5380555", "0.5374587", "0.5371299", "0.5332882", "0.5328893", "0.5313647", "0.5287874", "0.5262935", "0.525757", "0.5223339", "0.52169406",...
0.701972
0
when the given dictionary was built with invalid version, Lexpp() must raise an FileNotFoundError.
def test_dict_with_invalid_version(self): invalid_version_info = (-1, -1, -1) d = LexicalDictionary(invalid_version_info) with self.assertRaises(FileNotFoundError): lp = Lexpp(external_dict=d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_file_must_exist(cls, v: pathlib.Path):\n if not v.exists():\n raise ValueError(f\"Path object not found in filesystem : {v}\")\n return v", "def test_versioning_unknown_version(workflow_runner):\n with pytest.raises(WDL.Error.SyntaxError):\n workflow_runner(\"test_vers...
[ "0.53207624", "0.5272581", "0.5113402", "0.49925733", "0.49682027", "0.49366477", "0.49290675", "0.4862165", "0.48179412", "0.4808284", "0.4800879", "0.47982088", "0.47976533", "0.47848648", "0.47835198", "0.47674665", "0.47549736", "0.47533146", "0.4734658", "0.47309145", "0...
0.76646054
0
Test IMA measurement list verification
def test_measurment_verification(self): lines = MEASUREMENTS.splitlines() lists_map = ima.process_allowlists(ALLOWLIST, '') lists_map_empty = ima.process_allowlists(ALLOWLIST_EMPTY, '') self.assertTrue(ima.process_measurement_list(lines) is not None, "Validation ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMA(self):\n for size in range(5):\n a = AttributeAbility(['MA',], size + 1)\n self.assert_(str((size + 1) * 2) in str(a))\n self.assert_('MA' in str(a))", "def test_tma(self):\n periods = 200\n tma = qufilab.tma(self.close, periods)\n tma_talib...
[ "0.68490857", "0.61888325", "0.6171639", "0.6037265", "0.5970654", "0.59149486", "0.5888203", "0.5864408", "0.58238757", "0.5806092", "0.5764368", "0.57225096", "0.56853753", "0.5684274", "0.56749153", "0.56539196", "0.56467265", "0.56409836", "0.56372494", "0.56322753", "0.5...
0.672114
1
Test the signature verification
def test_signature_verification(self): curdir = os.path.dirname(os.path.abspath(__file__)) keydir = os.path.join(curdir, "data", "ima_keys") lines = SIGNATURES.split('\n') # empty keyring keyring = ima_file_signatures.ImaKeyring() self.assertTrue(ima.process_measurement...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signature_validation(self):\n signature = app.utils.generate_signed_data(\n self._body,\n settings.PRIVATE_KEY\n )\n\n self.assertTrue(app.utils.validate_signed_data(\n self._body,\n signature,\n settings.PUBLIC_KEY\n ))", ...
[ "0.77902305", "0.75923115", "0.75323004", "0.74079645", "0.74058723", "0.74050516", "0.74050516", "0.73182243", "0.7251686", "0.7179718", "0.7163755", "0.71622854", "0.71182853", "0.70662576", "0.69989586", "0.69811237", "0.6978251", "0.69613624", "0.68993866", "0.687873", "0...
0.7749139
1
Test verification using allowlist and keys
def test_mixed_verfication(self): lists_map = ima.process_allowlists(ALLOWLIST, '') lists_map_wrong = ima.process_allowlists(ALLOWLIST_WRONG, '') lists_map_empty = ima.process_allowlists(ALLOWLIST_EMPTY, '') lists_map_exclude = ima.process_allowlists(ALLOWLIST, EXCLUDELIST) list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_keys(self):", "def test_allowed_list(self):\n val = DwcaValidator(yaml.load(self.yaml_allowed_list, Loader=yaml.FullLoader),\n error_handler=WhipErrorHandler)\n document = {'rightsHolder': 'INBO'}\n self.assertTrue(val.validate(document))\n documen...
[ "0.69990325", "0.6503591", "0.6438906", "0.64284337", "0.63496256", "0.6261098", "0.62267494", "0.6169922", "0.61219287", "0.60758525", "0.60459375", "0.6018578", "0.6004694", "0.59688807", "0.5948346", "0.5946929", "0.5933196", "0.592859", "0.592859", "0.59258276", "0.592237...
0.6537112
1
Test reading and processing of the IMA allowlist
def test_read_allowlist(self): curdir = os.path.dirname(os.path.abspath(__file__)) allowlist_file = os.path.join(curdir, "data", "ima-allowlist-short.txt") allowlist_sig = os.path.join(curdir, "data", "ima-allowlist-short.sig") allowlist_bad_sig = os.path.join(curdir, "data", "ima-allow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMA(self):\n for size in range(5):\n a = AttributeAbility(['MA',], size + 1)\n self.assert_(str((size + 1) * 2) in str(a))\n self.assert_('MA' in str(a))", "def test_mixed_verfication(self):\n\n lists_map = ima.process_allowlists(ALLOWLIST, '')\n lists...
[ "0.6069202", "0.6002008", "0.58429635", "0.58420193", "0.5785939", "0.5668755", "0.5662467", "0.5551865", "0.5444446", "0.54424447", "0.54371136", "0.53471714", "0.53247184", "0.5321629", "0.53089964", "0.53062594", "0.5292875", "0.5286533", "0.52821994", "0.52798986", "0.527...
0.7443931
0
Solve for Q that satisfies the unitvector and orthogonality constraints on ih and jh.
def solve_Q(ih, jh): # Build A and b # Solve for c via least squares. # Form C from c # Solve for Q and return it. return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qsolve(self, options=''):\n for x in self._rhs:\n if x != 0:\n raise NotImplementedError, \"qsolve is currently only implemented for homogeneous systems (i.e., with rhs=0)\"\n out, err = self.call_4ti2('qsolve', options=options)\n qhom = ExtremalRays(self._read_fi...
[ "0.6241606", "0.6148683", "0.5991751", "0.5882897", "0.5864265", "0.5864265", "0.5854156", "0.5815089", "0.57524", "0.5718916", "0.56797683", "0.564325", "0.5630615", "0.5611269", "0.5610496", "0.56033105", "0.55892944", "0.55485725", "0.55240804", "0.5521097", "0.5519906", ...
0.73338413
0
Run the SfM factorization on a set of points. points will be an array with shape (num_frames, num_points, 2)
def sfm(points): # Construct the required W/Rh/Sh matrices. # Get ih/jh from Rh and use them to find Q. # Use Q, Rh, and Sh to get R and S. # Extract the F 2x3 rotation matrices from R and form an (F,2,3) array of # rotation matrices. # Build an orthonormal matrix that rotates the first R m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sp2mfe(sp):\n return np.dot(sp,fb.T)", "def FPS(points, snum, save_fn):\n with tf.device('/gpu:0'):\n pts_data = np.array(points).astype('float32')\n if len(pts_data.shape) < 3:\n pts_data = np.expand_dims(pts_data, 0)\n pt_sample = tf.Variable(pts_data)\n # pdb.s...
[ "0.5975943", "0.5763397", "0.5726196", "0.5494718", "0.5407802", "0.53726435", "0.53275496", "0.5291048", "0.5277068", "0.52592564", "0.522678", "0.51935947", "0.5183583", "0.51783246", "0.51298887", "0.51186275", "0.51161283", "0.50533324", "0.50484854", "0.5037496", "0.5022...
0.60149163
0
Given a set of images and 4 points for each image representing a quadrilateral planar region, extract a square texture of size texture_size containing the pixel values within the region averaged over all of the images You may use the imported OpenCV findHomography and warpPerspective functions.
def get_texture(images, region_points, texture_size=256): # Build a (4,2) array of X/Y texture coordinates for a # texture_size x texture_size square. The coordinates should # start at the top left (0,0) and proceed clockwise. for image, rect_points in zip(images, region_points): # Find a homo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_images_to_galaxy(self):\r\n\r\n left, right, top, bottom = 0, 0, 0, 0\r\n \r\n for _, img in self.images():\r\n seg_img = load_gals.get_seg_img(img)\r\n gal_val = seg_img[int(seg_img.shape[0] / 2), int(seg_img.shape[1] / 2)]\r\n inds = np.argwhere(seg_...
[ "0.5416749", "0.5303679", "0.5290608", "0.52169013", "0.51593566", "0.5159317", "0.5120584", "0.51170015", "0.51068276", "0.50936884", "0.50905704", "0.5082373", "0.50683004", "0.50675297", "0.50357467", "0.5005794", "0.50047696", "0.5002947", "0.49948925", "0.49871492", "0.4...
0.7357089
0
Create and print a formatted string of the Python JSON object
def jprint(obj): # text = json.dumps(obj, sort_keys=True, indent=4) print(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_json(obj):\n print(json.dumps(obj, indent=2))", "def print_friendly_JSON_object(JSON_object):\n formatted_string = json.dumps(JSON_object, sort_keys=True, indent=4)\n print(formatted_string)", "def format(self, obj):\n return json.dumps(obj, sort_keys=True, indent=4, separators=(',', ...
[ "0.7738837", "0.77262264", "0.7652911", "0.7562521", "0.7512172", "0.73125386", "0.7222539", "0.7222539", "0.7188306", "0.71415734", "0.71262425", "0.71243536", "0.71220195", "0.71210355", "0.7102938", "0.7087172", "0.7087172", "0.7065974", "0.70607436", "0.70526266", "0.7051...
0.77629435
0
Remove comments from the string column of FTL Translations and Entities, and source & target columns of FTL TranslationMemoryEntries. See bug 1501168 for more details.
def remove_comments_from_ftl_translations(apps, schema): parser = FluentParser() serializer = FluentSerializer() # Translations Translation = apps.get_model('base', 'Translation') translations = Translation.objects.filter(entity__resource__format='ftl') translations_to_update = [] for t in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteComments(self: Self, event: Event = None) -> None:\n #@+<< deleteComments docstring >>\n #@+node:ekr.20171123135625.37: *3* << deleteComments docstring >>\n #@@pagewidth 50\n #@-<< deleteComments docstring >>\n c, p, u, w = self, self.p, self.undoer, self.frame.body.wrapper\n #\n # \...
[ "0.63007027", "0.60225815", "0.5909399", "0.5684708", "0.559779", "0.5582361", "0.5547229", "0.55372834", "0.54712635", "0.54712635", "0.538484", "0.5373036", "0.5370515", "0.53657305", "0.5343653", "0.5320726", "0.5320122", "0.5293025", "0.5290128", "0.5279373", "0.52651274"...
0.6996354
0
Calculate the intersection of multiple sets. Returns None if the sequence is empty (intersection is undefined in that case).
def intersection(seq: Iterable[AbstractSet[VT]]) -> Optional[Set[VT]]: it = iter(seq) try: ret = set(next(it)) except StopIteration: return None for elem in it: ret &= elem return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(sets):\n return functools.reduce(set.intersection, [s for s in sets])", "def intersection(*seqs):\n return (item for item in seqs[0]\n if all(item in seq for seq in seqs[1:]))", "def intersection(seq, *seqs):\n yield from intersectionby(None, seq, *seqs)", "def inter...
[ "0.73543805", "0.7323059", "0.7238087", "0.72340417", "0.7164058", "0.71342057", "0.7057006", "0.70209986", "0.6982457", "0.6818658", "0.67081434", "0.66939795", "0.6664711", "0.6597815", "0.6597815", "0.6597815", "0.6597815", "0.6546341", "0.64577156", "0.64117146", "0.64100...
0.7758402
0
Deal with the sections, parse tags that contains
def deal_with_sections(self): self.data_sections = [] self.create_parser_sections(self.soup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n for section in self.sections:\n section.parse()", "def parse_section(self, root, fmt):\n return self.parse_tag(root, fmt)", "def parse_section(soup):\n section_tag = soup.find_all('a', {'class': 'advisory-severity-vote__message'})\n section_scale = [code.string...
[ "0.7145104", "0.670612", "0.6648321", "0.663754", "0.6276728", "0.6140698", "0.6139788", "0.6085154", "0.6074952", "0.6010655", "0.60064274", "0.5991036", "0.5880521", "0.5871931", "0.5843928", "0.5817745", "0.58112407", "0.56929976", "0.5691535", "0.5638269", "0.5634737", ...
0.7188599
0
Save the soup to a file to be analysed. This can be used during the debugging process.
def save_soup_to_file(self, filename='soup.html', prettify=True): with open(filename, 'w', encoding='utf-8') as fd_div: if prettify: fd_div.write(self.soup.prettify()) fd_div.write('\n') else: # for item in self.soup: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_page(soup, fileName):\r\n soup.prettify(formatter='html')\r\n\r\n with open(fileName, 'wb') as f:\r\n f.write(str(soup).encode('utf-8'))", "def save(self, filename):\n outfile = open(filename, \"w\")\n outfile.write(self.html.encode('utf8'))\n outfile.close()", "def ...
[ "0.69119775", "0.68967545", "0.6814837", "0.678686", "0.6609632", "0.6512527", "0.6495282", "0.64832926", "0.6460627", "0.6437362", "0.6279404", "0.62464994", "0.6237458", "0.62224764", "0.61950946", "0.61732525", "0.6168661", "0.614357", "0.6141181", "0.6113128", "0.6081286"...
0.8114595
0
Remove tags from bs4 soup object using a list of bs4 rules to find_all()
def remove_tags(self, rules): for rule in rules: [s.extract() for s in self.soup.find_all(**rule)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tag(self, rules):\n for rule in rules:\n [s.extract() for s in self.soup.find_all(limit=1, **rule)]", "def strip_tags(self, rules):\n tags = list()\n for rule in rules:\n for tag in self.soup.find_all(**rule):\n tag.replace_with_children()\n ...
[ "0.8494302", "0.77870476", "0.7570323", "0.6667215", "0.6545679", "0.6504235", "0.64213884", "0.6260987", "0.6136997", "0.60621667", "0.599809", "0.5997039", "0.5977512", "0.5962853", "0.59545106", "0.5896528", "0.588618", "0.58397466", "0.57758904", "0.5770293", "0.57565296"...
0.83712757
1
Remove the first found tag from bs4 soup object using a list of bs4 rules to find_all() Remove the first tag.
def remove_tag(self, rules): for rule in rules: [s.extract() for s in self.soup.find_all(limit=1, **rule)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tags(self, rules):\n for rule in rules:\n [s.extract() for s in self.soup.find_all(**rule)]", "def remove_unwanted_tags(soup: bs4.BeautifulSoup):\n for tag in soup.find_all(['script', 'style']):\n tag.decompose()", "def remove_empty_tags(soup, tag_name, recursive=False):\...
[ "0.6875533", "0.66250354", "0.6624276", "0.63994205", "0.6261287", "0.5753556", "0.5697915", "0.5612316", "0.5603596", "0.55581594", "0.54788345", "0.5478544", "0.54722995", "0.5456739", "0.5419763", "0.53666866", "0.5362756", "0.5354523", "0.5345727", "0.5335365", "0.5324092...
0.7566524
0
Create a tag inside a bs4 soup object from a selection using a rule.
def create_tag_from_selection(self, rule, name_new_tag, name_section='Abstract'): inside_tags = self.soup.find_all(**rule) section = self.soup.new_tag('section_{}'.format(name_new_tag)) heading = self.soup.new_tag('h2') heading.append(name_section) section.append(heading) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tag_sections(self, rule=None):\n tag_names = ['h{}'.format(i) for i in range(1, 6)]\n for tag_name in tag_names:\n tags = self.soup.find_all(tag_name) # Tags corresponded to headings\n for each_tag in tags:\n inside_tags = [item for item in itertools.t...
[ "0.5257915", "0.51351243", "0.5075911", "0.50490224", "0.48048347", "0.48014548", "0.4702285", "0.46681097", "0.46524996", "0.46381027", "0.4610205", "0.44818646", "0.44637433", "0.4461058", "0.4441869", "0.4416578", "0.44047773", "0.43896973", "0.43789333", "0.43644205", "0....
0.7169499
0
Return ``data`` (``bytes``) piped through Graphviz ``engine`` into ``format`` as ``bytes``.
def pipe(engine: str, format: str, data: bytes, renderer: typing.Optional[str] = None, formatter: typing.Optional[str] = None, quiet: bool = False) -> bytes: cmd = command(engine, format, renderer=renderer, formatter=formatter) kwargs = {'input': data} proc = run_check(cmd, captu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipeline2dot(pipe, data, **params):\n raw_data = data\n data = OrderedDict()\n if isinstance(raw_data, pandas.DataFrame):\n for k, c in enumerate(raw_data.columns):\n data[c] = 'sch0:f%d' % k\n elif isinstance(raw_data, numpy.ndarray):\n if len(raw_data.shape) != 2:\n ...
[ "0.5745151", "0.5555182", "0.5413819", "0.53791255", "0.5372635", "0.53422517", "0.5323139", "0.524208", "0.51908976", "0.51894003", "0.51610243", "0.51464564", "0.5119918", "0.5075732", "0.5058698", "0.5002419", "0.49949446", "0.49824095", "0.4963268", "0.49587408", "0.49507...
0.5821977
0
Return ``input_string`` piped through Graphviz ``engine`` into ``format`` as ``str``.
def pipe_string(engine: str, format: str, input_string: str, *, encoding: str, renderer: typing.Optional[str] = None, formatter: typing.Optional[str] = None, quiet: bool = False) -> str: cmd = command(engine, format, renderer=renderer, formatter=formatt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipe_lines_string(engine: str, format: str, input_lines: typing.Iterator[str],\n *, encoding: str,\n renderer: typing.Optional[str] = None,\n formatter: typing.Optional[str] = None,\n quiet: bool = False) -> str:\n cmd = com...
[ "0.6254893", "0.58393633", "0.5770029", "0.54757094", "0.54306865", "0.5411699", "0.5408644", "0.5379858", "0.5372143", "0.5352482", "0.53347826", "0.5331266", "0.52636224", "0.5218286", "0.5188129", "0.5173873", "0.5168962", "0.5168962", "0.5149738", "0.5136821", "0.5133094"...
0.66071606
0
r"""Return ``input_lines`` piped through Graphviz ``engine`` into ``format`` as ``bytes``.
def pipe_lines(engine: str, format: str, input_lines: typing.Iterator[str], *, input_encoding: str, renderer: typing.Optional[str] = None, formatter: typing.Optional[str] = None, quiet: bool = False) -> bytes: cmd = command(engine, format, renderer=rendere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipe_lines_string(engine: str, format: str, input_lines: typing.Iterator[str],\n *, encoding: str,\n renderer: typing.Optional[str] = None,\n formatter: typing.Optional[str] = None,\n quiet: bool = False) -> str:\n cmd = com...
[ "0.61697996", "0.529381", "0.5169942", "0.5108336", "0.5096991", "0.5089665", "0.49354553", "0.4926845", "0.48710537", "0.4858232", "0.4847835", "0.483394", "0.48286122", "0.48206902", "0.48160985", "0.47986445", "0.4794481", "0.47861627", "0.4775213", "0.4770948", "0.4713867...
0.72306937
0
r"""Return ``input_lines`` piped through Graphviz ``engine`` into ``format`` as ``str``.
def pipe_lines_string(engine: str, format: str, input_lines: typing.Iterator[str], *, encoding: str, renderer: typing.Optional[str] = None, formatter: typing.Optional[str] = None, quiet: bool = False) -> str: cmd = command(engin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipe_lines(engine: str, format: str, input_lines: typing.Iterator[str],\n *, input_encoding: str,\n renderer: typing.Optional[str] = None,\n formatter: typing.Optional[str] = None,\n quiet: bool = False) -> bytes:\n cmd = command(engine, format, render...
[ "0.6733793", "0.5717532", "0.5580296", "0.5483241", "0.53632164", "0.52603775", "0.52583337", "0.52485454", "0.52419585", "0.5237028", "0.52271277", "0.52254957", "0.5171651", "0.5157024", "0.5115239", "0.5077523", "0.5072391", "0.5067369", "0.5050122", "0.5046749", "0.504083...
0.6918139
0
Return DOT ``source`` piped through Graphviz unflatten preprocessor.
def unflatten(source: str, stagger: typing.Optional[int] = None, fanout: bool = False, chain: typing.Optional[int] = None, encoding: str = ENCODING) -> str: if fanout and stagger is None: raise RequiredArgumentError('fanout given without stagger') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source(node):\n return compiler.walk(node,visitor()).src", "def get_source(self) -> str:\n return unparse(self.tree)", "def preprocess(self, source, name, filename=None):\n if not name or not os.path.splitext(name)[1] in self.environment.file_extensions:\n return source\n ...
[ "0.6164927", "0.60988575", "0.58390117", "0.58158195", "0.56476647", "0.5595404", "0.55704796", "0.54695565", "0.54542994", "0.53434557", "0.5338454", "0.52110535", "0.5172719", "0.51634973", "0.5150302", "0.514226", "0.5102451", "0.5101248", "0.50798005", "0.5070926", "0.506...
0.6230079
0
Return the version number tuple from the ``stderr`` output of ``dot V``.
def version() -> typing.Tuple[int, ...]: cmd = [DOT_BINARY, '-V'] log.debug('run %r', cmd) proc = run_check(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='ascii') ma = re.search(r'graphviz version' r' ' r'(\d+)\.(\d+)' r'(?:\.(\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version():\n with settings(hide('running', 'warnings'), warn_only=True):\n res = local('vagrant --version', capture=True)\n if res.failed:\n return None\n line = res.splitlines()[-1]\n version = re.match(r'Vagrant (?:v(?:ersion )?)?(.*)', line).group(1)\n return tuple(_to_int(part)...
[ "0.6124963", "0.60885113", "0.5935639", "0.57704717", "0.5638784", "0.5634477", "0.55732274", "0.5529228", "0.545926", "0.54546577", "0.5447036", "0.5417734", "0.5413174", "0.5405824", "0.5403854", "0.5388346", "0.53701687", "0.5362312", "0.5341649", "0.5338153", "0.53360623"...
0.7328178
0
Return subprocess.STARTUPINFO instance hiding the console window.
def get_startupinfo(): startupinfo = subprocess.STARTUPINFO() # pytype: disable=module-attr startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr startupinfo.wShowWindow = subprocess.SW_HIDE # pytype: disable=module-attr return startupinfo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_no_wait(command, **popen_kwargs):\n if subprocess.mswindows:\n startupinfo = subprocess.STARTUPINFO()\n startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW\n popen_kwargs['startupinfo'] = startupinfo\n\n extended_env = get_extended_env()\n\n process = subprocess.Popen(\n ...
[ "0.5445847", "0.5068875", "0.4956035", "0.48601747", "0.47777396", "0.47746158", "0.47705573", "0.47445047", "0.4648698", "0.46116912", "0.45981306", "0.4597618", "0.45688903", "0.4568066", "0.4558782", "0.45507377", "0.45243064", "0.4502743", "0.4497576", "0.44913495", "0.44...
0.7814508
0
Return None for startupinfo argument of ``subprocess.Popen``.
def get_startupinfo() -> None: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_startupinfo():\n startupinfo = subprocess.STARTUPINFO() # pytype: disable=module-attr\n startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr\n startupinfo.wShowWindow = subprocess.SW_HIDE # pytype: disable=module-attr\n return startupinfo", "...
[ "0.74116313", "0.5801284", "0.5455187", "0.54010653", "0.53217965", "0.52510387", "0.52332073", "0.51812404", "0.5168039", "0.51029634", "0.5048516", "0.5048516", "0.5044696", "0.50266993", "0.49940917", "0.4978078", "0.49363893", "0.49302343", "0.49073413", "0.4896389", "0.4...
0.7570563
0
Install a default admin user and add an admin role to it.
def install(): # check if admin exists from enferno.user.models import Role a = Role.query.filter(Role.name == 'admin').first() if a is None: r = Role(name='admin') try: db.session.add(r) db.session.commit() u = click.prompt('Admin Email?', default='a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_admin():\n admin_role = Role.query.filter_by(permissions=0xFF).first()\n admin = User.query.filter_by(email=current_app.config['PILI_ADMIN']).first()\n if not admin:\n admin_user = User(\n email=current_app.config['PILI_ADMIN'],\n username=curre...
[ "0.7185216", "0.7116533", "0.7033214", "0.68818015", "0.66818506", "0.6670618", "0.6602122", "0.65950525", "0.65218127", "0.6447902", "0.6413881", "0.6331784", "0.6317065", "0.62546134", "0.6245582", "0.62319773", "0.62319773", "0.62292063", "0.6199548", "0.6181536", "0.61603...
0.72258955
0
Remove .pyc and .pyo files recursively starting at current directory. Borrowed from FlaskScript, converted to use Click.
def clean(): for dirpath, dirnames, filenames in os.walk('.'): for filename in filenames: if filename.endswith('.pyc') or filename.endswith('.pyo'): full_pathname = os.path.join(dirpath, filename) click.echo('Removing {}'.format(full_pathname)) os....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_pyc_files():\n with settings(warn_only=True):\n with cd(env.code_dir):\n sudo('find . -name \"*.pyc\" -exec rm {} \\;')", "def clean_python(c):\n c.run(\"find . -name '*.pyc' -exec rm -f {} +\")\n c.run(\"find . -name '*.pyo' -exec rm -f {} +\")\n c.run(\"find . -name '*~...
[ "0.82912546", "0.7869817", "0.77186435", "0.770085", "0.75403976", "0.74685585", "0.74342155", "0.7177044", "0.7157621", "0.7092455", "0.70719796", "0.68412036", "0.6777637", "0.6777637", "0.67209095", "0.66712123", "0.6663641", "0.65910006", "0.6589809", "0.65644103", "0.651...
0.8256154
1
Plot image of given depth
def imshow(self, depth): layer = self.cube[depth] img = [] for i in range(self.height): img.append([layer[i][j].value for j in range(self.width)]) plt.imshow(img, cmap='gray') plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_glide_depths(depths, mask_tag_filt):\n import numpy\n\n from . import plotutils\n\n fig, ax = plt.subplots()\n\n ax = plotutils.plot_noncontiguous(ax, depths, numpy.where(mask_tag_filt)[0])\n ax.invert_yaxis()\n\n plt.show()\n\n return None", "def plot_well_depth(self):\n fig...
[ "0.65465724", "0.6293776", "0.62561876", "0.62431103", "0.62291616", "0.6226079", "0.62257254", "0.6224469", "0.6208157", "0.6181805", "0.6156093", "0.61438584", "0.6133444", "0.6118609", "0.6116789", "0.6116789", "0.6116789", "0.61166316", "0.6115073", "0.6078475", "0.605519...
0.7406107
0
main entrypoint for pyout simple example
def main(): parser = get_parser() def help(return_code=0): """print help, including the software version and active client and exit with return code. """ print("\npyout v%s" % pyout.__version__) parser.print_help() sys.exit(return_code) # If an error oc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n return", "def main(args=None):", "def main(args=None):", "def main(args):\n # Results: print to console and also write to output file\n pass", "def main() -> None:", "def main() -> None:", "def main() -> None:", "def main() -> None:", "def main(args=None):\n app()\n ret...
[ "0.68645716", "0.6821353", "0.6821353", "0.67814094", "0.6771033", "0.6771033", "0.6771033", "0.6771033", "0.67264724", "0.67020386", "0.6670861", "0.6638433", "0.66318727", "0.66093105", "0.66093105", "0.66093105", "0.66093105", "0.6572008", "0.6541942", "0.6541942", "0.6540...
0.71005654
0
Given an input file and a delimiter, read it in and generate a pyout Tabular table to print to the console.
def generate_table(input_file, delim=",", header=True): input_file = os.path.abspath(input_file) if not os.path.exists(input_file): sys.exit("%s does not exist." % input_file) # Read in rows with user specified delimiter rows = read_rows(input_file, delim=delim) # Generate tabulars expecte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(file_path, separator='\\t'):\n\n\ttable = []\n\twith open(file_path) as file:\n\t\tfor line in file:\n\t\t\t# Remove newline character.\n\t\t\tline = line.rstrip('\\n')\n\t\t\t\n\t\t\t# Parse the line.\n\t\t\trow = line.split(separator)\n\n\t\t\ttable.append(row)\n\n\treturn table", "def tsv_gener...
[ "0.6365776", "0.6235281", "0.6129745", "0.6129745", "0.6091581", "0.6068329", "0.6058738", "0.6048446", "0.60038877", "0.59615177", "0.5877478", "0.5800982", "0.57886297", "0.5696215", "0.56674856", "0.5622929", "0.55715847", "0.55473804", "0.5529686", "0.55277234", "0.552772...
0.73263705
0
Compute the empirical CDF of the sample 'x' and evaluate it at datapoints 'xi'. This function is called internally in RSA_thres.compute_indices and RSA_groups.compute_indices to calculate the input CDFs.
def empiricalcdf(x, xi): ########################################################################### # Check inputs ########################################################################### if not isinstance(x, np.ndarray): raise ValueError('"x" must be a numpy.array.') if x.dtype....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(self, x):\n\n pi = 3.1415926536\n mean = self.mean\n stddev = self.stddev\n\n x1 = (x - mean) / (stddev * (2 ** 0.5))\n\n erf1 = (2/pi**0.5)\n erf2 = (x1-((x1**3)/3)+((x1**5)/10)-((x1**7)/42)+((x1**9)/216))\n erf = erf1 * erf2\n cdf = (1/2)*(1+erf)\n\...
[ "0.69266355", "0.69214094", "0.69214094", "0.6914141", "0.68764466", "0.6758876", "0.66747475", "0.66608214", "0.65801144", "0.6571776", "0.6469703", "0.6457943", "0.6447456", "0.63774574", "0.6353632", "0.62779135", "0.6256293", "0.6246077", "0.6245759", "0.61944", "0.619059...
0.75315416
0
This function produces scatter plots of X[i1] against X[i2]. The marker colour is proportional to the value of Y.
def scatter_plots_col(X, Y, i1, i2, ms=7, X_Labels=[], Y_Label='Y', ax=[]): # Options for the graphic pltfont = {'fontname': 'Bitstream Vera Sans', 'fontsize': 15} # font # Colorscale colorscale = 'jet' #colorscale = 'gray' # black and white plot #######################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatterPlot2():\n N = 100\n x = np.random.rand(N)\n y = np.random.rand(N)\n colors = np.random.rand(N)\n\n plt.scatter(x, y, c=colors, alpha=0.5)\n plt.show()", "def plot_scatter(x, y):\n\tplt.scatter(x, y)", "def plot_points(x, y):\n x_one = x[y == -1, :]\n x_two = x[y == 1, :]\n\n...
[ "0.71140313", "0.69723463", "0.6817191", "0.67054677", "0.66604096", "0.6649407", "0.6608744", "0.65191203", "0.6509968", "0.65001076", "0.6464415", "0.6463723", "0.63981", "0.63730437", "0.63573474", "0.63559175", "0.6354318", "0.63027215", "0.63024336", "0.62980604", "0.628...
0.722757
0
This function plot the empirical Cumulative Distribution Function (CDF) of a given sample (y).
def plot_cdf(Y, Y_Label='Y'): # Options for the graphic pltfont = {'fontname': 'Bitstream Vera Sans', 'fontsize': 15} # font lc = 'k' # line colour ########################################################################### # Check inputs ###############################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(self, alpha): #Plot empirical cfd with confidence interval\n x = self.x\n n = len(x)\n y = np.arange(1, n+1)/n\n \n #Computing confidence interval with the Dvoretzky–Kiefer–Wolfowitz method based on the empirical points\n F1 = []\n F2 = []\n for i in ...
[ "0.72035897", "0.6797092", "0.66657126", "0.6557169", "0.6513908", "0.6484057", "0.6463381", "0.64624864", "0.64501673", "0.6449529", "0.6449529", "0.641028", "0.6400101", "0.6282225", "0.62478644", "0.61759305", "0.6134407", "0.6084292", "0.6021003", "0.60009956", "0.5982908...
0.74187386
0
Transductive PACBayesian bound obtained with a specified ''Dfunction''. See Theorem 5 of Begin et al. (2014) for details.
def compute_general_transductive_gibbs_bound(d_function, empirical_gibbs_risk, m, N, KLQP, delta=0.05, complexity_term=None): if complexity_term is None: complexity_term = compute_transductive_complexity_term(d_function, m, N) m_over_N = float(m)/N right_hand_side = ( KLQP + log( co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PGD(Params, relaxationVars, fixedBs, fixedTs, data):\n Tol = Params[\"tol\"]\n TolCD = Params[\"tolCD\"]\n Lambda0 = Params[\"Lambda\"]\n Lambda1 = Params[\"alpha\"] * Lambda0\n M = Params[\"M\"]\n y = data.ycentered # data.y - data.ybar\n\n Bindices = relaxationVars.BActive.copy() # lis...
[ "0.58839214", "0.55378145", "0.5463493", "0.5463493", "0.5463493", "0.5460533", "0.5451618", "0.5363957", "0.53538585", "0.5353578", "0.5339323", "0.53147376", "0.5305465", "0.5302172", "0.5283621", "0.51917964", "0.5176923", "0.5163032", "0.5151974", "0.514702", "0.5128174",...
0.5691414
1