repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_firewall_policy | def show_firewall_policy(self, firewall_policy, **_params):
"""Fetches information of a certain firewall policy."""
return self.get(self.firewall_policy_path % (firewall_policy),
params=_params) | python | def show_firewall_policy(self, firewall_policy, **_params):
"""Fetches information of a certain firewall policy."""
return self.get(self.firewall_policy_path % (firewall_policy),
params=_params) | [
"def",
"show_firewall_policy",
"(",
"self",
",",
"firewall_policy",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"firewall_policy_path",
"%",
"(",
"firewall_policy",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain firewall policy. | [
"Fetches",
"information",
"of",
"a",
"certain",
"firewall",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1410-L1413 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_firewall_policy | def update_firewall_policy(self, firewall_policy, body=None):
"""Updates a firewall policy."""
return self.put(self.firewall_policy_path % (firewall_policy),
body=body) | python | def update_firewall_policy(self, firewall_policy, body=None):
"""Updates a firewall policy."""
return self.put(self.firewall_policy_path % (firewall_policy),
body=body) | [
"def",
"update_firewall_policy",
"(",
"self",
",",
"firewall_policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"firewall_policy_path",
"%",
"(",
"firewall_policy",
")",
",",
"body",
"=",
"body",
")"
] | Updates a firewall policy. | [
"Updates",
"a",
"firewall",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1419-L1422 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.firewall_policy_insert_rule | def firewall_policy_insert_rule(self, firewall_policy, body=None):
"""Inserts specified rule into firewall policy."""
return self.put(self.firewall_policy_insert_path % (firewall_policy),
body=body) | python | def firewall_policy_insert_rule(self, firewall_policy, body=None):
"""Inserts specified rule into firewall policy."""
return self.put(self.firewall_policy_insert_path % (firewall_policy),
body=body) | [
"def",
"firewall_policy_insert_rule",
"(",
"self",
",",
"firewall_policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"firewall_policy_insert_path",
"%",
"(",
"firewall_policy",
")",
",",
"body",
"=",
"body",
")"
] | Inserts specified rule into firewall policy. | [
"Inserts",
"specified",
"rule",
"into",
"firewall",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1428-L1431 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.firewall_policy_remove_rule | def firewall_policy_remove_rule(self, firewall_policy, body=None):
"""Removes specified rule from firewall policy."""
return self.put(self.firewall_policy_remove_path % (firewall_policy),
body=body) | python | def firewall_policy_remove_rule(self, firewall_policy, body=None):
"""Removes specified rule from firewall policy."""
return self.put(self.firewall_policy_remove_path % (firewall_policy),
body=body) | [
"def",
"firewall_policy_remove_rule",
"(",
"self",
",",
"firewall_policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"firewall_policy_remove_path",
"%",
"(",
"firewall_policy",
")",
",",
"body",
"=",
"body",
")"
] | Removes specified rule from firewall policy. | [
"Removes",
"specified",
"rule",
"from",
"firewall",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1433-L1436 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_firewalls | def list_firewalls(self, retrieve_all=True, **_params):
"""Fetches a list of all firewalls for a project."""
# Pass filters in "params" argument to do_request
return self.list('firewalls', self.firewalls_path, retrieve_all,
**_params) | python | def list_firewalls(self, retrieve_all=True, **_params):
"""Fetches a list of all firewalls for a project."""
# Pass filters in "params" argument to do_request
return self.list('firewalls', self.firewalls_path, retrieve_all,
**_params) | [
"def",
"list_firewalls",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"# Pass filters in \"params\" argument to do_request",
"return",
"self",
".",
"list",
"(",
"'firewalls'",
",",
"self",
".",
"firewalls_path",
",",
"retrieve... | Fetches a list of all firewalls for a project. | [
"Fetches",
"a",
"list",
"of",
"all",
"firewalls",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1438-L1443 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_firewall | def show_firewall(self, firewall, **_params):
"""Fetches information of a certain firewall."""
return self.get(self.firewall_path % (firewall), params=_params) | python | def show_firewall(self, firewall, **_params):
"""Fetches information of a certain firewall."""
return self.get(self.firewall_path % (firewall), params=_params) | [
"def",
"show_firewall",
"(",
"self",
",",
"firewall",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"firewall_path",
"%",
"(",
"firewall",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain firewall. | [
"Fetches",
"information",
"of",
"a",
"certain",
"firewall",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1445-L1447 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_firewall | def update_firewall(self, firewall, body=None):
"""Updates a firewall."""
return self.put(self.firewall_path % (firewall), body=body) | python | def update_firewall(self, firewall, body=None):
"""Updates a firewall."""
return self.put(self.firewall_path % (firewall), body=body) | [
"def",
"update_firewall",
"(",
"self",
",",
"firewall",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"firewall_path",
"%",
"(",
"firewall",
")",
",",
"body",
"=",
"body",
")"
] | Updates a firewall. | [
"Updates",
"a",
"firewall",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1453-L1455 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.remove_router_from_l3_agent | def remove_router_from_l3_agent(self, l3_agent, router_id):
"""Remove a router from l3 agent."""
return self.delete((self.agent_path + self.L3_ROUTERS + "/%s") % (
l3_agent, router_id)) | python | def remove_router_from_l3_agent(self, l3_agent, router_id):
"""Remove a router from l3 agent."""
return self.delete((self.agent_path + self.L3_ROUTERS + "/%s") % (
l3_agent, router_id)) | [
"def",
"remove_router_from_l3_agent",
"(",
"self",
",",
"l3_agent",
",",
"router_id",
")",
":",
"return",
"self",
".",
"delete",
"(",
"(",
"self",
".",
"agent_path",
"+",
"self",
".",
"L3_ROUTERS",
"+",
"\"/%s\"",
")",
"%",
"(",
"l3_agent",
",",
"router_id... | Remove a router from l3 agent. | [
"Remove",
"a",
"router",
"from",
"l3",
"agent",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1461-L1464 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.get_lbaas_agent_hosting_pool | def get_lbaas_agent_hosting_pool(self, pool, **_params):
"""Fetches a loadbalancer agent hosting a pool."""
return self.get((self.pool_path + self.LOADBALANCER_AGENT) % pool,
params=_params) | python | def get_lbaas_agent_hosting_pool(self, pool, **_params):
"""Fetches a loadbalancer agent hosting a pool."""
return self.get((self.pool_path + self.LOADBALANCER_AGENT) % pool,
params=_params) | [
"def",
"get_lbaas_agent_hosting_pool",
"(",
"self",
",",
"pool",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"(",
"self",
".",
"pool_path",
"+",
"self",
".",
"LOADBALANCER_AGENT",
")",
"%",
"pool",
",",
"params",
"=",
"_params"... | Fetches a loadbalancer agent hosting a pool. | [
"Fetches",
"a",
"loadbalancer",
"agent",
"hosting",
"a",
"pool",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1466-L1469 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_pools_on_lbaas_agent | def list_pools_on_lbaas_agent(self, lbaas_agent, **_params):
"""Fetches a list of pools hosted by the loadbalancer agent."""
return self.get((self.agent_path + self.LOADBALANCER_POOLS) %
lbaas_agent, params=_params) | python | def list_pools_on_lbaas_agent(self, lbaas_agent, **_params):
"""Fetches a list of pools hosted by the loadbalancer agent."""
return self.get((self.agent_path + self.LOADBALANCER_POOLS) %
lbaas_agent, params=_params) | [
"def",
"list_pools_on_lbaas_agent",
"(",
"self",
",",
"lbaas_agent",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"(",
"self",
".",
"agent_path",
"+",
"self",
".",
"LOADBALANCER_POOLS",
")",
"%",
"lbaas_agent",
",",
"params",
"=",... | Fetches a list of pools hosted by the loadbalancer agent. | [
"Fetches",
"a",
"list",
"of",
"pools",
"hosted",
"by",
"the",
"loadbalancer",
"agent",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1471-L1474 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.get_lbaas_agent_hosting_loadbalancer | def get_lbaas_agent_hosting_loadbalancer(self, loadbalancer, **_params):
"""Fetches a loadbalancer agent hosting a loadbalancer."""
return self.get((self.lbaas_loadbalancer_path +
self.LOADBALANCER_HOSTING_AGENT) % loadbalancer,
params=_params) | python | def get_lbaas_agent_hosting_loadbalancer(self, loadbalancer, **_params):
"""Fetches a loadbalancer agent hosting a loadbalancer."""
return self.get((self.lbaas_loadbalancer_path +
self.LOADBALANCER_HOSTING_AGENT) % loadbalancer,
params=_params) | [
"def",
"get_lbaas_agent_hosting_loadbalancer",
"(",
"self",
",",
"loadbalancer",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"(",
"self",
".",
"lbaas_loadbalancer_path",
"+",
"self",
".",
"LOADBALANCER_HOSTING_AGENT",
")",
"%",
"loadba... | Fetches a loadbalancer agent hosting a loadbalancer. | [
"Fetches",
"a",
"loadbalancer",
"agent",
"hosting",
"a",
"loadbalancer",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1476-L1480 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_loadbalancers_on_lbaas_agent | def list_loadbalancers_on_lbaas_agent(self, lbaas_agent, **_params):
"""Fetches a list of loadbalancers hosted by the loadbalancer agent."""
return self.get((self.agent_path + self.AGENT_LOADBALANCERS) %
lbaas_agent, params=_params) | python | def list_loadbalancers_on_lbaas_agent(self, lbaas_agent, **_params):
"""Fetches a list of loadbalancers hosted by the loadbalancer agent."""
return self.get((self.agent_path + self.AGENT_LOADBALANCERS) %
lbaas_agent, params=_params) | [
"def",
"list_loadbalancers_on_lbaas_agent",
"(",
"self",
",",
"lbaas_agent",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"(",
"self",
".",
"agent_path",
"+",
"self",
".",
"AGENT_LOADBALANCERS",
")",
"%",
"lbaas_agent",
",",
"params... | Fetches a list of loadbalancers hosted by the loadbalancer agent. | [
"Fetches",
"a",
"list",
"of",
"loadbalancers",
"hosted",
"by",
"the",
"loadbalancer",
"agent",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1482-L1485 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_service_providers | def list_service_providers(self, retrieve_all=True, **_params):
"""Fetches service providers."""
# Pass filters in "params" argument to do_request
return self.list('service_providers', self.service_providers_path,
retrieve_all, **_params) | python | def list_service_providers(self, retrieve_all=True, **_params):
"""Fetches service providers."""
# Pass filters in "params" argument to do_request
return self.list('service_providers', self.service_providers_path,
retrieve_all, **_params) | [
"def",
"list_service_providers",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"# Pass filters in \"params\" argument to do_request",
"return",
"self",
".",
"list",
"(",
"'service_providers'",
",",
"self",
".",
"service_providers_p... | Fetches service providers. | [
"Fetches",
"service",
"providers",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1487-L1491 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_metering_labels | def list_metering_labels(self, retrieve_all=True, **_params):
"""Fetches a list of all metering labels for a project."""
return self.list('metering_labels', self.metering_labels_path,
retrieve_all, **_params) | python | def list_metering_labels(self, retrieve_all=True, **_params):
"""Fetches a list of all metering labels for a project."""
return self.list('metering_labels', self.metering_labels_path,
retrieve_all, **_params) | [
"def",
"list_metering_labels",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'metering_labels'",
",",
"self",
".",
"metering_labels_path",
",",
"retrieve_all",
",",
"*",
"*",
"_params"... | Fetches a list of all metering labels for a project. | [
"Fetches",
"a",
"list",
"of",
"all",
"metering",
"labels",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1501-L1504 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_metering_label | def show_metering_label(self, metering_label, **_params):
"""Fetches information of a certain metering label."""
return self.get(self.metering_label_path %
(metering_label), params=_params) | python | def show_metering_label(self, metering_label, **_params):
"""Fetches information of a certain metering label."""
return self.get(self.metering_label_path %
(metering_label), params=_params) | [
"def",
"show_metering_label",
"(",
"self",
",",
"metering_label",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"metering_label_path",
"%",
"(",
"metering_label",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain metering label. | [
"Fetches",
"information",
"of",
"a",
"certain",
"metering",
"label",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1506-L1509 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_metering_label_rules | def list_metering_label_rules(self, retrieve_all=True, **_params):
"""Fetches a list of all metering label rules for a label."""
return self.list('metering_label_rules',
self.metering_label_rules_path, retrieve_all,
**_params) | python | def list_metering_label_rules(self, retrieve_all=True, **_params):
"""Fetches a list of all metering label rules for a label."""
return self.list('metering_label_rules',
self.metering_label_rules_path, retrieve_all,
**_params) | [
"def",
"list_metering_label_rules",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'metering_label_rules'",
",",
"self",
".",
"metering_label_rules_path",
",",
"retrieve_all",
",",
"*",
"... | Fetches a list of all metering label rules for a label. | [
"Fetches",
"a",
"list",
"of",
"all",
"metering",
"label",
"rules",
"for",
"a",
"label",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1519-L1523 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_metering_label_rule | def show_metering_label_rule(self, metering_label_rule, **_params):
"""Fetches information of a certain metering label rule."""
return self.get(self.metering_label_rule_path %
(metering_label_rule), params=_params) | python | def show_metering_label_rule(self, metering_label_rule, **_params):
"""Fetches information of a certain metering label rule."""
return self.get(self.metering_label_rule_path %
(metering_label_rule), params=_params) | [
"def",
"show_metering_label_rule",
"(",
"self",
",",
"metering_label_rule",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"metering_label_rule_path",
"%",
"(",
"metering_label_rule",
")",
",",
"params",
"=",
"_params",
")"... | Fetches information of a certain metering label rule. | [
"Fetches",
"information",
"of",
"a",
"certain",
"metering",
"label",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1525-L1528 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_rbac_policy | def update_rbac_policy(self, rbac_policy_id, body=None):
"""Update a RBAC policy."""
return self.put(self.rbac_policy_path % rbac_policy_id, body=body) | python | def update_rbac_policy(self, rbac_policy_id, body=None):
"""Update a RBAC policy."""
return self.put(self.rbac_policy_path % rbac_policy_id, body=body) | [
"def",
"update_rbac_policy",
"(",
"self",
",",
"rbac_policy_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"rbac_policy_path",
"%",
"rbac_policy_id",
",",
"body",
"=",
"body",
")"
] | Update a RBAC policy. | [
"Update",
"a",
"RBAC",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1534-L1536 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_rbac_policies | def list_rbac_policies(self, retrieve_all=True, **_params):
"""Fetch a list of all RBAC policies for a project."""
return self.list('rbac_policies', self.rbac_policies_path,
retrieve_all, **_params) | python | def list_rbac_policies(self, retrieve_all=True, **_params):
"""Fetch a list of all RBAC policies for a project."""
return self.list('rbac_policies', self.rbac_policies_path,
retrieve_all, **_params) | [
"def",
"list_rbac_policies",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'rbac_policies'",
",",
"self",
".",
"rbac_policies_path",
",",
"retrieve_all",
",",
"*",
"*",
"_params",
")... | Fetch a list of all RBAC policies for a project. | [
"Fetch",
"a",
"list",
"of",
"all",
"RBAC",
"policies",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1538-L1541 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_rbac_policy | def show_rbac_policy(self, rbac_policy_id, **_params):
"""Fetch information of a certain RBAC policy."""
return self.get(self.rbac_policy_path % rbac_policy_id,
params=_params) | python | def show_rbac_policy(self, rbac_policy_id, **_params):
"""Fetch information of a certain RBAC policy."""
return self.get(self.rbac_policy_path % rbac_policy_id,
params=_params) | [
"def",
"show_rbac_policy",
"(",
"self",
",",
"rbac_policy_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"rbac_policy_path",
"%",
"rbac_policy_id",
",",
"params",
"=",
"_params",
")"
] | Fetch information of a certain RBAC policy. | [
"Fetch",
"information",
"of",
"a",
"certain",
"RBAC",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1543-L1546 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_qos_policies | def list_qos_policies(self, retrieve_all=True, **_params):
"""Fetches a list of all qos policies for a project."""
# Pass filters in "params" argument to do_request
return self.list('policies', self.qos_policies_path,
retrieve_all, **_params) | python | def list_qos_policies(self, retrieve_all=True, **_params):
"""Fetches a list of all qos policies for a project."""
# Pass filters in "params" argument to do_request
return self.list('policies', self.qos_policies_path,
retrieve_all, **_params) | [
"def",
"list_qos_policies",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"# Pass filters in \"params\" argument to do_request",
"return",
"self",
".",
"list",
"(",
"'policies'",
",",
"self",
".",
"qos_policies_path",
",",
"ret... | Fetches a list of all qos policies for a project. | [
"Fetches",
"a",
"list",
"of",
"all",
"qos",
"policies",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1552-L1556 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_qos_policy | def show_qos_policy(self, qos_policy, **_params):
"""Fetches information of a certain qos policy."""
return self.get(self.qos_policy_path % qos_policy,
params=_params) | python | def show_qos_policy(self, qos_policy, **_params):
"""Fetches information of a certain qos policy."""
return self.get(self.qos_policy_path % qos_policy,
params=_params) | [
"def",
"show_qos_policy",
"(",
"self",
",",
"qos_policy",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"qos_policy_path",
"%",
"qos_policy",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain qos policy. | [
"Fetches",
"information",
"of",
"a",
"certain",
"qos",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1558-L1561 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_qos_policy | def update_qos_policy(self, qos_policy, body=None):
"""Updates a qos policy."""
return self.put(self.qos_policy_path % qos_policy,
body=body) | python | def update_qos_policy(self, qos_policy, body=None):
"""Updates a qos policy."""
return self.put(self.qos_policy_path % qos_policy,
body=body) | [
"def",
"update_qos_policy",
"(",
"self",
",",
"qos_policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"qos_policy_path",
"%",
"qos_policy",
",",
"body",
"=",
"body",
")"
] | Updates a qos policy. | [
"Updates",
"a",
"qos",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1567-L1570 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_qos_rule_types | def list_qos_rule_types(self, retrieve_all=True, **_params):
"""List available qos rule types."""
return self.list('rule_types', self.qos_rule_types_path,
retrieve_all, **_params) | python | def list_qos_rule_types(self, retrieve_all=True, **_params):
"""List available qos rule types."""
return self.list('rule_types', self.qos_rule_types_path,
retrieve_all, **_params) | [
"def",
"list_qos_rule_types",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'rule_types'",
",",
"self",
".",
"qos_rule_types_path",
",",
"retrieve_all",
",",
"*",
"*",
"_params",
")"... | List available qos rule types. | [
"List",
"available",
"qos",
"rule",
"types",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1576-L1579 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_bandwidth_limit_rules | def list_bandwidth_limit_rules(self, policy_id,
retrieve_all=True, **_params):
"""Fetches a list of all bandwidth limit rules for the given policy."""
return self.list('bandwidth_limit_rules',
self.qos_bandwidth_limit_rules_path % policy_id,
... | python | def list_bandwidth_limit_rules(self, policy_id,
retrieve_all=True, **_params):
"""Fetches a list of all bandwidth limit rules for the given policy."""
return self.list('bandwidth_limit_rules',
self.qos_bandwidth_limit_rules_path % policy_id,
... | [
"def",
"list_bandwidth_limit_rules",
"(",
"self",
",",
"policy_id",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'bandwidth_limit_rules'",
",",
"self",
".",
"qos_bandwidth_limit_rules_path",
"%",
"pol... | Fetches a list of all bandwidth limit rules for the given policy. | [
"Fetches",
"a",
"list",
"of",
"all",
"bandwidth",
"limit",
"rules",
"for",
"the",
"given",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1581-L1586 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_bandwidth_limit_rule | def show_bandwidth_limit_rule(self, rule, policy, body=None):
"""Fetches information of a certain bandwidth limit rule."""
return self.get(self.qos_bandwidth_limit_rule_path %
(policy, rule), body=body) | python | def show_bandwidth_limit_rule(self, rule, policy, body=None):
"""Fetches information of a certain bandwidth limit rule."""
return self.get(self.qos_bandwidth_limit_rule_path %
(policy, rule), body=body) | [
"def",
"show_bandwidth_limit_rule",
"(",
"self",
",",
"rule",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"qos_bandwidth_limit_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
",",
"body",
"=",
"bod... | Fetches information of a certain bandwidth limit rule. | [
"Fetches",
"information",
"of",
"a",
"certain",
"bandwidth",
"limit",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1588-L1591 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.create_bandwidth_limit_rule | def create_bandwidth_limit_rule(self, policy, body=None):
"""Creates a new bandwidth limit rule."""
return self.post(self.qos_bandwidth_limit_rules_path % policy,
body=body) | python | def create_bandwidth_limit_rule(self, policy, body=None):
"""Creates a new bandwidth limit rule."""
return self.post(self.qos_bandwidth_limit_rules_path % policy,
body=body) | [
"def",
"create_bandwidth_limit_rule",
"(",
"self",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"post",
"(",
"self",
".",
"qos_bandwidth_limit_rules_path",
"%",
"policy",
",",
"body",
"=",
"body",
")"
] | Creates a new bandwidth limit rule. | [
"Creates",
"a",
"new",
"bandwidth",
"limit",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1593-L1596 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_bandwidth_limit_rule | def update_bandwidth_limit_rule(self, rule, policy, body=None):
"""Updates a bandwidth limit rule."""
return self.put(self.qos_bandwidth_limit_rule_path %
(policy, rule), body=body) | python | def update_bandwidth_limit_rule(self, rule, policy, body=None):
"""Updates a bandwidth limit rule."""
return self.put(self.qos_bandwidth_limit_rule_path %
(policy, rule), body=body) | [
"def",
"update_bandwidth_limit_rule",
"(",
"self",
",",
"rule",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"qos_bandwidth_limit_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
",",
"body",
"=",
"b... | Updates a bandwidth limit rule. | [
"Updates",
"a",
"bandwidth",
"limit",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1598-L1601 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.delete_bandwidth_limit_rule | def delete_bandwidth_limit_rule(self, rule, policy):
"""Deletes a bandwidth limit rule."""
return self.delete(self.qos_bandwidth_limit_rule_path %
(policy, rule)) | python | def delete_bandwidth_limit_rule(self, rule, policy):
"""Deletes a bandwidth limit rule."""
return self.delete(self.qos_bandwidth_limit_rule_path %
(policy, rule)) | [
"def",
"delete_bandwidth_limit_rule",
"(",
"self",
",",
"rule",
",",
"policy",
")",
":",
"return",
"self",
".",
"delete",
"(",
"self",
".",
"qos_bandwidth_limit_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
")"
] | Deletes a bandwidth limit rule. | [
"Deletes",
"a",
"bandwidth",
"limit",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1603-L1606 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_dscp_marking_rules | def list_dscp_marking_rules(self, policy_id,
retrieve_all=True, **_params):
"""Fetches a list of all DSCP marking rules for the given policy."""
return self.list('dscp_marking_rules',
self.qos_dscp_marking_rules_path % policy_id,
... | python | def list_dscp_marking_rules(self, policy_id,
retrieve_all=True, **_params):
"""Fetches a list of all DSCP marking rules for the given policy."""
return self.list('dscp_marking_rules',
self.qos_dscp_marking_rules_path % policy_id,
... | [
"def",
"list_dscp_marking_rules",
"(",
"self",
",",
"policy_id",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'dscp_marking_rules'",
",",
"self",
".",
"qos_dscp_marking_rules_path",
"%",
"policy_id",
... | Fetches a list of all DSCP marking rules for the given policy. | [
"Fetches",
"a",
"list",
"of",
"all",
"DSCP",
"marking",
"rules",
"for",
"the",
"given",
"policy",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1608-L1613 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_dscp_marking_rule | def show_dscp_marking_rule(self, rule, policy, body=None):
"""Shows information of a certain DSCP marking rule."""
return self.get(self.qos_dscp_marking_rule_path %
(policy, rule), body=body) | python | def show_dscp_marking_rule(self, rule, policy, body=None):
"""Shows information of a certain DSCP marking rule."""
return self.get(self.qos_dscp_marking_rule_path %
(policy, rule), body=body) | [
"def",
"show_dscp_marking_rule",
"(",
"self",
",",
"rule",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"qos_dscp_marking_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
",",
"body",
"=",
"body",
... | Shows information of a certain DSCP marking rule. | [
"Shows",
"information",
"of",
"a",
"certain",
"DSCP",
"marking",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1615-L1618 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.create_dscp_marking_rule | def create_dscp_marking_rule(self, policy, body=None):
"""Creates a new DSCP marking rule."""
return self.post(self.qos_dscp_marking_rules_path % policy,
body=body) | python | def create_dscp_marking_rule(self, policy, body=None):
"""Creates a new DSCP marking rule."""
return self.post(self.qos_dscp_marking_rules_path % policy,
body=body) | [
"def",
"create_dscp_marking_rule",
"(",
"self",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"post",
"(",
"self",
".",
"qos_dscp_marking_rules_path",
"%",
"policy",
",",
"body",
"=",
"body",
")"
] | Creates a new DSCP marking rule. | [
"Creates",
"a",
"new",
"DSCP",
"marking",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1620-L1623 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_dscp_marking_rule | def update_dscp_marking_rule(self, rule, policy, body=None):
"""Updates a DSCP marking rule."""
return self.put(self.qos_dscp_marking_rule_path %
(policy, rule), body=body) | python | def update_dscp_marking_rule(self, rule, policy, body=None):
"""Updates a DSCP marking rule."""
return self.put(self.qos_dscp_marking_rule_path %
(policy, rule), body=body) | [
"def",
"update_dscp_marking_rule",
"(",
"self",
",",
"rule",
",",
"policy",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"qos_dscp_marking_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
",",
"body",
"=",
"body",
... | Updates a DSCP marking rule. | [
"Updates",
"a",
"DSCP",
"marking",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1625-L1628 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.delete_dscp_marking_rule | def delete_dscp_marking_rule(self, rule, policy):
"""Deletes a DSCP marking rule."""
return self.delete(self.qos_dscp_marking_rule_path %
(policy, rule)) | python | def delete_dscp_marking_rule(self, rule, policy):
"""Deletes a DSCP marking rule."""
return self.delete(self.qos_dscp_marking_rule_path %
(policy, rule)) | [
"def",
"delete_dscp_marking_rule",
"(",
"self",
",",
"rule",
",",
"policy",
")",
":",
"return",
"self",
".",
"delete",
"(",
"self",
".",
"qos_dscp_marking_rule_path",
"%",
"(",
"policy",
",",
"rule",
")",
")"
] | Deletes a DSCP marking rule. | [
"Deletes",
"a",
"DSCP",
"marking",
"rule",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1630-L1633 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_flavors | def list_flavors(self, retrieve_all=True, **_params):
"""Fetches a list of all Neutron service flavors for a project."""
return self.list('flavors', self.flavors_path, retrieve_all,
**_params) | python | def list_flavors(self, retrieve_all=True, **_params):
"""Fetches a list of all Neutron service flavors for a project."""
return self.list('flavors', self.flavors_path, retrieve_all,
**_params) | [
"def",
"list_flavors",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'flavors'",
",",
"self",
".",
"flavors_path",
",",
"retrieve_all",
",",
"*",
"*",
"_params",
")"
] | Fetches a list of all Neutron service flavors for a project. | [
"Fetches",
"a",
"list",
"of",
"all",
"Neutron",
"service",
"flavors",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1643-L1646 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_flavor | def show_flavor(self, flavor, **_params):
"""Fetches information for a certain Neutron service flavor."""
return self.get(self.flavor_path % (flavor), params=_params) | python | def show_flavor(self, flavor, **_params):
"""Fetches information for a certain Neutron service flavor."""
return self.get(self.flavor_path % (flavor), params=_params) | [
"def",
"show_flavor",
"(",
"self",
",",
"flavor",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"flavor_path",
"%",
"(",
"flavor",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information for a certain Neutron service flavor. | [
"Fetches",
"information",
"for",
"a",
"certain",
"Neutron",
"service",
"flavor",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1648-L1650 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_flavor | def update_flavor(self, flavor, body):
"""Update a Neutron service flavor."""
return self.put(self.flavor_path % (flavor), body=body) | python | def update_flavor(self, flavor, body):
"""Update a Neutron service flavor."""
return self.put(self.flavor_path % (flavor), body=body) | [
"def",
"update_flavor",
"(",
"self",
",",
"flavor",
",",
"body",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"flavor_path",
"%",
"(",
"flavor",
")",
",",
"body",
"=",
"body",
")"
] | Update a Neutron service flavor. | [
"Update",
"a",
"Neutron",
"service",
"flavor",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1652-L1654 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.associate_flavor | def associate_flavor(self, flavor, body):
"""Associate a Neutron service flavor with a profile."""
return self.post(self.flavor_profile_bindings_path %
(flavor), body=body) | python | def associate_flavor(self, flavor, body):
"""Associate a Neutron service flavor with a profile."""
return self.post(self.flavor_profile_bindings_path %
(flavor), body=body) | [
"def",
"associate_flavor",
"(",
"self",
",",
"flavor",
",",
"body",
")",
":",
"return",
"self",
".",
"post",
"(",
"self",
".",
"flavor_profile_bindings_path",
"%",
"(",
"flavor",
")",
",",
"body",
"=",
"body",
")"
] | Associate a Neutron service flavor with a profile. | [
"Associate",
"a",
"Neutron",
"service",
"flavor",
"with",
"a",
"profile",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1656-L1659 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.disassociate_flavor | def disassociate_flavor(self, flavor, flavor_profile):
"""Disassociate a Neutron service flavor with a profile."""
return self.delete(self.flavor_profile_binding_path %
(flavor, flavor_profile)) | python | def disassociate_flavor(self, flavor, flavor_profile):
"""Disassociate a Neutron service flavor with a profile."""
return self.delete(self.flavor_profile_binding_path %
(flavor, flavor_profile)) | [
"def",
"disassociate_flavor",
"(",
"self",
",",
"flavor",
",",
"flavor_profile",
")",
":",
"return",
"self",
".",
"delete",
"(",
"self",
".",
"flavor_profile_binding_path",
"%",
"(",
"flavor",
",",
"flavor_profile",
")",
")"
] | Disassociate a Neutron service flavor with a profile. | [
"Disassociate",
"a",
"Neutron",
"service",
"flavor",
"with",
"a",
"profile",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1661-L1664 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_service_profiles | def list_service_profiles(self, retrieve_all=True, **_params):
"""Fetches a list of all Neutron service flavor profiles."""
return self.list('service_profiles', self.service_profiles_path,
retrieve_all, **_params) | python | def list_service_profiles(self, retrieve_all=True, **_params):
"""Fetches a list of all Neutron service flavor profiles."""
return self.list('service_profiles', self.service_profiles_path,
retrieve_all, **_params) | [
"def",
"list_service_profiles",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'service_profiles'",
",",
"self",
".",
"service_profiles_path",
",",
"retrieve_all",
",",
"*",
"*",
"_para... | Fetches a list of all Neutron service flavor profiles. | [
"Fetches",
"a",
"list",
"of",
"all",
"Neutron",
"service",
"flavor",
"profiles",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1674-L1677 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_service_profile | def show_service_profile(self, flavor_profile, **_params):
"""Fetches information for a certain Neutron service flavor profile."""
return self.get(self.service_profile_path % (flavor_profile),
params=_params) | python | def show_service_profile(self, flavor_profile, **_params):
"""Fetches information for a certain Neutron service flavor profile."""
return self.get(self.service_profile_path % (flavor_profile),
params=_params) | [
"def",
"show_service_profile",
"(",
"self",
",",
"flavor_profile",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"service_profile_path",
"%",
"(",
"flavor_profile",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information for a certain Neutron service flavor profile. | [
"Fetches",
"information",
"for",
"a",
"certain",
"Neutron",
"service",
"flavor",
"profile",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1679-L1682 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_service_profile | def update_service_profile(self, service_profile, body):
"""Update a Neutron service profile."""
return self.put(self.service_profile_path % (service_profile),
body=body) | python | def update_service_profile(self, service_profile, body):
"""Update a Neutron service profile."""
return self.put(self.service_profile_path % (service_profile),
body=body) | [
"def",
"update_service_profile",
"(",
"self",
",",
"service_profile",
",",
"body",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"service_profile_path",
"%",
"(",
"service_profile",
")",
",",
"body",
"=",
"body",
")"
] | Update a Neutron service profile. | [
"Update",
"a",
"Neutron",
"service",
"profile",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1684-L1687 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_availability_zones | def list_availability_zones(self, retrieve_all=True, **_params):
"""Fetches a list of all availability zones."""
return self.list('availability_zones', self.availability_zones_path,
retrieve_all, **_params) | python | def list_availability_zones(self, retrieve_all=True, **_params):
"""Fetches a list of all availability zones."""
return self.list('availability_zones', self.availability_zones_path,
retrieve_all, **_params) | [
"def",
"list_availability_zones",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'availability_zones'",
",",
"self",
".",
"availability_zones_path",
",",
"retrieve_all",
",",
"*",
"*",
... | Fetches a list of all availability zones. | [
"Fetches",
"a",
"list",
"of",
"all",
"availability",
"zones",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1689-L1692 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.get_auto_allocated_topology | def get_auto_allocated_topology(self, project_id, **_params):
"""Fetch information about a project's auto-allocated topology."""
return self.get(
self.auto_allocated_topology_path % project_id,
params=_params) | python | def get_auto_allocated_topology(self, project_id, **_params):
"""Fetch information about a project's auto-allocated topology."""
return self.get(
self.auto_allocated_topology_path % project_id,
params=_params) | [
"def",
"get_auto_allocated_topology",
"(",
"self",
",",
"project_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"auto_allocated_topology_path",
"%",
"project_id",
",",
"params",
"=",
"_params",
")"
] | Fetch information about a project's auto-allocated topology. | [
"Fetch",
"information",
"about",
"a",
"project",
"s",
"auto",
"-",
"allocated",
"topology",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1696-L1700 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_bgp_speakers | def list_bgp_speakers(self, retrieve_all=True, **_params):
"""Fetches a list of all BGP speakers for a project."""
return self.list('bgp_speakers', self.bgp_speakers_path, retrieve_all,
**_params) | python | def list_bgp_speakers(self, retrieve_all=True, **_params):
"""Fetches a list of all BGP speakers for a project."""
return self.list('bgp_speakers', self.bgp_speakers_path, retrieve_all,
**_params) | [
"def",
"list_bgp_speakers",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'bgp_speakers'",
",",
"self",
".",
"bgp_speakers_path",
",",
"retrieve_all",
",",
"*",
"*",
"_params",
")"
] | Fetches a list of all BGP speakers for a project. | [
"Fetches",
"a",
"list",
"of",
"all",
"BGP",
"speakers",
"for",
"a",
"project",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1708-L1711 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_bgp_speaker | def show_bgp_speaker(self, bgp_speaker_id, **_params):
"""Fetches information of a certain BGP speaker."""
return self.get(self.bgp_speaker_path % (bgp_speaker_id),
params=_params) | python | def show_bgp_speaker(self, bgp_speaker_id, **_params):
"""Fetches information of a certain BGP speaker."""
return self.get(self.bgp_speaker_path % (bgp_speaker_id),
params=_params) | [
"def",
"show_bgp_speaker",
"(",
"self",
",",
"bgp_speaker_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"(",
"bgp_speaker_id",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain BGP speaker. | [
"Fetches",
"information",
"of",
"a",
"certain",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1713-L1716 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_bgp_speaker | def update_bgp_speaker(self, bgp_speaker_id, body=None):
"""Update a BGP speaker."""
return self.put(self.bgp_speaker_path % bgp_speaker_id, body=body) | python | def update_bgp_speaker(self, bgp_speaker_id, body=None):
"""Update a BGP speaker."""
return self.put(self.bgp_speaker_path % bgp_speaker_id, body=body) | [
"def",
"update_bgp_speaker",
"(",
"self",
",",
"bgp_speaker_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"bgp_speaker_id",
",",
"body",
"=",
"body",
")"
] | Update a BGP speaker. | [
"Update",
"a",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1722-L1724 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.add_peer_to_bgp_speaker | def add_peer_to_bgp_speaker(self, speaker_id, body=None):
"""Adds a peer to BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/add_bgp_peer", body=body) | python | def add_peer_to_bgp_speaker(self, speaker_id, body=None):
"""Adds a peer to BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/add_bgp_peer", body=body) | [
"def",
"add_peer_to_bgp_speaker",
"(",
"self",
",",
"speaker_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"speaker_id",
")",
"+",
"\"/add_bgp_peer\"",
",",
"body",
"=",
"body",
")"
] | Adds a peer to BGP speaker. | [
"Adds",
"a",
"peer",
"to",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1730-L1733 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.remove_peer_from_bgp_speaker | def remove_peer_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a peer from BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/remove_bgp_peer", body=body) | python | def remove_peer_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a peer from BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/remove_bgp_peer", body=body) | [
"def",
"remove_peer_from_bgp_speaker",
"(",
"self",
",",
"speaker_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"speaker_id",
")",
"+",
"\"/remove_bgp_peer\"",
",",
"body",
"=",
"body",... | Removes a peer from BGP speaker. | [
"Removes",
"a",
"peer",
"from",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1735-L1738 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.add_network_to_bgp_speaker | def add_network_to_bgp_speaker(self, speaker_id, body=None):
"""Adds a network to BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/add_gateway_network", body=body) | python | def add_network_to_bgp_speaker(self, speaker_id, body=None):
"""Adds a network to BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/add_gateway_network", body=body) | [
"def",
"add_network_to_bgp_speaker",
"(",
"self",
",",
"speaker_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"speaker_id",
")",
"+",
"\"/add_gateway_network\"",
",",
"body",
"=",
"body... | Adds a network to BGP speaker. | [
"Adds",
"a",
"network",
"to",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1740-L1743 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.remove_network_from_bgp_speaker | def remove_network_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a network from BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/remove_gateway_network", body=body) | python | def remove_network_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a network from BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/remove_gateway_network", body=body) | [
"def",
"remove_network_from_bgp_speaker",
"(",
"self",
",",
"speaker_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"speaker_id",
")",
"+",
"\"/remove_gateway_network\"",
",",
"body",
"=",... | Removes a network from BGP speaker. | [
"Removes",
"a",
"network",
"from",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1745-L1748 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_route_advertised_from_bgp_speaker | def list_route_advertised_from_bgp_speaker(self, speaker_id, **_params):
"""Fetches a list of all routes advertised by BGP speaker."""
return self.get((self.bgp_speaker_path % speaker_id) +
"/get_advertised_routes", params=_params) | python | def list_route_advertised_from_bgp_speaker(self, speaker_id, **_params):
"""Fetches a list of all routes advertised by BGP speaker."""
return self.get((self.bgp_speaker_path % speaker_id) +
"/get_advertised_routes", params=_params) | [
"def",
"list_route_advertised_from_bgp_speaker",
"(",
"self",
",",
"speaker_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"(",
"self",
".",
"bgp_speaker_path",
"%",
"speaker_id",
")",
"+",
"\"/get_advertised_routes\"",
",",
"params"... | Fetches a list of all routes advertised by BGP speaker. | [
"Fetches",
"a",
"list",
"of",
"all",
"routes",
"advertised",
"by",
"BGP",
"speaker",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1750-L1753 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_bgp_peer | def show_bgp_peer(self, peer_id, **_params):
"""Fetches information of a certain BGP peer."""
return self.get(self.bgp_peer_path % peer_id,
params=_params) | python | def show_bgp_peer(self, peer_id, **_params):
"""Fetches information of a certain BGP peer."""
return self.get(self.bgp_peer_path % peer_id,
params=_params) | [
"def",
"show_bgp_peer",
"(",
"self",
",",
"peer_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"bgp_peer_path",
"%",
"peer_id",
",",
"params",
"=",
"_params",
")"
] | Fetches information of a certain BGP peer. | [
"Fetches",
"information",
"of",
"a",
"certain",
"BGP",
"peer",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1759-L1762 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.update_bgp_peer | def update_bgp_peer(self, bgp_peer_id, body=None):
"""Update a BGP peer."""
return self.put(self.bgp_peer_path % bgp_peer_id, body=body) | python | def update_bgp_peer(self, bgp_peer_id, body=None):
"""Update a BGP peer."""
return self.put(self.bgp_peer_path % bgp_peer_id, body=body) | [
"def",
"update_bgp_peer",
"(",
"self",
",",
"bgp_peer_id",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"bgp_peer_path",
"%",
"bgp_peer_id",
",",
"body",
"=",
"body",
")"
] | Update a BGP peer. | [
"Update",
"a",
"BGP",
"peer",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1768-L1770 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.list_network_ip_availabilities | def list_network_ip_availabilities(self, retrieve_all=True, **_params):
"""Fetches IP availibility information for all networks"""
return self.list('network_ip_availabilities',
self.network_ip_availabilities_path,
retrieve_all, **_params) | python | def list_network_ip_availabilities(self, retrieve_all=True, **_params):
"""Fetches IP availibility information for all networks"""
return self.list('network_ip_availabilities',
self.network_ip_availabilities_path,
retrieve_all, **_params) | [
"def",
"list_network_ip_availabilities",
"(",
"self",
",",
"retrieve_all",
"=",
"True",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"list",
"(",
"'network_ip_availabilities'",
",",
"self",
".",
"network_ip_availabilities_path",
",",
"retrieve_all",
... | Fetches IP availibility information for all networks | [
"Fetches",
"IP",
"availibility",
"information",
"for",
"all",
"networks"
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1776-L1780 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.show_network_ip_availability | def show_network_ip_availability(self, network, **_params):
"""Fetches IP availability information for a specified network"""
return self.get(self.network_ip_availability_path % (network),
params=_params) | python | def show_network_ip_availability(self, network, **_params):
"""Fetches IP availability information for a specified network"""
return self.get(self.network_ip_availability_path % (network),
params=_params) | [
"def",
"show_network_ip_availability",
"(",
"self",
",",
"network",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"network_ip_availability_path",
"%",
"(",
"network",
")",
",",
"params",
"=",
"_params",
")"
] | Fetches IP availability information for a specified network | [
"Fetches",
"IP",
"availability",
"information",
"for",
"a",
"specified",
"network"
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1782-L1785 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.add_tag | def add_tag(self, resource_type, resource_id, tag, **_params):
"""Add a tag on the resource."""
return self.put(self.tag_path % (resource_type, resource_id, tag)) | python | def add_tag(self, resource_type, resource_id, tag, **_params):
"""Add a tag on the resource."""
return self.put(self.tag_path % (resource_type, resource_id, tag)) | [
"def",
"add_tag",
"(",
"self",
",",
"resource_type",
",",
"resource_id",
",",
"tag",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"tag_path",
"%",
"(",
"resource_type",
",",
"resource_id",
",",
"tag",
")",
")"
] | Add a tag on the resource. | [
"Add",
"a",
"tag",
"on",
"the",
"resource",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1787-L1789 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.replace_tag | def replace_tag(self, resource_type, resource_id, body, **_params):
"""Replace tags on the resource."""
return self.put(self.tags_path % (resource_type, resource_id), body) | python | def replace_tag(self, resource_type, resource_id, body, **_params):
"""Replace tags on the resource."""
return self.put(self.tags_path % (resource_type, resource_id), body) | [
"def",
"replace_tag",
"(",
"self",
",",
"resource_type",
",",
"resource_id",
",",
"body",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"put",
"(",
"self",
".",
"tags_path",
"%",
"(",
"resource_type",
",",
"resource_id",
")",
",",
"body",
... | Replace tags on the resource. | [
"Replace",
"tags",
"on",
"the",
"resource",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1791-L1793 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.remove_tag | def remove_tag(self, resource_type, resource_id, tag, **_params):
"""Remove a tag on the resource."""
return self.delete(self.tag_path % (resource_type, resource_id, tag)) | python | def remove_tag(self, resource_type, resource_id, tag, **_params):
"""Remove a tag on the resource."""
return self.delete(self.tag_path % (resource_type, resource_id, tag)) | [
"def",
"remove_tag",
"(",
"self",
",",
"resource_type",
",",
"resource_id",
",",
"tag",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"delete",
"(",
"self",
".",
"tag_path",
"%",
"(",
"resource_type",
",",
"resource_id",
",",
"tag",
")",
"... | Remove a tag on the resource. | [
"Remove",
"a",
"tag",
"on",
"the",
"resource",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1795-L1797 |
rackerlabs/rackspace-python-neutronclient | neutronclient/v2_0/client.py | Client.remove_tag_all | def remove_tag_all(self, resource_type, resource_id, **_params):
"""Remove all tags on the resource."""
return self.delete(self.tags_path % (resource_type, resource_id)) | python | def remove_tag_all(self, resource_type, resource_id, **_params):
"""Remove all tags on the resource."""
return self.delete(self.tags_path % (resource_type, resource_id)) | [
"def",
"remove_tag_all",
"(",
"self",
",",
"resource_type",
",",
"resource_id",
",",
"*",
"*",
"_params",
")",
":",
"return",
"self",
".",
"delete",
"(",
"self",
".",
"tags_path",
"%",
"(",
"resource_type",
",",
"resource_id",
")",
")"
] | Remove all tags on the resource. | [
"Remove",
"all",
"tags",
"on",
"the",
"resource",
"."
] | train | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L1799-L1801 |
alexhayes/django-toolkit | django_toolkit/url/shorten.py | shorten_url | def shorten_url(url, length=32, strip_www=True, strip_path=True, ellipsis=False):
"""
Shorten a URL by chopping out the middle.
For example if supplied with http://subdomain.example.com.au and length 16
the following would be returned.
sub...le.com.au
"""
if '://' not in url:
# Ens... | python | def shorten_url(url, length=32, strip_www=True, strip_path=True, ellipsis=False):
"""
Shorten a URL by chopping out the middle.
For example if supplied with http://subdomain.example.com.au and length 16
the following would be returned.
sub...le.com.au
"""
if '://' not in url:
# Ens... | [
"def",
"shorten_url",
"(",
"url",
",",
"length",
"=",
"32",
",",
"strip_www",
"=",
"True",
",",
"strip_path",
"=",
"True",
",",
"ellipsis",
"=",
"False",
")",
":",
"if",
"'://'",
"not",
"in",
"url",
":",
"# Ensure we have a protocol",
"url",
"=",
"'http:... | Shorten a URL by chopping out the middle.
For example if supplied with http://subdomain.example.com.au and length 16
the following would be returned.
sub...le.com.au | [
"Shorten",
"a",
"URL",
"by",
"chopping",
"out",
"the",
"middle",
"."
] | train | https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/url/shorten.py#L12-L52 |
alexhayes/django-toolkit | django_toolkit/url/shorten.py | netloc_no_www | def netloc_no_www(url):
"""
For a given URL return the netloc with any www. striped.
"""
ext = tldextract.extract(url)
if ext.subdomain and ext.subdomain != 'www':
return '%s.%s.%s' % (ext.subdomain, ext.domain, ext.tld)
else:
return '%s.%s' % (ext.domain, ext.tld) | python | def netloc_no_www(url):
"""
For a given URL return the netloc with any www. striped.
"""
ext = tldextract.extract(url)
if ext.subdomain and ext.subdomain != 'www':
return '%s.%s.%s' % (ext.subdomain, ext.domain, ext.tld)
else:
return '%s.%s' % (ext.domain, ext.tld) | [
"def",
"netloc_no_www",
"(",
"url",
")",
":",
"ext",
"=",
"tldextract",
".",
"extract",
"(",
"url",
")",
"if",
"ext",
".",
"subdomain",
"and",
"ext",
".",
"subdomain",
"!=",
"'www'",
":",
"return",
"'%s.%s.%s'",
"%",
"(",
"ext",
".",
"subdomain",
",",
... | For a given URL return the netloc with any www. striped. | [
"For",
"a",
"given",
"URL",
"return",
"the",
"netloc",
"with",
"any",
"www",
".",
"striped",
"."
] | train | https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/url/shorten.py#L55-L63 |
eallik/spinoff | geventreactor/__init__.py | deferToGreenletPool | def deferToGreenletPool(*args, **kwargs):
"""Call function using a greenlet from the given pool and return the result as a Deferred"""
reactor = args[0]
pool = args[1]
func = args[2]
d = defer.Deferred()
def task():
try:
reactor.callFromGreenlet(d.callback, func(*args[3:], *... | python | def deferToGreenletPool(*args, **kwargs):
"""Call function using a greenlet from the given pool and return the result as a Deferred"""
reactor = args[0]
pool = args[1]
func = args[2]
d = defer.Deferred()
def task():
try:
reactor.callFromGreenlet(d.callback, func(*args[3:], *... | [
"def",
"deferToGreenletPool",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"reactor",
"=",
"args",
"[",
"0",
"]",
"pool",
"=",
"args",
"[",
"1",
"]",
"func",
"=",
"args",
"[",
"2",
"]",
"d",
"=",
"defer",
".",
"Deferred",
"(",
")",
"def... | Call function using a greenlet from the given pool and return the result as a Deferred | [
"Call",
"function",
"using",
"a",
"greenlet",
"from",
"the",
"given",
"pool",
"and",
"return",
"the",
"result",
"as",
"a",
"Deferred"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L52-L65 |
eallik/spinoff | geventreactor/__init__.py | deferToGreenlet | def deferToGreenlet(*args, **kwargs):
"""Call function using a greenlet and return the result as a Deferred"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
return deferToGreenletPool(reactor, reactor.getGreenletPool(), *args, **... | python | def deferToGreenlet(*args, **kwargs):
"""Call function using a greenlet and return the result as a Deferred"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
return deferToGreenletPool(reactor, reactor.getGreenletPool(), *args, **... | [
"def",
"deferToGreenlet",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
"assert",
"reactor",
".",
"greenlet",
"==",
"getcurrent",
"(",
")",
",",
"\"must invoke this in the reactor greenlet\"",
"retu... | Call function using a greenlet and return the result as a Deferred | [
"Call",
"function",
"using",
"a",
"greenlet",
"and",
"return",
"the",
"result",
"as",
"a",
"Deferred"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L68-L72 |
eallik/spinoff | geventreactor/__init__.py | callMultipleInGreenlet | def callMultipleInGreenlet(tupleList):
"""Call a list of functions in the same thread"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
reactor.callInGreenlet(_runMultiple, tupleList) | python | def callMultipleInGreenlet(tupleList):
"""Call a list of functions in the same thread"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
reactor.callInGreenlet(_runMultiple, tupleList) | [
"def",
"callMultipleInGreenlet",
"(",
"tupleList",
")",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
"assert",
"reactor",
".",
"greenlet",
"==",
"getcurrent",
"(",
")",
",",
"\"must invoke this in the reactor greenlet\"",
"reactor",
".",
"callInGreenl... | Call a list of functions in the same thread | [
"Call",
"a",
"list",
"of",
"functions",
"in",
"the",
"same",
"thread"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L75-L79 |
eallik/spinoff | geventreactor/__init__.py | waitForGreenlet | def waitForGreenlet(g):
"""Link greenlet completion to Deferred"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
d = defer.Deferred()
def cb(g):
try:
d.callback(g.get())
except:
d.errb... | python | def waitForGreenlet(g):
"""Link greenlet completion to Deferred"""
from twisted.internet import reactor
assert reactor.greenlet == getcurrent(), "must invoke this in the reactor greenlet"
d = defer.Deferred()
def cb(g):
try:
d.callback(g.get())
except:
d.errb... | [
"def",
"waitForGreenlet",
"(",
"g",
")",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
"assert",
"reactor",
".",
"greenlet",
"==",
"getcurrent",
"(",
")",
",",
"\"must invoke this in the reactor greenlet\"",
"d",
"=",
"defer",
".",
"Deferred",
"(... | Link greenlet completion to Deferred | [
"Link",
"greenlet",
"completion",
"to",
"Deferred"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L82-L95 |
eallik/spinoff | geventreactor/__init__.py | waitForDeferred | def waitForDeferred(d, result=None):
"""Block current greenlet for Deferred, waiting until result is not a Deferred or a failure is encountered"""
from twisted.internet import reactor
assert reactor.greenlet != getcurrent(), "can't invoke this in the reactor greenlet"
if result is None:
result =... | python | def waitForDeferred(d, result=None):
"""Block current greenlet for Deferred, waiting until result is not a Deferred or a failure is encountered"""
from twisted.internet import reactor
assert reactor.greenlet != getcurrent(), "can't invoke this in the reactor greenlet"
if result is None:
result =... | [
"def",
"waitForDeferred",
"(",
"d",
",",
"result",
"=",
"None",
")",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
"assert",
"reactor",
".",
"greenlet",
"!=",
"getcurrent",
"(",
")",
",",
"\"can't invoke this in the reactor greenlet\"",
"if",
"re... | Block current greenlet for Deferred, waiting until result is not a Deferred or a failure is encountered | [
"Block",
"current",
"greenlet",
"for",
"Deferred",
"waiting",
"until",
"result",
"is",
"not",
"a",
"Deferred",
"or",
"a",
"failure",
"is",
"encountered"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L98-L118 |
eallik/spinoff | geventreactor/__init__.py | blockingCallFromGreenlet | def blockingCallFromGreenlet(*args, **kwargs):
"""Call function in reactor greenlet and block current greenlet waiting for the result"""
reactor = args[0]
assert reactor.greenlet != getcurrent(), "can't invoke this in the reactor greenlet"
func = args[1]
result = AsyncResult()
def task():
... | python | def blockingCallFromGreenlet(*args, **kwargs):
"""Call function in reactor greenlet and block current greenlet waiting for the result"""
reactor = args[0]
assert reactor.greenlet != getcurrent(), "can't invoke this in the reactor greenlet"
func = args[1]
result = AsyncResult()
def task():
... | [
"def",
"blockingCallFromGreenlet",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"reactor",
"=",
"args",
"[",
"0",
"]",
"assert",
"reactor",
".",
"greenlet",
"!=",
"getcurrent",
"(",
")",
",",
"\"can't invoke this in the reactor greenlet\"",
"func",
"="... | Call function in reactor greenlet and block current greenlet waiting for the result | [
"Call",
"function",
"in",
"reactor",
"greenlet",
"and",
"block",
"current",
"greenlet",
"waiting",
"for",
"the",
"result"
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L121-L139 |
eallik/spinoff | geventreactor/__init__.py | GeventReactor.mainLoop | def mainLoop(self):
"""This main loop yields to gevent until the end, handling function calls along the way."""
self.greenlet = gevent.getcurrent()
callqueue = self._callqueue
seconds = self.seconds
try:
while 1:
self._wait = 0
now = se... | python | def mainLoop(self):
"""This main loop yields to gevent until the end, handling function calls along the way."""
self.greenlet = gevent.getcurrent()
callqueue = self._callqueue
seconds = self.seconds
try:
while 1:
self._wait = 0
now = se... | [
"def",
"mainLoop",
"(",
"self",
")",
":",
"self",
".",
"greenlet",
"=",
"gevent",
".",
"getcurrent",
"(",
")",
"callqueue",
"=",
"self",
".",
"_callqueue",
"seconds",
"=",
"self",
".",
"seconds",
"try",
":",
"while",
"1",
":",
"self",
".",
"_wait",
"... | This main loop yields to gevent until the end, handling function calls along the way. | [
"This",
"main",
"loop",
"yields",
"to",
"gevent",
"until",
"the",
"end",
"handling",
"function",
"calls",
"along",
"the",
"way",
"."
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L357-L417 |
eallik/spinoff | geventreactor/__init__.py | GeventReactor.addReader | def addReader(self, selectable):
"""Add a FileDescriptor for notification of data available to read."""
try:
self._reads[selectable].resume()
except KeyError:
self._reads[selectable] = g = Stream.spawn(self, selectable, 'doRead')
self.addToGreenletPool(g) | python | def addReader(self, selectable):
"""Add a FileDescriptor for notification of data available to read."""
try:
self._reads[selectable].resume()
except KeyError:
self._reads[selectable] = g = Stream.spawn(self, selectable, 'doRead')
self.addToGreenletPool(g) | [
"def",
"addReader",
"(",
"self",
",",
"selectable",
")",
":",
"try",
":",
"self",
".",
"_reads",
"[",
"selectable",
"]",
".",
"resume",
"(",
")",
"except",
"KeyError",
":",
"self",
".",
"_reads",
"[",
"selectable",
"]",
"=",
"g",
"=",
"Stream",
".",
... | Add a FileDescriptor for notification of data available to read. | [
"Add",
"a",
"FileDescriptor",
"for",
"notification",
"of",
"data",
"available",
"to",
"read",
"."
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L419-L425 |
eallik/spinoff | geventreactor/__init__.py | GeventReactor.addWriter | def addWriter(self, selectable):
"""Add a FileDescriptor for notification of data available to write."""
try:
self._writes[selectable].resume()
except KeyError:
self._writes[selectable] = g = Stream.spawn(self, selectable, 'doWrite')
self.addToGreenletPool(g) | python | def addWriter(self, selectable):
"""Add a FileDescriptor for notification of data available to write."""
try:
self._writes[selectable].resume()
except KeyError:
self._writes[selectable] = g = Stream.spawn(self, selectable, 'doWrite')
self.addToGreenletPool(g) | [
"def",
"addWriter",
"(",
"self",
",",
"selectable",
")",
":",
"try",
":",
"self",
".",
"_writes",
"[",
"selectable",
"]",
".",
"resume",
"(",
")",
"except",
"KeyError",
":",
"self",
".",
"_writes",
"[",
"selectable",
"]",
"=",
"g",
"=",
"Stream",
"."... | Add a FileDescriptor for notification of data available to write. | [
"Add",
"a",
"FileDescriptor",
"for",
"notification",
"of",
"data",
"available",
"to",
"write",
"."
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L427-L433 |
eallik/spinoff | geventreactor/__init__.py | GeventReactor.removeReader | def removeReader(self, selectable):
"""Remove a FileDescriptor for notification of data available to read."""
try:
if selectable.disconnected:
self._reads[selectable].kill(block=False)
del self._reads[selectable]
else:
self._reads[s... | python | def removeReader(self, selectable):
"""Remove a FileDescriptor for notification of data available to read."""
try:
if selectable.disconnected:
self._reads[selectable].kill(block=False)
del self._reads[selectable]
else:
self._reads[s... | [
"def",
"removeReader",
"(",
"self",
",",
"selectable",
")",
":",
"try",
":",
"if",
"selectable",
".",
"disconnected",
":",
"self",
".",
"_reads",
"[",
"selectable",
"]",
".",
"kill",
"(",
"block",
"=",
"False",
")",
"del",
"self",
".",
"_reads",
"[",
... | Remove a FileDescriptor for notification of data available to read. | [
"Remove",
"a",
"FileDescriptor",
"for",
"notification",
"of",
"data",
"available",
"to",
"read",
"."
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L435-L444 |
eallik/spinoff | geventreactor/__init__.py | GeventReactor.removeWriter | def removeWriter(self, selectable):
"""Remove a FileDescriptor for notification of data available to write."""
try:
if selectable.disconnected:
self._writes[selectable].kill(block=False)
del self._writes[selectable]
else:
self._writ... | python | def removeWriter(self, selectable):
"""Remove a FileDescriptor for notification of data available to write."""
try:
if selectable.disconnected:
self._writes[selectable].kill(block=False)
del self._writes[selectable]
else:
self._writ... | [
"def",
"removeWriter",
"(",
"self",
",",
"selectable",
")",
":",
"try",
":",
"if",
"selectable",
".",
"disconnected",
":",
"self",
".",
"_writes",
"[",
"selectable",
"]",
".",
"kill",
"(",
"block",
"=",
"False",
")",
"del",
"self",
".",
"_writes",
"[",... | Remove a FileDescriptor for notification of data available to write. | [
"Remove",
"a",
"FileDescriptor",
"for",
"notification",
"of",
"data",
"available",
"to",
"write",
"."
] | train | https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/geventreactor/__init__.py#L446-L455 |
wonderb0lt/sounddrizzle | sounddrizzle.py | resolve | def resolve(track_url):
"""
Resolves the URL to an actual track from the SoundCloud API.
If the track resolves to more than one possible track, it takes the first search result.
:returns: The track dictionary from the SoundCloud API
"""
try:
path = urlparse.urlparse(track_url).path
... | python | def resolve(track_url):
"""
Resolves the URL to an actual track from the SoundCloud API.
If the track resolves to more than one possible track, it takes the first search result.
:returns: The track dictionary from the SoundCloud API
"""
try:
path = urlparse.urlparse(track_url).path
... | [
"def",
"resolve",
"(",
"track_url",
")",
":",
"try",
":",
"path",
"=",
"urlparse",
".",
"urlparse",
"(",
"track_url",
")",
".",
"path",
"tracks",
"=",
"client",
".",
"get",
"(",
"'/tracks'",
",",
"q",
"=",
"path",
")",
"if",
"tracks",
":",
"return",
... | Resolves the URL to an actual track from the SoundCloud API.
If the track resolves to more than one possible track, it takes the first search result.
:returns: The track dictionary from the SoundCloud API | [
"Resolves",
"the",
"URL",
"to",
"an",
"actual",
"track",
"from",
"the",
"SoundCloud",
"API",
"."
] | train | https://github.com/wonderb0lt/sounddrizzle/blob/e668e2e56e2a267329afa1d510556dd296fb8026/sounddrizzle.py#L38-L55 |
wonderb0lt/sounddrizzle | sounddrizzle.py | filename_for_track | def filename_for_track(track):
"""
:return: A safe filename for the given track
"""
artist = track.user['permalink']
title = track.title
return '{}-{}.mp3'.format(artist, title).lower().replace(' ', '_').replace('/', '_') | python | def filename_for_track(track):
"""
:return: A safe filename for the given track
"""
artist = track.user['permalink']
title = track.title
return '{}-{}.mp3'.format(artist, title).lower().replace(' ', '_').replace('/', '_') | [
"def",
"filename_for_track",
"(",
"track",
")",
":",
"artist",
"=",
"track",
".",
"user",
"[",
"'permalink'",
"]",
"title",
"=",
"track",
".",
"title",
"return",
"'{}-{}.mp3'",
".",
"format",
"(",
"artist",
",",
"title",
")",
".",
"lower",
"(",
")",
".... | :return: A safe filename for the given track | [
":",
"return",
":",
"A",
"safe",
"filename",
"for",
"the",
"given",
"track"
] | train | https://github.com/wonderb0lt/sounddrizzle/blob/e668e2e56e2a267329afa1d510556dd296fb8026/sounddrizzle.py#L58-L65 |
wonderb0lt/sounddrizzle | sounddrizzle.py | download | def download(url, target_file, chunk_size=4096):
"""
Simple requests downloader
"""
r = requests.get(url, stream=True)
with open(target_file, 'w+') as out:
# And this is why I love Armin Ronacher:
with click.progressbar(r.iter_content(chunk_size=chunk_size),
... | python | def download(url, target_file, chunk_size=4096):
"""
Simple requests downloader
"""
r = requests.get(url, stream=True)
with open(target_file, 'w+') as out:
# And this is why I love Armin Ronacher:
with click.progressbar(r.iter_content(chunk_size=chunk_size),
... | [
"def",
"download",
"(",
"url",
",",
"target_file",
",",
"chunk_size",
"=",
"4096",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
"with",
"open",
"(",
"target_file",
",",
"'w+'",
")",
"as",
"out",
":",
"# A... | Simple requests downloader | [
"Simple",
"requests",
"downloader"
] | train | https://github.com/wonderb0lt/sounddrizzle/blob/e668e2e56e2a267329afa1d510556dd296fb8026/sounddrizzle.py#L68-L80 |
wonderb0lt/sounddrizzle | sounddrizzle.py | add_metadata | def add_metadata(track_file, track_data):
"""
Adds artist and title from the track data, and downloads the cover and embeds it in the MP3 tags.
"""
# This needs some exception handling!
# We don't always know what type the cover is!
mp3 = mutagen.mp3.MP3(track_file)
mp3['TPE1'] = mutagen.id... | python | def add_metadata(track_file, track_data):
"""
Adds artist and title from the track data, and downloads the cover and embeds it in the MP3 tags.
"""
# This needs some exception handling!
# We don't always know what type the cover is!
mp3 = mutagen.mp3.MP3(track_file)
mp3['TPE1'] = mutagen.id... | [
"def",
"add_metadata",
"(",
"track_file",
",",
"track_data",
")",
":",
"# This needs some exception handling!",
"# We don't always know what type the cover is!",
"mp3",
"=",
"mutagen",
".",
"mp3",
".",
"MP3",
"(",
"track_file",
")",
"mp3",
"[",
"'TPE1'",
"]",
"=",
"... | Adds artist and title from the track data, and downloads the cover and embeds it in the MP3 tags. | [
"Adds",
"artist",
"and",
"title",
"from",
"the",
"track",
"data",
"and",
"downloads",
"the",
"cover",
"and",
"embeds",
"it",
"in",
"the",
"MP3",
"tags",
"."
] | train | https://github.com/wonderb0lt/sounddrizzle/blob/e668e2e56e2a267329afa1d510556dd296fb8026/sounddrizzle.py#L83-L97 |
ulf1/oxyba | oxyba/linreg_ridge_gd.py | linreg_ridge_gd | def linreg_ridge_gd(y, X, lam, algorithm='L-BFGS-B', debug=False):
"""Ridge Regression with Gradient Optimization methods
Parameters:
-----------
y : ndarray
target variable with N observations
X : ndarray
The <N x C> design matrix with C independent
variables, features, fa... | python | def linreg_ridge_gd(y, X, lam, algorithm='L-BFGS-B', debug=False):
"""Ridge Regression with Gradient Optimization methods
Parameters:
-----------
y : ndarray
target variable with N observations
X : ndarray
The <N x C> design matrix with C independent
variables, features, fa... | [
"def",
"linreg_ridge_gd",
"(",
"y",
",",
"X",
",",
"lam",
",",
"algorithm",
"=",
"'L-BFGS-B'",
",",
"debug",
"=",
"False",
")",
":",
"import",
"numpy",
"as",
"np",
"import",
"scipy",
".",
"optimize",
"as",
"sopt",
"def",
"objective_pssr",
"(",
"theta",
... | Ridge Regression with Gradient Optimization methods
Parameters:
-----------
y : ndarray
target variable with N observations
X : ndarray
The <N x C> design matrix with C independent
variables, features, factors, etc.
algorithm : str
Optional. The algorithm used in s... | [
"Ridge",
"Regression",
"with",
"Gradient",
"Optimization",
"methods"
] | train | https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/linreg_ridge_gd.py#L2-L70 |
mccutchen/triangulizor | triangulizor/triangulizor.py | triangulize | def triangulize(image, tile_size):
"""Processes the given image by breaking it down into tiles of the given
size and applying a triangular effect to each tile. Returns the processed
image as a PIL Image object.
The image can be given as anything suitable for passing to `Image.open`
(ie, the path to... | python | def triangulize(image, tile_size):
"""Processes the given image by breaking it down into tiles of the given
size and applying a triangular effect to each tile. Returns the processed
image as a PIL Image object.
The image can be given as anything suitable for passing to `Image.open`
(ie, the path to... | [
"def",
"triangulize",
"(",
"image",
",",
"tile_size",
")",
":",
"if",
"isinstance",
"(",
"image",
",",
"basestring",
")",
"or",
"hasattr",
"(",
"image",
",",
"'read'",
")",
":",
"image",
"=",
"Image",
".",
"open",
"(",
"image",
")",
"assert",
"isinstan... | Processes the given image by breaking it down into tiles of the given
size and applying a triangular effect to each tile. Returns the processed
image as a PIL Image object.
The image can be given as anything suitable for passing to `Image.open`
(ie, the path to an image or as a file-like object contain... | [
"Processes",
"the",
"given",
"image",
"by",
"breaking",
"it",
"down",
"into",
"tiles",
"of",
"the",
"given",
"size",
"and",
"applying",
"a",
"triangular",
"effect",
"to",
"each",
"tile",
".",
"Returns",
"the",
"processed",
"image",
"as",
"a",
"PIL",
"Image... | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L22-L58 |
mccutchen/triangulizor | triangulizor/triangulizor.py | process_tile | def process_tile(tile_x, tile_y, tile_size, pix, draw, image):
"""Process a tile whose top left corner is at the given x and y
coordinates.
"""
logging.debug('Processing tile (%d, %d)', tile_x, tile_y)
# Calculate average color for each "triangle" in the given tile
n, e, s, w = triangle_colors(... | python | def process_tile(tile_x, tile_y, tile_size, pix, draw, image):
"""Process a tile whose top left corner is at the given x and y
coordinates.
"""
logging.debug('Processing tile (%d, %d)', tile_x, tile_y)
# Calculate average color for each "triangle" in the given tile
n, e, s, w = triangle_colors(... | [
"def",
"process_tile",
"(",
"tile_x",
",",
"tile_y",
",",
"tile_size",
",",
"pix",
",",
"draw",
",",
"image",
")",
":",
"logging",
".",
"debug",
"(",
"'Processing tile (%d, %d)'",
",",
"tile_x",
",",
"tile_y",
")",
"# Calculate average color for each \"triangle\" ... | Process a tile whose top left corner is at the given x and y
coordinates. | [
"Process",
"a",
"tile",
"whose",
"top",
"left",
"corner",
"is",
"at",
"the",
"given",
"x",
"and",
"y",
"coordinates",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L61-L94 |
mccutchen/triangulizor | triangulizor/triangulizor.py | triangle_colors | def triangle_colors(tile_x, tile_y, tile_size, pix):
"""Extracts the average color for each triangle in the given tile. Returns
a 4-tuple of colors for the triangles in this order: North, East, South,
West (clockwise).
"""
quad_size = tile_size / 2
north = []
for y in xrange(tile_y, tile_y ... | python | def triangle_colors(tile_x, tile_y, tile_size, pix):
"""Extracts the average color for each triangle in the given tile. Returns
a 4-tuple of colors for the triangles in this order: North, East, South,
West (clockwise).
"""
quad_size = tile_size / 2
north = []
for y in xrange(tile_y, tile_y ... | [
"def",
"triangle_colors",
"(",
"tile_x",
",",
"tile_y",
",",
"tile_size",
",",
"pix",
")",
":",
"quad_size",
"=",
"tile_size",
"/",
"2",
"north",
"=",
"[",
"]",
"for",
"y",
"in",
"xrange",
"(",
"tile_y",
",",
"tile_y",
"+",
"quad_size",
")",
":",
"x_... | Extracts the average color for each triangle in the given tile. Returns
a 4-tuple of colors for the triangles in this order: North, East, South,
West (clockwise). | [
"Extracts",
"the",
"average",
"color",
"for",
"each",
"triangle",
"in",
"the",
"given",
"tile",
".",
"Returns",
"a",
"4",
"-",
"tuple",
"of",
"colors",
"for",
"the",
"triangles",
"in",
"this",
"order",
":",
"North",
"East",
"South",
"West",
"(",
"clockwi... | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L97-L128 |
mccutchen/triangulizor | triangulizor/triangulizor.py | draw_triangles | def draw_triangles(tile_x, tile_y, tile_size, split, top_color, bottom_color,
draw):
"""Draws a triangle on each half of the tile with the given coordinates
and size.
"""
assert split in ('right', 'left')
# The four corners of this tile
nw = (tile_x, tile_y)
ne = (tile_x ... | python | def draw_triangles(tile_x, tile_y, tile_size, split, top_color, bottom_color,
draw):
"""Draws a triangle on each half of the tile with the given coordinates
and size.
"""
assert split in ('right', 'left')
# The four corners of this tile
nw = (tile_x, tile_y)
ne = (tile_x ... | [
"def",
"draw_triangles",
"(",
"tile_x",
",",
"tile_y",
",",
"tile_size",
",",
"split",
",",
"top_color",
",",
"bottom_color",
",",
"draw",
")",
":",
"assert",
"split",
"in",
"(",
"'right'",
",",
"'left'",
")",
"# The four corners of this tile",
"nw",
"=",
"(... | Draws a triangle on each half of the tile with the given coordinates
and size. | [
"Draws",
"a",
"triangle",
"on",
"each",
"half",
"of",
"the",
"tile",
"with",
"the",
"given",
"coordinates",
"and",
"size",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L131-L153 |
mccutchen/triangulizor | triangulizor/triangulizor.py | draw_triangle | def draw_triangle(a, b, c, color, draw):
"""Draws a triangle with the given vertices in the given color."""
draw.polygon([a, b, c], fill=color) | python | def draw_triangle(a, b, c, color, draw):
"""Draws a triangle with the given vertices in the given color."""
draw.polygon([a, b, c], fill=color) | [
"def",
"draw_triangle",
"(",
"a",
",",
"b",
",",
"c",
",",
"color",
",",
"draw",
")",
":",
"draw",
".",
"polygon",
"(",
"[",
"a",
",",
"b",
",",
"c",
"]",
",",
"fill",
"=",
"color",
")"
] | Draws a triangle with the given vertices in the given color. | [
"Draws",
"a",
"triangle",
"with",
"the",
"given",
"vertices",
"in",
"the",
"given",
"color",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L156-L158 |
mccutchen/triangulizor | triangulizor/triangulizor.py | get_average_color | def get_average_color(colors):
"""Calculate the average color from the list of colors, where each color
is a 3-tuple of (r, g, b) values.
"""
c = reduce(color_reducer, colors)
total = len(colors)
return tuple(v / total for v in c) | python | def get_average_color(colors):
"""Calculate the average color from the list of colors, where each color
is a 3-tuple of (r, g, b) values.
"""
c = reduce(color_reducer, colors)
total = len(colors)
return tuple(v / total for v in c) | [
"def",
"get_average_color",
"(",
"colors",
")",
":",
"c",
"=",
"reduce",
"(",
"color_reducer",
",",
"colors",
")",
"total",
"=",
"len",
"(",
"colors",
")",
"return",
"tuple",
"(",
"v",
"/",
"total",
"for",
"v",
"in",
"c",
")"
] | Calculate the average color from the list of colors, where each color
is a 3-tuple of (r, g, b) values. | [
"Calculate",
"the",
"average",
"color",
"from",
"the",
"list",
"of",
"colors",
"where",
"each",
"color",
"is",
"a",
"3",
"-",
"tuple",
"of",
"(",
"r",
"g",
"b",
")",
"values",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L161-L167 |
mccutchen/triangulizor | triangulizor/triangulizor.py | color_reducer | def color_reducer(c1, c2):
"""Helper function used to add two colors together when averaging."""
return tuple(v1 + v2 for v1, v2 in itertools.izip(c1, c2)) | python | def color_reducer(c1, c2):
"""Helper function used to add two colors together when averaging."""
return tuple(v1 + v2 for v1, v2 in itertools.izip(c1, c2)) | [
"def",
"color_reducer",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"tuple",
"(",
"v1",
"+",
"v2",
"for",
"v1",
",",
"v2",
"in",
"itertools",
".",
"izip",
"(",
"c1",
",",
"c2",
")",
")"
] | Helper function used to add two colors together when averaging. | [
"Helper",
"function",
"used",
"to",
"add",
"two",
"colors",
"together",
"when",
"averaging",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L170-L172 |
mccutchen/triangulizor | triangulizor/triangulizor.py | get_color_dist | def get_color_dist(c1, c2):
"""Calculates the "distance" between two colors, where the distance is
another color whose components are the absolute values of the difference
between each component of the input colors.
"""
return tuple(abs(v1 - v2) for v1, v2 in itertools.izip(c1, c2)) | python | def get_color_dist(c1, c2):
"""Calculates the "distance" between two colors, where the distance is
another color whose components are the absolute values of the difference
between each component of the input colors.
"""
return tuple(abs(v1 - v2) for v1, v2 in itertools.izip(c1, c2)) | [
"def",
"get_color_dist",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"tuple",
"(",
"abs",
"(",
"v1",
"-",
"v2",
")",
"for",
"v1",
",",
"v2",
"in",
"itertools",
".",
"izip",
"(",
"c1",
",",
"c2",
")",
")"
] | Calculates the "distance" between two colors, where the distance is
another color whose components are the absolute values of the difference
between each component of the input colors. | [
"Calculates",
"the",
"distance",
"between",
"two",
"colors",
"where",
"the",
"distance",
"is",
"another",
"color",
"whose",
"components",
"are",
"the",
"absolute",
"values",
"of",
"the",
"difference",
"between",
"each",
"component",
"of",
"the",
"input",
"colors... | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L175-L180 |
mccutchen/triangulizor | triangulizor/triangulizor.py | prep_image | def prep_image(image, tile_size):
"""Takes an image and a tile size and returns a possibly cropped version
of the image that is evenly divisible in both dimensions by the tile size.
"""
w, h = image.size
x_tiles = w / tile_size # floor division
y_tiles = h / tile_size
new_w = x_tiles * tile... | python | def prep_image(image, tile_size):
"""Takes an image and a tile size and returns a possibly cropped version
of the image that is evenly divisible in both dimensions by the tile size.
"""
w, h = image.size
x_tiles = w / tile_size # floor division
y_tiles = h / tile_size
new_w = x_tiles * tile... | [
"def",
"prep_image",
"(",
"image",
",",
"tile_size",
")",
":",
"w",
",",
"h",
"=",
"image",
".",
"size",
"x_tiles",
"=",
"w",
"/",
"tile_size",
"# floor division",
"y_tiles",
"=",
"h",
"/",
"tile_size",
"new_w",
"=",
"x_tiles",
"*",
"tile_size",
"new_h",... | Takes an image and a tile size and returns a possibly cropped version
of the image that is evenly divisible in both dimensions by the tile size. | [
"Takes",
"an",
"image",
"and",
"a",
"tile",
"size",
"and",
"returns",
"a",
"possibly",
"cropped",
"version",
"of",
"the",
"image",
"that",
"is",
"evenly",
"divisible",
"in",
"both",
"dimensions",
"by",
"the",
"tile",
"size",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L183-L196 |
mccutchen/triangulizor | triangulizor/triangulizor.py | iter_tiles | def iter_tiles(image, tile_size):
"""Yields (x, y) coordinate pairs for the top left corner of each tile in
the given image, based on the given tile size.
"""
w, h = image.size
for y in xrange(0, h, tile_size):
for x in xrange(0, w, tile_size):
yield x, y | python | def iter_tiles(image, tile_size):
"""Yields (x, y) coordinate pairs for the top left corner of each tile in
the given image, based on the given tile size.
"""
w, h = image.size
for y in xrange(0, h, tile_size):
for x in xrange(0, w, tile_size):
yield x, y | [
"def",
"iter_tiles",
"(",
"image",
",",
"tile_size",
")",
":",
"w",
",",
"h",
"=",
"image",
".",
"size",
"for",
"y",
"in",
"xrange",
"(",
"0",
",",
"h",
",",
"tile_size",
")",
":",
"for",
"x",
"in",
"xrange",
"(",
"0",
",",
"w",
",",
"tile_size... | Yields (x, y) coordinate pairs for the top left corner of each tile in
the given image, based on the given tile size. | [
"Yields",
"(",
"x",
"y",
")",
"coordinate",
"pairs",
"for",
"the",
"top",
"left",
"corner",
"of",
"each",
"tile",
"in",
"the",
"given",
"image",
"based",
"on",
"the",
"given",
"tile",
"size",
"."
] | train | https://github.com/mccutchen/triangulizor/blob/8be58de01327f87af33ce7df8077d1582e75c005/triangulizor/triangulizor.py#L199-L206 |
hirokiky/uiro | uiro/__init__.py | main | def main(global_conf, root, **settings):
""" Entry point to create Uiro application.
Setup all of necessary things:
* Getting root matching
* Initializing DB connection
* Initializing Template Lookups
* Collecting installed applications
* Creating apps for serving static files
... | python | def main(global_conf, root, **settings):
""" Entry point to create Uiro application.
Setup all of necessary things:
* Getting root matching
* Initializing DB connection
* Initializing Template Lookups
* Collecting installed applications
* Creating apps for serving static files
... | [
"def",
"main",
"(",
"global_conf",
",",
"root",
",",
"*",
"*",
"settings",
")",
":",
"matching",
"=",
"import_module_attribute",
"(",
"settings",
"[",
"'uiro.root_matching'",
"]",
")",
"apps",
"=",
"[",
"import_module",
"(",
"app_name",
")",
"for",
"app_name... | Entry point to create Uiro application.
Setup all of necessary things:
* Getting root matching
* Initializing DB connection
* Initializing Template Lookups
* Collecting installed applications
* Creating apps for serving static files
and will create/return Uiro application. | [
"Entry",
"point",
"to",
"create",
"Uiro",
"application",
"."
] | train | https://github.com/hirokiky/uiro/blob/8436976b21ac9b0eac4243768f5ada12479b9e00/uiro/__init__.py#L10-L34 |
devricks/soft_drf | soft_drf/api/viewsets/nested.py | NestedViewset.check_parent_object_permissions | def check_parent_object_permissions(self, request, obj):
"""
Check if the request should be permitted for a given parent object.
Raises an appropriate exception if the request is not permitted.
"""
for permission in self.get_parent_permissions():
if not permission.has... | python | def check_parent_object_permissions(self, request, obj):
"""
Check if the request should be permitted for a given parent object.
Raises an appropriate exception if the request is not permitted.
"""
for permission in self.get_parent_permissions():
if not permission.has... | [
"def",
"check_parent_object_permissions",
"(",
"self",
",",
"request",
",",
"obj",
")",
":",
"for",
"permission",
"in",
"self",
".",
"get_parent_permissions",
"(",
")",
":",
"if",
"not",
"permission",
".",
"has_object_permission",
"(",
"request",
",",
"self",
... | Check if the request should be permitted for a given parent object.
Raises an appropriate exception if the request is not permitted. | [
"Check",
"if",
"the",
"request",
"should",
"be",
"permitted",
"for",
"a",
"given",
"parent",
"object",
".",
"Raises",
"an",
"appropriate",
"exception",
"if",
"the",
"request",
"is",
"not",
"permitted",
"."
] | train | https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/api/viewsets/nested.py#L27-L34 |
devricks/soft_drf | soft_drf/api/viewsets/nested.py | NestedViewset.get_parent_queryset | def get_parent_queryset(self):
"""
Get the list of parent items for this view.
This must be an iterable, and may be a queryset.
Defaults to using `self.parent_queryset`.
You may want to override this if you need to provide different
querysets depending on the incoming req... | python | def get_parent_queryset(self):
"""
Get the list of parent items for this view.
This must be an iterable, and may be a queryset.
Defaults to using `self.parent_queryset`.
You may want to override this if you need to provide different
querysets depending on the incoming req... | [
"def",
"get_parent_queryset",
"(",
"self",
")",
":",
"if",
"self",
".",
"parent_queryset",
"is",
"not",
"None",
":",
"return",
"self",
".",
"parent_queryset",
".",
"_clone",
"(",
")",
"if",
"self",
".",
"parent_model",
"is",
"not",
"None",
":",
"return",
... | Get the list of parent items for this view.
This must be an iterable, and may be a queryset.
Defaults to using `self.parent_queryset`.
You may want to override this if you need to provide different
querysets depending on the incoming request.
(Eg. return a list of items that is s... | [
"Get",
"the",
"list",
"of",
"parent",
"items",
"for",
"this",
"view",
".",
"This",
"must",
"be",
"an",
"iterable",
"and",
"may",
"be",
"a",
"queryset",
".",
"Defaults",
"to",
"using",
"self",
".",
"parent_queryset",
".",
"You",
"may",
"want",
"to",
"ov... | train | https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/api/viewsets/nested.py#L36-L54 |
devricks/soft_drf | soft_drf/api/viewsets/nested.py | NestedViewset.get_parent_object | def get_parent_object(self, parent_queryset=None):
"""
Returns the parent object the view is displaying.
You may want to override this if you need to provide non-standard
queryset lookups. Eg if parent objects are referenced using multiple
keyword arguments in the url conf.
... | python | def get_parent_object(self, parent_queryset=None):
"""
Returns the parent object the view is displaying.
You may want to override this if you need to provide non-standard
queryset lookups. Eg if parent objects are referenced using multiple
keyword arguments in the url conf.
... | [
"def",
"get_parent_object",
"(",
"self",
",",
"parent_queryset",
"=",
"None",
")",
":",
"if",
"self",
".",
"_parent_object_cache",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_parent_object_cache",
"if",
"parent_queryset",
"is",
"None",
":",
"parent_querys... | Returns the parent object the view is displaying.
You may want to override this if you need to provide non-standard
queryset lookups. Eg if parent objects are referenced using multiple
keyword arguments in the url conf. | [
"Returns",
"the",
"parent",
"object",
"the",
"view",
"is",
"displaying",
".",
"You",
"may",
"want",
"to",
"override",
"this",
"if",
"you",
"need",
"to",
"provide",
"non",
"-",
"standard",
"queryset",
"lookups",
".",
"Eg",
"if",
"parent",
"objects",
"are",
... | train | https://github.com/devricks/soft_drf/blob/1869b13f9341bfcebd931059e93de2bc38570da3/soft_drf/api/viewsets/nested.py#L56-L102 |
klorenz/python-argdeco | argdeco/command_decorator.py | CommandDecorator.add_subcommands | def add_subcommands(self, command, *args, **kwargs):
"""add subcommands.
If command already defined, pass args and kwargs to add_subparsers()
method, else to add_parser() method. This behaviour is for convenience,
because I mostly use the sequence:
>>> p = parser.add_parser('f... | python | def add_subcommands(self, command, *args, **kwargs):
"""add subcommands.
If command already defined, pass args and kwargs to add_subparsers()
method, else to add_parser() method. This behaviour is for convenience,
because I mostly use the sequence:
>>> p = parser.add_parser('f... | [
"def",
"add_subcommands",
"(",
"self",
",",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"subcommands",
"=",
"kwargs",
".",
"pop",
"(",
"'subcommands'",
",",
"None",
")",
"try",
":",
"cmd",
"=",
"self",
"[",
"command",
"]",
"except... | add subcommands.
If command already defined, pass args and kwargs to add_subparsers()
method, else to add_parser() method. This behaviour is for convenience,
because I mostly use the sequence:
>>> p = parser.add_parser('foo', help="some help")
>>> subparser = p.add_subparsers(... | [
"add",
"subcommands",
"."
] | train | https://github.com/klorenz/python-argdeco/blob/8d01acef8c19d6883873689d017b14857876412d/argdeco/command_decorator.py#L159-L200 |
klorenz/python-argdeco | argdeco/command_decorator.py | CommandDecorator.update | def update(self, command=None, **kwargs):
"""update data, which is usually passed in ArgumentParser initialization
e.g. command.update(prog="foo")
"""
if command is None:
argparser = self.argparser
else:
argparser = self[command]
for k,v in kwarg... | python | def update(self, command=None, **kwargs):
"""update data, which is usually passed in ArgumentParser initialization
e.g. command.update(prog="foo")
"""
if command is None:
argparser = self.argparser
else:
argparser = self[command]
for k,v in kwarg... | [
"def",
"update",
"(",
"self",
",",
"command",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"command",
"is",
"None",
":",
"argparser",
"=",
"self",
".",
"argparser",
"else",
":",
"argparser",
"=",
"self",
"[",
"command",
"]",
"for",
"k",
",... | update data, which is usually passed in ArgumentParser initialization
e.g. command.update(prog="foo") | [
"update",
"data",
"which",
"is",
"usually",
"passed",
"in",
"ArgumentParser",
"initialization"
] | train | https://github.com/klorenz/python-argdeco/blob/8d01acef8c19d6883873689d017b14857876412d/argdeco/command_decorator.py#L202-L213 |
klorenz/python-argdeco | argdeco/command_decorator.py | CommandDecorator.get_config_name | def get_config_name(self, action, name=None):
'''get the name for configuration
This returns a name respecting commands and subcommands. So if you
have a command name "index" with subcommand "ls", which has option
"--all", you will pass the action for subcommand "ls" and the options's... | python | def get_config_name(self, action, name=None):
'''get the name for configuration
This returns a name respecting commands and subcommands. So if you
have a command name "index" with subcommand "ls", which has option
"--all", you will pass the action for subcommand "ls" and the options's... | [
"def",
"get_config_name",
"(",
"self",
",",
"action",
",",
"name",
"=",
"None",
")",
":",
"_name",
"=",
"None",
"if",
"name",
"is",
"None",
":",
"if",
"'.'",
"in",
"action",
":",
"action",
",",
"name",
"=",
"action",
".",
"rsplit",
"(",
"'.'",
",",... | get the name for configuration
This returns a name respecting commands and subcommands. So if you
have a command name "index" with subcommand "ls", which has option
"--all", you will pass the action for subcommand "ls" and the options's
dest name ("all" in this case), then this functi... | [
"get",
"the",
"name",
"for",
"configuration"
] | train | https://github.com/klorenz/python-argdeco/blob/8d01acef8c19d6883873689d017b14857876412d/argdeco/command_decorator.py#L268-L316 |
klorenz/python-argdeco | argdeco/command_decorator.py | CommandDecorator.add_command | def add_command(self, command, *args, **kwargs):
"""add a command.
This is basically a wrapper for add_parser()
"""
cmd = self.add_parser(command, *args, **kwargs) | python | def add_command(self, command, *args, **kwargs):
"""add a command.
This is basically a wrapper for add_parser()
"""
cmd = self.add_parser(command, *args, **kwargs) | [
"def",
"add_command",
"(",
"self",
",",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"self",
".",
"add_parser",
"(",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | add a command.
This is basically a wrapper for add_parser() | [
"add",
"a",
"command",
"."
] | train | https://github.com/klorenz/python-argdeco/blob/8d01acef8c19d6883873689d017b14857876412d/argdeco/command_decorator.py#L319-L324 |
klorenz/python-argdeco | argdeco/command_decorator.py | CommandDecorator.execute | def execute(self, argv=None, compile=None, preprocessor=None, compiler_factory=None):
"""Parse arguments and execute decorated function
argv: list of arguments
compile:
- None, pass args as keyword args to function
- True, pass args as single dictionary
- fun... | python | def execute(self, argv=None, compile=None, preprocessor=None, compiler_factory=None):
"""Parse arguments and execute decorated function
argv: list of arguments
compile:
- None, pass args as keyword args to function
- True, pass args as single dictionary
- fun... | [
"def",
"execute",
"(",
"self",
",",
"argv",
"=",
"None",
",",
"compile",
"=",
"None",
",",
"preprocessor",
"=",
"None",
",",
"compiler_factory",
"=",
"None",
")",
":",
"action",
",",
"args",
",",
"kwargs",
"=",
"self",
".",
"compile_args",
"(",
"argv",... | Parse arguments and execute decorated function
argv: list of arguments
compile:
- None, pass args as keyword args to function
- True, pass args as single dictionary
- function, get args from parse_args() and return a pair of
tuple and dict to be passed ... | [
"Parse",
"arguments",
"and",
"execute",
"decorated",
"function"
] | train | https://github.com/klorenz/python-argdeco/blob/8d01acef8c19d6883873689d017b14857876412d/argdeco/command_decorator.py#L450-L462 |
20c/twentyc.rpc | twentyc/rpc/client.py | RestClient._request | def _request(self, typ, id=0, method='GET', params=None, data=None, url=None):
"""
send the request, return response obj
"""
headers = { "Accept": "application/json" }
auth = None
if self.user:
auth = (self.user, self.password)
if not url:
... | python | def _request(self, typ, id=0, method='GET', params=None, data=None, url=None):
"""
send the request, return response obj
"""
headers = { "Accept": "application/json" }
auth = None
if self.user:
auth = (self.user, self.password)
if not url:
... | [
"def",
"_request",
"(",
"self",
",",
"typ",
",",
"id",
"=",
"0",
",",
"method",
"=",
"'GET'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"url",
"=",
"None",
")",
":",
"headers",
"=",
"{",
"\"Accept\"",
":",
"\"application/json\"",
"... | send the request, return response obj | [
"send",
"the",
"request",
"return",
"response",
"obj"
] | train | https://github.com/20c/twentyc.rpc/blob/23ff07be55eaf21cc2e1a13c2879710b5bc7f933/twentyc/rpc/client.py#L43-L60 |
20c/twentyc.rpc | twentyc/rpc/client.py | RestClient.all | def all(self, typ, **kwargs):
"""
List all of type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to
"""
return self._load(self._request(typ, params=kwargs)) | python | def all(self, typ, **kwargs):
"""
List all of type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to
"""
return self._load(self._request(typ, params=kwargs)) | [
"def",
"all",
"(",
"self",
",",
"typ",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_load",
"(",
"self",
".",
"_request",
"(",
"typ",
",",
"params",
"=",
"kwargs",
")",
")"
] | List all of type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to | [
"List",
"all",
"of",
"type",
"Valid",
"arguments",
":",
"skip",
":",
"number",
"of",
"records",
"to",
"skip",
"limit",
":",
"number",
"of",
"records",
"to",
"limit",
"request",
"to"
] | train | https://github.com/20c/twentyc.rpc/blob/23ff07be55eaf21cc2e1a13c2879710b5bc7f933/twentyc/rpc/client.py#L104-L111 |
20c/twentyc.rpc | twentyc/rpc/client.py | RestClient.create | def create(self, typ, data, return_response=False):
"""
Create new type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to
"""
res = self._request(typ, method='POST', data=data)
if res.status_code != 201... | python | def create(self, typ, data, return_response=False):
"""
Create new type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to
"""
res = self._request(typ, method='POST', data=data)
if res.status_code != 201... | [
"def",
"create",
"(",
"self",
",",
"typ",
",",
"data",
",",
"return_response",
"=",
"False",
")",
":",
"res",
"=",
"self",
".",
"_request",
"(",
"typ",
",",
"method",
"=",
"'POST'",
",",
"data",
"=",
"data",
")",
"if",
"res",
".",
"status_code",
"!... | Create new type
Valid arguments:
skip : number of records to skip
limit : number of records to limit request to | [
"Create",
"new",
"type",
"Valid",
"arguments",
":",
"skip",
":",
"number",
"of",
"records",
"to",
"skip",
"limit",
":",
"number",
"of",
"records",
"to",
"limit",
"request",
"to"
] | train | https://github.com/20c/twentyc.rpc/blob/23ff07be55eaf21cc2e1a13c2879710b5bc7f933/twentyc/rpc/client.py#L119-L143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.