query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
save the dataset to records file. Remember to call after convert_to_ids method.
def save_records(self, pad_id): train_records_path = os.path.join(self.config.records_dir, "train.tfrecords") dev_records_path = os.path.join(self.config.records_dir, "dev.tfrecords") test_records_path = os.path.join(self.config.records_dir, "test.tfrecords") statistics_file = os.path.jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_dataset(self):\n if self.res_dataset is None:\n return\n if self.write_path is None:\n raise Exception(\"Error: Attempted to save result dataset without ever specifiying a path to write to\")\n\n if self.format == \"arrow\":\n self.res_dataset.save_to_...
[ "0.68754226", "0.67101437", "0.65302217", "0.6478312", "0.63904744", "0.63881606", "0.6382442", "0.6357445", "0.6306369", "0.6278397", "0.62303036", "0.6225361", "0.62247103", "0.62021756", "0.6199742", "0.6193617", "0.61871", "0.6167681", "0.61663264", "0.61569935", "0.61483...
0.6829742
1
>>> p = Primes(10) >>> len(p) 4
def __len__(self): return len(self.primes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_length_primes(n):\n assert n > 0, \"Cannot generate a list of %d length primes.\" % n\n a = []\n for i in range(10**(n-1), 10**n):\n if is_prime(i):\n a.append(str(i))\n return a", "def prime_pi(n):\n if n < 2:\n return 0\n\n primes = sieve(n)\n return len(prim...
[ "0.72399455", "0.71607894", "0.6955966", "0.6808245", "0.6790493", "0.67851686", "0.6727017", "0.6705161", "0.6661847", "0.66584545", "0.65762335", "0.6457321", "0.6454395", "0.6433077", "0.6403811", "0.63543993", "0.633442", "0.628941", "0.62281543", "0.622775", "0.622196", ...
0.7829653
0
clean_up on place shall remove link with associated visitors but not delete it. However since each album needs to be associated with a place, clean_up on place shall clean_up and delete associated albums.
def clean_up(self, graph): # Delete albums associated with place if len(self.albums) != 0: for album in self.albums: album.clean_up() album.delete(graph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n\n tracks = []\n removed_playlists = 0\n for playlist in PlaylistManager.find():\n\n if len(playlist.tracks) == 0:\n PlaylistManager.remove(playlist.id)\n removed_playlists += 1\n else:\n tracks += playlist.tracks\n\n tracks = list(set(tracks...
[ "0.56522363", "0.5632935", "0.556085", "0.551513", "0.54856205", "0.5455005", "0.5455005", "0.5452388", "0.545235", "0.544706", "0.5406526", "0.5401399", "0.53751695", "0.5368347", "0.53581285", "0.5356732", "0.53475654", "0.53157127", "0.53075457", "0.5305903", "0.5292561", ...
0.7646151
0
The subsystems which the pulses work on.
def onSubSys(self) -> List[int]: return self._onSubSys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsystems():\n return list(x for x in SystemScope if x is not SystemScope.SYSTEM)", "def all_present_subsystems(self):\n return _yield_subdir_names(self.subsys_configs)", "def subsystems(self) -> Optional[Iterable[str]]:\n\n return self.get_project_subsystems()", "def assign_subsyst...
[ "0.7108462", "0.6836988", "0.6729169", "0.65037864", "0.6058275", "0.59678674", "0.5963102", "0.5925865", "0.58703226", "0.5808296", "0.57273567", "0.57026535", "0.5601382", "0.5600621", "0.5598558", "0.55863845", "0.5569667", "0.5562868", "0.55053097", "0.5504476", "0.550156...
0.6854705
1
Compare two GatePulsePair object.
def _compareObj(self, other): if not isinstance(other, GatePulsePair): raise Error.ArgumentError(f"GatePulsePair object can not compare with a {type(other)}.") if isinstance(other.cirLine.data, FixedGateOP) and isinstance(self.cirLine.data, RotationGateOP): return False i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateCompare(self,gate1,gate2):\n \n if gate1.getDist()>gate2.getDist():\n return 1\n elif gate1.getDist()==gate2.getDist():\n return 0\n else: #gate1Num<gate2Num\n return -1", "def __eq__(self, other: 'PairwiseInfo') -> bool:\n\n ret...
[ "0.6439984", "0.61721945", "0.60912037", "0.60420144", "0.602644", "0.59933335", "0.5925109", "0.5911374", "0.58882856", "0.5884855", "0.5847428", "0.5843614", "0.58279824", "0.5825291", "0.5825062", "0.5806124", "0.5805809", "0.57896304", "0.57886875", "0.5786566", "0.577911...
0.7468586
0
Return the evaluation of the goal function f at point theta.
def evaluate_goal(self, theta, old_theta, i, res, iter): base_theta = utils.true_param(old_theta) v = self.f(i, base_theta, **theta) # Store the value in history. This is only stored if iter is below # iter_parallel_start, otherwise we store the history after the # parallel ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(self, x, theta):\n raise NotImplementedError(\n \"f has not been implemented for this Experiment\")", "def evaluate(self, theta=np.array([]) ):\n ### 2018-05-06 - check whether the parameter-set is within\n ### physical bounds. If not, return -np.inf here.\n if not se...
[ "0.695184", "0.63509303", "0.61093414", "0.6083635", "0.5811482", "0.5794628", "0.5793523", "0.57917213", "0.5768919", "0.5766916", "0.5753904", "0.5725246", "0.5663353", "0.5654156", "0.5633597", "0.5614551", "0.5608629", "0.55932194", "0.55601877", "0.554822", "0.55387604",...
0.6660737
1
Return the average of the n last evaluations of the goal function. This is a fast function which uses the last evaluations already done by the SPSA algorithm to return an approximation of the current goal value (note that we do not call the goal function another time, so the returned value is an upper bound of the true...
def average_evaluations(self, n): assert(self.history_count > 0), "not enough evaluations in average_evaluations!" n = max(1, min(1000, n)) n = min(n, self.history_count) # print(f'n = {n}') # print(f'hist_cnt = {self.history_count}') sum_eval = 0.0 sum_theta =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_best_evals(self, n):\n\n assert(self.best_count > 0), \"not enough evaluations in average_evaluations!\"\n\n n = max(1, min(1000, n))\n n = min(n, self.best_count)\n\n sum_eval = 0.0\n sum_theta = utils.linear_combinaison(0.0, self.theta0)\n for i in range(n):\...
[ "0.7095657", "0.64972407", "0.6409218", "0.6360709", "0.6347688", "0.6334922", "0.632885", "0.625927", "0.62543154", "0.6250692", "0.6192058", "0.61885005", "0.6188313", "0.61422193", "0.6113202", "0.61050177", "0.60652506", "0.60049415", "0.5967572", "0.59209144", "0.5917514...
0.71149397
0
Return the average of the n last best evaluations of the goal function. This is a fast function which uses the last evaluations already done by the SPSA algorithm to return an approximation of the current goal value (note that we do not call the goal function another time, so the returned value is an upper bound of the...
def average_best_evals(self, n): assert(self.best_count > 0), "not enough evaluations in average_evaluations!" n = max(1, min(1000, n)) n = min(n, self.best_count) sum_eval = 0.0 sum_theta = utils.linear_combinaison(0.0, self.theta0) for i in range(n): j =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_evaluations(self, n):\n\n assert(self.history_count > 0), \"not enough evaluations in average_evaluations!\"\n\n n = max(1, min(1000, n))\n n = min(n, self.history_count)\n # print(f'n = {n}')\n # print(f'hist_cnt = {self.history_count}')\n\n sum_eval = 0.0\n ...
[ "0.6813846", "0.6276238", "0.61682856", "0.61212015", "0.6074704", "0.6072416", "0.6014111", "0.6009451", "0.60071987", "0.5985506", "0.5965429", "0.59616864", "0.59548175", "0.5951732", "0.5939928", "0.5937624", "0.5937097", "0.5905596", "0.5884166", "0.58767945", "0.5859884...
0.749127
0
Generator for model filters in an operator.
def _model_filter_in_operator_generator(filter_operator: Operator) -> Generator: for operator in filter_operator: if isinstance(operator.unresolved_value, ModelFilter): yield operator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters(self):", "def filter(self, filters):", "def condition_filters(self):\r\n return filters.Filters(self)", "def _build_filters(self, criteria: Q):\n # Decide the function based on the connector type\n func = and_ if criteria.connector == criteria.AND else or_\n params...
[ "0.6577749", "0.6336782", "0.62646586", "0.61139977", "0.58842677", "0.5834455", "0.58338654", "0.5800242", "0.57979363", "0.57475597", "0.5693952", "0.5657997", "0.56530845", "0.5643832", "0.5632665", "0.5546424", "0.5539193", "0.55261505", "0.54394835", "0.53975594", "0.539...
0.841577
0
Iterate over the operators in the filter, assign resolved value if found in second arg. If not found, assigns ``UNKNOWN``.
def _put_resolved_booleans_into_filter( filter_operator: Operator, model_filters_to_resolved_values: Dict[ModelFilter, BooleanValues] ) -> None: for operator in _model_filter_in_operator_generator(filter_operator): model_filter = operator.unresolved_value operator.resolved_value = model_filters_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_operator(self):\n\t\tfor op in self.ops:\n\t\t\tself.filter.set_operator(op)\n\t\t\tself.assertEqual(self.filter.operator.value, op)", "def _model_filter_in_operator_generator(filter_operator: Operator) -> Generator:\n for operator in filter_operator:\n if isinstance(operator.unresolved_value,...
[ "0.60437655", "0.5642127", "0.5469392", "0.5314203", "0.52503777", "0.5242413", "0.50989926", "0.5098336", "0.50518554", "0.5039647", "0.50250936", "0.49366522", "0.4914287", "0.4895046", "0.48431635", "0.48428714", "0.48428714", "0.47520688", "0.47494227", "0.4746074", "0.47...
0.6927108
0
Iterate over the model filters, if the filter key has a cached value, evaluate the filter. The resolved filter values are placed in ``model_filters_to_resolved_values``.
def _populate_model_filters_to_resolved_values( manifest_specs_cached_values: Dict[str, Any], model_filters_to_resolved_values: Dict[ModelFilter, BooleanValues], model_filters: Operator, ) -> None: for model_filter in model_filters: if model_filter.key in manifest_specs_cached_values: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_filters(self, filters, queryset, view):\n return filters", "def apply_filters(self, filters):\n self._data = self.model.objects.filter(**filters)", "def _get_filters(self, request, queryset, view): # noqa\n self.opts = queryset.model._meta\n filter_fields = getattr(view...
[ "0.60582566", "0.58838373", "0.5869402", "0.5766602", "0.5689414", "0.5587206", "0.55353963", "0.5509496", "0.54153544", "0.5376045", "0.5346958", "0.53428364", "0.53274405", "0.5317073", "0.5286032", "0.5283004", "0.5261405", "0.52375436", "0.52314645", "0.5215077", "0.52018...
0.747011
0
Parse the model ID, return a tuple framework, task, restofid.
def extract_framework_task_model(model_id: str) -> Tuple[str, str, str]: _id_parts = model_id.split("-") if len(_id_parts) < 3: raise ValueError(f"incorrect model ID: {model_id}.") framework = _id_parts[0] task = _id_parts[1] name = "-".join(_id_parts[2:]) return framework, task, name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_id(app_object_id_string):\n splitter = re.compile(r'-')\n tokens = splitter.split(app_object_id_string)\n app_string = tokens[0]\n model_string = tokens[1]\n content_id = int(tokens[2])\n content_type = ContentType.objects.get(app_label=app_string, model=model_string)\n object = cont...
[ "0.63340414", "0.6116038", "0.6081815", "0.6078587", "0.6059168", "0.6045916", "0.60072386", "0.59797734", "0.58408475", "0.5745599", "0.57417506", "0.57395905", "0.5736701", "0.57130075", "0.56183445", "0.5603926", "0.5577302", "0.5551033", "0.5548943", "0.55013406", "0.5496...
0.79884815
0
List tasks for JumpStart, and optionally apply filters to result.
def list_jumpstart_tasks( # pylint: disable=redefined-builtin filter: Union[Operator, str] = Constant(BooleanValues.TRUE), region: str = JUMPSTART_DEFAULT_REGION_NAME, ) -> List[str]: tasks: Set[str] = set() for model_id, _ in _generate_jumpstart_model_versions(filter=filter, region=region): _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tasks(ctx):\n ctx.run(\"invoke --list\")", "def list():\n manager = Actions()\n tasks_list = manager.get_tasks_list()\n console_utils.print_tree(manager, tasks_list)", "def task_list(request):\n ip = get_ip(request)\n tasks = Task.objects.filter(ip=ip).order_by(\"-start_time\")\n ...
[ "0.62302595", "0.5944628", "0.5892642", "0.5848125", "0.58470535", "0.5805977", "0.5783318", "0.5729834", "0.56717557", "0.5634618", "0.56331176", "0.5580704", "0.5574483", "0.5566287", "0.55040795", "0.5500361", "0.5482131", "0.54775214", "0.54646075", "0.546253", "0.5454796...
0.7140575
0
List frameworks for JumpStart, and optionally apply filters to result.
def list_jumpstart_frameworks( # pylint: disable=redefined-builtin filter: Union[Operator, str] = Constant(BooleanValues.TRUE), region: str = JUMPSTART_DEFAULT_REGION_NAME, ) -> List[str]: frameworks: Set[str] = set() for model_id, _ in _generate_jumpstart_model_versions(filter=filter, region=region):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_frameworks():\n sys.stdout.write(\n \"\"\"Testable frameworks: %s\n\nNote that membership in this list means the framework can be tested with\nPyMongo, not necessarily that it is officially supported.\n\"\"\"\n % \", \".join(sorted(FRAMEWORKS))\n )", "def _add_framework_name(framewor...
[ "0.641015", "0.54722816", "0.52246255", "0.5197344", "0.51471305", "0.49741188", "0.4967614", "0.49433026", "0.486602", "0.47791523", "0.47461623", "0.47451043", "0.47303116", "0.46275637", "0.46110302", "0.45978498", "0.45566553", "0.45515397", "0.45515397", "0.44752362", "0...
0.7124517
0
List scripts for JumpStart, and optionally apply filters to result.
def list_jumpstart_scripts( # pylint: disable=redefined-builtin filter: Union[Operator, str] = Constant(BooleanValues.TRUE), region: str = JUMPSTART_DEFAULT_REGION_NAME, ) -> List[str]: if (isinstance(filter, Constant) and filter.resolved_value == BooleanValues.TRUE) or ( isinstance(filter, str) an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listscripts(self):\n code, data, listing = self.__send_command(\n \"LISTSCRIPTS\", withcontent=True)\n if code == \"NO\":\n return None\n ret = []\n active_script = None\n for l in listing.splitlines():\n if self.__size_expr.match(l):\n ...
[ "0.5531334", "0.5428492", "0.52650154", "0.5204197", "0.5131874", "0.510841", "0.5031889", "0.4875896", "0.48689678", "0.48459044", "0.48197192", "0.48173922", "0.48037595", "0.47818825", "0.47726372", "0.4759749", "0.47552037", "0.4720627", "0.46446505", "0.46405977", "0.463...
0.73214215
0
Generate models for JumpStart, and optionally apply filters to result.
def _generate_jumpstart_model_versions( # pylint: disable=redefined-builtin filter: Union[Operator, str] = Constant(BooleanValues.TRUE), region: str = JUMPSTART_DEFAULT_REGION_NAME, list_incomplete_models: bool = False, ) -> Generator: if isinstance(filter, str): filter = Identity(filter) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_models():\n train_models()\n return build_response.sent_ok()", "def build_model():", "def printModels(cls, options):\n print \"Generating experiment requests...\"\n\n searchParams = _ClientJobUtils.makeSearchJobParamsDict(options=options)", "def _prepare_models(self):\n if self.f...
[ "0.5248083", "0.5081667", "0.48777255", "0.4869814", "0.48449266", "0.48347938", "0.48122686", "0.47640938", "0.47469398", "0.4737511", "0.4721504", "0.47007674", "0.470074", "0.46955106", "0.46910864", "0.46489784", "0.4646657", "0.46447644", "0.4593294", "0.45908704", "0.45...
0.64913726
0
Function which mormalizes the data. Rows of D data points. Original varible D is not modified, new variables are allocated from scratch. When external means and stds are not provided, means and stds from the data are calculated.
def normalize(D, ntype=0, means=None, stds=None): if (not isinstance(D,np.ndarray)) or (len(D.shape) > 2): raise AssertionError("Input D must be derivative of numpy.ndarray and have less than 3 dimensions.") (D,initial_shape) = ensure_column(D) n_rows = D.shape[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def denormalize(D, means, stds=None): \n \n (D,initial_shape) = ensure_column(D) \n \n n_rows = D.shape[0] \n \n if stds is not None:\n result = np.multiply( D, stds ) + np.tile( means, (n_rows,1) )\n else:\n result = D + np.tile( means, (n_rows,1) )\n \n result...
[ "0.78407174", "0.6774901", "0.67637706", "0.67298394", "0.6704539", "0.6699134", "0.66663307", "0.6653064", "0.6653064", "0.6491102", "0.6440225", "0.6440225", "0.6421771", "0.6375681", "0.63658774", "0.6330248", "0.6249732", "0.6249581", "0.6240338", "0.6208789", "0.62005764...
0.71338135
1
Denormalizes the data using means and stds. Original varible D is not modified, new variables are allocated from scratch.
def denormalize(D, means, stds=None): (D,initial_shape) = ensure_column(D) n_rows = D.shape[0] if stds is not None: result = np.multiply( D, stds ) + np.tile( means, (n_rows,1) ) else: result = D + np.tile( means, (n_rows,1) ) result = rev_ensure_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(D, ntype=0, means=None, stds=None):\n \n if (not isinstance(D,np.ndarray)) or (len(D.shape) > 2):\n raise AssertionError(\"Input D must be derivative of numpy.ndarray and have less than 3 dimensions.\")\n \n (D,initial_shape) = ensure_column(D)\n \n n_rows = D.shape[0...
[ "0.7247053", "0.7206705", "0.71938586", "0.7177489", "0.7083183", "0.70006365", "0.69111687", "0.68807256", "0.6869511", "0.6869511", "0.68402255", "0.68382424", "0.6825936", "0.67422646", "0.6687607", "0.6647537", "0.66458845", "0.66431385", "0.663447", "0.661706", "0.661368...
0.77888536
0
This function is reverse with respect to ensure_coulmn It restores the original dimensions of the vector
def rev_ensure_column(v,initial_shape): if initial_shape: # check that the tuple is nonempty v.shape = initial_shape return v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orthonormalize_inplace(self):\n Q = np.linalg.qr(self.components.T)[0].T\n self.components[...] = Q", "def resize(self, *args):\n return _ida_hexrays.qvector_lvar_t_resize(self, *args)", "def _fix_shape(x, n, axis):\n s = list(x.shape)\n if s[axis] > n:\n index = [slice(No...
[ "0.5942021", "0.5941977", "0.5830956", "0.58093876", "0.5779417", "0.5717236", "0.56827855", "0.56485176", "0.56421804", "0.5637114", "0.56165284", "0.5542016", "0.5524448", "0.54983765", "0.54652536", "0.54402447", "0.541388", "0.5400957", "0.5379518", "0.53780234", "0.53077...
0.6151537
0
Function determines dimension of a vector. E. g. if vector has a shape (1,len) or (len,1) or (len,) it returns len.
def vector_len( vector ): if not isinstance(vector, np.ndarray ): return len(vector) else: shape = vector.shape # shape is a tuple sl = len(shape) if sl == 0: return 0 elif sl == 1: return shape[0] else: non_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vector_length(v):\r\n v = as_tensor_variable(v)\r\n if v.ndim != 1:\r\n raise TypeError('argument must be symbolic vector')\r\n if v.type.broadcastable[0]:\r\n return 1\r\n if isinstance(v, gof.Constant) and v.type.ndim == 1:\r\n return len(v.data)\r\n if v.owner and isi...
[ "0.78375614", "0.76818323", "0.7277682", "0.71983206", "0.7103266", "0.6978397", "0.6914042", "0.68944025", "0.6851971", "0.6821197", "0.6734348", "0.67316663", "0.6725683", "0.66860473", "0.66572464", "0.6627746", "0.6585282", "0.65730613", "0.6547987", "0.6525411", "0.65132...
0.8467635
0
View lists all activities in a recipe
def view_activities(recipe_id): if 'name' in session: recipe = PLAN.get_name_from_id(recipe_id) activities = PLAN.users[session['name']].view_recipe_activities(recipe) return render_template('activities.html', activities=activities, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_activities(self): \n database = Database('data/database.db')\n activities = database.read_activities()\n view = Template(filename=\"view/template.html\", lookup=lookup)\n \n \n return view.render(\n rows = [[item.number, item.name] for item in activities]...
[ "0.7098218", "0.64416516", "0.6359117", "0.6214234", "0.62102234", "0.60915476", "0.60626256", "0.5996576", "0.5990855", "0.5967303", "0.5947807", "0.5926748", "0.5922374", "0.58748513", "0.5871159", "0.58557916", "0.5843883", "0.58284855", "0.5797355", "0.57198846", "0.56897...
0.7231245
0
Extracts the name from a single sentence of the 'database' input_string. The name is the first word in the string.
def extract_name(sentence): pos = sentence.find(' ') return sentence[:pos]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_name(sentence):\n if \"WIFE\" in sentence:\n return \"WIFE\"\n elif \"MAHAVIR\" in sentence or \"FATHER\" in sentence or \"SINGH\" in sentence: \n return \"MAHAVIR\"\n elif \"TEENAGER\" in sentence:\n return \"TEENAGER\"\n elif \"GIRL\" in sentence or \"WOMAN\" in sentenc...
[ "0.56790894", "0.5624334", "0.5608065", "0.5596785", "0.55544513", "0.5494415", "0.54825205", "0.5446229", "0.5429508", "0.53938454", "0.5371457", "0.5356211", "0.5354216", "0.53345764", "0.53151315", "0.5298442", "0.5283765", "0.52683014", "0.5237332", "0.52276117", "0.52254...
0.66267174
0
Extracts the comma separated connection or film data from a sentence of the 'database' input_string. Starting from a given substring to the end of the string. To retrieve connections, start_str='to'. To retrieve games, start_str='play'
def extract_data(sentence, start_str): pos = sentence.find(start_str) if pos == -1: return None if pos + len(start_str) == len(sentence) - 1: return [] items = sentence[pos + (len(start_str) + 1):].split(',') return list(map(lambda x: x.lstrip(), items))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_match_rows(self, string):\n # Strings to build the query\n fieldlist = 'w0.urlid'\n tablelist = ''\n clauselist = ''\n wordids = []\n\n # Split the words by spaces\n words = string.split(' ')\n tablenumber = 0\n\n for word in words:\n ...
[ "0.5334885", "0.5186011", "0.5090417", "0.50633615", "0.50150484", "0.4872764", "0.48694447", "0.48500234", "0.484397", "0.48406842", "0.47947022", "0.47689897", "0.4748765", "0.47441426", "0.473664", "0.46660376", "0.46588197", "0.46465313", "0.46278796", "0.45753732", "0.45...
0.58856046
0
Returns a list of all the games a user likes
def get_games_liked(network, user): if not user in network: return None if not 'games' in network[user]: return [] return network[user]['games']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_likes(self, data_base):\n cursor = data_base.cursor(dictionary=True)\n cursor.execute(f\"SELECT user_id FROM user_like WHERE post_id = {self.id}\")\n user_likes = tuple(map(lambda x: str(x['user_id']), cursor.fetchall()))\n if not user_likes:\n return []\n ...
[ "0.7015423", "0.69208395", "0.67245775", "0.67051995", "0.6687749", "0.65598106", "0.64529777", "0.64155376", "0.6378932", "0.63228387", "0.62585735", "0.6232062", "0.6226145", "0.61290556", "0.6088099", "0.6082818", "0.6048625", "0.5938895", "0.5935001", "0.5928655", "0.5897...
0.76072174
0
Adds a connection from user_A to user_B.
def add_connection(network, user_A, user_B): if user_A not in network or user_B not in network: return False if not user_B in network[user_A]['connections']: network[user_A]['connections'].append(user_B) return network
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_addConnection(self, user, tagA, tagB):\r\n eTagA, iTagA = tagA.split('/', 2)\r\n eTagB, iTagB = tagB.split('/', 2)\r\n\r\n ifA = user.getEndpoint(eTagA).getInterface(iTagA)\r\n ifB = user.getEndpoint(eTagB).getInterface(iTagB)\r\n\r\n if ifA.clsName != ifB.clsName:\r\n ...
[ "0.7987027", "0.7670441", "0.71820414", "0.6541292", "0.6537126", "0.6513064", "0.63350296", "0.62619996", "0.62432957", "0.6166243", "0.6136505", "0.60668856", "0.6046037", "0.5969228", "0.58736104", "0.58450896", "0.5791936", "0.5787016", "0.57681024", "0.5718977", "0.57006...
0.79342914
1
Creates a new user profile and adds that user to the network, along with any game preferences specified in games. Users have no connections to begin with.
def add_new_user(network, user, games): if not user in network: network[user] = {'connections': [], 'games': games} return network
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_user(network, user, games):\n if user not in network:\n network[user] = [[], games]\n return network", "def create_user_profile(sender, instance, created, **kwargs):\n if created:\n # create new Stellar account\n stellar.api.create_account(user=instance)", "def createP...
[ "0.7117497", "0.70152885", "0.69539124", "0.69374615", "0.69374615", "0.69374615", "0.6920384", "0.69119585", "0.68634856", "0.6826175", "0.6809397", "0.6758873", "0.67379594", "0.67251223", "0.6718418", "0.6712079", "0.66611475", "0.6638409", "0.6633247", "0.6613752", "0.661...
0.7374734
0
Finds all the secondary connections (i.e. connections of connections) of a given user. Secondary connections can include the user himself/herself and a user's primary connection that is a secondary connection as well.
def get_secondary_connections(network, user): if user not in network: return None if network[user]['connections'] != []: result = [] for conn in get_connections(network, user): for conn_2 in get_connections(network, conn): if conn_2 not in result: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_secondary_connections(network, user):\n if user not in network:\n return None\n if network[user][0] == []:\n return []\n return [person\n for group in\n [network[connection][0] for connection in network[user][0]]\n for person in group]", "def get_co...
[ "0.8156165", "0.67806035", "0.6443198", "0.6302404", "0.6001595", "0.58823705", "0.56933975", "0.5661499", "0.5622436", "0.56224114", "0.56027144", "0.55988115", "0.55988115", "0.5553347", "0.5547893", "0.5535188", "0.54834986", "0.54733616", "0.5465031", "0.54358125", "0.539...
0.8376694
0
Finds the number of people that user_A and user_B have in common.
def count_common_connections(network, user_A, user_B): if user_A not in network or user_B not in network: return False common_connections = 0 for conn in network[user_A]['connections']: if conn in network[user_B]['connections']: common_connections += 1 return common_connectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_common_connections(network, user_A, user_B):\n count = 0\n if user_A not in network or user_B not in network:\n return False\n for person in network[user_A][0]:\n if person in network[user_B][0]:\n count += 1\n return count", "def common_count(self, node_1, node_2):...
[ "0.81366605", "0.64713997", "0.6242102", "0.6077465", "0.607496", "0.58812374", "0.58194506", "0.5770734", "0.576868", "0.5764771", "0.5734131", "0.5663875", "0.5648639", "0.56372166", "0.56187195", "0.5590245", "0.55224013", "0.5519934", "0.5516126", "0.5513296", "0.55109286...
0.7500884
1
Finds a connections path from user_A to user_B. It has to be an existing path but it DOES NOT have to be the shortest path.
def find_path_to_friend(network, user_A, user_B, path=None): if path is None: path = [] if user_A in network and user_B in network: path.append(user_A) current_connections = get_connections(network, user_A) if user_B in current_connections: return [user_A, user_B] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_path(network, user_A, user_B, path=[]):\n path = path + [user_A] # all paths include starting node\n if user_A == user_B: # id the last node is user_B a valid path exists\n return path # base case\n for node in network[user_A][0]:\n if node not in path: # otherwise path is an ...
[ "0.7669256", "0.74481094", "0.7430099", "0.6393886", "0.6260245", "0.62537074", "0.6090832", "0.60771996", "0.6049806", "0.5955868", "0.59534496", "0.5941864", "0.5919209", "0.5871891", "0.5821266", "0.5804118", "0.5768927", "0.57547647", "0.57235235", "0.5713709", "0.5698482...
0.8000221
0
Filters users by a liked game.
def users_by_game(network, game): result = [] for user in network: if game in get_games_liked(network, user): result.append(user) if result == []: return None return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_games_liked(network, user):\n if not user in network:\n return None\n if not 'games' in network[user]:\n return []\n return network[user]['games']", "def get_games_liked(network, user):\n if user not in network or network[user][1] == []:\n return None\n return network[...
[ "0.6602238", "0.6027898", "0.5924964", "0.59089816", "0.5883662", "0.5883414", "0.5834347", "0.58041096", "0.5760458", "0.5760458", "0.574534", "0.5715337", "0.57011193", "0.5692843", "0.5640665", "0.5617214", "0.5617123", "0.55867946", "0.5584217", "0.5572285", "0.5558541", ...
0.6763938
0
Removes a user from the network, including within connections.
def delete_user(network, user): if user in network: del network[user] for u in network: connections = get_connections(network, u) if user in connections: i = connections.index(user) del connections[i] return network
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, user):\n self.packet.send_room([\"rp\", user.get_int_id(self.rooms),\n user.data.id], user.room)\n self.rooms[user.room][\"users\"].remove(user)", "def remove_user(self, u: \"Node\") -> None:\n\n if u in self.users_:\n self.users_[u] ...
[ "0.77904415", "0.7550601", "0.7473682", "0.74685127", "0.7452049", "0.7438654", "0.731242", "0.7298207", "0.722409", "0.722409", "0.722409", "0.7219383", "0.7191735", "0.7148766", "0.70995563", "0.70881975", "0.7084012", "0.7063465", "0.70371556", "0.7036402", "0.70335364", ...
0.80548996
0
check type and dimensionality of an input signal. If signal is the first input signal, set the dimension of it as self.dim. So, this method have to be called before calling functions that use self.dim.
def __check_signal(self, signal): if not(isinstance(signal, np.ndarray)): raise TypeError() if len(signal.shape) != 1: raise TypeError() if not(hasattr(self, 'dim')): self.dim = signal.shape[0] else: if signal.shape[0] != self.dim: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_signal(self, signal: np.ndarray):\n # if signal is a list, convert it to nparray\n if isinstance(signal, list):\n signal = np.array(signal)\n # if signal is still not nparray, raise error\n if not (isinstance(signal, np.ndarray)):\n print(\"1\") \n ...
[ "0.7807708", "0.66550505", "0.6484145", "0.6049809", "0.59849834", "0.59090304", "0.589519", "0.584538", "0.5836356", "0.5833826", "0.5738557", "0.5730873", "0.56899583", "0.5685632", "0.5644865", "0.5634468", "0.55924934", "0.55602676", "0.554988", "0.55450547", "0.55286795"...
0.8263599
0
Generates corr space data and saves it to disk
def gen_data(self,do_print=True,force_gen_inputs=False): if do_print: print print 'Generating corr space data, id = %s'%self.id self.post_init(force_gen_inputs=force_gen_inputs) self.run() self.post_run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_data_raw (mdp,do_makedata,filename):\n #\n fin = open(filename,'r')\n for line in fin:\n lsp = line.split(' ')\n if len(lsp) > 1: # skip empty lines\n if lsp[0] == \"for\": # indicates when to get correlator\n lsp.pop(0)\n update_params(mdp,lsp)\n ## -- do_makedata tells it to go ahead with g...
[ "0.65893036", "0.6341853", "0.62557477", "0.6097091", "0.6018437", "0.60105604", "0.5890326", "0.58047855", "0.57793343", "0.57107365", "0.5645555", "0.5641321", "0.560955", "0.55532336", "0.54753006", "0.54725295", "0.5466314", "0.54604185", "0.54604185", "0.54604185", "0.54...
0.66838986
0
returns euclidean distance p1 is a list of features p2 is alsoa a list of features p1 and p2 should be the same size distance is the squareroot of sum of all squares of differences for each feature
def distance(p1, p2): """ (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2 + """ sum_all = 0 for i, v in enumerate(p1): diff_squared = (v - p2[i]) ** 2 sum_all += diff_squared return(math.sqrt(sum_all))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_feature_distances(features1: np.ndarray, \r\n features2: np.ndarray) -> np.ndarray:\r\n #broadcasting trick\r\n a = features1[:, np.newaxis, :]\r\n b = features2[np.newaxis, :, :]\r\n \r\n return np.linalg.norm( (a-b), axis=-1)", "def GetDist(feature_1, fea...
[ "0.7802887", "0.7571842", "0.7497374", "0.7418175", "0.73836523", "0.73509413", "0.7349909", "0.72473276", "0.7206549", "0.7182788", "0.7123703", "0.7121786", "0.7101655", "0.70998794", "0.70989585", "0.70877427", "0.70846736", "0.7084224", "0.70823973", "0.70755225", "0.7070...
0.76441604
1
Returns the nth 0based term of the Fibonacci sequence
def fibonacci_term(n): return int(((1+sqrt(5))**n-(1-sqrt(5))**n)/(2**n*sqrt(5)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci(n):", "def fibonacci(n):\n\tfib_seq = []\n\tnth_term = 0\n\t\n\tfor i in range(0,n+1):\n\t\tif i == 0:\n\t\t\tfib_seq.append(0)\n\t\tif i == 1:\n\t\t\tfib_seq.append(1)\n\t\tif i > 1:\n\t\t\tnth_term = fib_seq[-1] + fib_seq[-2]\n\t\t\tfib_seq.append(nth_term)\n\t\n\tprint(fib_seq)\n\tprint(fib_seq[...
[ "0.77835625", "0.7699114", "0.7652416", "0.7619707", "0.75898635", "0.7513049", "0.7501769", "0.74895394", "0.7479242", "0.74768573", "0.7446154", "0.7437935", "0.74273765", "0.74261755", "0.7385632", "0.73672014", "0.73632944", "0.7333317", "0.7329111", "0.7326546", "0.73195...
0.79072845
0
Returns the fibonacci sequence up to max
def fibonacci_sequence(max): term = fibonacci_term(0) f = [] i = 1 while term < max: f.append(term) term = fibonacci_term(i) i += 1 return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci(max_num):\n\n\t# base case\n\tif max_num <= 1:\n\t\treturn 1\n\telse:\n\t\t# moving toward base case\n\t\t# calling itself recursively\n\t\treturn fibonacci(max_num - 1) + fibonacci(max_num - 2)", "def fibonacci(n):", "def generateFibonacci(upper_bound):\n fibs = [0]\n latest = 1\n while...
[ "0.8281956", "0.7737896", "0.75432396", "0.72496516", "0.7240206", "0.714092", "0.71191853", "0.7100903", "0.7076584", "0.70763195", "0.70746773", "0.70539343", "0.70536774", "0.7052248", "0.70504606", "0.7048068", "0.70352656", "0.70310515", "0.7012211", "0.70013833", "0.699...
0.88220775
0
Returns the nth pentagonal number
def pentagonal(n): return (n * ((3 * n) - 1)) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pentagonal(n: int) -> int:\n return int(n * (3 * n - 1) / 2)", "def pentagon(n) -> int:\n\n return (n * (3 * n - 1)) // 2", "def pentagonal_index(P):\n return (1 + sqrt(1 + 24 * P)) / 6", "def heptagonal(n: int) -> int:\n return int(n * (5 * n - 3) / 2)", "def octagonal(n: int) -> int:\n ...
[ "0.88123727", "0.83205825", "0.8142224", "0.7177567", "0.7158477", "0.6992907", "0.6940794", "0.69250464", "0.6844195", "0.6839999", "0.65696996", "0.6385111", "0.62820965", "0.62305856", "0.61976534", "0.6148501", "0.60797244", "0.6061159", "0.6033475", "0.60114115", "0.5987...
0.86722
1
Slice string `series` from index `start` for `length` characters and convert the resulting string into a list of ints
def _get_slice(series, start, length): return [ int(s) for s in series[start:start+length] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slices(series: str, length: int) -> List[str]:\n if length > len(series) or length <= 0:\n raise ValueError(f\"Error Length: {length}\")\n\n return [series[i:i + length] for i in range(len(series) - length + 1)]", "def slices(digits, count):\n\n last = len(digits)-count+1\n\n if count == 0...
[ "0.699702", "0.6602383", "0.6324749", "0.6079446", "0.604875", "0.5986106", "0.5644645", "0.5591515", "0.5581331", "0.5538795", "0.55022365", "0.5466425", "0.54612", "0.5392008", "0.53775644", "0.53083634", "0.529448", "0.5261992", "0.52554864", "0.523289", "0.52198005", "0...
0.7710995
0
Generate website group edges CSV.
def generate_website_group_edges(website_group_json, dst): with open(website_group_json) as f_h: with gremlin_writer(GremlinEdgeCSV, dst, attributes=[]) as writer: for data in json_lines_file(f_h): root_id = data["id"] websites = data["websites"] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeEdges(self, fileName, format):\n edges = self.edgeIndex.values()\n if format == 'simple':\n f = open(fileName,'w')\n for edge in edges:\n f.write(\"%s -- %s\\n\" % (edge.startVertex.vertexNumber, edge.endVertex.vertexNumber))\n f.close()\n ...
[ "0.5825317", "0.5617242", "0.557936", "0.5554491", "0.55313265", "0.54741925", "0.5381994", "0.5376619", "0.5346174", "0.53068507", "0.5273619", "0.5252207", "0.5225125", "0.52054346", "0.518958", "0.5181892", "0.51808137", "0.51801807", "0.51615274", "0.51400363", "0.5115309...
0.77869326
0
Given a HMM model, calculate the onetimestep updates to the posterior.
def one_step_update(model, posterior_tm1, Y_t): prediction = model.transmat_ @ posterior_tm1 likelihood = np.exp(model._compute_log_likelihood(Y_t)) posterior_t = prediction * likelihood return posterior_t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moment_update(model, model_ema, m):\n for p1, p2 in zip(model.parameters(), model_ema.parameters()):\n p2.data.mul_(m).add_(1-m, p1.detach().data)", "def moment_update(model, model_ema, m):\n for p1, p2 in zip(model.parameters(), model_ema.parameters()):\n p2.data.mul_(m).add_(1-m, p1.det...
[ "0.6641234", "0.6641234", "0.65344256", "0.5842853", "0.57025343", "0.5628273", "0.5624245", "0.55662006", "0.55565214", "0.5556335", "0.5555525", "0.55499953", "0.55407476", "0.5503146", "0.54973006", "0.5490032", "0.54801166", "0.5471939", "0.54597974", "0.5448272", "0.5395...
0.69332415
0
If field is of GeometryField than encode otherwise call parent's method
def handle_field(self, obj, field): value = field._get_val_from_obj(obj) if isinstance(field, GeometryField): self._current[field.name] = value else: super(Serializer, self).handle_field(obj, field)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, o): \n if isinstance(o, GEOSGeometry):\n dictval = json.loads(o.geojson)\n #raise Exception(o.ewkt)\n dictval['__GEOSGeometry__'] = ['__init__', [o.ewkt]] #json class hint; see http://json-rpc.org/wiki/specification\n return dictval\n else...
[ "0.6092368", "0.58623064", "0.5737154", "0.57359904", "0.5712789", "0.56236666", "0.56137514", "0.5575033", "0.55569685", "0.5485647", "0.5467278", "0.5435098", "0.53939056", "0.5381318", "0.53652793", "0.53468394", "0.534481", "0.53239167", "0.5288633", "0.5278437", "0.52280...
0.70307666
0
overload the default method to process any GEOSGeometry objects otherwise call original method
def default(self, o): if isinstance(o, GEOSGeometry): dictval = json.loads(o.geojson) #raise Exception(o.ewkt) dictval['__GEOSGeometry__'] = ['__init__', [o.ewkt]] #json class hint; see http://json-rpc.org/wiki/specification return dictval else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify(self, tolerance, preserve_topology=...): # -> BaseGeometry:\n ...", "def get_geospatial(self):\n self.unimpl_base_class()", "def get_default_geometry(self):", "def convertor(geometry, method=\"wgs2gcj\"):\n if geometry['type'] == 'Point':\n coords = geometry['coordinates...
[ "0.6038567", "0.60086095", "0.5834033", "0.58121526", "0.5745491", "0.56554115", "0.5609684", "0.55950236", "0.5489419", "0.5473454", "0.54334366", "0.5390387", "0.5352398", "0.5352128", "0.5349648", "0.53448266", "0.53440094", "0.5336835", "0.53026235", "0.5299472", "0.52732...
0.63417476
0
Convert to a string that GEOSGeometry class constructor can accept. The default decoder would pass our geo dict object to the constructor which would result in a TypeError; using the below hook we are forcing it into a ewkt format. This is accomplished with a class hint as per JSONRPC
def GEOJsonToEWKT(dict): if '__GEOSGeometry__' in dict: # using class hint catch a GEOSGeometry definition return dict['__GEOSGeometry__'][1][0] return dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(self, o): \n if isinstance(o, GEOSGeometry):\n dictval = json.loads(o.geojson)\n #raise Exception(o.ewkt)\n dictval['__GEOSGeometry__'] = ['__init__', [o.ewkt]] #json class hint; see http://json-rpc.org/wiki/specification\n return dictval\n else...
[ "0.7065414", "0.6355173", "0.59645593", "0.57913524", "0.57722545", "0.57579434", "0.5652088", "0.5635648", "0.5624472", "0.54958695", "0.5458331", "0.54087853", "0.53846693", "0.53395563", "0.52791077", "0.525524", "0.52512026", "0.5229241", "0.5206178", "0.51639766", "0.515...
0.67895186
1
The desktop type. You can call `eds_get_desktop_types` to query desktop type.
def desktop_type(self) -> pulumi.Input[str]: return pulumi.get(self, "desktop_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desktop_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"desktop_type\")", "def desktop_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"desktop_type\")", "def desktop_name(self) -> Optional[str]:\n return None", "def device_type(self) -> str:\n ...
[ "0.8786367", "0.87387115", "0.68791276", "0.66055137", "0.65639985", "0.62983614", "0.62983614", "0.627414", "0.6271547", "0.6242804", "0.6240439", "0.62114114", "0.6184054", "0.6184054", "0.61598814", "0.61366844", "0.61350536", "0.61319685", "0.6104484", "0.6085211", "0.603...
0.88508695
0
The root disk size gib.
def root_disk_size_gib(self) -> pulumi.Input[int]: return pulumi.get(self, "root_disk_size_gib")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_disk_size_gib(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"root_disk_size_gib\")", "def root_disk_size_gib(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"root_disk_size_gib\")", "def disk_size_gb(self) -> pulumi.Output[Optional[float]]:\n return pulu...
[ "0.9248658", "0.8900354", "0.79580075", "0.7942863", "0.7942863", "0.7890328", "0.77936786", "0.7761898", "0.77536315", "0.77416444", "0.7678155", "0.7634557", "0.7634557", "0.7580981", "0.73675495", "0.73544204", "0.7239178", "0.72334707", "0.71683353", "0.71169215", "0.7106...
0.91740936
1
The name of the bundle.
def bundle_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "bundle_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundle_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"bundle_name\")", "def bundle_id(self) -> str:\n return pulumi.get(self, \"bundle_id\")", "def bundle_id(self) -> str:\n return pulumi.get(self, \"bundle_id\")", "def bundle_id(self) -> pulumi.Output[str]:\...
[ "0.86618936", "0.73552686", "0.73552686", "0.714117", "0.7098918", "0.6944878", "0.69287366", "0.68272054", "0.66933715", "0.664791", "0.6634069", "0.6630414", "0.662722", "0.66147816", "0.66147816", "0.66147816", "0.6612741", "0.6596214", "0.65880525", "0.6536391", "0.653628...
0.8517897
1
Provides a ECD Bundle resource.
def __init__(__self__, resource_name: str, args: BundleArgs, opts: Optional[pulumi.ResourceOptions] = None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n bundle_name: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n desktop_type: Optional[pulumi.Input[str]] = None,\n ...
[ "0.6647277", "0.6139058", "0.58623874", "0.5751916", "0.5688191", "0.56277573", "0.560747", "0.56042796", "0.5582597", "0.5573237", "0.55176234", "0.55176234", "0.5489475", "0.54803205", "0.54769784", "0.546301", "0.54373896", "0.54065865", "0.54052466", "0.5404825", "0.54040...
0.6560403
1
Get an existing Bundle resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, bundle_name: Optional[pulumi.Input[str]] = None, description: Optional[pulumi.Input[str]] = None, desktop_type: Optional[pulumi.Input[str]] = None, im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_by_id(state_id):\n my_state = storage.get('State', state_id)\n if my_state is None:\n abort(404)\n return jsonify(my_state.to_dict())", "def get_state_by_id(state_id):\n state = storage.get(State, state_id)\n if not state:\n abort(404)\n return jsonify(state.to_dict(...
[ "0.6044276", "0.6008436", "0.59655076", "0.5911224", "0.5793162", "0.57901233", "0.57784617", "0.5725814", "0.5669625", "0.56525624", "0.5647222", "0.5586973", "0.55866736", "0.55588764", "0.55441326", "0.54835856", "0.54622126", "0.5458629", "0.54441386", "0.53769153", "0.53...
0.66141945
0
The name of the bundle.
def bundle_name(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "bundle_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundle_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"bundle_name\")", "def bundle_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"bundle_name\")", "def bundle_id(self) -> str:\n return pulumi.get(self, \"bundle_id\")", "def bundle_id(se...
[ "0.8517897", "0.8517897", "0.73552686", "0.73552686", "0.714117", "0.7098918", "0.6944878", "0.69287366", "0.68272054", "0.66933715", "0.664791", "0.6634069", "0.6630414", "0.662722", "0.66147816", "0.66147816", "0.66147816", "0.6612741", "0.6596214", "0.65880525", "0.6536391...
0.86618936
0
The desktop type. You can call `eds_get_desktop_types` to query desktop type.
def desktop_type(self) -> pulumi.Output[str]: return pulumi.get(self, "desktop_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desktop_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"desktop_type\")", "def desktop_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"desktop_type\")", "def desktop_name(self) -> Optional[str]:\n return None", "def device_type(self) -> str:\n i...
[ "0.88508695", "0.87387115", "0.68791276", "0.66055137", "0.65639985", "0.62983614", "0.62983614", "0.627414", "0.6271547", "0.6242804", "0.6240439", "0.62114114", "0.6184054", "0.6184054", "0.61598814", "0.61366844", "0.61350536", "0.61319685", "0.6104484", "0.6085211", "0.60...
0.8786367
1
The ID of the image.
def image_id(self) -> pulumi.Output[str]: return pulumi.get(self, "image_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_id(self):\n return self._image_id", "def image_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"image_id\")", "def image_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"image_id\")", "def __get_image_id(self):\n return self.__get_multi_images_ids(1)"...
[ "0.8816168", "0.84175587", "0.84175587", "0.83684385", "0.82905245", "0.8163188", "0.8163188", "0.7813689", "0.7636593", "0.7486018", "0.74152106", "0.7291737", "0.72484857", "0.7207797", "0.71587074", "0.7150392", "0.71293414", "0.70939773", "0.7091085", "0.70805043", "0.707...
0.85654783
1
The root disk size gib.
def root_disk_size_gib(self) -> pulumi.Output[int]: return pulumi.get(self, "root_disk_size_gib")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_disk_size_gib(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"root_disk_size_gib\")", "def root_disk_size_gib(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"root_disk_size_gib\")", "def disk_size_gb(self) -> pulumi.Output[Optional[float]]:\n return pulum...
[ "0.91740936", "0.8900354", "0.79580075", "0.7942863", "0.7942863", "0.7890328", "0.77936786", "0.7761898", "0.77536315", "0.77416444", "0.7678155", "0.7634557", "0.7634557", "0.7580981", "0.73675495", "0.73544204", "0.7239178", "0.72334707", "0.71683353", "0.71169215", "0.710...
0.9248658
0
Testing the conversion of rsr from wavelength to wavenumber
def test_convert2wavenumber(self): newrsr, info = utils.convert2wavenumber(TEST_RSR) unit = info['unit'] self.assertEqual(unit, 'cm-1') self.assertTrue(newrsr['20']['det-1'].has_key('wavenumber')) self.assertFalse(newrsr['20']['det-1'].has_key('wavelength')) wvn_res = RE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wavelength_to_wavenumber(wavelength):\n return 1. / wavelength", "def test_wk2yr(self):\n result = round(TimeUnit(34, 'wk', 'yr').doconvert(), 2)\n self.assertEqual(result, round(0.652055, 2))", "def calculate_1rm_brzycki(w: float, r: int):\n\n if r == 0:\n return 0\n\n if w =...
[ "0.6189273", "0.5634813", "0.5630745", "0.5557721", "0.5557721", "0.5554414", "0.5544192", "0.554243", "0.5521899", "0.5503673", "0.5499144", "0.5481467", "0.54787725", "0.5475458", "0.5467655", "0.54647005", "0.54603744", "0.54594994", "0.54490954", "0.5412325", "0.5409588",...
0.7865288
0
Perform the request via PhantomJS.
def phantomjs_get(url): from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.userAgent"] = config.USER_AGENT dcap["phantomjs.page.settings.loadImages"] = False drive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.driver = webdriver.PhantomJS()\n self.driver.get(self.get_server_url())", "def do_get(self, url):\n self.driver.get(url)", "def start_phantomjs(self):\n driver = webdriver.PhantomJS()\n return(driver)", "def call(self):\n\n self.url = self...
[ "0.65761065", "0.6351941", "0.63481647", "0.59856844", "0.59129536", "0.5856444", "0.5794455", "0.57042354", "0.5664509", "0.55692554", "0.5561167", "0.5527076", "0.5525101", "0.55229294", "0.55212134", "0.55170685", "0.5462537", "0.54617757", "0.54610646", "0.5457927", "0.54...
0.650528
1
Will block access if the resource points to a draft blog post, and the user is different from the author. Any other variation is just passed on to be handled by regular permission checks.
def check_permission(self, action, username, resource, perm): if not resource: return if resource.realm == 'blog' and resource.id: the_post = BlogPost(self.env, resource.id, resource.version) for category in the_post.category_list: if category in self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_owner_authenticated_user_read_given_blogpost(self):\r\n\r\n with self.flask_app.test_request_context('/'):\r\n app = AppFactory.create()\r\n user = UserFactory.create()\r\n blogpost = BlogpostFactory.create(app=app)\r\n\r\n assert self.mock_authentica...
[ "0.6910113", "0.667111", "0.661465", "0.65971345", "0.65062755", "0.641898", "0.641898", "0.641898", "0.6400173", "0.6387623", "0.63546264", "0.6342159", "0.63315797", "0.6272541", "0.6268477", "0.6256566", "0.622883", "0.62074184", "0.6192771", "0.6173709", "0.6173709", "0...
0.7453113
0
If the post is a draft, just do some rudimentary checking to make sure the author does not shoot him/herself in the foot.
def validate_blog_post(self, req, postname, version, fields): for category in _parse_categories(fields['categories']): if category in self.draft: if req.authname == 'anonymous': return [(None, 'You need to be logged in to save as draft.')] elif req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isDraft(self): #$NON-NLS-1$\r", "def test_home_view_with_a_draft_post(self):\n category = create_category('Category 1')\n author = create_author('Author 1')\n create_post(category=category, author=author, name='Draft Post', content='Lorem ipsum dolor sit amet, consectetur adipiscing elit...
[ "0.65785074", "0.6397195", "0.63286626", "0.62827975", "0.6240328", "0.60869026", "0.60302997", "0.5999535", "0.5980869", "0.5980869", "0.5980869", "0.5914506", "0.5834592", "0.5820645", "0.5819241", "0.5819241", "0.57507384", "0.5684251", "0.5664793", "0.5656092", "0.5635812...
0.6586996
0
Write a string to the temp file.
def write_string(s): time.sleep(0.2) with open(str(tmp_file), "w") as f: f.write(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_file(self, string):\n with open(self.p.base_dir + '/' + self.p.filename, 'w') as f:\n f.write(string)", "def write(self, string):\n self.__file.write(string)", "def write_file(name_file, string):\n with open(name_file, 'w') as file:\n file.write(string)", "def...
[ "0.7564076", "0.74288267", "0.73325247", "0.70655453", "0.70291775", "0.6984853", "0.6932403", "0.6910737", "0.68788034", "0.68242836", "0.67888033", "0.6777633", "0.6777468", "0.6729787", "0.6676116", "0.66373664", "0.6525719", "0.6495248", "0.63843197", "0.6327576", "0.6311...
0.8023115
0
Test that shell command works when the command is known to work.
def test_shell_good_command(): out, err = shell_command("ls .") assert err is None assert "test" in out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shell_bad_command():\n out, err = shell_command(\"ls adasdasdas\")\n assert out is None\n assert \"adasdasdas\" in err", "def test_process_host_commands(self):\n\n command = [\"df\", \"-h\"]\n output = run(verification.process_host_commands(command))\n self.assertTrue(\"```...
[ "0.8150244", "0.74268186", "0.7383249", "0.7294423", "0.701333", "0.6992854", "0.69897044", "0.6959436", "0.6927863", "0.6918448", "0.69177306", "0.6879265", "0.6870562", "0.6854691", "0.68386334", "0.6801076", "0.6761413", "0.67489773", "0.67297786", "0.6681002", "0.6648594"...
0.86112136
0
Test that shell command works when the command is known to work.
def test_shell_bad_command(): out, err = shell_command("ls adasdasdas") assert out is None assert "adasdasdas" in err
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shell_good_command():\n out, err = shell_command(\"ls .\")\n assert err is None\n assert \"test\" in out", "def test_process_host_commands(self):\n\n command = [\"df\", \"-h\"]\n output = run(verification.process_host_commands(command))\n self.assertTrue(\"```\\nThat comman...
[ "0.86112136", "0.74268186", "0.7383249", "0.7294423", "0.701333", "0.6992854", "0.69897044", "0.6959436", "0.6927863", "0.6918448", "0.69177306", "0.6879265", "0.6870562", "0.6854691", "0.68386334", "0.6801076", "0.6761413", "0.67489773", "0.67297786", "0.6681002", "0.6648594...
0.8150244
1
This function will run the command for number_to_run number of times. For each run, it will capture the run time for the unit test and will move on to the next test if it takes too long to run this one.
def run_commands(command, number_to_run, temp_file): global g_max_runtime_secs global g_finished_this_unit_test temp_string = command.split() testname = temp_string[-1] temp_string = testname.split('/') full_command = command + ' > ' + temp_file g_finished_this_unit_test = False for r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test(_freq, cmd):\n for count in range(_freq):\n os.system(cmd.replace(\"result\", \"result\" + str(count + 1)))", "def main(argv):\n global g_test_root_dir\n global g_temp_filename\n\n if len(argv) < 2:\n print(\"invoke this script as python collectUnitTestRunTime.py 10 'python...
[ "0.6575637", "0.6521473", "0.64306206", "0.6430121", "0.64166987", "0.63451195", "0.61504436", "0.6135496", "0.6086589", "0.6084007", "0.60143", "0.6000346", "0.59813243", "0.59571207", "0.58898485", "0.5881376", "0.58780885", "0.5875602", "0.5844247", "0.5824281", "0.5815500...
0.7836011
0
Main program. Take user input, parse it and call other functions to execute the commands and find long running unit tests, store the dataset and parameter settings and move onto the next unit tests if applicable.
def main(argv): global g_test_root_dir global g_temp_filename if len(argv) < 2: print("invoke this script as python collectUnitTestRunTime.py 10 'python run.py_path/run.py --wipe " "--test dir_to_test/test1,python run.py_path/run.py --wipe --test dir_to_test2/test2,...' True\n") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if self.verbose:\n print(f'Running {self.name} tests...')\n\n # try running setup if there is one\n if self.setup:\n self.__process_setup()\n\n final_report = [None] * len(self.tests)\n\n for test_in, test_out in sorted(self.tests.items()):\...
[ "0.7044788", "0.7024273", "0.70204896", "0.700891", "0.69523466", "0.69330347", "0.6905141", "0.68196094", "0.67372173", "0.67198765", "0.6711246", "0.67071337", "0.6679333", "0.6668226", "0.6664324", "0.66402525", "0.6635689", "0.6629262", "0.66186917", "0.66109586", "0.6596...
0.74495375
0
Crypt key property getter.
def crypt_key(self): return self._crypt_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(self):\r\n return self.__encryption_key", "def _GetKeyString(self):\n return self.__key_string", "def __GetKeyString(self):\n return self._GetKeyString()", "def _GetKeyString(self):\n return self.__key_string", "def __GetKeyString(self):\n return self._GetKeyString()"...
[ "0.770979", "0.73459613", "0.72082657", "0.7200954", "0.7153404", "0.70125467", "0.70125467", "0.696998", "0.696998", "0.68880767", "0.6879895", "0.68580955", "0.68320686", "0.6807505", "0.6768181", "0.67640454", "0.6733351", "0.6709191", "0.6709191", "0.67053545", "0.6701271...
0.7816463
0
Prunes dataframe to rows whose longitudes are multiples of 60 degrees and whose years are multiples of 10. This includes only lat/lon grid locations for which we have USNO data for all eight types of twilight events.
def get_grid_data(df): bools = (df['Longitude'] % 60 == 0) & (df['Year'] % 10 == 0) return df[bools]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_tracks_domain(df, minlon=90, maxlon=180, minlat=-40, maxlat=0):\n\n domain = sbox(minlon, minlat, maxlon, maxlat, ccw=False)\n tracks = df.groupby('num')\n tempfilter = tracks.filter(lambda x: len(x) > 1)\n filterdf = tempfilter.groupby('num').filter(\n lambda x: LineString(zip(x['lon...
[ "0.6048604", "0.5930983", "0.5897412", "0.5653762", "0.5554248", "0.54679614", "0.543293", "0.5403124", "0.5379485", "0.5308922", "0.5299097", "0.5277261", "0.5236994", "0.51776224", "0.515241", "0.5146878", "0.5102294", "0.50780743", "0.50694305", "0.50475067", "0.50459665",...
0.7148291
0
Get descriptor version from index.
def descriptorVersion(self) -> int: return self._coreIndex.getDescriptorVersion()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\r\n\r\n return self.versions[0].number", "def get_version(self):\n return self.cur_config['version']['name']", "def get_index(self):\n\t\treturn call_sdk_function('PrlVmDev_GetIndex', self.handle)", "def __getitem__(self, index: int) -> FaceDescriptor:\n _coreDescr...
[ "0.62470573", "0.6164937", "0.6150249", "0.61311305", "0.61171246", "0.61062837", "0.60857606", "0.6019658", "0.5965834", "0.595268", "0.5926031", "0.588588", "0.5883278", "0.587447", "0.5865104", "0.58440655", "0.5817548", "0.5810021", "0.57959163", "0.5795582", "0.57735914"...
0.77219415
0
Get descriptor by index from internal storage.
def __getitem__(self, index: int) -> FaceDescriptor: _coreDescriptor = self._faceEngine.createDescriptor(self._coreIndex.getDescriptorVersion()) error, descriptor = self._coreIndex.descriptorByIndex(index, _coreDescriptor) assertError(error) return FaceDescriptor(descriptor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_at_index(self, index: int) -> object:\n return self.data[index]", "def get(self, index):\n raise NotImplementedError() # pragma: no cover", "def get_by_index(self, index):\n # makes it easier for callers to just pass in a header value\n index = int(index) if index else 0\n ...
[ "0.67557156", "0.6576555", "0.6531874", "0.65297633", "0.64009917", "0.6336537", "0.63330805", "0.6243469", "0.6238573", "0.6216206", "0.61165506", "0.61148983", "0.611092", "0.610756", "0.6094632", "0.6077617", "0.60752577", "0.6068823", "0.6039814", "0.6013402", "0.60041183...
0.70444727
0
Returns a chunk of guess dataset corresponding to the same pixels of the main dataset.
def _read_guess_chunk(self): curr_pixels = self._get_pixels_in_current_batch() self._guess = self._h5_guess[curr_pixels, :] if self.verbose and self.mpi_rank == 0: print('Guess of shape: {}'.format(self._guess.shape))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_guess_chunk(self):\n if self._start_pos < self.max_pos:\n self._current_sho_spec_slice = slice(self.sho_spec_inds_per_forc * self._current_forc,\n self.sho_spec_inds_per_forc * (self._current_forc + 1))\n self._end_pos = int(min(...
[ "0.6148216", "0.5663909", "0.5594921", "0.53717375", "0.5326499", "0.5301302", "0.5206093", "0.51859504", "0.51695466", "0.51634556", "0.512264", "0.511285", "0.50646293", "0.5054581", "0.50458497", "0.50453305", "0.503205", "0.5013712", "0.50062114", "0.50025904", "0.4998994...
0.6047562
1
Writes the guess or fit results into appropriate HDF5 datasets.
def _write_results_chunk(self): if self._is_guess: targ_dset = self._h5_guess source_dset = self._guess else: targ_dset = self._h5_fit source_dset = self._fit curr_pixels = self._get_pixels_in_current_batch() if self.verbose and self.mpi_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def _create_guess_datasets(self):\n self.h5_guess = create_empty_dataset(self.h5_loop_metrics, loop_fit32, 'Guess')\n write_simple_attrs(self._h5_group, {'guess method': 'pycroscopy statistical'})\n\n # This is necessary comparing against new runs to avoi...
[ "0.69929975", "0.69636846", "0.6793143", "0.6706263", "0.6678321", "0.6622494", "0.661845", "0.6577388", "0.65469503", "0.64344764", "0.6309686", "0.62802446", "0.6271253", "0.626097", "0.62531996", "0.62441474", "0.62441474", "0.6225183", "0.6224221", "0.6205013", "0.6176995...
0.70214975
0
Model specific call that will create the (empty) fit dataset, and link the fit dataset to the spectroscopic datasets.
def _create_fit_datasets(self): raise NotImplementedError('Please override the _create_fit_datasets ' 'specific to your model')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_fit_datasets(self):\n\n if self.h5_guess is None:\n warn('Need to guess before fitting!')\n return\n\n self.h5_fit = create_empty_dataset(self.h5_guess, loop_fit32, 'Fit')\n write_simple_attrs(self._h5_group, {'fit method': 'pycroscopy functional'})\n\n ...
[ "0.7104951", "0.7070305", "0.65044504", "0.64612836", "0.6461269", "0.64220417", "0.63549966", "0.6304513", "0.6270343", "0.6267603", "0.6158856", "0.61479485", "0.61465675", "0.61364293", "0.6110159", "0.61055976", "0.6104337", "0.61033475", "0.608298", "0.60610783", "0.6040...
0.7163324
0
Gets existing Guess, Fit, status datasets, from the HDF5 group. All other domainspecific datasets should be loaded in the classes that extend this class
def _get_existing_datasets(self): self._h5_guess = USIDataset(self.h5_results_grp['Guess']) try: self._h5_status_dset = self.h5_results_grp[self._status_dset_name] except KeyError: warn('status dataset not created yet') self._h5_status_dset = None tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_datasets(self):\n datasets = list()\n for fname in sorted(os.listdir(self.base_dir)):\n if not self._filename_re.match(fname):\n continue\n\n file_path = os.path.join(self.base_dir, fname)\n try:\n fh = self._open_hdf5(file_...
[ "0.6769013", "0.6504869", "0.62971133", "0.62946093", "0.62839943", "0.6193727", "0.6161359", "0.6161155", "0.6072767", "0.6044694", "0.60155284", "0.5996884", "0.59594387", "0.5885074", "0.5856235", "0.57856464", "0.57595074", "0.57548445", "0.57152677", "0.5700575", "0.5699...
0.7772891
0
Function to compute ZCA whitening matrix (aka Mahalanobis whitening).
def zca_whitening_matrix(X): # Covariance matrix [column-wise variables]: Sigma = (X-mu)' * (X-mu) / N sigma = np.cov(X, rowvar=True) # [M x M] # Singular Value Decomposition. X = U * np.diag(S) * V U,S,V = np.linalg.svd(sigma) # U: [M x M] eigenvectors of sigma. # S: [M x 1] eigenvalues...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _whiten_embeddings_zca(self, xs, lambd = 1e-8):\n print('ZCA-Whitening')\n Cov_s = np.cov(xs.T)\n d = Cov_s.shape[0]\n\n W_s = scipy.linalg.sqrtm(Cov_s + lambd*np.eye(d))\n xs = xs@W_s#.T\n return xs", "def _whiten_embeddings_zca(self, lambd = 1e-8):\n print(...
[ "0.7298965", "0.72373927", "0.7098", "0.69169414", "0.674374", "0.66822344", "0.6380025", "0.62321043", "0.61145115", "0.59687454", "0.59334385", "0.591302", "0.57762146", "0.5614465", "0.5599952", "0.5513964", "0.5494949", "0.5427968", "0.5414677", "0.5395066", "0.5314387", ...
0.7799107
0
Test that the build will fail when the "MATLAB_RELEASE" argument is different from the one contained in VersionInfo.xml ("latest")
def test_mismatching_releases_raises_error(self): # The failure message that we expect to see expected_fail_regex = ( f"Provided release (.*) does not match release found in VersionInfo.xml" ) with self.assertRaisesRegex( docker.errors.BuildError, ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mismatching_releases_displays_err_msg(self):\n\n # The failure message that we expect to see\n expected_fail_msg = (\n f\"Provided release ({self.old_matlab_release}) does not match \"\n \"release found in VersionInfo.xml\"\n )\n\n build_msg = utils.get_bu...
[ "0.7061311", "0.6778055", "0.65040183", "0.6406685", "0.6374489", "0.6338314", "0.6337696", "0.6325358", "0.6279139", "0.6252388", "0.6159534", "0.61333746", "0.6117964", "0.609705", "0.60959524", "0.6092544", "0.6088889", "0.6075766", "0.60548264", "0.6053249", "0.60388136",...
0.7735341
0
Test that the error message is displayed when the "MATLAB_RELEASE" argument is different from the one contained in VersionInfo.xml ("latest")
def test_mismatching_releases_displays_err_msg(self): # The failure message that we expect to see expected_fail_msg = ( f"Provided release ({self.old_matlab_release}) does not match " "release found in VersionInfo.xml" ) build_msg = utils.get_build_output( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mismatching_releases_raises_error(self):\n\n # The failure message that we expect to see\n expected_fail_regex = (\n f\"Provided release (.*) does not match release found in VersionInfo.xml\"\n )\n\n with self.assertRaisesRegex(\n docker.errors.BuildError,...
[ "0.7205926", "0.6710082", "0.6615529", "0.64460653", "0.6420502", "0.64166665", "0.64018804", "0.6322818", "0.6317216", "0.625823", "0.6214125", "0.6150578", "0.6125207", "0.60518926", "0.604974", "0.60494673", "0.60443074", "0.60435677", "0.60417646", "0.6041761", "0.6023344...
0.7735132
0
Test that the failure message is displayed if a failure occurs during the installation of matlab
def test_install_error_message(self): fail_msg = "Failure message" fail_file = Path(self.dockerfile_dirpath) / "matlab-install" / "FAIL" with open(str(fail_file), "w") as ff: ff.write(fail_msg + "\n") self.addCleanup(utils.remove_file, fail_file) build_msg = utils...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_installation(self):\n self.installer._pretty_print = Mock()\n self.installer._run_command = Mock()\n stdout = Mock()\n stderr = Mock()\n self.installer._run_command.return_value = (stdout, stderr)\n stderr.read().splitlines.return_value = []\n self.a...
[ "0.68971574", "0.68589246", "0.64004433", "0.6262197", "0.6260561", "0.6079343", "0.602237", "0.5998593", "0.599344", "0.59405375", "0.59382325", "0.59276253", "0.5877427", "0.587091", "0.5852264", "0.58366877", "0.58251274", "0.582421", "0.57860076", "0.57816166", "0.5777218...
0.7641776
0
Takes cooler, a set of regions (chromosomes, chromosomal arms, regions) For each region, it fetches a sparse cooler matrix. Returns (as a generator) a list of (matrix, bins) pairs
def fetchCooler(c, regions, coolerFetch = lambda coo, ext:coo.matrix(balance=True, sparse=True).fetch(ext), mask=True, force=False, ): regions = [list(i) for i in regions] resolution = c.binsize for i in regions: if i[1] == None: i[1] = 0 if i[2] == None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_map(nrows, ncols, nrooms, max_col_size, max_row_size):\n arr = np.zeros((nrows, ncols), dtype=np.int8)\n\n for i in range(nrooms):\n rand_row_start = np.random.randint(nrows)\n rand_col_start = np.random.randint(ncols)\n\n rand_row_size = np.random.randint(max_row_size / 2, ...
[ "0.6095622", "0.5488364", "0.54629165", "0.5376488", "0.5363729", "0.52927715", "0.52869534", "0.5282201", "0.5278", "0.5261104", "0.52289116", "0.5223765", "0.52106524", "0.5200011", "0.518992", "0.51824594", "0.518002", "0.5161271", "0.5128736", "0.51250774", "0.51108515", ...
0.7412908
0
Takes cooler, a set of regions (chromosomes, chromosomal arms, regions), and a dataframe. For each region, it converts (chr1, pos1) columns of the dataframe (specified in the "columns" argument) to a column named "ind1", which is an index of this position
def chunkDataFrame(c, regions, positionDataFrame, columns=[("chrom1","pos1"), ("chrom2","pos2")], force=False, ): originalRegions = [tuple(i) for i in regions] regions = [list(i) for i in regions] resolution = c.binsize positionDataFrame = positionDataFrame.copy() for i in regio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geocode(df, col):\r\n pass", "def bin_electrodes_by_region(self, elec_column1='stein.region', elec_column2='ind.region',\n x_coord_column='ind.x', roi_dict=None):\n if self.elec_info is None:\n print('{}: please load data before trying to bin electrode loc...
[ "0.60151386", "0.5834247", "0.57282376", "0.5675862", "0.56448144", "0.56053734", "0.5441846", "0.54264975", "0.5393006", "0.5374605", "0.5335748", "0.52952147", "0.52914923", "0.5289396", "0.52858377", "0.52417886", "0.52283543", "0.5179012", "0.51709", "0.5138947", "0.51387...
0.66535616
0
A function to check for correct field types between the from and to fields.
def checkField(fromFieldType, toFieldType, delimiter): if fromFieldType == "String": if not toFieldType == "String": arcpy.AddError("Copy To Field must be of type text when Read From Field is of type text.") else: if not toFieldType == "String": if delimiter != "": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_desti_field_chk(base_field, base_field_type, field_name):\n kwargs = {}\n if base_field != '':\n if base_field_type == '1':\n kwargs[field_name + '__exact'] = base_field\n if base_field_type == '2':\n kwargs[field_name + '__startswith'] = base_field\n if ...
[ "0.60380894", "0.60211766", "0.5991003", "0.5971663", "0.59447753", "0.5879657", "0.58585453", "0.5791437", "0.5766009", "0.57439035", "0.5743668", "0.57058144", "0.5589982", "0.5586574", "0.5582527", "0.5561692", "0.5555909", "0.55478966", "0.5512225", "0.54971504", "0.54956...
0.7540543
0
Plot a finite element mesh as a wireframe using edges connectivity.
def plot_wireframe(ax, cmesh, color='k', show=False): coors = cmesh.coors dim = cmesh.dim edges = cmesh.get_conn(1, 0) ax = _get_axes(ax, dim) for edge_vertices in edges.indices.reshape((edges.num, 2)): cc = coors[edge_vertices] if dim == 3: ax.plot(cc[:, 0], cc[:, 1],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fenics_mesh(mesh, new_fig=True):\n if(new_fig):\n plt.figure()\n\n plot(mesh)\n #plt.title(\"FEniCS mesh\")\n plt.show(block=False)\n\n pass", "def test_plot_mesh(self):\n plt.close('all')\n\n #\n # Initialize\n #\n fig, ax = plt.subplots(3,3)\n ...
[ "0.6795343", "0.66574126", "0.66412956", "0.64610934", "0.6281666", "0.61296725", "0.60942197", "0.6073105", "0.60276896", "0.5883175", "0.58822703", "0.5879725", "0.5844625", "0.5747496", "0.5702003", "0.565129", "0.5606482", "0.5584321", "0.5578948", "0.557612", "0.55558884...
0.70331657
0
Label mesh topology entities using celllocal ids.
def label_local_entities(ax, cmesh, edim, color='b', fontsize=10, show=False): coors = cmesh.get_centroids(edim) dim = cmesh.dim centres = cmesh.get_centroids(dim) conn = cmesh.get_conn(dim, edim) off = conn.offsets ax = _get_axes(ax, dim) eps = 0.1 oeps = 1.0 - eps for ii in xran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_localizations_labels(depc, loc_id_list, config=None):\n from os.path import exists, join\n\n logger.info('[ibs] Process Localization Labels')\n logger.info('config = {!r}'.format(config))\n # Get controller\n ibs = depc.controller\n\n if config['labeler_algo'] in ['pipeline', 'cnn']:\...
[ "0.5615183", "0.56146234", "0.5562032", "0.5527917", "0.55126536", "0.54222244", "0.5398315", "0.53490674", "0.5333232", "0.52936053", "0.52397186", "0.5204311", "0.5195951", "0.518437", "0.51465446", "0.51452196", "0.51276094", "0.50848764", "0.50652826", "0.50405645", "0.50...
0.6390221
0
Run a worker, call the worker's train_prcess() method.
def run(self, worker, evaluator=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_worker(self):\n # TODO(xiejw): To allow execution framework to add train hooks.\n return self._start_distributed_training()", "def worker(self, gpu_id: int):\n if self.seed is not None:\n make_deterministic(self.seed)\n self.current_rank = self.rank\n if self.distrib...
[ "0.81170535", "0.6662402", "0.6560574", "0.6424407", "0.64064884", "0.62709504", "0.6250227", "0.6231598", "0.6201631", "0.61577517", "0.6096804", "0.6034648", "0.5959863", "0.5958695", "0.5943286", "0.59378487", "0.5897218", "0.5874826", "0.587004", "0.58641726", "0.58599484...
0.66718954
1
function to generate the error profile based on true labels and predicted labels for a classification problem
def error_profile(y_true: Dict[str, List[np.ndarray]], y_pred: Dict[str, List[np.ndarray]], model_type: str) -> None: num_folds = len(y_pred["train"]) acc = {"train": [], "test": []} test_predictions = np.array([]) test_labels = np.array([]) for k in range(num_folds): y_train_true ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_errors(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (1.0 - num_correct / preds.size(0)) * 100.0", "def predict_labels(model):\n test_datagen = ImageDataGenerator(featurewise_center=True,\n featurewise_std_normalization=True\n ...
[ "0.69387436", "0.6698274", "0.65620875", "0.6545873", "0.64661515", "0.64296305", "0.64051944", "0.64016044", "0.64016044", "0.6384025", "0.6381803", "0.6358461", "0.63415956", "0.63344145", "0.6308464", "0.6304838", "0.6284326", "0.6279838", "0.6240312", "0.6237167", "0.6231...
0.7280616
0
clip(arr,thresh=3.5) Simple sigmaclipping algorithm. Returns avg,std of clipped array.
def clip(arr,thresh=3.5): a = arr.copy() avg,std = a.mean(),a.std() while 1: size = a.size a = a[abs(a-avg)<thresh*std] avg,std = a.mean(),a.std() if size==a.size: break return avg,std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip(arr,thresh=3.5):\n a = numpy.array(arr)\n\n avg,std = a.mean(),a.std()\n while 1:\n avg,std,size = a.mean(),a.std(),a.size\n a = a[abs(a-avg)<thresh*std]\n if size==a.size:\n break\n return avg,std", "def sigma_clip(arr,sigma=3):\n\n cliparr = range(len(arr...
[ "0.87744415", "0.74298495", "0.7050653", "0.70448977", "0.64035314", "0.6359961", "0.6326048", "0.6302444", "0.6283845", "0.61879015", "0.6141052", "0.6097245", "0.6068267", "0.60678166", "0.60551995", "0.6035484", "0.60212284", "0.6006312", "0.5957043", "0.5899439", "0.58193...
0.888268
0
id_slits(flat_data,small) Identifies slits and starboxes. There are issues with correctly classifying short edge slits (which mimic star boxes) and dealing with slits that have substantial dips.
def id_slits(flat_data,findstars=True): y_axis = flat_data.shape[0] data = flat_data.mean(axis=1) d = data.copy() """ The slits tend to be demarcated by when the sorted data begins to grow at an accelerating rate; the first derivative tends to be an acceptable proxy, though. The edges are masked for bad p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_slits(arc,find_stars=True,chilimit=2.5,SATURATED=57000.,useLines=True):\n\n arc = arc.copy()\n \"\"\" Attempt to avoid saturated lines \"\"\"\n w = arc.shape[1]\n tmp = arc.copy()\n tmp[tmp>SATURATED] = 0.\n tmpSorted = scipy.sort(tmp,axis=1)\n flux = tmpSorted[:,w*0.97:w*0.98].mean(axi...
[ "0.5802957", "0.5298557", "0.5084957", "0.5063652", "0.4890329", "0.48611894", "0.48507932", "0.48137918", "0.4810392", "0.47764036", "0.47670275", "0.47526032", "0.47370464", "0.47212443", "0.47186974", "0.47151244", "0.47017494", "0.4694448", "0.4681186", "0.46714354", "0.4...
0.73491573
0
Called when new line received from connection
def _on_read(self, line): # Some game logic (or magic) line = line.strip() logger.info("RCV> %s", line) if not line: self.stream.close() return self.stream.write("echo: %s\n" % line) # Wait for further input on this connection self.wait()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineReceived(self,line):\n print \"data received:\",line,self.delimiter", "def lineReceived(self, line):\n pass", "def newLineEvent(self, line):\n self.newLine_callback(line)", "def _on_connect(self, stream_reader, stream_writer):\n # Sometimes the remote side doesn't send the...
[ "0.7500021", "0.7399633", "0.7342613", "0.7329971", "0.7170145", "0.70820045", "0.70148516", "0.6992787", "0.6955204", "0.6838713", "0.68079877", "0.6682475", "0.6677752", "0.6536084", "0.64785165", "0.64569104", "0.6385242", "0.63659185", "0.63574743", "0.62926215", "0.62211...
0.7630632
0
Fit the model to data matrix X and targets Y.
def fit(self, X, Y): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X, y):\n self.model_x = X\n self.model_y = y", "def fit ( self, X: np.ndarray, y: np.ndarray ):\n \n self.X = X\n self.y = y", "def fit(self, X, y):\n self.X_train = X\n self.y_train = y", "def fit(self, X, y):\n self.X_data = X\n s...
[ "0.76865864", "0.7495343", "0.74461746", "0.7412673", "0.7352247", "0.7292747", "0.7271479", "0.7256889", "0.7256889", "0.7241033", "0.72407746", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.72048783", "0.7...
0.75660306
1
Evaluate the decision_function of the models in the chain.
def decision_function(self, X): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, prediction_fn):\n pass", "def decision_function(self, X):\n return self.predict(X, output=\"score\")", "def decision_function(self, Xtt):\n # predict decision score on test dataset\n self.logger.info(\n self.__name__ + ' predicts decision scores on {:d}...
[ "0.6772991", "0.62682056", "0.62380344", "0.6168039", "0.61620486", "0.6074819", "0.5991949", "0.5981098", "0.5978402", "0.59382457", "0.59114414", "0.59068817", "0.5877776", "0.58687377", "0.58312726", "0.5826906", "0.5823408", "0.5768491", "0.5758743", "0.57502604", "0.5746...
0.6659339
1
return the number of flat features from a pytorch variable
def num_flat_features(self, x): return int(np.prod(x.size()[1:]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_flat_features(self, x):\n size = x.size()[1:] # all dimensions except the batch dimension\n num_features = 1\n for s in size:\n num_features *= s\n return num_features", "def num_flat_features(x):\n\n size = x.size()[1:] # All dimensions except batch dimens...
[ "0.7284407", "0.7197461", "0.71856856", "0.7124822", "0.69571304", "0.6939893", "0.6765308", "0.6756191", "0.6736225", "0.65332246", "0.6499784", "0.6494851", "0.64596397", "0.64460313", "0.64324874", "0.63832456", "0.6366171", "0.63653505", "0.6354612", "0.63422126", "0.6318...
0.7314911
0
Process text using one or more providors registered with MLRegistry
def process_text(text, providers, logging_enabled=False): registry = MLRegistry() if not registry.validate_providers(providers): raise ValueError( "One or more providers are not valid {}".format(providers) ) data = [] for provider in providers: current_provider = regi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_text(self, text, language):", "def apply(self, text):", "def _process(hass, text):\n intents = hass.data.get(DOMAIN, {})\n\n for intent_type, matchers in intents.items():\n for matcher in matchers:\n match = matcher.match(text)\n\n if not match:\n c...
[ "0.6415086", "0.5930939", "0.5904197", "0.5764646", "0.57569325", "0.5670612", "0.5665805", "0.5619918", "0.561568", "0.56010884", "0.55854166", "0.5555991", "0.5553827", "0.55413115", "0.5493264", "0.5479778", "0.5477325", "0.5474064", "0.5462044", "0.5457138", "0.5439645", ...
0.67856145
0
Configures the session to execute this target. This should only modify session.config, but gets access to the entire session to retrieve information about it.
def configure(self, session): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self, conf):\n return", "def configure(self, config: dict):\n self.config.update(config)", "def do_config(self, args):\n self.config_command.cmdloop(\"Enter to config mode\")", "def configure(self, config: ConfigParams):\n self.__mode = config.get_as_string_with_defa...
[ "0.60705197", "0.5951739", "0.59411156", "0.58812964", "0.58621", "0.5860319", "0.5845918", "0.5825204", "0.5825204", "0.5813379", "0.58120495", "0.57986385", "0.579658", "0.57687813", "0.5756923", "0.57400143", "0.5701752", "0.5701752", "0.56825835", "0.56699854", "0.5618635...
0.7415877
0
co_filename of code objects created at runtime from the source that this Target describes, assuming no path mapping.
def co_filename(self): assert ( self.filename is not None ), "co_filename requires Target created from filename" return self.filename.strpath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source(self):\n return some.dap.source(py.path.local(self.co_filename))", "def inferTargetName(self):\n target_name = None\n\n for filename in self.files:\n if DUMMY_CPP_FILE_NAME in filename:\n continue\n\n if \"/\" in filename or \"$\" in filename:\n return\n\n nam...
[ "0.6200904", "0.6148831", "0.60650134", "0.6062886", "0.6043761", "0.6038777", "0.5963403", "0.5944892", "0.592063", "0.59055865", "0.5901258", "0.58915967", "0.58757555", "0.5857606", "0.5812992", "0.57950807", "0.57573414", "0.57501376", "0.57398427", "0.57251495", "0.56827...
0.74443585
0
Same as self.filename.lines, if it is valid e.g. for objects.
def lines(self): assert ( self.filename is not None ), "lines() requires Target created from filename" return self.filename.lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __read_lines__(self):\r\n fd = open(self.input_file, \"r\")\r\n lines = fd.readlines()\r\n fd.close()\r\n return lines", "def _get_file_lines(self):\n\n # check if the PO/POT file is readable\n if self.__name is None or not os.access(self.__name, os.R_OK):\n ...
[ "0.6747216", "0.6679091", "0.66733927", "0.6654729", "0.6469234", "0.6444568", "0.6334337", "0.6252677", "0.6252224", "0.6234618", "0.6214764", "0.6200841", "0.61941946", "0.6185534", "0.6185534", "0.61712074", "0.6145789", "0.6127659", "0.61066437", "0.6075771", "0.59868294"...
0.6826756
0
Construct a new bakery.
def bakery(cls, size=200, _size_alert=None): return Bakery(cls, util.LRUCache(size, size_alert=_size_alert))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(\n cls,\n baseplate: Baseplate,\n exchange: kombu.Exchange,\n connection: kombu.Connection,\n queue_name: str,\n routing_keys: Sequence[str],\n handler_fn: Handler,\n error_handler_fn: Optional[ErrorHandler] = None,\n health_check_fn: Optional[...
[ "0.5933725", "0.57848924", "0.5568412", "0.55482167", "0.5534499", "0.54715455", "0.5468907", "0.5459821", "0.5437807", "0.54049957", "0.537843", "0.535118", "0.53441674", "0.5343216", "0.5335349", "0.5331593", "0.5323526", "0.52943146", "0.52782476", "0.5261039", "0.5253455"...
0.68587977
0
Cloning version of _add_lazyload_options.
def _with_lazyload_options(self, options, effective_path, cache_path=None): q = self._clone() q._add_lazyload_options(options, effective_path, cache_path=cache_path) return q
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_lazyload_options(self, options, effective_path, cache_path=None):\n\n key = ()\n\n if not cache_path:\n cache_path = effective_path\n\n for opt in options:\n if opt._is_legacy_option or opt._is_compile_state:\n ck = opt._generate_cache_key()\n ...
[ "0.7351524", "0.5850695", "0.57257646", "0.54799783", "0.5440046", "0.542972", "0.5402423", "0.5402423", "0.5373771", "0.53724265", "0.531277", "0.5289197", "0.52809143", "0.51790977", "0.51785725", "0.5111756", "0.5091345", "0.5084972", "0.50819707", "0.5048309", "0.5036518"...
0.76684904
0
Used by perstate lazy loaders to add options to the "lazy load" query from a parent query. Creates a cache key based on given load path and query options; if a repeatable cache key cannot be generated, the query is "spoiled" so that it won't use caching.
def _add_lazyload_options(self, options, effective_path, cache_path=None): key = () if not cache_path: cache_path = effective_path for opt in options: if opt._is_legacy_option or opt._is_compile_state: ck = opt._generate_cache_key() if c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _with_lazyload_options(self, options, effective_path, cache_path=None):\n q = self._clone()\n q._add_lazyload_options(options, effective_path, cache_path=cache_path)\n return q", "def get_cache_key(self, extra_args='', version=None):\r\n query, params = self.query.get_compiler(usi...
[ "0.61270165", "0.587668", "0.54732877", "0.5227243", "0.5152111", "0.5139174", "0.51296777", "0.5055537", "0.5020471", "0.49873075", "0.49650243", "0.49546865", "0.48689407", "0.4863961", "0.4855229", "0.48383257", "0.48105037", "0.47380558", "0.4709959", "0.46971396", "0.469...
0.67983854
0
Add a criteria function that will be applied postcache. This adds a function that will be run against the
def with_post_criteria(self, fn): return self._using_post_criteria([fn])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, func, *args):\n @wraps(func)\n def cached_func(*args):\n \"\"\"Run wise cache function\"\"\"\n try: # fails if cache is not instantiated\n return self.data['run'][func.__name__]\n except KeyError:\n value = func(*args)\n ...
[ "0.57693905", "0.556603", "0.5531649", "0.5530684", "0.5401678", "0.5360797", "0.5349943", "0.53326744", "0.5330154", "0.53179365", "0.528131", "0.5280769", "0.5261637", "0.5245427", "0.5236207", "0.52035993", "0.5197932", "0.51809543", "0.51750386", "0.5161694", "0.5151479",...
0.7152418
0
Load the given primary key identity from the database.
def _load_on_pk_identity(self, session, query, primary_key_identity, **kw): mapper = query._raw_columns[0]._annotations["parententity"] _get_clause, _get_params = mapper._get_clause def setup(query): _lcl_get_clause = _get_clause q = query._clone() q._get_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_by_pk(cls, _pk):\n try:\n return cls.q.get(_pk)\n except SQLAlchemyError:\n cls.s.rollback()\n raise", "def _identity_lookup(\n self,\n mapper: Mapper[_O],\n primary_key_identity: Union[Any, Tuple[Any, ...]],\n identity_token: An...
[ "0.6682378", "0.60061365", "0.58653814", "0.5855983", "0.5852731", "0.5839741", "0.5839741", "0.5839741", "0.5839741", "0.581331", "0.5812196", "0.5805475", "0.578652", "0.5777436", "0.5773851", "0.57506794", "0.56822234", "0.5653946", "0.5653946", "0.5653946", "0.5653946", ...
0.60104835
1
Calculate the error budget
def error_budget(self, slo=0, dec_point=3): self.slo = slo self.dec_point = dec_point err_budget = round(float(100-slo),dec_point) return err_budget
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(self): \n if not self.terminal:\n err = sum([v**2 for v in self.state + self.q[:-1]])\n else:\n err = sum([v**2 for v in LIMITS[:9]] + [1.0 - LIMITS[9]**2])\n err *= (self.max_steps - self.steps)\n return err", "def _computeError(self, inputs, targets):\n return .5*np....
[ "0.66941774", "0.6438683", "0.6386701", "0.622592", "0.61903656", "0.61200005", "0.6113358", "0.60751", "0.606798", "0.60242563", "0.5982136", "0.59535897", "0.5950767", "0.59501123", "0.5931098", "0.59281754", "0.591864", "0.59047747", "0.58921164", "0.58647203", "0.58646446...
0.670839
0
Calculate downtime in minutes
def downtime(self, down_time=0): self.down_time = down_time return down_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed_per_hour(self):\r\n return (3600.*(self.circ_failed+self.strm_failed))/self.current_uptime()", "def uptime(self) -> timedelta:\n return timedelta(seconds=int(time() - self.start_time))", "def _get_sleep_time(self, start_date, end_date):\n if start_date.minute == end_date.minute:\n ...
[ "0.6477869", "0.64276373", "0.6388033", "0.6321712", "0.62180614", "0.6206905", "0.6198657", "0.6171962", "0.6130945", "0.6065142", "0.60411316", "0.60108954", "0.60030276", "0.59931856", "0.59828526", "0.5981133", "0.5975357", "0.59615815", "0.59528226", "0.5902129", "0.5892...
0.68633246
0
Calculate availability in %
def availability(self, up_time=100, down_time=0, dec_point=3): self.up_time = up_time self.down_time = down_time self.dec_point = dec_point avail_percentage = round(float((up_time/(up_time+down_time))*100),dec_point) return avail_percentage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_availability(val, quant) -> float:\n return val + qty_available(quant)", "def ok(self, results):\n return \"{:5.2f}% capacity used\".format(\n results[\"usage\"].resource.usage_ratio * 100.0\n )", "def availability(self):\n if len(self.nodes) == 0:\n return...
[ "0.6637567", "0.6620742", "0.65621686", "0.61889", "0.61668587", "0.6147338", "0.6124066", "0.6106438", "0.60578084", "0.60313505", "0.60313505", "0.60313505", "0.59664994", "0.5964897", "0.5962494", "0.5768327", "0.57639223", "0.5762271", "0.5754381", "0.5727384", "0.5722385...
0.7643614
0
Get the avionics servo mechanical limits for the current system.
def GetAvionicsServoLimits(): sys_conf = system_config.SystemConfig.GetSystemConfigBySerial( _CONFIG['system']['wing_serial']) config_file = os.path.join(makani.HOME, 'avionics/servo/firmware/config_params.yaml') net_conf = network_config.NetworkConfig() yaml_keys = [sys_conf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity_limits(robot):\n return _get_limits(robot, \"Velocity\")", "def pwm_limit(self):\n return self._read(MX_PWM_LIMIT)", "def max_voltage_limit(self):\n return self._read(MX_MAX_VOLTAGE_LIMIT)", "def get_car_limits(self):\n # car's limits\n min_turning_radius = sel...
[ "0.7589826", "0.73986447", "0.7276931", "0.7213175", "0.69989234", "0.69592965", "0.6935034", "0.684604", "0.683837", "0.68241745", "0.6763293", "0.6756409", "0.6644776", "0.66212046", "0.65628123", "0.65265524", "0.6358509", "0.6343373", "0.6325908", "0.6301501", "0.62830347...
0.77723485
0
send the temp setpoint and status
def sendControls(self, status, tempset): outString = str(status) + '?' + str(tempset) + '?control' self.sendBytesToSTM(outString.encode("utf-8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendTemperature(self):\n if len(self.controller.myContainer.temperature) != 0:\n temp = sum(self.controller.myContainer.temperature) / len(self.controller.myContainer.temperature)\n else:\n temp = 0\n payload = ('{\"ts\": '+ str(int(time())) + ', \"temp\":' + str(tem...
[ "0.69648415", "0.67290276", "0.66760725", "0.6419395", "0.6197502", "0.6032963", "0.5922063", "0.5901843", "0.58650285", "0.5830984", "0.5789958", "0.57530457", "0.57461417", "0.56979966", "0.5695067", "0.5682123", "0.56808144", "0.5653576", "0.55845916", "0.5564297", "0.5558...
0.7084275
0