query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Create application for the tests. | def app():
_app = create_app("flaskapp.settings.testing")
_app.logger.setLevel(logging.CRITICAL)
ctx = _app.test_request_context()
ctx.push()
yield _app
ctx.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application():\n yield create_test_application()",
"def create_and_run():\n\n app = App()\n app.run()",
"def create_app(self):\n\n app = create_app()\n app.config.from_object('project.config.TestingConfig')\n return app",
"def app():\n print('creating app with test vars')... | [
"0.78650266",
"0.78183943",
"0.779372",
"0.7706425",
"0.7696785",
"0.76925087",
"0.76771784",
"0.76373273",
"0.7630568",
"0.76160675",
"0.7544439",
"0.7523237",
"0.75079054",
"0.7506175",
"0.74288905",
"0.74103117",
"0.73966044",
"0.737695",
"0.73750865",
"0.7362577",
"0.7358... | 0.0 | -1 |
Create a new profile from an existing profile | def wlanCopyProfile(self, iface, profile, newProfile, ssid=None, pass_phrase=None, saveOrigProfile=None, saveNewProfile=None):
sXML = self.wlanGetProfile(iface, profile, saveToFile=saveOrigProfile)
#print sXML
reProf = re.compile('<{0}>.*</{0}>'.format('name'))
reProf2 = re.compile('<{0}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ... | [
"0.8025856",
"0.74423146",
"0.73864764",
"0.73674834",
"0.73625",
"0.73201007",
"0.7273355",
"0.7258695",
"0.72443515",
"0.72335404",
"0.7229877",
"0.7214494",
"0.7181721",
"0.715497",
"0.7084597",
"0.7083544",
"0.70644885",
"0.706198",
"0.7054918",
"0.70378166",
"0.7000497",... | 0.0 | -1 |
Cutoff value (float) for maximum length of a path to reach goal; no valid path returned by the planner has higher cost than this. | def dead_end_value(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCutoffDistance(self):\n return self.cutoffDistance",
"def cutoff_distance(self):\n return self._cutoff_distance",
"def GetEpsilonBeer(Abs, conc, pathLength):\n return Abs / (conc * pathLength)",
"def pathcost_cooler(k=5, lam=0.0003, limit=3000):\n return lambda t: (k * exp(-lam * t... | [
"0.66599065",
"0.6464602",
"0.59441173",
"0.5824008",
"0.5823617",
"0.5738601",
"0.5698907",
"0.563141",
"0.562286",
"0.55233145",
"0.5477712",
"0.5420577",
"0.53618807",
"0.53434753",
"0.53083557",
"0.5302423",
"0.52958834",
"0.5275068",
"0.5263953",
"0.5245157",
"0.5243079"... | 0.0 | -1 |
Assemble mac address from the list | def _get_mac_address(self, mac_numbers):
mac = ""
for num in mac_numbers:
num = self._convert_to_hex(num)
mac = ':'.join((mac, num))
mac = mac[1:]
return mac | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_address(self):\n mac = [\n self.random.randint(0x00, 0xff),\n self.random.randint(0x00, 0xff),\n self.random.randint(0x00, 0xff),\n self.random.randint(0x00, 0xff),\n self.random.randint(0x00, 0xff),\n self.random.randint(0x00, 0xff)\... | [
"0.7022228",
"0.68802977",
"0.6582795",
"0.6570698",
"0.6570698",
"0.6570698",
"0.6570698",
"0.6556131",
"0.6456271",
"0.6389757",
"0.63864744",
"0.6316981",
"0.6316593",
"0.63095945",
"0.6283913",
"0.62120837",
"0.6191361",
"0.6191361",
"0.61385566",
"0.61184037",
"0.6116887... | 0.740949 | 0 |
Read private key and certificates from files. Return (private key, certificates) chain pair. | def read_chain_pair(private_key, certificates):
with open(private_key, 'rb') as f:
private_key = f.read()
with open(certificates, 'rb') as f:
certificates = f.read()
return (private_key, certificates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_key_and_cert(key_file, cert_file):\n with open(cert_file, 'rb') as f:\n cert = x509.load_pem_x509_certificate(f.read(), default_backend())\n with open(key_file, 'rb') as f:\n key = serialization.load_pem_private_key(f.read(), None, backend=default_backend())\n\n ... | [
"0.6391459",
"0.62914973",
"0.5971284",
"0.59437066",
"0.58221966",
"0.57909185",
"0.57617474",
"0.5750648",
"0.564614",
"0.5595037",
"0.5582063",
"0.55411404",
"0.54925364",
"0.5485883",
"0.54124856",
"0.5362128",
"0.5354524",
"0.5340389",
"0.5324609",
"0.5308338",
"0.526386... | 0.8233212 | 0 |
Applies network layers and ops on input image(s) x. | def forward(self, x, test=False):
sources = list()
loc = list()
conf = list()
# apply bases layers and cache source layer outputs
for k in range(len(self.base)):
x = self.base[k](x)
if k in self.feature_layer:
if len(sources) == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_network(inputs):\n return apply_layer(tf.sigmoid(apply_layer(inputs, 64)), 1)",
"def forward(self, x):\n for task_module_name in self.task_module_name_path[self.task_idx]:\n for layer in self.task_modules[task_module_name]:\n x = layer(x)\n #x = self.task_... | [
"0.65620095",
"0.63693756",
"0.6366089",
"0.63534147",
"0.6309185",
"0.6308151",
"0.6257753",
"0.6208064",
"0.6199206",
"0.619269",
"0.61763096",
"0.616371",
"0.6153872",
"0.6143252",
"0.61291367",
"0.61276346",
"0.61222804",
"0.61158955",
"0.6111172",
"0.60992426",
"0.608334... | 0.0 | -1 |
Return the best partial ratio match from fuzzywuzzy module. | def top_partial_ratio(group):
scores = []
for c0, c1 in combinations(group, 2):
score = fuzz.partial_ratio(c0.value, c1.value)
field = c0 if len(c0.value) >= len(c1.value) else c1
scores.append(FuzzyRatioScore(score, field))
scores = sorted(scores, reverse=True, key=lambda s: (s.sco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fuzzy_partial_ratio(thing_1, thing_2):\n return fuzz.partial_ratio(thing_1, thing_2)",
"def fuzzy_ratio(thing_1, thing_2):\n return fuzz.ratio(thing_1, thing_2)",
"def find_best_match(fpl_teams: List[str], team: str) -> Tuple[str, int]:\n best_ratio = 0.0\n best_match = None\n for t in fpl_teams... | [
"0.767117",
"0.706915",
"0.7045623",
"0.69615054",
"0.688134",
"0.68650913",
"0.6457859",
"0.62769884",
"0.6275168",
"0.60757107",
"0.6075642",
"0.60390335",
"0.60216784",
"0.60216784",
"0.5956916",
"0.5956916",
"0.59508455",
"0.59213847",
"0.5902485",
"0.5899878",
"0.5849218... | 0.7887274 | 0 |
Return all arguments required to execute CLI | def get_arguments(self):
args = self.parser.parse_args()
config = None
with open(args.config_file, "r") as f:
config = json.load(f)
if "collections" in config:
if len(config["collections"]) > 0:
collection = config["collections"][0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_arguments(self):\n pass",
"def __get_cli_args():\r\n parser = argparse.ArgumentParser()\r\n o = parser.add_mutually_exclusive_group()\r\n o.add_argument('-a', action='store_true')\r\n o.add_argument('-b', action='store_true')\r\n parser.add_argument('-suite', help='suite file na... | [
"0.8434595",
"0.7754269",
"0.7644272",
"0.76297367",
"0.76230663",
"0.75364363",
"0.74571276",
"0.7417445",
"0.7412155",
"0.7406127",
"0.7401388",
"0.73903877",
"0.73764217",
"0.7358373",
"0.73560494",
"0.7318047",
"0.73040634",
"0.72991544",
"0.7276237",
"0.72737163",
"0.725... | 0.0 | -1 |
Returns the resource schema path. | def GetSchemaPath(cls, for_help=False):
return export_util.GetSchemaPath(
'compute', cls.GetApiVersion(), 'BackendService', for_help=for_help) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bundled_schema_path():\n return str(data.load_resource(\"schema\"))",
"def _get_base_schema_path(base_schema: str = None) -> str:\n biothings_schema_path = LOADER.filename(\"data_models/biothings.model.jsonld\")\n base_schema_path = biothings_schema_path if base_schema is None else base_schema\n... | [
"0.8129537",
"0.7225695",
"0.7073041",
"0.70640045",
"0.68459177",
"0.6833207",
"0.67889005",
"0.67540175",
"0.67540175",
"0.6610404",
"0.64634776",
"0.6445213",
"0.6430494",
"0.6416756",
"0.6370232",
"0.63636297",
"0.62787116",
"0.62350994",
"0.6226971",
"0.6226971",
"0.6224... | 0.7178181 | 2 |
Create Backend Services patch request. | def ComposePatchRequest(self, client, backend_service_ref, replacement):
if backend_service_ref.Collection() == 'compute.regionBackendServices':
return (
client.apitools_client.regionBackendServices,
'Patch',
client.messages.ComputeRegionBackendServicesPatchRequest(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requestfactory_patch(self, path, data=None, content_type=client.MULTIPART_CONTENT, **extra):\r\n\r\n data = data or {}\r\n patch_data = self._encode_data(data, content_type)\r\n\r\n parsed = urlparse.urlparse(path)\r\n request = {\r\n 'CONTENT_LENGTH': len(patch_data),\r\n 'CONTENT_TY... | [
"0.6822116",
"0.6498407",
"0.6371376",
"0.6356031",
"0.6331954",
"0.63101476",
"0.618666",
"0.61838037",
"0.61745155",
"0.61538756",
"0.61318535",
"0.6130529",
"0.61251915",
"0.6110662",
"0.6103166",
"0.6076066",
"0.6054936",
"0.6054936",
"0.6054936",
"0.6049838",
"0.6041006"... | 0.6702764 | 1 |
Compute the intersection area of a numpy array of boxes and a single box. | def intersection(boxes, box):
ix = np.maximum(0, np.minimum(box[2], boxes[:,2]) - np.maximum(box[0], boxes[:,0]))
iy = np.maximum(0, np.minimum(box[3], boxes[:,3]) - np.maximum(box[1], boxes[:,1]))
return ix*iy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_inters(box, boxes, box_area):\n # Calculate intersection areas\n y1 = np.maximum(box[0], boxes[:, 0])\n y2 = np.minimum(box[2], boxes[:, 2])\n x1 = np.maximum(box[1], boxes[:, 1])\n x2 = np.minimum(box[3], boxes[:, 3])\n return np.divide(np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0)... | [
"0.7640445",
"0.73185265",
"0.7236327",
"0.7168402",
"0.7168402",
"0.7132642",
"0.7098993",
"0.70911914",
"0.7082353",
"0.70558786",
"0.696013",
"0.6940942",
"0.6880113",
"0.68699026",
"0.6814332",
"0.68049055",
"0.6767781",
"0.66969436",
"0.66479206",
"0.66479206",
"0.664419... | 0.78136355 | 0 |
Resize an image to given dimensions and transform the target accordingly. | def resize(sample, target_image_size, bbox_diag_threshold):
transformed_sample = {}
image = sample["image"]
scale_factors = np.array(target_image_size)/np.array(_size(image))
bboxes = sample["bboxes"]
bboxes = bboxes * np.tile(scale_factors, 2)
not_too_small = np.linalg.norm(bboxes[:,2:] - bbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(image_path, target_dimensions, image_format):\n with Image.open(image_path) as img:\n img = img.resize(target_dimensions, resample=Image.LANCZOS)\n if image_format == 'PNG':\n img = img.convert('RGBA')\n else:\n img = img.convert('RGB')\n img.save(ima... | [
"0.73642147",
"0.7287396",
"0.72173774",
"0.71214217",
"0.7111653",
"0.7009032",
"0.69824106",
"0.6782985",
"0.6747425",
"0.67268914",
"0.66843146",
"0.66701424",
"0.66636115",
"0.6641147",
"0.6636635",
"0.6615918",
"0.66053194",
"0.65742534",
"0.6569193",
"0.65666544",
"0.65... | 0.0 | -1 |
Get the list of functional units for the experiment. | def getFuList(self):
if self._fupardict:
return self._fupardict.keys()
buf = self._parent.Xeprbuf(10000)
self.aqGetExpFuList(buf, 10000)
return buf.get_unicode_str().split(',') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_units(self) -> List[str]:\n result = []\n for elements in self._get_results_list():\n result.append(elements[3])\n return result",
"def getListOfUnits(self, *args):\n return _libsbml.UnitDefinition_getListOfUnits(self, *args)",
"def client_units(self) -> List[Flyi... | [
"0.7093225",
"0.65067303",
"0.6453618",
"0.6437445",
"0.6428049",
"0.63517296",
"0.6145797",
"0.60083926",
"0.59385496",
"0.59025174",
"0.5840358",
"0.5831512",
"0.5831512",
"0.58269817",
"0.58130693",
"0.5776839",
"0.57549787",
"0.57283396",
"0.5718893",
"0.5671003",
"0.5671... | 0.5055429 | 91 |
Get the feature dimension of this data. | def feature_size(self):
return self.fingerprint_length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_dimension(self) -> int:\n return self._feature_dimension",
"def feature_dim(self):\n return feature_dim_from_test_system(self)",
"def features_dim(self):\n if not self.exposes_features:\n return None\n\n dim = self._features_op.outputs[0].get_shape().as_list()... | [
"0.89637285",
"0.86458623",
"0.8564586",
"0.83512133",
"0.8064637",
"0.7931219",
"0.78060144",
"0.7794164",
"0.77869695",
"0.77869695",
"0.77869695",
"0.77869695",
"0.7766574",
"0.7721604",
"0.7697934",
"0.7682128",
"0.7605907",
"0.75448817",
"0.75407034",
"0.75349915",
"0.75... | 0.0 | -1 |
Lookahead matching of the given parse expression. C{FollowedBy} does not advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list. | def __init__(self, expr):
pattern = r"(?=%s)" % _silent_pattern(expr) # standard lookahead
super(FollowedBy, self).__init__(pattern, silent=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, input_reader):\n retval = []\n # skip the whitespace here to prevent errors at the end of the string\n if input_reader.getIgnoreState():\n input_reader.skipWhite()\n retval.append(self.__rule.match(input_reader))\n try:\n while True:\n ... | [
"0.57092345",
"0.51224923",
"0.50611615",
"0.5051354",
"0.5044692",
"0.50340766",
"0.5002219",
"0.49619815",
"0.49585378",
"0.4927308",
"0.4903575",
"0.49026915",
"0.48927513",
"0.4887522",
"0.48688808",
"0.485787",
"0.4854168",
"0.48492277",
"0.4842384",
"0.47809103",
"0.478... | 0.614381 | 0 |
Returns the subset of words that appear in the vocabulary | def _known_in(self, words):
return set(word for word in words if self._word_2_frequency.get(word)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known(words):\n return [w for w in words if w in tokenizer.vocab] #change vocab file?",
"def vocabulary(corpus_tokenized):\n vocab = list()\n for element in corpus_tokenized:\n document = element['document']\n for word in document:\n if word not in vocab:\n vo... | [
"0.7594449",
"0.720146",
"0.70779043",
"0.7063525",
"0.7058395",
"0.69525725",
"0.69047606",
"0.69046646",
"0.6876374",
"0.68029535",
"0.6776875",
"0.6718827",
"0.6660168",
"0.6533313",
"0.6492384",
"0.64660704",
"0.6452104",
"0.64520884",
"0.642334",
"0.64188725",
"0.6406661... | 0.63981956 | 22 |
Checks if the current user is a registered admin for the current project | def is_admin(self):
return self._is_admin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self):\n if not self.current_user:\n return False\n else:\n return self.current_user in [\"1\"]",
"def check_is_admin(current_user):\n return current_user['isAdmin'] == True",
"def is_admin(user):\n return user.is_authenticated and user.id == app.confi... | [
"0.8297756",
"0.8160167",
"0.80554956",
"0.8043304",
"0.79863364",
"0.79214054",
"0.7903485",
"0.7887539",
"0.7857068",
"0.78517",
"0.78253925",
"0.7813934",
"0.78050643",
"0.7784232",
"0.7778466",
"0.77617514",
"0.77617204",
"0.77617204",
"0.7747296",
"0.77374744",
"0.772453... | 0.7416524 | 38 |
Method to determine if a specific user has access to a given file | def has_access(self):
self._has_access = False
if self.read_contact_info is not None:
if self.read_contact_info['USERNAME'] == consts.USERNAME or \
consts.USERNAME in consts.REGISTEREDADMINS:
self._has_access = True
return self._has_access | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_repo_file_privilege(login, repo_base, repo, privilege):\n repo = repo.lower()\n repo_base = repo_base.lower()\n\n # Users always have privileges over their own files.\n if login == repo_base:\n return\n\n # Check if the current user or the public user has the p... | [
"0.6930615",
"0.6836904",
"0.6724489",
"0.66948104",
"0.6682556",
"0.66695434",
"0.66538167",
"0.6621766",
"0.6619583",
"0.65748703",
"0.65140116",
"0.6506986",
"0.6495302",
"0.6474799",
"0.64360607",
"0.6389911",
"0.6389425",
"0.6388728",
"0.6342937",
"0.6318559",
"0.6317628... | 0.6043489 | 37 |
Loads the query molecule from SMILES, molblock or InChI. | def load_query(self, query_string: str) -> np.ndarray:
rdmol = load_molecule(query_string)
fp = build_fp(rdmol, self.fp_type, self.fp_params, 0)
return np.array(fp, dtype=np.uint64) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_molecule(self):\n self.pymol = pybel.readstring(self.input_format, self.file_dic['input'])",
"def _set_molecule_from_smiles(self, mol_smiles):\n try:\n self.mol_graph = Chem.MolFromSmiles(mol_smiles)\n except Exception:\n raise LoadingError(f'{mol_smiles} coul... | [
"0.6670654",
"0.6001101",
"0.5710529",
"0.56766015",
"0.56631404",
"0.5651736",
"0.56413436",
"0.5599945",
"0.5409557",
"0.5342238",
"0.5283499",
"0.5217227",
"0.51927537",
"0.5192512",
"0.51640475",
"0.51393247",
"0.5125168",
"0.5119117",
"0.51116127",
"0.5100645",
"0.504425... | 0.61572385 | 1 |
Private method to convert a datetime object into a timestamp | def _datetime_to_timestamp(self, dt):
return time.mktime(dt.timetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_timestamp(obj: \"datetime\") -> \"Timestamp\":\n td = datetime_to_epoch_timedelta(obj)\n ts = Timestamp()\n ts.seconds = td.seconds + td.days * _SECONDS_PER_DAY\n ts.nanos = td.microseconds * _NANOS_PER_MICROSECOND\n return ts",
"def to_stamp(datetime_):\r\n try:\r\n retu... | [
"0.72915614",
"0.7261263",
"0.7230859",
"0.72280365",
"0.72121686",
"0.7209182",
"0.7165147",
"0.7133808",
"0.7081074",
"0.70417845",
"0.70254016",
"0.701384",
"0.6949144",
"0.69176286",
"0.68709433",
"0.6847967",
"0.6819334",
"0.680639",
"0.68053293",
"0.67908376",
"0.672243... | 0.7956671 | 0 |
Shows you a user's info. Defaults to message author if user is not specified. | async def userinfo(self, ctx, user: discord.Member=None):
if user is None:
member = ctx.message.author
else:
member = user
# user-friendly status
if member.status == discord.Status.online:
status = '<:online:314049328459022338>'
elif member.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _user(\n self, ctx: Context, user: Union[discord.Member, discord.User] = None\n ) -> None:\n\n # TODO: Add comments\n\n user = user or ctx.author\n\n created = convert_date(user.created_at)\n joined = convert_date(user.joined_at)\n\n roles = user.roles[1:]\n\n... | [
"0.7817979",
"0.74240613",
"0.73358816",
"0.73201436",
"0.70985305",
"0.70746315",
"0.7062301",
"0.7056473",
"0.70420814",
"0.7007846",
"0.6932124",
"0.6932124",
"0.692926",
"0.6917675",
"0.67954487",
"0.6789906",
"0.6709936",
"0.6700023",
"0.6698432",
"0.66610175",
"0.665627... | 0.7020608 | 9 |
return ``True`` if this object is initialized with current schema\ and return ``False`` otherwise. | def is_init(self):
cur = self.connection.cursor()
masterdata = list(cur.execute(
'SELECT * FROM sqlite_master WHERE name="metadata"'
))
if len(masterdata) == 0:
return False
schema_version = list(cur.execute(
'SELECT value FROM metadata ' +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_initialised(self) -> bool:\n return _schema.has_schema(self._engine)",
"def _is_initialized(self) -> bool:\n return len(self) > 0",
"def isInitialized(self):\n\t\tif self.isTypeSet and self.isCfgSet:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def initialize(self) -> bool:\n ... | [
"0.8566377",
"0.70202136",
"0.68050253",
"0.6754496",
"0.6735238",
"0.6682235",
"0.6647975",
"0.66320235",
"0.6615343",
"0.661172",
"0.6484367",
"0.6484367",
"0.6474015",
"0.6436641",
"0.6405033",
"0.6385124",
"0.63354135",
"0.6331027",
"0.6293815",
"0.62921417",
"0.62463856"... | 0.80022717 | 1 |
Makes the point go forward by x pixels in dir | def forward(self, x):
self.x = (self.x+(x*(math.cos(self.dir))))
self.y = (self.y+(x*(math.sin(self.dir))))
return (self.x, self.y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_forward(self):\n self.x, self.y = self.compute_positions()",
"def forward_character():\r\n set_point(point()+1)",
"def forward(self, amount):\n newX = self._x + round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y - round(amount * math.cos(math.radians(self.... | [
"0.7059315",
"0.6894002",
"0.66802937",
"0.667741",
"0.6607247",
"0.6591154",
"0.6550676",
"0.6534507",
"0.64682215",
"0.6462259",
"0.64148843",
"0.6414298",
"0.6394705",
"0.6365585",
"0.63058364",
"0.62997663",
"0.62896514",
"0.62759936",
"0.6250437",
"0.62298954",
"0.619899... | 0.7757055 | 0 |
Set the name for the slider | def setName(self, name):
self.label.setText(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.options['name'] = name",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.settings[\"name\"] = name",
"def set_name(self, name):\n self.name = name\n self.labels.change_name(name)",
"def set_name(self, name):\... | [
"0.7245413",
"0.72082627",
"0.7175868",
"0.71171975",
"0.7107551",
"0.7107551",
"0.7107551",
"0.7107551",
"0.7107551",
"0.70956314",
"0.70956314",
"0.70956314",
"0.70956314",
"0.7082746",
"0.70528257",
"0.7050544",
"0.7021297",
"0.6976529",
"0.6952984",
"0.6952984",
"0.693313... | 0.75466573 | 0 |
Initialize with the API Key | def __init__(self, api_key: str):
self.session: requests.Session = requests.Session()
self.session.headers.update({'Authorization': api_key}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, key=None):\n self._key = key or os.environ['HERE_API_KEY']",
"def __init__(self, api_key: str):\n self.api_key = api_key",
"def __init__(self, api_key=None):\n self.api_key = api_key",
"def __init__(self, api_key):\r\n self.api_key = api_key",
"def __init__(se... | [
"0.83547544",
"0.8173028",
"0.8099521",
"0.80829173",
"0.79598755",
"0.7817079",
"0.76180947",
"0.7599765",
"0.75974107",
"0.75172",
"0.7434733",
"0.73651415",
"0.7356161",
"0.73084694",
"0.72623533",
"0.7216557",
"0.72150844",
"0.72045577",
"0.71730375",
"0.71643966",
"0.716... | 0.6655067 | 58 |
Retrieve the ALPlayer object populated with data from the api. | def get_player(self, name: str, platform: ALPlatform, skip_tracker_rank=False) -> ALPlayer:
basic_player_stats: list = self.basic_player_stats(name, platform, skip_tracker_rank)
assert len(basic_player_stats) == 1
event_info: list = self.events(
player_name=name,
platform... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_player(self) -> Optional[andesite.Player]:\n ...",
"async def get_self(self) -> PlayerInfo:\n e = await self.request.request(url=f'https://users.roblox.com/v1/users/authenticated', method='get')\n a = PlayerInfo(player_id=e['id'], request=self.request)\n await a.update()... | [
"0.67135566",
"0.6585449",
"0.65201277",
"0.6420934",
"0.64123994",
"0.6359362",
"0.6288932",
"0.6288932",
"0.61246634",
"0.6101677",
"0.6024989",
"0.6006343",
"0.600117",
"0.59851706",
"0.5930705",
"0.58900714",
"0.58649504",
"0.5855935",
"0.58505946",
"0.58325666",
"0.58195... | 0.59879375 | 13 |
Retrieve the ALPlayer object populated with data from the api. | def get_player_by_uid(
self, uid: str, platform: ALPlatform, skip_tracker_rank=False
) -> ALPlayer:
basic_player_stats: list = self.basic_player_stats_by_uid(uid, platform, skip_tracker_rank)
assert len(basic_player_stats) == 1
event_info: list = self.events_by_uid(
u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_player(self) -> Optional[andesite.Player]:\n ...",
"async def get_self(self) -> PlayerInfo:\n e = await self.request.request(url=f'https://users.roblox.com/v1/users/authenticated', method='get')\n a = PlayerInfo(player_id=e['id'], request=self.request)\n await a.update()... | [
"0.6715293",
"0.6585135",
"0.65204173",
"0.6421293",
"0.641435",
"0.63592935",
"0.6290682",
"0.6290682",
"0.61249655",
"0.61035603",
"0.6027695",
"0.6007488",
"0.6003152",
"0.5989015",
"0.59873766",
"0.5930425",
"0.58902603",
"0.5865511",
"0.58557814",
"0.5851137",
"0.5833282... | 0.53667 | 49 |
Singly Linked List Node class. | def __init__(self, key: str, value: object) -> None:
self.next = None
self.key = key
self.value = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.head = ListNode()",
"def __init__(self):\n self.head = None\n self.tail = None\n self.current_node = None",
"def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = node\n self.len = 0",
"def __init_... | [
"0.7117212",
"0.70768267",
"0.70628655",
"0.6832603",
"0.6740588",
"0.6723775",
"0.6723775",
"0.6723775",
"0.6723775",
"0.6723775",
"0.66723776",
"0.66317385",
"0.6605092",
"0.6588505",
"0.6580435",
"0.6541727",
"0.6500344",
"0.65001905",
"0.6414454",
"0.64032686",
"0.6384015... | 0.0 | -1 |
Insert new node at the beginning of the list. | def insert(self, key: str, value: object) -> None:
new_node = SLNode(key, value)
new_node.next = self.head
self.head = new_node
self.size = self.size + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp",
"def prepend(self, value):\r\n if self.head is None:\r\n self.head = N... | [
"0.77808535",
"0.77274454",
"0.7689688",
"0.76597255",
"0.7659181",
"0.76521987",
"0.76361793",
"0.76311517",
"0.7571801",
"0.75325745",
"0.75214666",
"0.75045174",
"0.74570006",
"0.74384606",
"0.74276674",
"0.7357503",
"0.73145",
"0.72937196",
"0.72582",
"0.72568065",
"0.724... | 0.6260958 | 86 |
Generate a token with random letters with length | def token_generator(length):
token_list = \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
s = []
for i in range(length):
s.append(random.choice(token_list))
return "".join(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in range(length))",
"def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in... | [
"0.869654",
"0.869654",
"0.86412734",
"0.85131264",
"0.85017395",
"0.8308035",
"0.81617856",
"0.80150723",
"0.7694371",
"0.7593965",
"0.75904083",
"0.7447171",
"0.7431913",
"0.7379307",
"0.7360987",
"0.72811204",
"0.7254398",
"0.7188803",
"0.71364963",
"0.70949674",
"0.707447... | 0.8507378 | 4 |
Adds CTC loss on top of pred symbol and returns the resulting symbol | def _add_ctc_loss(pred, seq_len, num_label, loss_type):
label = mx.sym.Variable('label')
if loss_type == 'warpctc':
print("Using WarpCTC Loss")
sm = _add_warp_ctc_loss(pred, seq_len, num_label, label)
else:
print("Using MXNet CTC Loss")
assert loss_type == 'ctc'
sm = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_mxnet_ctc_loss(pred, seq_len, label):\n pred_ctc = mx.sym.Reshape(data=pred, shape=(-4, seq_len, -1, 0))\n\n loss = mx.sym.contrib.ctc_loss(data=pred_ctc, label=label)\n ctc_loss = mx.sym.MakeLoss(loss)\n\n softmax_class = mx.symbol.SoftmaxActivation(data=pred)\n softmax_loss = mx.sym.MakeL... | [
"0.7279776",
"0.67509294",
"0.6634631",
"0.64416933",
"0.636777",
"0.6334527",
"0.62488717",
"0.62174857",
"0.6172037",
"0.5912462",
"0.5818996",
"0.58138746",
"0.5788817",
"0.5786746",
"0.57292295",
"0.5714518",
"0.5672616",
"0.56589985",
"0.5637777",
"0.55821425",
"0.553402... | 0.73154473 | 0 |
Returns name and shape of init states of LSTM network | def init_states(batch_size, num_lstm_layer, num_hidden):
init_c = [('l%d_init_c' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)]
init_h = [('l%d_init_h' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)]
return init_c + init_h | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_initial_state(state_sizes: list, batch_size, name):\n\n init_states = []\n\n # for each layer, create a tf variable and tile\n for i, tupl in enumerate(state_sizes):\n c = tf.get_variable(name+\"_c_%d\"%i, shape=[1, tupl[0]])\n h = tf.get_variable(name+\"_h_%d\"%i, shape=[1, tupl[1]... | [
"0.6832012",
"0.6490874",
"0.64794016",
"0.63486713",
"0.61073273",
"0.61069",
"0.6104121",
"0.61003625",
"0.6077626",
"0.6058606",
"0.60517395",
"0.5974428",
"0.5965294",
"0.5960053",
"0.5928339",
"0.592516",
"0.5925127",
"0.591759",
"0.587162",
"0.58607215",
"0.5859695",
... | 0.6766326 | 1 |
Compare position of val to position of self. Return true if the two pieces have the same position. | def __eq__(self, val):
if type(val)== type(self):
return val.getPosition()==self.getPosition() and self.getName()==val.getName()
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_position_for_same_occupancy(self, position1, position2):\n return self.board.board[position1] == self.board.board[position2]",
"def __flt_eq_pos(self, other):\n if self.position is None:\n return True\n\n return (\n self.position == other.position\n ... | [
"0.6700722",
"0.6460452",
"0.629321",
"0.6234782",
"0.6168382",
"0.614241",
"0.6116273",
"0.6066237",
"0.603371",
"0.6020098",
"0.5977026",
"0.5946027",
"0.5944572",
"0.59200644",
"0.58380294",
"0.58275545",
"0.5816172",
"0.5812624",
"0.58060807",
"0.57808554",
"0.5780674",
... | 0.7136205 | 0 |
Create and save a User with the given email and password. | def _create_user(self, email, password, **extra_fields):
if not email:
raise ValueError("The given email must be set")
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user",
"def... | [
"0.85441065",
"0.8511467",
"0.85078454",
"0.85021895",
"0.85021806",
"0.8489139",
"0.8489139",
"0.8488738",
"0.8488738",
"0.8488738",
"0.84858716",
"0.8475896",
"0.84750444",
"0.84750444",
"0.84750444",
"0.84750444",
"0.84750444",
"0.84750444",
"0.84750444",
"0.84750444",
"0.... | 0.84768116 | 11 |
Retrieve the minified output generated thus far. | def output(self):
return self._parser.result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js_minify(js):\n log.info(\"Compressing Javascript...\")\n ins, outs = StringIO(js), StringIO()\n JavascriptMinify(ins, outs).minify()\n return force_single_line_js(outs.getvalue())",
"def write_minified(output_path, minified_result):\n with output_path.open('w') as out_file:\n last_cha... | [
"0.6143014",
"0.60554135",
"0.6052664",
"0.5837117",
"0.5837117",
"0.5813492",
"0.5813492",
"0.5813492",
"0.5806984",
"0.5768665",
"0.55227584",
"0.54721683",
"0.5414607",
"0.54120636",
"0.5400579",
"0.5354504",
"0.5346947",
"0.5344406",
"0.53166336",
"0.5301093",
"0.52374953... | 0.505104 | 46 |
Converts the given `s` into an ASCIIencoded string from a Unicodeencoded one. | def unicode_to_ascii(s: str) -> str:
chars = []
for c in unicodedata.normalize('NFD', s):
if unicodedata.category(c) != 'Mn' and c in ALLOWED_CHARS:
chars.append(c)
return "".join(chars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode_to_ascii(s):\n ret = \"\"\n for ch in s:\n try:\n ach = str(ch)\n ret += ach\n except UnicodeEncodeError:\n ret += \"?\"\n return ret",
"def unicodeToAscii(s):\n return ''.join(\n c for c in unicodedata.normalize('NFD', s)\n if ... | [
"0.80530214",
"0.7639015",
"0.75411695",
"0.7500414",
"0.7283374",
"0.72818977",
"0.7221033",
"0.72080964",
"0.70875305",
"0.70871806",
"0.70841277",
"0.7066727",
"0.7027619",
"0.70116156",
"0.69688123",
"0.694573",
"0.6916214",
"0.6898315",
"0.68660194",
"0.68598235",
"0.685... | 0.7804846 | 1 |
Returns the JSON file locations as a list. | def json_fpaths() -> [str]:
return glob.glob(f"{RECIPES_DIRPATH}/*.json") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locations(self):\n return self.data.get(\"locations\", [])",
"def locations(self):\n return [part.file for part in self.iterParts() if part]",
"def locations(self):\n return [part.file for part in self.iterParts() if part]",
"def locations(self):\n return [part.file for part i... | [
"0.7117035",
"0.67887336",
"0.67887336",
"0.67887336",
"0.67069376",
"0.6670644",
"0.6662277",
"0.66217643",
"0.6557245",
"0.65487367",
"0.65021336",
"0.6481439",
"0.6472302",
"0.64608634",
"0.64167076",
"0.6407466",
"0.6391989",
"0.6311217",
"0.6309606",
"0.6303351",
"0.6299... | 0.694632 | 1 |
Returns the current quorum configuration, i.e. config[i] May return if p_i is not a participant or BOTTOM during the process of a configuration reset | def get_config(self):
if self.allow_reco():
return self.chs_config()
else:
return self.get_config_j(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config():\n \n logger.info('Reading current configuration...')\n dburl = dbconn.DbURL()\n array = gparray.GpArray.initFromCatalog(dburl, utility=True)\n \n master_hostname = array.master.getSegmentHostName()\n master_port = array.master.getSegmentPort()\n \n cmd = pg.ReadPostmast... | [
"0.6242041",
"0.6049767",
"0.60446256",
"0.598099",
"0.5942673",
"0.5942673",
"0.5852599",
"0.5801146",
"0.57961076",
"0.5724765",
"0.5715988",
"0.5701836",
"0.56410754",
"0.5633207",
"0.56322837",
"0.5620723",
"0.56143135",
"0.5612343",
"0.5583728",
"0.5523893",
"0.5521681",... | 0.57858795 | 9 |
Returns the current quorum configuration (config[i]) to application Returns config[i] when no reconfiguration occurs or no agreement on proposal. Once participants agree on proposal, returns proposal set U current configuration. | def get_config_app(self):
if self.degree(self.id) in [0, 1, 2]:
return self.get_config_j(self.id)
else:
return list(set(self.get_config_j(self.id)) | set(self.get_prp_j(self.id)[1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def configuration(self) -> Optional[pulumi.Input['BrokerConfigurationArgs']]:\n return pulumi.get(self, \"configuration\")",
"def configuration(self... | [
"0.6239466",
"0.60387367",
"0.60387367",
"0.5956868",
"0.59504783",
"0.5895645",
"0.58602935",
"0.582811",
"0.5820163",
"0.58134586",
"0.5805068",
"0.58021927",
"0.57909834",
"0.5775168",
"0.5733354",
"0.5731225",
"0.573007",
"0.57178",
"0.5675857",
"0.56626356",
"0.5660312",... | 0.6082164 | 1 |
Returns config whenever there is a single such non value. Returns BOTTOM if no config exists. | def chs_config(self):
conf = set()
for j in self.get_fd_j(self.id):
if self.get_config_j(j) != constants.NOT_PARTICIPANT:
conf |= set(self.get_config_j(j))
if conf == set():
return constants.BOTTOM
else:
return list(conf) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config() -> Optional[Config]:\n return CurrentConfig.get()",
"def default(self):\n return self._configs[0] if len(self._configs) else None",
"def getConfig(self, committed=False, ignore_last=False):\n # go back from the latest entry, find the most recent config entry\n for idx, ... | [
"0.6573118",
"0.6316215",
"0.62860805",
"0.6104078",
"0.6081168",
"0.60742784",
"0.6067803",
"0.605521",
"0.6035528",
"0.6021096",
"0.59994614",
"0.5970423",
"0.5957983",
"0.59468275",
"0.59468275",
"0.5943898",
"0.59314483",
"0.5925146",
"0.58585817",
"0.5848977",
"0.5847518... | 0.5750651 | 100 |
Return e from an input distribution | def get_e(num_sys=1, prob='thermal'):
if prob == 'thermal':
return np.sqrt(uniform(size=num_sys))
elif prob == 'flat':
return uniform(size=num_sys)
elif prob == 'circular':
return np.zeros(num_sys)
elif prob == 'tokovinin': # From Tokovinin & Kiyaeva (2016), MNRAS 456
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def e(self):\n if self._e is None:\n # self._e = self.distributions.uniform(0.3,0.33)\n # return self._e\n # max is set by q but also limited by users choice of e_max.\n res_a = 29.9*((self.j[0]/self.k[0])**(2/3))\n q = self.distributions.truncated_norm... | [
"0.7415424",
"0.7137588",
"0.71217835",
"0.695846",
"0.6825506",
"0.63998413",
"0.6388059",
"0.6343656",
"0.6254818",
"0.62431073",
"0.6239055",
"0.6230489",
"0.62157154",
"0.62043214",
"0.6115948",
"0.6113689",
"0.6105811",
"0.6094007",
"0.6073158",
"0.60673875",
"0.60582536... | 0.7340206 | 1 |
This function calculates the probability of a random star having the observed proper motion | def get_P_binary(proj_sep, delta_v_trans, num_sys=100000, method='kde', kde_method='sklearn'):
# Catalog check
global binary_set
if binary_set is None:
generate_binary_set(num_sys=num_sys)
if method is 'kde':
# Use a Gaussian KDE
global binary_kde
#if binary_kde is Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_probability(self):\n return 0",
"def p(self) -> Probability:\n ...",
"def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\")\n total = 0\n for i in xrange(n) :\n if np.random.... | [
"0.6616909",
"0.66122586",
"0.65956324",
"0.65656006",
"0.6558705",
"0.6527563",
"0.65138316",
"0.6502501",
"0.63788253",
"0.6353283",
"0.6345645",
"0.6345645",
"0.6343374",
"0.6284382",
"0.62379724",
"0.62123704",
"0.61686015",
"0.61510676",
"0.61377114",
"0.6118212",
"0.610... | 0.0 | -1 |
This function calculates the probability of a random star having the observed proper motion | def get_P_binary_v_tot(proj_sep, delta_v_tot, num_sys=100000):
# Catalog check
global binary_set
if binary_set is None:
generate_binary_set(num_sys=num_sys)
# Use a Gaussian KDE
global binary_v_tot_kde
# We work in log space for the set of binaries
if binary_v_tot_kde is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_probability(self):\n return 0",
"def p(self) -> Probability:\n ...",
"def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\")\n total = 0\n for i in xrange(n) :\n if np.random.... | [
"0.6616407",
"0.6611605",
"0.6594753",
"0.6565147",
"0.6557539",
"0.65286505",
"0.65132105",
"0.6502074",
"0.6378543",
"0.63531625",
"0.6344999",
"0.6344999",
"0.6343321",
"0.62833744",
"0.62366265",
"0.6212156",
"0.61679083",
"0.61501026",
"0.613744",
"0.61175925",
"0.610784... | 0.0 | -1 |
Gets the current value of the score. | def get(self):
score = self._evaluate(self.y_true, self.y_pred)
return score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_score(self):\n return self.score",
"def get_score(self):\n return self.score",
"def get_score(self):\n return self.score",
"def getScore(self):\r\n return self._score",
"def get_score(self):\n return self._score",
"def get_score(self):\n return self._scor... | [
"0.8346142",
"0.8346142",
"0.8346142",
"0.82685524",
"0.82329327",
"0.82329327",
"0.82329327",
"0.81996274",
"0.8153556",
"0.8084667",
"0.80073917",
"0.7920184",
"0.7873557",
"0.7837606",
"0.77810675",
"0.7692049",
"0.76469946",
"0.751065",
"0.7477388",
"0.74663246",
"0.74570... | 0.6870809 | 97 |
resize image using cv2 | def scale_image(image, scale=1, interpolation='linear'):
if interpolation == 'linear':
return cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_LINEAR)
if interpolation == 'nearest':
return cv2.resize(image, None, fx=scale, fy=scale, interpolation=cv2.INTER_NEAREST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(image):\r\n return cv2.resize(image, (200, 66), interpolation=cv2.INTER_AREA)",
"def resize_image(img, width, height):\n\n return cv2.resize(img, (width, height))",
"def resize_image(image_path):\n img = cv2.imread(image_path);\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB);\n img = cv2... | [
"0.8261548",
"0.8075126",
"0.8029768",
"0.8016128",
"0.7924036",
"0.7875393",
"0.78491545",
"0.7844469",
"0.7772517",
"0.77287513",
"0.77221835",
"0.7603124",
"0.7569391",
"0.75212836",
"0.7410956",
"0.73702043",
"0.73482066",
"0.73242635",
"0.73195106",
"0.7284048",
"0.72769... | 0.0 | -1 |
resize images and cameras to fit the network (can be divided by base image size) | def crop_mvs_input(images, cams, depth_image=None):
# crop images and cameras
for view in range(FLAGS.view_num):
h, w = images[view].shape[0:2]
new_h = h
new_w = w
if new_h > FLAGS.height:
new_h = FLAGS.height
else:
new_h = int(math.ceil(h / FLAGS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_real_images(self, images):\n block_idx = (self.growth_idx + 1) // 2\n height, width = self.params[\"generator_projection_dims\"][0:2]\n resized_image = tf.image.resize(\n images=images,\n size=[\n height * (2 ** block_idx), width * (2 ** block_id... | [
"0.66563886",
"0.66166437",
"0.6392838",
"0.6369865",
"0.63596517",
"0.63324946",
"0.6206985",
"0.6188757",
"0.6171561",
"0.6120761",
"0.60885406",
"0.60879236",
"0.6077981",
"0.607681",
"0.6075122",
"0.607204",
"0.6069862",
"0.6055661",
"0.6013288",
"0.6003485",
"0.6003485",... | 0.0 | -1 |
Bottleneck style convolutional block with skip connections across blocks. Applies downsample convolution in lower features space. Followed by single kernel convolution to higher feature space. Also, applies skip connections across blocks for routing information across levels. | def conv_block(
input_tensor: tf.Tensor,
skip_tensors: List[tf.Tensor],
features_in: int,
features_out: int,
name: str,
) -> Tuple[tf.Tensor, List[tf.Tensor]]:
out = KL.Conv2D(
features_in,
1,
strides=(1, 1),
padding="same",
use_bias=False,
name=n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottleneck_block(x, num_out_channels, block_name):\n # skip layer\n if K.int_shape(x)[-1] == num_out_channels:\n _skip = x\n else:\n _skip = Conv2D(num_out_channels, kernel_size=(1, 1), activation='relu', padding='same',\n name=block_name + '_skip')(x)\n\n # resi... | [
"0.68322164",
"0.6781432",
"0.6746523",
"0.66436356",
"0.6612772",
"0.6579295",
"0.6521966",
"0.65205854",
"0.6513803",
"0.64872867",
"0.64735466",
"0.6468668",
"0.6424998",
"0.64214027",
"0.6407201",
"0.63719285",
"0.6370339",
"0.63593894",
"0.6357853",
"0.6347723",
"0.63421... | 0.61381096 | 47 |
r""" The naive implementation simply calculates the topk of a linear layer's output. | def forward(self, inp, return_all_scores=False):
gate = self.gate(inp)
gate_top_k_val, gate_top_k_idx = torch.topk(
gate, k=self.top_k, dim=-1, largest=True, sorted=False
) # [.. x top_k]
gate_top_k_val = gate_top_k_val.view(-1, self.top_k)
# (BxL) x 1 x top_k
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_k(input, k=1, sorted=True, index_type=dtypes.int32, name=None): # pylint: disable=redefined-builtin\n return gen_nn_ops.top_kv2(\n input, k=k, sorted=sorted, index_type=index_type, name=name\n )",
"def in_top_k(predictions, targets, k, name=None):\n with ops.name_scope(name, \"in_top_k\"):\n ... | [
"0.7440344",
"0.72381604",
"0.6975233",
"0.68716294",
"0.67940646",
"0.6786215",
"0.67805046",
"0.6726646",
"0.66277933",
"0.6550718",
"0.6539295",
"0.64932567",
"0.6452183",
"0.64044917",
"0.63626915",
"0.6361559",
"0.6321251",
"0.6311895",
"0.62869394",
"0.62519705",
"0.624... | 0.0 | -1 |
Returns a vector of concept scores for the given features using a normalized dot product similarity as in Yeh et al. | def dot_prod_concept_score(
features,
concept_vectors,
epsilon=1e-5,
beta=1e-5,
channels_axis=-1,
):
# First check that all the dimensions make sense
assert features.shape[channels_axis] == concept_vectors.shape[-1], (
f'Expected input to have {concept_vectors.shape[-1]} elements in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_normalization_scalar(features: List[List[float]]) -> List[List[float]]:\n normalized_features = []\n for feature in features:\n sum_squares = 0\n for i in feature:\n sum_squares += i * i\n sum_squares_root = np.sqrt(sum_squares)\n if sum_squares == 0:\n ... | [
"0.6520329",
"0.6430667",
"0.6394072",
"0.6382461",
"0.6351479",
"0.6329946",
"0.6322808",
"0.6261107",
"0.6182496",
"0.6160588",
"0.60493076",
"0.60208386",
"0.59891814",
"0.59368724",
"0.593012",
"0.58729786",
"0.5855223",
"0.58174413",
"0.57436484",
"0.5715467",
"0.5713523... | 0.6894692 | 0 |
Searches the list of players for a given name Returns the first instance where a player has the given name. | def find_player(self, name):
for index in range(0, len(self.player_list)):
if self.player_list[index].name == name:
return self.player_list[index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player(self, name):\n\n self.name = name\n q = Query()\n data = TinyDB('app/data/db_player.json').table('players')\n\n self.search_result = data.search(\n (q.name == self.name) |\n (q.surname == self.name)\n )\n\n if len(self.search_re... | [
"0.7655409",
"0.7581371",
"0.73113996",
"0.72627175",
"0.7086329",
"0.70571876",
"0.70207703",
"0.686663",
"0.6809111",
"0.67774487",
"0.6688535",
"0.6658734",
"0.66132474",
"0.6570869",
"0.65514565",
"0.65377414",
"0.6527125",
"0.65249634",
"0.6492997",
"0.6479223",
"0.64773... | 0.8673462 | 0 |
Create a ``RegistrationProfile`` for a given ``User``, and return the ``RegistrationProfile``. | def create_profile(self,user):
salt= sha.new(str(random.random())).hexdigest()[:5]
activation_key = sha.new(salt+user.username).hexdigest()
return RegistrationProfile(user=user,
activation_key=activation_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_registration_profile(self, user):\n salt = hashlib.sha1(str(random.random())).hexdigest()[:10]\n activation_key = hashlib.sha1(salt + user.username).hexdigest()\n\n return self.create(user=user, activation_key=activation_key)",
"def create_profile(self, user):\n salt = sha.... | [
"0.8223235",
"0.78692263",
"0.7372174",
"0.73067397",
"0.70762444",
"0.6990593",
"0.69725096",
"0.6967239",
"0.6944255",
"0.6929402",
"0.6837238",
"0.6790474",
"0.67200273",
"0.6655921",
"0.6645508",
"0.6624257",
"0.6616297",
"0.6602875",
"0.6593323",
"0.6572731",
"0.6567856"... | 0.82466364 | 0 |
Remove expired instances of ``RegistrationProfile`` and their associated ``User``s. It is recommended that this method be executed regularly as part of your routine site maintenance; this application provides a custom management command which will call this method, accessible as ``manage.py cleanupregistration``. | def delete_expired_users(self):
for profile in self.all():
if profile.activation_key_expired():
user = profile.user
if not user.is_active:
user.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_expired_users(self):\n for profile in self.all():\n if profile.activation_key_expired():\n user = profile.user\n if not user.is_active:\n user.delete() # Removing the ``User`` will remove the ``RegistrationProfile``, too.",
"def delete... | [
"0.73485786",
"0.70826864",
"0.67892396",
"0.63968474",
"0.63140017",
"0.6178437",
"0.59981287",
"0.59697443",
"0.58801055",
"0.58665377",
"0.5861399",
"0.57514364",
"0.56671995",
"0.5614381",
"0.5590029",
"0.5549079",
"0.54921854",
"0.54647243",
"0.54460067",
"0.5438572",
"0... | 0.67647916 | 3 |
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected. | def recall(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (possible_positives + K.epsilon())
return recall | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t... | [
"0.76052207",
"0.74484503",
"0.74047023",
"0.7281549",
"0.7209793",
"0.7166467",
"0.71581",
"0.7145881",
"0.7145881",
"0.7145881",
"0.7145881",
"0.7145881",
"0.7145881",
"0.7132385",
"0.71016103",
"0.70670533",
"0.70652425",
"0.7063426",
"0.7063426",
"0.7063426",
"0.7063426",... | 0.7097688 | 33 |
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant. | def precision(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
precision = true_positives / (predicted_positives + K.epsilon())
return precision | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def comp... | [
"0.7489052",
"0.7288358",
"0.7159325",
"0.715323",
"0.7065856",
"0.6984727",
"0.6964892",
"0.69536865",
"0.6912471",
"0.68334424",
"0.68176156",
"0.68093187",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.6804945",
"0.67855513",
"0.67575085",
"0.67575085... | 0.675501 | 44 |
Returns mean start and end hours grouped by weekday. | def presence_start_end_view(user_id):
data = get_data()
if user_id not in data:
log.debug('User %s not found!', user_id)
return []
result_start, result_stop = group_by_weekday_start_end(data[user_id])
result = []
for i in range(7):
result.append((
calendar.day_ab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_time_weekday_view(user_id):\n #import pdb; pdb.set_trace()\n data = get_data()\n if user_id not in data:\n log.debug('User %s not found!', user_id)\n return []\n\n weekdays = group_by_weekday(data[user_id])\n result = [(calendar.day_abbr[weekday], mean(intervals))\n ... | [
"0.70767546",
"0.691566",
"0.60244334",
"0.6006631",
"0.59523463",
"0.5813882",
"0.5720163",
"0.57031125",
"0.56863064",
"0.56797594",
"0.56209344",
"0.5582896",
"0.55791557",
"0.55611074",
"0.55569315",
"0.54988813",
"0.5399546",
"0.53779376",
"0.53592837",
"0.5350021",
"0.5... | 0.50501186 | 35 |
Returns labels associated with Image. | def labels(self) -> Dict[str, str]:
return self.attrs.get("Labels", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_labels(path):\n client = vision.ImageAnnotatorClient()\n\n with io.open(path, 'rb') as image_file:\n content = image_file.read()\n\n image = vision.types.Image(content=content)\n\n response = client.label_detection(image=image)\n labels = response.label_annotations\n #print('Lab... | [
"0.7138663",
"0.7133516",
"0.7130016",
"0.7122506",
"0.7111845",
"0.7087622",
"0.70217323",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
"0.7000098",
... | 0.0 | -1 |
Test the ascii_escaped output format. | def test_tabular_output_escaped():
headers = ["text", "numeric"]
data = [
["abc", Decimal(1)],
["defg", Decimal("11.1")],
["hi", Decimal("1.1")],
["Pablo\rß\n", 0],
]
expected = dedent(
"""\
+------------+---------+
| text | numeric |
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plain_ansi(self):\n irc_ansi = irc.parse_ansi_to_irc(string.printable)\n ansi_irc = irc.parse_irc_to_ansi(string.printable)\n self.assertEqual(irc_ansi, string.printable)\n self.assertEqual(ansi_irc, string.printable)",
"def is_printable(c):\n return ord(c)>=32 or c in ['\... | [
"0.6732766",
"0.6406619",
"0.6277316",
"0.6251546",
"0.61997485",
"0.6184127",
"0.6170037",
"0.6024704",
"0.6006847",
"0.5948027",
"0.5901922",
"0.58854496",
"0.58677125",
"0.5860605",
"0.5801056",
"0.5801056",
"0.5796908",
"0.5796908",
"0.5795084",
"0.57895523",
"0.5780044",... | 0.6542039 | 1 |
Test the format_output wrapper. | def test_tabular_format_output_wrapper():
data = [["1", None], ["2", "Sam"], ["3", "Joe"]]
headers = ["id", "name"]
expected = dedent(
"""\
+----+------+
| id | name |
+----+------+
| 1 | N/A |
| 2 | Sam |
| 3 | Joe |
+----+------+"""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_output_formatting_func(self, sample: Any):\n try:\n if not type(sample) == iter:\n self._formatting_func_return_types(format=sample)\n return True\n except Exception:\n raise ValueError(\n f\"formatting_func must return {self._f... | [
"0.7369798",
"0.70274675",
"0.67627716",
"0.6762203",
"0.6761139",
"0.6622697",
"0.65406054",
"0.6526979",
"0.64411855",
"0.6382983",
"0.6381997",
"0.6381733",
"0.63810277",
"0.63721865",
"0.6358712",
"0.6331598",
"0.63055885",
"0.62849057",
"0.62764215",
"0.62751293",
"0.627... | 0.5988137 | 53 |
Test that ANSI escape codes work with tabulate. | def test_tabulate_ansi_escape_in_default_value():
data = [["1", None], ["2", "Sam"], ["3", "Joe"]]
headers = ["id", "name"]
styled = format_output(
iter(data),
headers,
format_name="psql",
missing_value="\x1b[38;5;10mNULL\x1b[39m",
)
unstyled = format_output(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_asciitable_m_pretty_ansi(self):\n input = '''\n┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ \n┃\\x1b[1m \\x1b[0m\\x1b[1mReleased \\x1b[0m\\x1b[1m \\x1b[0m┃\\x1b[1m \\x1b[0m\\x1b[1mTitle \\x1b[0m\\x1b[1m \\x1b[0... | [
"0.70575464",
"0.653272",
"0.6358273",
"0.6196326",
"0.60648966",
"0.58987457",
"0.58536655",
"0.58270675",
"0.5749906",
"0.5715439",
"0.5708848",
"0.5671626",
"0.56693846",
"0.56251574",
"0.55986124",
"0.5450305",
"0.544031",
"0.540491",
"0.5401781",
"0.53985673",
"0.5381614... | 0.71552247 | 0 |
Test that provided column types are passed to preprocessors. | def test_provide_column_types():
expected_column_types = (bool, float)
data = ((1, 1.0), (0, 2))
headers = ("a", "b")
def preprocessor(data, headers, column_types=(), **_):
assert expected_column_types == column_types
return data, headers
format_output(
data,
header... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_type_in_col(arch, **kwargs):\n return all(\n attrib.isdigit()\n for attrib in arch.xpath('//@col')\n )",
"def _column_type(strings, has_invisible=True, numparse=True):\n types = [_type(s, has_invisible, numparse) for s in strings]\n return reduce(_more_generic, types, bool)",
... | [
"0.69267917",
"0.68872726",
"0.65001106",
"0.61542696",
"0.60413736",
"0.5988151",
"0.59039944",
"0.5828359",
"0.5757172",
"0.5706538",
"0.5698194",
"0.56468266",
"0.564525",
"0.564525",
"0.5624118",
"0.56221634",
"0.5595887",
"0.5567571",
"0.5535115",
"0.55180484",
"0.551586... | 0.7498186 | 0 |
Load configuration from from YAML file. | def config_from_yaml(self, filename):
with open(filename, 'r') as f:
config = yaml.load(f)
config = self._process_config_imports(config)
self._config.update(config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p... | [
"0.79749984",
"0.7948293",
"0.7870235",
"0.7864097",
"0.7782877",
"0.7770844",
"0.7759317",
"0.7758727",
"0.77337193",
"0.77292687",
"0.7688582",
"0.7679165",
"0.76457",
"0.7640206",
"0.7639675",
"0.76378214",
"0.7629019",
"0.76260763",
"0.75758195",
"0.7562336",
"0.7479118",... | 0.78772604 | 2 |
Get the least common multiple. | def _lcm_f(a, b):
return int((a * b) / _gcd_f(a, b)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def least_common_multiple(number1, number2):\n return number1 * number2 // math.gcd(number1, number2)",
"def least_common_multiple2(number1, number2, number3, number4):\n return least_common_multiple((number1 * number2 // math.gcd(number1, number2)),\n (number3 * number4 // ... | [
"0.7903114",
"0.75025064",
"0.73285586",
"0.7166786",
"0.6805132",
"0.6473004",
"0.6357267",
"0.62809765",
"0.61856556",
"0.61782134",
"0.61521375",
"0.61483604",
"0.6133332",
"0.61324215",
"0.60736656",
"0.6026523",
"0.60008913",
"0.60008913",
"0.60008913",
"0.59906423",
"0.... | 0.55290264 | 75 |
Create a Vitis.GlobalAveragePooling2D Layer. | def __init__(self, **kwargs):
super(VitisGlobalAveragePooling2D, self).__init__(**kwargs)
self.rescale_factor = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, **kwargs):\n super(VitisAveragePooling2D, self).__init__(**kwargs)",
"def _create_globalaveragepool(cls, onnx_node, inputs, opset_version):\n data_format = onnx_node.getattr(\"data_format\", 'channels_first')\n _, forward = cls._common_onnx_node_to_singa_op(onnx_node, inputs,\... | [
"0.61525106",
"0.609915",
"0.5919478",
"0.5911318",
"0.58175915",
"0.5786517",
"0.5785733",
"0.5725473",
"0.57131076",
"0.57019055",
"0.56622005",
"0.5642687",
"0.5559154",
"0.54910403",
"0.5473044",
"0.5453422",
"0.54310554",
"0.54178834",
"0.53916913",
"0.5368832",
"0.53341... | 0.6580204 | 0 |
Takes a state and graph embeddings, Returns a part [h_N, D] of context vector [h_c, h_N, D], that is related to RL Agent last step. | def get_step_context(self, state, embeddings):
# index of previous node
prev_node = state.prev_a.to(self.dev) # (batch_size, 1)
# from embeddings=(batch_size, n_nodes, input_dim) select embeddings of previous nodes
cur_embedded_node = embeddings.gather(1, prev_node.view(prev_node.shape... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_nn(cell, rnn_size, input_data, vocab_size, embed_dim):\n embed = get_embed(input_data, vocab_size, embed_dim) \n output, final_state = build_rnn(cell, embed)\n \n logits = tf.contrib.layers.fully_connected(output, vocab_size, activation_fn=None)\n #final_state = tf.identity(final_stat... | [
"0.5710615",
"0.5697232",
"0.56184053",
"0.5616776",
"0.5595174",
"0.5548798",
"0.5524491",
"0.5477435",
"0.54760706",
"0.54628956",
"0.54440236",
"0.54390854",
"0.53898245",
"0.5347198",
"0.5345448",
"0.5341874",
"0.5341261",
"0.53183186",
"0.53023475",
"0.53003037",
"0.5272... | 0.7374239 | 0 |
Generate a presigned URL to share an S3 object | def create_presigned_url(bucket_name, object_name, expiration=3600):
# Generate a presigned URL for the S3 object
s3_client = boto3.client('s3')
try:
response = s3_client.generate_presigned_url('get_object',
Params={'Bucket': bucket_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_presigned_url(bucket_name, object_name):\n\n logger = logging.getLogger(\"SimpleReplayLogger\")\n\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={'Bucket': bucket_name,\n ... | [
"0.781918",
"0.7818755",
"0.775786",
"0.7680955",
"0.7658105",
"0.7649027",
"0.76473826",
"0.7646118",
"0.76096344",
"0.75693727",
"0.7362465",
"0.73525697",
"0.73306215",
"0.7309494",
"0.7161238",
"0.7114588",
"0.70948786",
"0.7060615",
"0.70502365",
"0.7022286",
"0.70070326... | 0.76516396 | 5 |
Get the opcode string from a codeblock. | def get_opcode(self, code):
opcode = int(str(code)[-2:])
return opcode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_op_code_str(self, op):\n try:\n from tflite.BuiltinOperator import BuiltinOperator\n except ImportError:\n raise ImportError(\"The tflite package must be installed\")\n\n op_code_list_idx = op.OpcodeIndex()\n op_code_id = self.model.OperatorCodes(op_code_li... | [
"0.6249712",
"0.5808073",
"0.5758956",
"0.57538587",
"0.570763",
"0.570763",
"0.5671009",
"0.56138945",
"0.55983204",
"0.55761415",
"0.557361",
"0.55591536",
"0.5555312",
"0.5523228",
"0.5506385",
"0.5496092",
"0.5473834",
"0.5467974",
"0.5443687",
"0.54090476",
"0.53862494",... | 0.6715364 | 0 |
Retrieve the dataset manager. | def resolve_dataset_manager() -> DatasetManager:
_dataset_manager_class = conf.getimport(
section="core",
key="dataset_manager_class",
fallback="airflow.datasets.manager.DatasetManager",
)
_dataset_manager_kwargs = conf.getjson(
section="core",
key="dataset_manager_kw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_manager(self):\n\n return self._data_manager",
"def _get_data_manager(self):\n\n ftype = self.conf['General']['save_as']\n if ftype == 'npz':\n return NPZDataManager(self.conf, self.log)\n elif ftype == 'hdf5':\n return HDF5DataManager(self.conf, sel... | [
"0.84404564",
"0.7547824",
"0.69010204",
"0.6821794",
"0.6821317",
"0.6761993",
"0.67312783",
"0.6668024",
"0.6635121",
"0.6446262",
"0.64157367",
"0.6388273",
"0.6379517",
"0.63311225",
"0.62744164",
"0.6216641",
"0.618155",
"0.61262697",
"0.6106576",
"0.6034368",
"0.6029758... | 0.7545222 | 2 |
Return the current visualization. Default is no visualization | def get_visualization():
if Visualization.__current_visualization is None:
Visualization.set_visualization(NoVisualization())
return Visualization.__current_visualization | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_graph(self):\n if self._linear_viewer.isVisible():\n return self._linear_viewer\n else:\n return self._flow_graph",
"def get_default_plot(self):\n return self.default_plot",
"def vis(self):\n \treturn self._vis",
"def visual_reference(self) -> pulumi.... | [
"0.7015167",
"0.66728127",
"0.6522938",
"0.6354091",
"0.6350514",
"0.62987596",
"0.6281821",
"0.6218688",
"0.62015843",
"0.6179625",
"0.61453456",
"0.61453456",
"0.61198264",
"0.60377395",
"0.60220164",
"0.5964381",
"0.5920324",
"0.5883091",
"0.5869931",
"0.58525586",
"0.5811... | 0.85380006 | 0 |
Sets a new visualization. | def set_visualization(visualization):
Visualization.__current_visualization = visualization | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_visualization(self, vis):\n # Destroy the old visualization to avoid leaking memory\n try:\n self.sizer.Remove(self.vis)\n self.vis.Destroy()\n except AttributeError:\n # Don't crash if there was no old visualization\n pass\n # Set the... | [
"0.75664",
"0.67613727",
"0.67532706",
"0.67054766",
"0.6348466",
"0.6195793",
"0.5890382",
"0.58264846",
"0.581631",
"0.5799407",
"0.5764887",
"0.5696465",
"0.5681003",
"0.56570977",
"0.565017",
"0.56282824",
"0.56247157",
"0.56245434",
"0.55731523",
"0.5568358",
"0.55621314... | 0.775578 | 0 |
Method for populating a SimObject from a dictionary. | def from_dict(cls, dictionary):
instance = cls()
for key, value in dictionary.items():
instance.__dict__[key] = value
return instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(dict):\n return SIO_SDC(**dict)",
"def from_dict(self, dict_=None):\n for key in dict_:\n if hasattr(self, key):\n setattr(self, key, dict_[key])",
"def from_dict(cls, obj):\r\n raise NotImplementedError",
"def _from_dict(self, data=None):\n ... | [
"0.6614978",
"0.650077",
"0.64925647",
"0.6438353",
"0.6405005",
"0.6405005",
"0.63604647",
"0.63278633",
"0.6316172",
"0.62846863",
"0.6272756",
"0.62303245",
"0.6150155",
"0.61341256",
"0.61329454",
"0.61329454",
"0.6121385",
"0.6121385",
"0.6121385",
"0.6121385",
"0.612138... | 0.6175366 | 12 |
Convert ownershipvoucher dictionary to json and write to file. ownershipVoucher is a dictionary of the template below with values as per RFC8366. | def genOwnershipVoucherJsonFile( ownershipVoucher, voucherFileJson ):
template = { "created-on": str,
"expires-on": str,
"assertion": str,
"serial-number": str,
"pinned-domain-cert": str,
"domain-cert-revocation-checks": bool,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write(self):\n raw_data = {'file_version': 1}\n raw_creds = []\n raw_data['data'] = raw_creds\n for (cred_key, cred) in self._data.items():\n raw_key = dict(cred_key)\n raw_cred = json.loads(cred.to_json())\n raw_creds.append({'key': raw_key, 'crede... | [
"0.57161313",
"0.55950993",
"0.55210066",
"0.5401349",
"0.5320288",
"0.52819663",
"0.5272004",
"0.5208323",
"0.517391",
"0.51711",
"0.5164001",
"0.5157927",
"0.5157889",
"0.5153851",
"0.5132664",
"0.5128681",
"0.51168865",
"0.51157135",
"0.5086597",
"0.50822693",
"0.50820655"... | 0.79461914 | 0 |
Make a dataset for training or evaluating SMURF. | def make_dataset(self,
path,
mode,
height=None,
width=None):
# Split up the possibly comma seperated directories.
if ',' in path:
l = path.split(',')
d = '/'.join(l[0].split('/')[:-1])
l[0] = l[0].split('/')[-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(dataset_type, soruce, opts): \n\n p = PreProcessor(dataset_type, opts)\n\n # If we are NOT running \"implementation.py\", we read the data from file\n if dataset_type == \"train\" or dataset_type == \"dev\" or dataset_type == \"test\":\n path_to_data = soruce\n p.read_labe... | [
"0.71976507",
"0.7156453",
"0.6980805",
"0.6959531",
"0.688197",
"0.68500346",
"0.6844109",
"0.6841355",
"0.68199223",
"0.6816855",
"0.6813762",
"0.68059635",
"0.67992455",
"0.67547446",
"0.6730391",
"0.6708142",
"0.6706259",
"0.66852164",
"0.6672077",
"0.6619019",
"0.6602753... | 0.0 | -1 |
Return True if password is valid for user, else False | def check_password(self, password):
if self.password_expire_epoch != 0 and \
time.time() > self.password_expire_epoch:
lg.debug("Password invalid for user '%s': user password is expired"\
%self.name)
return False
if self.password_hash is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass",
"def get_has_password(self, user):\n return True if user.password else False",
"def check_password(self, password):\n return self.password == password",
"def verify_password(self, pass... | [
"0.8181345",
"0.80773896",
"0.80308294",
"0.79664797",
"0.78895646",
"0.78841513",
"0.7839702",
"0.78388",
"0.7825555",
"0.7808887",
"0.775599",
"0.775599",
"0.77107185",
"0.77031857",
"0.7691626",
"0.7690411",
"0.7689362",
"0.76876014",
"0.7684381",
"0.76713455",
"0.7656842"... | 0.7833034 | 8 |
PLots the features in a 3d plot including the hyperplane that separates the data | def plot_3d_plot(self, features, headers, labels):
self.master_plot.scatter(features[:, 0], features[:, 1], features[:, 2], c=labels)
self.master_plot.set_xlabel(headers[0])
self.master_plot.set_ylabel(headers[1])
self.master_plot.set_zlabel(headers[2])
plot_hyperplane(self.clf,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot3d(self):\n plot_rupture_wire3d(self)",
"def svm_add_3d_hyperplane(model, ax, plotted_points):\n SPACE_SAMPLING_POINTS = 70\n X_MIN = np.min(plotted_points[:, 0])\n X_MAX = np.max(plotted_points[:, 0])\n Y_MIN = np.min(plotted_points[:, 1])\n Y_MAX = np.max(plotted_points[:, 1])\n ... | [
"0.7302647",
"0.7106038",
"0.7101418",
"0.69293755",
"0.6890816",
"0.6856431",
"0.6853505",
"0.6824226",
"0.67982167",
"0.6775323",
"0.67729586",
"0.67109203",
"0.67087954",
"0.6701973",
"0.66566586",
"0.6629957",
"0.66192967",
"0.6613964",
"0.66003513",
"0.6584965",
"0.65722... | 0.75784415 | 0 |
Creates and initializes a card | def __init__(self, suit: str, rank: str) -> None:
self.suit = suit
self.rank = rank
self.value = Card.values[rank]
self.hidden = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createCard(self,id,name):\n card = Card(id,name)\n self.cards[id] = card\n print('Created Card:'+id)",
"def define_card(card):\n try:\n value = define_card_value(card[0])\n color = define_card_color(card[1])\n return Card(value, color)\n except AttributeError:\... | [
"0.7489538",
"0.74147695",
"0.73503184",
"0.7285862",
"0.7285862",
"0.7158202",
"0.71478814",
"0.71125865",
"0.70091987",
"0.6920996",
"0.6901048",
"0.6856007",
"0.681001",
"0.67669064",
"0.67593235",
"0.6752542",
"0.6734627",
"0.6703586",
"0.66528183",
"0.66227216",
"0.66011... | 0.6388992 | 45 |
Converts the given boundary value to an appropriate integral boundary value. This is used to handle the special "min' and 'max' string values. The test_value argument should be the value which is being tested for whether or not it's in a range. Since long integral values have an unlimited precision there is no actual M... | def _convert_range_boundary(boundary, test_value):
if _is_string(boundary):
if boundary.lower() == 'min':
boundary = test_value - 1
elif boundary.lower() == 'max':
boundary = test_value + 1
else:
raise error.CommandDescriptionError('Invalid range boundary ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_range_boundary(boundary):\n return (isinstance(boundary, numbers.Integral) or\n (_is_string(boundary) and (boundary.lower() in ('min','max'))))",
"def clean_int(\n i: int,\n ub: int,\n lb: int = 0,\n ) -> int: \n\n # Initialisations\n i_temp = i\n\n # Check if the in... | [
"0.6226162",
"0.6110354",
"0.5956353",
"0.5869911",
"0.5851052",
"0.5840057",
"0.58316064",
"0.5831372",
"0.5728684",
"0.569103",
"0.56804085",
"0.56803036",
"0.5654331",
"0.56315446",
"0.55944073",
"0.5495219",
"0.5494189",
"0.5409632",
"0.5409632",
"0.539477",
"0.5389832",
... | 0.7728433 | 0 |
Called when an argument doesn't match the expected type. Raises an ArgumentValidationError exception. The message for the exception can be customized by specifying a error format string in the type definition. The format string is called ' validationerrorformat'. | def _raise_argument_validation_exception(typedef, value, detail, expected_tokens=None):
typedef_name = typedef.get('help-name')
if typedef_name is None:
typedef_name = typedef.get('name')
if typedef_name is None:
typedef_name = typedef.get('field')
if typedef_name is None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_incorrect_arg_type(self):\n\n with pytest.raises(TypeError) as exc_info:\n upper_incomplete_gamma(a='A', z=0.3)\n\n expected_error_msg = (\n 'type of argument \"a\" must be one of (int, float); got str instead'\n )\n assert str(exc_info.value) == expected_... | [
"0.69686395",
"0.66745853",
"0.6643091",
"0.6587547",
"0.6579584",
"0.646052",
"0.6447449",
"0.64430845",
"0.6376854",
"0.63049024",
"0.63008493",
"0.62791383",
"0.6219893",
"0.61986107",
"0.61303514",
"0.6127861",
"0.6121139",
"0.6109378",
"0.6102843",
"0.60939085",
"0.60928... | 0.7721112 | 0 |
Returns whether or not the argument is a list. This means that it's an instance of a sequence, but not including the string types | def _is_list(arg):
return isinstance(arg, collections.Sequence) and not _is_string(arg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_list ( self, s ):\r\n\t\treturn isinstance ( s, type( list () ) )",
"def is_list_of(seq, expected_type):\n return is_seq_of(seq, expected_type, seq_type=list)",
"def _is_list(item):\n return isinstance(item, list)",
"def _is_list(val):\n\n return isinstance(val, list)",
"def is_sequence_o... | [
"0.83214027",
"0.81061",
"0.8065349",
"0.79083794",
"0.7902992",
"0.78376174",
"0.78361946",
"0.78166515",
"0.7780776",
"0.7772325",
"0.7759591",
"0.77538717",
"0.7664642",
"0.7664073",
"0.7621871",
"0.7563922",
"0.75465405",
"0.7468648",
"0.73699504",
"0.73252976",
"0.728769... | 0.90609455 | 0 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
top = _app_ctx_stack.top
if not hasattr(top, 'sqlite_db'):
top.sqlite_db = sqlite3.connect(app.config['DATABASE'])
top.sqlite_db.row_factory = sqlite3.Row
return top.sqlite_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.7738929",
"0.7583458",
"0.7317899",
"0.7169646",
"0.70223415",
"0.69680053",
"0.6955745",
"0.6949704",
"0.68988895",
"0.6843065",
"0.6830136",
"0.68184245",
"0.68068093",
"0.6795719",
"0.6770086",
"0.67619467",
"0.67508566",
"0.6747435",
"0.6732536",
"0.67013234",
"0.66885... | 0.6672212 | 26 |
Format a timestamp for display. | def format_datetime(timestamp):
return datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d @ %H:%M') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_ts(cls, timestamp):\n return localtime(timestamp).strftime('%Y-%m-%d %H:%M:%S')",
"def formatTimestamp(self, timestamp):\n return time.strftime('%Y%m%d-%H%M%S-%Z', time.localtime(timestamp))",
"def render_timestamp(timestamp):\n return datetime.fromtimestamp(timestamp).strftime(\"%... | [
"0.83113927",
"0.8024185",
"0.78500414",
"0.7596884",
"0.7578498",
"0.7574983",
"0.7447329",
"0.743664",
"0.7395809",
"0.73817986",
"0.727902",
"0.71649474",
"0.7120334",
"0.70975757",
"0.70693433",
"0.7055185",
"0.698",
"0.698",
"0.6962262",
"0.6930938",
"0.69197065",
"0.6... | 0.7109238 | 15 |
Find the minimum number of edits required to convert str_1 to str_2 | def edit_distance(str_1, str_2):
return edit_distance_dp(str_1, len(str_1), str_2, len(str_2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editing_distance(str1: str, str2: str) -> int:\r\n if not str1 and not str2:\r\n return 0\r\n if not str1:\r\n return len(str2)\r\n if not str2:\r\n return len(str1)\r\n if str1[0] == str2[0]:\r\n return min(editing_distance(str1[1::], str2[1::]), 1 + editing_distance(st... | [
"0.78606004",
"0.7667521",
"0.7666502",
"0.7485708",
"0.7342039",
"0.7078117",
"0.7051589",
"0.7030334",
"0.7002312",
"0.6992367",
"0.68882006",
"0.68589854",
"0.68285865",
"0.6781553",
"0.67763644",
"0.6762268",
"0.6755266",
"0.66761094",
"0.66730696",
"0.665412",
"0.663446"... | 0.7184663 | 5 |
Find the minimum number of edits required to convert str_1 to str_2 | def edit_distance_dp(str_1, m, str_2, n):
# table for storing sub-problems
sub = [[0 for i in range(n + 1)] for j in range(m + 1)] # padded for empty cases
# fill table
for i in range(m + 1):
for j in range(n + 1):
if i == 0:
# str_1 is empty, or we have not selecte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editing_distance(str1: str, str2: str) -> int:\r\n if not str1 and not str2:\r\n return 0\r\n if not str1:\r\n return len(str2)\r\n if not str2:\r\n return len(str1)\r\n if str1[0] == str2[0]:\r\n return min(editing_distance(str1[1::], str2[1::]), 1 + editing_distance(st... | [
"0.78606004",
"0.7667521",
"0.7666502",
"0.7485708",
"0.7342039",
"0.7184663",
"0.7078117",
"0.7051589",
"0.7030334",
"0.7002312",
"0.6992367",
"0.68882006",
"0.68589854",
"0.68285865",
"0.67763644",
"0.6762268",
"0.6755266",
"0.66761094",
"0.66730696",
"0.665412",
"0.663446"... | 0.6781553 | 14 |
Convert a coordinate to the point format used in R3 protocol | def to_cmd(c: Coordinate, pose_flag: Optional[int] = 7):
txt = ("{:.{d}f}".format(i, d=c.digits) if i is not None else "" for i in c.values)
return f'({",".join(txt)}) ({pose_flag},0)' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinate_point_to_coordinate(self, point):\n return self.gen(self._point_to_ray[point])",
"def convert(coords):\n lat = coords[:4]\n lon = coords[4:]\n\n lat = lat[:2] + \".\" + lat[2:]\n\n if int(lon[0]) > 5:\n lon = \"-\" + lon[:2] + \".\" + lon[2:]\n else:\n lon = \"-... | [
"0.66741616",
"0.64301664",
"0.62839675",
"0.6281405",
"0.62608045",
"0.62392443",
"0.62174106",
"0.6155676",
"0.61556274",
"0.6136992",
"0.611316",
"0.61059934",
"0.6103914",
"0.60896146",
"0.608129",
"0.6037829",
"0.598683",
"0.5964238",
"0.5938356",
"0.5923728",
"0.5906637... | 0.0 | -1 |
Returns the standard InChI string for a molecule | def MolToInchi(mol, options="", logLevel=None, treatWarningAsError=False):
if options.find('AuxNone') == -1:
if options:
options += " /AuxNone"
else:
options += "/AuxNone"
try:
inchi, aux = MolToInchiAndAuxInfo(mol, options, logLevel=logLevel,
treatWarn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inchi(self) -> str:\n if not self._inchi:\n self.sanitize(raise_exception=False)\n self._inchi = Chem.MolToInchi(self.rd_mol)\n if self._inchi is None:\n raise MoleculeException(\"Could not make InChI\")\n return self._inchi",
"def inchi_key(self)... | [
"0.7660741",
"0.63990366",
"0.60433763",
"0.595492",
"0.5946647",
"0.59346324",
"0.592875",
"0.5795559",
"0.5732636",
"0.57045305",
"0.566792",
"0.5595976",
"0.5595365",
"0.5565196",
"0.55554646",
"0.55542576",
"0.5534849",
"0.54897135",
"0.54738885",
"0.5453322",
"0.5441915"... | 0.5070574 | 79 |
Returns the rendered template in HTML format of the main page of the website for the GET request along the path "/" or "index.html". Returns Any | def index() -> Any:
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_page():\n return render_template(\"index.html\")",
"def get(self):\n return render_template(\"index.html\")",
"def get(self):\n template = Constants.JINJA_ENVIRONMENT.get_template('homepage.html')\n self.response.headers['Content-Type'] = 'text/html'\n self.response.writ... | [
"0.7773576",
"0.7701407",
"0.76876473",
"0.75099677",
"0.7498149",
"0.7437251",
"0.7437251",
"0.7436899",
"0.7420055",
"0.7402748",
"0.7386607",
"0.7386607",
"0.7386607",
"0.73803544",
"0.73803544",
"0.73736036",
"0.734291",
"0.7334071",
"0.73024625",
"0.72956324",
"0.7279382... | 0.7218152 | 25 |
Returns the site icon for the GET request along the path "/favicon.ico". Returns Any | def favicon() -> Any:
return send_from_directory(os.path.join(app.root_path, "static"),
"favicon.ico", mimetype="image/png") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_favicon(self): \n favurl = \"%s://%s/favicon.ico\" % (self.urlparts.scheme, self.domain)\n r = requests.get(favurl)\n if r:\n return favurl\n else:\n return \"\"",
"async def api_favicon(self):\n # SECURITY: We control the path of the file so ... | [
"0.79970914",
"0.75161207",
"0.7465618",
"0.74292725",
"0.74158657",
"0.73389995",
"0.73227185",
"0.72797966",
"0.72470355",
"0.72041726",
"0.7127063",
"0.7098606",
"0.6974032",
"0.6884807",
"0.6819414",
"0.66975546",
"0.6694368",
"0.64336145",
"0.64245147",
"0.6389769",
"0.6... | 0.7102287 | 11 |
Return a map of all switches in the machine. | def get_switch_map(self, do_sort=True):
switch_map = []
for switch in self.machine.switches.values():
switch_map.append(SwitchMap(switch.hw_switch.get_board_name(), switch))
# sort by board + driver number
if do_sort:
switch_map.sort(key=lambda x: (self._natural_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switches(self) -> List[dict]:\n return self.items_by_domain(\"switch\")",
"def switches(self):\n return {k:v for k, v in self._data.items() \n if v[\"type\"] == \"SWITCH\"}",
"async def get_hw_switch_states(self) -> Dict[str, bool]:\n raise NotImplementedError",
"d... | [
"0.7777836",
"0.7621708",
"0.7443831",
"0.73941827",
"0.72622395",
"0.7212569",
"0.6953223",
"0.68368125",
"0.6708856",
"0.6657472",
"0.6531701",
"0.65303135",
"0.64049363",
"0.6335255",
"0.61550575",
"0.6124635",
"0.59139466",
"0.57728636",
"0.5758768",
"0.5725718",
"0.56988... | 0.7177897 | 6 |
Return a map of all coils in the machine. | def get_coil_map(self, do_sort=True) -> List[CoilMap]:
coil_map = []
for coil in self.machine.coils.values():
assert coil.hw_driver is not None
coil_map.append(CoilMap(coil.hw_driver.get_board_name(), coil))
# sort by board + driver number
if do_sort:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_cliffs(self):\n cliff_list = Cliff.list()\n rtn = {}\n\n for clf in cliff_list:\n rtn[clf] = self.read_cliff(clf)\n\n return rtn",
"def councils(self):\n catalog = getToolByName(self.context, 'portal_catalog')\n\n return [dict(url=council.getURL(), ti... | [
"0.61735106",
"0.6158383",
"0.6126377",
"0.6033344",
"0.5983551",
"0.59124845",
"0.58763355",
"0.57980853",
"0.57952774",
"0.57756484",
"0.56649864",
"0.5617694",
"0.55903614",
"0.5582277",
"0.5558947",
"0.5551839",
"0.5548989",
"0.55406815",
"0.55191165",
"0.5518905",
"0.549... | 0.6748809 | 0 |
This function responds to a request for /api/movie/{movie_id} with one matching movie. | def read_one(**kwargs):
# Get the movie by id
movie_id = kwargs['movie_id']
fields = kwargs.get('fields')
movie = Movie.query.filter(Movie.movie_id == movie_id).one_or_none()
# Did we find a movie?
if movie is not None:
#Intersect supplied fields with Schema defined ones => Receive only... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_movie(movie_id=None):\n movie = [movie for movie in store.data if movie['id'] == int(movie_id)]\n msg = helper.create_message(MSG['movie_not_found'])\n\n return (jsonify(movie=movie[0]), 200) if movie else (jsonify(msg), 404)",
"def get_movie(payload: PayloadJSON, movie_id: int) -> ResourceJSON:... | [
"0.77707213",
"0.7636874",
"0.7499034",
"0.7423642",
"0.7315157",
"0.72396636",
"0.71681803",
"0.7103371",
"0.7078891",
"0.7065013",
"0.6978475",
"0.69712627",
"0.695383",
"0.6861186",
"0.6836065",
"0.6782413",
"0.6756869",
"0.67431486",
"0.67383784",
"0.6677799",
"0.64845866... | 0.70478445 | 10 |
Get the latest state of the sensor. | def update(self):
from trakt.calendar import MyShowCalendar
calendar = MyShowCalendar(days=self._days)
if not calendar:
_LOGGER.error("Nothing in calendar")
return False
self._state = len(calendar)
for show in calendar:
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n if self.coordinator.data:\n return self.coordinator.data[self._sensor]",
"def state(self):\n if self.ticker.values is not None:\n return round(\n float(\n self.ticker.values.get(\"last\")\n ),\n ... | [
"0.753419",
"0.74876356",
"0.74765736",
"0.72214586",
"0.7112677",
"0.6995063",
"0.69775915",
"0.6945787",
"0.69136775",
"0.68911135",
"0.68863803",
"0.6863116",
"0.6858303",
"0.6834618",
"0.6774382",
"0.67590016",
"0.6746638",
"0.6699024",
"0.6691935",
"0.6685089",
"0.666090... | 0.0 | -1 |
Return the name of the sensor. | def name(self):
return 'Trakt My Upcoming Calendar' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Return the state attributes of the sensor. | def device_state_attributes(self):
return self._hass.data[DATA_UPCOMING] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self) ... | [
"0.8418945",
"0.82497084",
"0.8243777",
"0.8243777",
"0.8200083",
"0.8169021",
"0.8169021",
"0.8159991",
"0.8159991",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
... | 0.7415868 | 68 |
Return a humanreadable representation of this puzzle. | def __str__(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n puzzle_string = '—' * 13 + '\\n'\n for i in range(self.PUZZLE_NUM_ROWS):\n for j in range(self.PUZZLE_NUM_COLUMNS):\n puzzle_string += '│{0: >2}'.format(str(self.position[i][j]))\n if j == self.PUZZLE_NUM_COLUMNS - 1:\n ... | [
"0.8013328",
"0.78277814",
"0.7773529",
"0.73918873",
"0.7119878",
"0.70278764",
"0.6998809",
"0.6988922",
"0.6977293",
"0.6952625",
"0.69012094",
"0.68929327",
"0.68723154",
"0.6848498",
"0.6841087",
"0.6836507",
"0.68216294",
"0.67960393",
"0.67693913",
"0.675468",
"0.67473... | 0.0 | -1 |
Return whether this puzzle is in a solved state. | def is_solved(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_solution(self) -> bool:\n if self in [self.SATISFIED, self.ALL_SOLUTIONS, self.OPTIMAL_SOLUTION]:\n return True\n return False",
"def did_solve(self) -> bool:\n return self._solution.info.status == \"solved\"",
"def did_solve(self):\n return self._solution[\"statu... | [
"0.7891133",
"0.7724571",
"0.77192897",
"0.75712657",
"0.7528001",
"0.7525148",
"0.7440006",
"0.7415231",
"0.73069674",
"0.7285772",
"0.7249697",
"0.7190834",
"0.7167805",
"0.71411747",
"0.71117806",
"0.70549554",
"0.70549554",
"0.70549554",
"0.70272464",
"0.69721466",
"0.696... | 0.6638584 | 32 |
Return a string that would evaluate to self. | def __repr__(self):
if self.rest is Link.empty:
rest = ''
else:
rest = ', ' + repr(self.rest)
return 'Link({0}{1})'.format(self.first, rest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())",
"def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.ge... | [
"0.72736275",
"0.72736275",
"0.72736275",
"0.7100371",
"0.7076422",
"0.69418997",
"0.6940535",
"0.6876189",
"0.6798726",
"0.6792618",
"0.6779267",
"0.6779267",
"0.6779267",
"0.67703366",
"0.67703366",
"0.67703366",
"0.67703366",
"0.67653316",
"0.6762984",
"0.6705609",
"0.6700... | 0.0 | -1 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
backup_type = dictionary.get('backupType')
copy_partially_successful_run = dictionary.get('copyPartiallySuccessfulRun')
extended_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
Maximum deviation from null. | def major_extent(self) -> complex:
return max((self.max() - self.null, self.null - self.min())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_error(self) -> float:\n return float(np.max(np.abs(self._flattened_errors())))",
"def max(self):\n # skipna == True\n return self._summarize(lambda c: c.max)",
"def get_max_value(self):\n if self.is_ready():\n max_values = [dnd.get_max_value() for dnd in self.dnds... | [
"0.66094536",
"0.65046316",
"0.6458721",
"0.6394537",
"0.63921916",
"0.63389707",
"0.62978673",
"0.62939286",
"0.6280261",
"0.62595344",
"0.62512046",
"0.62446564",
"0.6238238",
"0.62342966",
"0.6180326",
"0.6177482",
"0.61723816",
"0.6159018",
"0.6150413",
"0.6140926",
"0.61... | 0.0 | -1 |
Minimum deviation from null. | def minor_extent(self) -> complex:
return min((self.max() - self.null, self.null - self.min())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)",
"def min(self) -> \"Stream[float]\":\n return self.agg(np.min).astype(\"float\")",
"def min(self) -> float:\n return stats.min(self)",
"def min(self):\n return numpy.ma.min(self.data)",
"def min_... | [
"0.69159925",
"0.6710705",
"0.6672135",
"0.6645889",
"0.65403515",
"0.6534892",
"0.6518658",
"0.6478745",
"0.64436805",
"0.63997614",
"0.638135",
"0.6351122",
"0.63509774",
"0.634495",
"0.6343436",
"0.6341788",
"0.6337545",
"0.6327965",
"0.6310968",
"0.63020283",
"0.62958074"... | 0.0 | -1 |
Takes a sequence of integers and projects (embeds) these labels into a continuous space by concatenating the correspending rows in the projection matrix W i.e. [2, 5] > [W[2] ... W[5]] | def project(self, x):
assert 'int' in str(x.dtype)
if x.ndim == 2:
shape = (x.shape[0], x.shape[1] * self._W.shape[1])
return self._W[x.flatten()].reshape(shape)
elif x.ndim == 1:
return self._W[x].flatten()
else:
assert ValueError("proje... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpose(el, seq):\n return rest(mapcat(lambda x: [el, x], seq))",
"def propagate_labels_simple(regions,labels):\n rlabels,_ = label(regions)\n cors = correspondences(rlabels,labels,False)\n outputs = zeros(amax(rlabels)+1,'i')\n for o,i in cors.T: outputs[o] = i\n outputs[0] = 0\n retu... | [
"0.5254593",
"0.5242168",
"0.5135488",
"0.5073297",
"0.50690424",
"0.50441635",
"0.5037247",
"0.5024143",
"0.50197333",
"0.4993316",
"0.4962656",
"0.49546117",
"0.49486738",
"0.49337402",
"0.49267393",
"0.49264637",
"0.4915613",
"0.49069843",
"0.49024236",
"0.48953483",
"0.48... | 0.0 | -1 |
Convert class labels from scalars to onehot vectors. | def dense_to_one_hot(labels_dense, num_classes, nlevels=1):
if nlevels == 1:
num_labels = labels_dense.shape[0]
index_offset = np.arange(num_labels) * num_classes
labels_one_hot = np.zeros((num_labels, num_classes), dtype=np.int32)
labels_one_hot.flat[index_offset + labels_dense.rave... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.8250402",
"0.807683",
"0.80523187",
"0.7977843",
"0.7908335",
"0.7900327",
"0.7892233",
"0.7869711",
"0.7849721",
"0.7849721",
"0.7826951",
"0.7826122",
"0.77677035",
"0.7765413",
"0.77540547",
"0.77540547",
"0.77540547",
"0.77489346",
"0.7742955",
"0.7737176",
"0.77226317... | 0.69248796 | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.