hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | rest_request | <not_specific> | def rest_request(self, url, path, *args, **kwargs):
"""
Makes REST call to Spark API endpoint
"""
url = url.rstrip("/") + "/" + path.lstrip("/")
if args:
for arg in args:
url = url.rstrip("/") + "/" + arg.lstrip("/")
if kwargs:
que... |
Makes REST call to Spark API endpoint
| Makes REST call to Spark API endpoint | [
"Makes",
"REST",
"call",
"to",
"Spark",
"API",
"endpoint"
] | def rest_request(self, url, path, *args, **kwargs):
url = url.rstrip("/") + "/" + path.lstrip("/")
if args:
for arg in args:
url = url.rstrip("/") + "/" + arg.lstrip("/")
if kwargs:
query = "&".join(["{0}={1}".format(key, value) for key, value in kwargs.it... | [
"def",
"rest_request",
"(",
"self",
",",
"url",
",",
"path",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"url",
"=",
"url",
".",
"rstrip",
"(",
"\"/\"",
")",
"+",
"\"/\"",
"+",
"path",
".",
"lstrip",
"(",
"\"/\"",
")",
"if",
"args",
":",
"... | Makes REST call to Spark API endpoint | [
"Makes",
"REST",
"call",
"to",
"Spark",
"API",
"endpoint"
] | [
"\"\"\"\n Makes REST call to Spark API endpoint\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | configure | <not_specific> | def configure(self, config_map):
"""
Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value
"""
collectd.info("Configuring Spark Process Plugin ...")
if "MasterPort" not in config_map and "WorkerPorts" not in config_map:
... |
Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value
| Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value | [
"Configuration",
"callback",
"for",
"collectd",
"Args",
":",
"config_map",
"(",
"dict",
")",
":",
"mapping",
"of",
"config",
"name",
"to",
"value"
] | def configure(self, config_map):
collectd.info("Configuring Spark Process Plugin ...")
if "MasterPort" not in config_map and "WorkerPorts" not in config_map:
raise ValueError(
"No port provided for metrics url - \
please provide key 'MasterPort' and/or 'Worker... | [
"def",
"configure",
"(",
"self",
",",
"config_map",
")",
":",
"collectd",
".",
"info",
"(",
"\"Configuring Spark Process Plugin ...\"",
")",
"if",
"\"MasterPort\"",
"not",
"in",
"config_map",
"and",
"\"WorkerPorts\"",
"not",
"in",
"config_map",
":",
"raise",
"Valu... | Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value | [
"Configuration",
"callback",
"for",
"collectd",
"Args",
":",
"config_map",
"(",
"dict",
")",
":",
"mapping",
"of",
"config",
"name",
"to",
"value"
] | [
"\"\"\"\n Configuration callback for collectd\n\n Args:\n config_map (dict): mapping of config name to value\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "config_map",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_map",
"type": null,
"docstring": null,
"docstring_toke... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | read | null | def read(self):
"""
Makes API calls for cluster level metrics
related to master and worker nodes
and posts them to SignalFx
"""
if self.master_port:
master = self.metric_address + ":" + self.master_port
master_resp = self.spark_agent.request_metric... |
Makes API calls for cluster level metrics
related to master and worker nodes
and posts them to SignalFx
| Makes API calls for cluster level metrics
related to master and worker nodes
and posts them to SignalFx | [
"Makes",
"API",
"calls",
"for",
"cluster",
"level",
"metrics",
"related",
"to",
"master",
"and",
"worker",
"nodes",
"and",
"posts",
"them",
"to",
"SignalFx"
] | def read(self):
if self.master_port:
master = self.metric_address + ":" + self.master_port
master_resp = self.spark_agent.request_metrics(master, MASTER_PATH)
master_metrics = self.get_metrics(master_resp, "master")
self.post_metrics(master_metrics)
if sel... | [
"def",
"read",
"(",
"self",
")",
":",
"if",
"self",
".",
"master_port",
":",
"master",
"=",
"self",
".",
"metric_address",
"+",
"\":\"",
"+",
"self",
".",
"master_port",
"master_resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",
"(",
"master",... | Makes API calls for cluster level metrics
related to master and worker nodes
and posts them to SignalFx | [
"Makes",
"API",
"calls",
"for",
"cluster",
"level",
"metrics",
"related",
"to",
"master",
"and",
"worker",
"nodes",
"and",
"posts",
"them",
"to",
"SignalFx"
] | [
"\"\"\"\n Makes API calls for cluster level metrics\n related to master and worker nodes\n and posts them to SignalFx\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | configure | null | def configure(self, config_map):
"""
Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value
"""
collectd.info("Configuring Spark Application Plugin ...")
required_keys = ("Cluster", "Master")
for key in required_key... |
Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value
| Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value | [
"Configuration",
"callback",
"for",
"collectd",
"Args",
":",
"config_map",
"(",
"dict",
")",
":",
"mapping",
"of",
"config",
"name",
"to",
"value"
] | def configure(self, config_map):
collectd.info("Configuring Spark Application Plugin ...")
required_keys = ("Cluster", "Master")
for key in required_keys:
if key not in config_map:
raise ValueError("Missing required config setting: %s" % key)
for key, value in... | [
"def",
"configure",
"(",
"self",
",",
"config_map",
")",
":",
"collectd",
".",
"info",
"(",
"\"Configuring Spark Application Plugin ...\"",
")",
"required_keys",
"=",
"(",
"\"Cluster\"",
",",
"\"Master\"",
")",
"for",
"key",
"in",
"required_keys",
":",
"if",
"ke... | Configuration callback for collectd
Args:
config_map (dict): mapping of config name to value | [
"Configuration",
"callback",
"for",
"collectd",
"Args",
":",
"config_map",
"(",
"dict",
")",
":",
"mapping",
"of",
"config",
"name",
"to",
"value"
] | [
"\"\"\"\n Configuration callback for collectd\n\n Args:\n config_map (dict): mapping of config name to value\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "config_map",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_map",
"type": null,
"docstring": null,
"docstring_toke... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | read | null | def read(self):
"""
Collect metrics from Spark API endpoints and send to SignalFx
"""
# Get all active apps in cluster
apps = self._get_running_apps()
# Get streaming metrics
self._get_streaming_metrics(apps)
# Get the job metrics
self._get_job_... |
Collect metrics from Spark API endpoints and send to SignalFx
| Collect metrics from Spark API endpoints and send to SignalFx | [
"Collect",
"metrics",
"from",
"Spark",
"API",
"endpoints",
"and",
"send",
"to",
"SignalFx"
] | def read(self):
apps = self._get_running_apps()
self._get_streaming_metrics(apps)
self._get_job_metrics(apps)
self._get_stage_metrics(apps)
self._get_executor_metrics(apps)
self.post_metrics()
self.cleanup() | [
"def",
"read",
"(",
"self",
")",
":",
"apps",
"=",
"self",
".",
"_get_running_apps",
"(",
")",
"self",
".",
"_get_streaming_metrics",
"(",
"apps",
")",
"self",
".",
"_get_job_metrics",
"(",
"apps",
")",
"self",
".",
"_get_stage_metrics",
"(",
"apps",
")",
... | Collect metrics from Spark API endpoints and send to SignalFx | [
"Collect",
"metrics",
"from",
"Spark",
"API",
"endpoints",
"and",
"send",
"to",
"SignalFx"
] | [
"\"\"\"\n Collect metrics from Spark API endpoints and send to SignalFx\n \"\"\"",
"# Get all active apps in cluster",
"# Get streaming metrics",
"# Get the job metrics",
"# Get the stage metrics",
"# Get the executor metrics",
"# Send metrics to SignalFx",
"# clear metrics data structur... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_standalone_apps | <not_specific> | def _get_standalone_apps(self):
"""
Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application. The driver URL is the API endpoint required to
retrieve any application level metrics
"""
... |
Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application. The driver URL is the API endpoint required to
retrieve any application level metrics
| Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application. The driver URL is the API endpoint required to
retrieve any application level metrics | [
"Retrieve",
"active",
"applications",
"for",
"Spark",
"standalone",
"cluster",
"Uses",
"BeautifulSoup",
"module",
"to",
"find",
"driver",
"URL",
"mapped",
"to",
"the",
"specific",
"application",
".",
"The",
"driver",
"URL",
"is",
"the",
"API",
"endpoint",
"requi... | def _get_standalone_apps(self):
resp = self.spark_agent.request_metrics(self.master, STANDALONE_STATE_PATH)
apps = {}
active_apps = {}
if "activeapps" in resp:
active_apps = resp["activeapps"]
for app in active_apps:
app_id = app.get("id")
app_... | [
"def",
"_get_standalone_apps",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",
"(",
"self",
".",
"master",
",",
"STANDALONE_STATE_PATH",
")",
"apps",
"=",
"{",
"}",
"active_apps",
"=",
"{",
"}",
"if",
"\"activeapps\"",... | Retrieve active applications for Spark standalone cluster
Uses BeautifulSoup module to find driver URL mapped to the specific
application. | [
"Retrieve",
"active",
"applications",
"for",
"Spark",
"standalone",
"cluster",
"Uses",
"BeautifulSoup",
"module",
"to",
"find",
"driver",
"URL",
"mapped",
"to",
"the",
"specific",
"application",
"."
] | [
"\"\"\"\n Retrieve active applications for Spark standalone cluster\n\n Uses BeautifulSoup module to find driver URL mapped to the specific\n application. The driver URL is the API endpoint required to\n retrieve any application level metrics\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_mesos_apps | <not_specific> | def _get_mesos_apps(self):
"""
Retrieve all applications corresponding to Spark mesos cluster
"""
resp = self.spark_agent.request_metrics(self.master, MESOS_MASTER_APP_PATH)
apps = {}
frameworks = {}
if "frameworks" in resp:
frameworks = resp["framewor... |
Retrieve all applications corresponding to Spark mesos cluster
| Retrieve all applications corresponding to Spark mesos cluster | [
"Retrieve",
"all",
"applications",
"corresponding",
"to",
"Spark",
"mesos",
"cluster"
] | def _get_mesos_apps(self):
resp = self.spark_agent.request_metrics(self.master, MESOS_MASTER_APP_PATH)
apps = {}
frameworks = {}
if "frameworks" in resp:
frameworks = resp["frameworks"]
for app in frameworks:
app_id = app.get("id")
app_name = a... | [
"def",
"_get_mesos_apps",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",
"(",
"self",
".",
"master",
",",
"MESOS_MASTER_APP_PATH",
")",
"apps",
"=",
"{",
"}",
"frameworks",
"=",
"{",
"}",
"if",
"\"frameworks\"",
"in... | Retrieve all applications corresponding to Spark mesos cluster | [
"Retrieve",
"all",
"applications",
"corresponding",
"to",
"Spark",
"mesos",
"cluster"
] | [
"\"\"\"\n Retrieve all applications corresponding to Spark mesos cluster\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_yarn_apps | <not_specific> | def _get_yarn_apps(self):
"""
Retrieve all applications corresponding to Spark mesos cluster
from yarn
"""
resp = self.spark_agent.request_metrics(self.master, YARN_MASTER_APP_PATH)
apps = {}
for app in resp.get("apps", {}).get("app", []):
if app.get(... |
Retrieve all applications corresponding to Spark mesos cluster
from yarn
| Retrieve all applications corresponding to Spark mesos cluster
from yarn | [
"Retrieve",
"all",
"applications",
"corresponding",
"to",
"Spark",
"mesos",
"cluster",
"from",
"yarn"
] | def _get_yarn_apps(self):
resp = self.spark_agent.request_metrics(self.master, YARN_MASTER_APP_PATH)
apps = {}
for app in resp.get("apps", {}).get("app", []):
if app.get("applicationType", "").upper() == "SPARK" and app.get("state", "").upper() == "RUNNING":
app_id = ... | [
"def",
"_get_yarn_apps",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",
"(",
"self",
".",
"master",
",",
"YARN_MASTER_APP_PATH",
")",
"apps",
"=",
"{",
"}",
"for",
"app",
"in",
"resp",
".",
"get",
"(",
"\"apps\"",... | Retrieve all applications corresponding to Spark mesos cluster
from yarn | [
"Retrieve",
"all",
"applications",
"corresponding",
"to",
"Spark",
"mesos",
"cluster",
"from",
"yarn"
] | [
"\"\"\"\n Retrieve all applications corresponding to Spark mesos cluster\n from yarn\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_running_apps | <not_specific> | def _get_running_apps(self):
"""
Retrieve running applications in Spark based on cluster
"""
if not self.cluster_mode:
collectd.info("Cluster mode not defined")
return []
if self.cluster_mode == SPARK_STANDALONE_MODE:
return self._get_standalon... |
Retrieve running applications in Spark based on cluster
| Retrieve running applications in Spark based on cluster | [
"Retrieve",
"running",
"applications",
"in",
"Spark",
"based",
"on",
"cluster"
] | def _get_running_apps(self):
if not self.cluster_mode:
collectd.info("Cluster mode not defined")
return []
if self.cluster_mode == SPARK_STANDALONE_MODE:
return self._get_standalone_apps()
elif self.cluster_mode == SPARK_MESOS_MODE:
return self._ge... | [
"def",
"_get_running_apps",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"cluster_mode",
":",
"collectd",
".",
"info",
"(",
"\"Cluster mode not defined\"",
")",
"return",
"[",
"]",
"if",
"self",
".",
"cluster_mode",
"==",
"SPARK_STANDALONE_MODE",
":",
"ret... | Retrieve running applications in Spark based on cluster | [
"Retrieve",
"running",
"applications",
"in",
"Spark",
"based",
"on",
"cluster"
] | [
"\"\"\"\n Retrieve running applications in Spark based on cluster\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_streaming_metrics | null | def _get_streaming_metrics(self, apps):
"""
Get streaming metrics corresponding to a streaming application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
"""
for app_id, (app_name, app_user, tracking_url... |
Get streaming metrics corresponding to a streaming application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
| Get streaming metrics corresponding to a streaming application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"streaming",
"metrics",
"corresponding",
"to",
"a",
"streaming",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | def _get_streaming_metrics(self, apps):
for app_id, (app_name, app_user, tracking_url) in apps.items():
resp = self.spark_agent.request_metrics(tracking_url, APPS_ENDPOINT, app_id, "streaming/statistics")
if not resp:
continue
dim = {"app_name": str(app_name),... | [
"def",
"_get_streaming_metrics",
"(",
"self",
",",
"apps",
")",
":",
"for",
"app_id",
",",
"(",
"app_name",
",",
"app_user",
",",
"tracking_url",
")",
"in",
"apps",
".",
"items",
"(",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metri... | Get streaming metrics corresponding to a streaming application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"streaming",
"metrics",
"corresponding",
"to",
"a",
"streaming",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | [
"\"\"\"\n Get streaming metrics corresponding to a streaming application\n\n Args:\n apps (dict): Mapping of application id to app name, user,\n and url endpoint for API call\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apps",
"type": null,
"docstring": null,
"docstring_tokens": [... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_job_metrics | null | def _get_job_metrics(self, apps):
"""
Get job metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
"""
for app_id, (app_name, app_user, tracking_url) in apps.item... |
Get job metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
| Get job metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"job",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | def _get_job_metrics(self, apps):
for app_id, (app_name, app_user, tracking_url) in apps.items():
resp = self.spark_agent.request_metrics(tracking_url, APPS_ENDPOINT, app_id, "jobs", status="RUNNING")
if not resp:
continue
dim = {"app_name": str(app_name), "us... | [
"def",
"_get_job_metrics",
"(",
"self",
",",
"apps",
")",
":",
"for",
"app_id",
",",
"(",
"app_name",
",",
"app_user",
",",
"tracking_url",
")",
"in",
"apps",
".",
"items",
"(",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",
... | Get job metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"job",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | [
"\"\"\"\n Get job metrics corresponding to a running application\n\n Args:\n apps (dict): Mapping of application id to app name, user,\n and url endpoint for API call\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apps",
"type": null,
"docstring": null,
"docstring_tokens": [... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_stage_metrics | null | def _get_stage_metrics(self, apps):
"""
Get stage metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
"""
for app_id, (app_name, app_user, tracking_url) in apps.... |
Get stage metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
| Get stage metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"stage",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | def _get_stage_metrics(self, apps):
for app_id, (app_name, app_user, tracking_url) in apps.items():
resp = self.spark_agent.request_metrics(tracking_url, APPS_ENDPOINT, app_id, "stages", status="ACTIVE")
if not resp:
continue
dim = {"app_name": str(app_name), ... | [
"def",
"_get_stage_metrics",
"(",
"self",
",",
"apps",
")",
":",
"for",
"app_id",
",",
"(",
"app_name",
",",
"app_user",
",",
"tracking_url",
")",
"in",
"apps",
".",
"items",
"(",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metrics",... | Get stage metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"stage",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | [
"\"\"\"\n Get stage metrics corresponding to a running application\n\n Args:\n apps (dict): Mapping of application id to app name, user,\n and url endpoint for API call\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apps",
"type": null,
"docstring": null,
"docstring_tokens": [... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _update_driver_metrics | <not_specific> | def _update_driver_metrics(self, executor, exec_metrics, dim):
"""
Helper method to get driver specific metrics from executor endpoint
Args:
executor (dict): JSON response containing driver-specific metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
... |
Helper method to get driver specific metrics from executor endpoint
Args:
executor (dict): JSON response containing driver-specific metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
... | Helper method to get driver specific metrics from executor endpoint
Args:
executor (dict): JSON response containing driver-specific metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
dim (dict): Dictionary representing dimensions | [
"Helper",
"method",
"to",
"get",
"driver",
"specific",
"metrics",
"from",
"executor",
"endpoint",
"Args",
":",
"executor",
"(",
"dict",
")",
":",
"JSON",
"response",
"containing",
"driver",
"-",
"specific",
"metrics",
"exec_metrics",
"(",
"dict",
")",
":",
"... | def _update_driver_metrics(self, executor, exec_metrics, dim):
for key, (metric_type, metric_name) in metrics.SPARK_DRIVER_METRICS.items():
if key not in executor:
continue
metric_value = executor[key]
mr = exec_metrics.get(metric_name, MetricRecord(metric_nam... | [
"def",
"_update_driver_metrics",
"(",
"self",
",",
"executor",
",",
"exec_metrics",
",",
"dim",
")",
":",
"for",
"key",
",",
"(",
"metric_type",
",",
"metric_name",
")",
"in",
"metrics",
".",
"SPARK_DRIVER_METRICS",
".",
"items",
"(",
")",
":",
"if",
"key"... | Helper method to get driver specific metrics from executor endpoint
Args:
executor (dict): JSON response containing driver-specific metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
dim (dict): Dictionary representing dimensions | [
"Helper",
"method",
"to",
"get",
"driver",
"specific",
"metrics",
"from",
"executor",
"endpoint",
"Args",
":",
"executor",
"(",
"dict",
")",
":",
"JSON",
"response",
"containing",
"driver",
"-",
"specific",
"metrics",
"exec_metrics",
"(",
"dict",
")",
":",
"... | [
"\"\"\"\n Helper method to get driver specific metrics from executor endpoint\n\n Args:\n executor (dict): JSON response containing driver-specific metrics\n exec_metrics (dict): Mapping of metric name (key in JSON response) to\n MetricRecord object to be sent... | [
{
"param": "self",
"type": null
},
{
"param": "executor",
"type": null
},
{
"param": "exec_metrics",
"type": null
},
{
"param": "dim",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "executor",
"type": null,
"docstring": null,
"docstring_tokens... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _update_executor_metrics | <not_specific> | def _update_executor_metrics(self, executor, exec_metrics, dim):
"""
Helper method to get executor metrics
Args:
executor (dict): JSON response containing executor metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRe... |
Helper method to get executor metrics
Args:
executor (dict): JSON response containing executor metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
dim (dict): Dictionary representi... | Helper method to get executor metrics
Args:
executor (dict): JSON response containing executor metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
dim (dict): Dictionary representing dimensions | [
"Helper",
"method",
"to",
"get",
"executor",
"metrics",
"Args",
":",
"executor",
"(",
"dict",
")",
":",
"JSON",
"response",
"containing",
"executor",
"metrics",
"exec_metrics",
"(",
"dict",
")",
":",
"Mapping",
"of",
"metric",
"name",
"(",
"key",
"in",
"JS... | def _update_executor_metrics(self, executor, exec_metrics, dim):
for key, (metric_type, metric_name) in metrics.SPARK_EXECUTOR_METRICS.items():
if key not in executor:
continue
metric_value = executor[key]
mr = exec_metrics.get(metric_name, MetricRecord(metric... | [
"def",
"_update_executor_metrics",
"(",
"self",
",",
"executor",
",",
"exec_metrics",
",",
"dim",
")",
":",
"for",
"key",
",",
"(",
"metric_type",
",",
"metric_name",
")",
"in",
"metrics",
".",
"SPARK_EXECUTOR_METRICS",
".",
"items",
"(",
")",
":",
"if",
"... | Helper method to get executor metrics
Args:
executor (dict): JSON response containing executor metrics
exec_metrics (dict): Mapping of metric name (key in JSON response) to
MetricRecord object to be sent by collectd
dim (dict): Dictionary representing dimensions | [
"Helper",
"method",
"to",
"get",
"executor",
"metrics",
"Args",
":",
"executor",
"(",
"dict",
")",
":",
"JSON",
"response",
"containing",
"executor",
"metrics",
"exec_metrics",
"(",
"dict",
")",
":",
"Mapping",
"of",
"metric",
"name",
"(",
"key",
"in",
"JS... | [
"\"\"\"\n Helper method to get executor metrics\n\n Args:\n executor (dict): JSON response containing executor metrics\n exec_metrics (dict): Mapping of metric name (key in JSON response) to\n MetricRecord object to be sent by collectd\n dim (dict): Dic... | [
{
"param": "self",
"type": null
},
{
"param": "executor",
"type": null
},
{
"param": "exec_metrics",
"type": null
},
{
"param": "dim",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "executor",
"type": null,
"docstring": null,
"docstring_tokens... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _get_executor_metrics | null | def _get_executor_metrics(self, apps):
"""
Get executor metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
"""
for app_id, (app_name, app_user, tracking_url) in... |
Get executor metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call
| Get executor metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"executor",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | def _get_executor_metrics(self, apps):
for app_id, (app_name, app_user, tracking_url) in apps.items():
resp = self.spark_agent.request_metrics(tracking_url, APPS_ENDPOINT, app_id, "executors")
if not resp:
continue
dim = {"app_name": str(app_name), "user": str... | [
"def",
"_get_executor_metrics",
"(",
"self",
",",
"apps",
")",
":",
"for",
"app_id",
",",
"(",
"app_name",
",",
"app_user",
",",
"tracking_url",
")",
"in",
"apps",
".",
"items",
"(",
")",
":",
"resp",
"=",
"self",
".",
"spark_agent",
".",
"request_metric... | Get executor metrics corresponding to a running application
Args:
apps (dict): Mapping of application id to app name, user,
and url endpoint for API call | [
"Get",
"executor",
"metrics",
"corresponding",
"to",
"a",
"running",
"application",
"Args",
":",
"apps",
"(",
"dict",
")",
":",
"Mapping",
"of",
"application",
"id",
"to",
"app",
"name",
"user",
"and",
"url",
"endpoint",
"for",
"API",
"call"
] | [
"\"\"\"\n Get executor metrics corresponding to a running application\n\n Args:\n apps (dict): Mapping of application id to app name, user,\n and url endpoint for API call\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "apps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "apps",
"type": null,
"docstring": null,
"docstring_tokens": [... |
b8d392f84453059a12f9169b84807a433e7e3a3d | theletterf/collectd-spark | spark_plugin.py | [
"Apache-2.0"
] | Python | _validate_master | <not_specific> | def _validate_master(cls, master):
"""
validate form of master url provided from config file
Args:
master (str): String representing master URL
Returns:
bool: True if master URL contains host and port as expected
and False otherwise
"""
hos... |
validate form of master url provided from config file
Args:
master (str): String representing master URL
Returns:
bool: True if master URL contains host and port as expected
and False otherwise
| validate form of master url provided from config file
Args:
master (str): String representing master URL
True if master URL contains host and port as expected
and False otherwise | [
"validate",
"form",
"of",
"master",
"url",
"provided",
"from",
"config",
"file",
"Args",
":",
"master",
"(",
"str",
")",
":",
"String",
"representing",
"master",
"URL",
"True",
"if",
"master",
"URL",
"contains",
"host",
"and",
"port",
"as",
"expected",
"an... | def _validate_master(cls, master):
host, port = master.rsplit(":", 1)
if host and port:
try:
port = int(port)
except (ValueError, TypeError):
return False
return _validate_url(host)
else:
return False | [
"def",
"_validate_master",
"(",
"cls",
",",
"master",
")",
":",
"host",
",",
"port",
"=",
"master",
".",
"rsplit",
"(",
"\":\"",
",",
"1",
")",
"if",
"host",
"and",
"port",
":",
"try",
":",
"port",
"=",
"int",
"(",
"port",
")",
"except",
"(",
"Va... | validate form of master url provided from config file
Args:
master (str): String representing master URL | [
"validate",
"form",
"of",
"master",
"url",
"provided",
"from",
"config",
"file",
"Args",
":",
"master",
"(",
"str",
")",
":",
"String",
"representing",
"master",
"URL"
] | [
"\"\"\"\n validate form of master url provided from config file\n\n Args:\n master (str): String representing master URL\n\n Returns:\n bool: True if master URL contains host and port as expected\n and False otherwise\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "master",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "master",
"type": null,
"docstring": null,
"docstring_tokens": ... |
2036f90182fc82d14a660ed3db371b059bee2b61 | giantas/remoteref | accounts/views.py | [
"MIT"
] | Python | register_user | <not_specific> | def register_user(request):
"""Create UserRegistrationForm, return form else validate and create CustomUser instance."""
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('home_page'))
if request.method == 'POST':
form = UserRegistrationForm(request.POST, host=request.... | Create UserRegistrationForm, return form else validate and create CustomUser instance. | Create UserRegistrationForm, return form else validate and create CustomUser instance. | [
"Create",
"UserRegistrationForm",
"return",
"form",
"else",
"validate",
"and",
"create",
"CustomUser",
"instance",
"."
] | def register_user(request):
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('home_page'))
if request.method == 'POST':
form = UserRegistrationForm(request.POST, host=request.get_host())
if form.is_valid():
username = form.cleaned_data.get('username')
... | [
"def",
"register_user",
"(",
"request",
")",
":",
"if",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'home_page'",
")",
")",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"fo... | Create UserRegistrationForm, return form else validate and create CustomUser instance. | [
"Create",
"UserRegistrationForm",
"return",
"form",
"else",
"validate",
"and",
"create",
"CustomUser",
"instance",
"."
] | [
"\"\"\"Create UserRegistrationForm, return form else validate and create CustomUser instance.\"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2036f90182fc82d14a660ed3db371b059bee2b61 | giantas/remoteref | accounts/views.py | [
"MIT"
] | Python | login_user | <not_specific> | def login_user(request):
"""Validate user credentials and log in else display error."""
next_page = request.GET.get('next')
if next_page:
next_page = next_page.strip()
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('home_page'))
if request.method == 'POST':... | Validate user credentials and log in else display error. | Validate user credentials and log in else display error. | [
"Validate",
"user",
"credentials",
"and",
"log",
"in",
"else",
"display",
"error",
"."
] | def login_user(request):
next_page = request.GET.get('next')
if next_page:
next_page = next_page.strip()
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('home_page'))
if request.method == 'POST':
form = UserLoginForm(data=request.POST)
if form.is_v... | [
"def",
"login_user",
"(",
"request",
")",
":",
"next_page",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'next'",
")",
"if",
"next_page",
":",
"next_page",
"=",
"next_page",
".",
"strip",
"(",
")",
"if",
"request",
".",
"user",
".",
"is_authenticated",
... | Validate user credentials and log in else display error. | [
"Validate",
"user",
"credentials",
"and",
"log",
"in",
"else",
"display",
"error",
"."
] | [
"\"\"\"Validate user credentials and log in else display error.\"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2036f90182fc82d14a660ed3db371b059bee2b61 | giantas/remoteref | accounts/views.py | [
"MIT"
] | Python | logout_user | <not_specific> | def logout_user(request):
"""Log out the user, return redirect response."""
if request.user.is_authenticated():
logout(request)
messages.success(request, 'You have been logged out successfully.')
return HttpResponseRedirect(reverse('home_page')) | Log out the user, return redirect response. | Log out the user, return redirect response. | [
"Log",
"out",
"the",
"user",
"return",
"redirect",
"response",
"."
] | def logout_user(request):
if request.user.is_authenticated():
logout(request)
messages.success(request, 'You have been logged out successfully.')
return HttpResponseRedirect(reverse('home_page')) | [
"def",
"logout_user",
"(",
"request",
")",
":",
"if",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"logout",
"(",
"request",
")",
"messages",
".",
"success",
"(",
"request",
",",
"'You have been logged out successfully.'",
")",
"return",
"Ht... | Log out the user, return redirect response. | [
"Log",
"out",
"the",
"user",
"return",
"redirect",
"response",
"."
] | [
"\"\"\"Log out the user, return redirect response.\"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2036f90182fc82d14a660ed3db371b059bee2b61 | giantas/remoteref | accounts/views.py | [
"MIT"
] | Python | activate_user | <not_specific> | def activate_user(request, uidb64, token):
"""Validate link and mark user as active else return error and redirect response."""
if uidb64 is not None and token is not None:
uid = force_text(urlsafe_base64_decode(uidb64))
user = CustomUser.objects.get(pk=uid)
if default_token_generator.ch... | Validate link and mark user as active else return error and redirect response. | Validate link and mark user as active else return error and redirect response. | [
"Validate",
"link",
"and",
"mark",
"user",
"as",
"active",
"else",
"return",
"error",
"and",
"redirect",
"response",
"."
] | def activate_user(request, uidb64, token):
if uidb64 is not None and token is not None:
uid = force_text(urlsafe_base64_decode(uidb64))
user = CustomUser.objects.get(pk=uid)
if default_token_generator.check_token(user, token) and not user.is_active:
user.is_active = True
... | [
"def",
"activate_user",
"(",
"request",
",",
"uidb64",
",",
"token",
")",
":",
"if",
"uidb64",
"is",
"not",
"None",
"and",
"token",
"is",
"not",
"None",
":",
"uid",
"=",
"force_text",
"(",
"urlsafe_base64_decode",
"(",
"uidb64",
")",
")",
"user",
"=",
... | Validate link and mark user as active else return error and redirect response. | [
"Validate",
"link",
"and",
"mark",
"user",
"as",
"active",
"else",
"return",
"error",
"and",
"redirect",
"response",
"."
] | [
"\"\"\"Validate link and mark user as active else return error and redirect response.\"\"\""
] | [
{
"param": "request",
"type": null
},
{
"param": "uidb64",
"type": null
},
{
"param": "token",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uidb64",
"type": null,
"docstring": null,
"docstring_token... |
aad9d4f1aac5dcf1e36db7435add9070af4ca96e | giantas/remoteref | debtinfo/models.py | [
"MIT"
] | Python | add_debtor | null | def add_debtor(sender, **kwargs):
"""Create a Debtor instance for a created Profile instance."""
profile = kwargs['instance']
if kwargs['created']:
try:
debtor = Debtor.objects.get(debtor=profile.debtor)
except Debtor.DoesNotExist:
debtor = Debtor.objects.create(
... | Create a Debtor instance for a created Profile instance. | Create a Debtor instance for a created Profile instance. | [
"Create",
"a",
"Debtor",
"instance",
"for",
"a",
"created",
"Profile",
"instance",
"."
] | def add_debtor(sender, **kwargs):
profile = kwargs['instance']
if kwargs['created']:
try:
debtor = Debtor.objects.get(debtor=profile.debtor)
except Debtor.DoesNotExist:
debtor = Debtor.objects.create(
debtor=profile.debtor, id_number=profile.id_number, cel... | [
"def",
"add_debtor",
"(",
"sender",
",",
"**",
"kwargs",
")",
":",
"profile",
"=",
"kwargs",
"[",
"'instance'",
"]",
"if",
"kwargs",
"[",
"'created'",
"]",
":",
"try",
":",
"debtor",
"=",
"Debtor",
".",
"objects",
".",
"get",
"(",
"debtor",
"=",
"pro... | Create a Debtor instance for a created Profile instance. | [
"Create",
"a",
"Debtor",
"instance",
"for",
"a",
"created",
"Profile",
"instance",
"."
] | [
"\"\"\"Create a Debtor instance for a created Profile instance.\"\"\""
] | [
{
"param": "sender",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sender",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4bdd498cb7972e6f0d25522da97781163c15ece3 | giantas/remoteref | debtinfo/views.py | [
"MIT"
] | Python | post | <not_specific> | def post(self, request, *args, **kwargs):
"""Validate form data and save to database, return response else return form."""
self.object = None
self.form = self.get_form(self.form_class)
if self.form.is_valid():
obj = self.form.save(commit=False)
self.object = obj.... | Validate form data and save to database, return response else return form. | Validate form data and save to database, return response else return form. | [
"Validate",
"form",
"data",
"and",
"save",
"to",
"database",
"return",
"response",
"else",
"return",
"form",
"."
] | def post(self, request, *args, **kwargs):
self.object = None
self.form = self.get_form(self.form_class)
if self.form.is_valid():
obj = self.form.save(commit=False)
self.object = obj.save()
messages.success(request, 'Query successful! ')
return Http... | [
"def",
"post",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"object",
"=",
"None",
"self",
".",
"form",
"=",
"self",
".",
"get_form",
"(",
"self",
".",
"form_class",
")",
"if",
"self",
".",
"form",
".... | Validate form data and save to database, return response else return form. | [
"Validate",
"form",
"data",
"and",
"save",
"to",
"database",
"return",
"response",
"else",
"return",
"form",
"."
] | [
"\"\"\"Validate form data and save to database, return response else return form.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens"... |
4bdd498cb7972e6f0d25522da97781163c15ece3 | giantas/remoteref | debtinfo/views.py | [
"MIT"
] | Python | download_table | <not_specific> | def download_table(request):
"""Create Debtors list xlsx file, return download response."""
debtors = Debtor.objects.all()
wb = openpyxl.Workbook(write_only=True)
debtors_sheet = 'Debtors'
wb.create_sheet(debtors_sheet)
sheet = wb.get_sheet_by_name(debtors_sheet)
sheet.append(['First Name',... | Create Debtors list xlsx file, return download response. | Create Debtors list xlsx file, return download response. | [
"Create",
"Debtors",
"list",
"xlsx",
"file",
"return",
"download",
"response",
"."
] | def download_table(request):
debtors = Debtor.objects.all()
wb = openpyxl.Workbook(write_only=True)
debtors_sheet = 'Debtors'
wb.create_sheet(debtors_sheet)
sheet = wb.get_sheet_by_name(debtors_sheet)
sheet.append(['First Name', 'Last Name', 'ID', 'Contact'])
for details in debtors:
... | [
"def",
"download_table",
"(",
"request",
")",
":",
"debtors",
"=",
"Debtor",
".",
"objects",
".",
"all",
"(",
")",
"wb",
"=",
"openpyxl",
".",
"Workbook",
"(",
"write_only",
"=",
"True",
")",
"debtors_sheet",
"=",
"'Debtors'",
"wb",
".",
"create_sheet",
... | Create Debtors list xlsx file, return download response. | [
"Create",
"Debtors",
"list",
"xlsx",
"file",
"return",
"download",
"response",
"."
] | [
"\"\"\"Create Debtors list xlsx file, return download response.\"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4bdd498cb7972e6f0d25522da97781163c15ece3 | giantas/remoteref | debtinfo/views.py | [
"MIT"
] | Python | search_fields | <not_specific> | def search_fields(query_string, field_list, model):
"""Initialise database search of the query provided."""
entry_query = get_query(query_string, field_list)
found_entries = model.objects.filter(entry_query)
return found_entries | Initialise database search of the query provided. | Initialise database search of the query provided. | [
"Initialise",
"database",
"search",
"of",
"the",
"query",
"provided",
"."
] | def search_fields(query_string, field_list, model):
entry_query = get_query(query_string, field_list)
found_entries = model.objects.filter(entry_query)
return found_entries | [
"def",
"search_fields",
"(",
"query_string",
",",
"field_list",
",",
"model",
")",
":",
"entry_query",
"=",
"get_query",
"(",
"query_string",
",",
"field_list",
")",
"found_entries",
"=",
"model",
".",
"objects",
".",
"filter",
"(",
"entry_query",
")",
"return... | Initialise database search of the query provided. | [
"Initialise",
"database",
"search",
"of",
"the",
"query",
"provided",
"."
] | [
"\"\"\"Initialise database search of the query provided.\"\"\""
] | [
{
"param": "query_string",
"type": null
},
{
"param": "field_list",
"type": null
},
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "field_list",
"type": null,
"docstring": null,
"docstr... |
b512978e7018d8e4048268817f3dc0949e421ff6 | giantas/remoteref | accounts/forms.py | [
"MIT"
] | Python | email_token | null | def email_token(self, user):
"""Generate activation email and to user else write to file."""
token = default_token_generator.make_token(user)
uid = urlsafe_base64_encode(force_bytes(user.pk))
subject = 'Account Activation - Enstitute'
text_content = 'You have registered for an ac... | Generate activation email and to user else write to file. | Generate activation email and to user else write to file. | [
"Generate",
"activation",
"email",
"and",
"to",
"user",
"else",
"write",
"to",
"file",
"."
] | def email_token(self, user):
token = default_token_generator.make_token(user)
uid = urlsafe_base64_encode(force_bytes(user.pk))
subject = 'Account Activation - Enstitute'
text_content = 'You have registered for an account with Enstitute.'
activation_link = 'http://{0}/accounts/us... | [
"def",
"email_token",
"(",
"self",
",",
"user",
")",
":",
"token",
"=",
"default_token_generator",
".",
"make_token",
"(",
"user",
")",
"uid",
"=",
"urlsafe_base64_encode",
"(",
"force_bytes",
"(",
"user",
".",
"pk",
")",
")",
"subject",
"=",
"'Account Activ... | Generate activation email and to user else write to file. | [
"Generate",
"activation",
"email",
"and",
"to",
"user",
"else",
"write",
"to",
"file",
"."
] | [
"\"\"\"Generate activation email and to user else write to file.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "user",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user",
"type": null,
"docstring": null,
"docstring_tokens": [... |
75fedcdcc2a48d98ec72d83d5b2788dcdf589fea | m-kuhn/sqlfluff | src/sqlfluff/core/rules/std.py | [
"MIT"
] | Python | _eval | <not_specific> | def _eval(self, segment, raw_stack, **kwargs):
"""Incorrect indentation found in file."""
tab = "\t"
space = " "
correct_indent = (
space * self.tab_space_size if self.indent_unit == "space" else tab
)
wrong_indent = (
tab if self.indent_unit == "s... | Incorrect indentation found in file. | Incorrect indentation found in file. | [
"Incorrect",
"indentation",
"found",
"in",
"file",
"."
] | def _eval(self, segment, raw_stack, **kwargs):
tab = "\t"
space = " "
correct_indent = (
space * self.tab_space_size if self.indent_unit == "space" else tab
)
wrong_indent = (
tab if self.indent_unit == "space" else space * self.tab_space_size
)
... | [
"def",
"_eval",
"(",
"self",
",",
"segment",
",",
"raw_stack",
",",
"**",
"kwargs",
")",
":",
"tab",
"=",
"\"\\t\"",
"space",
"=",
"\" \"",
"correct_indent",
"=",
"(",
"space",
"*",
"self",
".",
"tab_space_size",
"if",
"self",
".",
"indent_unit",
"==",
... | Incorrect indentation found in file. | [
"Incorrect",
"indentation",
"found",
"in",
"file",
"."
] | [
"\"\"\"Incorrect indentation found in file.\"\"\"",
"# Ensure that the number of space indents is a multiple of tab_space_size",
"# before attempting to convert spaces to tabs to avoid mixed indents",
"# unless we are converted tabs to spaces (indent_unit = space)",
"# Only attempt a fix at the start of a n... | [
{
"param": "self",
"type": null
},
{
"param": "segment",
"type": null
},
{
"param": "raw_stack",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment",
"type": null,
"docstring": null,
"docstring_tokens"... |
75fedcdcc2a48d98ec72d83d5b2788dcdf589fea | m-kuhn/sqlfluff | src/sqlfluff/core/rules/std.py | [
"MIT"
] | Python | _eval | <not_specific> | def _eval(self, segment, **kwargs):
"""Blank line expected but not found after CTE definition."""
error_buffer = []
if segment.is_type("with_compound_statement"):
# First we need to find all the commas, the end brackets, the
# things that come after that and the blank lin... | Blank line expected but not found after CTE definition. | Blank line expected but not found after CTE definition. | [
"Blank",
"line",
"expected",
"but",
"not",
"found",
"after",
"CTE",
"definition",
"."
] | def _eval(self, segment, **kwargs):
error_buffer = []
if segment.is_type("with_compound_statement"):
bracket_indices = []
for idx, seg in enumerate(segment.segments):
if seg.is_type("end_bracket"):
bracket_indices.append(idx)
for br... | [
"def",
"_eval",
"(",
"self",
",",
"segment",
",",
"**",
"kwargs",
")",
":",
"error_buffer",
"=",
"[",
"]",
"if",
"segment",
".",
"is_type",
"(",
"\"with_compound_statement\"",
")",
":",
"bracket_indices",
"=",
"[",
"]",
"for",
"idx",
",",
"seg",
"in",
... | Blank line expected but not found after CTE definition. | [
"Blank",
"line",
"expected",
"but",
"not",
"found",
"after",
"CTE",
"definition",
"."
] | [
"\"\"\"Blank line expected but not found after CTE definition.\"\"\"",
"# First we need to find all the commas, the end brackets, the",
"# things that come after that and the blank lines in between.",
"# Find all the closing brackets. They are our anchor points.",
"# Work through each point and deal with it... | [
{
"param": "self",
"type": null
},
{
"param": "segment",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment",
"type": null,
"docstring": null,
"docstring_tokens"... |
eb3f7fd734568c9e35d988d674e5a47a88c899cb | stefmolin/python-data-viz-workshop | notebooks/utils.py | [
"MIT"
] | Python | run_env_check | null | def run_env_check():
"""Check that the packages we need are installed and the Python version is correct."""
# read in the environment file and process versions
with open('../environment.yml', 'r') as file:
env = yaml.safe_load(file)
requirements = {}
for req in env['dependencies']:
... | Check that the packages we need are installed and the Python version is correct. | Check that the packages we need are installed and the Python version is correct. | [
"Check",
"that",
"the",
"packages",
"we",
"need",
"are",
"installed",
"and",
"the",
"Python",
"version",
"is",
"correct",
"."
] | def run_env_check():
with open('../environment.yml', 'r') as file:
env = yaml.safe_load(file)
requirements = {}
for req in env['dependencies']:
pkg, version = req.split('=')
if '-' in pkg:
continue
requirements[pkg.split('::')[-1]] = version
print('Using Pytho... | [
"def",
"run_env_check",
"(",
")",
":",
"with",
"open",
"(",
"'../environment.yml'",
",",
"'r'",
")",
"as",
"file",
":",
"env",
"=",
"yaml",
".",
"safe_load",
"(",
"file",
")",
"requirements",
"=",
"{",
"}",
"for",
"req",
"in",
"env",
"[",
"'dependencie... | Check that the packages we need are installed and the Python version is correct. | [
"Check",
"that",
"the",
"packages",
"we",
"need",
"are",
"installed",
"and",
"the",
"Python",
"version",
"is",
"correct",
"."
] | [
"\"\"\"Check that the packages we need are installed and the Python version is correct.\"\"\"",
"# read in the environment file and process versions",
"# check the python version",
"# check the requirements"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b404b396b84282068d0bb01eba273b6fad6f1563 | nlevitt/cdxj-indexer | cdxj_indexer/postquery.py | [
"Apache-2.0"
] | Python | post_query_extract | <not_specific> | def post_query_extract(mime, length, stream):
"""
Extract a url-encoded form POST/PUT from stream
content length, return None
Attempt to decode application/x-www-form-urlencoded or multipart/*,
otherwise read whole block and b64encode
"""
post_query = b''
try:
length = int(lengt... |
Extract a url-encoded form POST/PUT from stream
content length, return None
Attempt to decode application/x-www-form-urlencoded or multipart/*,
otherwise read whole block and b64encode
| Extract a url-encoded form POST/PUT from stream
content length, return None
Attempt to decode application/x-www-form-urlencoded or multipart,
otherwise read whole block and b64encode | [
"Extract",
"a",
"url",
"-",
"encoded",
"form",
"POST",
"/",
"PUT",
"from",
"stream",
"content",
"length",
"return",
"None",
"Attempt",
"to",
"decode",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"or",
"multipart",
"otherwise",
"rea... | def post_query_extract(mime, length, stream):
post_query = b''
try:
length = int(length)
except (ValueError, TypeError):
return
if length <= 0:
return
while length > 0:
buff = stream.read(length)
length -= len(buff)
if not buff:
break
... | [
"def",
"post_query_extract",
"(",
"mime",
",",
"length",
",",
"stream",
")",
":",
"post_query",
"=",
"b''",
"try",
":",
"length",
"=",
"int",
"(",
"length",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"return",
"if",
"length",
"<=",
"... | Extract a url-encoded form POST/PUT from stream
content length, return None
Attempt to decode application/x-www-form-urlencoded or multipart/*,
otherwise read whole block and b64encode | [
"Extract",
"a",
"url",
"-",
"encoded",
"form",
"POST",
"/",
"PUT",
"from",
"stream",
"content",
"length",
"return",
"None",
"Attempt",
"to",
"decode",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"or",
"multipart",
"/",
"*",
"othe... | [
"\"\"\"\n Extract a url-encoded form POST/PUT from stream\n content length, return None\n Attempt to decode application/x-www-form-urlencoded or multipart/*,\n otherwise read whole block and b64encode\n \"\"\""
] | [
{
"param": "mime",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "stream",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mime",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens":... |
f965d8750bab9b09820eb8bf193d753b6a16e50f | Kyle-Tran/Game-of-Life | project/main.py | [
"MIT"
] | Python | conway_game | null | def conway_game(colorList, random):
"""
Creates field for Conway's Game of Life
"""
####################
# Initialize field #
####################
screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)
# screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)
scree... |
Creates field for Conway's Game of Life
| Creates field for Conway's Game of Life | [
"Creates",
"field",
"for",
"Conway",
"'",
"s",
"Game",
"of",
"Life"
] | def conway_game(colorList, random):
screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)
screen.fill(black)
conway.update(colorList[0], colorList[1], surface=screen)
conway.transition()
if random == "y" or random == "Y":
conway.random_field()
generation = 0
while True:
... | [
"def",
"conway_game",
"(",
"colorList",
",",
"random",
")",
":",
"screen",
"=",
"pygame",
".",
"display",
".",
"set_mode",
"(",
"(",
"1280",
",",
"720",
")",
",",
"pygame",
".",
"RESIZABLE",
")",
"screen",
".",
"fill",
"(",
"black",
")",
"conway",
".... | Creates field for Conway's Game of Life | [
"Creates",
"field",
"for",
"Conway",
"'",
"s",
"Game",
"of",
"Life"
] | [
"\"\"\"\n Creates field for Conway's Game of Life\n \"\"\"",
"####################",
"# Initialize field #",
"####################",
"# screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)",
"#############",
"# Game Loop #",
"#############",
"# Continually iterates through generati... | [
{
"param": "colorList",
"type": null
},
{
"param": "random",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "colorList",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "random",
"type": null,
"docstring": null,
"docstring_tok... |
f965d8750bab9b09820eb8bf193d753b6a16e50f | Kyle-Tran/Game-of-Life | project/main.py | [
"MIT"
] | Python | rps_game | null | def rps_game(colorList, random):
"""
Creates field for ternary/quinary multi-state world
"""
####################
# Initialize field #
####################
screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)
# screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)
... |
Creates field for ternary/quinary multi-state world
| Creates field for ternary/quinary multi-state world | [
"Creates",
"field",
"for",
"ternary",
"/",
"quinary",
"multi",
"-",
"state",
"world"
] | def rps_game(colorList, random):
screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)
screen.fill(black)
rps.update(colorList[0], colorList[1], colorList[2], colorList[3], colorList[4], surface=screen)
rps.transition()
if random == "y" or random == "Y":
rps.random_field()
gene... | [
"def",
"rps_game",
"(",
"colorList",
",",
"random",
")",
":",
"screen",
"=",
"pygame",
".",
"display",
".",
"set_mode",
"(",
"(",
"1280",
",",
"720",
")",
",",
"pygame",
".",
"RESIZABLE",
")",
"screen",
".",
"fill",
"(",
"black",
")",
"rps",
".",
"... | Creates field for ternary/quinary multi-state world | [
"Creates",
"field",
"for",
"ternary",
"/",
"quinary",
"multi",
"-",
"state",
"world"
] | [
"\"\"\"\n Creates field for ternary/quinary multi-state world\n \"\"\"",
"####################",
"# Initialize field #",
"####################",
"# screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)",
"#############",
"# Game Loop #",
"#############",
"# Continually iterates thro... | [
{
"param": "colorList",
"type": null
},
{
"param": "random",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "colorList",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "random",
"type": null,
"docstring": null,
"docstring_tok... |
f965d8750bab9b09820eb8bf193d753b6a16e50f | Kyle-Tran/Game-of-Life | project/main.py | [
"MIT"
] | Python | langtons_ant | null | def langtons_ant():
"""
Creates field for Langton's ant
"""
####################
# Initialize field #
####################
# screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)
screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)
screen.fill(black)
langto... |
Creates field for Langton's ant
| Creates field for Langton's ant | [
"Creates",
"field",
"for",
"Langton",
"'",
"s",
"ant"
] | def langtons_ant():
screen = pygame.display.set_mode(size_monitor, pygame.RESIZABLE)
screen.fill(black)
langton.reset(screen)
langton.transition(screen)
generation = 0
while True:
pygame.display.set_caption(
"Langston's Ant - Generation " + str(generation))
keys = pyg... | [
"def",
"langtons_ant",
"(",
")",
":",
"screen",
"=",
"pygame",
".",
"display",
".",
"set_mode",
"(",
"size_monitor",
",",
"pygame",
".",
"RESIZABLE",
")",
"screen",
".",
"fill",
"(",
"black",
")",
"langton",
".",
"reset",
"(",
"screen",
")",
"langton",
... | Creates field for Langton's ant | [
"Creates",
"field",
"for",
"Langton",
"'",
"s",
"ant"
] | [
"\"\"\"\n Creates field for Langton's ant\n \"\"\"",
"####################",
"# Initialize field #",
"####################",
"# screen = pygame.display.set_mode((1280, 720), pygame.RESIZABLE)",
"#############",
"# Game Loop #",
"#############",
"# clock.tick(fps) # Comment out for fastest per... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | update | null | def update(self, dead, live, surface):
"""
Updates cells color correlating to dead or live
"""
for x in range(self.rows):
for y in range(self.columns):
x_pos, y_pos = x * self.scale, y * self.scale
if self.curr_array[x][y] == 1:
... |
Updates cells color correlating to dead or live
| Updates cells color correlating to dead or live | [
"Updates",
"cells",
"color",
"correlating",
"to",
"dead",
"or",
"live"
] | def update(self, dead, live, surface):
for x in range(self.rows):
for y in range(self.columns):
x_pos, y_pos = x * self.scale, y * self.scale
if self.curr_array[x][y] == 1:
pygame.draw.rect(surface, live,
[x_pos... | [
"def",
"update",
"(",
"self",
",",
"dead",
",",
"live",
",",
"surface",
")",
":",
"for",
"x",
"in",
"range",
"(",
"self",
".",
"rows",
")",
":",
"for",
"y",
"in",
"range",
"(",
"self",
".",
"columns",
")",
":",
"x_pos",
",",
"y_pos",
"=",
"x",
... | Updates cells color correlating to dead or live | [
"Updates",
"cells",
"color",
"correlating",
"to",
"dead",
"or",
"live"
] | [
"\"\"\"\n Updates cells color correlating to dead or live\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dead",
"type": null
},
{
"param": "live",
"type": null
},
{
"param": "surface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dead",
"type": null,
"docstring": null,
"docstring_tokens": [... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | click | null | def click(self, pos):
"""
Clicking on cell will change it's state from dead to live or vice versa
"""
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
if self.curr_array[x][y] == 1:
self.curr_array[x][y] = 0
else:
self.curr_array[x][y] = 1 |
Clicking on cell will change it's state from dead to live or vice versa
| Clicking on cell will change it's state from dead to live or vice versa | [
"Clicking",
"on",
"cell",
"will",
"change",
"it",
"'",
"s",
"state",
"from",
"dead",
"to",
"live",
"or",
"vice",
"versa"
] | def click(self, pos):
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
if self.curr_array[x][y] == 1:
self.curr_array[x][y] = 0
else:
self.curr_array[x][y] = 1 | [
"def",
"click",
"(",
"self",
",",
"pos",
")",
":",
"x",
",",
"y",
"=",
"int",
"(",
"pos",
"[",
"0",
"]",
"/",
"self",
".",
"scale",
")",
",",
"int",
"(",
"pos",
"[",
"1",
"]",
"/",
"self",
".",
"scale",
")",
"if",
"self",
".",
"curr_array",... | Clicking on cell will change it's state from dead to live or vice versa | [
"Clicking",
"on",
"cell",
"will",
"change",
"it",
"'",
"s",
"state",
"from",
"dead",
"to",
"live",
"or",
"vice",
"versa"
] | [
"\"\"\"\n Clicking on cell will change it's state from dead to live or vice versa\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pos",
"type": null,
"docstring": null,
"docstring_tokens": []... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | reset | null | def reset(self):
"""
Clears entire field to all dead cells
"""
for x in range(self.rows):
for y in range(self.columns):
self.curr_array[x][y] = 0 |
Clears entire field to all dead cells
| Clears entire field to all dead cells | [
"Clears",
"entire",
"field",
"to",
"all",
"dead",
"cells"
] | def reset(self):
for x in range(self.rows):
for y in range(self.columns):
self.curr_array[x][y] = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"for",
"x",
"in",
"range",
"(",
"self",
".",
"rows",
")",
":",
"for",
"y",
"in",
"range",
"(",
"self",
".",
"columns",
")",
":",
"self",
".",
"curr_array",
"[",
"x",
"]",
"[",
"y",
"]",
"=",
"0"
] | Clears entire field to all dead cells | [
"Clears",
"entire",
"field",
"to",
"all",
"dead",
"cells"
] | [
"\"\"\"\n Clears entire field to all dead cells\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | click | null | def click(self, pos, choice):
"""
Clicking on cell will change it's state to choice of color currently pressed (1-5)
Default is white
"""
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
self.curr_array[x][y] = choice |
Clicking on cell will change it's state to choice of color currently pressed (1-5)
Default is white
| Clicking on cell will change it's state to choice of color currently pressed (1-5)
Default is white | [
"Clicking",
"on",
"cell",
"will",
"change",
"it",
"'",
"s",
"state",
"to",
"choice",
"of",
"color",
"currently",
"pressed",
"(",
"1",
"-",
"5",
")",
"Default",
"is",
"white"
] | def click(self, pos, choice):
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
self.curr_array[x][y] = choice | [
"def",
"click",
"(",
"self",
",",
"pos",
",",
"choice",
")",
":",
"x",
",",
"y",
"=",
"int",
"(",
"pos",
"[",
"0",
"]",
"/",
"self",
".",
"scale",
")",
",",
"int",
"(",
"pos",
"[",
"1",
"]",
"/",
"self",
".",
"scale",
")",
"self",
".",
"c... | Clicking on cell will change it's state to choice of color currently pressed (1-5)
Default is white | [
"Clicking",
"on",
"cell",
"will",
"change",
"it",
"'",
"s",
"state",
"to",
"choice",
"of",
"color",
"currently",
"pressed",
"(",
"1",
"-",
"5",
")",
"Default",
"is",
"white"
] | [
"\"\"\"\n Clicking on cell will change it's state to choice of color currently pressed (1-5)\n Default is white\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pos",
"type": null
},
{
"param": "choice",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pos",
"type": null,
"docstring": null,
"docstring_tokens": []... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | transition | null | def transition(self, surface):
"""
Updates cells colors on field between each transition
"""
ant_xpos, ant_ypos = self.ant[0], self.ant[1]
ant_xcoord, ant_ycoord = ant_xpos * self.scale, ant_ypos * self.scale
if self.curr_array[ant_xpos][ant_ypos] == -1: # curr cell is ... |
Updates cells colors on field between each transition
| Updates cells colors on field between each transition | [
"Updates",
"cells",
"colors",
"on",
"field",
"between",
"each",
"transition"
] | def transition(self, surface):
ant_xpos, ant_ypos = self.ant[0], self.ant[1]
ant_xcoord, ant_ycoord = ant_xpos * self.scale, ant_ypos * self.scale
if self.curr_array[ant_xpos][ant_ypos] == -1:
self.curr_array[ant_xpos][ant_ypos] = 0
self.rotate(self.rules[0])
... | [
"def",
"transition",
"(",
"self",
",",
"surface",
")",
":",
"ant_xpos",
",",
"ant_ypos",
"=",
"self",
".",
"ant",
"[",
"0",
"]",
",",
"self",
".",
"ant",
"[",
"1",
"]",
"ant_xcoord",
",",
"ant_ycoord",
"=",
"ant_xpos",
"*",
"self",
".",
"scale",
",... | Updates cells colors on field between each transition | [
"Updates",
"cells",
"colors",
"on",
"field",
"between",
"each",
"transition"
] | [
"\"\"\"\n Updates cells colors on field between each transition\n \"\"\"",
"# curr cell is white (default)",
"# change cell to first color",
"# rotate direction based on first rule",
"# Update color of cell ant is currently on",
"# Move ant forward in current direction",
"# Draw ant on tha... | [
{
"param": "self",
"type": null
},
{
"param": "surface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "surface",
"type": null,
"docstring": null,
"docstring_tokens"... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | move | null | def move(self):
"""
Changes ant's current location to cell 1 away in it's current direction
"""
x, y = self.ant[0], self.ant[1]
# Stitches field for when ant is at edge
addx, addy = (x + 1) % self.rows, (y+1) % self.columns
minusx, minusy = (x - 1) % self.rows, (y... |
Changes ant's current location to cell 1 away in it's current direction
| Changes ant's current location to cell 1 away in it's current direction | [
"Changes",
"ant",
"'",
"s",
"current",
"location",
"to",
"cell",
"1",
"away",
"in",
"it",
"'",
"s",
"current",
"direction"
] | def move(self):
x, y = self.ant[0], self.ant[1]
addx, addy = (x + 1) % self.rows, (y+1) % self.columns
minusx, minusy = (x - 1) % self.rows, (y - 1) % self.columns
if self.direction == "N":
self.ant = (x, minusy)
elif self.direction == "E":
self.ant = (add... | [
"def",
"move",
"(",
"self",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"ant",
"[",
"0",
"]",
",",
"self",
".",
"ant",
"[",
"1",
"]",
"addx",
",",
"addy",
"=",
"(",
"x",
"+",
"1",
")",
"%",
"self",
".",
"rows",
",",
"(",
"y",
"+",
"1",
... | Changes ant's current location to cell 1 away in it's current direction | [
"Changes",
"ant",
"'",
"s",
"current",
"location",
"to",
"cell",
"1",
"away",
"in",
"it",
"'",
"s",
"current",
"direction"
] | [
"\"\"\"\n Changes ant's current location to cell 1 away in it's current direction\n \"\"\"",
"# Stitches field for when ant is at edge"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | rotate | null | def rotate(self, rule):
"""
Changes current direction based on rule
"""
if rule == "R":
if self.direction == "N":
self.direction = "E"
elif self.direction == "E":
self.direction = "S"
elif self.direction == "S":
... |
Changes current direction based on rule
| Changes current direction based on rule | [
"Changes",
"current",
"direction",
"based",
"on",
"rule"
] | def rotate(self, rule):
if rule == "R":
if self.direction == "N":
self.direction = "E"
elif self.direction == "E":
self.direction = "S"
elif self.direction == "S":
self.direction = "W"
elif self.direction == "W":
... | [
"def",
"rotate",
"(",
"self",
",",
"rule",
")",
":",
"if",
"rule",
"==",
"\"R\"",
":",
"if",
"self",
".",
"direction",
"==",
"\"N\"",
":",
"self",
".",
"direction",
"=",
"\"E\"",
"elif",
"self",
".",
"direction",
"==",
"\"E\"",
":",
"self",
".",
"d... | Changes current direction based on rule | [
"Changes",
"current",
"direction",
"based",
"on",
"rule"
] | [
"\"\"\"\n Changes current direction based on rule\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "rule",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rule",
"type": null,
"docstring": null,
"docstring_tokens": [... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | click | null | def click(self, pos, direction, surface):
"""
Clicking on cell spawns ant in specified direction
"""
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
prev_x, prev_y = self.ant[0] * self.scale, self.ant[1] * self.scale
new_x, new_y = x * self.scale, y * self.scale... |
Clicking on cell spawns ant in specified direction
| Clicking on cell spawns ant in specified direction | [
"Clicking",
"on",
"cell",
"spawns",
"ant",
"in",
"specified",
"direction"
] | def click(self, pos, direction, surface):
x, y = int(pos[0] / self.scale), int(pos[1] / self.scale)
prev_x, prev_y = self.ant[0] * self.scale, self.ant[1] * self.scale
new_x, new_y = x * self.scale, y * self.scale
if self.ant != (-1, -1):
self.curr_array[self.ant[0], self.a... | [
"def",
"click",
"(",
"self",
",",
"pos",
",",
"direction",
",",
"surface",
")",
":",
"x",
",",
"y",
"=",
"int",
"(",
"pos",
"[",
"0",
"]",
"/",
"self",
".",
"scale",
")",
",",
"int",
"(",
"pos",
"[",
"1",
"]",
"/",
"self",
".",
"scale",
")"... | Clicking on cell spawns ant in specified direction | [
"Clicking",
"on",
"cell",
"spawns",
"ant",
"in",
"specified",
"direction"
] | [
"\"\"\"\n Clicking on cell spawns ant in specified direction\n \"\"\"",
"# There is an ant on the field currently",
"# make sure previous cell where ant was can still update later",
"# by making that cell empty (white)",
"# On clicking, deletes previous ant",
"# Creates new ant in specified ... | [
{
"param": "self",
"type": null
},
{
"param": "pos",
"type": null
},
{
"param": "direction",
"type": null
},
{
"param": "surface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pos",
"type": null,
"docstring": null,
"docstring_tokens": []... |
7ead05d3f9b40123d5b838866a8a290b3a4e5104 | Kyle-Tran/Game-of-Life | project/grid.py | [
"MIT"
] | Python | reset | null | def reset(self, surface):
"""
Clears entire field to all dead cells
"""
for x in range(self.rows):
for y in range(self.columns):
x_pos, y_pos = x * self.scale, y * self.scale
self.curr_array[x][y] = -1 # initial field array to all empty (-1)
... |
Clears entire field to all dead cells
| Clears entire field to all dead cells | [
"Clears",
"entire",
"field",
"to",
"all",
"dead",
"cells"
] | def reset(self, surface):
for x in range(self.rows):
for y in range(self.columns):
x_pos, y_pos = x * self.scale, y * self.scale
self.curr_array[x][y] = -1
pygame.draw.rect(surface, (255, 255, 255),
[x_pos, y_pos, sel... | [
"def",
"reset",
"(",
"self",
",",
"surface",
")",
":",
"for",
"x",
"in",
"range",
"(",
"self",
".",
"rows",
")",
":",
"for",
"y",
"in",
"range",
"(",
"self",
".",
"columns",
")",
":",
"x_pos",
",",
"y_pos",
"=",
"x",
"*",
"self",
".",
"scale",
... | Clears entire field to all dead cells | [
"Clears",
"entire",
"field",
"to",
"all",
"dead",
"cells"
] | [
"\"\"\"\n Clears entire field to all dead cells\n \"\"\"",
"# initial field array to all empty (-1)"
] | [
{
"param": "self",
"type": null
},
{
"param": "surface",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "surface",
"type": null,
"docstring": null,
"docstring_tokens"... |
340edf12856b6d5bd37c0efe3a8dc56df31b0b0d | tanayz/Kaggle | Search_result/srr3.py | [
"Apache-2.0"
] | Python | confusion_matrix | <not_specific> | def confusion_matrix(rater_a, rater_b, min_rating=None, max_rating=None):
"""
Returns the confusion matrix between rater's ratings
"""
assert(len(rater_a) == len(rater_b))
if min_rating is None:
min_rating = min(rater_a + rater_b)
if max_rating is None:
max_rating = max(rater_a +... |
Returns the confusion matrix between rater's ratings
| Returns the confusion matrix between rater's ratings | [
"Returns",
"the",
"confusion",
"matrix",
"between",
"rater",
"'",
"s",
"ratings"
] | def confusion_matrix(rater_a, rater_b, min_rating=None, max_rating=None):
assert(len(rater_a) == len(rater_b))
if min_rating is None:
min_rating = min(rater_a + rater_b)
if max_rating is None:
max_rating = max(rater_a + rater_b)
num_ratings = int(max_rating - min_rating + 1)
conf_mat... | [
"def",
"confusion_matrix",
"(",
"rater_a",
",",
"rater_b",
",",
"min_rating",
"=",
"None",
",",
"max_rating",
"=",
"None",
")",
":",
"assert",
"(",
"len",
"(",
"rater_a",
")",
"==",
"len",
"(",
"rater_b",
")",
")",
"if",
"min_rating",
"is",
"None",
":"... | Returns the confusion matrix between rater's ratings | [
"Returns",
"the",
"confusion",
"matrix",
"between",
"rater",
"'",
"s",
"ratings"
] | [
"\"\"\"\n Returns the confusion matrix between rater's ratings\n \"\"\""
] | [
{
"param": "rater_a",
"type": null
},
{
"param": "rater_b",
"type": null
},
{
"param": "min_rating",
"type": null
},
{
"param": "max_rating",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rater_a",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rater_b",
"type": null,
"docstring": null,
"docstring_toke... |
340edf12856b6d5bd37c0efe3a8dc56df31b0b0d | tanayz/Kaggle | Search_result/srr3.py | [
"Apache-2.0"
] | Python | histogram | <not_specific> | def histogram(ratings, min_rating=None, max_rating=None):
"""
Returns the counts of each type of rating that a rater made
"""
if min_rating is None:
min_rating = min(ratings)
if max_rating is None:
max_rating = max(ratings)
num_ratings = int(max_rating - min_rating + 1)
hist_... |
Returns the counts of each type of rating that a rater made
| Returns the counts of each type of rating that a rater made | [
"Returns",
"the",
"counts",
"of",
"each",
"type",
"of",
"rating",
"that",
"a",
"rater",
"made"
] | def histogram(ratings, min_rating=None, max_rating=None):
if min_rating is None:
min_rating = min(ratings)
if max_rating is None:
max_rating = max(ratings)
num_ratings = int(max_rating - min_rating + 1)
hist_ratings = [0 for x in range(num_ratings)]
for r in ratings:
hist_rat... | [
"def",
"histogram",
"(",
"ratings",
",",
"min_rating",
"=",
"None",
",",
"max_rating",
"=",
"None",
")",
":",
"if",
"min_rating",
"is",
"None",
":",
"min_rating",
"=",
"min",
"(",
"ratings",
")",
"if",
"max_rating",
"is",
"None",
":",
"max_rating",
"=",
... | Returns the counts of each type of rating that a rater made | [
"Returns",
"the",
"counts",
"of",
"each",
"type",
"of",
"rating",
"that",
"a",
"rater",
"made"
] | [
"\"\"\"\n Returns the counts of each type of rating that a rater made\n \"\"\""
] | [
{
"param": "ratings",
"type": null
},
{
"param": "min_rating",
"type": null
},
{
"param": "max_rating",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ratings",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "min_rating",
"type": null,
"docstring": null,
"docstring_t... |
340edf12856b6d5bd37c0efe3a8dc56df31b0b0d | tanayz/Kaggle | Search_result/srr3.py | [
"Apache-2.0"
] | Python | quadratic_weighted_kappa | <not_specific> | def quadratic_weighted_kappa(y, y_pred):
"""
Calculates the quadratic weighted kappa
axquadratic_weighted_kappa calculates the quadratic weighted kappa
value, which is a measure of inter-rater agreement between two raters
that provide discrete numeric ratings. Potential values range from -1
(re... |
Calculates the quadratic weighted kappa
axquadratic_weighted_kappa calculates the quadratic weighted kappa
value, which is a measure of inter-rater agreement between two raters
that provide discrete numeric ratings. Potential values range from -1
(representing complete disagreement) to 1 (represen... | Calculates the quadratic weighted kappa
axquadratic_weighted_kappa calculates the quadratic weighted kappa
value, which is a measure of inter-rater agreement between two raters
that provide discrete numeric ratings. Potential values range from -1
(representing complete disagreement) to 1 (representing complete
agreeme... | [
"Calculates",
"the",
"quadratic",
"weighted",
"kappa",
"axquadratic_weighted_kappa",
"calculates",
"the",
"quadratic",
"weighted",
"kappa",
"value",
"which",
"is",
"a",
"measure",
"of",
"inter",
"-",
"rater",
"agreement",
"between",
"two",
"raters",
"that",
"provide... | def quadratic_weighted_kappa(y, y_pred):
rater_a = y
rater_b = y_pred
min_rating=None
max_rating=None
rater_a = np.array(rater_a, dtype=int)
rater_b = np.array(rater_b, dtype=int)
assert(len(rater_a) == len(rater_b))
if min_rating is None:
min_rating = min(min(rater_a), min(rater... | [
"def",
"quadratic_weighted_kappa",
"(",
"y",
",",
"y_pred",
")",
":",
"rater_a",
"=",
"y",
"rater_b",
"=",
"y_pred",
"min_rating",
"=",
"None",
"max_rating",
"=",
"None",
"rater_a",
"=",
"np",
".",
"array",
"(",
"rater_a",
",",
"dtype",
"=",
"int",
")",
... | Calculates the quadratic weighted kappa
axquadratic_weighted_kappa calculates the quadratic weighted kappa
value, which is a measure of inter-rater agreement between two raters
that provide discrete numeric ratings. | [
"Calculates",
"the",
"quadratic",
"weighted",
"kappa",
"axquadratic_weighted_kappa",
"calculates",
"the",
"quadratic",
"weighted",
"kappa",
"value",
"which",
"is",
"a",
"measure",
"of",
"inter",
"-",
"rater",
"agreement",
"between",
"two",
"raters",
"that",
"provide... | [
"\"\"\"\n Calculates the quadratic weighted kappa\n axquadratic_weighted_kappa calculates the quadratic weighted kappa\n value, which is a measure of inter-rater agreement between two raters\n that provide discrete numeric ratings. Potential values range from -1\n (representing complete disagreement... | [
{
"param": "y",
"type": null
},
{
"param": "y_pred",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y_pred",
"type": null,
"docstring": null,
"docstring_tokens": []... |
863c10766382759f8d32de8b5fa83e85c697b32b | tanayz/Kaggle | HB_ML_Challenge/test_xgboost.py | [
"Apache-2.0"
] | Python | AMS | <not_specific> | def AMS(s, b):
'''
Approximate median significance:
s = true positive rate
b = false positive rate
'''
assert s >= 0
assert b >= 0
bReg = 10.
return np.sqrt(2.0 * ((s + b + bReg) * np.log(1 + s / (b + bReg)) - s)) |
Approximate median significance:
s = true positive rate
b = false positive rate
| Approximate median significance:
s = true positive rate
b = false positive rate | [
"Approximate",
"median",
"significance",
":",
"s",
"=",
"true",
"positive",
"rate",
"b",
"=",
"false",
"positive",
"rate"
] | def AMS(s, b):
assert s >= 0
assert b >= 0
bReg = 10.
return np.sqrt(2.0 * ((s + b + bReg) * np.log(1 + s / (b + bReg)) - s)) | [
"def",
"AMS",
"(",
"s",
",",
"b",
")",
":",
"assert",
"s",
">=",
"0",
"assert",
"b",
">=",
"0",
"bReg",
"=",
"10.",
"return",
"np",
".",
"sqrt",
"(",
"2.0",
"*",
"(",
"(",
"s",
"+",
"b",
"+",
"bReg",
")",
"*",
"np",
".",
"log",
"(",
"1",
... | Approximate median significance:
s = true positive rate
b = false positive rate | [
"Approximate",
"median",
"significance",
":",
"s",
"=",
"true",
"positive",
"rate",
"b",
"=",
"false",
"positive",
"rate"
] | [
"'''\n Approximate median significance:\n s = true positive rate\n b = false positive rate\n '''"
] | [
{
"param": "s",
"type": null
},
{
"param": "b",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
8d9b3417674f0e53d5809a6e1d47fbcec1359e50 | tanayz/Kaggle | SAM/model.py | [
"Apache-2.0"
] | Python | print_GridCV_scores | null | def print_GridCV_scores(gs_clf, export_file):
'''Exports a CSV of the GridCV scores.
gs_clf: A GridSearchCV object which has been fitted
export_file: A file path
Example output (file content):
mean,std,feat__words__ngram_range,feat__words__stop_words,clf__alpha
0.56805074971164937,0.0082019735998974941,"(1, 2)"... | Exports a CSV of the GridCV scores.
gs_clf: A GridSearchCV object which has been fitted
export_file: A file path
Example output (file content):
mean,std,feat__words__ngram_range,feat__words__stop_words,clf__alpha
0.56805074971164937,0.0082019735998974941,"(1, 2)",english,0.0001
0.57189542483660127,0.00663847238... | Exports a CSV of the GridCV scores.
gs_clf: A GridSearchCV object which has been fitted
export_file: A file path
| [
"Exports",
"a",
"CSV",
"of",
"the",
"GridCV",
"scores",
".",
"gs_clf",
":",
"A",
"GridSearchCV",
"object",
"which",
"has",
"been",
"fitted",
"export_file",
":",
"A",
"file",
"path"
] | def print_GridCV_scores(gs_clf, export_file):
with open(export_file, 'w') as outfile:
csvwriter = csv.writer(outfile, delimiter=',')
header = ["mean","std"]
param_names = [param for param in gs_clf.param_grid]
header.extend(param_names)
csvwriter.writerow(header)
for config in gs_clf.grid_scores_:
mean ... | [
"def",
"print_GridCV_scores",
"(",
"gs_clf",
",",
"export_file",
")",
":",
"with",
"open",
"(",
"export_file",
",",
"'w'",
")",
"as",
"outfile",
":",
"csvwriter",
"=",
"csv",
".",
"writer",
"(",
"outfile",
",",
"delimiter",
"=",
"','",
")",
"header",
"="... | Exports a CSV of the GridCV scores. | [
"Exports",
"a",
"CSV",
"of",
"the",
"GridCV",
"scores",
"."
] | [
"'''Exports a CSV of the GridCV scores.\n\n\tgs_clf: A GridSearchCV object which has been fitted\n\texport_file: A file path\n\n\tExample output (file content):\n\tmean,std,feat__words__ngram_range,feat__words__stop_words,clf__alpha\n\t0.56805074971164937,0.0082019735998974941,\"(1, 2)\",english,0.0001\n\t0.5718954... | [
{
"param": "gs_clf",
"type": null
},
{
"param": "export_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gs_clf",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "export_file",
"type": null,
"docstring": null,
"docstring_t... |
4e17dafcfcb857d9164a0d21cf8b3a0f6ac2f5b5 | tanayz/Kaggle | HB_ML_Challenge/xgboostR/wrapper/xgboost.py | [
"Apache-2.0"
] | Python | update | null | def update(self, dtrain, it):
"""
update
dtrain: the training DMatrix
it: current iteration number
"""
assert isinstance(dtrain, DMatrix)
xglib.XGBoosterUpdateOneIter(self.handle, it, dtrain.handle) |
update
dtrain: the training DMatrix
it: current iteration number
| update
dtrain: the training DMatrix
it: current iteration number | [
"update",
"dtrain",
":",
"the",
"training",
"DMatrix",
"it",
":",
"current",
"iteration",
"number"
] | def update(self, dtrain, it):
assert isinstance(dtrain, DMatrix)
xglib.XGBoosterUpdateOneIter(self.handle, it, dtrain.handle) | [
"def",
"update",
"(",
"self",
",",
"dtrain",
",",
"it",
")",
":",
"assert",
"isinstance",
"(",
"dtrain",
",",
"DMatrix",
")",
"xglib",
".",
"XGBoosterUpdateOneIter",
"(",
"self",
".",
"handle",
",",
"it",
",",
"dtrain",
".",
"handle",
")"
] | update
dtrain: the training DMatrix
it: current iteration number | [
"update",
"dtrain",
":",
"the",
"training",
"DMatrix",
"it",
":",
"current",
"iteration",
"number"
] | [
"\"\"\"\n update\n dtrain: the training DMatrix\n it: current iteration number\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dtrain",
"type": null
},
{
"param": "it",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dtrain",
"type": null,
"docstring": null,
"docstring_tokens":... |
4e17dafcfcb857d9164a0d21cf8b3a0f6ac2f5b5 | tanayz/Kaggle | HB_ML_Challenge/xgboostR/wrapper/xgboost.py | [
"Apache-2.0"
] | Python | predict | <not_specific> | def predict(self, data, output_margin=False):
"""
predict with data
data: the dmatrix storing the input
output_margin: whether output raw margin value that is untransformed
"""
length = ctypes.c_ulong()
preds = xglib.XGBoosterPredict(self.handle, data.hand... |
predict with data
data: the dmatrix storing the input
output_margin: whether output raw margin value that is untransformed
| predict with data
data: the dmatrix storing the input
output_margin: whether output raw margin value that is untransformed | [
"predict",
"with",
"data",
"data",
":",
"the",
"dmatrix",
"storing",
"the",
"input",
"output_margin",
":",
"whether",
"output",
"raw",
"margin",
"value",
"that",
"is",
"untransformed"
] | def predict(self, data, output_margin=False):
length = ctypes.c_ulong()
preds = xglib.XGBoosterPredict(self.handle, data.handle,
int(output_margin), ctypes.byref(length))
return ctypes2numpy(preds, length.value, 'float32') | [
"def",
"predict",
"(",
"self",
",",
"data",
",",
"output_margin",
"=",
"False",
")",
":",
"length",
"=",
"ctypes",
".",
"c_ulong",
"(",
")",
"preds",
"=",
"xglib",
".",
"XGBoosterPredict",
"(",
"self",
".",
"handle",
",",
"data",
".",
"handle",
",",
... | predict with data
data: the dmatrix storing the input
output_margin: whether output raw margin value that is untransformed | [
"predict",
"with",
"data",
"data",
":",
"the",
"dmatrix",
"storing",
"the",
"input",
"output_margin",
":",
"whether",
"output",
"raw",
"margin",
"value",
"that",
"is",
"untransformed"
] | [
"\"\"\"\n predict with data\n data: the dmatrix storing the input\n output_margin: whether output raw margin value that is untransformed\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "output_margin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4e17dafcfcb857d9164a0d21cf8b3a0f6ac2f5b5 | tanayz/Kaggle | HB_ML_Challenge/xgboostR/wrapper/xgboost.py | [
"Apache-2.0"
] | Python | train | <not_specific> | def train(params, dtrain, num_boost_round = 10, evals = [], obj=None, feval=None):
""" train a booster with given paramaters """
bst = Booster(params, [dtrain]+[ d[0] for d in evals ] )
if obj == None:
for i in range(num_boost_round):
bst.update( dtrain, i )
if len(evals) != ... | train a booster with given paramaters | train a booster with given paramaters | [
"train",
"a",
"booster",
"with",
"given",
"paramaters"
] | def train(params, dtrain, num_boost_round = 10, evals = [], obj=None, feval=None):
bst = Booster(params, [dtrain]+[ d[0] for d in evals ] )
if obj == None:
for i in range(num_boost_round):
bst.update( dtrain, i )
if len(evals) != 0:
sys.stderr.write(evaluate(bst, ... | [
"def",
"train",
"(",
"params",
",",
"dtrain",
",",
"num_boost_round",
"=",
"10",
",",
"evals",
"=",
"[",
"]",
",",
"obj",
"=",
"None",
",",
"feval",
"=",
"None",
")",
":",
"bst",
"=",
"Booster",
"(",
"params",
",",
"[",
"dtrain",
"]",
"+",
"[",
... | train a booster with given paramaters | [
"train",
"a",
"booster",
"with",
"given",
"paramaters"
] | [
"\"\"\" train a booster with given paramaters \"\"\"",
"# try customized objective function"
] | [
{
"param": "params",
"type": null
},
{
"param": "dtrain",
"type": null
},
{
"param": "num_boost_round",
"type": null
},
{
"param": "evals",
"type": null
},
{
"param": "obj",
"type": null
},
{
"param": "feval",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "params",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dtrain",
"type": null,
"docstring": null,
"docstring_tokens... |
32a599c86dd7359a9e354303582e8fb7e22c27f5 | tanayz/Kaggle | Search_result/autocrct.py | [
"Apache-2.0"
] | Python | autocorrect_query | <not_specific> | def autocorrect_query(query,train=None,test=None,cutoff=0.8,warning_on=True):
"""
autocorrect a query based on the training set
"""
if train is None:
train = pd.read_csv('../input/train.csv').fillna('')
if test is None:
test = pd.read_csv('../input/test.csv').fillna('')
train_data = train.values[train['query... |
autocorrect a query based on the training set
| autocorrect a query based on the training set | [
"autocorrect",
"a",
"query",
"based",
"on",
"the",
"training",
"set"
] | def autocorrect_query(query,train=None,test=None,cutoff=0.8,warning_on=True):
if train is None:
train = pd.read_csv('../input/train.csv').fillna('')
if test is None:
test = pd.read_csv('../input/test.csv').fillna('')
train_data = train.values[train['query'].values==query,:]
test_data = test.values[test['query']... | [
"def",
"autocorrect_query",
"(",
"query",
",",
"train",
"=",
"None",
",",
"test",
"=",
"None",
",",
"cutoff",
"=",
"0.8",
",",
"warning_on",
"=",
"True",
")",
":",
"if",
"train",
"is",
"None",
":",
"train",
"=",
"pd",
".",
"read_csv",
"(",
"'../input... | autocorrect a query based on the training set | [
"autocorrect",
"a",
"query",
"based",
"on",
"the",
"training",
"set"
] | [
"\"\"\"\n\tautocorrect a query based on the training set\n\t\"\"\""
] | [
{
"param": "query",
"type": null
},
{
"param": "train",
"type": null
},
{
"param": "test",
"type": null
},
{
"param": "cutoff",
"type": null
},
{
"param": "warning_on",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "train",
"type": null,
"docstring": null,
"docstring_tokens":... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | shear_matrix | <not_specific> | def shear_matrix(striu):
"""Convert a 3x3 matrix representation of shear to a 4x4 representation
:striu: A 3x3 shear matrix
:return: A 4x4 shear matrix
"""
S = np.identity(4)
S[:3, :3] = striu2mat(striu)
return S | Convert a 3x3 matrix representation of shear to a 4x4 representation
:striu: A 3x3 shear matrix
:return: A 4x4 shear matrix
| Convert a 3x3 matrix representation of shear to a 4x4 representation | [
"Convert",
"a",
"3x3",
"matrix",
"representation",
"of",
"shear",
"to",
"a",
"4x4",
"representation"
] | def shear_matrix(striu):
S = np.identity(4)
S[:3, :3] = striu2mat(striu)
return S | [
"def",
"shear_matrix",
"(",
"striu",
")",
":",
"S",
"=",
"np",
".",
"identity",
"(",
"4",
")",
"S",
"[",
":",
"3",
",",
":",
"3",
"]",
"=",
"striu2mat",
"(",
"striu",
")",
"return",
"S"
] | Convert a 3x3 matrix representation of shear to a 4x4 representation | [
"Convert",
"a",
"3x3",
"matrix",
"representation",
"of",
"shear",
"to",
"a",
"4x4",
"representation"
] | [
"\"\"\"Convert a 3x3 matrix representation of shear to a 4x4 representation\n\n :striu: A 3x3 shear matrix\n\n :return: A 4x4 shear matrix\n \"\"\""
] | [
{
"param": "striu",
"type": null
}
] | {
"returns": [
{
"docstring": "A 4x4 shear matrix",
"docstring_tokens": [
"A",
"4x4",
"shear",
"matrix"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "striu",
"type": null,
"docstring": null,
"docstring_... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | xyz_rpy | <not_specific> | def xyz_rpy(transformation):
"""Decompose a transformation matrix into translation and euler angles
:param transformation: A 4x4 transformation matrix
:return: A tuple of (x, y, z, r, p, y) where (x, y, z) are coordinates of a
cartesian translation and (r, p, y) are roll, pitch, yaw applied in
... | Decompose a transformation matrix into translation and euler angles
:param transformation: A 4x4 transformation matrix
:return: A tuple of (x, y, z, r, p, y) where (x, y, z) are coordinates of a
cartesian translation and (r, p, y) are roll, pitch, yaw applied in
that order around fixed axis
... | Decompose a transformation matrix into translation and euler angles | [
"Decompose",
"a",
"transformation",
"matrix",
"into",
"translation",
"and",
"euler",
"angles"
] | def xyz_rpy(transformation):
T, R, _, _ = decompose44(transformation)
return (T[0], T[1], T[2]), mat2euler(R) | [
"def",
"xyz_rpy",
"(",
"transformation",
")",
":",
"T",
",",
"R",
",",
"_",
",",
"_",
"=",
"decompose44",
"(",
"transformation",
")",
"return",
"(",
"T",
"[",
"0",
"]",
",",
"T",
"[",
"1",
"]",
",",
"T",
"[",
"2",
"]",
")",
",",
"mat2euler",
... | Decompose a transformation matrix into translation and euler angles | [
"Decompose",
"a",
"transformation",
"matrix",
"into",
"translation",
"and",
"euler",
"angles"
] | [
"\"\"\"Decompose a transformation matrix into translation and euler angles\n\n :param transformation: A 4x4 transformation matrix\n\n :return: A tuple of (x, y, z, r, p, y) where (x, y, z) are coordinates of a\n cartesian translation and (r, p, y) are roll, pitch, yaw applied in\n that order aro... | [
{
"param": "transformation",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple of (x, y, z, r, p, y) where (x, y, z) are coordinates of a\ncartesian translation and (r, p, y) are roll, pitch, yaw applied in\nthat order around fixed axis",
"docstring_tokens": [
"A",
"tuple",
"of",
"(",
"x",
"y"... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | connect_joint | null | def connect_joint(self, joint):
"""Connect a joint (as a child) to this link"""
joint.parent = self
self.children.append(joint) | Connect a joint (as a child) to this link | Connect a joint (as a child) to this link | [
"Connect",
"a",
"joint",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"link"
] | def connect_joint(self, joint):
joint.parent = self
self.children.append(joint) | [
"def",
"connect_joint",
"(",
"self",
",",
"joint",
")",
":",
"joint",
".",
"parent",
"=",
"self",
"self",
".",
"children",
".",
"append",
"(",
"joint",
")"
] | Connect a joint (as a child) to this link | [
"Connect",
"a",
"joint",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"link"
] | [
"\"\"\"Connect a joint (as a child) to this link\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "joint",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "joint",
"type": null,
"docstring": null,
"docstring_tokens": ... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | connect_link | null | def connect_link(self, link, trans):
"""Connect a link (as a child) to this link"""
# Create a new joint to sit between this link and the provided link
joint = _URDFJoint('fixed', trans)
self.connect_joint(joint)
joint.connect_link(link) | Connect a link (as a child) to this link | Connect a link (as a child) to this link | [
"Connect",
"a",
"link",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"link"
] | def connect_link(self, link, trans):
joint = _URDFJoint('fixed', trans)
self.connect_joint(joint)
joint.connect_link(link) | [
"def",
"connect_link",
"(",
"self",
",",
"link",
",",
"trans",
")",
":",
"joint",
"=",
"_URDFJoint",
"(",
"'fixed'",
",",
"trans",
")",
"self",
".",
"connect_joint",
"(",
"joint",
")",
"joint",
".",
"connect_link",
"(",
"link",
")"
] | Connect a link (as a child) to this link | [
"Connect",
"a",
"link",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"link"
] | [
"\"\"\"Connect a link (as a child) to this link\"\"\"",
"# Create a new joint to sit between this link and the provided link"
] | [
{
"param": "self",
"type": null
},
{
"param": "link",
"type": null
},
{
"param": "trans",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | xml | null | def xml(self, doc, robot):
"""Represent this link and all its children as xml"""
link = doc.createElement('link')
link.setAttribute('name', self.name)
if len(self.visuals) > 0:
for visual in self.visuals:
visual.xml(doc, link)
robot.appendChild(link... | Represent this link and all its children as xml | Represent this link and all its children as xml | [
"Represent",
"this",
"link",
"and",
"all",
"its",
"children",
"as",
"xml"
] | def xml(self, doc, robot):
link = doc.createElement('link')
link.setAttribute('name', self.name)
if len(self.visuals) > 0:
for visual in self.visuals:
visual.xml(doc, link)
robot.appendChild(link)
for child in self.children:
child.xml(doc, ... | [
"def",
"xml",
"(",
"self",
",",
"doc",
",",
"robot",
")",
":",
"link",
"=",
"doc",
".",
"createElement",
"(",
"'link'",
")",
"link",
".",
"setAttribute",
"(",
"'name'",
",",
"self",
".",
"name",
")",
"if",
"len",
"(",
"self",
".",
"visuals",
")",
... | Represent this link and all its children as xml | [
"Represent",
"this",
"link",
"and",
"all",
"its",
"children",
"as",
"xml"
] | [
"\"\"\"Represent this link and all its children as xml\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "doc",
"type": null
},
{
"param": "robot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | connect_joint | null | def connect_joint(self, joint):
"""Connect a joint (as a child) to this joint"""
# Create a new link to sit between this joint and the provided joint
link = _URDFLink()
self.connect_link(link)
link.connect_joint(joint) | Connect a joint (as a child) to this joint | Connect a joint (as a child) to this joint | [
"Connect",
"a",
"joint",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | def connect_joint(self, joint):
link = _URDFLink()
self.connect_link(link)
link.connect_joint(joint) | [
"def",
"connect_joint",
"(",
"self",
",",
"joint",
")",
":",
"link",
"=",
"_URDFLink",
"(",
")",
"self",
".",
"connect_link",
"(",
"link",
")",
"link",
".",
"connect_joint",
"(",
"joint",
")"
] | Connect a joint (as a child) to this joint | [
"Connect",
"a",
"joint",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | [
"\"\"\"Connect a joint (as a child) to this joint\"\"\"",
"# Create a new link to sit between this joint and the provided joint"
] | [
{
"param": "self",
"type": null
},
{
"param": "joint",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "joint",
"type": null,
"docstring": null,
"docstring_tokens": ... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | connect_link | null | def connect_link(self, link, trans=np.identity(4)):
"""Connect a link (as a child) to this joint"""
self.name = f'{link.name}_joint'
# If the relative position/rotation of the provided link is zero we can
# connect the link directly to this joint, otherwise we need another
# li... | Connect a link (as a child) to this joint | Connect a link (as a child) to this joint | [
"Connect",
"a",
"link",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | def connect_link(self, link, trans=np.identity(4)):
self.name = f'{link.name}_joint'
if np.allclose(xyz_rpy(trans), 0):
self.child = link
else:
joint_link = _URDFLink(f'{self.name}_link')
joint_link.connect_link(link, trans)
self.child = joint_link | [
"def",
"connect_link",
"(",
"self",
",",
"link",
",",
"trans",
"=",
"np",
".",
"identity",
"(",
"4",
")",
")",
":",
"self",
".",
"name",
"=",
"f'{link.name}_joint'",
"if",
"np",
".",
"allclose",
"(",
"xyz_rpy",
"(",
"trans",
")",
",",
"0",
")",
":"... | Connect a link (as a child) to this joint | [
"Connect",
"a",
"link",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | [
"\"\"\"Connect a link (as a child) to this joint\"\"\"",
"# If the relative position/rotation of the provided link is zero we can",
"# connect the link directly to this joint, otherwise we need another",
"# link to sit right where this joint ends which then connects to the",
"# provided link through another... | [
{
"param": "self",
"type": null
},
{
"param": "link",
"type": null
},
{
"param": "trans",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | connect_visual | null | def connect_visual(self, visual):
"""Connect a visual element (as a child) to this joint"""
link = _URDFLink()
self.connect_link(link)
link.connect_visual(visual) | Connect a visual element (as a child) to this joint | Connect a visual element (as a child) to this joint | [
"Connect",
"a",
"visual",
"element",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | def connect_visual(self, visual):
link = _URDFLink()
self.connect_link(link)
link.connect_visual(visual) | [
"def",
"connect_visual",
"(",
"self",
",",
"visual",
")",
":",
"link",
"=",
"_URDFLink",
"(",
")",
"self",
".",
"connect_link",
"(",
"link",
")",
"link",
".",
"connect_visual",
"(",
"visual",
")"
] | Connect a visual element (as a child) to this joint | [
"Connect",
"a",
"visual",
"element",
"(",
"as",
"a",
"child",
")",
"to",
"this",
"joint"
] | [
"\"\"\"Connect a visual element (as a child) to this joint\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "visual",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "visual",
"type": null,
"docstring": null,
"docstring_tokens":... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | xml | null | def xml(self, doc, robot):
"""Represent this joint and all its children as xml"""
# A joint is only valid if it has both a parent and a child
if self.parent and self.child:
joint = doc.createElement('joint')
joint.setAttribute('type', self.type)
joint.setAttr... | Represent this joint and all its children as xml | Represent this joint and all its children as xml | [
"Represent",
"this",
"joint",
"and",
"all",
"its",
"children",
"as",
"xml"
] | def xml(self, doc, robot):
if self.parent and self.child:
joint = doc.createElement('joint')
joint.setAttribute('type', self.type)
joint.setAttribute('name', self.name)
parent = doc.createElement('parent')
parent.setAttribute('link', self.parent.name)
... | [
"def",
"xml",
"(",
"self",
",",
"doc",
",",
"robot",
")",
":",
"if",
"self",
".",
"parent",
"and",
"self",
".",
"child",
":",
"joint",
"=",
"doc",
".",
"createElement",
"(",
"'joint'",
")",
"joint",
".",
"setAttribute",
"(",
"'type'",
",",
"self",
... | Represent this joint and all its children as xml | [
"Represent",
"this",
"joint",
"and",
"all",
"its",
"children",
"as",
"xml"
] | [
"\"\"\"Represent this joint and all its children as xml\"\"\"",
"# A joint is only valid if it has both a parent and a child"
] | [
{
"param": "self",
"type": null
},
{
"param": "doc",
"type": null
},
{
"param": "robot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | xml | null | def xml(self, doc, link):
"""Represent this visual element as xml"""
# Extract scale and shear from transformation
_, _, Z, S = decompose44(self.trans)
z = np.mean(Z)
meta = _URDFVisual.meta[self.node.name]
if not meta.non_uniform_scale and not np.allclose(Z, z):
... | Represent this visual element as xml | Represent this visual element as xml | [
"Represent",
"this",
"visual",
"element",
"as",
"xml"
] | def xml(self, doc, link):
_, _, Z, S = decompose44(self.trans)
z = np.mean(Z)
meta = _URDFVisual.meta[self.node.name]
if not meta.non_uniform_scale and not np.allclose(Z, z):
raise ValueError('Non uniform scale not supported for node '
f'{self.nod... | [
"def",
"xml",
"(",
"self",
",",
"doc",
",",
"link",
")",
":",
"_",
",",
"_",
",",
"Z",
",",
"S",
"=",
"decompose44",
"(",
"self",
".",
"trans",
")",
"z",
"=",
"np",
".",
"mean",
"(",
"Z",
")",
"meta",
"=",
"_URDFVisual",
".",
"meta",
"[",
"... | Represent this visual element as xml | [
"Represent",
"this",
"visual",
"element",
"as",
"xml"
] | [
"\"\"\"Represent this visual element as xml\"\"\"",
"# Extract scale and shear from transformation"
] | [
{
"param": "self",
"type": null
},
{
"param": "doc",
"type": null
},
{
"param": "link",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "doc",
"type": null,
"docstring": null,
"docstring_tokens": []... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | proto_str | <not_specific> | def proto_str(self, name, fields=[], header=''):
"""Generate a PROTO string representation of this node tree
:param name: Name of the PROTO (must be the same as an eventual file
name according to webots specifications)
:type name: str
:param fields: List of field definitions... | Generate a PROTO string representation of this node tree
:param name: Name of the PROTO (must be the same as an eventual file
name according to webots specifications)
:type name: str
:param fields: List of field definitions for the generated PROTO, one
list element might... | Generate a PROTO string representation of this node tree | [
"Generate",
"a",
"PROTO",
"string",
"representation",
"of",
"this",
"node",
"tree"
] | def proto_str(self, name, fields=[], header=''):
out = _IndentedOutput()
out.write('#VRML_SIM R2021a utf8')
for line in header.split('\n'):
out.write(('' if not line or line.isspace() else '# ') + line)
out.write(f'PROTO {name} [')
for field in fields:
out... | [
"def",
"proto_str",
"(",
"self",
",",
"name",
",",
"fields",
"=",
"[",
"]",
",",
"header",
"=",
"''",
")",
":",
"out",
"=",
"_IndentedOutput",
"(",
")",
"out",
".",
"write",
"(",
"'#VRML_SIM R2021a utf8'",
")",
"for",
"line",
"in",
"header",
".",
"sp... | Generate a PROTO string representation of this node tree | [
"Generate",
"a",
"PROTO",
"string",
"representation",
"of",
"this",
"node",
"tree"
] | [
"\"\"\"Generate a PROTO string representation of this node tree\n\n :param name: Name of the PROTO (must be the same as an eventual file\n name according to webots specifications)\n :type name: str\n :param fields: List of field definitions for the generated PROTO, one\n l... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "fields",
"type": null
},
{
"param": "header",
"type": null
}
] | {
"returns": [
{
"docstring": "A PROTO string representation of this node and it's children",
"docstring_tokens": [
"A",
"PROTO",
"string",
"representation",
"of",
"this",
"node",
"and",
"it",
"'",
"s",
"ch... |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | translation | <not_specific> | def translation(self):
"""4x4 translanslation matrix of this node relative to its parent"""
t = self.fields.get('translation', '').split()
if len(t) != 3 or t[0] == 'IS':
return np.identity(4)
return translation_matrix([float(a) for a in t]) | 4x4 translanslation matrix of this node relative to its parent | 4x4 translanslation matrix of this node relative to its parent | [
"4x4",
"translanslation",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | def translation(self):
t = self.fields.get('translation', '').split()
if len(t) != 3 or t[0] == 'IS':
return np.identity(4)
return translation_matrix([float(a) for a in t]) | [
"def",
"translation",
"(",
"self",
")",
":",
"t",
"=",
"self",
".",
"fields",
".",
"get",
"(",
"'translation'",
",",
"''",
")",
".",
"split",
"(",
")",
"if",
"len",
"(",
"t",
")",
"!=",
"3",
"or",
"t",
"[",
"0",
"]",
"==",
"'IS'",
":",
"retur... | 4x4 translanslation matrix of this node relative to its parent | [
"4x4",
"translanslation",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | [
"\"\"\"4x4 translanslation matrix of this node relative to its parent\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | rotation | <not_specific> | def rotation(self):
"""4x4 rotation matrix of this node relative to its parent"""
r = self.fields.get('rotation', '').split()
if len(r) != 4 or r[0] == 'IS':
return np.identity(4)
return axangle2aff([float(a) for a in r[:3]], float(r[3])) | 4x4 rotation matrix of this node relative to its parent | 4x4 rotation matrix of this node relative to its parent | [
"4x4",
"rotation",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | def rotation(self):
r = self.fields.get('rotation', '').split()
if len(r) != 4 or r[0] == 'IS':
return np.identity(4)
return axangle2aff([float(a) for a in r[:3]], float(r[3])) | [
"def",
"rotation",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"fields",
".",
"get",
"(",
"'rotation'",
",",
"''",
")",
".",
"split",
"(",
")",
"if",
"len",
"(",
"r",
")",
"!=",
"4",
"or",
"r",
"[",
"0",
"]",
"==",
"'IS'",
":",
"return",
... | 4x4 rotation matrix of this node relative to its parent | [
"4x4",
"rotation",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | [
"\"\"\"4x4 rotation matrix of this node relative to its parent\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | scale | <not_specific> | def scale(self):
"""4x4 scale matrix of this node relative to its parent"""
s = self.fields.get('scale', '').split()
if len(s) != 3 or s[0] == 'IS':
return np.identity(4)
return scale_matrix([float(a) for a in s]) | 4x4 scale matrix of this node relative to its parent | 4x4 scale matrix of this node relative to its parent | [
"4x4",
"scale",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | def scale(self):
s = self.fields.get('scale', '').split()
if len(s) != 3 or s[0] == 'IS':
return np.identity(4)
return scale_matrix([float(a) for a in s]) | [
"def",
"scale",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"fields",
".",
"get",
"(",
"'scale'",
",",
"''",
")",
".",
"split",
"(",
")",
"if",
"len",
"(",
"s",
")",
"!=",
"3",
"or",
"s",
"[",
"0",
"]",
"==",
"'IS'",
":",
"return",
"np",
... | 4x4 scale matrix of this node relative to its parent | [
"4x4",
"scale",
"matrix",
"of",
"this",
"node",
"relative",
"to",
"its",
"parent"
] | [
"\"\"\"4x4 scale matrix of this node relative to its parent\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d877d2ab315221a0b73422bf521da6205df28fe | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/robot_description.py | [
"Apache-2.0"
] | Python | urdf_str | <not_specific> | def urdf_str(self, name, base='base_link', transformation=np.identity(4),
header=''):
"""Generate a URDF string representation of this node tree
:param name: Name of the robot
:type name: str
:param base: Name of the base link in the URDF representation
:type ba... | Generate a URDF string representation of this node tree
:param name: Name of the robot
:type name: str
:param base: Name of the base link in the URDF representation
:type base: str
:param transformation: A 4x4 transformation matrix to apply to the
robot before genera... | Generate a URDF string representation of this node tree | [
"Generate",
"a",
"URDF",
"string",
"representation",
"of",
"this",
"node",
"tree"
] | def urdf_str(self, name, base='base_link', transformation=np.identity(4),
header=''):
_URDFLink.index, _URDFJoint.index = 0, 0
base_link = _URDFLink(base)
self._urdf(transformation, base_link)
doc = minidom.Document()
if header:
doc.appendChild(doc.cr... | [
"def",
"urdf_str",
"(",
"self",
",",
"name",
",",
"base",
"=",
"'base_link'",
",",
"transformation",
"=",
"np",
".",
"identity",
"(",
"4",
")",
",",
"header",
"=",
"''",
")",
":",
"_URDFLink",
".",
"index",
",",
"_URDFJoint",
".",
"index",
"=",
"0",
... | Generate a URDF string representation of this node tree | [
"Generate",
"a",
"URDF",
"string",
"representation",
"of",
"this",
"node",
"tree"
] | [
"\"\"\"Generate a URDF string representation of this node tree\n\n :param name: Name of the robot\n :type name: str\n :param base: Name of the base link in the URDF representation\n :type base: str\n :param transformation: A 4x4 transformation matrix to apply to the\n r... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "base",
"type": null
},
{
"param": "transformation",
"type": null
},
{
"param": "header",
"type": null
}
] | {
"returns": [
{
"docstring": "A URDF string representation of this node and it's children",
"docstring_tokens": [
"A",
"URDF",
"string",
"representation",
"of",
"this",
"node",
"and",
"it",
"'",
"s",
"chil... |
10e42e6cad8ffb84235cb27facd63ee90087fb62 | OssianEriksson/autonomous-twizy | twizy_bringup/src/twizy_bringup/twizyparam.py | [
"Apache-2.0"
] | Python | _traverse_dict | null | def _traverse_dict(d, callback):
"""Calls a callback for every key-value pair in d recursively
:param d: A dictionary to traverse
:type d: list
:param callback: A callback accepting a dictionary, key and value as
arguments
:type callback: callable
"""
kv = d.copy().items() if i... | Calls a callback for every key-value pair in d recursively
:param d: A dictionary to traverse
:type d: list
:param callback: A callback accepting a dictionary, key and value as
arguments
:type callback: callable
| Calls a callback for every key-value pair in d recursively | [
"Calls",
"a",
"callback",
"for",
"every",
"key",
"-",
"value",
"pair",
"in",
"d",
"recursively"
] | def _traverse_dict(d, callback):
kv = d.copy().items() if isinstance(d, dict) else enumerate(d.copy())
for k, v in kv:
for a in (k, v):
if isinstance(a, (dict, list)):
_traverse_dict(a, callback)
callback(d, k, v) | [
"def",
"_traverse_dict",
"(",
"d",
",",
"callback",
")",
":",
"kv",
"=",
"d",
".",
"copy",
"(",
")",
".",
"items",
"(",
")",
"if",
"isinstance",
"(",
"d",
",",
"dict",
")",
"else",
"enumerate",
"(",
"d",
".",
"copy",
"(",
")",
")",
"for",
"k",
... | Calls a callback for every key-value pair in d recursively | [
"Calls",
"a",
"callback",
"for",
"every",
"key",
"-",
"value",
"pair",
"in",
"d",
"recursively"
] | [
"\"\"\"Calls a callback for every key-value pair in d recursively\n \n :param d: A dictionary to traverse\n :type d: list\n :param callback: A callback accepting a dictionary, key and value as\n arguments\n :type callback: callable\n \"\"\""
] | [
{
"param": "d",
"type": null
},
{
"param": "callback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "d",
"type": null,
"docstring": "A dictionary to traverse",
"docstring_tokens": [
"A",
"dictionary",
"to",
"traverse"
],
"default": null,
"is_optional": null
},
{
... |
10e42e6cad8ffb84235cb27facd63ee90087fb62 | OssianEriksson/autonomous-twizy | twizy_bringup/src/twizy_bringup/twizyparam.py | [
"Apache-2.0"
] | Python | parse | <not_specific> | def parse(path):
"""Parse a YAML file
The following extra tags are supported:
* !eval: Evaluates a Python expression
* !include: Includes another YAML file by path
* !variable: A variable to be used in !eval expressions
:param path: Path to a YAML file
:type path: str
:return: A ... | Parse a YAML file
The following extra tags are supported:
* !eval: Evaluates a Python expression
* !include: Includes another YAML file by path
* !variable: A variable to be used in !eval expressions
:param path: Path to a YAML file
:type path: str
:return: A parsed YAML object where... | Parse a YAML file
The following extra tags are supported.
!eval: Evaluates a Python expression
!include: Includes another YAML file by path
!variable: A variable to be used in !eval expressions | [
"Parse",
"a",
"YAML",
"file",
"The",
"following",
"extra",
"tags",
"are",
"supported",
".",
"!eval",
":",
"Evaluates",
"a",
"Python",
"expression",
"!include",
":",
"Includes",
"another",
"YAML",
"file",
"by",
"path",
"!variable",
":",
"A",
"variable",
"to",... | def parse(path):
text = Path(path).read_text()
text = re.sub(r'^( *)<< *:', r'\1!merge :', text, flags=re.M)
parsed = yaml.load(text, yaml.SafeLoader)
def extract_variables(root, k, v):
if isinstance(k, _Variable):
del root[k]
variables[k.name] = v
elif isinstance... | [
"def",
"parse",
"(",
"path",
")",
":",
"text",
"=",
"Path",
"(",
"path",
")",
".",
"read_text",
"(",
")",
"text",
"=",
"re",
".",
"sub",
"(",
"r'^( *)<< *:'",
",",
"r'\\1!merge :'",
",",
"text",
",",
"flags",
"=",
"re",
".",
"M",
")",
"parsed",
"... | Parse a YAML file
The following extra tags are supported: | [
"Parse",
"a",
"YAML",
"file",
"The",
"following",
"extra",
"tags",
"are",
"supported",
":"
] | [
"\"\"\"Parse a YAML file\n\n The following extra tags are supported:\n\n * !eval: Evaluates a Python expression\n * !include: Includes another YAML file by path\n * !variable: A variable to be used in !eval expressions\n\n :param path: Path to a YAML file\n :type path: str\n \n :return: A pa... | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": "A parsed YAML object where the tags defined above have been\nexpanded",
"docstring_tokens": [
"A",
"parsed",
"YAML",
"object",
"where",
"the",
"tags",
"defined",
"above",
"have",
"bee... |
7add2eaa6a6ac4391ab449d9230e5f07def6d409 | OssianEriksson/autonomous-twizy | twizy_description/src/twizy_description/collada_node.py | [
"Apache-2.0"
] | Python | terminate | <not_specific> | def terminate(a):
"""Flattens a matrix of coordinates terminating each tuple with -1
:param a: A matrix where each row represents a tuple of coordinates
:return: A flat list where each row in the input matrix follows
after the next, but where every row has been term... | Flattens a matrix of coordinates terminating each tuple with -1
:param a: A matrix where each row represents a tuple of coordinates
:return: A flat list where each row in the input matrix follows
after the next, but where every row has been terminated with -1
to... | Flattens a matrix of coordinates terminating each tuple with -1 | [
"Flattens",
"a",
"matrix",
"of",
"coordinates",
"terminating",
"each",
"tuple",
"with",
"-",
"1"
] | def terminate(a):
return np.hstack((a, np.full((a.shape[0], 1), -1))).flatten() | [
"def",
"terminate",
"(",
"a",
")",
":",
"return",
"np",
".",
"hstack",
"(",
"(",
"a",
",",
"np",
".",
"full",
"(",
"(",
"a",
".",
"shape",
"[",
"0",
"]",
",",
"1",
")",
",",
"-",
"1",
")",
")",
")",
".",
"flatten",
"(",
")"
] | Flattens a matrix of coordinates terminating each tuple with -1 | [
"Flattens",
"a",
"matrix",
"of",
"coordinates",
"terminating",
"each",
"tuple",
"with",
"-",
"1"
] | [
"\"\"\"Flattens a matrix of coordinates terminating each tuple with -1\n\n :param a: A matrix where each row represents a tuple of coordinates\n\n :return: A flat list where each row in the input matrix follows\n after the next, but where every row has been terminated with -1\n ... | [
{
"param": "a",
"type": null
}
] | {
"returns": [
{
"docstring": "A flat list where each row in the input matrix follows\nafter the next, but where every row has been terminated with -1\nto separate out rows",
"docstring_tokens": [
"A",
"flat",
"list",
"where",
"each",
"row",
"in"... |
5276d49a54af25320f230dd2201ecfd1856ce82a | BeenzSyed/tempest | tempest/common/utils/linux/remote_client.py | [
"Apache-2.0"
] | Python | validate_authentication | null | def validate_authentication(self):
"""Validate ssh connection and authentication
This method raises an Exception when the validation fails.
"""
self.ssh_client.test_connection_auth() | Validate ssh connection and authentication
This method raises an Exception when the validation fails.
| Validate ssh connection and authentication
This method raises an Exception when the validation fails. | [
"Validate",
"ssh",
"connection",
"and",
"authentication",
"This",
"method",
"raises",
"an",
"Exception",
"when",
"the",
"validation",
"fails",
"."
] | def validate_authentication(self):
self.ssh_client.test_connection_auth() | [
"def",
"validate_authentication",
"(",
"self",
")",
":",
"self",
".",
"ssh_client",
".",
"test_connection_auth",
"(",
")"
] | Validate ssh connection and authentication
This method raises an Exception when the validation fails. | [
"Validate",
"ssh",
"connection",
"and",
"authentication",
"This",
"method",
"raises",
"an",
"Exception",
"when",
"the",
"validation",
"fails",
"."
] | [
"\"\"\"Validate ssh connection and authentication\n This method raises an Exception when the validation fails.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | creates | <not_specific> | def creates(resource):
"""Decorator that adds resources to the appropriate cleanup list."""
def decorator(f):
@functools.wraps(f)
def wrapper(cls, *args, **kwargs):
result = f(cls, *args, **kwargs)
body = result[resource]
if 'uuid' in body:
c... | Decorator that adds resources to the appropriate cleanup list. | Decorator that adds resources to the appropriate cleanup list. | [
"Decorator",
"that",
"adds",
"resources",
"to",
"the",
"appropriate",
"cleanup",
"list",
"."
] | def creates(resource):
def decorator(f):
@functools.wraps(f)
def wrapper(cls, *args, **kwargs):
result = f(cls, *args, **kwargs)
body = result[resource]
if 'uuid' in body:
cls.created_objects[resource].add(body['uuid'])
return result
... | [
"def",
"creates",
"(",
"resource",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"cls",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"result",
"=",
"f",
"(",
"cls",
"... | Decorator that adds resources to the appropriate cleanup list. | [
"Decorator",
"that",
"adds",
"resources",
"to",
"the",
"appropriate",
"cleanup",
"list",
"."
] | [
"\"\"\"Decorator that adds resources to the appropriate cleanup list.\"\"\""
] | [
{
"param": "resource",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "resource",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | tearDownClass | null | def tearDownClass(cls):
"""Ensure that all created objects get destroyed."""
try:
for resource, uuids in cls.created_objects.iteritems():
delete_method = getattr(cls.client, 'delete_%s' % resource)
for u in uuids:
delete_method(u, ignore_e... | Ensure that all created objects get destroyed. | Ensure that all created objects get destroyed. | [
"Ensure",
"that",
"all",
"created",
"objects",
"get",
"destroyed",
"."
] | def tearDownClass(cls):
try:
for resource, uuids in cls.created_objects.iteritems():
delete_method = getattr(cls.client, 'delete_%s' % resource)
for u in uuids:
delete_method(u, ignore_errors=exc.NotFound)
finally:
super(BaseBar... | [
"def",
"tearDownClass",
"(",
"cls",
")",
":",
"try",
":",
"for",
"resource",
",",
"uuids",
"in",
"cls",
".",
"created_objects",
".",
"iteritems",
"(",
")",
":",
"delete_method",
"=",
"getattr",
"(",
"cls",
".",
"client",
",",
"'delete_%s'",
"%",
"resourc... | Ensure that all created objects get destroyed. | [
"Ensure",
"that",
"all",
"created",
"objects",
"get",
"destroyed",
"."
] | [
"\"\"\"Ensure that all created objects get destroyed.\"\"\""
] | [
{
"param": "cls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | create_chassis | <not_specific> | def create_chassis(cls, description=None, expect_errors=False):
"""
Wrapper utility for creating test chassis.
:param description: A description of the chassis. if not supplied,
a random value will be generated.
:return: Created chassis.
"""
description = de... |
Wrapper utility for creating test chassis.
:param description: A description of the chassis. if not supplied,
a random value will be generated.
:return: Created chassis.
| Wrapper utility for creating test chassis. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"chassis",
"."
] | def create_chassis(cls, description=None, expect_errors=False):
description = description or data_utils.rand_name('test-chassis-')
resp, body = cls.client.create_chassis(description=description)
return {'chassis': body, 'response': resp} | [
"def",
"create_chassis",
"(",
"cls",
",",
"description",
"=",
"None",
",",
"expect_errors",
"=",
"False",
")",
":",
"description",
"=",
"description",
"or",
"data_utils",
".",
"rand_name",
"(",
"'test-chassis-'",
")",
"resp",
",",
"body",
"=",
"cls",
".",
... | Wrapper utility for creating test chassis. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"chassis",
"."
] | [
"\"\"\"\n Wrapper utility for creating test chassis.\n\n :param description: A description of the chassis. if not supplied,\n a random value will be generated.\n :return: Created chassis.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "description",
"type": null
},
{
"param": "expect_errors",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | create_node | <not_specific> | def create_node(cls, chassis_id, cpu_arch='x86', cpu_num=8, storage=1024,
memory=4096, driver='fake'):
"""
Wrapper utility for creating test baremetal nodes.
:param cpu_arch: CPU architecture of the node. Default: x86.
:param cpu_num: Number of CPUs. Default: 8.
... |
Wrapper utility for creating test baremetal nodes.
:param cpu_arch: CPU architecture of the node. Default: x86.
:param cpu_num: Number of CPUs. Default: 8.
:param storage: Disk size. Default: 1024.
:param memory: Available RAM. Default: 4096.
:return: Created node.
... | Wrapper utility for creating test baremetal nodes. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"baremetal",
"nodes",
"."
] | def create_node(cls, chassis_id, cpu_arch='x86', cpu_num=8, storage=1024,
memory=4096, driver='fake'):
resp, body = cls.client.create_node(chassis_id, cpu_arch=cpu_arch,
cpu_num=cpu_num, storage=storage,
... | [
"def",
"create_node",
"(",
"cls",
",",
"chassis_id",
",",
"cpu_arch",
"=",
"'x86'",
",",
"cpu_num",
"=",
"8",
",",
"storage",
"=",
"1024",
",",
"memory",
"=",
"4096",
",",
"driver",
"=",
"'fake'",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"cl... | Wrapper utility for creating test baremetal nodes. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"baremetal",
"nodes",
"."
] | [
"\"\"\"\n Wrapper utility for creating test baremetal nodes.\n\n :param cpu_arch: CPU architecture of the node. Default: x86.\n :param cpu_num: Number of CPUs. Default: 8.\n :param storage: Disk size. Default: 1024.\n :param memory: Available RAM. Default: 4096.\n :return: ... | [
{
"param": "cls",
"type": null
},
{
"param": "chassis_id",
"type": null
},
{
"param": "cpu_arch",
"type": null
},
{
"param": "cpu_num",
"type": null
},
{
"param": "storage",
"type": null
},
{
"param": "memory",
"type": null
},
{
"param": "d... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | create_port | <not_specific> | def create_port(cls, node_id, address=None):
"""
Wrapper utility for creating test ports.
:param address: MAC address of the port. If not supplied, a random
value will be generated.
:return: Created port.
"""
address = address or data_utils.rand_mac_address(... |
Wrapper utility for creating test ports.
:param address: MAC address of the port. If not supplied, a random
value will be generated.
:return: Created port.
| Wrapper utility for creating test ports. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"ports",
"."
] | def create_port(cls, node_id, address=None):
address = address or data_utils.rand_mac_address()
resp, body = cls.client.create_port(address=address, node_id=node_id)
return {'port': body, 'response': resp} | [
"def",
"create_port",
"(",
"cls",
",",
"node_id",
",",
"address",
"=",
"None",
")",
":",
"address",
"=",
"address",
"or",
"data_utils",
".",
"rand_mac_address",
"(",
")",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"create_port",
"(",
"address",... | Wrapper utility for creating test ports. | [
"Wrapper",
"utility",
"for",
"creating",
"test",
"ports",
"."
] | [
"\"\"\"\n Wrapper utility for creating test ports.\n\n :param address: MAC address of the port. If not supplied, a random\n value will be generated.\n :return: Created port.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "node_id",
"type": null
},
{
"param": "address",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | delete_chassis | <not_specific> | def delete_chassis(cls, chassis_id):
"""
Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis.
:return: Server response.
"""
resp, body = cls.client.delete_chassis(chassis_id)
if chassis_id in cls.created_objects['chas... |
Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis.
:return: Server response.
| Deletes a chassis having the specified UUID. | [
"Deletes",
"a",
"chassis",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_chassis(cls, chassis_id):
resp, body = cls.client.delete_chassis(chassis_id)
if chassis_id in cls.created_objects['chassis']:
cls.created_objects['chassis'].remove(chassis_id)
return resp | [
"def",
"delete_chassis",
"(",
"cls",
",",
"chassis_id",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"delete_chassis",
"(",
"chassis_id",
")",
"if",
"chassis_id",
"in",
"cls",
".",
"created_objects",
"[",
"'chassis'",
"]",
":",
"cls",
"... | Deletes a chassis having the specified UUID. | [
"Deletes",
"a",
"chassis",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a chassis having the specified UUID.\n\n :param uuid: The unique identifier of the chassis.\n :return: Server response.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "chassis_id",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | delete_node | <not_specific> | def delete_node(cls, node_id):
"""
Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node.
:return: Server response.
"""
resp, body = cls.client.delete_node(node_id)
if node_id in cls.created_objects['node']:
cls.c... |
Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node.
:return: Server response.
| Deletes a node having the specified UUID. | [
"Deletes",
"a",
"node",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_node(cls, node_id):
resp, body = cls.client.delete_node(node_id)
if node_id in cls.created_objects['node']:
cls.created_objects['node'].remove(node_id)
return resp | [
"def",
"delete_node",
"(",
"cls",
",",
"node_id",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"delete_node",
"(",
"node_id",
")",
"if",
"node_id",
"in",
"cls",
".",
"created_objects",
"[",
"'node'",
"]",
":",
"cls",
".",
"created_obj... | Deletes a node having the specified UUID. | [
"Deletes",
"a",
"node",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a node having the specified UUID.\n\n :param uuid: The unique identifier of the node.\n :return: Server response.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "node_id",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ec873213636ba804a7e8c3c5a3c6f201b633472d | BeenzSyed/tempest | tempest/api/baremetal/base.py | [
"Apache-2.0"
] | Python | delete_port | <not_specific> | def delete_port(cls, port_id):
"""
Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port.
:return: Server response.
"""
resp, body = cls.client.delete_port(port_id)
if port_id in cls.created_objects['port']:
cls.c... |
Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port.
:return: Server response.
| Deletes a port having the specified UUID. | [
"Deletes",
"a",
"port",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_port(cls, port_id):
resp, body = cls.client.delete_port(port_id)
if port_id in cls.created_objects['port']:
cls.created_objects['port'].remove(port_id)
return resp | [
"def",
"delete_port",
"(",
"cls",
",",
"port_id",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"delete_port",
"(",
"port_id",
")",
"if",
"port_id",
"in",
"cls",
".",
"created_objects",
"[",
"'port'",
"]",
":",
"cls",
".",
"created_obj... | Deletes a port having the specified UUID. | [
"Deletes",
"a",
"port",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a port having the specified UUID.\n\n :param uuid: The unique identifier of the port.\n :return: Server response.\n\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "port_id",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f8c762c6291c4e52bf4b12fe67a05b672670d821 | BeenzSyed/tempest | tempest/services/compute/v3/json/flavors_client.py | [
"Apache-2.0"
] | Python | create_flavor | <not_specific> | def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
"""Creates a new flavor or instance type."""
post_body = {
'name': name,
'ram': ram,
'vcpus': vcpus,
'disk': disk,
'id': flavor_id,
}
if kwargs.get('ephemeral... | Creates a new flavor or instance type. | Creates a new flavor or instance type. | [
"Creates",
"a",
"new",
"flavor",
"or",
"instance",
"type",
"."
] | def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
post_body = {
'name': name,
'ram': ram,
'vcpus': vcpus,
'disk': disk,
'id': flavor_id,
}
if kwargs.get('ephemeral'):
post_body['ephemeral'] = kwargs.get('... | [
"def",
"create_flavor",
"(",
"self",
",",
"name",
",",
"ram",
",",
"vcpus",
",",
"disk",
",",
"flavor_id",
",",
"**",
"kwargs",
")",
":",
"post_body",
"=",
"{",
"'name'",
":",
"name",
",",
"'ram'",
":",
"ram",
",",
"'vcpus'",
":",
"vcpus",
",",
"'d... | Creates a new flavor or instance type. | [
"Creates",
"a",
"new",
"flavor",
"or",
"instance",
"type",
"."
] | [
"\"\"\"Creates a new flavor or instance type.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "ram",
"type": null
},
{
"param": "vcpus",
"type": null
},
{
"param": "disk",
"type": null
},
{
"param": "flavor_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
f8c762c6291c4e52bf4b12fe67a05b672670d821 | BeenzSyed/tempest | tempest/services/compute/v3/json/flavors_client.py | [
"Apache-2.0"
] | Python | update_flavor_extra_spec | <not_specific> | def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
"""Update specified extra Specs of the mentioned flavor and key."""
resp, body = self.put('flavors/%s/flavor-extra-specs/%s' %
(flavor_id, key),
json.dumps(kwargs), self.headers)
... | Update specified extra Specs of the mentioned flavor and key. | Update specified extra Specs of the mentioned flavor and key. | [
"Update",
"specified",
"extra",
"Specs",
"of",
"the",
"mentioned",
"flavor",
"and",
"key",
"."
] | def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
resp, body = self.put('flavors/%s/flavor-extra-specs/%s' %
(flavor_id, key),
json.dumps(kwargs), self.headers)
body = json.loads(body)
return resp, body | [
"def",
"update_flavor_extra_spec",
"(",
"self",
",",
"flavor_id",
",",
"key",
",",
"**",
"kwargs",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"put",
"(",
"'flavors/%s/flavor-extra-specs/%s'",
"%",
"(",
"flavor_id",
",",
"key",
")",
",",
"json",
".",
... | Update specified extra Specs of the mentioned flavor and key. | [
"Update",
"specified",
"extra",
"Specs",
"of",
"the",
"mentioned",
"flavor",
"and",
"key",
"."
] | [
"\"\"\"Update specified extra Specs of the mentioned flavor and key.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f8c762c6291c4e52bf4b12fe67a05b672670d821 | BeenzSyed/tempest | tempest/services/compute/v3/json/flavors_client.py | [
"Apache-2.0"
] | Python | list_flavor_access | <not_specific> | def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
resp, body = self.get('flavors/%s/flavor-access' % flavor_id,
self.headers)
body = json.loads(body)
return resp, body['flavor_access'] | Gets flavor access information given the flavor id. | Gets flavor access information given the flavor id. | [
"Gets",
"flavor",
"access",
"information",
"given",
"the",
"flavor",
"id",
"."
] | def list_flavor_access(self, flavor_id):
resp, body = self.get('flavors/%s/flavor-access' % flavor_id,
self.headers)
body = json.loads(body)
return resp, body['flavor_access'] | [
"def",
"list_flavor_access",
"(",
"self",
",",
"flavor_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"'flavors/%s/flavor-access'",
"%",
"flavor_id",
",",
"self",
".",
"headers",
")",
"body",
"=",
"json",
".",
"loads",
"(",
"body",
")"... | Gets flavor access information given the flavor id. | [
"Gets",
"flavor",
"access",
"information",
"given",
"the",
"flavor",
"id",
"."
] | [
"\"\"\"Gets flavor access information given the flavor id.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f8c762c6291c4e52bf4b12fe67a05b672670d821 | BeenzSyed/tempest | tempest/services/compute/v3/json/flavors_client.py | [
"Apache-2.0"
] | Python | add_flavor_access | <not_specific> | def add_flavor_access(self, flavor_id, tenant_id):
"""Add flavor access for the specified tenant."""
post_body = {
'add_tenant_access': {
'tenant_id': tenant_id
}
}
post_body = json.dumps(post_body)
resp, body = self.post('flavors/%s/action... | Add flavor access for the specified tenant. | Add flavor access for the specified tenant. | [
"Add",
"flavor",
"access",
"for",
"the",
"specified",
"tenant",
"."
] | def add_flavor_access(self, flavor_id, tenant_id):
post_body = {
'add_tenant_access': {
'tenant_id': tenant_id
}
}
post_body = json.dumps(post_body)
resp, body = self.post('flavors/%s/action' % flavor_id,
post_body, s... | [
"def",
"add_flavor_access",
"(",
"self",
",",
"flavor_id",
",",
"tenant_id",
")",
":",
"post_body",
"=",
"{",
"'add_tenant_access'",
":",
"{",
"'tenant_id'",
":",
"tenant_id",
"}",
"}",
"post_body",
"=",
"json",
".",
"dumps",
"(",
"post_body",
")",
"resp",
... | Add flavor access for the specified tenant. | [
"Add",
"flavor",
"access",
"for",
"the",
"specified",
"tenant",
"."
] | [
"\"\"\"Add flavor access for the specified tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f8c762c6291c4e52bf4b12fe67a05b672670d821 | BeenzSyed/tempest | tempest/services/compute/v3/json/flavors_client.py | [
"Apache-2.0"
] | Python | remove_flavor_access | <not_specific> | def remove_flavor_access(self, flavor_id, tenant_id):
"""Remove flavor access from the specified tenant."""
post_body = {
'remove_tenant_access': {
'tenant_id': tenant_id
}
}
post_body = json.dumps(post_body)
resp, body = self.post('flavors... | Remove flavor access from the specified tenant. | Remove flavor access from the specified tenant. | [
"Remove",
"flavor",
"access",
"from",
"the",
"specified",
"tenant",
"."
] | def remove_flavor_access(self, flavor_id, tenant_id):
post_body = {
'remove_tenant_access': {
'tenant_id': tenant_id
}
}
post_body = json.dumps(post_body)
resp, body = self.post('flavors/%s/action' % flavor_id,
post_b... | [
"def",
"remove_flavor_access",
"(",
"self",
",",
"flavor_id",
",",
"tenant_id",
")",
":",
"post_body",
"=",
"{",
"'remove_tenant_access'",
":",
"{",
"'tenant_id'",
":",
"tenant_id",
"}",
"}",
"post_body",
"=",
"json",
".",
"dumps",
"(",
"post_body",
")",
"re... | Remove flavor access from the specified tenant. | [
"Remove",
"flavor",
"access",
"from",
"the",
"specified",
"tenant",
"."
] | [
"\"\"\"Remove flavor access from the specified tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
e796f9bc06e9034732d4a623250cc2a199c8131f | BeenzSyed/tempest | tempest/services/object_storage/account_client.py | [
"Apache-2.0"
] | Python | list_account_metadata | <not_specific> | def list_account_metadata(self):
"""
HEAD on the storage URL
Returns all account metadata headers
"""
headers = {"X-Storage-Token": self.token}
resp, body = self.head('', headers=headers)
return resp, body |
HEAD on the storage URL
Returns all account metadata headers
| HEAD on the storage URL
Returns all account metadata headers | [
"HEAD",
"on",
"the",
"storage",
"URL",
"Returns",
"all",
"account",
"metadata",
"headers"
] | def list_account_metadata(self):
headers = {"X-Storage-Token": self.token}
resp, body = self.head('', headers=headers)
return resp, body | [
"def",
"list_account_metadata",
"(",
"self",
")",
":",
"headers",
"=",
"{",
"\"X-Storage-Token\"",
":",
"self",
".",
"token",
"}",
"resp",
",",
"body",
"=",
"self",
".",
"head",
"(",
"''",
",",
"headers",
"=",
"headers",
")",
"return",
"resp",
",",
"bo... | HEAD on the storage URL
Returns all account metadata headers | [
"HEAD",
"on",
"the",
"storage",
"URL",
"Returns",
"all",
"account",
"metadata",
"headers"
] | [
"\"\"\"\n HEAD on the storage URL\n Returns all account metadata headers\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e796f9bc06e9034732d4a623250cc2a199c8131f | BeenzSyed/tempest | tempest/services/object_storage/account_client.py | [
"Apache-2.0"
] | Python | create_account_metadata | <not_specific> | def create_account_metadata(self, metadata,
metadata_prefix='X-Account-Meta-'):
"""Creates an account metadata entry."""
headers = {}
for key in metadata:
headers[metadata_prefix + key] = metadata[key]
resp, body = self.post('', headers=header... | Creates an account metadata entry. | Creates an account metadata entry. | [
"Creates",
"an",
"account",
"metadata",
"entry",
"."
] | def create_account_metadata(self, metadata,
metadata_prefix='X-Account-Meta-'):
headers = {}
for key in metadata:
headers[metadata_prefix + key] = metadata[key]
resp, body = self.post('', headers=headers, body=None)
return resp, body | [
"def",
"create_account_metadata",
"(",
"self",
",",
"metadata",
",",
"metadata_prefix",
"=",
"'X-Account-Meta-'",
")",
":",
"headers",
"=",
"{",
"}",
"for",
"key",
"in",
"metadata",
":",
"headers",
"[",
"metadata_prefix",
"+",
"key",
"]",
"=",
"metadata",
"[... | Creates an account metadata entry. | [
"Creates",
"an",
"account",
"metadata",
"entry",
"."
] | [
"\"\"\"Creates an account metadata entry.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "metadata",
"type": null
},
{
"param": "metadata_prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "metadata",
"type": null,
"docstring": null,
"docstring_tokens... |
e796f9bc06e9034732d4a623250cc2a199c8131f | BeenzSyed/tempest | tempest/services/object_storage/account_client.py | [
"Apache-2.0"
] | Python | delete_account_metadata | <not_specific> | def delete_account_metadata(self, metadata,
metadata_prefix='X-Remove-Account-Meta-'):
"""
Deletes an account metadata entry.
"""
headers = {"X-Storage-Token": self.token}
for item in metadata:
headers[metadata_prefix + item] = 'x'
... |
Deletes an account metadata entry.
| Deletes an account metadata entry. | [
"Deletes",
"an",
"account",
"metadata",
"entry",
"."
] | def delete_account_metadata(self, metadata,
metadata_prefix='X-Remove-Account-Meta-'):
headers = {"X-Storage-Token": self.token}
for item in metadata:
headers[metadata_prefix + item] = 'x'
resp, body = self.post('', headers=headers, body=None)
... | [
"def",
"delete_account_metadata",
"(",
"self",
",",
"metadata",
",",
"metadata_prefix",
"=",
"'X-Remove-Account-Meta-'",
")",
":",
"headers",
"=",
"{",
"\"X-Storage-Token\"",
":",
"self",
".",
"token",
"}",
"for",
"item",
"in",
"metadata",
":",
"headers",
"[",
... | Deletes an account metadata entry. | [
"Deletes",
"an",
"account",
"metadata",
"entry",
"."
] | [
"\"\"\"\n Deletes an account metadata entry.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "metadata",
"type": null
},
{
"param": "metadata_prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "metadata",
"type": null,
"docstring": null,
"docstring_tokens... |
e796f9bc06e9034732d4a623250cc2a199c8131f | BeenzSyed/tempest | tempest/services/object_storage/account_client.py | [
"Apache-2.0"
] | Python | request | <not_specific> | def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
self.http_obj = http.ClosingHttp()
if headers is None:
headers = {}
if self.base_url is None:
self._set_auth()
req_url = "%s/%s" % (self.base_url, url)
... | A simple HTTP request interface. | A simple HTTP request interface. | [
"A",
"simple",
"HTTP",
"request",
"interface",
"."
] | def request(self, method, url, headers=None, body=None):
self.http_obj = http.ClosingHttp()
if headers is None:
headers = {}
if self.base_url is None:
self._set_auth()
req_url = "%s/%s" % (self.base_url, url)
self._log_request(method, req_url, headers, bod... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
")",
":",
"self",
".",
"http_obj",
"=",
"http",
".",
"ClosingHttp",
"(",
")",
"if",
"headers",
"is",
"None",
":",
"headers",
"=",
"{",
... | A simple HTTP request interface. | [
"A",
"simple",
"HTTP",
"request",
"interface",
"."
] | [
"\"\"\"A simple HTTP request interface.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "headers",
"type": null
},
{
"param": "body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens":... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | create_node | <not_specific> | def create_node(self, chassis_id, **kwargs):
"""
Create a baremetal node with the specified parameters.
:param cpu_arch: CPU architecture of the node. Default: x86_64.
:param cpu_num: Number of CPUs. Default: 8.
:param storage: Disk size. Default: 1024.
:param memory: Av... |
Create a baremetal node with the specified parameters.
:param cpu_arch: CPU architecture of the node. Default: x86_64.
:param cpu_num: Number of CPUs. Default: 8.
:param storage: Disk size. Default: 1024.
:param memory: Available RAM. Default: 4096.
:param driver: Drive... | Create a baremetal node with the specified parameters. | [
"Create",
"a",
"baremetal",
"node",
"with",
"the",
"specified",
"parameters",
"."
] | def create_node(self, chassis_id, **kwargs):
node = {'chassis_uuid': chassis_id,
'properties': {'cpu_arch': kwargs.get('cpu_arch', 'x86_64'),
'cpu_num': kwargs.get('cpu_num', 8),
'storage': kwargs.get('storage', 1024),
... | [
"def",
"create_node",
"(",
"self",
",",
"chassis_id",
",",
"**",
"kwargs",
")",
":",
"node",
"=",
"{",
"'chassis_uuid'",
":",
"chassis_id",
",",
"'properties'",
":",
"{",
"'cpu_arch'",
":",
"kwargs",
".",
"get",
"(",
"'cpu_arch'",
",",
"'x86_64'",
")",
"... | Create a baremetal node with the specified parameters. | [
"Create",
"a",
"baremetal",
"node",
"with",
"the",
"specified",
"parameters",
"."
] | [
"\"\"\"\n Create a baremetal node with the specified parameters.\n\n :param cpu_arch: CPU architecture of the node. Default: x86_64.\n :param cpu_num: Number of CPUs. Default: 8.\n :param storage: Disk size. Default: 1024.\n :param memory: Available RAM. Default: 4096.\n :p... | [
{
"param": "self",
"type": null
},
{
"param": "chassis_id",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the created node.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"created",
"node",
"."
],
"... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | create_chassis | <not_specific> | def create_chassis(self, **kwargs):
"""
Create a chassis with the specified parameters.
:param description: The description of the chassis.
Default: test-chassis
:return: A tuple with the server response and the created chassis.
"""
chassis = {'description':... |
Create a chassis with the specified parameters.
:param description: The description of the chassis.
Default: test-chassis
:return: A tuple with the server response and the created chassis.
| Create a chassis with the specified parameters. | [
"Create",
"a",
"chassis",
"with",
"the",
"specified",
"parameters",
"."
] | def create_chassis(self, **kwargs):
chassis = {'description': kwargs.get('description', 'test-chassis')}
return self._create_request('chassis', 'chassis', chassis) | [
"def",
"create_chassis",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"chassis",
"=",
"{",
"'description'",
":",
"kwargs",
".",
"get",
"(",
"'description'",
",",
"'test-chassis'",
")",
"}",
"return",
"self",
".",
"_create_request",
"(",
"'chassis'",
",",
"'... | Create a chassis with the specified parameters. | [
"Create",
"a",
"chassis",
"with",
"the",
"specified",
"parameters",
"."
] | [
"\"\"\"\n Create a chassis with the specified parameters.\n\n :param description: The description of the chassis.\n Default: test-chassis\n :return: A tuple with the server response and the created chassis.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the created chassis.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"created",
"chassis",
"."
],
... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | create_port | <not_specific> | def create_port(self, node_id, **kwargs):
"""
Create a port with the specified parameters.
:param node_id: The ID of the node which owns the port.
:param address: MAC address of the port. Default: 01:23:45:67:89:0A.
:return: A tuple with the server response and the created port.... |
Create a port with the specified parameters.
:param node_id: The ID of the node which owns the port.
:param address: MAC address of the port. Default: 01:23:45:67:89:0A.
:return: A tuple with the server response and the created port.
| Create a port with the specified parameters. | [
"Create",
"a",
"port",
"with",
"the",
"specified",
"parameters",
"."
] | def create_port(self, node_id, **kwargs):
port = {'address': kwargs.get('address', '01:23:45:67:89:0A'),
'node_uuid': node_id}
return self._create_request('ports', 'port', port) | [
"def",
"create_port",
"(",
"self",
",",
"node_id",
",",
"**",
"kwargs",
")",
":",
"port",
"=",
"{",
"'address'",
":",
"kwargs",
".",
"get",
"(",
"'address'",
",",
"'01:23:45:67:89:0A'",
")",
",",
"'node_uuid'",
":",
"node_id",
"}",
"return",
"self",
".",... | Create a port with the specified parameters. | [
"Create",
"a",
"port",
"with",
"the",
"specified",
"parameters",
"."
] | [
"\"\"\"\n Create a port with the specified parameters.\n\n :param node_id: The ID of the node which owns the port.\n :param address: MAC address of the port. Default: 01:23:45:67:89:0A.\n :return: A tuple with the server response and the created port.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "node_id",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the created port.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"created",
"port",
"."
],
"... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | delete_node | <not_specific> | def delete_node(self, uuid):
"""
Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node.
:return: A tuple with the server response and the response body.
"""
return self._delete_request('nodes', uuid) |
Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node.
:return: A tuple with the server response and the response body.
| Deletes a node having the specified UUID. | [
"Deletes",
"a",
"node",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_node(self, uuid):
return self._delete_request('nodes', uuid) | [
"def",
"delete_node",
"(",
"self",
",",
"uuid",
")",
":",
"return",
"self",
".",
"_delete_request",
"(",
"'nodes'",
",",
"uuid",
")"
] | Deletes a node having the specified UUID. | [
"Deletes",
"a",
"node",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a node having the specified UUID.\n\n :param uuid: The unique identifier of the node.\n :return: A tuple with the server response and the response body.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "uuid",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the response body.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"response",
"body",
"."
],
... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | delete_chassis | <not_specific> | def delete_chassis(self, uuid):
"""
Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis.
:return: A tuple with the server response and the response body.
"""
return self._delete_request('chassis', uuid) |
Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis.
:return: A tuple with the server response and the response body.
| Deletes a chassis having the specified UUID. | [
"Deletes",
"a",
"chassis",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_chassis(self, uuid):
return self._delete_request('chassis', uuid) | [
"def",
"delete_chassis",
"(",
"self",
",",
"uuid",
")",
":",
"return",
"self",
".",
"_delete_request",
"(",
"'chassis'",
",",
"uuid",
")"
] | Deletes a chassis having the specified UUID. | [
"Deletes",
"a",
"chassis",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a chassis having the specified UUID.\n\n :param uuid: The unique identifier of the chassis.\n :return: A tuple with the server response and the response body.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "uuid",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the response body.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"response",
"body",
"."
],
... |
5e90cd6a630cc4d1e8a6843c1a30c3c26ab4036a | BeenzSyed/tempest | tempest/services/baremetal/v1/base_v1.py | [
"Apache-2.0"
] | Python | delete_port | <not_specific> | def delete_port(self, uuid):
"""
Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port.
:return: A tuple with the server response and the response body.
"""
return self._delete_request('ports', uuid) |
Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port.
:return: A tuple with the server response and the response body.
| Deletes a port having the specified UUID. | [
"Deletes",
"a",
"port",
"having",
"the",
"specified",
"UUID",
"."
] | def delete_port(self, uuid):
return self._delete_request('ports', uuid) | [
"def",
"delete_port",
"(",
"self",
",",
"uuid",
")",
":",
"return",
"self",
".",
"_delete_request",
"(",
"'ports'",
",",
"uuid",
")"
] | Deletes a port having the specified UUID. | [
"Deletes",
"a",
"port",
"having",
"the",
"specified",
"UUID",
"."
] | [
"\"\"\"\n Deletes a port having the specified UUID.\n\n :param uuid: The unique identifier of the port.\n :return: A tuple with the server response and the response body.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "uuid",
"type": null
}
] | {
"returns": [
{
"docstring": "A tuple with the server response and the response body.",
"docstring_tokens": [
"A",
"tuple",
"with",
"the",
"server",
"response",
"and",
"the",
"response",
"body",
"."
],
... |
f568488563efb954b2e65dc1f665e97004e282cb | BeenzSyed/tempest | tempest/services/compute/v3/xml/flavors_client.py | [
"Apache-2.0"
] | Python | create_flavor | <not_specific> | def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
"""Creates a new flavor or instance type."""
flavor = Element("flavor",
xmlns=XMLNS_V3,
ram=ram,
vcpus=vcpus,
disk=disk,
... | Creates a new flavor or instance type. | Creates a new flavor or instance type. | [
"Creates",
"a",
"new",
"flavor",
"or",
"instance",
"type",
"."
] | def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
flavor = Element("flavor",
xmlns=XMLNS_V3,
ram=ram,
vcpus=vcpus,
disk=disk,
id=flavor_id,
na... | [
"def",
"create_flavor",
"(",
"self",
",",
"name",
",",
"ram",
",",
"vcpus",
",",
"disk",
",",
"flavor_id",
",",
"**",
"kwargs",
")",
":",
"flavor",
"=",
"Element",
"(",
"\"flavor\"",
",",
"xmlns",
"=",
"XMLNS_V3",
",",
"ram",
"=",
"ram",
",",
"vcpus"... | Creates a new flavor or instance type. | [
"Creates",
"a",
"new",
"flavor",
"or",
"instance",
"type",
"."
] | [
"\"\"\"Creates a new flavor or instance type.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "ram",
"type": null
},
{
"param": "vcpus",
"type": null
},
{
"param": "disk",
"type": null
},
{
"param": "flavor_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
f568488563efb954b2e65dc1f665e97004e282cb | BeenzSyed/tempest | tempest/services/compute/v3/xml/flavors_client.py | [
"Apache-2.0"
] | Python | update_flavor_extra_spec | <not_specific> | def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
"""Update extra Specs details of the mentioned flavor and key."""
doc = Document()
for (k, v) in kwargs.items():
element = Element(k)
doc.append(element)
value = Text(v)
element.append(v... | Update extra Specs details of the mentioned flavor and key. | Update extra Specs details of the mentioned flavor and key. | [
"Update",
"extra",
"Specs",
"details",
"of",
"the",
"mentioned",
"flavor",
"and",
"key",
"."
] | def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
doc = Document()
for (k, v) in kwargs.items():
element = Element(k)
doc.append(element)
value = Text(v)
element.append(value)
resp, body = self.put('flavors/%s/flavor-extra-specs/%s' %
... | [
"def",
"update_flavor_extra_spec",
"(",
"self",
",",
"flavor_id",
",",
"key",
",",
"**",
"kwargs",
")",
":",
"doc",
"=",
"Document",
"(",
")",
"for",
"(",
"k",
",",
"v",
")",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"element",
"=",
"Element",
"... | Update extra Specs details of the mentioned flavor and key. | [
"Update",
"extra",
"Specs",
"details",
"of",
"the",
"mentioned",
"flavor",
"and",
"key",
"."
] | [
"\"\"\"Update extra Specs details of the mentioned flavor and key.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f568488563efb954b2e65dc1f665e97004e282cb | BeenzSyed/tempest | tempest/services/compute/v3/xml/flavors_client.py | [
"Apache-2.0"
] | Python | list_flavor_access | <not_specific> | def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
resp, body = self.get('flavors/%s/flavor-access' % str(flavor_id),
self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body | Gets flavor access information given the flavor id. | Gets flavor access information given the flavor id. | [
"Gets",
"flavor",
"access",
"information",
"given",
"the",
"flavor",
"id",
"."
] | def list_flavor_access(self, flavor_id):
resp, body = self.get('flavors/%s/flavor-access' % str(flavor_id),
self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body | [
"def",
"list_flavor_access",
"(",
"self",
",",
"flavor_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"'flavors/%s/flavor-access'",
"%",
"str",
"(",
"flavor_id",
")",
",",
"self",
".",
"headers",
")",
"body",
"=",
"self",
".",
"_parse_... | Gets flavor access information given the flavor id. | [
"Gets",
"flavor",
"access",
"information",
"given",
"the",
"flavor",
"id",
"."
] | [
"\"\"\"Gets flavor access information given the flavor id.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f568488563efb954b2e65dc1f665e97004e282cb | BeenzSyed/tempest | tempest/services/compute/v3/xml/flavors_client.py | [
"Apache-2.0"
] | Python | add_flavor_access | <not_specific> | def add_flavor_access(self, flavor_id, tenant_id):
"""Add flavor access for the specified tenant."""
doc = Document()
server = Element("add_tenant_access")
doc.append(server)
server.add_attr("tenant_id", tenant_id)
resp, body = self.post('flavors/%s/action' % str(flavor_i... | Add flavor access for the specified tenant. | Add flavor access for the specified tenant. | [
"Add",
"flavor",
"access",
"for",
"the",
"specified",
"tenant",
"."
] | def add_flavor_access(self, flavor_id, tenant_id):
doc = Document()
server = Element("add_tenant_access")
doc.append(server)
server.add_attr("tenant_id", tenant_id)
resp, body = self.post('flavors/%s/action' % str(flavor_id),
str(doc), self.headers)... | [
"def",
"add_flavor_access",
"(",
"self",
",",
"flavor_id",
",",
"tenant_id",
")",
":",
"doc",
"=",
"Document",
"(",
")",
"server",
"=",
"Element",
"(",
"\"add_tenant_access\"",
")",
"doc",
".",
"append",
"(",
"server",
")",
"server",
".",
"add_attr",
"(",
... | Add flavor access for the specified tenant. | [
"Add",
"flavor",
"access",
"for",
"the",
"specified",
"tenant",
"."
] | [
"\"\"\"Add flavor access for the specified tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
f568488563efb954b2e65dc1f665e97004e282cb | BeenzSyed/tempest | tempest/services/compute/v3/xml/flavors_client.py | [
"Apache-2.0"
] | Python | remove_flavor_access | <not_specific> | def remove_flavor_access(self, flavor_id, tenant_id):
"""Remove flavor access from the specified tenant."""
doc = Document()
server = Element("remove_tenant_access")
doc.append(server)
server.add_attr("tenant_id", tenant_id)
resp, body = self.post('flavors/%s/action' % st... | Remove flavor access from the specified tenant. | Remove flavor access from the specified tenant. | [
"Remove",
"flavor",
"access",
"from",
"the",
"specified",
"tenant",
"."
] | def remove_flavor_access(self, flavor_id, tenant_id):
doc = Document()
server = Element("remove_tenant_access")
doc.append(server)
server.add_attr("tenant_id", tenant_id)
resp, body = self.post('flavors/%s/action' % str(flavor_id),
str(doc), self.he... | [
"def",
"remove_flavor_access",
"(",
"self",
",",
"flavor_id",
",",
"tenant_id",
")",
":",
"doc",
"=",
"Document",
"(",
")",
"server",
"=",
"Element",
"(",
"\"remove_tenant_access\"",
")",
"doc",
".",
"append",
"(",
"server",
")",
"server",
".",
"add_attr",
... | Remove flavor access from the specified tenant. | [
"Remove",
"flavor",
"access",
"from",
"the",
"specified",
"tenant",
"."
] | [
"\"\"\"Remove flavor access from the specified tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flavor_id",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flavor_id",
"type": null,
"docstring": null,
"docstring_token... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | status_timeout | null | def status_timeout(self, things, thing_id, expected_status,
error_status='ERROR',
not_found_exception=nova_exceptions.NotFound):
"""
Given a thing and an expected status, do a loop, sleeping
for a configurable amount of time, checking for the
... |
Given a thing and an expected status, do a loop, sleeping
for a configurable amount of time, checking for the
expected status to show. At any time, if the returned
status of the thing is ERROR, fail out.
| Given a thing and an expected status, do a loop, sleeping
for a configurable amount of time, checking for the
expected status to show. At any time, if the returned
status of the thing is ERROR, fail out. | [
"Given",
"a",
"thing",
"and",
"an",
"expected",
"status",
"do",
"a",
"loop",
"sleeping",
"for",
"a",
"configurable",
"amount",
"of",
"time",
"checking",
"for",
"the",
"expected",
"status",
"to",
"show",
".",
"At",
"any",
"time",
"if",
"the",
"returned",
... | def status_timeout(self, things, thing_id, expected_status,
error_status='ERROR',
not_found_exception=nova_exceptions.NotFound):
self._status_timeout(things, thing_id,
expected_status=expected_status,
error_s... | [
"def",
"status_timeout",
"(",
"self",
",",
"things",
",",
"thing_id",
",",
"expected_status",
",",
"error_status",
"=",
"'ERROR'",
",",
"not_found_exception",
"=",
"nova_exceptions",
".",
"NotFound",
")",
":",
"self",
".",
"_status_timeout",
"(",
"things",
",",
... | Given a thing and an expected status, do a loop, sleeping
for a configurable amount of time, checking for the
expected status to show. | [
"Given",
"a",
"thing",
"and",
"an",
"expected",
"status",
"do",
"a",
"loop",
"sleeping",
"for",
"a",
"configurable",
"amount",
"of",
"time",
"checking",
"for",
"the",
"expected",
"status",
"to",
"show",
"."
] | [
"\"\"\"\n Given a thing and an expected status, do a loop, sleeping\n for a configurable amount of time, checking for the\n expected status to show. At any time, if the returned\n status of the thing is ERROR, fail out.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "things",
"type": null
},
{
"param": "thing_id",
"type": null
},
{
"param": "expected_status",
"type": null
},
{
"param": "error_status",
"type": null
},
{
"param": "not_found_exception",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "things",
"type": null,
"docstring": null,
"docstring_tokens":... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | delete_timeout | null | def delete_timeout(self, things, thing_id,
error_status='ERROR',
not_found_exception=nova_exceptions.NotFound):
"""
Given a thing, do a loop, sleeping
for a configurable amount of time, checking for the
deleted status to show. At any time, if... |
Given a thing, do a loop, sleeping
for a configurable amount of time, checking for the
deleted status to show. At any time, if the returned
status of the thing is ERROR, fail out.
| Given a thing, do a loop, sleeping
for a configurable amount of time, checking for the
deleted status to show. At any time, if the returned
status of the thing is ERROR, fail out. | [
"Given",
"a",
"thing",
"do",
"a",
"loop",
"sleeping",
"for",
"a",
"configurable",
"amount",
"of",
"time",
"checking",
"for",
"the",
"deleted",
"status",
"to",
"show",
".",
"At",
"any",
"time",
"if",
"the",
"returned",
"status",
"of",
"the",
"thing",
"is"... | def delete_timeout(self, things, thing_id,
error_status='ERROR',
not_found_exception=nova_exceptions.NotFound):
self._status_timeout(things,
thing_id,
allow_notfound=True,
error_s... | [
"def",
"delete_timeout",
"(",
"self",
",",
"things",
",",
"thing_id",
",",
"error_status",
"=",
"'ERROR'",
",",
"not_found_exception",
"=",
"nova_exceptions",
".",
"NotFound",
")",
":",
"self",
".",
"_status_timeout",
"(",
"things",
",",
"thing_id",
",",
"allo... | Given a thing, do a loop, sleeping
for a configurable amount of time, checking for the
deleted status to show. | [
"Given",
"a",
"thing",
"do",
"a",
"loop",
"sleeping",
"for",
"a",
"configurable",
"amount",
"of",
"time",
"checking",
"for",
"the",
"deleted",
"status",
"to",
"show",
"."
] | [
"\"\"\"\n Given a thing, do a loop, sleeping\n for a configurable amount of time, checking for the\n deleted status to show. At any time, if the returned\n status of the thing is ERROR, fail out.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "things",
"type": null
},
{
"param": "thing_id",
"type": null
},
{
"param": "error_status",
"type": null
},
{
"param": "not_found_exception",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "things",
"type": null,
"docstring": null,
"docstring_tokens":... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _create_subnet | <not_specific> | def _create_subnet(self, network, namestart='subnet-smoke-'):
"""
Create a subnet for the given network within the cidr block
configured for tenant networks.
"""
cfg = self.config.network
tenant_cidr = netaddr.IPNetwork(cfg.tenant_network_cidr)
result = None
... |
Create a subnet for the given network within the cidr block
configured for tenant networks.
| Create a subnet for the given network within the cidr block
configured for tenant networks. | [
"Create",
"a",
"subnet",
"for",
"the",
"given",
"network",
"within",
"the",
"cidr",
"block",
"configured",
"for",
"tenant",
"networks",
"."
] | def _create_subnet(self, network, namestart='subnet-smoke-'):
cfg = self.config.network
tenant_cidr = netaddr.IPNetwork(cfg.tenant_network_cidr)
result = None
for subnet_cidr in tenant_cidr.subnet(cfg.tenant_network_mask_bits):
body = dict(
subnet=dict(
... | [
"def",
"_create_subnet",
"(",
"self",
",",
"network",
",",
"namestart",
"=",
"'subnet-smoke-'",
")",
":",
"cfg",
"=",
"self",
".",
"config",
".",
"network",
"tenant_cidr",
"=",
"netaddr",
".",
"IPNetwork",
"(",
"cfg",
".",
"tenant_network_cidr",
")",
"result... | Create a subnet for the given network within the cidr block
configured for tenant networks. | [
"Create",
"a",
"subnet",
"for",
"the",
"given",
"network",
"within",
"the",
"cidr",
"block",
"configured",
"for",
"tenant",
"networks",
"."
] | [
"\"\"\"\n Create a subnet for the given network within the cidr block\n configured for tenant networks.\n \"\"\"",
"# Repeatedly attempt subnet creation with sequential cidr",
"# blocks until an unallocated block is found."
] | [
{
"param": "self",
"type": null
},
{
"param": "network",
"type": null
},
{
"param": "namestart",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "network",
"type": null,
"docstring": null,
"docstring_tokens"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.