query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Generate a model filename depending on flags.
def generateModelFilename(args, type): opt = [] if args.letters: opt.append('l') if args.symbols: opt.append('s') if args.digits: opt.append('d') opt.sort() return "models/model_{0}_{1}.yml".format(type, ''.join(opt))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_filename_from_options(opt):\n fs = '{}_emb_{}_hid_{}_de_{}_dd_{}_n_lyrs_{}_lr_{}'.format(\n opt.rnn_cell,\n opt.embedding_size, opt.hidden_size,\n opt.dropout_p_encoder, opt.dropout_p_decoder,\n opt.n_layers, opt.lr)\n\n if opt.optim is not None:\n fs += '_{}'....
[ "0.6673857", "0.6638888", "0.63141143", "0.63017", "0.62750924", "0.6254374", "0.6215407", "0.6143703", "0.6113542", "0.6111861", "0.60562485", "0.60557556", "0.6055665", "0.60303986", "0.60138685", "0.59926826", "0.5991642", "0.596877", "0.594533", "0.5944135", "0.59324217",...
0.7817009
0
Generate a filename in folder. folder/prefixfolder.0.ext
def generateFilename(folder, prefix, ext): filename = os.path.basename(os.path.normpath(folder)) if prefix: filename = "{0}-{1}".format(prefix, filename) path = getIncrementedFilename(os.path.join(folder, filename), ext) return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_filename(extension, with_path=True, base_folder=None):\n name = get_md5(str(uuid4()))\n # if not extension:\n # extension = get_file_extension()\n if base_folder is not None:\n base_folder = \"%s/\" % base_folder.rstrip(\"/\")\n else:\n base_folder = \"\"\n\n if with_pa...
[ "0.7385492", "0.7333924", "0.7312657", "0.72930425", "0.7238043", "0.72070307", "0.7178001", "0.7148282", "0.710962", "0.70897174", "0.7036363", "0.69962245", "0.6996097", "0.69855136", "0.69633824", "0.6955315", "0.69493705", "0.6947302", "0.6938939", "0.69265604", "0.692255...
0.8751055
0
This function run the filterbank function that will create the filters as numpy array, and then, it saves those arrays as module's buffers.
def register_filters(self): n = 0 # prepare for pytorch for k in self.phi_f.keys(): if type(k) != str: # view(-1, 1).repeat(1, 2) because real numbers! self.phi_f[k] = torch.from_numpy( self.phi_f[k]).float().view(-1, 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_filters(self):\n\n \"\"\"\n filter_bank = bandpass_filterbank(\n self.bands, fs=self.fs, order=order, output=output\n )\n\n return [lambda sig: sosfiltfilt(bpf, sig) for bpf in filter_bank]\n \"\"\"\n\n # This seems to work only for Octave bands out of...
[ "0.61499494", "0.6001202", "0.576146", "0.5688442", "0.566973", "0.56480443", "0.56426305", "0.5606874", "0.5561089", "0.5473349", "0.54167676", "0.537563", "0.5322362", "0.5278769", "0.52452475", "0.52107644", "0.5201634", "0.5196191", "0.5195992", "0.51905155", "0.51783687"...
0.5164274
22
This function loads filters from the module's buffer
def load_filters(self): buffer_dict = dict(self.named_buffers()) n = 0 for k in self.phi_f.keys(): if type(k) != str: self.phi_f[k] = buffer_dict['tensor' + str(n)] n += 1 for psi_f in self.psi1_f: for sub_k in psi_f.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_filter(self, *args, **kwargs):\n raise NotImplementedError", "def load_all_filters(self, interp=True, lamb=None):\n raise NotImplementedError", "def get_filters(self):", "def load_all_filters(self, interp=True, lamb=None):\n with self as s:\n filters = [s._load_filte...
[ "0.6760127", "0.66662526", "0.65889287", "0.6388731", "0.6377088", "0.6367973", "0.6348672", "0.6340092", "0.63190585", "0.6272265", "0.62107223", "0.61704546", "0.6143195", "0.6071618", "0.60356534", "0.5954291", "0.59326255", "0.5896352", "0.5821316", "0.5776325", "0.573437...
0.7129835
0
If the key already exists, print the same and return nothing; otherwise, check if it is less than or greater than the root node and traverse the left or right subtree respectively
def insert(self, key, value): if self.key == key: self.val = value elif key < self.key: if self.left is None: self.left = self.__class__(key, value) else: self.left = self.left.insert(key, value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert(self, key: int) -> TreeNode:\n node = self.root\n while True:\n # Check if a key is greater than node.\n if key > node.val:\n if not node.right:\n # node.right is a leaf\n node.right = TreeNode(val=key)\n ...
[ "0.74619985", "0.70719695", "0.70218116", "0.70132345", "0.69432765", "0.6942919", "0.6870456", "0.67686296", "0.66912097", "0.6633694", "0.66175914", "0.65009683", "0.6491999", "0.647724", "0.6445138", "0.63893914", "0.6381344", "0.63772565", "0.63666034", "0.63644916", "0.6...
0.0
-1
Extracts GPM_IMERG data from its HDF5 format.
def extract_GPM_IMERG(hdf_list, layer_indexs, outdir = None, resolution = "0.1"): hdf_list = core.enf_filelist(hdf_list) output_filelist = [] # load the GPM datatype from the library datatype = datatype_library()["GPM_IMERG_{0}_GLOBAL".format(resolution)] # for every hdf file in the input list ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_mock_bgs_mxxl_file_hdf5(filename):\n f = h5py.File(filename)\n ra = f[\"Data/ra\"][...].astype('f8') % 360.0\n dec = f[\"Data/dec\"][...].astype('f8')\n SDSSr_true = f[\"Data/app_mag\"][...].astype('f8')\n zred = f[\"Data/z_obs\"][...].astype('f8')\n f.close()\n\n return {'RA':r...
[ "0.5809921", "0.5733813", "0.5630111", "0.56280625", "0.54389006", "0.5396725", "0.53915787", "0.538835", "0.5332873", "0.53064656", "0.5283936", "0.5279001", "0.52393204", "0.52156854", "0.5193792", "0.51659465", "0.51659465", "0.5145079", "0.5095168", "0.50883245", "0.50419...
0.6405701
0
This function adds two numbers
def add(x, y): return x + y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_numbers(a,b):\r\n return a+ b", "def add_numbers(x, y):\r\n return x + y", "def add_numbers(x,y):\n return x + y", "def add_numbers(x, y):\n return x + y", "def sum_num(a, b):\n return a + b", "def add(num1, num2):\n return num1 + num2", "def add(num1, num2):\n return num1 ...
[ "0.8762212", "0.8670217", "0.859789", "0.8591465", "0.84667885", "0.8446509", "0.8446509", "0.8446509", "0.8446509", "0.8446509", "0.8402066", "0.8401869", "0.8377483", "0.83571845", "0.83463866", "0.83314013", "0.8326433", "0.83133906", "0.82971615", "0.82867235", "0.8249899...
0.80355823
29
This function subtracts two numbers
def subtract(x, y): return x - y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(num1, num2):\n return num1 - num2", "def subtract(num1, num2):\n return num1 - num2", "def subtract(num1, num2):\n return num1 - num2", "def subtract_numbers(x,y):\n return x - y", "def subtraction(number1, number2):\n return number1 - number2", "def subtract(num1, num2):\n \...
[ "0.87336814", "0.8722757", "0.8722757", "0.8620713", "0.84730077", "0.84625244", "0.8447413", "0.8398901", "0.8352518", "0.8352518", "0.8276303", "0.82603747", "0.81481236", "0.8122859", "0.8122859", "0.8122859", "0.81185967", "0.80385715", "0.8032834", "0.7915922", "0.787678...
0.81928986
12
This function multiplies two numbers
def multiply(x, y): return x * y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(num1, num2):\n return num1 * num2", "def multiply(num1, num2):\n return num1 * num2", "def multiply(num1, num2):\n return num1 * num2", "def mul(num1, num2):\n return num1 * num2", "def mul(num1, num2):\n return num1 * num2", "def mul(num1, num2):\n return num1 * num2", "de...
[ "0.86584413", "0.86584413", "0.8622478", "0.85672337", "0.85672337", "0.85672337", "0.8551275", "0.8551275", "0.8537031", "0.8535148", "0.85343", "0.85343", "0.85213196", "0.85102606", "0.8500077", "0.8463136", "0.84555733", "0.8426819", "0.8426555", "0.8426555", "0.8426555",...
0.8345003
27
This function divides two numbers
def divide(x, y): return x / y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div(num1, num2):\n return num1 / num2", "def div(num1, num2):\n return num1 / num2", "def div_numbers(a: int, b: int) -> int:\n return a / b", "def div(a,b):\r\n return a/b", "def div(x, y):\n return x / y", "def div(a, b):\n a = float(a)\n b = float(b)\n return a / b", "def...
[ "0.8534857", "0.8534857", "0.8504551", "0.8425715", "0.83172905", "0.823194", "0.8219543", "0.81378883", "0.8098497", "0.80835444", "0.8072071", "0.806691", "0.8055883", "0.80257976", "0.7996066", "0.7993646", "0.79935116", "0.79935116", "0.79935116", "0.7978012", "0.79232347...
0.80539584
13
Test the startdate helper function.
def test_startdate(self): req = create_request(query_string={'dates': '7d'}) eq_(startdate(req), date.today() - timedelta(days=7)) req = create_request(query_string={'dates': 'today'}) eq_(startdate(req), date.today()) req = create_request(query_string={'day': '2012-05-24'}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sample_one_date(self):\r\n self.assertEqual(self.test_sample.date, datetime.datetime(2016, 2, 12, 7, 34, 26))", "def test_sample_date(self):\r\n self.assertEqual(self.test_sample.date, '2018-08-02 22:32:23')", "def test_date_field():", "def test_2_default_start_date(self):\n dat...
[ "0.7418544", "0.72079736", "0.70811504", "0.69365495", "0.6818063", "0.6744521", "0.6690331", "0.6622518", "0.6553764", "0.65366197", "0.6513246", "0.6510367", "0.6502609", "0.6445681", "0.6438329", "0.64213866", "0.6361636", "0.63540447", "0.6352647", "0.6343614", "0.632949"...
0.7412501
1
Test the enddate helper function
def test_enddate(self): req = create_request(query_string={'day': '2012-05-24'}) eq_(enddate(req), datetime(2012, 5, 25)) req = create_request(query_string={'week': '2012-05-24'}) eq_(enddate(req), datetime(2012, 5, 27, 23, 59, 59)) req = create_request(query_string={'day': 'to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_date(self):\n self.assertEqual(self.active.end_date, self.active.start_date + timedelta(3))", "def test_get_end_date(self):\n # Creating booking object\n book_time = datetime.utcnow()\n duration = 3\n booking = Booking(1, \"dummy\", book_time, duration)\n\n ...
[ "0.8099103", "0.73868465", "0.7336594", "0.71555233", "0.70647436", "0.7038015", "0.7003596", "0.6972179", "0.69413835", "0.69184554", "0.6905523", "0.68968177", "0.6835612", "0.6827259", "0.6807936", "0.6802212", "0.6802212", "0.6792249", "0.6782013", "0.67711264", "0.674704...
0.80878216
1
Test the paginate helper function.
def test_paginate(self): db = get_session(self.app) statuses = [] with self.app.app_context(): p = project(save=True) u = user(save=True) # Create 100 statuses for i in range(30): statuses.append(status(project=p, user=u, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pagination(self):\n self.check_pagination()", "def test_pagination(self):\n for page in range(1, 5):\n self._test_one_page(page=page)", "def test_paginate_no_inputs():\n result = search_paginate()\n assert result == (0, 50)", "def test_search_paginate(page_size, page_n...
[ "0.82312167", "0.7885856", "0.75684536", "0.74428177", "0.73290133", "0.7238233", "0.70430285", "0.70365375", "0.69941574", "0.69684213", "0.69094944", "0.68341506", "0.68096733", "0.67118025", "0.66954076", "0.66705185", "0.66219485", "0.66180134", "0.6590547", "0.6590547", ...
0.69497466
10
Test the week start/end helper functions.
def test_weeks(self): d = datetime(2014, 1, 29) eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0)) eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sunday(self):\n date = datetime.date(1980, 5, 4)\n self.assertEqual(date.isoweekday(), 7)\n start_date, end_date = get_weekspan(date)\n self.assertEqual(start_date.isoweekday(), 1)\n self.assertEqual(end_date.isoweekday(), 7)\n self.assertTrue(start_date.toordinal...
[ "0.7717152", "0.7608945", "0.7549894", "0.7433294", "0.7384707", "0.7339487", "0.7160178", "0.7136441", "0.6967238", "0.6891316", "0.687496", "0.6784274", "0.6770107", "0.6727777", "0.6703208", "0.6680453", "0.6665933", "0.6658816", "0.6594567", "0.6536674", "0.64868426", "...
0.7576969
2
Test the __repr__ function of the Status model.
def test_status_repr(self): with self.app.app_context(): u = user(username='testuser', save=True) s = status(content='my status update', user=u, save=True) eq_(repr(s), '<Status: testuser: my status update>')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return f\"<TestStatus {self.test_id}: {self.status}>\"", "def test_repr_method(self):\n\n u = User(\n email=\"test@test.com\",\n username=\"testuser\",\n password=\"HASHED_PASSWORD\"\n )\n\n u.id = 9999\n\n db.sessio...
[ "0.74939585", "0.6992701", "0.6944632", "0.6924971", "0.68719125", "0.6830909", "0.6818189", "0.6818189", "0.6818189", "0.6818189", "0.6818189", "0.68118507", "0.6807135", "0.6787736", "0.67022115", "0.6695331", "0.6669228", "0.6649944", "0.664373", "0.66423917", "0.6630548",...
0.8246034
0
Test the loading of replies for a status.
def test_status_replies(self): with self.app.app_context(): p = project(save=True) u = user(save=True) s = status(project=p, user=u, save=True) for i in range(30): status(project=p, user=u, reply_to=s, save=True) page = s.replies() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_status_reply_count(self):\n with self.app.app_context():\n u = user(save=True)\n s = status(user=u, project=None, save=True)\n for i in range(5):\n status(user=u, project=None, reply_to=s, save=True)\n\n eq_(s.reply_count, 5)", "def test_...
[ "0.612048", "0.601257", "0.5980231", "0.5976872", "0.5916692", "0.580269", "0.5790228", "0.5780758", "0.5731992", "0.5731364", "0.5731364", "0.5725933", "0.5664359", "0.5663646", "0.5607137", "0.5565588", "0.5563875", "0.5541946", "0.5509027", "0.55016154", "0.55000496", "0...
0.71060956
0
Test the reply_count property of the Status model.
def test_status_reply_count(self): with self.app.app_context(): u = user(save=True) s = status(user=u, project=None, save=True) for i in range(5): status(user=u, project=None, reply_to=s, save=True) eq_(s.reply_count, 5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_status_replies(self):\n with self.app.app_context():\n p = project(save=True)\n u = user(save=True)\n s = status(project=p, user=u, save=True)\n\n for i in range(30):\n status(project=p, user=u, reply_to=s, save=True)\n\n page = ...
[ "0.7165764", "0.65260106", "0.64591074", "0.64202434", "0.6334059", "0.6179951", "0.6167599", "0.61667216", "0.6138746", "0.6063657", "0.605946", "0.60412294", "0.6024089", "0.5998621", "0.5979235", "0.5946217", "0.59048754", "0.5891214", "0.5882784", "0.5866248", "0.57976913...
0.86650324
0
Test the __repr__ function of the Project model.
def test_project_repr(self): with self.app.app_context(): p = project(slug="project", name="Project", save=True) eq_(repr(p), '<Project: [project] Project>')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_repr(self):\n foo = Project(FilePath(\"bar\"))\n self.assertEqual(repr(foo), \"Project(%r)\" % (foo.directory))", "def test_repr(self):\n foo = Project(FilePath('bar'))\n self.assertEqual(\n repr(foo), 'Project(%r)' % (foo.directory))", "def test_repr():\n c =...
[ "0.79380965", "0.7825642", "0.7233653", "0.7208413", "0.7143264", "0.68903", "0.6815971", "0.67883444", "0.6762459", "0.6707629", "0.66418946", "0.6614794", "0.6576248", "0.6576248", "0.6576248", "0.6576248", "0.6576248", "0.6570561", "0.65669024", "0.65509444", "0.6509135", ...
0.84027827
0
Test loading of recent statuses for a project.
def test_project_recent_statuses(self): with self.app.app_context(): p = project(save=True) u = user(save=True) # Create 70 statuses for i in range(70): status(project=p, user=u, save=True) s = status(project=p, user=u, save=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_status():\n logger.debug(\"Starting the check_status() routine.\")\n\n url = \"https://www.toggl.com/api/v8/time_entries/current\"\n token = os.environ[\"TOGGL_API_TOKEN\"]\n auth_token = base64.b64encode(f\"{token}:api_token\".encode()).decode()\n resp = requests.get(url, headers={\"Autho...
[ "0.6473298", "0.635153", "0.63074726", "0.63074726", "0.62822413", "0.6234853", "0.6201601", "0.6116359", "0.6101787", "0.60247105", "0.6018722", "0.6009632", "0.5984645", "0.59713846", "0.59026635", "0.58660436", "0.58178747", "0.581399", "0.5808873", "0.5801979", "0.5789115...
0.75648475
0
Test that the WeekColumnClause generates the right thing.
def test_week_column_clause(self): # Dummy object to have a "name" attribute e = lambda: None e.name = "test" c = None eq_(compile_week_column_sqlite(e, c), "strftime('%Y%W', test)") eq_(compile_week_column_postgresql(e, c), "to_char(test, 'YYYYWW')") eq_(compile_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weeks():\n assert_equal(datetime.timedelta(days=7), convert_delta(\"1w\"))", "def test_weeks(self):\n d = datetime(2014, 1, 29)\n eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))\n eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))", "def test_wednesday(self):\n date =...
[ "0.6432751", "0.63473666", "0.61770153", "0.60826415", "0.60353845", "0.6013306", "0.5977321", "0.59392285", "0.59301287", "0.5923003", "0.5915772", "0.5915053", "0.5880065", "0.58589923", "0.5838699", "0.58327746", "0.5722747", "0.5686529", "0.5684126", "0.5675613", "0.56345...
0.8682297
0
Test the week_start function of the Status model.
def test_status_week_start(self): d = datetime(2014, 5, 8, 17, 17, 51, 0) with self.app.app_context(): u = user(username='testuser', save=True) s = status(content='my status update', created=d, user=u, save=True) d_actual = s.week_start.strftime("%Y-%m-%d") eq_(d_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_status_weeks_at_year_start(self):\n d = datetime(2013, 12, 31, 12, 13, 45, 0)\n with self.app.app_context():\n u = user(username='testuser', save=True)\n s = status(content='my status update', created=d, user=u, save=True)\n eq_(s.week_start.strftime(\"%Y-%m-%d\"...
[ "0.83616626", "0.69464576", "0.6789109", "0.65788275", "0.6457048", "0.6422893", "0.64069396", "0.6401101", "0.6383727", "0.6268315", "0.6216089", "0.6153314", "0.6131804", "0.6118409", "0.6089668", "0.60509104", "0.59532243", "0.58916193", "0.5876618", "0.58585644", "0.57753...
0.8738532
0
Test the week_end function of the Status model.
def test_status_week_end(self): d = datetime(2014, 5, 8, 17, 17, 51, 0) with self.app.app_context(): u = user(username='testuser', save=True) s = status(content='my status update', created=d, user=u, save=True) d_actual = s.week_end.strftime("%Y-%m-%d") eq_(d_actu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_status_weeks_at_year_end(self):\n d = datetime(2014, 1, 1, 12, 13, 45, 0)\n with self.app.app_context():\n u = user(username='testuser', save=True)\n s = status(content='my status update', created=d, user=u, save=True)\n eq_(s.week_start.strftime(\"%Y-%m-%d\"), \...
[ "0.8233477", "0.6845551", "0.68036824", "0.67204213", "0.6662919", "0.66568273", "0.6647003", "0.6631411", "0.6620486", "0.6614611", "0.65919197", "0.65521747", "0.6544718", "0.6541975", "0.6520461", "0.63687605", "0.63436925", "0.63127625", "0.61663187", "0.6138307", "0.6131...
0.8860835
0
Test the week_{start|end} function around the end of the year.
def test_status_weeks_at_year_end(self): d = datetime(2014, 1, 1, 12, 13, 45, 0) with self.app.app_context(): u = user(username='testuser', save=True) s = status(content='my status update', created=d, user=u, save=True) eq_(s.week_start.strftime("%Y-%m-%d"), "2013-12-30")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weeks(self):\n d = datetime(2014, 1, 29)\n eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))\n eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))", "def test_wednesday(self):\n date = datetime.date(1988, 5, 4)\n self.assertEqual(date.isoweekday(), 3)\n start_da...
[ "0.72202384", "0.6944205", "0.6851087", "0.68134177", "0.671705", "0.656679", "0.6489247", "0.6467046", "0.6361605", "0.63153404", "0.6272321", "0.6271848", "0.62629914", "0.6248644", "0.6210934", "0.6208731", "0.616122", "0.6093136", "0.60783833", "0.6053811", "0.60115033", ...
0.72202754
0
Test the week_{start|end} function around the start of the year.
def test_status_weeks_at_year_start(self): d = datetime(2013, 12, 31, 12, 13, 45, 0) with self.app.app_context(): u = user(username='testuser', save=True) s = status(content='my status update', created=d, user=u, save=True) eq_(s.week_start.strftime("%Y-%m-%d"), "2013-12-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weeks(self):\n d = datetime(2014, 1, 29)\n eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))\n eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))", "def test_sunday(self):\n date = datetime.date(1980, 5, 4)\n self.assertEqual(date.isoweekday(), 7)\n start_date,...
[ "0.7470957", "0.68341273", "0.6726478", "0.6707495", "0.6693684", "0.6622957", "0.66202676", "0.6535436", "0.6477194", "0.6451959", "0.641651", "0.6399002", "0.6384759", "0.63531256", "0.6233793", "0.6227825", "0.6224333", "0.61802244", "0.6172713", "0.6135849", "0.60264415",...
0.71730626
1
Test the week_{start|end} functions with no 'created' date.
def test_status_week_no_created(self): with self.app.app_context(): s = status(content='my status update', save=True) # monkey patch s: s.created = None eq_(s.week_start, None) eq_(s.week_end, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_weekend_dates(self):\n input_ = [\n self.indicator_record(date=datetime.date(2014, 10, 14), value=0.035657),\n ]\n output = self.expander._daily_workday_indicator_expander(input_)\n no_weekend_dates = [record.date.weekday() < 5 for record in output]\n\n sel...
[ "0.73055196", "0.7117679", "0.7052217", "0.67183137", "0.66667885", "0.66064274", "0.65761286", "0.6546625", "0.6537206", "0.64989585", "0.64692307", "0.64305776", "0.6367222", "0.63057864", "0.62805516", "0.6254404", "0.6246417", "0.623945", "0.62334543", "0.62056017", "0.61...
0.654107
8
Test the `include_week` param of `dictify`.
def test_status_dictify_include_week(self): d = datetime(2014, 5, 8, 17, 17, 51, 0) with self.app.app_context(): s = status(content='my status update', created=d, save=True) d1 = s.dictify(include_week=False) eq_(d1.get("week_start", None), None) eq_(d1.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weeks(self):\n d = datetime(2014, 1, 29)\n eq_(week_start(d), datetime(2014, 1, 27, 0, 0, 0))\n eq_(week_end(d), datetime(2014, 2, 2, 23, 59, 59))", "def test_weekly_training_is_weekly(self):\n self.assertIsInstance(self.weekly_training.is_weekly, bool)\n self.assertTr...
[ "0.59799606", "0.5628876", "0.55689055", "0.5502893", "0.5496654", "0.5488705", "0.5447173", "0.5436449", "0.5319935", "0.53015006", "0.5293573", "0.5238236", "0.5212375", "0.5199183", "0.51928383", "0.51906854", "0.5107755", "0.5097796", "0.50974196", "0.5042864", "0.5034714...
0.79879344
0
Make sure the index view works like it's supposed to.
def test_index_view(self): response = self.client.get('/') eq_(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_view(self):\n response = self.client.get(url_for('main.index'))\n self.assertEqual(response.status_code, 200)", "def test_index_view(self):\n response = self.client.get(reverse('index'))\n self.assertEquals(response.status_code, 200)", "def index():\n pass", "def...
[ "0.7291941", "0.71232474", "0.7037661", "0.7029703", "0.69959986", "0.6897299", "0.68384355", "0.6778169", "0.6765011", "0.66536397", "0.65870583", "0.65506434", "0.6536556", "0.65247446", "0.6522577", "0.64995563", "0.6498999", "0.64752", "0.64728224", "0.64705855", "0.64657...
0.71265316
1
Make sure the user view works like it's supposed to.
def test_user_view(self): with self.app.app_context(): u = user(save=True) response = self.client.get('/user/%s' % u.slug) eq_(response.status_code, 200) response = self.client.get('/user/not-a-real-user') eq_(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_view(self, user):\r\n return True", "def user_view(cls, user, profile):\r\n pass", "def user_view(cls, user, profile):\n pass", "def test_anonymous_user_view(self):\n table = self.get_change_page_form(self.anonymous_client, self.question_1.pk)\n self.assertInHTML('<...
[ "0.7086963", "0.672903", "0.6679672", "0.66452026", "0.63684213", "0.6178163", "0.61555654", "0.61341447", "0.60966873", "0.6051872", "0.6032711", "0.6025575", "0.59920925", "0.5991533", "0.5991533", "0.5989656", "0.59573746", "0.59573746", "0.5936291", "0.5921777", "0.591154...
0.6225484
5
Make sure the project view works like it's supposed to.
def test_project_view(self): with self.app.app_context(): p = project(save=True) response = self.client.get('/project/%s' % p.slug) eq_(response.status_code, 200) response = self.client.get('/project/not-a-real-project') eq_(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_project_view(self):\n response = self.client.get('/projects/')\n self.assertEqual(response.status_code, 200)", "def user_project_view(cls, user, project):\r\n pass", "def test_project_admin_views(self):\n \n self._check_project_admin_view(self.testproject,\"a...
[ "0.7107375", "0.70435315", "0.68293095", "0.6828729", "0.6634028", "0.6627897", "0.6423891", "0.6423891", "0.6373143", "0.63483727", "0.6324649", "0.6324649", "0.6324649", "0.63243335", "0.62829185", "0.6280038", "0.62500846", "0.62067044", "0.61663127", "0.61609465", "0.6160...
0.7253505
0
Make sure the project view works like it's supposed to.
def test_team_view(self): with self.app.app_context(): u = user(save=True) t = team(users=[u], save=True) response = self.client.get('/team/%s' % t.slug) eq_(response.status_code, 200) response = self.client.get('/team/not-a-real-team') eq_(response.stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_project_view(self):\n with self.app.app_context():\n p = project(save=True)\n\n response = self.client.get('/project/%s' % p.slug)\n eq_(response.status_code, 200)\n\n response = self.client.get('/project/not-a-real-project')\n eq_(response.status_code, 404)",...
[ "0.7254752", "0.7108477", "0.70447385", "0.6829914", "0.6829656", "0.663527", "0.6628732", "0.64248526", "0.64248526", "0.6373948", "0.63493025", "0.6326653", "0.6326653", "0.6326653", "0.63260484", "0.62844414", "0.6281339", "0.6251772", "0.6206528", "0.6167661", "0.61619043...
0.0
-1
Make sure the weekly view works like it's supposed to.
def test_weekly_view(self): with self.app.app_context(): s = status(content='this works!', content_html='this works!', save=True) response = self.client.get('/weekly') eq_(response.status_code, 200) assert 'this works!' in response.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly():", "def news_for_week(self):\n\n raise NotImplementedError", "def do_upw(self, arg):\n self.do_timesheet('update week')", "def do_rw(self, arg):\n self.do_timesheet('report week')", "def test_date_accept_this_week(self):\n spi_search = \"find date this week\...
[ "0.7390644", "0.6628069", "0.6316971", "0.62943584", "0.6222734", "0.61304134", "0.6124772", "0.61098677", "0.6065505", "0.6025269", "0.60083735", "0.5984915", "0.5946888", "0.5876103", "0.58697593", "0.5849083", "0.5841368", "0.58262897", "0.58222216", "0.5779531", "0.577626...
0.6230381
4
Test that the sitewise Atom feed appears and functions properly.
def test_feeds(self): with self.app.app_context(): u = user(email='joe@example.com', slug='joe', save=True) team(users=[u], slug='a-team', save=True) p = project(slug='prjkt', save=True) for i in range(20): status(user=u, project=p, content='foo',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_feed(app, status, warning):\n app.build()\n assert app.statuscode == 0\n\n feed_path = app.outdir / \"blog/atom.xml\"\n assert (feed_path).exists()\n\n with feed_path.open() as feed_opened:\n feed_tree = lxml.etree.parse(feed_opened)\n entries = feed_tree.findall(\"{http://www.w3....
[ "0.694841", "0.6721112", "0.66035324", "0.65567565", "0.6466354", "0.6420811", "0.63885915", "0.6233843", "0.621266", "0.6136231", "0.6107135", "0.6084935", "0.60631865", "0.6060736", "0.6054466", "0.59608984", "0.5956934", "0.5914514", "0.5891691", "0.5851255", "0.5791811", ...
0.63128316
7
Make sure the Atom feed works with no status updates.
def test_feeds_no_statuses(self): rv = self.client.get('/statuses.xml') eq_(rv.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_feed(app, status, warning):\n app.build()\n assert app.statuscode == 0\n\n feed_path = app.outdir / \"blog/atom.xml\"\n assert (feed_path).exists()\n\n with feed_path.open() as feed_opened:\n feed_tree = lxml.etree.parse(feed_opened)\n entries = feed_tree.findall(\"{http://www.w3....
[ "0.6835991", "0.64578855", "0.6295441", "0.625764", "0.6122108", "0.60887194", "0.6051578", "0.5944181", "0.5819396", "0.5798948", "0.5683095", "0.56825566", "0.56687045", "0.56673497", "0.5664007", "0.56639534", "0.5616004", "0.5591796", "0.5588172", "0.5587753", "0.5587734"...
0.66492504
1
Test feeds for non existant objects
def test_feeds_do_not_exist(self): rv = self.client.get('/user/who.xml') eq_(rv.status_code, 404) rv = self.client.get('/project/fake.xml') eq_(rv.status_code, 404) rv = self.client.get('/team/not-real.xml') eq_(rv.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_empty_feed(self, items, rest_of_world):\n if not items or (len(items) == 1 and items[0].get('shelf')):\n # Empty feed.\n if rest_of_world:\n return -1\n return 0\n return 1", "def test_invalid_source_couchdb(self):\n with self.assert...
[ "0.63835967", "0.62838155", "0.6250704", "0.62298465", "0.62261206", "0.621487", "0.6144546", "0.5962096", "0.59538424", "0.58879393", "0.58648056", "0.5765122", "0.57643414", "0.57216215", "0.5687507", "0.5675347", "0.5660919", "0.5654927", "0.56497484", "0.5635615", "0.5635...
0.71294767
0
Test that team/project/user Atom feeds appear as tags.
def test_contextual_feeds(self): with self.app.app_context(): user(email='joe@example.com', save=True) u = user(username='buffy', email="buffy@sunnydalehigh.edu", name='Buffy Summers', slug='buffy', save=True) team(name='Scooby Gang', slug='scoobies', us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tagged_feed_link(self):\n TagFactory(name=\"green\", slug=\"green\")\n url = urlparams(reverse(\"questions.list\", args=[\"all\"]), tagged=\"green\")\n response = self.client.get(url)\n self.assertEqual(200, response.status_code)\n doc = pq(response.content)\n fee...
[ "0.6655427", "0.652093", "0.64729774", "0.6471719", "0.6333423", "0.63199914", "0.6251648", "0.6232657", "0.6213999", "0.6211783", "0.62080234", "0.6168511", "0.61674637", "0.6151765", "0.60887814", "0.60651493", "0.604175", "0.6029766", "0.6012529", "0.60103023", "0.59475577...
0.5885222
24
Test that you get a 403 if you're not authenticated.
def test_status_unauthenticated(self): rv = self.client.post('/statusize/', data={'message': 'foo'}, follow_redirects=True) eq_(rv.status_code, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_not_authorized(self):\n response = self.client.post(self.url)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def test_not_authenticated(self):\n response = self.client.get(telemetry_url)\n self.assertEqual(403, response.status_code)", "def test_...
[ "0.8655705", "0.835574", "0.8007285", "0.8007285", "0.79983294", "0.7925336", "0.79206896", "0.79143316", "0.7888472", "0.7881424", "0.7881424", "0.7881424", "0.7881424", "0.78648674", "0.78588146", "0.78435475", "0.7817501", "0.7798326", "0.7776099", "0.7757407", "0.7747948"...
0.75294024
37
Test posting a status.
def test_status(self): with self.app.app_context(): u = user(email='joe@example.com', save=True) authenticate(self.client, u) rv = self.client.post('/statusize/', data={'message': 'foo'}, follow_redirects=True) eq_(rv.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _post_status(event, gh, status):\n await gh.post(event.data[\"pull_request\"][\"statuses_url\"], data=status)", "def test_status_post(self):\n Parameters = Parameters1()\n response = self.client.open(\n '/status',\n method='POST',\n data=json.dumps(Para...
[ "0.745656", "0.74509895", "0.74124265", "0.74124265", "0.73885244", "0.72250813", "0.7212874", "0.71124977", "0.7078242", "0.69433266", "0.69389755", "0.6911412", "0.69109553", "0.6865766", "0.6787152", "0.678631", "0.6743121", "0.67309874", "0.6695728", "0.66593856", "0.6653...
0.74267554
2
Test posting a status with no message.
def test_status_no_message(self): with self.app.app_context(): u = user(email='joe@example.com', save=True) authenticate(self.client, u) rv = self.client.post('/statusize/', data={'message': ''}, follow_redirects=True) # This kicks up a 404, bu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_status_no_login(self):\n self.logout()\n post_json = {\"submission_id\": self.status_check_submission_id}\n response = self.app.post_json(\"/v1/check_status/\", post_json, expect_errors=True,\n headers={\"x-session-id\": self.session_id})\n ...
[ "0.7201963", "0.6949421", "0.6923064", "0.69161886", "0.6813586", "0.66684335", "0.6579005", "0.6507071", "0.64746195", "0.6440355", "0.6384444", "0.6365908", "0.63456374", "0.6339759", "0.6318823", "0.6302569", "0.6298929", "0.6298929", "0.62898874", "0.627214", "0.6268902",...
0.8056997
0
Test posting a status with a project.
def test_status_with_project(self): with self.app.app_context(): u = user(email='joe@example.com', save=True) p = project(name='blackhole', slug='blackhole', save=True) data = {'message': 'r1cky rocks!', 'project': p.id} authenticate(self.client, u) rv = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_projects_post(self):\n project = Project()\n response = self.client.open('/project-tracker/projects',\n method='POST',\n data=json.dumps(project),\n content_type='application/json')\n ...
[ "0.74586385", "0.7216196", "0.69448817", "0.69277596", "0.6804187", "0.6725366", "0.6686353", "0.6686353", "0.663884", "0.6617445", "0.65784293", "0.6564429", "0.65430015", "0.6496777", "0.6490737", "0.64863753", "0.643171", "0.64247245", "0.64239454", "0.639966", "0.6381403"...
0.8201474
0
Decorate a function to ensure the first arg being submitted is either a Dataset or DataArray.
def is_xarray(func, *dec_args): @wraps(func) def wrapper(*args, **kwargs): try: ds_da_locs = dec_args[0] if not isinstance(ds_da_locs, list): ds_da_locs = [ds_da_locs] for loc in ds_da_locs: if isinstance(loc, int): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_inputs(function):\n def decorated(self, data, *args, **kwargs):\n if not (isinstance(data, np.ndarray) and len(data.shape) == 2 and data.shape[1] == 1):\n raise ValueError('The argument `data` must be a numpy.ndarray with shape (n, 1).')\n\n return function(self, data, *args, ...
[ "0.67674077", "0.64274913", "0.57832295", "0.56677085", "0.5607064", "0.5605012", "0.5602898", "0.56021005", "0.55504334", "0.5547576", "0.55301267", "0.55263126", "0.55132675", "0.5495199", "0.54852957", "0.54453933", "0.5425492", "0.5423", "0.53411466", "0.5329185", "0.5301...
0.69493866
0
Checks that at the minimum, the object has provided dimensions.
def has_dims(xobj, dims, kind): if isinstance(dims, str): dims = [dims] if not all(dim in xobj.dims for dim in dims): raise DimensionError( f'Your {kind} object must contain the ' f'following dimensions at the minimum: {dims}' ) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dimensions(self) -> None:\n dims = (self.y_dim, self.x_dim)\n da = self._obj[self.vars[0]] if isinstance(self._obj, xr.Dataset) else self._obj\n extra_dims = [dim for dim in da.dims if dim not in dims]\n if len(extra_dims) == 1:\n dims = tuple(extra_dims) + dims\n ...
[ "0.71973795", "0.66598827", "0.6652556", "0.6621302", "0.6527767", "0.6464313", "0.64623004", "0.64564466", "0.64167625", "0.63492084", "0.63252366", "0.6256437", "0.6236625", "0.61707157", "0.6160307", "0.6137123", "0.6123389", "0.60822576", "0.60810775", "0.60706764", "0.60...
0.7164908
1
Checks that the array is at least the specified length.
def has_min_len(arr, len_, kind): arr_len = len(arr) if arr_len < len_: raise DimensionError( f'Your {kind} array must be at least {len_}, ' f'but has only length {arr_len}!' ) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LengthTest(arr):\n\tif len(arr) == 8:\n\t\treturn True;\n\telif len(arr) == 7:\n\t\treturn IsMissingField('cid', arr)\n\telse:\n\t\treturn False", "def has_definite_size(iterable):\n return hasattr(iterable, '__len__')", "def check_consistent_length(arrays: Sequence[npt.ArrayLike]) -> None:\n lengths...
[ "0.7045086", "0.69550073", "0.66807944", "0.66467315", "0.65652573", "0.6508588", "0.649857", "0.63973033", "0.638944", "0.6372922", "0.63468534", "0.6344845", "0.6343781", "0.6341784", "0.63383394", "0.6317262", "0.62815475", "0.62730503", "0.62381244", "0.62193894", "0.6203...
0.82707816
0
Checks that the reference dimensions match appropriate initialized dimensions. If uninitialized, ignore 'member'. Otherwise, ignore 'lead' and 'member'.
def match_initialized_dims(init, ref, uninitialized=False): # since reference products won't have the initialization dimension, # temporarily rename to time. init = init.rename({'init': 'time'}) init_dims = list(init.dims) if 'lead' in init_dims: init_dims.remove('lead') if ('member' in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_reference_same_dims(perfectModelEnsemble_initialized_control):\n pm = perfectModelEnsemble_initialized_control.generate_uninitialized()\n pm = pm.isel(lead=[0, 1, 2], init=[0, 1, 2])\n metric = \"mse\"\n comparison = \"m2e\"\n dim = \"init\"\n actual_no_ref = pm.verify(\n m...
[ "0.63892365", "0.5941461", "0.5922711", "0.5867122", "0.58525753", "0.5823122", "0.55616474", "0.55140597", "0.54647905", "0.5436583", "0.54341036", "0.5396807", "0.53695035", "0.53636837", "0.53424156", "0.5328619", "0.5301063", "0.52989846", "0.5285114", "0.5285059", "0.525...
0.6501884
0
Checks that a new reference (or control) dataset has at least one variable in common with the initialized dataset. This ensures that they can be compared pairwise.
def match_initialized_vars(init, ref): init_vars = init.data_vars ref_vars = ref.data_vars # https://stackoverflow.com/questions/10668282/ # one-liner-to-check-if-at-least-one-item-in-list-exists-in-another-list if set(init_vars).isdisjoint(ref_vars): raise VariableError( 'Please...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dataset_consistency(self):\n if not self.multi_dataset: \n raise MutantError(\"_check_dataset_consistency only makes sense for multi-datasets!\")\n def _check_sets_raise_error(set1, set2, set1_name, set2_name):\n if not set1==set2:\n raise MutantError(...
[ "0.6559695", "0.64126575", "0.6134037", "0.60592747", "0.59999657", "0.5986645", "0.587413", "0.58625877", "0.5837595", "0.5830325", "0.57788134", "0.57457954", "0.5678638", "0.5620417", "0.5592057", "0.55767757", "0.55720913", "0.55549836", "0.5544577", "0.5535928", "0.55305...
0.7352274
0
Check whether an item is in a list; kind is just a string.
def is_in_list(item, list_, kind): if item not in list_: raise KeyError(f'Specify {kind} from {list_}: got {item}') return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isList(self, item):\n\t retval = False\n\t if type(item) in (ListType, TupleType) :\n\t retval = True", "def _is_list(item):\n return isinstance(item, list)", "def _is_in_list(l, valid_l):\n\n for elem in l:\n if Settings._is_primitive(elem):\n if not Settings._is_in...
[ "0.7021183", "0.67562884", "0.66337615", "0.6577507", "0.6478335", "0.6457706", "0.64438295", "0.64166516", "0.6394912", "0.63919556", "0.63097334", "0.6309731", "0.6302186", "0.62983406", "0.62785506", "0.6268537", "0.6239638", "0.6180043", "0.6126522", "0.6114221", "0.60942...
0.84802943
0
to seperate by nbytes to different files
def Seperate(f_read, f_write_name): lines = f_read.readlines() line_s = [line.split() for line in lines] for i in range(6, 13): nbytes = pow(2,i) f_write = f_write_name + str(nbytes) + "b.txt" f = open(f_write, "w+") for line in line_s: if line[3] == str(nbytes)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitFile(filename, n):\n in_file = open(filename)\n line = in_file.readline()\n count = 0\n while line <> \"\":\n if count < 10: num = \"0\"+str(count)\n else: num = str(count)\n f = open(\"output/\"+filename+\"-\"+num,\"w\")\n for i in range(n):\n if line ==...
[ "0.6571904", "0.65097827", "0.6118995", "0.5988217", "0.59850276", "0.5945666", "0.5910023", "0.57907903", "0.5722481", "0.5643262", "0.56297284", "0.56196105", "0.55893993", "0.55658495", "0.5523404", "0.5513597", "0.5506873", "0.5497721", "0.54768145", "0.54430634", "0.5441...
0.66836053
0
Tokenization/string cleaning for all datasets except for SST.
def clean_str(string): string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string) string = re.sub(r"\'s", " \'s", string) string = re.sub(r"\'ve", " \'ve", string) string = re.sub(r"n\'t", " n\'t", string) string = re.sub(r"\'re", " \'re", string) string = re.sub(r"\'d", " \'d", string) string =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaning (data):", "def clean_data(self, data):\r\n data=data.lower()\r\n doc=nlp(data, disable=['parser', 'ner'])\r\n \r\n #Removing stopwords, digits and punctuation from data\r\n tokens = [token.lemma_ for token in doc if not (token.is_stop\r\n ...
[ "0.66246843", "0.6196098", "0.61627287", "0.61283535", "0.6075013", "0.60135293", "0.5987855", "0.5977075", "0.5957499", "0.5951337", "0.5931883", "0.5906291", "0.59061503", "0.5903117", "0.5876904", "0.58567333", "0.5848976", "0.5844153", "0.5844153", "0.5820813", "0.5793052...
0.0
-1
The sequence of the concatenated correctly decoded blocks is compressed into a final secret key of length of length r by applying a Toeplitz matrix.
def privacy_amplification(s, n, r, mode): col = np.array(np.random.choice(2, r)).astype(np.uint8) # First column of the normal Toeplitz matrix row = np.array(np.random.choice(2, n)).astype(np.uint8) # First row of the normal Toeplitz matrix if mode == 0: # Toeplitz to circulant matrix with fast Fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(input_bytes, expanded_key, n_r):\n\n # Add ZeroLength padding if necessary\n pad = 16 - (len(input_bytes) % 16)\n input_bytes.extend([0] * pad)\n input_bytes[-1] = pad\n\n # Encrypt each block of input plaintext\n output_bytes = []\n for i in range(0, len(input_bytes), 16):\n ...
[ "0.6258901", "0.60757315", "0.5972422", "0.5852941", "0.5815506", "0.5773393", "0.57597727", "0.5512592", "0.54211104", "0.5400716", "0.5400716", "0.5400716", "0.53929317", "0.52486134", "0.5210715", "0.5209968", "0.520833", "0.5205103", "0.52044094", "0.5204119", "0.51949733...
0.5353178
13
Over the promoted binary strings, the parties compute hashes of length t bits. Bob discloses his hash to Alice, who compares it with hers. If the hashes are identical, the promoted binary strings are appended to the respective privacy amplification sequences.
def universal_hashing(x, y, t): Q = 32 # Bit length of the input integers Q_star = Q + t - 1 # Universe within which a, b and x reside n_apo = len(x) // Q # In case n_apo is not an integer, the strings are padded with zeros so that n_apo becomes an integer if len(x) % Q != 0: s =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(plainString):\n result = plainString\n for i in range(0,12):\n result = hashHelp(result)\n return result", "def soft_hash(p):\n return tuple(map(r_soft_hash, p))", "def hamming_dist(bytes1, bytes2):\n if type(bytes1) == str:\n bytes1 = [ord(c) for c in str1]\n ...
[ "0.63132495", "0.62663287", "0.61413586", "0.6085211", "0.607741", "0.6076511", "0.6065881", "0.6062843", "0.6061022", "0.6042466", "0.5988908", "0.59755546", "0.59542084", "0.5930543", "0.5915192", "0.58927184", "0.58881557", "0.5867044", "0.581291", "0.5809976", "0.58012825...
0.5932892
13
find_categories should return a list of categories
def test_find_categories(self): testdoc = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ItemListDocument xmlns="http://xml.vidispine.com/schema/vidispine"> <hits>1691985</hits> <facet> <field>gnm_asset_category</field> <count fieldValue="Rushes">1165113</count> <cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_categories(self):\n pass", "def test_get_categories(self, mocker):\n mock = mocker.patch(\"requests_html.HTMLSession\")\n mock.return_value.get.return_value.html.find.return_value = iter(\n [\n mocker.Mock(text=\"Ammo\", attrs={\"href\": \"catalogue?cat...
[ "0.70744044", "0.7039473", "0.7035772", "0.6929018", "0.68586075", "0.6794448", "0.6700164", "0.6694461", "0.664981", "0.6573715", "0.65274477", "0.64942217", "0.6484619", "0.642137", "0.64205706", "0.64100933", "0.638793", "0.63869643", "0.6381255", "0.63460815", "0.63432914...
0.0
-1
Process the current data. MUST BE OVERRIDDEN BY THE USER By default, this returns ``NotImplementedError``.
def handle(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _async_process_data(self):\n raise NotImplementedError", "def process(self):\n raise NotImplementedError", "def process(self):\n raise NotImplementedError('Method must be implemented by subclass.')", "def process(self, data, channel = None):\n\t\traise NotImplementException()", "de...
[ "0.7634887", "0.74022204", "0.7244592", "0.7204964", "0.6772651", "0.6757765", "0.6676194", "0.6645171", "0.66196644", "0.6470466", "0.6468187", "0.6463113", "0.6461822", "0.64220357", "0.63872004", "0.63293827", "0.6324447", "0.63098866", "0.630326", "0.6292367", "0.62867355...
0.6348844
15
Run the validation for the current data. MUST BE OVERRIDDEN BY THE USER By default, this returns ``NotImplementedError``.
def validate(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n raise NotImplementedError(\"validate function needs to be implemented for validators\")", "def validate(self):\n raise NotImplementedError('validate method not implemented.')", "def validate(self):\n raise NotImplementedError()", "def Validate(self):\n raise NotI...
[ "0.76561004", "0.7616243", "0.75926286", "0.73546165", "0.7302044", "0.7253421", "0.7202504", "0.7191916", "0.712734", "0.712734", "0.712734", "0.712734", "0.712734", "0.712734", "0.712734", "0.712734", "0.7049217", "0.69627583", "0.6961386", "0.69554317", "0.6953269", "0.6...
0.7663959
1
Add message error for a field.
def add_error(self, field, message): add_list_value(self.errors, field, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_message(self, error_field=None, **kwargs):\n\n if error_field:\n return \"Validation failed in Validator \\\"{}\\\" on field \\\"{}\\\"\".format(self.__class__.__name__, error_field)\n return \"Validation failed in Validator \\\"{}\\\"\".format(self.__class__.__name__)", "def e...
[ "0.7599287", "0.7313962", "0.71314716", "0.7058884", "0.6715801", "0.6687381", "0.6651646", "0.66483325", "0.6566156", "0.6498605", "0.6266045", "0.626373", "0.62412614", "0.6224567", "0.6207376", "0.6121861", "0.6121136", "0.6024853", "0.5969752", "0.5968636", "0.5929933", ...
0.82044226
0
Process CallEvent current data.
def handle(self): # parse the data map_dict_fields(self.data, const.API_FIELDS, const.DB_FIELDS) self.validate() if self.errors: raise InvalidDataException(self.errors) # save data self.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callevent_handler(data):\n return CallEventHandler(data)", "def process_event(self, event):\r\n pass", "def process_event(self, event):\n if not self.frozen:\n if event[\"event\"] in [self.event, self.devent]:\n if self.what is None or event[\"target\"].startswith...
[ "0.66926533", "0.64303017", "0.6046719", "0.5988167", "0.59835887", "0.59176195", "0.5900073", "0.5865489", "0.5778673", "0.5776462", "0.57161283", "0.5702438", "0.5701657", "0.56626755", "0.5656092", "0.5645034", "0.5601509", "0.5601481", "0.55944395", "0.55784994", "0.55774...
0.0
-1
Validate fields for current data.
def validate(self): form = CallEventForm(self.data) if not form.is_valid(): self.errors = form.errors map_dict_fields(self.errors, const.DB_FIELDS, const.API_FIELDS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validation(self, data=empty):\n\n if data is not empty:\n unknown = set(data) - set(self.fields)\n if unknown:\n errors = ['Unknown field: {}'.format(f) for f in unknown]\n raise ValidationError({api_settings.NON_FIELD_ERRORS_KEY: errors})\n ...
[ "0.7889252", "0.7759904", "0.7674115", "0.76731163", "0.7659703", "0.73907673", "0.73892146", "0.73417574", "0.725726", "0.7234909", "0.7218641", "0.71649754", "0.71597", "0.7101678", "0.70301306", "0.69928086", "0.6915084", "0.6911766", "0.69010913", "0.68979913", "0.6870323...
0.6685648
39
Save current data for CallEvent. This function calls an async job to save the current data.
def save(self): # send data to be saved by another job save_callevent.delay(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persistData(self):\n\n call_data = self.data\n\n call, created = Call.objects.update_or_create(\n call_id=call_data.get('call_id'),\n defaults=call_data\n )\n\n if not created:\n call.refresh_from_db()\n self.persisted_data = call\n ret...
[ "0.6577137", "0.59424883", "0.59046453", "0.5822146", "0.57159835", "0.5595816", "0.554675", "0.5530205", "0.5493683", "0.5481861", "0.5462773", "0.54595935", "0.54430693", "0.54261476", "0.5422521", "0.5421429", "0.54210997", "0.5407424", "0.5397306", "0.5378384", "0.5337597...
0.7813169
0
Process Bill current data.
def handle(self): self.validate() if self.errors: raise InvalidDataException(self.errors) phone_number = self.data.get('phone_number') month = self.data.get('month') year = self.data.get('year') # if a period was not informed, get the current last one ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bill_handler(data):\n return BillHandler(data)", "def process_deal(self, data):\n for i in data:\n if i.status == OrderStatus.PARTIALLY_FILLED or i.status == OrderStatus.FILLED:\n symbol, exchange = convert_symbol_tiger2vt(str(i.contract))\n self.tradeid += ...
[ "0.64300424", "0.5972971", "0.5840716", "0.57267725", "0.5645599", "0.5611629", "0.5566578", "0.5532405", "0.5518817", "0.550737", "0.54749537", "0.54644704", "0.5458061", "0.54263884", "0.54090387", "0.54090387", "0.54090387", "0.53795475", "0.53674847", "0.53633726", "0.536...
0.66551983
0
Validate fields for current data.
def validate(self): # validate phone number phone_number = self.data.get('phone_number', '') if not phone_number: self.add_error('phone_number', const.MESSAGE_FIELD_REQUIRED) elif not str(phone_number).isdigit(): self.add_error('phone_number', const.MESSAGE_FIELD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validation(self, data=empty):\n\n if data is not empty:\n unknown = set(data) - set(self.fields)\n if unknown:\n errors = ['Unknown field: {}'.format(f) for f in unknown]\n raise ValidationError({api_settings.NON_FIELD_ERRORS_KEY: errors})\n ...
[ "0.7889252", "0.7759904", "0.7674115", "0.76731163", "0.7659703", "0.73907673", "0.73892146", "0.73417574", "0.725726", "0.7234909", "0.7218641", "0.71649754", "0.71597", "0.7101678", "0.70301306", "0.69928086", "0.6915084", "0.6911766", "0.69010913", "0.68979913", "0.6870323...
0.6682169
41
Convenient function to return CallEvent handler instance.
def callevent_handler(data): return CallEventHandler(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_event(self, hclass, event, *args, **kwargs):\n signal = self.signals.get_signal((hclass, event))\n event = Event(signal.name, self)\n ret = signal.call(event, *args, **kwargs) # FIXME should be coroutine\n return (event, ret)", "def create_event() -> abc.Event:\n return g...
[ "0.61877227", "0.56290776", "0.5514893", "0.5472287", "0.5423003", "0.53900313", "0.53869385", "0.53429985", "0.5308292", "0.5287016", "0.5287016", "0.5192604", "0.51753825", "0.5169624", "0.5154342", "0.5150147", "0.5145951", "0.5132487", "0.5116136", "0.50812685", "0.504729...
0.7149864
0
Convenient function to return Bill handler instance.
def bill_handler(data): return BillHandler(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_handler(cls):\n if cls.__instance is None:\n cls.__instance = AliceBlueApi()\n return cls.__instance", "def get_bh_obj(self, dbName):\n bh_xml = self.get_batchHistorical_XML(dbName)\n return self.get_batchHistorical_obj(bh_xml)", "def get_handler(self):\n r...
[ "0.5837129", "0.5660788", "0.53860235", "0.5356632", "0.52412736", "0.51488864", "0.5145289", "0.5141486", "0.51175463", "0.50862247", "0.50208473", "0.5017006", "0.501412", "0.50135314", "0.4983343", "0.49492487", "0.49440217", "0.4903349", "0.48964068", "0.4875863", "0.4866...
0.7591026
0
Value of the node equal to total if there are no children otherwise equal othe sum of the value of children referenced by cardinal index in meta
def value(self): if self.children == tuple(): return sum(self.meta) total = 0 for meta in self.meta: if 0 < meta <= len(self.children): total += self.children[meta-1].value() return total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(self):\n return sum(self.meta) + sum(child.total() for child in self.children)", "def total_value(self):\n return self.parent.child_total_value[self.action]", "def total(tree):\n if tree is None:\n return 0\n return total(tree.left) + total(tree.right) + tree.cargo", "def...
[ "0.75193995", "0.7090225", "0.6833369", "0.67395985", "0.6575276", "0.6499926", "0.6339678", "0.630775", "0.62239635", "0.60891306", "0.60015976", "0.598772", "0.5975482", "0.5940115", "0.59390444", "0.5911306", "0.58939373", "0.5876452", "0.58716124", "0.586836", "0.58667994...
0.79557794
0
Sum of meta plus the total of all child nodes
def total(self): return sum(self.meta) + sum(child.total() for child in self.children)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n if self.children == tuple():\n return sum(self.meta)\n total = 0\n for meta in self.meta:\n if 0 < meta <= len(self.children):\n total += self.children[meta-1].value()\n return total", "def compute_node_sums(nodes):\n for ...
[ "0.74751604", "0.69016945", "0.6744781", "0.6410817", "0.629062", "0.61332744", "0.61299336", "0.6067545", "0.5979318", "0.59661347", "0.59570414", "0.59568745", "0.59314394", "0.5910669", "0.58150107", "0.5808881", "0.58080286", "0.5805435", "0.5795782", "0.57718265", "0.575...
0.8090835
0
Returns a tree and the number of items read from records
def build(cls, records): children = [] i = 2 for _ in range(records[0]): j, child = cls.build(records[i:]) i += j children.append(child) return (i + records[1]), cls(tuple(records[i:i+records[1]]), tuple(children))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part1(records):\n _, root = Node.build(records)\n return root.total()", "def gbRecordSizer(recordLines):\n from Bio import SeqIO\n record = SeqIO.read(recordLines,'genbank')\n return len(record)", "def get_tree_size(cur):\n sql = \"\"\"\n SELECT\n COUNT(*)\n FROM\n ...
[ "0.66247857", "0.5619292", "0.55071753", "0.55022055", "0.5421426", "0.54014426", "0.5342836", "0.53116477", "0.5294181", "0.527001", "0.52267885", "0.5213094", "0.5200736", "0.5200254", "0.5183346", "0.5159723", "0.51134664", "0.511233", "0.50889426", "0.5079547", "0.5078990...
0.5670042
1
Solution to part 1
def part1(records): _, root = Node.build(records) return root.total()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def solve(self):", "def exercise_b2_113():\r\n pass", "def exercise_b2_53():\r\n pass", "def exercise_b2_106():\r\n pass", "def exercise_b2_52():\r\n pass", "def exercise_b2_82():\r\n pass", "def exercise_b2_69():\r\n pass", "def exercise_b2_107():\r\n pass"...
[ "0.6860136", "0.6415511", "0.6202804", "0.6106216", "0.6052542", "0.6050159", "0.5955089", "0.5949797", "0.59256583", "0.5925007", "0.5909748", "0.5794604", "0.577965", "0.5774798", "0.5770544", "0.575337", "0.57521874", "0.57492805", "0.5743798", "0.57215977", "0.57066065", ...
0.0
-1
Solution to part 2
def part2(records): _, root = Node.build(records) return root.value()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def exercise_b2_113():\r\n pass", "def solve(self):", "def exercise_b2_53():\r\n pass", "def exercise_b2_52():\r\n pass", "def exercise_b2_106():\r\n pass", "def exercise_b2_82():\r\n pass", "def exercise_b2_69():\r\n pass", "def exercise_b2_107():\r\n pass"...
[ "0.6733", "0.6378728", "0.6295594", "0.6291791", "0.62320524", "0.6220759", "0.6138619", "0.61285377", "0.60926586", "0.60514635", "0.6017924", "0.60055375", "0.5994972", "0.5983455", "0.5907087", "0.5883317", "0.58621526", "0.5810498", "0.57668465", "0.5721406", "0.56933993"...
0.0
-1
Loads, transforms, and creates torch.utils.data.Dataloaders for data for model training.
def load_data(path): # Training Images Details IMG_SIZE = 224 # Size of images used for training IMG_MEAN = [0.485, 0.456, 0.406] # image normalization mean IMG_SDEV = [0.229, 0.224, 0.225] # image normalization standard deviation # Training phases phases = ['train', 'valid', 'test'] # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataloaders():\n # train data path\n data_train = '../dataset/train/'\n # set transformations\n train_transforms = transforms.Compose([\n transforms.Resize((224, 224)),\n transforms.ToTensor(),\n transforms.Normalize([0.485, 0.456, 0.406],\n ...
[ "0.77281815", "0.7679162", "0.7420929", "0.7360315", "0.7353043", "0.72895133", "0.72467554", "0.71633875", "0.7142155", "0.7077823", "0.70729184", "0.70373833", "0.70304716", "0.69901633", "0.69705194", "0.69640154", "0.6917019", "0.6907139", "0.68998027", "0.6896355", "0.68...
0.6713237
25
Displays classified image with top predicted class as title and horizontal bar chart of predicted probabilities of predicted top classes
def display_prediction(image_path, probabilities, predictions): top_class = predictions[0] # Setup plot gird and title fig = plt.figure(figsize=(4, 5.4)) ax1 = plt.subplot2grid((2, 1), (0, 0)) ax2 = plt.subplot2grid((2, 1), (1, 0)) fig.suptitle(top_class.capitalize(), x=0.6, y=1, fontsize=16) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_prediction(top_p, top_class, image_path, cat_to_name):\n # Create a Path object that defines where the image lives. This will help categorize the image by using the parent directory ID.\n path = Path(image_path)\n\n # Get the names of each class\n names = [cat_to_name[str(c)] for c in top_c...
[ "0.7790771", "0.74688953", "0.728419", "0.7250048", "0.7156965", "0.70418864", "0.7005864", "0.68334913", "0.67379767", "0.6721212", "0.6688149", "0.6659827", "0.66352", "0.6618896", "0.6612142", "0.6602421", "0.6587695", "0.6572992", "0.6572382", "0.657004", "0.6568309", "...
0.8097561
0
convert indeces to named classesself.
def prediction_class_names(predictions, class_to_idx, category_names): class_dict = {val: key for key, val in class_to_idx.items()} class_idxs = [class_dict[pred] for pred in predictions] if not category_names: class_names = class_idxs else: with open(category_names, 'r') as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class_names_from_indices(self, indices: List) -> List[str]:\n return [self.idx2classname[idx] for idx in indices]", "def class_names(self):\n raise NotImplementedError", "def _resolve_index(self, cls):\n # If we have just a string, it's a simple index\n if isinstance(self.in...
[ "0.5682203", "0.5644654", "0.5611211", "0.55302596", "0.55037844", "0.54154146", "0.537661", "0.53480476", "0.5342873", "0.5277011", "0.5267153", "0.5265985", "0.5265694", "0.524224", "0.5241123", "0.5229729", "0.5219091", "0.5206962", "0.51718116", "0.51710224", "0.5169603",...
0.46751457
95
Scales, crops, and normalizes a PIL image for a PyTorch model, returns an Numpy array
def process_image(image_path): IMG_SIZE = 224 # Size of images used for training IMG_MEAN = [0.485, 0.456, 0.406] IMG_SDEV = [0.229, 0.224, 0.225] # Load PIL image image = Image.open(image_path) # Resize to 256 max dim if image.size[0] >= image.size[1]: image.thumbnail((256, image...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(img):\n # standard mean and std for the model\n mean = np.array([0.485, 0.456, 0.406])\n std = np.array([0.229, 0.224, 0.225])\n # resize\n img = img.resize(size = (224, 224))\n # transforms to numpy\n img = np.array(img, dtype = np.float64)\n # Mean and Std\n img = (img -...
[ "0.71821076", "0.69814414", "0.6904471", "0.69009393", "0.685111", "0.67293745", "0.67096347", "0.66926676", "0.66468805", "0.66277456", "0.64866555", "0.6469493", "0.6469493", "0.645499", "0.6364015", "0.6331581", "0.6315815", "0.62925875", "0.62887025", "0.6270465", "0.6261...
0.6288287
19
test adding and retrieving a part
def test_add_get_parts(): content_parts = ContentPartRepository(DB) test_parts = ( ContentPart("001", 1, "front", "Content 001 front matter content v1"), ContentPart("001", 1, "body", "Content 001 body content v1"), ContentPart("002", 1, "front", "Content 002 front matter content v1"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_part(self):\n pass", "def test_create_part(self):\n pass", "def test_get_parts(self):\n pass", "def test_part1_example1(example1):\n assert aoc.part1(example1) == 2 + 2 + 654 + 33583", "def test_delete_part():\n content_parts = ContentPartRepository(DB)\n test_par...
[ "0.7892113", "0.75526345", "0.6896779", "0.61566734", "0.6072473", "0.59990543", "0.5930896", "0.58812284", "0.5811125", "0.58075863", "0.5804326", "0.57871413", "0.5774533", "0.575701", "0.5745839", "0.573843", "0.5719643", "0.5713363", "0.56933546", "0.56900316", "0.5682222...
0.74941045
2
test deletion of a part
def test_delete_part(): content_parts = ContentPartRepository(DB) test_part = ContentPart("001", 1, "front", "Content 001 front matter content v1") content_parts.add_or_update_content_part(test_part) part = content_parts.get_content_part( test_part.content_id, test_part.version, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleting_a_segment(self):\n pass", "def test_delete_run(self):\n pass", "def test_delete_unknown_part():\n content_parts = ContentPartRepository(DB)\n test_part = ContentPart(\"998\", 1, \"front\", \"Content 001 front matter content v1\")\n\n content_parts.delete_content_part(\n...
[ "0.7695575", "0.74451977", "0.7388344", "0.73298687", "0.723345", "0.721669", "0.71612936", "0.7058679", "0.7038795", "0.699258", "0.69905293", "0.6938634", "0.689907", "0.6876178", "0.6847478", "0.67984086", "0.679399", "0.6785987", "0.676931", "0.6755514", "0.6753548", "0...
0.7932837
0
test deletion of an unknown part
def test_delete_unknown_part(): content_parts = ContentPartRepository(DB) test_part = ContentPart("998", 1, "front", "Content 001 front matter content v1") content_parts.delete_content_part( test_part.content_id, test_part.version, test_part.part_name ) # should succeed with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deleting_a_segment(self):\n pass", "def test_delete_part():\n content_parts = ContentPartRepository(DB)\n test_part = ContentPart(\"001\", 1, \"front\", \"Content 001 front matter content v1\")\n content_parts.add_or_update_content_part(test_part)\n part = content_parts.get_content_pa...
[ "0.75592434", "0.7469026", "0.7082972", "0.70620626", "0.69433826", "0.6927957", "0.6918441", "0.66657805", "0.66232866", "0.65941745", "0.65907836", "0.65786546", "0.6574386", "0.6556716", "0.65324837", "0.6516587", "0.65045065", "0.64942455", "0.64762455", "0.6460559", "0.6...
0.7612974
0
Test if check_estimator passes.
def test_check_estimator(estimator): check_estimator(estimator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_estimator_passed(estimator_class):\n estimator_instance = estimator_class.create_test_instance()\n\n result_class = check_estimator(estimator_class, verbose=False)\n assert all(x == \"PASSED\" for x in result_class.values())\n\n result_instance = check_estimator(estimator_instance, verbo...
[ "0.80959433", "0.788", "0.716171", "0.7135777", "0.69051164", "0.68552", "0.6739199", "0.67147166", "0.66096014", "0.6544982", "0.65300125", "0.65168136", "0.6454732", "0.64471126", "0.63448036", "0.63052756", "0.6285852", "0.6276287", "0.6228733", "0.6198588", "0.6192282", ...
0.9097493
0
Change discrete observation from list(int) to list(one_hot) format.
def _maybe_one_hot(self, obs): if self.toOneHot: obs = np.reshape(obs, (1, -1)) ints = obs.dot(self.multiplication_factor) x = np.zeros([obs.shape[0], self.one_hot_len]) for i, j in enumerate(ints): x[i, j] = 1 return x else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_one_hot(a):\n a = a[:, 0]\n a = a.astype(int)\n A = np.zeros((len(a), config.num_classes))\n A[np.arange(len(a)), a] = 1\n return A", "def one_hot_encode(x):\n # TODO: Implement Function\n x_l = list(x)\n for index in np.arange(len(x_l)):\n x_l[index] = get_one_hot_v...
[ "0.7416499", "0.73966396", "0.73918724", "0.72971946", "0.7207314", "0.72037125", "0.7139652", "0.71099603", "0.7033327", "0.7021459", "0.70200396", "0.7019017", "0.7016751", "0.7008288", "0.70073783", "0.69921046", "0.6990432", "0.69456226", "0.6942551", "0.6907128", "0.6907...
0.7035223
8
Returns the corresponding chunk of rows in html to plug into the sent/feedback table.
def get_page(request): if request.method == "GET": type = request.GET.get("type") page = int(request.GET.get("page")) - 1 if type == "sent": # we will be rendering the message chunk template template = "manage/message_chunk.djhtml" # retriev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_view_page(self):\n for row in self.driver.find_elements_by_css_selector(\"table\"):\n cells = row.find_elements_by_tag_name(\"td\")\n for cell in cells:\n yield cell.text", "def _get_markup(self):\n return make_soup(self.driver.find_element_by_id(\"con...
[ "0.60858893", "0.6076753", "0.58057654", "0.5803907", "0.57270235", "0.5589391", "0.55872047", "0.5523099", "0.55127245", "0.55062383", "0.5490729", "0.5480366", "0.5471003", "0.5465028", "0.5459512", "0.54529256", "0.5449086", "0.5394213", "0.53920627", "0.5363005", "0.53630...
0.0
-1
Render the messages template.
def index(request): messages = SESSION.get_messages_sent_list(request.session) feedbacks = SESSION.get_messages_received_list(request.session) # initially display the first 20 messages/feedback chronologically messages.sort(key=lambda r: r.createdAt, reverse=True) feedbacks.sort(key=lambda ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(self):\n if callable(self.template_name):\n template_name = self.template_name()\n else:\n template_name = self.template_name\n return loader.render_to_string(template_name,\n self.get_context())", "def display_message(s...
[ "0.7035445", "0.66552466", "0.66547364", "0.6609877", "0.6553335", "0.64389837", "0.64056784", "0.64051974", "0.6389229", "0.6343613", "0.63003796", "0.62833905", "0.6280249", "0.62575364", "0.6251609", "0.62417936", "0.6224152", "0.6167498", "0.61624205", "0.6140442", "0.613...
0.61247367
23
Inserts a token in the dev session that allows bypass of message sending limits.
def message_no_limit(request): # this is only available in development - should use our # parse.decorators.dev_only decorator instead of this if PRODUCTION_SERVER: raise Http404 # insert the token in the session and return a plaintext response # confirming the success of the operation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_token(token):\n session.token = token", "def addtoken(name, unsafe_import_token):\n stm = shared_morphene_instance()\n if mph.rpc is not None:\n mph.rpc.rpcconnect()\n if not unlock_wallet(stm):\n return\n if not unsafe_import_token:\n unsafe_import_token = click.p...
[ "0.6590985", "0.6338823", "0.5966944", "0.5879409", "0.58003116", "0.57796687", "0.577519", "0.5697267", "0.5667257", "0.5604066", "0.56003624", "0.55679744", "0.5536947", "0.5519392", "0.5478841", "0.54772025", "0.54772025", "0.5474425", "0.54730254", "0.5463118", "0.5463118...
0.0
-1
Render the message edit template for a new message and handles send message forms.
def edit(request, message_id): data = { 'messages_nav': True, 'message_id': message_id, "filters": FILTERS } store = SESSION.get_store(request.session) # number of patron stores mp = SESSION.get_patronStore_count(request.session) # make sure cache attr is None fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_message(request, concierge, template=\"concierges/fragments/message.html\"):\n if request.method == 'GET':\n d={}\n message_id = request.GET.get('message_id')\n if message_id:\n concierge_message = get_object_or_404(ConciergeMessage, id=message_id, concierge=concierge)...
[ "0.6888231", "0.6605622", "0.6384519", "0.6323812", "0.6319759", "0.6246339", "0.6222022", "0.614048", "0.6048232", "0.6047693", "0.5966948", "0.59573525", "0.595559", "0.5880641", "0.5874995", "0.58715373", "0.5858922", "0.5823802", "0.5823802", "0.5790194", "0.5785954", "...
0.63695437
3
Renders the message details template.
def details(request, message_id): # get from the messages_sent_list in session cache messages_sent_list = SESSION.get_messages_sent_list(request.session) message = None for m in messages_sent_list: if m.objectId == message_id: message = m break if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_message(self, message):\n params = {\n 'message': message\n }\n self.render_template('message.html', params)", "def display_message(self, message):\n\t\tself.render('message.html', {'message': message})", "def display_message(self, message):\n params = {\n 'mes...
[ "0.7095157", "0.68992794", "0.6822599", "0.65498877", "0.6411576", "0.636557", "0.6316783", "0.62561345", "0.6192269", "0.6101258", "0.59332615", "0.5921668", "0.5917479", "0.58156806", "0.5809721", "0.5794232", "0.5774132", "0.574701", "0.5730858", "0.5717982", "0.57084215",...
0.6380669
5
Renders the feedback template with the stores feedbacks.
def feedback(request, feedback_id): data = { 'messages_nav': True, 'feedback_id':feedback_id, "store_name":\ SESSION.get_store(request.session).get("store_name"), } # get from the messages_received_list in session cache messages_received_list = SESSION.get_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback():\n return render_template(\"feedback.html\")", "def format_feedback_with_evaluation(self, system, feedback):\r\n context = {'msg': feedback, 'id': \"1\", 'rows': 50, 'cols': 50}\r\n html = system.render_template('{0}/open_ended_evaluation.html'.format(self.TEMPLATE_DIR), context)\...
[ "0.77700275", "0.6443423", "0.63993746", "0.61923313", "0.6072761", "0.6065711", "0.60377914", "0.5947812", "0.5686895", "0.56571215", "0.556786", "0.5525154", "0.55216753", "0.551024", "0.5504222", "0.5497528", "0.54762155", "0.5469965", "0.5448755", "0.53788567", "0.5337837...
0.6219698
3
Render the feedback reply template.
def feedback_reply(request, feedback_id): account = request.session['account'] store = SESSION.get_store(request.session) # data to be passed in the templace context data = { 'messages_nav': True, 'from_address': store.get("store_name"), } # get from the messages_received_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback():\n return render_template(\"feedback.html\")", "def format_feedback_with_evaluation(self, system, feedback):\r\n context = {'msg': feedback, 'id': \"1\", 'rows': 50, 'cols': 50}\r\n html = system.render_template('{0}/open_ended_evaluation.html'.format(self.TEMPLATE_DIR), context)\...
[ "0.8071685", "0.66222847", "0.6601717", "0.65883493", "0.6256797", "0.62489635", "0.6239926", "0.62362665", "0.6133139", "0.6132438", "0.6095247", "0.60882807", "0.6037546", "0.6021293", "0.6019793", "0.6000751", "0.5951408", "0.59288824", "0.59260064", "0.59131086", "0.59098...
0.60118836
15
Handles requests to delete the feedback with the given feedback_id.
def feedback_delete(request, feedback_id): store = SESSION.get_store(request.session) # get the feedback from the messages_received_list in session cache messages_received_list = SESSION.get_messages_received_list(\ request.session) i_remove, feedback = 0, None for ind, m in enumerate(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_delete_feedback(request, id):\n\n close_old_connections()\n \n # Not marking it as served if it isn't even ready yet.\n if not request.user.is_authenticated:\n return HttpResponseForbidden(\"You're not authenticated.\")\n \n # Delete the feedback.\n Feedback.objects.get(id=id).d...
[ "0.8160355", "0.78569925", "0.78176135", "0.7574826", "0.73686093", "0.6502442", "0.62784785", "0.61090565", "0.60895765", "0.6086703", "0.6070523", "0.6036125", "0.5935712", "0.59251213", "0.5901508", "0.587811", "0.587575", "0.58570015", "0.5855246", "0.5809003", "0.5801402...
0.81376773
1
Cannot delete a sent message!
def delete(request, message_id): return HttpResponse("error")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete(self):\n return await self.set_message(text='')", "def delete_message(self, ts):\n return self(\"chat.delete\", ts=ts)", "def delete(self):\n for i, message in enumerate(self.owner.messages):\n if message == self.body:\n del self.owner.messages[i]...
[ "0.74304277", "0.7324267", "0.72790956", "0.7275756", "0.7189639", "0.71528727", "0.7102933", "0.7055106", "0.70477355", "0.6957992", "0.690495", "0.6887381", "0.6870188", "0.68561035", "0.6829536", "0.68203616", "0.67518395", "0.67293304", "0.67164654", "0.6702516", "0.66663...
0.7191316
4
For those, who are too lazy/have bad memory to lock mutex first
def log_threadsafe(level, prompt): with mutex_logger: obs.script_log(level, prompt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_am_locking(self):\r\n pass", "def lock(*args):", "def lock(self):\n self.mtx.acquire()", "def lock(self):\n raise NotImplementedError", "def lock_blocks(self) -> int:", "def unlocked():\r\n return Lock(None)", "def Locked(self) -> bool:", "def is_locked(self):\r\n ...
[ "0.7189098", "0.6998071", "0.6720906", "0.6678787", "0.6532872", "0.63862634", "0.63354945", "0.6305619", "0.62413925", "0.6203512", "0.6191948", "0.61771846", "0.6088776", "0.6058434", "0.60163575", "0.5982816", "0.5976289", "0.58853894", "0.58459604", "0.584133", "0.5825488...
0.0
-1
Creates thread, which will await new client and tell the client current (if nonzero) state on connection. "daemon = True" means "die if all other threads are dead" !! Should be called only on main thread with have_client_to_speak_with set to False first. Otherwise can result in multiple threads, each one writing state ...
def init_client_seeker(): client_seeker = threading.Thread(target=seek_for_client) client_seeker.daemon = True client_seeker.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek_for_client():\n global have_client_to_speak_with\n \n win32pipe.DisconnectNamedPipe(pipe) #in case there were connection to dead client\n log_threadsafe(obs.LOG_DEBUG, 'Waiting for a new client')\n win32pipe.ConnectNamedPipe(pipe, None) #seek for new client\n log_threadsafe(obs.LOG_DEBUG...
[ "0.6031676", "0.59984016", "0.59984016", "0.58910114", "0.58797324", "0.58580804", "0.58397484", "0.58056575", "0.5750222", "0.5733554", "0.5697208", "0.56557536", "0.56497175", "0.56365186", "0.562158", "0.56081617", "0.5605185", "0.55930245", "0.5590876", "0.5588366", "0.55...
0.623583
0
Disconnects old (dead) client and wait for a new one. On connection sends curren (if nonzero) state to the new client. Calls pipe_send_state(), reads state and modyfies have_client_to_speak_with. That's why most of operations on that variables/function must be guarded with mutex_state_sending. See comments above for de...
def seek_for_client(): global have_client_to_speak_with win32pipe.DisconnectNamedPipe(pipe) #in case there were connection to dead client log_threadsafe(obs.LOG_DEBUG, 'Waiting for a new client') win32pipe.ConnectNamedPipe(pipe, None) #seek for new client log_threadsafe(obs.LOG_DEBUG, 'A client...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipe_send_state(should_seek_new_client_on_fail=True):\n global have_client_to_speak_with\n \n if have_client_to_speak_with:\n log_threadsafe(obs.LOG_DEBUG, 'Sending %d to pipe' % state)\n try:\n win32file.WriteFile(pipe, str(state).encode('utf-8'))\n except pywintypes.e...
[ "0.6485937", "0.6325655", "0.5730386", "0.57117444", "0.56294435", "0.5588799", "0.54520696", "0.5417959", "0.5390762", "0.5348496", "0.532897", "0.5312628", "0.5282257", "0.52460295", "0.5241522", "0.52319646", "0.52246296", "0.5206628", "0.52012765", "0.51943886", "0.519205...
0.67902863
0
Changes have_client_to_speak_with, reads state (which must not be changed while the function is running) and calls init_client_seeker(). !! Is called form another thread. Before call u must lock mutex_state_sending.
def pipe_send_state(should_seek_new_client_on_fail=True): global have_client_to_speak_with if have_client_to_speak_with: log_threadsafe(obs.LOG_DEBUG, 'Sending %d to pipe' % state) try: win32file.WriteFile(pipe, str(state).encode('utf-8')) except pywintypes.error: #Assum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek_for_client():\n global have_client_to_speak_with\n \n win32pipe.DisconnectNamedPipe(pipe) #in case there were connection to dead client\n log_threadsafe(obs.LOG_DEBUG, 'Waiting for a new client')\n win32pipe.ConnectNamedPipe(pipe, None) #seek for new client\n log_threadsafe(obs.LOG_DEBUG...
[ "0.70347106", "0.6604987", "0.61231416", "0.5816052", "0.5534356", "0.5503837", "0.54970783", "0.5408261", "0.5402283", "0.5363836", "0.53447926", "0.53427213", "0.52955645", "0.52635205", "0.5250508", "0.5248067", "0.52243906", "0.52208585", "0.5217627", "0.51942456", "0.516...
0.62453586
2
Updates state and sends it
def trigger_recording_started(_): log_threadsafe(obs.LOG_DEBUG, 'Recording started') global state with mutex_state_sending: state = int(time.time()) pipe_send_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.write_state(bytes([]))", "def send_state(self):\n self.state = self.enigma.get_state()\n messages = self.notify_slaves()\n for message in messages:\n self.network.messages_to_slaves.append(message)", "def send_state(self, key=None):\n state...
[ "0.7710814", "0.7683065", "0.7633148", "0.7631688", "0.7533116", "0.74796695", "0.7380803", "0.7181045", "0.7141217", "0.7089488", "0.70795596", "0.7029052", "0.70156026", "0.69915026", "0.6983326", "0.68827826", "0.6818449", "0.681782", "0.68168974", "0.68005514", "0.6773816...
0.0
-1
Updates state and sends it if changed
def trigger_recording_stopped(_): log_threadsafe(obs.LOG_DEBUG, 'Recording stopped') global state if state != 0: #for the case if script was loaded when obs had been already recording smth with mutex_state_sending: state = 0 pipe_send_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self._state = 23", "def update(self):\n self._state = self._state", "def _update_state(self) -> None:\n raise NotImplementedError(\"\")", "def update_to_state(self, game_state):\n pass", "def send_state(self, key=None):\n state = self.get_state(key=key...
[ "0.7627398", "0.75969285", "0.7536473", "0.7426226", "0.74173343", "0.73965555", "0.73766005", "0.7318327", "0.7260345", "0.7254058", "0.71716243", "0.7170184", "0.715956", "0.71410614", "0.70669395", "0.70611566", "0.7059857", "0.70065117", "0.700196", "0.69691515", "0.68990...
0.0
-1
Sets up triggers on obs events (such as start recording and stop recording) Creates pipe. Pipe is immutable handle, which never changes after initialization Calls init_client_seeker() to find a client
def script_load(settings): log_threadsafe(obs.LOG_DEBUG, 'Plugin loaded') recording_signal_handler = obs.obs_output_get_signal_handler(obs.obs_frontend_get_recording_output()) obs.signal_handler_connect(recording_signal_handler, "start", trigger_recording_started) obs.signal_handler_connect(recordi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pipe(self):\n if self._evdev:\n return None\n\n if not self.__pipe:\n target_function = self._get_target_function()\n if not target_function:\n return None\n\n self.__pipe, child_conn = Pipe(duplex=False)\n self._listener = Pr...
[ "0.5552144", "0.53435254", "0.52983624", "0.5288273", "0.51492506", "0.51354164", "0.5033195", "0.50323343", "0.4952999", "0.49294472", "0.49061546", "0.48975146", "0.48605904", "0.48601755", "0.48336682", "0.48016807", "0.47991025", "0.4794015", "0.47684467", "0.47600764", "...
0.5208223
4
If state is nonzero, sends termination signal to client, since we can't do it latter Closes handle of pipe, which is good manner, even if windows can fix it itself No need to kill seekerthread, even it's exist, because it's daemon, and will die following us
def script_unload(): log_threadsafe(obs.LOG_DEBUG, 'Plugin unloaded') global state if state != 0: with mutex_state_sending: state = 0 pipe_send_state(should_seek_new_client_on_fail=False) win32file.CloseHandle(pipe)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler_sighup(signum, frame):\n global done, pipe\n\n try:\n pipe.flush()\n pipe.close()\n except:\n pass\n pipe = None\n done = True", "def signal_handler(signal, frame):\n\n print('Aborted. Will shut down all httperf processes')\n for client in Httperf.all_clients:\n...
[ "0.6405409", "0.6141598", "0.58835435", "0.5868371", "0.5854071", "0.58146906", "0.57779884", "0.5692469", "0.5635228", "0.5627712", "0.5624471", "0.55906993", "0.55561763", "0.5552946", "0.5502911", "0.5473116", "0.5465859", "0.54627633", "0.546184", "0.5454293", "0.5439344"...
0.0
-1
Ensures that checker works with module names.
def test_module_names(filename, error, default_options): Checker.parse_options(default_options) checker = Checker(tree=ast.parse(''), file_tokens=[], filename=filename) _line, _col, error_text, _type = next(checker.run()) assert int(error_text[3:6]) == error.code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_module(name):\n return importlib.util.find_spec(name) is not None", "def test_check_module(self) -> None:\n check_module(\"os\")", "def test_normal_module_name(assert_errors, filename, default_options):\n visitor = WrongModuleNameVisitor(default_options, filename=filename)\n visitor.r...
[ "0.6912898", "0.6729183", "0.64819825", "0.6213858", "0.6135468", "0.6125287", "0.6087428", "0.6074897", "0.6055561", "0.6008322", "0.5943098", "0.5931158", "0.59298307", "0.592889", "0.58813554", "0.5871252", "0.5861828", "0.5789622", "0.57785904", "0.5772654", "0.5709748", ...
0.6579433
2
The type of resource extracted by the particular resource. This should be a single word only meaning something like "info", "executable", ... This resource type is used for better log messages.
def resource_type(cls): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7799778", "0.7799778", "0.77337795", "0.77337795", "0.77337795", "0.77337795", "0.77337795", "0.7435112", "0.73980755", "0.7264488", "0.7127422", "0.7035029", "0.6932327", "0.6839248", "0.677211", "0.66678107", "0.66678107", "0.66678107", "0.66678107", "0.66678107", "0.666...
0.77825916
2
The number of results a plugin aims to place on the filesystem.
def result_count(cls) -> ResultCount: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_results(self):\n pass", "def fileCount(self):\n pass", "def getFileCount(self) -> int:\n ...", "def _get_count(results):\n return len(results)", "def fileCounter(directory):", "def count():", "def GetNumberOfResultsProcessed(self) -> int:\n return self.i", "d...
[ "0.73602754", "0.7134048", "0.7066376", "0.68129724", "0.6745999", "0.66068745", "0.66040087", "0.64821917", "0.63636446", "0.63636446", "0.63636446", "0.63636446", "0.6329005", "0.6314411", "0.6274031", "0.6268524", "0.62136436", "0.6210633", "0.61933887", "0.6191781", "0.61...
0.61865956
20
Log any errors that occur. Errors are conditions that are unusual and are not occurring often. One example for this would be that an application has no executable.
def log_error(self, msg): self.logger.error(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error():\n logging.error(\"ERROR\")\n print('ERROR')", "def log_error(err):\n print(err)", "def log_error(e):\n\tprint(e)", "def log_error(e):\n\tprint(e)", "def logError(e):\r\n print(e)", "def log_error(e):\r\n print(e)", "def log_error(e):\r\n print(e)", "def on_errors(se...
[ "0.7046593", "0.69921356", "0.6905214", "0.6905214", "0.68912655", "0.68705267", "0.68705267", "0.68142605", "0.6719086", "0.669861", "0.669861", "0.669861", "0.669861", "0.669861", "0.669861", "0.669861", "0.669861", "0.669861", "0.66833425", "0.66607875", "0.6599609", "0....
0.6488181
25
Log info messages to be able to mentally understand what happened during program execution
def log_info(self, msg): self.logger.info(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(msg):\n log('INFO', msg)", "def _stdlog(self, msg):\n print msg\n logger.info(msg)", "def log(self, message):", "def log(msg):\n print msg", "def log(self, msg):\n print(msg)", "def log_info(info_dict):\n pass", "def info(self, msg):\r\n self.logger.info(ms...
[ "0.7264416", "0.72114503", "0.71225137", "0.7085697", "0.7074822", "0.70589614", "0.7052712", "0.70438987", "0.70417255", "0.6995632", "0.69834477", "0.69674873", "0.6950858", "0.6940487", "0.6914248", "0.690979", "0.6880222", "0.68519104", "0.6844136", "0.68307483", "0.68298...
0.69204116
14
Extract data / files from the application `app`. A extractor should put these files at `result_path` and log any errors to `logger`. The return code should be `True` on success, `False` otherwise.
def extract_data(self, app : Bundle, result_path : str) -> bool: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_application_file(self, application):\n # 1. Get the path of the app_config directory\n app_conf_dir = self.sys_conf['configs']['env'][self.env]['app_config_url']\n\n # 2. Get the path for the given application configuration file\n app_conf_dir += '/{file}.yaml'.format(file...
[ "0.51713", "0.51351815", "0.5070502", "0.5006909", "0.49494296", "0.48960212", "0.48624113", "0.48357296", "0.4821892", "0.47723943", "0.4735612", "0.47250524", "0.4720484", "0.4704852", "0.46886972", "0.46639046", "0.46378937", "0.46374047", "0.4626576", "0.4626012", "0.4625...
0.7481783
0
Returns a list of all extractor classes
def all_extractors(): import os.path import importlib import inspect extractors = [] # Rudimentary parsing of the directory to find all python files plugin_dir = os.path.dirname(__file__) # Assuming the plugins are all stored in the extractors/ dir where also # the base class is store...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_extractor_classes():\n from .extractors import _ALL_CLASSES\n\n return _ALL_CLASSES", "def gen_extractors():\n return [klass() for klass in gen_extractor_classes()]", "def get_classes(self):\n query = read_query('structure exploration/classes')\n response = self._submit_query(que...
[ "0.8139812", "0.7888099", "0.7181725", "0.7095149", "0.70722044", "0.6925459", "0.69171095", "0.68636954", "0.6830808", "0.6830808", "0.6830808", "0.6830808", "0.6830808", "0.6830808", "0.6829222", "0.6816609", "0.67426676", "0.67400193", "0.6680297", "0.656685", "0.6564237",...
0.7946651
1
Create a CHIRP security token.
def _create_security_token(user): timestamp = int(time.time()) plaintext = "%x %s" % (timestamp, user.email) nearest_mult_of_16 = 16 * ((len(plaintext) + 15) // 16) # Pad plaintest with whitespace to make the length a multiple of 16, # as this is a requirement of AES encryption. plaintext = plai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_token(self, token_id, data):\n raise exception.NotImplemented() # pragma: no cover", "def create_token():\n def token_helper():\n token = util.prompt_for_user_token(username=\"robbo1992\", scope='user-library-read playlist-modify-private playlist-modify',\n ...
[ "0.6548358", "0.6520948", "0.64401877", "0.6379608", "0.6306839", "0.6266338", "0.6234284", "0.6166603", "0.6100921", "0.6073261", "0.6028012", "0.6022119", "0.60128707", "0.6011934", "0.6005523", "0.5988126", "0.5968929", "0.59353334", "0.5913032", "0.5910365", "0.5910365", ...
0.60828435
9
Parse a CHIRP security token.
def _parse_security_token(token): if not token: return None if ':' not in token: logging.warn('Malformed token: no signature separator') return None sig, body = token.split(':', 1) if _DISABLE_CRYPTO: plaintext = body else: key_storage = KeyStorage.get() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_token(self, response=None):\n token_url = 'https://tinychat.com/start?#signin'\n if response is None:\n response = util.web.http_get(url=token_url, referer=token_url, proxy=self._proxy)\n\n if response is not None and response['content'] is not None:\n soup = B...
[ "0.6144686", "0.60707945", "0.6040866", "0.5988779", "0.57434446", "0.57302487", "0.55320007", "0.54820126", "0.5480701", "0.5480701", "0.5480701", "0.5467807", "0.5436225", "0.5368838", "0.53524274", "0.534094", "0.5266281", "0.52243197", "0.5222019", "0.51838434", "0.517491...
0.67126787
0