query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
MonteCarloP calcs a pvalue from a val and list of random vals
def test_MonteCarloP(self): val = 3.0 random_vals = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] # test for "high" tail (larger values than expected by chance) p_val = MonteCarloP(val, random_vals, 'high') self.assertEqual(p_val, 0.7) # test for "low" tail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MonteCarloP(value, rand_values, tail='high'):\r\n pop_size = len(rand_values)\r\n rand_values.sort()\r\n if tail == 'high':\r\n num_better = pop_size\r\n for i, curr_val in enumerate(rand_values):\r\n if value <= curr_val:\r\n num_better = i\r\n b...
[ "0.69069713", "0.64986116", "0.6078979", "0.60509866", "0.59458214", "0.5939556", "0.5934664", "0.5890255", "0.5845607", "0.5830554", "0.58179206", "0.58139086", "0.58129823", "0.5778573", "0.57759005", "0.57329464", "0.5719441", "0.5702878", "0.5702018", "0.5702018", "0.5702...
0.7427385
0
Test correct sorting of different data types
def test_signed_sort(self): # an empty list must be returned when an empty list needs to be sorted self.assertEqual(signed_natsort([]), []) # tuples that can be sorted by type-casting the first element test_list = [('9', 'SampleA'), ('-1', 'SampleD'), ('7', 'SampleC'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSort(self):\n numlist = [6,4.78,1.2,5]\n numlist.sort()\n self.assertEqual([1.2,4.78,5,6],numlist)\n \n strlist = [\"kgb\",\"mss\",\"cheka\"]\n strlist.sort()\n self.assertEqual([\"cheka\",\"kgb\",\"mss\"],strlist) \n \n # -----------...
[ "0.7092075", "0.68638074", "0.6664304", "0.65875995", "0.65537965", "0.65115535", "0.6486401", "0.64831835", "0.6455502", "0.64523315", "0.6400193", "0.6400193", "0.63637185", "0.6339312", "0.6298116", "0.627685", "0.62749624", "0.62458575", "0.62178886", "0.62110156", "0.621...
0.6379586
12
SeqQualBad should apply correct function
def test_call(self): f = lambda id_, seq, qual: len(seq) > 3 s1 = 'aa' s2 = 'aaaa' sq = SeqQualBad('Q', f) self.assertEqual(sq('x', s1, [1, 2, 3]), False) self.assertEqual(sq('y', s2, [1, 2, 3]), True) self.assertEqual(sq.FailedIds, ['y'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str(self):\r\n f = lambda id_, seq, qual: len(seq) > 3\r\n s1 = 'aa'\r\n s2 = 'aaaa'\r\n sq = SeqQualBad('Q', f)\r\n self.assertEqual(sq('x', s1, [1, 2, 3]), False)\r\n self.assertEqual(str(sq), 'Q\\t0')\r\n self.assertEqual(sq('y', s2, [1, 2, 3]), True)\r\...
[ "0.614135", "0.60520554", "0.60089314", "0.5960278", "0.5845161", "0.5727147", "0.56888014", "0.56650746", "0.5642437", "0.561796", "0.5563314", "0.5552838", "0.5520526", "0.5506492", "0.5484893", "0.54627264", "0.54343426", "0.5412817", "0.5385918", "0.53731793", "0.5372889"...
0.7215726
0
SeqQualBad should apply correct function
def test_str(self): f = lambda id_, seq, qual: len(seq) > 3 s1 = 'aa' s2 = 'aaaa' sq = SeqQualBad('Q', f) self.assertEqual(sq('x', s1, [1, 2, 3]), False) self.assertEqual(str(sq), 'Q\t0') self.assertEqual(sq('y', s2, [1, 2, 3]), True) self.assertEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_call(self):\r\n f = lambda id_, seq, qual: len(seq) > 3\r\n s1 = 'aa'\r\n s2 = 'aaaa'\r\n sq = SeqQualBad('Q', f)\r\n self.assertEqual(sq('x', s1, [1, 2, 3]), False)\r\n self.assertEqual(sq('y', s2, [1, 2, 3]), True)\r\n self.assertEqual(sq.FailedIds, ['y']...
[ "0.7215726", "0.60520554", "0.60089314", "0.5960278", "0.5845161", "0.5727147", "0.56888014", "0.56650746", "0.5642437", "0.561796", "0.5563314", "0.5552838", "0.5520526", "0.5506492", "0.5484893", "0.54627264", "0.54343426", "0.5412817", "0.5385918", "0.53731793", "0.5372889...
0.614135
1
Test setter for dms on invalid input data.
def test_DistanceMatrices_setter_invalid(self): # Allows testing of non-callable property setter that raises errors. # Idea was obtained from http://stackoverflow.com/a/3073049 self.assertRaises(TypeError, setattr, self.empty_dms, 'DistanceMatrices', None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_property_invalid(self):\n\n self.assertRaises(DataObjectError,\n setattr(self, \"foobar\", \"some value\")\n )", "def test_Alpha_setter_invalid(self):\r\n self.assertRaises(ValueError, setattr, self.mc, 'Alpha', -5)\r\n self.assertRaises(ValueError, setattr, self.m...
[ "0.67700034", "0.67351973", "0.66960865", "0.6675565", "0.6642064", "0.6620681", "0.6586522", "0.6521533", "0.6393385", "0.63860404", "0.6336834", "0.6327808", "0.6252038", "0.6229749", "0.61951184", "0.6128106", "0.60890394", "0.6086999", "0.6051094", "0.5954277", "0.5950720...
0.6394959
8
Set up correlation stats instances for use in tests.
def setUp(self): super(CorrelationStatsTests, self).setUp() self.cs = CorrelationStats([self.overview_dm, self.overview_dm])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_correlations(self) -> None:\n pass", "def setUp(self):\r\n super(CorrelationTests, self).setUp()\r\n\r\n # For testing spearman and correlation_test using method='spearman'.\r\n # Taken from the Spearman wikipedia article. Also used for testing\r\n # Pearson (verified ...
[ "0.66205704", "0.65938514", "0.64253557", "0.6363382", "0.62880164", "0.6172049", "0.61055905", "0.61038965", "0.60784465", "0.5943968", "0.5926849", "0.5908632", "0.589366", "0.58215433", "0.5804072", "0.5732656", "0.5720282", "0.5717338", "0.5714809", "0.5712495", "0.569234...
0.8043287
0
Test setting dms with mismatching sample ID labels.
def test_DistanceMatrices_setter_mismatched_labels(self): mismatch = DistanceMatrix(array([[0]]), ['s2']) self.assertRaises(ValueError, setattr, self.cs, 'DistanceMatrices', [self.single_ele_dm, mismatch]) # Also test that constructor raises this error. s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_labels_sampleids_all_valid(self):\r\n\r\n fasta_labels = ['seq1_1', 'seq1_2', 'seq2_3', 'seq1_4', 'seq4_5']\r\n\r\n sample_ids = ['seq1', 'seq2', 'seq3', 'seq4']\r\n\r\n total_seq_count = 5\r\n\r\n perc_not_valid, perc_nosampleid_match =\\\r\n check_labels_samp...
[ "0.6430758", "0.6430221", "0.63667476", "0.6117575", "0.6070567", "0.60578406", "0.5993584", "0.5990566", "0.597775", "0.59336007", "0.5856553", "0.5849612", "0.5842134", "0.58159816", "0.5815432", "0.5811253", "0.58012134", "0.5773082", "0.57083696", "0.57036763", "0.5692382...
0.6118285
3
Test setting dms with mismatching dimensions.
def test_DistanceMatrices_setter_wrong_dims(self): self.assertRaises(ValueError, setattr, self.cs, 'DistanceMatrices', [self.overview_dm, self.single_ele_dm]) # Also test that constructor raises this error. self.assertRaises(ValueError, CorrelationStats, [self.overv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_DistanceMatrices_setter_too_small(self):\r\n self.assertRaises(ValueError, setattr, self.size_dms,\r\n 'DistanceMatrices', [self.single_ele_dm, self.single_ele_dm])", "def test_DistanceMatrices_setter_wrong_number(self):\r\n self.assertRaises(ValueError, setattr, s...
[ "0.6928108", "0.6874212", "0.6849712", "0.6819833", "0.68031293", "0.67870945", "0.6766845", "0.6741331", "0.6738196", "0.6481065", "0.6429381", "0.64163303", "0.63790584", "0.6352786", "0.6330706", "0.6317768", "0.6260689", "0.62161106", "0.6197809", "0.61875194", "0.617473"...
0.72167075
0
Test for compatible sample IDs between dms and mdmap.
def test_validate_compatibility(self): self.assertEqual(self.cs_overview._validate_compatibility(), None) self.cs_overview.DistanceMatrices = [self.single_ele_dm] self.assertRaises(ValueError, self.cs_overview._validate_compatibility) self.cs_overview.DistanceMatrices = [self.ove...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_map_sample_ids(self):\r\n expected = ['s4', 's1', 's2', 's3']\r\n actual = map_sample_ids(self.sample_ids1, self.sample_id_map1)\r\n self.assertEqual(actual, expected)\r\n expected = ['s1', 's2', 's3', 's4']\r\n actual = map_sample_ids(self.sample_ids2, self.sample_id_ma...
[ "0.7112644", "0.7062698", "0.70477545", "0.66064286", "0.6537797", "0.64481264", "0.6377024", "0.6225622", "0.6208677", "0.61173064", "0.61093485", "0.6098548", "0.60719407", "0.6068969", "0.5986515", "0.5968269", "0.59656614", "0.5954786", "0.5944907", "0.5925963", "0.591942...
0.0
-1
Test retrieving the value of alpha.
def test_Alpha_getter(self): self.assertEqual(self.mc.Alpha, 0.05)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha(self):\n return self._alpha", "def alpha(self):\n return self._alpha", "def alpha(self):\n return self._alpha", "def Alpha(self):\r\n return self._alpha", "def pvalue_alpha(self):\n return self._pvalue_alpha", "def alpha(self) -> float:\n return self._a...
[ "0.7561801", "0.7561801", "0.7561801", "0.742706", "0.74048764", "0.73612374", "0.7214624", "0.7214082", "0.71475494", "0.71227735", "0.7079877", "0.694268", "0.6941437", "0.6905684", "0.6904693", "0.69039196", "0.68581414", "0.68114007", "0.66682154", "0.66522425", "0.663632...
0.7855992
0
Test setting the value of alpha with an invalid value.
def test_Alpha_setter_invalid(self): self.assertRaises(ValueError, setattr, self.mc, 'Alpha', -5) self.assertRaises(ValueError, setattr, self.mc, 'Alpha', 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_alpha(alpha: Any) -> None:\n with pytest.raises(ValueError, match=r\".*Invalid alpha.*\"):\n check_alpha(alpha=alpha)", "def test_valid_alpha(alpha: Any) -> None:\n check_alpha(alpha=alpha)", "def Alpha(self, alpha):\r\n if alpha >= 0 and alpha <= 1:\r\n self._al...
[ "0.74858946", "0.73676944", "0.73237574", "0.70234877", "0.686579", "0.68463796", "0.6826726", "0.6750497", "0.6745764", "0.6743646", "0.6663638", "0.66208637", "0.66052175", "0.6544802", "0.6502486", "0.64970905", "0.6417649", "0.64174455", "0.63266647", "0.6166965", "0.6147...
0.7037886
3
padding a coordinates matrix with zeros functions as expected
def test_pad_coords_matrix(self): m = array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) actual = pad_coords_matrix(m, 0) assert_almost_equal(actual, m) m = array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) expected = array([[1, 2, 3, 0., 0.], [4, 5, 6, 0., 0.], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pad_with_zeros(self, X, margin):\n newX = np.zeros((X.shape[0] + 2 * margin, X.shape[1] + 2 * margin, X.shape[2]))\n x_offset = margin\n y_offset = margin\n newX[x_offset:X.shape[0] + x_offset, y_offset:X.shape[1] + y_offset, :] = X\n return newX", "def zero_pad(X, padding...
[ "0.7033473", "0.68885094", "0.6868558", "0.6865582", "0.6816079", "0.67290765", "0.6593918", "0.65910506", "0.6558249", "0.6540293", "0.65077734", "0.6478265", "0.6456148", "0.64330906", "0.64061576", "0.6403077", "0.63520133", "0.63168234", "0.6306263", "0.6296674", "0.62596...
0.7036303
0
padding the correct choice of a coords matrix with zeros functions
def test_pad_coords_matrices(self): # first is longer m1 = array([[1, 0, 3, 9, 4], [4, 5, 6, 94, 5], [7, 8, 9, 6, 6], [10, 11, 12, 4, 6]]) m2 = array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) m2_expected = array([[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pad_coords_matrix(self):\r\n m = array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])\r\n actual = pad_coords_matrix(m, 0)\r\n assert_almost_equal(actual, m)\r\n\r\n m = array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])\r\n expected = array([[1, 2, 3, 0., 0.], [4,...
[ "0.7117952", "0.65868896", "0.65785515", "0.6501283", "0.64380693", "0.6399462", "0.6336972", "0.63358057", "0.6289226", "0.61283475", "0.61172956", "0.61025107", "0.6076333", "0.60524166", "0.60524166", "0.60518605", "0.6038858", "0.6012112", "0.5993603", "0.59513336", "0.59...
0.637023
6
Properly returns output filepaths
def test_get_output_filepaths(self): actual_fna_fp, actual_log_fp = get_output_filepaths(".", '/home/tests/seqs.fna') expected_fna_fp = "./seqs_rev_primer_truncated.fna" expected_log_fp = "./rev_primer_truncation.log" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_output_filepaths(self):\r\n\r\n output_dir = \".\"\r\n\r\n fasta_fp = \"seqs.fna\"\r\n\r\n qual_fp = \"seqs.qual\"\r\n\r\n expected_fasta_fp = \"./seqs_filtered.fasta\"\r\n expected_qual_fp = \"./seqs_filtered.qual\"\r\n\r\n actual_fasta_fp, actual_qual_fp =\\...
[ "0.734594", "0.7312007", "0.70702755", "0.7034646", "0.6986393", "0.69681424", "0.6931804", "0.68986213", "0.6857369", "0.68264735", "0.6799058", "0.6794141", "0.6794141", "0.678673", "0.6744922", "0.6697387", "0.66039425", "0.65911645", "0.6585443", "0.6569108", "0.65288097"...
0.71378
2
median_absolute_deviation returns MAD and median
def test_median_absolute_deviation(self): data = [0, 0, 0, 0, 0, 0] expected = (0, 0) self.assertEqual(median_absolute_deviation(data), expected) data = [1, 1, 1, 1, 1, 1] expected = (0, 1) self.assertEqual(median_absolute_deviation(data), expected) data = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median_absolute_deviation(values, q=None, return_median=False):\n if q is None:\n q = 1.482602218505602 # 1.0 / scipy.stats.norm.ppf(0.75)\n median = np.median(values)\n mad = q * np.median(np.abs(values - median))\n if return_median:\n return (median, mad)\n return mad", "def m...
[ "0.82259566", "0.8170646", "0.7970479", "0.7823791", "0.78015774", "0.77789927", "0.7706595", "0.7662235", "0.7658402", "0.76450974", "0.7635419", "0.76026976", "0.75772506", "0.757502", "0.7562948", "0.7513366", "0.74352425", "0.73555076", "0.7171446", "0.70960367", "0.70711...
0.8453222
0
Test correct validation of refnames
def test_is_valid_git_refname(self): # valid branchnames self.assertTrue(is_valid_git_refname('master')) self.assertTrue(is_valid_git_refname('debuggatron_2000')) self.assertTrue(is_valid_git_refname('refname/bar')) self.assertTrue(is_valid_git_refname('ref.nameslu/_eggs_/sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_git_refname(self):\n # valid branchnames\n self.assertTrue(is_valid_git_refname('master'))\n self.assertTrue(is_valid_git_refname('debuggatron_2000'))\n self.assertTrue(is_valid_git_refname('refname/bar'))\n self.assertTrue(is_valid_git_refname('ref.nameslu/_egg...
[ "0.7150435", "0.7047968", "0.69608057", "0.68386763", "0.6745208", "0.66999996", "0.6494315", "0.64755124", "0.64679325", "0.6362962", "0.6344786", "0.63308144", "0.63021445", "0.6261632", "0.62562066", "0.6192927", "0.61428964", "0.6124795", "0.6118343", "0.611327", "0.60924...
0.7153677
0
Create MetadataMap objects that will be used in the tests.
def setUp(self): # Create a map using the overview tutorial mapping file. self.overview_map_str = [ "#SampleID\tBarcodeSequence\tTreatment\tDOB\tDescription", "PC.354\tAGCACGAGCCTA\tControl\t20061218\t354", "PC.355\tAACTCGTCGATG\tControl\t20061218\t355", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n # Create a map using the overview tutorial mapping file.\n self.overview_map_str = [\n \"#SampleID\\tBarcodeSequence\\tTreatment\\tDOB\\tDescription\",\n \"PC.354\\tAGCACGAGCCTA\\tControl\\t20061218\\t354\",\n \"PC.355\\tAACTCGTCGATG\\tC...
[ "0.68473846", "0.6119218", "0.6092915", "0.6078074", "0.605229", "0.5994328", "0.5966472", "0.58847755", "0.5858641", "0.5824805", "0.58215755", "0.58207226", "0.58156586", "0.5807158", "0.58058745", "0.5805292", "0.5773067", "0.5772084", "0.57532537", "0.57523465", "0.574000...
0.677722
1
Test parsing a mapping file into a MetadataMap instance.
def test_parseMetadataMap(self): obs = MetadataMap.parseMetadataMap(self.overview_map_str) self.assertEqual(obs, self.overview_map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parseMetadataMap(self):\n obs = MetadataMap.parseMetadataMap(self.overview_map_str)\n self.assertEqual(obs, self.overview_map)", "def parseMetadataMap(lines):\r\n return MetadataMap(*parse_mapping_file_to_dict(lines))", "def test_mapping_file_to_dict(self):\r\n s1 = ['#samp...
[ "0.76381105", "0.7290793", "0.7073001", "0.6939293", "0.69154876", "0.6781981", "0.6752578", "0.67096996", "0.66310954", "0.65012664", "0.64911705", "0.6455028", "0.64299685", "0.64178264", "0.6411651", "0.6391864", "0.6345432", "0.6330246", "0.63205326", "0.63199586", "0.631...
0.76714677
0
Test metadata by sample ID accessor with valid sample IDs.
def test_getSampleMetadata(self): exp = {'BarcodeSequence': 'AGCACGAGCCTA', 'Treatment': 'Control', 'DOB': '20061218', 'Description': '354'} obs = self.overview_map.getSampleMetadata('PC.354') self.assertEqual(obs, exp) exp = {'BarcodeSequence': 'ACCAGCGACTAG', 'Tre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getSampleMetadata_bad_sample_id(self):\r\n # Nonexistent sample ID.\r\n self.assertRaises(KeyError, self.overview_map.getSampleMetadata,\r\n 'PC.000')\r\n self.assertRaises(KeyError, self.no_metadata.getSampleMetadata,\r\n 'PC.000')\r\...
[ "0.7431824", "0.7423145", "0.7369246", "0.7362075", "0.72175646", "0.7169284", "0.6952929", "0.6874879", "0.68736506", "0.6858345", "0.6702421", "0.6702421", "0.66929317", "0.6604854", "0.64635986", "0.6420688", "0.6412234", "0.63275015", "0.62831044", "0.62747246", "0.618264...
0.59749407
33
Test metadata by sample ID accessor with invalid sample IDs.
def test_getSampleMetadata_bad_sample_id(self): # Nonexistent sample ID. self.assertRaises(KeyError, self.overview_map.getSampleMetadata, 'PC.000') self.assertRaises(KeyError, self.no_metadata.getSampleMetadata, 'PC.000') # Intege...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getSampleMetadata_bad_sample_id(self):\n # Nonexistent sample ID.\n self.assertRaises(KeyError, self.overview_map.getSampleMetadata,\n 'PC.000')\n self.assertRaises(KeyError, self.no_metadata.getSampleMetadata,\n 'PC.000')\n # Integer sample ID.\n s...
[ "0.8162427", "0.7233724", "0.7197308", "0.71696544", "0.70223343", "0.68886316", "0.6872766", "0.6865513", "0.67051697", "0.66967005", "0.6626677", "0.6602173", "0.6586331", "0.6459241", "0.64281696", "0.6396801", "0.6368925", "0.636097", "0.6333778", "0.6319337", "0.62891454...
0.8133904
1
Test syncing removes samples bt only.
def test_mapping_file_removal(self): # doesn't change in test mf_exp, _ = parse_mapping_file_to_dict(self.MF_IN_2) bt_exp = parse_biom_table(self.BT_OUT_2) mf_obs, bt_obs, nonshared_samples = \ sync_biom_and_mf(parse_mapping_file_to_dict(self.MF_IN_2)[0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_intent_classifier_del_testing_samples_all(self):\n pass", "def test_delete_device(self):\n pass", "def test_delete_device(self):\n pass", "def test_mapping_file_removal(self):\r\n mf_exp, _ = parse_mapping_file_to_dict(self.MF_OUT_3)\r\n # bt doesn't change in this...
[ "0.6041369", "0.58838004", "0.58838004", "0.5843747", "0.5841256", "0.58092874", "0.58036286", "0.57898206", "0.57875687", "0.5752315", "0.5737191", "0.5715313", "0.5699778", "0.56901836", "0.5681198", "0.5674911", "0.5663646", "0.56626165", "0.5653162", "0.56387395", "0.5625...
0.5836076
5
Checks for mismatches between tree tips and fasta labels
def test_check_tree_exact_match(self): fasta_labels = ['seq1_1', 'seq1_2', 'seq2_3', 'seq3_4'] actual_subset_results = check_tree_exact_match(fasta_labels, self.sample_tree_3tips_fp) # Should find all and give True, True result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tree_exact_match(fasta_labels,\r\n tree_fp):\r\n\r\n # Need to get modified fasta labels with underscore stripped\r\n\r\n raw_fasta_labels = set([label.split('_')[0] for label in fasta_labels])\r\n\r\n tree_f = open(tree_fp, \"U\")\r\n\r\n tree = DndParser(tree_f)\r\...
[ "0.7472705", "0.6961766", "0.64668345", "0.61982507", "0.61708957", "0.60168505", "0.5910689", "0.5866582", "0.57653385", "0.5755649", "0.57268196", "0.57027036", "0.5677144", "0.56739706", "0.56739324", "0.5649226", "0.5646364", "0.5640952", "0.56364226", "0.5587625", "0.555...
0.7300454
1
Executes SQL query and returns DataFrame.
def db_to_df(query): conn = loader.database._connection return sql.read_frame(query, conn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, sql):\n df = pd.read_sql(sql, self.conn)\n return df", "def get_dataframe(q):\n cnx = create_engine(postgres_str)\n query = q\n return pd.read_sql_query(query, cnx)", "def run_query(query):\n db.query(query)\n dbResult = db.store_result()\n dbFetched = dbResult.f...
[ "0.84523284", "0.8120144", "0.80557394", "0.7880153", "0.77570075", "0.77549434", "0.7708188", "0.76731205", "0.7658008", "0.7648323", "0.76369375", "0.7636578", "0.7624598", "0.7564879", "0.75207096", "0.7504296", "0.7453938", "0.7449333", "0.7306037", "0.72851914", "0.72777...
0.7391846
18
Return the same library that the server uses.
def get_library(self, name = 'default'): from ambry.library import new_library config = self.server_rc.library(name) l = new_library(config, reset = True) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def library( self ) :\n\n return( self.__library )", "def library(self):\n if not self._library:\n self._library = Library(self, self.query('/library/'))\n return self._library", "def get_library(self):\n \n l = get_library(self.client_rc, 'client')\n \n ...
[ "0.7422488", "0.72508186", "0.71273136", "0.6917867", "0.6820803", "0.6691624", "0.6402989", "0.6402989", "0.639464", "0.639464", "0.63461465", "0.63129234", "0.61115736", "0.6106397", "0.6099034", "0.60251695", "0.58919185", "0.589181", "0.5869102", "0.58437496", "0.5805811"...
0.7389302
2
converts color tuples to floats and then to yuv
def to_ycc(color): return rgb_to_ycc(*[x / 255.0 for x in color])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yuv(self):\n r, g, b = self.rgb\n y = 0.299 * r + 0.587 * g + 0.114 * b\n return (\n y,\n 0.492 * (b - y),\n 0.877 * (r - y),\n )", "def rgb2yuv(r, g, b, mode='444'):\n r = 255 * r\n g = 255 * g\n b = 255 * b\n y = 0...
[ "0.7606738", "0.6749512", "0.6665871", "0.66367644", "0.64315003", "0.63107586", "0.6289735", "0.62335294", "0.6170534", "0.6135592", "0.60839796", "0.60689104", "0.59477323", "0.5935662", "0.58740616", "0.58640736", "0.5794277", "0.5742652", "0.5737539", "0.5723088", "0.5700...
0.5526547
39
Normalized address to canonical form. Upper bech32 > lower bech32, but doesn't touch base58 addresses.
def normalize_address(addr: str) -> str: # bitcoin hrps hrps = {net["bech32"] + "1" for net in NETWORKS.values()} # liquid hrps # Blech32 addresses are intended for confidential assets hrps = hrps.union( {net["blech32"] + "1" for net in NETWORKS.values() if "blech32" in net} ) if add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_address(address: str):\n return Web3.toChecksumAddress(address.lower())", "def normalize(address):\n replacement = re.sub('\\W+', SEPARATOR, address.lower())\n\n processed = []\n for p in replacement.split(SEPARATOR):\n if not p:\n continue\n\n if p in ABBRS:\n ...
[ "0.73187464", "0.68048775", "0.6526617", "0.6249219", "0.6132101", "0.6118677", "0.60433686", "0.60082114", "0.59740037", "0.595377", "0.5948732", "0.5879482", "0.57183504", "0.5681086", "0.5625624", "0.56023884", "0.5578978", "0.55276287", "0.5507959", "0.5505848", "0.550393...
0.7352353
0
Converts the name to max 20 asciionly characters.
def to_ascii20(name: str) -> str: # ascii characters have codes from 0 to 127 # but 127 is "delete" and we don't want it return "".join([c for c in name if ord(c) < 127])[:20]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _FormalizeName(cls, name):\n name = name.replace(\"_\", \"-\").lower()\n name = name[:cls.NAME_LENGTH_LIMIT]\n if name[-1] == \"-\":\n name = name[:-1] + cls.REPLACER\n return name", "def cap_name(name: str) -> str:\n username = [capwords(i) for i in name.split()]\n ...
[ "0.6946382", "0.6755767", "0.6749435", "0.65873563", "0.6556658", "0.6556658", "0.6556658", "0.6524218", "0.6454601", "0.64491177", "0.6385745", "0.6372039", "0.6366422", "0.63055056", "0.62990564", "0.62797534", "0.62651503", "0.62578857", "0.6255381", "0.62459964", "0.62313...
0.7446068
0
Create a filesystemfriendly alias from a string. Leading and trailing whitespaces are removed. Replaces space(s) and hyphen(s) with one underscore. Keeps only alphanumeric chars and returns in lowercase.
def alias(name): name = name.strip().replace(" ", "_").replace("-", "_") while "__" in name: name = name.replace("__", "_") return "".join(x for x in name if x.isalnum() or x == "_").lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix_string (str):\n return str.replace(' ', '_').lower()", "def underscore(string):\n # NOTE(retr0h): Taken from jpvanhal/inflection\n # https://github.com/jpvanhal/inflection\n string = re.sub(r\"([A-Z]+)([A-Z][a-z])\", r\"\\1_\\2\", string)\n string = re.sub(r\"([a-z\\d])([A-Z])\", r\"\\1_\\...
[ "0.71173334", "0.70385796", "0.6876377", "0.68696725", "0.6855914", "0.67737335", "0.6747113", "0.6722989", "0.6720989", "0.6717903", "0.66659254", "0.66647875", "0.6661587", "0.6635719", "0.66127557", "0.6608984", "0.65894717", "0.6577357", "0.6561417", "0.6559157", "0.65543...
0.7586851
0
Add a warning about only using the symmetry options if you are sure your extra kpoints have been symmetrized
def __init__( self, reciprocal_lattice: Lattice, original_points: np.ndarray, original_dim: np.ndarray, extra_points: np.ndarray, ir_to_full_idx: Optional[np.ndarray] = None, extra_ir_points_idx: Optional[np.ndarray] = None, nworkers: int = pdefaults["nwor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOnWhichSymmetryLine(self):\n return False", "def test_enforce_symmetry(self):\n ntheta = 6\n theta = np.linspace(0, 2 * np.pi, ntheta, endpoint=False)\n lg_1 = LinearGrid(L=5, theta=theta, N=4, NFP=4, sym=True)\n lg_2 = LinearGrid(L=5, theta=theta, N=4, NFP=4, sym=False)\...
[ "0.62112737", "0.6011911", "0.56854564", "0.5684476", "0.56279755", "0.5588012", "0.5549932", "0.55206543", "0.5502514", "0.54752094", "0.54264754", "0.54177797", "0.52868915", "0.5283784", "0.5210238", "0.51578265", "0.5092635", "0.5072402", "0.505262", "0.5038344", "0.50234...
0.0
-1
|coro| Check if a subdomain (profile or team vanity url) is available. Returns
async def fetch_subdomain(self, subdomain: str): value = await self.http.check_subdomain(subdomain) if (value or {}).get('exists') is True: # currently this endpoint returns {} if the subdomain does not # exist, but just in case it eventually returns 204 or something, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_subdomains(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"allow_subdomains\")", "def allow_subdomains(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"allow_subdomains\")", "def allow_subdomains(self) -> Optional[pulumi.Input[bool]]:\n retur...
[ "0.7017098", "0.7012684", "0.7012684", "0.6679806", "0.66295666", "0.6477908", "0.6378813", "0.6240189", "0.6216939", "0.6179353", "0.6109202", "0.61023796", "0.6047482", "0.6004596", "0.59772", "0.582907", "0.5786557", "0.5774037", "0.5748392", "0.5694645", "0.5673031", "0...
0.7411058
0
Extract pos and neg pcaps from labelled context directories, and then transform them into jsons.
def preprocess(negative_pcap_dir, sub_dir_name=''): # Positive/Abnormal pcaps. contexts_dir = os.path.join("../AppInspector/data/", sub_dir_name) logger.info('The contexts are stored at %s', os.path.abspath(contexts_dir)) contexts = Analyzer.pred_pos_contexts(contexts_dir) positive_flows = Analyzer....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pred_pos_contexts(pred_contexts_path):\n with open(os.path.join(pred_contexts_path, 'contexts.json'), 'r', errors='ignore') as infile:\n contexts = json.load(infile)\n logger.info('The number of contexts: %d', len(contexts))\n pred_pos = []\n with open(os.path...
[ "0.49770555", "0.49024388", "0.48034352", "0.4717608", "0.4688163", "0.4656319", "0.4650039", "0.4601165", "0.4571989", "0.45131797", "0.44776583", "0.44692293", "0.44607103", "0.4454326", "0.44478834", "0.44386327", "0.44356653", "0.44355574", "0.44307193", "0.44167322", "0....
0.578686
0
Return 'at' member variable as a formatted string string representing 'at' in ISO8601 format Returns 'at' member variable as a formatted string of the form
def get_at_as_string(self): return self.at.strftime("%Y-%m-%dT%H:%M:%S.000Z")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ISO8601(self):\n if self.timezoneNaive():\n return \"%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d\" % (\n self._year, self._month, self._day,\n self._hour, self._minute, self._second)\n tzoffset = _tzoffset2iso8601zone(_tzoffset(self._tz, self._t))\n return ...
[ "0.72459257", "0.69570607", "0.65177613", "0.64920515", "0.64581513", "0.6419734", "0.637666", "0.62874144", "0.6221447", "0.62209547", "0.62071264", "0.6191752", "0.61416787", "0.6105509", "0.61008096", "0.61002755", "0.6072278", "0.6039104", "0.60313743", "0.6028439", "0.60...
0.8492517
0
Return a XML representation of this object string containing XML representation of the object Returns a XML representation of this object.
def to_xml(self): xml = '<activity at="' + self.get_at_as_string() + '" ' xml += 'action="' + self.action + '" ' xml += 'actor="' + self.actor + '" ' xml += 'regarding="' + self.regarding + '" ' xml += 'source="' + self.source + '" ' xml += 'tags="' + ",".joi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml(self):\n xml_strings = ['<code_object name=\"%s\">' % self.name]\n xml_strings.append(' <type value=\"%s\" />' % self.object_type)\n xml_strings.append(' <source>')\n for source_line in self.source:\n xml_strings.append(source_line[1])\n xml_strings.append...
[ "0.74828345", "0.7380056", "0.73624426", "0.73097473", "0.71984595", "0.71833086", "0.7014053", "0.6943666", "0.6934077", "0.6912874", "0.6912874", "0.6893437", "0.6874527", "0.68468726", "0.68373364", "0.6809838", "0.6780215", "0.67786294", "0.6767218", "0.6750789", "0.67452...
0.0
-1
The legacy option for noloadplugins requires some more treatment than the other as the behavior when the env variable is set is different. Any nonempty string set in env variable means that the option is set, and we should not load the plugins. This helper function comes to overwrite the resolve method in the legacy op...
def resolve(self, config: "Config") -> bool: option = config.getoption(self.argument, default=None) if option is not None: # A value is set, and it is not the default one return self.validate(option) if os.getenv(self.environment_variable): return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_env_none(self, option, prefix, auto_env):\n actual = option.parse_env(prefix=prefix, auto_env=auto_env)\n assert actual is None", "def test_parse_env_none(self, option, prefix, auto_env):\n actual = option.parse_env(prefix=prefix, auto_env=auto_env)\n assert actual is N...
[ "0.51739156", "0.51739156", "0.51739156", "0.49260968", "0.4922603", "0.48318923", "0.47386324", "0.47186476", "0.47146806", "0.47039858", "0.46987316", "0.46981013", "0.4630471", "0.46208906", "0.46115732", "0.46084148", "0.46039188", "0.45809716", "0.4572238", "0.45620498", ...
0.49190092
5
The size of the disk in bytes. This field is read only.
def disk_size_bytes(self) -> float: return pulumi.get(self, "disk_size_bytes")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disk_size(self) -> Optional[pulumi.Input[float]]:\n return pulumi.get(self, \"disk_size\")", "def get_size_on_disk(self):\n\t\treturn call_sdk_function('PrlVmDevHd_GetSizeOnDisk', self.handle)", "def get_disk_size(self):\n\t\treturn call_sdk_function('PrlVmDevHd_GetDiskSize', self.handle)", "def g...
[ "0.8488403", "0.82856387", "0.8159251", "0.806256", "0.8041449", "0.80235624", "0.7962538", "0.79339886", "0.79339886", "0.7889254", "0.788414", "0.7859527", "0.78429943", "0.78429943", "0.78429943", "0.7819104", "0.7819104", "0.7811654", "0.7797124", "0.7793191", "0.77910364...
0.88374627
0
Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
def encryption(self) -> Optional['outputs.EncryptionResponse']: return pulumi.get(self, "encryption")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_managed_key_encryption(self) -> Optional[pulumi.Input['ClusterPropertiesCustomerManagedKeyEncryptionArgs']]:\n return pulumi.get(self, \"customer_managed_key_encryption\")", "def encryption_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"encryption_key\")", "def...
[ "0.71474904", "0.67002624", "0.67002624", "0.66994554", "0.66994554", "0.66881645", "0.66687936", "0.6664986", "0.6500628", "0.6476242", "0.64343953", "0.64243203", "0.64243203", "0.6332017", "0.6250746", "0.6250746", "0.61947167", "0.6185863", "0.6181991", "0.6117204", "0.61...
0.6562586
8
The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
def hyper_v_generation(self) -> Optional[str]: return pulumi.get(self, "hyper_v_generation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hyper_v_generation(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"hyper_v_generation\")", "def hyper_v_generation(self) -> Optional[pulumi.Input[Union[str, 'HyperVGeneration']]]:\n return pulumi.get(self, \"hyper_v_generation\")", "def generation(self) -> str:\n ret...
[ "0.7692093", "0.73718244", "0.6243719", "0.5988553", "0.59448713", "0.58329034", "0.5825566", "0.5821433", "0.5738689", "0.5691001", "0.5632967", "0.56286323", "0.55821794", "0.55527973", "0.55519694", "0.55513406", "0.5538936", "0.5495107", "0.5476784", "0.5454252", "0.54430...
0.7753346
0
The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.
def sku(self) -> Optional['outputs.DiskSkuResponse']: return pulumi.get(self, "sku")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def sku_name(self) -> str:\n return pulumi.get(self, \"sku_name\")", "def sku_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(...
[ "0.80691034", "0.80691034", "0.80691034", "0.7582981", "0.7582981", "0.75759035", "0.7407973", "0.6995917", "0.6995917", "0.6958878", "0.6958878", "0.68768513", "0.67876196", "0.67787415", "0.67292804", "0.66472685", "0.66273826", "0.65524215", "0.65112174", "0.65112174", "0....
0.6859917
12
Replace placeholders with actual critic tags.
def restore(self, m): content = None if m.group('block_keys') is not None: content = RE_CRITIC_SUB_PLACEHOLDER.sub( self.subrestore, m.group('block_keys') ) if content is not None: content = RE_CRITIC_BLOCK.sub(self.block_edit, content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_placeholders(self, placeholder_dict):\n\n for placeholder, value in placeholder_dict.items():\n placeholder_wrapped = f\"{self.marker_string}{placeholder}{self.marker_string}\"\n\n if placeholder not in self.unresolved_placeholders:\n self.hd.log.warn(f\"Plac...
[ "0.6440129", "0.63140357", "0.59874797", "0.5782778", "0.5775679", "0.577254", "0.5731867", "0.56905717", "0.5679864", "0.5668366", "0.55986214", "0.5517333", "0.5292933", "0.52764016", "0.52385575", "0.52349263", "0.5216085", "0.5198625", "0.5187954", "0.5149389", "0.5128161...
0.0
-1
Tests that product is not created if title, description or price
def test_object_is_not_created_without_required_fields(self): data1 = self.data.copy() del data1["title"] serializer = ProductSerializer(data=data1) self.assertFalse(serializer.is_valid()) self.assertEqual(serializer.errors.get("title")[0], self.error_message) data2 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_without_name(self):\n good = GoodInfo(\"\", \"30\", \"40\", \"2020-12-30\", \n \"14\", \"2020-12-30\")\n check_product_data = self.database.add(good)\n\n self.assertFalse(check_product_data)", "def test_product_price_is_required(self):\n product = {...
[ "0.72486204", "0.71221596", "0.7092196", "0.7007494", "0.69848824", "0.69525737", "0.6931229", "0.69276774", "0.69188684", "0.6883448", "0.68797135", "0.6832526", "0.68302685", "0.68091416", "0.6808507", "0.6806046", "0.6781628", "0.67768246", "0.67197466", "0.6702742", "0.66...
0.68675256
11
Convert sparse matrix to tuple representation.
def sparse_to_tuple(sparse_mx): def to_tuple(mx): if not sp.isspmatrix_coo(mx): mx = mx.tocoo() coords = np.vstack((mx.row, mx.col)).transpose() values = mx.data shape = mx.shape return coords, values, shape if isinstance(sparse_mx, list): for i in ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape", "def sparse_to_tuple(sparse_mx):\r\n ...
[ "0.85870504", "0.82527", "0.82527", "0.8091624", "0.7986327", "0.602773", "0.59843755", "0.5971062", "0.59706587", "0.59447116", "0.59443593", "0.5910293", "0.5910293", "0.5910293", "0.5910293", "0.5910293", "0.58940256", "0.58499134", "0.5845008", "0.577404", "0.5689886", ...
0.82655305
2
Symmetrically normalize adjacency matrix.
def normalize_adj(adj): adj = sp.coo_matrix(adj) rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = sp.diags(d_inv_sqrt) return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)", "def normalize_adj(adj):\r\n adj = sp.coo_m...
[ "0.7884198", "0.769071", "0.7593361", "0.7564878", "0.73355997", "0.7303837", "0.726871", "0.68821305", "0.6859434", "0.6858368", "0.68307346", "0.6827637", "0.6751015", "0.6748903", "0.67268735", "0.66270924", "0.6615512", "0.6487585", "0.6484342", "0.63597053", "0.63597053"...
0.7697268
5
Retrieves a user secret value by its label. This returns the value of the secret with the given label, if it attached to the current kernel.
def get_secret(self, label) -> str: if label is None or len(label) == 0: raise ValidationError("Label must be non-empty.") request_body = { 'Label': label, } response_json = self._make_post_request(request_body, self.GET_USER_SECRET_BY_LABEL_ENDPOINT) if '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_secret(secret):\n if isinstance(secret, AwsSecret):\n result = aws_cli([\n 'secretsmanager',\n '--region', secret.region,\n 'get-secret-value',\n '--secret-id', secret.arn\n ])\n\n \"\"\"\n Result will be of the form:\n {\n...
[ "0.62043464", "0.61685747", "0.60764873", "0.5999727", "0.5997154", "0.58218443", "0.5811252", "0.57434416", "0.5714891", "0.5704732", "0.5704732", "0.5676241", "0.56560385", "0.5652123", "0.5652123", "0.56296796", "0.5614095", "0.55914706", "0.55555296", "0.5549595", "0.5543...
0.77861106
0
Load the xlsx using pandas.
def load_data(fname='SeatTest_New.xlsx'): return pd.ExcelFile(fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> pd.DataFrame:\n\n if not os.path.exists(self.file_name):\n raise FileNotFoundError(f\"File does not exist: {self.file_name}\")\n\n _, ext = os.path.splitext(self.file_name)\n assert ext == \".xls\", \"Invalid filetype attempted to load\"\n\n return pd.r...
[ "0.71797925", "0.6848687", "0.68167615", "0.66614985", "0.6633156", "0.65813315", "0.6564204", "0.6535915", "0.65047884", "0.64587235", "0.6447141", "0.64227694", "0.64150715", "0.6328543", "0.632805", "0.63079506", "0.62955076", "0.6278", "0.6175378", "0.61065334", "0.609010...
0.676728
3
Returns minimum, 0.25quantile, median, 0.75quantile, maximum
def sortAndReturnQuantiles(values): values.sort() N = len(values) return (values[0], values[N/4], values[N/2], values[(3*N)/4], values[N-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__quantile(self):\r\n # regular cases\r\n sample_data = array(range(25, 42))\r\n assert_almost_equal(_quantile(sample_data, 0.5), median(sample_data))\r\n\r\n # sorted data is assumed for this function\r\n sample_data = sorted(\r\n array([0.17483293, 0.99891939...
[ "0.7551233", "0.7125311", "0.7045623", "0.7041125", "0.6862604", "0.6860084", "0.68464315", "0.6841616", "0.66776264", "0.6621251", "0.66117114", "0.6600348", "0.6583251", "0.65673953", "0.6566243", "0.65649414", "0.65272975", "0.6527023", "0.65033", "0.64728934", "0.64529073...
0.5983625
66
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary environment = dictionary.get('environment') relative_snapshot_directory = dictionary.get('relativeSnapshotDirectory') root_path = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.8318104", "0.8168106", "0.8168106", "0.8119619", "0.8089429", "0.7978183", "0.79495466", "0.79227656", "0.7898806", "0.7894103", "0.7887986", "0.78827816", "0.78821284", "0.7876549", "0.7858773", "0.78385323", "0.78039247", "0.78039247", "0.78039247", "0.78039247", "0.7803...
0.0
-1
Return a lidstone smoothed probability estimate.
def _lidstone_smooth(prob, smoothing, observations, outcomes): return (prob + smoothing) / (observations + (smoothing * outcomes))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample_prob(self, dataset_lens):\n prob = dataset_lens / dataset_lens.sum()\n smoothed_prob = prob ** self.args.multilang_sampling_alpha\n smoothed_prob = smoothed_prob / smoothed_prob.sum()\n return smoothed_prob", "def lnprobability(self):\n return", "def prob(x):\...
[ "0.6227884", "0.5801274", "0.5726661", "0.57025665", "0.56788296", "0.55971295", "0.55155945", "0.5514156", "0.550704", "0.54942447", "0.5492587", "0.5472975", "0.5462955", "0.54546356", "0.54211354", "0.5379682", "0.53661036", "0.53627414", "0.5348145", "0.534459", "0.534447...
0.77696234
0
Remove an interable of bad_words from the ratio list.
def prune_ratios(ratios, bad_words): for word in bad_words: ratios.pop(word, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_unsuitable_words(words):\n\n max_length = Board.SIZE\n return [word for word in words if word and \"-\" not in word and len(word) <= max_length]", "def _remove_dislikes(bad_movies, good_movies_vec, rejected_list=[], harshness=1):\n bad_vec = _aggregate_vectors(bad_movies, reje...
[ "0.65363735", "0.63232315", "0.6322166", "0.62315327", "0.6222503", "0.6214518", "0.6170965", "0.60796994", "0.5982607", "0.598148", "0.5967787", "0.59264064", "0.5906127", "0.58813316", "0.5880216", "0.5856961", "0.5813792", "0.58104986", "0.57986283", "0.57950324", "0.57690...
0.7815906
0
Returns a generator containing all the business_id and survey_id for all the active enrolments for the respondent.
def get_respondent_enrolments(respondent: dict): if "associations" in respondent: for association in respondent["associations"]: for enrolment in association["enrolments"]: if enrolment["enrolmentStatus"] == "ENABLED": yield {"business_id": association["partyI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_incidents(self):\n sql = f\"SELECT * FROM incidences\"\n curr = Db().cur\n curr.execute(sql)\n output = curr.fetchall()\n return output", "def get_answer_ids(self):\r\n answer_ids = []\r\n for response in self.responders.keys():\r\n results ...
[ "0.5677259", "0.55573374", "0.53757215", "0.53593934", "0.5329094", "0.5220098", "0.51297617", "0.5075436", "0.5071301", "0.5000213", "0.49483576", "0.49270314", "0.49097753", "0.489378", "0.48811698", "0.48648813", "0.48528102", "0.4850827", "0.4838931", "0.4820864", "0.4809...
0.7051227
0
Returns a list of all legal actions in the current state.
def legal_actions(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legal_actions(self):\n return self.env.legal_actions()", "def getLegalActions(self, state):\n return self.actionFn(state)", "def _get_legal_actions(self):\n return self.game.get_legal_actions()", "def getLegalActions(self,state):\n return self.actionFn(state)", "def actions(...
[ "0.8330947", "0.8123257", "0.80978876", "0.8056057", "0.7867841", "0.7792349", "0.7613125", "0.7537817", "0.75234914", "0.74991876", "0.7487427", "0.7425238", "0.7348172", "0.73237926", "0.7280961", "0.7266683", "0.7251046", "0.71979815", "0.71937084", "0.71588075", "0.715666...
0.71426064
21
Exports data into a csv file
def _export_data_to_csv(self, source, target): self.log.info(f"Dumping data into {target}") source.to_csv(target, index=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_csv(self, filename): # DONE\n self.data.to_csv(filename)", "def export_csv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".csv\",\n filetypes=((\"comma seperated values\", \"*.csv\"),\n (\"All Files\", \"*.*\")))...
[ "0.7990632", "0.79207224", "0.7745393", "0.7699379", "0.76846886", "0.76796097", "0.75728464", "0.7533846", "0.74939096", "0.7479773", "0.74648976", "0.745569", "0.7452145", "0.7452145", "0.74344015", "0.741739", "0.7412646", "0.7399062", "0.73793143", "0.7353978", "0.7316901...
0.7814499
2
returns a list of the first n prime numbers
def first_n_primes(n): list_of_primes = [] # the current number that we're checking the primality of candidate = 2 # keep on finding primes until our list has enough elements while len(list_of_primes) < n: # assume that we have a prime number is_prime = True # use trial division to determine if it's not p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]", "def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i)\n return primeList", "def primes(n):\n return [i for i, v in enumerate(prime_cache(n)) if v]", "def get_primes(n):\n\n ...
[ "0.8420783", "0.839178", "0.8231127", "0.81828445", "0.8178282", "0.80901706", "0.8073909", "0.80329627", "0.8032902", "0.80059683", "0.7996604", "0.79583174", "0.7944368", "0.7928831", "0.79222775", "0.7905399", "0.78709066", "0.7862071", "0.7758681", "0.7744201", "0.7674449...
0.8406851
1
Returns the full path to the asset in question.
def get_asset_path(name): return os.path.join(constants.ROOT_DIR, 'assets', name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(self):\n raise NotImplementedError(\"This asset does not support absolute paths\")", "def assets_path(self) -> str:\n return self._assets_path", "def _path(name: str):\n return os.path.join(ASSET_PATH, name)", "def get_path(self, asset, force_save=None):\n if force_save i...
[ "0.81034595", "0.7839225", "0.7623718", "0.7573192", "0.7344079", "0.7237341", "0.71700203", "0.71181595", "0.7112841", "0.70917594", "0.7072176", "0.6909239", "0.6780773", "0.671772", "0.66482526", "0.662682", "0.6603054", "0.660063", "0.65784276", "0.6553525", "0.6542615", ...
0.7654927
2
This function takes previous hidden state and memory tuple with input and outputs current hidden state.
def LSTM(self, previous_hidden_memory_tuple, x): previous_hidden_state,c_prev=tf.unstack(previous_hidden_memory_tuple) #Input Gate i= tf.sigmoid( tf.matmul(x,self.Wi)+tf.matmul(previous_hidden_state,self.Ui) + self.bi ) #Forget Gate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, inputs, states):\n \"\"\"Now we have multiple states, state->states\"\"\"\n sigmoid = tf.sigmoid\n # Parameters of gates are concatenated into one multiply for efficiency.\n # states: size = time_lag\n if self._state_is_tuple:\n hs = ()\n ...
[ "0.63487583", "0.6315101", "0.6273064", "0.620773", "0.6207183", "0.61981785", "0.6158234", "0.61556345", "0.6035942", "0.5976789", "0.5911347", "0.58838457", "0.587888", "0.58724", "0.58595335", "0.5855759", "0.5847062", "0.5820537", "0.581944", "0.58067113", "0.5802399", ...
0.6984514
0
Saves the API key and token to the config file
def save(cls, api_key: str, token: str): cls.config_file.write_text(str({"key": api_key, "token": token})) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():\n with open(CONFIG_FILE, 'w') as f:\n json.dump(config, f, indent=4, sort_keys=True)", "def save(self):\n # EXERCISE:\n # - save self.access_token, self.user_id, self.save_message to access token file AccessData.ACCESS_TOKEN_FILE\n # @see http://stackoverflow.com/qu...
[ "0.70027107", "0.69438446", "0.6830329", "0.67823946", "0.6676658", "0.66735905", "0.66594225", "0.6614656", "0.6566711", "0.655198", "0.65375125", "0.649939", "0.6499356", "0.64931494", "0.64898485", "0.6483116", "0.64796144", "0.64609236", "0.6446499", "0.64148897", "0.6284...
0.86162394
0
Takes in text and returns a dict with the count of each character
def frequency(text): # TODO: change function input to a textfile? import collections freq = collections.Counter(text) # print freq return freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countChar(txt, split_txt):\n\tchar_dict = dict()\n\n\tfor i in split_txt:\n\t\tchar_count = txt.count(i)\n\t\tchar_dict.update({i:char_count})\n\n\treturn char_dict", "def count_characters(text):\n counted_characters = initialize_dictionary_with_characters()\n for char in next_uppercase_character(text....
[ "0.8515722", "0.829436", "0.8086271", "0.79062074", "0.7801718", "0.7664166", "0.7633931", "0.7613389", "0.75940645", "0.75430864", "0.7332121", "0.7322051", "0.7275195", "0.7265974", "0.7184626", "0.71677846", "0.7165582", "0.7119899", "0.7091762", "0.70727223", "0.70111597"...
0.5989089
90
Set up the sensor platform.
async def async_setup_entry(hass, entry, async_add_entries): conf = hass.data[DATA_COMPENSATION][entry.unique_id] entity = CompensationSensor( hass, conf[CONF_ENTITY_ID], conf[CONF_TRACKED_ENTITY_ID], conf.get(CONF_NAME), conf.get(CONF_MQTT_TOPIC), conf.get(CONF_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')", "def setup_platform(\n hass: HomeAssistant,\n config: ConfigType,\n add_entities: AddEntitiesCallback,\n discovery_info: DiscoveryInfoType | None = None,\n) -> None:\n name = config...
[ "0.7160159", "0.71533996", "0.7074503", "0.70394546", "0.6980012", "0.6921004", "0.6887539", "0.6857045", "0.6847261", "0.6803095", "0.68022704", "0.6777776", "0.6736042", "0.6712932", "0.67101544", "0.6709726", "0.67015046", "0.6692982", "0.66697454", "0.66685134", "0.663923...
0.0
-1
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91900426", "0.9168249", "0.8901578", "0.8770551", "0.8511197", "0.8479612", "0.84444356", "0.8299865", "0.81868285", "0.81055766", "0.8079376", "0.80653954", "0.8050165", "0.77025265", "0.76141983", "0.76136565", "0.76024383", "0.76024383", "0.76024383", "0.7540682", "0.75...
0.0
-1
Return the state attributes of the sensor.
def device_state_attributes(self): ret = { ATTR_ENTITY_ID: self._entity_id, ATTR_COEFFICIENTS: self._coefficients, CONF_TRACKED_ENTITY_ID: self._tracked_entity_id, ATTR_BASE_SENSOR: self._entity_id.replace("_calibrated", ""), CONF_MQTT_TOPIC: self._mqt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self) ...
[ "0.8418945", "0.82497084", "0.8243777", "0.8243777", "0.8200083", "0.8169021", "0.8169021", "0.8159991", "0.8159991", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", "0.8145903", ...
0.7751082
45
Sets the id of this EventSubscription.
def id(self, id): if id is None: raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.__id = id", "def SetId(self, id):\n self.id = int(id)", "def id(self, id):\n if id is None:\n raise ValueError(\"Invalid value for `id`, must not be `None`\")\n\n self._id = id", "def id(...
[ "0.7806183", "0.7768249", "0.7498126", "0.74475724", "0.74475724", "0.74475724", "0.74157274", "0.74157274", "0.74157274", "0.74157274", "0.74157274", "0.73852074", "0.734027", "0.73282754", "0.73282754", "0.73282754", "0.73282754", "0.73282754", "0.73282754", "0.73282754", "...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, EventSubscription): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80885184", "0.80885184", "0.805514", "0.7983044", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457167", "0.8393036", "0.81455255", "0.8139734", "0.81333447", "0.8094964", "0.8093362", "0.8093362", "0.8093362", "0.80863476", "0.80863476", "0.8077286", "0.8077286", "0.806682" ]
0.0
-1
With given box list, find the smallest bouding box that contains all boxes in the list.
def get_bound(box_list): box_xyxy_list = [] for box in box_list: box_xyxy = xywh2xyxy(box) box_xyxy_list.append(box_xyxy) box_xyxy_list = np.array(box_xyxy_list) x1max, y1max, x2max, y2max = np.amax(box_xyxy_list, axis=0) x1min, y1min, x2min, y2min = np.amin(box_xyxy_list, axis=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_smaller_box(boxes):\n\n min_area = rect_area(boxes[0])\n smaller_box = boxes[0]\n for box in boxes[1:]:\n area = rect_area(box)\n if area < min_area:\n min_area = area\n smaller_box = box\n\n return smaller_box", "def FindTightFit(box_list,w):\n mini = ...
[ "0.754953", "0.63735944", "0.62749684", "0.6248584", "0.6188197", "0.6142795", "0.6142795", "0.6108184", "0.6071732", "0.606873", "0.601897", "0.601897", "0.600545", "0.5934862", "0.5928227", "0.5922692", "0.5915713", "0.5851588", "0.58376944", "0.5795319", "0.5759323", "0....
0.637867
1
preprocess infinity part for euclide distance cauculate.
def distance_with_inf(v1, v2): result = [] for i in range(0, len(v1)): if v1[i] == v2[i]: result.append(0) elif (v1[i] == float("inf") or v1[i] == -float("inf")) or \ (v2[i] == float("inf") or v2[i] == -float("inf")): return float("inf") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDistanceInf(graph, D):\n for i in graph.vertices:\n D[i] = float('inf')\n# print(\"set distance infinity to \"+i)\n return D", "def inf(self):\n return self._inf", "def norm_inf(u):\n #return abs(u.ravel()).max()\n return linalg.norm(u.ravel(), inf)", "def infrec(f, g,...
[ "0.5721144", "0.55264866", "0.54484564", "0.5380442", "0.5245411", "0.5221264", "0.5083507", "0.5075491", "0.50719213", "0.501209", "0.49951497", "0.4990628", "0.49818683", "0.49814063", "0.4933954", "0.4920794", "0.48716316", "0.48613474", "0.4861107", "0.48342845", "0.48312...
0.48863262
16
Merge boxes pairs with similar slope.
def merge(pair_list, threshold=need_to_fill): pair_list = list(pair_list) slope_list = [] # Calculate slope of the starting coordinate of # every other box to the first box in the tuple. for pair in pair_list: # Get the first boxe's coordinate. # Due to the former process, the first ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_merge_overlapping_boxes(self):\n # box2 contains box1\n box1 = ((1, 2), (1, 2), (1, 2))\n box2 = ((1, 3), (1, 3), (1, 3))\n mapping = {box1: [1, 2, 3, 4], box2: [1, 2, 3, 4, 5]}\n boxes = [box1, box2]\n merged_boxes, _ = dc.dock.binding_pocket.merge_overlapping_boxes(mapping,\n ...
[ "0.6123632", "0.5814088", "0.58106196", "0.5764641", "0.57155097", "0.5530584", "0.5522245", "0.5502801", "0.5490806", "0.5458715", "0.54297304", "0.5416291", "0.5416212", "0.5372227", "0.5365286", "0.5337028", "0.5323485", "0.5317293", "0.5312482", "0.53120834", "0.5307718",...
0.70763254
0
Checks if a passport is valid (quick and dirty and wrong)
def simple_validator(passport): if len(passport) == 8: return True if len(passport) == 7 and "cid" not in passport: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)", "def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass", "def valid_passport(passport: map) -...
[ "0.7308497", "0.7199634", "0.714216", "0.70225924", "0.6910431", "0.6855071", "0.68504894", "0.68382406", "0.6829393", "0.67939174", "0.6729741", "0.6716507", "0.6710734", "0.6676408", "0.6641805", "0.6636901", "0.6564422", "0.6549426", "0.6537175", "0.6517832", "0.6502756", ...
0.69347924
4
Override the default password_policy app settings with development settings.
def plugin_settings(settings): # pylint: disable=unused-argument pass # lint-amnesty, pylint: disable=unnecessary-pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings_app_password(self, settings_app_password):\n\n self._settings_app_password = settings_app_password", "def settings_app_password(self):\n return self._settings_app_password", "def set_fake_pw(password='admin'):\n fake = raw_input('Password (leave blank to use \\'admin\\'):')\n\n ...
[ "0.71844524", "0.6755497", "0.61164665", "0.59122086", "0.5813225", "0.5794313", "0.57910943", "0.57764655", "0.57253873", "0.5613276", "0.5597949", "0.55317557", "0.552276", "0.552276", "0.5519346", "0.5499511", "0.5496181", "0.5488342", "0.5469743", "0.5456375", "0.5454069"...
0.0
-1
Checks if the uploaded file is allowed to be uploaded, as defined globally.
def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_allowed(self):\n if self._allowed_ext:\n if self.get_ext() not in self._allowed_ext:\n return False\n \n return True", "def can_manage(self, filename):\n return False", "def allowed_upload(self, filename):\n for suffix in ['.changes', '.dsc',...
[ "0.7713054", "0.7261623", "0.7102377", "0.7100585", "0.69731605", "0.69507706", "0.6891045", "0.685728", "0.6804868", "0.6779085", "0.6778682", "0.67470074", "0.66980654", "0.66956604", "0.6681553", "0.6675329", "0.6672942", "0.6666644", "0.66512626", "0.66217315", "0.6621731...
0.6570346
25
The part of the Flask application situated at the root. Allows for the uploading of UPPAALmodels that can be used within the application afterwards. Only one UPPAALmodel at a time is allowed to be uploaded.
def upload_file(): global gui print(request.data) if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files: flash('No file part') return redirect(request.url) file = request.files['file'] # if user does ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uploadAppRedir():\n logger.debug('[FLASKWEB /app] Redirect to /apps')\n return uploadApp()", "def app_dir(self):\n return self._app_dir", "def get_application(self):\n return self._silva_root", "def prepare_app(self):\n self.app = Flask(self.APP_NAME)\n self.app.config.from_obj...
[ "0.5644979", "0.5644961", "0.56285644", "0.5541109", "0.5506098", "0.549772", "0.5473318", "0.5457833", "0.5454805", "0.54411095", "0.54352194", "0.54238725", "0.5423227", "0.54130495", "0.5360551", "0.534778", "0.53393334", "0.5336365", "0.53242844", "0.531308", "0.5310466",...
0.0
-1
Constructor for the wall that the player can run into.
def __init__(self, x, y): # Call the parent's constructor super().__init__() width = 10 height = 10 # Make a blue wall, of the size specified in the parameters self.image = pygame.Surface([width, height]) self.image.fill(BLUE) # Make our top-left corne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name):\n self.in_wall = False", "def __init__(self):\n \n self._wall = BrickWall() \n self._paddle = GRectangle(\n x=GAME_WIDTH/2 - PADDLE_WIDTH/2,\n y=PADDLE_OFFSET,\n width=PADDLE_WIDTH,\n height=PADDLE_HEIGHT,\n ...
[ "0.7270496", "0.68309796", "0.670598", "0.65221125", "0.6520005", "0.64119273", "0.63943356", "0.6367158", "0.63664806", "0.631831", "0.63179773", "0.63164955", "0.63128287", "0.6289888", "0.6272107", "0.6266109", "0.6262653", "0.62209517", "0.62076586", "0.61991787", "0.6132...
0.5933575
37
Plot acoustic flux equation in the model
def plot_fppy_equation(self,LAXIS,xbl,xbr,ybu,ybd,ilg): # load x GRID grd1 = self.xzn0 lhs0 = self.minus_dt_fppy lhs1 = self.minus_fht_ux_gradx_fppy rhs0 = self.minus_div_fppyx rhs1 = self.minus_fppx_gradx_uy rhs2 = self.plus_eht_uyf_uxff_gradx_pp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_a(self, LAXIS, bconv, tconv, xbl, xbr, ybu, ybd, ilg):\n\n if self.ig != 1 and self.ig != 2:\n print(\"ERROR(TurbulentMassFluxEquation.py):\" + self.errorGeometry(self.ig))\n sys.exit()\n\n # load x GRID\n grd1 = self.xzn0\n\n # load DATA to plot\n ...
[ "0.70277", "0.6700877", "0.66026074", "0.6452446", "0.6307293", "0.62818736", "0.6256203", "0.6196208", "0.61653876", "0.6156947", "0.6156701", "0.6133908", "0.6120965", "0.61175543", "0.6110692", "0.6105514", "0.6098381", "0.6079134", "0.60629886", "0.6058539", "0.6058126", ...
0.6511978
3
Initialize this dataset class.
def __init__(self, opt, validation=False): BaseDataset.__init__(self, opt) phase = opt.phase if validation: phase = 'validation' self.dir_A = os.path.join(opt.dataroot, phase + 'A') # create a path '/path/to/data/trainA' self.dir_B = os.path.join(opt.dataroot, phas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s...
[ "0.816631", "0.81641185", "0.8013762", "0.76137954", "0.7422038", "0.7393049", "0.7352237", "0.73437655", "0.7111143", "0.71019876", "0.7099074", "0.7096382", "0.70223516", "0.696418", "0.6961817", "0.6889772", "0.6879775", "0.68740934", "0.68599087", "0.68520594", "0.6842619...
0.0
-1
Return a data point and its metadata information.
def __oldgetitem__(self, index): # read a image given a random integer index A_path = self.A_paths[index] B_path = self.B_paths[index] A = Image.open(A_path) B = Image.open(B_path).convert('RGB') # split AB image into A and B # apply the same transform to both A ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point(self):\n return self.x, self.y, self.z", "def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_height,\n\n 'mesh_normal': self.mesh_normal.to_data(),\n 'up_vector': self.up_vector.to_data()...
[ "0.6608484", "0.6598616", "0.65755457", "0.6537603", "0.652212", "0.6339209", "0.6292759", "0.6292759", "0.6158163", "0.6152089", "0.61388254", "0.61352396", "0.6116942", "0.606738", "0.605004", "0.6025813", "0.59911", "0.5990552", "0.59891266", "0.59781885", "0.5964194", "...
0.0
-1
Return a data point and its metadata information.
def __getitem__(self, index): # read a image given a random integer index A_path = self.A_paths[index] B_path = self.B_paths[index] A = np.asarray(Image.open(A_path)).astype(np.float32) B = np.asarray(Image.open(B_path)).astype(np.float32) # split AB image into A and B ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point(self):\n return self.x, self.y, self.z", "def to_data(self):\n point = {\n 'point': [self.pt[0], self.pt[1], self.pt[2]],\n 'layer_height': self.layer_height,\n\n 'mesh_normal': self.mesh_normal.to_data(),\n 'up_vector': self.up_vector.to_data()...
[ "0.6607296", "0.6599758", "0.65745145", "0.6535129", "0.65202826", "0.63402396", "0.6291092", "0.6291092", "0.61568433", "0.61515397", "0.6138252", "0.6133588", "0.6116883", "0.60677505", "0.6049698", "0.60260797", "0.5992455", "0.59917825", "0.59876746", "0.59777427", "0.596...
0.0
-1
Excludes any questions that aren't published yet.
def get_queryset(self): return Question.objects.filter(pub_date__lte=timezone.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.6170101", "0.6170101", "0.6101224", "0.6100283", "0.6083196", "0.6055842", "0.60525465", "0.5971601", "0.5893893", "0.5893893", "0.5890032", "0.5882812", "0.58696455", "0.58696455", "0.58696455", "0.58696455", "0.58689994", "0.585721...
0.62109476
10
Excludes any questions that aren't published yet.
def get_queryset(self): return PubFulltext.objects.order_by('-pmid')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.6170101", "0.6170101", ...
0.0
-1
Excludes any questions that aren't published yet.
def get_queryset(self): return Gene_Protein.objects.order_by('idGene_Protein')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.62109476", "0.6170101", "0.6170101", ...
0.0
-1
Find boundary values for each sigmalevel.
def sigma_boundary(counts, percentage): # Sort counts in descending order counts_desc = sorted(counts.flatten(), reverse=True) # Find cumulative sum of sorted counts cumulative_counts = np.cumsum(counts_desc) # Create a mask for counts outside of percentage boundary sum_mask = cumulative_counts < (percentage /100...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defineSigmaLevels():\r\n # A and B values for the definition of sigma levelist\r\n # Since there are 72 model levels, there are 73 half levels, so it is for A and B values\r\n # the unit of A is hPa!!!!!!!!!!!!\r\n # from surface to TOA\r\n A = np.array([\r\n 0.000...
[ "0.6097681", "0.6044969", "0.60404694", "0.59865844", "0.5922415", "0.59218204", "0.58480215", "0.5823268", "0.57707566", "0.57390004", "0.5721888", "0.57121825", "0.56688964", "0.56647086", "0.5648956", "0.5645886", "0.56272155", "0.5581513", "0.5529685", "0.5528194", "0.552...
0.56924087
12
Set the data directory for PROJ to use.
def set_data_dir(proj_data_dir): global _USER_PROJ_DATA global _VALIDATED_PROJ_DATA _USER_PROJ_DATA = proj_data_dir # set to none to re-validate _VALIDATED_PROJ_DATA = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data_dir(datadir, update_env=True):\n if os.path.isdir(datadir):\n _config.datadir = datadir\n\n if update_env:\n os.environ[\"TESSDATA_PREFIX\"] = _config.datadir\n else:\n _warn(\"set_data_dir: Invalid directory: '{0}'\".format(datadir))", "def set_data_directory(p...
[ "0.774017", "0.7633231", "0.74432135", "0.7414963", "0.73292196", "0.7327005", "0.7287819", "0.7148138", "0.7123478", "0.70711535", "0.7059172", "0.6974434", "0.6958719", "0.6900097", "0.68638986", "0.679028", "0.6737954", "0.6702934", "0.6637235", "0.6622871", "0.6613711", ...
0.8011117
0
Converts an array or cuDF to a sparse Dask array backed by sparse CuPy. CSR matrices. Unfortunately, due to current limitations in Dask, there is no direct path to convert a cupy.sparse.spmatrix into a CuPy backed dask.Array without copying to host.
def to_sp_dask_array(cudf_or_array, client=None): client = default_client() if client is None else client # Makes sure the MatDescriptor workaround for CuPy sparse arrays # is loaded (since Dask lazy-loaded serialization in cuML is only # executed when object from the cuML package needs serialization. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse_dask_array(cudf_or_array, client=None):\n client = default_client() if client is None else client\n\n # Makes sure the MatDescriptor workaround for CuPy sparse arrays\n # is loaded (since Dask lazy-loaded serialization in cuML is only\n # executed when object from the cuML package needs s...
[ "0.7916184", "0.7733261", "0.6586304", "0.6578876", "0.65787643", "0.654864", "0.65452975", "0.6512623", "0.65097255", "0.64714724", "0.63873535", "0.6351011", "0.6325023", "0.63145846", "0.6278994", "0.62499017", "0.62311625", "0.6184011", "0.61715764", "0.6162056", "0.61559...
0.6711316
2
Creates a unique file name for datastore by appending epoch timestamp to the file name
def get_file_name() -> str: import uuid uniq_append_string = uuid.uuid4().hex return "LOCAL_STORAGE_{}".format(uniq_append_string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_filename(instance, filename, prefix):\n md5 = hashlib.md5()\n md5.update(struct.pack('f', time.time()))\n for chunk in instance.file.chunks():\n md5.update(chunk)\n extension = os.path.splitext(filename)[1]\n return os.path.join(prefix, md5.hexdigest() + extension)", "def uniq...
[ "0.73440087", "0.7293261", "0.72058505", "0.7104382", "0.7023639", "0.6989666", "0.6973913", "0.6958078", "0.69552904", "0.69092476", "0.68472177", "0.6841427", "0.68403774", "0.6814487", "0.6809997", "0.6788753", "0.676268", "0.6753617", "0.6726381", "0.6722001", "0.6716039"...
0.7249474
2
Get the unique recipient screen name of this direct message.
def RecipientScreenName(self): return self._recipient_screen_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SenderScreenName(self):\n return self._sender_screen_name", "def name(self):\n name = self.__telegram_info.message.from_user.name\n return name[0].upper() + name[1::]", "def recipient(self):\n return self._recipient", "def recipient(self):\n\t\trecipient = re.search(r\...
[ "0.7752734", "0.64918673", "0.62729293", "0.6255866", "0.623452", "0.619695", "0.61146194", "0.606235", "0.60291743", "0.60020447", "0.5992718", "0.5992718", "0.5974469", "0.59644693", "0.59502053", "0.591237", "0.5908692", "0.58798575", "0.5869063", "0.58652693", "0.5863729"...
0.8478044
0
Get the unique recipient id of this direct message.
def RecipientId(self): return self._recipient_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipient(self):\n return self._recipient", "def __get_sender_id(self):\n return self.__sender_id", "def SenderId(self):\n return self._sender_id", "def message_id(self):\n return self._message_id", "def get_id(self):\n return self.email", "def get_id(self):\n ...
[ "0.69726956", "0.6845519", "0.6706302", "0.6689855", "0.656959", "0.656959", "0.65526414", "0.6541907", "0.64965004", "0.6486919", "0.6448498", "0.6448498", "0.6448498", "0.63657314", "0.6359405", "0.63500994", "0.6349369", "0.6317537", "0.631039", "0.631039", "0.62365204", ...
0.78954524
0
Get the unique id of this direct message.
def Id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_id(self):\n return self._message_id", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id", "def getMessageID(self):\n return self._payload[1]", "def unique_id(self):\n return self._uid", "def unique_id(self):\n return se...
[ "0.7614403", "0.76060534", "0.76060534", "0.76017725", "0.7509896", "0.7509896", "0.7509896", "0.74474", "0.740683", "0.73945445", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", "0.7383446", ...
0.0
-1
Get the time this direct message was posted, in seconds since the epoch.
def CreatedAtInSeconds(self): return timegm(rfc822.parsedate(self.created_at))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\n return self.__time", "def recv_time(self) -> float:\n return ntp_to_system_time(self.recv_timestamp)", "def get_time(self):\n return self._current_time_sec", "def get_time(self):\n return self._time", "def get_time(self):\n return self._time", "def...
[ "0.73640406", "0.7342908", "0.7301104", "0.72908604", "0.72908604", "0.72908604", "0.7247763", "0.71192276", "0.71192276", "0.7102016", "0.7069394", "0.70629513", "0.70410895", "0.70329237", "0.701099", "0.6998171", "0.69673026", "0.6934306", "0.69011426", "0.68950593", "0.68...
0.0
-1
Get the unique sender screen name of this direct message.
def SenderScreenName(self): return self._sender_screen_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RecipientScreenName(self):\n return self._recipient_screen_name", "def __get_sender_id(self):\n return self.__sender_id", "def sender(self) -> str:\n return self._sender", "def get_sender_username(self, mess):\n jid = mess.getFrom()\n typ = mess.getType()\n usern...
[ "0.80563945", "0.7244876", "0.7227212", "0.72249496", "0.71701336", "0.68805486", "0.683139", "0.6565113", "0.65164447", "0.6444427", "0.63503104", "0.6341293", "0.62930715", "0.6288434", "0.6222932", "0.61604697", "0.6127182", "0.6113828", "0.6101023", "0.6058973", "0.600164...
0.8693423
0
Get the unique sender id of this direct message.
def SenderId(self): return self._sender_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_sender_id(self):\n return self.__sender_id", "def message_id(self) -> str:\n return self[\"Sns\"][\"MessageId\"]", "def message_id(self):\n return self._message_id", "def sender(self) -> str:\n return self._sender", "def getSender(self):\n\n if self in WebSocket...
[ "0.8418445", "0.67250335", "0.6714075", "0.66589636", "0.6650832", "0.6625197", "0.66181654", "0.66074836", "0.65833485", "0.6534161", "0.6499195", "0.6368212", "0.63660455", "0.6344593", "0.6330442", "0.6250936", "0.6246877", "0.6246877", "0.6246877", "0.61974514", "0.616759...
0.8302837
1
A string representation of this twitter.DirectMessage instance. The return value is the same as the JSON string representation.
def __str__(self): return self.AsJsonString()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.message.as_string()", "def json(self):\n message_value = deepcopy(self.value)\n return json.dumps(encode_bin_as_b64(message_value))", "def to_string(self) -> str:\n return json.dumps(self.to_json())", "def to_string(self) -> str:\n return js...
[ "0.73219067", "0.7229696", "0.7227228", "0.7227228", "0.7124252", "0.7122441", "0.70216167", "0.6903345", "0.68823695", "0.68624634", "0.6857768", "0.68442136", "0.68369865", "0.68369865", "0.68369865", "0.68369865", "0.68369865", "0.68369865", "0.68369865", "0.68369865", "0....
0.0
-1
A JSON string representation of this twitter.DirectMessage instance.
def AsJsonString(self): return json.dumps(self.AsDict(), sort_keys=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(self):\n return json.dumps({'messages': self.messages},\n default=lambda i: i.__dict__)", "def json(self):\n message_value = deepcopy(self.value)\n return json.dumps(encode_bin_as_b64(message_value))", "def toJSON(self):\n data = {\n '...
[ "0.7496092", "0.73971313", "0.71908426", "0.69993734", "0.69836813", "0.69580036", "0.69580036", "0.69568026", "0.68295556", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.6821523", "0.68117136", "0.6811...
0.66468924
50
A dict representation of this twitter.DirectMessage instance. The return value uses the same key names as the JSON representation.
def AsDict(self): data = {} if self.id: data['id'] = self.id if self.created_at: data['created_at'] = self.created_at if self.sender_id: data['sender_id'] = self.sender_id if self.sender_screen_name: data['sender_screen_name'] = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return {\n 'special_messages': self.special_messages,\n 'description': self.description,\n 'name': self.name,\n 'id': self.id,\n }", "def as_dict(self):\n return {'message':self.message, 'line': self.line}", "def to_dict(se...
[ "0.7472715", "0.7249064", "0.71586627", "0.7055147", "0.7027829", "0.7010954", "0.6975489", "0.6833074", "0.6831375", "0.6794496", "0.6776659", "0.677373", "0.677124", "0.6758995", "0.6710048", "0.67042106", "0.6704086", "0.66896236", "0.6686174", "0.6685533", "0.66622084", ...
0.71117073
3
Create a new instance based on a JSON dict.
def NewFromJsonDict(data): return DirectMessage(created_at=data.get('created_at', None), recipient_id=data.get('recipient_id', None), sender_id=data.get('sender_id', None), text=data.get('text', None), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_from_jsondict(cls, data, **kwargs):\n\n json_data = data.copy()\n if kwargs:\n for key, val in kwargs.items():\n json_data[key] = val\n\n c = cls(**json_data)\n c._json = data\n return c", "def _from_json_dict(cls, dic):\n # create a new obj...
[ "0.78019667", "0.77675295", "0.775119", "0.7727157", "0.7727157", "0.7727157", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", "0.7577627", ...
0.0
-1
Tests whether the request of a metricsonly field forwarded to the SessionsReleaseHealthBackend is handled with an empty response. This test is designed to show an edgecase that can happen in case the duplexer makes the wrong decision with respect to which backend to choose for satisfying the query.
def test_sessions_metrics_with_metrics_only_field(self): response = self.do_request( { "organization_slug": [self.organization1], "project": [self.project1.id], "field": ["crash_free_rate(session)"], "groupBy": [], "inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_response(self):\n url = reverse(\"metrics\")\n offset = len(COST_MODEL_METRIC_MAP)\n client = APIClient()\n data = client.get(url + \"?limit=1&offset=\" + str(offset), **self.headers).data[\"data\"]\n self.assertEqual([], data)", "def test_no_telemetry(self):\n ...
[ "0.647578", "0.61641896", "0.6061185", "0.60308886", "0.5969548", "0.58484936", "0.57027304", "0.5686139", "0.56588954", "0.56503046", "0.5642935", "0.56159806", "0.5604346", "0.56027746", "0.55803365", "0.5559873", "0.55318046", "0.5513805", "0.5482832", "0.54733104", "0.546...
0.6252798
1
Evaluates the layer forward, i.e. from random numbers u to output x.
def eval_forward(self, u): if self.eval_forward_f is None: # masked random numbers tt_u = tt.matrix('u') mu = self.mask * tt_u # scale net s_net = nn.FeedforwardNet(self.n_inputs, mu) for h in self.s_hiddens: s_net.addLay...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_forward(self, x, u):\n\n if self.eval_forward_f is None:\n\n # conditional input\n tt_x = tt.matrix('x')\n\n # masked random numbers\n tt_u = tt.matrix('u')\n mu = self.mask * tt_u\n\n # scale net\n s_net = nn.FeedforwardN...
[ "0.7508767", "0.69100744", "0.6880717", "0.68043745", "0.6768155", "0.67019033", "0.66984", "0.6636887", "0.66325754", "0.6596729", "0.65929896", "0.6587823", "0.6585839", "0.657773", "0.6551676", "0.6527975", "0.6519867", "0.6518147", "0.65168434", "0.65100193", "0.65027", ...
0.7289731
1
Evaluates the layer forward, i.e. from input x and random numbers u to output y.
def eval_forward(self, x, u): if self.eval_forward_f is None: # conditional input tt_x = tt.matrix('x') # masked random numbers tt_u = tt.matrix('u') mu = self.mask * tt_u # scale net s_net = nn.FeedforwardNet(self.n_inputs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_forward(self, u):\n\n if self.eval_forward_f is None:\n\n # masked random numbers\n tt_u = tt.matrix('u')\n mu = self.mask * tt_u\n\n # scale net\n s_net = nn.FeedforwardNet(self.n_inputs, mu)\n for h in self.s_hiddens:\n ...
[ "0.7142729", "0.6692717", "0.66237617", "0.6623711", "0.66003966", "0.65893316", "0.6441261", "0.64330065", "0.64307", "0.64253", "0.6417393", "0.64077145", "0.63962835", "0.63808537", "0.6371223", "0.6344166", "0.6341299", "0.6328462", "0.63110834", "0.6305471", "0.6284393",...
0.73542875
0
Histogram equalization of a grayscale image.
def histeq( im, nbr_bins = 256): # get image histogram imhist, bins = histogram( im.flatten(), nbr_bins, normed = True) cdf = imhist.cumsum() # cumulative distribution function cdf = 255 * cdf / cdf[-1] # normalize # use linear interpolation of cdf to find new pixel values im2 = interp( im.flatten(), bins[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def histogram_equalize(im_orig):\n if im_orig.ndim == 3:\n return _histogram_equalize_rgb(im_orig)\n return _histogram_equalize_grayscale(im_orig)", "def _histogram_equalize_grayscale(im_orig):\n image = im_orig.copy()\n\n hist_orig = utils.get_histogram(image)\n\n im_eq = _histogram_equali...
[ "0.80511105", "0.78612596", "0.77823985", "0.7713141", "0.76837647", "0.7615567", "0.75756526", "0.75611514", "0.7508731", "0.74970746", "0.7411783", "0.7396931", "0.7365457", "0.73105085", "0.73070043", "0.73011714", "0.720667", "0.7177305", "0.7073054", "0.7041186", "0.6991...
0.7123623
18
Checks if a user is a patient
def form_valid(self, form): try: patient = form.get_user().patient_username except Patient.DoesNotExist: patient = None if patient is not None: auth_login(self.request, form.get_user()) nonce = get_random_string(length=16, allowed_chars=u'abcdefghijklmnopqrstuvwxyz0123456789') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_doctor(self):\n return self.user_type == 'D'", "def check_user(self):\n try:\n if self.get_customer()[0][0] == self.dni:\n return True\n else:\n return False\n except:\n return False", "def has_permission(self, request, ...
[ "0.67715794", "0.64577687", "0.6217261", "0.61275584", "0.6087876", "0.60714763", "0.6032666", "0.60055125", "0.597937", "0.5978116", "0.59780604", "0.5947342", "0.5921415", "0.59074646", "0.58979136", "0.5892952", "0.58584225", "0.58549124", "0.5823415", "0.5806358", "0.5805...
0.0
-1
first do depth first walk then return a list of (key,val) tuples like OrderedDict where key_filter(key) == True or truthy
def flatten_sections_filter_keys(report, key_filter=None): allitems = [] if not key_filter: def walk_dict(d): if isinstance(d, dict): for kk in d: if isinstance(d[kk], dict): walk_dict(d[kk]) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flat (root, ignore_access_errors=False):\n for key, subkeys, values in walk (root, ignore_access_errors):\n yield key\n for value in values:\n yield value", "def RecurseKeys(self):\n yield self\n for subkey in self.GetSubkeys():\n for key in subkey.RecurseKeys():\n yield key", ...
[ "0.5880279", "0.58668417", "0.5830949", "0.58073777", "0.5796399", "0.57596606", "0.573731", "0.5668744", "0.5581191", "0.55399823", "0.5506889", "0.54981583", "0.54556835", "0.545427", "0.5451362", "0.54487", "0.54470015", "0.54153174", "0.5411029", "0.53954065", "0.5391584"...
0.6290142
0
Returns the reward value of the current step.
def get_reward(self): assert self.env.prev_obs_data is not None assert self.env.obs_data is not None reward, termination = self.reward_fn(self.env.prev_obs_data, self.env.obs_data) reward = float(reward) termination = bool(termination)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length # the reward is proportional to the duration \n else:\n return 0", "def reward(self):\n return self._reward", "def get_reward(self):\n accuracy = self.state\n # Use accuracy as reward for ...
[ "0.8388979", "0.8245466", "0.8081594", "0.80481964", "0.8047221", "0.8000799", "0.79587364", "0.78430593", "0.7826278", "0.7813064", "0.7791065", "0.77169067", "0.77101547", "0.76771545", "0.764766", "0.7606153", "0.75809145", "0.73644924", "0.7339855", "0.7327747", "0.732774...
0.74971884
17
Get previous circular buffer data pointer.
def dec_ptr(self, ptr): result = ptr - reading_len[self.data_format] if result < data_start: result = 0x10000 - reading_len[self.data_format] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get (self) :\r\n if (self.empty()) : # Empty, can't get anything\r\n raise Exception(\"Circular Buffer Empty\")\r\n else : # nextGet always tells us where we are\r\n c = self.buff_[self.nextGet_];\r\n self.nextGet_ = (self.nextGet_+1) % self.capacity()\r\n ...
[ "0.65129316", "0.64552796", "0.6415716", "0.63126653", "0.62894744", "0.626211", "0.62540084", "0.6241677", "0.61624795", "0.61493164", "0.61334354", "0.6120699", "0.61006176", "0.60790527", "0.60618985", "0.60555565", "0.60396975", "0.6036821", "0.6035651", "0.6033994", "0.6...
0.0
-1
Return the gradient operator of a weighted graph in matrix form.
def gradop(adj: np.ndarray) -> sp.csr_matrix: e = np.array(adj.nonzero()) ne = e.shape[1] nv = adj.shape[0] i, j, x = np.tile(range(ne), 2), e.flatten(), np.repeat([-1, 1], ne) return sp.csr_matrix((x, (i, j)), shape=(ne, nv))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self):\n gradients = [func.gradient for func in self.functionals]\n return DiagonalOperator(*gradients)", "def gradient(self):\n if self.operator is None:\n return ConstantOperator(self.vector, self.domain)\n else:\n if not self.operator.is_linear:\n...
[ "0.71253705", "0.699914", "0.6698267", "0.66590863", "0.65351784", "0.6476302", "0.64446676", "0.64373606", "0.64070755", "0.63756424", "0.6370833", "0.635036", "0.6345278", "0.6341418", "0.63284105", "0.63116056", "0.6304451", "0.63006914", "0.62996995", "0.62847024", "0.626...
0.6210857
27