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 |
|---|---|---|---|---|---|---|
Plots a snake plot of each of the interested columns | def snake_plot(frame, interested_columns, title, legend, xlabel, ylabel):
melt_frame = pd.melt(frame,
id_vars=['cluster'],
value_vars=interested_columns,
var_name='Attribute',
value_name='Value')
sns.lineplot(x=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_data(DataFrame, title, ps, pe, columns: list):\n\n ax = plt.gca()\n idx = 0\n colors = ['blue', 'red', 'green', 'black']\n plot_titles = title.split('/')\n plot_title = plot_titles[1]\n\n for c in columns:\n DataFrame[ps:pe].plot(kind='line',y=c, color=colors[idx], ax=ax, font... | [
"0.58958626",
"0.58589727",
"0.58240443",
"0.5753686",
"0.5698444",
"0.56954896",
"0.56772983",
"0.56410605",
"0.5608602",
"0.55871904",
"0.55770636",
"0.5547814",
"0.5544125",
"0.5542654",
"0.5542255",
"0.5526182",
"0.5520085",
"0.5514221",
"0.5509322",
"0.5476117",
"0.54674... | 0.76266176 | 0 |
Plots the silhouette scores of the frame for each of the specified clusters. | def plot_silhouette_scores(frame, range_n_clusters, diversity_matrix, merges):
for n_clusters in range_n_clusters:
# Create a subplot with 1 row and 2 columns
fig, ax1 = plt.subplots(1, 1)
fig.set_size_inches(18, 7)
# The 1st subplot is the silhouette plot
# The silhouette c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_silhouette(sample_silhouette_values, n_clusters, labels, silhouette_avg):\n fig, ax = plt.subplots()\n\n y_lower = 10\n for i in range(n_clusters):\n # Aggregate the silhouette scores for samples belonging to\n # cluster i, and sort them\n ith_cluster_silhouette_values = \\\n... | [
"0.8037675",
"0.7823171",
"0.73707336",
"0.7062678",
"0.69883806",
"0.6941358",
"0.6689383",
"0.63975275",
"0.6334107",
"0.62856597",
"0.62112147",
"0.6175734",
"0.6061005",
"0.6044159",
"0.60095775",
"0.5978901",
"0.59724396",
"0.5941249",
"0.589615",
"0.5894953",
"0.5864557... | 0.8468193 | 0 |
Perform a chisquared goodness of fit test over two sample of dimension1 and dimension2 respectively. | def chi_test_goodness_of_fit(dimension1, dimension2):
total_len = (dimension1 + dimension2) / 2
X = (dimension1 - total_len) ** 2 / total_len + (dimension2 - total_len) ** 2 / total_len
return 1 - chi2.cdf(X, df=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_chi2(y0, y1, level):\n if len(y0) == 0 or len(y1) == 0:\n return True\n l0 = np.argmax(y0, axis=1)\n l1 = np.argmax(y1, axis=1)\n v, c = np.unique(np.append(l0,l1), return_counts=True)\n v0, c0 = np.unique(l0, return_counts=True)\n v1, c1 = np.unique(l1, return_counts=True)\n p... | [
"0.64753354",
"0.60610265",
"0.6016278",
"0.5913464",
"0.5901474",
"0.57436407",
"0.57388335",
"0.568389",
"0.56123126",
"0.55914026",
"0.55861884",
"0.558014",
"0.5577315",
"0.55454296",
"0.5542086",
"0.5520435",
"0.54633105",
"0.54578066",
"0.5428883",
"0.54274",
"0.5395537... | 0.78899103 | 0 |
Calculate sleep times used in rebind. | def determine_sleep_times(self):
determined_sleep_time = \
random.randrange(self.dns_conf.min_backoff_range,
self.dns_conf.max_backoff_range)
backoff = [(2 ** i) * determined_sleep_time for i in
range(0, self.dns_conf.retries)]
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _probe_wait_time(self):\n r = self.probe_cycle_time / float(len(self.servers)) #self.probe_cycle_time=5\n r = max(.25, r) # Cap it at four per second\n return r",
"def offset_sleep(self, sleep_time):\n ran_time = time.perf_counter() - self._lap\n while sleep_time ... | [
"0.60285157",
"0.6009046",
"0.58081615",
"0.5806744",
"0.5776757",
"0.5759307",
"0.57145727",
"0.57145727",
"0.57145727",
"0.57042134",
"0.5688411",
"0.56477773",
"0.56366765",
"0.55911964",
"0.5567266",
"0.5508835",
"0.5488248",
"0.5479877",
"0.54617745",
"0.54141647",
"0.54... | 0.6273055 | 0 |
Return Provider details for given project and service ids. | def _get_provider_details(self, project_id, service_id):
try:
provider_details = self.storage_controller.get_provider_details(
project_id,
service_id)
except Exception:
raise LookupError(u'Service {0} does not exist'.format(
service... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_providers(self):\n return self.keys",
"def get_providers(self):\n return self.keys",
"def get_providers(self):\n return self.keys",
"def get_providers(self):\n return self.keys",
"def get_providers(self):\n return self.keys",
"def get_providers(self):\n r... | [
"0.567815",
"0.567815",
"0.567815",
"0.567815",
"0.567815",
"0.567815",
"0.5534151",
"0.5506235",
"0.5498377",
"0.54944086",
"0.5407276",
"0.5407276",
"0.54021585",
"0.53792185",
"0.53750056",
"0.5219493",
"0.5184015",
"0.51827127",
"0.5146317",
"0.5141752",
"0.5136631",
"0... | 0.71052694 | 0 |
Return service details for given domain name. | def get_service_by_domain_name(self, domain_name):
try:
service_details = self.storage_controller\
.get_service_details_by_domain_name(domain_name)
if service_details is None:
# as per latest change, get_service_details_by_domain_name
# wil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(domain_name=None):\n url = 'https://api.cloudns.net/dns/soa-details.json'\n\n params = Parameters({'domain-name': domain_name})\n\n return requests.get(url, params=params.to_dict())",
"def info(self):\n\n return self.call(method='getDomain', args=[self.domainname])",
"def get_service_in... | [
"0.6859723",
"0.6769073",
"0.67403907",
"0.65586346",
"0.6434467",
"0.6289694",
"0.62767226",
"0.62281585",
"0.6130483",
"0.61227214",
"0.6104589",
"0.6103292",
"0.6071906",
"0.60665345",
"0.6053853",
"0.6019364",
"0.6019364",
"0.5949385",
"0.59336716",
"0.59336716",
"0.59336... | 0.8118489 | 0 |
Return the services by status. | def get_services_by_status(self, status):
services_project_ids = \
self.storage_controller.get_services_by_status(status)
return services_project_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_status(status):\n return list(tasks.find({'status': status}))",
"def get_services(self):\r\n return get_service_list()",
"def list_services(ctx):\n pass",
"def traffic_statuscodes_services(self, **kwargs):\n url_path = 'traffic/statuscodes' + '/services'\n self.logger.de... | [
"0.7049646",
"0.6689513",
"0.6677364",
"0.6673207",
"0.6567198",
"0.65604615",
"0.65027153",
"0.6489611",
"0.64702153",
"0.64578134",
"0.64263135",
"0.64239645",
"0.64082414",
"0.6390707",
"0.6386031",
"0.6359116",
"0.63583326",
"0.62846625",
"0.6273547",
"0.62672573",
"0.625... | 0.7700673 | 0 |
Return domains by Provider url. | def get_domains_by_provider_url(self, provider_url):
domains = \
self.storage_controller.get_domains_by_provider_url(provider_url)
return domains | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_domains(self, resp):\n return",
"def list_domain_names():\n pass",
"def domains(cls):\n return [cls.domain]",
"def get_domain(url, tlds=tlds):\n\n url_elements = url.split('.')\n for i in range(-len(url_elements), 0):\n last_i_elements = url_elements[i:]\n\n candi... | [
"0.6430849",
"0.6277802",
"0.6249539",
"0.62413734",
"0.6151304",
"0.6043874",
"0.5975646",
"0.5955752",
"0.59473914",
"0.59411186",
"0.5921341",
"0.58428735",
"0.58101237",
"0.57892513",
"0.5766142",
"0.57303643",
"0.5706897",
"0.569777",
"0.5695994",
"0.5686844",
"0.5680109... | 0.829891 | 0 |
Add defaults to the service. If the service rules are None or Empty, add default rule. If the operation is 'create', add default ttl and cache. | def _append_defaults(self, service_json, operation='create'):
# default origin rule
for origin in service_json.get('origins', []):
if origin.get('rules') is None:
# add a rules section
origin['rules'] = []
if origin.get('rules') == []:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_default_ops(op_name):\n _add_default_op(op_name)\n _add_default_reverse_op(op_name)",
"def __init__(__self__, *,\n default_action: str,\n ip_rules: Optional[Sequence['outputs.IPRuleResponse']] = None,\n virtual_network_rules: Optional... | [
"0.5655553",
"0.515327",
"0.5140459",
"0.50912434",
"0.49852654",
"0.48414034",
"0.47737116",
"0.47653344",
"0.4733586",
"0.47129753",
"0.47046983",
"0.46832877",
"0.4680678",
"0.46356103",
"0.46295312",
"0.46178746",
"0.4593103",
"0.45821074",
"0.45806965",
"0.45522276",
"0.... | 0.7724897 | 0 |
Set limit for number of services for a given project. | def services_limit(self, project_id, limit):
self.storage_controller.set_service_limit(
project_id=project_id,
project_limit=limit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_services_limit(self, project_id):\n limit = self.storage_controller.get_service_limit(\n project_id=project_id)\n\n return {\n 'limit': limit\n }",
"def test_set_project_limits(self):\n pass",
"def limit_num_clients(self, limit_num_clients):\n\n ... | [
"0.6471788",
"0.64218056",
"0.6413854",
"0.6060075",
"0.60413957",
"0.59873587",
"0.596239",
"0.59554595",
"0.59497374",
"0.5947321",
"0.5947321",
"0.5947321",
"0.5882596",
"0.5846059",
"0.57915354",
"0.57868916",
"0.57765067",
"0.5770326",
"0.5769836",
"0.5739568",
"0.566119... | 0.8279682 | 0 |
Set provider details for a given service. | def set_service_provider_details(self, project_id, service_id,
auth_token, status):
old_service = self.storage_controller.get_service(
project_id,
service_id
)
if (
old_service.status == 'create_in_progress' and
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svc_provider(self, svc_provider):\n\n self._svc_provider = svc_provider",
"def provider(self, provider):\n\n self._provider = provider",
"def provider(self, provider: Provider) -> None:\n self._provider = provider",
"def service(self, service):\n \n self._service = serv... | [
"0.6977805",
"0.6805736",
"0.6665561",
"0.6196104",
"0.61873233",
"0.60626787",
"0.6057812",
"0.6042221",
"0.5880441",
"0.58626604",
"0.57989204",
"0.5765839",
"0.5726033",
"0.5714743",
"0.5682375",
"0.5682375",
"0.5633122",
"0.560682",
"0.5588587",
"0.5569293",
"0.55266166",... | 0.7028902 | 0 |
Get the currently set limit on services for a given project. | def get_services_limit(self, project_id):
limit = self.storage_controller.get_service_limit(
project_id=project_id)
return {
'limit': limit
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def services_limit(self, project_id, limit):\n self.storage_controller.set_service_limit(\n project_id=project_id,\n project_limit=limit)",
"def limit(self):\n if self._limit:\n return self._limit\n else: # no custom limit, go with the default\n r... | [
"0.69445556",
"0.6309081",
"0.6216308",
"0.60979694",
"0.60979694",
"0.6012911",
"0.5990903",
"0.5957679",
"0.5948644",
"0.58482075",
"0.5815061",
"0.5800849",
"0.57906145",
"0.57872075",
"0.5773124",
"0.5751639",
"0.56718725",
"0.56718725",
"0.56032366",
"0.5512052",
"0.5497... | 0.79729736 | 0 |
Perform an action on the service. List of actions include delete enable disable | def _action_per_service_obj(self, project_id, action, service_obj):
kwargs = {
'project_id': project_id,
'service_obj': json.dumps(service_obj.to_dict()),
'time_seconds': self.determine_sleep_times(),
'context_dict': context_utils.get_current().to_dict()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_action(self, action_id: int) -> None:\r\n ...",
"def perform_action(self, action_data):\n pass",
"def act(self, action):\n action_name = action.op\n args = action.args\n list_action = first(a for a in self.actions if a.name == action_name)\n if list_action ... | [
"0.7034492",
"0.6696946",
"0.66441625",
"0.64970267",
"0.64446104",
"0.6440804",
"0.6430157",
"0.64035803",
"0.63278395",
"0.63194764",
"0.6304759",
"0.62832385",
"0.62832385",
"0.626898",
"0.6202323",
"0.61996645",
"0.6197948",
"0.6197948",
"0.6155549",
"0.61273426",
"0.6090... | 0.68188334 | 1 |
perform action on services present in this domain. If domain is None, The action is performed on all the services for a project. Else, the action will be performed on those services present in the given domain. List of actions include delete enable disable | def services_action(self, project_id, action, domain=None):
# list all the services of for this project_id
# 10 per batch
if domain:
service_obj = self.get_service_by_domain_name(domain_name=domain)
self._action_per_service_obj(project_id=service_obj.project_id,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _action_per_service_obj(self, project_id, action, service_obj):\n\n kwargs = {\n 'project_id': project_id,\n 'service_obj': json.dumps(service_obj.to_dict()),\n 'time_seconds': self.determine_sleep_times(),\n 'context_dict': context_utils.get_current().to_dict... | [
"0.6046327",
"0.5385886",
"0.5032531",
"0.5005013",
"0.49541962",
"0.48829716",
"0.4859582",
"0.48533118",
"0.47662762",
"0.47570053",
"0.46811166",
"0.4667595",
"0.46635142",
"0.4658779",
"0.4647985",
"0.46342596",
"0.462998",
"0.46158728",
"0.45956248",
"0.45922107",
"0.458... | 0.7953384 | 0 |
Submit a task to delete a service. Before deletion, update each of the provider's status in service with 'delete_in_progress' | def delete_service(self, project_id, service_id):
service_obj = self.storage_controller.get_service(
project_id, service_id)
# get provider details for this service
provider_details = self._get_provider_details(project_id, service_id)
# change each provider detail's status ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteTask():\n\tmarkOff(isdelete = 1)",
"def delete(task_id, pfn):\n\n activated = PoolManager.db.query('UPDATE `standalone_deletion_tasks` SET `status` = \\'active\\' WHERE `id` = %s', task_id)\n if activated == 0:\n # task was cancelled\n return -1, None, None, '', '' \n\n ... | [
"0.69710827",
"0.64997005",
"0.6491998",
"0.6446538",
"0.63313043",
"0.63238674",
"0.6156784",
"0.6100283",
"0.6087065",
"0.6025164",
"0.5998475",
"0.5991577",
"0.5949423",
"0.5927035",
"0.58892",
"0.5847633",
"0.5831502",
"0.5829406",
"0.5825055",
"0.5800169",
"0.5739188",
... | 0.72996503 | 0 |
Purge the contents of a service. | def purge(self, project_id, service_id, hard=False, purge_url=None):
try:
service_obj = self.storage_controller.get_service(
project_id,
service_id
)
except ValueError as e:
# This except is hit when service object does not exist
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fastlypurgeservice(args):\n if (api.purge_service(service_id)):\n return\n std_error_message('ERROR: unable to purge')\n sys.exit(1)",
"def remove(self, service):\n os.remove(os.path.join(self.directory, service))",
"async def purge_service_handler(call: ServiceCallTy... | [
"0.741854",
"0.6813206",
"0.67435163",
"0.6589748",
"0.64740765",
"0.64023095",
"0.63810223",
"0.62743807",
"0.62388366",
"0.6212894",
"0.61731035",
"0.61199427",
"0.60783875",
"0.60350007",
"0.5960799",
"0.594509",
"0.59347975",
"0.58964086",
"0.5871504",
"0.5835116",
"0.579... | 0.6901178 | 1 |
Generate shared ssl domain. | def _generate_shared_ssl_domain(self, domain_name, store):
try:
if not hasattr(self, store):
gen_store = {
domain_name:
self.dns_controller.generate_shared_ssl_domain_suffix()
}
setattr(self, store, gen_store... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pick_shared_ssl_domain(self, domain, service_id, store):\n shared_ssl_domain = self._generate_shared_ssl_domain(\n domain,\n store)\n while self.storage_controller.domain_exists_elsewhere(\n shared_ssl_domain,\n service_id):\n shared... | [
"0.6602102",
"0.60436404",
"0.59672946",
"0.59199816",
"0.56846285",
"0.5672926",
"0.5590925",
"0.5545225",
"0.5491634",
"0.54699576",
"0.54422164",
"0.54416156",
"0.53732616",
"0.53383464",
"0.5326021",
"0.52998525",
"0.52980924",
"0.5276215",
"0.5264941",
"0.5263037",
"0.52... | 0.7403791 | 0 |
Select an available shared ssl domain. | def _pick_shared_ssl_domain(self, domain, service_id, store):
shared_ssl_domain = self._generate_shared_ssl_domain(
domain,
store)
while self.storage_controller.domain_exists_elsewhere(
shared_ssl_domain,
service_id):
shared_ssl_domain ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_shared_ssl_domain(self, domain_name, store):\n try:\n if not hasattr(self, store):\n gen_store = {\n domain_name:\n self.dns_controller.generate_shared_ssl_domain_suffix()\n }\n setattr(self, stor... | [
"0.5689062",
"0.56121516",
"0.55737084",
"0.5377569",
"0.5169096",
"0.5055096",
"0.50386524",
"0.5031396",
"0.496945",
"0.4960824",
"0.49167025",
"0.48684436",
"0.48575142",
"0.4856687",
"0.4841558",
"0.47577953",
"0.47523022",
"0.4727151",
"0.47231057",
"0.4716028",
"0.47054... | 0.7051767 | 0 |
Migrate domain. Domain migration includes Set cert_status to all the provider's domain_certification Update the all the certificates with cert_status Update the access_url of all the providers with new_cert As of now, below are the supported statuses. create_in_progress deployed failed cancelled | def migrate_domain(self, project_id, service_id, domain_name, new_cert,
cert_status='deployed'):
dns_controller = self.dns_controller
storage_controller = self.storage_controller
try:
# Update CNAME records and provider_details in cassandra
provide... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migration():",
"def migrate(ctx):\n connecter = ScalingoInterface(ctx.obj)\n connecter.manage_py(\"migrate\")",
"def migrate(ctx, start_version, end_version):\n if ctx.obj['TYPE'] == 'file':\n if ctx.obj['DATA_FILE']:\n file_path = ctx.obj['DATA_FILE']\n else:\n ... | [
"0.52947104",
"0.52850825",
"0.5215103",
"0.51772064",
"0.5111653",
"0.5102113",
"0.50005865",
"0.49916673",
"0.49495527",
"0.49211556",
"0.48535863",
"0.4836588",
"0.47983626",
"0.47739193",
"0.47713152",
"0.4753917",
"0.47522193",
"0.47479156",
"0.47305268",
"0.4714046",
"0... | 0.6895208 | 0 |
Determine whether upgrade is required from http to https. | def _detect_upgrade_http_to_https(self, old_domains, new_domain):
is_upgrade = False
for old_domain in old_domains:
if old_domain.domain == new_domain.domain:
if (
old_domain.protocol == 'http' and
new_domain.protocol == 'https'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_https(tls_ver):\n output = True\n\n # check python version\n if sys.version_info < (3, 6): #modify from 3, 7 to 3, 6\n _LOGGER.error(\"PyISY cannot use HTTPS: Invalid Python version. See docs.\")\n output = False\n\n # check that Python was compiled again... | [
"0.7013589",
"0.6877719",
"0.6835044",
"0.67509013",
"0.6749535",
"0.6745643",
"0.6733843",
"0.66749674",
"0.66121554",
"0.656048",
"0.6548066",
"0.65262836",
"0.65262836",
"0.65262836",
"0.64995104",
"0.6481197",
"0.64492905",
"0.6409013",
"0.639509",
"0.6392362",
"0.6365283... | 0.7846189 | 0 |
Update access url of a service. This is typically called from admin APIs only. | def update_access_url_service(
self, project_id, service_id, access_url_changes):
try:
service_old = self.storage_controller.get_service(
project_id,
service_id
)
except ValueError as e:
# If service is not found
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_endpoint(self, url: str):\n if not is_empty(url):\n self._url = url",
"def access_token_url(self, access_token_url):\n\n self._access_token_url = access_token_url",
"async def admin_server_url(self, ctx: commands.Context, *url: str):\n the_url = await self.config.server_u... | [
"0.6140987",
"0.58911353",
"0.5705447",
"0.55841684",
"0.5539611",
"0.55391365",
"0.5522294",
"0.54902446",
"0.5471639",
"0.5446068",
"0.5445985",
"0.54131925",
"0.5402898",
"0.53829634",
"0.5381009",
"0.5369225",
"0.535183",
"0.5334624",
"0.5331476",
"0.5327684",
"0.5291088"... | 0.70854115 | 0 |
Returns a list of all compounds and their members which match details | def find_compounds_and_members(self, details):
results = []
for compound in self.compound:
members = compound.find_members(details)
if members:
results.append([compound, members])
else:
if details.match(compound):
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_members(self, details):\n\n results = []\n\n for member in self.member:\n if details.match(member):\n results.append(member)\n\n return results",
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def get_compounds(... | [
"0.67593724",
"0.61379445",
"0.61379445",
"0.61379445",
"0.61379445",
"0.60055417",
"0.59725624",
"0.5907787",
"0.58341086",
"0.58221567",
"0.5796687",
"0.57167304",
"0.5674226",
"0.56659615",
"0.5557334",
"0.5501994",
"0.5473911",
"0.54394156",
"0.543635",
"0.5420882",
"0.53... | 0.837103 | 0 |
Returns a list of all members which match details | def find_members(self, details):
results = []
for member in self.member:
if details.match(member):
results.append(member)
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def members(self):\n return self.find_users_by_rel('member')",
"def house_members(*, verbose=False):\n ro = _get(URL_MEMBERS(115, \"senate\"), verbose=verbose)\n return [[m.get(k, \"NULL\") for k in (\"id\", ... | [
"0.7444193",
"0.7444193",
"0.7444193",
"0.7444193",
"0.72677976",
"0.7156162",
"0.70991063",
"0.69769543",
"0.68319833",
"0.68266237",
"0.6796303",
"0.67863345",
"0.6736924",
"0.66945404",
"0.6620382",
"0.6596303",
"0.6576785",
"0.65737575",
"0.6569523",
"0.6569285",
"0.65369... | 0.89413244 | 0 |
Set up the Circadian Lighting switches. | def setup_platform(hass, config, add_devices, discovery_info=None):
cl = hass.data.get(DATA_CIRCADIAN_LIGHTING)
if cl:
cs = CircadianSwitch(
hass,
cl,
name=config.get(CONF_NAME),
lights_ct=config.get(CONF_LIGHTS_CT, []),
lights_rgb=config.get(C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n hass,\n cl,\n name,\n lights_ct,\n lights_rgb,\n lights_xy,\n lights_brightness,\n disable_brightness_adjust,\n min_brightness,\n max_brightness,\n sleep_entity,\n sleep_state,\n sleep_colortem... | [
"0.6863107",
"0.6488386",
"0.6380548",
"0.62340754",
"0.62009704",
"0.61620224",
"0.6117625",
"0.61055994",
"0.6045269",
"0.6008986",
"0.6007743",
"0.5955323",
"0.5918207",
"0.5847845",
"0.58214337",
"0.5813663",
"0.58018595",
"0.57929444",
"0.57890886",
"0.5779171",
"0.57704... | 0.6819392 | 1 |
Initialize the Circadian Lighting switch. | def __init__(
self,
hass,
cl,
name,
lights_ct,
lights_rgb,
lights_xy,
lights_brightness,
disable_brightness_adjust,
min_brightness,
max_brightness,
sleep_entity,
sleep_state,
sleep_colortemp,
sleep_br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n\t\tpcd8544.LCD.initialize(self)\n\t\tRPIO.setup(self._backlight_pin, RPIO.OUT, initial=RPIO.LOW)",
"def initialize_lights(self):\n\t\tfor light in OUTPUT.LIGHTS:\n\t\t\tif light != -1:\n\t\t\t\tio.set_bit(light, 0)\n\t\tfor order in self.orderQueue.yield_orders(exclude=(None,)):\n\t\t\tse... | [
"0.68807083",
"0.66731375",
"0.6484032",
"0.6390828",
"0.63852453",
"0.6382471",
"0.6371761",
"0.63004184",
"0.62277156",
"0.62126756",
"0.62051046",
"0.6088817",
"0.6054241",
"0.6041844",
"0.60356313",
"0.60107315",
"0.5950152",
"0.59031045",
"0.58684736",
"0.58111435",
"0.5... | 0.70276856 | 0 |
Poll the ZMQ socket and handle any requests | def _poll(self):
return self.zmq_core.poll(10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _recv(self) -> None:\n if not self.connected or now() < self.next_poll:\n return\n self.next_poll += self.poll_interval\n data = []\n while True:\n try:\n data.append(self.endpoint.recv(BUFFSIZE))\n except BlockingIOError:\n ... | [
"0.69055873",
"0.68843067",
"0.6857073",
"0.6712601",
"0.66626436",
"0.6556246",
"0.65089446",
"0.6492233",
"0.6479491",
"0.6428314",
"0.6357783",
"0.6345307",
"0.6330564",
"0.6303835",
"0.62860656",
"0.6283613",
"0.6279859",
"0.6260314",
"0.6258035",
"0.62578166",
"0.6243584... | 0.70718515 | 0 |
Check the status of all subthreads. Return None if all is good, otherwise the return value | def _check_threads(self):
waiting_threads = []
for tname, tobj in self.threads.items():
if tobj.is_alive():
if self.end_threads:
waiting_threads.append(tname)
elif not self.end_threads:
self.log.critical('Thread %s has died.', t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_threads_of_subclass(self):\n\n running = True\n\n while running:\n status_list = []\n for subset in self.subset_list:\n if subset.get_thread_status():\n status_list.append(True)\n else:\n status_lis... | [
"0.70975834",
"0.64291215",
"0.5923517",
"0.5861932",
"0.57117945",
"0.5707103",
"0.5703028",
"0.5700605",
"0.5673994",
"0.5650553",
"0.56394386",
"0.56365746",
"0.56301475",
"0.56055987",
"0.5570941",
"0.55586267",
"0.5548579",
"0.55378234",
"0.5533326",
"0.5479861",
"0.5476... | 0.7206934 | 0 |
Create and check for PID file | def create_pidfile(self):
pidfile = config['rnmsd_pid_file']
piddir = os.path.dirname(pidfile)
if not os.path.isdir(piddir):
self.log.error(
'Exiting, pidfile directory %s doesn\'t exist',
piddir)
sys.exit(1)
return
try:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pid_file(app_config, app_logger):\n pid = str(os.getpid())\n pidfile = get_config_item(app_config, 'app_pid_file')\n\n if os.path.isfile(pidfile):\n print(\"{} already exists, exiting\".format(pidfile))\n app_logger.info(\"STARTUP: PID file exists... exiting...\")\n return ... | [
"0.78267324",
"0.70434827",
"0.69837373",
"0.68481535",
"0.6831097",
"0.67738515",
"0.67058194",
"0.65120584",
"0.6469379",
"0.64558667",
"0.6425764",
"0.6398386",
"0.63672733",
"0.6287355",
"0.6235005",
"0.62338674",
"0.60846907",
"0.60708743",
"0.605776",
"0.6025453",
"0.59... | 0.74817705 | 1 |
Check whether the session identified by access_token is still active. | def is_session_active(connection, access_token):
path_info = '/sessions/{}/'.format(access_token)
try:
connection.send_head_request(path_info)
except NotFoundError:
is_active = False
else:
is_active = True
return is_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available(self):\n return self.access_token is not None",
"def checkLogin():\n if 'access_token' in login_session:\n return True\n else:\n return False",
"async def check_access_token(self, token):\n async with self._session.get(\n 'https://eu.battle.net/oau... | [
"0.72026837",
"0.69360524",
"0.68848956",
"0.6842804",
"0.6803483",
"0.6796278",
"0.66986454",
"0.6642437",
"0.66177076",
"0.6599793",
"0.6491223",
"0.6456557",
"0.6398118",
"0.6388368",
"0.6310803",
"0.6307009",
"0.6285741",
"0.6277886",
"0.62337244",
"0.6228262",
"0.6187215... | 0.7563582 | 0 |
select the fundamental features, the orders of same customer and vendor are handled. | def select_features(self):
customer_vendor_ratings = self.customer_vendor_full[
['customer_id', 'vendor_id', 'order_rating']]
customer_vendor_ratings = customer_vendor_ratings.groupby(['customer_id', 'vendor_id']) \
.mean().reset_index() # 69814 remained
customer_ve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(self, features):\n if 'Weather Type' not in features:\n features.append('Weather Type')\n self.data = self.data[:,[self._getFIdx(f) for f in features]]\n self.featureNames = self.featureNames[[self._getFIdx(f) for f in features]]\n return 0",
"def select_features... | [
"0.62038004",
"0.61837196",
"0.5901089",
"0.5885419",
"0.58853894",
"0.5817987",
"0.58072037",
"0.57907003",
"0.5771395",
"0.5670049",
"0.5666989",
"0.5625063",
"0.56106484",
"0.5605341",
"0.55673826",
"0.5555261",
"0.55033815",
"0.5491215",
"0.5461791",
"0.54598844",
"0.5397... | 0.64063615 | 0 |
calculate the mean rating of each vendors, which could be used as the knowledge base to recommend vendors for new customers | def get_vendors_mean(self):
matrix = self.customer_vendor_matrix.mean(axis=0).to_frame()
vendor_ids = matrix.index.values
vendor_ratings = matrix.values
vendor2rating = {}
indices = min(vendor_ids.shape[0], vendor_ratings.shape[0])
for i in range(0, indices):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_global_mean(self, ratings):\n total_ratings = []\n for user, movie, rating in ratings:\n total_ratings.append(rating)\n return sum(total_ratings) / len(total_ratings)",
"def average_rating(self):\n reviews = self.gamereview_set.all()\n\n try:\n ret... | [
"0.6353005",
"0.6340688",
"0.6336318",
"0.61197704",
"0.60765153",
"0.6037497",
"0.6021065",
"0.60001135",
"0.59619015",
"0.5957588",
"0.59256816",
"0.5886889",
"0.58500624",
"0.58463585",
"0.5845758",
"0.583951",
"0.583692",
"0.58353823",
"0.5835221",
"0.5823128",
"0.5811456... | 0.75592566 | 0 |
Ensure that EC2Instances are attached to the IAM Roles that they can assume due to their IAM instance profiles | def test_ec2_iaminstanceprofiles(mock_get_instances, neo4j_session):
# Arrange
boto3_session = MagicMock()
create_test_account(neo4j_session, TEST_ACCOUNT_ID, TEST_UPDATE_TAG)
data_iam = tests.data.aws.iam.INSTACE['Roles']
sync_ec2_instances(
neo4j_session,
boto3_session,
[TE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_instance_role_created(environment):\n # TODO actually implement this\n return IAM.Role(environment + '-conglomerate')",
"def test_instance_profile_exists(self) -> None:\n self.assertTrue(self.validate_instance_profile('s3-access-role', is_prod=self.prod_env))",
"def validate_instance_pr... | [
"0.6565851",
"0.6298186",
"0.6172132",
"0.6014849",
"0.5964671",
"0.58234483",
"0.5803747",
"0.5713959",
"0.56750005",
"0.5503741",
"0.54769564",
"0.54711753",
"0.5456973",
"0.53569406",
"0.53181815",
"0.5287462",
"0.5283519",
"0.51924163",
"0.51860017",
"0.5181208",
"0.51497... | 0.71473306 | 0 |
return the number of lines in a text file | def number_of_lines(filename=""):
with open(filename, encoding="utf-8") as file:
text = file.readlines()
return len(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_lines(filename=\"\"):\n num_lines = 0\n with open(filename, encoding=\"utf-8\") as myFile:\n return myFile.read().count('\\n')",
"def number_of_lines(filename=\"\"):\n n_lines = 0\n with open(filename, encoding='utf-8', mode='r') as file:\n for lines in file:\n ... | [
"0.8665073",
"0.85607177",
"0.85592586",
"0.8487091",
"0.8482783",
"0.8437015",
"0.8436582",
"0.8417676",
"0.8408271",
"0.83975255",
"0.83901024",
"0.83690625",
"0.834709",
"0.8245488",
"0.80862397",
"0.8038329",
"0.8023487",
"0.8022584",
"0.7962599",
"0.7935981",
"0.7935245"... | 0.8820164 | 0 |
Send the current flight state to the transciever, and thus the rocket. | def sendflightState(self, sendState): # noqa
self.ser.write(b's%i' % sendState.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_states(self):\n\n teleop_enabled_msg = Bool()\n teleop_enabled_msg.data = self.teleop_enabled\n\n assisted_driving_enabled_msg = Bool()\n assisted_driving_enabled_msg.data = self.assisted_driving_enabled\n\n self.teleop_enabled_pub.publish(teleop_enabled_msg)\n se... | [
"0.60907817",
"0.5984566",
"0.58695805",
"0.57425344",
"0.57217777",
"0.56834185",
"0.5640775",
"0.56102484",
"0.559434",
"0.5582875",
"0.5568263",
"0.55058724",
"0.5497179",
"0.5497179",
"0.54881114",
"0.5457845",
"0.5457278",
"0.5428949",
"0.5414893",
"0.5407283",
"0.538774... | 0.6847784 | 0 |
Test case for tiers_tier_level_tier_name_delete Delete a Tier | def test_tiers_tier_level_tier_name_delete(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete(self, tier_uuid):\n\n tier = objects.storage_tier.get_by_uuid(pecan.request.context, tier_uuid)\n\n # Semantic checks\n _check(self, \"delete\", tier.as_dict())\n\n # update the crushmap by removing the tier\n try:\n self._ceph.crushmap_tier_delete(tier.name)\n except exception... | [
"0.67815244",
"0.6706333",
"0.65708774",
"0.6436579",
"0.6382647",
"0.62957644",
"0.61977655",
"0.6169465",
"0.61388546",
"0.6132979",
"0.6104202",
"0.6102361",
"0.6094278",
"0.5993867",
"0.596568",
"0.59202605",
"0.5866869",
"0.58500504",
"0.5847219",
"0.584652",
"0.58423996... | 0.87974644 | 0 |
Test case for tiers_tier_level_tier_name_get Get details of a tier | def test_tiers_tier_level_tier_name_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tiers_tier_level_tier_name_put(self):\n pass",
"def tier(self) -> str:\n return pulumi.get(self, \"tier\")",
"def tier(self) -> str:\n return pulumi.get(self, \"tier\")",
"def tier(self) -> str:\n return pulumi.get(self, \"tier\")",
"def tier(self) -> Optional[str]:\n ... | [
"0.7159931",
"0.6799089",
"0.6799089",
"0.6799089",
"0.67774236",
"0.67774236",
"0.67774236",
"0.67774236",
"0.66728526",
"0.66688925",
"0.6558044",
"0.6537654",
"0.63975346",
"0.6367671",
"0.62408906",
"0.612786",
"0.6116579",
"0.60461444",
"0.60234326",
"0.6012326",
"0.5912... | 0.9035238 | 0 |
Test case for tiers_tier_level_tier_name_put Update a Tier | def test_tiers_tier_level_tier_name_put(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tiers_tier_level_tier_name_delete(self):\n pass",
"def test_tiers_tier_level_tier_name_get(self):\n pass",
"def tier(self, tier):\n\n self._tier = tier",
"async def addTier(self, ctx, tier):\n server_dict = self.get_server_dict(ctx)\n tierList = server_dict.setdefa... | [
"0.6466295",
"0.61677974",
"0.5902317",
"0.5811052",
"0.58044934",
"0.56242704",
"0.560508",
"0.55993885",
"0.55920327",
"0.5578496",
"0.5533905",
"0.5501091",
"0.5464273",
"0.5441399",
"0.5413747",
"0.5362622",
"0.53545535",
"0.5347455",
"0.5334378",
"0.53276813",
"0.5302480... | 0.85818404 | 0 |
Test case for tiers_update_permission_post Update tier permission | def test_tiers_update_permission_post(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_update_permissions(self):\n userPK = User.objects.get(username='c2e1').pk\n url = reverse('User-detail', kwargs={'pk': userPK})\n data = {'username': 'company1NewTest'}\n response = self.client.put(url, data, format='json')\n #This is 404 instead of 403 because ther... | [
"0.6371461",
"0.6144",
"0.6117372",
"0.61148316",
"0.6056639",
"0.6036503",
"0.60155016",
"0.60033387",
"0.5982016",
"0.59428376",
"0.5935314",
"0.5926942",
"0.59155416",
"0.59114814",
"0.59091777",
"0.5903923",
"0.5900709",
"0.5874981",
"0.5828853",
"0.5782035",
"0.57819986"... | 0.8746304 | 0 |
Returns the flow crossing vertex | def getFlowAcrossVertex(self, vertex):
return sum(self.getFlow((vertex, toVertex)) for toVertex in self.adjacent[vertex]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartVertex(self):",
"def cross_z(self):\n return Vector((self.v.y, -self.v.x))",
"def getCrossWithExtraEdgeInBetweenGraph(self):\n graph = self.graph\n makeLayer = self.makeLayer\n eastWestEdgeFromTo = self.eastWestEdgeFromTo\n addNodesToLayer = self.addNodesToLayer\n... | [
"0.6133787",
"0.58074725",
"0.5795851",
"0.57816106",
"0.5777972",
"0.5765601",
"0.57546103",
"0.57392836",
"0.5733873",
"0.56958085",
"0.56896365",
"0.5687451",
"0.5661065",
"0.566005",
"0.563813",
"0.5636889",
"0.563444",
"0.5628244",
"0.55948323",
"0.55920935",
"0.55738664... | 0.59718496 | 1 |
Returns edge's residual capacity. | def getResidualCapacity(self, edge):
return self.getCapacity(edge) - self.getFlow(edge) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_residual(n, key, edges):\n\n if n['direction'] == 'F':\n e = [e for e in edges if e['first'] == key and e['last'] == n['id']][0]\n r = e['capacity'] - e['flow'] \n \n if n['direction'] == 'B':\n e = [e for e in edges if e['last'] == key and e['first'] == n['id']][0]\n ... | [
"0.63806295",
"0.6283103",
"0.625208",
"0.6233415",
"0.6207016",
"0.61327523",
"0.6126988",
"0.6123496",
"0.60875595",
"0.60215575",
"0.5967845",
"0.5937776",
"0.59225434",
"0.58994806",
"0.58757985",
"0.58425635",
"0.583627",
"0.58085674",
"0.5769376",
"0.57658845",
"0.57630... | 0.86101377 | 0 |
Sets edge's flow to value. | def setFlow(self, edge, value):
self.flow[edge] = value
self.flow[edge[::-1]] = - value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increaseFlow(self, edge, value):\r\n self.flow[edge] += value\r\n self.flow[edge[::-1]] -= value",
"def flow(self, flow):\n\n self._flow = flow",
"def update_flow(self, flow):\r\n self.flow = flow",
"def set_cur_flow(self, flow):\n self.cur_flow = flow",
"def set_flow... | [
"0.7616722",
"0.6973972",
"0.68580323",
"0.6408602",
"0.61558783",
"0.5977393",
"0.5609222",
"0.5607507",
"0.5512434",
"0.54854566",
"0.5483543",
"0.54786694",
"0.5415533",
"0.5415083",
"0.5385193",
"0.53820366",
"0.5363754",
"0.5352125",
"0.5349089",
"0.5339413",
"0.5323319"... | 0.8860267 | 0 |
Increases edge's flow value units. | def increaseFlow(self, edge, value):
self.flow[edge] += value
self.flow[edge[::-1]] -= value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFlow(self, edge, value):\r\n self.flow[edge] = value\r\n self.flow[edge[::-1]] = - value",
"def verticalScaleIncrease(self):\n scaleFac = float(self.qline4.text())\n self.qline4.setText(str(scaleFac * 2))\n self.model.refreshScreen()",
"def calculate_flow(self):\r\n ... | [
"0.6228963",
"0.5691512",
"0.55355525",
"0.5511678",
"0.54958206",
"0.54285634",
"0.5410586",
"0.5335164",
"0.533416",
"0.5316682",
"0.5300461",
"0.52784884",
"0.52711165",
"0.5259239",
"0.52536094",
"0.5252405",
"0.5250219",
"0.5229206",
"0.52281463",
"0.5214871",
"0.5185873... | 0.7383177 | 0 |
Returns the vertices adjacent to u in the network. | def neighbors(self, u):
return filter(lambda v: self.getCapacity((u,v)) > 0, self.adjacent[u]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\r\n return self.adjacent.keys()",
"def neighbours((u,v)):\r\n return ((u,v+1), (u+1,v), (u,v-1), (u-1,v))",
"def adjacent((u,v)):\r\n return ((u,v+1), (u+1,v), (u,v-1), (u-1,v))",
"def edgesFromVertex(u):\r\n edgeRepresentation = lambda v: f\"({u}, {v}, {self.getCa... | [
"0.6803862",
"0.6780063",
"0.67606676",
"0.6732391",
"0.661207",
"0.6545687",
"0.6477077",
"0.62765",
"0.6252161",
"0.6216077",
"0.61558986",
"0.6136389",
"0.61298835",
"0.6127779",
"0.61036056",
"0.6093554",
"0.5998052",
"0.597525",
"0.5967301",
"0.5945805",
"0.59347796",
... | 0.71668124 | 0 |
Loads a flow network from a file containing a list of edges | def loadNetworkFromFile(self, file):
for line in open(file, 'r'):
fromVertex, toVertex, capacity = map(int, line.split())
self.addEdge(fromVertex, toVertex, capacity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_graph(filename):\n return nx.read_edgelist(filename, create_using=nx.DiGraph(), nodetype=str)",
"def load_graph(input_file=None, input_list=None):\n G = nx.Graph()\n if input_file:\n with open(input_file, 'r') as file:\n for line in file.readlines():\n line = li... | [
"0.73569643",
"0.7217747",
"0.70087665",
"0.69992256",
"0.6897869",
"0.6894151",
"0.6851246",
"0.6777775",
"0.6776262",
"0.6776262",
"0.6763551",
"0.67537546",
"0.6719503",
"0.6697877",
"0.66808724",
"0.6660775",
"0.6645007",
"0.663379",
"0.6618979",
"0.6615639",
"0.659514",
... | 0.7971356 | 0 |
Verifies the validity of an edge. | def isValidEdge(self, fromVertex, toVertex, capacity):
return fromVertex != toVertex \
and capacity > 0 \
and (toVertex, fromVertex) not in self.capacity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\r\n if self.eid is None:\r\n if self._inV is None:\r\n raise ValidationError('in vertex must be set before saving new edges')\r\n if self._outV is None:\r\n raise ValidationError('out vertex must be set before saving new edges')\r\n ... | [
"0.6676864",
"0.64963645",
"0.6346049",
"0.6190434",
"0.6149481",
"0.6142393",
"0.6099385",
"0.60896003",
"0.6063515",
"0.60516906",
"0.60447335",
"0.6030835",
"0.5974186",
"0.58861196",
"0.58814746",
"0.58596796",
"0.58498436",
"0.58173174",
"0.57973045",
"0.57961833",
"0.57... | 0.6530676 | 1 |
Represents edges incident to the given vertex. | def edgesFromVertex(u):
edgeRepresentation = lambda v: f"({u}, {v}, {self.capacity[(u, v)]})"
return ", ".join(map(edgeRepresentation, self.residualNeighbors(u))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_edges(self, vertex):\n return self[vertex].values()",
"def edgesFromVertex(u):\r\n edgeRepresentation = lambda v: f\"({u}, {v}, {self.getCapacity((u, v))}, {self.getFlow((u,v))})\"\r\n return \", \".join(map(edgeRepresentation, sorted(self.adjacent[u])))",
"def getAdjacentV... | [
"0.66660047",
"0.64987445",
"0.6228471",
"0.61703193",
"0.60383624",
"0.6024463",
"0.59824324",
"0.5927077",
"0.59147644",
"0.5896644",
"0.5895152",
"0.5879631",
"0.5876344",
"0.5865338",
"0.5863654",
"0.57891226",
"0.5740063",
"0.56684095",
"0.56630445",
"0.565284",
"0.56414... | 0.65142435 | 1 |
Get the command to change the RPATH of executables and dynamic libraries. Returns None if there is no such command or if it cannot be found. | def get_command_to_set_search_path():
# Check if already computed
if _COMMAND_TO_SEARCH_PATH:
return _COMMAND_TO_SEARCH_PATH[0]
# Get name of the utility
# In Pyzo it should be present in 'shared'.
utilCommand = None
if sys.platform.startswith('win'):
return
if sys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_command_path(command):\n def excutable(command_path):\n return os.path.isfile(command_path) and os.access(command_path, os.X_OK)\n\n for path in os.environ[\"PATH\"].split(os.pathsep):\n command_path = os.path.join(path, command)\n if excutable(command_path):\n return ... | [
"0.6255126",
"0.6138694",
"0.60418767",
"0.5968339",
"0.58044875",
"0.5675814",
"0.561852",
"0.5603006",
"0.5590942",
"0.5584856",
"0.5537524",
"0.5531008",
"0.547949",
"0.54761356",
"0.54701483",
"0.5468862",
"0.54510987",
"0.5449228",
"0.5445026",
"0.5430739",
"0.54279894",... | 0.740347 | 0 |
set_search_path(fname, args) For the given library/executable, set the search path to the relative paths specified in args. | def set_search_path(fname, *args):
# Prepare
args = [arg.lstrip('/') for arg in args if arg]
args = [arg for arg in args if arg != '.'] # Because we add empty dir anyway
args.append('') # make libs search next to themselves
command = get_command_to_set_search_path()
if sys.platform.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPath(*args):",
"def setLibrarySearchPath(cls, searchPath):\n cls._sharedLibrarySearchPath = searchPath",
"def SetToolPaths(toolpaths):\n global tool_search_paths\n\n tool_search_paths = toolpaths",
"def add_search_path(*path_tokens):\n full_path = os.path.join(*path_tokens)\n if ful... | [
"0.64020216",
"0.63845533",
"0.6305493",
"0.61671513",
"0.57596266",
"0.5749473",
"0.5731139",
"0.56485677",
"0.5574055",
"0.5572449",
"0.55463296",
"0.54238147",
"0.53576607",
"0.5243006",
"0.5231702",
"0.5188231",
"0.5179701",
"0.5143609",
"0.5125657",
"0.5119846",
"0.50629... | 0.8102745 | 0 |
mac_add_rpath(fname, rpath) Set the rpath for a Mac library or executble. If the rpath is already registered, it is ignored. | def mac_add_rpath(fname, rpath):
cmd = ['install_name_tool', '-add_rpath', rpath, fname]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while p.poll() is None:
time.sleep(0.01)
if p.returncode:
msg = p.stdout.read().decode('utf-8')
if 'would duplicate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_search_path(fname, *args):\n \n # Prepare\n args = [arg.lstrip('/') for arg in args if arg]\n args = [arg for arg in args if arg != '.'] # Because we add empty dir anyway\n args.append('') # make libs search next to themselves\n command = get_command_to_set_search_path()\n \n if s... | [
"0.61044854",
"0.55935186",
"0.5154276",
"0.50972795",
"0.5093967",
"0.5069164",
"0.5011133",
"0.49950626",
"0.49950626",
"0.48626006",
"0.48574904",
"0.4849434",
"0.48439705",
"0.483935",
"0.48366848",
"0.47979206",
"0.4756526",
"0.47333944",
"0.47318786",
"0.4720459",
"0.46... | 0.8328899 | 0 |
remove_CRT_dependencies(path, recurse=True) Check all .dll and .pyd files in the given directory (and its subdirectories if recurse is True), removing the dependency on the Windows C runtime from the embedded manifest. | def remove_CRT_dependencies(dirname, recurse=True):
dllExt = ['.dll', '.pyd']
for entry in os.listdir(dirname):
p = os.path.join(dirname, entry)
if recurse and os.path.isdir(p):
remove_CRT_dependencies(p, recurse)
elif os.path.isfile(p) and os.path.splitext(p)[1].lower() in d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_CRT_dependency(filename):\n if 'QtCore' in filename:\n 1/0\n \n # Read the whole file\n with open(filename, 'rb') as f:\n try:\n bb = f.read() \n except IOError: \n #raise IOError('Could not read %s'%filename)\n print... | [
"0.67132187",
"0.6338965",
"0.58292806",
"0.58292806",
"0.57720107",
"0.56638527",
"0.56332237",
"0.54942554",
"0.53578675",
"0.52612513",
"0.52479726",
"0.5208126",
"0.5110863",
"0.5066882",
"0.5057223",
"0.5053179",
"0.503866",
"0.50053036",
"0.49623176",
"0.49534804",
"0.4... | 0.8671634 | 0 |
remove_CRT_dependency(filename) Modify the embedded manifest of a Windows dll (or pyd file), such that it no longer depends on the Windows C runtime. In effect, the dll will fall back to using the C runtime that the executable depends on (and has loaded in memory). This function is not necessary for dll's and pyd's tha... | def remove_CRT_dependency(filename):
if 'QtCore' in filename:
1/0
# Read the whole file
with open(filename, 'rb') as f:
try:
bb = f.read()
except IOError:
#raise IOError('Could not read %s'%filename)
print('Warning: coul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_CRT_dependencies(dirname, recurse=True):\n dllExt = ['.dll', '.pyd']\n for entry in os.listdir(dirname):\n p = os.path.join(dirname, entry)\n if recurse and os.path.isdir(p):\n remove_CRT_dependencies(p, recurse)\n elif os.path.isfile(p) and os.path.splitext(p)[1].l... | [
"0.73687106",
"0.5205088",
"0.49888223",
"0.4902427",
"0.48205435",
"0.46612123",
"0.46361238",
"0.46100083",
"0.45949885",
"0.45814943",
"0.45651954",
"0.45251635",
"0.44925237",
"0.4485878",
"0.44825184",
"0.44366407",
"0.44326705",
"0.4416141",
"0.44160512",
"0.43943736",
... | 0.77922666 | 0 |
Authenticate user based on the email and hash generated from the client side. return true if database hash matches the generated hash from client. | def authenticate_hash(self, email=None, generatedHash=None):
# need to get user object
user = self.get_user(email=email)
if user is not None:
dbHash = self.get_password_element(email,'hash')
if generatedHash == dbHash:
# reset the login attempts if success... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate(cls, email, password):\n\n user = cls.query.filter_by(email=email).first()\n\n if user:\n is_auth = bcrypt.check_password_hash(user.password, password)\n if is_auth:\n return user\n\n return False",
"def authenticate(cls, email, password)... | [
"0.75592697",
"0.75124884",
"0.74760115",
"0.7254617",
"0.71893054",
"0.709824",
"0.70686954",
"0.7023922",
"0.6955437",
"0.6943794",
"0.690132",
"0.6899407",
"0.68666786",
"0.6864233",
"0.6826092",
"0.6813151",
"0.68127894",
"0.6771867",
"0.6760738",
"0.671063",
"0.6705644",... | 0.8412809 | 0 |
return a salt from the database based on email. Otherwise send a random hash and keep it for that username (for security reasons). | def get_user_salt(self, email):
salt = self.get_password_element(email,'salt')
# if salt returns empty then we must insert one to table
pe = PasswordEngine()
if salt == '':
salt = pe.create_salt(email)
return salt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_salt(self):\n if not self.id and not self._salt:\n self._salt = b64encode(os.urandom(8))\n\n if isinstance(self._salt, str):\n self._salt = self._salt.encode('UTF-8')\n\n return self._salt",
"def get_salt():\n return os.urandom(32)",
"def test_user_hash_with_salt(self):\n ... | [
"0.66929895",
"0.66100025",
"0.641736",
"0.6234982",
"0.6233121",
"0.6197048",
"0.61675066",
"0.6157871",
"0.61479104",
"0.6111039",
"0.6084866",
"0.60674596",
"0.60665494",
"0.6007614",
"0.5907286",
"0.58952284",
"0.5883466",
"0.5859627",
"0.5855202",
"0.5855202",
"0.5840246... | 0.8192353 | 0 |
checks if user can be allowed to log in returns true if active, false otherwise. | def confirm_login_allowed(self, user):
# if the user has been disabled due to incorrect
# password retries or other.
if not user.is_active:
return False;
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_login(self):\n return all([self.user.is_active, self.status, self.status_detail == \"active\"])",
"def is_logged_in(self, params):\n email = self.credentials.get('email', '')\n password = self.credentials.get('password', '')\n if email != '' and password != '':\n r... | [
"0.74850535",
"0.7263313",
"0.7250036",
"0.7241304",
"0.71848375",
"0.7163512",
"0.71529865",
"0.7129357",
"0.7122476",
"0.7118163",
"0.7076311",
"0.7059655",
"0.6992689",
"0.69454676",
"0.69398195",
"0.69063956",
"0.6884993",
"0.6878017",
"0.6828764",
"0.6779906",
"0.6768289... | 0.7590802 | 0 |
Gets the element('salt', 'hash') value based on the user's email returns the desired password's element value | def get_password_element(self, email, element) :
# variable to store the element's value
elementValue = ''
try:
user = RegisterUser.objects.get(email=email)
# lets check if user exists
if user is not None:
# django password pbkdf2 object struct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_salt(self, email):\n \n salt = self.get_password_element(email,'salt')\n # if salt returns empty then we must insert one to table\n pe = PasswordEngine()\n if salt == '':\n salt = pe.create_salt(email)\n return salt",
"def log_in_password(self):\n... | [
"0.6748485",
"0.65840894",
"0.64012045",
"0.6298085",
"0.6280135",
"0.60772556",
"0.60008395",
"0.5907641",
"0.58502907",
"0.5847571",
"0.58360124",
"0.58275574",
"0.5815977",
"0.5814779",
"0.5806858",
"0.5804686",
"0.57629085",
"0.5762354",
"0.5756022",
"0.57338196",
"0.5729... | 0.8664907 | 0 |
Does the given protocol conform to what Psycopg2 expects? | def __conform__(self, proto):
from psycopg2.extensions import ISQLQuote
if proto == ISQLQuote:
return self
else:
raise Exception(
"Error implementing psycopg2 protocol. Is psycopg2 installed?"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provides_protocol(type_, protocol):\n return issubclass(type_, protocol)",
"def _valid_protocol_type(protocol):\n\n if protocol == 'ssh' or protocol == 'https':\n return True\n\n return False",
"def supports_protocol(self, obj, protocol):\n\n return self.adapt(obj, protocol, None... | [
"0.55910546",
"0.5571708",
"0.5516932",
"0.5514837",
"0.54838055",
"0.547964",
"0.53685224",
"0.5359681",
"0.5345889",
"0.5165212",
"0.5046097",
"0.5041398",
"0.5022679",
"0.50189215",
"0.5017243",
"0.50120264",
"0.49885988",
"0.49649566",
"0.49493903",
"0.49305743",
"0.49295... | 0.71407974 | 0 |
Return a properly quoted string for use in PostgreSQL/PostGIS. | def getquoted(self):
if self.is_geometry:
# Psycopg will figure out whether to use E'\\000' or '\000'.
return b"%s(%s)" % (
b"ST_GeogFromWKB" if self.geography else b"ST_GeomFromEWKB",
sql.quote(self.ewkb).encode(),
)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote(value):\n return DoubleQuotedScalarString(value)",
"def mysql_quote(x):\n if not x:\n return \"NULL\"\n x = x.replace(\"\\\\\", \"\\\\\\\\\")\n x = x.replace(\"'\", \"''\")\n x = x.replace(\"\\n\", \"\\\\n\")\n return \"'{}'\".format(x)",
"def wrap_with_in_single_quote(s):\n ... | [
"0.66940063",
"0.6535666",
"0.64561844",
"0.64561844",
"0.64361304",
"0.63675547",
"0.6357881",
"0.6355792",
"0.6295191",
"0.62618315",
"0.6259162",
"0.62564594",
"0.62517357",
"0.6249715",
"0.6229994",
"0.6216584",
"0.61803275",
"0.61727995",
"0.6152074",
"0.6148209",
"0.614... | 0.7788644 | 0 |
Generates metagene plots. The xaxis is the relative nucleotide positions and the start /stop site is at the center (origin at 0). The yaxis is the raw or normalized coverage. At most 7 experiments can be provided for a single plot. For a given start or stop site, the coverage around the site of interest is plotted. The... | def metagene(ribo,
site,
out,
experiments,
title,
normalize,
lowerlength,
upperlength,
dump ):
return plot_metagene_wrapper(
ribo_file = ribo,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def E_vs_length(Emax, Emin, wmax=90, wmin=10, Lmax=1000, Lmin=102.4, p=75,\r\n fmax=5.7e9, p1=database['K+'], p2=database['pi+'],\r\n p3=database['p+'], delta_p=1.6e-2, nE=10, nw=10, nL=10, ng=50,\r\n nl=50, nf=20, L_resolution=0.01, w_resolution=0.01, plot=True,\r\n ... | [
"0.57209456",
"0.5638557",
"0.5569487",
"0.5564008",
"0.55281615",
"0.55258775",
"0.5522993",
"0.55133784",
"0.5510649",
"0.5501769",
"0.548391",
"0.5467619",
"0.54589623",
"0.54538274",
"0.5452719",
"0.5452321",
"0.5447687",
"0.5402292",
"0.53882784",
"0.5380957",
"0.5376788... | 0.73170066 | 0 |
Root to the html form of the add of a new beer | def NBF():
return render_template('new_beer_form.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n return render_template('add.html')",
"def add_bus():\n\n return render_template('bus-add-form.html')",
"def newbeer():\n if request.method == 'POST':\n # Recuperation of the data in the form\n # Récupération des informations depuis le formulaire\n user = reque... | [
"0.65689516",
"0.6152604",
"0.6027424",
"0.59465873",
"0.5936869",
"0.58807456",
"0.58599013",
"0.5812042",
"0.57999456",
"0.5734156",
"0.57341427",
"0.5722854",
"0.571864",
"0.5698649",
"0.5692506",
"0.5683524",
"0.5674586",
"0.56531405",
"0.5648339",
"0.5622599",
"0.559298"... | 0.6390691 | 1 |
Root to the html form of the add of a new bar | def NBAF():
return render_template('new_bar_form.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success_new_bar(name):\n return 'Nom ddu bar %s' % name + ' a bien ete ajoute'",
"def create_status_bar(self):\n self.status_text = QLabel(\"XSpec\")\n self.statusBar().addWidget(self.status_text, 1)",
"def addRawDataNode():\n return render_template(\"addRawDataNode.html\")",
"def sub... | [
"0.6328226",
"0.5899648",
"0.5835303",
"0.5831696",
"0.57518154",
"0.57339233",
"0.5729714",
"0.5669461",
"0.5656452",
"0.56243116",
"0.561138",
"0.5593637",
"0.5553223",
"0.55235523",
"0.54833716",
"0.545912",
"0.54487044",
"0.5421879",
"0.54186684",
"0.53617907",
"0.5359320... | 0.6635245 | 0 |
Root to add a new beer, use POST to add | def newbeer():
if request.method == 'POST':
# Recuperation of the data in the form
# Récupération des informations depuis le formulaire
user = request.form['newb']
tipe = request.form['type']
tast = request.form['tast']
flavour = request.form['flav']
alcool = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n parent_key = ndb.Key(Boat, \"parent_boat\")\n boat_data = json.loads(self.request.body)\n new_boat = Boat(id=None, name=boat_data['name'], type=boat_data['type'],\n length=boat_data['length'], at_sea=True, parent=parent_key)\n new_boat.put()\n ... | [
"0.6550911",
"0.6312388",
"0.61873627",
"0.61139274",
"0.610773",
"0.60227907",
"0.59595567",
"0.59549576",
"0.59205467",
"0.5912747",
"0.59028554",
"0.58966565",
"0.58903795",
"0.5878631",
"0.5817448",
"0.5816571",
"0.5782538",
"0.57743555",
"0.5772395",
"0.5761205",
"0.5711... | 0.6795132 | 0 |
Root to the html form of the add of a new brass | def NBRF():
return render_template('new_brass_form.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n return render_template('add.html')",
"def success_new_brass(name):\n return 'Nom de brasserie %s' % name + ' a bien ete ajoute'",
"def addCollectionNode():\n return render_template(\"addCollectionNode.html\")",
"def newbrass():\n if request.method == 'POST':\n # Recupe... | [
"0.59706724",
"0.59088194",
"0.5818063",
"0.5815881",
"0.5781018",
"0.57334006",
"0.5710688",
"0.5670536",
"0.56507707",
"0.56151325",
"0.55328876",
"0.55289054",
"0.55181086",
"0.55113006",
"0.5498142",
"0.54971117",
"0.54963464",
"0.54863006",
"0.5458793",
"0.5454002",
"0.5... | 0.64626473 | 0 |
Get all jobs for the project. `ProjectPermissionsMixin.get_object` checks that the request user has the required project permission and will raise `PermissionDenied` if not. | def get_queryset(self):
project = ProjectPermissionsMixin.get_object(self)
object_list = project.jobs.all()
object_list = self._get_status({}, object_list)
object_list = self._get_method({}, object_list)
object_list = self._get_users({}, project, object_list)
return obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n # TODO: auth\n return list(self.app.db.jobs.find())",
"def get(self):\n opts = PROJECTS_OPTS_PARSER.parse_args()\n filters = PROJECT_FILTERS_PARSER.parse_args()\n filters = clean_attrs(filters)\n\n query = Project.query\n\n if not current_user.is_... | [
"0.68691915",
"0.6589207",
"0.656691",
"0.6522385",
"0.6489487",
"0.6445526",
"0.64393765",
"0.63388616",
"0.632887",
"0.631223",
"0.6281403",
"0.62613845",
"0.6249164",
"0.62082106",
"0.61591274",
"0.614297",
"0.6116712",
"0.6106522",
"0.6099878",
"0.6098878",
"0.60673636",
... | 0.7378433 | 0 |
Extract the status from the request. If a valid context is passed, then we also return the list of all available options. If an object_list is provided, filter the results if the request variable is valid. | def _get_status(self, context, object_list=None):
status = self.request.GET.get("status", "").upper()
if object_list is not None:
return self._get_object_list(
object_list, status != "" and JobStatus.is_member(status), status=status
)
options = list(map(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_status(obj):\n return get_object_parameter(obj, 'status')",
"def available_statuses(self):\n return self.pipeline.get(self.status, ())",
"def available_statuses(self):\n return self.pipeline.get(self.status, ())",
"def obj_get_list(self, request=None, **kwargs):\n filte... | [
"0.53152364",
"0.52971894",
"0.52971894",
"0.5286153",
"0.51883984",
"0.5130976",
"0.5038396",
"0.49965563",
"0.4993336",
"0.498464",
"0.49524662",
"0.49169832",
"0.48328838",
"0.48249683",
"0.4702378",
"0.46927157",
"0.46670496",
"0.46463567",
"0.46446133",
"0.4621663",
"0.4... | 0.7375783 | 0 |
Extract the method from the request. If a valid context is passed, then we also return the list of all available options. If an object_list is provided, filter the results if the request variable is valid. | def _get_method(self, context, object_list=None):
method = self.request.GET.get("trigger", "").lower()
if object_list is not None:
return self._get_object_list(
object_list, method != "" and JobMethod.is_member(method), method=method
)
options = list(map... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _method_check(self, request, allowed=None):\n if allowed is None:\n allowed = []\n\n request_method = request.method.lower()\n allows = ','.join(map(str.upper, allowed))\n\n if request_method == \"options\":\n response = HttpResponse(allows)\n respon... | [
"0.548802",
"0.5398395",
"0.53673834",
"0.53559345",
"0.53458333",
"0.5311024",
"0.5275371",
"0.52751344",
"0.5249971",
"0.51782876",
"0.5155439",
"0.50941813",
"0.5090527",
"0.5004736",
"0.50026494",
"0.4995633",
"0.49739784",
"0.49499235",
"0.49317288",
"0.4898297",
"0.4878... | 0.6721649 | 0 |
Get a filtered object_list if the condition is valid. | def _get_object_list(self, object_list, condition, **kwargs):
if object_list is not None:
return object_list.filter(**kwargs) if condition else object_list
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter(self, filter_condition):\n def _inner_filter(item: list):\n return self._default_filter(item, filter_condition)\n\n self._result = list(filter(_inner_filter, self._data))",
"def _get_objects(self, object_query):\n object_name = object_query[\"object_name\"]\n expression... | [
"0.6204527",
"0.60719746",
"0.6006793",
"0.5950194",
"0.5901517",
"0.5789731",
"0.5742828",
"0.56732994",
"0.56541747",
"0.5645953",
"0.5636937",
"0.5617427",
"0.5569945",
"0.5568897",
"0.55584174",
"0.5548867",
"0.55426335",
"0.55312145",
"0.5528259",
"0.54797894",
"0.547312... | 0.75605255 | 0 |
Find the minimum norm solution as combination of two points This is correct only in 2D ie. min_c |\sum c_i x_i|_2^2 st. \sum c_i = 1 , 1 >= c_1 >= 0 for all i, c_i + c_j = 1.0 for some i, j | def _min_norm_2d(dps):
dmin = 1e8
for i in range(dps.size()[0]): # task loop
for j in range(i+1,dps.size()[0]):
# if (i,j) not in dps:
# dps[(i, j)] = 0.0
# for k in range(len(vecs[i])):
# dps[(i,j)] += torch.dot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_norm_element_FW(vecs):\n # Solution lying at the combination of two points\n dps = {}\n init_sol, dps = MinNormSolver._min_norm_2d(vecs, dps)\n\n n=len(vecs)\n sol_vec = np.zeros(n)\n sol_vec[init_sol[0][0]] = init_sol[1]\n sol_vec[init_sol[0][1]] = 1 -... | [
"0.6852478",
"0.67641306",
"0.6420474",
"0.6328402",
"0.60157067",
"0.5997282",
"0.59627706",
"0.594836",
"0.59307766",
"0.59295034",
"0.5910023",
"0.5898663",
"0.579951",
"0.57855904",
"0.57585",
"0.575038",
"0.57333255",
"0.57270384",
"0.5710863",
"0.5694614",
"0.5686929",
... | 0.71316063 | 0 |
Given a list of vectors (vecs), this method finds the minimum norm element in the convex hull as min |u|_2 st. u = \sum c_i vecs[i] and \sum c_i = 1. It is quite geometric, and the main idea is the fact that if d_{ij} = min |u|_2 st u = c x_i + (1c) x_j; the solution lies in (0, d_{i,j}) Hence, we find the best 2task s... | def find_min_norm_element(vecs):
# Solution lying at the combination of two points
vecs_clone = []
for i in range(len(vecs)):
# assert len(vecs[i]) == 1
vecs_task = []
for k in range(len(vecs[i])):
vecs_task.append(vecs[i][k].view(-1))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_norm_element_FW(vecs):\n # Solution lying at the combination of two points\n dps = {}\n init_sol, dps = MinNormSolver._min_norm_2d(vecs, dps)\n\n n=len(vecs)\n sol_vec = np.zeros(n)\n sol_vec[init_sol[0][0]] = init_sol[1]\n sol_vec[init_sol[0][1]] = 1 -... | [
"0.7845345",
"0.740307",
"0.5896718",
"0.5852501",
"0.5789607",
"0.5678633",
"0.5563747",
"0.5526394",
"0.5509864",
"0.5495292",
"0.5482861",
"0.5448869",
"0.5439474",
"0.543252",
"0.5419022",
"0.53660023",
"0.5356996",
"0.53411865",
"0.53368443",
"0.5324925",
"0.5301364",
... | 0.7515014 | 1 |
Given a list of vectors (vecs), this method finds the minimum norm element in the convex hull as min |u|_2 st. u = \sum c_i vecs[i] and \sum c_i = 1. It is quite geometric, and the main idea is the fact that if d_{ij} = min |u|_2 st u = c x_i + (1c) x_j; the solution lies in (0, d_{i,j}) Hence, we find the best 2task s... | def find_min_norm_element_FW(vecs):
# Solution lying at the combination of two points
dps = {}
init_sol, dps = MinNormSolver._min_norm_2d(vecs, dps)
n=len(vecs)
sol_vec = np.zeros(n)
sol_vec[init_sol[0][0]] = init_sol[1]
sol_vec[init_sol[0][1]] = 1 - init_sol[1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_norm_element(vecs):\n # Solution lying at the combination of two points\n\n\n vecs_clone = []\n for i in range(len(vecs)):\n # assert len(vecs[i]) == 1\n vecs_task = []\n for k in range(len(vecs[i])):\n vecs_task.append(vecs[i][k].vie... | [
"0.73330045",
"0.7255511",
"0.6087293",
"0.592769",
"0.58198243",
"0.5741734",
"0.5688759",
"0.5682437",
"0.5635772",
"0.5614468",
"0.5586824",
"0.55859196",
"0.55328155",
"0.5530995",
"0.5529109",
"0.54409605",
"0.54140544",
"0.5371464",
"0.5371464",
"0.5371137",
"0.53483",
... | 0.791391 | 0 |
Compute the softmax gradient. | def softmax_gradient(softmax_result):
s = softmax_result.reshape(-1, 1)
return np.diagflat(s) - np.dot(s, s.T) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax_grad(self, X):\n s = X.reshape(-1,1)\n return np.diagflat(X)-np.dot(s,np.traspose(s))",
"def softmax_loss_vectorized(W, X, y, reg):\n\n #############################################################################\n # TODO: Compute the softmax.ipynb loss and its gradient using no ... | [
"0.78992367",
"0.7522225",
"0.7465205",
"0.73112655",
"0.7280887",
"0.72573936",
"0.7247204",
"0.72449166",
"0.72261804",
"0.71742153",
"0.71674335",
"0.71323025",
"0.7108319",
"0.70951736",
"0.7091125",
"0.70845246",
"0.7076378",
"0.70714897",
"0.7064694",
"0.7033263",
"0.70... | 0.84031147 | 0 |
Creates all the memory/data settings to run GPU accelerated KMeans. | def KMeansConfig(dataTable, k, eps = 0.00001, srcDims=100000000000,gpuMemSize = 512, settings = {}):
settings = dataConfig(dataTable,settings)
settings["sourceDims"] = min(settings["sourceDims"],srcDims)
#XXX: determine memory and thread sizes from device
settings["memSize"] = gpuMemSize*1024*1024
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_initializer():\n os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'\n import tensorflow as tf\n physical_devices = tf.config.experimental.list_physical_devices('GPU')\n if len(physical_devices) > 0:\n os.environ['CUDA_VISIBLE_DEVICES'] = '0'\n tf.config.experimental.set_memory_growth(ph... | [
"0.6134373",
"0.6072545",
"0.5965323",
"0.5843835",
"0.5794437",
"0.57741374",
"0.566442",
"0.55324566",
"0.5529135",
"0.5518156",
"0.5513717",
"0.5470229",
"0.5415823",
"0.53994125",
"0.53809905",
"0.5373161",
"0.53620535",
"0.5344233",
"0.53428006",
"0.5328344",
"0.5313129"... | 0.68053925 | 0 |
Verify that `expected_output` will be generated by `parse_args`. | def assert_output(self, parser_args, expected_output):
c = count_nginx_log_frequency(
parser_args.file,
parser_args.segment,
NGINX_ACCESS_LOG_REGEX
)
saved_stdout = sys.stdout
try:
out = StringIO()
sys.stdout = out
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_input_matches_expected_output(in_, out):\n ...",
"def Checktest(self, expectedoutput):\n\n if expectedoutput == 0:\n result = self.runner.invoke(yoda.cli, [\"setup\", \"check\"])\n self.assertEqual(result.exit_code, 0)\n self.assertIn(\"The configuration file ... | [
"0.70679086",
"0.6941145",
"0.686125",
"0.6844002",
"0.67257416",
"0.6716536",
"0.66547",
"0.6605551",
"0.6565752",
"0.65413404",
"0.6490594",
"0.6413985",
"0.63952696",
"0.6379116",
"0.6369094",
"0.6332762",
"0.6323952",
"0.63228565",
"0.62874997",
"0.62874997",
"0.62815195"... | 0.71121615 | 0 |
Export the output of the model in CSV format Calling this before solve() raises an exception. | def export(self, f, delimiter=","):
if self.sol is None:
raise Exception("Missing call to solve()")
np.savetxt(f, self.sol, header=",".join(self.__class__.CSV_ROW), delimiter=",") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model_csv(self):\n\n self.model_df.to_csv(self.model_output_file)",
"def to_csv(self, path):\n results = self.all()\n if self.stop_check is not None and self.stop_check():\n return\n results.to_csv(path)",
"def to_csv(self):\n if not self._fitted:\n ... | [
"0.69496757",
"0.6699756",
"0.6542161",
"0.6471497",
"0.6463173",
"0.64180166",
"0.64090765",
"0.63848656",
"0.6354497",
"0.6347289",
"0.63354594",
"0.6322575",
"0.6303393",
"0.6293159",
"0.62914145",
"0.6289343",
"0.6263222",
"0.6209261",
"0.619797",
"0.6166573",
"0.61408406... | 0.68338674 | 1 |
Split a polynomial f in two polynomials. | def split(f):
n = len(f)
f0 = [f[2 * i + 0] for i in range(n // 2)]
f1 = [f[2 * i + 1] for i in range(n // 2)]
return [f0, f1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faceSplit(self, f, v1, v2):\n if self.containsEdge(v1, v2):\n raise ValueError('There is already an edge between'\n 'the vertices given.'\n 'Is your polyhedron really one ?')\n try:\n i1 = f.vertices.index(v1)\n ... | [
"0.6266938",
"0.55817914",
"0.55153847",
"0.5511008",
"0.5489136",
"0.5471892",
"0.54399157",
"0.54242575",
"0.54033285",
"0.53847605",
"0.5338852",
"0.53152174",
"0.52988446",
"0.5269004",
"0.5252662",
"0.5233323",
"0.5219564",
"0.5200834",
"0.51936954",
"0.5164589",
"0.5160... | 0.68901557 | 0 |
Repeat one or more times a regex pattern. | def repeat(pattern, capture=True):
return (r"(" if capture else r"(?:") + pattern + r")+" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repeat_pattern(pattern, width):\n assert width % pattern.width == 0\n return operation.repeat(pattern, width // pattern.width)",
"def repeat(word, repetitions):\n return word * repetitions",
"def repeat_string_n_times(string, count):\r\n return string * int(count)",
"def compile_regex(x,... | [
"0.7057113",
"0.6823221",
"0.6635748",
"0.6630393",
"0.6554486",
"0.65291905",
"0.64637315",
"0.6460605",
"0.64430726",
"0.6424126",
"0.6424126",
"0.62654805",
"0.613634",
"0.61253893",
"0.6115911",
"0.606681",
"0.6047808",
"0.60394895",
"0.6018747",
"0.6000592",
"0.58714306"... | 0.7656598 | 0 |
Get an element of an enum based on its index. | def getItem(enum, index):
return enum[list(enum.__members__)[index]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key):\n try:\n if utils.is_str(key):\n key = utils.force_name_case(key)\n return next(enum for enum in self if enum.name == key)\n else:\n return self._enums[key]\n except (StopIteration, TypeError, KeyError, Ind... | [
"0.7338907",
"0.68426746",
"0.6676853",
"0.65888476",
"0.6412255",
"0.6412255",
"0.64061856",
"0.63535595",
"0.63179505",
"0.63174105",
"0.63059276",
"0.63045925",
"0.63044786",
"0.63043123",
"0.62875384",
"0.6265312",
"0.6255619",
"0.6238629",
"0.62368363",
"0.61992544",
"0.... | 0.8137312 | 0 |
Transform nested lists of dicts into a singlelevel list of dict. Each element of the returned list is a dict containing the keyvalues of all the dict traversed in the nesting. For example, the input | def flatten(parsed):
parsedList = [parsed] if isinstance(parsed, dict) else parsed
result = []
for dico in parsedList:
#Sort keys between actual values and nested dicts
listKeys = []
standardKeys = []
for key in dico:
if isi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_dictionaries(input):\n output = dict()\n if isinstance(input, list):\n for map in input:\n if not isinstance(map, dict):\n raise Exception('Tried to flatten a list of NON-dictionaries into a single dictionary. Whoops!')\n for key in map.keys(): #Add key... | [
"0.76482874",
"0.70647556",
"0.68496233",
"0.6748174",
"0.67097384",
"0.6643058",
"0.653708",
"0.6326997",
"0.63099176",
"0.62939554",
"0.62681895",
"0.6261919",
"0.623813",
"0.62281686",
"0.6199451",
"0.61871254",
"0.6135649",
"0.6087126",
"0.6084057",
"0.60724264",
"0.60704... | 0.7303608 | 1 |
Initialise a text pattern encapsulating a Pattern object. | def __init__(self, pattern):
self.pattern = pattern | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pattern):\n self._pattern = re.compile(pattern)",
"def __init__(self, title, pattern, alignment=\"left\"):\n\n TextColumn.__init__(self, title, alignment)\n self.pattern = pattern",
"def __init__(self, pattern1, pattern2):\n self.pattern1 = pattern1\n self.... | [
"0.7026829",
"0.6786201",
"0.67479306",
"0.6686362",
"0.6616921",
"0.64661425",
"0.6373413",
"0.6365473",
"0.6294536",
"0.6239017",
"0.6239017",
"0.6160952",
"0.6107341",
"0.60346353",
"0.59868246",
"0.5967532",
"0.59274745",
"0.58590156",
"0.58494097",
"0.5820785",
"0.577407... | 0.73183507 | 0 |
Teste le temps d'execution moyen d'un algorithme pour le probleme de couverture de graphe passe par l'argument nomMethode. Son fonctionnement est identique a la fonction testTempsN, a part le fait que l'argument p est maintenant une fonction de n. | def testTempsPfunc(nMax, p, nomMethode, fois = 10, **kwargs):
n = np.linspace(nMax / 10, nMax, 10, dtype = int)
res = np.zeros(n.shape)
progressBar = ProgressBar(maxValue = n.size * fois)
for ni in range(n.size):
for f in range(fois):
progressBar.update(ni * fois + f + 1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(method, n):\n \n m1,m2 = generate(n)\n \n start = time.time()\n method(m1,m2)\n end = time.time()\n \n exe = end - start\n \n return exe",
"def test_noarg():\n with pytest.raises(TypeError):\n session5.time_it(session5.speed_converter,\n ... | [
"0.57966805",
"0.56562084",
"0.5603032",
"0.55502313",
"0.5493021",
"0.536733",
"0.53644514",
"0.5349735",
"0.5324386",
"0.5324386",
"0.53158253",
"0.5228784",
"0.5213554",
"0.51858634",
"0.51828045",
"0.51634634",
"0.5148739",
"0.5109179",
"0.5071595",
"0.5071319",
"0.505179... | 0.7289037 | 0 |
Calcule le nombre de noeuds dans l'arbre de branchement visites par les differents algorithmes de branchement passes dans listAlgo. | def testNoeud(n, p, listAlgo):
assert n.size == p.size
res = np.zeros((len(listAlgo), n.size), dtype = int)
progressBar = ProgressBar(maxValue = n.size * len(listAlgo))
for ni in range(n.size):
for i, (algoName, algoArgs) in enumerate(listAlgo):
progressBar.update(ni * le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nucliators_num_and_proba(self):\n XY = self.XY\n TIMES = self.die_times\n # CHEN'S IMPLEMENTATION\n # nucliators = np.array([True for i in range(len(TIMES))])\n # leaders = np.array([-1 for i in range(len(TIMES))])\n # cells_idx_sorted_by_times = np.arange(0, len(T... | [
"0.5837356",
"0.5733209",
"0.5725088",
"0.5660552",
"0.56603295",
"0.56545347",
"0.5648576",
"0.5648576",
"0.557373",
"0.55588174",
"0.5554708",
"0.5501397",
"0.54987824",
"0.54965085",
"0.5492416",
"0.5478417",
"0.5458125",
"0.54197997",
"0.5391663",
"0.5371931",
"0.5371846"... | 0.59531885 | 0 |
Apply a function that uses os.system to apply exactextract zonal statistics | def exact_zonalstats(self, ras_path, vec_path, fid, col, stats, output_csv):
cmd = "exactextract --raster grid:%s --polygons %s --fid %s --stat %s=%s\(grid\) --output %s" %(ras_path, vec_path, fid, col, stats, output_csv)
# Apply zonalstatistics
os.system(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zonal_statistics(wrksppath, timestamp, region, model):\n logging.info('\\nDoing Zonal Statistics on ' + region)\n # Define app workspace and sub-paths\n resampleds = os.path.join(wrksppath, region, model + '_GeoTIFFs_resampled')\n shp_path = os.path.join(wrksppath, region, 'shapefiles', 'ffgs_' + r... | [
"0.60095936",
"0.51905686",
"0.5181356",
"0.514862",
"0.51476085",
"0.51448154",
"0.5131406",
"0.5116357",
"0.5069199",
"0.5063919",
"0.50120705",
"0.49994534",
"0.49952674",
"0.49900427",
"0.49884692",
"0.49875668",
"0.49793628",
"0.49753082",
"0.49700022",
"0.49682066",
"0.... | 0.6195457 | 0 |
Write FIR Filter Header Files Mark Wickert February 2015 | def FIR_header(fname_out,h):
M = len(h)
N = 3 # Coefficients per line
f = open(fname_out,'wt')
f.write('//define a FIR coefficient Array\n\n')
f.write('#include <stdint.h>\n\n')
f.write('#ifndef M_FIR\n')
f.write('#define M_FIR %d\n' % M)
f.write('#endif\n')
f.write('/******... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FIR_fix_header(fname_out,h):\r\n M = len(h)\r\n hq = int16(rint(h*2**15))\r\n N = 8 # Coefficients per line\r\n f = open(fname_out,'wt')\r\n f.write('//define a FIR coefficient Array\\n\\n')\r\n f.write('#include <stdint.h>\\n\\n')\r\n f.write('#ifndef M_FIR\\n')\r\n f.write('#define M_... | [
"0.70931596",
"0.67370427",
"0.66219014",
"0.6600384",
"0.6590528",
"0.6477551",
"0.6436763",
"0.6416983",
"0.63725084",
"0.63308465",
"0.6271982",
"0.6247542",
"0.62426054",
"0.6219489",
"0.62039953",
"0.6149303",
"0.6132102",
"0.6124595",
"0.6111361",
"0.6081367",
"0.607858... | 0.7048848 | 1 |
Write FIR FixedPoint Filter Header Files Mark Wickert February 2015 | def FIR_fix_header(fname_out,h):
M = len(h)
hq = int16(rint(h*2**15))
N = 8 # Coefficients per line
f = open(fname_out,'wt')
f.write('//define a FIR coefficient Array\n\n')
f.write('#include <stdint.h>\n\n')
f.write('#ifndef M_FIR\n')
f.write('#define M_FIR %d\n' % M)
f.writ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FIR_header(fname_out,h):\r\n M = len(h)\r\n N = 3 # Coefficients per line\r\n f = open(fname_out,'wt')\r\n f.write('//define a FIR coefficient Array\\n\\n')\r\n f.write('#include <stdint.h>\\n\\n')\r\n f.write('#ifndef M_FIR\\n')\r\n f.write('#define M_FIR %d\\n' % M)\r\n f.write('#endi... | [
"0.68696386",
"0.65298086",
"0.6383164",
"0.6348103",
"0.63411176",
"0.6297931",
"0.61885476",
"0.6168549",
"0.61448276",
"0.604231",
"0.60388714",
"0.5995459",
"0.5904048",
"0.58931124",
"0.5880672",
"0.58292276",
"0.5825504",
"0.58194333",
"0.57832295",
"0.5757579",
"0.5731... | 0.6958764 | 0 |
Write IIR SOS Header Files File format is compatible with CMSISDSP IIR Directform II Filter Functions Mark Wickert March 2015October 2016 | def IIR_sos_header(fname_out,SOS_mat):
Ns,Mcol = SOS_mat.shape
f = open(fname_out,'wt')
f.write('//define a IIR SOS CMSIS-DSP coefficient array\n\n')
f.write('#include <stdint.h>\n\n')
f.write('#ifndef STAGES\n')
f.write('#define STAGES %d\n' % Ns)
f.write('#endif\n')
f.write('/*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def niriss_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, \n filter='F150W', grism='GR150R'): \n naxis = 2048, 2048\n crpix = 1024, 1024\n \n cd = np.array([[ -0.0658, 0], [0, 0.0654]])/3600.\n cd_rot = rotate_CD_matrix(cd, pa_aper)\n \n h = pyfits.Header(... | [
"0.66640776",
"0.65826136",
"0.6545432",
"0.6491295",
"0.6480264",
"0.6465463",
"0.64238787",
"0.6403075",
"0.63853866",
"0.63784516",
"0.6355174",
"0.63049304",
"0.6269048",
"0.62388563",
"0.6225391",
"0.62192416",
"0.6201914",
"0.61963505",
"0.61715484",
"0.6123511",
"0.612... | 0.75789934 | 0 |
A method for displaying digital filter frequency response magnitude, phase, and group delay. A plot is produced using matplotlib freq_resp(self,mode = 'dB',Npts = 1024) A method for displaying the filter frequency response magnitude, phase, and group delay. A plot is produced using matplotlib freqz_resp(b,a=[1],mode = ... | def freqz_resp_list(b,a=np.array([1]),mode = 'dB',fs=1.0,Npts = 1024,fsize=(6,4)):
if type(b) == list:
# We have a list of filters
N_filt = len(b)
f = np.arange(0,Npts)/(2.0*Npts)
for n in range(N_filt):
w,H = signal.freqz(b[n],a[n],2*np.pi*f)
if n == 0:
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fft(self, **kwargs):\r\n from PyLnD.loads.freq_domain import FFT\r\n\r\n u_out = []\r\n f_in = []\r\n # Obtain the keyword arguments.\r\n if 'u_out' in kwargs.keys():\r\n u_out = kwargs['u_out']\r\n if type(u_out) is not list:\r\n u_out = ... | [
"0.64033353",
"0.62686026",
"0.62227094",
"0.6184112",
"0.61235726",
"0.6065172",
"0.60524064",
"0.6013173",
"0.6007936",
"0.5988842",
"0.59674466",
"0.5882669",
"0.5855861",
"0.5827436",
"0.5808305",
"0.5761468",
"0.5744499",
"0.57347035",
"0.5727783",
"0.5727151",
"0.568414... | 0.8219789 | 0 |
Create list of parameters that have handle types or are structs that contain handles. | def get_param_list_handles(self, values):
handles = []
for value in values:
if self.is_handle(value.base_type):
handles.append(value)
elif self.is_struct(
value.base_type
) and (value.base_type in self.structs_with_handles):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _params(self, obj):\n if isinstance(obj, BaseParameter):\n return [obj]\n elif isinstance(obj, BaseModule):\n return obj.parameters\n elif isinstance(obj, list):\n return self._list_params(obj)\n elif isinstance(obj, dict):\n return self._... | [
"0.62961376",
"0.6136545",
"0.60709596",
"0.5932396",
"0.58450574",
"0.5757733",
"0.57559466",
"0.57514113",
"0.56807816",
"0.5679042",
"0.5679042",
"0.56139725",
"0.5589959",
"0.55787647",
"0.5571645",
"0.5554827",
"0.55536526",
"0.55490935",
"0.55383956",
"0.5516286",
"0.55... | 0.7163818 | 0 |
Returns a set of all classes that are related to class `cls` via a restriction who's property matches any of the relations specified in `relations` or `fixed_relations`. | def get_related(cls, relations='relation', fixed_relations=None,
recursive=True, initial_classes=None):
matches = set(initial_classes) if initial_classes else set()
onto = cls.namespace.world
def tolist(rels):
if rels is None:
rels = []
elif isinstance(rels, (str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_related_nodes(reltype, inst=None):\n if inst is None:\n inst = ctx.instance\n ret = []\n for rel in inst.relationships:\n if reltype in rel.type_hierarchy:\n ret.append(rel.target)\n return ret",
"def prefetch_relations(relations, fields):\n\n\t\t# Create dict with content_type_id keys co... | [
"0.56025344",
"0.54824036",
"0.5469363",
"0.5312377",
"0.5239161",
"0.52039725",
"0.5177927",
"0.5169897",
"0.51600647",
"0.51197445",
"0.511781",
"0.50856453",
"0.50803256",
"0.5072536",
"0.50679827",
"0.506668",
"0.502101",
"0.49876282",
"0.49720237",
"0.49641904",
"0.49626... | 0.7943788 | 0 |
Make our basic default map for plotting | def basic_map(proj):
fig = plt.figure(figsize=(15, 10))
add_metpy_logo(fig, 0, 80, size='large')
view = fig.add_axes([0, 0, 1, 1], projection=proj)
view.set_extent([-120, -70, 20, 50])
view.add_feature(cfeature.STATES.with_scale('50m'))
view.add_feature(cfeature.OCEAN)
view.add_feature(cfeat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_map(data,LatLonBox):\n\n proj = ccrs.LambertConformal(central_longitude=data.StationLongitude,\n central_latitude=data.StationLatitude)\n\n fig = plt.figure(figsize=(17,11))\n ax = plt.subplot(111,projection=proj)\n \n ax.coastlines('50m', 'black', line... | [
"0.69561476",
"0.69260865",
"0.687373",
"0.68676054",
"0.6839179",
"0.6830576",
"0.68072754",
"0.6774143",
"0.67183614",
"0.67153305",
"0.66923743",
"0.6678213",
"0.6667825",
"0.665954",
"0.6653233",
"0.6628197",
"0.6622806",
"0.662191",
"0.6588893",
"0.6570472",
"0.65534616"... | 0.7771503 | 0 |
Resolve an IP address to a block of geo information. If a given address is unresolvable, return the default as defined by the settings, or "worldwide". | def lookup(self, address):
if self.noop:
return self.default_val
sock = self.socket_lib
gsocket = sock.socket(socket.AF_INET, socket.SOCK_STREAM)
gsocket.settimeout(self.timeout)
gsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
with statsd.timer('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_relative_location(self):\n http = urllib3.PoolManager()\n url = 'http://ipinfo.io/json'\n response = http.request('GET', url)\n soup = BeautifulSoup(response.data, features=\"html5lib\")\n soup = str(soup).split(\"body\")[1][1:-2]\n try:\n soup = ast.lit... | [
"0.6373992",
"0.61173093",
"0.60862064",
"0.6049507",
"0.6031096",
"0.6020606",
"0.60052085",
"0.59522474",
"0.5937974",
"0.59290636",
"0.59168726",
"0.59094286",
"0.5901701",
"0.588299",
"0.5877834",
"0.5875955",
"0.58749783",
"0.5853056",
"0.585162",
"0.58436143",
"0.580632... | 0.67328864 | 0 |
Copied from functools._make_key, as private function | def make_key(*args, **kwargs) -> Hashable:
if len(args) == 1 and isinstance(args[0], (int, str)):
return args[0]
if kwargs:
args = sum(kwargs.items(), (*args, _KWD_MARK))
return _HashedSeq(args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MakeKey(self, string, string_1, string_2):\n ...",
"def create_key ():",
"def def_key(x):\n return x",
"def _make_key(self, extra_prefix, key):\n if extra_prefix:\n return \"-\".join((self.prefix, extra_prefix, key))\n else:\n return \"-\".join((self.prefix, ... | [
"0.74343807",
"0.7412338",
"0.7368532",
"0.7350305",
"0.7350305",
"0.7293795",
"0.7173891",
"0.7173357",
"0.7129407",
"0.71269816",
"0.70437497",
"0.69630134",
"0.6898098",
"0.6889156",
"0.68764186",
"0.6844142",
"0.6826022",
"0.67985255",
"0.6783256",
"0.6780269",
"0.6764185... | 0.77028704 | 0 |
This function will give the XML file a pretty format | def pretty_print_xml(xml_file):
assert xml_file is not None
parser = etree.XMLParser(resolve_entities=False, strip_cdata=False, remove_blank_text=True)
tree = etree.parse(xml_file, parser)
tree.write(xml_file, pretty_print=True, encoding='utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_xml(xml):\n try:\n #parser = etree.XMLParser(remove_blank_text=True)\n tree = etree.fromstring(xml.encode('utf-8'))\n return etree.tostring(tree, pretty_print=True).decode()\n except:\n print(f\"ERROR pretty_xml() xml:{xml}\")\n raise",
"def pretty_print(xml_te... | [
"0.7275774",
"0.72622114",
"0.7219577",
"0.72054785",
"0.71931106",
"0.7120816",
"0.70987236",
"0.68587804",
"0.6851068",
"0.68459046",
"0.68249655",
"0.681348",
"0.68123454",
"0.67879665",
"0.6767181",
"0.6728557",
"0.6689568",
"0.6655467",
"0.6622747",
"0.66176265",
"0.6565... | 0.78514236 | 0 |
Produces ECDF graphs for input data. Inputs can be 1d arraylike, pandas Series, or pandas DataFrame. If a DataFrame is passed, group_by and targets may be set for group comparisons. If no target is set for a DataFrame, all columns will be graphed. | def ecdf(data, group_by=None, targets=None, ax=None, **kwargs):
text_color = plt.rcParams.get('ytick.color')
linewidth = 2
# Handle keyword arguments
for k, v in kwargs.items():
if k not in ['linewidth']:
raise TypeError('ecdf got an unexpeted keyword argument: {}'.format(k))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evals_by_target(ax, pds, baseline_ds=None, baseline_label=\"\", dim=None, funcId=None, groupby=None):\n if groupby is None: groupby = GroupByMedian()\n pfsize = len(pds.algds.keys())\n\n runlengths = 10**np.linspace(0, np.log10(pds.maxevals((dim, funcId))), num=500)\n target_values = pp.RunlengthBa... | [
"0.5437421",
"0.5339018",
"0.5221766",
"0.5221521",
"0.51959044",
"0.51781005",
"0.5176909",
"0.51717454",
"0.51717454",
"0.51649326",
"0.5159308",
"0.51462454",
"0.51462454",
"0.51288325",
"0.51288325",
"0.51205784",
"0.51197684",
"0.50759",
"0.5034205",
"0.48831218",
"0.487... | 0.73187286 | 0 |
Filters and labels a stack of binary (labelled) images based a supplied beamprofile. If the binary objects are located in an area of the ``beamprofile`` | def filter_binaries_beamprofile(bin_arr, beamprofile, cutoff=0.75, dilate=0):
bp_bool = beamprofile < cutoff * beamprofile.max()
out_binary = np.empty_like(bin_arr, dtype=int)
total_cells = 0
removed_cells = 0
for i, img in enumerate(bin_arr):
labeled, n = mh.labeled.label(img)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_binaries(bin_arr, remove_bordering=True, min_size=None, max_size=None, min_minor=None, max_minor=None,\r\n min_major=None, max_major=None):\r\n\r\n out = np.empty_like(bin_arr)\r\n for i, img in enumerate(bin_arr):\r\n if len(np.unique(img)) > 2: # Image is already label... | [
"0.57251734",
"0.5680151",
"0.55629224",
"0.55371886",
"0.54404503",
"0.54081875",
"0.5387208",
"0.5370653",
"0.53620297",
"0.53029686",
"0.52930856",
"0.5276979",
"0.52664846",
"0.52561504",
"0.52538973",
"0.5253762",
"0.5230767",
"0.521749",
"0.5214794",
"0.5210686",
"0.520... | 0.6396572 | 0 |
Create ``Cell`` objects from input ``Data`` object. Cell are identified in each frame by the binary image and all the data is cropped across all data elements to | def data_to_cells(input_data, initial_crop=5, final_crop=7, rotate='binary', remove_bordering=True,
remove_multiple_cells=True, remove_poor_fit=True, init_coords=True, verbose=True):
assert 'binary' in input_data.dclasses
assert input_data.ndim == 3
vprint = print if verbose else l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data):\n\n self.__data = np.array(data, dtype=object)\n\n # Get number of rows / columns\n self.__nrows, self.__ncols = self.__data.shape\n\n # Construct the cells\n grid = []\n for i in range(self.__nrows):\n row = []\n for j in ra... | [
"0.6227827",
"0.52800345",
"0.5201028",
"0.5186441",
"0.51484674",
"0.5120581",
"0.5110698",
"0.5085366",
"0.5084027",
"0.5069146",
"0.506612",
"0.5052179",
"0.50508493",
"0.5050668",
"0.5042638",
"0.5041943",
"0.50404125",
"0.503732",
"0.50229436",
"0.49961802",
"0.4982009",... | 0.76060915 | 0 |
Lookup MX records for a given email address, URL or domain name and identify the email service provider(s) from an internal list of known service providers. | def mxsniff(email_or_domain, ignore_errors=False, cache=None):
domain = get_domain(email_or_domain)
if cache and domain in cache:
return cache[domain]
result = []
tld = []
try:
answers = [] # Default value in case of verbose mode where an error occurs
answers = sorted([(rd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_mx(host):\n mail_exchangers = []\n addr = {}\n\n # The 'which nslookup' will not work in Windows systems\n if os.name != \"nt\":\n # Get the existence of nslookup\n fout = check_output(['which', 'nslookup']).decode()\n cmd = fout.strip()\n if cmd != '':\n ... | [
"0.6081652",
"0.6034598",
"0.58497",
"0.5779143",
"0.5668985",
"0.55136585",
"0.54503334",
"0.53364486",
"0.530277",
"0.5238585",
"0.5196607",
"0.5114593",
"0.50946337",
"0.5032373",
"0.50283235",
"0.50243527",
"0.50243473",
"0.49972066",
"0.49691933",
"0.49393648",
"0.492851... | 0.6903164 | 0 |
Place pieces on the board | def set_pieces(self):
for i in range(len(self._game_board)):
# Row 1
if i == 0:
for ii in range(len(self._game_board[i])):
if ii == 0 or ii == 8:
self._game_board[i][ii] = Chariot("black", "BCHA")
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_piece(piece, px, py, pc):\n \n\n for i, j in piece:\n x = px + i\n y = py + j\n if not (0 <= x < BOARD_WIDTH):\n continue\n if not (0 <= y < BOARD_HEIGHT):\n continue\n board[y][x] = pc",
"def place_pieces(self):\n # Soldiers\n ... | [
"0.7658466",
"0.7455928",
"0.73506844",
"0.73138446",
"0.73007345",
"0.729585",
"0.7259547",
"0.7257414",
"0.7240009",
"0.72098583",
"0.7100545",
"0.70418787",
"0.70204294",
"0.70123047",
"0.6976292",
"0.69622004",
"0.6950994",
"0.69338965",
"0.69305855",
"0.6882351",
"0.6827... | 0.7702644 | 0 |
Prints a message declaring start of the game | def printStartMsg(self):
print("\nSTARING THE GAME")
print("HAVE FUN!\n") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_start_game():\n print(HANGMAN_ASCII_ART)\n print(MAX_TRIES)",
"def display_starting_message(): # opening message\n starting_message = \"Is your cat plotting to kill you?? \\nLet's find out. \\n(Please note that this is merely a pythonic presentation of an app created by The Oatmeal.... | [
"0.7799476",
"0.7565161",
"0.7392909",
"0.72942185",
"0.7184049",
"0.70650315",
"0.7043099",
"0.69731873",
"0.69327986",
"0.6895159",
"0.6832667",
"0.6815326",
"0.68022037",
"0.67814875",
"0.6756332",
"0.6738329",
"0.67144835",
"0.67093796",
"0.67016387",
"0.66931564",
"0.669... | 0.87447006 | 0 |
Moves piece from starting_loc to ending_loc on gameboard | def move_pieces(self, starting_loc, ending_loc):
self._game_board[ending_loc[0]][ending_loc[1]] = \
self._game_board[starting_loc[0]][starting_loc[1]]
self._game_board[starting_loc[0]][starting_loc[1]] = "____" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_piece(self,start_location, end_location):\r\n\r\n board = self._board.get_board()\r\n start_pos = self.parse_pos(start_location) # Start and end position are lists that contain column and row\r\n end_pos = self.parse_pos(end_location)\r\n\r\n start_row = start_pos[0] # Positi... | [
"0.7688168",
"0.73786306",
"0.72923684",
"0.7213452",
"0.70540076",
"0.7035445",
"0.69348",
"0.6913098",
"0.69071984",
"0.6884811",
"0.6872986",
"0.6818325",
"0.67328197",
"0.67028815",
"0.6698548",
"0.6680781",
"0.6672807",
"0.6663776",
"0.6660042",
"0.6657248",
"0.6637972",... | 0.81536204 | 0 |
checks if the general of the passed color is in check if checkmate is true, checks if the general of the color passed is in checkmate | def gen_is_in_check(self, color, checkmate=False):
gen_location = self.get_general_location(color)
gen_piece = self._game_board[gen_location[0]][gen_location[1]]
is_red = color == "red"
opposite_color = "black" if is_red else "red"
opposing_gen_loc = self.get_general_location(op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_checkmate(self, color):\n\n if color == 'red':\n opposing_color = 'blue'\n else:\n opposing_color = 'red'\n general_location = None\n\n for piece in self._active_pieces[opposing_color]:\n if type(piece) is General:\n general_locati... | [
"0.7039147",
"0.6643741",
"0.6642845",
"0.6437368",
"0.6426064",
"0.6331268",
"0.6308762",
"0.6298158",
"0.62189233",
"0.6203074",
"0.6116791",
"0.6101278",
"0.60995513",
"0.6093594",
"0.60777986",
"0.6071043",
"0.6064444",
"0.60298425",
"0.6025423",
"0.6000517",
"0.59999096"... | 0.7182875 | 0 |
Sometimes the asset cache will contain zeroquantity holdings for some assets (until they're flushed). These shouldn't be returned by listmyassets. | def listmyassets_filter_zeros(self):
# activate assets
self.nodes[0].generate(500)
self.sync_all()
assert_equal(0, len(self.nodes[0].listmyassets()))
assert_equal(0, len(self.nodes[1].listmyassets()))
self.nodes[0].issue("FOO", 1000)
self.nodes[0].generate(10)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_inventory(self):\n self.inventory = [i for i in self.inventory if i.quantity != 0]",
"def resetAssetCollection(self):\n self.__assetscollection = {\"pc\": [], \"ic\": []}\n gc.collect()\n self.updateObservers(\"PROGRESSUPDATE||0\")\n return True",
"def resetAsset... | [
"0.5935301",
"0.59316236",
"0.5834367",
"0.5832448",
"0.5808702",
"0.56290805",
"0.5616631",
"0.5596113",
"0.5561146",
"0.55457944",
"0.55417615",
"0.5539237",
"0.55366",
"0.55346745",
"0.5528255",
"0.5526743",
"0.5492401",
"0.5486385",
"0.54837215",
"0.546645",
"0.5466162",
... | 0.6213578 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.