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
Returns the parity of the permutation >>> parity((3, 4)) 1 >>> parity((2,1)) 1 >>> parity((1, 2, 6, 5)) 1
def parity(p): f = dict(zip(sorted(p), p)) seen, neven = set(), 0 for x in p: if x in seen: continue c, l = x, 0 while c not in seen: seen.add(c) l += 1 c = f[c] neven += (l - 1) % 2 return 1 if neven % 2 == 0 else -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parity_of_permutation(cls, lst: Iterable) -> int:\n\t\tparity = 1\n\t\tlst = list(lst)\n\t\tfor i in range(0, len(lst) - 1):\n\t\t\tif lst[i] != i:\n\t\t\t\tparity *= -1\n\t\t\t\tmn = SquareMatrix.__idx_of_minimum(lst[i:]) + i\n\t\t\t\t\n\t\t\t\tlst[i], lst[mn] = lst[mn], lst[i]\n\t\treturn parity", "def p...
[ "0.7810365", "0.751558", "0.74588585", "0.74564564", "0.7020123", "0.6833049", "0.68051773", "0.6797909", "0.60460204", "0.59874743", "0.58930457", "0.585515", "0.5851539", "0.5723222", "0.5665174", "0.5619301", "0.5564634", "0.55510086", "0.550783", "0.54255444", "0.540439",...
0.7581894
1
>>> jig('1', '1') (1, []) >>> jig('12', '1') (1, ['2']) >>> jig('12', '2') (1, ['1']) >>> jig('1', '12') (1, ['2']) >>> jig('2', '12') (1, ['1']) >>> jig('12', '21') (1, [])
def jig(a, b): # Assumptions: # elements are unique per list out = list(a) sign = 1 for x in b: if x not in out: out.append(x) else: swaps = len(out) - out.index(x) - 1 sign *= (-1) ** swaps out.remove(x) return sign, out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pij_dagger(i: int, j: int):\n return hermitian_conjugated(_pij(i, j))", "def _qij_vec_dagger(i: int, j: int):\n return [hermitian_conjugated(i) for i in _qij_vec(i, j)]", "def test_get_ijk_list():\n\n l0 = get_ijk_list(0)\n assert l0 == [\n [0, 0, 0]\n ]\n\n l1 = get_ijk_list(1)\n...
[ "0.5384816", "0.53626597", "0.5330242", "0.5321761", "0.50911194", "0.50391024", "0.50116795", "0.49772155", "0.49516168", "0.4926835", "0.49146804", "0.4865859", "0.48324883", "0.47729522", "0.47677034", "0.47592914", "0.47451174", "0.47234073", "0.47234073", "0.47234073", "...
0.5998455
0
Saves the corresponding tag from the input field to the tag list. Ideally, we would like to use the MATCH function to determine which button was clicked. However, since we only have one save tag toast for all the tags, we can't use MATCH in the Output field. To use MATCH, Dash requires the Output field to match the sam...
def save_tag(n_clicks_timestamp, input_values): ctx = dash.callback_context triggered_id, triggered_prop, triggered_value = utils.ctx_triggered_info(ctx) if triggered_value is None: raise PreventUpdate # Unfortunately, we have to convert the stringified dict back to a dict. # Dash doesn't...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self) -> None:\n if not self.found:\n return\n self.tag_helper.save()", "def _save(self, **kwargs): #signal, sender, instance):\r\n tags = self._get_instance_tag_cache(kwargs['instance'])\r\n if tags is not None:\r\n Tag.objects.update_tags(kwargs['insta...
[ "0.6423813", "0.5827545", "0.5687878", "0.5630163", "0.5520939", "0.5326943", "0.51490104", "0.50914985", "0.5063527", "0.50503564", "0.5007661", "0.49620467", "0.4947558", "0.4932287", "0.4920134", "0.4887643", "0.48833373", "0.48679376", "0.48314855", "0.4811858", "0.481064...
0.6465949
0
Updates the options in the batch applied tag dropdown on tag changes. Notice that we don't need to have a similar callback to update the options of the nonbatch applied tag dropdowns. This is because the whole selected info panel is dynamically generated.
def update_batch_applied_tag_dropdown_options(tag_update_signal): tag_list = state.get_tag_list() return converters.tag_dropdown_options_from_tags(tag_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_change_over_time_tag_dropdown_options(tag_update_signal):\n tag_list = state.get_tag_list()\n tag_options = converters.timestamped_tag_dropdown_options_from_tags(tag_list)\n custom_time_range_option = {\n \"label\": constants.CUSTOM_TIME_RANGE_DROPDOWN_VALUE,\n \"value\": constant...
[ "0.6000653", "0.59050953", "0.5842685", "0.55560786", "0.5249337", "0.5249142", "0.52388763", "0.5198426", "0.5176975", "0.50794584", "0.50590396", "0.50292253", "0.49184924", "0.49001974", "0.49001974", "0.48938623", "0.48720917", "0.48586974", "0.4852081", "0.48486608", "0....
0.7676964
0
Updates the options in the change over time tag dropdown on tag changes.
def update_change_over_time_tag_dropdown_options(tag_update_signal): tag_list = state.get_tag_list() tag_options = converters.timestamped_tag_dropdown_options_from_tags(tag_list) custom_time_range_option = { "label": constants.CUSTOM_TIME_RANGE_DROPDOWN_VALUE, "value": constants.CUSTOM_TIME_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_batch_applied_tag_dropdown_options(tag_update_signal):\n tag_list = state.get_tag_list()\n return converters.tag_dropdown_options_from_tags(tag_list)", "def tags_changed(self, tags):\n pass", "def edit_tags(self):\n os.system(\"clear\")\n while True:\n tag_categ...
[ "0.7586686", "0.6757567", "0.6380285", "0.595404", "0.58845717", "0.57431585", "0.5715949", "0.57073283", "0.5632384", "0.56054455", "0.55602384", "0.554889", "0.5507737", "0.5482022", "0.5447586", "0.5431845", "0.5413043", "0.5364032", "0.53272116", "0.5323045", "0.52857333"...
0.7404219
1
Initializes an instance the ClosurizedNamespacesInfo class.
def __init__(self, closurized_namespaces, ignored_extra_namespaces): self._closurized_namespaces = closurized_namespaces self._ignored_extra_namespaces = (ignored_extra_namespaces + DEFAULT_EXTRA_NAMESPACES) self.Reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n this = _libsbml.new_SBMLNamespaces(*args)\n try: self.this.append(this)\n except: self.this = this", "def __init__(self, *args):\n this = _libsbml.new_XMLNamespaces(*args)\n try: self.this.append(this)\n except: self.this = this", "def __in...
[ "0.64506286", "0.6413823", "0.62931633", "0.61669827", "0.60347897", "0.5980294", "0.58920556", "0.58700234", "0.5846751", "0.5769954", "0.57318336", "0.5715054", "0.5680259", "0.566", "0.56599915", "0.5620923", "0.5602918", "0.554831", "0.55419225", "0.5532889", "0.5530244",...
0.66668606
0
Returns the namespaces which are already required by this file.
def GetRequiredNamespaces(self): return set(self._required_namespaces)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_namespaces():\n return list(StaticAsset._load_namespaces().keys())", "def GetProvidedNamespaces(self):\n return set(self._provided_namespaces)", "def namespaces(self):\n namespaces = set()\n for namespace_package in self.namespace_packages:\n dotted_name = []\n ...
[ "0.7514273", "0.7426737", "0.7389762", "0.7381562", "0.73246866", "0.7281683", "0.72748566", "0.71076447", "0.70576507", "0.70466834", "0.700075", "0.6840143", "0.6832781", "0.6823503", "0.6747387", "0.6740858", "0.6717921", "0.6711543", "0.66982067", "0.66495764", "0.6623423...
0.8207242
0
Returns whether the given goog.provide token is unnecessary.
def IsExtraProvide(self, token): namespace = tokenutil.GetStringAfterToken(token) if self.GetClosurizedNamespace(namespace) is None: return False if token in self._duplicate_provide_tokens: return True # TODO(user): There's probably a faster way to compute this. for created_namespace,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsFirstProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[0]", "def IsLastProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[-1]", "def isImportantToken(self, token, ignoreSemanticTagList=[]):\n if len(ignoreSemanticTagList) > 0...
[ "0.68526685", "0.6557919", "0.5716231", "0.54505974", "0.54359466", "0.54258895", "0.5409967", "0.5333457", "0.52942836", "0.5160305", "0.51457137", "0.51277775", "0.5105873", "0.5047557", "0.50473565", "0.50441617", "0.50110626", "0.49972895", "0.49934402", "0.4982881", "0.4...
0.7508166
0
Returns whether the given goog.require token is unnecessary.
def IsExtraRequire(self, token): namespace = tokenutil.GetStringAfterToken(token) if self.GetClosurizedNamespace(namespace) is None: return False if namespace in self._ignored_extra_namespaces: return False if token in self._duplicate_require_tokens: return True if namespace in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsFirstRequire(self, token):\n return self._require_tokens and token == self._require_tokens[0]", "def IsLastRequire(self, token):\n return self._require_tokens and token == self._require_tokens[-1]", "def isImportantToken(self, token, ignoreSemanticTagList=[]):\n if len(ignoreSemanticTagList) > 0...
[ "0.7097087", "0.6847048", "0.6291652", "0.6257764", "0.6020306", "0.6010145", "0.59261143", "0.57647413", "0.5722998", "0.5658726", "0.5658726", "0.5645742", "0.5449439", "0.5385633", "0.53722316", "0.5368333", "0.5328896", "0.5321386", "0.5280161", "0.5277081", "0.5277081", ...
0.7031952
1
Returns the dict of missing required namespaces for the current file. For each nonprivate identifier used in the file, find either a goog.require, goog.provide or a created identifier that satisfies it. goog.require statements can satisfy the identifier by requiring either the namespace of the identifier or the identif...
def GetMissingRequires(self): external_dependencies = set(self._required_namespaces) # Assume goog namespace is always available. external_dependencies.add('goog') # goog.module is treated as a builtin, too (for goog.module.get). external_dependencies.add('goog.module') created_identifiers = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetMissingProvides(self):\n missing_provides = dict()\n for namespace, identifier, line_number in self._created_namespaces:\n if (not self._IsPrivateIdentifier(identifier) and\n namespace not in self._provided_namespaces and\n identifier not in self._provided_namespaces and\n ...
[ "0.63311404", "0.5920848", "0.5731538", "0.5633661", "0.56284595", "0.5426965", "0.54253066", "0.52527624", "0.5209391", "0.512581", "0.5070434", "0.5059201", "0.49837956", "0.49681267", "0.49222076", "0.4893362", "0.48832375", "0.48443305", "0.4834767", "0.48293024", "0.4805...
0.7333173
0
Checks if a namespace would normally be required.
def ShouldRequireNamespace(namespace, identifier): return ( not self._IsPrivateIdentifier(identifier) and namespace not in external_dependencies and namespace not in self._provided_namespaces and identifier not in external_dependencies and identifier not in create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _namespace_requested(self, namespace):\r\n if namespace is None:\r\n return False\r\n namespace_tuple = self._tuplefy_namespace(namespace)\r\n if namespace_tuple[0] in IGNORE_DBS:\r\n return False\r\n elif namespace_tuple[1] in IGNORE_COLLECTIONS:\r\n ...
[ "0.73953635", "0.7301753", "0.65251887", "0.6509852", "0.64805037", "0.64667636", "0.6344185", "0.6334187", "0.61623454", "0.6138466", "0.61357164", "0.60664326", "0.6056696", "0.60520434", "0.6033502", "0.5975159", "0.58885986", "0.5803981", "0.5801867", "0.5779978", "0.5777...
0.7544301
0
Finds the namespace of an identifier given a list of other namespaces.
def _FindNamespace(self, identifier, *namespaces_list): identifier = identifier.rsplit('.', 1)[0] identifier_prefix = identifier + '.' for namespaces in namespaces_list: for namespace in namespaces: if namespace == identifier or namespace.startswith(identifier_prefix): return namespa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ns_list(logger,body,v1=None):\n if v1 is None:\n v1 = client.CoreV1Api()\n logger.debug('new client - fn get_ns_list')\n \n try:\n matchNamespace = body.get('matchNamespace')\n except KeyError:\n matchNamespace = '*'\n logger.debug(\"matching all namespaces.\"...
[ "0.5511319", "0.5437833", "0.54365224", "0.533564", "0.5334929", "0.5333034", "0.520893", "0.51984334", "0.5171764", "0.51552564", "0.51050156", "0.5095089", "0.50680137", "0.50477624", "0.503882", "0.50184745", "0.49847686", "0.49847686", "0.49530628", "0.49236485", "0.49200...
0.81949735
0
Returns whether the given identifier is private.
def _IsPrivateIdentifier(self, identifier): pieces = identifier.split('.') for piece in pieces: if piece.endswith('_'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_private_id(private_id):\n\n if private_id == identifier.private_id:\n return True\n return False", "def is_private(self):\n return self.has_label(PRIVATE_LABEL)", "def private(self) -> bool:\n return pulumi.get(self, \"private\")", "def isPrivate(id):\n db = core.connect()...
[ "0.81769556", "0.775468", "0.7722495", "0.77160704", "0.7646948", "0.7562728", "0.739211", "0.73734015", "0.7295112", "0.69502974", "0.69394654", "0.67882586", "0.6739908", "0.66595906", "0.6556429", "0.65464985", "0.65414155", "0.6533351", "0.6517475", "0.6428402", "0.638672...
0.818094
0
Returns whether token is the first provide token.
def IsFirstProvide(self, token): return self._provide_tokens and token == self._provide_tokens[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsLastProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[-1]", "def IsFirstRequire(self, token):\n return self._require_tokens and token == self._require_tokens[0]", "def IsLastRequire(self, token):\n return self._require_tokens and token == self._require_tokens[...
[ "0.7887217", "0.7391644", "0.69115305", "0.6791802", "0.6652381", "0.6512905", "0.6475678", "0.6475678", "0.63664705", "0.629974", "0.6282053", "0.6246363", "0.6235441", "0.61809856", "0.6155028", "0.61259884", "0.61105454", "0.60996723", "0.60899884", "0.5997687", "0.5997313...
0.8674835
0
Returns whether token is the first require token.
def IsFirstRequire(self, token): return self._require_tokens and token == self._require_tokens[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsLastRequire(self, token):\n return self._require_tokens and token == self._require_tokens[-1]", "def IsFirstProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[0]", "def IsExtraRequire(self, token):\n namespace = tokenutil.GetStringAfterToken(token)\n\n if se...
[ "0.81671214", "0.6949763", "0.68476576", "0.66363865", "0.6201824", "0.6201824", "0.6094359", "0.60599226", "0.5999892", "0.5982507", "0.5949889", "0.590627", "0.58565307", "0.5829618", "0.57798374", "0.57632315", "0.57223994", "0.57069623", "0.56557584", "0.5650901", "0.5618...
0.89671576
0
Returns whether token is the last provide token.
def IsLastProvide(self, token): return self._provide_tokens and token == self._provide_tokens[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsLastRequire(self, token):\n return self._require_tokens and token == self._require_tokens[-1]", "def has_more_tokens(self) -> bool:\n return len(self.jack_file_tokens) > self._token_idx", "def IsFirstProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[0]", ...
[ "0.76438874", "0.72274315", "0.68776894", "0.6821207", "0.67988884", "0.66592544", "0.6655954", "0.6569088", "0.65481645", "0.65435654", "0.64170283", "0.6405064", "0.6377603", "0.6337176", "0.62775195", "0.62491417", "0.62417126", "0.62393886", "0.62069696", "0.618613", "0.6...
0.8860514
0
Returns whether token is the last require token.
def IsLastRequire(self, token): return self._require_tokens and token == self._require_tokens[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsFirstRequire(self, token):\n return self._require_tokens and token == self._require_tokens[0]", "def IsLastProvide(self, token):\n return self._provide_tokens and token == self._provide_tokens[-1]", "def has_more_tokens(self) -> bool:\n return len(self.jack_file_tokens) > self._token_idx", ...
[ "0.7509558", "0.7488049", "0.686767", "0.6495814", "0.6475725", "0.6301454", "0.62661564", "0.6179465", "0.614039", "0.6088959", "0.6046331", "0.6027082", "0.60161424", "0.5990586", "0.59724194", "0.5945365", "0.59441656", "0.59059834", "0.58650494", "0.5856617", "0.58212847"...
0.903281
0
Processes the given token for dependency information.
def ProcessToken(self, token, state_tracker): # Note that this method is in the critical path for the linter and has been # optimized for performance in the following ways: # - Tokens are checked by type first to minimize the number of function # calls necessary to determine if action needs to be tak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_token(self, token: str) -> Optional[str]:\n raise RuntimeError('Cannot use _handle_token of this abstract class.')", "def parse(token):\n\n pass", "def _handle_token(self, token: str) -> Optional[str]:\n return token", "def next_token(self, context, token):", "def parse_depende...
[ "0.5602669", "0.5558042", "0.55427074", "0.540906", "0.52787644", "0.5224743", "0.5199154", "0.5164769", "0.51535594", "0.50753266", "0.50697255", "0.5051195", "0.5051195", "0.5051195", "0.50148237", "0.5011514", "0.5000214", "0.49974158", "0.4989386", "0.49775434", "0.495347...
0.6788418
0
Adds the namespace of an identifier to the list of created namespaces. If the identifier is annotated with a 'missingProvide' suppression, it is not added.
def _AddCreatedNamespace(self, state_tracker, identifier, line_number, namespace=None): if not namespace: namespace = identifier if self._HasSuppression(state_tracker, 'missingProvide'): return self._created_namespaces.append([namespace, identifier, line_number])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _AddUsedNamespace(self, state_tracker, identifier, token,\n is_alias_definition=False):\n if self._HasSuppression(state_tracker, 'missingRequire'):\n return\n\n identifier = self._GetUsedIdentifier(identifier)\n namespace = self.GetClosurizedNamespace(identifier)\n # b/5...
[ "0.6178203", "0.5934162", "0.57995856", "0.57396895", "0.56798714", "0.5676811", "0.5642477", "0.55801946", "0.55589324", "0.5475503", "0.54490924", "0.52659315", "0.5214463", "0.5213079", "0.52038467", "0.51981443", "0.49920872", "0.49379152", "0.49338087", "0.49110115", "0....
0.7534255
0
Adds the namespace of an identifier to the list of used namespaces. If the identifier is annotated with a 'missingRequire' suppression, it is not added.
def _AddUsedNamespace(self, state_tracker, identifier, token, is_alias_definition=False): if self._HasSuppression(state_tracker, 'missingRequire'): return identifier = self._GetUsedIdentifier(identifier) namespace = self.GetClosurizedNamespace(identifier) # b/5362203 If it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _AddCreatedNamespace(self, state_tracker, identifier, line_number,\n namespace=None):\n if not namespace:\n namespace = identifier\n\n if self._HasSuppression(state_tracker, 'missingProvide'):\n return\n\n self._created_namespaces.append([namespace, identifier, line...
[ "0.66084504", "0.6232781", "0.61949253", "0.5883757", "0.58255833", "0.5819052", "0.5810038", "0.5806278", "0.5666905", "0.5602587", "0.55705494", "0.5505676", "0.547098", "0.5374336", "0.5356941", "0.5347893", "0.5189263", "0.51137614", "0.5087794", "0.50860125", "0.501923",...
0.70048755
0
Strips apply/call/inherit calls from the identifier.
def _GetUsedIdentifier(self, identifier): for suffix in ('.apply', '.call', '.inherit'): if identifier.endswith(suffix): return identifier[:-len(suffix)] return identifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_named_call():\n global _use_named_call\n _use_named_call = False", "def restore_user_defined_calls(*args):\n return _ida_hexrays.restore_user_defined_calls(*args)", "def __call__(fun_name):", "def _unwrap_simple_call(self, node: ast.expr) -> ast.expr:\n if isinstance(node, ast.Call) and len...
[ "0.5675074", "0.5346134", "0.5218611", "0.51925397", "0.51191026", "0.509856", "0.5074015", "0.5058325", "0.50206256", "0.49795005", "0.49678898", "0.49467093", "0.49240702", "0.4921765", "0.49191517", "0.49014243", "0.49014243", "0.49014243", "0.49014243", "0.49014243", "0.4...
0.5554346
1
Display each taxi in taxi list.
def display_taxis(taxis): for i, taxi in enumerate(taxis): print(f"{i} - {taxi}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def taxis_available(taxi_types):\n for number, taxi in enumerate(taxi_types):\n print(\"{} - {}\".format(number, taxi))", "def display_taxis(taxis):\n for i, taxi in enumerate(taxis):\n print(\"{} - {}\".format(i, taxi))", "def display(self):\r\n\t\tfor each_item in self.items:\r\n\t\t\teac...
[ "0.65396684", "0.6429241", "0.61385715", "0.58961475", "0.57848", "0.57381195", "0.56497097", "0.5648627", "0.55053335", "0.5472496", "0.5460303", "0.53348786", "0.53228974", "0.5319868", "0.52896756", "0.52867186", "0.52786404", "0.5254497", "0.5254258", "0.52528995", "0.524...
0.66690373
0
Returns the sorted topN docs for a single queryID.
def get_topN_docs(click_model, queryID): # for every queryID, find the first top 10 relevant docs unordered_docs = [] # list of [ind, rank] for all relevant docs for ind in click_model[queryID]: document = click_model[queryID][ind] rank = document['rank'] # moving the docID into the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_docs(self, query_vectors, n_docs):\n raise NotImplementedError", "def top_files(query, files, idfs, n):\n tf_idfs = []\n for filename, filewords in files.items():\n tf_idf = 0\n\n for word in query:\n if word not in idfs:\n continue\n id...
[ "0.7397129", "0.7190849", "0.7050551", "0.7031025", "0.6947377", "0.6884981", "0.68634695", "0.67815554", "0.6779356", "0.66407865", "0.6520463", "0.63906056", "0.617372", "0.6103085", "0.6072736", "0.60727215", "0.60646886", "0.59424716", "0.58749926", "0.57950824", "0.57085...
0.8405925
0
Method to create the Dataset class gtk.Notebook() page for displaying assessment inputs for the selected data set.
def _create_analyses_input_page(self, notebook): # pylint: disable=R0914 # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Build-up the containers for the tab. # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # _hbox = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_notebook(self):\r\n\r\n _notebook = gtk.Notebook()\r\n\r\n # Set the user's preferred gtk.Notebook tab position.\r\n if Configuration.TABPOS[2] == 'left':\r\n _notebook.set_tab_pos(gtk.POS_LEFT)\r\n elif Configuration.TABPOS[2] == 'right':\r\n _notebook...
[ "0.67163163", "0.669597", "0.65538305", "0.654544", "0.6439258", "0.62485445", "0.5970818", "0.5954215", "0.5790756", "0.57078046", "0.5697864", "0.5688682", "0.56205344", "0.557784", "0.5577001", "0.5522175", "0.5494343", "0.5491092", "0.5468219", "0.5451919", "0.5449248", ...
0.6900534
0
Method to load the gtk.Widgets() on the analysis inputs page.
def _load_analysis_inputs_page(self): # Load the gtk.ComboBox() with system hardware names. self.cmbAssembly.handler_block(self._lst_handler_id[0]) Widgets.load_combo(self.cmbAssembly, Configuration.RTK_HARDWARE_LIST, simple=False) self.cmbAssembly.handl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_analyses_input_page(self, notebook): # pylint: disable=R0914\r\n\r\n # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #\r\n # Build-up the containers for the tab. #\r\n # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #\r\n ...
[ "0.68877333", "0.6753903", "0.65538627", "0.6503645", "0.6488988", "0.63903576", "0.63797456", "0.62879664", "0.6276804", "0.62472034", "0.622531", "0.6221652", "0.6181676", "0.6164852", "0.6162042", "0.61567295", "0.61434543", "0.6064883", "0.60598457", "0.6035046", "0.60240...
0.6992013
0
Check ongoing hacks and their expiration time.
async def check_hacks(self) -> None: hacks = await self.get_expired_hacks() for h in hacks: await self.delete_skill_action_by_target_id_and_skill_type(h[3], 'hack') channel = self.bots_txt await channel.send( content=f"<@{h[0]}>", em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_hacks(self) -> None:\n\n hacks = await self.get_expired_hacks()\n for h in hacks:\n await self.delete_skill_action_by_target_id_and_skill_type(h[3], 'hack')\n await self.update_user_is_hacked(h[3], 0)\n\n channel = self.bots_txt\n\n await ch...
[ "0.6524886", "0.61418", "0.6007292", "0.5943196", "0.58323187", "0.5762643", "0.57544595", "0.5733186", "0.5719667", "0.56494826", "0.56424487", "0.5639762", "0.56145597", "0.56025016", "0.557354", "0.5539113", "0.55334616", "0.55320907", "0.5497794", "0.54934573", "0.5474352...
0.6332263
1
Updates all content fields of hacks executed by a specific user.
async def update_hacks_content(self, attacker_id: int) -> None: mycursor, db = await the_database() await mycursor.execute("UPDATE SlothSkills SET content = 'virus' WHERE user_id = %s", (attacker_id,)) await db.commit() await mycursor.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_user_is_hacked(self, user_id: int, hacked: int) -> None:\n\n mycursor, db = await the_database()\n await mycursor.execute(\"UPDATE UserCurrency SET hacked = %s WHERE user_id = %s\", (hacked, user_id))\n await db.commit()\n await mycursor.close()", "def update_user():"...
[ "0.6449547", "0.5994832", "0.5917885", "0.59126174", "0.574175", "0.5576456", "0.53066003", "0.5300011", "0.5268399", "0.5226327", "0.5225666", "0.5216887", "0.52048266", "0.51805025", "0.5174077", "0.5142172", "0.5128559", "0.5101558", "0.5093439", "0.50742656", "0.5071988",...
0.65136653
0
Checks if the target member has a contagious virus in their hack.
async def check_virus(self, ctx: commands.Context, target: discord.Member) -> None: answer: discord.PartialMessageable = None if isinstance(ctx, commands.Context): answer = ctx.send else: answer = ctx.respond infected = ctx.author hack = await self.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_vulnerability(self):\n\t\tpass", "def basic_check(word):\n if word[-1] == \"b\" or word[-1] == \"g\":\n return False\n consonant_counter = 0\n for char in word:\n if char in VOWELS:\n consonant_counter = 0\n else:\n consonant_counter += 1\n if ...
[ "0.67220134", "0.5530193", "0.5503171", "0.5468125", "0.538155", "0.53553593", "0.53199047", "0.5271036", "0.5269808", "0.52576876", "0.5244865", "0.52445847", "0.522711", "0.52121764", "0.5185404", "0.5182956", "0.51672363", "0.5136818", "0.512856", "0.511059", "0.51015955",...
0.6997657
0
Makes an embedded message for a virus infection skill action.
async def get_virus_embed(self, channel: discord.TextChannel, perpetrator_id: int, target_id: int, infected_id: int) -> discord.Embed: timestamp = await utils.get_timestamp() wire_embed = discord.Embed( title="Someone has been infected by a hacking!", timestamp=datetime.fromtim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_virus(self, ctx: commands.Context, target: discord.Member) -> None:\n\n answer: discord.PartialMessageable = None\n if isinstance(ctx, commands.Context):\n answer = ctx.send\n else:\n answer = ctx.respond\n\n infected = ctx.author\n\n hack = ...
[ "0.61588365", "0.52967834", "0.5241235", "0.52001595", "0.505561", "0.5049495", "0.50357", "0.50017184", "0.49742955", "0.49708763", "0.49689567", "0.49649853", "0.49194732", "0.49093622", "0.49093622", "0.49093622", "0.49093622", "0.49093622", "0.49093622", "0.4882686", "0.4...
0.5607754
1
Utility function loading an image, converting it into greyscale, and performing histogram equilization
def load_and_preprocess_image(path): img = cv2.imread(path, 0) # Load image into greyscale img = cv2.equalizeHist(img) # Histogram equilization return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def histo_image(image, verbose=False):\n gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n\n histo_global = cv2.equalizeHist(gray)\n\n _, histo = cv2.threshold(histo_global, thresh=250,\n maxval=255, type=cv2.THRESH_BINARY)\n\n if verbose:\n plt.imshow(histo, cmap='gra...
[ "0.67547977", "0.67301863", "0.6704774", "0.6599597", "0.65497786", "0.6504103", "0.64119923", "0.6376085", "0.63556564", "0.6292844", "0.6277472", "0.62644446", "0.62549794", "0.62410015", "0.6209802", "0.6203148", "0.6193479", "0.61523557", "0.6127991", "0.6120134", "0.6074...
0.7406885
0
Utility function processing all images in a given directory.
def bulk_process_images(inputpath, outputpath, extension): for dirpath, dirnames, filenames in os.walk(inputpath): structure = os.path.join(outputpath, dirpath[len(inputpath) + 1:]) for file in filenames: if file.endswith(extension): src = os.path.join(dirpath, file) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_images():\n create_dirs()\n for root, dirs, files in os.walk(IN):\n for name in files:\n if name[0] == '.':\n continue\n process_image(name)", "def process_imgdir(self,imgdir):\n #Write images into resultdir\n resultdir = os.path.join(imgdir, 'results')\n #R...
[ "0.813414", "0.72451013", "0.7199291", "0.7147753", "0.7090039", "0.70295995", "0.70114356", "0.69021356", "0.687131", "0.68625164", "0.6833119", "0.6790636", "0.6766119", "0.67627907", "0.67616725", "0.67560166", "0.6703966", "0.66968566", "0.6695718", "0.6682746", "0.666091...
0.73714215
1
Utility function augmenting all images in an input path, copying them into an output path
def bulk_augment_images(input_path, output_path, extension, augmentation, label_type, label_threshold=-1): for dir_path, dir_names, filenames in os.walk(input_path): structure = os.path.join(output_path, dir_path[len(input_path) + 1:]) for file in filenames: if file.endswith(extension): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aug_imgs(in_path, out_path):\n names = os.listdir(in_path)\n aug = iaa.Sequential([iaa.AdditiveGaussianNoise(scale=0.01*255), iaa.Fliplr(p=0.5), iaa.Affine(shear=-10)],\n random_order=True)\n for i, name in enumerate(names):\n img = cv2.imread(in_path + name, 0)\n ...
[ "0.72657603", "0.7063366", "0.6926456", "0.6781271", "0.6385733", "0.6332555", "0.63126224", "0.6292644", "0.62688696", "0.6258702", "0.62342423", "0.62127364", "0.6199814", "0.61439675", "0.61195624", "0.6092347", "0.60701877", "0.605984", "0.60366774", "0.60089594", "0.5961...
0.7562213
0
Threaded fetching of the udemy course links from tutorialbar.com
def gatherUdemyCourseLinks(courses): thread_pool = Pool() results = thread_pool.map(getUdemyLink, courses) thread_pool.close() thread_pool.join() return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_page_urls(self,soup):\n\t\tcourse_links =[]\n\t\troot_url = 'http://onlinelearning.cornell.edu'\n\t\tfor link in soup.select('span.field-content a[href]'):\n\t\t\tnew_url = root_url + link['href']\n\t\t\tcourse_links.append(new_url)\n\t\t\tcourse_links.append(' \\n')\n\t\t\n\t\tself.new_list.append(...
[ "0.64871687", "0.6117817", "0.6110424", "0.59748065", "0.59708416", "0.5970168", "0.5913486", "0.591276", "0.58788747", "0.58563405", "0.5855745", "0.58344626", "0.5743032", "0.57388294", "0.5734839", "0.5685268", "0.5638574", "0.5638217", "0.56250453", "0.55969715", "0.55925...
0.7585741
0
Returns if a CORS relevant header was used in the request. In that case the answer should include apropiate headers.
def _has_cors_header(self): return "Access-Control-Request-Method" in self.headers or "Access-Control-Request-Headers" in self.headers or "Origin" in self.headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_cors_headers(self, res):\r\n self.assertEqual(res.headers['access-control-allow-origin'], '*')\r\n self.assertEqual(\r\n res.headers['access-control-allow-headers'], 'X-Requested-With')", "def _check_cors_headers(self, res):\r\n self.assertEqual(res.headers['access-cont...
[ "0.77488124", "0.77488124", "0.6515614", "0.65088147", "0.64439636", "0.63956106", "0.6353866", "0.63124585", "0.6307344", "0.62298346", "0.6204528", "0.6182343", "0.6175846", "0.61416525", "0.612719", "0.60686135", "0.60395163", "0.6036721", "0.601054", "0.601054", "0.600865...
0.81310594
0
Returns request Range start and end if specified. If Range header is not specified returns (None, None)
def _get_range_header(self): try: range_header = self.headers["Range"] if range_header == None: return (None, None) match = self.range_regex.match(range_header) if match == None: return (None, None) except: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_range_header(self):\n range_header = self.headers.getheader(\"Range\")\n if range_header is None:\n return (None, None)\n if not range_header.startswith(\"bytes=\"):\n print \"Not implemented: parsing header Range: %s\" % range_header\n return (None, N...
[ "0.76051366", "0.64007", "0.63162076", "0.62205637", "0.6198985", "0.61585295", "0.6094305", "0.60727465", "0.60231185", "0.6018141", "0.6005612", "0.5990971", "0.5956472", "0.5912372", "0.5882862", "0.58700633", "0.5840941", "0.5808205", "0.5808205", "0.5799625", "0.5738819"...
0.74889433
1
Creates a new ShadowSource. After the creation, a lens can be added with setupPerspectiveLens.
def __init__(self): self.index = self._generateUID() DebugObject.__init__(self, "ShadowSource-" + str(self.index)) ShaderStructElement.__init__(self) self.valid = False self.camera = Camera("ShadowSource-" + str(self.index)) self.cameraNode = NodePath(self.camera) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, scene = base.render, ambient = 0.2, hardness = 16, fov = 40, near = 10, far = 100):\n \n # Read and store the function parameters\n self.scene = scene\n self.__ambient = ambient\n self.__hardness = hardness\n \n # By default, mark every object as textured.\n self.flagText...
[ "0.56471896", "0.54164994", "0.52801746", "0.51461595", "0.51001674", "0.5033836", "0.50236815", "0.4979795", "0.49654973", "0.49104264", "0.48959804", "0.489492", "0.48817372", "0.48636484", "0.4848264", "0.48168567", "0.48058757", "0.4802296", "0.47864646", "0.47845897", "0...
0.6872107
0
Sets the film size of the source
def setFilmSize(self, size_x, size_y): self.lens.setFilmSize(size_x, size_y) self.rebuildMatrixCache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_size(self, w, h):\n\t\tpass", "def set_size(self, size):\n \n self.width = size[0]\n self.height = size[1]", "def setsize(self, size):\n self.__size = size", "def setFrameSize(self, frame_size):\n \n self.frame_size = frame_size", "def set_size(self, size=N...
[ "0.66870576", "0.6594383", "0.6515641", "0.6513604", "0.6441292", "0.6421563", "0.63714147", "0.6353532", "0.63481283", "0.63318676", "0.62815446", "0.6245005", "0.62030274", "0.61962676", "0.61962676", "0.6195462", "0.61918056", "0.6174559", "0.6174559", "0.6174559", "0.6174...
0.76360935
0
Returns the assigned source index. The source index is the index of the ShadowSource in the ShadowSources array of the assigned Light.
def getSourceIndex(self): return self.sourceIndex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetAMRBlockSourceIndex(self, p_int, p_int_1):\n ...", "def source_id(self):\n return self._source_id", "def source(self):\n if not self.set_source:\n return sb.NotSpecified\n return uint32_packer.unpack(self[4:8])[0]", "def _get_target_index(self):\n return (...
[ "0.64287513", "0.6268864", "0.5967637", "0.58983713", "0.585019", "0.57937014", "0.57937014", "0.57837826", "0.5761022", "0.5761022", "0.5639242", "0.5594638", "0.5589636", "0.5575055", "0.55677557", "0.5560122", "0.5557805", "0.55487514", "0.5494656", "0.5484412", "0.5480852...
0.74652684
0
Sets the source index of this source. This is called by the light, as only the light knows at which position this source is in the Sources array.
def setSourceIndex(self, index): self.sourceIndex = index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_source(self, source_name):\n self.source = source_name", "def source_id(self, source_id):\n\n self._source_id = source_id", "def source_id(self, source_id):\n\n self._source_id = source_id", "def set_source(self, source):\n self.data['source'] = source", "def source(self...
[ "0.679036", "0.66052014", "0.66052014", "0.6591564", "0.6569787", "0.62374467", "0.6223604", "0.6223604", "0.6223604", "0.6223604", "0.6223604", "0.6223604", "0.6223604", "0.61710954", "0.61393267", "0.6092534", "0.6084271", "0.6015366", "0.5984961", "0.59811014", "0.5959025"...
0.8529315
0
Computes the modelViewProjection matrix for the lens. Actually, this is the worldViewProjection matrix, but for convenience it is called mvp.
def computeMVP(self): projMat = self.converterYUR modelViewMat = self.transforMat.invertCompose( Globals.render.getTransform(self.cameraNode)).getMat() return UnalignedLMatrix4f(modelViewMat * projMat)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modelview_matrix(self):\n camera = self.figure.scene.camera\n return camera.view_transform_matrix.to_array().astype(np.float32)", "def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(s...
[ "0.70178586", "0.6966919", "0.6562363", "0.65267247", "0.64798117", "0.64471877", "0.63473505", "0.6164686", "0.61556834", "0.61460024", "0.6138456", "0.6125117", "0.60684174", "0.60494584", "0.60469806", "0.6032966", "0.6031657", "0.59044665", "0.5889228", "0.5841249", "0.58...
0.7526075
0
Assigns this source a position in the shadow atlas. This is called by the shadow atlas. Coordinates are float from 0 .. 1
def assignAtlasPos(self, x, y): self.atlasPos = Vec2(x, y) self.doesHaveAtlasPos = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPosition(self):\n # determine posX, posY for battle\n (x1,y1) = globals.battlemapQuadrants[self.systemGrid]\n self.posX = x1+self.setX\n self.posY = y1+self.setY", "def setzePosition(self, x, y):\n self.zielX = x\n self.zielY = y", "def set_position(self, x: flo...
[ "0.6156805", "0.60141057", "0.60129917", "0.6004218", "0.6000607", "0.5993239", "0.598556", "0.59563553", "0.58847815", "0.58847356", "0.5878124", "0.58766407", "0.58704585", "0.58442515", "0.58430034", "0.5831376", "0.58271724", "0.5809994", "0.5803376", "0.57787955", "0.577...
0.6183983
0
Returns the assigned atlas pos, if present. Coordinates are float from 0 .. 1
def getAtlasPos(self): return self.atlasPos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_position(self):\n position = (self.position_x * SPRITE_SIZE, self.position_y * SPRITE_SIZE)\n return position", "def _getCoords(self):\n\n if self._coords is not None:\n return self._coords[self._acsi]", "def fixture_coord():\n\tEXAMPLE_FILE_FOLDER = str(MODULE_D...
[ "0.66034317", "0.65444887", "0.6444638", "0.63149214", "0.6291102", "0.6274993", "0.6270446", "0.6253127", "0.6180184", "0.6170509", "0.61551327", "0.61384577", "0.60982853", "0.6077503", "0.60670394", "0.6055914", "0.6049513", "0.60348207", "0.60224485", "0.6008913", "0.6008...
0.7560469
0
Returns wheter this ShadowSource has already a position in the shadow atlas
def hasAtlasPos(self): return self.doesHaveAtlasPos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_origin(self):\n return self.contains(self.ambient_space().zero())", "def has_positions(self):\n return self.positions.exists()", "def has_pos(self) -> object:\n return self._has_pos", "def is_origin(self) -> bool:\n return self.x == 0 and self.y == 0", "def has_dest...
[ "0.660991", "0.65274745", "0.64275694", "0.6206538", "0.6185759", "0.61701924", "0.6113514", "0.6070053", "0.6006791", "0.59578675", "0.59305793", "0.59122664", "0.5864909", "0.58581674", "0.5855908", "0.581775", "0.58165866", "0.5779871", "0.5778968", "0.57593817", "0.574624...
0.6653766
0
Deletes the atlas coordinates, called by the atlas after the Source got removed from the atlas
def removeFromAtlas(self): self.doesHaveAtlasPos = False self.atlasPos = Vec2(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeCoordinatesDumpFile(self):\n os.remove(self.COORDINATES_DUMP_FNAME)", "def cleanAll(self):\n for i in range(len(self.asteroid_type) - 1, -1, -1):\n x, y = self.get_coords(self.asteroid_type[i])\n self.del_asteroid(i)\n\n for i in range(len(self.asteroid_id_e) ...
[ "0.65160275", "0.64323896", "0.64059365", "0.63009447", "0.63009447", "0.62701464", "0.6259166", "0.622845", "0.62146705", "0.61958385", "0.61958385", "0.6183421", "0.60780424", "0.60723054", "0.6050865", "0.6039283", "0.603769", "0.6031997", "0.60197896", "0.60166305", "0.60...
0.7005352
0
Setups a PerspectiveLens with a given nearPlane, farPlane and FoV. The FoV is a tuple in the format (Horizontal FoV, Vertical FoV)
def setupPerspectiveLens(self, near=0.1, far=100.0, fov=(90, 90)): # self.debug("setupPerspectiveLens(",near,",",far,",",fov,")") self.lens = PerspectiveLens() self.lens.setNearFar(near, far) self.lens.setFov(fov[0], fov[1]) self.camera.setLens(self.lens) self.nearPlane =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupOrtographicLens(self, near=0.1, far=100.0, filmSize=(512, 512)):\n # self.debug(\"setupOrtographicLens(\",near,\",\",far,\",\",filmSize,\")\")\n self.lens = OrthographicLens()\n self.lens.setNearFar(near, far)\n self.lens.setFilmSize(*filmSize)\n self.camera.setLens(self...
[ "0.70291877", "0.66441834", "0.65732735", "0.65727365", "0.6233378", "0.6114747", "0.6030867", "0.6030412", "0.5988965", "0.5988965", "0.5988965", "0.5973305", "0.596118", "0.5778326", "0.5762084", "0.570791", "0.5695007", "0.5631295", "0.5628302", "0.5604736", "0.5587684", ...
0.80055594
0
Setups a OrtographicLens with a given nearPlane, farPlane and filmSize. The filmSize is a tuple in the format (filmWidth, filmHeight) in world space.
def setupOrtographicLens(self, near=0.1, far=100.0, filmSize=(512, 512)): # self.debug("setupOrtographicLens(",near,",",far,",",filmSize,")") self.lens = OrthographicLens() self.lens.setNearFar(near, far) self.lens.setFilmSize(*filmSize) self.camera.setLens(self.lens) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupPerspectiveLens(self, near=0.1, far=100.0, fov=(90, 90)):\n # self.debug(\"setupPerspectiveLens(\",near,\",\",far,\",\",fov,\")\")\n self.lens = PerspectiveLens()\n self.lens.setNearFar(near, far)\n self.lens.setFov(fov[0], fov[1])\n self.camera.setLens(self.lens)\n ...
[ "0.6712774", "0.6084861", "0.5635632", "0.55978215", "0.5591141", "0.5473505", "0.5404724", "0.54038227", "0.52609247", "0.52150947", "0.5176009", "0.51734596", "0.5155422", "0.5127603", "0.4930873", "0.49277773", "0.48962718", "0.4891529", "0.4888189", "0.4877433", "0.487195...
0.85450816
0
Gets called when shadow sources was updated
def onUpdated(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_source(self):\n pass", "def activate_source(self):\n pass", "def _update_modified_data_sources(self):\n new_last_imported = datetime.utcnow()\n self._update_modified_since(self.last_imported)\n self.last_imported = new_last_imported", "def handle_reload_toolbox(...
[ "0.69026774", "0.59549236", "0.58609873", "0.5794801", "0.5756406", "0.57472444", "0.572068", "0.5648752", "0.5624924", "0.55939525", "0.5568056", "0.5460217", "0.5427892", "0.5391734", "0.53892064", "0.5381881", "0.5369996", "0.5367086", "0.5359593", "0.5359593", "0.5359411"...
0.604301
1
Initializes the public_id, secret_id and the redirect_uri so that init_user can be called anytime
def __init__(self) -> None: self._public_id = 'daf1fbca87e94c9db377c98570e32ece' self._secret_id = '1a674398d1bb44859ccaa4488df1aaa9' self._redirect_uri = 'https://pass-post.netlify.app'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n create_user(app)\n get_all_user()", "def initialize(self, *a, **kw):\n webapp2.RequestHandler.initialize(self, *a, **kw)\n uid = self.read_secure_cookie('user_id')\n self.user = uid and User.by_id(int(uid))", "def initialize(self, *a, **kw):\n\n webapp2.RequestHa...
[ "0.6612536", "0.65369034", "0.6525771", "0.63945854", "0.6338878", "0.6335516", "0.62250316", "0.6218013", "0.61803603", "0.61792296", "0.6086227", "0.6085263", "0.597309", "0.5938068", "0.5929208", "0.59091866", "0.5891024", "0.58577573", "0.5855543", "0.58548415", "0.584877...
0.7228125
0
Initializes an instance of spotipy.Spotify that is logged in
def init_user(self) -> Any: return \ spotipy.Spotify(auth_manager=spotipy.oauth2.SpotifyOAuth(scope="playlist-modify-public", client_id=self._public_id, client_secret=self._secret_id, redirect_uri=self._redirect_uri))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, username):\n self.spotify = spotipy.Spotify(simple_auth_token(username))", "def auth(self):\n token = spotipy.util.prompt_for_user_token(self.username,\n self.scope,\n client_id = ...
[ "0.8046805", "0.7582148", "0.74957615", "0.7105578", "0.6914381", "0.6837434", "0.6777287", "0.6466859", "0.6430304", "0.6380559", "0.62434363", "0.6243389", "0.61116755", "0.61068124", "0.60647935", "0.5974983", "0.5959601", "0.59238493", "0.59238493", "0.5872101", "0.58713"...
0.7950831
1
Return the audio features of a song
def get_song_features(self, song_id: str) -> List[float]: user = self.init_user() user.trace = True features = user.audio_features(song_id)[0] return [features['acousticness'], features['danceability'], features['energy'], features['duration_ms'], features...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spotify_features(search):\n\t\n\t# Configure API credentials\n\tclient_credentials_manager = SpotifyClientCredentials(client_id=config.SPOTIFY_CID, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclient_secret=config.SPOTIFY_SECRET)\n\tsp = spotipy.Spotify(client_credentials_manager = client_credentials_manager)\n\t\n\t# Fi...
[ "0.7809176", "0.73876536", "0.6952075", "0.6951485", "0.68658644", "0.6713561", "0.66311383", "0.6595504", "0.6544838", "0.64794326", "0.64385945", "0.63735366", "0.63735366", "0.63646275", "0.6312347", "0.62634575", "0.62581265", "0.62259", "0.6213748", "0.61638194", "0.6130...
0.7706416
1
Given the user's playlist URL, return a list of track ids included in the playlist.
def get_song_ids(self, playlist_link: str) -> List[str]: user = self.init_user() playlist_id = self.parse_link_to_id(playlist_link) res = user.playlist_items(playlist_id, offset=0, fields='items.track.id', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_playlist_tracks_id(self, username, playlist_name):\n track_list = []\n playlist_id = self.get_playlist_id(username, playlist_name)\n tracks = self.spotify.playlist_tracks(playlist_id)\n for i in range(len(tracks['items'])):\n track_list.append(tracks['items'][i]['trac...
[ "0.76453924", "0.74738145", "0.73954004", "0.69144875", "0.6867974", "0.6815433", "0.6652141", "0.663792", "0.66315997", "0.65984553", "0.65869725", "0.65690655", "0.64615995", "0.6455686", "0.6426979", "0.6400573", "0.6325174", "0.6292672", "0.6279484", "0.62740594", "0.6226...
0.7682564
0
Given the playlist link, return the playlist id.
def parse_link_to_id(self, playlist_link: str) -> str: split_1 = playlist_link.split('/')[4] split_2 = split_1.split('?') return split_2[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_playlist_id(self, username, playlist_name):\n playlist_id = ''\n playlists = self.spotify.user_playlists(username)\n for playlist in playlists['items']:\n if playlist['name'] == playlist_name:\n playlist_id = playlist['id']\n return playlist_id\...
[ "0.7627802", "0.75714946", "0.7359392", "0.73437", "0.7227414", "0.71185565", "0.70467764", "0.66185874", "0.660244", "0.6591759", "0.65801316", "0.64638054", "0.6358947", "0.63445514", "0.62671155", "0.6256702", "0.6156125", "0.61192715", "0.60325164", "0.6021746", "0.599894...
0.81976426
0
Selects the given labels from a named SelectWidget control. (A functional replacement for the JavaScript used by this widget.)
def setSelectWidget(browser, name, labels): control = browser.getControl(name='%s.from' % name).mech_control form = control._form for label in labels: value = str(control.get(label=label)) form.new_control('text', 'form.buyable_types', {'value': value})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def htmlSelect(labelText, parName, args, choiceList, hint=None, descriptionSeparator='::',\n labelAttr='', attr=''):\n snippet = htmlLabel(labelText,parName,labelAttr)\n default = args[parName] if parName in args else ''\n if not isinstance(default,list):\n default = [default]\n sn...
[ "0.62763876", "0.6042844", "0.6035751", "0.5838853", "0.58088744", "0.57668555", "0.5582798", "0.54629403", "0.545703", "0.5385097", "0.53836495", "0.5362602", "0.530068", "0.530068", "0.5267683", "0.510479", "0.510479", "0.50969267", "0.50787586", "0.50787586", "0.50787586",...
0.7560723
0
Returns the 'Add to Cart' button as on Plone 2.5 it is a link but on Plone 3+ it is a control.
def getAddToCartControlOrLink(browser): try: browser.getControl('Add to Cart') return browser.getControl('Add to Cart') except LookupError: return browser.getLink('Add to Cart')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto_cart(self):\n self.driver.find_element(*BasePageLocators.GO_CART).click()\n return CartPage(self.driver)", "def checkout_btn(self):\n self._checkout_btn.click()", "def add_create_pl_btn(self):\n self.create_pl = QPushButton(\"Add to playlist\")\n self.create_pl.click...
[ "0.5797779", "0.5744916", "0.57158464", "0.55404997", "0.5528336", "0.54405314", "0.5308705", "0.5291106", "0.5275951", "0.52686775", "0.5261013", "0.5248891", "0.5233275", "0.52236503", "0.5206349", "0.520571", "0.5186595", "0.51761496", "0.51619565", "0.5154222", "0.5139150...
0.7175834
0
visualize all boxes in one image
def vis_all_boxes(im_array, boxes): import matplotlib.pyplot as plt from ..fio.load_ct_img import windowing_rev, windowing im = windowing_rev(im_array+config.PIXEL_MEANS, config.WINDOWING) im = windowing(im, [-175,275]).astype(np.uint8) # soft tissue window plt.imshow(im) color = (0.,1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_boxes(self, im, boxes):\n for bbox in boxes:\n l = [int(x) for x in bbox[\"coords\"]]\n l = self.scalebox(l)\n icon = self.classes_to_icons[bbox[\"label\"]]\n overlay_im_to_background(im, icon, l[0], l[1] - icon.shape[0] - 5)\n cv2.rectangle(im...
[ "0.7867931", "0.76596415", "0.756796", "0.74380344", "0.7399842", "0.73794574", "0.71901476", "0.71162546", "0.70859426", "0.7064588", "0.70577294", "0.705543", "0.7016237", "0.6984557", "0.69161266", "0.6911", "0.6865214", "0.6836461", "0.67877877", "0.6779726", "0.6752084",...
0.78662
1
Returns the query query that was executed.
def query(self): return self.details[KEY_QUERY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_query(self):\n return self._project.sql_query", "def query(self):\n return self._query", "def query(self):\n return self._query", "def query(self):\n return self._query", "def query(self):\n \n return self._query", "def query(self):\n return self._...
[ "0.8080436", "0.77075416", "0.77075416", "0.77075416", "0.76990044", "0.767134", "0.7641934", "0.7529619", "0.7150072", "0.71093875", "0.7002335", "0.7000758", "0.6994188", "0.69290036", "0.69209105", "0.6887981", "0.6861571", "0.6861571", "0.6849569", "0.684395", "0.6810813"...
0.7744766
1
Returns the question configuration item for this query.
def question(self): return self.details[KEY_QUESTION]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_question(self):\n question = self.raw_question\n if question is not None:\n return {\n \"question\": self.raw_question\n }", "def get_item(self, key):\n return self.config[key] if key in self.config.keys() else None", "def get_current_question(s...
[ "0.6725646", "0.6343248", "0.6231551", "0.62013745", "0.5762635", "0.5752337", "0.5736601", "0.5728157", "0.5649923", "0.5638383", "0.5637754", "0.5636276", "0.56350523", "0.56283134", "0.55637985", "0.5533542", "0.5525235", "0.55054075", "0.5498197", "0.5498197", "0.5478393"...
0.68976724
0
Returns the summary configuration item for this query.
def query_summary(self): return self.details[KEY_QUERY_SUMMARY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\n if hasattr(self,\"_summary\"):\n return self._summary\n else:\n return {}", "def getSummary(self):\n return self.base.get(\"summary\", [])", "def getSummary(self):\n return self.summary", "def summary(self) -> str:\n return pulumi....
[ "0.694487", "0.6819714", "0.68172693", "0.6718434", "0.66479325", "0.66479325", "0.66479325", "0.66479325", "0.66479325", "0.66479325", "0.66479325", "0.66351444", "0.65762407", "0.6470729", "0.6427356", "0.63207453", "0.62939316", "0.6261002", "0.6137292", "0.60124767", "0.5...
0.7261878
0
Fills in the target_query attribute with observable value and time specification for correlation.
def build_target_query(self, observable: Observable, **kwargs) -> None: # XXX for some reason the self.target_query is getting cached when the same module runs for the same analysis # for different observables if '<O_VALUE>' not in self.target_query: self._reload_target_query() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_target_query_timespec(self, start_time: str or datetime.datetime, stop_time: str or datetime.datetime) -> None:\n pass", "async def test_transaction_specific_response_time_target(self):\n self.set_source_parameter(\"transaction_specific_target_response_times\", [\"[Bb]ar:150\"])\n r...
[ "0.604419", "0.53452486", "0.52948", "0.5195184", "0.5151387", "0.51285744", "0.5099029", "0.5069341", "0.5056171", "0.50234467", "0.5007837", "0.49828333", "0.4980737", "0.4980737", "0.4980737", "0.49167588", "0.49151227", "0.4892735", "0.4863999", "0.4849976", "0.484692", ...
0.75333405
0
Cycle through result keys in order to extract mapped observables and add to alert. REQUIRED in order to 'automatically' add observables from field mapping reccomended to use in self.query_results. Includes a call for each extracted observable to the optional process_field_mapping, which will simply pass if unimplemente...
def extract_result_observables(self, analysis, result: dict, observable: Observable = None, result_time: str or datetime.datetime = None) -> None: for result_field in result.keys(): if result[result_field] is None: continue # do we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_field_mapping(self, analysis, observable: Observable, result, result_field, result_time=None) -> None:\n pass", "def process_query_results(self, query_results: dict or list, analysis, observable: Observable) -> None:\n pass", "def handle_result(self, results: List[Dict], **info):\n ...
[ "0.69729936", "0.63311803", "0.53645015", "0.5282289", "0.525873", "0.5136312", "0.5067871", "0.50671", "0.506112", "0.50556207", "0.5048589", "0.500648", "0.4995515", "0.49854666", "0.4978949", "0.49533278", "0.49402848", "0.48627585", "0.4818297", "0.4792701", "0.4790801", ...
0.73603886
0
Called for each observable value added to analysis. Returns the observable value to add to the analysis. By default, the observable_value is returned asis.
def filter_observable_value(self, result_field, observable_type, observable_value): return observable_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation_value(self):\n pass", "def return_value(value) -> ObservableBase:\n from ..operators.observable.returnvalue import return_value\n return return_value(value)", "def value(self, observation, input_actions=None):\n action, value = self(observation, input_actions)\n r...
[ "0.6367385", "0.59634846", "0.59626716", "0.5945809", "0.57399595", "0.5591523", "0.5574882", "0.5561304", "0.5561304", "0.5561304", "0.5505398", "0.5402143", "0.53939724", "0.53933454", "0.5378962", "0.53695613", "0.5364363", "0.53551453", "0.53331333", "0.53300166", "0.5328...
0.60311365
1
Fills in query time specification dummy strings, such as and or Adjusts the timezone and formatting of start_time and stop_time variables initialized in build_target_query as needed and replaces the dummy variables in configured query.
def fill_target_query_timespec(self, start_time: str or datetime.datetime, stop_time: str or datetime.datetime) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepareQuery(self, qid):\r\n \r\n connection = self.getConnection()\r\n cursor = connection.cursor()\r\n\r\n if self.granularity == 'day':\r\n extractTime = \"TO_CHAR(t.START_DATE, 'yyyy,mm,dd'), TO_CHAR(t.END_DATE, 'yyyy,mm,dd')\"\r\n elif self.granularity == 'yea...
[ "0.6397164", "0.5582921", "0.552272", "0.5454462", "0.54289496", "0.5377006", "0.5312675", "0.5311064", "0.5248024", "0.5233668", "0.52072245", "0.5175267", "0.51748633", "0.5169004", "0.5168347", "0.51603746", "0.5153136", "0.513233", "0.5115868", "0.50992113", "0.50686836",...
0.72575843
0
Process the query results returned from execute_query. Suggestions for use here would be iterating through query results in order to build analysis results, add observables (use extract_result_observables if you have a mapping, etc.
def process_query_results(self, query_results: dict or list, analysis, observable: Observable) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, results):\n raise NotImplementedError", "def handleQuery(self,query):\n results = None\n return results", "def _process_results(self, timestamp, results):\n\n topic_value = self.create_topic_values(results)\n\n _log.debug('Processing Results!')\n ...
[ "0.73964363", "0.7046268", "0.69759685", "0.6945569", "0.6538649", "0.6538649", "0.65130275", "0.6506455", "0.6459518", "0.6354048", "0.6343065", "0.63208896", "0.63202345", "0.6278921", "0.6225547", "0.62215114", "0.62137306", "0.6207395", "0.6198005", "0.6193059", "0.618145...
0.81553155
0
(Optional) Called each time an observable is created from the observablefield mapping. The idea of this method is to perform any additional processing when an observable is extracted based off of a field
def process_field_mapping(self, analysis, observable: Observable, result, result_field, result_time=None) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, collection, field):\n pass", "def extract_result_observables(self, analysis, result: dict, observable: Observable = None, result_time: str or datetime.datetime =\n None) -> None:\n for result_field in result.keys():\n if result[re...
[ "0.58540356", "0.5765759", "0.5707929", "0.5624119", "0.55814207", "0.5354908", "0.51964396", "0.5195021", "0.50517035", "0.4980307", "0.49428532", "0.49420545", "0.4938556", "0.49383038", "0.49340662", "0.4906365", "0.49007678", "0.4898083", "0.48704743", "0.48574975", "0.48...
0.7088125
0
Analysis module execution. See base class for more information. In order for this method to run as expected, all required methods must be implemented in child classes (see BaseAPIAnalyzer docstring). This method may be overridden if analysis 'flow' must be drastically different (ex. executing and correlating using mult...
def execute_analysis(self, observable, **kwargs) -> bool or Analysis: analysis = observable.get_analysis(self.generated_analysis_type, instance=self.instance) if analysis is None: analysis = self.create_analysis(observable) analysis.question = self.config['question'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.run_measurement()\n self.run_analysis()\n self.results = self.analysis.proc_data_dict['analysis_params_dict']\n if self.get_param_value('update'):\n self.run_update()\n self.dev.update_cancellation_params()\n\n if self.get_param_value('...
[ "0.62735236", "0.60627526", "0.59651273", "0.5931442", "0.5895053", "0.5891176", "0.5891176", "0.5877689", "0.5872152", "0.58661216", "0.58206034", "0.57702005", "0.57657474", "0.5761147", "0.5748475", "0.5739148", "0.57294863", "0.5725235", "0.5660845", "0.56297", "0.56297",...
0.6239604
1
Mapping dialogue state, which contains the history utterances and informed/requested slots up to this turn, into vector so that it can be fed into the model. This mapping function uses informed/requested slots that user has informed and requested up to this turn .
def state_to_representation_last(self, state): # Current_slots rep. current_slots = copy.deepcopy(state["current_slots"]["inform_slots"]) current_slots.update(state["current_slots"]["explicit_inform_slots"]) current_slots.update(state["current_slots"]["implicit_inform_slots"]) cu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_state_representation(self, state):\n\n user_action = state['user_action']\n current_slots = state['current_slots']\n agent_last = state['agent_action']\n\n ########################################################################\n # Create one-hot of acts to represe...
[ "0.640888", "0.566024", "0.5613271", "0.5596102", "0.5474696", "0.54214483", "0.5382502", "0.52699685", "0.52173156", "0.51859146", "0.51858324", "0.51645875", "0.51623684", "0.5160781", "0.5158822", "0.51578665", "0.51083446", "0.51068085", "0.50694966", "0.5061151", "0.5055...
0.5790193
1
Building the Action Space for the RLbased Agent. All diseases are treated as actions.
def _build_action_space(self): feasible_actions = [] # Adding the inform actions and request actions. for slot in sorted(self.slot_set.keys()): feasible_actions.append({'action': 'request', 'inform_slots': {}, 'request_slots': {slot: dialogue_configuration.VALUE_UNKNOWN},"explicit_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildActionSpace(self):\n self.action_types = self.AGENT_TYPES\n self.action_space = Dict({\n \"action\": Discrete(len(self.AGENT_TYPES)), \n })\n self.action_space.shape = (len(self.action_types),)", "def set_up_discrete_action_space(self):\n self.action_list = ...
[ "0.79722804", "0.66439545", "0.646315", "0.6356318", "0.6356318", "0.63392097", "0.6334569", "0.63179284", "0.62124294", "0.6210738", "0.62058586", "0.6205503", "0.6194105", "0.6186956", "0.6137761", "0.613573", "0.6117709", "0.60733235", "0.60228527", "0.6015301", "0.6004433...
0.68322915
1
I'm the 'api' property.
def api(self): return self._api
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api(self):\n return self.__api", "def get_api(self):\n return self.api", "def api(self):\n return self._api", "def api(self):\n return self._api", "def api(self):\n return self._api", "def api(self):\n return self._api", "def api(self) -> str:", "def api(...
[ "0.764146", "0.7558748", "0.74769485", "0.74769485", "0.74769485", "0.74769485", "0.7213842", "0.70904386", "0.708594", "0.7075687", "0.69147086", "0.67615086", "0.67615086", "0.664098", "0.6583839", "0.65325695", "0.64373815", "0.64355713", "0.6426633", "0.6384219", "0.63284...
0.7629988
1
Calculate pairwise diversity given a list of genotype calls. Returns 0 for a monomorphic site, or sites with only one nonmissing call.
def pairwise_diversity(calls): # Count up the number of reference and alternate genotypes. if 0 in calls: ref_count = calls.count(0) else: return 0 if 1 in calls: alt_count = calls.count(1) else: return 0 # This sample size will change depending on how many no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairwise_diversity(self, samples=None):\n if samples is None:\n samples = self.samples()\n return float(\n self.diversity(\n [samples], windows=[0, self.sequence_length], span_normalise=False\n )[0]\n )", "def _coverage_of_diploid_alleles(\...
[ "0.58707273", "0.5370491", "0.5241782", "0.5118214", "0.50946355", "0.5012713", "0.49800998", "0.49774712", "0.49727434", "0.49480033", "0.49466312", "0.4924413", "0.4903285", "0.4879957", "0.4876379", "0.48494408", "0.48436004", "0.484338", "0.48357964", "0.4832953", "0.4831...
0.82642967
0
Read a VCF, and calculate pairwise diversity for each site. Returns a a dictionary with genomic coordinate as key and pairwise diversity as the value.
def read_vcf(vcf): vcfdata = {} with open(vcf, 'r') as f: for line in f: if line.startswith('#'): continue else: tmp = line.strip().split() pos = int(tmp[1]) sample_info = tmp[9:] # Get the genotype...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_vc(mdf, genomecol, vccol, verbose=False):\n vc = {}\n with open(mdf, 'r') as fin:\n for li in fin:\n p = li.strip().split(\"\\t\")\n vc[p[genomecol]] = p[vccol]\n if verbose:\n sys.stderr.write(f\"Found {len(vc)} virus clusters in {mdf}\\n\")\n return vc", ...
[ "0.55010855", "0.5443325", "0.5411451", "0.5253437", "0.52351487", "0.5203242", "0.51977223", "0.51912194", "0.51445794", "0.5135873", "0.5078174", "0.507168", "0.5062789", "0.50090235", "0.50023085", "0.4940941", "0.4905916", "0.48750815", "0.48076475", "0.47970852", "0.4771...
0.6337871
0
Read a BED file, and for each interval, calculate the average pairwise diversity in it. Prints the interval start, end, and the average pairwise diversity.
def calc_div_bed(vcfdata, bed): avg_pairwise_divs = [] with open(bed, 'r') as f: for line in f: tmp = line.strip().split() # Add 1 to the end, for 0-based BED coords start = int(tmp[1]) end = int(tmp[2]) # Some intervals are of 0 length - r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseBed(fname):\n \n handle=open(fname,'r')\n for line in handle:\n if line.startswith(\"#\"):\n continue\n if line.startswith(\"track\") or line.startswith(\"browser\"):\n continue\n vals=line.rstrip().split(\"\\t\")\n chr = vals[0]\n start = ...
[ "0.58007795", "0.5407008", "0.52349705", "0.5167778", "0.51037353", "0.5056159", "0.5043961", "0.5008997", "0.49668044", "0.49005035", "0.48916578", "0.48865697", "0.48817754", "0.48588818", "0.48307395", "0.48247167", "0.48014796", "0.4761774", "0.47577602", "0.47458568", "0...
0.70150334
0
This preforms the second strategy, chooses a random envelope for you.
def perform_strategy(self): number = randint(0, 111) myEnvelope = self._envelopeList[number] print(myEnvelope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_envelope_routed(self):\n addr_1 = self.connection_client_1.address\n addr_2 = self.connection_client_2.address\n\n msg = DefaultMessage(\n dialogue_reference=(\"\", \"\"),\n message_id=1,\n target=0,\n performative=DefaultMessage.Performativ...
[ "0.5605532", "0.5605532", "0.5256275", "0.5127899", "0.5127899", "0.50189346", "0.50167304", "0.5000255", "0.495632", "0.49257392", "0.48593804", "0.4853922", "0.48520026", "0.48400712", "0.48328158", "0.48325053", "0.47939473", "0.47607374", "0.47501016", "0.47105208", "0.46...
0.7433414
0
Combine results into single dataframe and save to disk as .csv file
def save_results(self): results = pd.concat([ pd.DataFrame(self.IDs.cpu().numpy(), columns= ['ID']), pd.DataFrame(self.predicted_labels.cpu().numpy(), columns= ['predicted_label']), pd.DataFrame(self.correct_predictions.cpu().numpy(), columns= ['correct_prediction']), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_results(self, path):\n pd.DataFrame(self.results).to_csv(path)", "def save_combined_clean_data(self):\n df = []\n for data in self.clean_data:\n df.append(data.df)\n df = pd.concat(df, axis=0, join='outer', ignore_index=False, keys=None,\n leve...
[ "0.7109894", "0.7028306", "0.7024764", "0.69350445", "0.6878669", "0.6859569", "0.6832618", "0.6804342", "0.6681769", "0.66685516", "0.6637697", "0.660774", "0.6546744", "0.65395343", "0.65183043", "0.65171605", "0.6508093", "0.6489798", "0.6484335", "0.647765", "0.64603716",...
0.7250397
0
Starts the add command and prompts user for a category
def command_add(message, bot): chat_id = message.chat.id user_bills['user_telegram_id'] = chat_id markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) markup.row_width = 2 for c in spend_categories: markup.add(c) markup.add("Cancel") msg = bot.reply_to(message, 'Select Category...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_category():\n if request.method == 'POST':\n result = USERS[session['username']].add_recipe_category(\n request.form['title'])\n if result == 'recipe_category added':\n flash(result, 'info')\n else:\n flash(result, 'warning')\n return redirect...
[ "0.67735505", "0.67442906", "0.66510326", "0.66429573", "0.6636363", "0.662902", "0.6562078", "0.6550507", "0.6453305", "0.645305", "0.640512", "0.6403172", "0.6363379", "0.63466406", "0.6299047", "0.6298222", "0.62930804", "0.6286906", "0.6272263", "0.62220436", "0.6192982",...
0.7265265
0
Asks user if the user wants to split the bill with another user
def get_sharing_details(message, bot): markup = types.ReplyKeyboardMarkup(one_time_keyboard=True) markup.row_width = 3 markup.add("Yes") markup.add("No") markup.add("Cancel") bot.send_message(message.chat.id, 'Do you want to split this bill with any other users?', reply_markup=markup) bot.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_user():\r\n while True:\r\n if bj.player1.double_down is True and bj.player1.split is True and bj.player1.went_split is False:\r\n p_choice = input(\"Hit, Stand, Double Down or Split?\\n\")\r\n if p_choice != \"hit\" and p_choice != \"stand\" ...
[ "0.5349768", "0.5122272", "0.51155144", "0.5085779", "0.5071575", "0.5061397", "0.5043871", "0.49912462", "0.49727002", "0.4970632", "0.4967183", "0.49505353", "0.4948263", "0.4942679", "0.49339795", "0.49235326", "0.492086", "0.49188274", "0.4916647", "0.49121168", "0.491185...
0.552782
0
Template method for executing the command.
def execute_command(self): raise Exception("Not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_command(self, **kwargs):\n return self.run_command(**kwargs)", "def execute(self) :\n \n raise NotImplementedError()", "def execute(self):\r\n pass", "def execute_command(self, command):\n raise NotImplementedError", "def execute(self):\n pass", "def...
[ "0.7968591", "0.7832499", "0.77924705", "0.77703875", "0.7767006", "0.7767006", "0.7767006", "0.7767006", "0.7767006", "0.7767006", "0.77667135", "0.77667135", "0.77667135", "0.77667135", "0.77194923", "0.77103496", "0.77051127", "0.7691909", "0.768377", "0.7665118", "0.76651...
0.8045764
0
Get the detections from the model using the generator.
def _get_detections(args, generator, model, score_threshold=0.05, max_detections=100, save_path=None): all_detections = [[None for i in range(generator.num_classes()) if generator.has_label(i)] for j in range(generator.size())] detection_out = np.zeros([generator.size(),512,512,3]) # detection_out = np.zer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_detections(self):\n self.rescue_model.setInput(self.human_blob)\n self.predictions = self.rescue_model.forward()", "def get_detections(self):\n frame = self.get_still()\n return detector.process_frame(frame, False)", "def extract_face_detections(self):\n self.dete...
[ "0.6862919", "0.65428936", "0.6540743", "0.63694745", "0.62906307", "0.6126367", "0.6088731", "0.60303426", "0.6010036", "0.59128106", "0.5887276", "0.58750725", "0.58260036", "0.58221745", "0.58056706", "0.5803134", "0.5769824", "0.5766133", "0.5759714", "0.5739925", "0.5706...
0.7306675
0
Logger name of this loggable object.
def logger_name(self): return self.__class__.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_name(self) -> Optional[str]:\n return self._log_name", "def logPrefix(self):\n return self.__class__.__name__", "def logger_name( self ):\n return Constants.LogKeys.steps", "def log_group_name(self) -> str:\n return jsii.get(self, \"logGroupName\")", "def log_group_name(...
[ "0.7734195", "0.74924845", "0.74675226", "0.7257177", "0.7257177", "0.71899426", "0.70215774", "0.69762486", "0.69282496", "0.6895209", "0.6883889", "0.68143374", "0.67916155", "0.67857605", "0.6767836", "0.6763246", "0.66945565", "0.6686084", "0.66589147", "0.6648707", "0.66...
0.8728791
0
Plots the sample cost and rate of a given fault over the injection times defined in the app sampleapproach
def samplecost(app, endclasses, fxnmode, samptype='std', title=""): associated_scens=[] for phase in app.phases: associated_scens = associated_scens + app.scenids.get((fxnmode, phase), []) costs = np.array([endclasses[scen]['cost'] for scen in associated_scens]) times = np.array([time for phase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\r\n dt = m.get_instance().dt\r\n self.perception_history = m.get_instance().larvae[0].history\r\n t = np.arange(0,len(self.perception_history)*dt,dt)\r\n plt.plot(t,self.perception_history)\r\n plt.title('Perception History')\r\n plt.xlabel('Time (s)')\r\n ...
[ "0.58707404", "0.58563536", "0.58295834", "0.5811372", "0.58079165", "0.57968676", "0.57574296", "0.5750948", "0.57313925", "0.57307285", "0.57214856", "0.5688989", "0.56813246", "0.5665063", "0.5632812", "0.5622377", "0.5619761", "0.56086326", "0.5604528", "0.56001186", "0.5...
0.5999519
0
Plots the total cost or total expected cost of faults over time.
def costovertime(endclasses, app, costtype='expected cost'): costovertime = cost_table(endclasses, app) plt.plot(list(costovertime.index), costovertime[costtype]) plt.title('Total '+costtype+' of all faults over time.') plt.ylabel(costtype) plt.xlabel("Time ("+str(app.units)+")") plt.grid()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cost(self):\n steps = np.arange(len(self.cost_values))\n plt.plot(steps, self.cost_values, '-o')\n plt.xlabel(\"Steps\")\n plt.ylabel(\"Cost value\")\n plt.title(\"Cost value per step using Gradient Descent\")\n plt.show()", "def plot_costs(j_history):\n plt....
[ "0.66773504", "0.6464759", "0.641111", "0.63844514", "0.62017936", "0.6200148", "0.6091807", "0.60301834", "0.59970903", "0.59831995", "0.5969821", "0.59258425", "0.58940935", "0.5876098", "0.5858264", "0.5832031", "0.58274806", "0.58000296", "0.5795744", "0.5789539", "0.5778...
0.7189957
0
Clean seleniumwire captured requests to avoid later, after many get, accumulated too much requests
def cleanCapturedRequests(driver): # driver.requests = None if hasattr(driver, "requests"): del driver.requests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancelRequests(self):\n self.get_bmc_website()\n self.__cancelMyRequest = Cancel(self.browser)\n self.__cancelMyRequest.cancelRequest()", "def _invalidate_http_cache(self):\n self._requests_cache = {}", "def reset_all_requests(self):\n self._send_request(\"/reset\")", "...
[ "0.5872074", "0.5758299", "0.5635539", "0.560575", "0.560575", "0.55663204", "0.55220544", "0.54572016", "0.54330814", "0.54221976", "0.5397869", "0.5388094", "0.53824675", "0.5355474", "0.53215826", "0.531101", "0.5293863", "0.5293863", "0.5276583", "0.52676547", "0.52650756...
0.8178762
0
Override default values for random initial topic assignment, set to "seed" instead.
def set_seed(self,seed): assert seed.dtype==np.int and seed.shape==(self.N,) self.topic_seed = seed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_seed(self,seed):\n\n\t\tassert seed.dtype==np.int and seed.shape==(self.samples,self.N)\n\t\tself.topic_seed = seed", "def initialize(self, number_of_topics, random=False):\n print(\"Initializing...\")\n\n self.initialize_randomly(number_of_topics)\n\n #print(\"pi\", self.document_to...
[ "0.7856412", "0.6859348", "0.6736005", "0.6576959", "0.6419191", "0.6385298", "0.6314003", "0.6161125", "0.61501825", "0.6149955", "0.61064327", "0.6061132", "0.60445714", "0.6027036", "0.6016285", "0.60146075", "0.5998351", "0.599772", "0.5957093", "0.59457964", "0.59443516"...
0.7798357
1
Compute termtopic matrix from sampled_topics.
def tt_comp(self,sampled_topics): samples = sampled_topics.shape[0] tt = np.zeros((self.V,self.K,samples)) for s in xrange(samples): tt[:,:,s] = samplers_lda.tt_comp(self.tokens, sampled_topics[s,:], self.N, self.V, self.K, self.beta) return tt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topic_matrix(self):\n print('get topic matrix')\n\n topic_words_dict = self.config['topic_words']\n\n topic_matrix = np.empty((0, self.wordvec.embedding_dim))\n\n topic_id = 0\n for topic in topic_words_dict.keys():\n topic_words = topic_words_dict[topic]\n ...
[ "0.7314734", "0.64872533", "0.64799446", "0.63049644", "0.6254123", "0.62255585", "0.61655533", "0.6160577", "0.61441", "0.6136241", "0.60976034", "0.6075077", "0.60740954", "0.6068708", "0.6040718", "0.60375553", "0.6037457", "0.60017866", "0.5994458", "0.59844494", "0.59823...
0.6976323
1
Compute perplexity for each sample.
def perplexity(self): return samplers_lda.perplexity_comp(self.docid,self.tokens,self.tt,self.dt,self.N,self.K,self.samples)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perplexity(self):\n raise NotImplementedError(\"To be implemented\")", "def perplexity(self, sents):\n return 2 ** self.cross_entropy(sents)", "def perplexity(self, sents):\n # total words seen\n M = 0\n for sent in sents:\n M += len(sent)\n # cross-entr...
[ "0.8005421", "0.7128528", "0.69695795", "0.68535006", "0.6853017", "0.6775191", "0.67121816", "0.668699", "0.65877926", "0.65655065", "0.6539731", "0.6510954", "0.64906204", "0.64209616", "0.6399191", "0.6285764", "0.62789685", "0.6167774", "0.60993886", "0.60989195", "0.6094...
0.7709719
1
Keep subset of samples. If index is an integer, keep last N=index samples. If index is a list, keep the samples corresponding to the index values in the list.
def samples_keep(self,index): if isinstance(index, (int, long)): index = range(self.samples)[-index:] self.sampled_topics = np.take(self.sampled_topics,index,axis=0) self.tt = np.take(self.tt,index,axis=2) self.dt = np.take(self.dt,index,axis=2) self.samples = len(index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _index_select_nd(source: torch.Tensor, index: torch.Tensor) -> torch.Tensor:\n index_size = index.size() # (num_atoms/num_bonds, max_num_bonds)\n suffix_dim = source.size()[1:] # (hidden_size,)\n final_size = index_size + suffix_dim # (num_atoms/num_bonds, max_num_bonds, hidden_size)\n\n target ...
[ "0.60203993", "0.59574664", "0.5886324", "0.5867899", "0.5816982", "0.57350016", "0.5727632", "0.5652907", "0.56261337", "0.56184375", "0.56039095", "0.5409709", "0.53960425", "0.5390497", "0.5389218", "0.5389218", "0.5365618", "0.5363418", "0.535475", "0.53461355", "0.533737...
0.7132457
0
Compute average termtopic matrix, and print to file if print_output=True.
def tt_avg(self, print_output=True, output_file = "tt.csv"): avg = self.tt.mean(axis=2) if print_output: np.savetxt(output_file, avg, delimiter = ",") return avg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic_content(self,W,output_file = \"topic_description.csv\"):\n\n\t\ttopic_top_probs = []\n\t\ttopic_top_words = []\n\n\t\ttt = self.tt_avg(False)\n\n\t\tfor t in xrange(self.K):\n\t\t\ttop_word_indices = tt[:,t].argsort()[-W:][::-1]\n\t\t\ttopic_top_probs.append(np.round(np.sort(tt[:,t])[-W:][::-1],3))\n\t\t...
[ "0.5921104", "0.57090473", "0.56463623", "0.55301774", "0.54683155", "0.54337686", "0.53767115", "0.5324321", "0.52994114", "0.52380234", "0.52355903", "0.52273804", "0.51805234", "0.51471543", "0.5144186", "0.5143176", "0.5133842", "0.51320434", "0.51258814", "0.5087141", "0...
0.6552503
0
Override default values for random initial topic assignment, set to "seed" instead. seed is 2d array (number of samples in LDA model x number of tokens in LDA model)
def set_seed(self,seed): assert seed.dtype==np.int and seed.shape==(self.samples,self.N) self.topic_seed = seed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_seed(self,seed):\n\n\t\tassert seed.dtype==np.int and seed.shape==(self.N,)\n\t\tself.topic_seed = seed", "def initialize(self, number_of_topics, random=False):\n print(\"Initializing...\")\n\n self.initialize_randomly(number_of_topics)\n\n #print(\"pi\", self.document_topic_prob)\n ...
[ "0.79058135", "0.7000231", "0.6963045", "0.6539895", "0.64373744", "0.63780665", "0.63570637", "0.63285434", "0.6327561", "0.63219947", "0.63108164", "0.6261182", "0.6256775", "0.62072074", "0.6185912", "0.6178263", "0.61493504", "0.6143526", "0.6107175", "0.61040074", "0.608...
0.80255085
0
Query docs with query_samples number of Gibbs sampling iterations.
def query(self,query_samples): self.sampled_topics = np.zeros((self.samples,self.N), dtype = np.int) for s in xrange(self.samples): self.sampled_topics[s,:] = samplers_lda.sampler_query(self.docid, self.tokens, self.topic_seed, np.ascontiguousarray(self.tt[:,:,s], dtype=np.float), self.N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(self, n_samples):", "def generate_samples(self, n_samples):", "def test_search_samples(self):\n self.login()\n\n page_size = 20\n query = 'batch8'\n\n # hit the API endpoint\n data = {'q': query,\n 'page': 1,\n 'page_size': p...
[ "0.6119865", "0.6119865", "0.6033776", "0.59654444", "0.59214705", "0.5798614", "0.56682414", "0.5615993", "0.5610056", "0.5603541", "0.55298346", "0.55129606", "0.5500481", "0.5475288", "0.5471387", "0.5451142", "0.5441666", "0.5428866", "0.539851", "0.5390029", "0.53861856"...
0.64173937
0
param observation nparray with shape (n, windowobs_dim) return observation nparray with shape(n, disc_dim)
def get_disc_obs(self, observation): temp = [self.convertToMocap(s.reshape((self.disc_window, -1))).reshape(-1) for s in observation] return np.asarray(temp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation(self, obs):\n\n# import pdb;pdb.set_trace()\n return np.moveaxis(obs, 2, 0)", "def observation_space():", "def observation_func(\n self,\n state: np.ndarray,\n observation_noise: Optional[np.ndarray] = None,\n control_vect: Optional[np.n...
[ "0.6400762", "0.6013691", "0.58461124", "0.564084", "0.55929255", "0.5563894", "0.55621684", "0.54093623", "0.5378842", "0.53710353", "0.5322694", "0.52799237", "0.5259906", "0.5259592", "0.52363986", "0.52172846", "0.5196161", "0.5196161", "0.5165882", "0.51658237", "0.51658...
0.72958225
0
Tested on Inception and MobileNet Please edit model_file to suit your model pb file and label_file to specify your label text file Please see function "detectGate" for further customization.
def addOpenFile(): model_file = "mobile_graph.pb" label_file = "mobile_labels.txt" graph = load_graph(model_file) filename = filedialog.askopenfilename(initialdir="/",title="Select File",filetypes=[("JPEG Files",".jpeg .jpg")]) print("Selected file: %s" % filename) image = ImageTk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detectGate(graph,label_file,file_name):\n input_height = 192\n input_width = 192\n input_mean = 0\n input_std = 255\n input_layer = \"Placeholder\"\n output_layer = \"final_result\"\n \n \n \n\n \n\n \n t = read_tensor_from_image_file(\n file_name,\n input_height=input_height,\n input_...
[ "0.68174416", "0.62827706", "0.5758899", "0.5696043", "0.56804377", "0.5678108", "0.5578127", "0.5561133", "0.5548295", "0.55313677", "0.5493445", "0.5478988", "0.5474024", "0.5455986", "0.54302204", "0.54249835", "0.54225004", "0.54104656", "0.5408392", "0.5408276", "0.53971...
0.6969177
0
Rule for the definition of "available quantity" based on 1 quant object.
def qty_available(quant) -> float: return quant.quantity - quant.reserved_quantity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_product_quantity(item, qty):\n return True", "def sum_availability(val, quant) -> float:\n return val + qty_available(quant)", "def availability(self):\n # TODO: These lookups are highly inefficient. However, we'll wait with optimizing\n # until Django 1.8 is released, as the f...
[ "0.66404766", "0.6625551", "0.65198964", "0.6518039", "0.6365163", "0.63387996", "0.6244827", "0.6101653", "0.6098047", "0.607263", "0.5913213", "0.58860075", "0.5862092", "0.5858698", "0.5850056", "0.5831736", "0.5807448", "0.5775316", "0.5773819", "0.5766712", "0.57523704",...
0.77095944
0
Filter function that flags untracked quants to be filtered.
def filter_untracked(quant) -> bool: return quant.lot_id is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, *q, **kwargs):\n return self._filter_or_exclude(*q, **kwargs)", "def filter_tracked(self, queryset, name, value):\n q_batch = Q(batch=None) | Q(batch='')\n q_serial = Q(serial=None) | Q(serial='')\n\n if str2bool(value):\n return queryset.exclude(q_batch & ...
[ "0.6373299", "0.624071", "0.6236699", "0.60885334", "0.6035009", "0.5997121", "0.596575", "0.5934492", "0.5920947", "0.59118086", "0.58876425", "0.58635277", "0.5812935", "0.5790246", "0.5780941", "0.57521236", "0.57398605", "0.5689652", "0.5659296", "0.5656991", "0.5649688",...
0.6342002
1
Returns a list of available quantities based on a tracking status. Without tracking all of the quantities are summed together. With tracking the quantities are summed per lot. This does not provide mapping between the quantities and the lot numbers. Use the quantities_per_lot() function for that. availability_by_tracki...
def availability_by_tracking(tracking, quants) -> List[float]: if tracking == "none": return [reduce(sum_availability, quants, 0)] return list(quantities_per_lot(quants).values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantities_available(quantities):\n available = []\n for q in quantities:\n available.append(quantity_available(q))\n return available", "def sum_availability(val, quant) -> float:\n return val + qty_available(quant)", "def high_availability(self):\n from django.db import connecti...
[ "0.59363973", "0.5828805", "0.54700196", "0.5159181", "0.5094753", "0.5089247", "0.50791717", "0.5024315", "0.48572624", "0.48141047", "0.47759804", "0.475829", "0.47470802", "0.47466728", "0.47046915", "0.4694997", "0.46340385", "0.45999828", "0.4578999", "0.45616272", "0.45...
0.86029047
0
minimax is a recursive function that uses the current node to search children nodes until a leaf is found. The function keeps track of the alpha and beta variables as it traverses through the tree. When a leaf node is found the leaf_nodes variable is updated to keep track of the number of leafs examined.
def minimax(node, isMaximizingPlayer, alpha, beta): if node.name.isdigit(): # leaf nodes contain numbers not letters global leaf_nodes leaf_nodes += 1 return int(node.name) if isMaximizingPlayer: # max node bestVal = -math.inf for child in node.children: va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimax(node: GameState, depth: int, alpha: int, beta: int, maximizingPlayer: bool):\n\n # static evaluation of a GameState if at the bottom of the tree\n if depth == 0:\n node.buildGameStateFromID()\n if node.possible:\n node.compute_score()\n return node.score\n\n # r...
[ "0.73440564", "0.7331566", "0.7307859", "0.69187623", "0.6834855", "0.68207544", "0.66435844", "0.65970844", "0.65479726", "0.6534145", "0.64557296", "0.6412116", "0.63775927", "0.63698417", "0.6361018", "0.6336017", "0.6331006", "0.63172877", "0.62967336", "0.6285531", "0.62...
0.7741564
0
Add callback which will be called after reconnect.
def add_reconnect_callback(self, callback: Callable[[], None]) -> None: self._on_reconnect_callbacks.add(callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_connect(self):\n pass", "def callback_connect(self):\n pass", "def callback_connect(self):\n pass", "def register_connect_changed_callback(self, callback=None):\r\n return self._arm.register_connect_changed_callback(callback=callback)", "def add_on_connection_close_...
[ "0.74931026", "0.74931026", "0.74931026", "0.69970465", "0.6915597", "0.6901249", "0.6890013", "0.6638505", "0.6606058", "0.6539018", "0.6511781", "0.65081155", "0.64518017", "0.6449474", "0.6388555", "0.63857764", "0.6376846", "0.63707376", "0.6370163", "0.6357641", "0.63466...
0.84650695
0
Sets a consumption task for this connection and schedules it to run.
def set_and_schedule_consumption_task( self, consumption_task: Callable[[], Awaitable[None]] ) -> None: self._consumption_task = consumption_task if self._consumption_task: self._running_task = asyncio.ensure_future(self._consumption_task())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_task(self, task):\n # Check if current task is valid\n if not task.connect(self): # Check if task can be used\n return # Drop current task\n self.queue.put(task) # Add current task in schedule queue", "async def _start_cron_task(self):\n pas...
[ "0.5458914", "0.54185814", "0.53717726", "0.53485686", "0.5340436", "0.5327154", "0.5307498", "0.51731163", "0.51555216", "0.5129518", "0.51186925", "0.5094137", "0.5083912", "0.50817496", "0.50254023", "0.50215", "0.5017692", "0.4945982", "0.4923733", "0.48934317", "0.489142...
0.8098527
0
Paginate the results of the base query. We use limit/offset as the results need to be ordered by date and not the primary key.
def _paginate(cls, context, query): marker = int(context.marker or 0) limit = int(context.limit or CONF.metadatas_page_size) # order by 'updated DESC' to show the most recent metadatas first query = query.order_by(desc(DBMetadata.updated)) # Apply limit/offset query = que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate(self, page_size=20, **q_options):\n cursor = self._get_cursor(self.page, page_size, **q_options)\n results, cursor, more = self.query.fetch_page(page_size,\n start_cursor=cursor,\n *...
[ "0.7076282", "0.70332694", "0.7004154", "0.6953918", "0.687327", "0.68525463", "0.6833838", "0.67465377", "0.6690049", "0.664417", "0.65346265", "0.6503121", "0.6495013", "0.6476076", "0.6464674", "0.64421767", "0.6423931", "0.64225787", "0.6421544", "0.64159894", "0.63912034...
0.70889175
0
Split SubFind FOF groups into different subsets This includes the full FOF group, the main (background/central) subhalo, satellite subhaloes, and diffuse material This allows for more flexible comparison between other algorithms, which may include different subsets of particles in haloes and/or subhaloes
def splitSFgroups(halodata, pids_fof, coords_fof, vels_fof, pids, coords, vels, nhalo, nsubhalo): firstSub = halodata['Group/GroupFirstSub'] numSubs = halodata['Group/GroupNsubs'] group_offset = halodata['Group/GroupOffsetType'][:,1] group_npart = halodata['Group/GroupLen'] sub_npart = halodata['Subhalo/SubhaloLe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitVRdata(partdata, halodata, pids_halos, pids, coords, vels, nhalo, nsubhalo):\n\n\t# Arrays to hold different subsets of FOF group particles\n\tpids_background = np.array(pids_halos[:nhalo], dtype = 'object')\n\tcoords_background = np.empty(nhalo, dtype = 'object')\n\tvels_background = np.empty(nhalo, dtyp...
[ "0.6487616", "0.592714", "0.5788769", "0.5654306", "0.5585296", "0.55509764", "0.5434781", "0.543442", "0.5431795", "0.5424935", "0.54144394", "0.5367812", "0.53305584", "0.53304404", "0.52642953", "0.5258931", "0.522978", "0.5192073", "0.5165952", "0.51431376", "0.5128682", ...
0.76197255
0
Split VELOCIraptor FOF groups into different subsets This includes the full FOF group, the background (field) halo, and subhaloes This allows for more flexible comparison between other algorithms, which may include different subsets of particles in haloes and/or subhaloes
def splitVRdata(partdata, halodata, pids_halos, pids, coords, vels, nhalo, nsubhalo): # Arrays to hold different subsets of FOF group particles pids_background = np.array(pids_halos[:nhalo], dtype = 'object') coords_background = np.empty(nhalo, dtype = 'object') vels_background = np.empty(nhalo, dtype = 'object') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitSFgroups(halodata, pids_fof, coords_fof, vels_fof, pids, coords, vels, nhalo, nsubhalo):\n\n\tfirstSub = halodata['Group/GroupFirstSub']\n\tnumSubs = halodata['Group/GroupNsubs']\n\tgroup_offset = halodata['Group/GroupOffsetType'][:,1]\n\tgroup_npart = halodata['Group/GroupLen']\n\tsub_npart = halodata['S...
[ "0.77059865", "0.62634546", "0.5937793", "0.5880467", "0.58631194", "0.5844169", "0.5616146", "0.5584471", "0.55817026", "0.5554655", "0.5537077", "0.5516713", "0.5505204", "0.5493369", "0.5489576", "0.5452154", "0.5451404", "0.54258513", "0.5421155", "0.54158276", "0.5400885...
0.7033883
1
Extracts a single face image from a video sequence.
def extract_face(seq): img, locations = extract_image(seq) if img is None: # No frame with a face was found. return None else: # We found a frame with a face. # If there are multiple faces, choose the largest. loc = get_largest_face(locations) cropped = crop_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame(face_cc, video_capture, voice):\n if video_capture.isOpened():\n _, frame = video_capture.read()\n\n gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n\n try:\n faces = face_cc.detectMultiScale(\n gray,\n scaleFactor=1.1,\n minNeighbors=5,\n ...
[ "0.648261", "0.6263333", "0.6202552", "0.6190077", "0.61684835", "0.60556257", "0.5997593", "0.59863806", "0.59741646", "0.5964527", "0.594866", "0.5927054", "0.5911717", "0.590194", "0.5895345", "0.58833265", "0.5880981", "0.5844954", "0.5831536", "0.5815507", "0.58091724", ...
0.7714512
0