query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
A set of unicode strings the allowed usage of the key from the extended key usage extension.
def extended_key_usage(self): if self._extended_key_usage is None: return set() return set(self._extended_key_usage.native)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ext_key_usages(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"ext_key_usages\")", "def ext_key_usages(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"ext_key_usages\")", "def ext_key_usages(self) -> Optional[pulumi.Input[...
[ "0.7455842", "0.7374315", "0.7374315", "0.71024346", "0.6737492", "0.6654881", "0.6457139", "0.6399681", "0.6399681", "0.60323876", "0.591794", "0.58423394", "0.57243574", "0.5681344", "0.5556404", "0.5525818", "0.55181473", "0.54313207", "0.5347413", "0.5326456", "0.53208786...
0.7662352
0
Location of the certificate revocation list (CRL) for the certificate.
def crl_url(self): if self._crl_distribution_points is None: return None return self._get_crl_url(self._crl_distribution_points)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta_crl_url(self):\n\n if self._freshest_crl is None:\n return None\n\n return self._get_crl_url(self._freshest_crl)", "def getCRLNumber(self):\n\n return self.get_POW().getCRLNumber()", "def verify_crl(cert, path, validation_context, use_deltas=True, cert_description=None...
[ "0.60479736", "0.60283333", "0.59533787", "0.5584155", "0.5403625", "0.5297503", "0.5247908", "0.5099858", "0.47928554", "0.4789441", "0.47877467", "0.47574297", "0.47253102", "0.47195476", "0.4710957", "0.4671869", "0.46657896", "0.46578422", "0.4616067", "0.46016717", "0.45...
0.5565284
4
Location of the delta CRL for the certificate. Will be one of the
def delta_crl_url(self): if self._freshest_crl is None: return None return self._get_crl_url(self._freshest_crl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta_crl_distribution_points(self):\n\n if self._delta_crl_distribution_points is None:\n self._delta_crl_distribution_points = []\n\n if self.freshest_crl_value is not None:\n for distribution_point in self.freshest_crl_value:\n distribution_poin...
[ "0.6988407", "0.6318833", "0.6084879", "0.56201124", "0.5176203", "0.51518315", "0.50600994", "0.48365542", "0.48194048", "0.4758225", "0.47277874", "0.46993938", "0.46964672", "0.4641692", "0.46160996", "0.46053565", "0.46053565", "0.46053565", "0.46053565", "0.45939425", "0...
0.72536683
0
Grabs the first URL out of a asn1crypto.x509.CRLDistributionPoints object
def _get_crl_url(self, distribution_points): if distribution_points is None: return None for distribution_point in distribution_points: name = distribution_point['distribution_point'] if name.name == 'full_name' and name.chosen[0].name == 'uniform_resource_identifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crl_url(self):\n\n if self._crl_distribution_points is None:\n return None\n\n return self._get_crl_url(self._crl_distribution_points)", "def _make_crl_distribution_points(self, name, value):\n\n if value is None:\n return None\n\n is_tuple = isinstance(value...
[ "0.667195", "0.6278513", "0.5788191", "0.57319546", "0.5548122", "0.5375431", "0.53468317", "0.5276551", "0.5264446", "0.5262795", "0.5246713", "0.5246206", "0.519427", "0.5137729", "0.5130993", "0.5105424", "0.5057051", "0.5054585", "0.503951", "0.5028308", "0.5016119", "0...
0.7561168
0
Constructs an asn1crypto.x509.CRLDistributionPoints object
def _make_crl_distribution_points(self, name, value): if value is None: return None is_tuple = isinstance(value, tuple) if not is_tuple and not isinstance(value, str_cls): raise TypeError(_pretty_message( ''' %s must be a unicode string o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta_crl_distribution_points(self):\n\n if self._delta_crl_distribution_points is None:\n self._delta_crl_distribution_points = []\n\n if self.freshest_crl_value is not None:\n for distribution_point in self.freshest_crl_value:\n distribution_poin...
[ "0.54835486", "0.5322369", "0.5205519", "0.49923587", "0.48922306", "0.48400053", "0.4827509", "0.48133376", "0.4768135", "0.47563958", "0.47420117", "0.47342488", "0.46844715", "0.46796644", "0.46796644", "0.4675792", "0.46536493", "0.46308368", "0.46132258", "0.45735577", "...
0.6899878
0
Location of the OCSP responder for this certificate. Will be one of the
def ocsp_url(self): if self._authority_information_access is None: return None for ad in self._authority_information_access: if ad['access_method'].native == 'ocsp' and ad['access_location'].name == 'uniform_resource_identifier': return ad['access_location'].cho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_ocsp_server(self, cert_path):\n try:\n url, _err = util.run_script(\n [\"openssl\", \"x509\", \"-in\", cert_path, \"-noout\", \"-ocsp_uri\"],\n log=logger.debug)\n except errors.SubprocessError:\n logger.info(\"Cannot extract OCSP URI ...
[ "0.6131117", "0.5615289", "0.5481226", "0.52892077", "0.5258419", "0.5220536", "0.51888037", "0.51888037", "0.510542", "0.50266665", "0.5012942", "0.49867067", "0.49449998", "0.49422258", "0.49315235", "0.49149665", "0.49149665", "0.48778692", "0.48690465", "0.48679858", "0.4...
0.61559165
0
A bool if the certificate should have the OCSP no check extension. Only applicable to certificates created for signing OCSP responses. Such certificates should normally be issued for a very short period of time since they are effectively whitelisted by clients.
def ocsp_no_check(self, value): if value is None: self._ocsp_no_check = None else: self._ocsp_no_check = bool(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_own_cert(self):\n return os.path.isfile(self.get_own_cert_path())", "def _has_certs_in_ocsp_response(certs):\n global PYASN1_VERSION\n if PYASN1_VERSION <= 3000:\n return certs is not None\n else:\n return certs is not None and certs.hasValue() and certs[0].hasValue()", "d...
[ "0.6640712", "0.6638826", "0.64836407", "0.6184736", "0.60924083", "0.60924083", "0.6009329", "0.5859004", "0.5826376", "0.5821309", "0.57753557", "0.5768901", "0.5729878", "0.57177037", "0.5646141", "0.56311846", "0.56311846", "0.5621099", "0.5600893", "0.55848324", "0.55529...
0.6420999
3
Sets the value for an extension using a fully constructed asn1crypto.core.Asn1Value object. Normally this should not be needed, and the convenience attributes should be sufficient. See the definition of asn1crypto.x509.Extension to determine the appropriate object type for a given extension. Extensions are marked as cr...
def set_extension(self, name, value, allow_deprecated=False): extension = x509.Extension({ 'extn_id': name }) # We use native here to convert OIDs to meaningful names name = extension['extn_id'].native if name in self._deprecated_extensions and not allow_deprecated:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_extension(name, value, critical=0, _pyfree=1):\n if name == 'subjectKeyIdentifier' and \\\n value.strip('0123456789abcdefABCDEF:') is not '':\n raise ValueError('value must be precomputed hash')\n lhash = m2.x509v3_lhash()\n ctx = m2.x509v3_set_conf_lhash(lhash)\n x509_ext_ptr = m...
[ "0.6438263", "0.6328225", "0.6300037", "0.61802584", "0.6002731", "0.5839028", "0.5822578", "0.5822578", "0.57922786", "0.56969255", "0.5691874", "0.5555141", "0.55509424", "0.5463055", "0.53673494", "0.5295832", "0.52437776", "0.5206584", "0.51691777", "0.50493395", "0.49365...
0.73829615
0
Validates the certificate information, constructs the ASN.1 structure and then signs it
def build(self, signing_private_key): is_oscrypto = isinstance(signing_private_key, asymmetric.PrivateKey) if not isinstance(signing_private_key, keys.PrivateKeyInfo) and not is_oscrypto: raise TypeError(_pretty_message( ''' signing_private_key must be an ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Certificate(self) -> _n_8_t_0:", "def Certificate(self) -> _n_8_t_0:", "def sign_command(args):\n if args.files:\n die(\"Unexpected positional arguments\")\n\n # Load certificate request\n if not args.request:\n die(\"Need --request\")\n subject_csr = load_req(args.request)\n\n ...
[ "0.61315787", "0.61315787", "0.59517", "0.5880631", "0.58634347", "0.57155013", "0.5710871", "0.57072276", "0.56894225", "0.56489754", "0.5619481", "0.55772793", "0.5548957", "0.5527686", "0.5521173", "0.54978174", "0.54738504", "0.54585457", "0.5449486", "0.5449079", "0.5438...
0.5624256
10
Calculates the accuracy of a (multiclass) classifier, defined as the fraction of correct classifications.
def calc_accuracy(true, predicted): return sum([t==p for t,p in zip(true, predicted)]) / float(len(true))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiclass_accuracy(prediction, ground_truth):\n correct = sum(a == b for a, b in zip(prediction, ground_truth))\n\n accuracy = correct / len(ground_truth)\n\n return accuracy", "def accuracy(cls, test_labels):\n N = len(test_labels)\n\n # Calculate total correct as precentage\n ...
[ "0.8062225", "0.7989661", "0.7957554", "0.7913096", "0.7886881", "0.77577", "0.7662704", "0.7636037", "0.76325977", "0.76278996", "0.75958216", "0.7560955", "0.75587344", "0.7547818", "0.754766", "0.75229615", "0.75066584", "0.74955165", "0.7488491", "0.7473771", "0.7405914",...
0.72045815
38
Calculates the precision, recall and Fscore of a classifier.
def precision_recall_fscore(true, predicted, beta=1, labels=None, pos_label=None, average=None): # Build contingency table as ldict ldict = {} for l in labels: ldict[l] = {"tp": 0., "fp": 0., "fn": 0., "support": 0.} for t, p in zip(true, predicted): if t == p: ldict[t]["tp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(label_recall, label_precision, pred_recall, pred_precision):\n f11 = 6*label_recall*label_precision/(5*label_recall+label_precision)\n f12 = 5*pred_recall*pred_precision/(2*pred_recall+3*pred_precision)\n\n return 0.4*f11 + 0.6*f12", "def precision(self):\n self.overall_precision = prec...
[ "0.76547", "0.75400555", "0.7316806", "0.7304719", "0.7169431", "0.7160372", "0.71144414", "0.7101537", "0.7096566", "0.7079038", "0.7062186", "0.70435596", "0.7024895", "0.69993293", "0.69966674", "0.697652", "0.69500256", "0.6949167", "0.69278425", "0.69204175", "0.6903022"...
0.6980734
15
Helper function for slicing the audio file by window size and sample rate with [1stride] percent overlap (default 50%).
def slice_signal(file, window_size, stride, sample_rate): wav, sr = librosa.load(file, sr=sample_rate) hop = int(window_size * stride) slices = [] for end_idx in range(window_size, len(wav), hop): start_idx = end_idx - window_size slice_sig = wav[start_idx:end_idx] #print(type(sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_clips_by_stride2(stride, frames_list, sequence_size):\n clips = []\n sz = len(frames_list)\n clip = []\n cnt = 0\n for start in range(0, sz-sequence_size):\n for i in range(start, start+sequence_size):\n clip.append(frames_list[i])\n clips.append(clip)\n clip ...
[ "0.600388", "0.5930789", "0.58244437", "0.5814211", "0.5788517", "0.57616496", "0.5741947", "0.5716796", "0.5714888", "0.5699974", "0.56802857", "0.56785756", "0.56071216", "0.5601426", "0.55252904", "0.5479792", "0.54793173", "0.5475118", "0.5470689", "0.54675853", "0.542913...
0.70155334
0
Onestop IDE for smart contract.
def smartx_cmd(ctx): webbrowser.open("https://smartx.ont.io/")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contract_pepo_pbc():\n pass", "def main():\n\n api = SymbolService()", "def init():\n try:\n compile_contract(\n \"fishcake\", f\"Fishcake(sp.address('{pub_key_hash}'),{default_supply})\")\n fishcake_addr = deploy(\"fishcake\")\n print(\"\\n\")\n compile_cont...
[ "0.57452", "0.5450769", "0.53970563", "0.5168819", "0.5165328", "0.51380014", "0.5120251", "0.5116236", "0.51133585", "0.5109121", "0.50889903", "0.50777507", "0.505974", "0.5058526", "0.5046549", "0.50383246", "0.5038014", "0.5036075", "0.50294083", "0.5006385", "0.49798456"...
0.0
-1
self.Nodes is a list of nodes self.States is a list of (dictionary of) states
def __init__(self,setup): if isinstance(setup, KFSetup) == True: self.Nodes = setup.Nodes elif isinstance(setup, list) == True: for node in setup: if isinstance(node, KFNode) == False: print "List of nodes must be of type KNode" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def states(self) -> Type[Any]:\n return []", "def get_states(self):\n raise NotImplementedError()", "def states(self):\n return self._x_list", "def state_list(self) -> Sequence[TState]:\n pass", "def __init__(self):\n\n self.nodes = {}", "def state_nodes(self) -> np.nda...
[ "0.6639524", "0.6583393", "0.6522062", "0.6484665", "0.6410268", "0.6396257", "0.6363788", "0.63094705", "0.62580496", "0.62406516", "0.6234366", "0.62304926", "0.6182667", "0.617986", "0.61758226", "0.61434454", "0.6099685", "0.6057645", "0.6055081", "0.60545105", "0.6047305...
0.63547057
7
Helper function to make calls to Airtable REST API.
def airtable_api(base, table, token, action = '', parameters = {}, method = 'get', data = {}): headers = { 'Content-type': 'application/json', 'Accept-Encoding': 'gzip', 'Authorization': 'Bearer %s' % token } url = "https://api.airtable.com/v0/%s/%s/%s" % (base, table, action) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _api_call(self, **kwargs):\n params = {\n 'format': 'json',\n }\n params.update(kwargs)\n r = requests.get(self.api_base_url, params=params)\n return r.json()", "def test_api_response(self):\n # url = 'http://127.0.0.1:8000/api/aircraft/'\n url = re...
[ "0.61390936", "0.61125934", "0.60539144", "0.6022661", "0.59775054", "0.597503", "0.5948181", "0.5932787", "0.59238493", "0.59189403", "0.5911685", "0.5896667", "0.58928114", "0.5880146", "0.58788973", "0.586516", "0.5859757", "0.5797205", "0.5797205", "0.579526", "0.5782091"...
0.765456
0
Perform recursive expansion of ${vars}. Works by looking for a string matching the expansion syntax and replacing that with the value of the ivars dict corresponding to the key inside {}. If no key matching key is found, the expansion is escaped (by duplicating the $), to make sure the expansion ends. Cyclic expansions...
def interpolate(self, string, ivars, settings=None): if not isinstance(string, basestring): return string if settings is None: settings = self.settings ret = string m = self._INTERP_REGEX.search(ret) i = 0 while m is not None: k = m....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(self, s, lvars):\n if is_String(s):\n try:\n s0, s1 = s[:2]\n except (IndexError, ValueError):\n return s\n if s0 != '$':\n return s\n if s1 == '$':\n # In this case keep the double $'s which w...
[ "0.6811773", "0.66787976", "0.6488473", "0.6440492", "0.6396849", "0.6386581", "0.63629097", "0.6258556", "0.5814664", "0.5750376", "0.5742669", "0.56797206", "0.5659204", "0.55962145", "0.55536675", "0.5550205", "0.5548363", "0.55258036", "0.5493188", "0.54344845", "0.541024...
0.48064128
50
Tokenize data file and turn into tokenids using given vocabulary file. This function loads data linebyline from data_path, calls the above sentence_to_token_ids, and saves the result to target_path. See comment for sentence_to_token_ids on the details of tokenids format.
def data_to_token_ids(data_path, target_path, vocabulary_path, tokenizer=None, normalize_digits=True): if not gfile.Exists(target_path): print("Tokenizing data in %s" % data_path) vocab, _ = data_utils.initialize_vocabulary(vocabulary_path) with gfile.GFile(data_path, m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_token_ids(data_path, target_path, vocabulary_path):\n if not gfile.Exists(target_path):\n print(\"Tokenizing data in %s\" % data_path)\n vocab, _ = initialize_vocabulary(vocabulary_path)\n with gfile.GFile(data_path, mode=\"rb\") as data_file:\n with gfile.GFile(targe...
[ "0.88158065", "0.8449106", "0.83855826", "0.8366422", "0.82797813", "0.8102873", "0.7367587", "0.726734", "0.7234463", "0.7134788", "0.7093858", "0.70898783", "0.70898783", "0.70594037", "0.7039706", "0.6949376", "0.6746222", "0.67304814", "0.6648989", "0.6558965", "0.6438027...
0.8453001
1
Read data from source file and put into buckets.
def read_data(tokenized_dialog_path, buckets, max_size=None, reversed=False): data_set = [[] for _ in buckets] with gfile.GFile(tokenized_dialog_path, mode="r") as fh: utterences = fh.readline().split('\t') source = utterences[0] if len(utterences) >= 2 else None target = utterences[1] if len(utt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(source_path, target_path, opt):\n data_set = [[] for _ in _buckets]\n with tf.gfile.GFile(source_path, mode=\"r\") as source_file:\n with tf.gfile.GFile(target_path, mode=\"r\") as target_file:\n source, target = source_file.readline(), target_file.readline() \n ...
[ "0.65618515", "0.65262836", "0.6054701", "0.5990696", "0.58459795", "0.58217275", "0.5660017", "0.5587472", "0.55752623", "0.5531793", "0.5517406", "0.54970056", "0.54949343", "0.548751", "0.5446074", "0.5389549", "0.5365129", "0.53465563", "0.5338558", "0.52951324", "0.52681...
0.53149813
19
Updates sbfdInitiator resource on the server.
def update(self, MplsLabelCount=None, Name=None): # type: (int, str) -> SbfdInitiator return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_candidate_initiation_status(request):\n candidate_pk = request.POST.get('candidate')\n if not candidate_pk:\n return json_response(status=404)\n candidate = get_object_or_none(Candidate, pk=candidate_pk)\n initiated = json.loads(request.POST.get('initiated'))\n if not candidate or ...
[ "0.5474608", "0.5050383", "0.4984643", "0.4836667", "0.48322695", "0.47715214", "0.47665533", "0.47395217", "0.47383836", "0.4738318", "0.4738305", "0.47367153", "0.47344047", "0.4676075", "0.4672489", "0.4661571", "0.46312398", "0.46172616", "0.46114567", "0.4608545", "0.460...
0.45967504
21
Finds and retrieves sbfdInitiator resources from the server. All named parameters are evaluated on the server using regex. The named parameters can be used to selectively retrieve sbfdInitiator resources from the server. To retrieve an exact match ensure the parameter value starts with ^ and ends with $ By default the ...
def find( self, Count=None, DescriptiveName=None, MplsLabelCount=None, Name=None, SessionInfo=None, ): # type: (int, str, int, str, List[str]) -> SbfdInitiator return self._select(self._map_locals(self._SDM_ATT_MAP, locals()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generic_find(controller, heading, patterns):\n msg.info(heading)\n msg.info(\"--------------------------\")\n msg.blank()\n for pattern in patterns:\n for entry in controller.find(pattern):\n if hasattr(entry, \"uuid\"):\n eid = entry.uuid\n elif hasattr...
[ "0.49518782", "0.48978445", "0.47183838", "0.4708106", "0.45406547", "0.45046747", "0.44876707", "0.44648275", "0.4458623", "0.43709165", "0.4347843", "0.43476033", "0.43475124", "0.4342113", "0.43302515", "0.4325594", "0.43250877", "0.43101805", "0.43035924", "0.42664522", "...
0.5184359
0
Retrieves a single instance of sbfdInitiator data from the server. Args
def read(self, href): return self._read(href)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_initiator(self, init_key):\n if init_key[:5] != 'init_':\n raise Exception('Incorrect key passed to model.get_initiator(): ' +\n init_key)\n init_data = self.client.get(init_key)\n if init_data is None:\n return None\n else:\n ...
[ "0.5901854", "0.54212874", "0.52505374", "0.5221172", "0.5157096", "0.5156483", "0.5131844", "0.5088491", "0.5056409", "0.49985048", "0.4995144", "0.4982457", "0.49813747", "0.49672472", "0.4965639", "0.4940197", "0.48944193", "0.4890838", "0.4848253", "0.48449358", "0.484028...
0.0
-1
Base class infrastructure that gets a list of sbfdInitiator device ids encapsulated by this object. Use the optional regex parameters in the method to refine the list of device ids encapsulated by this object. Args
def get_device_ids( self, PortNames=None, Active=None, DestIPAddr=None, MyDiscriminator=None, PeerDiscriminator=None, TimeoutMultiplier=None, TxInterval=None, ): return self._get_ngpf_device_ids(locals())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_switch_ids():\n\n device_id_list = []\n url = 'https://' + APIC_EM + '/network-device'\n header = {'accept': 'application/json', 'X-Auth-Token': APIC_EM_TICKET}\n device_response = requests.get(url, headers=header, verify=False)\n device_json = device_response.json()\n device_info = devic...
[ "0.5543624", "0.5481396", "0.5470194", "0.54409117", "0.5349738", "0.52898645", "0.5209259", "0.516662", "0.50579447", "0.505697", "0.5042077", "0.5039442", "0.5039277", "0.5031319", "0.5025321", "0.49606717", "0.49584898", "0.4925496", "0.49149588", "0.49119374", "0.48910332...
0.53746444
4
Remove HTML markup from the given string.
def clean_html(html): html = re.sub(r"(?s)<!--(.*?)-->[\n]?", "\\1", html) html = re.sub(r"<!--", "", html) if html == '': return '' s = MLStripper() s.feed(html) return s.get_data().strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_html(text):\n return re.sub(r'<.*?>', r'', text)", "def strip_html(inputString):\r\n return BeautifulSoup(inputString, \"html.parser\").text", "def remove_html(x: str) -> str:\n regex = r\"<.+?>\"\n return re.sub(regex, \"\", x)", "def remove_html_tags(self,text):\n #https://med...
[ "0.8168552", "0.81124836", "0.7949947", "0.79056764", "0.7832942", "0.78204197", "0.7808701", "0.78075194", "0.7798221", "0.7784998", "0.7784378", "0.7784378", "0.7782839", "0.77705145", "0.77632415", "0.77590126", "0.7699831", "0.7595308", "0.7575034", "0.75212544", "0.75212...
0.7026485
40
Add L1feature selection (LASSO) to a classifier
def with_l1_feature_selection(class_T, **kwargs): class FeatureSelect(class_T): def fit(self, X, y): # The smaller C, the stronger the regularization. # The more regularization, the more sparsity. self.transformer_ = class_T(penalty="l1", **kwargs) logger.inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_features(self):\n print 'tuning alpha'\n hyper_params_model = lm.LassoCV(normalize=True, n_jobs=-1).fit(\n self.data.loc[self.train_index, self.features_], self.data.loc[self.train_index, self.target_name])\n print 'alpha is: {}'.format(hyper_params_model.alpha_)\n ...
[ "0.62955976", "0.606903", "0.59849876", "0.5970041", "0.5945682", "0.59200114", "0.5896963", "0.58824384", "0.5863572", "0.5863572", "0.57160354", "0.56982696", "0.5672844", "0.5630173", "0.56192195", "0.5605374", "0.5594883", "0.55813015", "0.5549581", "0.55495733", "0.55330...
0.6665041
0
Match separating punctuation (commas, periods, but not colons, hyphens)
def punct_filter_(w): return w in {u'.', u',', u';', u'?', u'!', u'(', u')', u'[', u']'}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignored_punctuation_regex():\n\treturn r'[!\\\"#$%&()*+\\,-./:;<=>?@\\[\\]\\\\^_`{}|~]+'", "def is_punctuation(ch):\n if (ch == '.'): return False\n if (ch >= '!' and ch <= '/'): return True\n if (ch >= ':' and ch <= '@'): return True\n if (ch >= '\\u2010' and ch <= '\\u2014'): return True # var...
[ "0.7343635", "0.7006425", "0.6784772", "0.67299044", "0.6666127", "0.6530255", "0.64739627", "0.64473224", "0.6433608", "0.63660544", "0.6341165", "0.63242084", "0.6294799", "0.62875867", "0.62520057", "0.6225957", "0.62174493", "0.6176782", "0.61660147", "0.61554426", "0.615...
0.6504791
6
Clear all stored response.
def clear(self): self.vars = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\r\n self._state[\"data\"].clear()\r\n self._state[\"session\"].request_rerun()", "def clear(self):\r\n self._state[\"data\"].clear()\r\n self._state[\"session\"].request_rerun()", "def clear(self):\n self._state[\"data\"].clear()\n self._state[\"sessio...
[ "0.7446551", "0.7446551", "0.7436163", "0.7436163", "0.7436163", "0.7329332", "0.72736454", "0.72287416", "0.71536124", "0.7138875", "0.70830476", "0.70826596", "0.70713127", "0.6988227", "0.69602025", "0.69010556", "0.69010556", "0.68921775", "0.6891574", "0.68742424", "0.68...
0.0
-1
Read template file and render file.
def create_document(self, output): if not os.path.exists(self.template_path): raise IOError('Template file not found.') documents = [] with open(self.template_path, 'rb') as f: data = f.read() template = Template(to_unicode(data)) indent_targets =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _render_template(self, tplfile, env):\n with open(tplfile) as fp:\n tpl = Template(fp.read())\n return tpl.render(Context(env))", "def render(self, tmpl_file, context):\n template = Template(tmpl_file.read_text(), keep_trailing_newline=True)\n return template.render(con...
[ "0.759074", "0.7526526", "0.7398593", "0.71414816", "0.7093139", "0.70328003", "0.70211214", "0.70048916", "0.6959408", "0.6915279", "0.6914749", "0.68996215", "0.6845751", "0.68133366", "0.6812965", "0.67076325", "0.6701488", "0.6701488", "0.6679855", "0.6670298", "0.6639249...
0.0
-1
Parse WebTest response. .describe('/ GET')
def describe(self, *args, **kwargs): def _autodoc(func, *_args, **_kwargs): if len(_args) > 0: #: Instance or class method. response = func(_args[0]) else: #: Function. if len(_kwargs) > 0: response = fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_method(self):\n self.getPage('/')\n self.assertStatus('200 OK')\n self.assertHeader('Content-Type', 'application/json')\n self.assertBody('{\"mystring\": \"\"}')", "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test...
[ "0.6889347", "0.6758513", "0.6715704", "0.664328", "0.661729", "0.6605064", "0.6605064", "0.6479323", "0.64753807", "0.646049", "0.64558667", "0.64163375", "0.64055413", "0.6396195", "0.63906515", "0.63906515", "0.6344304", "0.6327143", "0.63212115", "0.631387", "0.63123506",...
0.0
-1
Generate document. .generate('output_file.rst', template='template.rst')
def generate(self, *args, **kwargs): #: TODO Use decorator instead. def _generate(func): @wraps(func) def __generate(*_args): if len(_args) > 0: arg = _args[0] else: arg = _args if self._is_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(self, output):\n if not os.path.exists(self.template_path):\n raise IOError('Template file not found.')\n\n documents = []\n with open(self.template_path, 'rb') as f:\n data = f.read()\n template = Template(to_unicode(data))\n ind...
[ "0.76528835", "0.69006985", "0.67696035", "0.6688092", "0.6625607", "0.6345653", "0.6247454", "0.6246112", "0.6218659", "0.6213572", "0.61888826", "0.6187535", "0.6181747", "0.61376876", "0.61268723", "0.612233", "0.61221707", "0.61131835", "0.61126673", "0.61126673", "0.6101...
0.64648503
5
move objects randomly, used to create startgoalconfigurations
def move_objects(self): def get_new_obj_pose(curr_pos, curr_quat): angular_disp = 0.0 delta_alpha = np.random.uniform(-angular_disp, angular_disp) delta_rot = Quaternion(axis=(0.0, 0.0, 1.0), radians=delta_alpha) curr_quat = Quaternion(curr_quat) newq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _move_randomly(self):\n a, b = randint(0, len(self.state) - 1), randint(0, len(self.state) - 1)\n wiz1, wiz2 = self.state[a], self.state[b]\n self._swap_wizards(wiz1, wiz2)", "def MoveRandom(self):\n r = random.randint(0,3)\n if r == 0: self.x += 1\n elif r == 1: sel...
[ "0.7378422", "0.7229374", "0.7224192", "0.71494836", "0.7106477", "0.69178057", "0.68823785", "0.6878625", "0.6782675", "0.67623246", "0.67030305", "0.66793734", "0.6674687", "0.66025436", "0.65941995", "0.6520001", "0.6509973", "0.64586425", "0.64313936", "0.64313936", "0.64...
0.7156799
3
Computes growing degree days for one day.
def compute_gdd(tmin, tmax, base): gdd = (tmin + tmax) / 2 - base if gdd < 0: return 0 else: return gdd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_angle(day):\n return 2*pi*( day - 1 )/365", "def declination_degree(day_date, TY):\n\n return 23.45 * np.vectorize(sin)((2 * pi / (TY)) * (day_date - 81))", "def compute(self, days=1):\n raise NotImplementedError", "def compute_days(start: date, end: date) -> int:\n delta = end - star...
[ "0.63740456", "0.6364502", "0.62554413", "0.5825322", "0.5759924", "0.5728445", "0.57181114", "0.56224924", "0.56181675", "0.56117284", "0.5574303", "0.55253017", "0.54893756", "0.5466688", "0.54473484", "0.5437151", "0.5433859", "0.54293084", "0.54293084", "0.5399242", "0.53...
0.0
-1
Inserts or updates a row in the agdds table.
def add_agdd_row(station_id, source_id, gdd, agdd, year, doy, date, base, missing, tmin, tmax): cursor = mysql_conn.cursor(buffered=True) cursor.execute(search_for_agdd_row, (station_id, source_id, date, base)) if cursor.rowcount < 1: cursor.execute(insert_agdd_row, (station_id, source_id, gdd, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_or_update(self, table, connection, row):\n\n # find line, if it exist\n dbrow = self.find(connection, table, row)\n\n # TODO XXX use actual database function instead of this stupid thing\n now = datetime.datetime.now()\n\n column_names = table.columns.keys()\n\n ...
[ "0.71272016", "0.64908445", "0.64370745", "0.6415218", "0.63375866", "0.62611103", "0.62001574", "0.61876833", "0.6153674", "0.6153602", "0.6137083", "0.6070958", "0.6063594", "0.60508627", "0.6006844", "0.59999216", "0.5953526", "0.5928303", "0.59262604", "0.5911096", "0.590...
0.6496721
1
Retrieves tmin and tmax data from climate source and computes agdds to be inserted into the agdd table.
def populate_agdds(start_date, end_date, source, source_id, stations): # possibly grab ACIS station data (for entire date range) if source == 'ACIS': station_ids = [] for station in stations: station_ids.append(station['char_network_id']) acis_data = get_acis_climate_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_temps(start_date, end_date):\n \n return session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)). filter(Measurement.date >= start_date).filter(Measurement.date <= end_date).all()", "def calc_temps(start_date, end_date):\n engine = create_engine(...
[ "0.5735708", "0.5730932", "0.5722183", "0.56052613", "0.5589223", "0.55774945", "0.555737", "0.5545903", "0.55298", "0.5475786", "0.5471325", "0.5433377", "0.5417408", "0.54048234", "0.5404228", "0.5385842", "0.5363252", "0.5359528", "0.5340754", "0.5295347", "0.52815783", ...
0.6996738
0
Populates the agdds table with urma, acis, and prism temps and agdds for qc purposes.
def populate_agdd_qc(urma_start, urma_end, acis_start, acis_end, prism_start, prism_end): logging.info(' ') logging.info('-----------------beginning climate quality check population-----------------') stations = get_stations() sources = get_sources() acis_source_id = None urma_source_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_agdds(start_date, end_date, source, source_id, stations):\r\n # possibly grab ACIS station data (for entire date range)\r\n if source == 'ACIS':\r\n station_ids = []\r\n for station in stations:\r\n station_ids.append(station['char_network_id'])\r\n acis_data = ge...
[ "0.7020696", "0.59384745", "0.57721275", "0.55029595", "0.54911304", "0.535942", "0.5247746", "0.52255356", "0.5182375", "0.51726794", "0.5150156", "0.5148654", "0.5112237", "0.510183", "0.5043503", "0.5028003", "0.5018343", "0.5009472", "0.5000762", "0.4996117", "0.49891308"...
0.6922955
1
Compute the reciprocal rank of a ranked list against some ground truth.
def reciprocal_rank(ranking, references, atk=None): for k, prediction in enumerate(ranking[:atk], 1): if prediction in references: return 1.0 / k return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recip_rank(recs, truth):\n good = recs['item'].isin(truth.index)\n npz, = np.nonzero(good)\n if len(npz):\n return 1.0 / (npz[0] + 1.0)\n else:\n return 0.0", "def mrr(ground_truth, prediction):\n rr = 0.\n for rank, item in enumerate(prediction):\n if item in ground_tr...
[ "0.73031837", "0.6954642", "0.69224846", "0.6495415", "0.6495415", "0.6495415", "0.64866287", "0.63244474", "0.62833434", "0.6090479", "0.6087416", "0.6059336", "0.6052769", "0.5926173", "0.59248835", "0.5920617", "0.59073466", "0.58768547", "0.5853657", "0.57954407", "0.5781...
0.7614039
0
Compute the average precision of a ranked list against some ground truth
def average_precision(ranking, references, atk=None): total, num_correct = 0.0, 0.0 for k, prediction in enumerate(ranking[:atk], 1): if prediction in references: num_correct += 1 total += num_correct / k return total / num_correct if total > 0 else 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(ground_truth, prediction):\n ground_truth = remove_duplicates(ground_truth)\n prediction = remove_duplicates(prediction)\n precision_score = count_a_in_b_unique(prediction, ground_truth) / float(len(prediction))\n assert 0 <= precision_score <= 1\n return precision_score", "def avera...
[ "0.7208344", "0.7128738", "0.70493734", "0.70493734", "0.69964546", "0.69185257", "0.6745876", "0.6717349", "0.6709977", "0.670711", "0.66209596", "0.66137177", "0.65935045", "0.65935045", "0.6568909", "0.6563142", "0.65568525", "0.6533323", "0.6532258", "0.65147334", "0.6491...
0.7527089
0
Compute the mean average precision. Input should be a list of prediction rankings and a list of ground truth rankings.
def mean_average_precision(rankings, references, atk=None): return _mean_score(rankings, references, partial(average_precision, atk=atk))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_average_precision(ground_truth_boxes, predicted_boxes):\n # DO NOT EDIT THIS CODE\n all_gt_boxes = []\n all_prediction_boxes = []\n confidence_scores = []\n\n for image_id in ground_truth_boxes.keys():\n pred_boxes = predicted_boxes[image_id][\"boxes\"]\n scores = predicted_bo...
[ "0.7831679", "0.7574589", "0.75513065", "0.75513065", "0.75288075", "0.74372524", "0.732722", "0.7210581", "0.7141075", "0.6975217", "0.69228095", "0.6889771", "0.6889771", "0.6876503", "0.67573595", "0.67374164", "0.6712426", "0.668879", "0.66805184", "0.66583216", "0.664517...
0.77060956
1
Compute the mean reciprocal precision. Input should be a list of prediction rankings and a list of ground truth rankings.
def mean_reciprocal_rank(rankings, references, atk=None): return _mean_score(rankings, references, partial(reciprocal_rank, atk=atk))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_precision(ranking, references, atk=None):\n total, num_correct = 0.0, 0.0\n for k, prediction in enumerate(ranking[:atk], 1):\n if prediction in references:\n num_correct += 1\n total += num_correct / k\n return total / num_correct if total > 0 else 0.0", "def me...
[ "0.7065807", "0.70518625", "0.70157504", "0.70157504", "0.68720365", "0.685541", "0.6840075", "0.67997265", "0.67997265", "0.67997265", "0.67128766", "0.67063826", "0.6668957", "0.6668957", "0.666502", "0.6556388", "0.65000385", "0.63746715", "0.6370327", "0.6348512", "0.6345...
0.6964207
4
Return 1 if the predicted ranking is not perfect.
def is_error(ranking, references): return 1 if average_precision(ranking, references) < 1 else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_rank(self, X, err):\n singularValues,_,_,_ = self.compute_svd(X,k=-1)\n ratio = np.array([np.linalg.norm(singularValues[k:]) / np.linalg.norm(singularValues) for k in\n range(len(singularValues) - 1, 0, -1)])\n find_idx = numpy.nonzero(ratio <= err)\n rank ...
[ "0.69346136", "0.672925", "0.651005", "0.646099", "0.6448155", "0.6444491", "0.64425844", "0.64425844", "0.64425844", "0.64425844", "0.6406233", "0.63962543", "0.6384781", "0.6384781", "0.63778514", "0.63349134", "0.6325778", "0.63230485", "0.6310548", "0.6310548", "0.6278173...
0.64548105
4
Return the margin, or absolute difference between the highest irrelevant item and the lowest relevant one.
def margin(ranking, references): lowest_relevant, highest_irrelevant = 0, 0 for k, prediction in enumerate(ranking, 1): if prediction not in references and highest_irrelevant is 0: highest_irrelevant = k if prediction in references and k > lowest_relevant: lowest_relevant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_margin(self) -> float:\n return self.position.exchange.available_margin", "def score_margin(self):\n if self.previous_event is None:\n score = self.score\n else:\n score = self.previous_event.score\n offense_team_id = self.get_offense_team_id()\n ...
[ "0.6683197", "0.6535715", "0.6526499", "0.64784586", "0.6443067", "0.637917", "0.63374513", "0.6324491", "0.6324483", "0.6308849", "0.62230015", "0.59055555", "0.576389", "0.57285047", "0.56073964", "0.56070846", "0.55782366", "0.5575528", "0.55331033", "0.55096865", "0.54899...
0.6742604
0
Discounted cumulative gain at rank (DCG)
def dcg(relevances, rank=10): relevances = np.asarray(relevances)[:rank] n_relevances = len(relevances) if n_relevances == 0: return 0. discounts = np.log2(np.arange(n_relevances) + 2) return np.sum(relevances / discounts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discounted_cumulative_gain(ranked_list):\n total_ndcg = 0\n for query in ranked_list:\n relevances = [doc[0] for doc in query[1]]\n dcg = 0\n for i, rel in enumerate(relevances, 1):\n dcg += rel / (math.log(i + 1, 2))\n\n idcg = 0\n for i, rel in enumerate(so...
[ "0.71784985", "0.71222025", "0.6881122", "0.68019325", "0.6787491", "0.67346466", "0.6697927", "0.6597123", "0.64656633", "0.6435575", "0.6423271", "0.63383526", "0.6318887", "0.63159037", "0.6252899", "0.6227333", "0.62143683", "0.62141496", "0.6133122", "0.61255443", "0.612...
0.66329145
7
Normalized discounted cumulative gain (NDGC)
def ndcg(relevances, rank=10): best_dcg = dcg(sorted(relevances, reverse=True), rank) if best_dcg == 0: return 0. return dcg(relevances, rank) / best_dcg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dcg(scores, discount=np.log2):\n scores = np.nan_to_num(scores)\n ranks = np.arange(1, len(scores) + 1)\n disc = discount(ranks)\n np.maximum(disc, 1, out=disc)\n np.reciprocal(disc, out=disc)\n return np.dot(scores, disc)", "def _get_cg_discount(top_k_int=1):\n log_2 = tf.log(tf.constant...
[ "0.65538585", "0.6481912", "0.6384384", "0.6360059", "0.6212594", "0.6171593", "0.61645573", "0.6149474", "0.6141358", "0.6097007", "0.6049013", "0.60426986", "0.59782493", "0.59467566", "0.59015936", "0.5899923", "0.5890733", "0.5869578", "0.5842891", "0.583804", "0.5810907"...
0.5687919
27
Handles a new ride for the bird.
def NewRide(self, ride, startTime): self.currRide = ride self.waitTimes.append(int(startTime) - int(self.idleTime))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ride(vehicle_id):\n form = EndRideForm()\n vehicle_at_start = movr.get_vehicle(vehicle_id)\n if vehicle_at_start is None: # Vehicle not found in database\n flash(\"Vehicle `{}` not found.\".format(vehicle_id))\n return redirect(url_for('vehicles', _external=True))\n elif not vehicle_...
[ "0.6446078", "0.6432448", "0.6353472", "0.61630404", "0.6094398", "0.60312307", "0.5896501", "0.57249016", "0.55817395", "0.5569545", "0.53594303", "0.5137688", "0.51246005", "0.507295", "0.5052853", "0.50418717", "0.5041374", "0.50409484", "0.5001274", "0.4959977", "0.495907...
0.59893584
6
Completes the bird's active ride.
def CompleteRide(self,endTime,endX,endY): ride = self.currRide ride.EndRide(endX,endY,endTime) self.totalDistance+=ride.GetDistance() self.totalDuration+=ride.GetDuration() self.rides.append(ride) self.currRide = None self.idleTime = endTime self.Calculat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self):\n # Stop driving\n self.robot.drivetrain.arcade_drive(0.0, 0.0)", "def end(self, interrupted: bool) -> None:\n self.drive.arcadeDrive(0, 0)", "def endCompetition(self):\n self.robot_exit = True", "def complete(self):\n self._is_complete = True", "def end(se...
[ "0.6222994", "0.60794526", "0.6044299", "0.6004306", "0.59830385", "0.5944956", "0.5893873", "0.5867495", "0.57774293", "0.5750507", "0.5740049", "0.5732889", "0.57264733", "0.5721332", "0.56923115", "0.56396633", "0.5600887", "0.55898863", "0.55898863", "0.5544427", "0.55334...
0.6494587
0
Calculate the bird's distance from the drop point
def CalculateDistanceFromDropPoint(self,endPosX,endPosY): R = 6371.0 startLat = math.radians(float(self.dropX)) startLong = math.radians(float(self.dropY)) endLat = math.radians(float(endPosX)) endLong = math.radians(float(endPosY)) longDist = endLong - startLong ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetDistanceFromDropPoint(self):\n return self.distanceFromDropPoint", "def distance(self) -> float:\n return self._dist_two_wire() # at this time we only support 2-wire meausre", "def compute_distance(self):\n loc = np.extend_dims(self.state[:, :, Boids.Attr.LOC], axis=-1)\n m ...
[ "0.71565235", "0.6582328", "0.65763086", "0.6385657", "0.62829095", "0.62786025", "0.6270165", "0.6270165", "0.6270165", "0.6270165", "0.6270165", "0.6270165", "0.6270165", "0.62629414", "0.62093073", "0.61642647", "0.6148952", "0.6113482", "0.61008674", "0.60697323", "0.6023...
0.65202206
3
Getter for overall distance Return
def GetTotalDistanceTraveled(self): return self.totalDistance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance(self) -> int:\n return self.get_measurement_data().distance", "def get(cls, approach):\n return approach.distance", "def distance(self):\n return self._distance", "async def distance(self):\n return round(await self._rpc.distance(), 2)", "def _get_admin_distance...
[ "0.7741126", "0.77363366", "0.7720084", "0.7548991", "0.75194705", "0.736661", "0.7225689", "0.72174215", "0.7111943", "0.70954406", "0.7094097", "0.7026749", "0.6943714", "0.6880381", "0.68690765", "0.6821791", "0.67623985", "0.6749115", "0.67360604", "0.669975", "0.6680262"...
0.7153402
8
Getter for distance from drop point Return
def GetDistanceFromDropPoint(self): return self.distanceFromDropPoint
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self):\n return self._distance", "def get_distance(self) -> int:\n return self.get_measurement_data().distance", "def get_distance(start, end):\n\n\t\tloc_start, loc_end, dst_node = create_distance(start, end)\n\t\tdistance = cmds.getAttr(\"%s.distance\" % dst_node)\n\n\t\tcmds.delet...
[ "0.76265997", "0.7575346", "0.73508847", "0.7346014", "0.7258451", "0.7191502", "0.70774806", "0.7016465", "0.7005957", "0.6948037", "0.68207526", "0.68057805", "0.67899567", "0.676611", "0.6720881", "0.6713946", "0.6695198", "0.6695198", "0.6695198", "0.6695198", "0.6695198"...
0.8377415
0
Getter for maximum wait time Return
def GetMaxWaitTime(self): return max(self.waitTimes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MaxWaitTime(self):\r\n\t\treturn self._get_attribute('maxWaitTime')", "def max_timeout(self):\n return self._max_timeout", "def max_waiting(self):\n return self._max_waiting", "def get_timeout(self) -> int:", "def get_wait_timeout(self):\n if self.__wait_timeout is not None:\n ...
[ "0.82421374", "0.8093026", "0.8073709", "0.7785421", "0.7377285", "0.7354005", "0.730726", "0.72938687", "0.72644025", "0.71912974", "0.7185561", "0.7089766", "0.70715714", "0.69640744", "0.69640744", "0.69523233", "0.69438374", "0.69140947", "0.6854665", "0.6839531", "0.6828...
0.81754684
1
Getter for total Duration Return
def GetTotalDuration(self): return self.totalDuration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(self):\n return self.duration", "def get_duration(self):\n return self._duration", "def Duration(self):\r\n\t\treturn self._get_attribute('duration')", "def Duration(self):\n\t\treturn self._get_attribute('duration')", "def duration(self):\n return self._get('duration'...
[ "0.8640967", "0.8465019", "0.8192792", "0.81764585", "0.81736344", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81567216", "0.81281835", "0.81279856", "0.81210256", "0.80905044", "0.79546475", "0.7880334", "0.78671366", ...
0.8545387
1
Getter for id Return
def GetID(self): return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_getter(self):\n return self._id", "def _get_id(self):\n return self.id", "def id(self):\n return self.getattr('id')", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n return self.id", "def get_id(self):\n ...
[ "0.8621182", "0.8557873", "0.84580034", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", "0.84160674", ...
0.81307554
70
returns all options of the strip characters in required length
def bruteforce(strip, min_length, max_length): return (''.join(char) for char in chain.from_iterable(product(strip, repeat=x) for x in range(min_length, max_length+1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sanitize(self, opts_list):\n for opt in opts_list:\n if len(opt.strip()) == 0:\n opts_list.remove(opt)\n return opts_list", "def lstrip(self, chars=None):\n return asarray(lstrip(self, chars))", "def filter_min_length(self, string):\n newstring = strin...
[ "0.56886077", "0.5513566", "0.53906834", "0.5386568", "0.5321687", "0.5275547", "0.5219687", "0.52139086", "0.5201099", "0.5179651", "0.5171791", "0.5100026", "0.5069645", "0.50526756", "0.5038516", "0.50358015", "0.49880165", "0.4964224", "0.4960884", "0.49529618", "0.494691...
0.60040057
0
data could be numpy array or list of lists of dataframe if x and y provided, assume a 2D data set with X and Y >> scatter if X only > imshow from array or pandas
def scatter_hist(x, y=None, kargs_scatter={'s':20, 'c':'b'}, kargs_grids={}, kargs_histx={}, kargs_histy={}, hist_position='right', width=.5, height=.5, offset_x=.10, offset_y=.10, gap=0.06, grid=True, **kargs): # if 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_2d_data(X, y):\n assert len(X.shape) == len(y.shape) == 2, f\"Input/output pairs must be 2D-arrays. X: {X.shape}, y: {y.shape}\"\n (N, D) = X.shape\n assert N == y.shape[0], f\"Number of samples must match for input/output pairs. X: {N}, y: {y.shape[0]}\"\n assert D == 2, f\"Expected 2 fe...
[ "0.6581301", "0.6562821", "0.6548173", "0.6538196", "0.649233", "0.64503056", "0.63920987", "0.6099296", "0.6082181", "0.60210073", "0.6002888", "0.59204847", "0.59161323", "0.5893735", "0.5887856", "0.5883411", "0.58474094", "0.5835318", "0.58278733", "0.58179444", "0.578762...
0.54975533
47
This function updates knownfaces dynamo table with the data derived from Slack and AWS Rekognition
def update_dynamo(username, userid, match_percentage, image_id, url, \ age, gender, smile, beard, happy, sad, angry): put_into_dynamo = RekognitionKnown( user_name = username, slack_user_id = userid, match_percentage = match_percentage, image_id = image_id, image_url = ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_data():\n fetch_missingpersons = request.get_json()\n update_data = MissingPerson.query.filter_by(id=fetch_missingpersons['id']).first()\n update_data.embedding = fetch_missingpersons['embedding']\n db.session.commit()\n return jsonify(fetch_missingpersons)", "def update_unknown_dynamo(...
[ "0.5749878", "0.56376445", "0.55223274", "0.5288706", "0.5233593", "0.5223677", "0.5190544", "0.51581466", "0.51386875", "0.5101116", "0.50991535", "0.50734353", "0.5036171", "0.5016885", "0.49960828", "0.496741", "0.49518254", "0.4918262", "0.49122834", "0.49036375", "0.4895...
0.6076229
0
This function updates unknownfaces dynamo table with the data derived AWS Rekognition
def update_unknown_dynamo(url, age, gender, \ smile, beard, happy, sad, angry): put_into_unknown_dynamo = RekognitionUnknown( image_url = url, age_range = age, gender = gender, is_smiling = smile, has_beard = beard, is_happy = happy, is_sad = sad, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_dynamo(username, userid, match_percentage, image_id, url, \\\n age, gender, smile, beard, happy, sad, angry):\n put_into_dynamo = RekognitionKnown(\n user_name = username,\n slack_user_id = userid,\n match_percentage = match_percentage,\n image_id = image_id,\n i...
[ "0.6149813", "0.5659518", "0.56375855", "0.5558385", "0.54713255", "0.5422148", "0.5335955", "0.5258836", "0.5254008", "0.5233241", "0.5213646", "0.51518", "0.5145294", "0.51217556", "0.51177675", "0.5106467", "0.5100847", "0.50853866", "0.50845665", "0.5082567", "0.5066661",...
0.6175062
0
Returns a default LabelStoreConfig to fill in any missing ones.
def get_default_label_store(self, scene: SceneConfig) -> LabelStoreConfig: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(cls):\n default = super(LSHNearestNeighborIndex, cls).get_default_config()\n\n lf_default = plugin.make_config(get_lsh_functor_impls())\n default['lsh_functor'] = lf_default\n\n di_default = plugin.make_config(get_descriptor_index_impls())\n default['descri...
[ "0.6221486", "0.60220504", "0.5819019", "0.5805407", "0.5782555", "0.57711416", "0.57619035", "0.57562435", "0.5748874", "0.56956226", "0.56690294", "0.5653731", "0.5632784", "0.55963796", "0.55954915", "0.55846584", "0.55831254", "0.55684423", "0.5543517", "0.55301565", "0.5...
0.77048916
0
Returns a default EvaluatorConfig to use if one isn't set.
def get_default_evaluator(self) -> EvaluatorConfig: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config():\n # pylint: disable=cyclic-import\n from raylab.agents.sac import DEFAULT_CONFIG\n\n return DEFAULT_CONFIG", "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def default(self):\n return self._config...
[ "0.69978195", "0.67205906", "0.6683171", "0.6621579", "0.63026786", "0.62763005", "0.62488645", "0.62030625", "0.61780494", "0.61780494", "0.6141372", "0.6116631", "0.6102302", "0.6101332", "0.60781455", "0.6034338", "0.6029229", "0.60245436", "0.5991673", "0.5976192", "0.596...
0.85756123
0
Add intervals to the figure as rectangles.
def _generate_rectangle(figure: plotting.figure, source: plotting.ColumnDataSource): return figure.rect( x="x", y="y", width="width", height="height", line_color="#000000", fill_color="color", fill_alpha=0.7, line_width=1.5, source=source, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_rects(self):\n width = 1.0 / self.rows\n height = 1.0 / self.rows\n\n for x in xrange(0, self.rows, 1):\n for y in xrange(0, self.rows, 1):\n rect = Rectangle((x/float(self.rows), y/float(self.rows)), width, height, facecolor=\"#000000\")\n sel...
[ "0.7189564", "0.6219012", "0.6094361", "0.60833675", "0.60436827", "0.60337275", "0.602918", "0.60240656", "0.60226893", "0.6018765", "0.6016253", "0.59641397", "0.5936662", "0.5932538", "0.59318054", "0.5924499", "0.580369", "0.57975924", "0.57900375", "0.5789951", "0.571219...
0.56621635
24
Visualization routine for generating a calendar visualization with Bokeh.
def _bokeh_visualization( calendar: "Calendar", n_years: int, relative_dates: bool, add_yticklabels: bool = True, **kwargs, ) -> plotting.figure: if add_yticklabels: tooltips = [ ("Interval", "@desc"), ("Size", "@width_days days"), ("Type", "@type"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bokeh_dashboard_creator(dataframe):\r\n ############################################\r\n # Revenue, Impressions by Day by Partner\r\n ############################################\r\n \r\n output_file(\"dashboard.html\")\r\n \r\n df = dataframe\r\n df['Day'] = pd.to_datetime(df['Day'])\r...
[ "0.68911076", "0.68793774", "0.60817", "0.6039826", "0.5992555", "0.5942231", "0.5935102", "0.58497673", "0.58346933", "0.57104707", "0.56599814", "0.565917", "0.5641684", "0.5613914", "0.56110364", "0.56102514", "0.55630434", "0.5560685", "0.5560528", "0.5540341", "0.553218"...
0.7399681
0
Visualization routine for generating a calendar visualization with Bokeh.
def bokeh_visualization( calendar, n_years: int, relative_dates: bool, add_yticklabels: bool = True, **kwargs, ) -> None: bokeh_fig = _bokeh_visualization( calendar, n_years, relative_dates, add_yticklabels, **kwargs ) if "pytest" in sys.modules: # Do not open browser if we are ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bokeh_visualization(\n calendar: \"Calendar\",\n n_years: int,\n relative_dates: bool,\n add_yticklabels: bool = True,\n **kwargs,\n) -> plotting.figure:\n if add_yticklabels:\n tooltips = [\n (\"Interval\", \"@desc\"),\n (\"Size\", \"@width_days days\"),\n ...
[ "0.7399681", "0.68911076", "0.60817", "0.6039826", "0.5992555", "0.5942231", "0.5935102", "0.58497673", "0.58346933", "0.57104707", "0.56599814", "0.565917", "0.5641684", "0.5613914", "0.56110364", "0.56102514", "0.55630434", "0.5560685", "0.5560528", "0.5540341", "0.553218",...
0.68793774
2
removes file without error on non existing file
def silent_remove(filename): try: os.remove(filename) except OSError as err: if err.errno != errno.ENOENT: # errno.ENOENT = no such file or directory raise # re-raise exception if a different error occurred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _removeFile(self, filename):\n try:\n #delete the output file\n os.remove(filename)\n except:\n #print (\"Failed to remove the file: \" + filename)\n pass", "def rm_file(filename):\n try:\n os.unlink(filename)\n except FileNotFoundError:\...
[ "0.81589264", "0.8088351", "0.8077004", "0.7990209", "0.7931335", "0.7897219", "0.7851091", "0.7844677", "0.7837529", "0.7830017", "0.7830017", "0.7794231", "0.77705145", "0.77115726", "0.76478285", "0.7643525", "0.7634688", "0.7624167", "0.7613937", "0.76029307", "0.7598251"...
0.75850594
23
main function to track fish
def main(): parser = argparse.ArgumentParser(description="Tracks adult fish") # add options for argument parser parser.add_argument("in_path", help="Path to the video directory.") parser.add_argument("out_path", help="Directory for results. Should be empty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def falcon():", "def main():\n ff = FileForensics()\n # ff.scan_dir(\"/Users/ns/notes\") # FIXME\n ff.scan_dir(\"/Users/ns/work/termination_data\")\n\n print \"\\n--- BIG FILES ---\"\n for (size, mime, filename) in ff.get_big_files():\n print (bcolors.FAIL+\"{:>10} MB\"+bcolors.ENDC+\" {...
[ "0.626659", "0.592361", "0.5907526", "0.59051025", "0.5881423", "0.587882", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.58329105", "0.5...
0.5814685
31
Registers a global stack transformation that merges a set of tags with whatever was also explicitly added to the resource definition.
def register_auto_tags(auto_tags: Mapping[str, str]) -> None: pulumi.runtime.register_stack_transformation(lambda args: auto_tag(args, auto_tags))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tags(event):\n\n add_tags_from_presets()", "def add_tags_to_resource(ResourceId=None, Tags=None):\n pass", "def hook_tags_for_projects(task):\n if task['project'] in TAGS_FOR_PROJECTS.keys():\n for tag in TAGS_FOR_PROJECTS[task['project']]:\n task['tags'].add(tag)", "def au...
[ "0.5524886", "0.54226065", "0.51583046", "0.51563334", "0.50898856", "0.506334", "0.49708322", "0.49250105", "0.4869671", "0.48399723", "0.48346636", "0.47867766", "0.47468102", "0.47392708", "0.47238922", "0.4723705", "0.46952054", "0.46935907", "0.46483028", "0.46255636", "...
0.61592054
0
Applies the given tags to the resource properties if applicable.
def auto_tag( args: pulumi.ResourceTransformationArgs, auto_tags: Mapping[str, str] ) -> pulumi.ResourceTransformationResult | None: if is_taggable(args.type_): # Ignore the typing because this is code we didn't actually # write (see note above) args.props["tags"] = {**(args.props["tags"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_property(self, resources, resource, model, prop, context):\n pass", "def add_tags_to_resource(ResourceId=None, Tags=None):\n pass", "def remove_tags_from_resource(ResourceId=None, TagKeys=None):\n pass", "def add_tags():\n\n tags = shallow_copy(e['ResourceProperties'].get('Tag...
[ "0.6113242", "0.58627033", "0.54521155", "0.5443542", "0.54036754", "0.5331512", "0.52759224", "0.52736276", "0.5259163", "0.5252262", "0.5227304", "0.5164752", "0.5161838", "0.511677", "0.50644654", "0.50644654", "0.50644654", "0.5043394", "0.5038415", "0.5038415", "0.503841...
0.0
-1
Returns true if the given resource type is an AWS resource that supports tags.
def is_taggable(t: str) -> bool: return t in taggable_resource_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsTagExists(self, ResourceId, TagName):\n\n try:\n if self.Service == 'ec2':\n response = self.DescribeTags(ResourceId)\n if TagName in list(map(lambda x: x['Key'], [x for x in response['Tags']])):\n return True\n elif self.Service =...
[ "0.6399579", "0.63201123", "0.62766284", "0.6256046", "0.62011147", "0.61333555", "0.6058019", "0.6058019", "0.5869327", "0.5817959", "0.57866144", "0.5778956", "0.57481205", "0.57481205", "0.57481205", "0.5704926", "0.5670921", "0.5625209", "0.55327207", "0.551816", "0.54557...
0.7635412
0
Data providing function. Run type argument specifies which set of data to load, e.g. augmented, denoised.
def data(): run_type = 'standardised' sr = 48000 train_perc = 0.9 if sr == 48000: time_dimension = 282 if sr == 44100: time_dimension = 259 x_train, y_train, x_test, y_test = essential.compile_dataset(run_type, sr) # reshape for CNN input x_train = np.array([x.reshape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_data (arguments):\n if arguments.define_labels:\n data.define_labels()\n elif arguments.preprocess:\n # Preprocess from data_raw --> data_preprocessed\n data.preprocess()\n elif arguments.annotate:\n # Annotate from data_preprocessed --> data_annotated\n reverse = False # DEBUG\n annot...
[ "0.64160925", "0.6190907", "0.60048896", "0.5920387", "0.5856521", "0.58437264", "0.580692", "0.5792205", "0.57894427", "0.5783844", "0.57578003", "0.57564956", "0.5756411", "0.5743674", "0.5704999", "0.5696924", "0.5683071", "0.56713223", "0.56644464", "0.5656992", "0.564022...
0.0
-1
Saves the running configuration to memory
def write_mem(self): request = 'commands/writemem' return self._post(request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():\n\n env.config.save(env.config_file)", "def save(self):\r\n with open(self.filename, 'wb') as configfile:\r\n self.write(configfile)", "def save(self):\n file = open(self.path, 'w')\n self.config.write(file)\n file.close()", "def save_config(self):\n ...
[ "0.7493188", "0.72542393", "0.72524124", "0.72474897", "0.71941704", "0.7145096", "0.709614", "0.70905155", "0.6976864", "0.6925252", "0.69204694", "0.68928176", "0.68441886", "0.68203056", "0.6806835", "0.67773426", "0.6760707", "0.67580456", "0.6750563", "0.67335844", "0.67...
0.0
-1
add a file full of user agents to use The loading of more than one user agent implies the use of random user agents.
def add_user_agent(self, useragent_path): with open(useragent_path) as wordlist_f: for useragent in wordlist_f.read().split("\n"): useragent = useragent.strip() if useragent: self.user_agents.append(useragent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_agents(self, file_name):\n with open(file_name) as f:\n self.user_agents = json.load(f)\n self.headers[\"User-Agent\"] = random.choice(self.user_agents)", "def add_user_agent(self, value):\n # type: (str) -> None\n self.user_agent_policy.add_user_agent(value)",...
[ "0.7073403", "0.70005083", "0.65844756", "0.64439905", "0.6365973", "0.62721574", "0.62331593", "0.6203372", "0.6203372", "0.6193418", "0.6089249", "0.59869266", "0.5959281", "0.5702221", "0.55101806", "0.5510148", "0.54230016", "0.5420298", "0.5412782", "0.5324192", "0.53180...
0.8312047
0
Run a full attack on the domain with which we have been configured. Brute force a directory and file structure based on the wordlists with which we have been configured.
def brute(self, follow_redirects, max_depth, method="GET"): """TODO option to make max_depth be obeyed relative to the last successful dir? ie: with max_depth 3, example.com/fail/fail/fail fails out but once we hit example.com/fail/success/, keep going until we hit exam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runAttacks(self,\n policy: Policy,\n outputDir: str=None):\n outputDir = policy.getOutputDir(parent=outputDir) if \\\n policy else outputDir\n\n acCache = AccessListCache.get()\n acListInst = acCache.getAccessListFromPolicy(policy)\n\n ...
[ "0.61052847", "0.5582462", "0.5421415", "0.5398599", "0.5380833", "0.52952486", "0.5163187", "0.5157558", "0.50875354", "0.50039095", "0.49987626", "0.4996667", "0.49739432", "0.4954363", "0.4850667", "0.4829968", "0.47634757", "0.47529042", "0.47518617", "0.47344095", "0.472...
0.5599937
1
initialize your data structure here.
def __init__(self):        self.stack=[]        self.top1=-1        
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self.data = []\n self.record = {}", "def __init__(self):\n self.structure = {}", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self...
[ "0.7761043", "0.76102185", "0.7555967", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.752797", "0.7446006", "0.7446006", "0.7446006", "0.7446006", "0.7446006", "0.743338", "0.743338", "0.7408609", "0.7385719", "0.737986", "0.737986", "0.73...
0.0
-1
Computes the discounted reward for the entire episode.
def accumulate_rewards(rewards, gamma): reversed_rewards = rewards[::-1] # list reversal acc = list(itertools.accumulate(reversed_rewards, lambda x, y: x*gamma + y)) return np.array(acc[::-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount_and_normalize_rewards(self, episode_rewards):\n # Get empty array with the same size as the rewards array\n discounted_episode_rewards = np.zeros_like(episode_rewards)\n\n # Variable that stores value of the discounted reward being calculated by the loop\n current_reward = ...
[ "0.74826664", "0.7430066", "0.741672", "0.7255326", "0.71947306", "0.7184354", "0.71606743", "0.7058474", "0.6957285", "0.69207364", "0.6917125", "0.6786361", "0.6777256", "0.675367", "0.6746068", "0.6699113", "0.6676255", "0.6666142", "0.6660753", "0.6658038", "0.6646817", ...
0.0
-1
The function formats the data into input, output format for keras.
def format_data(data_history, gamma, constant_baseline=0.0): inp_rec_seq, inp_reward_seq, output_recs, reward_weights = [], [], [], [] for curr_recs, curr_rewards in zip(data_history['recommendation_seqs'], data_history['reward_seqs']): inp_rec_seq.append(curr_recs[:-1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_data(self, data: np.ndarray) -> np.ndarray:\n if self._validate:\n if len(data.shape) <= 1:\n raise DataProcessorError(\n \"The data should be an array with at least two dimensions.\"\n )\n\n return data", "def format_data(self...
[ "0.6314015", "0.6246027", "0.6231632", "0.61880815", "0.6053848", "0.6035714", "0.59119385", "0.58998334", "0.58435905", "0.5785506", "0.57303697", "0.57288903", "0.5716272", "0.56407213", "0.5639877", "0.56329596", "0.5605512", "0.5576301", "0.55761236", "0.5567073", "0.5542...
0.5448296
27
The function formats the data into input, output format for keras. This function is specific to the implementation of CVaR safety constraint.
def format_data_safe_rl(data_history, gamma, constant_baseline=0.0): inp_rec_seq, inp_reward_seq, output_recs, reward_weights = [], [], [], [] trajectories_cost = [] for curr_recs, curr_rewards, curr_safety_costs in zip( data_history['recommendation_seqs'], data_history['reward_seqs'], data_hist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_data(self, data: np.ndarray) -> np.ndarray:\n if self._validate:\n if len(data.shape) <= 1:\n raise DataProcessorError(\n \"The data should be an array with at least two dimensions.\"\n )\n\n return data", "def _format_data(sel...
[ "0.6250772", "0.5920552", "0.5892971", "0.5890803", "0.5845975", "0.5780606", "0.54537845", "0.54380304", "0.5425152", "0.5380497", "0.5314547", "0.5235957", "0.5224633", "0.5224549", "0.51962775", "0.51615614", "0.51596385", "0.5113475", "0.5094499", "0.5078179", "0.50427276...
0.49504268
31
Format data for movielens RNN agent update step.
def format_data_movielens(data_history, gamma, constant_baseline=0.0, mask_already_recommended=False, user_id_input=True, **kwargs): inp_rec_seq, inp_reward_seq, output_recs, reward_weights = [], [], [], [] user_id_seq = [] trajectories_cost = [] if mask_alrea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(self, data):", "def format(self, data):", "def _formatData(self):\r\n assert self._runData is not None\r\n\r\n # Getting Axes data into separate lists\r\n x=[]; y=[]; z=[]\r\n for i in range(len(self._runData)):\r\n ySet = []; xSet = []; zSet = []\r\n ...
[ "0.62151235", "0.61034393", "0.5625424", "0.5501767", "0.5371727", "0.533092", "0.5279299", "0.5247887", "0.5191981", "0.5178478", "0.5173216", "0.51704234", "0.51599264", "0.5084671", "0.5054417", "0.50439805", "0.50328034", "0.5023124", "0.49991286", "0.49879792", "0.491233...
0.0
-1
Format data for movielens RNN agent update step.
def format_data_batch_movielens(data_history, gamma, constant_baseline=0.0, mask_already_recommended=False, user_id_input=True, **kwargs): inp_rec_seq, inp_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(self, data):", "def format(self, data):", "def _formatData(self):\r\n assert self._runData is not None\r\n\r\n # Getting Axes data into separate lists\r\n x=[]; y=[]; z=[]\r\n for i in range(len(self._runData)):\r\n ySet = []; xSet = []; zSet = []\r\n ...
[ "0.62151235", "0.61034393", "0.5625424", "0.5501767", "0.5371727", "0.533092", "0.5279299", "0.5247887", "0.5191981", "0.5178478", "0.5173216", "0.51704234", "0.51599264", "0.5084671", "0.5054417", "0.50439805", "0.50328034", "0.5023124", "0.49991286", "0.49879792", "0.491233...
0.0
-1
Loads RNNAgent model from the path.
def load_model(filepath, optimizer_name, learning_rate=None, momentum=None, gradient_clip_value=None, gradient_clip_norm=None): tmp_model_file_path = os.path.join(tempfile.gettempdir(), 'tmp_model.h5') file_util.copy(filepath, tmp_model_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, model_path: str):", "def load_model(self, path):\n pass", "def load(path_to_model):\n pass", "def load_model(self):\n if os.stat('code/lr-model.pt').st_size == 0:\n return\n params = torch.load('code/lr-model.pt')\n self.set_params(params)", ...
[ "0.7680528", "0.76016873", "0.7450854", "0.74493736", "0.73280495", "0.72616035", "0.72341067", "0.72091913", "0.7154966", "0.71253365", "0.7112163", "0.711106", "0.7059853", "0.6976574", "0.6972874", "0.6958696", "0.6945698", "0.6940508", "0.693897", "0.69260585", "0.6889142...
0.0
-1
Produce a message to be sent to the client
async def producer(): # TODO await asyncio.sleep(1) return "Test"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, msg):\n cmd = self.__compose(msg)\n self.sock.send(cmd)", "def produce(self, message):\n self.producer.send(self.topic, message)", "async def send(self, message):", "def send(self, msg):\n self.message('Me', msg)", "def send(self, msg):\n pass", "def...
[ "0.67657566", "0.67215765", "0.6719323", "0.6709652", "0.66985375", "0.66985375", "0.66985375", "0.6639729", "0.663648", "0.65998", "0.6583822", "0.6571753", "0.6563523", "0.6556051", "0.6508014", "0.6472861", "0.6471602", "0.6410295", "0.63898164", "0.63897264", "0.6379636",...
0.0
-1
Handle an incoming message from the client
async def consumer(message): # TODO print(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, message):\n print(\"You received a message:\")\n print(message)\n # Overwrite this function to do something with the message!", "def handle(self, message):", "def _handle_message(self, msg):\n self.event('message', msg)", "def handle(self):\n self.ip = self...
[ "0.80266124", "0.7809786", "0.77366966", "0.76922536", "0.76625097", "0.76180035", "0.75640327", "0.7540196", "0.7486705", "0.7470195", "0.7465139", "0.7313078", "0.7188383", "0.71748143", "0.71278876", "0.7114025", "0.7101321", "0.7091043", "0.7091043", "0.70842177", "0.7083...
0.0
-1
Handle sending to and receiving from client
async def handler(websocket, path): print("Connected") # print(vars(websocket)) # global connected # # Register. # connected.add(websocket) # try: # # Implement logic here. # await asyncio.wait([ws.send("Hello!") for ws in connected]) # await asyncio.sleep(10) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self):\n self.ip = self.client_address[0]\n self.port = self.client_address[1]\n self.connection = self.request\n #self.logged_in = False\n\n # Loop that listens for messages from the client\n while True:\n received_string = self.connection.recv(4096)...
[ "0.708529", "0.7018448", "0.69944143", "0.6946621", "0.69224364", "0.6911591", "0.6822991", "0.6816772", "0.6740385", "0.67231447", "0.66530687", "0.6620048", "0.6618178", "0.6612965", "0.66045904", "0.65902686", "0.65812224", "0.6549281", "0.65410584", "0.652811", "0.6524247...
0.0
-1
Get the checkpoint path from the given model output directory
def _get_checkpoint(self): ckpt = tf.train.get_checkpoint_state(self.model) if ckpt and ckpt.model_checkpoint_path: ckpt_path = ckpt.model_checkpoint_path else: raise RuntimeError('No checkpoint file found') return ckpt_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_dir(self):\n return os.path.join(self.checkpoint_dir, self.model_dir)", "def _checkpoint_dir(job_log_dir: str) -> str:\n return os.path.join(job_log_dir, 'checkpoints')", "def get_checkpoint_path(self) -> str:\n return self._j_checkpoint_storage.getCheckpointPath().toString()", "def...
[ "0.8124849", "0.7751144", "0.7577298", "0.746758", "0.7276259", "0.71268463", "0.7119968", "0.7004831", "0.6968759", "0.6910264", "0.68485147", "0.6757792", "0.6754972", "0.67422986", "0.67221975", "0.6708189", "0.6678933", "0.6621704", "0.65912944", "0.65912944", "0.6507298"...
0.7458354
4
String for representing the Organization object (in Admin site etc.).
def __str__(self): if self.name != None and self.name != '': return self.name else: return "Organization object owned by %s."%(self.owner)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str('%s (%s)' % (self.company, self.owner))", "def organization_name(self):\n if self.organization is not None:\n return self.organization.name\n\n return ''", "def org_urn(self):\n return f\"psc:org:{self.credentials.org_key}\"", "def organi...
[ "0.7165319", "0.6806214", "0.6790389", "0.64104795", "0.6407919", "0.6346011", "0.6310931", "0.63100046", "0.630681", "0.6305702", "0.6300019", "0.62802875", "0.6278159", "0.6271169", "0.626531", "0.62608826", "0.6247357", "0.620912", "0.6205226", "0.61515045", "0.61467075", ...
0.76456773
0
Return a graph of station data.
def data_graph(): station_reference = request.args.get("stationReference") station_name = request.args.get("stationName") station_name = station_name.replace(" ","+") if station_name is not None: # station_data = station_data.replace(" ", "+") station = station_data.loc[station_data.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati...
[ "0.67551476", "0.656002", "0.65165", "0.6463983", "0.64335907", "0.6389499", "0.6388792", "0.638696", "0.6359457", "0.6335296", "0.6310423", "0.6298127", "0.62936765", "0.6238035", "0.6215655", "0.6190057", "0.6184878", "0.61778945", "0.617618", "0.61750436", "0.61674297", ...
0.5977963
41
Return station tide info.
def draw_html(): station_reference = request.args.get("stationReference") station_name = request.args.get("stationName") station_name = station_name.replace(" ","+") # print("**********") # print(station_name) # print("**********") # print("**********") # print(station_data.stationName) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_station(station_id):\n return STATIONS.station_details_for(station_id)", "def weatherstation_info_command(station_id):\n station = stations.get_station(station_id)\n print(station)", "def get_station_boroughs(self):\\", "def prism_station_details(self, station_id):\n if self.cursor is...
[ "0.6912989", "0.6862332", "0.64211416", "0.63385594", "0.6311428", "0.60967267", "0.608455", "0.6082878", "0.60771835", "0.60742456", "0.60365105", "0.60324866", "0.59842825", "0.5912893", "0.588451", "0.5863232", "0.5842666", "0.58136994", "0.58136994", "0.58052826", "0.5803...
0.0
-1
Generates nonlinearly separable data and returns the samples and class labels
def load_non_linearly_separable_data(): x, y = make_gaussian_quantiles(n_features=2, n_classes=2, random_state=1) assert np.bitwise_or(y == 0, y == 1).all() return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_data(groups):\n # get path list for the intended classification problem\n input_paths = generate_input_list(groups) \n X_lst = []\n y = []\n for p in input_paths:\n dp = pd.read_csv(p, sep = '\\t') #datapoint\n # Normalization \n # norm = lambda x: (x - x.mean()) / ...
[ "0.6725396", "0.64309126", "0.63958347", "0.63937193", "0.6377529", "0.636468", "0.63290304", "0.62903607", "0.6288107", "0.6281172", "0.62540567", "0.62314403", "0.62133723", "0.6178726", "0.614421", "0.6132435", "0.612361", "0.61162657", "0.6115919", "0.6110773", "0.6107986...
0.60316014
26
setup GPU device if available, move model into configured device
def _prepare_device(self, n_gpu_use): n_gpu = torch.cuda.device_count() if n_gpu_use > 0 and n_gpu == 0: self.logger.warning( "Warning: There\'s no GPU available on this machine, training will be performed on CPU.") n_gpu_use = 0 if n_gpu_use > n_gpu: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_device(n_gpus: int) -> object:\n if n_gpus >= 1 and torch.cuda.is_available():\n LOG.info('\\n CUDA is available! using GPU...')\n return torch.device('cuda')\n else:\n LOG.info('\\n Using CPU...')\n return torch.device('cpu')", "def create_gpu_device_if_present():\n ...
[ "0.7189841", "0.6974946", "0.68392825", "0.68199843", "0.67975026", "0.6781155", "0.67694235", "0.6714223", "0.6713853", "0.6688746", "0.66411406", "0.66013426", "0.6601249", "0.65606564", "0.6550351", "0.6538365", "0.6532433", "0.6494333", "0.6494088", "0.6472267", "0.645544...
0.6146334
42
Training logic for an epoch
def _train_epoch(self, epoch): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_one_epoch(self):\n raise NotImplementedError", "def train(self, training_steps=10):", "def train():\n pass", "def train_epoch(self, data_loader):\n raise NotImplementedError", "def train(self):\n self.epoch = 0\n self.step = 0\n self.start_time = time.tim...
[ "0.81284416", "0.8044275", "0.795282", "0.7818035", "0.7789884", "0.7776823", "0.7748766", "0.7745458", "0.77287894", "0.7725468", "0.76904434", "0.7620618", "0.7620618", "0.7620618", "0.7620618", "0.7620618", "0.76109827", "0.75628734", "0.7556383", "0.7547646", "0.7536899",...
0.84083605
2
Resume from saved checkpoints
def _resume_checkpoint(self, resume_path): self.logger.info("Loading checkpoint: {} ...".format(resume_path)) checkpoint = torch.load(resume_path) self.start_epoch = checkpoint['epoch'] + 1 self.mnt_best = checkpoint['monitor_best'] # load model params from checkpoint. i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume(self, checkpoint):\n model_dict = paddle.load(checkpoint)\n self.model.set_state_dict(model_dict)", "def _resume_checkpoint(self, resume_path):\n self.logger.info(\"Loading checkpoint: {} ...\".format(resume_path))\n checkpoint = torch.load(resume_path)\n self.start_...
[ "0.7948833", "0.79420406", "0.7860005", "0.7762703", "0.7674831", "0.7672587", "0.75724417", "0.74276704", "0.72801906", "0.72801906", "0.72801906", "0.72574735", "0.71175265", "0.7104059", "0.71037406", "0.7057032", "0.6996928", "0.69433475", "0.69009686", "0.68490225", "0.6...
0.78904974
2
Yields counts of character ngrams from string s of order n.
def extract_char_ngrams(self, s: str, n: int) -> Counter: return Counter([s[i:i + n] for i in range(len(s) - n + 1)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_char_ngrams(s: str, n: int) -> Counter:\n return Counter([s[i:i + n] for i in range(len(s) - n + 1)])", "def precook(s, n=4, out=False):\n words = s.split()\n counts = defaultdict(int)\n for k in xrange(1,n+1):\n for i in xrange(len(words)-k+1):\n ngram = tuple(words[i:i+k])\n coun...
[ "0.82485414", "0.76264787", "0.73532337", "0.73268604", "0.71129584", "0.7092459", "0.70224917", "0.6941578", "0.6845443", "0.67267495", "0.6712389", "0.6680387", "0.66529167", "0.6583822", "0.6576275", "0.65749717", "0.65712875", "0.6563945", "0.6559195", "0.6554432", "0.653...
0.8287722
1
Yields counts of character ngrams from string s of order n.
def extract_char_ngrams(self, s: str, n: int) -> Counter: return Counter([s[i:i + n] for i in range(len(s) - n + 1)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_char_ngrams(s: str, n: int) -> Counter:\n return Counter([s[i:i + n] for i in range(len(s) - n + 1)])", "def precook(s, n=4, out=False):\n words = s.split()\n counts = defaultdict(int)\n for k in xrange(1,n+1):\n for i in xrange(len(words)-k+1):\n ngram = tuple(words[i:i+k])\n coun...
[ "0.82485414", "0.76264787", "0.73532337", "0.73268604", "0.71129584", "0.7092459", "0.70224917", "0.6941578", "0.6845443", "0.67267495", "0.6712389", "0.6680387", "0.66529167", "0.6583822", "0.6576275", "0.65749717", "0.65712875", "0.6563945", "0.6559195", "0.6554432", "0.653...
0.8287722
0
Computes ChrF on a single sentence pair.
def sentence_score(self, hypothesis: str, references: List[str]) -> CHRFScore: hypothesis, references = references[0], [hypothesis] assert not isinstance(references, str), \ "sentence_score needs a list of references, not a single string" stats = self.get_sentence_statistics(hypothe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chrf(hypotheses, references):\n return sacrebleu.corpus_chrf(hypotheses=hypotheses, references=references)", "def _chrf_score_compute(total_preds_char_n_grams: Dict[int, Tensor], total_preds_word_n_grams: Dict[int, Tensor], total_target_char_n_grams: Dict[int, Tensor], total_target_word_n_grams: Dict[int,...
[ "0.6330933", "0.60219", "0.5845918", "0.5628675", "0.55938405", "0.55922145", "0.55860597", "0.5574938", "0.555412", "0.5540551", "0.5536721", "0.55080277", "0.5410617", "0.5399693", "0.5389467", "0.53649914", "0.52740103", "0.5269019", "0.5247514", "0.5240202", "0.52391034",...
0.5269137
17
Extracts all the ngrams (min_order <= n <= max_order) from a sequence of tokens.
def extract_ngrams(line, min_order=1, max_order=BLEU.NGRAM_ORDER) -> Counter: ngrams = Counter() # type: Counter tokens = line.split() for n in range(min_order, max_order + 1): for i in range(0, len(tokens) - n + 1): ngram = ' '.join(tokens[i: i + n]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_grams(tokens, n):\n return zip(*[tokens[i:] for i in range(n)])", "def build_ngrams(tokens, n=2):\n ngrams = zip(*(islice(group, idx, None) for idx, group in enumerate(tee(tokens, n))))\n return ngrams", "def get_ngrams(tokens, min_n, max_n):\n all_ngrams = list()\n n_tokens = len(tokens)\...
[ "0.8024978", "0.78923404", "0.7772897", "0.75658435", "0.75516206", "0.7496225", "0.7459337", "0.7409229", "0.7395054", "0.7372828", "0.7341489", "0.728606", "0.7244324", "0.7237867", "0.72247565", "0.7176616", "0.7175382", "0.71394616", "0.71245074", "0.71214175", "0.7113682...
0.7025471
23
Extracts reference statistics for a given segment.
def reference_stats(refs, output_len): ngrams = Counter() closest_diff = None closest_len = None for ref in refs: tokens = ref.split() reflen = len(tokens) diff = abs(output_len - reflen) if closest_diff is None or diff < closest_diff: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_references(alignedsegment):\n \n references = [alignedsegment.reference_name]\n \n # Some reads don't have secondary hits\n if not alignedsegment.has_tag('XA'):\n return references\n \n # XA is a string contigname1,<other info>;contigname2,<other info>; ...\n secondary_al...
[ "0.5470782", "0.53688884", "0.53582793", "0.53248024", "0.5299202", "0.5170791", "0.5132248", "0.5121406", "0.51021016", "0.504924", "0.5033814", "0.5031647", "0.5017428", "0.4956699", "0.4956699", "0.4898067", "0.4897853", "0.48240963", "0.4789918", "0.47849065", "0.47824642...
0.48478
17
Produces BLEU scores along with its sufficient statistics from a source against one or more references.
def corpus_score(self, sys_stream: Union[str, Iterable[str]], ref_streams: Union[str, List[Iterable[str]]], use_effective_order: bool = False) -> BLEUScore: # Add some robustness to the input arguments if isinstance(sys_stream, str): sys_stream = [s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bleu_score(references, generated, n_gram=4, smooth=False):\r\n formatted_ref = [[ref] for ref in references]\r\n bleu_s, _, _, _, _, _ = compute_bleu(formatted_ref, generated, n_gram, smooth)\r\n return bleu_s * 100", "def bleu_stats(hypothesis, reference):\n stats = []\n stats.append(len(hypo...
[ "0.6538913", "0.611638", "0.611638", "0.5920825", "0.58097124", "0.57767993", "0.56798124", "0.56685686", "0.56611174", "0.5635664", "0.5564803", "0.5557683", "0.5550513", "0.552961", "0.552961", "0.5481987", "0.5463703", "0.54276645", "0.5392559", "0.5389487", "0.5355115", ...
0.49421677
48
Perform ZCA whitening on an image.
def whiten(x, e): x = x - x.mean(0).repeat(x.size()[1], 1) sigma = x * x.t / x.shape[1] u, s, _ = torch.svd(sigma, some=False) return u * torch.diag(1 / torch.sqrt(S.diag() + e)) * u.t * x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ZCA_whitening(imageVector):\n\n sigma = np.dot(inputs, inputs.T)/inputs.shape[1] #Correlation matrix\n U,S,V = np.linalg.svd(sigma) #Singular Value Decomposition\n epsilon = 0.1 #Whitening constant, it prevents division by zero\n ZCAMatrix = np.dot(np.dot(U, np.diag(1.0/np.sqrt(np.di...
[ "0.6916947", "0.65716195", "0.6485328", "0.6384206", "0.63341457", "0.62049633", "0.5988863", "0.5755377", "0.56526095", "0.55399", "0.5451515", "0.5449809", "0.54059184", "0.5369222", "0.53182316", "0.530681", "0.52628165", "0.5259321", "0.5207307", "0.5207307", "0.5117338",...
0.5035
24
Apply Gaussian noise to an input tensor.
def gaussian_noise(tensor, mean, stddev): noise = Variable(tensor.data.new(tensor.size()).normal_(mean, std)) return tensor + noise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_noise(self, tensor):\n return tensor.new_empty(tensor.size()).normal_(std=self._discreteness)", "def task_gaussian_noise(input_array, noise_factor):\n return(np.random.normal(0, noise_factor, input_array.shape))", "def add_gaussian_noise(X, mu=0, sigma=0.1):\n noise = np.random.normal...
[ "0.78414464", "0.7245466", "0.71811473", "0.71459424", "0.68363976", "0.6799063", "0.66733646", "0.66543114", "0.65751487", "0.6564241", "0.6492763", "0.64736784", "0.64736784", "0.64586484", "0.64251614", "0.6397649", "0.6334172", "0.63252485", "0.6302892", "0.6299813", "0.6...
0.7755156
1
Add a `canon` option to `f` which toggles canonicalizes the return value of `f`.
def canon(f): @wraps(f) def wrapped(G, H, canon=True): game = f(G, H) if canon: game = canonicalize(game) return game return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pony_func(func):\n func.is_pony_func = True\n return func", "def main():\n parser = argparse.ArgumentParser(description=(\n 'Canonicalize Call Graphs to FASTEN Canonical Call Graphs'))\n parser.add_argument('directory', help=(\n 'a directory with the Call Graph, and description file...
[ "0.49801686", "0.48075998", "0.4801738", "0.47585616", "0.47026438", "0.47009388", "0.46868795", "0.46559855", "0.46223104", "0.46175477", "0.45939246", "0.45530087", "0.4538339", "0.44475698", "0.4445085", "0.44408873", "0.44223046", "0.4421128", "0.44015473", "0.43992308", ...
0.635531
0
Move in exactly one component.
def disjunctive(G, H): left_1 = {disjunctive(G_L, H) for G_L in G._left} left_2 = {disjunctive(G, H_L) for H_L in H._left} right_1 = {disjunctive(G_R, H) for G_R in G._right} right_2 = {disjunctive(G, H_R) for H_R in H._right} return Game(left_1 | left_2, right_1 | right_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n pass", "def move(self):\n raise NotImplementedError", "def move_to_position1(self):", "def move_to_position2(self):", "def _move_in_one_more_block():\n with tik_inst.for_range(0, sub_h_align_block_size) as sub_h_idx:\n tik_inst.data_move(dst[sub_w_block * d...
[ "0.6899064", "0.66450226", "0.6615794", "0.63474816", "0.62919295", "0.6285745", "0.62708914", "0.6266035", "0.6195555", "0.61668605", "0.61501706", "0.6106435", "0.60828984", "0.6042071", "0.6039131", "0.60356104", "0.6013029", "0.60085666", "0.59947014", "0.5982884", "0.597...
0.0
-1
Move in all components. Play ends when any one of them terminates.
def conjunctive(G, H): left = {conjunctive(G_L, H_L) for G_L in G._left for H_L in H._left} right = {conjunctive(G_R, H_R) for G_R in G._right for H_R in H._right} return Game(left, right)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n pass", "def handleMove(self):\n pass", "def run(self):\n while not self.turn_over:\n self.go()", "def run(self):\n for _ in range(self.num_iteration):\n self.move()\n time.sleep(self.speed)\n if not self.is_running:\n ...
[ "0.67165536", "0.6450276", "0.642639", "0.63869965", "0.6380625", "0.63037014", "0.6282754", "0.6249404", "0.6245922", "0.62315774", "0.62287354", "0.6171988", "0.6170963", "0.6135099", "0.6109948", "0.61098945", "0.6106997", "0.6100875", "0.6084784", "0.60692745", "0.6066481...
0.0
-1
Move in any number of components, but at least one.
def selective(G, H): left_1 = {selective(G_L, H) for G_L in G._left} left_2 = {selective(G, H_L) for H_L in H._left} left_3 = {selective(G_L, H_L) for G_L in G._left for H_L in H._left} right_1 = {selective(G_R, H) for G_R in G._right} right_2 = {selective(G, H_R) for H_R in H._right} right_3 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _move_in_one_more_block():\n with tik_inst.for_range(0, sub_h_align_block_size) as sub_h_idx:\n tik_inst.data_move(dst[sub_w_block * data_cnt_one_block * sub_h_idx],\n src[w_offset + w_size * sub_h_idx], 0, 1, sub_w_block, 0, 0)\n # in order to avoid d...
[ "0.6018227", "0.59535146", "0.59033984", "0.5829751", "0.5825883", "0.57707506", "0.5694387", "0.56823575", "0.5666963", "0.5642597", "0.5641661", "0.5638052", "0.55918825", "0.5589538", "0.55241865", "0.55067444", "0.54987234", "0.54837316", "0.5470003", "0.5466049", "0.5463...
0.0
-1
Move in exactly one component. Play ends immediately when any one of them terminates.
def diminished_disjunctive(G, H): if G == 0 or H == 0: return Game(0) else: left_1 = {diminished_disjunctive(G_L, H) for G_L in G._left} left_2 = {diminished_disjunctive(G, H_L) for H_L in H._left} right_1 = {diminished_disjunctive(G_R, H) for G_R in G._right} right_2 = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_one_move(self):\n self.print(\"top of move\")\n # 1) grab three cups\n c1 = self.take_cup_after(self.current_cup_idx())\n c2 = self.take_cup_after(self.current_cup_idx())\n c3 = self.take_cup_after(self.current_cup_idx())\n print(f\"pick up: {c1}, {c2}, {c3}\")\n ...
[ "0.647995", "0.6420473", "0.64017844", "0.6215315", "0.61987627", "0.6173288", "0.6152753", "0.6094539", "0.60649693", "0.6058507", "0.602774", "0.6017141", "0.5978515", "0.5970727", "0.594726", "0.5940435", "0.5864352", "0.58516985", "0.5839466", "0.58298063", "0.58190876", ...
0.0
-1
Move in all nonterminal components. Play ends only after all components terminate.
def continued_conjunctive(G, H): if G == 0 or H == 0: return disjunctive(G, H) else: left = {continued_conjunctive(G_L, H_L) for G_L in G._left for H_L in H._left} right = {continued_conjunctive(G_R, H_R) for G_R in G._right for H_R in H._right} return Game(left, right)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\r\n segments = len(self.all_turtles) - 1\r\n for i in range(len(self.all_turtles)):\r\n if segments == 0:\r\n self.all_turtles[segments].forward(MOVE_DISTANCE)\r\n else:\r\n new_x = self.all_turtles[segments - 1].xcor()\r\n ...
[ "0.58747476", "0.5517833", "0.5281134", "0.521895", "0.5170323", "0.5140568", "0.50613856", "0.50562793", "0.5037675", "0.49982315", "0.49946517", "0.49908346", "0.49866736", "0.49725467", "0.4972026", "0.49627477", "0.49455985", "0.494381", "0.49339187", "0.49254557", "0.489...
0.0
-1