query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Callback method which provides multiple sets of hyperparameters. This method will get called when the framework is about to launch one or more new trials.
def generate_multiple_parameters(self, parameter_id_list, **kwargs): result = [] for parameter_id in parameter_id_list: try: _logger.debug("generating param for %s", parameter_id) res = self.generate_parameters(parameter_id, **kwargs) except nni.NoMoreTrialError: return result result.append(res) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hyperparams(self):", "def set_hyperparams(self, params):", "def set_hyperparams(use_defaults):\n if use_defaults:\n n_neurons, n_hidden, n_steps, k_prob = default_hyperparams()\n return n_neurons, n_hidden, n_steps, k_prob\n\n print (\"Select number of neurons in recurrent layer (de...
[ "0.6093139", "0.60821086", "0.6056654", "0.6048801", "0.5946009", "0.5892329", "0.58283186", "0.5769709", "0.5693694", "0.5682708", "0.5671747", "0.56698847", "0.5659107", "0.56570727", "0.5655058", "0.55922323", "0.55687296", "0.55628824", "0.55287516", "0.55127597", "0.5509...
0.5127206
91
Abstract method invoked when a trial reports its final result. Must override. This method only listens to results of algorithmgenerated hyperparameters. Currently customized trials added from web UI will not report result to this method.
def receive_trial_result(self, parameter_id, parameters, value, **kwargs): raise NotImplementedError('Tuner: receive_trial_result not implemented')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_result(self, trial_runner, trial, result):\n\n raise NotImplementedError", "def on_trial_result(self, trial_id: str, result: Dict):\r\n pass", "def on_trial_result(self, trial: Trial, result: Dict[str, Any]) -> str:\n return SchedulerDecision.CONTINUE", "def on_trial_complet...
[ "0.7683167", "0.727441", "0.7006758", "0.697437", "0.6819828", "0.66941464", "0.6415118", "0.6251354", "0.61040443", "0.6080441", "0.60787594", "0.60784376", "0.60360926", "0.6024143", "0.5920114", "0.5916876", "0.5889306", "0.5887554", "0.58353734", "0.5814758", "0.5813528",...
0.6768137
5
Abstract method invoked when a trial is completed or terminated. Do nothing by default.
def trial_end(self, parameter_id, success, **kwargs):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_trial_complete(self, trial_runner, trial, result):\n\n raise NotImplementedError", "def on_trial_complete(self, trial: Trial, result: Dict[str, Any]):\n pass", "def trial(self):\n pass", "def on_trial_complete(self,\r\n trial_id: str,\r\n ...
[ "0.7465205", "0.7200161", "0.68019694", "0.6782522", "0.66770226", "0.66569257", "0.6578445", "0.6572621", "0.6555807", "0.65140676", "0.64149064", "0.6342137", "0.63419366", "0.63419366", "0.6279795", "0.62722665", "0.62639666", "0.62104183", "0.6204361", "0.6177283", "0.616...
0.7370623
1
Abstract method for updating the search space. Must override. Tuners are advised to support updating search space at runtime. If a tuner can only set search space once before generating first hyperparameters, it should explicitly document this behaviour.
def update_search_space(self, search_space): raise NotImplementedError('Tuner: update_search_space not implemented')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSearch(self, authenticationToken, search):\r\n pass", "def set_search_space(self,\n search_space_size: int):\n self.search_space = np.linspace(0, 1, search_space_size)", "def _update_search_info(self):\n page_size = int(self._search_data['pageSize'])\n ...
[ "0.6237321", "0.61739534", "0.6061544", "0.57943547", "0.57356995", "0.5705272", "0.56967473", "0.5678522", "0.5660615", "0.5633325", "0.562737", "0.5563", "0.55493927", "0.5500955", "0.54821765", "0.545939", "0.545895", "0.5434083", "0.542714", "0.5413401", "0.5410262", "0...
0.78161246
0
Internal API under revising, not recommended for end users.
def load_checkpoint(self): checkpoin_path = self.get_checkpoint_path() _logger.info('Load checkpoint ignored by tuner, checkpoint path: %s', checkpoin_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n\t\treturn", "def __call__(self):\n raise NotImplementedError", "def use(self):", "def __call__(self) -> None:", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(self):\n raise NotImplementedError()", "def __call__( self ):\n ...
[ "0.69528687", "0.69337785", "0.69062424", "0.6883205", "0.6824363", "0.6824363", "0.66919035", "0.66813666", "0.66731226", "0.643567", "0.6399171", "0.6399171", "0.6366321", "0.6341558", "0.6322771", "0.6309366", "0.6309366", "0.6309366", "0.6309366", "0.6309366", "0.6233418"...
0.0
-1
Internal API under revising, not recommended for end users.
def save_checkpoint(self): checkpoin_path = self.get_checkpoint_path() _logger.info('Save checkpoint ignored by tuner, checkpoint path: %s', checkpoin_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n\t\treturn", "def __call__(self):\n raise NotImplementedError", "def use(self):", "def __call__(self) -> None:", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(self):\n raise NotImplementedError()", "def __call__( self ):\n ...
[ "0.69528687", "0.69337785", "0.69062424", "0.6883205", "0.6824363", "0.6824363", "0.66919035", "0.66813666", "0.66731226", "0.643567", "0.6399171", "0.6399171", "0.6366321", "0.6341558", "0.6322771", "0.6309366", "0.6309366", "0.6309366", "0.6309366", "0.6309366", "0.6233418"...
0.0
-1
Internal API under revising, not recommended for end users.
def import_data(self, data): # Import additional data for tuning # data: a list of dictionarys, each of which has at least two keys, 'parameter' and 'value' pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n\t\treturn", "def __call__(self):\n raise NotImplementedError", "def use(self):", "def __call__(self) -> None:", "def __call__(self):\n pass", "def __call__(self):\n pass", "def __call__(self):\n raise NotImplementedError()", "def __call__( self ):\n ...
[ "0.6952133", "0.6933044", "0.69058836", "0.6883263", "0.6823979", "0.6823979", "0.6691241", "0.66809124", "0.66732705", "0.6436257", "0.6400146", "0.6400146", "0.6365986", "0.63412696", "0.6322178", "0.63098705", "0.63098705", "0.63098705", "0.63098705", "0.63098705", "0.6231...
0.0
-1
rejects outliers more than 2 standard deviations from the median
def reject_outliers(data, m=2., std=None): median = np.median(data) keep = [] if std is None: std = np.std(data) for item in data: if abs(item - median) > m * std: pass else: keep.append(item) return keep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_outliers(data, m):\n d = np.abs(data - np.nanmedian(data))\n mdev = np.nanmedian(d)\n s = d/mdev if mdev else 0.\n return np.where(s < m)", "def Reject_Outliers_With_Median(x, m = 3.):\r\n\r\n N = len(x);\r\n median = np.median(x);\r\n\r\n dev = np.abs(x-median)\r\n MAD = -1/(m...
[ "0.8004999", "0.79847676", "0.78939694", "0.78283536", "0.738809", "0.7329081", "0.73082936", "0.7248964", "0.72328097", "0.7188622", "0.71676505", "0.7041594", "0.6996292", "0.69633675", "0.6947517", "0.6941564", "0.69394505", "0.6929792", "0.6907235", "0.685433", "0.6829677...
0.7908967
2
helper function which sends a password reset email to the inputted user
def send_password_reset(user): _log('++ sending password reset email for: {} {}'.format(user.first_name, user.last_name)) secret_string = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(20)) # if local set the domain to localhost if ENV_DICT['ENVIRON'] == 'LOCAL': secret_link = 'http://localhost:8080/reset/{}/'.format(secret_string) # otherwise use the subdomain of the tenancy else: secret_link = 'http://{}.cpisearch.io/reset/{}/'.format(user.tenancy, secret_string) reset_link_object = PasswordResetLink( user_id=user.user_id, secret_link=secret_string, tenancy=user.tenancy, ) db.session.add(reset_link_object) db.session.commit() send_email( to_email=user.email, subject='SuccessKit Password Reset', template_path='emails/password_reset_email.html', template_vars={ 'user': user, 'secret_link': secret_link } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_password_reset_email():\n aaa.send_password_reset_email(\n username=post_get('username'),\n email_addr=post_get('email_address')\n )\n return 'Please check your mailbox.'", "def send_pw_reset_email(user):\n token = user.get_token()\n message = Message(\n 'Reset Your P...
[ "0.840331", "0.8259578", "0.8028634", "0.7889112", "0.7888703", "0.7869221", "0.7866193", "0.78599626", "0.77490634", "0.77134913", "0.7707003", "0.76722884", "0.7621699", "0.76027656", "0.75812316", "0.75633854", "0.7558679", "0.7517307", "0.751042", "0.7506474", "0.7458127"...
0.7943816
3
send the echo reply
def echo(self, message): data = { "method" : "echo", "type" : "message", "data" : json.dumps(message) } return json.dumps(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(update, context):\r\n update.message.reply_text(update.message.text)", "def echo(update, context):\n update.message.reply_text(update.message.text)", "def echo(update, context):\n update.message.reply_text(update.message.text)", "def echo(update, context):\n update.message.reply_text(upd...
[ "0.71260184", "0.7080249", "0.7080249", "0.7080249", "0.7080249", "0.7023008", "0.68403614", "0.68021274", "0.67664033", "0.6743571", "0.66914415", "0.666011", "0.6580238", "0.6556136", "0.6480439", "0.6473965", "0.6467779", "0.6429761", "0.64276445", "0.63813347", "0.6371209...
0.0
-1
By default the nested modules are not imported automatically. Call this function if you would like to import them all. This may be useful for autocompletion in interactive mode.
def import_all(): import theory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_sub_modules(self):\n try:\n for package in self.package_list:\n Utils.import_utils.import_submodules(package)\n except ImportError, err:\n print_error(\"{0} : \\n\".format(str(err)))\n print_error('unexpected error: {0}'.format(traceback.form...
[ "0.7020762", "0.6595134", "0.63510954", "0.62685543", "0.6243627", "0.62241906", "0.617775", "0.61071664", "0.61007714", "0.6059917", "0.60515565", "0.6002455", "0.59896797", "0.5956948", "0.595397", "0.5918022", "0.591676", "0.59048396", "0.5900739", "0.587304", "0.5872894",...
0.6882997
1
Setup for the tests
def setUp(self): super(TestDOSCreateService, self).setUp() self.domain_list = [{"domain": "mywebsite%s.com" % uuid.uuid1()}] self.origin_list = [{"origin": "mywebsite1.com", "port": 443, "ssl": False}] self.caching_list = [{"name": "default", "ttl": 3600}, {"name": "home", "ttl": 1200, "rules": [{"name": "index", "request_url": "/index.htm"}]}] self.restrictions_list = [ { u"name": u"website only", u"rules": [ { u"name": "mywebsite.com", u"referrer": "mywebsite.com" } ] } ] self.service_name = str(uuid.uuid1()) self.flavor_id = self.test_config.default_flavor self.MAX_ATTEMPTS = 30 if self.test_config.generate_flavors: # create the flavor self.flavor_id = str(uuid.uuid1()) self.client.create_flavor(flavor_id=self.flavor_id, provider_list=[{ "provider": "fastly", "links": [{"href": "www.fastly.com", "rel": "provider_url"}]}])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup( self ):", "def setup(self) -> None:", "def setUp(self):\n\n return", "def setup(self):\n pass", "def setUp(self):\n\n self._set_up()", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n ...
[ "0.84664446", "0.84248596", "0.83041763", "0.82830304", "0.82820684", "0.82600397", "0.82600397", "0.8245472", "0.8245472", "0.82379264", "0.82379264", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233901", "0.8233...
0.0
-1
Reset domain_list, origin_list, caching_list, service_name and flavor_id to its default value.
def reset_defaults(self): self.domain_list = [{"domain": "mywebsite%s.com" % uuid.uuid1()}] self.origin_list = [{"origin": "mywebsite1.com", "port": 443, "ssl": False}] self.caching_list = [{"name": "default", "ttl": 3600}, {"name": "home", "ttl": 1200, "rules": [{"name": "index", "request_url": "/index.htm"}]}] self.service_name = str(uuid.uuid1()) self.flavor_id = self.test_config.default_flavor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.manager.delete_all()\n for name, val in DEFAULT_SETTINGS.items():\n val['name'] = name\n val['default_value'] = val['value']\n self.manager.from_dict(val)", "def reset(self):\n for var in self.var_list:\n var.value = None\n ...
[ "0.6844756", "0.6752497", "0.65349716", "0.6512155", "0.6489538", "0.6362991", "0.614943", "0.6136506", "0.610388", "0.59980386", "0.5987554", "0.59747857", "0.59503067", "0.59085506", "0.59052765", "0.58961785", "0.5888273", "0.5880857", "0.58757615", "0.58709276", "0.586754...
0.8584799
0
Create invalid_json like [[[[[[[[[[[[[test]]]]]]]]]]]]]
def create_invalid_json(self, length): str = "" str += "[" * length str += "\"test\"" str += "]" * length return str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_circular_nested(self):\n obj = {}\n obj[\"list\"] = [{\"obj\": obj}]\n with self.assertRaises(orjson.JSONEncodeError):\n orjson.dumps(obj)", "def test_schema_invalid_json(self):\n schema_0_input = schema_nested_2_invalid_JSON\n\n # if you uncomment this line...
[ "0.6324935", "0.62803555", "0.6237883", "0.615935", "0.5985762", "0.597395", "0.5954119", "0.5931266", "0.5930603", "0.5907497", "0.5892029", "0.588324", "0.5859376", "0.5838681", "0.582026", "0.5753517", "0.57280266", "0.5629437", "0.56058764", "0.5550728", "0.5540297", "0...
0.6898037
0
zip the data using gzip format
def data_zip(self, data): stringio = StringIO.StringIO() gzip_file = gzip.GzipFile(fileobj=stringio, mode='wb') gzip_file.write(data) gzip_file.close() return stringio.getvalue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __unzip(self, data):\n compressed = StringIO.StringIO(data)\n gzipper = gzip.GzipFile(fileobj=compressed)\n return gzipper.read()", "def save_to_gzip(data,fname):\n with gzip.open(fname + '.gz', 'wb',compresslevel = 9) as f:\n f.write(data.tobytes())", "def gzip_compress(...
[ "0.6996331", "0.67672616", "0.67579013", "0.6729529", "0.65639186", "0.65639186", "0.6514379", "0.63974094", "0.6345399", "0.61934805", "0.61905354", "0.61457014", "0.61027217", "0.6101483", "0.6070386", "0.60639983", "0.6051844", "0.604895", "0.6003619", "0.5999707", "0.5944...
0.7971304
0
Check the response of one request to see whether one request can kill the application.
def check_one_request(self): resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' # delete the service self.assertTrue(resp.status_code < 503) if self.service_url != '': self.client.delete_service(location=self.service_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_or_exit(self, request):\n requestType = request.get(\"request\")\n if requestType == \"STATUS\":\n status = self.process.get_status()\n self.send_status(status)\n elif (requestType == \"START\"):\n self.start_command(request.get(\"payload\", dict()...
[ "0.6309385", "0.6140188", "0.60674703", "0.60662365", "0.60635126", "0.6054033", "0.60283077", "0.6022958", "0.58536756", "0.5797017", "0.5794923", "0.57817405", "0.5742668", "0.5686234", "0.5639874", "0.5638953", "0.56379867", "0.56096375", "0.5609241", "0.5599548", "0.55796...
0.0
-1
Check whether it is possible to kill the application by creating a big invalid json blob.
def test_invalid_json_create_service(self): # create a payload with invalid json blob attack_string = self.create_invalid_json(2500) kwargs = {"data": attack_string} print kwargs resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_flag_aborted(self):\n container_dir = os.path.join(self.root, 'apps', 'proid.myapp#001',\n 'data')\n fs.mkdir_safe(container_dir)\n\n app_abort.flag_aborted(container_dir,\n why=app_abort.AbortedReason.INVALID_TYPE,\n ...
[ "0.5367132", "0.53574306", "0.53090554", "0.52711785", "0.52711344", "0.5247174", "0.52454853", "0.5202278", "0.51793706", "0.51491207", "0.51413524", "0.51264703", "0.51186717", "0.51085", "0.51063746", "0.510217", "0.50914645", "0.50710905", "0.50488275", "0.5040957", "0.50...
0.47117037
85
Check whether it is possible to kill the application by creating a big malicious json blob.
def test_malicious_json_create_service(self): # create a payload with malicous json blob attack_string = self.create_malicious_json(900) headers = {"X-Auth-Token": self.client.auth_token, "X-Project-Id": self.client.project_id} kwargs = {"headers": headers, "data": attack_string} resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_too_large(self):\n # currently the entire POST JSON request body is limited by default to 100kb\n return sys.getsizeof(self.metadata) > 10000", "def can_process(dict_data: dict) -> bool:\n return dict_data[\"experiment\"] in [_023_EXPERIMENT]", "def is_private(self, info):\n ...
[ "0.53570426", "0.5039716", "0.498842", "0.4982407", "0.4946164", "0.49423128", "0.49222663", "0.49024215", "0.49024215", "0.48760965", "0.48653737", "0.48636398", "0.4819188", "0.48098838", "0.48077267", "0.48038307", "0.48038307", "0.4798679", "0.47941115", "0.47817224", "0....
0.5133456
1
Check whether it is possible to kill the application by creating a big malicious json blob with utf8 encoding.
def test_malicious_json_utf_8_create_service(self): # create a payload with malicous json blob attack_string = self.create_malicious_json(800) headers = {"X-Auth-Token": self.client.auth_token, "X-Project-Id": self.client.project_id} kwargs = {"headers": headers, "data": attack_string.encode("utf-8")} resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_encoding(self, app, data_queues):\n body = b'{\"comment\": \"R\\xe9sum\\xe9 from 1990\", \"items\": []}'\n assert \"Résumé\" in body.decode(\"iso8859-1\")\n with pytest.raises(UnicodeDecodeError):\n body.decode(\"utf-8\")\n headers = {\"Content-Type\": \"applicat...
[ "0.57005584", "0.5268216", "0.5156061", "0.51394224", "0.5138233", "0.5138233", "0.50800556", "0.5001988", "0.49770227", "0.4972004", "0.48682755", "0.4838062", "0.48076913", "0.48053455", "0.47852117", "0.47045177", "0.47016084", "0.4695853", "0.46840426", "0.46781862", "0.4...
0.54639024
1
Check whether it is possible to kill the application by creating service with big XProjectId header.
def test_create_service_with_big_project_id(self): failed_count = 0 for k in range(2500, 8000, 500): self.reset_defaults() headers = {"X-Auth-Token": self.client.auth_token, "X-Project-Id": "1"*k, "Content-Type": "application/json"} kwargs = {"headers": headers} self.service_name = str(uuid.uuid1()) resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' #self.assertTrue(resp.status_code < 503) if (resp.status_code == 503): failed_count += 1 resp = self.client.list_services(requestslib_kwargs=kwargs) if (resp.status_code == 503): failed_count += 1 self.assertTrue(failed_count <= 3) #self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(self):\n if self.client is None:\n # never started, can't stop - should be warning or exception?\n return False\n try:\n self.client.kill()\n except Py4JError:\n logger.debug(\"Error while attempting to kill\", exc_info=1)\n # fal...
[ "0.6032888", "0.581664", "0.58002466", "0.57792443", "0.57447904", "0.5740473", "0.5734078", "0.572867", "0.5727236", "0.5721195", "0.57153744", "0.57026726", "0.5682279", "0.5640893", "0.5611833", "0.56033003", "0.5586408", "0.5567747", "0.55517226", "0.55265665", "0.5523955...
0.50609064
94
Check whether it is possible to kill the application by creating a big malicious json blob with utf16 encoding.
def test_malicious_json_utf_16_create_service(self): # create a payload with malicous json blob attack_string = self.create_malicious_json(400) headers = {"X-Auth-Token": self.client.auth_token, "X-Project-Id": self.client.project_id} kwargs = {"headers": headers, "data": attack_string.encode("utf-16")} resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_encoding(self, app, data_queues):\n body = b'{\"comment\": \"R\\xe9sum\\xe9 from 1990\", \"items\": []}'\n assert \"Résumé\" in body.decode(\"iso8859-1\")\n with pytest.raises(UnicodeDecodeError):\n body.decode(\"utf-8\")\n headers = {\"Content-Type\": \"applicat...
[ "0.5257188", "0.5233604", "0.50461715", "0.5023485", "0.5023485", "0.4973716", "0.48788738", "0.4845623", "0.48314884", "0.48003462", "0.47874525", "0.47507095", "0.4736719", "0.4718207", "0.47097185", "0.47041085", "0.46827826", "0.46773538", "0.46709177", "0.4652283", "0.46...
0.5806415
0
Check whether it is possible to kill the application by creating a big malicious json blob with gzip.
def test_malicious_json_gzip_create_service(self): # create a payload with malicious json blob attack_string = self.create_malicious_json(2500) headers = {"X-Auth-Token": self.client.auth_token, "X-Project-Id": self.client.project_id, "Content-Encoding": "gzip"} kwargs = {"headers": headers, "data": self.data_zip(attack_string)} resp = self.client.create_service(service_name=self.service_name, domain_list=self.domain_list, origin_list=self.origin_list, caching_list=self.caching_list, flavor_id=self.flavor_id, requestslib_kwargs=kwargs) if 'location' in resp.headers: self.service_url = resp.headers['location'] else: self.service_url = '' self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gzip(handler,config):\r\n if not config.gzip:\r\n return False\r\n if not gzip_support:\r\n return False\r\n accept_encoding = handler.headers.get('accept-encoding','').split(',')\r\n accept_encoding = [ x.strip() for x in accept_encoding ]\r\n ctype = handler.resp_headers[\"C...
[ "0.53313565", "0.5310692", "0.5241604", "0.51391083", "0.50379765", "0.5004744", "0.50042313", "0.4998042", "0.4920025", "0.49113283", "0.49000984", "0.48996288", "0.48760656", "0.48497862", "0.4841596", "0.48019674", "0.48009473", "0.47862568", "0.47672084", "0.47561482", "0...
0.58686054
0
Check whether it is possible to kill the application by creating a service with huge list of domains.
def test_dos_create_service_domain_list(self): # create a huge list of domain self.reset_defaults() for k in range(1, 30000): self.domain_list.append({"domain": "w.t%s.com" % k}) # send MAX_ATTEMPTS requests for k in range(1, self.MAX_ATTEMPTS): self.service_name = str(uuid.uuid1()) self.check_one_request()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dos_list_service_huge_junk(self):\n # create a huge list of domain\n attack_string = \"1\" * 3500\n params = {\"junk\": attack_string}\n resp = self.client.list_services(param=params)\n self.assertTrue(resp.status_code < 503)", "def test_dos_list_service_huge_limit(sel...
[ "0.6063095", "0.6022489", "0.56425107", "0.5547615", "0.54923004", "0.54674953", "0.5434379", "0.54335403", "0.54237306", "0.5372089", "0.53475595", "0.5319241", "0.52755827", "0.5261143", "0.525039", "0.52496856", "0.5240958", "0.52227604", "0.52175325", "0.5212614", "0.5209...
0.6728664
0
Check whether it is possible to kill the application by creating a service with huge list of origins.
def test_dos_create_service_origin_list(self): # create a huge list of domain self.reset_defaults() for k in range(1, 9000): self.origin_list.append({"origin": "m%s.com" % k, "port": 443, "ssl": False, "rules": [{"request_url": "/i.htm", "name": "i"}]}) # send MAX_ATTEMPTS requests for k in range(1, self.MAX_ATTEMPTS): self.service_name = str(uuid.uuid1()) self.check_one_request()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def killAll(controller=False):", "def remote_kill():", "def issuer_liveness_check():\n global app_config\n\n if app_config[\"running\"]:\n # return True until we get a shutdown request\n return True\n\n # return True until the work queue is cleared\n return tob_connection_active()", ...
[ "0.541091", "0.54013634", "0.5319908", "0.5259425", "0.5252269", "0.5223949", "0.52037764", "0.51941264", "0.51511925", "0.51103085", "0.5099697", "0.5097654", "0.50843334", "0.5061235", "0.5056471", "0.5046156", "0.501708", "0.5002467", "0.49952114", "0.4995023", "0.497257",...
0.5795615
0
Check whether it is possible to kill the application by creating a service with huge list of caching.
def test_dos_create_service_caching_list(self): # create a huge list of domain self.reset_defaults() for k in range(1, 16000): self.caching_list.append({"name": "d%s" % k, "ttl": 3600, "rules": [{"request_url": "/i.htm", "name": "i"}]}) # send MAX_ATTEMPTS requests for k in range(1, self.MAX_ATTEMPTS): self.service_name = str(uuid.uuid1()) self.check_one_request()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stop_flag(con):\n k, v = con.kv.get(\"service/rebootmgr/stop\")\n if v:\n return True\n return False", "def check_launcher():\n\n # Storage in memory which holds info about currently running checks\n storage = {}\n\n # Storage in memory which holds process info: process id and ...
[ "0.6023754", "0.5898645", "0.56894463", "0.5599096", "0.5579539", "0.55786425", "0.5548588", "0.55426264", "0.55050087", "0.5472136", "0.5437276", "0.54278713", "0.54199785", "0.541985", "0.54131436", "0.54023516", "0.5397745", "0.5380403", "0.53791565", "0.5373397", "0.53566...
0.58760566
2
Check whether it is possible to kill the application by creating a service with huge list rules within caching list.
def test_dos_create_service_caching_list_rules(self): # create a huge list of domain self.reset_defaults() for k in range(1, 15000): self.caching_list[1]["rules"].append( {"name": "i%s" % k, "request_url": "/index.htm"}) # send MAX_ATTEMPTS requests for k in range(1, self.MAX_ATTEMPTS): self.service_name = str(uuid.uuid1()) self.check_one_request()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stop_flag(con):\n k, v = con.kv.get(\"service/rebootmgr/stop\")\n if v:\n return True\n return False", "def test_dos_create_service_caching_list(self):\n # create a huge list of domain\n self.reset_defaults()\n for k in range(1, 16000):\n self.caching_lis...
[ "0.58728933", "0.57062775", "0.5591448", "0.55198026", "0.5498804", "0.54034287", "0.5393193", "0.5377958", "0.53490484", "0.5301769", "0.5300462", "0.5272994", "0.52642924", "0.52431273", "0.52165616", "0.5213221", "0.5209753", "0.5188523", "0.5138128", "0.5119553", "0.51152...
0.6129817
0
Check whether it is possible to kill the application by listing all services with a huge limit
def test_dos_list_service_huge_limit(self): # create a huge list of domain attack_string = "1" * 3500 params = {"limit": attack_string, "marker": attack_string} resp = self.client.list_services(param=params) self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dos_list_service_huge_junk(self):\n # create a huge list of domain\n attack_string = \"1\" * 3500\n params = {\"junk\": attack_string}\n resp = self.client.list_services(param=params)\n self.assertTrue(resp.status_code < 503)", "def checkProcess(process_id, time_limit)...
[ "0.6190547", "0.6119105", "0.60541016", "0.6032116", "0.60296106", "0.6005415", "0.5905079", "0.5887385", "0.5848494", "0.57247454", "0.571023", "0.5692282", "0.5672176", "0.56716925", "0.5535039", "0.5512738", "0.550317", "0.5502144", "0.54839885", "0.5466932", "0.5466897", ...
0.67318535
0
Check whether it is possible to kill the application by listing all services with a huge junk parameter
def test_dos_list_service_huge_junk(self): # create a huge list of domain attack_string = "1" * 3500 params = {"junk": attack_string} resp = self.client.list_services(param=params) self.assertTrue(resp.status_code < 503)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dontStartPrivilegedService(self):\n ports = self._privilegedStartService(self.highPortNumber)\n self.assertEqual(ports, [])", "def killAll(controller=False):", "def kill_all():\n compose_kill_all()", "def killMongosProc():\n cmd = [\"pgrep -f \\\"\" + MONGOS_KSTR + \"\\\" | xargs...
[ "0.6493543", "0.6443476", "0.61796784", "0.6155581", "0.61487615", "0.6087331", "0.60726637", "0.59983176", "0.5993885", "0.5984284", "0.59252936", "0.589027", "0.5874005", "0.5832126", "0.5820105", "0.58096033", "0.58073664", "0.58000046", "0.57864124", "0.5713508", "0.57121...
0.6348732
2
Executes before save the user
def pre_save(cls: any, sender: any, document: Document, **kwargs: dict) -> None: document.updated_at = datetime.now()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_user_create(self, user):", "def before_save(self):", "def pre_save(self, obj):\n obj.owner = self.request.user", "def beforeSave(self):", "def save(self, *args, **kwargs):\r\n\r\n\t\t# if self.has_django_dashboard_access is True:\r\n\t\t# self.is_staff = True\r\n\t\tsuper(User, self).save...
[ "0.75533545", "0.72868514", "0.7269945", "0.7237694", "0.70919347", "0.7054464", "0.6995794", "0.6962672", "0.6962672", "0.6941786", "0.69044524", "0.68476075", "0.6816776", "0.6761809", "0.6706968", "0.66740394", "0.66548544", "0.6599316", "0.6566465", "0.65550697", "0.65411...
0.0
-1
Executes after save the user
def post_save(cls: any, sender: any, document: Document, **kwargs: dict) -> None: is_new = kwargs.get('created') if not is_new: return password = document.password.encode('utf-8') hashed_password = hashpw(password, gensalt()) document.password = hashed_password.decode('utf-8') document.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_user_create(self, user):", "def save_user(self):\n db.session.add(self)\n db.session.commit()", "def commit(self):\n\t\t#firstly, get all variables and values of this model\n\t\tcontent = self.__dict__.copy() \n\t\t#if '_rev' is one of the variables of this model instance,\n\t\t#it means ...
[ "0.7430409", "0.72945154", "0.72669756", "0.71373963", "0.71373963", "0.7093228", "0.70894575", "0.7066202", "0.7066089", "0.7066089", "0.70545375", "0.7034863", "0.70316386", "0.7031347", "0.70147616", "0.70029557", "0.69145274", "0.6857509", "0.68545806", "0.6842717", "0.68...
0.0
-1
Given the key of the external_issue return the external issue link.
def get_issue_url(self, key): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_key_uri(self) -> str:\n return pulumi.get(self, \"external_key_uri\")", "def get_link_issue_config(self, group, **kwargs):\n return [\n {\n 'name': 'externalIssue',\n 'label': 'Issue',\n 'default': '',\n 'type': 'st...
[ "0.65414643", "0.6026105", "0.6026105", "0.5845039", "0.5555224", "0.554478", "0.5533305", "0.5504559", "0.5486554", "0.5481756", "0.5427769", "0.5370131", "0.532764", "0.532764", "0.532104", "0.5304017", "0.5276933", "0.5276933", "0.5267372", "0.52666265", "0.524295", "0.5...
0.75889593
0
These fields are used to render a form for the user,
def get_create_issue_config(self, group, **kwargs): event = group.get_latest_event() if event is not None: Event.objects.bind_nodes([event], 'data') return [ { 'name': 'title', 'label': 'Title', 'default': self.get_group_title(group, event, **kwargs), 'type': 'string', 'required': True, }, { 'name': 'description', 'label': 'Description', 'default': self.get_group_description(group, event, **kwargs), 'type': 'textarea', 'autosize': True, 'maxRows': 10, } ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formfields(cls):\n\n T = current.T\n request = current.request\n\n auth = current.auth\n auth_settings = auth.settings\n auth_messages = auth.messages\n\n utable = auth_settings.table_user\n passfield = auth_settings.password_field\n\n # Instantiate Conse...
[ "0.7295035", "0.7280732", "0.6917473", "0.6905996", "0.68841517", "0.6860251", "0.681893", "0.669571", "0.6574075", "0.6406303", "0.6388662", "0.6359046", "0.63055116", "0.63051003", "0.62667084", "0.6262183", "0.6247393", "0.62319326", "0.6203267", "0.61991507", "0.6193516",...
0.0
-1
Used by the `GroupIntegrationDetailsEndpoint` to create an `ExternalIssue` using title/description obtained from calling `get_issue` described below.
def get_link_issue_config(self, group, **kwargs): return [ { 'name': 'externalIssue', 'label': 'Issue', 'default': '', 'type': 'string', } ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_issue(self, data, **kwargs):\n raise NotImplementedError", "def create_issue(self, data, **kwargs):\n raise NotImplementedError", "def _create_issue(self, dep_name, dep_latest_version, is_subtask=False, parent_key=None):\n logging.info(\"Creating a new JIRA issue to track {0} upgrad...
[ "0.6574817", "0.6574817", "0.6256626", "0.60651046", "0.59626025", "0.5874895", "0.58699363", "0.5765933", "0.57578117", "0.5719975", "0.5636442", "0.5623104", "0.5390712", "0.5389898", "0.5384934", "0.53750795", "0.53621405", "0.5351848", "0.5316811", "0.52315885", "0.521538...
0.562188
13
Returns a list of field names that should have their last used values persisted on a perproject basis.
def get_persisted_default_config_fields(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stored_field_names(self):\r\n \r\n bn = self._by_name\r\n return [name for name in self._names if bn[name].stored]", "def get_fieldnames(self):\n fieldnames = self._fields.keys()\n fieldnames.remove('time')\n fieldnames.remove('lon')\n fieldnames.remove('lat')...
[ "0.7186901", "0.66612464", "0.6604475", "0.64602005", "0.6406558", "0.6403274", "0.63492525", "0.63447577", "0.63416326", "0.6341628", "0.6330346", "0.63049877", "0.6242699", "0.6180476", "0.615603", "0.61414677", "0.6139766", "0.6136323", "0.6128718", "0.611067", "0.61068535...
0.543067
87
Stores the last used field defaults on a perproject basis. This accepts a dict of values that will be filtered to keys returned by ``get_persisted_default_config_fields`` which will automatically be merged into the associated field config object as the default.
def store_issue_last_defaults(self, project_id, data): persisted_fields = self.get_persisted_default_config_fields() if not persisted_fields: return defaults = {k: v for k, v in six.iteritems(data) if k in persisted_fields} self.org_integration.config.update({ 'project_issue_defaults': {project_id: defaults}, }) self.org_integration.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_fields_with_default(annotation_fields, defaults_dict):\n all_fields = OrderedDict()\n all_filed_keys = _merge_field_keys(annotation_fields, defaults_dict)\n for name in all_filed_keys:\n # Get or create annotation\n annotation = (\n annotation_f...
[ "0.6671097", "0.64907825", "0.6364141", "0.6281838", "0.62724817", "0.6210134", "0.6145344", "0.60783255", "0.6055254", "0.6043969", "0.60429865", "0.5975377", "0.5955533", "0.5933369", "0.58850956", "0.585415", "0.56757694", "0.5667322", "0.5656256", "0.5634078", "0.56188464...
0.7270465
0
Create an issue via the provider's API and return the issue key, title and description. Should also handle API client exceptions and reraise as an IntegrationError (using the `message_from_error` helper).
def create_issue(self, data, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_issue(*, image: str, repo: str, run: str, stacktrace: str) -> Issue:\n title = f\"Automatic error report from {repo}\"\n body = _report_body(image=image, repo=repo, run=run, stacktrace=stacktrace)\n return TAGBOT_ISSUES_REPO.create_issue(title, body)", "def test_issue_create_issue(self):\n ...
[ "0.62188655", "0.61720526", "0.61446583", "0.61345875", "0.6107727", "0.6092078", "0.59738606", "0.5907364", "0.58103263", "0.5800523", "0.5772324", "0.5594634", "0.55728924", "0.5495695", "0.5421277", "0.54186255", "0.53647876", "0.5340007", "0.5340007", "0.52912503", "0.528...
0.6616591
1
Get an issue via the provider's API and return the issue key, title and description. Should also handle API client exceptions and reraise as an IntegrationError (using the `message_from_error` helper).
def get_issue(self, issue_id, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_issue(self, issue: int) -> \"AIOGitHubAPIRepositoryIssue\":\n _endpoint = f\"/repos/{self.full_name}/issues/{issue}\"\n\n response = await self.client.get(endpoint=_endpoint)\n return AIOGitHubAPIRepositoryIssue(self.client, response)", "def get_issue(self, issue_id):\n ...
[ "0.65489364", "0.65003854", "0.6287192", "0.6163007", "0.5994408", "0.59484714", "0.5892161", "0.5892161", "0.5879316", "0.5820025", "0.55038637", "0.5416788", "0.53846055", "0.5347415", "0.5340963", "0.5287205", "0.52774334", "0.5276077", "0.5235982", "0.5216044", "0.520453"...
0.6298639
3
Takes the external issue that has been linked via `get_issue`. Does anything needed after an issue has been linked, i.e. creating a comment for a linked issue.
def after_link_issue(self, external_issue, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_create_comment(self):\n pass", "def create_issue_link(self, link_type, inwardissue,\r\n outwardissue, comment=None):\r\n self.jira.create_issue_link(type=link_type,\r\n inwardIssue=str(inwardissue),\r\n ...
[ "0.6610581", "0.64180446", "0.63382167", "0.6309767", "0.62233156", "0.6104971", "0.60037994", "0.59019923", "0.58587396", "0.5726099", "0.5722433", "0.5694132", "0.56749576", "0.56747717", "0.5665945", "0.5628418", "0.56239235", "0.5613582", "0.5613582", "0.55969155", "0.557...
0.6989102
0
Takes result of `get_issue` or `create_issue` and returns the formatted key
def make_external_key(self, data): return data['key']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strkey(item):\n return '%s:%s:%s' % (item['group_id'], item['artifact_id'], item['version'])", "def get_key(self, metric, period):\n key = self.key_format\n key = key.replace('{metric}', metric)\n key = key.replace('{period}', period)\n return key", "def key(self) -> str:\n ...
[ "0.6959604", "0.6585755", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", "0.62527156", ...
0.0
-1
Returns the display name of the issue. This is not required but helpful for integrations whose external issue key does not match the disired display name.
def get_issue_display_name(self, external_issue): return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -...
[ "0.71604306", "0.71604306", "0.71604306", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.7145177", "0.70821923", "0.69916433", "0.69874066", "0.69397634", "0.69397634", "0.69397...
0.8553241
0
Returns the default repository and a set/subset of repositories of asscoaited with the installation
def get_repository_choices(self, group, **kwargs): try: repos = self.get_repositories() except ApiError: raise IntegrationError( 'Unable to retrive repositories. Please try again later.' ) else: repo_choices = [(repo['identifier'], repo['name']) for repo in repos] repo = kwargs.get('repo') if not repo: params = kwargs.get('params', {}) defaults = self.get_project_defaults(group.project_id) repo = params.get('repo', defaults.get('repo')) try: default_repo = repo or repo_choices[0][0] except IndexError: return '', repo_choices # If a repo has been selected outside of the default list of # repos, stick it onto the front of the list so that it can be # selected. try: next(True for r in repo_choices if r[0] == default_repo) except StopIteration: repo_choices.insert(0, self.create_default_repo_choice(default_repo)) return default_repo, repo_choices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_repo(self):\n for repo in self.get_repos():\n if self.get_safe(repo, 'default') and self.getboolean(repo, 'default'):\n return repo\n return False", "def repositories(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ConfigurationServiceGitRepositoryArg...
[ "0.69626194", "0.6797415", "0.67053837", "0.6657273", "0.64963764", "0.64527845", "0.64362335", "0.6361238", "0.6116716", "0.6100047", "0.60793626", "0.60697997", "0.60428035", "0.6021395", "0.6019142", "0.5995058", "0.59550256", "0.59521323", "0.5947704", "0.5873819", "0.585...
0.61885285
8
Helper method for get_repository_choices Returns the choice for the default repo in a tuple to be added to the list of repository choices
def create_default_repo_choice(self, default_repo): return (default_repo, default_repo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_repository_choices(self, group, **kwargs):\n try:\n repos = self.get_repositories()\n except ApiError:\n raise IntegrationError(\n 'Unable to retrive repositories. Please try again later.'\n )\n else:\n repo_choices = [(repo['i...
[ "0.7996344", "0.6400903", "0.6090768", "0.604242", "0.60069907", "0.56722534", "0.56320244", "0.557179", "0.55387455", "0.54395264", "0.5438947", "0.5407968", "0.5386718", "0.535366", "0.5341311", "0.53403133", "0.5228114", "0.5218312", "0.5218312", "0.5218312", "0.52169466",...
0.8641376
0
Propagate a sentry issue's assignee to a linked issue's assignee. If assign=True, we're assigning the issue. Otherwise, deassign.
def sync_assignee_outbound(self, external_issue, user, assign=True, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_assignment(self, updates, original=None):\n if not original:\n original = {}\n\n self.set_type(updates, original)\n\n if not updates.get('assigned_to'):\n if updates.get('priority'):\n # Priority was edited - nothing to set here\n ret...
[ "0.6341137", "0.6102024", "0.59917015", "0.59198666", "0.5881656", "0.5821527", "0.5817272", "0.57891667", "0.57301235", "0.5691763", "0.56128204", "0.55561805", "0.55232775", "0.528361", "0.52553594", "0.52330756", "0.5215624", "0.51927084", "0.5185444", "0.5087694", "0.5084...
0.7126472
1
Propagate a sentry issue's status to a linked issue's status.
def sync_status_outbound(self, external_issue, is_resolved, project_id, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition_jira_issue(issue_key, status_name):\n assert status_name is not None\n transition_url = (\n \"/rest/api/2/issue/{key}/transitions\"\n \"?expand=transitions.fields\".format(key=issue_key)\n )\n transitions_resp = get_jira_session().get(transition_url)\n log_check_response...
[ "0.6218616", "0.61115164", "0.6070995", "0.58736444", "0.5512117", "0.54699665", "0.54437476", "0.53715336", "0.52957445", "0.5283756", "0.528201", "0.52811617", "0.5259673", "0.519446", "0.5176529", "0.51729983", "0.5112813", "0.5091007", "0.50332105", "0.5021849", "0.501354...
0.5979092
3
Given webhook data, check whether the status category changed FROM "done" to something else, meaning the sentry issue should be marked as unresolved
def should_unresolve(self, data): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_webhook_bad_status_update(self):\n payload = json.dumps({\n 'matrix': [\n {\n 'config': {\n 'env': [\n 'REVIEWBOARD_STATUS_UPDATE_ID=%d'\n % (self.status_update.pk + 1),\n ...
[ "0.6707768", "0.62921613", "0.6197687", "0.6112344", "0.6096037", "0.584279", "0.5831116", "0.5799407", "0.57872725", "0.5704704", "0.56981957", "0.5695242", "0.56950885", "0.5661777", "0.5642203", "0.55865103", "0.5574639", "0.55675113", "0.5555497", "0.5525483", "0.55217344...
0.0
-1
Given webhook data, check whether the status category changed TO "done" from something else, meaning the sentry issue should be marked as resolved see example above
def should_resolve(self, data): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_webhook_bad_status_update(self):\n payload = json.dumps({\n 'matrix': [\n {\n 'config': {\n 'env': [\n 'REVIEWBOARD_STATUS_UPDATE_ID=%d'\n % (self.status_update.pk + 1),\n ...
[ "0.64663035", "0.61939365", "0.6079813", "0.6076638", "0.6062934", "0.58889955", "0.5886065", "0.5785363", "0.57708836", "0.5713253", "0.5695346", "0.5679474", "0.56603295", "0.5658613", "0.5631367", "0.55999297", "0.5591073", "0.5583671", "0.5571988", "0.55619466", "0.555703...
0.0
-1
return the current position in axis x
def get_pos_x(self): return self.__pos_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_x(self):\n return self.position.x", "def get_x(self):\n return self.posX", "def get_x_position(self):\n return self.rect.x", "def get_axis_x(self):\r\n return self.__x_axis", "def get_x_position(self):\n return self.actual_coordinates[0]", "def xaxis ( self ) :...
[ "0.84356475", "0.8302575", "0.825707", "0.8191136", "0.81628805", "0.809894", "0.808944", "0.808944", "0.8071701", "0.79766065", "0.7853635", "0.7823813", "0.77839094", "0.7724001", "0.7704104", "0.7700276", "0.76920474", "0.76795393", "0.7627869", "0.7589636", "0.75225663", ...
0.8329716
1
return the current position in axis y
def get_pos_y(self): return self.__pos_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_y(self):\n return self.position.y", "def get_y_position(self):\n return self.actual_coordinates[1]", "def get_y(self):\n return self.coords[1]", "def y(self):\r\n return self.position.y", "def get_axis_y(self):\r\n return self.__y_axis", "def getY(self):\n r...
[ "0.8298365", "0.819705", "0.8127928", "0.8116509", "0.80807966", "0.8054", "0.80265415", "0.80205864", "0.80196774", "0.79003936", "0.7895202", "0.7861297", "0.78577423", "0.78577423", "0.77969265", "0.7770738", "0.77373946", "0.7711272", "0.7710626", "0.76898646", "0.7657803...
0.8150986
2
return the current speed in axis x
def get_speed_x(self): return self.__speed_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_speed_x(self):\r\n return self.__X_speed", "def speedup_x(self):\r\n new_speed = math.cos((self.__direction*math.pi)/180) + self.__X_speed\r\n self.__X_speed = new_speed", "def getXVelocity(self):\n return self.xvelocity", "def get_speed(self):\r\n return self.__x_s...
[ "0.8555267", "0.7207319", "0.71035296", "0.68359816", "0.6763808", "0.67338073", "0.6704949", "0.66456616", "0.65846103", "0.6549981", "0.6549981", "0.651929", "0.6485276", "0.6482039", "0.6412599", "0.63956916", "0.63956916", "0.6384349", "0.6323819", "0.63225263", "0.631968...
0.84871364
1
return the current speed in axis y
def get_speed_y(self): return self.__speed_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_speed_y(self):\r\n return self.__y_speed", "def speedup_y(self):\r\n new_speed = math.sin((self.__direction*math.pi)/180) + self.__y_speed\r\n self.__y_speed = new_speed", "def verticalspeed(self):\n return self.__vertspeed.value", "def get_axis_y(self):\r\n return ...
[ "0.8572007", "0.7324329", "0.7246045", "0.7071657", "0.70214754", "0.69910544", "0.6868786", "0.681344", "0.680576", "0.67981166", "0.67907566", "0.6772865", "0.6765004", "0.67371374", "0.6736603", "0.6687959", "0.6687255", "0.6685152", "0.6685152", "0.66710705", "0.66710705"...
0.8426076
1
set new speed (new_speed) in axis x for the torpedo
def set_speed_x(self, new_speed): self.__speed_x = new_speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speedup_x(self):\r\n new_speed = math.cos((self.__direction*math.pi)/180) + self.__X_speed\r\n self.__X_speed = new_speed", "def set_speed(self, axis, speed):\n #log.info(f\"set speed {axis} {speed}\")\n self.cmd_axis_speed[axis] = speed", "def set_speed(self, new_speed):\n ...
[ "0.7153202", "0.69229406", "0.6859478", "0.6688785", "0.66181517", "0.6542605", "0.6542605", "0.6542605", "0.65331244", "0.64134264", "0.6341696", "0.62807065", "0.6228572", "0.6213521", "0.61853576", "0.617665", "0.61610395", "0.6149115", "0.6138381", "0.6097479", "0.6094318...
0.79879344
0
set new speed (new_speed) in axis y for the torpedo
def set_speed_y(self, new_speed): self.__speed_y = new_speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speedup_y(self):\r\n new_speed = math.sin((self.__direction*math.pi)/180) + self.__y_speed\r\n self.__y_speed = new_speed", "def customize_torpedo_speed(self, current_gameboard, turn, new_speed):\n current_gameboard['torpedo_speed'][turn] = new_speed", "def set_speed(self, new_speed):\...
[ "0.74478376", "0.7266299", "0.6885508", "0.68010527", "0.67818487", "0.65538603", "0.64874476", "0.6445851", "0.6438389", "0.64053863", "0.6376815", "0.6363942", "0.63039124", "0.63012075", "0.62974465", "0.62974465", "0.62974465", "0.62857443", "0.6271287", "0.62608033", "0....
0.8085644
0
return the current heading of the torpedo
def get_heading(self): return self.__heading
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_heading(self):\n return self.heading[0]", "def heading(self):\n x, y = self._orient\n result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0\n result /= self._degreesPerAU\n return (self._angleOffset + self._angleOrient*result) % self._fullcircle", "def heading(se...
[ "0.7605571", "0.7476633", "0.74684876", "0.74127597", "0.73098963", "0.7308734", "0.7180691", "0.7153451", "0.70962083", "0.70469266", "0.6980597", "0.696472", "0.69280505", "0.69280505", "0.6892175", "0.6828829", "0.6755277", "0.6697896", "0.65643686", "0.65230525", "0.64725...
0.74286294
4
set new position (new_pos) in axis x for the torpedo
def set_new_pos_in_x(self, new_pos): self.__pos_x = new_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setXPos(self,newXPos):\n self.xPos=newXPos", "def set_axis_x(self, new_axis_point):\r\n self.__x_axis = new_axis_point", "def setX(self, value):\n self.position[0] = value", "def set_pos(self, x):\n self._pos = x", "def set_x(self, new_x):\r\n self.x = new_x", "def ...
[ "0.7246535", "0.7111097", "0.70392", "0.6978868", "0.6963708", "0.6886643", "0.68568933", "0.6825037", "0.6757608", "0.6701941", "0.6696527", "0.6664855", "0.6620675", "0.6489275", "0.64415085", "0.63936675", "0.63880914", "0.634943", "0.6321042", "0.6301134", "0.62831503", ...
0.7426567
0
set new position (new_pos) in axis y for the torpedo
def set_new_pos_in_y(self, new_pos): self.__pos_y = new_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_axis_y(self, new_axis_point):\r\n self.__y_axis = new_axis_point", "def set_y(self, new_y):\r\n self.y = new_y", "def set_ypos(self, deg):\n if deg < -10:\n deg = -10\n elif deg > 10:\n deg = 10\n deg += 10\n self.kit.servo[8].angle = deg"...
[ "0.7400605", "0.7042508", "0.70301294", "0.70165414", "0.69808483", "0.67663985", "0.66854906", "0.6540774", "0.6528592", "0.65152085", "0.64745337", "0.64745337", "0.6468849", "0.64469284", "0.6417484", "0.6325399", "0.6307254", "0.6282218", "0.62483877", "0.6222319", "0.621...
0.7415262
0
return the radius of the torpedo
def get_radius(self): return self.__radius
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_radius(self):\n return self.r", "def get_radius(self):\n if self.no_dist is False:\n dist = self.distance\n radius = (dist * self.ang_size / 60. *\n np.pi/180. * ct._kpc_over_pc_)/2.\n self.radius = radius\n else:\n sel...
[ "0.77602255", "0.77165467", "0.76469624", "0.7562884", "0.7555129", "0.75368184", "0.7519935", "0.7519935", "0.75191283", "0.7482755", "0.74786043", "0.74501884", "0.74501884", "0.74501884", "0.74501884", "0.74501884", "0.74244076", "0.7423964", "0.74209315", "0.7340949", "0....
0.7430451
16
return the current lives of the torpedo
def get_lives(self): return self.__lives
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lives(self) -> int:\n return self.rstate.lives()", "def get_life(self):\r\n return self.__lives", "def get_lives(self):\n return self.__num_lives", "def lives(self) -> int:\n return self.__state.lives()", "def get_lives(self):\n\t\treturn self._lives", "def getLives(se...
[ "0.75683385", "0.7511627", "0.74918586", "0.748768", "0.74035114", "0.726982", "0.7224529", "0.72001475", "0.65682024", "0.6508566", "0.63753396", "0.6278137", "0.6209027", "0.60758", "0.5966505", "0.5905969", "0.58002245", "0.5699493", "0.5666366", "0.56506854", "0.5461768",...
0.72537
6
set the new number of lives (new_number_of_lives) of the torpedo
def set_lives(self, new_number_of_lives): self.__lives = new_number_of_lives
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLives(self, lives):\n assert type(lives) == int\n self._lives = lives", "def set_lives(self, lives):\n self._lives = lives", "def update_lives(self, amount):\n self.lives += amount", "def setNbLives(self, nb_lives: int) -> None:\n self._nbLives = nb_lives\n if...
[ "0.7700371", "0.7667687", "0.7629367", "0.73052084", "0.72219425", "0.7182382", "0.6548997", "0.6420976", "0.6353151", "0.6246695", "0.62098116", "0.5965814", "0.5958923", "0.58790517", "0.5875401", "0.56700194", "0.5605648", "0.55878407", "0.5576551", "0.5528152", "0.5494097...
0.8256307
0
Initialize the object with a placeholder value of 1.
def __init__(self) -> None: super().__init__() self.placeholder = 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, value=1.0):\n self.value = value", "def __init__(self,value = 0):\n\n self.value = value", "def __init__(self):\n super().__init__()\n self._value = 0", "def __init__(self, BLANK=0):\n self.BLANK = BLANK", "def __init__(self, number=0):\n pass", ...
[ "0.69245744", "0.6914013", "0.68501645", "0.6800856", "0.6740337", "0.6642504", "0.65677077", "0.65439326", "0.6520527", "0.64555895", "0.6452134", "0.64311016", "0.64110297", "0.6386236", "0.6386236", "0.6364008", "0.6297296", "0.6297296", "0.6297296", "0.6297296", "0.629729...
0.7242961
0
This class has nothing to read.
def read(self, sacc_data: sacc.Sacc) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __call__(se...
[ "0.75815195", "0.74074113", "0.74074113", "0.74074113", "0.74074113", "0.740586", "0.740586", "0.7403441", "0.7401648", "0.7282445", "0.72723436", "0.7257734", "0.72302353", "0.7219913", "0.71216524", "0.712106", "0.712106", "0.712106", "0.712106", "0.712106", "0.712106", "...
0.0
-1
This class has no state to reset.
def _reset(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self):\n\t\tpass", "def reset(self):", "def reset(self):", "def reset(self):", "def reset(self):", "def reset(self) -> None:\n ...", "def reset(self) -> None:\n ...", "def reset(self) -> ...
[ "0.9048386", "0.9048386", "0.9048386", "0.8916843", "0.8910682", "0.8910682", "0.8910682", "0.8910682", "0.8868721", "0.8868721", "0.8868721", "0.8868721", "0.8868721", "0.8868721", "0.8868721", "0.8868721", "0.88441813", "0.88396436", "0.88396436", "0.88275737", "0.88275737"...
0.8961898
3
Return an empty RequiredParameters object.
def _required_parameters(self) -> RequiredParameters: return RequiredParameters([])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_required_params():\n return {}", "def get_empty_required_fields(self):\n empty_fields = self.get_empty_fields()\n return [f for f in empty_fields if f in self.REQUIRED_FIELDS]", "def get_required_parameters(self) -> list:\n results = []\n if self.no_params or self.par...
[ "0.7562365", "0.6865271", "0.6684548", "0.6580648", "0.642038", "0.6418872", "0.63192177", "0.6319068", "0.6306489", "0.6298723", "0.623854", "0.62329423", "0.6214493", "0.61800486", "0.61040115", "0.6102065", "0.6099858", "0.6063706", "0.60514194", "0.6025997", "0.6002806", ...
0.86397606
0
Return an empty DerivedParameterCollection.
def _get_derived_parameters(self) -> DerivedParameterCollection: return DerivedParameterCollection([])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self) -> None:\n super().clear()\n self._parameters = np.array([], dtype=object)", "def get_parameters(self):\n self.unimpl_base_class()", "def get_parameters(self):\n d = super().get_parameters()\n d.pop('population_size', None)\n return d", "def empty_col...
[ "0.60794294", "0.60395926", "0.59694386", "0.59527194", "0.5874923", "0.5814086", "0.57916915", "0.57306236", "0.5725052", "0.56777626", "0.5676922", "0.56153905", "0.5593001", "0.5562131", "0.5517442", "0.5513053", "0.5445878", "0.5444455", "0.5426895", "0.5397799", "0.53526...
0.8430621
1
Return a constant value of the likelihood, determined by the value of self.placeholder.
def compute_loglike(self, tools: ModelingTools) -> float: return -3.0 * self.placeholder
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def likelihood(self):\n if self._likelihood is None:\n self._likelihood = exp(self.log_likelihood)\n if self._likelihood == 0:\n self._likelihood = sys.float_info.min\n return self._likelihood", "def constant(_):\n return 1.", "def likelihood(self):\n \n...
[ "0.63914543", "0.62072855", "0.61657786", "0.61218697", "0.60915124", "0.60518366", "0.5950913", "0.5950913", "0.5950913", "0.5939804", "0.58370227", "0.5737465", "0.57351774", "0.57254374", "0.5683176", "0.5663706", "0.56332886", "0.5606523", "0.5575715", "0.55598384", "0.55...
0.5983048
6
Return an EmptyLikelihood object.
def empty_likelihood() -> EmptyLikelihood: return EmptyLikelihood()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNoData(self):\n #---+----|----+----|----+----|----+----|----+----|----+----|----+----|\n return TreeLikelihoodBase.getNoData(self)", "def mempty(self):\n return identity", "def empty() -> ObservableBase:\n from ..operators.observable.empty import empty\n return empty()...
[ "0.68557054", "0.63254637", "0.62527746", "0.61421937", "0.6079142", "0.6053957", "0.6017173", "0.6011714", "0.5980676", "0.59661746", "0.59467256", "0.5892879", "0.5858775", "0.584163", "0.5826427", "0.58017796", "0.5760485", "0.5741958", "0.56936145", "0.56328344", "0.56234...
0.89379823
0
Initialize the ParameterizedLikelihood by reading the specificed sacc_filename value.
def __init__(self, params: NamedParameters): super().__init__() self.sacc_filename = params.get_string("sacc_filename")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, initial_param_file, fasta_file):\n self.sequences = read_fasta_sequences_to_str(fasta_file)\n self.obs = observe_differences(self.sequences[0], self.sequences[1])\n self.theta = parse_params(initial_param_file)\n self.estimate = None\n self.likelihood = None\n ...
[ "0.6211385", "0.5966141", "0.5762728", "0.5676559", "0.5669715", "0.5662447", "0.55601126", "0.5527512", "0.5518656", "0.54877645", "0.5482554", "0.5455407", "0.54435134", "0.5440038", "0.54361457", "0.54338324", "0.54028064", "0.5392907", "0.5386685", "0.53818727", "0.537700...
0.72975916
0
This class has nothing to read.
def read(self, sacc_data: sacc.Sacc) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __call__(se...
[ "0.7580826", "0.74062556", "0.74062556", "0.74062556", "0.74062556", "0.7406094", "0.7406094", "0.74037766", "0.7402143", "0.7281538", "0.7273852", "0.72573453", "0.7230017", "0.7220113", "0.71211153", "0.712072", "0.712072", "0.712072", "0.712072", "0.712072", "0.712072", ...
0.0
-1
This class has no state to reset
def _reset(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self):", "def reset(self):", "def reset(self):", "def reset(self):", "def reset(self):\n\t\tpass", "def _reset(self):", "def reset(self):\n \n pass", "def reset(self):\n ...", "def r...
[ "0.9068043", "0.9068043", "0.9068043", "0.8984849", "0.8984849", "0.8984849", "0.8984849", "0.8948263", "0.8914379", "0.88837045", "0.88798285", "0.88798285", "0.8879266", "0.8879266", "0.88776076", "0.88776076", "0.88776076", "0.88776076", "0.88776076", "0.88776076", "0.8877...
0.8996086
4
Return an empty RequiredParameters object.
def _required_parameters(self) -> RequiredParameters: return RequiredParameters([])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_required_params():\n return {}", "def get_empty_required_fields(self):\n empty_fields = self.get_empty_fields()\n return [f for f in empty_fields if f in self.REQUIRED_FIELDS]", "def get_required_parameters(self) -> list:\n results = []\n if self.no_params or self.par...
[ "0.7562365", "0.6865271", "0.6684548", "0.6580648", "0.642038", "0.6418872", "0.63192177", "0.6319068", "0.6306489", "0.6298723", "0.623854", "0.62329423", "0.6214493", "0.61800486", "0.61040115", "0.6102065", "0.6099858", "0.6063706", "0.60514194", "0.6025997", "0.6002806", ...
0.86397606
1
Return an empty DerivedParameterCollection.
def _get_derived_parameters(self) -> DerivedParameterCollection: return DerivedParameterCollection([])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self) -> None:\n super().clear()\n self._parameters = np.array([], dtype=object)", "def get_parameters(self):\n self.unimpl_base_class()", "def get_parameters(self):\n d = super().get_parameters()\n d.pop('population_size', None)\n return d", "def empty_col...
[ "0.6081113", "0.6039337", "0.59705603", "0.5954725", "0.5876655", "0.58154607", "0.5792134", "0.5731025", "0.5725712", "0.56782943", "0.56777143", "0.56163365", "0.5595286", "0.5563155", "0.551771", "0.55127925", "0.54450375", "0.5443118", "0.5427724", "0.5399277", "0.5354234...
0.84288347
0
Return a constant value of the likelihood.
def compute_loglike(self, tools: ModelingTools) -> float: return -1.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def likelihood(self):\n if self._likelihood is None:\n self._likelihood = exp(self.log_likelihood)\n if self._likelihood == 0:\n self._likelihood = sys.float_info.min\n return self._likelihood", "def log_likelihood_function(self, instance) -> float:\n ret...
[ "0.73423636", "0.72417146", "0.7052984", "0.68619883", "0.6750545", "0.6744326", "0.6712814", "0.66508377", "0.6622217", "0.66061604", "0.65646875", "0.65308625", "0.65102774", "0.6497312", "0.6497312", "0.6497312", "0.64779097", "0.6463282", "0.6450098", "0.6369976", "0.6347...
0.0
-1
Return a ParameterizedLikelihood object.
def parameterized_likelihood(params: NamedParameters): return ParamaterizedLikelihood(params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_likelihood(self, discretized=False, state=None):\n if not hasattr(self, 'softmax'):\n self.generate_softmax()\n\n if self.softmax is not None:\n if state is not None:\n return self.softmax.probability(class_=self.softmax_class_label,\n ...
[ "0.6216977", "0.6201429", "0.59271574", "0.5916395", "0.59147215", "0.5894737", "0.5885555", "0.57895315", "0.5743663", "0.5680548", "0.5580204", "0.5562542", "0.55499244", "0.5537347", "0.5528815", "0.552764", "0.55163604", "0.549442", "0.54925627", "0.5490574", "0.5468335",...
0.75006866
0
Return an email Message object. This works like mboxutils.get_message, except it doesn't junk the headers if there's an error. Doing so would cause a headerless message to be written back out!
def get_message(obj): if isinstance(obj, email.Message.Message): return obj if hasattr(obj, "read"): obj = obj.read() try: msg = email.message_from_string(obj) except email.Errors.MessageParseError: msg = None return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_message(self):\n try:\n result = self.messages.get()\n except Queue.Empty:\n return None\n else:\n return Message(body=result.getBody(), subject=result.getBody(), sender=result.getFrom())", "def get_message(self, **kwargs):\n message = Mail()\n...
[ "0.695734", "0.6895103", "0.6767101", "0.6699613", "0.6677977", "0.65786904", "0.6405224", "0.63856715", "0.637261", "0.6364298", "0.6361784", "0.63502926", "0.62194216", "0.62027186", "0.6197121", "0.6094284", "0.6087418", "0.60842526", "0.60625416", "0.6039069", "0.6022497"...
0.7487364
0
Train bayes with a single message.
def msg_train(h, msg, is_spam, force): try: mboxutils.as_string(msg) except TypeError: return False if is_spam: spamtxt = options["Headers", "header_spam_string"] else: spamtxt = options["Headers", "header_ham_string"] oldtxt = msg.get(options["Headers", "trained_header_name"]) if force: if oldtxt != None: del msg[options["Headers", "trained_header_name"]] elif oldtxt == spamtxt: return False elif oldtxt != None: del msg[options["Headers", "trained_header_name"]] h.untrain(msg, not is_spam) h.train(msg, is_spam) msg.add_header(options["Headers", "trained_header_name"], spamtxt) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_training(self):\n self.classifier.train(\"test\", self.message)", "def train_naive_Bayes_classificator(self):\n positive_tweet_tokens = twitter_samples.tokenized(\n 'positive_tweets.json')\n negative_tweet_tokens = twitter_samples.tokenized(\n 'negative_tweets....
[ "0.63326174", "0.590261", "0.5853939", "0.58069724", "0.5763264", "0.5672857", "0.5650478", "0.5621643", "0.56209004", "0.5565473", "0.55476063", "0.55283743", "0.5522747", "0.55125904", "0.55125904", "0.55125904", "0.55125904", "0.55125904", "0.5502847", "0.5445922", "0.5443...
0.5377778
25
Train bayes with all messages from a maildir.
def maildir_train(h, path, is_spam, force, removetrained): if loud: print(" Reading %s as Maildir" % (path,)) import time import socket pid = os.getpid() host = socket.gethostname() counter = 0 trained = 0 for fn in os.listdir(path): cfn = os.path.join(path, fn) tfn = os.path.normpath(os.path.join(path, "..", "tmp", "%d.%d_%d.%s" % (time.time(), pid, counter, host))) if (os.path.isdir(cfn)): continue counter += 1 if loud and counter % 10 == 0: sys.stdout.write("\r%6d" % counter) sys.stdout.flush() f = file(cfn, "rb") msg = get_message(f) f.close() if not msg: print("Malformed message: %s. Skipping..." % cfn) continue if not msg_train(h, msg, is_spam, force): continue trained += 1 if not options["Headers", "include_trained"]: continue f = file(tfn, "wb") f.write(mboxutils.as_string(msg)) f.close() shutil.copystat(cfn, tfn) os.rename(tfn, cfn) if (removetrained): os.unlink(cfn) if loud: sys.stdout.write("\r%6d" % counter) sys.stdout.write("\r Trained %d out of %d messages\n" % (trained, counter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mhdir_train(h, path, is_spam, force):\n if loud:\n print(\" Reading as MH mailbox\")\n import glob\n counter = 0\n trained = 0\n for fn in glob.glob(os.path.join(path, \"[0-9]*\")):\n counter += 1\n cfn = fn\n tfn = os.path.join(path, \"spambayes.tmp\")\n if l...
[ "0.6355704", "0.59449077", "0.58821434", "0.57554334", "0.5644402", "0.56377137", "0.563683", "0.55812377", "0.5577881", "0.55669934", "0.55518764", "0.5542003", "0.5526991", "0.5500925", "0.54829085", "0.54665416", "0.5462842", "0.5462842", "0.5462842", "0.5462842", "0.54628...
0.6894524
0
Train bayes with a Unix mbox
def mbox_train(h, path, is_spam, force): if loud: print(" Reading as Unix mbox") import mailbox import fcntl f = file(path, "r+b") fcntl.flock(f, fcntl.LOCK_EX) mbox = mailbox.PortableUnixMailbox(f, get_message) outf = os.tmpfile() counter = 0 trained = 0 for msg in mbox: if not msg: print("Malformed message number %d. I can't train on this mbox, sorry." % counter) return counter += 1 if loud and counter % 10 == 0: sys.stdout.write("\r%6d" % counter) sys.stdout.flush() if msg_train(h, msg, is_spam, force): trained += 1 if options["Headers", "include_trained"]: outf.write(mboxutils.as_string(msg, True)) if options["Headers", "include_trained"]: outf.seek(0) try: os.ftruncate(f.fileno(), 0) f.seek(0) except: print("Problem truncating mbox--nothing written") raise try: for line in outf: f.write(line) except: print(file=sys.stderr ("Problem writing mbox! Sorry, " "I tried my best, but your mail " "may be corrupted.")) raise fcntl.flock(f, fcntl.LOCK_UN) f.close() if loud: sys.stdout.write("\r%6d" % counter) sys.stdout.write("\r Trained %d out of %d messages\n" % (trained, counter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mhdir_train(h, path, is_spam, force):\n if loud:\n print(\" Reading as MH mailbox\")\n import glob\n counter = 0\n trained = 0\n for fn in glob.glob(os.path.join(path, \"[0-9]*\")):\n counter += 1\n cfn = fn\n tfn = os.path.join(path, \"spambayes.tmp\")\n if l...
[ "0.64364576", "0.5568894", "0.5551472", "0.5536631", "0.55087847", "0.5448178", "0.5402387", "0.5222322", "0.5197107", "0.5109843", "0.5092976", "0.5084856", "0.5042653", "0.49968976", "0.49160054", "0.48901597", "0.48886093", "0.48782876", "0.48486832", "0.4847762", "0.48258...
0.7277786
0
Train bayes with an mh directory
def mhdir_train(h, path, is_spam, force): if loud: print(" Reading as MH mailbox") import glob counter = 0 trained = 0 for fn in glob.glob(os.path.join(path, "[0-9]*")): counter += 1 cfn = fn tfn = os.path.join(path, "spambayes.tmp") if loud and counter % 10 == 0: sys.stdout.write("\r%6d" % counter) sys.stdout.flush() f = file(fn, "rb") msg = get_message(f) f.close() if not msg: print("Malformed message: %s. Skipping..." % cfn) continue msg_train(h, msg, is_spam, force) trained += 1 if not options["Headers", "include_trained"]: continue f = file(tfn, "wb") f.write(mboxutils.as_string(msg)) f.close() shutil.copystat(cfn, tfn) os.rename(tfn, cfn) if loud: sys.stdout.write("\r%6d" % counter) sys.stdout.write("\r Trained %d out of %d messages\n" % (trained, counter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, trainfile):", "def maildir_train(h, path, is_spam, force, removetrained):\n if loud:\n print(\" Reading %s as Maildir\" % (path,))\n import time\n import socket\n pid = os.getpid()\n host = socket.gethostname()\n counter = 0\n trained = 0\n for fn in os.listdir(pat...
[ "0.6380039", "0.6258465", "0.61761475", "0.61341226", "0.61309236", "0.6125414", "0.5975877", "0.5948309", "0.593305", "0.593305", "0.593305", "0.593305", "0.593305", "0.59213877", "0.59187734", "0.59036076", "0.5867951", "0.5858581", "0.5823942", "0.5820531", "0.5797346", ...
0.6462255
0
Print usage message and sys.exit(code).
def usage(code, msg=''): if msg: print(msg, file=sys.stderr) print(file=sys.stderr) print(__doc__ % globals(), file=sys.stderr) sys.exit(code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage(code, msg=''):\n if msg:\n print >> sys.stderr, msg\n print >> sys.stderr\n print >> sys.stderr, __doc__ % globals()\n sys.exit(code)", "def print_usage(retcode=None):\n\n print(USAGE)\n\n if retcode is not None:\n sys.exit(retcode)", "def _usage(args, contents): #...
[ "0.857187", "0.84930104", "0.82156926", "0.80079097", "0.80019534", "0.7876711", "0.7762567", "0.7719165", "0.7678097", "0.76671606", "0.76106125", "0.7526046", "0.7498428", "0.7443448", "0.7410347", "0.739671", "0.73825425", "0.7338862", "0.72609067", "0.72423035", "0.721592...
0.83571476
2
Main program; parse options and go.
def main(): global loud try: opts, args = getopt.getopt(sys.argv[1:], 'hfqnrd:p:g:s:o:') except getopt.error as msg: usage(2, msg) if not opts: usage(2, "No options given") force = False trainnew = False removetrained = False good = [] spam = [] for opt, arg in opts: if opt == '-h': usage(0) elif opt == "-f": force = True elif opt == "-n": trainnew = True elif opt == "-q": loud = False elif opt == '-g': good.append(arg) elif opt == '-s': spam.append(arg) elif opt == "-r": removetrained = True elif opt == '-o': options.set_from_cmdline(arg, sys.stderr) pck, usedb = storage.database_type(opts) if args: usage(2, "Positional arguments not allowed") if usedb == None: usedb = options["Storage", "persistent_use_database"] pck = get_pathname_option("Storage", "persistent_storage_file") h = hammie.open(pck, usedb, "c") for g in good: if loud: print("Training ham (%s):" % g) train(h, g, False, force, trainnew, removetrained) sys.stdout.flush() save = True for s in spam: if loud: print("Training spam (%s):" % s) train(h, s, True, force, trainnew, removetrained) sys.stdout.flush() save = True if save: h.store()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n opt = parse_opts()\n run(opt)", "def main():\n opt = parse_opts()\n run(opt)", "def main():\n args = parse_args()\n process_args(args)", "def main():\r\n\r\n option_parser, opts, args = parse_command_line_parameters(**script_info)\r\n\r\n # additional option checks\r\n ...
[ "0.8560429", "0.8560429", "0.7825128", "0.7385847", "0.7380843", "0.7359725", "0.7359053", "0.7329115", "0.7324324", "0.73130786", "0.72243994", "0.7201445", "0.71907645", "0.7140356", "0.71203774", "0.70296603", "0.7009472", "0.69990236", "0.69920576", "0.6989174", "0.697666...
0.0
-1
Geeft het aangewezen team de bijbehorende punten
def add_score(home, away, outcome, curr_score_dict, points=3): if outcome == "Draw": """Roept hier zichzelf aan en geeft beide teams 1 point""" curr_score_dict = add_score(home, away, home, curr_score_dict, 1) curr_score_dict = add_score(home, away, away, curr_score_dict, 1) else: curr_score_dict[outcome] += points return curr_score_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_team(self) -> str: # pragma: no cover", "def test_assign_managing_team(self):\n pass", "def get_teams():", "def tournament(self):\n pass", "def test_retrieve_team(self):\n pass", "def getTeam(self):\n return [\"The A-Team\", \"some other bloke\"]", "def test_get_p...
[ "0.6666914", "0.6513072", "0.6471292", "0.64375335", "0.6296479", "0.6221735", "0.6213691", "0.6190552", "0.6122579", "0.60757536", "0.6051041", "0.6051041", "0.6043804", "0.6019438", "0.5961975", "0.596115", "0.5952441", "0.58856195", "0.58792037", "0.5852543", "0.5833983", ...
0.0
-1
Deze functie speelt 1 wedstrijd
def run_one_match(match, chance): home = match[0] away = match[1] home_win = chance[0] draw = chance[1] random_number = random.get_random_number_0_1() * 100 if 0 <= random_number < home_win: return home elif home_win <= random_number < (home_win + draw): return "Draw" elif (home_win + draw) <= random_number < 100: return away
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one(self):", "def one():\n return 1", "def firstFunction(self):", "def first(self):", "def f(self):\n return 1", "def g(self):\n return 2", "def af(self) -> int:", "def __len__(self):\n\t\treturn 1", "def simple():", "def simple():", "def MINET(self):", "def __len...
[ "0.75467473", "0.69522214", "0.64830875", "0.6376005", "0.627995", "0.6255927", "0.62200975", "0.61720407", "0.61150414", "0.61150414", "0.61148226", "0.60770017", "0.6056167", "0.6049184", "0.6015185", "0.600677", "0.5944893", "0.5944893", "0.5924077", "0.589751", "0.5880711...
0.0
-1
Runt 1x de pool, dus alle combinaties van teams worden gespeeld. Na 1x spelen van de pool komt er een huidige score uit met welke teams welke punten hebben.
def run_one_pool(curr_pool, goals=False): curr_score = { "Ajax": 0, "Feyenoord": 0, "PSV": 0, "FC Utrecht": 0, "Willem II": 0 } for match in curr_pool: if curr_pool[match]: teamvsteam, chance = match, curr_pool[match] if not goals: outcome = run_one_match(teamvsteam, chance) else: outcome = run_one_match_with_goals(teamvsteam, curr_pool) curr_score = add_score(teamvsteam[0], teamvsteam[1], outcome, curr_score) return curr_score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted):\n battleData, htmlData = loadBattleData(league)\n similarities = loadSims() \n \n #If not given an opponent team then simply randomly choose losers from the dataset to compare to.\n if len(oppTeam) == 0:\n picks = set([])\n ...
[ "0.6253384", "0.6129651", "0.6121192", "0.58671147", "0.56712914", "0.56542623", "0.5605723", "0.55911577", "0.5516436", "0.5502499", "0.5497719", "0.5487439", "0.5475032", "0.5417539", "0.5398502", "0.53883797", "0.5378638", "0.53657436", "0.5356736", "0.53533053", "0.531976...
0.6507316
0
Voor het krijgen van het team met de hoogste score Eerst maak je een lijst van keys en values van de dict aan, Dan return je de key met de hoogste value
def get_key_with_max_value(dictionary): values = list(dictionary.values()) keys = list(dictionary.keys()) return keys[values.index(max(values))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getKey(team):\n\treturn team.pointsTotal", "def test_get_score(self):\r\n score_dict = self.combinedoe.get_score()\r\n self.assertEqual(score_dict['score'], 15.0)\r\n self.assertEqual(score_dict['total'], 5.0)", "def calculate_scores(players):\n scores = {}\n for player in player...
[ "0.6327457", "0.60438794", "0.59636986", "0.59507185", "0.59062374", "0.5892593", "0.5856969", "0.5797239", "0.5787206", "0.5772934", "0.5765099", "0.57467407", "0.5697413", "0.56824213", "0.56676555", "0.56566817", "0.5620655", "0.56118125", "0.5599565", "0.5589965", "0.5582...
0.0
-1
Na het spelen van een pool heeft ieder team een ranking gekregen Een ranking van 1ste tot 5e plek
def rank_teams_of_curr_run(curr_score, curr_ranking): for place in curr_ranking: curr_place = get_key_with_max_value(curr_score) curr_ranking[place] = curr_ranking[place].__add__([curr_place]) curr_score.pop(curr_place) return curr_ranking
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank():\n return 0", "def __rank__(self) -> int:", "def determine_winner1(self): \r\n sorted_player_rank = self._rank()\r\n print(f\"sorted player rank: {sorted_player_rank}\")\r\n print(f\"winner is player {sorted_player_rank[0]}: with points {sorted_player_rank[0][1]}\")", "d...
[ "0.6728134", "0.6681021", "0.66481817", "0.6520164", "0.64416414", "0.6437209", "0.6390938", "0.6388172", "0.63257813", "0.6287748", "0.62862384", "0.62794214", "0.6261754", "0.6251218", "0.62348217", "0.62102944", "0.61975676", "0.61489576", "0.6129253", "0.6124578", "0.6107...
0.6324077
9
Het draaien van de monte carlo machine speelt gewoon heel veel pools (de hoeveelheid runs). Na het spelen van een pool wordt de ranking van die partij toegevoegd aan de totale ranking. Als bijvoorbeeld ajax 10x eerste wordt, dan staat die 10x in de lijst van total_ranking[1]
def run_monte_carlo(runs, pool, goals=False): total_ranking = { 1: [], 2: [], 3: [], 4: [], 5: [] } for run in range(runs): if goals: curr_score = run_one_pool(pool, True) else: curr_score = run_one_pool(pool) total_ranking = rank_teams_of_curr_run(curr_score, total_ranking) return total_ranking
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mlbpowerrankings(self, irc, msg, args):\n \n url = self._b64decode('aHR0cDovL2VzcG4uZ28uY29tL21sYi9wb3dlcnJhbmtpbmdz')\n\n try:\n req = urllib2.Request(url)\n html = (urllib2.urlopen(req)).read()\n except:\n irc.reply(\"Failed to fetch: %s\" % url)\n...
[ "0.6204498", "0.6093356", "0.5933787", "0.58172834", "0.57272923", "0.5666633", "0.5657551", "0.5655824", "0.5565564", "0.55135745", "0.54635066", "0.5455027", "0.5450292", "0.54313564", "0.5428389", "0.54252523", "0.5423509", "0.54218894", "0.5421884", "0.5414211", "0.541161...
0.6112421
1
Rekent uit hoeveel kans elk team heeft om op welke positie te komen.
def get_monte_carlo_output_as_chance_pool_position(monte_carlo_output): teams = ['FC Utrecht', 'Feyenoord', 'Ajax', 'Willem II', 'PSV'] chance_of_position = {'FC Utrecht': [], 'Feyenoord': [], 'Ajax': [], 'Willem II': [], 'PSV': []} for place in monte_carlo_output: curr_place_data = monte_carlo_output[place] for team in teams: chance_of_position[team] = chance_of_position[team].__add__( [curr_place_data.count(team) / len(curr_place_data) * 100]) return chance_of_position
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_assign_managing_team(self):\n pass", "def test_retrieve_team(self):\n pass", "def yield_team(self) -> str: # pragma: no cover", "def test_get_player_upcoming_chests(self):\n pass", "def test_get_game_diff(self):\n pass", "def test_get_teams(self):\n pass", "...
[ "0.62098694", "0.61753535", "0.61327255", "0.6104695", "0.6101235", "0.6073628", "0.6073628", "0.6066183", "0.6057919", "0.6053062", "0.59653044", "0.5929945", "0.5929048", "0.59061193", "0.58922637", "0.58756685", "0.58638287", "0.5809114", "0.5790195", "0.5784957", "0.57837...
0.0
-1
Zet de kans dat welk team op welke positie kan komen om naar een dataframe
def get_monte_carlo_output_as_chance_pool_position_as_df(output_chance_pool_position): index = ['FC Utrecht', 'Feyenoord', 'Ajax', 'Willem II', 'PSV'] data = np.array([output_chance_pool_position['FC Utrecht'], output_chance_pool_position['Feyenoord'], output_chance_pool_position['Ajax'], output_chance_pool_position['Willem II'], output_chance_pool_position['PSV']]) df = pd.DataFrame( data=data, columns=['1st pos', '2st pos', '3st pos', '4st pos', '5st pos', ], index=index) return df.sort_values(by=['1st pos'], ascending=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teams(self, game_id: int) -> DataFrame[Any]:", "def history(df, team, opponent):\n if opponent:\n games = df[(df.team == team) & (df.opponent == opponent)]#team_games(df, team)\n else:\n games = df[df.team == team]#team_games(df, team)\n\n games['dragkills'] = (games['teamdragkills'] +...
[ "0.71462554", "0.6340257", "0.62695956", "0.6160155", "0.604419", "0.5988061", "0.59751797", "0.5950979", "0.5900773", "0.58963233", "0.5861297", "0.5782506", "0.57776165", "0.5742003", "0.57202584", "0.5702576", "0.5697749", "0.5696252", "0.5693709", "0.5687836", "0.56840354...
0.0
-1
Showing some metrics about the training process
def acc(self, Y, Y_pred): Y = list(Y); Y_pred = list(Y_pred) print('precision:', precision_score(Y, Y_pred)) print('accuracy:', accuracy_score(Y, Y_pred)) print('recall:', recall_score(Y, Y_pred)) print('micro_F1:', f1_score(Y, Y_pred, average='micro')) print('macro_F1:', f1_score(Y, Y_pred, average='macro')) _path = os.path.join(PATH, self.rule, "stacking", "train", self.test_file) with open(os.path.join(_path, "log.txt"), 'a', encoding='utf-8') as f: f.write(str(accuracy_score(Y, Y_pred))) f.write('\n') f.write(str(precision_score(Y, Y_pred))) f.write('\n') f.write(str(recall_score(Y, Y_pred))) f.write('\n') f.write(str(f1_score(Y, Y_pred, average='micro'))) f.write('\n') f.write(str(f1_score(Y, Y_pred, average='macro'))) f.write('\n') f.write('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training_info(self):\n pass", "def see_evaluation(epoch, training_acc, test_acc):\n print (\"Epoch \", epoch, \"Training acc: \", training_acc*100, \"Test acc: \", test_acc*100)", "def log_training_results(engine: Engine):\n train_evaluator.run(self.train_dl)\n metrics: Dict...
[ "0.742047", "0.7125699", "0.70225435", "0.6843678", "0.6834565", "0.67972416", "0.6694375", "0.6562454", "0.6555784", "0.6526767", "0.64960825", "0.64705855", "0.64659774", "0.64622957", "0.6448941", "0.6423238", "0.640517", "0.63936925", "0.6384484", "0.6364167", "0.63290286...
0.0
-1
Save the model during training process
def saveModel(self, save_path): if not os.path.exists('/'.join(os.path.split(save_path)[:-1])): os.makedirs('/'.join(os.path.split(save_path)[:-1])) with open(save_path, 'wb') as fw: pickle.dump(self.clf, fw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self):\n joblib.dump(self.pipeline, \"model.joblib\")", "def save(self):\n\n self.saver.save(self.sess, self.path + '/tensorflow-model', global_step=self.counter.count)", "def save_model(self):\n self.pred_net.save((self.save_path / \"iqn_pred_net\").absolute().as_posix())\n self...
[ "0.83240354", "0.8217656", "0.81594694", "0.81355256", "0.81164765", "0.8089369", "0.80891705", "0.808788", "0.806147", "0.8058413", "0.804224", "0.80383664", "0.800308", "0.79580605", "0.79499894", "0.7901396", "0.7878723", "0.7874183", "0.7860603", "0.78565586", "0.78311694...
0.7401242
74
Showing some metrics about the training process
def acc(self, Y, Y_pred): Y = list(Y); Y_pred = list(Y_pred) print('precision:', precision_score(Y, Y_pred)) print('accuracy:', accuracy_score(Y, Y_pred)) print('recall:', recall_score(Y, Y_pred)) print('micro_F1:', f1_score(Y, Y_pred, average='micro')) print('macro_F1:', f1_score(Y, Y_pred, average='macro')) _path = os.path.join(PATH, self.rule, "stacking", "test", self.test_file) with open(os.path.join(_path, "layer2_log.txt"), 'a', encoding='utf-8') as f: f.write(str(accuracy_score(Y, Y_pred))) f.write('\n') f.write(str(precision_score(Y, Y_pred))) f.write('\n') f.write(str(recall_score(Y, Y_pred))) f.write('\n') f.write(str(f1_score(Y, Y_pred, average='micro'))) f.write('\n') f.write(str(f1_score(Y, Y_pred, average='macro'))) f.write('\n') f.write('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training_info(self):\n pass", "def see_evaluation(epoch, training_acc, test_acc):\n print (\"Epoch \", epoch, \"Training acc: \", training_acc*100, \"Test acc: \", test_acc*100)", "def log_training_results(engine: Engine):\n train_evaluator.run(self.train_dl)\n metrics: Dict...
[ "0.742047", "0.7125699", "0.70225435", "0.6843678", "0.6834565", "0.67972416", "0.6694375", "0.6562454", "0.6555784", "0.6526767", "0.64960825", "0.64705855", "0.64659774", "0.64622957", "0.6448941", "0.6423238", "0.640517", "0.63936925", "0.6384484", "0.6364167", "0.63290286...
0.0
-1
compute truncate_div calculating data's truncate_div, res = floor(x / y) if x/y>0 else ceil(x/y)
def truncate_div_compute(input_x, input_y, output_x, kernel_name="truncate_div"): shape_list = broadcast_shapes( te.lang.cce.util.shape_to_list(input_x.shape), te.lang.cce.util.shape_to_list(input_y.shape), param_name_input1="input_x", param_name_input2="input_y") int_list = ("int32", "int8", "uint8") input_dtype = input_x.dtype if input_dtype in int_list: data_zero = te.lang.cce.broadcast(tvm.const(0, 'float32'), shape_list[2], 'float32') data_x_broad = te.lang.cce.cast_to(input_x, 'float32') data_y_broad = te.lang.cce.cast_to(input_y, 'float32') data_x_broad = te.lang.cce.broadcast(data_x_broad, shape_list[2]) data_y_broad = te.lang.cce.broadcast(data_y_broad, shape_list[2]) res_div = te.lang.cce.vdiv(data_x_broad, data_y_broad) res_min_int = te.lang.cce.ceil(te.lang.cce.vmin(res_div, data_zero)) res_max_int = te.lang.cce.floor(te.lang.cce.vmax(res_div, data_zero)) res_trunc = te.lang.cce.vadd(res_min_int, res_max_int) else: if tbe_platform.cce_conf.api_check_support("te.lang.cce.vlog", "float32"): input_x = te.lang.cce.cast_to(input_x, 'float32') input_y = te.lang.cce.cast_to(input_y, 'float32') data_x_broad = te.lang.cce.broadcast(input_x, shape_list[2]) data_y_broad = te.lang.cce.broadcast(input_y, shape_list[2]) res_trunc = te.lang.cce.vdiv(data_x_broad, data_y_broad) res = te.lang.cce.cast_to(res_trunc, input_dtype) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trunc_divide(lhs, rhs):\n return _make.trunc_divide(lhs, rhs)", "def ceildiv(a, b):\n return - (-a // b)", "def floor_div(a, b):\r\n # see decorator for function body\r", "def division(x, y, val = 0.0):\n if y != 0.0:\n val = float(x)/y\n return val", "def ceil_division(left_numbe...
[ "0.72226495", "0.6773521", "0.67653507", "0.65383255", "0.6387221", "0.63650364", "0.63168216", "0.63073", "0.62371224", "0.61715484", "0.6150904", "0.61437595", "0.6043365", "0.6009371", "0.6003909", "0.598048", "0.597958", "0.5978322", "0.5967595", "0.5960188", "0.5945854",...
0.73679143
0
Test alert policies .list()
def test_list_success(self, mock_get): mock_response = Mock(name='response') mock_response.json.return_value = self.policies_list_response mock_get.return_value = mock_response # Call the method response = self.policies.list() self.assertIsInstance(response, dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v1_alert_list_get(self):\n pass", "def test_list_alerts(self):\n pass", "def test_get_bios_policy_list(self):\n pass", "def test_get_dispatch_policy_list(self):\n pass", "def test_list_policy_for_all_namespaces(self):\n pass", "def test_list_namespaced_policy(s...
[ "0.7320283", "0.7009485", "0.68623906", "0.6676029", "0.65982765", "0.6446588", "0.6370711", "0.63015115", "0.6268315", "0.62665725", "0.6262467", "0.6249218", "0.62093353", "0.619969", "0.6179443", "0.617516", "0.6135", "0.6088493", "0.6051141", "0.60350955", "0.6035052", ...
0.58156645
35
Test alert policies .list() with filter_ids
def test_list_success_with_name(self, mock_get): mock_response = Mock(name='response') mock_response.json.return_value = self.policies_list_response mock_get.return_value = mock_response # Call the method response = self.policies.list(filter_name='Default Server Policy') self.assertIsInstance(response, dict) mock_get.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policies.json', headers=self.policies.headers, params='filter[name]=Default Server Policy' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_success_with_ids(self, mock_get):\n mock_response = Mock(name='response')\n mock_response.json.return_value = self.policies_list_response\n mock_get.return_value = mock_response\n\n # Call the method\n response = self.policies.list(filter_ids=[12345])\n\n sel...
[ "0.6732557", "0.591742", "0.5886457", "0.579967", "0.57484436", "0.5735297", "0.5659622", "0.56118584", "0.5551729", "0.5519896", "0.5487717", "0.5482517", "0.5437249", "0.5420804", "0.54120773", "0.5385751", "0.53770655", "0.5374436", "0.53729784", "0.53688127", "0.53541356"...
0.52062327
32
Test alert policies .list() failure case
def test_list_failure(self, mock_get): mock_response = Mock(name='response') mock_response.json.side_effect = ValueError('No JSON object could be decoded') mock_get.return_value = mock_response with self.assertRaises(ValueError): # Call the method self.policies.list()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_v1_alert_list_get(self):\n pass", "def test_list_alerts(self):\n pass", "def test_get_bios_policy_list(self):\n pass", "def test_get_dispatch_policy_list(self):\n pass", "def test_list_namespaced_policy(self):\n pass", "def test_list_policy_for_all_namespaces(s...
[ "0.76680684", "0.7328831", "0.68924195", "0.66651005", "0.65867394", "0.640709", "0.6294047", "0.62565273", "0.6240385", "0.62350607", "0.6212331", "0.6180631", "0.6174799", "0.61615473", "0.6154809", "0.611734", "0.6114586", "0.60622686", "0.60566926", "0.6034982", "0.603498...
0.6274525
8
Test alert policies .create() calls put with correct parameters
def test_create_success(self, mock_post): self.policies.create( name=self.policy_single_response['policy']['name'], incident_preference=self.policy_single_response['policy']['incident_preference'] ) mock_post.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policies.json', headers=self.policies.headers, data=json.dumps({ "policy": { "name": self.policy_single_response['policy']['name'], "incident_preference": self.policy_single_response['policy']['incident_preference'] } }) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update(self, mock_put):\n self.policies.update(id=333114, policy_update=self.policy_show_response)\n\n mock_put.assert_called_once_with(\n url='https://api.newrelic.com/v2/alert_policies/333114.json',\n headers=self.policies.headers,\n data=json.dumps(self.po...
[ "0.68285656", "0.6772421", "0.67621154", "0.64469576", "0.6395389", "0.63586205", "0.6352661", "0.6176362", "0.60673046", "0.6066516", "0.60473686", "0.60405195", "0.59732294", "0.5936393", "0.59167117", "0.5909094", "0.5891978", "0.58826816", "0.5856741", "0.58251625", "0.58...
0.67850477
1
Test alert policies .update() calls put with correct parameters
def test_update_success(self, mock_put): self.policies.update( id=self.policy_single_response['policy']['id'], name=self.policy_single_response['policy']['name'], incident_preference=self.policy_single_response['policy']['incident_preference'] ) mock_put.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policies/{0}.json'.format( self.policy_single_response['policy']['id'] ), headers=self.policies.headers, data=json.dumps({ "policy": { "name": self.policy_single_response['policy']['name'], "incident_preference": self.policy_single_response['policy']['incident_preference'] } }) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update(self, mock_put):\n self.policies.update(id=333114, policy_update=self.policy_show_response)\n\n mock_put.assert_called_once_with(\n url='https://api.newrelic.com/v2/alert_policies/333114.json',\n headers=self.policies.headers,\n data=json.dumps(self.po...
[ "0.79217553", "0.71475583", "0.709934", "0.6928383", "0.6687903", "0.66773266", "0.6663834", "0.6655021", "0.66526735", "0.65455186", "0.6470367", "0.6439922", "0.6429988", "0.6426166", "0.641693", "0.63938844", "0.63904506", "0.6387737", "0.63814616", "0.6356233", "0.6352678...
0.77502126
1
Test alert policies .delete() success
def test_delete_success(self, mock_delete): self.policies.delete(id=self.policy_single_response['policy']['id']) mock_delete.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policies/{0}.json'.format( self.policy_single_response['policy']['id'] ), headers=self.policies.headers )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_alert_by_id(self):\n pass", "def test_delete_success_alert():\n app = HelperApp(server.message_app)\n app.post('/login/', {'username': 'jessie', 'password': 'frog'})\n\n # Add a an message\n app.post('/compose/', {'to': 'james', 'subject': 's', 'body': 'S'})\n app.get('/') ...
[ "0.7788935", "0.74828786", "0.7098903", "0.70895654", "0.70789915", "0.7048444", "0.7027411", "0.69928205", "0.69801384", "0.6939634", "0.6917779", "0.69133645", "0.69022495", "0.6870939", "0.68659055", "0.68542594", "0.68441856", "0.6840614", "0.67858964", "0.67836225", "0.6...
0.7756372
1
Test alert policies .associate_with_notification_channel() calls put with correct parameters
def test_associate_with_notification_channel_success(self, mock_put): self.policies.associate_with_notification_channel( id=self.policy_single_response['policy']['id'], channel_id=self.channel_single_response['channel']['id'], ) mock_put.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policy_channels.json?policy_id={0}&channel_ids={1}'.format( self.policy_single_response['policy']['id'], self.channel_single_response['channel']['id'] ), headers=self.policies.headers )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dissociate_from_notification_channel(self, mock_put):\n self.policies.associate_with_notification_channel(\n id=self.policy_single_response['policy']['id'],\n channel_id=self.channel_single_response['channel']['id'],\n )\n\n mock_put.assert_called_once_with(\n ...
[ "0.73635596", "0.6459767", "0.60581565", "0.6028323", "0.60136247", "0.57947695", "0.5774505", "0.57623434", "0.5741606", "0.57012004", "0.5592528", "0.5584041", "0.55792534", "0.5516984", "0.55149835", "0.54886246", "0.5476943", "0.5455049", "0.5427881", "0.53757334", "0.534...
0.7614871
0
Test alert policies .associate_with_notification_channel() calls put with correct parameters
def test_dissociate_from_notification_channel(self, mock_put): self.policies.associate_with_notification_channel( id=self.policy_single_response['policy']['id'], channel_id=self.channel_single_response['channel']['id'], ) mock_put.assert_called_once_with( url='https://api.newrelic.com/v2/alerts_policy_channels.json?policy_id={0}&channel_ids={1}'.format( self.policy_single_response['policy']['id'], self.channel_single_response['channel']['id'] ), headers=self.policies.headers )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_associate_with_notification_channel_success(self, mock_put):\n self.policies.associate_with_notification_channel(\n id=self.policy_single_response['policy']['id'],\n channel_id=self.channel_single_response['channel']['id'],\n )\n\n mock_put.assert_called_once_wit...
[ "0.7613531", "0.64621556", "0.6059576", "0.60289395", "0.6013516", "0.57984847", "0.57735455", "0.57597476", "0.5742299", "0.570157", "0.5592619", "0.55849236", "0.5579137", "0.55171704", "0.5513387", "0.54899305", "0.54773784", "0.5452856", "0.54276377", "0.5375686", "0.5347...
0.7362509
1
get a list of models and configuration from the given directory
def get_file_names(path, extension='.json'): fn = os.listdir(path) l = [] for f in fn: if f.endswith(extension, 4): l.append(f) l = sorted(l) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_models_from_metafile(dir: str):\n meta_indexes = load(osp.join(dir, 'model-index.yml'))\n for meta_path in meta_indexes['Import']:\n # meta_path example: mmcls/.mim/configs/conformer/metafile.yml\n meta_path = osp.join(dir, meta_path)\n metainfo = load(meta_p...
[ "0.6871721", "0.6686087", "0.66322124", "0.6540745", "0.6520653", "0.6479264", "0.63319236", "0.63026965", "0.62088084", "0.617197", "0.6127471", "0.6107416", "0.6101004", "0.6093919", "0.6012968", "0.60112035", "0.5945807", "0.59440786", "0.5943602", "0.5941794", "0.5922967"...
0.0
-1