query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Selects upload/download and callback handlers. We use a callback handler that shows a simple textual progress indicator if file_size is above the configurable threshold. We use a resumable transfer handler if file_size is >= the configurable threshold and resumable transfers are supported by the given provider. boto su... | def GetTransferHandlers(self, uri, key, file_size, upload):
config = boto.config
resumable_threshold = config.getint('GSUtil', 'resumable_threshold', ONE_MB)
if file_size >= resumable_threshold:
cb = self.FileCopyCallbackHandler(upload).call
num_cb = int(file_size / ONE_MB)
resumable_track... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_size_sig_handler(self, file_size: int):\n # Verify the maximum has been set for the progress bar\n if self.fileAnalyzeProgressBar.maximum() != file_size:\n self.fileAnalyzeProgressBar.setMaximum(file_size)\n\n logging.debug(\"Set File Size: \" + str(file_size))",
"def upl... | [
"0.544197",
"0.51174533",
"0.5087956",
"0.49688822",
"0.48351347",
"0.48325843",
"0.47526792",
"0.47526148",
"0.4721983",
"0.4708315",
"0.47005746",
"0.46767825",
"0.4652243",
"0.46501178",
"0.46301877",
"0.46250758",
"0.46141136",
"0.45568892",
"0.45161462",
"0.45094308",
"0... | 0.6246947 | 0 |
Performs resumable upload if supported by provider and file is above threshold, else performs nonresumable upload. Returns (elapsed_time, bytes_transferred). | def PerformResumableUploadIfApplies(self, fp, dst_uri, headers, canned_acl):
start_time = time.time()
file_size = os.path.getsize(fp.name)
dst_key = dst_uri.new_key(False, headers)
(cb, num_cb, res_upload_handler) = self.GetTransferHandlers(
dst_uri, dst_key, file_size, True)
if dst_uri.sche... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attempt_resumable_upload(self, key, fp, file_length, headers, cb,\r\n num_cb):\r\n (server_start, server_end) = self.SERVER_HAS_NOTHING\r\n conn = key.bucket.connection\r\n if self.tracker_uri:\r\n # Try to resume existing resumable upload.\r\n ... | [
"0.64338714",
"0.59548914",
"0.57437813",
"0.5662042",
"0.558884",
"0.55833423",
"0.55503416",
"0.5455731",
"0.53347987",
"0.52953595",
"0.52573204",
"0.5241666",
"0.5155896",
"0.5148159",
"0.5137368",
"0.5097519",
"0.5084955",
"0.50364286",
"0.50277656",
"0.5009872",
"0.5007... | 0.6702616 | 0 |
Expands URI wildcarding, objectless bucket names, and directory names. | def ExpandWildcardsAndContainers(self, uri_strs, sub_opts=None, headers=None,
debug=0):
# The algorithm we use is:
# 1. Build a first level expanded list from uri_strs consisting of all
# URIs that aren't file wildcards, plus expansions of the file wildcards.
# 2. B... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand(obj):\n return (obj + '*', obj + '*:*', obj + '*:*:*')",
"def CmdWildcardIterator(self, uri_or_str, result_type=ResultType.URIS,\n headers=None, debug=0):\n return wildcard_iterator.wildcard_iterator(\n uri_or_str, result_type=result_type, headers=headers, debug=d... | [
"0.55044866",
"0.5206521",
"0.5049598",
"0.50417286",
"0.48971736",
"0.4896779",
"0.4889999",
"0.47994387",
"0.47948807",
"0.4794746",
"0.47835147",
"0.47599638",
"0.47182953",
"0.46996891",
"0.46986145",
"0.46973294",
"0.46916848",
"0.46824795",
"0.46782288",
"0.46630394",
"... | 0.65520847 | 0 |
Checks copy request for problems, and builds needed base_dst_uri. base_dst_uri is the base uri to be used if it's a multiobject copy, e.g., the URI for the destination bucket. The actual dst_uri can then be constructed from the src_uri and this base_dst_uri. | def ErrorCheckCopyRequest(self, src_uri_expansion, dst_uri_str, headers,
debug, command='cp'):
for src_uri in src_uri_expansion:
if src_uri.is_cloud_uri() and not src_uri.bucket_name:
raise CommandException('Provider-only src_uri (%s)')
if ContainsWildcard(dst_uri_str)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ConstructDstUri(self, src_uri, exp_src_uri, base_dst_uri):\n if base_dst_uri.names_container():\n # To match naming semantics of UNIX 'cp' command, copying files\n # to buckets/dirs should result in objects/files named by just the\n # final filename component; while copying directories should... | [
"0.7059639",
"0.6167912",
"0.5738104",
"0.5286239",
"0.5260773",
"0.5251806",
"0.51933813",
"0.51639533",
"0.51353896",
"0.5022377",
"0.497357",
"0.49711338",
"0.4926278",
"0.49253422",
"0.49151328",
"0.4913535",
"0.48611373",
"0.48356867",
"0.48299488",
"0.4821887",
"0.48125... | 0.67942697 | 1 |
Rewrites dst_uri and creates dest dir as needed, if this is a multisource copy. | def HandleMultiSrcCopyRequst(self, src_uri_expansion, dst_uri):
# If src_uri and dst_uri both name containers, handle
# two cases to make copy command work like UNIX "cp -r" works:
# a) if dst_uri names a non-existent directory, copy objects to a new
# directory with the dst_uri name. In this cas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src_to_dst(self,src_uri):\n m=re.match(self.src_root+\"(.*)$\",src_uri)\n if (m is None):\n raise \"FIXME - Does not match\"\n rel_path=m.group(1)\n if (os.sep != '/'):\n # if directoty path sep isn't / then translate for URI ... | [
"0.67312545",
"0.6727234",
"0.6659769",
"0.6657753",
"0.5765052",
"0.57490075",
"0.57084966",
"0.56707317",
"0.54465216",
"0.5427129",
"0.5386717",
"0.5382597",
"0.5380205",
"0.5367291",
"0.53512245",
"0.5320187",
"0.5288889",
"0.526838",
"0.5250299",
"0.52383864",
"0.5235054... | 0.6953039 | 0 |
Checks if src_uri and dst_uri represent same object. We don't handle anything about hard or symbolic links. | def SrcDstSame(self, src_uri, dst_uri):
if src_uri.is_file_uri() and dst_uri.is_file_uri():
# Translate a/b/./c to a/b/c, so src=dst comparison below works.
new_src_path = re.sub('%s+\.%s+' % (os.sep, os.sep), os.sep,
src_uri.object_name)
new_src_path = re.sub('^.%s+' %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if type(other) != URI:\n return False\n return (self._scheme == other._scheme \n and self._host == other._host \n and self._port == other._port \n and self._path == other._path\n and self._query == other... | [
"0.6530111",
"0.63638157",
"0.6347976",
"0.6287368",
"0.5945011",
"0.59095615",
"0.5890288",
"0.5871432",
"0.58332175",
"0.58163655",
"0.58120084",
"0.57903457",
"0.5762235",
"0.571436",
"0.5659043",
"0.5610552",
"0.5602035",
"0.5590678",
"0.5589833",
"0.55659765",
"0.5564731... | 0.8208193 | 0 |
Constructs a destination URI for CopyObjsCommand. | def ConstructDstUri(self, src_uri, exp_src_uri, base_dst_uri):
if base_dst_uri.names_container():
# To match naming semantics of UNIX 'cp' command, copying files
# to buckets/dirs should result in objects/files named by just the
# final filename component; while copying directories should result
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_request_url():\n url = 'http'\n if _config['save']:\n url += 's'\n url += '://{}:{}/move'.format(_config['ip'], _config['port'])\n return url",
"def UriStrFor(iterated_uri, obj):\n return '%s://%s/%s' % (iterated_uri.scheme, obj.bucket.name, obj.name)",
"def build_target_uri(sel... | [
"0.5702773",
"0.56189567",
"0.5521624",
"0.550445",
"0.54854167",
"0.546202",
"0.5313209",
"0.5293089",
"0.5288539",
"0.52817786",
"0.5187029",
"0.5181945",
"0.5181945",
"0.5154946",
"0.51415575",
"0.51282495",
"0.50870293",
"0.505311",
"0.50460774",
"0.5034968",
"0.5026224",... | 0.60834557 | 0 |
Print listing info for given bucket. | def PrintBucketInfo(self, bucket_uri, listing_style, headers=None, debug=0):
bucket_objs = 0
bucket_bytes = 0
if listing_style == ListingStyle.SHORT:
print bucket_uri
else:
try:
for obj in self.CmdWildcardIterator(
bucket_uri.clone_replace_name('*'), ResultType.KEYS,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_bucket(self, bucket):\n\n self.response.write(\"Listbucket result:\\n\")\n\n # Production apps should set page_size to a practical value.\n page_size = 1\n stats = cloudstorage.listbucket(bucket + \"/foo\", max_keys=page_size)\n while True:\n count = 0\n ... | [
"0.7354716",
"0.7352198",
"0.71958464",
"0.71349263",
"0.7099918",
"0.68598676",
"0.6761879",
"0.64579564",
"0.63793075",
"0.63526654",
"0.6350501",
"0.62969315",
"0.62795097",
"0.6077442",
"0.5934571",
"0.5862507",
"0.58489895",
"0.5740662",
"0.5668863",
"0.56325465",
"0.559... | 0.78802145 | 0 |
This func return data for top countries throughout time. | def topCountries(top=10):
#top 10 deadly countries
countries = agg('country')[:top].index
#grab aggregated data for these countries
dataOfTop10 = agg(['year','country']).query("country in @countries")### interesting...
#unstack data
dataOfTop10 = dataOfTop10.unstack(1)
#remove multiin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_top_country(self):\n tabular_format_countries_list = [['Canada', 66, '20'], ['United States', 33, '10']]\n\n result = InstallationStatistics.get_statistics_top_country(tabular_format_countries_list)\n\n self.assertEqual('Canada', result)",
"def topBrandsandCountries(df, countries_un... | [
"0.7188561",
"0.6930038",
"0.6566591",
"0.650713",
"0.64550346",
"0.6345606",
"0.6311068",
"0.6263752",
"0.62176055",
"0.6169439",
"0.6162773",
"0.6110329",
"0.6062588",
"0.6030514",
"0.5980516",
"0.59804785",
"0.59776163",
"0.59610236",
"0.59238714",
"0.59127903",
"0.5910179... | 0.7455793 | 0 |
Sets the cleanup_metadata of this PersonDeleteOptions. | def cleanup_metadata(self, cleanup_metadata):
self._cleanup_metadata = cleanup_metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCleanupTool(self,value):\n self.PDFreactorConfiguration.in1[\"cleanupTool\"] = value",
"def clean_up_daemon_sets_in_namespaces_with_cleanup_policy(self, namespaces, cleanup_policy):\n return self.delete_resource_with_cleanup_policy(namespaces, cleanup_policy,\n ... | [
"0.49342144",
"0.48299047",
"0.48164648",
"0.4738852",
"0.46431234",
"0.46101066",
"0.4605008",
"0.4540497",
"0.45076135",
"0.44877455",
"0.4485631",
"0.44735658",
"0.44406572",
"0.4437597",
"0.44371903",
"0.44357738",
"0.4411002",
"0.43998602",
"0.43897504",
"0.43820536",
"0... | 0.70799506 | 0 |
Sets the home_folder of this PersonDeleteOptions. | def home_folder(self, home_folder):
self._home_folder = home_folder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homeDirectory(self, ignored_value):\n\t\tself.__homeDirectory = self._resolve_home_directory()",
"def home(self, home):\n if home is None:\n raise ValueError(\"Invalid value for `home`, must not be `None`\") # noqa: E501\n\n self._home = home",
"def GetHomeFolder(self): # real sig... | [
"0.6487305",
"0.63046443",
"0.6077848",
"0.58213824",
"0.58197993",
"0.58150965",
"0.58150965",
"0.5753256",
"0.57263446",
"0.567206",
"0.5638868",
"0.54021066",
"0.53872454",
"0.5385635",
"0.53816557",
"0.53468376",
"0.53266287",
"0.5325523",
"0.5319053",
"0.52196246",
"0.51... | 0.75828874 | 0 |
Sets the shared_folders of this PersonDeleteOptions. | def shared_folders(self, shared_folders):
self._shared_folders = shared_folders | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_defined_shared_folders_enabled(self, bEnabled):\n\t\tcall_sdk_function('PrlVmCfg_SetUserDefinedSharedFoldersEnabled', self.handle, bEnabled)",
"def set_map_shared_folders_on_letters(self, bMapSharedFoldersOnLetters):\n\t\tcall_sdk_function('PrlVmCfg_SetMapSharedFoldersOnLetters', self.handle, bMapSh... | [
"0.6073998",
"0.56869525",
"0.51037014",
"0.50935656",
"0.486683",
"0.47957003",
"0.45884755",
"0.45884755",
"0.45875266",
"0.45848623",
"0.45294005",
"0.44923756",
"0.4445932",
"0.44363564",
"0.44327128",
"0.44121525",
"0.44094914",
"0.43840384",
"0.43696904",
"0.43313774",
... | 0.75721765 | 0 |
Sets the collections of this PersonDeleteOptions. | def collections(self, collections):
self._collections = collections | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_collections(self, collections):\n for collection in collections:\n self.drop_collection(collection)",
"def set_collection(self, service_name, collection_name, to_cache):\n self.services.setdefault(service_name, {})\n self.services[service_name].setdefault('collections', {... | [
"0.5033303",
"0.49573594",
"0.48853493",
"0.4865477",
"0.47951487",
"0.46853006",
"0.46215004",
"0.45475668",
"0.45191467",
"0.45182347",
"0.45089346",
"0.4502301",
"0.44906533",
"0.44569468",
"0.44522327",
"0.4444393",
"0.4437373",
"0.44267026",
"0.44267026",
"0.44095856",
"... | 0.62720793 | 1 |
Sets the ratings of this PersonDeleteOptions. | def ratings(self, ratings):
self._ratings = ratings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_rating(self, **kwargs):\n\n data = dict()\n data['value'] = kwargs.get('value') or None\n\n path = self._get_movie_id_path('rating_delete')\n resp = self._delete_method(path, kwargs, data)\n\n return resp",
"def rating_id(self, rating_id: int):\n\n self._ratin... | [
"0.5852431",
"0.47767842",
"0.457218",
"0.4555128",
"0.4551001",
"0.4544296",
"0.4539956",
"0.4499743",
"0.43452004",
"0.4328597",
"0.43138883",
"0.42836276",
"0.42558882",
"0.42526865",
"0.42484444",
"0.42158845",
"0.41451105",
"0.41451105",
"0.41451105",
"0.41185495",
"0.40... | 0.6189722 | 1 |
Sets the comments of this PersonDeleteOptions. | def comments(self, comments):
self._comments = comments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments(self, comments):\n if comments is not None and len(comments) > 1000:\n raise ValueError(\"Invalid value for `comments`, length must be less than or equal to `1000`\") # noqa: E501\n\n self._comments = comments",
"def comments(self, comments):\n\n self.container['comm... | [
"0.6005803",
"0.5943034",
"0.533463",
"0.52282166",
"0.51729524",
"0.5094263",
"0.4986265",
"0.49235",
"0.49029818",
"0.48535043",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48440555",
"0.48... | 0.6326292 | 0 |
Sets the collection_feedback of this PersonDeleteOptions. | def collection_feedback(self, collection_feedback):
self._collection_feedback = collection_feedback | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_as_not_feedback(self):\n self.feedback = False",
"def select_delete_collection(self, expec_fail=False):\n delete_collection_sitem = self.locator_finder_by_xpath(self.delete_collection_id, expec_fail=expec_fail)\n delete_collection_sitem.click()\n time.sleep(1)\n delete_... | [
"0.4660153",
"0.4479887",
"0.44771156",
"0.44402534",
"0.44323143",
"0.43931454",
"0.42445672",
"0.42226908",
"0.42033428",
"0.41435018",
"0.4123928",
"0.41066483",
"0.40954313",
"0.40865862",
"0.40662232",
"0.40604806",
"0.4026898",
"0.39949268",
"0.39785284",
"0.39696592",
... | 0.70743954 | 0 |
Sets the receiver_group of this PersonDeleteOptions. | def receiver_group(self, receiver_group):
self._receiver_group = receiver_group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_group(self, group):\n self._group = group",
"def remove_from_group(self, org, contact, group):\n pass",
"def set_group(self, group: str) -> None:\n self.group = group",
"def delete_group(self, group):\n raise NotImplementedError('delete_group')",
"def group(self, group):... | [
"0.56648105",
"0.5629727",
"0.55333155",
"0.54876494",
"0.545211",
"0.54422307",
"0.5429853",
"0.5429853",
"0.5429853",
"0.5285243",
"0.5226676",
"0.5157121",
"0.5043886",
"0.5042069",
"0.4996538",
"0.49878687",
"0.4980231",
"0.4943608",
"0.4893715",
"0.4893672",
"0.48786703"... | 0.73670137 | 0 |
Validate the identifier against the prefix's pattern, if it exists. | def validate(prefix: str, identifier: str) -> Optional[bool]:
pattern = get_pattern_re(prefix)
if pattern is None:
return None
return bool(pattern.match(normalize_identifier(prefix, identifier))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_identifier(self, identifier):\n pass",
"def _validate_identifier(self, identifier):\n for c in identifier:\n if c not in string.letters + string.digits + '_':\n return False\n return True",
"def validate_kf_id(kf_id, prefix='TA'):\n if len(kf_id) !... | [
"0.7408097",
"0.7396331",
"0.6896986",
"0.6826547",
"0.64809126",
"0.6387843",
"0.63224006",
"0.6290734",
"0.6247484",
"0.6160539",
"0.61340904",
"0.61145294",
"0.605325",
"0.6044549",
"0.6044547",
"0.60234606",
"0.6018778",
"0.5991968",
"0.59837234",
"0.59392786",
"0.5905442... | 0.8497021 | 0 |
Normalize the identifier with the appropriate banana. | def normalize_identifier(prefix: str, identifier: str) -> str:
# A "banana" is an embedded prefix that isn't actually part of the identifier.
# Usually this corresponds to the prefix itself, with some specific stylization
# such as in the case of FBbt. The banana does NOT include a colon ":" at the end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sanitize_to_identifer(name):\n n = name.strip()\n n = re.sub('/', ' ', n)\n n = re.sub('-', ' ', n)\n n = re.sub(' +', '_', n)\n n = re.sub('[\\W]+', '', n)\n return n",
"def normalize(val):\n \n if val.find('-') != -1:\n val = val.replace('-','_')\n\n return val",
"def n... | [
"0.62498116",
"0.6103178",
"0.6090855",
"0.60531324",
"0.5999573",
"0.59399766",
"0.5901326",
"0.58349013",
"0.5803965",
"0.580082",
"0.57906383",
"0.5772368",
"0.5770924",
"0.5757673",
"0.57162386",
"0.5711377",
"0.5693682",
"0.5654112",
"0.5643497",
"0.56413555",
"0.5633282... | 0.71285367 | 0 |
Get the identifiers.org URL for the given CURIE. | def get_identifiers_org_url(prefix: str, identifier: str) -> Optional[str]:
curie = get_identifiers_org_curie(prefix, identifier)
if curie is None:
return None
return f"https://identifiers.org/{curie}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url_from_doi(doi):\n\n try:\n r = requests.head(f\"https://doi.org/{doi}\", allow_redirects=True)\n except requests.exceptions.ConnectionError:\n return None\n\n return r.url",
"def get_Curie_ref(self, val):\n if len(val) == 0:\n return URIRef(self.base)\n ... | [
"0.61636496",
"0.60958976",
"0.60149693",
"0.59665805",
"0.57917076",
"0.5781677",
"0.56911445",
"0.5682871",
"0.56211597",
"0.5576372",
"0.5564913",
"0.55424225",
"0.5527563",
"0.5491155",
"0.5478088",
"0.541651",
"0.5405972",
"0.54037833",
"0.5390824",
"0.5363278",
"0.53604... | 0.70760375 | 0 |
Get the bioregistry link. | def _get_bioregistry_link(prefix: str, identifier: str) -> Optional[str]:
norm_prefix, norm_identifier = normalize_curie(prefix, identifier)
if norm_prefix is None:
return None
return f"{BIOREGISTRY_REMOTE_URL.rstrip()}/{norm_prefix}:{norm_identifier}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_registry(self) -> None:\n\n arr = self.load_links()[0]\n for i,v in enumerate(arr):\n print(f\"<{i}: {v}>\\n\")\n pass",
"def getLink(self):",
"def get_link(prefix: str, identifier: str, use_bioregistry_io: bool = True) -> Optional[str]:\n providers = get_providers(p... | [
"0.6344005",
"0.6297033",
"0.62138337",
"0.6201464",
"0.61723423",
"0.61723423",
"0.61248446",
"0.61228025",
"0.6117944",
"0.6117944",
"0.6117944",
"0.5885266",
"0.5865561",
"0.577505",
"0.57633257",
"0.5762611",
"0.57493734",
"0.5675951",
"0.56756413",
"0.5662293",
"0.563691... | 0.744591 | 0 |
Get the URL to resolve the given prefix/identifier pair with the given resolver. | def get_registry_resolve_url(metaprefix: str, prefix: str, identifier: str) -> Optional[str]:
providers = get_providers(prefix, identifier)
if not providers:
return None
return providers.get(metaprefix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_identifiers_org_url(prefix: str, identifier: str) -> Optional[str]:\n curie = get_identifiers_org_curie(prefix, identifier)\n if curie is None:\n return None\n return f\"https://identifiers.org/{curie}\"",
"def resolveUri(self, *args):\n return _libsbml.SBMLResolverRegistry_resolve... | [
"0.6380464",
"0.6088858",
"0.60886234",
"0.6022632",
"0.5849159",
"0.5730095",
"0.56223696",
"0.55889964",
"0.55541784",
"0.55472934",
"0.5524634",
"0.5510377",
"0.5502343",
"0.543467",
"0.54266346",
"0.53655595",
"0.5344931",
"0.5324596",
"0.53097606",
"0.5302649",
"0.529421... | 0.700943 | 0 |
Initialize types global variables with common types. | def initialize_types():
global VOID, VOID_P, VOID_PP
global CHAR, CHAR_P, CHAR_PP
global INT, INT_P, INT_108A
global ULONG, UINT
VOID = gdb.lookup_type("void")
VOID_P = VOID.pointer()
VOID_PP = VOID_P.pointer()
CHAR = gdb.lookup_type("char")
CHAR_P = CHAR.pointer()
CHAR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self): \n self.types = {}",
"def __set_utils_types(self):\n self.__arrayt = type(self.c_byte * 1)\n # self.__cfuncptrt = type(type(self.memmove))\n # class _p(self.Structure):\n # pass\n # self.__ptrt = type(self.POINTER(_p))\n self.__basic_... | [
"0.65056497",
"0.6477415",
"0.63417953",
"0.62999207",
"0.62689316",
"0.6072707",
"0.60454255",
"0.60141075",
"0.5958679",
"0.59225327",
"0.58071923",
"0.57830304",
"0.5762805",
"0.5757923",
"0.57541144",
"0.57219446",
"0.5718443",
"0.56720936",
"0.56538254",
"0.5637154",
"0.... | 0.7307148 | 0 |
Reads the memory location `where` with type `ttype`. | def read_value(where, ttype=None):
ttype = VOID_P if ttype is None else ttype
frame = gdb.selected_frame()
if where.startswith("$"):
return frame.read_register(where[1:]).cast(ttype)
else:
to_parse = "(%s) %s" % (str(ttype), where)
return gdb.parse_and_eval(to_parse) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, where):\n return self._data[where]",
"def fetch_where(self, tablename, where):\n\n if type(where) != str:\n raise NotAStringError(\"please provide a valid where clause\")\n\n query = 'select * from ' + tablename + ' where ' + where\n\n try:\n ... | [
"0.5448398",
"0.53106546",
"0.48611066",
"0.48344597",
"0.48211852",
"0.47786808",
"0.47259092",
"0.45408067",
"0.4456974",
"0.44333473",
"0.44250152",
"0.43972963",
"0.43949172",
"0.43939638",
"0.43215302",
"0.43211624",
"0.43104756",
"0.43070924",
"0.42990926",
"0.42651215",
... | 0.6839989 | 0 |
given a height along line of sight, the distance to the observation window and the solar radius, return the coronal density based off of streamer data fromLimb | def getDensity(h, R_w, R_sun): # k is a fitting constant
R = np.sqrt(R_w**2+h**2)
r = R/R_sun # units need to be in solar radii
a = 77.1
b = 31.4
c = 0.954
d = 8.30
e = 0.550
f = 4.63
return (a*r**(-b) + c*r**(-d) + e*r**(-f))*10**8 #[cm-3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_densities(self, r):\n # Handle scalar r values as single element array\n if not np.isscalar(r):\n r = np.array((r))\n\n assert np.min(r) > 0, \"Error: distances must be non-zero and positive.\"\n\n if self.s_exp is not None:\n oS, doS, ddoS = self.get_orbit... | [
"0.5454819",
"0.53788716",
"0.5350352",
"0.5328957",
"0.5292687",
"0.52506727",
"0.5144197",
"0.51307636",
"0.5065308",
"0.50575227",
"0.50207204",
"0.50146633",
"0.49834746",
"0.4977443",
"0.4975468",
"0.49359798",
"0.49337485",
"0.49244788",
"0.49076614",
"0.4901918",
"0.49... | 0.55072665 | 0 |
Turns a numpy array into a string. Use str2np to convert back. Yes, it is absurd that we need to do this. We shouldn't. But from my Expert | def np2str(a: np.ndarray) -> str:
return json.dumps(a.tolist()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arraystr(a, max_line_width=None, precision=None, suppress_small=None):\n return np.array2string(a, max_line_width,\n precision, suppress_small,\n separator=', ', prefix=\"\", style=str)\\\n .replace('..., ', '..., ' if PY3 else 'Elli... | [
"0.7668864",
"0.7660055",
"0.74028087",
"0.73397017",
"0.7132134",
"0.6980833",
"0.6820138",
"0.68081397",
"0.67062193",
"0.6697705",
"0.6608742",
"0.65923023",
"0.65681803",
"0.65397334",
"0.6435107",
"0.6393014",
"0.6393014",
"0.6337105",
"0.6320334",
"0.63053894",
"0.62946... | 0.778396 | 0 |
Turns a string into a numpy array. Reverse of np2str. | def str2np(s: str) -> np.ndarray:
return np.array(json.loads(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_numpy(string_array):\n if pd.isnull(string_array):\n return(np.NaN)\n else:\n return np.array(ast.literal_eval(string_array))",
"def string_to_array(arg):\n\n res = arg.replace('[', '').replace(']', '').replace(',', '')\n return np.array(res.split(' '), dtype=np.int8)",
"de... | [
"0.8174913",
"0.78813064",
"0.750545",
"0.742618",
"0.7182514",
"0.70567936",
"0.6892877",
"0.6872287",
"0.67668694",
"0.67524487",
"0.67366683",
"0.6626965",
"0.6586725",
"0.6580806",
"0.64523757",
"0.6432584",
"0.6423253",
"0.63838595",
"0.6343251",
"0.63229716",
"0.6311459... | 0.8019013 | 1 |
Syncopy custom ExceptionHandler. Prints formatted and colored messages and stack traces, and starts debugging if `%pdb` is enabled in Jupyter/iPython. | def SPYExceptionHandler(*excargs, **exckwargs):
# Depending on the number of input arguments, we're either in Jupyter/iPython
# or "regular" Python - this matters for coloring error messages
if len(excargs) == 3:
isipy = False
etype, evalue, etb = excargs
else:
etype, evalue, et... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def baseExceptionHandler(*args):\n\n\theader, frames, trcback = formatReport(*extractException(*args))\n\n\tLOGGER.error(\"!> {0}\".format(Constants.loggingSeparators))\n\tmap(lambda x: LOGGER.error(\"!> {0}\".format(x)), header)\n\n\tLOGGER.error(\"!> {0}\".format(Constants.loggingSeparators))\n\tmap(lambda x: LO... | [
"0.63668907",
"0.62963057",
"0.62103194",
"0.6100354",
"0.60183656",
"0.5926729",
"0.5918545",
"0.5916895",
"0.5910487",
"0.5765461",
"0.57642436",
"0.57295614",
"0.5726145",
"0.56801313",
"0.5637029",
"0.56245685",
"0.5609924",
"0.55958366",
"0.55697525",
"0.5569087",
"0.555... | 0.64448094 | 0 |
Log a message in parallel code run via slurm. This uses the parallel logger and one file per machine. Returns | def SPYParallelLog(msg, loglevel="INFO", caller=None):
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int): # Invalid string was set.
raise SPYValueError(legal=f"one of: {loglevels}", varname="loglevel", actual=loglevel)
if caller is None:
caller =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_parallel(pid, call_method_id, run_id='gwas', kinship_method='ibd'):\n job_id = '%s_%s_%d_%d' % (run_id, kinship_method, call_method_id, pid)\n file_prefix = env.env['results_dir'] + job_id\n\n #Cluster specific parameters \n shstr = '#!/bin/bash\\n'\n shstr += '#$ ... | [
"0.6007545",
"0.5688902",
"0.55962497",
"0.559282",
"0.55060256",
"0.54812354",
"0.5468144",
"0.5374238",
"0.5281202",
"0.5265701",
"0.5239216",
"0.51966226",
"0.51679915",
"0.51659477",
"0.51620716",
"0.5127934",
"0.511845",
"0.510981",
"0.51014036",
"0.50684947",
"0.5053366... | 0.61517555 | 0 |
Capture details about the view_func that is about to execute | def process_view(self, request, view_func, view_args, view_kwargs):
if not scout_config.value("monitor"):
return
tracked_request = TrackedRequest.instance()
tracked_request.is_real_request = True
track_request_view_data(request, tracked_request)
span = tracked_reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_exec_time(view_func):\r\n @wraps(view_func, assigned=available_attrs(view_func))\r\n def _wrapped_view_func(request, *args, **kwargs):\r\n t1 = time.time()\r\n back_view = view_func(request, *args, **kwargs)\r\n print request.get_full_path(), time.time() - t1\r\n return ... | [
"0.7136872",
"0.698362",
"0.69041514",
"0.6508647",
"0.6270444",
"0.62283134",
"0.62076545",
"0.609943",
"0.6065147",
"0.5921364",
"0.5820853",
"0.5762659",
"0.57506853",
"0.5735391",
"0.5725252",
"0.5722089",
"0.5718177",
"0.56821394",
"0.5678318",
"0.5665546",
"0.56598353",... | 0.70100695 | 1 |
Adds a new ToDo to the list | def add_todo():
task = flask.request.form["task"]
todos.append(ToDo(task))
return "success" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_items(list_id):\n\n item_title = request.form[\"item_title\"]\n item_description = request.form[\"item_description\"]\n user_id = session.get(\"user_id\")\n\n if not user_id:\n raise Exception(\"No user logged in.\")\n\n to_do_list = ToDoList.query.get(list_id)\n\n new_item = ToDoI... | [
"0.7692403",
"0.75500757",
"0.75385946",
"0.7229673",
"0.7222644",
"0.7201016",
"0.71989423",
"0.71025795",
"0.70856917",
"0.6990269",
"0.68904996",
"0.6773006",
"0.6752873",
"0.6706633",
"0.664904",
"0.661715",
"0.6607402",
"0.6585516",
"0.6567563",
"0.65658355",
"0.65384394... | 0.8164502 | 0 |
Create list of default pip requirements for MLflow Models. Returns list of default pip requirements for MLflow Models produced by this flavor. | def get_default_pip_requirements(include_cloudpickle=False):
_check_soft_dependencies("mlflow", severity="error")
from mlflow.utils.requirements_utils import _get_pinned_requirement
pip_deps = [_get_pinned_requirement("sktime")]
if include_cloudpickle:
pip_deps += [_get_pinned_requirement("clou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def python_requirements(self):\n try:\n dist = self.requirement.pip_requirement.get_dist()\n extras = self.requirement.pip_requirement.extras\n requirements = list(dist.requires(extras))\n except Exception:\n logger.warning(\"Failed to determine installatio... | [
"0.67231864",
"0.6240935",
"0.61417305",
"0.6106975",
"0.6102336",
"0.6072006",
"0.6058914",
"0.5995286",
"0.5991597",
"0.58851796",
"0.58757514",
"0.58436614",
"0.58049595",
"0.57882637",
"0.57187045",
"0.56341326",
"0.5592187",
"0.5590501",
"0.55732214",
"0.55626416",
"0.55... | 0.78039926 | 0 |
Return default Conda environment for MLflow Models. Returns The default Conda environment for MLflow Models produced by calls to | def get_default_conda_env(include_cloudpickle=False):
_check_soft_dependencies("mlflow", severity="error")
from mlflow.utils.environment import _mlflow_conda_env
return _mlflow_conda_env(
additional_pip_deps=get_default_pip_requirements(include_cloudpickle)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_environment():\n # Search for the environment variable set by the hutch python setup\n env = os.getenv('CONDA_ENVNAME')\n # Otherwise look for built-in Conda environment variables\n if not env:\n env = os.getenv('CONDA_DEFAULT_ENV')\n # Check the top level PYTHONPATH to see if... | [
"0.6355434",
"0.6241017",
"0.61965597",
"0.61439174",
"0.5763095",
"0.57486796",
"0.5724221",
"0.5691034",
"0.5655165",
"0.5654611",
"0.56079906",
"0.55675125",
"0.55185765",
"0.5517381",
"0.5498466",
"0.5476292",
"0.5472681",
"0.5404192",
"0.5397453",
"0.53926975",
"0.537949... | 0.80523634 | 0 |
Log a sktime model as an MLflow artifact for the current run. | def log_model(
sktime_model,
artifact_path,
conda_env=None,
code_paths=None,
registered_model_name=None,
signature=None,
input_example=None,
await_registration_for=None,
pip_requirements=None,
extra_pip_requirements=None,
serialization_format=SERIALIZATION_FORMAT_PICKLE,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_model_without_starting_new_run():\n with TempDir() as tmp:\n artifact_path = \"model\"\n local_path = tmp.path(\"model\")\n mlflow_model = Model(artifact_path=artifact_path, run_id=_AUTOLOG_RUN_ID)\n save_model_kwarg... | [
"0.70850366",
"0.69937974",
"0.6949326",
"0.67462784",
"0.66128474",
"0.65032214",
"0.6481456",
"0.64282435",
"0.6287046",
"0.59985286",
"0.59353966",
"0.59068996",
"0.58943534",
"0.57941216",
"0.5646695",
"0.5579601",
"0.54835516",
"0.54797125",
"0.5476407",
"0.54430944",
"0... | 0.73166275 | 0 |
Load PyFunc implementation. Called by ``pyfunc.load_model``. | def _load_pyfunc(path): # noqa: E501
_check_soft_dependencies("mlflow", severity="error")
from mlflow.exceptions import MlflowException
from mlflow.utils.model_utils import _get_flavor_configuration
if os.path.isfile(path):
serialization_format = SERIALIZATION_FORMAT_PICKLE
_logger.war... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_pyfunc(path):\n import tensorflow\n\n (\n tf_saved_model_dir,\n tf_meta_graph_tags,\n tf_signature_def_key,\n ) = _get_and_parse_flavor_configuration(model_path=path)\n\n loaded_model = tensorflow.saved_model.load( # pylint: disable=no-value-for-parameter\n export... | [
"0.7480354",
"0.6761297",
"0.67086977",
"0.67086977",
"0.64833236",
"0.644096",
"0.63043493",
"0.6161545",
"0.6015046",
"0.599458",
"0.5907236",
"0.58926547",
"0.58378094",
"0.58029515",
"0.5723951",
"0.5716107",
"0.56987995",
"0.56742996",
"0.5650106",
"0.562576",
"0.5615248... | 0.747926 | 1 |
sos factory function, returns a version specific SensorObservationService object | def SensorObservationService(url, version='1.0.0', xml=None):
if version in ['1.0', '1.0.0']:
return sos100.SensorObservationService_1_0_0.__new__(sos100.SensorObservationService_1_0_0, url, version, xml)
elif version in ['2.0', '2.0.0']:
return sos200.SensorObservationService_2_0_0.__new__(sos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sensor(self, sensor_key):\n sensor_class, service = self.services[sensor_key]\n\n return sensor_class(self.platform_name, sensor_key, service)",
"def new_instance(valid, test_mode):\n database = SensorsTable(test_mode=test_mode)\n implementations = SensorGetter.get_sensor_implement... | [
"0.5936116",
"0.5500027",
"0.54106855",
"0.5394249",
"0.535936",
"0.532393",
"0.5269507",
"0.5235204",
"0.52062535",
"0.517184",
"0.5136265",
"0.51114684",
"0.5089523",
"0.5087797",
"0.5068168",
"0.50676584",
"0.5035795",
"0.5032768",
"0.50292856",
"0.50230336",
"0.50151926",... | 0.8053189 | 0 |
Download and save the dataneededtorender for builds and jobs. We ask jenkins what builds it knows about for the given jobs, then download them all to get a `.data` file that is suitable for passing as input to this script (at some later date) to graph this build. | def download_builds(config, builds, force=False):
if not config.get('datadir'):
raise ValueError("No output dir (--datadir) specified")
jenkins_client = jenkins.get_client(config)
download_args = []
for build in builds:
if ':' in build:
(job, build_id) = build.split(':')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_buildings_download(request):\n body = json.loads(request.body)\n export_id = body.get('export_id')\n\n export_subdir = exporter._make_export_subdirectory(export_id)\n keys = list(DefaultStorage().bucket.list(export_subdir))\n\n if not keys or len(keys) > 1:\n return {\n ... | [
"0.5980997",
"0.5846999",
"0.58016133",
"0.5684989",
"0.56449175",
"0.5640449",
"0.56289864",
"0.56019944",
"0.5526899",
"0.5520561",
"0.55028105",
"0.5481336",
"0.54385823",
"0.542231",
"0.53897566",
"0.53834313",
"0.53440076",
"0.5336366",
"0.5249497",
"0.52163655",
"0.5207... | 0.62587667 | 0 |
Asserts a site visitor can GET the `analyse` screen | def test_analyse_screen(client):
path = reverse('text_analysis:analyse')
response = client.get(path)
assert response.status_code == 200, 'Should return an `OK` status code' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visit(self, client, site, landing_page):\n response = client.get(landing_page.relative_url(site))\n assert response.status_code == 200",
"def test_accessible(self):\n survey = Survey.objects.get(id=2)\n responses = Response.objects.filter(survey=survey)\n response = re... | [
"0.6595508",
"0.62993777",
"0.62831616",
"0.62774974",
"0.62224185",
"0.6215889",
"0.60910827",
"0.6065271",
"0.6050251",
"0.60461843",
"0.6045932",
"0.5955406",
"0.59379095",
"0.5934326",
"0.5934326",
"0.5934326",
"0.5934326",
"0.5933294",
"0.5930834",
"0.59113115",
"0.58974... | 0.7581896 | 0 |
Plots margin densities for sigma and width. Expected to be uniform. | def plot_margin_densities(bgm_fit, threshold):
bgm = bgm_fit.named_steps['bayesiangaussianmixture']
weights = bgm.weights_ # n_components
means = bgm.means_ # n_components x n_features
covariances = bgm.covariances_ # n_components x n_features x n_features
n_components = means.shape[0]
n_feature... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_density(sampler, threshold, sigma, width, n_random_samples = 10000):\n recX, labels = sampler.sample(n_random_samples)\n rec_t0 = recX[:,0]\n rec_amplitude = recX[:,1]\n generator.generate_pdf(threshold, sigma, width)\n fig = plt.figure(figsize = (12, 12))\n # pdf and random samples go t... | [
"0.6333102",
"0.6179185",
"0.60010207",
"0.5960666",
"0.5759967",
"0.5678299",
"0.55475837",
"0.554194",
"0.5537761",
"0.5533913",
"0.55258965",
"0.5466195",
"0.5440112",
"0.54317516",
"0.5392096",
"0.53833497",
"0.53494036",
"0.5318962",
"0.53053164",
"0.5287674",
"0.5281734... | 0.6800891 | 0 |
View to handle connecting existing django accounts with facebook | def facebook_connect(request, template='socialregistration/facebook.html',
extra_context=dict()):
# for facebook the login is done in JS, so by the time it hits our view here there is no redirect step. Look for the querystring values and use that instead of worrying about session.
connect_object = get_objec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_authentication(request):\n try:\n code = request.GET['code']\n except:\n messages.error('There is some problem in connecting with facebook at the moment, Please try sign up with email')\n return HttpResponseRedirect('/')\n\n try:\n access_token = get_facebook_acces... | [
"0.7017177",
"0.6939956",
"0.69250727",
"0.68696064",
"0.67818755",
"0.6711868",
"0.66746074",
"0.6576655",
"0.63557416",
"0.633736",
"0.62841153",
"0.62753177",
"0.617561",
"0.6134787",
"0.6076174",
"0.602836",
"0.60073495",
"0.5994413",
"0.5967894",
"0.59287626",
"0.5921563... | 0.7441132 | 0 |
Redirect the user to the openid provider | def openid_redirect(request):
request.session['next'] = _get_next(request)
request.session['openid_provider'] = request.GET.get('openid_provider')
request.session['socialregistration_connect_object'] = get_object(request.GET)
client = OpenID(
request,
'http%s://%s%s' % (
_ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openid_done(request, provider=None):\n\n if not provider:\n provider = request.session.get('openid_provider', '')\n if hasattr(request,'openid') and request.openid:\n #check for already existing associations\n openid_key = str(request.openid)\n\n #authenticate and login\n ... | [
"0.7310133",
"0.69767207",
"0.69368905",
"0.67243433",
"0.66221726",
"0.6532379",
"0.65151626",
"0.639436",
"0.63739187",
"0.6283034",
"0.62608516",
"0.6209797",
"0.6182559",
"0.61617637",
"0.61428356",
"0.6127544",
"0.61146307",
"0.6099549",
"0.6084637",
"0.6081178",
"0.6079... | 0.83476585 | 0 |
Center protein so that the molecule is not broken by periodic boundary conditions | def center_protein(traj, inplace=True):
create_bonds(traj.topology)
return traj.image_molecules(inplace=inplace, make_whole=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(self, center_mass=False):\n if center_mass:\n com = self.center_of_mass\n self.xyz -= com\n else:\n self.xyz -= self.xyz.mean(0)",
"def resetAlignmentCenter(self):\n cent = self.TiltSeries_._TiltAlignmentParas.cent\n imdimX = self.TiltSeries... | [
"0.6612349",
"0.65694755",
"0.6376795",
"0.63726264",
"0.6337984",
"0.6238661",
"0.61947876",
"0.619474",
"0.61426926",
"0.61275536",
"0.6102843",
"0.6085959",
"0.60810447",
"0.6072383",
"0.60476613",
"0.60178554",
"0.6017457",
"0.59851617",
"0.59755105",
"0.59694713",
"0.592... | 0.75121605 | 0 |
Return the number of circular references to the object. For the purposes of this function, the circular reference must be only accessible (directly or indirectly) through the object. | def circular_reference_count(obj: typing.Any) -> int:
if np is not None:
result = _numpy_circular_ref_count(obj)
if result is not NotImplemented:
return result
return _get_circular_ref_count(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_refs(self):\n return self._n_refs",
"def referencecount(self) :\n\t\ttry :\n\t\t\treturn self._referencecount\n\t\texcept Exception as e:\n\t\t\traise e",
"def get_size(obj: Any) -> int:\n if isinstance(obj, BLACKLIST):\n return 0\n seen_ids: set[int] = set()\n size = 0\n object... | [
"0.7472081",
"0.712911",
"0.6964042",
"0.6863925",
"0.68219185",
"0.678775",
"0.6773094",
"0.67412645",
"0.6582645",
"0.65278816",
"0.64337957",
"0.6420373",
"0.6420373",
"0.64150935",
"0.6401749",
"0.63989073",
"0.6373764",
"0.63708293",
"0.6358727",
"0.63216347",
"0.6320435... | 0.85062957 | 0 |
Enable purging. Only with purging, pyweakref.ref instances will be weak references, not strong references. | def enable_purging() -> None:
global _purge, _purge_timer
if not purging():
_purge = True
_purge_timer = threading.Timer(5.0, _purge_func)
_purge_timer.start() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release(self):\n del self.ref\n self.ref = None\n gc.collect()",
"def _enable_weakref(self) -> None:\n self._tx_weakref_disabled = False",
"def disable_purging() -> None:\r\n global _purge, _purge_timer\r\n if purging():\r\n _purge = False\r\n _purge_timer.ca... | [
"0.6430023",
"0.63898516",
"0.63580555",
"0.6267979",
"0.6240635",
"0.62111545",
"0.61647785",
"0.61381817",
"0.61381817",
"0.61381817",
"0.61381817",
"0.61381817",
"0.61381817",
"0.611086",
"0.6087001",
"0.60550416",
"0.60219187",
"0.5966864",
"0.5905727",
"0.5900416",
"0.58... | 0.65232295 | 0 |
Return all pyweakrefs to obj. If none, return an empty list. | def get_pyweakrefs(obj: typing.Any) -> list[ReferenceType]:
seq = _reference_id_registry.get(id(obj), [])
return [seq[0] for item in seq] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_refobjs(self, ):\n return cmds.ls(type=\"jb_reftrack\")",
"def list_refs(self):\n pass",
"def _refs(self, items):\n # type: (Iterable[Any]) -> Iterable[weakref.ReferenceType]\n return map(self.ref, items)",
"def list_all_refs(self):\n self.list_refs()\n s... | [
"0.69156635",
"0.68716735",
"0.6771153",
"0.6550949",
"0.6442704",
"0.64174813",
"0.6346928",
"0.6336576",
"0.6197461",
"0.61949223",
"0.6137897",
"0.6096993",
"0.60405004",
"0.60172296",
"0.5993775",
"0.5944581",
"0.5942475",
"0.59189206",
"0.5828131",
"0.57902074",
"0.57866... | 0.85791713 | 0 |
Return if purging is enabled. Without purging, pyweakref.ref instances will not be weak references, rather strong references. | def purging() -> bool:
return _purge | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_purging() -> None:\r\n global _purge, _purge_timer\r\n if not purging():\r\n _purge = True\r\n _purge_timer = threading.Timer(5.0, _purge_func)\r\n _purge_timer.start()",
"def reuseable(self) -> bool:\n return self._reuseable",
"def disable_purging() -> None:\r\n ... | [
"0.5966954",
"0.59007514",
"0.58261746",
"0.57176876",
"0.5714088",
"0.5536531",
"0.5514175",
"0.5476762",
"0.54592717",
"0.5433333",
"0.5414477",
"0.53703785",
"0.53387326",
"0.531639",
"0.52955073",
"0.52908105",
"0.52488065",
"0.5241981",
"0.5231054",
"0.5223706",
"0.52126... | 0.6741145 | 0 |
Generates previews on the timeline | def generate_previews(source: BaseSource=None, force=False):
entry_filters = {'extra_attributes__has_key': 'file'}
if source:
entry_filters['source'] = source.entry_source
entries = Entry.objects.filter(**entry_filters)
entry_count = len(entries)
log_message = f"Generating previews for {en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPreviews(self):\n logger.debug(\"Func: getPreviews\")\n \n # return \"ASDFASDF\"\n return sorted(self._currentPreviewsDict.keys())",
"def get_all_game_previews(self):\n state = 'preview.gameData.status.detailedState'\n return self._db.Games.find({'date' : self._da... | [
"0.5931078",
"0.552589",
"0.5501078",
"0.5446661",
"0.53483385",
"0.5338679",
"0.53334534",
"0.53294927",
"0.5276309",
"0.5274671",
"0.52258205",
"0.52163804",
"0.5206252",
"0.52037615",
"0.5201259",
"0.51994044",
"0.5165678",
"0.5152966",
"0.510705",
"0.5101222",
"0.5090006"... | 0.6162525 | 0 |
Get the full extent of an axes, including axes labels, tick labels, and titles. | def full_extent(ax, pad=0.0):
# For text objects, we need to draw the figure first, otherwise the extents
# are undefined.
ax.figure.canvas.draw()
items = ax.get_xticklabels() + ax.get_yticklabels()
# items += [ax, ax.title, ax.xaxis.label, ax.yaxis.label]
items += [ax, ax.title]
bbox = Bbox... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extent(self):\n return self._ax.extent",
"def full_extent(ax, pad=0.0):\n # For text objects, we need to draw the figure first, otherwise the extents are undefined.\n ax.figure.canvas.draw()\n items = ax.get_xticklabels() + ax.get_yticklabels()\n items += [ax, ax.title]\n bbox = Bbox.un... | [
"0.75531536",
"0.7368489",
"0.6839166",
"0.67600006",
"0.67201394",
"0.6709703",
"0.66875136",
"0.6674248",
"0.6548036",
"0.6335185",
"0.63227665",
"0.62621903",
"0.625633",
"0.6246917",
"0.6236677",
"0.62210065",
"0.6219811",
"0.61830145",
"0.61672103",
"0.6164999",
"0.59673... | 0.73843247 | 1 |
Setup the ringbuffer datastream, and return the channel object so that we can flush it when we want to. This datastream logs LOTS of data, but isn't written out unless explicitly flushed a flight recorder | def setup_ringbuffer_datastream(context):
chan = context.create_channel("ring", 5000000, 50,
0, ringbuffer=True)
enabled = {
"SCHED" : True,
"SIGNAL_FAM" : True,
"SYSCALL" : True,
"TASKALIAS": True,
"DSKITRACE": True
}
ring_ds = context.create_datastream("ds_ring", "ring")
ds.process_enabled_dict(enab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBufferedData(self):\n if not self.ringBuffer: # first time when buffer is empty\n return np.zeros((1, self.windowLength, self.sensorChannels)) \n return np.array(self.ringBuffer)",
"def scribe_buffer():\r\n if LogOptions._SCRIBE_BUFFER is None:\r\n LogOptions._SCRIBE_BUFF... | [
"0.5606128",
"0.5467135",
"0.5409699",
"0.5336863",
"0.5334489",
"0.53252643",
"0.53099316",
"0.52994365",
"0.528977",
"0.52294934",
"0.5184993",
"0.5103268",
"0.51002824",
"0.5098576",
"0.5091853",
"0.5083243",
"0.5059984",
"0.5043554",
"0.50412124",
"0.5015153",
"0.50136906... | 0.7082423 | 0 |
import_types is used to parse and prepare the type rules that will be used in calculating the types of expression trees. | def import_types(self, typerule_list, variable_types = []):
# For simplicity, variable types are treated exactly the same as type rules
all_type_rules = variable_types + typerule_list
# Sort all type rules by their input lengths into the _type_rules dict
for type_rule in all_type_rules... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _imports(graph: mapry.Graph, py: mapry.Py) -> str:\n # pylint: disable=too-many-branches\n # pylint: disable=too-many-statements\n stdlib_block = {'import typing'}\n\n third_party_block = set() # type: Set[str]\n\n if mapry.needs_type(a_type=graph, query=mapry.Path):\n if py.path_as == '... | [
"0.5921209",
"0.57611024",
"0.567505",
"0.5611896",
"0.5579761",
"0.55159265",
"0.54755175",
"0.5425813",
"0.5418027",
"0.53423756",
"0.53144497",
"0.5309955",
"0.52486587",
"0.52472657",
"0.5202084",
"0.5195576",
"0.518933",
"0.517455",
"0.51186496",
"0.5110992",
"0.5099339"... | 0.5941546 | 0 |
expression_type is the main entry point for the package. Call TypeParser.expression_type and pass in a parse tree to have the root type of the tree calculated via a DepthFirst Search of the tree. | def expression_type(self, node):
# End recursion & return this node's type if it is a leaf or nonexistent
if not node:
return None
if not node.get_children():
return self._subexpression_type(self._node_to_expression(node))
else:
# Iteratively consume ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _subexpression_type(self, expression):\n\n # Return the first matched TypeRule's output type, or None if no match\n for type_rule in self._type_rules[len(expression)]:\n applied_type = type_rule.apply(expression)\n if applied_type is not None:\n return applied... | [
"0.61831594",
"0.5693838",
"0.56593543",
"0.5624738",
"0.5615666",
"0.5555837",
"0.5478738",
"0.54660076",
"0.5333142",
"0.5242742",
"0.5225837",
"0.52114373",
"0.52045923",
"0.51956785",
"0.51615644",
"0.5066505",
"0.49917197",
"0.49774233",
"0.49624798",
"0.49380043",
"0.49... | 0.6376541 | 0 |
Calculate the type of a leaflevel expression. That is, an expression with no complex child nodes that cannot be described by a single string type. | def _subexpression_type(self, expression):
# Return the first matched TypeRule's output type, or None if no match
for type_rule in self._type_rules[len(expression)]:
applied_type = type_rule.apply(expression)
if applied_type is not None:
return applied_type
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expression_type(self, node):\n\n # End recursion & return this node's type if it is a leaf or nonexistent\n if not node:\n return None\n if not node.get_children():\n return self._subexpression_type(self._node_to_expression(node))\n else:\n # Iterati... | [
"0.7099167",
"0.61412406",
"0.609437",
"0.58264744",
"0.5807559",
"0.54864943",
"0.5333536",
"0.52839464",
"0.5262899",
"0.5258796",
"0.52191246",
"0.52068317",
"0.5178198",
"0.51626647",
"0.50838065",
"0.50707287",
"0.5054888",
"0.5040522",
"0.49886164",
"0.49787894",
"0.494... | 0.6180652 | 1 |
Convert all nodes in an expression list to their associated types. This search handles the bulk of the parser's recursion, as it will start recursion on any node in the expression which is not a leaf node. | def _child_types(self, children):
# Recursively determine types on each child node
child_types = []
for child in children:
child_types.append(self.expression_type(child))
return child_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expression_type(self, node):\n\n # End recursion & return this node's type if it is a leaf or nonexistent\n if not node:\n return None\n if not node.get_children():\n return self._subexpression_type(self._node_to_expression(node))\n else:\n # Iterati... | [
"0.6018786",
"0.5674755",
"0.56699795",
"0.55886114",
"0.5423717",
"0.5258556",
"0.52495664",
"0.5247424",
"0.5180887",
"0.5121855",
"0.51158464",
"0.50840604",
"0.50553924",
"0.5054486",
"0.5041273",
"0.5030835",
"0.5007947",
"0.5004885",
"0.4962244",
"0.49611312",
"0.495678... | 0.5898406 | 1 |
Check whether the next part of the potential expression contains a unary negation. | def _has_unary_negation(self, child_types, expression):
return len(expression) in [0,2] and child_types[0] == '-' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_negated(x) -> bool:\n return not (x & 1 == 0)",
"def _negation_op(spec, expression):",
"def no_operators(expression):\n OPERATORS = set('+-*/')\n for i in expression:\n if i in OPERATORS:\n return True\n raise NotValidExpression('Not a valid expression, no operators')",
"... | [
"0.7028451",
"0.6717068",
"0.6701668",
"0.6684899",
"0.6622539",
"0.64245415",
"0.63324",
"0.62940043",
"0.62915003",
"0.6271314",
"0.62570894",
"0.624976",
"0.62437516",
"0.62413335",
"0.62379885",
"0.62241846",
"0.6194157",
"0.6190811",
"0.6138865",
"0.6043831",
"0.6005857"... | 0.76073074 | 0 |
retries creation of kafka consumer connections until it succeeds or times out | def try_creating_kafka_consumer(broker, broker_port, topic, consumer_group):
retries = 8
for i in range(retries):
try:
return KafkaConsumer(topic, group_id=consumer_group, bootstrap_servers=[f'{broker}:{broker_port}'])
except errors.NoBrokersAvailable:
logging.error("atte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_kafka_connection(delay=5):\n while True:\n try:\n kafka = KafkaProducer(bootstrap_servers=KAFKA_BROKERS)\n LOGGER.info('Connection to kafka cluster established')\n kafka.close()\n break\n except:\n LOGGER.error('Can not connect to... | [
"0.6611963",
"0.6494159",
"0.63523865",
"0.6156412",
"0.61105436",
"0.61080486",
"0.59963095",
"0.5959119",
"0.59372276",
"0.5926103",
"0.58610475",
"0.5830046",
"0.5807465",
"0.5799397",
"0.57653743",
"0.57564795",
"0.56917095",
"0.56620485",
"0.5633267",
"0.5633075",
"0.562... | 0.7616249 | 0 |
Calculates the R^2 value for the GWR model. | def r2_GWR(GWRMod):
tss = np.sum((GWRMod.y - GWRMod.y_mean)**2)
r2 = 1.0 - GWRMod.res2/tss
return r2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_R2(self):\n\n d1 = self.T - self.Y\n d2 = self.T - self.T.mean()\n\n self.r2 = 1 - d1.dot(d1) / d2.dot(d2)\n self.r2 = format(self.r2, '.3f')\n\n print \"\"\n print \"R2:\", self.r2",
"def _calc_r2(self):\n sse = np.sum((self.data.y - self.predict(se... | [
"0.7919789",
"0.76424164",
"0.7621829",
"0.7487459",
"0.71899205",
"0.7047658",
"0.69599354",
"0.6907422",
"0.6887155",
"0.68140036",
"0.67396015",
"0.67070526",
"0.6683979",
"0.66635364",
"0.65382195",
"0.65051377",
"0.64974743",
"0.6475882",
"0.64547855",
"0.6451764",
"0.63... | 0.82065165 | 0 |
Populate a list with Edge objects, mapped from db. | def populate_edges(self, edges_list):
edges = []
for edge in edges_list:
source, target, weight = edge[4], edge[5], edge[6]
freq, line, geom = edge[7], edge[1], edge[2]
edges.append(Edge(source, target, weight,
freq, line, geom))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_edge_ist(self) -> EdgeList:\r\n return EdgeList(self)",
"def create_edges(self, edge_json):\n self.edges = []\n for edge in edge_json:\n from_node = self.find_node(edge[\"from\"])\n to_node = self.find_node(edge[\"to\"])\n self.edges.append(Edge(f... | [
"0.6576329",
"0.6504471",
"0.6298686",
"0.6290396",
"0.6286582",
"0.61591196",
"0.6077323",
"0.60347456",
"0.5996814",
"0.59027344",
"0.5868906",
"0.5867808",
"0.58494437",
"0.5840155",
"0.5787023",
"0.5771977",
"0.5738752",
"0.5715439",
"0.5699809",
"0.56931144",
"0.5678498"... | 0.72010344 | 0 |
Populate a list with Vertex objects, mapped from db. | def populate_vertices(self, vertices_list):
vertices = []
for vertex in vertices_list:
vertex_id = vertex[0]
vertices.append(Vertex(vertex_id))
self.vertices = vertices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_vertices(self):\n self.vertices = []\n for key in self.graph:\n self.vertices.append(self.Vertex(key, self.graph[key]))",
"def fetch_from_sqlite(self):\n conn = get_sqlite()\n c = conn.cursor()\n c.execute('SELECT * FROM vertices ORDER BY id')\n verti... | [
"0.71661055",
"0.6847688",
"0.66699135",
"0.6233327",
"0.60095",
"0.59055865",
"0.58005416",
"0.57749695",
"0.57571894",
"0.572714",
"0.571261",
"0.5698523",
"0.56625485",
"0.5659618",
"0.565549",
"0.56113976",
"0.55910236",
"0.558864",
"0.5581662",
"0.5579575",
"0.5548817",
... | 0.77077585 | 0 |
sets a series of parameters of the experiment setup or document according to a dictionary if an experiment is currently running, will attach as a pending update, which will be set once the experiment stops running through the server callback method for the experiment completed event | def set_param(self,set_dict):
if self.query_running():
self.params_pending = True
self.pending_params = set_dict
return "Pending"
for param in set_dict:
root={"EXP":self.app,"DM":self.appdoc}[param.split("_")[0]]
root.SetParam(win32com.client.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update(self):\n self.all_params = {}\n self._update_experiment_params()\n self._update_preprocessing_params()\n self._update_model_params()",
"def update(self, methodName=None, elementName=None, args=None, kwargs=None):\n #if methodName != 'run':\n # return\n ##print me... | [
"0.62047803",
"0.5832001",
"0.5816899",
"0.5796853",
"0.57953626",
"0.57526183",
"0.57322884",
"0.5712759",
"0.5709553",
"0.56523895",
"0.55731404",
"0.555652",
"0.5542452",
"0.54959196",
"0.54886276",
"0.5480578",
"0.54759264",
"0.54615855",
"0.54320467",
"0.5375757",
"0.535... | 0.6349464 | 0 |
sets the camera autoframing mode, which if true will immediately begin collection of the next frame after each arrives | def set_autoframing(self,value=True):
self.autoframe=value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def live():\n m = camera.status.mode\n print \"Hit ^C to exit.\"\n print \"NOTE! After using this command, type: mode('%s') \" % m\n mode('centre')\n try:\n while True:\n f = camera.GetFits()\n camera.status.update()\n setheaders(f)\n camera.status.lastact = time.time() #Record the ... | [
"0.6175358",
"0.5965215",
"0.59311265",
"0.5922155",
"0.59183586",
"0.5905513",
"0.58601236",
"0.58371323",
"0.57451624",
"0.57451624",
"0.5739937",
"0.5731639",
"0.5720027",
"0.5715713",
"0.57007986",
"0.5698071",
"0.56938946",
"0.56901175",
"0.568824",
"0.567828",
"0.566866... | 0.64564735 | 0 |
method that polls for frame completion a local variable is stored from last poll, indicating whether an experiment was in progress. If the new poll indicates it is not, returns True | def _server_poll_expcompleted_(self):
#print "class Princeton_CCD function _server_poll_expcompleted_"
try:
last_state = self.polled_running
except (AttributeError,UnboundLocalError):
self.polled_running = False
last_state = False
self.polled_runnin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_completion(self):\n\n time.sleep(3)\n while self.status == 0:\n pass",
"def poll(self):\n return False",
"def is_finished(self):\n self.refresh()\n return self.progress.remaining_budget is not None and self.progress.remaining_budget <= 0",
"def is_call_waiting(... | [
"0.63351786",
"0.6147131",
"0.60807467",
"0.601559",
"0.5987755",
"0.5970426",
"0.5962104",
"0.59266925",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0.58878636",
"0... | 0.69292897 | 0 |
Endpoint for validating if a posted string is a pangram | def check_string():
# Forcing check for valid json and headers with Content-Type:application/json
content = request.get_json(silent=False, force=True)
payload = content.get('data', None)
if not payload:
return response_handler(
{"error": "'data' key missing from JSON payload."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pangram(string):\n a_pos = ord('a')\n letters = [0] * 26\n for char in string:\n if char.isalpha():\n letters[ord(char.lower()) - a_pos] += 1\n return all(letters)",
"def post(self):\n data = request.json\n return check_spelling(data)",
"def verify_text(self, ... | [
"0.61329734",
"0.60513806",
"0.5977086",
"0.5897228",
"0.5871303",
"0.5826443",
"0.5744146",
"0.5684479",
"0.567305",
"0.56470114",
"0.56131446",
"0.5608203",
"0.5595567",
"0.5540064",
"0.55184543",
"0.5503536",
"0.54949117",
"0.5491614",
"0.547028",
"0.54653454",
"0.54595995... | 0.6516636 | 0 |
Pulse Compression is used to increase the range resolution and SNR by performing matched filtering of the transmitted pulse (template) with the received signal (x) | def pulse_compression(x, template, normalize=False, window=None, nfft=None):
[num_pulses, samples_per_pulse] = x.shape
if nfft is None:
nfft = samples_per_pulse
if window is not None:
Nx = len(template)
if callable(window):
W = window(cp.fft.fftfreq(Nx))
elif is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gate(filename,threshold,ratio,attack,release,wout=True,plot=True):\n start=time.time()\n if ratio < 1.0:\n print('Ratio must be > 1.0 for compression to occur! You are expanding.')\n if ratio==1.0:\n print('Signal is unaffected.')\n n, data, data_dB,sr,ch=inputwav(filename)\n #Arra... | [
"0.6036829",
"0.5981471",
"0.54640365",
"0.5410211",
"0.54006976",
"0.53201425",
"0.5316566",
"0.525516",
"0.52416986",
"0.52327883",
"0.52327174",
"0.5224613",
"0.51513845",
"0.5149857",
"0.5139385",
"0.50736994",
"0.50405174",
"0.5040428",
"0.50394034",
"0.50340354",
"0.501... | 0.678524 | 0 |
Pulse doppler processing yields a range/doppler data matrix that represents moving target data that's separated from clutter. An estimation of the doppler shift can also be obtained from pulse doppler processing. FFT taken across slowtime (pulse) dimension. | def pulse_doppler(x, window=None, nfft=None):
[num_pulses, samples_per_pulse] = x.shape
if nfft is None:
nfft = num_pulses
if window is not None:
Nx = num_pulses
if callable(window):
W = window(cp.fft.fftfreq(Nx))
elif isinstance(window, cp.ndarray):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_pulse_shaping_waveform(self):\n self.pulse_shaping_list = []\n # Make the rise time be 3.3333% if the dot time.\n rise_time_in_msec = 0.03333333333333 * self.dot_time_in_msec\n # Limit the rise time to 2 milliseconds.\n if rise_time_in_msec > 0.002:\n rise_tim... | [
"0.60852396",
"0.5998875",
"0.59345144",
"0.5842551",
"0.58012646",
"0.56403846",
"0.5631913",
"0.56271863",
"0.5620649",
"0.5618581",
"0.5582362",
"0.55823",
"0.5566295",
"0.5546302",
"0.5522001",
"0.5505924",
"0.54939055",
"0.5484252",
"0.54836947",
"0.54045796",
"0.53633",... | 0.7112541 | 0 |
Verifies we can add a new tag to a VM and not modify an existing tag on that resource | def test_add_or_update_single_tag(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.vm',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'normalize',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aws_service_api_vm_tag_put(self):\n pass",
"def test_removal_does_not_raise_on_nonexistent_tag(self):\n p = self.load_policy({\n 'name': 'test-azure-tag',\n 'resource': 'azure.vm',\n 'filters': [\n {'type': 'value',\n 'key': '... | [
"0.77649385",
"0.7387739",
"0.7075966",
"0.6656576",
"0.65036297",
"0.6465619",
"0.6458824",
"0.6456048",
"0.6449689",
"0.6442221",
"0.6399257",
"0.63945055",
"0.6361586",
"0.63506293",
"0.6283683",
"0.62317973",
"0.6213603",
"0.6211985",
"0.61786103",
"0.6172332",
"0.6161824... | 0.7408799 | 1 |
Adds tags to an empty resource group, then updates one tag and adds a new tag | def test_add_or_update_tags(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.resourcegroup',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'normalize',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tags_to_resource(ResourceId=None, Tags=None):\n pass",
"def add_tags(ResourceArn=None, Tags=None):\n pass",
"def _add_tags(self):\n\n if self.version != 'live':\n return\n\n tags = [t.strip() for t in self.tags_text.split(',')]\n tags = list(set(tags))\n\n f... | [
"0.6558311",
"0.62224245",
"0.61563283",
"0.6131066",
"0.6068289",
"0.60150707",
"0.59856796",
"0.5970131",
"0.5950358",
"0.5894891",
"0.5828419",
"0.5818687",
"0.57768595",
"0.57686335",
"0.575219",
"0.5750683",
"0.57304066",
"0.5720598",
"0.5716028",
"0.57158905",
"0.571091... | 0.6548033 | 1 |
Verifies we can delete a tag to a VM and not modify an existing tag on that resource | def test_remove_single_tag(self):
p = self.load_policy({
'name': 'test-azure-remove-single-tag',
'resource': 'azure.vm',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'normalize',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_removal_does_not_raise_on_nonexistent_tag(self):\n p = self.load_policy({\n 'name': 'test-azure-tag',\n 'resource': 'azure.vm',\n 'filters': [\n {'type': 'value',\n 'key': 'name',\n 'op': 'eq',\n 'value_... | [
"0.7614638",
"0.7149751",
"0.7064771",
"0.7040828",
"0.69282234",
"0.6877819",
"0.6588053",
"0.6364861",
"0.63523936",
"0.6196349",
"0.61579126",
"0.6140006",
"0.6125979",
"0.6120203",
"0.6086665",
"0.60324454",
"0.6031246",
"0.60080886",
"0.60051006",
"0.5979031",
"0.5945604... | 0.7371263 | 1 |
Verifies we can delete multiple tags from a resource group without modifying existing tags. | def test_remove_tags(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.resourcegroup',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'normalize',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_resource_group(self):\n pass",
"def bulk_delete(self, **kwargs: Any) -> Response:\n tags = kwargs[\"rison\"]\n try:\n DeleteTagsCommand(tags).run()\n return self.response(200, message=f\"Deleted {len(tags)} tags\")\n except TagNotFoundError:\n ... | [
"0.67967415",
"0.649529",
"0.62559175",
"0.6253165",
"0.62317085",
"0.62317085",
"0.6177669",
"0.61279553",
"0.6117101",
"0.60856915",
"0.6035331",
"0.6035331",
"0.60039115",
"0.59949845",
"0.59554094",
"0.59554094",
"0.5923172",
"0.58898515",
"0.5887204",
"0.5866109",
"0.585... | 0.66661125 | 1 |
Verifies attempting to delete a tag that is not on the resource does not throw an error | def test_removal_does_not_raise_on_nonexistent_tag(self):
p = self.load_policy({
'name': 'test-azure-tag',
'resource': 'azure.vm',
'filters': [
{'type': 'value',
'key': 'name',
'op': 'eq',
'value_type': 'norma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_tag(self):\r\n\r\n with app.test_client() as client:\r\n resp = client.post(f\"/tags/{self.tag.id}/delete\", follow_redirects=True)\r\n html = resp.get_data(as_text=True)\r\n\r\n self.assertEqual(resp.status_code, 200)\r\n self.assertNotIn(\"Marvel... | [
"0.7444001",
"0.7069921",
"0.6784255",
"0.6638141",
"0.6606541",
"0.6576158",
"0.65614355",
"0.64411354",
"0.6368591",
"0.63667697",
"0.63317627",
"0.632806",
"0.6313087",
"0.6304011",
"0.6302712",
"0.63016224",
"0.62931526",
"0.6242308",
"0.62377095",
"0.62280387",
"0.618957... | 0.7281134 | 1 |
tests for the temparature converter | def test_temperature(self):
self.assertEqual(Converter.TemperatureCtoF(50), 122)
self.assertEqual(Converter.TemperatureCtoF(-50), -58)
self.assertEqual(Converter.TemperatureFtoC(50), 10)
self.assertAlmostEqual(Converter.TemperatureFtoC(-50), -45.55, places=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempConvert(temp, unit):\n if unit == 'F':\n celsius = (temp - 32) * 5 / 9\n return celsius\n else:\n return temp",
"def test_temperatures_value(self):\n self.assertEqual(self.TminValue, 450.0)",
"def convert_temperature(self, event):\n try:\n #Compare ot... | [
"0.64593834",
"0.6315767",
"0.62554526",
"0.61849815",
"0.6140915",
"0.6105866",
"0.6082826",
"0.60662615",
"0.6046566",
"0.60280526",
"0.60113657",
"0.59822845",
"0.59665346",
"0.5951075",
"0.58979714",
"0.587829",
"0.5843394",
"0.5784856",
"0.57688904",
"0.5757867",
"0.5704... | 0.64599544 | 0 |
tests for the measurment converter | def test_measurment(self):
self.assertEqual(Converter.MeasurmentWorldtoUS(10, "km"), 6.214)
self.assertEqual(Converter.MeasurmentWorldtoUS(10, "m"), 10.936)
self.assertEqual(Converter.MeasurmentWorldtoUS(10, "cm"), 0.328)
self.assertEqual(Converter.MeasurmentWorldtoUS(10, "mm"), 0.39... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_convert_same_unit():\n assert pressure_util.convert(2, PRESSURE_PA, PRESSURE_PA) == 2\n assert pressure_util.convert(3, PRESSURE_HPA, PRESSURE_HPA) == 3\n assert pressure_util.convert(4, PRESSURE_MBAR, PRESSURE_MBAR) == 4\n assert pressure_util.convert(5, PRESSURE_INHG, PRESSURE_INHG) == 5",
... | [
"0.6973871",
"0.69157994",
"0.67782086",
"0.63163084",
"0.6262526",
"0.61533237",
"0.61193854",
"0.6063204",
"0.6003036",
"0.60023606",
"0.59685755",
"0.58939403",
"0.58698696",
"0.5863226",
"0.5838598",
"0.58297575",
"0.5821282",
"0.58060056",
"0.5742862",
"0.57288164",
"0.5... | 0.7210032 | 0 |
test for the speed converter | def test_speed(self):
self.assertEqual(Converter.SpeedKMHtoMPH(10), 6.2)
self.assertEqual(Converter.SpeedMPHtoKMH(10), 16.1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_speed(self, value):\n if value & SPEED_ACTIVE:\n return None\n else:\n return value & SPEED_MASK",
"def speed(self) -> int:",
"def speed(self) -> int:",
"def speed(self, s=0):",
"def convert_speed(self, event):\n try:\n #Compare other unit ... | [
"0.6799373",
"0.6479763",
"0.6479763",
"0.6465872",
"0.64656264",
"0.6375015",
"0.6311451",
"0.6302171",
"0.6270626",
"0.6230628",
"0.61868745",
"0.6089499",
"0.6011468",
"0.598422",
"0.59120023",
"0.59076583",
"0.5869805",
"0.58342975",
"0.58227706",
"0.5811397",
"0.5793797"... | 0.7302605 | 0 |
Monitor the status of the specified HAT device in a loop until the triggered status is True or the running status is False. | def wait_for_trigger(self):
# Read the status only to determine when the trigger occurs.
is_running = True
is_triggered = False
while is_running and not is_triggered:
status = self.hat.a_in_scan_status()
is_running = status.running
is_triggered = statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n while True:\r\n if self.camera_device.is_detecting():\r\n self.alarm_device.switch_alarm()",
"async def monitor():\n\n for n in range(6):\n await asyncio.sleep(2)\n print(\"monitor status:\", n, await ps.status())",
"def run(self):... | [
"0.62453014",
"0.6092352",
"0.6056146",
"0.6053579",
"0.5992721",
"0.5983913",
"0.59502167",
"0.5920007",
"0.58608514",
"0.5857563",
"0.58304703",
"0.5823211",
"0.5805296",
"0.57848245",
"0.57581127",
"0.5753424",
"0.5740827",
"0.57273775",
"0.57046634",
"0.56977254",
"0.5672... | 0.70297736 | 0 |
Renders a calendar with models from the chosen month | def calendar(request, year=None, month=None):
today = datetime.date.today()
year = int(year) if year else today.year
month = int(month) if month else today.month
try:
first_of_month = datetime.date(year, month, 1)
except ValueError: # Not a valid year and month
raise Http404
ev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_cal(request, year=None, month=None):\n if year == None:\n # get the current comic as a starting point\n lToday = Comic.objects.filter(published=True).order_by('-date')[0].date\n year = lToday.year\n month = lToday.month\n\n return calendar(request, year, month)",
"def c... | [
"0.7238604",
"0.7071681",
"0.705804",
"0.6771286",
"0.6719591",
"0.66115034",
"0.65900797",
"0.63997763",
"0.6175017",
"0.60905683",
"0.6089079",
"0.6088855",
"0.60475314",
"0.60411173",
"0.59932786",
"0.59637064",
"0.5923851",
"0.5848303",
"0.58288735",
"0.5822559",
"0.58192... | 0.7240797 | 0 |
Returns a given event or bedpres as an iCal .ics file | def ical_event(request, event_id):
event = Event.objects.get(id=event_id)
# Use the same template for both Event and BedPres.
template = loader.get_template("events/event_icalendar.ics")
context = {
"event_list": (event,),
}
response = HttpResponse(template.render(context), content_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_ics(self, request, pk, *args, **kwargs):\n\n event = Event.objects.get(pk=pk)\n ics_file = event.export_event()\n response = Response(ics_file)\n response['Content-Disposition'] = 'attachment; ' \\\n 'filename=' + event.label + '.ics... | [
"0.7014175",
"0.6851397",
"0.66403925",
"0.66294414",
"0.66041636",
"0.6558786",
"0.6377986",
"0.6361551",
"0.6311977",
"0.6311977",
"0.61969876",
"0.61969876",
"0.60658556",
"0.59038055",
"0.55257285",
"0.5499122",
"0.5488041",
"0.54850715",
"0.5362488",
"0.53586525",
"0.533... | 0.73986226 | 0 |
The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by `vpc_id`. | def engine_security_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "engine_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(s... | [
"0.68906003",
"0.68042195",
"0.68042195",
"0.6783754",
"0.6681128",
"0.6681128",
"0.6622851",
"0.6622851",
"0.65399075",
"0.6496629",
"0.6394589",
"0.63780427",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.63421786",
"0.62686855",
"0.62686855",
"0.... | 0.7011863 | 0 |
The IAM role that the Amazon EMR Studio assumes. The service role provides a way for Amazon EMR Studio to interoperate with other Amazon Web Services services. | def service_role(self) -> pulumi.Input[str]:
return pulumi.get(self, "service_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_role(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_role\")",
"def service_role(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_role\")",
"def service_role(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_role... | [
"0.75329775",
"0.7217653",
"0.7217653",
"0.70248497",
"0.7010139",
"0.6921028",
"0.69086546",
"0.69047856",
"0.6863307",
"0.68553287",
"0.6809839",
"0.67654437",
"0.67654437",
"0.67654437",
"0.67166924",
"0.66412354",
"0.66270715",
"0.66270715",
"0.66270715",
"0.6617036",
"0.... | 0.74035543 | 1 |
The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by `vpc_id`. | def workspace_security_group_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "workspace_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_security_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def workspace_security_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def security_group_id(self) -> pulumi.Inpu... | [
"0.72309697",
"0.7065785",
"0.67988247",
"0.67988247",
"0.6768797",
"0.6768797",
"0.6625691",
"0.6625691",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.638914",
"0.6377499",
"0.6354188",
"0.6262482",
"0.6262482",
"0.6262482",
"0.62624... | 0.7212722 | 1 |
The authentication endpoint of your identity provider (IdP). Specify this value when you use IAM authentication and want to let federated users log in to a Studio with the Studio URL and credentials from your IdP. Amazon EMR Studio redirects users to this endpoint to enter credentials. | def idp_auth_url(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_auth_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_auth_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_auth_url\")",
"def auth_url(self):\n\n return \"{}?client_id={}&redirect_uri={}&scope={}&state={}\".format(AUTH_ENDPOINT, self.client_id,\\\n self.redirect_uri, self.scope, self.state)",
"def au... | [
"0.73342144",
"0.61421776",
"0.59861565",
"0.5918602",
"0.58944696",
"0.56724465",
"0.5659786",
"0.5592917",
"0.55907595",
"0.55823594",
"0.55823416",
"0.5576239",
"0.55256826",
"0.5524355",
"0.55210763",
"0.55210763",
"0.5517178",
"0.55091786",
"0.5467416",
"0.5406468",
"0.5... | 0.7340292 | 1 |
The name that your identity provider (IdP) uses for its RelayState parameter. For example, RelayState or TargetSource. Specify this value when you use IAM authentication and want to let federated users log in to a Studio using the Studio URL. The RelayState parameter differs by IdP. | def idp_relay_state_parameter_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_relay_state_parameter_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_relay_state_parameter_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_relay_state_parameter_name\")",
"def relay_state(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"relay_state\")",
"def relay_state(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.7687181",
"0.59368676",
"0.59368676",
"0.56802654",
"0.5628786",
"0.5575582",
"0.5529944",
"0.54963726",
"0.533518",
"0.52946424",
"0.5269813",
"0.51703966",
"0.51690614",
"0.5145018",
"0.5112524",
"0.50896215",
"0.50896215",
"0.50896215",
"0.50896215",
"0.50896215",
"0.50... | 0.7885242 | 0 |
The IAM user role that users and groups assume when logged in to an Amazon EMR Studio. Only specify a User Role when you use Amazon Web Services SSO authentication. The permissions attached to the User Role can be scoped down for each user or group using session policies. | def user_role(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "user_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_role(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"user_role\")",
"def getUserRole(self):\n\n # general question concerning the user's role (hersteller, beauftragter...)\n self.roleView.getUserRole()",
"def role(self) -> aws_cdk.aws_iam.IRole:\n return ... | [
"0.7068165",
"0.66357064",
"0.6477955",
"0.6413195",
"0.6339574",
"0.6304233",
"0.62071526",
"0.6118527",
"0.61078304",
"0.60794014",
"0.60794014",
"0.60794014",
"0.603479",
"0.603247",
"0.6029019",
"0.59861964",
"0.5954648",
"0.595334",
"0.5868651",
"0.5853171",
"0.58490384"... | 0.7068885 | 1 |
The authentication endpoint of your identity provider (IdP). Specify this value when you use IAM authentication and want to let federated users log in to a Studio with the Studio URL and credentials from your IdP. Amazon EMR Studio redirects users to this endpoint to enter credentials. | def idp_auth_url(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_auth_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_auth_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_auth_url\")",
"def auth_url(self):\n\n return \"{}?client_id={}&redirect_uri={}&scope={}&state={}\".format(AUTH_ENDPOINT, self.client_id,\\\n self.redirect_uri, self.scope, self.state)",
"def au... | [
"0.733513",
"0.61433494",
"0.5987851",
"0.5917364",
"0.58954287",
"0.5673445",
"0.56609595",
"0.55953974",
"0.5591695",
"0.55847",
"0.558439",
"0.55766195",
"0.5527152",
"0.5522925",
"0.55222666",
"0.55222666",
"0.5518764",
"0.55106723",
"0.5466359",
"0.54050314",
"0.54050314... | 0.7341372 | 0 |
The name that your identity provider (IdP) uses for its RelayState parameter. For example, RelayState or TargetSource. Specify this value when you use IAM authentication and want to let federated users log in to a Studio using the Studio URL. The RelayState parameter differs by IdP. | def idp_relay_state_parameter_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "idp_relay_state_parameter_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def idp_relay_state_parameter_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"idp_relay_state_parameter_name\")",
"def relay_state(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"relay_state\")",
"def relay_state(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.768848",
"0.593493",
"0.593493",
"0.5682287",
"0.562658",
"0.5578043",
"0.5532136",
"0.549397",
"0.5336049",
"0.5295124",
"0.52722514",
"0.5171025",
"0.5170942",
"0.5145687",
"0.51145095",
"0.5092392",
"0.5092392",
"0.5092392",
"0.5092392",
"0.5092392",
"0.5092392",
"0.5... | 0.7886542 | 1 |
The IAM user role that users and groups assume when logged in to an Amazon EMR Studio. Only specify a User Role when you use Amazon Web Services SSO authentication. The permissions attached to the User Role can be scoped down for each user or group using session policies. | def user_role(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "user_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_role(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"user_role\")",
"def getUserRole(self):\n\n # general question concerning the user's role (hersteller, beauftragter...)\n self.roleView.getUserRole()",
"def role(self) -> aws_cdk.aws_iam.IRole:\n return ... | [
"0.7068214",
"0.66350424",
"0.64774257",
"0.64126813",
"0.63391656",
"0.6303802",
"0.620743",
"0.61188483",
"0.6108174",
"0.6079462",
"0.6079462",
"0.6079462",
"0.6034469",
"0.6032965",
"0.6026925",
"0.5984384",
"0.5955966",
"0.59547716",
"0.5867706",
"0.5852826",
"0.5848336"... | 0.7069238 | 0 |
Get an existing Studio resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
arn: Optional[pulumi.Input[str]] = None,
auth_mode: Optional[pulumi.Input[str]] = None,
default_s3_location: Optional[pulumi.Input[str]] = None,
descr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n state = storage.get(State, state_id)\n if not state:\n abort(404)\n return jsonify(state.to_dict()), 200",
"def get_state_by_id(state_id):\n my_state = storage.get('State', state_id)\n if my_state is None:\n abort(404)\n return jsonify(my_state.to_... | [
"0.62434953",
"0.6238258",
"0.61616653",
"0.61550075",
"0.6134168",
"0.61179656",
"0.6100013",
"0.6011708",
"0.59448004",
"0.5883692",
"0.5881919",
"0.58268267",
"0.5796979",
"0.57796544",
"0.5776168",
"0.56969273",
"0.5687934",
"0.5654655",
"0.56533",
"0.5652628",
"0.5650857... | 0.71403503 | 0 |
The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by `vpc_id`. | def engine_security_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "engine_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"engine_security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"security_group_id\")",
"def security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(se... | [
"0.7013316",
"0.68066067",
"0.68066067",
"0.67850715",
"0.6683846",
"0.6683846",
"0.66251224",
"0.66251224",
"0.6543493",
"0.6500523",
"0.6398078",
"0.63792205",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.63436174",
"0.62710613",
"0.62710613",
"0... | 0.6892434 | 1 |
The IAM role that the Amazon EMR Studio assumes. The service role provides a way for Amazon EMR Studio to interoperate with other Amazon Web Services services. | def service_role(self) -> pulumi.Output[str]:
return pulumi.get(self, "service_role") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_role(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"service_role\")",
"def service_role(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_role\")",
"def service_role(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_role\... | [
"0.74046427",
"0.7218937",
"0.7218937",
"0.70252204",
"0.7010788",
"0.69213706",
"0.69096506",
"0.6905022",
"0.6863561",
"0.6854463",
"0.68094724",
"0.6766141",
"0.6766141",
"0.6766141",
"0.67176384",
"0.66420156",
"0.66270846",
"0.66270846",
"0.66270846",
"0.6617356",
"0.661... | 0.75349903 | 0 |
The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by `vpc_id`. | def workspace_security_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "workspace_security_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_security_group_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def workspace_security_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"workspace_security_group_id\")",
"def security_group_id(self) -> pulumi.Input... | [
"0.7212722",
"0.7065785",
"0.67988247",
"0.67988247",
"0.6768797",
"0.6768797",
"0.6625691",
"0.6625691",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.64094466",
"0.638914",
"0.6377499",
"0.6354188",
"0.6262482",
"0.6262482",
"0.6262482",
"0.626248... | 0.72309697 | 0 |
Redirect edge to point from first vertex to last according to alphabet e.g. "b a 3" will become "a b 3" | def redirect_edge_alpabetically(edge):
if edge[0].lower() > edge[1].lower():
msg = "{} ".format(edge)
work = edge[0]
edge[0] = edge[1]
edge[1] = work
msg += "-> {}".format(edge)
logger.debug(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_alphabet(self):\n dag = Graph(self.k)\n # Building the DAG\n for i in range(len(self.word_sample) - 1):\n for a, b in zip(self.word_sample[i], self.word_sample[i + 1]):\n if a != b:\n dag.add_edge(a, b)\n break\n\n ... | [
"0.59650934",
"0.5724517",
"0.5512467",
"0.54730046",
"0.5430139",
"0.54295605",
"0.542761",
"0.541962",
"0.54040015",
"0.5391529",
"0.5389645",
"0.53580797",
"0.53372186",
"0.5329606",
"0.5303027",
"0.5292136",
"0.52884614",
"0.5262027",
"0.52558273",
"0.52490795",
"0.523480... | 0.66512823 | 0 |
Get transition vertexes with edges indexes from degrees dictionary | def get_transition_vertexes(dd, start, end):
# from degrees dictionary choose vertexes with degree == 2
# except for start and end vertex, combine a list of
# such vertexes with indexes of their edges in edges list
v_indexes = {}
for v in dd:
if dd[v][0] == 2 and v != start and v != end:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\r\n return self.adjacent.keys()",
"def _degree_verts(g):\n n = len(g)\n # degs = map(len, g) is a tiny bit slower than the following line\n degs = [ len(g[v]) for v in range(n) ]\n dv = dict()\n for v in range(n):\n degnbr = [0] * n\n for w in g[v]:\n ... | [
"0.67272043",
"0.6594935",
"0.65947855",
"0.63876325",
"0.6276506",
"0.6225013",
"0.6201821",
"0.6201821",
"0.6201821",
"0.61925185",
"0.61531764",
"0.61029667",
"0.6101509",
"0.6093262",
"0.60884774",
"0.6087071",
"0.6083367",
"0.6081893",
"0.6076063",
"0.6063979",
"0.604960... | 0.7821683 | 0 |
Find and reduces parallel edges in the list Sorts list. | def reduce_parallel(edges):
edges[:] = qsort(edges)
logger.debug("Performing parallel optimization\n")
e = edges # use shorter name for edges
l = 0 # l stands for left and points to left side of comparison
# r stands for right and points to the right side of comparison
# items are sorted in t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sortEdges( self, listEdges ):\r\n changed = True\r\n while changed:\r\n changed = False\r\n for i in range( len(listEdges)-1 ):\r\n if listEdges[ i ].cost > listEdges[ i+1 ].cost:\r\n changed = True\r\n aux = listEdges[ i ... | [
"0.65361464",
"0.59675485",
"0.5884665",
"0.56545603",
"0.560666",
"0.5599113",
"0.5576444",
"0.5544006",
"0.55268884",
"0.5505579",
"0.546652",
"0.54547846",
"0.5450952",
"0.544428",
"0.5394301",
"0.53624326",
"0.5361598",
"0.5353389",
"0.53372085",
"0.53365934",
"0.5315151"... | 0.6688602 | 0 |
Reduces transitional vertexes in graph described in edges | def reduce_sequential(edges, start, end):
dd = get_degrees_dictionary(edges) # O(len(edges))
tvs = get_transition_vertexes(dd, start, end) # O(len(dd))
logger.debug("dd: {}".format(dd))
logger.debug("tvs: {}".format(tvs))
for v in tvs: # for each vertex in transitional vertexes
# edges
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_edges(self):",
"def contract_edge(graph, u, v):\n graph[v] = (graph[v] | graph[u]) - {u, v}\n del graph[u]\n for w in graph:\n if u in graph[w]:\n graph[w] = (graph[w] | {v}) - {u, w}",
"def mutateEdge(g, edges, directed, connected):\n if ((directed and g.e == g.n ** 2 -... | [
"0.6852421",
"0.6568463",
"0.64864695",
"0.6437077",
"0.64132136",
"0.6352795",
"0.63091815",
"0.6269146",
"0.6220492",
"0.6137458",
"0.6101099",
"0.6094812",
"0.60881406",
"0.5988933",
"0.5956525",
"0.59382725",
"0.5912368",
"0.58929366",
"0.58926547",
"0.5890905",
"0.587798... | 0.6906566 | 0 |
Scans edges list and calculates degree for each vertex, also saving indexes of related edges for each vertex | def get_degrees_dictionary(edges):
dd = {} # degrees dictionary for vertexes
def append_vertex(vertex, edge_index):
if vertex not in dd.keys():
dd[vertex] = [1, edge_index]
else:
dd[vertex][0] += 1
dd[vertex].append(edge_index)
e = edges
for i in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_degree_centrality(self, vertices, edges):\n # here we are calculating our own deg cen res on the fly\n # edge counts will store the number of edges associated with\n # each vertex\n edge_counts = {}\n\n # get the edge frame in pandas form and iterate\n edge_... | [
"0.66839856",
"0.62963444",
"0.6290213",
"0.6239078",
"0.60592306",
"0.5999901",
"0.5971899",
"0.5934545",
"0.5895978",
"0.58021456",
"0.5762711",
"0.5754184",
"0.57531744",
"0.57054716",
"0.56767124",
"0.5667014",
"0.56646866",
"0.56646866",
"0.5633163",
"0.5631301",
"0.5627... | 0.6403898 | 1 |
scans edges data from user input | def scan_edges(edges_count):
edges = []
for _ in range(edges_count):
edge = input("Enter edge:").split(" ")
try:
edge[2] = int(edge[2])
except ValueError:
raise ValueError("Input data parsing error, "
"the format should be like \"s s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input(E):\n # ---------- INSERT CODE BELOW ----------\n edge_list = []\n\n for _ in range(E):\n src, dst, cost = input('').rstrip('\\r\\n').split()\n edge_list.append((int(src),int(dst),int(cost)))\n \n return edge_list\n # ---------- INSERT CODE ABOVE ----------",
"def ite... | [
"0.62639165",
"0.61379546",
"0.59890026",
"0.5863461",
"0.5795918",
"0.57196283",
"0.5619727",
"0.5607484",
"0.55164105",
"0.55157465",
"0.54790145",
"0.5441284",
"0.5408243",
"0.53987914",
"0.5396176",
"0.5338467",
"0.5337781",
"0.53025645",
"0.53013176",
"0.53010654",
"0.52... | 0.69968826 | 0 |
prints output in format of edge input | def print_output(edges):
for edge in edges:
print("{} {} {}".format(edge[0], edge[1], int(edge[2]))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self):\n\t\t# Sort graph nodes by id\n\t\tnodes = list(self.nodes.values())\n\t\tnodes.sort(key=lambda n:n.id)\n\n\t\tfor n in nodes:\n\t\t\t# Get all edges\n\t\t\tedges = []\n\t\t\tfor edge in n.neighbours:\n\t\t\t\tfor neighbour in n.get_neighbours(edge):\n\t\t\t\t\tedges.append((neighbour.id, edge))\... | [
"0.755939",
"0.7550991",
"0.68970513",
"0.68945307",
"0.6707391",
"0.6607396",
"0.65338475",
"0.650519",
"0.6493433",
"0.6471962",
"0.64449626",
"0.6379392",
"0.63720196",
"0.63169086",
"0.6315759",
"0.62729573",
"0.6227196",
"0.6221678",
"0.61985976",
"0.6175523",
"0.6173355... | 0.8158672 | 0 |
A loading strategy for running large imports as multiple smaller ones. The main functionality of this loader is to split two order iterators in smaller lists while keeping the ordering and their combined length around ``chunk_hint`` size. >>> from importtools import chunked_loader >>> loader = chunked_loader([10, 20, 3... | def chunked_loader(ordered_iter1, ordered_iter2, chunk_hint=16384):
i1 = _iter_const(ordered_iter1, True)
i2 = _iter_const(ordered_iter2, False)
iterator = heapq.merge(i1, i2)
while True:
i1_elemens = list()
i2_elemens = list()
current_chunk = itertools.islice(iterator, chunk_hin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunked_mem_sync(source_loader, destination_loader,\n DSFactory=RecordingDataSet, hint=16384):\n l = chunked_loader(source_loader, destination_loader, hint)\n for source, destination in l:\n dest_ds = DSFactory(destination)\n dest_ds.sync(source)\n yield dest_ds",... | [
"0.6354266",
"0.61556524",
"0.60194796",
"0.59803045",
"0.59595215",
"0.5909632",
"0.5840156",
"0.58236504",
"0.57858485",
"0.57338417",
"0.5732517",
"0.57212216",
"0.5676315",
"0.56753504",
"0.5671433",
"0.565042",
"0.56440836",
"0.56298584",
"0.5615986",
"0.5610143",
"0.559... | 0.7530391 | 0 |
Add takes 1 argument an 'int' or 'float', the number to add to 'total' | def add(self, num) -> [int, float]:
if Calculater.check_int_or_float(num):
self.total += num
else:
self.check_type(input_type=type(num)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, *args):\n sum = 0\n for arg in args:\n sum += float(arg)\n return sum",
"def add(*args):\n body = ['<h1>Addition Calculator</h1>']\n _sum = sum(map(int, args))\n body.append(f'Total equals: {_sum}')\n return '\\n'.join(body)",
"def add(*args):\n #con... | [
"0.7935701",
"0.74250954",
"0.739781",
"0.7102527",
"0.7092447",
"0.7013905",
"0.69816494",
"0.6873964",
"0.6804099",
"0.6773353",
"0.67576015",
"0.6706462",
"0.66936225",
"0.6674202",
"0.66623414",
"0.6653001",
"0.6609995",
"0.6609812",
"0.6603702",
"0.6588289",
"0.6569988",... | 0.78199905 | 1 |
get disparity that is calculated by (cur_price / est_price ) 100 | def get_disparity(code, k, w=1):
est_price, shares, value, net_worth, roe, excess_earning = estimate_price(code, k, w)
cur_price = reader.get_current_price(code)
try:
disparity = (cur_price / est_price) * 100
except:
disparity = None
return disparity, cur_price, est_price, shares, v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_diff_rel_d(self): \n try:\n return(self.price_diff_d / self.price_open)\n except:\n return",
"def get_risk_per_unit(price, sl_price):\n return abs(price - sl_price)",
"def ret_vol_ratio(self) -> float:\n return self.geo_ret / self.vol",
"def getF... | [
"0.6276128",
"0.6193277",
"0.61364526",
"0.6128976",
"0.61272293",
"0.60530365",
"0.59040016",
"0.58949846",
"0.5863152",
"0.58590317",
"0.58321106",
"0.5761174",
"0.5748162",
"0.56991106",
"0.5658361",
"0.5656721",
"0.5639175",
"0.5624067",
"0.5613983",
"0.55807894",
"0.5562... | 0.7322828 | 0 |
Spawns the given number of workers, by default daemon, and returns a list of them. 'interval' determines the time delay between each launching | def spawnWorkers(num, target, name=None, args=(), kwargs={}, daemon=1, interval=0):
from threading import Thread
threads = []
for i in range(num):
t = Thread(target=target, name=name, args=args, kwargs=kwargs)
t.setDaemon(daemon)
t.start()
threads.append(t)
time.sleep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __launch_worker__start_vms(cls, worker_obj, num_vms_to_start=0):\n inst_to_deploy = []\n if num_vms_to_start > 0:\n # Start a new instances\n print \"Starting {0} new workers\".format(num_vms_to_start)\n inst_to_deploy = worker_obj.start_instance(num=num_vms_to_st... | [
"0.5961028",
"0.59262305",
"0.589819",
"0.58462024",
"0.5842554",
"0.5837701",
"0.5811775",
"0.5801807",
"0.574919",
"0.56564355",
"0.56557107",
"0.5641795",
"0.5583108",
"0.5534931",
"0.54899144",
"0.54853344",
"0.5479785",
"0.5467822",
"0.5460599",
"0.54557663",
"0.54528475... | 0.7500879 | 0 |
Converts a sequence of elements to a string in a standard, filesystemsafe way | def seq2str(seq):
return ','.join(map(cleanstr, seq)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string",
"def get_itr_str(iterable) -> str:\n\treturn str([str(i) for i in iterable])",
"def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_strin... | [
"0.7136884",
"0.6967668",
"0.68453056",
"0.684023",
"0.68400466",
"0.68400466",
"0.6574962",
"0.64408785",
"0.64219457",
"0.6413968",
"0.63567305",
"0.63358706",
"0.6314232",
"0.63002855",
"0.62802845",
"0.6277351",
"0.6253571",
"0.6253571",
"0.6253571",
"0.62460905",
"0.6244... | 0.7047315 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.