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
Creates a list of random minibatches from (X, Y)
def random_mini_batches(X, mini_batch_size = 64, seed = 0): X = X.T m = X.shape[1] # number of training examples mini_batches = [] np.random.seed(seed) # Step 1: Shuffle (X, Y) permutation = list(np.random.permutation(m)) shuffled_X = X[:, permutation] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_mini_batches(X, Y, mini_batch_size = 64):\n\n\n\tm = X.shape[1]\n\tmini_batches = []\n\n\t#Shuffling around the data randomly according to the 'permutation' list\n\tpermutation = list(np.random.permutation(m))\n\tshuffled_X = X[:, permutation]\n\tshuffled_Y = Y[:, permutation].reshape((1,m))\n\n\tcomple...
[ "0.6538483", "0.6306659", "0.6229192", "0.62188995", "0.62120205", "0.6201539", "0.6146375", "0.61380875", "0.60996467", "0.60977423", "0.60959804", "0.60713136", "0.60708785", "0.6014206", "0.59900105", "0.5939547", "0.5883283", "0.5870768", "0.58435774", "0.58415437", "0.58...
0.5779349
21
Helper function to export card fulfillments to a text file. NB Will only work with Samen Doen cards due to Profile class arrangements. Hooks available to move this out of CC3 core to Samen Doen
def process_card_fulfillment_list(card_fulfillment_list): processed_card_fulfillments = [] for fulfillment in card_fulfillment_list: try: user_profile = fulfillment.profile.user.get_profile() except ObjectDoesNotExist: # Can do better when this fn is moved out of CC3 cor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_fr_cards(bc_file, bc_class):\n fr = bc_class.friction_controls\n if not fr.empty:\n bc_file.write('! Friction Controls\\n')\n bc_file.write(fr.to_csv(sep=' ', na_rep='', index=False, header=False,).replace('\\r\\n', '\\n'))\n bc_file.write('\\n') # blank line after Friction Co...
[ "0.5858813", "0.5749492", "0.5727883", "0.56262463", "0.5562148", "0.55313855", "0.54979175", "0.5494233", "0.54761094", "0.5467645", "0.5434945", "0.54304004", "0.5409987", "0.54044443", "0.5396171", "0.5390876", "0.5382627", "0.53750294", "0.5354081", "0.534875", "0.5336105...
0.5015489
61
GET returns 200 with a specific term instructor schedule course schedule data in json format
def get(self, request, *args, **kwargs): timer = Timer() section_id = kwargs.get('section_id') try: return self.make_http_resp(timer, request, section_id) except Exception as ex: return handle_exception(logger, timer, traceback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_schedule(self):\n response = self.client.open('/v1/schedule/{id}'.format(id=56),\n method='GET',\n content_type='application/json')\n self.assert200(response, \"Response body is : \" + response.data.decode('utf-8'))", ...
[ "0.63574547", "0.61109036", "0.6101973", "0.60870665", "0.59486985", "0.58191013", "0.5787258", "0.5783781", "0.57551056", "0.57121354", "0.5707875", "0.57006395", "0.56668895", "0.56541514", "0.56425047", "0.56286216", "0.5623365", "0.55335736", "0.55180854", "0.55138856", "...
0.0
-1
instructor schedule data in json format
def make_http_resp(self, timer, request, section_id): self.processed_primary = False try: section_id = self.validate_section_id(request, section_id) except NotSectionInstructorException: return not_instructor_error() schedule = get_instructor_section(request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_schedules():\n return json.dumps(calendar.get_schedules())", "def schedule_json(self) -> Optional[Dict]:\n if not self.schedule:\n return None\n else:\n start_time = conv_to_schedule(\n self.start_time if self.start_time else datetime.now()\n ...
[ "0.67919123", "0.64717513", "0.63028455", "0.6294236", "0.62216735", "0.61730635", "0.5869249", "0.58010226", "0.56957936", "0.56477994", "0.5646666", "0.56341016", "0.56084347", "0.557858", "0.55746126", "0.5516498", "0.5488573", "0.54806674", "0.5478912", "0.5469763", "0.54...
0.0
-1
Add common arguments to argument parser.
def _add_common_to_parser(parser): parser.add_argument( "--filename-pattern-image", action="store", type=str, default="{name:s}-{start_time:%Y%m%d_%H%M}.tiff", help="Filename pattern for output image files.") parser.add_argument( "--filename-pattern-video", actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add_common_args(parser: argparse.ArgumentParser):\n parser.add_argument(\"--model\", help=\"name of the model to use. Use query --get-models to get a list of valid names.\")\n parser.add_argument(\"--grid-type\", help=\"type of the grid to use.\")\n parser.add_argument(\"--level-type\", help=\"type ...
[ "0.7948395", "0.75996715", "0.75399613", "0.7516411", "0.74951726", "0.7462638", "0.7419608", "0.739864", "0.739864", "0.7369051", "0.7357307", "0.73173416", "0.72960037", "0.7179414", "0.71674997", "0.7102145", "0.7091434", "0.708741", "0.7082599", "0.70595914", "0.7022085",...
0.7148122
15
Get the argument parser for passing files.
def get_parser_files(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "outdir", action="store", type=pathlib.Path, help="Directory where to write resulting images.") parser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n p = argparse.ArgumentParser(description='such a good program')\n p.add_argument('infile')\n p.add_argument('outfile')\n return p", "def get_parser():\n parser = argparse.ArgumentParser()\n # parser = argparse.ArgumentParser(description=__doc__, formatter_class=argpar...
[ "0.79019636", "0.7870106", "0.7787764", "0.75685984", "0.74728954", "0.72674626", "0.71568024", "0.7144376", "0.71342105", "0.71342105", "0.7131248", "0.7063849", "0.7038956", "0.7009244", "0.6967036", "0.6923422", "0.6912022", "0.69116515", "0.6897074", "0.68824583", "0.6878...
0.6530431
70
Get the argument parser for passing times.
def get_parser_times(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "start_time", action="store", type=pandas.Timestamp) parser.add_argument( "end_time", action="store", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--date\", \"-d\", help=\"Date of this lab session\")\n parser.add_argument(\"--time-in\", \"-ti\", help=\"Time string representing the time lab began\")\n parser.add_argument(\"--time-out\", \"-to\", help=\"Time string repre...
[ "0.6568716", "0.59897435", "0.59649503", "0.5915204", "0.5913862", "0.5864289", "0.5827687", "0.5750248", "0.57498866", "0.57411927", "0.57269704", "0.56963646", "0.56855893", "0.5682023", "0.5682023", "0.56393063", "0.56157017", "0.56120384", "0.5598651", "0.55702114", "0.55...
0.74796635
0
Parse the command line.
def parse_cmdline(get_parser=get_parser_files): return get_parser().parse_args()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def parse(self, command_line=sys.argv[1:]):\n return self._parser.parse_args(command_line...
[ "0.798914", "0.77689564", "0.74818027", "0.74296236", "0.7251311", "0.723808", "0.7231153", "0.7195712", "0.7111324", "0.7103113", "0.7076255", "0.70687413", "0.7030809", "0.70304805", "0.7001228", "0.69465584", "0.6926082", "0.6920621", "0.69191545", "0.68995804", "0.6887038...
0.6510488
79
Parse commandline and call visualisation routines.
def video_files(): p = parse_cmdline(get_parser=get_parser_files) log.setup_main_handler( mods=("fogtools", "typhon", "fogpy", "sattools", "fcitools", "satpy", "pyresample"), level=logging.INFO) vis.show_video_abi_glm( files=p.files, img_out=p.filename_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(command=None):\r\n if command is None:\r\n my_command = CommandLine() # read options from the command line\r\n else:\r\n my_command = CommandLine(command) # interpret the list passed from the caller of main\r\n\r\n input_file = my_command.args.input_file\r\n style_sheet = my_co...
[ "0.7309777", "0.7190999", "0.6903792", "0.68515545", "0.6790966", "0.67772627", "0.6772432", "0.6749553", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", ...
0.0
-1
Parse commandline and call visualisation routines.
def video_times(): p = parse_cmdline(get_parser=get_parser_times) log.setup_main_handler( mods=("fogtools", "typhon", "fogpy", "sattools", "fcitools", "satpy", "pyresample"), level=logging.DEBUG) vis.show_video_abi_glm_times( start_date=p.start_time, end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(command=None):\r\n if command is None:\r\n my_command = CommandLine() # read options from the command line\r\n else:\r\n my_command = CommandLine(command) # interpret the list passed from the caller of main\r\n\r\n input_file = my_command.args.input_file\r\n style_sheet = my_co...
[ "0.7309777", "0.7190999", "0.6903792", "0.68515545", "0.6790966", "0.67772627", "0.6772432", "0.6749553", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", "0.6726485", ...
0.0
-1
Checks if Python version is supported by Cuckoo.
def check_python_version(): version = sys.version.split()[0] if version < "2.6" or version >= "3": raise CuckooStartupError("You are running an incompatible version of Python, please use 2.6 or 2.7")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_compatible():\n result = False\n req_ver = vers.convert('3.9.5')\n pythonver = vers.convert('{major}.{minor}.{micro}'.format(major=sys.version_info.major,\n minor=sys.version_info.minor,\n ...
[ "0.7637709", "0.7555077", "0.72389746", "0.7111935", "0.70349747", "0.7027567", "0.70126307", "0.70126307", "0.70126307", "0.70080096", "0.6967738", "0.68840957", "0.6819389", "0.6783709", "0.676768", "0.6756775", "0.6746007", "0.67407185", "0.6651795", "0.66268104", "0.65999...
0.795639
0
Checks if working directories are ready.
def check_working_directory(): if not os.path.exists(CUCKOO_ROOT): raise CuckooStartupError("You specified a non-existing root directory: %s" % CUCKOO_ROOT) cwd = os.path.join(os.getcwd(), "cuckoo.py") if not os.path.exists(cwd): raise CuckooStartupError("You are not running Cuckoo from it'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_all_systems_ready(self):\n self._check_all_sensors_ready()\n return True", "def _check_all_systems_ready(self):\n self._check_all_sensors_ready()\n return True", "def _check_all_systems_ready(self):\n raise NotImplementedError()", "def is_ready() -> bool:\n ...
[ "0.6585585", "0.6585585", "0.6461984", "0.64543515", "0.64328486", "0.63897145", "0.6369198", "0.63275504", "0.62811655", "0.6223177", "0.62050366", "0.6193372", "0.61837643", "0.61824787", "0.6179181", "0.61762285", "0.6173104", "0.61561316", "0.6148442", "0.61197335", "0.60...
0.6141566
19
Checks if dependencies are installed.
def check_dependencies(): check_python_version() dependencies = ["sqlite3"] for dependency in dependencies: try: __import__(dependency) except ImportError as e: raise CuckooStartupError("Unable to import \"%s\"" % dependency) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dependencies(self):\n imgmin = exists('imgmin')\n image_optim = exists('image_optim')\n\n if not imgmin or not image_optim:\n puts(p('Dependencies have not been installed:'))\n\n message = 'imgmin - https://github.com/rflynn/imgmin'\n message = s('✓ ...
[ "0.793422", "0.7930604", "0.7912953", "0.78336424", "0.76999456", "0.76947135", "0.7686539", "0.7666271", "0.76288325", "0.7572292", "0.75151587", "0.7492932", "0.74447614", "0.74242735", "0.73918897", "0.736468", "0.7360159", "0.7314458", "0.72915107", "0.7267136", "0.725657...
0.82182187
0
Checks if config files exist.
def check_configs(): configs = [os.path.join(CUCKOO_ROOT, "conf", "cuckoo.conf"), os.path.join(CUCKOO_ROOT, "conf", "reporting.conf")] for config in configs: if not os.path.exists(config): raise CuckooStartupError("Config file does not exist at path: %s" % config) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_configfiles():\n return (all(os.path.isdir(x) for x in CONFIG_DIRS) and\n os.path.isfile(CONFIG_FILE) and os.path.isfile(LOG_CONFIG_FILE))", "def __check_config(self):\n if not os.path.exists(self.__config_path):\n return False\n else:\n return True", ...
[ "0.8346882", "0.78028643", "0.77522177", "0.77137613", "0.7490861", "0.72511786", "0.7087832", "0.7071221", "0.70583725", "0.7033269", "0.7024421", "0.69919306", "0.69578743", "0.6946059", "0.6932018", "0.68946105", "0.6867093", "0.6830978", "0.6827687", "0.6827188", "0.67988...
0.8165395
1
Randomly transform image data. Given an input image list (possibly multimodal) and an optional corresponding segmentation image list, this function will perform data augmentation with
def data_augmentation(input_image_list, segmentation_image_list=None, number_of_simulations=10, reference_image=None, transform_type='affineAndDeformation', noise_model='additivegaussian', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_augmentation(image, aug):\n if (aug == \"random_crop\") and (random.randint(0,1)):\n image = random_crop(image) \n if (aug == \"random_rotation\") and (random.randint(0,1)): \n image = random_rotation(image) \n if (aug == \"random_flip\") and (random.randint(0,1)): \n image =...
[ "0.6911291", "0.6776172", "0.6606806", "0.6512269", "0.64750767", "0.64673746", "0.6444081", "0.62625486", "0.6222153", "0.62075675", "0.61686075", "0.6148961", "0.6134152", "0.61139226", "0.6082042", "0.6072987", "0.605287", "0.6020677", "0.6015514", "0.6012553", "0.6000056"...
0.7687681
0
Returns an ``Iterable`` containing all the instances in the specified dataset. If ``self.lazy`` is False, this calls ``self._read()``, ensures that the result is a list, then returns the resulting list. If ``self.lazy`` is True, this returns an object whose ``__iter__`` method calls ``self._read()`` each iteration. In ...
def read(self, *args, **kwargs) -> Iterable[Instance]: lazy = getattr(self, 'lazy', None) if lazy is None: logger.warning("DatasetReader.lazy is not set, " "did you forget to call the superclass constructor?") if lazy: return _LazyInstances(lam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self._datasets)", "def __iter__(self) -> Iterator:\n return iter(self.get_data_loader())", "def __iter__(self) -> Union[Iterator[int], Iterator[Tuple[int, Any]]]:\n self.size = self._data._dataset_size\n if (not self._data._fully_cached or\n ...
[ "0.7040597", "0.6643148", "0.6294192", "0.62414855", "0.61743397", "0.61443645", "0.60582954", "0.6047906", "0.59985113", "0.5981316", "0.5973242", "0.59701633", "0.5944178", "0.5882069", "0.58764064", "0.58696884", "0.5857583", "0.5841389", "0.58389926", "0.5835787", "0.5801...
0.8134299
0
Helper method for changing password.
def change_password(self): self.test_user.set_password(self.create_user_data()['password1']) self.test_user.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpassword(self, pwd):\n pass", "def change_password(change_account):\n change_data(change_account, changed_data='password')", "def change_password(self, new_password):\n dev = self.nearest_pandevice()\n self.password_hash = dev.request_password_hash(new_password)\n self.upd...
[ "0.83203053", "0.8311983", "0.80322033", "0.7970062", "0.78713304", "0.7853417", "0.7846718", "0.7818966", "0.7744164", "0.76641804", "0.7636149", "0.7597402", "0.7588872", "0.7561001", "0.7524474", "0.74891347", "0.7479619", "0.74788195", "0.7476977", "0.7459346", "0.7455279...
0.7484463
16
Test the login page elements like button, username field and password field is loded properly or not.
def test_login_page_elements(self): response = self.client.get(reverse('users:login')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'users/login.html') self.assertContains(response, ' <input type="text" name="username"') self.assertContains(respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login(self):\n url_extend = 'user_auth/login/'\n self.browser.get(self.url + url_extend)\n\n # enter the username and password.\n username_field = self.browser.find_element_by_name('user_name')\n username_field.send_keys('user4')\n password_field = self.browser.fi...
[ "0.81608397", "0.7807469", "0.7750099", "0.7648665", "0.7499904", "0.74693316", "0.7445929", "0.7401844", "0.7391671", "0.73524094", "0.73394597", "0.7300667", "0.72945255", "0.7244298", "0.7213896", "0.7185873", "0.7171691", "0.7159399", "0.7155342", "0.7133687", "0.7129667"...
0.8222996
0
Check login page is redirected to home page or not .
def test_post_login_page(self): response = self.client.post( reverse('users:login'), {'username': self.user['username'], 'password': self.user['password1']}, follow=True ) self.assertRedirects(response, reverse('users:home'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home_page_redirect_when_loggin_attempt_successful(self):\n\t\tpass", "def view_login(self):\n with self.client.get(\"/login\", catch_response=True) as response:\n for r_hist in response.history:\n if r_hist.status_code > 200 and r_hist.status_code < 400:\n ...
[ "0.78158134", "0.7318312", "0.7259517", "0.7234029", "0.71897537", "0.7179481", "0.70696545", "0.7032853", "0.7031419", "0.6956722", "0.694599", "0.6892971", "0.68414986", "0.68354315", "0.68219674", "0.6789293", "0.6781092", "0.6761577", "0.67566794", "0.67533886", "0.675035...
0.61683476
95
Check for invalid username and invalid password should not be able to login
def test_invalid_username_invalid_password(self): response = self.client.post( reverse('users:login'), { 'username': self.create_user_data()['username'], 'password': self.create_user_data()['password1'] } ) self.assertEqual(response.status_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def test_login_wrong_credentials(self):\n\t\tdata = {'username' : 'nonexistentuser', 'password' : 'nopasswordlol'}\n\t\tresponse = self.login(data)\n\n\t\terror_text = \"Unable to log in with p...
[ "0.7901798", "0.77217233", "0.77012146", "0.76538616", "0.7576865", "0.7574334", "0.755077", "0.7488525", "0.74578387", "0.744723", "0.74460363", "0.74412745", "0.74403954", "0.7430433", "0.7425823", "0.7395681", "0.7395213", "0.7375655", "0.7326853", "0.7312103", "0.7311579"...
0.7513344
7
Check for valid username and invalid password should not be able to login
def test_valid_username_invalid_password(self): response = self.client.post(reverse('users:login'), {'username': self.user['username'], 'password': '1sfsdf'}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', None, ERROR_MSG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_authentication(self, username, password):\n return self.user_table[username]['pwd'] == password", "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def check_auth(username, password, expected_user, expected_pw):\n ...
[ "0.7802883", "0.778277", "0.7756373", "0.7752627", "0.7586923", "0.75375336", "0.7489758", "0.7483796", "0.74812096", "0.7474361", "0.74624926", "0.7450919", "0.74466735", "0.7442546", "0.74277145", "0.7423208", "0.74196374", "0.74130267", "0.7404624", "0.7398643", "0.7396676...
0.7786559
1
Check for invalid username and valid password should not be able to login
def test_invalid_username_valid_password(self): response = self.client.post(reverse('users:login'), {'username': 'xyzabe', 'password': self.user['password1']}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', None, ERROR_MSG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth_user_fail_bad_username(self):\n\n self.assertFalse(User.authenticate(\"invalid\", \"allison\"))", "def test_valid_username_invalid_password(self):\n response = self.client.post(reverse('users:login'), {'username': self.user['username'], 'password': '1sfsdf'})\n self.assertEqual...
[ "0.7951096", "0.7841457", "0.7711811", "0.76967174", "0.7688351", "0.7644936", "0.76221037", "0.760486", "0.7591186", "0.75574297", "0.7532108", "0.75310373", "0.7526137", "0.7497212", "0.74888337", "0.74736017", "0.7467855", "0.74638116", "0.7450047", "0.7411747", "0.7391035...
0.7611962
7
Check for blank username and blank password should not be able to login
def test_blank_username_blank_password(self): response = self.client.post(reverse('users:login'), {'username': '', 'password': ''}) self.assertEqual(response.status_code, 200) self.assertFormError(response, 'form', 'username', 'This field is required.') self.assertFormError(response, 'fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_empty_username(self):\n self.client.post('api/v2/auth/signup', json=self.user,\n headers={'Content-Type': 'application/json'})\n\n res_other = self.client.post('/api/v2/auth/login', json={\n 'username': None, 'password': 'mikemike...
[ "0.7467626", "0.7417053", "0.73873866", "0.73845154", "0.7267287", "0.7184474", "0.7178433", "0.7175828", "0.7163327", "0.71527857", "0.71351755", "0.71197534", "0.70886356", "0.7087536", "0.70774215", "0.7072684", "0.7067899", "0.70463395", "0.7042235", "0.7033119", "0.70229...
0.76699674
0
Check for After changing password users should be able to login
def test_login_after_password_change(self): old_password = self.user['password1'] self.change_password() response = self.client.post( reverse('users:login'), {'username': self.user['username'], 'password': old_password} ) self.assertEqual(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_correct_user(self, login, password):\n pass", "def test_no_forced_password_change(self):\r\n\r\n email, password = self._setup_user()\r\n self._login(email, password)\r\n\r\n email, password = self._setup_user(is_staff=True)\r\n self._login(email, password)", "def test...
[ "0.74237895", "0.73377043", "0.72924936", "0.72834015", "0.71276367", "0.7053073", "0.70174813", "0.70155585", "0.69883895", "0.69872814", "0.69835067", "0.6974151", "0.6954494", "0.69419676", "0.6923948", "0.6913977", "0.69104934", "0.68806005", "0.68394154", "0.6821562", "0...
0.7121998
5
Check for users should not be able to login from old password
def test_old_password_login_check(self): old_password = self.user['password1'] self.change_password() response = self.client.post(reverse('users:login'), {'username': self.user['username'], 'password': old_password}) self.assertEqual(response.status_code, 200) self.assertFormErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_forced_password_change(self):\r\n\r\n email, password = self._setup_user()\r\n self._login(email, password)\r\n\r\n email, password = self._setup_user(is_staff=True)\r\n self._login(email, password)", "def test_disabled_too_frequent_password_resets(self):\r\n studen...
[ "0.71566904", "0.7139833", "0.70374", "0.69580734", "0.69088155", "0.6857486", "0.6838342", "0.67982876", "0.6719867", "0.67038935", "0.6684486", "0.66533893", "0.66437966", "0.66162145", "0.6593299", "0.6592775", "0.65780205", "0.6563781", "0.6559912", "0.65482986", "0.65358...
0.68825674
5
Return True if dropping an egg results in it's destruction, otherwise return False. Once destroyed an egg cannot be reused!
def drop(self, fromFloor): self.__drop_count += 1 if self.__smashed: # You cannot drop an egg which has already been smashed! raise AttemptedToDropADesroyedEgg() if fromFloor > self.__strength: self.__smashed = True log.info("I dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nonforce_drop(self) -> bool:\n if self.closed:\n return True\n if self.zero_failures():\n return False\n return random.random() < self.failurerate", "def remove(self, egg):", "def is_destroyed(self) -> bool:\n return self._coords == self.damaged_cells", ...
[ "0.6458748", "0.6121517", "0.59280527", "0.58651847", "0.584907", "0.57872874", "0.57657474", "0.5701933", "0.56951636", "0.5681737", "0.56644017", "0.56603515", "0.5633385", "0.55955076", "0.5491876", "0.54897475", "0.5488751", "0.5484713", "0.54588217", "0.54502827", "0.538...
0.60147166
2
Retrieves all info needed for worker and puts it into a dictionary
def get_task_worker(self): start, end = self.get_block() return { 'task_id':self.id, 'finished':self.finished, 'free_block':(start != end), 'keyword':self.keyword, 'chars':self.chars, 'algorithm':self.algorithm, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_worker_metadata(self) -> Dict[str, Any]:\n response = await self._client.get(\"collections/views/aggregate-worker-metadata\")\n response.raise_for_status()\n return response.json()", "def get_information(self):\n info_dict = dict()\n info_dict['run'] = self._runN...
[ "0.678594", "0.6314804", "0.61548144", "0.60795724", "0.6061691", "0.60179424", "0.60070586", "0.6003615", "0.6000852", "0.5975921", "0.5956673", "0.59529394", "0.5952804", "0.59031546", "0.5901462", "0.58881104", "0.58605975", "0.58536565", "0.58536565", "0.5828623", "0.5828...
0.6506152
1
Retrives the next block to be worked on and updates current_point
def get_block(self): current_value = self.get_value(self.current_point) endpoint_value = self.get_value(self.end_point) worker_start = self.current_point if (endpoint_value - current_value) > self.searchwidth: worker_end = self.get_word_from_value(current_value + self.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_position(self):", "def updateBlock(self):\n self.blkno = self.blknoSpinBox.value() - 1\n self.initDataParms()\n self.updateCurveList()\n self.compute()", "def next_line():\r\n set_point(point().next_line())", "def InsertNextPoint(self, ):\n ...", "def comput...
[ "0.6269478", "0.61071306", "0.6065598", "0.605103", "0.60347897", "0.60193807", "0.6014046", "0.5979615", "0.59784544", "0.59410185", "0.59170794", "0.58443856", "0.5820316", "0.5779748", "0.5770897", "0.5764013", "0.5760746", "0.57168615", "0.57011765", "0.56897867", "0.5672...
0.5988784
7
Beregner verdien fra base xtall til base 10tall
def get_value(self, str): base = len(self.chars) base_placement = len(str) - 1 value = 0 for symbol in str: valueChar = self.chars.find(symbol) value += valueChar * (base ** base_placement) base_placement -= 1 return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertebasenbase10(baseorig, numero):\n base10 = 0\n for i in range(len(numero)-1, -1, -1):\n base10 += DIGITOS.index(numero[i]) * baseorig**(len(numero)-i-1)\n\n return base10", "def convertebase10basen(basedest, numero):\n ret = \"\"\n while True:\n digit = numero%basedest\n ...
[ "0.69762754", "0.660738", "0.6280264", "0.61839783", "0.6165925", "0.60826427", "0.6078281", "0.6041513", "0.5987892", "0.5951344", "0.5911084", "0.5903381", "0.5859326", "0.58539116", "0.5836696", "0.58148897", "0.57990456", "0.578782", "0.5783043", "0.57668954", "0.57554835...
0.0
-1
Beregner basex ordet gitt base10 verdien, og returnerer denne Variabler value = base10 verdien av kodeordet str = verdiene kodeordet skal beregnes fra self.chars = alle tegnene som brukes (f.eks. "abcdefghij")
def get_word_from_value(self, value): base = len(self.chars) str = "" while value != 0: remainder = value % base value = int((value - remainder) / base) str = self.chars[remainder] + str return str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char2bf(char):\n\n result_code = \"\"\n ascii_value = ord(char)\n #print(ascii_value)\n factor = int(ascii_value / 10)\n #print(factor)\n remaining = int(ascii_value % 10)\n #print(remaining)\n\n result_code += \"%s\\n\" % (\"+\" * 10)\n result_code += \"[\\n\"\n result_code += \"...
[ "0.6319352", "0.59468013", "0.5832483", "0.57488376", "0.5731045", "0.56868696", "0.5657961", "0.56209755", "0.56140286", "0.5613853", "0.5583171", "0.55587304", "0.55219233", "0.54779905", "0.5461078", "0.54544", "0.54473144", "0.5445014", "0.5431559", "0.5415982", "0.540977...
0.4973494
90
Handles standard GETrequests and get_jobrequests
def do_GET(self): path = self.path status_code, res = webServer.handle_get_msg(path) self.send_response(status_code) self.end_headers() self.wfile.write(res.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET(self):\n self._try_to_process_request(self._handle_get_request)", "def on_get(self, req, resp):\n try:\n n_reqs = int(req.params.get('n', self.default_reqs))\n except ValueError:\n error_response(resp, 'ERROR: Incorrect number of requests')\n retur...
[ "0.708641", "0.68929356", "0.6749446", "0.67281705", "0.6490519", "0.6429551", "0.63998663", "0.6372085", "0.63160455", "0.62698215", "0.62575865", "0.6090804", "0.6070183", "0.60638535", "0.6025948", "0.59976333", "0.59892786", "0.597048", "0.59660536", "0.59596616", "0.5955...
0.53607714
98
Handles all POSTrequests, message is decoded in handle_post_msg()
def do_POST(self): content_length = int(self.headers['Content-Length']) body = self.rfile.read(content_length) response = BytesIO() try: res = webServer.handle_post_msg(body) print(res) self.send_response(200) except Exception as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_POST(self): # pylint: disable=invalid-name\n self.handle_request()", "def do_POST(self):\n self._try_to_process_request(self._handle_post_request)", "def handle_post_msg(body):\r\n request = json.loads(body)\r\n type = request['type']\r\n subtype = request['su...
[ "0.6977046", "0.6908505", "0.6876362", "0.66455024", "0.66303426", "0.65271676", "0.65047675", "0.6497064", "0.63782585", "0.63608754", "0.63462037", "0.63272667", "0.6258365", "0.6229079", "0.6213434", "0.6196621", "0.616209", "0.6155476", "0.60837656", "0.60646325", "0.6053...
0.6169068
16
Takes in a request, converts to dictionary and handles request according to type specified in request Required type subtype
def handle_post_msg(body): request = json.loads(body) type = request['type'] subtype = request['subtype'] if type == 'get': if subtype == 'job': job = {'job':get_next_job()} return webServer.add_json_successfull_status(job) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_request_dict(request: Union[str, bytes, HttpRequest, dict]) -> Dict[str, str]:\n if isinstance(request, (str, bytes)):\n try:\n return json.loads(request)\n except Exception:\n print('Must be given a valid JSON')\n raise\n if not isinstance(request, dict...
[ "0.66045016", "0.6057629", "0.6054783", "0.6026459", "0.60111326", "0.5992731", "0.59388953", "0.59353733", "0.59153354", "0.59043115", "0.5894454", "0.58504784", "0.58270943", "0.57932085", "0.5791295", "0.57862103", "0.5760113", "0.5708097", "0.56899875", "0.5688118", "0.56...
0.0
-1
Gets the Updated job template right now changes from active to inactive.
def get_updated_jobtemplate(self): return self.response_json
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Updated(self):\n return self._get_attr('Updated')", "def getChanges():", "def last_status_update(self):\n try:\n return StatusUpdate.objects.filter(section=self).latest(\"created_at\")\n except StatusUpdate.DoesNotExist:\n return None", "def changes(self) -> dic...
[ "0.5720681", "0.5635518", "0.5623788", "0.5566456", "0.55534095", "0.5552222", "0.5476115", "0.5407608", "0.5343847", "0.5331713", "0.53309363", "0.5325143", "0.5319297", "0.5319297", "0.5319297", "0.5319297", "0.5312014", "0.5278158", "0.52175415", "0.52158743", "0.52158743"...
0.73913294
0
First message to the user.
def openingMessage(): print("=" * 55) print("\nNote: ") print("Input of an RSA Encrypted message is required.") print("Public parameters of the system are n=31313 and e=4913\n") print("=" * 55)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_first_message(self):\n self.nonce = str(uuid4()).replace(\"-\", \"\")\n client_first_bare = \"n={},r={}\".format(self.user, self.nonce)\n self.auth_message = client_first_bare\n return \"n,,\" + client_first_bare", "def _send_msg(self, contact):\n msg_content = input...
[ "0.67874026", "0.6723854", "0.66218483", "0.65833837", "0.65342826", "0.6512653", "0.6380038", "0.6366027", "0.6304767", "0.6303987", "0.6287261", "0.62694854", "0.6222925", "0.61418635", "0.61328685", "0.6127601", "0.6061265", "0.6028994", "0.6011218", "0.5975677", "0.597244...
0.0
-1
The largest positive integer that divides each of the params.
def gcd(x:int, y:int) -> int: if x == 0: return y return gcd(y % x, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_div(self):\n if self._max_div is not None:\n return self._max_div\n n = self.degree\n if n == 1:\n return 1\n for x in sieve:\n if n % x == 0:\n d = n//x\n self._max_div = d\n return d", "def find_la...
[ "0.72691697", "0.68096185", "0.66286135", "0.66143864", "0.65909207", "0.64670926", "0.644061", "0.63005096", "0.6291326", "0.6288224", "0.6266296", "0.62133557", "0.6212883", "0.6203084", "0.6184084", "0.61810917", "0.61790323", "0.61790323", "0.617845", "0.6175247", "0.6130...
0.0
-1
Euler's Totient Function, returns number of totatives of n
def phi(n: int) -> int: result = 1 for i in range(2, n): if gcd(i, n) == 1: result += 1 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eulerTotient(n): #\n result = 1\n for i in range(2, n): \n if (nt.gcd(i, n) == 1): \n result+=1\n return result", "def eulers_totient(n):\n return int(n * product(1 - 1 / p for p in prime_factors(n)))", "def eulerphi(n):\r\n\treturn euler_phi(n)", "def euler_phi(n):\n\n ...
[ "0.8072356", "0.8067203", "0.74935395", "0.74776405", "0.74699026", "0.73793525", "0.7322867", "0.7098295", "0.7066441", "0.70519406", "0.6925338", "0.64791536", "0.64176416", "0.6406807", "0.63801664", "0.6270723", "0.6220426", "0.6215612", "0.62123954", "0.6190173", "0.6165...
0.6527361
11
Translates the plaintext back into ordinary English text
def decryptMessage(): exponents = [2, 1, 0] encryptedMessage = input("Please enter the RSA encrypted message: \n") messageSplit = encryptedMessage.split(" ") print("") for c in messageSplit: d = modInverse(PUBLIC_KEY["e"], phi(PUBLIC_KEY["n"])) p = (int(c) ** d) % PUBLIC_KEY["n"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translateText(text):\r\n\treturn translator.translate(text, src='en', dest='ro')", "def translate():\n pass", "def translate_text(target, text):\n return text", "def ta2en(text):\n return IITB_translator(\"ta\", \"en\", text)", "def translate_leet(phrase):", "def retranslate(self):\r\n ...
[ "0.79665506", "0.728794", "0.72659403", "0.7104326", "0.7055434", "0.70127326", "0.70127326", "0.693319", "0.6868713", "0.67893815", "0.67630345", "0.670048", "0.664606", "0.6633309", "0.66160625", "0.6613145", "0.6588977", "0.6535806", "0.6502176", "0.65011525", "0.6491229",...
0.0
-1
Compares a plain string to a hashed password
def verify_password(plain_password: str, hashed_password: str) -> bool: return pwd_context.verify(plain_password, hashed_password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(raw_password, enc_password):\n algo, salt, hsh = enc_password.split('$')\n return constant_time_compare(hsh, get_hexdigest(algo, salt, raw_password))", "def check_password(raw_password, enc_password):\n algo, salt, hsh = enc_password.split('$')\n return hsh == get_hexdigest(algo, s...
[ "0.7576271", "0.74892336", "0.74892336", "0.74081683", "0.7389026", "0.7322922", "0.7288965", "0.7263801", "0.72267926", "0.71997774", "0.71876806", "0.71660066", "0.7122997", "0.707954", "0.7066134", "0.7062869", "0.70221514", "0.6994417", "0.69662356", "0.6947845", "0.69309...
0.71074784
13
Takes in a raw password and hashes it. Used prior to saving a new password to the database.
def get_password_hash(password: str) -> str: return pwd_context.hash(password)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(self):\n self.__password = self.str_to_hash(self.__password)", "def hash_password(self, original_password):\n self.password = generate_password_hash(original_password)", "def hash_password(self, password):\n self.password_hash = generate_password_hash(password)", "def s...
[ "0.7692625", "0.76232475", "0.7447069", "0.7431796", "0.7431796", "0.73878235", "0.7385752", "0.7378277", "0.7317121", "0.7237397", "0.7199203", "0.71626663", "0.7114192", "0.7088237", "0.70874846", "0.7057534", "0.70349723", "0.7000121", "0.6976634", "0.69596976", "0.6918479...
0.68872106
22
Tokenizes a given text and determines the postags. Lowercases the text.
def pos_tag(text, simple=False): tokens = nltk.word_tokenize(text.lower()) pos = nltk.pos_tag(tokens) # simplify tags if requested if simple: simple_pos = [] for word, tag in pos: new_tag = nltk.tag.mapping.map_tag('en-ptb', 'universal',tag) # simplificati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(text):\n return text.lower()", "def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized", "def process_text(text, tokenize=tokenize1, filter=filter1, stem=None, lower=True):\n as...
[ "0.73638403", "0.71996164", "0.70776325", "0.70369464", "0.70350385", "0.699438", "0.6974615", "0.69460094", "0.6889723", "0.6881596", "0.6870311", "0.68678427", "0.68667", "0.682271", "0.6777725", "0.6755323", "0.67493415", "0.6743987", "0.6711147", "0.67024463", "0.66992223...
0.0
-1
Stops the current video.
def stop_video(self): global value if value>0: value=0 print(f"Stopping video: {name}") else: print("Cannot stop video: No video is currently playing")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_video(self):\n\n if self.current_video is None:\n print(\"Cannot stop video: No video is currently playing\")\n else:\n print(\"Stopping video:\", self.current_video.title)\n self.current_video = None", "def stop_video(self):\n if self._current_video...
[ "0.88741636", "0.8774506", "0.8441174", "0.8365092", "0.8315334", "0.75267285", "0.7508737", "0.7479121", "0.7374416", "0.73499715", "0.73044616", "0.7266504", "0.7158296", "0.71389854", "0.7137596", "0.70946974", "0.706027", "0.6946775", "0.6921336", "0.6860272", "0.68469775...
0.7786517
5
Plays a random video from the video library.
def play_random_video(self): print("play_random_video needs implementation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_random_video(self):\n num_videos = len(self._video_library.get_all_videos())\n videos = self._video_library.get_all_videos()\n random_index = randint(0, num_videos-1)\n self.play_video(videos[random_index].video_id)\n # print(\"play_random_video needs implementation\")",...
[ "0.8968212", "0.88889474", "0.8764582", "0.86797124", "0.74386805", "0.6433095", "0.6404907", "0.63862103", "0.6253938", "0.6234064", "0.610353", "0.61004305", "0.6057416", "0.6026028", "0.59989953", "0.5998689", "0.5952484", "0.5926255", "0.5915889", "0.5892517", "0.5839559"...
0.85630876
4
Pauses the current video.
def pause_video(self): global value if value==1: value=2 print(f"Pausing video: {name}") elif value==0: print(f"Cannot pause video: No video is currently playing") else: print(f"Video already paused: {name}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause_video(self):\n if self._paused:\n print(f\"Video already paused: {self._current_video.title}\")\n return\n elif self._current_video is None:\n print(\"Cannot pause video: No video is currently playing\")\n return\n print(f\"Pausing video: {self._cu...
[ "0.8277917", "0.81578803", "0.81201726", "0.8063698", "0.7832002", "0.7822245", "0.7746284", "0.77101934", "0.7540578", "0.7526118", "0.7477645", "0.74383736", "0.7433377", "0.74296737", "0.7347314", "0.73419297", "0.7341595", "0.7311873", "0.72468805", "0.7224297", "0.722429...
0.7657883
8
Resumes playing the current video.
def continue_video(self): global value if value==2: global name value=1 print(f"Continuing video: {name}") elif value==1: print(f"Cannot continue video: Video is not paused")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def continue_video(self):\n if self._current_video is None:\n print(\"Cannot continue video: No video is currently playing\")\n return\n elif not self._paused:\n print(\"Cannot continue video: Video is not paused\")\n return\n print(f\"Continuing video: {sel...
[ "0.78487545", "0.76695776", "0.7644487", "0.7620646", "0.76167583", "0.7603745", "0.75645643", "0.7465203", "0.74446094", "0.73118573", "0.71554846", "0.7129294", "0.7104252", "0.6880032", "0.6824016", "0.67914295", "0.67346185", "0.673355", "0.66960865", "0.6665674", "0.6665...
0.6646525
22
Creates a playlist with a given name.
def create_playlist(self, playlist_name): #self._video_playlist.name=playlist_name #self._video_playlist.caseless=playlist_name.lower() #print(f"Successfully created new playlist: {self._video_playlist.name}") if playlist_name.lower() not in self.playlists: self.playlists[pla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_playlist(self, playlist_name):\n print(\"create_playlist needs implementation\")", "def create_playlist(self, playlist_name):\n if playlist_name.lower() in self._playlists:\n print(\"Cannot create playlist: A playlist with the same name already exists\")\n return\n ...
[ "0.85660213", "0.85554105", "0.8544041", "0.84868944", "0.8483596", "0.84097624", "0.8327404", "0.8276789", "0.81442547", "0.7785124", "0.76372933", "0.7628255", "0.7530136", "0.7377695", "0.7313419", "0.7106524", "0.7087746", "0.70772105", "0.70699054", "0.7060932", "0.70289...
0.84133744
5
Adds a video to a playlist with a given name.
def add_to_playlist(self, playlist_name, video_id): vid = self._video_library.get_video(video_id) if vid and (playlist_name.lower() in self.playlists): if video_id not in self.playlists[playlist_name.lower()]: print("Added video to {0}: {1}".format(playlist_name, vid.title)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_playlist(self, playlist_name, video_id):\n video = self._video_library.get_video(video_id)\n if playlist_name.lower() not in self._playlists:\n print(f\"Cannot add video to {playlist_name}: Playlist does not exist\")\n return\n if not video:\n print(...
[ "0.8289542", "0.8254548", "0.81243855", "0.8081699", "0.78677225", "0.7106693", "0.70057124", "0.6953241", "0.6816299", "0.6771601", "0.6698732", "0.6667264", "0.6667212", "0.66409636", "0.65922916", "0.6531571", "0.65096724", "0.64778024", "0.64676934", "0.64045155", "0.6378...
0.81706756
2
Display all videos in a playlist with a given name.
def show_playlist(self, playlist_name): if self.playlists[playlist_name.lower()]!=[]: print(f"Showing playlist: {playlist_name}") for i in self.playlists[playlist_name.lower()]: videos = self._video_library.get_all_videos() templist = [] d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_playlist(self, playlist_name):\n if playlist_name.lower() not in self._playlists:\n print(f\"Cannot show playlist {playlist_name}: Playlist does not exist\")\n return\n playlist = self._playlists[playlist_name.lower()]\n print(f\"Showing playlist: {playlist_name}...
[ "0.795203", "0.7930741", "0.7693881", "0.7545777", "0.74915266", "0.68660384", "0.6755695", "0.6657861", "0.6496447", "0.62669796", "0.6146096", "0.6144877", "0.6072285", "0.6068287", "0.6064832", "0.60442716", "0.6008929", "0.59817594", "0.5926295", "0.59068966", "0.59018767...
0.7973328
0
Removes a video to a playlist with a given name.
def remove_from_playlist(self, playlist_name, video_id): if playlist_name.lower() in self.playlists: for i in self.playlists[playlist_name.lower()]: videos = self._video_library.get_all_videos() templist = [] def converttostr(input_seq, seperator): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_playlist(self, playlist_name, video_id):\n if playlist_name.lower() not in self.playlists:\n print(\"Cannot remove video from\", playlist_name, end=\"\")\n print(\": Playlist does not exist\")\n elif self._video_library.get_video(video_id) is None:\n p...
[ "0.8277546", "0.8267825", "0.82491636", "0.81425613", "0.7988888", "0.7960778", "0.7492291", "0.7470741", "0.743055", "0.7393017", "0.73424774", "0.73083645", "0.7294812", "0.72602385", "0.7201037", "0.7155624", "0.7128118", "0.70940757", "0.7084818", "0.7070951", "0.6355251"...
0.81126755
4
Removes all videos from a playlist with a given name.
def clear_playlist(self, playlist_name): if playlist_name.lower() in self.playlists: self.playlists[playlist_name.lower()] = [] print(f'Successfully removed all videos from {playlist_name}') else: print(f"Cannot clear playlist {playlist_name}: Playlist does not exist"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_playlist(self, playlist_name):\n playlist_id = playlist_name.lower()\n if not playlist_id in self.playlists.keys():\n print(f\"Cannot clear playlist {playlist_name}: Playlist does not exist\")\n return\n\n self.playlists.get(playlist_id).videos = []\n pri...
[ "0.82759166", "0.810445", "0.7842016", "0.77024317", "0.7658428", "0.7567538", "0.75538445", "0.7424383", "0.72478163", "0.7101949", "0.70759284", "0.70302415", "0.6900102", "0.68801945", "0.6860031", "0.6858115", "0.68081474", "0.67604417", "0.67214316", "0.66617334", "0.662...
0.7798576
3
Deletes a playlist with a given name.
def delete_playlist(self, playlist_name): if playlist_name.lower() in self.playlists: self.playlists.pop(playlist_name.lower()) print(f"Deleted playlist: {playlist_name}") else: print(f"Cannot delete playlist {playlist_name}: Playlist does not exist")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_playlist(self, playlist_name):\n playlist_id = playlist_name.lower()\n if not playlist_id in self.playlists.keys():\n print(f\"Cannot delete playlist {playlist_name}: Playlist does not exist\")\n return\n\n self.playlists.pop(playlist_id)\n print(f\"Dele...
[ "0.8899918", "0.88381743", "0.8813659", "0.8797008", "0.8750859", "0.8733403", "0.78041524", "0.7314389", "0.7266456", "0.7250033", "0.7242778", "0.72256124", "0.7210256", "0.71182895", "0.7081352", "0.70362234", "0.6962418", "0.69342923", "0.69230175", "0.69078976", "0.68709...
0.88254285
2
Display all the videos whose titles contain the search_term.
def search_videos(self, search_term): videos = self._video_library.get_all_videos() temp_list = [] for vid in videos: # Convoluted way to display tags in required format tags = "[" for tag in vid.tags: tags = tags + tag + " " tags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_videos(self, search_term):\n results = []\n for video in self._video_library.get_all_videos():\n if search_term.lower() in video.title.lower() and video.flag is None:\n results.append(video)\n self.output_search_results(results, search_term)", "def search...
[ "0.8331212", "0.79130685", "0.78181237", "0.7745555", "0.7296771", "0.71350473", "0.6829117", "0.65758127", "0.6539812", "0.65275896", "0.6482727", "0.6481391", "0.64698297", "0.640734", "0.638748", "0.6354398", "0.63542914", "0.63518894", "0.6330999", "0.6296946", "0.6252102...
0.8280379
1
Display all videos whose tags contains the provided tag.
def search_videos_tag(self, video_tag): videos = self._video_library.get_all_videos() temp_list = [] for vid in videos: # Convoluted way to display tags in required format tags ="[" for tag in vid.tags: tags = tags + tag + " " tag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_videos_tag(self, video_tag):\n results = []\n for video in self._video_library.get_all_videos():\n if video_tag.lower() in video.tags and video.flag is None:\n results.append(video)\n self.output_search_results(results, video_tag)", "def search_videos_tag...
[ "0.8045308", "0.7540733", "0.7481872", "0.73584425", "0.68464065", "0.67552704", "0.63414866", "0.61289597", "0.6046852", "0.59463876", "0.5857648", "0.58262694", "0.5813439", "0.58052194", "0.57624304", "0.57576835", "0.57258624", "0.5666013", "0.5597602", "0.5587654", "0.55...
0.77634656
1
Mark a video as flagged.
def flag_video(self, video_id, flag_reason=""): object=self._video_library.get_video(video_id) print(f"{object}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flag_video(self, video_id, flag_reason=\"Not supplied\"):\n video = self._video_library.get_video(video_id)\n if not video:\n print(\"Cannot flag video: Video does not exist\")\n return\n if video.flag is not None:\n print(\"Cannot flag video: Video is alre...
[ "0.7585753", "0.7543017", "0.7286989", "0.7286989", "0.6934897", "0.68738246", "0.67508376", "0.65071416", "0.59914064", "0.5956641", "0.583062", "0.5781579", "0.5766682", "0.57447886", "0.57447886", "0.57447886", "0.57447886", "0.56196725", "0.5476563", "0.54668385", "0.5389...
0.6579819
7
Removes a flag from a video.
def allow_video(self, video_id): print("allow_video needs implementation")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_video(self, video_id):\n video = self._video_library.get_video(video_id)\n if not self._video_library.get_video(video_id):\n print(\"Cannot remove flag from video: Video does not exist\")\n return\n if not video.flag:\n print(\"Cannot remove flag from...
[ "0.71073616", "0.6957776", "0.6648356", "0.65067405", "0.6319069", "0.6319069", "0.6288646", "0.6212749", "0.61405927", "0.6084444", "0.6061432", "0.5965828", "0.5923353", "0.58760494", "0.5868266", "0.57688993", "0.57488066", "0.5683442", "0.5658963", "0.5601935", "0.5565338...
0.0
-1
Enable or disable the router.
async def set_enabled(self, enabled: bool) -> None: return await self.api.set_enabled(enabled)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggleRouterConnected(self, flagToSet=None):\n if flagToSet is None:\n self.isRouterConnected = not (self.isRouterConnected)\n return\n self.isRouterConnected = flagToSet", "async def async_turn_on(self):\n path = \"/ip/firewall/nat\"\n param = \".id\"\n ...
[ "0.6549837", "0.6199958", "0.6047816", "0.600655", "0.58607954", "0.5822703", "0.579296", "0.57149607", "0.57149607", "0.5709502", "0.5699672", "0.56951374", "0.56603235", "0.5656877", "0.5641915", "0.563895", "0.5634997", "0.5631425", "0.56173617", "0.5610729", "0.5604729", ...
0.0
-1
Get current active operational dataset in TLVS format, or None.
async def get_active_dataset_tlvs(self) -> bytes | None: return await self.api.get_active_dataset_tlvs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_get_active_dataset_tlvs(hass: HomeAssistant) -> bytes | None:\n if DOMAIN not in hass.data:\n raise HomeAssistantError(\"OTBR API not available\")\n\n data: OTBRData = hass.data[DOMAIN]\n return await data.get_active_dataset_tlvs()", "def _get_data(self):\n c = Connector(se...
[ "0.64140606", "0.53788054", "0.5368342", "0.5340623", "0.5304488", "0.5285245", "0.5271362", "0.52568066", "0.525625", "0.52145404", "0.5213808", "0.5200595", "0.51775974", "0.51763356", "0.514455", "0.5142501", "0.5142501", "0.5139437", "0.5129725", "0.5113209", "0.50932395"...
0.65660226
0
Create an active operational dataset.
async def create_active_dataset( self, dataset: python_otbr_api.OperationalDataSet ) -> None: return await self.api.create_active_dataset(dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n\n dataset_id = \"{}.airflow\".format(client.project)\n dataset = bigquery.Dataset(dataset_id)\n dataset.location = \"US\"\n dataset = client.create_dataset(dataset, exists_ok=True)\n print(\"Created dataset {}.{}\".format(client.project, dataset.dataset_id))\n return datas...
[ "0.7311756", "0.6959166", "0.6920446", "0.67189634", "0.67153424", "0.6510759", "0.6500872", "0.64714384", "0.6467696", "0.64092255", "0.64085776", "0.6398017", "0.6389895", "0.6304472", "0.62450254", "0.623023", "0.62095875", "0.6189691", "0.6167886", "0.6153979", "0.6152047...
0.7764948
0
Set up the Open Thread Border Router component.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: websocket_api.async_setup(hass) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **params):\n\n # Initialize topo\n Topo.__init__(self, **params)\n\n # Host and link configuration\n hostConfiguration = {'cpu': cpuShare()}\n linkConfiguration = {'bw': args.bandwidth, 'delay': delay(), 'max_queue_len': args.input_queue_size }\n \n # Create the actual topol...
[ "0.62192327", "0.6034983", "0.5965902", "0.5813521", "0.57604", "0.5739103", "0.5624199", "0.5561005", "0.55013895", "0.5481573", "0.5452983", "0.5439202", "0.54322267", "0.54296595", "0.54053646", "0.5364516", "0.536268", "0.5278839", "0.52613586", "0.52425516", "0.5240492",...
0.0
-1
Warn user if insecure default network settings are used.
def _warn_on_default_network_settings( hass: HomeAssistant, entry: ConfigEntry, dataset_tlvs: bytes ) -> None: dataset = tlv_parser.parse_tlv(dataset_tlvs.hex()) insecure = False if ( network_key := dataset.get(tlv_parser.MeshcopTLVType.NETWORKKEY) ) is not None and bytes.fromhex(network_ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insecure(self) -> bool:\n return self._insecure", "def set_insecure(self, bool_value=True):\n self.insecure = bool_value\n self._geturl.insecure = bool_value", "def insecure(self, insecure: bool):\n\n self._insecure = insecure", "def no_network_access_check(user):\n return ...
[ "0.6017677", "0.6015723", "0.591362", "0.58963645", "0.5826089", "0.580664", "0.5791929", "0.5757958", "0.5702233", "0.5702233", "0.5658171", "0.5645198", "0.5638157", "0.5638157", "0.5621047", "0.5604798", "0.55833834", "0.55188936", "0.5460819", "0.5445649", "0.5445649", ...
0.79430103
0
Set up an Open Thread Border Router config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: api = python_otbr_api.OTBR(entry.data["url"], async_get_clientsession(hass), 10) otbrdata = OTBRData(entry.data["url"], api) try: dataset_tlvs = await otbrdata.get_active_dataset_tlvs() except ( HomeAssistantE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **params):\n\n # Initialize topo\n Topo.__init__(self, **params)\n\n # Host and link configuration\n hostConfiguration = {'cpu': cpuShare()}\n linkConfiguration = {'bw': args.bandwidth, 'delay': delay(), 'max_queue_len': args.input_queue_size }\n \n # Create the actual topol...
[ "0.59809196", "0.588865", "0.56609845", "0.56394005", "0.5567508", "0.5544084", "0.5540145", "0.55376536", "0.5513254", "0.5485693", "0.5481344", "0.54580015", "0.54271466", "0.5422367", "0.5421914", "0.5411975", "0.53917915", "0.53793836", "0.53344077", "0.52707", "0.5262626...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.data.pop(DOMAIN) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):\n unload_ok = await hass.config_entries.async_unloa...
[ "0.697284", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601", "0.6469397"...
0.6888074
1
Get current active operational dataset in TLVS format, or None. Returns None if there is no active operational dataset. Raises if the http status is 400 or higher or if the response is invalid.
async def async_get_active_dataset_tlvs(hass: HomeAssistant) -> bytes | None: if DOMAIN not in hass.data: raise HomeAssistantError("OTBR API not available") data: OTBRData = hass.data[DOMAIN] return await data.get_active_dataset_tlvs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_active_dataset_tlvs(self) -> bytes | None:\n return await self.api.get_active_dataset_tlvs()", "def _get_data(self):\n response = self._get_raw_data()\n if response is None:\n # error has already been logged\n return None\n\n if response.startswith(...
[ "0.6278388", "0.51822865", "0.50992644", "0.50317097", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647", "0.49691647",...
0.6420956
0
Command line option parser
def options_parse(): parser = argparse.ArgumentParser() # Options for model parameters setup (only change if model training was changed) parser.add_argument('--num_filters', type=int, default=64, help='Filter dimensions for DenseNet (all layers same). Default=64') parser.add_arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_options():\n global parser\n parser.add_option(\"-r\", \"--regions\", dest=\"input_brain_regions\",\n help=\"Input file for brain region data\",\n action=\"store\", type='string')\n\n parser.add_option(\"-g\", \"--gray\", dest=\"input_gray_levels\",\n ...
[ "0.7875108", "0.77416253", "0.7673511", "0.7616269", "0.7615143", "0.7595156", "0.75526184", "0.75350857", "0.7520856", "0.75206095", "0.748908", "0.7426462", "0.74064136", "0.73757994", "0.73684096", "0.73431", "0.7342854", "0.7271879", "0.72698784", "0.7234366", "0.72342134...
0.7297411
17
Get the basic information about the user.
def getbasics(tfinal): tfinal["screen_name"] = df["user"].apply(lambda x: x["screen_name"]) tfinal["user_id"] = df["user"].apply(lambda x: x["id"]) tfinal["followers_count"] = df["user"].apply(lambda x: x["followers_count"]) return tfinal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\n response = self.query('user_info')\n return response", "def user_info(self):\n resp = self._get(get_url('user'))\n raise_on_error(resp)\n ret = resp.json()\n return UserInfo(ret)", "def user_info(self):\n return self.auth.get_user_by_session()...
[ "0.8602612", "0.8136225", "0.79690456", "0.7805218", "0.77565444", "0.7732912", "0.77039087", "0.7688922", "0.76849806", "0.76553595", "0.7635081", "0.7590047", "0.7519128", "0.75158465", "0.7477178", "0.7463014", "0.7459062", "0.7459062", "0.7433174", "0.741587", "0.74010503...
0.0
-1
Put it all together.
def filldf(tfinal): getbasics(tfinal) # getusermentions(tfinal) getretweets(tfinal) getinreply(tfinal) return tfinal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrapup(self):\n pass", "def use(self):", "def _collect_all(self):", "def processing(self):\n pass", "def finalise(self):", "def run(self):\n\t\t\n\t\tpass", "def final(self):\n pass", "def all(self):", "def all(self):", "def merge_two_calls(self) -> None:", "def __call_...
[ "0.68635607", "0.61945486", "0.61396044", "0.61321986", "0.5985064", "0.59484243", "0.59349257", "0.5926103", "0.5926103", "0.58965355", "0.5891097", "0.5838405", "0.58246607", "0.58246607", "0.5821355", "0.5821355", "0.5821355", "0.5821355", "0.5821355", "0.5821355", "0.5821...
0.0
-1
Get the interactions between different users.
def getinteractions(row): # From every row of the original DataFrame. # First we obtain the "user_id" and "screen_name". user = row["user_id"], row["screen_name"] # Be careful if there is no user id if user[0] is None: return (None, None), [] # The interactions are going to be a set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInterestedUsers():", "def get_queryset(self):\n user = self.request.user\n return Interaction.objects.filter(owner=user)", "def interactions(self) -> Sequence[Interaction[_C_out,_A_out]]:\n return self._interactions", "def interactions(self) -> Sequence[Interaction[_C_out, Tuple[i...
[ "0.6618023", "0.6391998", "0.5856472", "0.5845436", "0.5824138", "0.5802955", "0.57908535", "0.57292044", "0.5703843", "0.56436706", "0.55917037", "0.55206144", "0.54955673", "0.5451473", "0.5409495", "0.53454435", "0.53434247", "0.53086203", "0.5301726", "0.5300352", "0.5287...
0.5900772
2
This function is the_cats_ass. That's an overstatement. This is an understatement. See what I did there? What _you_ can do here is save the sys.ENVIRONMENT by reducing printed waste. Mew.
def the_cats_ass(): return __cat_whisperer()[Cat.ASS]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tuxedo_cat():\n return __cat_whisperer(colors=True, coat='tuxedo_colorz', logo_colorz='dark_logo_colorz')[Cat.ASS]", "def env_cleanup(self):\n pass", "def _create_extra_environment(self):\n return {}", "def calico_kitty():\n return __cat_whisperer(colors=True, coat='calico_colorz', lo...
[ "0.5378321", "0.5314823", "0.51957476", "0.5176816", "0.50836897", "0.5041659", "0.50129634", "0.5007439", "0.49973828", "0.49863762", "0.4961463", "0.4959659", "0.49336305", "0.492728", "0.48846954", "0.48724553", "0.48644373", "0.48611596", "0.48404202", "0.48205215", "0.48...
0.616136
0
Filter the results of poking the cat. Takes variable names as strings for the args.
def comb(cat, *brush): return PrettyKitty(cat.ctx, {k: v for k, v in cat.values.items() if k in brush})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cat(**kwargs):\n if 'params' in kwargs:\n params = kwargs['params']\n if 'flags' in kwargs:\n flags = kwargs['flags']\n command = [\"cat\"]\n\n for f in params:\n command.append(f)\n\n call(command)", "def CatCommand(self, args, sub_opts=None, headers=None, debug=0):\n ...
[ "0.63766456", "0.59995097", "0.564777", "0.5529868", "0.5434185", "0.5299351", "0.5199314", "0.5147464", "0.501238", "0.5005839", "0.49969578", "0.4989059", "0.4971183", "0.49100712", "0.48868835", "0.48775518", "0.47976434", "0.47956964", "0.4789621", "0.4775739", "0.4743783...
0.0
-1
Omit any undesirable variables from the result.
def avoid(cat, *undesirables): return PrettyKitty(cat.ctx, {k: v for k, v in cat.values.items() if k not in undesirables})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unusedVars(self):\n fullcode = self.code_cfg\n variables = set([x[1:] for x in codeconfig_getvars(fullcode)])\n exceptions = set(['complexity', 'code_cfg'])\n clsvars = set(vars(self).keys())\n nones = set(filter(lambda x: self.__dict__[x] is None, clsvars))\n nones = ...
[ "0.6108275", "0.6065515", "0.5893631", "0.58840024", "0.5857133", "0.5839786", "0.57673234", "0.57253194", "0.5685147", "0.5642761", "0.5571985", "0.556635", "0.554247", "0.55097634", "0.547759", "0.5425294", "0.54203904", "0.5398573", "0.5384865", "0.5326627", "0.531577", ...
0.0
-1
You really shouldn't be poking cats. But if you insist, it is recommended to bring catnip as it's not unusual for cats to attack dicks who poke them.
def poke_the_cat(where, catnip=False): if not catnip: from random import randint class BadCat(InterruptedError): pass if randint(1, 10) == 7: mew = "You attempt to poke the cat but it attacks. " \ "Maybe if you gave it some catnip?" rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schrodingers_cat(peek=False):\n from random import choice, randint\n if peek:\n if randint(1, 10) % 2 == 0:\n # RIP\n return \"Nothing at all\"\n else:\n return poke_the_cat(Cat.LEGS, catnip=True)\n else:\n garbled_cries = \"mew meow wokka beocat e...
[ "0.61793715", "0.5548466", "0.52614313", "0.5206707", "0.5189093", "0.5179284", "0.5168439", "0.51067805", "0.51002204", "0.5057231", "0.5049274", "0.4982071", "0.49557567", "0.4942977", "0.4941298", "0.48946017", "0.48391628", "0.48205256", "0.47957787", "0.47827622", "0.471...
0.66019756
0
Peek in the box for a 50/50 shot of retrieving your desired output, while the other half of the time the cat is dead and the function returns nothing at all. If you decide not to peek, the cat being neither dead nor alive responds with random nonsense.
def schrodingers_cat(peek=False): from random import choice, randint if peek: if randint(1, 10) % 2 == 0: # RIP return "Nothing at all" else: return poke_the_cat(Cat.LEGS, catnip=True) else: garbled_cries = "mew meow wokka beocat ekkie".split() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_peek_shows_value_of_current_tail(dq_3):\n assert dq_3.peek() == 'ragtime'", "def poke_the_cat(where, catnip=False):\n if not catnip:\n from random import randint\n\n class BadCat(InterruptedError):\n pass\n\n if randint(1, 10) == 7:\n mew = \"You attempt ...
[ "0.5551094", "0.5481319", "0.54402834", "0.52876055", "0.5216225", "0.5209968", "0.5209621", "0.51197696", "0.509371", "0.50888205", "0.5036659", "0.5000694", "0.49975404", "0.4992409", "0.4970316", "0.49431387", "0.49377355", "0.49363643", "0.4902926", "0.48842472", "0.48525...
0.6159067
0
I can haz colorz?
def calico_kitty(): return __cat_whisperer(colors=True, coat='calico_colorz', logo_colorz='logo_colorz')[Cat.ASS]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colour(z, i):\n if abs(z) < self.threshold:\n return 0, 0, 0\n v = np.log2(i + self.threshold - np.log2(np.log2(abs(z)))) / self.threshold\n if v < 1.0:\n return v ** b1, v ** b2, v ** b3 # coloured tones\n else:\n v = ma...
[ "0.68576366", "0.672275", "0.6629412", "0.6468807", "0.6314449", "0.6175668", "0.61718744", "0.6159126", "0.6091556", "0.60612047", "0.59886336", "0.59635425", "0.5960913", "0.59592134", "0.593711", "0.592001", "0.58705544", "0.58628786", "0.5832216", "0.5817841", "0.5800164"...
0.0
-1
Finer than a pheasant
def tuxedo_cat(): return __cat_whisperer(colors=True, coat='tuxedo_colorz', logo_colorz='dark_logo_colorz')[Cat.ASS]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_phase():\n pass", "def atender(self):\n\n if self.enfila>0:\n \n self.enfila-=1\n self.fila.pop(0)", "def End(A):\n return Hom(A,A)", "def end_meassuring(self):\n self.enabler = 0\n #self.t.join()\n return 1", "def finish():", "de...
[ "0.6154273", "0.56990314", "0.5660295", "0.5646709", "0.5624932", "0.5624932", "0.5624932", "0.5624932", "0.5621548", "0.5606399", "0.5522237", "0.55028677", "0.55028677", "0.54799473", "0.5425177", "0.5425177", "0.53860223", "0.5381831", "0.5342247", "0.5336071", "0.532008",...
0.0
-1
The cat whisperer is usually very solitary and private. Thus any attempts at invoking the cat whisperer directly will be met with no resistance, because this is Python, and honestly he could use the friends.
def __cat_whisperer(**kwargs): from inspect import currentframe frames = [] frame = currentframe() while frame is not None: frame = frame.f_back try: c_frame = frame.f_locals.copy() co_name = frame.f_code.co_name except AttributeError: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cat(var, wrapper, message):\n wrapper.send(messages[\"cat_toss\"].format(wrapper.source), messages[\"cat_land\"].format(), sep=\"\\n\")", "def testEchoCatCat(self):\n pl = Pipeline(loadInitFile=False)\n repl = REPL(pl)\n repl.runCommandLine('echo hi | cat | cat')\n self.assertE...
[ "0.59018856", "0.5861355", "0.5858545", "0.57538694", "0.56366396", "0.5491336", "0.53796077", "0.5355786", "0.5333996", "0.53020954", "0.52790123", "0.5236062", "0.52325976", "0.51591986", "0.51591986", "0.5084246", "0.5084246", "0.50796264", "0.50266165", "0.5013587", "0.50...
0.5513489
5
Event handler for scripts class, adds own processing time
def handleEvent(eventname, *kwargs): stime = time.time() hdl = [hdl for hdl in classes.get('eventhandler').getEventhandlers(event=eventname) if hdl.handler == 'emonitor.modules.scripts.script.Script'] scriptname = "" if len(hdl) == 1: if "in.scriptname" in hdl[0].getParamete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script(self):", "def time_automation_listener(now):\n action()", "def start_processing(self):", "def run_script(self):\n pass", "def run(self, current_time):\r\n raise NotImplementedError(\"The run() method must be implemented by \"\r\n \"each class...
[ "0.6029688", "0.60170215", "0.5954977", "0.5938607", "0.58922416", "0.58922416", "0.58922416", "0.58922416", "0.58922416", "0.58922416", "0.58922416", "0.5856889", "0.582436", "0.5804509", "0.57735705", "0.5739238", "0.5738612", "0.57363063", "0.5725373", "0.5725373", "0.5697...
0.0
-1
Initializes the widget hardware.
def _initialize_hardware(self): # Import try: from gpiozero import MCP3008 except Exception as ex: logging.error('\n *** ERROR importing gpiozero: {}'.format(ex)) # Things failed, must be running locally, not on a widget, so don't # bother initi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_hardware(self):\n return", "def init(self):\n self.reset()\n\n self.__interface.send_command('POWER_SETTING')\n self.__interface.send_data(0x37)\n self.__interface.send_data(0x00)\n\n self.__interface.send_command('PANEL_SETTING')\n self.__interface.send...
[ "0.7541131", "0.69498444", "0.69382215", "0.68302613", "0.68180233", "0.6809574", "0.67239654", "0.6722193", "0.67057806", "0.6692837", "0.6665246", "0.6598455", "0.6580556", "0.6578541", "0.6548161", "0.65389204", "0.6495379", "0.64761627", "0.6467701", "0.64535296", "0.6444...
0.6526566
16
Thread that polls to get the current force on the FSR. Populates the self._average_force value.
def _force_loop(self): NUM_SAMPLES = 10.0 # Get the initial readings time.sleep(1) readings = [] for i in range(0, int(NUM_SAMPLES)): readings.insert(0, self._sensor.value) time.sleep(self._sampling_rate) self._average_force = sum(r for r in read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n lastbeat = time.time()\n averages = []\n for x in range(self.keep_amount):\n averages.append(1)\n while self.run:\n cur_amount = len(averages)\n if self.keep_amount != cur_amount:\n if self.keep_amount < cur_amount:\n ...
[ "0.6141744", "0.57550305", "0.5539875", "0.551071", "0.54476047", "0.5357573", "0.53213555", "0.5257272", "0.52194697", "0.5190291", "0.51847667", "0.51847667", "0.5159389", "0.5158231", "0.51533365", "0.51522845", "0.5108973", "0.5106741", "0.5078752", "0.5078129", "0.506391...
0.71686685
0
Part of force API. Returns a number with the scaled force (which should end up being between 0 and about 5 based on my testing).
def force(self): return self._divisor / self._average_force
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scale():\r\n\r\n \r\n return 0.5", "def getScale(self):\n return self.factor**self.turnOn", "def scale(self):\n return self.distribution.scale", "def scale(self, value):\r\n return (float(value)-float(self.minimum))/float(self.maximum-self.minimum)*2.0 - 1.0", "def scale(self, va...
[ "0.7514146", "0.72875655", "0.7234186", "0.711452", "0.7060418", "0.70115966", "0.6901176", "0.6861581", "0.68096155", "0.68067354", "0.68016386", "0.67743933", "0.6736795", "0.6702713", "0.66959536", "0.66959536", "0.66875863", "0.66495395", "0.6553178", "0.6551245", "0.6538...
0.6342841
28
Part of force API. Returns a number with the raw pressure.
def raw_force(self): if self.live: return self._sensor.value # For testing return self._test_raw_force
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_pressure(self) -> float: # type: ignore\n ...", "def native_pressure(self) -> float | None:\n return self._pressure", "def read_pressure(self):\n pRaw = self._read_multiple_bytes_as_array(self.BME280_PRESS_MSB, 3)\n\n return float(self._compensate_pressure((pRaw[0] <<...
[ "0.82014054", "0.8120208", "0.8058288", "0.80572706", "0.8028522", "0.7965267", "0.7960133", "0.7925344", "0.78824246", "0.78773296", "0.78055376", "0.76049834", "0.7570139", "0.7537577", "0.74433875", "0.74054044", "0.72677594", "0.69811654", "0.695675", "0.6943918", "0.6931...
0.6526758
42
Groups the cell images into their respective predicted class. Useful to see visually which mistakes the model made and which class the mistakes occurred.
def display_predictions(data, predictions): images = [[] for i in range(5)] for i, pred in enumerate(predictions): images[pred].append(data[i]) cols = ['Ne', 'Mo', 'Ba', 'Eo', 'Ly'] lengths = [len(w) for w in images] fig = plt.figure() grid = ImageGrid(fig, 111, nrows_ncols=(5, len(cols)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify_images():\n\n # Load the desired image\n img_path = 'dataset/colorize_images/n02085782_919.jpg'\n img = image.load_img(img_path, target_size=(299, 299))\n x = image.img_to_array(img)\n x = np.expand_dims(x, axis=0)\n x = preprocess_input(x)\n\n model = InceptionV3(weights=\"imagen...
[ "0.70386404", "0.65294516", "0.65029687", "0.6423954", "0.64230543", "0.6364461", "0.62974554", "0.6266392", "0.6211879", "0.62009114", "0.61849576", "0.61780983", "0.61658597", "0.6103416", "0.61006534", "0.60835475", "0.60513175", "0.6041398", "0.6017167", "0.6014741", "0.6...
0.0
-1
Load a saved model and generate predictions on test data. Then display the cell images organized by which prediction they were under.
def evaluate(): global_step = tf.Variable(0, name='global_step', trainable=False) # randomize the inputs look x, y_, data, keep_prob = blood_model.prepare_input() # Get images and labels for blood_model. conv_output, W_conv1, W_conv2, h_conv1, h_conv2 = blood_model.inference(data, keep_prob) co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction():\r\n\r\n loaded_model = load_model('imageTrainedModel.h5')\r\n print(loaded_model.summary())\r\n\r\n # retrieve history also:\r\n f = open('history.pckl', 'rb')\r\n history = pickle.load(f)\r\n f.close()\r\n\r\n print(history.keys())\r\n print(history)\r\n\r\n epochs = l...
[ "0.71263", "0.7030289", "0.70282024", "0.7010502", "0.69431835", "0.68770826", "0.68131137", "0.6748319", "0.66960573", "0.6673433", "0.6631963", "0.66049194", "0.6589844", "0.6577621", "0.6540029", "0.65387815", "0.65019274", "0.649637", "0.6476688", "0.645932", "0.6456553",...
0.0
-1
Find a natural gutter between start and stop, inclusive.
def get_gutter(start_obj, stop_obj): log.debug(f'get_gutter({start_obj.group(0)}, {stop_obj.group(0)})') start = start_obj.end(0) stop = stop_obj.start(0)-1 gutters = list() for column in range(start, stop+1): if all(line.rjust(column+1)[column] == ' ' for line in lines): gutters.append(column) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNiceExtentsBySpacing(minval,maxval,spacing,tolerance):\n pass", "def find_midpoint(start, end):\n mid = (start + end) / 2\n return int(mid)", "def gutter_spacing(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"gutter_spacing\")", "def gutter_spacing(self) -> Optional[...
[ "0.6075604", "0.57111067", "0.57065743", "0.57065743", "0.57065743", "0.55262905", "0.5473661", "0.5458969", "0.538811", "0.5384582", "0.5346922", "0.5319414", "0.5292439", "0.51302606", "0.5105891", "0.51037973", "0.5075034", "0.5074723", "0.5058725", "0.50488275", "0.498400...
0.80115026
0
Param n is a number Function will enlarge the number
def enlarge(n): return n*100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enlarge(n):\n\n return n* 100", "def enlarge(n):\r\n return n * 100", "def enlarge(self, n=2):\n c = self.center\n for i in range(len(self.points)):\n v = Vector.createFromTwoPoints(c, self.points[i])\n self.points[i].set((n * v)(c))", "def mirror(n):\n return...
[ "0.81874907", "0.8149599", "0.691363", "0.64795965", "0.6437244", "0.63877094", "0.6271831", "0.62134737", "0.61795235", "0.6164558", "0.6158201", "0.6148302", "0.60860157", "0.6071508", "0.6043378", "0.59866273", "0.59858376", "0.59682846", "0.5964596", "0.5962503", "0.59513...
0.80245125
2
all the private valuable is defined for test values
def __init__(self, *args, **kwargs): self.specGenerator = WMSpecGenerator() self.count = 0 self.maxWmSpec = kwargs.setdefault('numOfSpecs', 1) self.type = kwargs.setdefault("type", 'ReReco') if self.type != 'ReReco': raise TypeError('unknown request type %s' % self.ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_many_values(self):\n write this test!", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def setUp(self):\n self.t = True\n self.f = False\n self.value = 25", "def test(self):\n raise NotImplementedError", ...
[ "0.7416687", "0.681597", "0.681597", "0.681597", "0.6706734", "0.6663227", "0.66074175", "0.6508342", "0.6506361", "0.6506361", "0.6506361", "0.6506361", "0.6506361", "0.64573824", "0.63861674", "0.6379714", "0.6369126", "0.6348164", "0.62749034", "0.6264271", "0.62430596", ...
0.0
-1
Returns a list of request names of requests in runningopen state
def getRunningOpen(self, teamName): result = [] for request in self.status: if self.status[request] == 'running-open': result.append(request) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetRequestsByState(self, state):\n requests_dir = self._spool_state_dirs[state]\n return sorted(os.listdir(requests_dir))", "def get_available_request(self):\n for med in self.__state.__class__.__dict__:\n if med.startswith('request_'): yield med", "def get_requests(self):\n\t\tsel...
[ "0.69532305", "0.67579085", "0.6556441", "0.65352577", "0.6497508", "0.64858216", "0.6394398", "0.6211951", "0.60207194", "0.60156894", "0.59925896", "0.5909057", "0.5878461", "0.58699447", "0.58357877", "0.57668465", "0.57654035", "0.576168", "0.5757679", "0.5750489", "0.566...
0.7229156
0
This is just for clean up not part of emulated function
def _removeSpecs(self): self.specGenerator.removeSpecs()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_up(self):", "def horde_cleanup(self):", "def clean_up(self):\n\t\tpass", "def cleanup(self):", "def cleanup(self):", "def cleanup(self):", "def cleanup():", "def clean_up(self):\n pass", "def clean_up(self):\n pass", "def cleanUp(self):\r\n pass", "def finalise(s...
[ "0.7257313", "0.71828663", "0.7030774", "0.70296204", "0.70296204", "0.70296204", "0.69478714", "0.68301713", "0.68301713", "0.6816452", "0.67658687", "0.67415017", "0.6673759", "0.65570885", "0.65364534", "0.65364534", "0.651055", "0.65074927", "0.65074927", "0.6496239", "0....
0.0
-1
Give a fake team name
def getTeam(self): return ["The A-Team", "some other bloke"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_name(self):\n return 'Team Name'", "def yield_team(self) -> str: # pragma: no cover", "def team_name(self, team_name):\n self.team_id = self.get_team_id(team_name)\n LOG.debug(\"Mattermost team id: %s\", self.team_id)", "def teamname(record):\n\n tname = \"\"\n if...
[ "0.76355934", "0.72684175", "0.7165599", "0.7107976", "0.7086958", "0.6947856", "0.6859305", "0.68285376", "0.67991877", "0.67297554", "0.6650787", "0.6508734", "0.6422581", "0.641175", "0.6401281", "0.6394169", "0.63422143", "0.6316826", "0.6298397", "0.62319654", "0.6222579...
0.6413395
13
Function for rendering the home page
def render_home(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n return render_template('home_page.html')", "def home():\n return render_template('homepage.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def home()...
[ "0.88329524", "0.86391366", "0.8630416", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.86062366", "0.8602575", ...
0.88435775
0
Function for rendering an existing session page
def render_player_session(id): sess = get_player_session(id) if sess: pass #return render_template("session.html") else: pass #some kind of 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginPage():\n\n state = ''.join(random.choice(string.ascii_uppercase + string.digits)\n \t for x in xrange(32))\n login_session['state'] = state\n return render_template('login.html', STATE=state)", "def index():\n print(\"Inside index()\")\n if \"display_name\" not in session:\...
[ "0.68190837", "0.6669858", "0.66534925", "0.6565649", "0.65498805", "0.6485435", "0.63670814", "0.635986", "0.6321983", "0.6302406", "0.62669337", "0.6244736", "0.62421983", "0.62421983", "0.62374693", "0.6187892", "0.6185891", "0.6181225", "0.61790746", "0.61767036", "0.6166...
0.7415087
0
Function for rendering a DM session page
def render_DM_session(id): sess = get_DM_session(id) if sess: pass else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_player_session(id):\r\n\tsess = get_player_session(id)\r\n\tif sess:\r\n\t\tpass\r\n\t\t#return render_template(\"session.html\")\r\n\telse:\r\n\t\tpass\t\t\r\n\t\t#some kind of 404\r", "def loginPage():\n\n state = ''.join(random.choice(string.ascii_uppercase + string.digits)\n \t fo...
[ "0.69160146", "0.6585566", "0.6536112", "0.62708634", "0.6269151", "0.6269151", "0.62596005", "0.6238901", "0.61822796", "0.6137672", "0.6050705", "0.603166", "0.6014789", "0.59822565", "0.59557796", "0.59547424", "0.5920551", "0.589151", "0.58809185", "0.5834792", "0.5823835...
0.7526199
0
Return user properties from OGDS. Always returns a minimal set of the properties 'ogg.user.userid' and 'ogg.user.title' even when no ogdsuser is found.
def _collect_properties(self): properties = { 'userid': self.user_id, 'title': self.get_fullname() } if not self.ogds_user: return properties for attribute_name in self.ogds_user_attributes: value = getattr(self.ogds_user, attribute_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_user_gql(data):\n return {\n \"pk\": int(data[\"id\"]),\n \"username\": data[\"username\"],\n \"full_name\": data[\"full_name\"],\n \"is_private\": data[\"is_private\"],\n \"profile_pic_url\": data[\"profile_pic_url\"],\n \"is_verified\": data.get(\"is_verif...
[ "0.64163625", "0.59113324", "0.58720744", "0.58373237", "0.569525", "0.558774", "0.5474033", "0.5464169", "0.54381526", "0.5365471", "0.53464866", "0.53319556", "0.53300774", "0.5273262", "0.5270092", "0.5262506", "0.52574897", "0.5255697", "0.5240036", "0.5235572", "0.522683...
0.7212165
0
Calls functions in each NN file to get results. Starts with python, calls run file for c++ versions
def get_results(): #Get python results import mnist_nn import mnist_nn_gpu mnist_nn.save_results() mnist_nn_gpu.save_results() #Get cpp results import subprocess subprocess.call(['c++//./run.sh'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cpp(self):", "def main():\n\n config = None\n\n try:\n args = get_args()\n config = process_config(args.config)\n raise RuntimeError(\"Missing or invalid arguments\")\n except Exception as e:\n logging.error(\"Failed\", exc_info=e)\n\n print(\"Create the data gener...
[ "0.65926754", "0.6401703", "0.63215774", "0.63125354", "0.6269683", "0.62658095", "0.6245949", "0.6243756", "0.622921", "0.62033784", "0.61332804", "0.6127914", "0.61143494", "0.6087046", "0.60750556", "0.6072328", "0.606391", "0.6054718", "0.6037091", "0.6021028", "0.6000744...
0.668048
0
Create tables Start with Times table, load in the data and put into useful lists. Load lists into numpy array, then create cell text. Create columns, column colors, then create the table and save it. Repeat for accuracy table.
def create_tables(times, accuracies, batch_sizes): #Get time data p_cpu_times = list(times[0].values()) p_gpu_times = list(times[1].values()) c_cpu_times = list(times[2].values()) c_gpu_times = list(times[3].values()) #Get differences in times p_diff_times = [a - b for a, b in zip(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_display_data_table():\n\n for ccd in range(0, 10):\n for node in range(0, 4):\n file = 'ccd' + str(ccd) + '_' + str(node)\n infile = data_dir + file\n outfile = web_dir + 'Data/' + file\n\n f = open(infile, 'r')\n data = [lin...
[ "0.69752", "0.6746598", "0.66616607", "0.657273", "0.6527887", "0.6494611", "0.6466136", "0.6444683", "0.64372617", "0.63944316", "0.63084507", "0.63014144", "0.6282424", "0.62796277", "0.62533253", "0.6238252", "0.62094986", "0.61975396", "0.61698943", "0.6117473", "0.611501...
0.7961645
0
Create accuracy plots for each batch size Load in accuracy information into useful lists, then create a plot. Each plot has the accuracy for all 4 datasets listed
def create_batch_plots(accuracies, batch_sizes): #Get accuracy data p_cpu_accuracy = list(accuracies[0].values()) p_gpu_accuracy = list(accuracies[1].values()) c_cpu_accuracy = list(accuracies[2].values()) c_gpu_accuracy = list(accuracies[3].values()) #Create plot for each batch size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_plot(LS_sizes, data_fun):\r\n\r\n opt_neigh = []\r\n\r\n #plot of optimal n_neighbors as a function of the LS size\r\n\r\n for size in LS_sizes:\r\n\r\n acc = []\r\n neighbors_values = np.arange(1,size+1,1)\r\n\r\n # For a given LS size, plots of accuracy(n_neighbors)\r\n...
[ "0.73184514", "0.7299639", "0.70774925", "0.69942814", "0.6946279", "0.6922432", "0.68750584", "0.6874822", "0.6822587", "0.6822159", "0.67851657", "0.6782538", "0.6775013", "0.6749557", "0.6698696", "0.6659146", "0.6657379", "0.6631417", "0.6601273", "0.6561536", "0.6523589"...
0.78852516
0
Initialize a new fraction with the given numerator and denominator (default 1).
def __init__(self, numerator, denominator=1): common_div = gcd(numerator, denominator) if common_div == 0: common_div = 1 self.numerator = int((numerator / common_div) / copysign(1, denominator)) self.denominator = int((denominator / common_div) / copysign(1, denominator)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, numerator, denominator=1):\n gcd1 = math.gcd(numerator, denominator)\n\n if denominator < 0:\n self.numerator = -(int(numerator/gcd1))\n self.denominator = abs(int(denominator/gcd1))\n elif denominator == 0:\n self.numerator = 1\n ...
[ "0.8137715", "0.79004323", "0.7554975", "0.7540042", "0.7523119", "0.74793065", "0.74483407", "0.7292548", "0.7187293", "0.7100966", "0.707507", "0.68207115", "0.67850834", "0.67308176", "0.6693192", "0.66444474", "0.6619234", "0.6480323", "0.64723444", "0.6453896", "0.638398...
0.764352
2
Return the sum of two fractions as a new fraction. Use the standard formula a/b + c/d = (ad+bc)/(bd)
def __add__(self, frac): add_new_numerator = (self.numerator * frac.denominator) +\ (frac.numerator * self.denominator) add_new_denominator = self.denominator * frac.denominator if add_new_denominator == 0: raise ValueError("UNDEFINED.") return Fra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify_fraction(a, b):\n c = gcd(a, b)\n return a // c, b // c", "def __add__ (self, other):\n if (self.debug): print(f'enter fraction.__add__ with {other}')\n lcm = find_lcm(self.value[1], other.value[1])\n if (self.debug): print(f'{int(lcm/self.value[1])} {self.value}')\n f1 = self.equi...
[ "0.7550767", "0.73520947", "0.70274425", "0.70012", "0.68851763", "0.68535614", "0.6831391", "0.6830096", "0.6678177", "0.66171855", "0.6570202", "0.6537826", "0.6499646", "0.6448474", "0.64213866", "0.6402042", "0.63277656", "0.6272814", "0.62671316", "0.62539977", "0.618849...
0.65008366
12
Two fractions are equal if they have the same value. Fractions are stored in proper form so the internal representation is unique (3/6 is same as 1/2).
def __eq__(self, frac): return self.equal == frac.equal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equal(self):\n self.assertTrue(Fraction(7,10)==Fraction(7,10))", "def test_notequal(self):\n self.assertTrue(Fraction(144,2)!=Fraction(8,4))", "def test_frac_same(self):\n s1 = self.RNA(\"ACGU\")\n s2 = self.RNA(\"AACG\")\n s3 = self.RNA(\"GG\")\n s4 = self.RN...
[ "0.8099188", "0.7660002", "0.74295694", "0.72934115", "0.7253576", "0.7143537", "0.6919099", "0.6876407", "0.6799766", "0.67680925", "0.6742922", "0.67288", "0.6660526", "0.6650963", "0.66349375", "0.6611294", "0.6571344", "0.64932424", "0.64467835", "0.64218277", "0.64188033...
0.7083102
6
Enables some of the global JAX flags for debugging.
def enable_jax_debugging_flags(): # Enable the NaN-checker behavior to cause JAX to hard-break on the first # occurrence of a NaN. jax.config.update('jax_debug_nans', True) # Enable the compilation logger to check whether or not we're accidentally # causing a lot of re-compilation (inspect logs for excessiv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_debug(flag):\n global debug\n debug = flag\n XLM.XLM_Object.debug = flag\n XLM.xlm_library.debug = flag\n XLM.ms_stack_transformer.debug = flag\n XLM.stack_transformer.debug = flag\n XLM.excel2007.debug = flag", "def setDebug():\n\tglobal debug\n\tdebug = True", "def _pma_set_debug...
[ "0.7106474", "0.6122721", "0.6115534", "0.59994066", "0.59944767", "0.599425", "0.5859546", "0.5831815", "0.57899874", "0.574849", "0.5723658", "0.57184064", "0.5690623", "0.56572646", "0.56189394", "0.56183857", "0.55708146", "0.55087733", "0.55059654", "0.549461", "0.549309...
0.84278125
0
Prints out shape of parameters and total number of trainable parameters.
def log_param_shapes(params: Any, print_params_nested_dict: bool = False) -> int: if print_params_nested_dict: shape_dict = tree_map(lambda x: str(x.shape), params) # We use json.dumps for pretty printing nested dicts. logging.info('Printing model param shape:/n%s', j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_trainable_params(scope=None):\n n_params = 0\n print('name \\t| shape \\t| num parameters')\n\n for var in tf.trainable_variables(scope):\n # shape is an array of tf.Dimension\n shape = var.get_shape()\n n_elems = shape.num_elements()\n print(var.name, shape, n_elems)...
[ "0.81262803", "0.76609623", "0.7620059", "0.75991726", "0.7555964", "0.7479064", "0.74128604", "0.74116015", "0.73896194", "0.73896194", "0.73891115", "0.73891115", "0.73891115", "0.73891115", "0.73185104", "0.7250894", "0.72192323", "0.7219136", "0.7195513", "0.7163983", "0....
0.7029052
23