query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
This function converts the searchspace to a candidate_list that can then be used to distribute via MPI.
def get_candidates(self, searchspace): candidates_list = list() candidates = [x for x in product(*searchspace[1])] for c in candidates: params = {} for name, value in zip(searchspace[0], c): params[name] = value candidates_list.append(Candidate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_multiprocessing(self):\n pool = multiprocessing.Pool(self._main_args_.n_jobs)\n _cand_list = pool.map(self._search, self._main_args_._n_process_range)\n\n return _cand_list", "def get_all_candidates(self) -> list:", "def generateCandidates(self):\n\t\tprint(\"Candidate list:\\n...
[ "0.6026548", "0.57852715", "0.56433123", "0.5471128", "0.5248431", "0.5229676", "0.52044755", "0.5200372", "0.51994306", "0.511944", "0.51109856", "0.51095676", "0.50967646", "0.507686", "0.5046044", "0.5034481", "0.5031602", "0.4987694", "0.49830097", "0.49704012", "0.496087...
0.6952465
0
This function is called immediately after convert_searchspace and get the output of the latter as input. It's purpose is to call the solver libs main optimization function.
def execute_solver(self, searchspace): candidates = self.get_candidates(searchspace) try: self.loss_function_batch(candidates) except Exception as e: msg = "internal error in gridsearch execute_solver occured. {}".format(e) LOG.error(msg) raise Br...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self, **kwargs) -> OptimizationResult:\n raise NotImplementedError", "def solve(self):", "def get_sol(self):", "def do_optimisation(self):\n\n print('--> Parameters for optimisation:')\n print('--> Using measurements : {}'.format(self.stoma_cfg.comparison_helper.optimisation_ke...
[ "0.60987407", "0.60212064", "0.5963016", "0.5933277", "0.5891015", "0.57577413", "0.5561545", "0.5545029", "0.5545029", "0.5523147", "0.5497169", "0.54837024", "0.5478205", "0.54775745", "0.5473012", "0.5466365", "0.54575425", "0.5437272", "0.5429614", "0.54279876", "0.541828...
0.6682055
0
Add an iteration to the log with the specified data points. Type should be the type of information this is (e.g., train, valid, etc.) You can either pass data points as kwdargs, or as a dictionary (or both!). Values should be jsonserializable.
def log(self, type:str, data:dict={}, **kwdargs): info = {} info['type'] = type info['session'] = self.session kwdargs.update(data) info['data'] = kwdargs if self.log_gpu_stats: keys = ['fan_spd', 'temp', 'pwr_used', 'mem_used', 'util'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(writer, name, info, step):\n if isinstance(info, dict):\n for key, value in info.items():\n tag = name + '/' + key\n writer.add_scalar(tag, value, step)\n elif isinstance(info, float):\n writer.add_scalar(name, info, step)", "def addDataPoints(self):\n pass", "def __call__(self...
[ "0.5908826", "0.575356", "0.5713834", "0.5709501", "0.5555061", "0.5429399", "0.5388794", "0.5388794", "0.53204525", "0.53188676", "0.5315644", "0.5299712", "0.5275246", "0.5246965", "0.52456915", "0.52220035", "0.5196255", "0.5192238", "0.51893866", "0.51830155", "0.51747787...
0.60418427
0
Given a query string (can be already decoded for faster computation), query the entire log and return all values found by that query. If both log_idx and x_idx is None, this will be a list of lists in the form [log_idx][result_idx]. If x_idx is not None, then the result will be a list of [log_idx]. If both are not none...
def query(self, x:Union[str, list], entry_type:str=None, x_idx:int=None, log_idx:int=None) -> list: if type(x) is not list: x = self._decode(x) res = [] for idx in (range(len(self.logs)) if log_idx is None else [log_idx]): candidates = [] log = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_loggings(self, query: str) -> Tuple[List[dict], list]:\n query_data = {'query': self.add_instance_id_to_query(query),\n 'language': 'csql'}\n demisto.debug('Query being executed in CDL: {}'.format(str(query_data)))\n query_service = self.initial_query_service()\n...
[ "0.57926714", "0.5778369", "0.56765246", "0.537965", "0.5336968", "0.5321347", "0.5284683", "0.5267552", "0.52505964", "0.5193789", "0.5077994", "0.502245", "0.49698225", "0.49510625", "0.49295542", "0.49131703", "0.4882331", "0.4828372", "0.48133808", "0.47839195", "0.476927...
0.7937636
0
Returns the elapsed time between two entries based on the given conditionals. If a query isn't specified, the first / last entry will be used. The first query uses the first value and the second query uses the last value in the results. Setting legible to true returns humanreadable results, while false returns seconds.
def elapsed_time(self, cond1:str='', cond2:str='', legible:bool=True) -> list: q1 = 'x.time; ' + cond1 q2 = 'x.time; ' + cond2 x1 = self.query(q1, x_idx=0) x2 = self.query(q2, x_idx=-1) diff = (lambda x: str(datetime.timedelta(seconds=x)).split('.')[0]) if legible else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeUpdateTimes(old, new):\n\n if (('DaemonStartTime' in new) and ('StatsLifetime' in new) and\n ('DaemonStartTime' in old) and ('StatsLifetime' in old)):\n t_0 = new['DaemonStartTime']\n if t_0 != old['DaemonStartTime']:\n sys.stderr.write('Error: Daemon ads have differen...
[ "0.54689175", "0.54685867", "0.534292", "0.5298123", "0.52866083", "0.52362233", "0.51891977", "0.5052445", "0.5036804", "0.5035306", "0.50276196", "0.5026494", "0.50166583", "0.50115263", "0.50115263", "0.49992824", "0.4993841", "0.48839393", "0.48676643", "0.48600918", "0.4...
0.680527
0
Check if a user has a client with the specified name.
def contains(self, user_id: int, client_name: str) -> bool: return client_name in self.clients[user_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_user_existance(self, user):\n for client in self.clients:\n if user == client.get_name():\n return True\n return False", "def name_registered(name, state):\n for client in state['clients']:\n if client['name'] == name:\n return True\n ret...
[ "0.7478346", "0.71158206", "0.70193994", "0.6893321", "0.6695578", "0.66324085", "0.654453", "0.6511736", "0.65076065", "0.64812887", "0.6479814", "0.64477277", "0.62902", "0.62778467", "0.62645566", "0.62645566", "0.62445486", "0.6202286", "0.61864716", "0.61792886", "0.6152...
0.7886769
0
Send dictionary data to a client associated with the specified user.
def send(self, user_id: int, client_name: str, data: dict) -> bool: if not self.running: logger.error('Proxy server is not running') return False if not clients.contains(user_id, client_name): logger.error(f'user {user_id} has no associated client named ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(User,data):\n BufferManagement.append_to_buffer(data,User['ID'],User['GameID'],\"OUT\")", "def send_data(self, user):\n self.dwObservationsGroup.setVisible(True)\n\n for pyro in self.servers:\n inicialization_colaboration(pyro, factory, self)", "def send_data(self, data: di...
[ "0.6241751", "0.61633736", "0.59718823", "0.59137726", "0.5882311", "0.58734596", "0.5781574", "0.57726216", "0.5772319", "0.5704418", "0.5688189", "0.56806886", "0.5673772", "0.56649023", "0.56522435", "0.56324226", "0.5602788", "0.5602244", "0.55617833", "0.55304", "0.55275...
0.6462606
0
If ``user.date_joined`` is well in the past, ensure that we reset it.
def test_user_creation_old_date_joined(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), **self.user_info) self.assertEqual(new_user.get_username(), 'alice') self.assertEqual(new_user.email, 'alice@example.com') self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unexpired_account_old_date_joined(self):\n self.user_info['date_joined'] = datetime_now(\n ) - timedelta(settings.ACCOUNT_ACTIVATION_DAYS + 1)\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n ...
[ "0.69530255", "0.6145017", "0.61012566", "0.59289694", "0.5928659", "0.57964534", "0.5787182", "0.56021893", "0.5564429", "0.55416584", "0.5521589", "0.54652005", "0.54610646", "0.54565954", "0.54481906", "0.5446602", "0.54062927", "0.5368134", "0.531609", "0.5286739", "0.528...
0.66553056
1
Attempting to reactivate a deactivated account fails.
def test_activation_deactivated(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), **self.user_info) profile = self.registration_profile.objects.get(user=new_user) self.registration_profile.objects.activate_user( pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reactivate(username, success=True, code=None):\r\n if success:\r\n msg = u\"{0} was reactivated\".format(username)\r\n else:\r\n msg = u\"{0} attempted to reactivate with invalid credentials\"\r\n msg = msg.format(username)\r\n\r\n LOG.debug(msg)\r\n ...
[ "0.7130476", "0.6633453", "0.65982825", "0.6534391", "0.6443382", "0.63470507", "0.6346168", "0.63075256", "0.6273836", "0.62644875", "0.6257839", "0.62562954", "0.6252821", "0.6111652", "0.60757893", "0.6045257", "0.60239357", "0.5985713", "0.59539145", "0.5942889", "0.59348...
0.6839544
1
Attempting to activate with a nonexistent key (i.e., one not associated with any account) fails.
def test_activation_nonexistent_key(self): # Due to the way activation keys are constructed during # registration, this will never be a valid key. invalid_key = hashlib.sha256('foo'.encode('latin-1')).hexdigest() _, activated = self.registration_profile.objects.activate_user( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate(ctx: CLIContext, access_key):\n with Session() as session:\n try:\n data = session.KeyPair.activate(access_key)\n except Exception as e:\n ctx.output.print_mutation_error(\n e,\n item_name='keypair',\n action_name='act...
[ "0.6900479", "0.6847969", "0.65402436", "0.64723486", "0.62040704", "0.60852236", "0.6054449", "0.6009547", "0.59082973", "0.5895183", "0.5836678", "0.579545", "0.5771918", "0.5771918", "0.569097", "0.56812245", "0.5678251", "0.5629208", "0.56026345", "0.5600748", "0.5595802"...
0.7738358
0
Test resending activation email to an existing user
def test_resend_activation_email(self): user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), send_email=False, **self.user_info) self.assertEqual(len(mail.outbox), 0) profile = self.registration_profile.objects.get(user=user) orig_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resend_activation_email_activated_user(self):\n user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), send_email=False, **self.user_info)\n\n profile = self.registration_profile.objects.get(user=user)\n user, activated = self.regi...
[ "0.83999896", "0.8292599", "0.81918204", "0.80736554", "0.79771644", "0.7935104", "0.78606844", "0.76296455", "0.7612933", "0.75723714", "0.746926", "0.74641615", "0.7438704", "0.7394641", "0.73463005", "0.7321463", "0.73108983", "0.7279628", "0.72380596", "0.72116923", "0.71...
0.8512436
0
Test resending activation email to a nonexisting user
def test_resend_activation_email_nonexistent_user(self): self.assertFalse(self.registration_profile.objects.resend_activation_mail( email=self.user_info['email'], site=Site.objects.get_current(), )) self.assertEqual(len(mail.outbox), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resend_activation_email(self):\n user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), send_email=False, **self.user_info)\n self.assertEqual(len(mail.outbox), 0)\n\n profile = self.registration_profile.objects.get(user=user)\n ...
[ "0.82796556", "0.82518494", "0.82356507", "0.8166747", "0.81311166", "0.77691895", "0.76394284", "0.7639169", "0.7480525", "0.7434209", "0.7420683", "0.73485184", "0.7306991", "0.7222386", "0.7206487", "0.7183373", "0.7159346", "0.71508497", "0.71354586", "0.7133031", "0.7125...
0.83734745
0
Test the scenario where user tries to resend activation code to the already activated user's email
def test_resend_activation_email_activated_user(self): user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), send_email=False, **self.user_info) profile = self.registration_profile.objects.get(user=user) user, activated = self.registration_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resend_activation_email(self):\n user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), send_email=False, **self.user_info)\n self.assertEqual(len(mail.outbox), 0)\n\n profile = self.registration_profile.objects.get(user=user)\n ...
[ "0.7772148", "0.7533883", "0.75007194", "0.745016", "0.7330889", "0.7247859", "0.7168122", "0.71675116", "0.700994", "0.69821244", "0.6975616", "0.6938937", "0.68772507", "0.6867995", "0.6842328", "0.68418115", "0.6841612", "0.68409073", "0.6802734", "0.679834", "0.6794257", ...
0.7639534
1
Test the scenario where user tries to resend activation code to the expired user's email
def test_resend_activation_email_expired_user(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), send_email=False, **self.user_info) new_user.date_joined -= datetime.timedelta( days=settings.ACCOUNT_ACTIVATION_DAYS + 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reactivation_for_unregistered_user(self, email_user):\r\n response_data = self.reactivation_email(self.unregisteredUser)\r\n\r\n self.assertFalse(response_data['success'])", "def test_resend_activation_email(self):\n user = self.registration_profile.objects.create_inactive_user(\n ...
[ "0.7406478", "0.73823553", "0.7149422", "0.7145186", "0.7035695", "0.69946826", "0.6971374", "0.69590443", "0.69297165", "0.69098747", "0.6908706", "0.6829634", "0.68281144", "0.68117666", "0.68037045", "0.6787123", "0.6737959", "0.6736682", "0.6720985", "0.6687224", "0.66433...
0.76424897
0
Make sure that users created with the old create_new_activation_key method can still be activated.
def test_activation_key_backwards_compatibility(self): current_method = self.registration_profile.create_new_activation_key def old_method(self, save=True): salt = hashlib.sha1( str(random.random()).encode('ascii') ).hexdigest()[:5] salt = salt.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =...
[ "0.80733716", "0.7934203", "0.7856112", "0.7726737", "0.7689222", "0.76855624", "0.7584228", "0.7542768", "0.75306755", "0.7386188", "0.73742163", "0.72761464", "0.7140411", "0.70580685", "0.6964887", "0.69541126", "0.69507843", "0.6939093", "0.6906592", "0.67780584", "0.6769...
0.8035581
1
``SupervisedRegistrationManager.send_admin_approve_email`` sends an email to the site administrators
def test_admin_approval_email(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.activated = True self.registration_profile.objects.send_admin_approve_email( new_user, Site.objects.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_admin_notification_callback(sender, **kwargs):\r\n user = kwargs['user']\r\n\r\n studio_request_email = settings.FEATURES.get('STUDIO_REQUEST_EMAIL', '')\r\n context = {'user_name': user.username, 'user_email': user.email}\r\n\r\n subject = render_to_string('emails/course_creator_admin_subject...
[ "0.6826876", "0.6537784", "0.65328693", "0.6463197", "0.64304906", "0.6424267", "0.6414169", "0.63922054", "0.6382574", "0.63589734", "0.63459295", "0.6323314", "0.6317183", "0.62894416", "0.6276309", "0.61222446", "0.60361904", "0.6013066", "0.59930855", "0.59913015", "0.595...
0.7276848
0
``SupervisedRegistrationManager.send_admin_approve_complete_email`` sends an email to the approved user
def test_admin_approval_complete_email(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.send_admin_approve_complete_email(Site.objects.get_current()) self.assertEqual(len(mail.outbox), 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_approval_email(self):\n new_user = UserModel().objects.create_user(**self.user_info)\n profile = self.registration_profile.objects.create_profile(new_user)\n profile.activated = True\n self.registration_profile.objects.send_admin_approve_email(\n new_user, Site...
[ "0.7216282", "0.6898484", "0.6877655", "0.6873849", "0.68625057", "0.6809047", "0.67979604", "0.67557085", "0.6731575", "0.6731563", "0.66978157", "0.6491644", "0.64828694", "0.64157057", "0.63878804", "0.6341234", "0.63291425", "0.62196344", "0.62192416", "0.6214238", "0.620...
0.73317444
0
``SupervisedRegistrationProfile.send_admin_approve_complete_email`` sends an html email by default.
def test_admin_approval_complete_email_is_html_by_default(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.send_admin_approve_complete_email(Site.objects.get_current()) self.assertEqual(len(ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_approval_email_is_html_by_default(self):\n new_user = UserModel().objects.create_user(**self.user_info)\n profile = self.registration_profile.objects.create_profile(new_user)\n profile.activated = True\n self.registration_profile.objects.send_admin_approve_email(\n ...
[ "0.7453516", "0.7022225", "0.6932745", "0.6780172", "0.6744654", "0.67444867", "0.6634349", "0.65347636", "0.64052093", "0.6366307", "0.6279138", "0.6267874", "0.622664", "0.6210867", "0.60009414", "0.59587365", "0.59559697", "0.59181726", "0.5897239", "0.5852409", "0.5849377...
0.77065986
0
``SupervisedRegistrationProfile.send_admin_approve_complete_email`` sends a plain text email if settings.REGISTRATION_EMAIL_HTML is False.
def test_admin_approval_complete_email_is_plain_text_if_html_disabled(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.send_admin_approve_complete_email(Site.objects.get_current()) self.assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_approval_complete_email_is_html_by_default(self):\n new_user = UserModel().objects.create_user(**self.user_info)\n profile = self.registration_profile.objects.create_profile(new_user)\n profile.send_admin_approve_complete_email(Site.objects.get_current())\n self.assertEqu...
[ "0.77842164", "0.76348877", "0.74455917", "0.70333296", "0.6998661", "0.68728715", "0.6857257", "0.6834873", "0.6643044", "0.65904415", "0.65863746", "0.65829575", "0.65125144", "0.649665", "0.6470984", "0.623754", "0.62238634", "0.6176219", "0.614939", "0.610639", "0.6089036...
0.7635523
1
Approving a non activated user's account fails
def test_admin_approval_not_activated(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), **self.user_info) profile = self.registration_profile.objects.get(user=new_user) user = self.registration_profile.objects.admin_approve_us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_approval_already_approved(self):\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n profile = self.registration_profile.objects.get(user=new_user)\n user, activated = self.registration_profile.ob...
[ "0.71627605", "0.69641227", "0.6796605", "0.66530854", "0.63285375", "0.6298265", "0.62884927", "0.6279905", "0.6271375", "0.62594515", "0.61616224", "0.615995", "0.6108448", "0.60977083", "0.60727", "0.60627747", "0.60587007", "0.60499305", "0.6047088", "0.60400474", "0.6039...
0.7290984
0
Approving an already approved user's account returns the User model
def test_admin_approval_already_approved(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), **self.user_info) profile = self.registration_profile.objects.get(user=new_user) user, activated = self.registration_profile.objects.act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve_user_application(self, user):\n if self.is_moderator and \\\n self.has_perm('accounts.approve_user_application'):\n user.moderator = self\n user.moderator_decision = user.APPROVED\n user.decision_datetime = timezone.now()\n user.auth_token = ...
[ "0.6909134", "0.674219", "0.6548652", "0.6459261", "0.6325617", "0.6279541", "0.62602484", "0.62053704", "0.6091778", "0.5992073", "0.5967312", "0.59622", "0.5946091", "0.5944188", "0.5861703", "0.58382547", "0.5784199", "0.5784199", "0.57642704", "0.5756237", "0.57548046", ...
0.70116365
0
Approving a non existent user profile does nothing and returns False
def test_admin_approval_nonexistent_id(self): new_user = self.registration_profile.objects.create_inactive_user( site=Site.objects.get_current(), **self.user_info) profile = self.registration_profile.objects.get(user=new_user) user = self.registration_profile.objects.admin_approve_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_admin_approval_not_activated(self):\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n profile = self.registration_profile.objects.get(user=new_user)\n\n user = self.registration_profile.objects.admin_...
[ "0.7211909", "0.704508", "0.666929", "0.6517962", "0.65164953", "0.645244", "0.6382132", "0.6325677", "0.62553895", "0.6239202", "0.6206933", "0.62003577", "0.616768", "0.6134095", "0.6110486", "0.6090319", "0.60772467", "0.6069243", "0.6048604", "0.6048152", "0.6034915", "...
0.7436616
0
Make sure that users created with the old create_new_activation_key method can still be activated.
def test_activation_key_backwards_compatibility(self): current_method = self.registration_profile.create_new_activation_key def old_method(self, save=True): salt = hashlib.sha1( str(random.random()).encode('ascii') ).hexdigest()[:5] salt = salt.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =...
[ "0.8035581", "0.7934203", "0.7856112", "0.7726737", "0.7689222", "0.76855624", "0.7584228", "0.7542768", "0.75306755", "0.7386188", "0.73742163", "0.72761464", "0.7140411", "0.70580685", "0.6964887", "0.69541126", "0.69507843", "0.6939093", "0.6906592", "0.67780584", "0.67694...
0.80733716
0
Insert your code to print out the lines to the 99 bottles song in the space below! You should use a WHILE loop in this function to achieve this. The num argument to this function is the starting point for the number of bottles. Remember that each "verse" should take 4 lines, and then a blank link should be printed betw...
def bottle_song_while(num): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nine_lines() -> str:\n print('now printing 9 lines')\n for _ in range(3):\n three_lines()", "def print_verse(animal, sound):\n verse_1()\n print(\"And on his farm he had a \", animal, \"\\nE-I-E-I-O\", sep='')\n print(\"With a\", sound, sound, \"here\")\n print(\"And a\", sound, soun...
[ "0.6233986", "0.57964665", "0.5520915", "0.54867846", "0.5467426", "0.5463348", "0.5462544", "0.54321563", "0.5403192", "0.5333562", "0.5331812", "0.5290507", "0.5283106", "0.5270556", "0.52703255", "0.5217556", "0.5214013", "0.51769054", "0.5156016", "0.51449174", "0.5138296...
0.5883766
1
Returns true if one_img and another_img have the same shape, false otherwise.
def are_compatible_imgs(one_img, another_img): return have_same_shapes(one_img, another_img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shape_compare(shape1, shape2):\n if len(shape1) != len(shape2):\n return False\n for s1, s2 in zip(shape1, shape2):\n if s1 != s2:\n return False\n return True", "def have_same_shapes(array1, array2):\n return array1.shape == array2.shape", "def isconform(self, other):...
[ "0.72515416", "0.70794547", "0.6990521", "0.69838136", "0.689302", "0.6835531", "0.6782097", "0.6763147", "0.6737096", "0.6705083", "0.66664904", "0.661689", "0.66145134", "0.6578829", "0.65539706", "0.65390426", "0.65251374", "0.6489833", "0.64784217", "0.64107895", "0.64050...
0.8483048
0
Returns true if array1 and array2 have the same shapes, false otherwise.
def have_same_shapes(array1, array2): return array1.shape == array2.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _shape_compare(shape1, shape2):\n if len(shape1) != len(shape2):\n return False\n for s1, s2 in zip(shape1, shape2):\n if s1 != s2:\n return False\n return True", "def arrays_are_same(a1, a2):\n try:\n return a1.__array_interface__['data'] == a2.__array_interface__...
[ "0.8050905", "0.78989697", "0.7526569", "0.7451819", "0.73738337", "0.73495656", "0.730123", "0.72620535", "0.72423655", "0.7205247", "0.69364834", "0.6911189", "0.68480945", "0.6759641", "0.6745212", "0.6707359", "0.6681246", "0.6667784", "0.6612043", "0.6609904", "0.6555323...
0.8985268
0
Formats sensor info into a pandas dataframe
def _formatsensorinfo(): df = pd.DataFrame(columns=['Sensor', 'Resolution (m)', 'Band Count']) for i, (image, key) in enumerate(_sensor_info().items()): df.loc[i] = [image, key['resolution'], key['band_count']] return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_sensors_data(dataframe, ms_column='ms_ticker',\n time_column = 'Tstamp',\n ppg_columns=['led_1', 'led_2'],\n acc_columns=['acc_x', 'acc_y', 'acc_z']):\n\n sensors_dict = {}\n sensors = dataframe.loc[1:, 1:]\n sensors_colum...
[ "0.6624953", "0.6416637", "0.6211143", "0.597442", "0.5965767", "0.5957694", "0.5921427", "0.587795", "0.5847222", "0.5813631", "0.5772771", "0.5772312", "0.5770192", "0.5732042", "0.5725004", "0.5689484", "0.5637442", "0.5629542", "0.562008", "0.56172", "0.5614111", "0.560...
0.81698775
0
Function to convert GB of data into sensor aerial coverage (km2)
def gb_to_km2(gb, bit_depth=32): file_bytes = gb * 1e+9 storage_bytes = bit_depth / 8. sensors = _formatsensorinfo() km2 = sensors.apply(lambda row: ((np.sqrt(file_bytes / (row['Band Count'] * storage_bytes)) * row[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_ha_to_km2(nb):\n return nb / 100", "def km2_to_gb(km2, bit_depth=32):\n side_length = np.sqrt(km2) * 1000\n sensors = _formatsensorinfo()\n pixel_count = (side_length / sensors['Resolution (m)']) ** 2\n sqkm = (pixel_count * sensors['Band Count'] * (bit_depth / 8.))...
[ "0.6507239", "0.6442411", "0.59462905", "0.5850994", "0.56607485", "0.55751926", "0.55624545", "0.5560917", "0.5550755", "0.5461724", "0.54559845", "0.5455853", "0.5447054", "0.53527075", "0.5328211", "0.5309192", "0.5297917", "0.52910006", "0.52768147", "0.5258837", "0.52577...
0.7198349
0
Retrieves the observatory codes list from the minor planet center website and installs it into MOPS
def get_obscode(self, dest_list): OBSCODE_SRC = "http://www.minorplanetcenter.net/iau/lists/ObsCodes.html" OBSCODE_NAME = "OBSCODE.dat" out_fh = None in_fh = None # get observatory codes from http://www.minorplanetcenter.net/iau/lists/ObsCodes.html obscode_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMpcorb(url='https://minorplanetcenter.net/iau/MPCORB/MPCORB.DAT.gz', fname='MPCORB.DAT.gz', verbose=True):\n\n #filename = wget.download(url)\n try:\n r = requests.get(url, allow_redirects=True)\n open(fname, 'wb').write(r.content)\n if (verbose):\n print('Download comp...
[ "0.5565333", "0.54441065", "0.53809965", "0.5194474", "0.50488687", "0.5045861", "0.50372577", "0.5036097", "0.5020799", "0.50101346", "0.50070524", "0.49807304", "0.49794626", "0.49451062", "0.49243507", "0.48865172", "0.4870841", "0.48432496", "0.483973", "0.48340955", "0.4...
0.64424175
0
Automatically normalize rubrics set
def normalize_rubrics_set(sender, instance, action, reverse, model, pk_set, **kwargs): if action == 'post_add': if not hasattr(instance, '_during_rubrics_validation'): instance.validate_rubrics(pk_set)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n\n pass", "def normalize_dataset(self):", "def normalize_patch_names(self):\n # possibly busted -- don't use unless you know what you're doing\n self.set_all_levels(self.levels.copy())", "def normalize(self):\n normalized = self.all_details.get('normalized', ...
[ "0.6047742", "0.5771873", "0.57021165", "0.55634856", "0.5443524", "0.5437027", "0.5221316", "0.51826495", "0.51184225", "0.5110354", "0.511014", "0.51064444", "0.50620496", "0.5033376", "0.50265193", "0.5005946", "0.5003497", "0.5000315", "0.49652782", "0.49529353", "0.49302...
0.7133638
0
Check if an object (ie, key) of name ``key_name`` exists in bucket ``bucket_name``. Return ``True`` if so, ``False`` otherwise.
def _key_exists_in_bucket(log, s3_conn, bucket_name, key_name): b = s3_conn.get_bucket(bucket_name, validate=False) k = Key(b, key_name) log.debug("Checking if key '%s' exists in bucket '%s'" % ( key_name, bucket_name)) try: return k.exists() except S3ResponseError, e: log.er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_exists(self, bucket, key):\n\n return len(list(self._s3.Bucket(bucket).objects.filter(Prefix=key))) > 0", "def is_key_exists(client, bucket, key):\n\n response = client.list_objects_v2(\n Bucket=bucket,\n Prefix=key,\n )\n for obj in response.get('Contents', []):\n if...
[ "0.8160495", "0.79576224", "0.7938862", "0.79052913", "0.78558004", "0.7591784", "0.75248474", "0.7508359", "0.7468434", "0.7457666", "0.7429189", "0.73998713", "0.73656553", "0.72960764", "0.72082347", "0.7205028", "0.71590745", "0.71359664", "0.71282613", "0.7127641", "0.70...
0.84683293
0
Display on stdout information about a specified workflow. This function is called in response to use of the 'show' subcommand. The main argument parser and the subparser for the 'show' subcommand enforce rules about what command line options are required.
def xnat_workflow_info_show(args): request_url = "http://" + args.server + "/data/services/workflows/workflowid/" + args.workflow_id + "?format=json" print("xnat_workflow_info show: request_url: " + request_url) response = requests.get(request_url, auth=(args.username, args.password)) if (response.status_code != 20...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_command(self, args):\n self._validate_common(args)\n self._set_manifests(args)\n\n use_local = not args.available\n\n manifest = self._manager._local if use_local else self._manager._remote\n if not use_local:\n manifest.load()\n\n records = self._get_m...
[ "0.63580745", "0.62299454", "0.6064767", "0.6064767", "0.6064767", "0.6064767", "0.6030043", "0.6014529", "0.60076445", "0.60050035", "0.5992925", "0.5981076", "0.59309775", "0.5920359", "0.5865036", "0.5814962", "0.5814962", "0.5800926", "0.579651", "0.57814014", "0.5762249"...
0.6562416
0
Update the information about the specified workflow. The status is set to 'In Progress' The current_step_id is set to the args.step_id The step_description is set to args.step_description The percentageComplete is set to args.percent_complete The current_step_launch_time is set to the current time This function is call...
def xnat_workflow_info_update(args): request_url = "http://" + args.server + "/data/services/workflows/workflowid/" + args.workflow_id + "?format=json" print("xnat_workflow_info update: request_url: " + request_url) response = requests.get(request_url, auth=(args.username, args.password)) json_response = json.load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xnat_workflow_info_complete(args):\n\trequest_url = \"http://\" + args.server + \"/data/services/workflows/workflowid/\" + args.workflow_id + \"?format=json\"\n\tprint(\"xnat_workflow_info complete: request_url: \" + request_url)\n\tresponse = requests.get(request_url, auth=(args.username, args.password))\n\n\...
[ "0.6048921", "0.5477326", "0.543929", "0.53879887", "0.5310551", "0.5308938", "0.5286631", "0.5275502", "0.5237645", "0.51938933", "0.5187405", "0.5179316", "0.51630497", "0.51479596", "0.51460636", "0.5143816", "0.5125691", "0.5123657", "0.5116269", "0.5108726", "0.5088391",...
0.65959305
0
Calculates the minor matrix of a matrix
def minor(matrix): if type(matrix) is not list or len(matrix) is 0: raise TypeError('matrix must be a list of lists') if not all(isinstance(row, list) for row in matrix): raise TypeError('matrix must be a list of lists') if matrix is [[]]: raise ValueError('matrix must be a non-empty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minor(matrix):\n if type(matrix) is not list or len(matrix) < 1 or\\\n not all(isinstance(x, list) for x in matrix):\n raise TypeError(\"matrix must be a list of lists\")\n if not all(len(matrix) == len(x) for x in matrix) or matrix == [[]]:\n raise ValueError(\"matrix must be a ...
[ "0.7479713", "0.7215891", "0.7146785", "0.7060193", "0.69624025", "0.61146146", "0.5811989", "0.5749279", "0.5695024", "0.5560306", "0.54780453", "0.53746325", "0.5332624", "0.53250057", "0.5320316", "0.52763313", "0.5260169", "0.5238276", "0.5210187", "0.5195136", "0.516489"...
0.73282975
1
Forward and backward propagation for a twolayer sigmoidal network Compute the forward propagation and for the cross entropy cost, and backward propagation for the gradients for all parameters.
def forward_backward_prop(data, labels, params, dimensions): ### Unpack network parameters (do not modify) ofs = 0 Dx, H, Dy = (dimensions[0], dimensions[1], dimensions[2]) activation = [] W1 = np.reshape(params[ofs:ofs+ Dx * H], (Dx, H)) ofs += Dx * H b1 = np.reshape(params[ofs:ofs + H],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_backward_prop(data, labels, params, dimensions):\n\n ### Unpack network parameters (do not modify)\n ofs = 0\n Dx, H, Dy = (dimensions[0], dimensions[1], dimensions[2])\n\n W1 = np.reshape(params[ofs:ofs+ Dx * H], (Dx, H))\n ofs += Dx * H\n b1 = np.reshape(params[ofs:ofs + H], (1, H))...
[ "0.7532063", "0.7374891", "0.72554445", "0.72354245", "0.7207436", "0.71579987", "0.71538556", "0.7145697", "0.7138602", "0.70907974", "0.7043428", "0.7039785", "0.7020497", "0.6913334", "0.6912988", "0.69033414", "0.69025844", "0.6856283", "0.68511844", "0.68285286", "0.6775...
0.7443285
1
returns the entity for an expression
def get_entity(obj): return obj.or_expression.and_expression.cmp_expression.arith_expression. \ mul_expression.unary_expression.pow_expression.primary_expression. \ entity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity(expression):\n if expression:\n namespace = sys.modules.copy()\n namespace.update(__main__.__dict__)\n try:\n return eval(expression, namespace)\n except BaseException:\n # An uncaught exception closes idle, and eval can raise any\n # e...
[ "0.68227744", "0.6757395", "0.6437314", "0.6392807", "0.6392807", "0.6392807", "0.6279614", "0.62014425", "0.62014425", "0.60822487", "0.6082003", "0.6006702", "0.59892386", "0.5908467", "0.5908467", "0.5877089", "0.5870103", "0.5856701", "0.5837779", "0.57518417", "0.5736149...
0.77239
0
Ensures that assignments to mutations are compiled correctly.
def test_compiler_assignment_mutation(patch, compiler, lines, tree): patch.object(Objects, 'names', return_value='name') patch.object(Compiler, 'mutation_block') tree.assignment_fragment.service = None compiler.assignment(tree, '1') Compiler.mutation_block.assert_called_with(tree.assignment_fragment...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compiler_assignment(patch, compiler, lines, tree):\n patch.many(Objects, ['names', 'entity'])\n tree.assignment_fragment.service = None\n tree.assignment_fragment.mutation = None\n compiler.assignment(tree, '1')\n Objects.names.assert_called_with(tree.path)\n fragment = tree.assignment_f...
[ "0.6272183", "0.6160097", "0.59369516", "0.5779039", "0.567048", "0.5646768", "0.5634457", "0.5565552", "0.5530591", "0.55009997", "0.5493177", "0.54823136", "0.5481365", "0.54712486", "0.5439815", "0.5362965", "0.5328052", "0.53227156", "0.5319378", "0.52928895", "0.5274041"...
0.64989763
0
Ensures that service trees can be compiled
def test_compiler_service(patch, compiler, lines, tree): patch.object(Objects, 'arguments') patch.object(Compiler, 'output') tree.node.return_value = None compiler.service(tree, None, 'parent') line = tree.line() service = tree.path.extract_path() command = tree.service_fragment.command.chil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_tree():\r\n vstr = '.'.join(map(str,sys.version_info[:2]))\r\n stat = os.system('python %s/lib/python%s/compileall.py .' %\r\n (sys.prefix,vstr))\r\n if stat:\r\n msg = '*** ERROR: Some Python files in tree do NOT compile! ***\\n'\r\n msg += 'See messages abov...
[ "0.5618144", "0.53910667", "0.53302133", "0.5283878", "0.52683836", "0.52217925", "0.5201954", "0.50960606", "0.50957644", "0.50573", "0.50544745", "0.5052452", "0.50484043", "0.5022285", "0.5009119", "0.49843264", "0.49682018", "0.49440143", "0.49051693", "0.4899164", "0.487...
0.56734186
0
Ensures service trees that are infact mutations on paths are compiled correctly
def test_compiler_service_expressions(patch, compiler, lines, tree): patch.object(Objects, 'names', return_value='x') patch.object(Compiler, 'mutation_block') lines.variables = ['x'] compiler.service(tree, None, 'parent') Objects.names.assert_called_with(tree.path) Compiler.mutation_block.assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compiler_service(patch, compiler, lines, tree):\n patch.object(Objects, 'arguments')\n patch.object(Compiler, 'output')\n tree.node.return_value = None\n compiler.service(tree, None, 'parent')\n line = tree.line()\n service = tree.path.extract_path()\n command = tree.service_fragment....
[ "0.5428079", "0.53084874", "0.51514125", "0.49542487", "0.49449903", "0.48846176", "0.48718473", "0.48608884", "0.48404557", "0.4801645", "0.4790717", "0.47056824", "0.47055334", "0.4701831", "0.46994787", "0.46975002", "0.46778172", "0.4671022", "0.465185", "0.4650846", "0.4...
0.6015343
0
Ensures Compiler.return_statement raises CompilerError when the return is outside a function.
def test_compiler_return_statement_error(patch, compiler, tree): patch.init(CompilerError) with raises(CompilerError): compiler.return_statement(tree, None) CompilerError.__init__.assert_called_with('return_outside', tree=tree)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_67_function_not_return(self):\n\t\tinput = \"\"\"procedure main(); var x:integer;\n\t\tbegin x:=fu(); end\n\t\tfunction fu():integer;\n\t\tbegin with a:real; do\n\t\twith a:boolean; do while(true)do return 1;end\"\"\"\n\t\texpect = \"Function fu Not Return\"\n\t\tself.assertTrue(TestChecker.test(input,exp...
[ "0.66840446", "0.6656409", "0.6647458", "0.64723235", "0.6130208", "0.6126375", "0.6096024", "0.60320646", "0.59869313", "0.5941771", "0.59395885", "0.5916364", "0.5887083", "0.5850214", "0.57911235", "0.5757387", "0.57225996", "0.56752264", "0.5672008", "0.56060165", "0.5571...
0.7397634
0
Ensures that try blocks are compiled correctly.
def test_compiler_try_block(patch, compiler, lines, tree): patch.object(Compiler, 'subtree') tree.catch_block = None tree.finally_block = None compiler.try_block(tree, '1') kwargs = {'enter': tree.nested_block.line(), 'parent': '1'} lines.set_scope.assert_called_with(tree.line(), '1') lines....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_safety():\n try:\n yield\n except Exception as e:\n pass", "def add_try_clause(code, excpt):\n code = code.replace('\\t', ' ')\n return (\"try:\\n ...\\n\" + '\\n'.join([\" \" + line for line in code.split('\\n')])\n + \"\\nexcept \" + excpt.__name__ + \":\\n...
[ "0.664508", "0.5780589", "0.5767226", "0.54578865", "0.5455656", "0.53836477", "0.53488606", "0.5303897", "0.5267712", "0.5264704", "0.52495694", "0.5238459", "0.51827186", "0.51749957", "0.51573765", "0.5156621", "0.51503843", "0.5116108", "0.50956553", "0.5067567", "0.50078...
0.6505629
1
Ensures that finally blocks are compiled correctly.
def test_compiler_finally_block(patch, compiler, lines, tree): patch.object(Compiler, 'subtree') compiler.finally_block(tree, '1') lines.set_exit.assert_called_with(tree.line()) lines.set_scope.assert_called_with(tree.line(), '1') kwargs = {'enter': tree.nested_block.line(), 'parent': '1'} lines...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __exit__(self, exc_type, exc_val, exc_tb):\n self._finalize()\n # Do not return anything to pass on all other exceptions.", "def test_exception_handling_all_clauses(self) -> None:\n result = [\"start\"]\n try:\n result.append(\"middle\")\n except CustomError:\n ...
[ "0.63043255", "0.62099546", "0.6062015", "0.6051081", "0.6009144", "0.6009144", "0.6009144", "0.6001274", "0.59498113", "0.59498113", "0.5933909", "0.57896227", "0.57828623", "0.5766467", "0.569668", "0.569668", "0.569668", "0.56875014", "0.5678817", "0.56520456", "0.56490386...
0.6563467
0
A method to get data from Vertica based on different conditions
def get_data(self): data_obj = VerticaGetter() if self.context_name == 'PARTS': param_list = [self.start_date,self.end_date,self.param_name] param_list = [str(elem) for elem in param_list] res = data_obj.get_visitor_analysis(param_list) else: res =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_visitor_analysis(self,params=['2017-7-13','2017-7-15','www.att.com']):\n result =[]\n res_from_query1 = []\n\n query_params = {'domain_name':params[2],'start_date':params[0],'end_date':params[1]}\n logging.debug(\"Query params are: end date {} and start date {} for domain {}\".f...
[ "0.6352376", "0.57689154", "0.5531179", "0.5527229", "0.55084294", "0.54801834", "0.5430569", "0.54223144", "0.54097444", "0.5395574", "0.53931963", "0.5324181", "0.5310058", "0.5301954", "0.52758825", "0.527389", "0.5266154", "0.5256806", "0.5236464", "0.5193116", "0.5183335...
0.6444243
0
Draws person on screen.
def draw_person(screen, x, y): # Head pygame.draw.ellipse(screen, BLACK, [1 + x, y, 10, 10], 0) # Legs pygame.draw.line(screen, BLACK, [5 + x, 17 + y], [10 + x, 27 + y], 2) pygame.draw.line(screen, BLACK, [5 + x, 17 + y], [x, 27 + y], 2) # Body pygame.draw.line(screen, DARK_RED, [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_actor(self, actor):\n actor.draw()", "def draw():", "def draw_person(self, x, y, color=\"blue\"):\n # Delete the old person\n if self.person is not None:\n self.canvas.delete(self.person)\n\n # Compute pixel coords\n upper_left = (y * self.scale, x * self....
[ "0.7285399", "0.724118", "0.71653944", "0.7097219", "0.70808", "0.70777726", "0.7066312", "0.6952756", "0.6952756", "0.6952756", "0.6952756", "0.69348854", "0.67855656", "0.6777595", "0.67696035", "0.67442334", "0.672775", "0.6716797", "0.67056507", "0.6683689", "0.6668488", ...
0.7887709
0
Transforms the given input string into an action string and parameter dict.
def input_to_action_and_params(input_str: str) -> Tuple: input_split = input_str.split(',') action = input_split[0] try: _ = Action(action).name except BaseException: return None, {} if len(input_split) < 2: return action, {} params ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_action(str):\n raise NotImplementedError", "def _fill_action_info(action):\n def _is_ascii(s):\n return all(ord(c) < 128 for c in s)\n\n if not _is_ascii(action.obj_desc_str):\n tf.logging.info('Found an unconvertable unicode %s', action.obj_desc_str)\n return\n\n if not (isinstance...
[ "0.65398943", "0.6002655", "0.5969385", "0.5842105", "0.5739858", "0.56305015", "0.55528384", "0.55332977", "0.5485132", "0.52993757", "0.52983004", "0.528566", "0.5285044", "0.5276169", "0.5247784", "0.5225412", "0.51970327", "0.5193407", "0.51878124", "0.5151959", "0.513768...
0.7663271
0
Build the charmcraft's user agent.
def build_user_agent(): if any(key.startswith(prefix) for prefix in TESTING_ENV_PREFIXES for key in os.environ.keys()): testing = " (testing) " else: testing = " " os_platform = "{0.system}/{0.release} ({0.machine})".format(utils.get_os_platform()) return "charmcraft/{}{}{} python/{}".fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_user_agent(application_name, version, url):\n return '%s/%s %s/%s (+%s)' % (application_name, version,\n 'python-simplemediawiki', __version__, url)", "def user_agent():\n ua_list = [\n\"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (...
[ "0.67694896", "0.6522889", "0.6405889", "0.6401997", "0.6294636", "0.6294636", "0.62648255", "0.61141676", "0.60622364", "0.5920747", "0.58693933", "0.578796", "0.5767475", "0.575489", "0.5742353", "0.57009345", "0.5686013", "0.56682986", "0.5653903", "0.5636848", "0.5624967"...
0.7525859
0
Open a browser so the user can validate its identity.
def visit_page_with_browser(visit_url): logger.warning( "Opening an authorization web page in your browser; if it does not open, " "please open this URL: %s", visit_url, ) webbrowser.open(visit_url, new=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_in_browser(self):\n webbrowser.open(self.url)", "def i_am_in_the_login_page(browser):", "def open_browser(url):\n import webbrowser\n webbrowser.open_new(url)", "def browser_open(url):\n FNULL = open(os.devnull, 'w')\n subprocess.Popen([udata.browser, url], stdout=FNULL, stderr=su...
[ "0.67895275", "0.6759043", "0.6630728", "0.63975734", "0.6392893", "0.6361613", "0.630445", "0.6279862", "0.6269089", "0.62365544", "0.62334543", "0.62128156", "0.62128085", "0.6202877", "0.6127186", "0.6113092", "0.61082506", "0.6086434", "0.6076277", "0.6069961", "0.5973756...
0.6901476
0
Get the proper error from the Store response.
def _parse_store_error(self, response): default_msg = "Failure working with the Store: [{}] {!r}".format( response.status_code, response.content ) try: error_data = response.json() except ValueError: return default_msg try: error_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getError(self):\n \n return self.resp[\"error\"]", "def error(self):\n error = self._wrapped.error\n if error:\n return error\n\n return self.json['response'].get('error')", "def error(self):\n return self.get('error')", "def error(self) -> 'outputs.St...
[ "0.7631604", "0.75256366", "0.7226283", "0.712038", "0.70275104", "0.69710344", "0.6871004", "0.6711934", "0.6693698", "0.6689427", "0.6685457", "0.6596298", "0.6569899", "0.6562234", "0.65135616", "0.65135616", "0.65135616", "0.6481749", "0.64231026", "0.6394504", "0.6362766...
0.8181999
0
Push the bytes from filepath to the Storage.
def push(self, filepath): logger.debug("Starting to push %r", str(filepath)) def _progress(monitor): # XXX Facundo 2020-07-01: use a real progress bar if monitor.bytes_read <= monitor.len: progress = 100 * monitor.bytes_read / monitor.len print("U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self, filename):", "def put(self, filename, data, **kw):\n\n file_path = os.path.join(self.storage_path, filename)\n file_obj = open(file_path, \"w\")\n file_obj.write(data)", "def put_upload(self):\n # print \"starting upload...\", self.current_upload['filepath']\n ...
[ "0.6140802", "0.6135372", "0.61271423", "0.6080627", "0.6077034", "0.60489994", "0.60041165", "0.5966223", "0.59276855", "0.5907643", "0.5816445", "0.5807485", "0.579436", "0.5770611", "0.5760645", "0.57426924", "0.57190543", "0.5708948", "0.56816524", "0.5673225", "0.5625186...
0.7256056
0
Reply to `get_headers` the items in the list are block headers. This may contain no block headers if no block headers were able to be returned for the `get_headers` message.
def block_headers(self, block_headers: list): num_headers = len(block_headers) block_headers_size = num_headers * self._message_size['header'] return { 'id': 'block_headers', 'block_headers': block_headers, 'size': kB_to_MB(block_headers_size) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_get_block_headers(\n self,\n block_number_or_hash: Union[BlockNumber, Hash32],\n max_headers: int,\n skip: int,\n reverse: bool) -> None:\n cmd = GetBlockHeaders(self.cmd_id_offset)\n data = {\n 'block_number_or_hash': block_n...
[ "0.6398263", "0.63792133", "0.6118835", "0.5982666", "0.59108806", "0.58701664", "0.5843589", "0.58371085", "0.58370405", "0.57859343", "0.5763388", "0.57505375", "0.57074255", "0.57074255", "0.5694448", "0.5693868", "0.5686472", "0.56434983", "0.56325424", "0.56190914", "0.5...
0.70301086
0
Reply to `get_block_bodies`. The items in the list are some of the blocks, minus the header. This may contain no items if no blocks were able to be returned for the `get_block_bodies` message.
def block_bodies(self, block_bodies: dict): txsCount = 0 for block_hash, block_txs in block_bodies.items(): txsCount += len(block_txs) message_size = ( txsCount * self._message_size['tx']) + self._message_size['block_bodies'] print( f'block bodies with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blocks():\n query = iroha.blocks_query()\n IrohaCrypto.sign_query(query, ADMIN_PRIVATE_KEY)\n for block in net.send_blocks_stream_query(query):\n print('\\nThe next block arrived:', block)", "def get_blocks(self):\n cmd = \"\"\" SELECT * FROM %s; \"\"\" %(TABLE_BLOCKCHAIN)\n\n ...
[ "0.60025585", "0.59955996", "0.58984625", "0.58212274", "0.56914335", "0.56767464", "0.5617726", "0.5575063", "0.5542473", "0.5520685", "0.55080897", "0.55041003", "0.5458144", "0.5450298", "0.5408181", "0.53512585", "0.53361815", "0.5318983", "0.53125757", "0.53083175", "0.5...
0.71547246
0
Check whether the returned contenttype header allow javascript evaluation.
def valid_xss_content_type(http_res): # When no content-type is returned, browsers try to display the HTML if "content-type" not in http_res.headers: return True # else only text/html will allow javascript (maybe text/plain will work for IE...) if "text/html" in http_res.headers["content-type"]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_content_type():\n return request.content_type == \"application/json\"", "def is_expected_content_type(\n response_content_type: str, expected_content_type: str\n) -> bool:\n if expected_content_type == \"application/json\":\n return json_re.match(response_content_type) is not None\n ...
[ "0.68091947", "0.6261924", "0.6238575", "0.6197111", "0.6153048", "0.60105914", "0.5998132", "0.5958995", "0.59394896", "0.59072196", "0.5850662", "0.58055866", "0.5797369", "0.5795135", "0.57799494", "0.57058144", "0.56911135", "0.5662673", "0.56519127", "0.56462157", "0.560...
0.7420473
0
builds a machine learning pipeline for doing multioutput classification for natural language processing
def __build_ml_pipeline(self, clf: MultiOutputClassifier) -> Pipeline: pipeline = Pipeline([ ('features', FeatureUnion( [('text', Pipeline( [('text_field_extractor', basic_utils.TextFieldExtractor('message')), #('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():\n \n pipeline = Pipeline([\n ('vect', CountVectorizer(tokenizer=tokenize, max_df = 0.75, max_features = 5000, ngram_range = (1, 2))),\n ('tfidf', TfidfTransformer(use_idf = True)),\n ('clf', MultiOutputClassifier(estimator=RandomForestClassifier(n_estimators = 200, m...
[ "0.7269635", "0.7223614", "0.71758586", "0.71721834", "0.70421016", "0.67618203", "0.6731274", "0.67298734", "0.6728801", "0.6720035", "0.6685355", "0.66632694", "0.66128856", "0.66001356", "0.654419", "0.65418524", "0.65418524", "0.65403044", "0.6344633", "0.63234925", "0.63...
0.7457358
0
Search the folder recursively and register all drivers
def search_folder(self, folder: str, package: Optional[str]): if package is None and folder not in sys.path: sys.path.append(folder) for root, dirs, files in os.walk(folder): for filename in files: if filename.endswith(".py"): module = filena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_drivers(dirpath):\n\n return all_drivers", "def scan ( self, **kw ):\n stats = self.STATS\n stats.scan_time.begin ( self.name )\n for subdir in os.listdir ( self.physical_location ):\n if self.has_dir ( subdir ):\n pkgdir = self._get_package_dir ( subdir )\n ...
[ "0.7119866", "0.6184198", "0.60334384", "0.5979466", "0.5932499", "0.58827335", "0.58790505", "0.58568764", "0.5856191", "0.5835559", "0.58067805", "0.57290936", "0.5720739", "0.56965643", "0.5684904", "0.5677767", "0.5673537", "0.56722844", "0.5654209", "0.5652377", "0.56423...
0.68522954
1
Find the driver class based on scheme or URL
def find_driver_class(self, scheme_or_url: str) -> Optional[Type[Driver]]: index = scheme_or_url.find(":") if index > 0: scheme = scheme_or_url[0:index] else: scheme = scheme_or_url return self.drivers.get(scheme.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_scheme(path, lookup, default):\n parsed = urlparse(path)\n class_name = lookup.get(parsed.scheme, default)\n if class_name is None:\n raise NotImplementedError(\"No implementation for scheme \" + parsed.scheme)\n return class_name", "def get_driver(drv):\n return GenericDriver.ge...
[ "0.65723485", "0.6499248", "0.6454692", "0.6250065", "0.6104751", "0.6104161", "0.60814893", "0.60748696", "0.60409766", "0.601429", "0.5995699", "0.59820664", "0.59718454", "0.59391266", "0.5863618", "0.5837359", "0.5807873", "0.5804136", "0.5783373", "0.5783373", "0.5756775...
0.8328906
0
Test initializing Dexcom with authentication errors.
def test_authentication_errors(input, output, reason): with pytest.raises(output) as e: Dexcom(input[0], input[1]) assert reason == str(e.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authentication_success():\n d = Dexcom(USERNAME, PASSWORD)\n d._validate_account()\n d._validate_session_id()", "def test_scenarios_that_should_raise_errors(self, kwargs, auth):\n try:\n auth.load_creds(**kwargs)\n # raises ValueError (zero length field name in format) ...
[ "0.7536883", "0.6618764", "0.65720403", "0.6567568", "0.6479605", "0.64513946", "0.6403451", "0.639322", "0.6381177", "0.6378649", "0.63336074", "0.6326897", "0.6320049", "0.631656", "0.631656", "0.62936324", "0.6268773", "0.6193307", "0.6182612", "0.61680126", "0.6167636", ...
0.69497186
1
Test initializing Dexcom authentication success.
def test_authentication_success(): d = Dexcom(USERNAME, PASSWORD) d._validate_account() d._validate_session_id()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n self.assertEqual(self.new_credential.app_name, \"MySpace\")\n self.assertEqual(self.new_credential.account_name, \"Ghostke99\")\n self.assertEqual(self.new_credential.account_password, \"daimaMkenya001\")", "def test_successful_login(self):\n pass", "def test_...
[ "0.70896715", "0.70448446", "0.6913479", "0.68875015", "0.6861962", "0.68409127", "0.6829145", "0.6800808", "0.6780005", "0.677897", "0.67788976", "0.67390287", "0.67075497", "0.66906357", "0.6681035", "0.66645247", "0.6635904", "0.6620065", "0.6616168", "0.65994364", "0.6593...
0.8623307
0
Ask Watson a question via the Question and Answer API
def ask_question(self, question_text, question=None): if question is not None: q = question.to_dict() else: q = WatsonQuestion(question_text).to_dict() r = requests.post(self.url + '/question', json={'question': q}, headers={ 'Accept': 'application/json', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def ask(self, ctx: commands.Context, *, question: str):\n # Check for cooldown\n await self.check_cooldown(ctx)\n\n # Create question context and contact API\n context = contexts.create_question_context(self.bot.config.data_path, question, self.bot.user.display_name)\n asyn...
[ "0.6982006", "0.66366184", "0.65982455", "0.6484298", "0.6467906", "0.6254284", "0.6234972", "0.61679643", "0.60932195", "0.6068982", "0.6028334", "0.6021317", "0.5988627", "0.5976491", "0.59740007", "0.596954", "0.589997", "0.5877126", "0.58569384", "0.58495647", "0.5845561"...
0.79859823
0
Get Audit Log handler
def createHandler(storage='DB'): # DB storage if storage == 'DB': return AuditLogDBHandler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_handler(self):\n return self._log_handler", "def detailed_log_handler(self):\n return self._detailed_log_handler", "def _get_logger(self):", "def get_logging_handler(args):\n fmt = '[%(levelname)s]%(message)s'\n log_level = args.log_level\n if args.log_level is not None:\n ...
[ "0.7557837", "0.68570656", "0.6335169", "0.6222181", "0.60627127", "0.6036631", "0.5975994", "0.5975994", "0.5965508", "0.5922614", "0.5916183", "0.59161055", "0.5912652", "0.5911005", "0.58921826", "0.5865136", "0.5830517", "0.57903546", "0.57754993", "0.57667625", "0.575333...
0.7296049
1
Retrive AuditLog object list in Page
def getAuditListPage(self, user_id=None, name=None, updated_at__gte=None, updated_at__lte=None, ip_address=None, device_name=None, folder=None, folder_id=None, sub_folder_file=None, action_type=None, recipient=None, permissions=None, per_page = 10, **kwargs): # Queryset audit_log_list = self.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_list_logs():\n if 'POST' == request.method:\n per_page = get_safe_int(request.form.get('per_page'))\n page_num = get_safe_int(request.form.get('page_num'))\n else:\n per_page = get_safe_int(request.args.get('per_page'))\n page_num = get_safe_int(request.args.get('page_num'...
[ "0.67380667", "0.63694304", "0.6348748", "0.6259094", "0.6185929", "0.6045632", "0.5973503", "0.5931732", "0.5906624", "0.58994526", "0.58616203", "0.58440197", "0.584036", "0.5824457", "0.5819354", "0.5819354", "0.58111197", "0.57998276", "0.57991874", "0.57633597", "0.57579...
0.6769918
0
Clear all old log older than
def clear_old_log(self, older_than): return self.getAuditList(updated_at__lte=older_than).delete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_log(self):\n\n self.__logs = []", "def clearOldMarketLogs(self):\n file = open(\"./data/market_logs.txt\", \"r+\")\n file.truncate(0)\n file.close()", "def cleanup_logs(self):\n\n _now = time.time()\n\n for _id in self.open_logs.keys():\n try:\n ...
[ "0.7829508", "0.7634251", "0.7384605", "0.738349", "0.7359884", "0.7332163", "0.73147887", "0.72851676", "0.7244817", "0.7117306", "0.7012207", "0.70070654", "0.6958216", "0.693574", "0.6933201", "0.6864297", "0.67587966", "0.67275167", "0.66838926", "0.65923953", "0.6564623"...
0.7730747
1
To calculate the iou scores between cnt boxes and YoLo boxes, if the score surpass the appointed threshold we suppression the box of cnt boxes.
def iou_suppression(cnt_box, yolo_box, max_threshold, min_threshold): all_boxes = [] pre_bboxes = yolo_box bboxes = cnt_box for i in range(len(pre_bboxes)): max_flag = 0 min_flag = 0 for j in range(len(bboxes)): (pre_x1, pre_y1) = (pre_bboxes[i][0], pre_bboxes[i][1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_max_suppression_all_classes(boxes, scores, labels, iou_threshold=0.5):\n excluded_indices = []\n for i in range(0,len(boxes)):\n obj1_box, _, obj1_label = boxes[i], scores[i], labels[i]\n for j in range(i+1,len(boxes)):\n obj2_box, _, obj2_label = boxes[j], scores[j], labels[...
[ "0.6989079", "0.6986459", "0.6979503", "0.690439", "0.6744849", "0.67448354", "0.6679716", "0.65084344", "0.6469569", "0.63775074", "0.63395566", "0.62891537", "0.62755764", "0.62755764", "0.6253889", "0.62130964", "0.619081", "0.6176242", "0.61600477", "0.6157221", "0.605290...
0.7582998
0
Using the cluster algorithm to classify the size of the bubble, by using the area and aspect ratio of the bounding boxes as our features.
def cluster_classify(bounding_boxes): features = [] for box_index in range(bounding_boxes.shape[0]): area, ratio = ratio_area_calculate(bounding_boxes[box_index]) features.append([area, ratio]) features_a = np.asarray(features, dtype=np.float32) print(features_a.shape) criteria = (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shapes(self):\n colours = [[None for j in range(self.cellcounts[0])] for i in range(self.cellcounts[1])]\n X = []\n backmap = {}\n rad = 3\n for k,((i,y),(j,x)) in enumerate(self.mids):\n chunk = self.img[y-rad:y+rad, x-rad:x+rad,:]\n m = np.mean(np.mean(chunk, axis=0), axis=0).ast...
[ "0.6077967", "0.60674185", "0.6008858", "0.5988396", "0.5904685", "0.58623457", "0.58226436", "0.57865345", "0.57250804", "0.57222563", "0.5692926", "0.5655735", "0.562553", "0.5602001", "0.5597305", "0.55051017", "0.5499732", "0.54962677", "0.5493699", "0.5471456", "0.546404...
0.7626389
0
Broadcasts the feats and target variables across executors. Creates an RDD with n_boot partitions. For each partition, a random sample is taken, with replacement, from the feats set and a model is fitted. The resulting coefficients and some other fit information is saved as text in JSON format and outputted to a txt fi...
def main(feats_name, targets_name, model_name, n_boot, seed_start, output_filename, train_test_flag): #load feats and targets input_dict = {} input_dict['feats'] = 'data/%s' % (feats_name) input_dict['targets'] = 'data/%s' % (targets_name) #load the feats and targets df = pd.read_csv("%s" % (in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_data(self):\n for i in range(self.bootstraps):\n df_i = self.training_df.groupby(\n self.random_effect, group_keys=False\n ).apply(\n lambda x: x.sample(len(x), replace=True)\n )\n self.models.append(self.convert(df=df_i...
[ "0.5810328", "0.5650163", "0.55065024", "0.5499339", "0.5478603", "0.5469171", "0.5454035", "0.5424438", "0.5422869", "0.5408256", "0.5369461", "0.5368882", "0.5358429", "0.5330652", "0.53242874", "0.53063244", "0.5266392", "0.52625644", "0.52511126", "0.521655", "0.52021253"...
0.6896516
0
Adds a column to dataframe with days for later calculations
def add_num_days_col(): days = [] for i in range(len(df.index)): days.append(i + 1) days.reverse() df.insert(0, "days", days, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __day(self):\n return _VirtualColumn(\n df_name=self.thisptr[\"df_name_\"],\n operator=\"day\",\n operand1=self,\n operand2=None\n )", "def addDateColum(dataFrame):\n return pd.to_datetime(dataFrame[\"client_time\"], unit='s').dt.date", "def create_date_feature_daytime(...
[ "0.6972737", "0.65158284", "0.633173", "0.617159", "0.6134685", "0.6114694", "0.6107552", "0.6006179", "0.5976064", "0.5973299", "0.573198", "0.57273674", "0.5726013", "0.56949997", "0.5689015", "0.5660589", "0.5647243", "0.56403595", "0.5579352", "0.5570239", "0.5558213", ...
0.6780104
1
Flushes the root console to the screen.
def _flush(): libtcod.console_flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_console(cls):\n print('\\n' * 200)", "def clear_screen():\n print('\\n' * TERMINAL_HEIGHT)", "def clear_console():\n os.system('cls' if os.name == 'nt' else 'clear')", "def clear_console():\n os.system('cls' if os.name == 'nt' else \"clear\")", "def clear_screen():\n os.system(...
[ "0.74344736", "0.7243728", "0.71696347", "0.7133795", "0.71323425", "0.7118469", "0.7047784", "0.6978088", "0.69701266", "0.6964687", "0.6958009", "0.6958009", "0.6954441", "0.6937887", "0.69366187", "0.69366187", "0.69359", "0.6935286", "0.6909922", "0.6878773", "0.68648237"...
0.75925297
0
find all item in redis
def findall(self, key_list): for i in range(3): try: return self.redis_handler.mget(key_list) except: continue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all():\n # results = [String.from_dict(redis.hgetall(key)) for key in redis.keys() if key != 'index']\n results = []\n for key in redis_store.keys(String.generate_key('*')):\n data = pickle.loads(redis_store.get(key))\n string = String(data['key']).deserialize(data)\n...
[ "0.6733469", "0.6714285", "0.65926605", "0.6288928", "0.6144279", "0.58816123", "0.58655906", "0.5840032", "0.5831491", "0.57784694", "0.57565993", "0.5693411", "0.5674198", "0.56674504", "0.5646221", "0.5632638", "0.56318295", "0.56074804", "0.5578475", "0.5577699", "0.55544...
0.6747067
0
find a item in redis
def find(self, key): return self.redis_handler.get(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(key):\n key = String.generate_key(key)\n if redis_store.exists(key):\n data = pickle.loads(redis_store.get(key))\n string = String(key=data['key'], value= data['value']).deserialize(data)\n return string\n return None", "def search_db(self, key, item...
[ "0.6900045", "0.680785", "0.6459684", "0.64498824", "0.64484715", "0.63532203", "0.6226679", "0.62049645", "0.6184525", "0.6174242", "0.61580795", "0.6134529", "0.61290133", "0.6114064", "0.6092683", "0.60672754", "0.60466063", "0.60417306", "0.6018264", "0.60145307", "0.5982...
0.7702426
0
set a item in redis
def set(self, key, value): return self.redis_handler.set(key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _set(self, key, value, ttl=None):\n with await self._connect() as redis:\n return await redis.set(key, value, expire=ttl)", "def set_to_redis(self, key: str, value):\n self.redis_client.hset(self.root_path, key, value)", "def put(self, item): \n self.__db.rpush(self.k...
[ "0.7237973", "0.72274715", "0.71421015", "0.69426495", "0.67930114", "0.6736293", "0.67286867", "0.6625527", "0.65879625", "0.65843797", "0.65695363", "0.65695363", "0.65531176", "0.6495575", "0.64573854", "0.64379275", "0.6414918", "0.6401345", "0.63791215", "0.6373842", "0....
0.77541155
0
delete a item from redis
def delete(self, key): return self.redis_handler.delete(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _delete(self, key):\n with await self._connect() as redis:\n return await redis.delete(key)", "def delete(self):\n redis_store.delete(String.generate_key(self.key))", "def __delitem__(self, key):\r\n self.client.delete(id=key, ignore=[404], **self.kwargs)", "def dele...
[ "0.741887", "0.73217744", "0.70651907", "0.70398045", "0.69535375", "0.6834558", "0.6811334", "0.6696587", "0.6679723", "0.6679129", "0.6663745", "0.66577464", "0.6569222", "0.65407175", "0.65385026", "0.65385026", "0.6522376", "0.651613", "0.65159726", "0.65118474", "0.64322...
0.739435
1
Define spectrometer default specs > FlameS
def _default_specs(self): # Spectrometer specs self.model = "Flame-S" # Spectrometer model self.fov = 1 # Field of view fo spectrometer (radius of FOV) self.ILS = None # Number array holding instrument line shape (possibly don't hold this here?) se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _default_specs(self):\n # Spectrometer specs\n self.model = \"Flame-S\" # Spectrometer model\n self.fov = None # Field of view fo spectrometer\n self.ILS = None # Number array holding instrument line shape (possibly don't hold this here?)\n self.p...
[ "0.7413315", "0.6486956", "0.63442695", "0.6205281", "0.5809148", "0.5750546", "0.57413244", "0.5716522", "0.56452537", "0.562184", "0.55860764", "0.5564711", "0.5519998", "0.55020934", "0.55013305", "0.5500549", "0.54811794", "0.5477078", "0.5446217", "0.54205394", "0.541486...
0.7373845
1
Calculates focal length assuming a single round fiber of defined dimensions
def estimate_focal_length(self): fl = (self.fiber_diameter / 2) / np.tan(np.deg2rad(self.fov / 2)) return fl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def focal_length(self):\n\n return self.f * self.diameter", "def focal( self, fields, fun ):\n raise NotImplementedError(\"focal\")", "def frequency_radius(fx, fy, ft, ft_0=ft_0, clean_division=False):\n if ft_0==np.inf:\n f_radius2 = fx**2 + fy**2\n else:\n f_radius2 = fx**2 ...
[ "0.79014164", "0.60215604", "0.5981358", "0.588652", "0.575519", "0.57442456", "0.56969434", "0.5626481", "0.56007284", "0.5589518", "0.55743253", "0.555603", "0.5549697", "0.55395865", "0.55309623", "0.55236405", "0.5514437", "0.5477015", "0.5451845", "0.5442273", "0.5426293...
0.75817
1
Load spectrometer specifications from file
def load_specs(self, filename): self.filename = filename # Add loading functionality here
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromFile(self,fn = None):\n\n while True:\n\n if fn == None:\n fn = getFilename(\"Spectrometer file\",\"spec\")\n else:\n fn = getExpandedFilename(fn) # Sort out logicals\n if not fn.endswith(\"spec\"): # Append \".spec\" if not giv...
[ "0.660055", "0.65556073", "0.6536059", "0.6499446", "0.64870816", "0.64680994", "0.6439245", "0.6430662", "0.63703877", "0.6331795", "0.62849426", "0.62726784", "0.62101686", "0.62045944", "0.61871874", "0.6169471", "0.61566246", "0.6142039", "0.61395884", "0.6138183", "0.609...
0.6658959
1
Save spectrometer specifications to file
def save_specs(self, filename): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_fits(self, filename, comment=None, overwrite = False):\n\n\n hdu = fits.PrimaryHDU(self.flux)\n hdu.header = self.header\n\n # Update header information\n crval = self.dispersion[0]\n cd = self.dispersion[1]-self.dispersion[0]\n crpix = 1\n\n hdu.header...
[ "0.6595856", "0.6533776", "0.6499723", "0.6447519", "0.6442962", "0.64413184", "0.6426633", "0.6425785", "0.6320316", "0.63152426", "0.63152426", "0.61717904", "0.61564285", "0.61535543", "0.6131241", "0.61176497", "0.6089699", "0.5963254", "0.59546113", "0.59428746", "0.5942...
0.7411746
1
Update _max_DN when bit_depth is defined (two are intrinsically linked)
def bit_depth(self, value): self._bit_depth = value self._max_DN = (2 ** self.bit_depth) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_max_search_depth(self, depth):\n if self.max_search_depth < depth:\n self.max_search_depth = depth", "def reset_max_depth(self) -> None:\n # The max depth is now calculated on the fly, so this is a no-op.\n pass", "def get_max_dmag_from_depth(depth):\n return 2.5 *...
[ "0.65636545", "0.6207876", "0.61711556", "0.60789186", "0.59363323", "0.5929094", "0.58601475", "0.5837854", "0.57501835", "0.56456083", "0.5645322", "0.5613516", "0.5599527", "0.55671525", "0.552152", "0.5509521", "0.54828936", "0.54400885", "0.54004043", "0.5398635", "0.539...
0.7328129
0
Define spectrometer default specs > FlameS
def _default_specs(self): # Spectrometer specs self.model = "Flame-S" # Spectrometer model self.fov = None # Field of view fo spectrometer self.ILS = None # Number array holding instrument line shape (possibly don't hold this here?) self.pix_num = 204...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _default_specs(self):\n # Spectrometer specs\n self.model = \"Flame-S\" # Spectrometer model\n self.fov = 1 # Field of view fo spectrometer (radius of FOV)\n self.ILS = None # Number array holding instrument line shape (possibly don't hold this here?)...
[ "0.7373845", "0.6486956", "0.63442695", "0.6205281", "0.5809148", "0.5750546", "0.57413244", "0.5716522", "0.56452537", "0.562184", "0.55860764", "0.5564711", "0.5519998", "0.55020934", "0.55013305", "0.5500549", "0.54811794", "0.5477078", "0.5446217", "0.54205394", "0.541486...
0.7413315
0
Load spectrometer specifications from file
def load_specs(self, filename): self.filename = filename # Add loading functionality here
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromFile(self,fn = None):\n\n while True:\n\n if fn == None:\n fn = getFilename(\"Spectrometer file\",\"spec\")\n else:\n fn = getExpandedFilename(fn) # Sort out logicals\n if not fn.endswith(\"spec\"): # Append \".spec\" if not giv...
[ "0.660055", "0.65556073", "0.6536059", "0.6499446", "0.64870816", "0.64680994", "0.6439245", "0.6430662", "0.63703877", "0.6331795", "0.62849426", "0.62726784", "0.62101686", "0.62045944", "0.61871874", "0.6169471", "0.61566246", "0.6142039", "0.61395884", "0.6138183", "0.609...
0.6658959
0
Save spectrometer specifications to file
def save_specs(self, filename): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_fits(self, filename, comment=None, overwrite = False):\n\n\n hdu = fits.PrimaryHDU(self.flux)\n hdu.header = self.header\n\n # Update header information\n crval = self.dispersion[0]\n cd = self.dispersion[1]-self.dispersion[0]\n crpix = 1\n\n hdu.header...
[ "0.6595856", "0.6533776", "0.6499723", "0.6447519", "0.6442962", "0.64413184", "0.6426633", "0.6425785", "0.6320316", "0.63152426", "0.63152426", "0.61717904", "0.61564285", "0.61535543", "0.6131241", "0.61176497", "0.6089699", "0.5963254", "0.59546113", "0.59428746", "0.5942...
0.7411746
0
Update _max_DN when bit_depth is defined (two are intrinsically linked)
def bit_depth(self, value): self._bit_depth = value self._max_DN = (2 ** self.bit_depth) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_max_search_depth(self, depth):\n if self.max_search_depth < depth:\n self.max_search_depth = depth", "def reset_max_depth(self) -> None:\n # The max depth is now calculated on the fly, so this is a no-op.\n pass", "def get_max_dmag_from_depth(depth):\n return 2.5 *...
[ "0.65636545", "0.6207876", "0.61711556", "0.60789186", "0.59363323", "0.5929094", "0.58601475", "0.5837854", "0.57501835", "0.56456083", "0.5645322", "0.5613516", "0.5599527", "0.55671525", "0.552152", "0.5509521", "0.54828936", "0.54400885", "0.54004043", "0.5398635", "0.539...
0.7328129
1
Read all files in folder recursively and organize them into a list of (filename, sql) tuples
def read_files(folder): print_header("READING FILES FROM FOLDER (RECURSIVE)", "=") files = [] for dirpath, dirnames, filenames in os.walk(folder): if not dirpath.endswith("updates"): for filename in filenames: root, ext = os.path.splitext(filename) if ext....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sqls_from_dir(self, dir_path):\n sql_list = []\n files = os.listdir(dir_path)\n for create_file in files:\n if not create_file.startswith(\".\"):\n file_path = \"%s/%s\" % (dir_path, create_file)\n sql = self.get_sql_from_file(file_path)\n ...
[ "0.76059794", "0.65634596", "0.6449635", "0.6360225", "0.6299824", "0.62733024", "0.6213105", "0.61984193", "0.619503", "0.60957974", "0.60893697", "0.6081995", "0.6052015", "0.6038835", "0.60251546", "0.600837", "0.60078484", "0.6001441", "0.5988938", "0.5950044", "0.5942474...
0.8012706
0
Read move_files part of dbkit_rules.json file if it exists
def read_move_files(folder): dbCreateFileName = os.path.join(folder, "dbkit_rules.json") if os.path.exists(dbCreateFileName): print_header("READING MOVE FILES (dbkit_rules.json)", "=") with open(dbCreateFileName, "r") as f: dbCreate = json.load(f) move_files = dbCreate["move...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_file_movement(src:str, dest:str, is_move=False)->bool:\n debug_str = \"move\" if (is_move) else \"copy\"\n \n objects = _list_objects(src) # list objects\n for obj in objects:\n if _is_dir(dest) or _is_dir(src):\n temp_dest = _append_object(dest, _get_dest_obj_name(src, o...
[ "0.51995945", "0.51787287", "0.5144674", "0.5072162", "0.50150293", "0.49849713", "0.4915871", "0.49032304", "0.4850157", "0.4784332", "0.47758853", "0.47756916", "0.4771178", "0.4770833", "0.47643083", "0.4755832", "0.4753253", "0.4725161", "0.47226143", "0.4707663", "0.4707...
0.79636776
0
organize files into a scripts dict
def files_to_scripts(files, move_files): print_header("ORGANIZING FILES TO SCRIPTS DICT", "=") scripts = {} scripts["schemas"] = [] scripts["functions 0"] = [] scripts["functions"] = [] scripts["types"] = [] scripts["tables"] = [] scripts["views 0"] = [] scripts["views"] = [] sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_files(self):\n files = {}\n for fn_ in self.opts[\"src\"]:\n if os.path.isfile(fn_):\n files.update(self._file_dict(fn_))\n elif os.path.isdir(fn_):\n salt.utils.stringutils.print_cli(\n \"{} is a directory, only files a...
[ "0.60213524", "0.59225297", "0.5880797", "0.575963", "0.57571673", "0.571234", "0.57104003", "0.5703287", "0.5679858", "0.5656605", "0.5595563", "0.5567678", "0.55513555", "0.5537289", "0.5536284", "0.5535029", "0.5534358", "0.55050445", "0.5504044", "0.55035526", "0.55027443...
0.74946475
0
Initialize a `Flo` with the given `targets` channels. If `loop` is not given, a new loop will be created on the current thread, via `get_default_ioloop`.
def __init__(self, targets, loop=None): self.count = itertools.count() self.targets = {} if loop is None: loop = self.get_default_ioloop() self.loop = loop self.add_targets(targets)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_factory(targets, user_args):\n finished = []\n if user_args.config_file is not None or user_args.cli_apikeys is not None:\n api_keys = get_config_from_file(user_args)\n else:\n api_keys = None\n init_targets_len = len(targets)\n\n for counter, t in enumerate(targets):\n ...
[ "0.54357237", "0.50995916", "0.49078053", "0.48489243", "0.47902542", "0.4783872", "0.4773629", "0.46602944", "0.46581155", "0.46219262", "0.45824376", "0.45799193", "0.45532942", "0.45501685", "0.45226622", "0.45145828", "0.45042315", "0.4499752", "0.4499008", "0.44874325", ...
0.65605944
0
Counts the number of lower and upper case letters in a string
def case_count(in_string): uppercase_count = 0 lowercase_count = 0 for letter in in_string: if letter != " ": if letter == letter.upper(): uppercase_count += 1 else: lowercase_count += 1 return [lowercase_count, uppercase_count]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_upper_case(message):\n return sum([1 for c in message if c.isupper()])", "def count_letters(wordform: str):\n return len(re.findall('[a-z]', wordform))", "def count_alpha(word):\n\n alpha = re.compile(r'[a-z]', re.IGNORECASE)\n return len(alpha.findall(word))", "def letterSpace(text):\n...
[ "0.7406172", "0.73297775", "0.7275172", "0.72189844", "0.7165477", "0.709664", "0.7087264", "0.70732135", "0.70033956", "0.69842595", "0.6920518", "0.6881893", "0.68056023", "0.6789385", "0.6762092", "0.67230916", "0.6690782", "0.66434985", "0.661653", "0.65623677", "0.649265...
0.76858807
0
Creates a new list of even elements of the input list
def only_even(in_list): new_list = [] for l in in_list: if l % 2 == 0: new_list.append(l) return new_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_only(some_list):\n # This function will take a list of integer and return a list of even number in original list.\n new_list = []\n for d in some_list:\n if d%2 == 0: # if it even add in new list.\n new_list.append(d)\n return new_list", "def even_only(lst):\n ans = []\n...
[ "0.8216466", "0.76366603", "0.73949593", "0.7331615", "0.7238623", "0.72060996", "0.7156833", "0.6931347", "0.6891198", "0.68805885", "0.6873055", "0.6799956", "0.6781932", "0.670009", "0.66581994", "0.66321725", "0.65691346", "0.65464514", "0.65379465", "0.6520835", "0.62976...
0.8289554
0
Makes a list of primes less than n
def make_primes(n): out_list = [] for i in range(2, n): if is_prime(i): out_list.append(i) return out_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]", "def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range(3, n, 2):\n\t\tis_prime = True\n\t\tfor j in list_of_primes:\n\t\t\tif i%j == 0:\n\t\t\t\tis_prime = False\n\t\t\t\tbreak\n\t\tif is...
[ "0.8713316", "0.8503495", "0.8476378", "0.83455896", "0.8327164", "0.8288371", "0.8264936", "0.82252353", "0.8222862", "0.8146621", "0.81397367", "0.8082055", "0.8082055", "0.80769616", "0.8067349", "0.80551946", "0.799892", "0.79690963", "0.7966319", "0.7964421", "0.79084826...
0.8633674
1
Update hypno data from hypno score.
def _fcn_score_to_hypno(self): if self._scoreSet: # Reset hypnogram : self._hypno = np.zeros((len(self._time)), dtype=np.float32) # Loop over table row : for k in range(self._scoreTable.rowCount()): # Get tstart / tend / stage : tst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fcn_hypno_to_score(self):\n self._hypno = self._hyp.gui_to_hyp()\n # Avoid updating data while setting cell :\n self._scoreSet = False\n items = ['Wake', 'N1', 'N2', 'N3', 'REM', 'Art']\n # Remove every info in the table :\n self._scoreTable.setRowCount(0)\n # ...
[ "0.69021547", "0.6448774", "0.5955535", "0.56884146", "0.56210446", "0.55622756", "0.5517439", "0.5504259", "0.5499298", "0.5454883", "0.54529893", "0.5436108", "0.5409755", "0.53732544", "0.5350836", "0.5338595", "0.53281176", "0.531821", "0.5317143", "0.52891666", "0.526873...
0.7473255
0
Get the encoding type out of given item from the file.
def _get_encoding_type(file: str) -> Encoding: try: with open(file, 'r') as f: f.read() except UnicodeDecodeError: encoding = Encoding.DER else: encoding = Encoding.PEM return encoding
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoding_type(file): \n with open(file, 'rb') as f:\n rawdata = f.read()\n return detect(rawdata)['encoding']", "def getType(file):\n\n with open(file, \"r\") as result:\n return result.readline().strip()", "def get_encoding(fname):\n file = open(fname, 'rb')\n encoding = c...
[ "0.7261095", "0.62854016", "0.6118274", "0.6100573", "0.6017653", "0.5980837", "0.594074", "0.5851768", "0.5766606", "0.5754866", "0.57493925", "0.57193446", "0.5664526", "0.56490785", "0.5646268", "0.5622929", "0.561016", "0.5590955", "0.558657", "0.5581057", "0.5568738", ...
0.6800192
1
Creates an indicator bound to rough estimation of a trader's balance if cleared
def InstEfficiency(trader): return IndicatorBase(OnTraded(trader), rough_balance(trader))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw(amt) :\r\n global bal \r\n bal_in = bal\r\n\t#PREMISES FOR NEXT LINE: \r\n\t# (amt >= 0)\r\n\t# (bal >= 0)\r\n\t# (bal == bal_in)\r\n\t\"\"\"{1.OK amt >= 0\tpremise\r\n\t\t2.OK bal >= 0\tpremise\r\n\t\t3.OK bal == bal_in\tpremise\r\n\t}\"\"\"\r\n\t#PREMISES FOR NEXT LINE: \r\n\t# (bal == bal_in)...
[ "0.57472146", "0.5685068", "0.56540275", "0.5563497", "0.555056", "0.55295676", "0.5505332", "0.54965943", "0.5492877", "0.5469", "0.5445614", "0.54413164", "0.5430309", "0.53258413", "0.5317277", "0.52970695", "0.5282539", "0.52755755", "0.5257082", "0.5240821", "0.5200548",...
0.61001307
0
Trivial view to serve the `graphiql.html` file.
def graphiql(request): del request graphiql_filepath = pathlib.Path(__file__).absolute().parent / "graphiql.html" with open(graphiql_filepath) as f: return django.http.response.HttpResponse(f.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphs():\n return render_template(\"graphs.html\")", "def home():\n return render_template(\"d3_graph.html\")", "def graphing1():\n return render_template('graph1.html')", "def graph(graph_file):\n return render_template(graph_file)", "def get(self):\n self.render('view.html')", "...
[ "0.6823622", "0.67768425", "0.671672", "0.6425824", "0.64172035", "0.6391936", "0.63784313", "0.6268856", "0.6258848", "0.625319", "0.62249345", "0.6219032", "0.62177974", "0.6196758", "0.61770403", "0.61762196", "0.6161369", "0.61571264", "0.61453485", "0.61381763", "0.61381...
0.8503598
0
Create a new trial if all the required arguments are satisfied. To provide a better user experience if not all arguments are provided a delayed trials is created that holds all the data provided and will create the trial once all arguments are ready. Currently only `arguments` i.e the parameters of the experience is re...
def _new_trial(self, force=False, parameters=None, **kwargs): if isinstance(parameters, Namespace): parameters = dict(**vars(parameters)) if self.trial is not None and not is_delayed_call(self.trial) and not force: info(f'Trial is already set, to override use force=True') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt(self, console: io.IO, step: str,\n args: Dict[str, Any]) -> Dict[str, Any]:\n new_args = dict(args)\n if self._is_valid_passed_arg(console, step, args.get(self.PARAMETER),\n self._validate):\n return new_args\n\n project_c...
[ "0.5727646", "0.56166524", "0.5574033", "0.5554127", "0.5523372", "0.54420215", "0.5434806", "0.54256094", "0.53899026", "0.5374215", "0.53558785", "0.53427327", "0.5329406", "0.5288344", "0.5258452", "0.5238903", "0.5199388", "0.5165366", "0.5161996", "0.5150343", "0.5129981...
0.62850493
0
Helper function that returns a cuda device if available else a cpu
def get_device(): import torch if torch.cuda.is_available(): return torch.device('cuda') return torch.device('cpu')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device():\n return torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", "def finddevice():\n\n return next((device for device in [\"xpu\"] if hasattr(torch, device) and getattr(torch, device).is_available()), None)", "def get_available_device():\n if torch.cuda.is_available():\n ...
[ "0.8213414", "0.80462164", "0.7954685", "0.79011756", "0.77807885", "0.77807885", "0.77807885", "0.77807885", "0.7742657", "0.77195877", "0.7707996", "0.7697498", "0.76964045", "0.7692771", "0.7640589", "0.7599912", "0.7544454", "0.75261575", "0.7518505", "0.75091654", "0.743...
0.821113
1
pyzmq_version() Return the version of pyzmq as a string.
def pyzmq_version(): if __revision__: return '@'.join([__version__,__revision__[:6]]) else: return __version__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()", "def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()", "def pyzmq_version_info():\n return version_info", "def pyzmq_version_info():\n import re\n parts = re.findall('[0-9]+', __version__)\n parts = [ int(p) for p in ...
[ "0.84373516", "0.84373516", "0.80661434", "0.6667663", "0.6549085", "0.6435804", "0.6347818", "0.6327694", "0.6327694", "0.6276691", "0.6276691", "0.6200533", "0.61859506", "0.61743695", "0.6147893", "0.61379194", "0.60783356", "0.6067122", "0.6050079", "0.6044156", "0.604415...
0.8878596
0
pyzmq_version_info() Return the pyzmq version as a tuple of numbers If pyzmq is a dev version, the patchversion will be `inf`. This helps comparison of version tuples in Python 3, where strint comparison is no longer legal for some reason.
def pyzmq_version_info(): import re parts = re.findall('[0-9]+', __version__) parts = [ int(p) for p in parts ] if 'dev' in __version__: parts.append(float('inf')) return tuple(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyzmq_version_info():\n return version_info", "def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__", "def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n ...
[ "0.7976728", "0.72775203", "0.72775203", "0.6959455", "0.6959455", "0.6286459", "0.62027466", "0.57732135", "0.5685825", "0.5682888", "0.56416863", "0.5622866", "0.5595703", "0.55885005", "0.5584318", "0.55530846", "0.5501937", "0.54973155", "0.5417558", "0.53884226", "0.5356...
0.86118484
0
zmq_version() Return the version of ZeroMQ itself as a string.
def zmq_version(): return "%i.%i.%i" % zmq_version_info()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__", "def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__", "def pyzmq_version_info():\n...
[ "0.8685192", "0.8685192", "0.80834395", "0.674612", "0.6704914", "0.6492072", "0.6461652", "0.6461652", "0.6400034", "0.6352624", "0.63269675", "0.63269675", "0.63269675", "0.63269675", "0.63269675", "0.63120574", "0.6306926", "0.6306926", "0.62852186", "0.62732023", "0.62667...
0.87617785
0
Build list of folder names from a hierarchical dictionary.
def build_folder_names(result: Dict[str, Any], folder_name: str = "") -> List[Any]: folder_name = "/".join((folder_name, result.get("name", ""))).replace("//", "/") folders = [folder_name] if not result.get("children"): return folders for child in result["children"]: folders.extend(buil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _WalkFolders(self, folder_dict, parent):\n entries = folder_dict.keys()\n entries.sort()\n for e in entries:\n if folder_dict[e]:\n # Folder\n n_subfolder = self.doc.createElement('Filter')\n n_subfolder.setAttribute('Name', e)\n ...
[ "0.6111665", "0.582685", "0.5806846", "0.56202227", "0.56113344", "0.5601656", "0.5575259", "0.5546297", "0.5527751", "0.5522885", "0.54945767", "0.5400721", "0.5344008", "0.5344008", "0.5344008", "0.5340468", "0.5332155", "0.53121126", "0.53121126", "0.5288247", "0.52707154"...
0.7082711
0
Raise if there are more keyword arguments than understood.
def raise_on_kwargs_not_empty(kwargs): if kwargs: raise SyntaxWarning(f"Unknown arguments: {kwargs}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __checkArgs(self, kwargs):\n requiredArgs = self.__class__.__requiredArgs + \\\n self.__class__.__singleCompArgs if self.singleComp else\\\n self.__class__.__requiredArgs + self.__class__.__doubleCompArgs\n for arg in requiredArgs:\n if arg not in kwargs:\n ...
[ "0.7620842", "0.72032654", "0.7063662", "0.6778574", "0.6744365", "0.6722741", "0.66707915", "0.66231114", "0.6580309", "0.6487475", "0.6486354", "0.64717144", "0.6466011", "0.64350444", "0.6343345", "0.63406086", "0.6261273", "0.6232237", "0.62009984", "0.61015946", "0.60702...
0.73150235
1
Update a multiline custom field (html) with additional or new values.
def update_multiline_field(current_content: str, request_data: Dict[str, Any], key: str, new_values: List[str]) -> None: if new_values and new_values[0] == "-": combined_values = "<br>".join(list(dict.fromkeys(new_values[1:]).keys())) else: if all( value in current_content for value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_html():\n # save the new html_raw\n entry = request.form.get(\"entry\")\n entry_dict[entry]['html_raw'] = request.form.get(\"raw\")\n entry_dict[entry]['html'] = raw_to_html(entry, entry_dict[entry]['html_raw'])\n # save into pkl file\n with open(entry_dict_path, ...
[ "0.59086025", "0.5828451", "0.5679753", "0.55588466", "0.5530373", "0.54863334", "0.5480348", "0.5469625", "0.54385704", "0.5408135", "0.53908247", "0.53588456", "0.5333453", "0.5258297", "0.523771", "0.5234923", "0.52144086", "0.52082866", "0.5194152", "0.5179289", "0.517187...
0.7416428
0
Create and save yellowbrick visualizer image for model specificed
def create_img(X_train, X_test, y_train, y_test, labels, model, visualizer, upsampled, IMG_OUTPUT_FILEPATH): viz = Visualizer(X_train, X_test, y_train, y_test, labels, model, visualizer, upsampled=upsampled) viz.evaluate() if upsampled == True: outpath_ = IMG_OUTPUT_FILEPATH + str(model).split('('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_callback(model):\n\n # Get samples & Display them\n pred_img = model.predict([masked, mask])\n pred_time = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')\n\n # Clear current output and display test images\n combine_imgs = np.concatenate([pred_img, masked, mask, ori], axis=2)\n for...
[ "0.66604346", "0.6626089", "0.66033375", "0.654884", "0.6471268", "0.6439516", "0.6375745", "0.6337654", "0.6334921", "0.6328005", "0.62666893", "0.6247176", "0.6222995", "0.6202766", "0.6198136", "0.6175613", "0.6159791", "0.61297286", "0.61181533", "0.6102077", "0.60640174"...
0.6954059
0
Ensure a new ad can be added to the database.
def test_add_ad(self): with self.client: data = {'category': 'food'} data = {key: str(value) for key, value in data.items()} data['image'] = (io.BytesIO(b"ad.png"), 'ad.png') response = self.client.post( '/ads', data=data, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_article(article):\r\n\tcollection=create_database_connection()\r\n\tinsert_article(collection,article)", "def test_shorturl_not_saving_without_longurl(self):\n db.session.add(self.short_url)\n with self.assertRaises(sqlalchemy.exc.IntegrityError):\n db.session.commit()", "...
[ "0.6350939", "0.5799389", "0.57665575", "0.56594", "0.56178635", "0.56089073", "0.5568797", "0.5566294", "0.5514329", "0.55101174", "0.54969716", "0.54820824", "0.5454322", "0.5448606", "0.5436308", "0.5435855", "0.542952", "0.5428207", "0.5416877", "0.53936774", "0.53893906"...
0.58857304
1