query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.
def policy_name(self) -> Optional[str]: return pulumi.get(self, "policy_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_name(self, policy_name):\n\n self._policy_name = policy_name", "def policy_name(self, policy_name):\n\n self._policy_name = policy_name", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n ...
[ "0.5633985", "0.5633985", "0.5570308", "0.5570308", "0.5570308", "0.5570308", "0.5570308", "0.5570308", "0.5570308", "0.5490895", "0.5324416", "0.5102402", "0.502673", "0.49200144", "0.4904921", "0.48910597", "0.48780617", "0.48602393", "0.4856884", "0.47738758", "0.47476506"...
0.5550509
9
ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.
def __init__(__self__, *, match_resources: Optional['outputs.MatchResourcesPatch'] = None, param_ref: Optional['outputs.ParamRefPatch'] = None, policy_name: Optional[str] = None, validation_actions: Optional[Sequence[str]] = None): if match_res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec(self) -> Optional['outputs.ValidatingAdmissionPolicyBindingSpec']:\n return pulumi.get(self, \"spec\")", "def __init__(__self__, *,\n api_version: Optional[str] = None,\n kind: Optional[str] = None,\n metadata: Optional['_meta.v1.outputs.ObjectMeta'...
[ "0.7044167", "0.5892073", "0.57587856", "0.47794646", "0.46277392", "0.45490396", "0.44193137", "0.43513086", "0.43085527", "0.4262087", "0.42224517", "0.41610533", "0.4109367", "0.4109334", "0.40802166", "0.4066284", "0.4064739", "0.4055199", "0.40452915", "0.4036", "0.40158...
0.0
-1
PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.
def policy_name(self) -> Optional[str]: return pulumi.get(self, "policy_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_name(self, policy_name):\n\n self._policy_name = policy_name", "def policy_name(self, policy_name):\n\n self._policy_name = policy_name", "def policy_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_name\")", "def policy_name(self) -> pulumi.Input[str]:\n ...
[ "0.5631732", "0.5631732", "0.55699396", "0.55699396", "0.55699396", "0.55699396", "0.55699396", "0.55699396", "0.55699396", "0.54904664", "0.5323996", "0.5099683", "0.502581", "0.49196115", "0.49045834", "0.48892766", "0.48762485", "0.48594192", "0.48577783", "0.47718355", "0...
0.55509245
10
failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or misconfigured policy definitions or bindings. A policy is invalid if spec.paramKind refers to a nonexistent Kind. A binding is invalid if spec.para...
def failure_policy(self) -> Optional[str]: return pulumi.get(self, "failure_policy")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_policy(policy):\n if \"name\" not in policy:\n raise AttributeError(\"Policy missing attribute name.\")\n if \"policyType\" not in policy:\n raise AttributeError(\"Policy {} do not have PolicyType.\".format(policy[\"name\"]))\n if policy[\"policyType\"] not in [0, 1, 2]:\n ...
[ "0.5835593", "0.51083267", "0.5080039", "0.5063163", "0.4998524", "0.49710676", "0.4908479", "0.48891646", "0.48433125", "0.48009688", "0.47964483", "0.4781463", "0.47520885", "0.47497296", "0.47328606", "0.46700382", "0.4596225", "0.45896113", "0.4576499", "0.45675892", "0.4...
0.65031314
3
failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or misconfigured policy definitions or bindings. A policy is invalid if spec.paramKind refers to a nonexistent Kind. A binding is invalid if spec.para...
def failure_policy(self) -> Optional[str]: return pulumi.get(self, "failure_policy")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_policy(policy):\n if \"name\" not in policy:\n raise AttributeError(\"Policy missing attribute name.\")\n if \"policyType\" not in policy:\n raise AttributeError(\"Policy {} do not have PolicyType.\".format(policy[\"name\"]))\n if policy[\"policyType\"] not in [0, 1, 2]:\n ...
[ "0.5835224", "0.51080525", "0.5080742", "0.50630075", "0.4998422", "0.49712896", "0.49080715", "0.48887676", "0.48433957", "0.47994038", "0.47960606", "0.4781688", "0.4751839", "0.47501805", "0.47330263", "0.46712813", "0.45962194", "0.45904255", "0.45761374", "0.4568598", "0...
0.6503159
2
ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy.
def __init__(__self__, *, conditions: Optional[Sequence['_meta.v1.outputs.Condition']] = None, observed_generation: Optional[int] = None, type_checking: Optional['outputs.TypeChecking'] = None): if conditions is not None: pulumi.set(__self__, "condi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self) -> Optional['outputs.ValidatingAdmissionPolicyStatus']:\n return pulumi.get(self, \"status\")", "def status(self, status):\n allowed_values = [\"loaned\", \"finished\"] # noqa: E501\n if self.local_vars_configuration.client_side_validation and status not in allowed_values: ...
[ "0.69716156", "0.55257034", "0.5407147", "0.537072", "0.5350528", "0.5250231", "0.51140606", "0.5092403", "0.50157684", "0.50073355", "0.4939124", "0.49281713", "0.49000558", "0.48840648", "0.48489165", "0.48327956", "0.4818739", "0.48000705", "0.47999936", "0.4761761", "0.47...
0.0
-1
ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy.
def __init__(__self__, *, conditions: Optional[Sequence['_meta.v1.outputs.ConditionPatch']] = None, observed_generation: Optional[int] = None, type_checking: Optional['outputs.TypeCheckingPatch'] = None): if conditions is not None: pulumi.set(__self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(self) -> Optional['outputs.ValidatingAdmissionPolicyStatus']:\n return pulumi.get(self, \"status\")", "def status(self, status):\n allowed_values = [\"loaned\", \"finished\"] # noqa: E501\n if self.local_vars_configuration.client_side_validation and status not in allowed_values: ...
[ "0.69716156", "0.55257034", "0.5407147", "0.537072", "0.5350528", "0.5250231", "0.51140606", "0.5092403", "0.50157684", "0.50073355", "0.4939124", "0.49281713", "0.49000558", "0.48840648", "0.48489165", "0.48327956", "0.4818739", "0.48000705", "0.47999936", "0.4761761", "0.47...
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): confusion_matrix_dir = './confusion_matrix_plots' if not os.path.exists(confusion_matrix_dir): os.mkdir(confusion_matrix_dir) plt.cla() plt.figure() plt.imshow(cm, interpolation='nearest', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81920755", "0.8093736", "0.8028212", "0.8017333", "0.79923165", "0.7989431", "0.79789335", "0.7974398", "0.795948", "0.79555666", "0.7935652", "0.7932704", "0.7932632", "0.7929465", "0.7924336", "0.7922666", "0.79221356", "0.7921299", "0.79209703", "0.7916008", "0.7914319"...
0.7920307
19
Returns a list with all the word indexes to split the corpus into pages at. If you do pairwise(getPageSplits(...)) it will return the startIndex and endIndex of the words in that page.
def getPageSplits(testDataWithFeatures, allLabels): assert (len(testDataWithFeatures)-1) % len(allLabels) == 0 numWords = (len(testDataWithFeatures) - 1) / len(allLabels) + 1 approximateWordsPerPage = 8000 numPages = int(round(float(numWords) / approximateWordsPerPage)) numPages = max(numPage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(self):\r\n\r\n #using database\r\n\r\n if self.using_database:\r\n value_tuple = (notebookname,)\r\n db_cursor.execute(\"SELECT word\"\r\n +\" FROM word_to_indexes\"\r\n +\" WHERE notebook=?;\",\r\n ...
[ "0.59858227", "0.58930147", "0.5881305", "0.58526915", "0.5807913", "0.5792143", "0.5780423", "0.5718214", "0.56908", "0.5673136", "0.5658767", "0.56476617", "0.56389236", "0.5635444", "0.5578436", "0.5578436", "0.5510148", "0.54985785", "0.5490404", "0.54451317", "0.54240036...
0.6857033
0
Assert that the business legal type is altered.
def test_alteration_process(app, session, orig_legal_type, new_legal_type): # setup identifier = 'BC1234567' business = create_business(identifier) business.legal_type = orig_legal_type alteration_filing = copy.deepcopy(FILING_HEADER) alteration_filing['filing']['business']['legalType'] = orig_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ticket_type_change_error_bad_type(self):\n test_name = sys._getframe().f_code.co_name\n rv, output = self._execute('ticket_type change bad_type changed_type')\n self.assertEqual(2, rv)\n self.assertEqual(self.expected_results[test_name], output)", "def test_change_domain_type...
[ "0.656989", "0.65504843", "0.65075123", "0.64481497", "0.6339044", "0.6178134", "0.61590123", "0.6065943", "0.6063289", "0.6062553", "0.6045977", "0.60454863", "0.5990141", "0.5986804", "0.5977824", "0.59631515", "0.5949707", "0.5907156", "0.5902793", "0.58973396", "0.5886665...
0.62076473
5
Get package primary status.
def _get_primary_status(row): try: return row.find('div', {'class': 'pack_h3'}).string except AttributeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pir_status(self):\n response = self.parent.pir.status()\n return response[0]", "def get_status(self):\n return self._status", "def status_by_package_id(self, package_id):\n return self._delivery_service.package_status(int(package_id))", "def get_status(self):\n retu...
[ "0.6859324", "0.67212015", "0.67179984", "0.67138493", "0.67138493", "0.67138493", "0.6694631", "0.669053", "0.6660498", "0.66603005", "0.66602045", "0.6590318", "0.6583879", "0.6517595", "0.65113854", "0.65110695", "0.6474595", "0.64716995", "0.64471734", "0.6441793", "0.644...
0.64849865
16
Serving input_fn that builds features from placeholders
def _serving_input_fn(self): seq = tf.placeholder(dtype=tf.float32, shape=[None, None], name='seq') features = {'seq': seq} return tf.estimator.export.build_raw_serving_input_receiver_fn(features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_serving_input_fn():\n inputs = {}\n for feat in INPUT_COLUMNS:\n inputs[feat.name] = tf.placeholder(shape=[None], dtype=feat.dtype)\n\n features = {\n key: tf.expand_dims(tensor, -1)\n for key, tensor in inputs.iteritems()\n }\n return tf.contrib.learn.InputFnOps(features, None, inputs)"...
[ "0.7729514", "0.7346831", "0.7324483", "0.72329926", "0.7141356", "0.712646", "0.7116223", "0.70755315", "0.7053651", "0.7038903", "0.70289606", "0.70058405", "0.6954123", "0.6938028", "0.6873422", "0.6867659", "0.68650985", "0.68538463", "0.6836799", "0.68124574", "0.6799177...
0.68011504
20
Set up the test case environment.
def setUp(self): self.app = Flask(__name__) self.gh = mock.MagicMock() self.db = mock.MagicMock() self.sc = mock.MagicMock() self.testcommand = TeamCommand(self.db, self.gh, self.sc) self.help_text = self.testcommand.help self.maxDiff = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def SetupEnvironment(self):\n pass", "def _set_up():\n repl._setUp = self.setUp", "def setUpModule():\n # pull in test envir...
[ "0.8390826", "0.77799433", "0.77799433", "0.7661141", "0.7562371", "0.7500299", "0.7500299", "0.7474197", "0.7414517", "0.7391956", "0.7361548", "0.73167485", "0.7313403", "0.7298214", "0.72912717", "0.7222855", "0.72048897", "0.7172848", "0.71695566", "0.71607", "0.71384484"...
0.0
-1
Test team command delete parser with lookup error.
def test_handle_delete_lookup_error(self): self.db.query.return_value = [] self.assertTupleEqual(self.testcommand.handle("team delete brs", user), (self.testcommand.lookup_error, 200)) self.db.delete.assert_not_called() self.gh.org_delete_team.assert_not_cal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_team(self):\n pass", "def test_teams_delete_team_v1(self):\n pass", "def test_handle_delete(self):\n team = Team(\"BRS\", \"brs\", \"web\")\n team.github_team_id = \"12345\"\n test_user = User(\"userid\")\n test_user.github_id = \"1234\"\n team.a...
[ "0.7559359", "0.7257383", "0.72505456", "0.7183576", "0.68659335", "0.6824783", "0.67677784", "0.66842014", "0.65309316", "0.63344705", "0.63249165", "0.63124037", "0.6246539", "0.61518383", "0.6098072", "0.608815", "0.60859257", "0.6085169", "0.60825646", "0.6071488", "0.606...
0.7316079
1
Test team command delete parser with Github error.
def test_handle_delete_github_error(self): self.db.query.side_effect = GithubAPIException("error") self.assertTupleEqual(self.testcommand.handle("team delete brs", user), ("Team delete was unsuccessful with " "the following error: " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_team(self):\n pass", "def test_teams_delete_team_v1(self):\n pass", "def test_handle_delete(self):\n team = Team(\"BRS\", \"brs\", \"web\")\n team.github_team_id = \"12345\"\n test_user = User(\"userid\")\n test_user.github_id = \"1234\"\n team.a...
[ "0.74363333", "0.7280571", "0.7270792", "0.69625545", "0.68794084", "0.6630471", "0.6593462", "0.64995134", "0.6418535", "0.6400622", "0.6392852", "0.6335247", "0.6313746", "0.6305289", "0.6206836", "0.6206836", "0.61616915", "0.6145311", "0.6079621", "0.60526043", "0.6011954...
0.76252383
0
Test team command remove parser when user is not in team.
def test_handle_remove_not_in_team(self): test_user = User("userid") test_user.permissions_level = Permissions.admin team = Team("BRS", "brs", "web") team.github_team_id = "githubid" other_user = User("anotheruser") other_user.github_id = "githubID" other_user.git...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_teams_remove_user_from_team_v2(self):\n pass", "def test_remove_team_manager_from_team(self):\n pass", "def test_teams_remove_user_from_team_v1(self):\n pass", "def test_handle_remove_not_admin(self):\n test_user = User(\"userid\")\n team = Team(\"BRS\", \"brs\", \...
[ "0.7167882", "0.70738333", "0.69356644", "0.6594624", "0.6430752", "0.628227", "0.6048617", "0.6028056", "0.6010467", "0.6000762", "0.58871084", "0.58561516", "0.58381", "0.5816631", "0.5760512", "0.5673231", "0.56323326", "0.56022483", "0.5554935", "0.5545015", "0.55303717",...
0.69908637
2
Test team command remove parser with insufficient permission.
def test_handle_remove_not_admin(self): test_user = User("userid") team = Team("BRS", "brs", "web") self.db.retrieve.return_value = test_user self.db.query.return_value = [team] with self.app.app_context(): self.assertTupleEqual(self.testcommand.handle("team remove" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_team_manager_from_team(self):\n pass", "def test_teams_remove_user_from_team_v2(self):\n pass", "def test_handle_remove_not_in_team(self):\n test_user = User(\"userid\")\n test_user.permissions_level = Permissions.admin\n team = Team(\"BRS\", \"brs\", \"web\")...
[ "0.74124396", "0.6996266", "0.68074685", "0.6785503", "0.67604196", "0.6723054", "0.66223234", "0.6594288", "0.6567827", "0.6566253", "0.6537217", "0.6290257", "0.62760514", "0.6255405", "0.62469566", "0.6201174", "0.61873424", "0.6101515", "0.60213554", "0.60124296", "0.5997...
0.72986484
1
Test team command remove parser with lookup error.
def test_handle_remove_lookup_error(self): test_user = User("userid") test_user.permissions_level = Permissions.admin self.db.retrieve.side_effect = LookupError with self.app.app_context(): self.assertTupleEqual(self.testcommand.handle("team remove" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_team_manager_from_team(self):\n pass", "def test_handle_remove_not_in_team(self):\n test_user = User(\"userid\")\n test_user.permissions_level = Permissions.admin\n team = Team(\"BRS\", \"brs\", \"web\")\n team.github_team_id = \"githubid\"\n other_user =...
[ "0.7310583", "0.6710687", "0.66906583", "0.6620924", "0.6586377", "0.6461049", "0.641732", "0.6310145", "0.6263386", "0.6214439", "0.61719", "0.61262494", "0.60251486", "0.6001219", "0.5980266", "0.5976109", "0.59418344", "0.5889485", "0.5839505", "0.58375955", "0.5819552", ...
0.62968683
8
Test team command remove parser with github error.
def test_handle_remove_github_error(self): test_user = User("userid") test_user.permissions_level = Permissions.admin team = Team("BRS", "brs", "web") other_user = User("anotheruser") other_user.github_id = "githubID" other_user.github_username = "myuser" self.db....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_team_manager_from_team(self):\n pass", "def test_handle_delete_github_error(self):\n self.db.query.side_effect = GithubAPIException(\"error\")\n self.assertTupleEqual(self.testcommand.handle(\"team delete brs\", user),\n (\"Team delete was unsucce...
[ "0.70039016", "0.66776234", "0.66294795", "0.66225845", "0.6617376", "0.6550644", "0.64537877", "0.6323994", "0.6316362", "0.63047993", "0.6265777", "0.62170887", "0.6210322", "0.61249673", "0.61041236", "0.5930861", "0.5903191", "0.57639116", "0.5751656", "0.5730162", "0.571...
0.7124801
0
Initialize a new LevelViewModel.
def __init__(self, level_model: LevelModel, level_low_limit: int, level_high_limit: int): self.level_model = level_model self.level_min = min(level_model.level_bounds[0], level_model.level_bounds[1]) self.level_max = max(level_model.level_bounds[0], level_model.level_bounds[1]) self.leve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent=None):\n super().__init__(parent)\n\n # Filters on the model\n self.filters = Filters.NoFilter\n self.sorting = Sorting.Date\n\n # Contains all the submitted levels.\n # Key: level code\n # Value: Level instance\n self.levels_dict = ...
[ "0.6532033", "0.62393624", "0.6066005", "0.58251923", "0.57248515", "0.5580931", "0.5565138", "0.55295193", "0.5479385", "0.5414921", "0.54088503", "0.5345123", "0.53381556", "0.53363204", "0.5327553", "0.52900267", "0.5270273", "0.5242362", "0.522015", "0.51983047", "0.51897...
0.57849
4
Obtain the elevation of a given node.
def _elevation(self, node): return self.graph_provider.get_coords(node)['z']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elevation(self):\n return self.container['elevation']", "def get_elevation(self):\n return self.elevation", "def elevation(x, y):\n file = os.path.abspath(\"..\") + \"\\Shape\\Shape.vrt\"\n layer = gdal.Open(file)\n gt = layer.GetGeoTransform()\n rasterx = int((x - gt[0]) / gt[1])...
[ "0.74777585", "0.7380403", "0.7113948", "0.70002407", "0.69765276", "0.693508", "0.6879331", "0.67873174", "0.65245295", "0.6443845", "0.6351145", "0.63081145", "0.62342453", "0.6155747", "0.60225326", "0.59598935", "0.5955485", "0.59541744", "0.5894903", "0.58423847", "0.567...
0.86230934
0
Sets the learning rate to the initial LR divided by 5 at 60th, 120th and 160th epochs
def adjust_learning_rate(args,optimizer, epoch): args.epochs lr = args.lr * ( (0.2 ** int(epoch >= args.epochs - 140)) * (0.2 ** int(epoch >= args.epochs - 80)) * (0.2 ** int(epoch >= args.epochs - 40)) ) ##lr = args.lr ##DELETE ME! if args.tensorboard: log_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rate\n print('Change learning rate into %f' % (learning_rate))\n self.s...
[ "0.7851113", "0.77711433", "0.77694285", "0.7583295", "0.75615656", "0.75328285", "0.75036603", "0.7494985", "0.7489825", "0.74884444", "0.74778134", "0.74385315", "0.7414721", "0.73976934", "0.7382974", "0.73502624", "0.73357546", "0.7332341", "0.7326604", "0.7321816", "0.73...
0.70625454
77
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0) res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7643041", "0.7418986", "0.7418119", "0.7270918", "0.7245867", "0.7244652", "0.72375184", "0.72214437", "0.7210162", "0.7058879", "0.6851859", "0.6786372", "0.6783499", "0.67681795", "0.6727462", "0.67179555", "0.67179555", "0.67179555", "0.67179555", "0.67179555", "0.67179...
0.0
-1
Constructs a ResNet50 model.
def resnet50(pretrained=False, **kwargs): model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model", "def resnet50(**kwargs):\n model = ResNet(...
[ "0.7557751", "0.75548905", "0.74557495", "0.7386862", "0.7386862", "0.73601955", "0.7355623", "0.724254", "0.724254", "0.7191571", "0.7158499", "0.7101107", "0.70165247", "0.69687796", "0.68687624", "0.6822836", "0.6801022", "0.67330164", "0.6718147", "0.67159295", "0.657444"...
0.74759895
4
Initialise with a dictionary of anchors (id>(x,y), and other parameters)
def __init__(self, anchors, edge_length=0.25, distance_margin=1.5): super(LeDLL, self).__init__() self.anchors = anchors self.edge_length = edge_length self.distance_margin = distance_margin anchors_array_type = ctypes.c_double * (len(anchors) * 2) anch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_anchors(self):\n self.anchors_dic = {}\n meta = self.get_metadata()\n lines = meta.split(\"|\")\n for line in lines:\n data= line.split()\n anchor_name = data[0]\n # appending anchor in dictionary with its coordinates \n self.anchors_...
[ "0.71796453", "0.67017615", "0.63044125", "0.6296558", "0.6246962", "0.62227744", "0.6207734", "0.6180771", "0.6101929", "0.60120726", "0.5954702", "0.5928507", "0.5807805", "0.5801306", "0.57825166", "0.5772158", "0.56542486", "0.5639985", "0.56219363", "0.5615302", "0.55800...
0.51688653
53
Check if current assignment doesn't violate any constraint
def is_consistent(self, constraints): for constraint in constraints: if not constraint.is_satisfied_with(self): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consistent(self,assignment):\n return all(con.holds(assignment)\n for con in self.constraints\n if all(v in assignment for v in con.scope))", "def violated(self) -> bool:\n ...", "def _check_if_satisfiable(self):\n # Search for a satisfying assig...
[ "0.69896823", "0.6887728", "0.6842788", "0.6746609", "0.65457815", "0.64392394", "0.6376731", "0.63232243", "0.6281906", "0.62076354", "0.6085665", "0.6079781", "0.60751325", "0.6060571", "0.60528874", "0.60356015", "0.6018673", "0.60068434", "0.59915143", "0.59726906", "0.59...
0.5689079
71
Makes async call and fetches snl's api key
def async_get_api_key(self, splunk_cookie, auth_header): uri = self.get_api_key_uri() return self.async_get_request(uri, headers={'splunkd_8089':splunk_cookie}, auth_header=auth_header)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(api_key):\n api.get(api_key)", "def _get_api_key(self):\n self.api.apikey = self.api.action.user_show(id=self.username)['apikey']", "async def test_fetch_api_key(client):\n params = [('username', 'iago@zulip.com'),\n ('password', 'abcd1234')]\n headers = { \n ...
[ "0.6705761", "0.64800125", "0.6422762", "0.640498", "0.63824654", "0.6164252", "0.61566025", "0.61040366", "0.6034231", "0.6014702", "0.59607846", "0.5911448", "0.5850175", "0.5847009", "0.5824644", "0.5824618", "0.58008575", "0.57295686", "0.5699271", "0.56849414", "0.567795...
0.7052415
0
Load a yaml configuration file and resolve any environment variables The environment variables must have !ENV before them and be in this format
def load_config_yaml(file_path, strict=False, tag='!ENV'): pattern = re.compile(r'.*?\${(\w+)}.*?') loader = yaml.SafeLoader # the tag will be used to mark where to start searching for the pattern # e.g. somekey: !ENV somestring${MYENVVAR}blah blah blah loader.add_implicit_resolver(tag, pattern, No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_env():\n global api_key\n\n # Load the config file\n env_file = path.join(path.dirname(path.abspath(__file__)), 'env.yml')\n try:\n stream = open(env_file, 'r')\n y = yaml.safe_load(stream)\n except IOError:\n print(\"ERROR: Environment file {} not found\".format(env_fi...
[ "0.73803645", "0.700179", "0.700179", "0.69511443", "0.6896499", "0.6882543", "0.67253214", "0.66844374", "0.654744", "0.6542538", "0.6509685", "0.6494743", "0.64886767", "0.6473197", "0.6444666", "0.64001477", "0.63722515", "0.63578993", "0.63546145", "0.6346803", "0.6321414...
0.7342358
1
Extracts the environment variable from the node's value
def constructor_env_variables(loader, node): value = loader.construct_scalar(node) match = pattern.findall(value) # to find all env variables in line if match: full_value = value for g in match: full_value = full_value.replace( f'${{{g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _env_var_yaml(loader: SafeLineLoader, node: yaml.nodes.Node) -> str:\n args = node.value.split()\n\n # Check for a default value\n if len(args) > 1:\n return os.getenv(args[0], \" \".join(args[1:]))\n if args[0] in os.environ:\n return os.environ[args[0]]\n logger.error(\"Environme...
[ "0.74716383", "0.73307157", "0.7074623", "0.70116323", "0.6888294", "0.6856912", "0.6797471", "0.6755176", "0.6698688", "0.6673939", "0.66672635", "0.66546106", "0.6646088", "0.65838444", "0.6574294", "0.6572259", "0.65580225", "0.6532851", "0.6514942", "0.64226377", "0.64153...
0.7350258
1
Returns a string represent 'data' in one of the supported types. If the client has expressed preference, this should be honored if possible. If not possible (or there was no preference) a default type will be used.
def format(self, data): datatype = accept(self.supportedTypes) response.headers['Content-Type'] = datatype if datatype in ('text/json', 'text/x-json', 'application/json'): # Serialise to json return self.tojson(data) # Default... return in json anyway ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type_string(data):\r\n data_type = type(data)\r\n\r\n if data_type in (int, long):\r\n return 'integer'\r\n elif data_type == float:\r\n return 'float'\r\n elif data_type == bool:\r\n return 'boolean'\r\n elif data_type in (list, tuple):\r\n return 'list'\r\n e...
[ "0.72181106", "0.6739397", "0.65194744", "0.65123373", "0.6475743", "0.6404853", "0.6318477", "0.6301927", "0.6299875", "0.62026316", "0.61979747", "0.61979747", "0.61979747", "0.6190758", "0.615768", "0.614394", "0.61077607", "0.6000888", "0.59740025", "0.59547687", "0.59541...
0.5612148
62
Returns a string represent 'data' in json format.
def tojson(self, data): return json.dumps(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_data(self, data):\n return json.dumps(data)", "def json(self, data):\n import json\n data = json.dumps(data)\n return data", "def toJson(self, data):\n\t\treturn json.dumps(data, default=json_util.default)", "def to_json(self, data):\n return json.dumps(data)", ...
[ "0.8582262", "0.82973737", "0.826102", "0.8212806", "0.8127341", "0.80764705", "0.78036916", "0.7664359", "0.7637165", "0.753312", "0.748186", "0.7446753", "0.7418959", "0.7384266", "0.7370602", "0.7349678", "0.73454237", "0.733219", "0.73205304", "0.73152775", "0.72945607", ...
0.83052707
1
Creates test client, connects the server to test database, and populates sample data.
def setUp(self): self.client = app.test_client() app.config['Testing'] = True app.config['SECRET_KEY'] = 'test' connect_to_db(app, db_uri='postgresql:///testdb', echo=False) db.create_all() example_data() # Need to expand!
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.client = server.app.test_client()\n server.app.config['TESTING'] = True\n server.app.config['SECRET_KEY'] = \"123\"\n\n # Connect to test database\n model.connect_to_db(server.app, \"postgresql:///testdb\")\n\n # Create tables and add sample data\...
[ "0.756005", "0.7515475", "0.7349571", "0.7338716", "0.7322545", "0.7246193", "0.72203565", "0.7113777", "0.70973337", "0.70660955", "0.69986135", "0.69871175", "0.694488", "0.6926658", "0.68321484", "0.6822963", "0.6771319", "0.6761424", "0.6712739", "0.66872424", "0.66872424...
0.7238237
6
Data for the test database. Runs in setUp functions for tests that use it.
def example_data(): seed.add_sfpl_branches() seed.add_formats() book_1 = Book(title="Alanna: The First Adventure", author="Tamora Pierce") book_2 = Book(title="The Hitchhiker's Guide to the Galaxy", author="Douglas Adams") book_3 = Book(title="The Hobbit", author="J.R.R. Tolkien") db.session.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.data = DatabaseIntermediary()", "def setUpTestData(cls):\n call_command('loaddata', 'db.json', verbosity=0)", "def setUp(self):\n\n self.client = app.test_client()\n app.config['Testing'] = True\n app.config['SECRET_KEY'] = 'test'\n connect_to_d...
[ "0.87716556", "0.80401206", "0.7990495", "0.7918828", "0.790322", "0.7872592", "0.7859519", "0.784169", "0.7840029", "0.7834039", "0.78179884", "0.78173035", "0.7810383", "0.77892816", "0.77767634", "0.77753127", "0.7750969", "0.7717675", "0.77174526", "0.7709835", "0.7685749...
0.0
-1
Queries db for a students schedule
def select_student_enrollment_schedule(self, student_id): conn = sqlite3.connect(self.db_path) cursor = conn.cursor() with conn: cursor.execute( """SELECT cs.schedule_days, cs.start_time, cs.end_time FROM course_enrollments ce J...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_schedules(session, logger):\n for sched in session.query(Schedule).all():\n logger.info(\"- {}\".format(sched))", "def get_sem_schedule():\n\n rows = db.engine.execute(f\"SELECT * FROM sem_schedule WHERE EMP_ID = \\\"{g.user.EMP_ID}\\\"\")\n res = []\n for row in rows:\n res.a...
[ "0.6461527", "0.64595765", "0.62768745", "0.6230583", "0.6088938", "0.6048515", "0.5968079", "0.5828802", "0.5801634", "0.57932276", "0.5779998", "0.575282", "0.5739439", "0.57277304", "0.57023203", "0.56813735", "0.56773955", "0.56766766", "0.5668616", "0.5626562", "0.561353...
0.6974847
0
Tests no responses created for outbound posts
def test_brands_reply(self): # 1. Setup service channel / dispatch channel # 2. send a post to brand # 3. Reply with custom response # 4. Route a reply # 5. check there is no extra responses created # 6. create a matchable and repeat 1-5 brand = 'brand' ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_response_processing(self, method):\n self._register_uri(method)\n response = GetOrPost(self.client, method).call(self.test_endpoint,\n process_response=False)\n self.assertEqual(response, json.dumps(self.test_data))", "def tes...
[ "0.6788404", "0.6774958", "0.6763626", "0.6632563", "0.66077816", "0.64807165", "0.637886", "0.6375929", "0.6326921", "0.6299854", "0.626444", "0.62010765", "0.6196878", "0.619278", "0.61876297", "0.61870563", "0.6184402", "0.6165778", "0.6154294", "0.6152586", "0.6145053", ...
0.0
-1
Use standard Unix timestamps
def get_timestamp_now(): # local time as a time struct now = time.localtime() # convert time struct to seconds since epoch (timestamp) local = time.mktime(now) return str(local)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unix_timestamp():\n return int(time.time())", "def _create_timestamp():\n return (datetime.utcnow() - datetime(1970,1,1)).total_seconds()", "def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())", "def getUnixTimeStamp():\n ...
[ "0.74036795", "0.7114919", "0.71050674", "0.70601654", "0.688562", "0.6831353", "0.68053037", "0.67160815", "0.6695091", "0.6688814", "0.66821605", "0.6641052", "0.66099125", "0.65909076", "0.65902084", "0.6565757", "0.65510315", "0.6505561", "0.64923334", "0.6475822", "0.646...
0.0
-1
Return setting of owner's reportOutputPref at level specified in its PreferenceEntry.level
def reportOutputPref(self): # If the level of the object is below the Preference level, # recursively calls super (closer to base) classes to get preference at specified level # return self.get_pref_setting_for_level(REPORT_OUTPUT_PREF, self._report_output_pref.level)[0] from psyneuli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logPref(self):\n # If the level of the object is below the Preference level,\n # recursively calls base (super) classes to get preference at specified level\n return self.get_pref_setting_for_level(LOG_PREF, self._log_pref.level)[0]", "def reportOutputPref(self, setting):\n # s...
[ "0.72780037", "0.62180614", "0.6080581", "0.5823701", "0.5624488", "0.55002546", "0.5479233", "0.5469856", "0.5281435", "0.519492", "0.518808", "0.5150267", "0.5139333", "0.50287485", "0.4999145", "0.49966177", "0.49715298", "0.4954436", "0.49478325", "0.4925556", "0.48930228...
0.770061
0
Return setting of owner's logPref at level specified in its PreferenceEntry.level
def logPref(self): # If the level of the object is below the Preference level, # recursively calls base (super) classes to get preference at specified level return self.get_pref_setting_for_level(LOG_PREF, self._log_pref.level)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logPref(self, setting):\n self.set_preference(candidate_info=setting, pref_ivar_name=LOG_PREF)", "def verbosePref(self):\n # If the level of the object is below the Preference level,\n # recursively calls base (super) classes to get preference at specified level\n return self.g...
[ "0.6316234", "0.62302697", "0.59117764", "0.58178824", "0.5785135", "0.573081", "0.5714552", "0.5680662", "0.5662985", "0.5627414", "0.56167275", "0.5565954", "0.5534454", "0.55308014", "0.55078346", "0.54977345", "0.5492585", "0.5452731", "0.54279613", "0.54064333", "0.54041...
0.8309533
0
Obtain the coordinate of each pixel in the reciprocal space.
def get_reciprocal_space_pixel_position(pixel_center, wave_vector): wave_vector = xp.asarray(wave_vector) # reshape the array into a 1d position array pixel_center_1d = reshape_pixels_position_arrays_to_1d(pixel_center) # Calculate the reciprocal position of each pixel wave_vector_norm = xp.sqrt(xp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reciprocal_cell(self):\n return self.unit_cell.reciprocal()", "def r(self):\n\n r = np.sqrt(self.pos[:,0]**2 + self.pos[:,1]**2 + self.pos[:,2]**2)\n\n return r", "def get_points(self):\r\n return self.nx*self.ny*self.nz", "def get_pixel_pos(self):\n\n c = self.get_cent...
[ "0.66038615", "0.6470301", "0.6408027", "0.6393367", "0.6274257", "0.62354976", "0.61462224", "0.6119856", "0.6119148", "0.60882425", "0.6064431", "0.6053948", "0.6037336", "0.6020313", "0.5985811", "0.5962735", "0.59350663", "0.5907845", "0.5906473", "0.5897822", "0.58958805...
0.68662983
0
Add new options to the pytest commandline
def pytest_addoption(parser): # ignore datasources parser.addoption('--ignore-datasources', action='store_true', default=False, help='Ignore the datasource marker applied to tests')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_addoption(parser):\n add_cli_options(parser)", "def pytest_addoption(parser):\n parser.addoption(\"-c\", action=\"store\", help=\" -c <test config file>\")", "def pytest_addoption(parser):\n parser.addoption(\"--run-flaky\", action=\"store_true\",\n help=\"runs flaky tes...
[ "0.7959306", "0.78100795", "0.7790388", "0.7766908", "0.76232344", "0.75945115", "0.7535965", "0.7529197", "0.75037855", "0.7500713", "0.7500304", "0.74803746", "0.74548644", "0.74394923", "0.7422117", "0.740802", "0.73988837", "0.7380947", "0.7369792", "0.7358042", "0.730833...
0.703034
27
Iterate over a sequence that requires async for.
async def a_enumerate(seq, start=0): i = start async for val in seq: yield i, val i += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate(itr: AnyIterable) -> AsyncIterator[T]:\n if isinstance(itr, AsyncIterator):\n return itr\n\n async def gen():\n for i in itr:\n yield i\n\n return gen()", "async def _aiter_sync(iterable: Iterable[T]) -> AsyncIterator[T]:\n for item in iterable:\n yield ite...
[ "0.7327933", "0.7293463", "0.7245759", "0.69220495", "0.6894299", "0.646407", "0.64356184", "0.6262191", "0.6206724", "0.61930734", "0.61389524", "0.61149365", "0.60963917", "0.6084639", "0.60747236", "0.60632145", "0.6040443", "0.6014539", "0.60037136", "0.59884953", "0.5977...
0.66492033
5
Return True if number is a power of 2.
def power_of_2(c): return n & (n - 1) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPower2(num):\n\treturn ((num & (num - 1)) == 0) and num > 0", "def isPower2(num):\n\treturn ((num & (num - 1)) == 0) and num > 0", "def is_power_of_2(num: int) -> bool:\n return ((num & (num - 1)) == 0) and num > 0", "def is_power2(num):\n num = int(num)\n return num != 0 and ((num & (num - 1)...
[ "0.86893827", "0.86893827", "0.86486185", "0.86142594", "0.83917", "0.8308683", "0.82720256", "0.8229664", "0.81646913", "0.7880606", "0.7221173", "0.6846825", "0.68209946", "0.68001497", "0.67693186", "0.6716709", "0.66228914", "0.6604618", "0.6578151", "0.65709627", "0.6531...
0.793703
9
Returns a vector summing up each row of the matrix x.
def _sum_rows(x): # _sum_rows(x) is equivalent to math_ops.reduce_sum(x, 1) when x is # a matrix. The gradient of _sum_rows(x) is more efficient than # reduce_sum(x, 1)'s gradient in today's implementation. Therefore, # we use _sum_rows(x) in the nce_loss() computation since the loss # is mostly used for tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_final_values(self, x):\n \n values = np.zeros(len(x[0]))\n \n for i in range(len(x)):\n values = values + np.array(x.values[i] * self.weights[i])\n \n return values", "def ll_sum(x):\n xlist = []\n for i in x:\n for num in i:\n ...
[ "0.69549483", "0.66222095", "0.6443588", "0.6379898", "0.6366739", "0.6352674", "0.6291685", "0.6246245", "0.61629725", "0.61353415", "0.6134832", "0.61257815", "0.6120378", "0.6053841", "0.60315406", "0.60305494", "0.6021108", "0.60101163", "0.60079414", "0.5996381", "0.5990...
0.7237308
0
Computes sigmoid cross entropy given `logits`. Measures the probability error in discrete classification tasks in which each class is independent and not mutually exclusive. For instance, one could perform multilabel classification where a picture can contain both an elephant and a dog at the same time. For brevity, le...
def sigmoid_cross_entropy_with_logits(logits, targets, name=None): with ops.name_scope(name, "logistic_loss", [logits, targets]) as name: logits = ops.convert_to_tensor(logits, name="logits") targets = ops.convert_to_tensor(targets, name="targets") try: targets.get_shape().merge_with(logits.get_shap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_xent(logits, targets):\n # reshape them into one huge batch\n logits = tf.concat(0, logits)\n targets = tf.concat(0, targets)\n\n return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(\n logits, targets))", "def logit_entropy(logits):\n # We support either:\n # - 1D l...
[ "0.8052472", "0.75631636", "0.7471212", "0.7457534", "0.7426443", "0.7420262", "0.735233", "0.72464293", "0.723129", "0.71575016", "0.7152426", "0.71386164", "0.71288973", "0.7013112", "0.69826066", "0.69571996", "0.69388556", "0.6910177", "0.688051", "0.68615466", "0.6840803...
0.86424553
0
Return list of stations as json
def stations(): list_of_stations = session.query(Station.station, Station.name) all_stations = [] for s, n in list_of_stations: station_dict = {} station_dict["station"] = s station_dict["name"] = n all_stations.append(station_dict) return jsonify(all_stations)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations():\n\n station_results = session.query(Stations.station, Stations.name).all()\n\n station_data = []\n for row in station_results:\n station_dict = {}\n station_dict[\"station\"] = row.station\n station_dict[\"name\"] = row.name\n station_data.append(station_dict)\n...
[ "0.86155045", "0.8612225", "0.8578345", "0.857554", "0.8554028", "0.8529951", "0.8525643", "0.852311", "0.852159", "0.8498818", "0.84971195", "0.84934115", "0.8481039", "0.8477952", "0.8460487", "0.8447032", "0.8420812", "0.84163475", "0.83794355", "0.83295405", "0.8298081", ...
0.85554254
4
Load image as tf.Tensor.
def _load_image(image_path, img_height, img_width): image_file = tf.read_file(image_path) img = tf.image.decode_png(image_file) img = trim_image(img, img_height, img_width) img = tf.image.per_image_standardization(img) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_img(filename):\n img_str = tf.io.read_file(filename)\n img_decoded = tf.image.decode_image(img_str)\n img = tf.image.convert_image_dtype(img_decoded, tf.float32)\n return img", "def read_image_as_tensor(path: Path) -> tf.Tensor:\n img_data = tf.io.read_file(str(path))\n ...
[ "0.79898804", "0.78421783", "0.7397727", "0.73951936", "0.7245636", "0.7092631", "0.7059253", "0.6981903", "0.6976709", "0.69691414", "0.69576496", "0.69386655", "0.68857455", "0.6867385", "0.6853622", "0.68346906", "0.67981666", "0.67585754", "0.6750487", "0.67218274", "0.67...
0.7219355
5
Determine if the provided password is valid.
def is_valid_password(password): from string import ascii_lowercase from string import ascii_uppercase from string import digits if len(password) < MIN_LENGTH or len(password) > MAX_LENGTH: return False count_lower = 0 count_upper = 0 count_digit = 0 count_special = 0 for c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass", "def _check_password(self, password):\n if self.password_regex.search(password) is not None:\n print(\"Correct password\")\n return True\n else:\n print(\"...
[ "0.8516776", "0.8354247", "0.8320329", "0.83199084", "0.82479423", "0.82479423", "0.8237849", "0.8236277", "0.8231372", "0.8229386", "0.82032466", "0.8152879", "0.81508857", "0.81053776", "0.80793977", "0.80605215", "0.80581343", "0.8041872", "0.80090135", "0.8004572", "0.797...
0.7386877
79
Critical density at z=0
def testRhoCrit(): units = unitsystem.UnitSystem() assert units.rho_crit(0.7) == 9.204285430050004e-30 assert units.rho_crit(1.0) == 1.8784255979693885e-29
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_Z_conditionnal_density(self,Y):\n proba_cond = np.exp(self._estimate_weighted_log_prob(Y)) # Pi_k * g_k(yi)\n s = proba_cond.sum(axis=1)[:,np.newaxis] # sum_k (Pi_k * g_k(yi))\n return proba_cond / s #On normalise", "def delta_c_z(self,z):\n A = 0.15*(12.*np.pi)**(2/3.)\n...
[ "0.6571282", "0.6464311", "0.6417149", "0.63604754", "0.6333806", "0.6296631", "0.628923", "0.628923", "0.6174804", "0.61555403", "0.6142562", "0.6077917", "0.6070785", "0.6009029", "0.5964137", "0.59582376", "0.5948104", "0.59302366", "0.5899492", "0.5894627", "0.5894597", ...
0.0
-1
Not return unique pairs and slow
def _sample_pairs_nbp(data, frac, size_cap=np.int(1e6)): sample_size = int(len(data) * (len(data) - 1) / 2 * frac) sample_size = min(sample_size, size_cap) pairs = np.empty((sample_size, 2)) for i in numba.prange(sample_size): pair = np.random.choice(data, size=2, replace=False) pair.sor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(pairs):\n unique_pairs = []\n pair_list = {}\n for i in range(len(pairs)):\n for j in range(len(pairs[0])):\n # This is to remove self-matches\n if i == pairs[i][j]:\n continue\n if (\"%d,%d\" % (i, pairs[i][j]) not in pair_list)...
[ "0.74665505", "0.7458169", "0.7286342", "0.70704454", "0.66775495", "0.6664701", "0.65282387", "0.65227735", "0.63898265", "0.6220333", "0.6212185", "0.6169182", "0.6167575", "0.61417955", "0.6136165", "0.6135198", "0.6127529", "0.61261636", "0.61184144", "0.61083645", "0.609...
0.0
-1
This is used to compare 2 objects
def __eq__(self, other): return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(obj_a, obj_b):\n\n return tuple_to_string(obj_a) == tuple_to_string(obj_b)", "def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )", "def test_compare() -> None:\n\n obj = SpecificLocation()\n obj2 ...
[ "0.768704", "0.75287986", "0.7502687", "0.74012315", "0.73266083", "0.7315071", "0.730467", "0.72950774", "0.72916", "0.7233773", "0.7187291", "0.71354896", "0.71354896", "0.7133146", "0.71203434", "0.7096868", "0.7096868", "0.7077981", "0.7014047", "0.7014047", "0.7014047", ...
0.733177
28
The sigmoid function and its derivative
def __sigmoid(z, derivative=False): if derivative: return z * (1 - z) else: return 1 / (1 + np.exp(-z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def sigmoid(z):...
[ "0.889857", "0.8860607", "0.8750368", "0.8750368", "0.8613247", "0.8269655", "0.82664037", "0.82664037", "0.8261138", "0.8249627", "0.82088757", "0.81849754", "0.8175644", "0.816951", "0.8140514", "0.8139403", "0.8134387", "0.8134387", "0.8134387", "0.8134387", "0.8134387", ...
0.8082404
30
Constructor of a forward ANN instance.
def __init__(self, m_in, n_hid, n_out): self.dim_in = m_in + 1 # one extra input dim for bias self.dim_hid = n_hid self.dim_out = n_out self.dim_node = self.dim_in + self.dim_hid + self.dim_out self.weight = np.zeros((self.dim_node, self.dim_node), dtype=np.float64) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)", "def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ...
[ "0.68916357", "0.67293704", "0.67102045", "0.6693892", "0.6668455", "0.6649301", "0.6579996", "0.6558831", "0.6557919", "0.655301", "0.6536888", "0.6532181", "0.65283024", "0.6527244", "0.65140307", "0.6468515", "0.643456", "0.6432852", "0.64249855", "0.64235806", "0.6422971"...
0.0
-1
Calculate the energy of this ANN
def _energy(self, X, y): yhat = self.evaluate(X) loss = ((y - yhat) ** 2).sum() / 2 return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_energy(self):\n temp_e = 0\n\n for i in range(0,self.neuron_count):\n for j in range(0, self.neuron_count):\n if i != j:\n temp_e += self.get_weight(i, j) * self.current_state[i] * \\\n self.current_state[j]\n re...
[ "0.7925603", "0.75406826", "0.74740034", "0.74234474", "0.7363943", "0.7339669", "0.7337072", "0.7285573", "0.727482", "0.7252891", "0.7226012", "0.72183496", "0.7179306", "0.7082741", "0.7076141", "0.7031667", "0.7019678", "0.6981347", "0.6908306", "0.6892576", "0.6871601", ...
0.69891953
17
The constructor of Priority Queue
def __init__(self, max_size): # max_size is different to maxsize from the superclass, the queue is # initialized to be infinite (by setting maxsize to 9), but will shrink # to max_size whenever self.constraint is called if max_size <= 0: raise self.PQueueException('max_size m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,k,x,y):\n self.x = x\n self.y = y\n\n self.C = PriorityQueue()\n self.p = []\n self.k = k\n self.tmp = []", "def priority_queue():\n from src.priorityq import PriorityQueue\n priority_queue = PriorityQueue()\n return priority_queue", "def __i...
[ "0.77509904", "0.74588287", "0.74373686", "0.73494864", "0.73079515", "0.7118324", "0.7074923", "0.701779", "0.68682855", "0.68579656", "0.6853809", "0.6838587", "0.6823343", "0.67826444", "0.677461", "0.6711254", "0.6658506", "0.6652581", "0.6652581", "0.6652581", "0.6641934...
0.0
-1
Limit this queue to the max_size
def constraint(self): with self.mutating: self.queue = heapq.nsmallest(self.max_size, self.queue) heapq.heapify(self.queue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_write_queue_max_size(self, size):\n self.java_obj.setWriteQueueMaxSize(size)\n return self", "def limit(self, max_size):\n return self.__class__(itertools.islice(self, max_size))", "def set_write_queue_max_size(self, val): \n self.j_pump.setWriteQueueMaxSize(val)\n r...
[ "0.7408938", "0.7383901", "0.72856027", "0.7218965", "0.71198696", "0.6935463", "0.6903", "0.6872697", "0.68340915", "0.681831", "0.6812872", "0.67927736", "0.6770192", "0.6678455", "0.66666985", "0.6635649", "0.66229266", "0.6615451", "0.66063184", "0.6576646", "0.65566105",...
0.6173259
41
Returns the manifests which consist of the Recordings and Supervisions. When all the manifests are available in the ``output_dir``, it will simply read and return them.
def prepare_librispeech( corpus_dir: Pathlike, dataset_parts: Union[str, Sequence[str]] = 'auto', output_dir: Optional[Pathlike] = None, num_jobs: int = 1 ) -> Dict[str, Dict[str, Union[RecordingSet, SupervisionSet]]]: corpus_dir = Path(corpus_dir) assert corpus_dir.is_dir(), f'N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_manifests(self, content_retriever):\n return None", "def child_manifests(self, content_retriever):\n for manifest in self._parsed[\"manifests\"]:\n mbytes = json.dumps(manifest)\n yield ManifestReference(Bytes.for_string_or_unicode(mbytes))", "def get_manifests(arc...
[ "0.61077297", "0.61045086", "0.59841233", "0.5895404", "0.57937354", "0.5777963", "0.5594122", "0.55589306", "0.553366", "0.5532815", "0.55046815", "0.5439738", "0.54345614", "0.5396521", "0.5392771", "0.5381265", "0.5365184", "0.53536534", "0.5342521", "0.534236", "0.5334783...
0.0
-1
View function for home page of site.
def index(request): # Render the HTML template index.html with the data in the context variable. return render( request, 'index.html', context = {}, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
Get the value of the indexth node in the linked list. If the index is invalid, return 1.
def get(self, index: int) -> int: if index < 0 or index >= self.size: return -1 # choose search from head or tail if index + 1 < self.size - index: ptr = self.head for _ in range(index + 1): ptr = ptr.next else: # from tail pt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1", "def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n r...
[ "0.8308878", "0.8223689", "0.8101446", "0.7982042", "0.797206", "0.79664093", "0.7952038", "0.7949352", "0.79277694", "0.7905999", "0.7800025", "0.7734996", "0.77310765", "0.76515895", "0.7507434", "0.74748605", "0.74550724", "0.73873156", "0.73873156", "0.7384066", "0.733705...
0.7584202
14
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.
def addAtHead(self, val: int) -> None: pred, succ = self.head, self.head.next cur = Node(val) cur.next = succ cur.prev = pred pred.next = cur succ.prev = cur self.size += 1 # print("addHead", self.head.next.val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node", "def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ...
[ "0.78888327", "0.78128237", "0.77156687", "0.76672965", "0.7632993", "0.75963074", "0.7586912", "0.75706255", "0.7502218", "0.74938524", "0.7477616", "0.74631184", "0.7405691", "0.73827714", "0.73492926", "0.73492926", "0.728465", "0.72477174", "0.72355413", "0.71701944", "0....
0.7429465
12
Append a node of value val to the last element of the linked list.
def addAtTail(self, val: int) -> None: pred, succ = self.tail.prev, self.tail cur = Node(val) cur.next = succ cur.prev = pred pred.next = cur succ.prev = cur self.size += 1 # print("addAtTail", self.tail.prev.val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node", "def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ...
[ "0.80136085", "0.7979828", "0.78931767", "0.7879606", "0.7879606", "0.7855799", "0.77832985", "0.7744525", "0.7737238", "0.7721625", "0.7690721", "0.7631925", "0.76268226", "0.75301903", "0.75227934", "0.74494255", "0.7415731", "0.7320556", "0.72395295", "0.72237873", "0.7217...
0.7549912
13
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted.
def addAtIndex(self, index: int, val: int) -> None: # If index is greater than the length, # the node will not be inserted. if index > self.size: return # [so weird] If index is negative, # the node will be inserted at the head of the list. if index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ...
[ "0.80058235", "0.7905295", "0.78016585", "0.77571636", "0.7742864", "0.7742677", "0.77302635", "0.7709267", "0.7618808", "0.7613046", "0.7613046", "0.7596944", "0.7502421", "0.72808725", "0.72095805", "0.7154297", "0.7089389", "0.7024109", "0.70222694", "0.70174867", "0.69295...
0.7842
2
Test that an exception is correctly raised when two metrics have the same name. WHEN two or more metrics passed to a trainer have the same name THEN raise a ValueError
def test_metrics_names_collision(tmpdir): metrics = [ ClassifierLoss(name="test_loss"), ClassifierLoss(name="test_loss"), ] with pytest.raises(ValueError): # Since names collision is checked by the primitive Trainer we can test it easily # with just one FakeTraining and be a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_metric_from_name_nonexistent(self):\n with pytest.raises(ValueError):\n _metric_from_name(\"nonexistent_metric\")", "def test_get_metric_raises_error(estimator, build_dataset):\n input_data, labels, _, X = build_dataset()\n model = clone(estimator)\n set_random_state(model)\n model...
[ "0.69074655", "0.66071403", "0.6597664", "0.65158516", "0.6430883", "0.61472815", "0.61344683", "0.6079993", "0.60497904", "0.60078627", "0.5925428", "0.58541626", "0.58300716", "0.58232015", "0.58061445", "0.57979023", "0.57905364", "0.5761658", "0.57484984", "0.57387173", "...
0.79838043
0
Object constructor. Instantiates object and creates attributes. Generates snippets of provided light curves if `generate_snippets` parameter is True.
def __init__(self, id, lcs, classname='unknown', generate_snippets=True): self.lcs = [] self.lc_snippets = [] self.id = id self.classname = classname for lc in lcs: self.lcs.append(lc) if generate_snippets: self.lc_snippets.extend(generate_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_example_light():\n return Light({\"warning\": False, \"off\": True})", "def __init__(self, LightFun):\n self.setParameters()\n self.Light = LightFun", "def generate_lc_snippets(lc):\n epochs, mags, errs = [lc.epochs, lc.mags, lc.errs]\n lc_snippets = []\n n_epochs = le...
[ "0.6511569", "0.6154508", "0.59090006", "0.5742656", "0.5707672", "0.56683654", "0.5632951", "0.56133384", "0.55843776", "0.5568053", "0.5517448", "0.55120707", "0.5490088", "0.5456", "0.5449923", "0.5447288", "0.54252243", "0.5403897", "0.5393874", "0.5370551", "0.53599244",...
0.53604203
20
Return list of lightCurve() objects made from provided data.
def dotAstroLc(lc, id, classname): lcs = [] numlcs = 0 data = lc soup = BeautifulSoup(data) try: ra = float(soup('position2d')[0]('value2')[0]('c1')[0] .renderContents()) dec = float(soup('position2d')[0]('value2')[0]('c2')[0] .renderContents())...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transit_light_curves(self, params, plots=False):\n time_diffs = np.diff(sorted(self.times.jd))\n diff_between_transits = params.per/2.\n split_inds = np.argwhere(time_diffs > diff_between_transits) + 1\n\n if len(split_inds) > 1:\n\n split_ind_pairs = [[0, split_inds[...
[ "0.65246844", "0.6465934", "0.6337164", "0.6251219", "0.61025953", "0.581342", "0.5769288", "0.57455343", "0.5701347", "0.5545635", "0.55104846", "0.5487012", "0.5486434", "0.5476765", "0.5459259", "0.54267687", "0.53850377", "0.5325321", "0.53144944", "0.5300755", "0.5249857...
0.5032054
33
Return CSV timeseries data for source with provided DotAstro ID.
def dotAstro_to_csv(id): id = str(id) isError = False if("http" in id): url = id elif id.isdigit(): url = "http://dotastro.org/lightcurves/vosource.php?Source_ID=" + id else: print("dotAstro ID not a digit.") try: lc = urllib.request.urlopen(url).read() if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trip_data():\n get_pronto_data()\n zp = zipfile.ZipFile('open_data_year_one.zip')\n file_handle = zp.open('2015_trip_data.csv')\n return pd.read_csv(file_handle)", "def retrieve_time_series(api, series_ID):\r\n #Retrieve Data By Series ID \r\n series_search = api.data_by_series(series=s...
[ "0.5778693", "0.57539296", "0.5607236", "0.55872345", "0.5522315", "0.551624", "0.5502703", "0.5502596", "0.5493564", "0.5476462", "0.54688483", "0.5370776", "0.5345104", "0.5308931", "0.53048325", "0.52921736", "0.5291309", "0.5286951", "0.52680284", "0.52658486", "0.5265848...
0.6717508
0
Allocates tensors for the optimizer state to allow direct compilation of the model before the first step.
def preinitialize(self): for group in self.param_groups: for p in group['params']: self.state[p]["sum"] = torch.full_like( p, group["initial_accumulator_value"], memory_format=torch.preserve_format, devic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initalize_state(self):\n\n self.memories.append(tf.tanh(\n tf.random_normal(shape=(self.memory_capacity, self.memory_vector_size), stddev=0.5)))\n self.ww_t.append(tf.nn.softmax(tf.range(self.memory_capacity, 0, -1, dtype=tf.float32)))\n self.rw_t.append(tf.nn.softmax(tf.range(...
[ "0.7076541", "0.68022853", "0.66044825", "0.6513382", "0.64494544", "0.63675654", "0.63314015", "0.6323805", "0.6311833", "0.626584", "0.62340623", "0.6197052", "0.6197052", "0.6181561", "0.61793137", "0.6171753", "0.6158653", "0.61254156", "0.61200625", "0.6108338", "0.60939...
0.0
-1
Get the front element.
def peek(self): return self.stack[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.6372947
87
Returns whether the queue is empty.
def empty(self): return len(self.stack) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.8835949", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462...
0.0
-1
Test homepage in EN.
def test_homepage_en(self): self.driver.get(self.url_ + '/') title_present = EC.text_to_be_present_in_element( (By.XPATH, '//*[@id="main-nav"]/div/div[1]/a'), 'Data Commons') WebDriverWait(self.driver, self.TIMEOUT_SEC).until(title_present) hero_msg = self.driver.find_elem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home(self):\n\t\tresponse = self.client.get('/')\n\t\tself.assertContains(response, 'Home Page', 1, 200)", "def test_home(self):\n\n response = self.client.get(reverse('home'))\n\n assert response.status_code == 200", "def test_homepage_anon(self):\r\n\r\n with self.client:\r\n ...
[ "0.7044564", "0.6976756", "0.6971325", "0.6947039", "0.69357276", "0.69271016", "0.6900843", "0.68843704", "0.68268716", "0.68015486", "0.67653173", "0.6704349", "0.66744864", "0.6672788", "0.6670328", "0.6670328", "0.663169", "0.6624608", "0.66016173", "0.66008836", "0.65848...
0.7652041
0
Linearly map `low` to 0 and `high` to 255.
def rescale_intensity_v2(im, low, high): from skimage.exposure import rescale_intensity, adjust_gamma if low > high: im_out = rescale_intensity(low-im.astype(np.float), (0, low-high), (0, 255)).astype(np.uint8) else: im_out = rescale_intensity(im.astype(np.float), (low, high), (0, 255)).ast...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_map(val):\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)", "def lut(threshold):\n\n return [255 if i<=threshold else 0 for i in range(256)]", "def color_map(val):\n # NOTE: This relies on remap_interval, which you must provide\n color_code = remap_interval(v...
[ "0.71330273", "0.7012908", "0.6887508", "0.6887508", "0.6887508", "0.6887508", "0.6748736", "0.670707", "0.6633846", "0.6474674", "0.64253134", "0.6237296", "0.6188002", "0.6144321", "0.6108516", "0.60863185", "0.608047", "0.60553056", "0.60326636", "0.59998363", "0.59759337"...
0.6144009
14
Escape a string (treat it as a single complete string) in shell commands.
def shell_escape(s): from tempfile import mkstemp fd, path = mkstemp() try: with os.fdopen(fd, 'w') as f: f.write(s) cmd = r"""cat %s | sed -e "s/'/'\\\\''/g; 1s/^/'/; \$s/\$/'/" """ % path escaped_str = check_output(cmd, shell=True) finally: os.remove(path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sh_escape(command):\n command = command.replace(\"\\\\\", \"\\\\\\\\\")\n command = command.replace(\"$\", r'\\$')\n command = command.replace('\"', r'\\\"')\n command = command.replace('`', r'\\`')\n return command", "def shellquote(s):\n return '\"' + s.replace(\"'\", \"'\\\\''\") + '\"'"...
[ "0.7615862", "0.7415594", "0.72144705", "0.71579486", "0.71099776", "0.70795584", "0.6998123", "0.69563174", "0.6952765", "0.69116515", "0.68636763", "0.68261117", "0.6795108", "0.67928225", "0.67837805", "0.6766631", "0.67595863", "0.67594546", "0.6755718", "0.675253", "0.67...
0.685382
11
Takes two tensors and return outer product x[N,2] y[N,2]
def outer_product(x,y): return x[:,0]*y[:,1] -x[:,1]*y[:,0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outer_prod(x, y):\n if len(list(x.size())) != 2 or len(list(y.size())) != 2:\n raise ValueError(\"An input is not of the right dimension.\")\n\n z = torch.zeros(2, x.size()[1], y.size()[1], dtype=torch.double, device=x.device)\n z[0] = torch.ger(x[0], y[0]) - torch.ger(x[1], -y[1])\n z[1] = ...
[ "0.8282488", "0.808492", "0.7961398", "0.78640157", "0.7682538", "0.7472887", "0.74291945", "0.72502005", "0.7165973", "0.7074585", "0.69793797", "0.6913625", "0.68650544", "0.6829372", "0.68225485", "0.67908347", "0.6570677", "0.6471019", "0.6418274", "0.641755", "0.6402861"...
0.8016695
2
Optionally restricts the returned purchases to a given user, by filtering against a `username` query parameter in the URL.
def get_queryset(self): fl = self.request.QUERY_PARAMS.get('fl', None) win = self.request.QUERY_PARAMS.get('win', None) win_filter = Q(orderstatus__in=['Shipped', 'Unshipped', 'Processing'], fulfillmentchannel='MFN') #win_filter = Q(orderstatus__in=['Unshipped', 'Process...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n username = self.kwargs.get('username', None)\n filters = {}\n if username:\n filters['user__username'] = username\n return super(PhotosListView, self).get_queryset().filter(**filters)", "def filter_queryset(self, request, queryset, view):\n ...
[ "0.59664434", "0.5964932", "0.5932522", "0.59106624", "0.5906326", "0.56628233", "0.5652694", "0.55447114", "0.554033", "0.5512286", "0.5504258", "0.5494387", "0.548664", "0.54821676", "0.5471788", "0.5470485", "0.5449447", "0.5415206", "0.5406221", "0.53797895", "0.53711593"...
0.0
-1
Creates the date from timestamp
def _create_date(timestamp): mdate = matplotlib.dates.date2num(datetime.fromtimestamp(timestamp)) return mdate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromtimestamp(cls, timestamp):\n return date()", "def _make_timestamp(self):\r\n\t\tlogger.debug(\"Get a timestamp\")\r\n\t\treturn time.mktime(datetime.today().timetuple())", "def date_from(timestamp): \n return datetime.fromtimestamp(timestamp)", "def _date_from_timestamp(timestamp, fmt='%Y-%...
[ "0.8244945", "0.7645255", "0.7641031", "0.7470334", "0.71942896", "0.71869344", "0.7128895", "0.7087993", "0.70406747", "0.6940797", "0.691165", "0.67489123", "0.67464787", "0.6689873", "0.6641581", "0.6533665", "0.6532811", "0.65282696", "0.6512029", "0.64087105", "0.6406217...
0.8043789
1
Check changes induced Check if the given coordinates induce changement of state into the grid.
def check_changes(coordXY, grid, case = None, no_case = None): #TODO : Corriger -> erreur sur le droit de positionner les pions # récupérer toutes les modifications possibles par le positionnement et les appliquer (pas le cas en ce moment) # problème -> change état de tous les pions définis alentour et non pas uniq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_changed(self, new_grid):\n for row in range(self._grid_height):\n for col in range(self._grid_width):\n if self.get_tile(row,col) != new_grid[row][col]:\n return True\n return False", "def _check_cells(self):\n for row_number in range(self....
[ "0.6674244", "0.6398143", "0.639027", "0.63412356", "0.630463", "0.630463", "0.630463", "0.6271029", "0.6261409", "0.6258394", "0.62574655", "0.6252726", "0.62230015", "0.6208698", "0.61585134", "0.61537504", "0.61457443", "0.6081691", "0.60575897", "0.6048838", "0.604813", ...
0.72975755
0
User Get the authenticated user's profile The user profile contains data related to the authenticated user including (but not limited to); Achievements Authentications (including types and timestamps) Challenges Flags (including armoire, tutorial, tour etc...) Guilds History (including timestamps and values) Inbox Invi...
def getAuthenticatedProfile(self, userFields = None): if userFields == None: url = "https://habitica.com/api/v3/user" return(getUrl(url, self.credentials)) else: url = "https://habitica.com/api/v3/user?userFields=" + userFields return(getUrl(url, self.credentials))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getProfileFromUser(self):\n # Make sure user is authenticated\n user = endpoints.get_current_user()\n if not user:\n raise endpoints.UnauthorizedException('Authorization required')\n # Get Profile from datastore\n user_id = user.email()\n p_key = ndb.Key(Pr...
[ "0.75967926", "0.7570412", "0.750899", "0.73847157", "0.71897686", "0.7097075", "0.7049962", "0.6997069", "0.69511384", "0.6907491", "0.6889673", "0.67918557", "0.67534745", "0.6707265", "0.66898364", "0.6664899", "0.6658067", "0.6651149", "0.66491234", "0.663755", "0.6627726...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): # load data file into a dataframe df = pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns df['month'] = df['S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.7738649
53
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') df = load_data(city, month, day) # ToDo: here I will have to adjust for month (etc.) names vs. indices...! # TO DO: display the most common month: The month as January=1, December=12 df['Start Time'] = pd.to_datetime(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80234134", "0.80223715", "0.7914983", "0.78252095", "0.7820841", "0.7812996", "0.77644646", "0.7739144", "0.7734762", "0.77328056", "0.7685236", "0.7667557", "0.76502746", "0.7643304", "0.76385033", "0.7635647", "0.7623848", "0.7622241", "0.7611794", "0.75985956", "0.75820...
0.7078936
85
Displays statistics on the most popular stations and trip.
def station_stats(df): df = load_data(city, month, day) print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station popular_ss = df['Start Station'].mode()[0] print('Most popular start station', popular_ss) # TO ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198", "0.7337384...
0.7446617
5
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): df = load_data(city, month, day) # TO DO: display total travel time total_duration = df['Trip Duration'].sum() print('Total travel time: ', total_duration) # TO DO: display mean travel time average_duration = df['Trip Duration'].mean() print('Average travel ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7738467
59
Convert Datetime instance to Unix timestamp
def to_unix_tmsp(col): return pd.DatetimeIndex(col).astype(np.int64) / 1e6
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unix(cls, timestamp):\n if not isinstance(timestamp, datetime.datetime):\n raise TypeError(\"Time.milliseconds expects a datetime object\")\n return timestamp.timestamp()", "def to_unix_time(timestamp):\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n return int(...
[ "0.78930306", "0.76791304", "0.7671278", "0.7511419", "0.74802154", "0.7341475", "0.7335883", "0.7325489", "0.72515094", "0.72451687", "0.7234019", "0.7215728", "0.7195584", "0.70525545", "0.7006051", "0.6991268", "0.6981582", "0.6915108", "0.6905022", "0.68706393", "0.687015...
0.598531
93
Convert Twitter's datetime format into a Datetime instance
def parse_twitter_datetime(timestr): return pd.datetime.strptime(timestr, "%a %b %d %H:%M:%S %z %Y")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertTwitterDate(twitterDate):\n if isinstance(twitterDate, str):\n # # TODO -- handle this using regex?\n twitterDate = datetime.datetime.strptime(twitterDate, \"%Y-%m-%dT%H:%M:%S\")\n return twitterDate", "def yt_datetime(yt_date_time):\n time_obj = time.strptime(yt_date_time, \"%Y...
[ "0.7253326", "0.6921931", "0.69097465", "0.6858569", "0.677372", "0.67647505", "0.67264235", "0.6717891", "0.6596842", "0.6456491", "0.6452504", "0.64496654", "0.6419113", "0.6416089", "0.6404157", "0.64036393", "0.63832146", "0.63804865", "0.6364216", "0.6352645", "0.6351611...
0.7148858
1
Returns name of self class
def get_self_name(self) -> str: return self.__class__.__name__.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\r\n return self.__class__.__name__", "def class_name(self) -> str:\n return self.__class__.__name__", "def f_get_class_name(self):\n return self.__class__.__name__", "def getClassName(self):\n n = type(self).__name__\n return n", "def name(self) -> str:\n ...
[ "0.8852125", "0.8850131", "0.87839246", "0.87667465", "0.8728203", "0.8728203", "0.8679602", "0.8679602", "0.8679602", "0.8679602", "0.8679602", "0.86701566", "0.8598663", "0.8570712", "0.85512286", "0.8544286", "0.8541741", "0.8516065", "0.84566486", "0.8291503", "0.8174922"...
0.8810198
2
Init and create a new frame to contain the triangulation center Optional position for the center of the frame. Default (0,0) radius Optional distance from corners to the center.
def __init__(self, center=(0, 0), radius=9999): center = np.asarray(center) # Create coordinates for the corners of the frame self.coords = [center+radius*np.array((-1, -1)), center+radius*np.array((+1, -1)), center+radius*np.array((+1, +1)), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, center, radius, rotation=0.0, feature_center=None, feature_boarder=None):\n # rotation=math.pi/2 - align the read dot of the camera with the screw\n self._center = center\n self._radius = radius\n self._rotation = rotation\n self._feature_center = feature_cente...
[ "0.6676664", "0.63411975", "0.6179902", "0.57114846", "0.5534782", "0.55271107", "0.55176866", "0.55176866", "0.54962796", "0.54693043", "0.541076", "0.5317382", "0.5296985", "0.529408", "0.52887297", "0.5265165", "0.52315176", "0.5230105", "0.52295285", "0.5191467", "0.51831...
0.7467637
0
Insert new_item into directly after item_before New items added to a dictionary are appended.
def _insert_after(paragraph, item_before, new_item, new_value): item_found = False for item in paragraph: if item_found: value = paragraph.pop(item) paragraph[item] = value if item == item_before: item_found = True paragraph[new_item] = new_value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_item(self, key: _KT, value: _VT) -> None:\n dict.__setitem__(self, key, value)", "def prepend(self, item: Any):\n self.insert(0, item)", "def add_before ( self ):\n self.add_item( 0 )", "def put_new_order(self, item: dict):\n return self.table_connection.put_item(Item=...
[ "0.642172", "0.6301951", "0.6253505", "0.62310386", "0.62070614", "0.6094782", "0.6083916", "0.605952", "0.5998011", "0.5982183", "0.59757614", "0.5935031", "0.5889781", "0.587933", "0.58791065", "0.5836179", "0.5835346", "0.582441", "0.5821649", "0.5794004", "0.578403", "0...
0.769625
0
Returns the value of the Maintainer field.
def get_maintainer(self): return self.paragraphs[0].get("Maintainer")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_original_maintainer(self):\n return self.paragraphs[0].get(\"XSBC-Original-Maintainer\")", "def getMaintainer(self, name, email):\r\n if self.maintainers.has_key(name):\r\n return self.maintainers[name]\r\n else:\r\n self.maintainers[name] = Maintainer(name, ema...
[ "0.61551005", "0.59138644", "0.5685815", "0.5407607", "0.5329033", "0.5318602", "0.53003275", "0.52996933", "0.5192133", "0.5153571", "0.5153571", "0.5127826", "0.51009345", "0.509826", "0.5026537", "0.49984026", "0.49918282", "0.4986109", "0.49360093", "0.48912492", "0.48409...
0.69666094
0
Returns the value of the XSBCOriginalMaintainer field.
def get_original_maintainer(self): return self.paragraphs[0].get("XSBC-Original-Maintainer")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_maintainer(self):\n return self.paragraphs[0].get(\"Maintainer\")", "def set_original_maintainer(self, original_maintainer):\n if \"XSBC-Original-Maintainer\" in self.paragraphs[0]:\n self.paragraphs[0][\"XSBC-Original-Maintainer\"] = original_maintainer\n else:\n ...
[ "0.62599087", "0.5707324", "0.5576531", "0.52927727", "0.51091826", "0.509906", "0.5018135", "0.49116808", "0.48210266", "0.46915063", "0.4677207", "0.46124312", "0.46090537", "0.46077567", "0.4606556", "0.45423928", "0.45042706", "0.4495458", "0.4481923", "0.4481923", "0.447...
0.7101076
0
Check extension for fastq or gzipped fastq. Raise ValueError if extension not recognized.
def check_fastq(filename): fq_exts = [".fq", ".fastq"] p, ext = os.path.splitext(filename) val = False if ext.lower() in [".gz"]: p2, ext2 = os.path.splitext(p) val = ext2.lower() in fq_exts else: val = ext.lower() in fq_exts if not val: raise ValueError("Error: \...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_extension(self):\n if self.extension in Config.override_ext:\n expected_mimetype = Config.override_ext[self.extension]\n else:\n expected_mimetype, encoding = mimetypes.guess_type(self.src_path,\n strict=Fa...
[ "0.65123624", "0.64013535", "0.63146836", "0.6143918", "0.60532343", "0.5836518", "0.58257705", "0.5792562", "0.57849544", "0.57376045", "0.5706201", "0.56216365", "0.56049883", "0.55871713", "0.5584481", "0.5574781", "0.5458147", "0.54552484", "0.5451408", "0.54379416", "0.5...
0.7762297
0
Method that replaces a substring in a token for a given list of tokens.
def _replace_from_sentence_tokens(sentence_tokens, to_replace, replacement): return [token.replace(to_replace, replacement) for token in sentence_tokens]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sub_with_list(self):\n m = strutils.MultiReplace([\n (r'cat', 'kedi'),\n (r'purple', 'mor'),\n (r'q\\w+?t', 'dinglehopper'),\n ], regex=True)\n self.assertEqual(\n m.sub('The purple cat ate a quart of jelly'),\n 'The mor kedi ate ...
[ "0.67109144", "0.64023477", "0.63696796", "0.6349418", "0.6327286", "0.6323115", "0.6227536", "0.6203965", "0.61981875", "0.60321206", "0.599779", "0.5974216", "0.5923483", "0.58950657", "0.58660954", "0.58434665", "0.58434665", "0.5770836", "0.5740962", "0.57251304", "0.5711...
0.66048217
1
Remove stop words from list of tokenized words
def _remove_stopwords(self, words): new_words = [] for word in words: if word not in stopwords.words('english'): new_words.append(word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_words(stop_list, tokens):\n return [t for t in tokens if len(t) > 2 and not t in stop_list]", "def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens", "def remove_stop_words(tokenized_wo...
[ "0.86630034", "0.86183923", "0.85973936", "0.8596811", "0.8580546", "0.8363658", "0.8350171", "0.8328014", "0.8318595", "0.8263289", "0.82468146", "0.820217", "0.81783086", "0.81630206", "0.8158307", "0.8138284", "0.81271654", "0.8113883", "0.8099041", "0.8048383", "0.8027641...
0.79347324
31
Creates and saves a superuser with the given serial number, password.
def create_superuser(self, serial_number, password): user = self.model( serial_number=serial_number, password=password ) user.is_admin = True user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, su_id, first_name, last_name, email, phone_number, password):\n user = self.create_user(\n su_id,\n first_name,\n last_name,\n email,\n phone_number,\n password=password,\n )\n user.is_admin = True\n ...
[ "0.7681351", "0.76124823", "0.76076746", "0.7554112", "0.74127674", "0.7409013", "0.737492", "0.73683006", "0.7329475", "0.731218", "0.7277733", "0.7271645", "0.72659516", "0.7265516", "0.7258986", "0.7253185", "0.72525126", "0.7247135", "0.7238454", "0.7221088", "0.721395", ...
0.80836827
0
Finalize all values that are the only choice for a unit. Go through all the units, and whenever there is a unit with a value that only fits in one box, assign the value to this box.
def only_choice(values): ''' Your solution here ''' new_values = values.copy() for unit in unitlist: for digit in '123456789': dplaces = [box for box in unit if digit in values[box]] if len(dplaces) == 1: new_values[dplaces[0]] = digit return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only_choice(values):\n # TODO: Copy your code from the classroom to complete this function\n for unit in unitlist:\n #print (unit)\n #solved_boxes = [box for box in unit if len(values[box]) == 1]\n #unsolved_boxes = [box for box in unit if len(values[box]) > 1]\n #print (unit,...
[ "0.61504924", "0.57404405", "0.56119126", "0.5568942", "0.5530054", "0.5511549", "0.5460048", "0.5459475", "0.54525775", "0.5449666", "0.54192895", "0.54188764", "0.53864187", "0.5360861", "0.5312623", "0.5276798", "0.525857", "0.525857", "0.5258102", "0.5246358", "0.52420604...
0.51394284
30
Inventory manager is not allowed to create an organization
def test_create_organization_inventory_manager_success(self): self.client.force_authenticate(user=self.inventory_manager) data = {'org_name': 'test_case'} response = self.client.post("/organization/", data) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_organization_failure(self):\n self.client.force_authenticate(user=self.system_admin)\n data = {}\n response = self.client.post(\"/organization/\", data, format='json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)", "def test_add_organization(se...
[ "0.6778392", "0.67234755", "0.64599377", "0.6402805", "0.6393647", "0.635046", "0.6233645", "0.61878043", "0.61232233", "0.5983139", "0.5939455", "0.5922168", "0.59139717", "0.58883953", "0.588757", "0.5857369", "0.5826473", "0.58117867", "0.5802862", "0.57880884", "0.5758042...
0.7750922
0
User can't create organization if missing fields
def test_create_organization_failure(self): self.client.force_authenticate(user=self.system_admin) data = {} response = self.client.post("/organization/", data, format='json') self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_organization_requirements(self):\n form_data = self.form_data(is_org=True)\n form = DonationPaymentForm(data=form_data)\n self.assertFalse(form.is_valid())\n\n form_data['organization_name'] = 'Org org'\n form = DonationPaymentForm(data=form_data)\n self.assertFal...
[ "0.6847244", "0.684167", "0.68183357", "0.6477336", "0.6236655", "0.6222464", "0.6200225", "0.61997765", "0.6189554", "0.6150628", "0.61505085", "0.61335784", "0.61215967", "0.61207044", "0.61083925", "0.609354", "0.6074155", "0.60623264", "0.6027276", "0.6026062", "0.5998916...
0.72812766
0
Gets the height of the parse tree for a sentence.
def _parse_tree_height(sent): children = list(sent._.children) if not children: return 0 else: return max(_parse_tree_height(child) for child in children) + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parse_tree_height(tokens):\n avg_parse_tree_height = 0.0\n \n for sentence in tokens.sents:\n avg_parse_tree_height += _parse_tree_height(sentence)\n \n n_sentences = len(list(tokens.sents))\n avg_parse_tree_height /= n_sentences\n \n return avg_parse_tree_height, n_sent...
[ "0.74386245", "0.705205", "0.6955899", "0.6947488", "0.6883093", "0.6832427", "0.6754443", "0.6688783", "0.66853946", "0.6631002", "0.6612964", "0.6593852", "0.6577851", "0.65697604", "0.6563841", "0.65334165", "0.65145767", "0.64313453", "0.64313453", "0.6428795", "0.6427672...
0.75695616
0
Turn the switch off.
async def async_turn_off(self, **kwargs: Any) -> None: await self.entity_description.turn_off_fn(self.coordinator.diffuser) self._attr_is_on = False self.async_write_ha_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off(self, **kwargs):\n self.smartplug.turn_off()", "def off_switch(self):\n self._switch_callback = None", "def turn_off(self):\n self.handleCommand(1)\n self._state = STATE_OFF", "def turn_off(self, **kwargs):\n set_sonoff_state(self._host, \"off\")\n self....
[ "0.870139", "0.867637", "0.85906535", "0.8523712", "0.84588856", "0.84180963", "0.8404447", "0.8398465", "0.8375364", "0.83491224", "0.83192796", "0.82949907", "0.8277566", "0.81680954", "0.8155346", "0.8112255", "0.8091075", "0.8072859", "0.8058921", "0.8058517", "0.8041678"...
0.0
-1
Iterates over the time period, producing tuples of time series
def items(self): for ts in self: yield ts, self[ts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_time_series(ts, in_len, out_len, step):\n\n for i in reversed(range(len(ts) - out_len, in_len - 1, -step)):\n x = ts[i - in_len:i]\n y = ts[i:i + out_len]\n yield x, y", "def _extract_mql_timeseries_data(response):\n lkeys = response['timeSeriesDescriptor'].get('labelDescripto...
[ "0.6515352", "0.64006966", "0.6393214", "0.6360067", "0.62468415", "0.6239201", "0.6209532", "0.61959296", "0.6089191", "0.6052167", "0.6044509", "0.6021246", "0.6020649", "0.6006316", "0.5988076", "0.59748757", "0.5954953", "0.5924226", "0.591802", "0.58916175", "0.5843919",...
0.5288811
83
Sets the starting timestamp for the series. If the current starting timestamp is less than [ts], no effect.
def set_start(self, ts): base_key = self.floor_time(ts) if self.first_timestamp is None or base_key < self.first_timestamp: self.first_timestamp = base_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_start_time(self, timestamp):\n self.start_day = int(timestamp[8:10])\n hour = int(timestamp[11:13])\n minute = int(timestamp[14:16])\n second = int(timestamp[17:19])\n usecond = float(int(timestamp[21:])) / 1000000\n self.start_time = float(hour * 3600 + minute * 6...
[ "0.71726155", "0.68829364", "0.6790327", "0.6500168", "0.6423189", "0.64198804", "0.641927", "0.63886786", "0.63861066", "0.6351156", "0.6320445", "0.6319173", "0.6225742", "0.6181448", "0.6056101", "0.6056101", "0.5969934", "0.5969934", "0.5969934", "0.5969934", "0.5969934",...
0.83277404
0
Sets the ending timestamp for the series. If the current ending timestamp is greater than [ts], no effect.
def set_end(self, ts): base_key = self.floor_time(ts) if self.last_timestamp is None or base_key > self.last_timestamp: self.last_timestamp = base_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_time_stamp(self, end_time_stamp):\n\n self._end_time_stamp = end_time_stamp", "def end(self, end):\n # type: (datetime) -> None\n\n if end is not None:\n if not isinstance(end, datetime):\n raise TypeError(\"Invalid type for `end`, type has to be `datetime`\...
[ "0.685227", "0.62342775", "0.61946666", "0.61403495", "0.6130133", "0.6126901", "0.6126901", "0.6122215", "0.6037033", "0.6037033", "0.6037033", "0.6017229", "0.59695864", "0.5881182", "0.5881182", "0.5881182", "0.5861162", "0.5849282", "0.5826532", "0.5782154", "0.57187223",...
0.8093839
0
Returns the addition of other to self.
def __radd__(self, other): # Maintain state of self and create new trace variable new_var new_var = Var(self.val, self.der) return new_var.__add__(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n return self.add(other)", "def __radd__(self, other):\n return self + other", "def __radd__(self, other):\n return self + other", "def __iadd__(self, other):\n\n return self + other", "def __add__(self, other):\r\n return self.add(other)", "de...
[ "0.87494993", "0.8552048", "0.8552048", "0.8539222", "0.8523907", "0.84485304", "0.8430519", "0.8407301", "0.8396849", "0.8396849", "0.8396849", "0.8396849", "0.8396849", "0.8396849", "0.8396849", "0.834592", "0.8284097", "0.82768524", "0.82768524", "0.82576734", "0.8238056",...
0.73007697
100