hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _create_empty_security_group | <not_specific> | def _create_empty_security_group(self, tenant_id, client=None,
namestart='secgroup-smoke-'):
"""Create a security group without rules.
Default rules will be created:
- IPv4 egress to any
- IPv6 egress to any
:param tenant_id: secgroup will... | Create a security group without rules.
Default rules will be created:
- IPv4 egress to any
- IPv6 egress to any
:param tenant_id: secgroup will be created in this tenant
:returns: DeletableSecurityGroup -- containing the secgroup created
| Create a security group without rules.
Default rules will be created:
IPv4 egress to any
IPv6 egress to any | [
"Create",
"a",
"security",
"group",
"without",
"rules",
".",
"Default",
"rules",
"will",
"be",
"created",
":",
"IPv4",
"egress",
"to",
"any",
"IPv6",
"egress",
"to",
"any"
] | def _create_empty_security_group(self, tenant_id, client=None,
namestart='secgroup-smoke-'):
if client is None:
client = self.network_client
sg_name = data_utils.rand_name(namestart)
sg_desc = sg_name + " description"
sg_dict = dict(name=s... | [
"def",
"_create_empty_security_group",
"(",
"self",
",",
"tenant_id",
",",
"client",
"=",
"None",
",",
"namestart",
"=",
"'secgroup-smoke-'",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"network_client",
"sg_name",
"=",
"data_utils... | Create a security group without rules. | [
"Create",
"a",
"security",
"group",
"without",
"rules",
"."
] | [
"\"\"\"Create a security group without rules.\n\n Default rules will be created:\n - IPv4 egress to any\n - IPv6 egress to any\n\n :param tenant_id: secgroup will be created in this tenant\n :returns: DeletableSecurityGroup -- containing the secgroup created\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "client",
"type": null
},
{
"param": "namestart",
"type": null
}
] | {
"returns": [
{
"docstring": "- containing the secgroup created",
"docstring_tokens": [
"-",
"containing",
"the",
"secgroup",
"created"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _default_security_group | <not_specific> | def _default_security_group(self, tenant_id, client=None):
"""Get default secgroup for given tenant_id.
:returns: DeletableSecurityGroup -- default secgroup for given tenant
"""
if client is None:
client = self.network_client
sgs = [
sg for sg in client.l... | Get default secgroup for given tenant_id.
:returns: DeletableSecurityGroup -- default secgroup for given tenant
| Get default secgroup for given tenant_id. | [
"Get",
"default",
"secgroup",
"for",
"given",
"tenant_id",
"."
] | def _default_security_group(self, tenant_id, client=None):
if client is None:
client = self.network_client
sgs = [
sg for sg in client.list_security_groups().values()[0]
if sg['tenant_id'] == tenant_id and sg['name'] == 'default'
]
msg = "No default se... | [
"def",
"_default_security_group",
"(",
"self",
",",
"tenant_id",
",",
"client",
"=",
"None",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"network_client",
"sgs",
"=",
"[",
"sg",
"for",
"sg",
"in",
"client",
".",
"list_securit... | Get default secgroup for given tenant_id. | [
"Get",
"default",
"secgroup",
"for",
"given",
"tenant_id",
"."
] | [
"\"\"\"Get default secgroup for given tenant_id.\n\n :returns: DeletableSecurityGroup -- default secgroup for given tenant\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "client",
"type": null
}
] | {
"returns": [
{
"docstring": "- default secgroup for given tenant",
"docstring_tokens": [
"-",
"default",
"secgroup",
"for",
"given",
"tenant"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _create_security_group_rule | <not_specific> | def _create_security_group_rule(self, client=None, secgroup=None,
tenant_id=None, **kwargs):
"""Create a rule from a dictionary of rule parameters.
Create a rule in a secgroup. if secgroup not defined will search for
default secgroup in tenant_id.
:p... | Create a rule from a dictionary of rule parameters.
Create a rule in a secgroup. if secgroup not defined will search for
default secgroup in tenant_id.
:param secgroup: type DeletableSecurityGroup.
:param secgroup_id: search for secgroup by id
default -- choose default secg... | Create a rule from a dictionary of rule parameters.
Create a rule in a secgroup. if secgroup not defined will search for
default secgroup in tenant_id. | [
"Create",
"a",
"rule",
"from",
"a",
"dictionary",
"of",
"rule",
"parameters",
".",
"Create",
"a",
"rule",
"in",
"a",
"secgroup",
".",
"if",
"secgroup",
"not",
"defined",
"will",
"search",
"for",
"default",
"secgroup",
"in",
"tenant_id",
"."
] | def _create_security_group_rule(self, client=None, secgroup=None,
tenant_id=None, **kwargs):
if client is None:
client = self.network_client
if secgroup is None:
secgroup = self._default_security_group(tenant_id)
ruleset = dict(security... | [
"def",
"_create_security_group_rule",
"(",
"self",
",",
"client",
"=",
"None",
",",
"secgroup",
"=",
"None",
",",
"tenant_id",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"network_client",
"i... | Create a rule from a dictionary of rule parameters. | [
"Create",
"a",
"rule",
"from",
"a",
"dictionary",
"of",
"rule",
"parameters",
"."
] | [
"\"\"\"Create a rule from a dictionary of rule parameters.\n\n Create a rule in a secgroup. if secgroup not defined will search for\n default secgroup in tenant_id.\n\n :param secgroup: type DeletableSecurityGroup.\n :param secgroup_id: search for secgroup by id\n default -- c... | [
{
"param": "self",
"type": null
},
{
"param": "client",
"type": null
},
{
"param": "secgroup",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "client",
"type": null,
"docstring": null,
"docstring_tokens":... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _create_loginable_secgroup_rule_neutron | <not_specific> | def _create_loginable_secgroup_rule_neutron(self, client=None,
secgroup=None):
"""These rules are intended to permit inbound ssh and icmp
traffic from all sources, so no group_id is provided.
Setting a group_id would only permit traffic from ports
... | These rules are intended to permit inbound ssh and icmp
traffic from all sources, so no group_id is provided.
Setting a group_id would only permit traffic from ports
belonging to the same security group.
| These rules are intended to permit inbound ssh and icmp
traffic from all sources, so no group_id is provided.
Setting a group_id would only permit traffic from ports
belonging to the same security group. | [
"These",
"rules",
"are",
"intended",
"to",
"permit",
"inbound",
"ssh",
"and",
"icmp",
"traffic",
"from",
"all",
"sources",
"so",
"no",
"group_id",
"is",
"provided",
".",
"Setting",
"a",
"group_id",
"would",
"only",
"permit",
"traffic",
"from",
"ports",
"belo... | def _create_loginable_secgroup_rule_neutron(self, client=None,
secgroup=None):
if client is None:
client = self.network_client
rules = []
rulesets = [
dict(
protocol='tcp',
port_range_min=22,
... | [
"def",
"_create_loginable_secgroup_rule_neutron",
"(",
"self",
",",
"client",
"=",
"None",
",",
"secgroup",
"=",
"None",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"network_client",
"rules",
"=",
"[",
"]",
"rulesets",
"=",
"["... | These rules are intended to permit inbound ssh and icmp
traffic from all sources, so no group_id is provided. | [
"These",
"rules",
"are",
"intended",
"to",
"permit",
"inbound",
"ssh",
"and",
"icmp",
"traffic",
"from",
"all",
"sources",
"so",
"no",
"group_id",
"is",
"provided",
"."
] | [
"\"\"\"These rules are intended to permit inbound ssh and icmp\n traffic from all sources, so no group_id is provided.\n Setting a group_id would only permit traffic from ports\n belonging to the same security group.\n \"\"\"",
"# ssh",
"# ping",
"# if rule already exist - skip rul... | [
{
"param": "self",
"type": null
},
{
"param": "client",
"type": null
},
{
"param": "secgroup",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "client",
"type": null,
"docstring": null,
"docstring_tokens":... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _get_router | <not_specific> | def _get_router(self, tenant_id):
"""Retrieve a router for the given tenant id.
If a public router has been configured, it will be returned.
If a public router has not been configured, but a public
network has, a tenant router will be created and returned that
routes traffic to... | Retrieve a router for the given tenant id.
If a public router has been configured, it will be returned.
If a public router has not been configured, but a public
network has, a tenant router will be created and returned that
routes traffic to the public network.
| Retrieve a router for the given tenant id.
If a public router has been configured, it will be returned.
If a public router has not been configured, but a public
network has, a tenant router will be created and returned that
routes traffic to the public network. | [
"Retrieve",
"a",
"router",
"for",
"the",
"given",
"tenant",
"id",
".",
"If",
"a",
"public",
"router",
"has",
"been",
"configured",
"it",
"will",
"be",
"returned",
".",
"If",
"a",
"public",
"router",
"has",
"not",
"been",
"configured",
"but",
"a",
"public... | def _get_router(self, tenant_id):
router_id = self.config.network.public_router_id
network_id = self.config.network.public_network_id
if router_id:
result = self.network_client.show_router(router_id)
return net_common.AttributeDict(**result['router'])
elif network... | [
"def",
"_get_router",
"(",
"self",
",",
"tenant_id",
")",
":",
"router_id",
"=",
"self",
".",
"config",
".",
"network",
".",
"public_router_id",
"network_id",
"=",
"self",
".",
"config",
".",
"network",
".",
"public_network_id",
"if",
"router_id",
":",
"resu... | Retrieve a router for the given tenant id. | [
"Retrieve",
"a",
"router",
"for",
"the",
"given",
"tenant",
"id",
"."
] | [
"\"\"\"Retrieve a router for the given tenant id.\n\n If a public router has been configured, it will be returned.\n\n If a public router has not been configured, but a public\n network has, a tenant router will be created and returned that\n routes traffic to the public network.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
7b0b08c53283d021becb3001d8d7683c677f0919 | BeenzSyed/tempest | tempest/scenario/manager.py | [
"Apache-2.0"
] | Python | _create_networks | <not_specific> | def _create_networks(self, tenant_id=None):
"""Create a network with a subnet connected to a router.
:returns: network, subnet, router
"""
if tenant_id is None:
tenant_id = self.tenant_id
network = self._create_network(tenant_id)
router = self._get_router(ten... | Create a network with a subnet connected to a router.
:returns: network, subnet, router
| Create a network with a subnet connected to a router. | [
"Create",
"a",
"network",
"with",
"a",
"subnet",
"connected",
"to",
"a",
"router",
"."
] | def _create_networks(self, tenant_id=None):
if tenant_id is None:
tenant_id = self.tenant_id
network = self._create_network(tenant_id)
router = self._get_router(tenant_id)
subnet = self._create_subnet(network)
subnet.add_to_router(router.id)
self.networks.appe... | [
"def",
"_create_networks",
"(",
"self",
",",
"tenant_id",
"=",
"None",
")",
":",
"if",
"tenant_id",
"is",
"None",
":",
"tenant_id",
"=",
"self",
".",
"tenant_id",
"network",
"=",
"self",
".",
"_create_network",
"(",
"tenant_id",
")",
"router",
"=",
"self",... | Create a network with a subnet connected to a router. | [
"Create",
"a",
"network",
"with",
"a",
"subnet",
"connected",
"to",
"a",
"router",
"."
] | [
"\"\"\"Create a network with a subnet connected to a router.\n\n :returns: network, subnet, router\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [
{
"docstring": "network, subnet, router",
"docstring_tokens": [
"network",
"subnet",
"router"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_toke... |
3c8d95ebd54df6582cd1fc09847cc51d1dedd6c0 | BeenzSyed/tempest | tempest/api/image/v1/test_images.py | [
"Apache-2.0"
] | Python | _create_remote_image | <not_specific> | def _create_remote_image(cls, name, container_format, disk_format):
"""
Create a new remote image and return the ID of the newly-registered
image
"""
name = 'New Remote Image %s' % name
location = 'http://example.com/someimage_%s.iso' % name
resp, image = cls.crea... |
Create a new remote image and return the ID of the newly-registered
image
| Create a new remote image and return the ID of the newly-registered
image | [
"Create",
"a",
"new",
"remote",
"image",
"and",
"return",
"the",
"ID",
"of",
"the",
"newly",
"-",
"registered",
"image"
] | def _create_remote_image(cls, name, container_format, disk_format):
name = 'New Remote Image %s' % name
location = 'http://example.com/someimage_%s.iso' % name
resp, image = cls.create_image(name=name,
container_format=container_format,
... | [
"def",
"_create_remote_image",
"(",
"cls",
",",
"name",
",",
"container_format",
",",
"disk_format",
")",
":",
"name",
"=",
"'New Remote Image %s'",
"%",
"name",
"location",
"=",
"'http://example.com/someimage_%s.iso'",
"%",
"name",
"resp",
",",
"image",
"=",
"cls... | Create a new remote image and return the ID of the newly-registered
image | [
"Create",
"a",
"new",
"remote",
"image",
"and",
"return",
"the",
"ID",
"of",
"the",
"newly",
"-",
"registered",
"image"
] | [
"\"\"\"\n Create a new remote image and return the ID of the newly-registered\n image\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "container_format",
"type": null
},
{
"param": "disk_format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
3c8d95ebd54df6582cd1fc09847cc51d1dedd6c0 | BeenzSyed/tempest | tempest/api/image/v1/test_images.py | [
"Apache-2.0"
] | Python | _create_standard_image | <not_specific> | def _create_standard_image(cls, name, container_format,
disk_format, size):
"""
Create a new standard image and return the ID of the newly-registered
image. Note that the size of the new image is a random number between
1024 and 4096
"""
ima... |
Create a new standard image and return the ID of the newly-registered
image. Note that the size of the new image is a random number between
1024 and 4096
| Create a new standard image and return the ID of the newly-registered
image. Note that the size of the new image is a random number between
1024 and 4096 | [
"Create",
"a",
"new",
"standard",
"image",
"and",
"return",
"the",
"ID",
"of",
"the",
"newly",
"-",
"registered",
"image",
".",
"Note",
"that",
"the",
"size",
"of",
"the",
"new",
"image",
"is",
"a",
"random",
"number",
"between",
"1024",
"and",
"4096"
] | def _create_standard_image(cls, name, container_format,
disk_format, size):
image_file = StringIO.StringIO('*' * size)
name = 'New Standard Image %s' % name
resp, image = cls.create_image(name=name,
container_format=container_... | [
"def",
"_create_standard_image",
"(",
"cls",
",",
"name",
",",
"container_format",
",",
"disk_format",
",",
"size",
")",
":",
"image_file",
"=",
"StringIO",
".",
"StringIO",
"(",
"'*'",
"*",
"size",
")",
"name",
"=",
"'New Standard Image %s'",
"%",
"name",
"... | Create a new standard image and return the ID of the newly-registered
image. | [
"Create",
"a",
"new",
"standard",
"image",
"and",
"return",
"the",
"ID",
"of",
"the",
"newly",
"-",
"registered",
"image",
"."
] | [
"\"\"\"\n Create a new standard image and return the ID of the newly-registered\n image. Note that the size of the new image is a random number between\n 1024 and 4096\n \"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "container_format",
"type": null
},
{
"param": "disk_format",
"type": null
},
{
"param": "size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
2e499a2b17e6a8350812186e66e5d6afe3416ecf | BeenzSyed/tempest | tempest/hacking/checks.py | [
"Apache-2.0"
] | Python | import_no_clients_in_api | <not_specific> | def import_no_clients_in_api(physical_line, filename):
"""Check for client imports from tempest/api tests
T102: Cannot import OpenStack python clients
"""
if "tempest/api" in filename:
res = PYTHON_CLIENT_RE.match(physical_line)
if res:
return (physical_line.find(res.group(... | Check for client imports from tempest/api tests
T102: Cannot import OpenStack python clients
| Check for client imports from tempest/api tests
T102: Cannot import OpenStack python clients | [
"Check",
"for",
"client",
"imports",
"from",
"tempest",
"/",
"api",
"tests",
"T102",
":",
"Cannot",
"import",
"OpenStack",
"python",
"clients"
] | def import_no_clients_in_api(physical_line, filename):
if "tempest/api" in filename:
res = PYTHON_CLIENT_RE.match(physical_line)
if res:
return (physical_line.find(res.group(1)),
("T102: python clients import not allowed"
" in tempest/api/* tests"... | [
"def",
"import_no_clients_in_api",
"(",
"physical_line",
",",
"filename",
")",
":",
"if",
"\"tempest/api\"",
"in",
"filename",
":",
"res",
"=",
"PYTHON_CLIENT_RE",
".",
"match",
"(",
"physical_line",
")",
"if",
"res",
":",
"return",
"(",
"physical_line",
".",
... | Check for client imports from tempest/api tests
T102: Cannot import OpenStack python clients | [
"Check",
"for",
"client",
"imports",
"from",
"tempest",
"/",
"api",
"tests",
"T102",
":",
"Cannot",
"import",
"OpenStack",
"python",
"clients"
] | [
"\"\"\"Check for client imports from tempest/api tests\n\n T102: Cannot import OpenStack python clients\n \"\"\""
] | [
{
"param": "physical_line",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "physical_line",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstri... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | _translate_ip_xml_json | <not_specific> | def _translate_ip_xml_json(ip):
"""
Convert the address version to int.
"""
ip = dict(ip)
version = ip.get('version')
if version:
ip['version'] = int(version)
if ip.get('type'):
ip['type'] = ip.get('type')
if ip.get('mac_addr'):
ip['mac_addr'] = ip.get('mac_addr')... |
Convert the address version to int.
| Convert the address version to int. | [
"Convert",
"the",
"address",
"version",
"to",
"int",
"."
] | def _translate_ip_xml_json(ip):
ip = dict(ip)
version = ip.get('version')
if version:
ip['version'] = int(version)
if ip.get('type'):
ip['type'] = ip.get('type')
if ip.get('mac_addr'):
ip['mac_addr'] = ip.get('mac_addr')
return ip | [
"def",
"_translate_ip_xml_json",
"(",
"ip",
")",
":",
"ip",
"=",
"dict",
"(",
"ip",
")",
"version",
"=",
"ip",
".",
"get",
"(",
"'version'",
")",
"if",
"version",
":",
"ip",
"[",
"'version'",
"]",
"=",
"int",
"(",
"version",
")",
"if",
"ip",
".",
... | Convert the address version to int. | [
"Convert",
"the",
"address",
"version",
"to",
"int",
"."
] | [
"\"\"\"\n Convert the address version to int.\n \"\"\""
] | [
{
"param": "ip",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ip",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | create_server | <not_specific> | def create_server(self, name, image_ref, flavor_ref, **kwargs):
"""
Creates an instance of a server.
name (Required): The name of the server.
image_ref (Required): Reference to the image used to build the server.
flavor_ref (Required): The flavor used to build the server.
... |
Creates an instance of a server.
name (Required): The name of the server.
image_ref (Required): Reference to the image used to build the server.
flavor_ref (Required): The flavor used to build the server.
Following optional keyword arguments are accepted:
admin_password:... | Creates an instance of a server.
name (Required): The name of the server.
image_ref (Required): Reference to the image used to build the server.
flavor_ref (Required): The flavor used to build the server.
Following optional keyword arguments are accepted:
admin_password: Sets the initial root password.
key_name: Key na... | [
"Creates",
"an",
"instance",
"of",
"a",
"server",
".",
"name",
"(",
"Required",
")",
":",
"The",
"name",
"of",
"the",
"server",
".",
"image_ref",
"(",
"Required",
")",
":",
"Reference",
"to",
"the",
"image",
"used",
"to",
"build",
"the",
"server",
".",... | def create_server(self, name, image_ref, flavor_ref, **kwargs):
server = Element("server",
xmlns=XMLNS_V3,
flavor_ref=flavor_ref,
image_ref=image_ref,
name=name)
attrs = ["admin_password", "key_name",
... | [
"def",
"create_server",
"(",
"self",
",",
"name",
",",
"image_ref",
",",
"flavor_ref",
",",
"**",
"kwargs",
")",
":",
"server",
"=",
"Element",
"(",
"\"server\"",
",",
"xmlns",
"=",
"XMLNS_V3",
",",
"flavor_ref",
"=",
"flavor_ref",
",",
"image_ref",
"=",
... | Creates an instance of a server. | [
"Creates",
"an",
"instance",
"of",
"a",
"server",
"."
] | [
"\"\"\"\n Creates an instance of a server.\n name (Required): The name of the server.\n image_ref (Required): Reference to the image used to build the server.\n flavor_ref (Required): The flavor used to build the server.\n Following optional keyword arguments are accepted:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "image_ref",
"type": null
},
{
"param": "flavor_ref",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | wait_for_server_termination | <not_specific> | def wait_for_server_termination(self, server_id, ignore_error=False):
"""Waits for server to reach termination."""
start_time = int(time.time())
while True:
try:
resp, body = self.get_server(server_id)
except exceptions.NotFound:
return
... | Waits for server to reach termination. | Waits for server to reach termination. | [
"Waits",
"for",
"server",
"to",
"reach",
"termination",
"."
] | def wait_for_server_termination(self, server_id, ignore_error=False):
start_time = int(time.time())
while True:
try:
resp, body = self.get_server(server_id)
except exceptions.NotFound:
return
server_status = body['status']
i... | [
"def",
"wait_for_server_termination",
"(",
"self",
",",
"server_id",
",",
"ignore_error",
"=",
"False",
")",
":",
"start_time",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"while",
"True",
":",
"try",
":",
"resp",
",",
"body",
"=",
"self",
"."... | Waits for server to reach termination. | [
"Waits",
"for",
"server",
"to",
"reach",
"termination",
"."
] | [
"\"\"\"Waits for server to reach termination.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
},
{
"param": "ignore_error",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | list_addresses | <not_specific> | def list_addresses(self, server_id):
"""Lists all addresses for a server."""
resp, body = self.get("servers/%s/ips" % str(server_id), self.headers)
networks = {}
xml_list = etree.fromstring(body)
for child in xml_list.getchildren():
network = self._parse_network(chil... | Lists all addresses for a server. | Lists all addresses for a server. | [
"Lists",
"all",
"addresses",
"for",
"a",
"server",
"."
] | def list_addresses(self, server_id):
resp, body = self.get("servers/%s/ips" % str(server_id), self.headers)
networks = {}
xml_list = etree.fromstring(body)
for child in xml_list.getchildren():
network = self._parse_network(child)
networks.update(**network)
... | [
"def",
"list_addresses",
"(",
"self",
",",
"server_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"\"servers/%s/ips\"",
"%",
"str",
"(",
"server_id",
")",
",",
"self",
".",
"headers",
")",
"networks",
"=",
"{",
"}",
"xml_list",
"=",
... | Lists all addresses for a server. | [
"Lists",
"all",
"addresses",
"for",
"a",
"server",
"."
] | [
"\"\"\"Lists all addresses for a server.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | list_addresses_by_network | <not_specific> | def list_addresses_by_network(self, server_id, network_id):
"""Lists all addresses of a specific network type for a server."""
resp, body = self.get("servers/%s/ips/%s" % (str(server_id),
network_id),
self.headers)
... | Lists all addresses of a specific network type for a server. | Lists all addresses of a specific network type for a server. | [
"Lists",
"all",
"addresses",
"of",
"a",
"specific",
"network",
"type",
"for",
"a",
"server",
"."
] | def list_addresses_by_network(self, server_id, network_id):
resp, body = self.get("servers/%s/ips/%s" % (str(server_id),
network_id),
self.headers)
network = self._parse_network(etree.fromstring(body))
return resp... | [
"def",
"list_addresses_by_network",
"(",
"self",
",",
"server_id",
",",
"network_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"\"servers/%s/ips/%s\"",
"%",
"(",
"str",
"(",
"server_id",
")",
",",
"network_id",
")",
",",
"self",
".",
... | Lists all addresses of a specific network type for a server. | [
"Lists",
"all",
"addresses",
"of",
"a",
"specific",
"network",
"type",
"for",
"a",
"server",
"."
] | [
"\"\"\"Lists all addresses of a specific network type for a server.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
},
{
"param": "network_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | create_image | <not_specific> | def create_image(self, server_id, name, meta=None):
"""Creates an image of the original server."""
post_body = Element('create_image', name=name)
if meta:
metadata = Element('metadata')
post_body.append(metadata)
for k, v in meta.items():
data... | Creates an image of the original server. | Creates an image of the original server. | [
"Creates",
"an",
"image",
"of",
"the",
"original",
"server",
"."
] | def create_image(self, server_id, name, meta=None):
post_body = Element('create_image', name=name)
if meta:
metadata = Element('metadata')
post_body.append(metadata)
for k, v in meta.items():
data = Element('meta', key=k)
data.append(Te... | [
"def",
"create_image",
"(",
"self",
",",
"server_id",
",",
"name",
",",
"meta",
"=",
"None",
")",
":",
"post_body",
"=",
"Element",
"(",
"'create_image'",
",",
"name",
"=",
"name",
")",
"if",
"meta",
":",
"metadata",
"=",
"Element",
"(",
"'metadata'",
... | Creates an image of the original server. | [
"Creates",
"an",
"image",
"of",
"the",
"original",
"server",
"."
] | [
"\"\"\"Creates an image of the original server.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "meta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
240c962d1ca10111aeb8350c15945ca5f3df84e0 | BeenzSyed/tempest | tempest/services/compute/v3/xml/servers_client.py | [
"Apache-2.0"
] | Python | list_instance_actions | <not_specific> | def list_instance_actions(self, server_id):
"""List the provided server action."""
resp, body = self.get("servers/%s/os-instance-actions" % server_id,
self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body | List the provided server action. | List the provided server action. | [
"List",
"the",
"provided",
"server",
"action",
"."
] | def list_instance_actions(self, server_id):
resp, body = self.get("servers/%s/os-instance-actions" % server_id,
self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body | [
"def",
"list_instance_actions",
"(",
"self",
",",
"server_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"\"servers/%s/os-instance-actions\"",
"%",
"server_id",
",",
"self",
".",
"headers",
")",
"body",
"=",
"self",
".",
"_parse_array",
"(... | List the provided server action. | [
"List",
"the",
"provided",
"server",
"action",
"."
] | [
"\"\"\"List the provided server action.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | list_stacks | <not_specific> | def list_stacks(self, region, params=None):
"""Lists all stacks for a user."""
uri = 'stacks'
if params:
uri += '?%s' % urllib.urlencode(params)
resp, body = self.get(uri, region)
if resp['status'] == '200':
body = json.loads(body)
return resp... | Lists all stacks for a user. | Lists all stacks for a user. | [
"Lists",
"all",
"stacks",
"for",
"a",
"user",
"."
] | def list_stacks(self, region, params=None):
uri = 'stacks'
if params:
uri += '?%s' % urllib.urlencode(params)
resp, body = self.get(uri, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body['stacks']
else:
r... | [
"def",
"list_stacks",
"(",
"self",
",",
"region",
",",
"params",
"=",
"None",
")",
":",
"uri",
"=",
"'stacks'",
"if",
"params",
":",
"uri",
"+=",
"'?%s'",
"%",
"urllib",
".",
"urlencode",
"(",
"params",
")",
"resp",
",",
"body",
"=",
"self",
".",
"... | Lists all stacks for a user. | [
"Lists",
"all",
"stacks",
"for",
"a",
"user",
"."
] | [
"\"\"\"Lists all stacks for a user.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tokens":... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | list_stacks_mgmt_api | <not_specific> | def list_stacks_mgmt_api(self, region, params=None):
"""Lists all stacks for a user."""
# uri = 'stacks'
# if params:
# uri += '?%s?GLOBAL_TENANT=1' % urllib.urlencode(params)
# print uri
url = "stacks?global_tenant=1"
resp, body = self.get(url, region)
... | Lists all stacks for a user. | Lists all stacks for a user. | [
"Lists",
"all",
"stacks",
"for",
"a",
"user",
"."
] | def list_stacks_mgmt_api(self, region, params=None):
url = "stacks?global_tenant=1"
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body['stacks']
else:
return resp, body | [
"def",
"list_stacks_mgmt_api",
"(",
"self",
",",
"region",
",",
"params",
"=",
"None",
")",
":",
"url",
"=",
"\"stacks?global_tenant=1\"",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
",",
"region",
")",
"if",
"resp",
"[",
"'status'",
"]",
... | Lists all stacks for a user. | [
"Lists",
"all",
"stacks",
"for",
"a",
"user",
"."
] | [
"\"\"\"Lists all stacks for a user.\"\"\"",
"# uri = 'stacks'",
"# if params:",
"# uri += '?%s?GLOBAL_TENANT=1' % urllib.urlencode(params)",
"# print uri"
] | [
{
"param": "self",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tokens":... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | list_resources | <not_specific> | def list_resources(self, stack_name, stack_identifier, region):
"""Returns the details of a single resource."""
url = "stacks/%s/%s/resources" % (stack_name, stack_identifier)
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
r... | Returns the details of a single resource. | Returns the details of a single resource. | [
"Returns",
"the",
"details",
"of",
"a",
"single",
"resource",
"."
] | def list_resources(self, stack_name, stack_identifier, region):
url = "stacks/%s/%s/resources" % (stack_name, stack_identifier)
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body['resources']
else:
... | [
"def",
"list_resources",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"region",
")",
":",
"url",
"=",
"\"stacks/%s/%s/resources\"",
"%",
"(",
"stack_name",
",",
"stack_identifier",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url... | Returns the details of a single resource. | [
"Returns",
"the",
"details",
"of",
"a",
"single",
"resource",
"."
] | [
"\"\"\"Returns the details of a single resource.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | wait_for_resource_status | <not_specific> | def wait_for_resource_status(self, stack_identifier, resource_name,
status, failure_pattern='^.*_FAILED$'):
"""Waits for a Resource to reach a given status."""
start = int(time.time())
fail_regexp = re.compile(failure_pattern)
while True:
try... | Waits for a Resource to reach a given status. | Waits for a Resource to reach a given status. | [
"Waits",
"for",
"a",
"Resource",
"to",
"reach",
"a",
"given",
"status",
"."
] | def wait_for_resource_status(self, stack_identifier, resource_name,
status, failure_pattern='^.*_FAILED$'):
start = int(time.time())
fail_regexp = re.compile(failure_pattern)
while True:
try:
resp, body = self.get_resource(
... | [
"def",
"wait_for_resource_status",
"(",
"self",
",",
"stack_identifier",
",",
"resource_name",
",",
"status",
",",
"failure_pattern",
"=",
"'^.*_FAILED$'",
")",
":",
"start",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"fail_regexp",
"=",
"re",
".",... | Waits for a Resource to reach a given status. | [
"Waits",
"for",
"a",
"Resource",
"to",
"reach",
"a",
"given",
"status",
"."
] | [
"\"\"\"Waits for a Resource to reach a given status.\"\"\"",
"# ignore this, as the resource may not have",
"# been created yet"
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "resource_name",
"type": null
},
{
"param": "status",
"type": null
},
{
"param": "failure_pattern",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_identifier",
"type": null,
"docstring": null,
"docstrin... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | wait_for_stack_status | <not_specific> | def wait_for_stack_status(self, stack_identifier, status,
failure_pattern='^.*_FAILED$'):
"""Waits for a Stack to reach a given status."""
start = int(time.time())
fail_regexp = re.compile(failure_pattern)
while True:
resp, body = self.get_stack... | Waits for a Stack to reach a given status. | Waits for a Stack to reach a given status. | [
"Waits",
"for",
"a",
"Stack",
"to",
"reach",
"a",
"given",
"status",
"."
] | def wait_for_stack_status(self, stack_identifier, status,
failure_pattern='^.*_FAILED$'):
start = int(time.time())
fail_regexp = re.compile(failure_pattern)
while True:
resp, body = self.get_stack(stack_identifier)
stack_name = body['stack_na... | [
"def",
"wait_for_stack_status",
"(",
"self",
",",
"stack_identifier",
",",
"status",
",",
"failure_pattern",
"=",
"'^.*_FAILED$'",
")",
":",
"start",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"fail_regexp",
"=",
"re",
".",
"compile",
"(",
"failu... | Waits for a Stack to reach a given status. | [
"Waits",
"for",
"a",
"Stack",
"to",
"reach",
"a",
"given",
"status",
"."
] | [
"\"\"\"Waits for a Stack to reach a given status.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "status",
"type": null
},
{
"param": "failure_pattern",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_identifier",
"type": null,
"docstring": null,
"docstrin... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | show_resource_metadata | <not_specific> | def show_resource_metadata(self, stack_name, stack_identifier, resource_name, region):
"""Returns the resource's metadata."""
url = ('stacks/{stack_name}/{stack_identifier}/resources/{resource_name}'
'/metadata'.format(**locals()))
resp, body = self.get(url, region)
if res... | Returns the resource's metadata. | Returns the resource's metadata. | [
"Returns",
"the",
"resource",
"'",
"s",
"metadata",
"."
] | def show_resource_metadata(self, stack_name, stack_identifier, resource_name, region):
url = ('stacks/{stack_name}/{stack_identifier}/resources/{resource_name}'
'/metadata'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.l... | [
"def",
"show_resource_metadata",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"resource_name",
",",
"region",
")",
":",
"url",
"=",
"(",
"'stacks/{stack_name}/{stack_identifier}/resources/{resource_name}'",
"'/metadata'",
".",
"format",
"(",
"**",
"loca... | Returns the resource's metadata. | [
"Returns",
"the",
"resource",
"'",
"s",
"metadata",
"."
] | [
"\"\"\"Returns the resource's metadata.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "resource_name",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | list_events | <not_specific> | def list_events(self, stack_name, stack_identifier, region):
"""Returns list of all events for a stack."""
url = 'stacks/{stack_name}/{stack_identifier}/events'.format(**locals())
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
... | Returns list of all events for a stack. | Returns list of all events for a stack. | [
"Returns",
"list",
"of",
"all",
"events",
"for",
"a",
"stack",
"."
] | def list_events(self, stack_name, stack_identifier, region):
url = 'stacks/{stack_name}/{stack_identifier}/events'.format(**locals())
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body['events']
else:
... | [
"def",
"list_events",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"region",
")",
":",
"url",
"=",
"'stacks/{stack_name}/{stack_identifier}/events'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
"resp",
",",
"body",
"=",
"self",
".",
"... | Returns list of all events for a stack. | [
"Returns",
"list",
"of",
"all",
"events",
"for",
"a",
"stack",
"."
] | [
"\"\"\"Returns list of all events for a stack.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | list_resource_events | <not_specific> | def list_resource_events(self, stack_identifier, resource_name):
"""Returns list of all events for a resource from stack."""
url = ('stacks/{stack_identifier}/resources/{resource_name}'
'/events'.format(**locals()))
resp, body = self.get(url)
if resp['status'] == '200':
... | Returns list of all events for a resource from stack. | Returns list of all events for a resource from stack. | [
"Returns",
"list",
"of",
"all",
"events",
"for",
"a",
"resource",
"from",
"stack",
"."
] | def list_resource_events(self, stack_identifier, resource_name):
url = ('stacks/{stack_identifier}/resources/{resource_name}'
'/events'.format(**locals()))
resp, body = self.get(url)
if resp['status'] == '200':
body = json.loads(body)
return resp, body['eve... | [
"def",
"list_resource_events",
"(",
"self",
",",
"stack_identifier",
",",
"resource_name",
")",
":",
"url",
"=",
"(",
"'stacks/{stack_identifier}/resources/{resource_name}'",
"'/events'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
")",
"resp",
",",
"body",... | Returns list of all events for a resource from stack. | [
"Returns",
"list",
"of",
"all",
"events",
"for",
"a",
"resource",
"from",
"stack",
"."
] | [
"\"\"\"Returns list of all events for a resource from stack.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "resource_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_identifier",
"type": null,
"docstring": null,
"docstrin... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | show_event | <not_specific> | def show_event(self, stack_name, stack_identifier, resource_name, event_id, region):
"""Returns the details of a single stack's event."""
url = ('stacks/{stack_name}/{stack_identifier}/resources/{resource_name}/events'
'/{event_id}'.format(**locals()))
#url = ('stacks/{stack_name... | Returns the details of a single stack's event. | Returns the details of a single stack's event. | [
"Returns",
"the",
"details",
"of",
"a",
"single",
"stack",
"'",
"s",
"event",
"."
] | def show_event(self, stack_name, stack_identifier, resource_name, event_id, region):
url = ('stacks/{stack_name}/{stack_identifier}/resources/{resource_name}/events'
'/{event_id}'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body ... | [
"def",
"show_event",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"resource_name",
",",
"event_id",
",",
"region",
")",
":",
"url",
"=",
"(",
"'stacks/{stack_name}/{stack_identifier}/resources/{resource_name}/events'",
"'/{event_id}'",
".",
"format",
"(... | Returns the details of a single stack's event. | [
"Returns",
"the",
"details",
"of",
"a",
"single",
"stack",
"'",
"s",
"event",
"."
] | [
"\"\"\"Returns the details of a single stack's event.\"\"\"",
"#url = ('stacks/{stack_name}/{stack_identifier}/resources/{resource_name}/events'.format(**locals()))",
"#print \"url for show event %s\" % url"
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "resource_name",
"type": null
},
{
"param": "event_id",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | show_template | <not_specific> | def show_template(self, stack_name, stack_identifier, region):
"""Returns the template for the stack."""
url = ('stacks/{stack_name}/{stack_identifier}/template'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
... | Returns the template for the stack. | Returns the template for the stack. | [
"Returns",
"the",
"template",
"for",
"the",
"stack",
"."
] | def show_template(self, stack_name, stack_identifier, region):
url = ('stacks/{stack_name}/{stack_identifier}/template'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"show_template",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"region",
")",
":",
"url",
"=",
"(",
"'stacks/{stack_name}/{stack_identifier}/template'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
")",
"resp",
",",
"body",
"=",
... | Returns the template for the stack. | [
"Returns",
"the",
"template",
"for",
"the",
"stack",
"."
] | [
"\"\"\"Returns the template for the stack.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | template_resource | <not_specific> | def template_resource(self, region):
"""Lists the supported template resource types."""
url = ('resource_types'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | Lists the supported template resource types. | Lists the supported template resource types. | [
"Lists",
"the",
"supported",
"template",
"resource",
"types",
"."
] | def template_resource(self, region):
url = ('resource_types'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"template_resource",
"(",
"self",
",",
"region",
")",
":",
"url",
"=",
"(",
"'resource_types'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
",",
"region",
")",
"if",
"resp... | Lists the supported template resource types. | [
"Lists",
"the",
"supported",
"template",
"resource",
"types",
"."
] | [
"\"\"\"Lists the supported template resource types.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tokens":... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | resource_schema | <not_specific> | def resource_schema(self, type_name, region):
"""Gets the interface schema for a specified resource type. """
url = ('resource_types/{type_name}'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, bo... | Gets the interface schema for a specified resource type. | Gets the interface schema for a specified resource type. | [
"Gets",
"the",
"interface",
"schema",
"for",
"a",
"specified",
"resource",
"type",
"."
] | def resource_schema(self, type_name, region):
url = ('resource_types/{type_name}'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"resource_schema",
"(",
"self",
",",
"type_name",
",",
"region",
")",
":",
"url",
"=",
"(",
"'resource_types/{type_name}'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
",",
... | Gets the interface schema for a specified resource type. | [
"Gets",
"the",
"interface",
"schema",
"for",
"a",
"specified",
"resource",
"type",
"."
] | [
"\"\"\"Gets the interface schema for a specified resource type. \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "type_name",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_name",
"type": null,
"docstring": null,
"docstring_token... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | resource_template | <not_specific> | def resource_template(self, type_name, region):
"""Returns the template for the stack."""
url = ('resource_types/{type_name}/template'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | Returns the template for the stack. | Returns the template for the stack. | [
"Returns",
"the",
"template",
"for",
"the",
"stack",
"."
] | def resource_template(self, type_name, region):
url = ('resource_types/{type_name}/template'.format(**locals()))
resp, body = self.get(url, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"resource_template",
"(",
"self",
",",
"type_name",
",",
"region",
")",
":",
"url",
"=",
"(",
"'resource_types/{type_name}/template'",
".",
"format",
"(",
"**",
"locals",
"(",
")",
")",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url"... | Returns the template for the stack. | [
"Returns",
"the",
"template",
"for",
"the",
"stack",
"."
] | [
"\"\"\"Returns the template for the stack.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "type_name",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type_name",
"type": null,
"docstring": null,
"docstring_token... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | show_stack | <not_specific> | def show_stack(self, stack_name, stack_identifier, region):
"""Returns the parameters for the stack."""
url = 'stacks/%s/%s' % (stack_name, stack_identifier)
resp, body = self.get(url, region)
if resp['status'] in('200','201'):
body = json.loads(body)
return resp, bod... | Returns the parameters for the stack. | Returns the parameters for the stack. | [
"Returns",
"the",
"parameters",
"for",
"the",
"stack",
"."
] | def show_stack(self, stack_name, stack_identifier, region):
url = 'stacks/%s/%s' % (stack_name, stack_identifier)
resp, body = self.get(url, region)
if resp['status'] in('200','201'):
body = json.loads(body)
return resp, body | [
"def",
"show_stack",
"(",
"self",
",",
"stack_name",
",",
"stack_identifier",
",",
"region",
")",
":",
"url",
"=",
"'stacks/%s/%s'",
"%",
"(",
"stack_name",
",",
"stack_identifier",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
",",
"reg... | Returns the parameters for the stack. | [
"Returns",
"the",
"parameters",
"for",
"the",
"stack",
"."
] | [
"\"\"\"Returns the parameters for the stack.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "stack_name",
"type": null
},
{
"param": "stack_identifier",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stack_name",
"type": null,
"docstring": null,
"docstring_toke... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | _validate_template | <not_specific> | def _validate_template(self, region, post_body):
"""Returns the validation request result."""
post_body = json.dumps(post_body, default=datehandler)
resp, body = self.post('validate', region, post_body, self.headers)
if resp['status'] == '200':
body = json.loads(body)
... | Returns the validation request result. | Returns the validation request result. | [
"Returns",
"the",
"validation",
"request",
"result",
"."
] | def _validate_template(self, region, post_body):
post_body = json.dumps(post_body, default=datehandler)
resp, body = self.post('validate', region, post_body, self.headers)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"_validate_template",
"(",
"self",
",",
"region",
",",
"post_body",
")",
":",
"post_body",
"=",
"json",
".",
"dumps",
"(",
"post_body",
",",
"default",
"=",
"datehandler",
")",
"resp",
",",
"body",
"=",
"self",
".",
"post",
"(",
"'validate'",
",",... | Returns the validation request result. | [
"Returns",
"the",
"validation",
"request",
"result",
"."
] | [
"\"\"\"Returns the validation request result.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "post_body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tokens":... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | validate_template | <not_specific> | def validate_template(self, region, template, parameters={}):
"""Returns the validation result for a template with parameters."""
post_body = {
'template': template,
'parameters': parameters,
}
return self._validate_template(region, post_body) | Returns the validation result for a template with parameters. | Returns the validation result for a template with parameters. | [
"Returns",
"the",
"validation",
"result",
"for",
"a",
"template",
"with",
"parameters",
"."
] | def validate_template(self, region, template, parameters={}):
post_body = {
'template': template,
'parameters': parameters,
}
return self._validate_template(region, post_body) | [
"def",
"validate_template",
"(",
"self",
",",
"region",
",",
"template",
",",
"parameters",
"=",
"{",
"}",
")",
":",
"post_body",
"=",
"{",
"'template'",
":",
"template",
",",
"'parameters'",
":",
"parameters",
",",
"}",
"return",
"self",
".",
"_validate_t... | Returns the validation result for a template with parameters. | [
"Returns",
"the",
"validation",
"result",
"for",
"a",
"template",
"with",
"parameters",
"."
] | [
"\"\"\"Returns the validation result for a template with parameters.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "template",
"type": null
},
{
"param": "parameters",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tokens":... |
cd458f1dcffd49d45d31667a9ac1c7dc7a53224c | BeenzSyed/tempest | tempest/services/orchestration/json/orchestration_client.py | [
"Apache-2.0"
] | Python | validate_template_url | <not_specific> | def validate_template_url(self, template_url, parameters={}):
"""Returns the validation result for a template with parameters."""
post_body = {
'template_url': template_url,
'parameters': parameters,
}
return self._validate_template(post_body) | Returns the validation result for a template with parameters. | Returns the validation result for a template with parameters. | [
"Returns",
"the",
"validation",
"result",
"for",
"a",
"template",
"with",
"parameters",
"."
] | def validate_template_url(self, template_url, parameters={}):
post_body = {
'template_url': template_url,
'parameters': parameters,
}
return self._validate_template(post_body) | [
"def",
"validate_template_url",
"(",
"self",
",",
"template_url",
",",
"parameters",
"=",
"{",
"}",
")",
":",
"post_body",
"=",
"{",
"'template_url'",
":",
"template_url",
",",
"'parameters'",
":",
"parameters",
",",
"}",
"return",
"self",
".",
"_validate_temp... | Returns the validation result for a template with parameters. | [
"Returns",
"the",
"validation",
"result",
"for",
"a",
"template",
"with",
"parameters",
"."
] | [
"\"\"\"Returns the validation result for a template with parameters.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "template_url",
"type": null
},
{
"param": "parameters",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "template_url",
"type": null,
"docstring": null,
"docstring_to... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | create_tenant | <not_specific> | def create_tenant(self, name, **kwargs):
"""
Create a tenant
name (required): New tenant name
description: Description of new tenant (default is none)
enabled <true|false>: Initial tenant status (default is true)
"""
post_body = {
'name': name,
... |
Create a tenant
name (required): New tenant name
description: Description of new tenant (default is none)
enabled <true|false>: Initial tenant status (default is true)
| Create a tenant
name (required): New tenant name
description: Description of new tenant (default is none)
enabled : Initial tenant status (default is true) | [
"Create",
"a",
"tenant",
"name",
"(",
"required",
")",
":",
"New",
"tenant",
"name",
"description",
":",
"Description",
"of",
"new",
"tenant",
"(",
"default",
"is",
"none",
")",
"enabled",
":",
"Initial",
"tenant",
"status",
"(",
"default",
"is",
"true",
... | def create_tenant(self, name, **kwargs):
post_body = {
'name': name,
'description': kwargs.get('description', ''),
'enabled': kwargs.get('enabled', True),
}
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants', post_body, self... | [
"def",
"create_tenant",
"(",
"self",
",",
"name",
",",
"**",
"kwargs",
")",
":",
"post_body",
"=",
"{",
"'name'",
":",
"name",
",",
"'description'",
":",
"kwargs",
".",
"get",
"(",
"'description'",
",",
"''",
")",
",",
"'enabled'",
":",
"kwargs",
".",
... | Create a tenant
name (required): New tenant name
description: Description of new tenant (default is none)
enabled <true|false>: Initial tenant status (default is true) | [
"Create",
"a",
"tenant",
"name",
"(",
"required",
")",
":",
"New",
"tenant",
"name",
"description",
":",
"Description",
"of",
"new",
"tenant",
"(",
"default",
"is",
"none",
")",
"enabled",
"<true|false",
">",
":",
"Initial",
"tenant",
"status",
"(",
"defau... | [
"\"\"\"\n Create a tenant\n name (required): New tenant name\n description: Description of new tenant (default is none)\n enabled <true|false>: Initial tenant status (default is true)\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | list_user_roles | <not_specific> | def list_user_roles(self, tenant_id, user_id):
"""Returns a list of roles assigned to a user for a tenant."""
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['roles'] | Returns a list of roles assigned to a user for a tenant. | Returns a list of roles assigned to a user for a tenant. | [
"Returns",
"a",
"list",
"of",
"roles",
"assigned",
"to",
"a",
"user",
"for",
"a",
"tenant",
"."
] | def list_user_roles(self, tenant_id, user_id):
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['roles'] | [
"def",
"list_user_roles",
"(",
"self",
",",
"tenant_id",
",",
"user_id",
")",
":",
"url",
"=",
"'/tenants/%s/users/%s/roles'",
"%",
"(",
"tenant_id",
",",
"user_id",
")",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
")",
"body",
"=",
"json",... | Returns a list of roles assigned to a user for a tenant. | [
"Returns",
"a",
"list",
"of",
"roles",
"assigned",
"to",
"a",
"user",
"for",
"a",
"tenant",
"."
] | [
"\"\"\"Returns a list of roles assigned to a user for a tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "user_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | assign_user_role | <not_specific> | def assign_user_role(self, tenant_id, user_id, role_id):
"""Add roles to a user on a tenant."""
post_body = json.dumps({})
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), post_body,
self.h... | Add roles to a user on a tenant. | Add roles to a user on a tenant. | [
"Add",
"roles",
"to",
"a",
"user",
"on",
"a",
"tenant",
"."
] | def assign_user_role(self, tenant_id, user_id, role_id):
post_body = json.dumps({})
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), post_body,
self.headers)
body = json.loads(body)
... | [
"def",
"assign_user_role",
"(",
"self",
",",
"tenant_id",
",",
"user_id",
",",
"role_id",
")",
":",
"post_body",
"=",
"json",
".",
"dumps",
"(",
"{",
"}",
")",
"resp",
",",
"body",
"=",
"self",
".",
"put",
"(",
"'/tenants/%s/users/%s/roles/OS-KSADM/%s'",
"... | Add roles to a user on a tenant. | [
"Add",
"roles",
"to",
"a",
"user",
"on",
"a",
"tenant",
"."
] | [
"\"\"\"Add roles to a user on a tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "user_id",
"type": null
},
{
"param": "role_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | enable_disable_user | <not_specific> | def enable_disable_user(self, user_id, enabled):
"""Enables or disables a user."""
put_body = {
'enabled': enabled
}
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id,
put_body, self.headers)
... | Enables or disables a user. | Enables or disables a user. | [
"Enables",
"or",
"disables",
"a",
"user",
"."
] | def enable_disable_user(self, user_id, enabled):
put_body = {
'enabled': enabled
}
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id,
put_body, self.headers)
body = json.loads(body)
retur... | [
"def",
"enable_disable_user",
"(",
"self",
",",
"user_id",
",",
"enabled",
")",
":",
"put_body",
"=",
"{",
"'enabled'",
":",
"enabled",
"}",
"put_body",
"=",
"json",
".",
"dumps",
"(",
"{",
"'user'",
":",
"put_body",
"}",
")",
"resp",
",",
"body",
"=",... | Enables or disables a user. | [
"Enables",
"or",
"disables",
"a",
"user",
"."
] | [
"\"\"\"Enables or disables a user.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": null
},
{
"param": "enabled",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_id",
"type": null,
"docstring": null,
"docstring_tokens"... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | list_users_for_tenant | <not_specific> | def list_users_for_tenant(self, tenant_id):
"""List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
body = json.loads(body)
return resp, body['users'] | List users for a Tenant. | List users for a Tenant. | [
"List",
"users",
"for",
"a",
"Tenant",
"."
] | def list_users_for_tenant(self, tenant_id):
resp, body = self.get('/tenants/%s/users' % tenant_id)
body = json.loads(body)
return resp, body['users'] | [
"def",
"list_users_for_tenant",
"(",
"self",
",",
"tenant_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"'/tenants/%s/users'",
"%",
"tenant_id",
")",
"body",
"=",
"json",
".",
"loads",
"(",
"body",
")",
"return",
"resp",
",",
"body",
... | List users for a Tenant. | [
"List",
"users",
"for",
"a",
"Tenant",
"."
] | [
"\"\"\"List users for a Tenant.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
a0411dc915a0f79b0a3b2a0b7972b1e82a09b4b3 | BeenzSyed/tempest | tempest/services/identity/json/identity_client.py | [
"Apache-2.0"
] | Python | list_services | <not_specific> | def list_services(self):
"""List Service - Returns Services."""
resp, body = self.get('/OS-KSADM/services/')
body = json.loads(body)
return resp, body['OS-KSADM:services'] | List Service - Returns Services. | List Service - Returns Services. | [
"List",
"Service",
"-",
"Returns",
"Services",
"."
] | def list_services(self):
resp, body = self.get('/OS-KSADM/services/')
body = json.loads(body)
return resp, body['OS-KSADM:services'] | [
"def",
"list_services",
"(",
"self",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"'/OS-KSADM/services/'",
")",
"body",
"=",
"json",
".",
"loads",
"(",
"body",
")",
"return",
"resp",
",",
"body",
"[",
"'OS-KSADM:services'",
"]"
] | List Service - Returns Services. | [
"List",
"Service",
"-",
"Returns",
"Services",
"."
] | [
"\"\"\"List Service - Returns Services.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _create_server | <not_specific> | def _create_server(self, name, tenant, security_groups=None):
"""
creates a server and assigns to security group
"""
self._set_compute_context(tenant)
if security_groups is None:
security_groups = [tenant.security_groups['default'].name]
create_kwargs = {
... |
creates a server and assigns to security group
| creates a server and assigns to security group | [
"creates",
"a",
"server",
"and",
"assigns",
"to",
"security",
"group"
] | def _create_server(self, name, tenant, security_groups=None):
self._set_compute_context(tenant)
if security_groups is None:
security_groups = [tenant.security_groups['default'].name]
create_kwargs = {
'nics': [
{'net-id': tenant.network.id},
],... | [
"def",
"_create_server",
"(",
"self",
",",
"name",
",",
"tenant",
",",
"security_groups",
"=",
"None",
")",
":",
"self",
".",
"_set_compute_context",
"(",
"tenant",
")",
"if",
"security_groups",
"is",
"None",
":",
"security_groups",
"=",
"[",
"tenant",
".",
... | creates a server and assigns to security group | [
"creates",
"a",
"server",
"and",
"assigns",
"to",
"security",
"group"
] | [
"\"\"\"\n creates a server and assigns to security group\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "tenant",
"type": null
},
{
"param": "security_groups",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _set_access_point | null | def _set_access_point(self, tenant):
"""
creates a server in a secgroup with rule allowing external ssh
in order to access tenant internal network
workaround ip namespace
"""
secgroups = [sg.name for sg in tenant.security_groups.values()]
name = 'server-{tenant}-a... |
creates a server in a secgroup with rule allowing external ssh
in order to access tenant internal network
workaround ip namespace
| creates a server in a secgroup with rule allowing external ssh
in order to access tenant internal network
workaround ip namespace | [
"creates",
"a",
"server",
"in",
"a",
"secgroup",
"with",
"rule",
"allowing",
"external",
"ssh",
"in",
"order",
"to",
"access",
"tenant",
"internal",
"network",
"workaround",
"ip",
"namespace"
] | def _set_access_point(self, tenant):
secgroups = [sg.name for sg in tenant.security_groups.values()]
name = 'server-{tenant}-access_point-'.format(tenant=tenant.tenant_name
)
name = data_utils.rand_name(name)
server = self._create_ser... | [
"def",
"_set_access_point",
"(",
"self",
",",
"tenant",
")",
":",
"secgroups",
"=",
"[",
"sg",
".",
"name",
"for",
"sg",
"in",
"tenant",
".",
"security_groups",
".",
"values",
"(",
")",
"]",
"name",
"=",
"'server-{tenant}-access_point-'",
".",
"format",
"(... | creates a server in a secgroup with rule allowing external ssh
in order to access tenant internal network
workaround ip namespace | [
"creates",
"a",
"server",
"in",
"a",
"secgroup",
"with",
"rule",
"allowing",
"external",
"ssh",
"in",
"order",
"to",
"access",
"tenant",
"internal",
"network",
"workaround",
"ip",
"namespace"
] | [
"\"\"\"\n creates a server in a secgroup with rule allowing external ssh\n in order to access tenant internal network\n workaround ip namespace\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant",
"type": null,
"docstring": null,
"docstring_tokens":... |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _deploy_tenant | null | def _deploy_tenant(self, tenant_or_id):
"""
creates:
network
subnet
router (if public not defined)
access security group
access-point server
for demo_tenant:
creates general server to test against
"""
... |
creates:
network
subnet
router (if public not defined)
access security group
access-point server
for demo_tenant:
creates general server to test against
| network
subnet
router (if public not defined)
access security group
access-point server
for demo_tenant:
creates general server to test against | [
"network",
"subnet",
"router",
"(",
"if",
"public",
"not",
"defined",
")",
"access",
"security",
"group",
"access",
"-",
"point",
"server",
"for",
"demo_tenant",
":",
"creates",
"general",
"server",
"to",
"test",
"against"
] | def _deploy_tenant(self, tenant_or_id):
if not isinstance(tenant_or_id, self.TenantProperties):
tenant = self.tenants[tenant_or_id]
tenant_id = tenant_or_id
else:
tenant = tenant_or_id
tenant_id = tenant.tenant_id
self._set_compute_context(tenant)
... | [
"def",
"_deploy_tenant",
"(",
"self",
",",
"tenant_or_id",
")",
":",
"if",
"not",
"isinstance",
"(",
"tenant_or_id",
",",
"self",
".",
"TenantProperties",
")",
":",
"tenant",
"=",
"self",
".",
"tenants",
"[",
"tenant_or_id",
"]",
"tenant_id",
"=",
"tenant_or... | creates:
network
subnet
router (if public not defined)
access security group
access-point server
for demo_tenant:
creates general server to test against | [
"creates",
":",
"network",
"subnet",
"router",
"(",
"if",
"public",
"not",
"defined",
")",
"access",
"security",
"group",
"access",
"-",
"point",
"server",
"for",
"demo_tenant",
":",
"creates",
"general",
"server",
"to",
"test",
"against"
] | [
"\"\"\"\n creates:\n network\n subnet\n router (if public not defined)\n access security group\n access-point server\n for demo_tenant:\n creates general server to test against\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_or_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_or_id",
"type": null,
"docstring": null,
"docstring_to... |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _get_server_ip | <not_specific> | def _get_server_ip(self, server, floating=False):
'''
returns the ip (floating/internal) of a server
'''
if floating:
return self.floating_ips[server].floating_ip_address
else:
network_name = self.tenants[server.tenant_id].network.name
return s... |
returns the ip (floating/internal) of a server
| returns the ip (floating/internal) of a server | [
"returns",
"the",
"ip",
"(",
"floating",
"/",
"internal",
")",
"of",
"a",
"server"
] | def _get_server_ip(self, server, floating=False):
if floating:
return self.floating_ips[server].floating_ip_address
else:
network_name = self.tenants[server.tenant_id].network.name
return server.networks[network_name][0] | [
"def",
"_get_server_ip",
"(",
"self",
",",
"server",
",",
"floating",
"=",
"False",
")",
":",
"if",
"floating",
":",
"return",
"self",
".",
"floating_ips",
"[",
"server",
"]",
".",
"floating_ip_address",
"else",
":",
"network_name",
"=",
"self",
".",
"tena... | returns the ip (floating/internal) of a server | [
"returns",
"the",
"ip",
"(",
"floating",
"/",
"internal",
")",
"of",
"a",
"server"
] | [
"'''\n returns the ip (floating/internal) of a server\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "server",
"type": null
},
{
"param": "floating",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server",
"type": null,
"docstring": null,
"docstring_tokens":... |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _connect_to_access_point | <not_specific> | def _connect_to_access_point(self, tenant):
"""
create ssh connection to tenant access point
"""
access_point_ssh = \
self.floating_ips[tenant.access_point].floating_ip_address
private_key = self.keypairs[tenant.tenant_id].private_key
access_point_ssh = self._... |
create ssh connection to tenant access point
| create ssh connection to tenant access point | [
"create",
"ssh",
"connection",
"to",
"tenant",
"access",
"point"
] | def _connect_to_access_point(self, tenant):
access_point_ssh = \
self.floating_ips[tenant.access_point].floating_ip_address
private_key = self.keypairs[tenant.tenant_id].private_key
access_point_ssh = self._ssh_to_server(access_point_ssh,
... | [
"def",
"_connect_to_access_point",
"(",
"self",
",",
"tenant",
")",
":",
"access_point_ssh",
"=",
"self",
".",
"floating_ips",
"[",
"tenant",
".",
"access_point",
"]",
".",
"floating_ip_address",
"private_key",
"=",
"self",
".",
"keypairs",
"[",
"tenant",
".",
... | create ssh connection to tenant access point | [
"create",
"ssh",
"connection",
"to",
"tenant",
"access",
"point"
] | [
"\"\"\"\n create ssh connection to tenant access point\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant",
"type": null,
"docstring": null,
"docstring_tokens":... |
cb64314f63f45963bebf4fe12dd743c6d4c006e9 | BeenzSyed/tempest | tempest/scenario/test_cross_tenant_connectivity.py | [
"Apache-2.0"
] | Python | _verify_mac_addr | null | def _verify_mac_addr(self, tenant):
"""
verify that VM (tenant's access point) has the same ip,mac as listed in
port list
"""
access_point_ssh = self._connect_to_access_point(tenant)
mac_addr = access_point_ssh.get_mac_address()
mac_addr = mac_addr.strip().lower()... |
verify that VM (tenant's access point) has the same ip,mac as listed in
port list
| verify that VM (tenant's access point) has the same ip,mac as listed in
port list | [
"verify",
"that",
"VM",
"(",
"tenant",
"'",
"s",
"access",
"point",
")",
"has",
"the",
"same",
"ip",
"mac",
"as",
"listed",
"in",
"port",
"list"
] | def _verify_mac_addr(self, tenant):
access_point_ssh = self._connect_to_access_point(tenant)
mac_addr = access_point_ssh.get_mac_address()
mac_addr = mac_addr.strip().lower()
port_list = self.network_client.list_ports()['ports']
port_detail_list = [
(port['fixed_ips']... | [
"def",
"_verify_mac_addr",
"(",
"self",
",",
"tenant",
")",
":",
"access_point_ssh",
"=",
"self",
".",
"_connect_to_access_point",
"(",
"tenant",
")",
"mac_addr",
"=",
"access_point_ssh",
".",
"get_mac_address",
"(",
")",
"mac_addr",
"=",
"mac_addr",
".",
"strip... | verify that VM (tenant's access point) has the same ip,mac as listed in
port list | [
"verify",
"that",
"VM",
"(",
"tenant",
"'",
"s",
"access",
"point",
")",
"has",
"the",
"same",
"ip",
"mac",
"as",
"listed",
"in",
"port",
"list"
] | [
"\"\"\"\n verify that VM (tenant's access point) has the same ip,mac as listed in\n port list\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant",
"type": null,
"docstring": null,
"docstring_tokens":... |
f157dfbfff092edd2a686f334d2d69d05aad2520 | BeenzSyed/tempest | tempest/services/compute/xml/quotas_client.py | [
"Apache-2.0"
] | Python | update_quota_set | <not_specific> | def update_quota_set(self, tenant_id, force=None,
injected_file_content_bytes=None,
metadata_items=None, ram=None, floating_ips=None,
fixed_ips=None, key_pairs=None, instances=None,
security_group_rules=None, injected_fi... |
Updates the tenant's quota limits for one or more resources
| Updates the tenant's quota limits for one or more resources | [
"Updates",
"the",
"tenant",
"'",
"s",
"quota",
"limits",
"for",
"one",
"or",
"more",
"resources"
] | def update_quota_set(self, tenant_id, force=None,
injected_file_content_bytes=None,
metadata_items=None, ram=None, floating_ips=None,
fixed_ips=None, key_pairs=None, instances=None,
security_group_rules=None, injected_fi... | [
"def",
"update_quota_set",
"(",
"self",
",",
"tenant_id",
",",
"force",
"=",
"None",
",",
"injected_file_content_bytes",
"=",
"None",
",",
"metadata_items",
"=",
"None",
",",
"ram",
"=",
"None",
",",
"floating_ips",
"=",
"None",
",",
"fixed_ips",
"=",
"None"... | Updates the tenant's quota limits for one or more resources | [
"Updates",
"the",
"tenant",
"'",
"s",
"quota",
"limits",
"for",
"one",
"or",
"more",
"resources"
] | [
"\"\"\"\n Updates the tenant's quota limits for one or more resources\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "force",
"type": null
},
{
"param": "injected_file_content_bytes",
"type": null
},
{
"param": "metadata_items",
"type": null
},
{
"param": "ram",
"type": null
}... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
ee4a3b84d5854a11da95ce94eb265b813b883a04 | BeenzSyed/tempest | tempest/services/compute/json/servers_client.py | [
"Apache-2.0"
] | Python | update_server | <not_specific> | def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
accessIPv6=None, disk_config=None):
"""
Updates the properties of an existing server.
server_id: The id of an existing server.
name: The name of the server.
personality: A list of file... |
Updates the properties of an existing server.
server_id: The id of an existing server.
name: The name of the server.
personality: A list of files to be injected into the server.
accessIPv4: The IPv4 access address for the server.
accessIPv6: The IPv6 access address for t... | Updates the properties of an existing server.
server_id: The id of an existing server.
name: The name of the server.
personality: A list of files to be injected into the server.
accessIPv4: The IPv4 access address for the server.
accessIPv6: The IPv6 access address for the server. | [
"Updates",
"the",
"properties",
"of",
"an",
"existing",
"server",
".",
"server_id",
":",
"The",
"id",
"of",
"an",
"existing",
"server",
".",
"name",
":",
"The",
"name",
"of",
"the",
"server",
".",
"personality",
":",
"A",
"list",
"of",
"files",
"to",
"... | def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
accessIPv6=None, disk_config=None):
post_body = {}
if meta is not None:
post_body['metadata'] = meta
if name is not None:
post_body['name'] = name
if accessIPv4 is not ... | [
"def",
"update_server",
"(",
"self",
",",
"server_id",
",",
"name",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"accessIPv4",
"=",
"None",
",",
"accessIPv6",
"=",
"None",
",",
"disk_config",
"=",
"None",
")",
":",
"post_body",
"=",
"{",
"}",
"if",
"m... | Updates the properties of an existing server. | [
"Updates",
"the",
"properties",
"of",
"an",
"existing",
"server",
"."
] | [
"\"\"\"\n Updates the properties of an existing server.\n server_id: The id of an existing server.\n name: The name of the server.\n personality: A list of files to be injected into the server.\n accessIPv4: The IPv4 access address for the server.\n accessIPv6: The IPv6 acc... | [
{
"param": "self",
"type": null
},
{
"param": "server_id",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "meta",
"type": null
},
{
"param": "accessIPv4",
"type": null
},
{
"param": "accessIPv6",
"type": null
},
{
"param": "d... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server_id",
"type": null,
"docstring": null,
"docstring_token... |
ee4a3b84d5854a11da95ce94eb265b813b883a04 | BeenzSyed/tempest | tempest/services/compute/json/servers_client.py | [
"Apache-2.0"
] | Python | list_network | <not_specific> | def list_network(self, network_id, region):
"""Get the status of a specific network"""
uri = "os-networksv2/%s" % network_id
resp, body = self.get(uri, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | Get the status of a specific network | Get the status of a specific network | [
"Get",
"the",
"status",
"of",
"a",
"specific",
"network"
] | def list_network(self, network_id, region):
uri = "os-networksv2/%s" % network_id
resp, body = self.get(uri, region)
if resp['status'] == '200':
body = json.loads(body)
return resp, body | [
"def",
"list_network",
"(",
"self",
",",
"network_id",
",",
"region",
")",
":",
"uri",
"=",
"\"os-networksv2/%s\"",
"%",
"network_id",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"uri",
",",
"region",
")",
"if",
"resp",
"[",
"'status'",
"]",
"==... | Get the status of a specific network | [
"Get",
"the",
"status",
"of",
"a",
"specific",
"network"
] | [
"\"\"\"Get the status of a specific network\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "network_id",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "network_id",
"type": null,
"docstring": null,
"docstring_toke... |
4c214fe8c447574f43ccb2d514a5a7f04040f7e2 | BeenzSyed/tempest | tempest/services/baremetal/v1/client_xml.py | [
"Apache-2.0"
] | Python | json_to_xml | <not_specific> | def json_to_xml(self, object_type, object_dict):
"""
Brainlessly converts a specification of an object to XML string.
:param object_type: Kind of the object.
:param object_dict: Specification of the object attributes as a dict.
:return: An XML string that corresponds to the spec... |
Brainlessly converts a specification of an object to XML string.
:param object_type: Kind of the object.
:param object_dict: Specification of the object attributes as a dict.
:return: An XML string that corresponds to the specification.
| Brainlessly converts a specification of an object to XML string. | [
"Brainlessly",
"converts",
"a",
"specification",
"of",
"an",
"object",
"to",
"XML",
"string",
"."
] | def json_to_xml(self, object_type, object_dict):
root = xml.Element(object_type)
for attr_name, value in object_dict:
if isinstance(value, dict):
value = self.json_to_xml(attr_name, value)
root.append(xml.Element(attr_name, value))
return str(xml.Document(... | [
"def",
"json_to_xml",
"(",
"self",
",",
"object_type",
",",
"object_dict",
")",
":",
"root",
"=",
"xml",
".",
"Element",
"(",
"object_type",
")",
"for",
"attr_name",
",",
"value",
"in",
"object_dict",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
"... | Brainlessly converts a specification of an object to XML string. | [
"Brainlessly",
"converts",
"a",
"specification",
"of",
"an",
"object",
"to",
"XML",
"string",
"."
] | [
"\"\"\"\n Brainlessly converts a specification of an object to XML string.\n\n :param object_type: Kind of the object.\n :param object_dict: Specification of the object attributes as a dict.\n :return: An XML string that corresponds to the specification.\n\n \"\"\"",
"# Handle n... | [
{
"param": "self",
"type": null
},
{
"param": "object_type",
"type": null
},
{
"param": "object_dict",
"type": null
}
] | {
"returns": [
{
"docstring": "An XML string that corresponds to the specification.",
"docstring_tokens": [
"An",
"XML",
"string",
"that",
"corresponds",
"to",
"the",
"specification",
"."
],
"type": null
}
],
"... |
4c214fe8c447574f43ccb2d514a5a7f04040f7e2 | BeenzSyed/tempest | tempest/services/baremetal/v1/client_xml.py | [
"Apache-2.0"
] | Python | _patch_request | null | def _patch_request(self, resource_name, uuid, patch_object):
"""Changes Content-Type header to application/json for jsonpatch."""
self.headers['Content-Type'] = 'application/json'
try:
super(self)._patch_request(self, resource_name, uuid, patch_object)
finally:
s... | Changes Content-Type header to application/json for jsonpatch. | Changes Content-Type header to application/json for jsonpatch. | [
"Changes",
"Content",
"-",
"Type",
"header",
"to",
"application",
"/",
"json",
"for",
"jsonpatch",
"."
] | def _patch_request(self, resource_name, uuid, patch_object):
self.headers['Content-Type'] = 'application/json'
try:
super(self)._patch_request(self, resource_name, uuid, patch_object)
finally:
self.headers['Content-Type'] = 'application/xml' | [
"def",
"_patch_request",
"(",
"self",
",",
"resource_name",
",",
"uuid",
",",
"patch_object",
")",
":",
"self",
".",
"headers",
"[",
"'Content-Type'",
"]",
"=",
"'application/json'",
"try",
":",
"super",
"(",
"self",
")",
".",
"_patch_request",
"(",
"self",
... | Changes Content-Type header to application/json for jsonpatch. | [
"Changes",
"Content",
"-",
"Type",
"header",
"to",
"application",
"/",
"json",
"for",
"jsonpatch",
"."
] | [
"\"\"\"Changes Content-Type header to application/json for jsonpatch.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "resource_name",
"type": null
},
{
"param": "uuid",
"type": null
},
{
"param": "patch_object",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resource_name",
"type": null,
"docstring": null,
"docstring_t... |
d7df6b2e1cd262aa5869adf97293ca57f775a2ab | BeenzSyed/tempest | tempest/api/network/base.py | [
"Apache-2.0"
] | Python | create_network | <not_specific> | def create_network(cls, network_name=None):
"""Wrapper utility that returns a test network."""
network_name = network_name or data_utils.rand_name('test-network-')
resp, body = cls.client.create_network(network_name)
network = body['network']
cls.networks.append(network)
... | Wrapper utility that returns a test network. | Wrapper utility that returns a test network. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"network",
"."
] | def create_network(cls, network_name=None):
network_name = network_name or data_utils.rand_name('test-network-')
resp, body = cls.client.create_network(network_name)
network = body['network']
cls.networks.append(network)
return network | [
"def",
"create_network",
"(",
"cls",
",",
"network_name",
"=",
"None",
")",
":",
"network_name",
"=",
"network_name",
"or",
"data_utils",
".",
"rand_name",
"(",
"'test-network-'",
")",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"create_network",
"(... | Wrapper utility that returns a test network. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"network",
"."
] | [
"\"\"\"Wrapper utility that returns a test network.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "network_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "network_name",
"type": null,
"docstring": null,
"docstring_tok... |
d7df6b2e1cd262aa5869adf97293ca57f775a2ab | BeenzSyed/tempest | tempest/api/network/base.py | [
"Apache-2.0"
] | Python | create_floating_ip | <not_specific> | def create_floating_ip(cls, external_network_id, **kwargs):
"""Wrapper utility that returns a test floating IP."""
resp, body = cls.client.create_floating_ip(
external_network_id,
**kwargs)
fip = body['floatingip']
cls.floating_ips.append(fip)
return fip | Wrapper utility that returns a test floating IP. | Wrapper utility that returns a test floating IP. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"floating",
"IP",
"."
] | def create_floating_ip(cls, external_network_id, **kwargs):
resp, body = cls.client.create_floating_ip(
external_network_id,
**kwargs)
fip = body['floatingip']
cls.floating_ips.append(fip)
return fip | [
"def",
"create_floating_ip",
"(",
"cls",
",",
"external_network_id",
",",
"**",
"kwargs",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"create_floating_ip",
"(",
"external_network_id",
",",
"**",
"kwargs",
")",
"fip",
"=",
"body",
"[",
"'... | Wrapper utility that returns a test floating IP. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"floating",
"IP",
"."
] | [
"\"\"\"Wrapper utility that returns a test floating IP.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "external_network_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "external_network_id",
"type": null,
"docstring": null,
"docstr... |
d7df6b2e1cd262aa5869adf97293ca57f775a2ab | BeenzSyed/tempest | tempest/api/network/base.py | [
"Apache-2.0"
] | Python | create_vpnservice | <not_specific> | def create_vpnservice(cls, subnet_id, router_id):
"""Wrapper utility that returns a test vpn service."""
resp, body = cls.client.create_vpnservice(
subnet_id, router_id, admin_state_up=True,
name=data_utils.rand_name("vpnservice-"))
vpnservice = body['vpnservice']
... | Wrapper utility that returns a test vpn service. | Wrapper utility that returns a test vpn service. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"vpn",
"service",
"."
] | def create_vpnservice(cls, subnet_id, router_id):
resp, body = cls.client.create_vpnservice(
subnet_id, router_id, admin_state_up=True,
name=data_utils.rand_name("vpnservice-"))
vpnservice = body['vpnservice']
cls.vpnservices.append(vpnservice)
return vpnservice | [
"def",
"create_vpnservice",
"(",
"cls",
",",
"subnet_id",
",",
"router_id",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"create_vpnservice",
"(",
"subnet_id",
",",
"router_id",
",",
"admin_state_up",
"=",
"True",
",",
"name",
"=",
"data_... | Wrapper utility that returns a test vpn service. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"vpn",
"service",
"."
] | [
"\"\"\"Wrapper utility that returns a test vpn service.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "subnet_id",
"type": null
},
{
"param": "router_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subnet_id",
"type": null,
"docstring": null,
"docstring_tokens... |
d7df6b2e1cd262aa5869adf97293ca57f775a2ab | BeenzSyed/tempest | tempest/api/network/base.py | [
"Apache-2.0"
] | Python | create_ikepolicy | <not_specific> | def create_ikepolicy(cls, name):
"""Wrapper utility that returns a test ike policy."""
resp, body = cls.client.create_ikepolicy(name)
ikepolicy = body['ikepolicy']
cls.ikepolicies.append(ikepolicy)
return ikepolicy | Wrapper utility that returns a test ike policy. | Wrapper utility that returns a test ike policy. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"ike",
"policy",
"."
] | def create_ikepolicy(cls, name):
resp, body = cls.client.create_ikepolicy(name)
ikepolicy = body['ikepolicy']
cls.ikepolicies.append(ikepolicy)
return ikepolicy | [
"def",
"create_ikepolicy",
"(",
"cls",
",",
"name",
")",
":",
"resp",
",",
"body",
"=",
"cls",
".",
"client",
".",
"create_ikepolicy",
"(",
"name",
")",
"ikepolicy",
"=",
"body",
"[",
"'ikepolicy'",
"]",
"cls",
".",
"ikepolicies",
".",
"append",
"(",
"... | Wrapper utility that returns a test ike policy. | [
"Wrapper",
"utility",
"that",
"returns",
"a",
"test",
"ike",
"policy",
"."
] | [
"\"\"\"Wrapper utility that returns a test ike policy.\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": []... |
61d13117e640456693eb280a85a368830023dac0 | BeenzSyed/tempest | tempest/test.py | [
"Apache-2.0"
] | Python | skip_because | <not_specific> | def skip_because(*args, **kwargs):
"""A decorator useful to skip tests hitting known bugs
@param bug: bug number causing the test to skip
@param condition: optional condition to be True for the skip to have place
@param interface: skip the test if it is the same as self._interface
"""
def decor... | A decorator useful to skip tests hitting known bugs
@param bug: bug number causing the test to skip
@param condition: optional condition to be True for the skip to have place
@param interface: skip the test if it is the same as self._interface
| A decorator useful to skip tests hitting known bugs | [
"A",
"decorator",
"useful",
"to",
"skip",
"tests",
"hitting",
"known",
"bugs"
] | def skip_because(*args, **kwargs):
def decorator(f):
@functools.wraps(f)
def wrapper(self, *func_args, **func_kwargs):
skip = False
if "condition" in kwargs:
if kwargs["condition"] is True:
skip = True
elif "interface" in kwargs... | [
"def",
"skip_because",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"func_args",
",",
"**",
"func_kwargs",
")",
":",... | A decorator useful to skip tests hitting known bugs | [
"A",
"decorator",
"useful",
"to",
"skip",
"tests",
"hitting",
"known",
"bugs"
] | [
"\"\"\"A decorator useful to skip tests hitting known bugs\n\n @param bug: bug number causing the test to skip\n @param condition: optional condition to be True for the skip to have place\n @param interface: skip the test if it is the same as self._interface\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [
{
"identifier": "bug",
"type": null,
"docstring": "bug number causing the test to skip",
"docstring_tokens": [
"bug",
"number",
"causing",
"the",
"test",
"to",
"sk... |
61d13117e640456693eb280a85a368830023dac0 | BeenzSyed/tempest | tempest/test.py | [
"Apache-2.0"
] | Python | is_extension_enabled | <not_specific> | def is_extension_enabled(extension_name, service):
"""A function that will check the list of enabled extensions from config
"""
configs = CONF
config_dict = {
'compute': configs.compute_feature_enabled.api_extensions,
'compute_v3': configs.compute_feature_enabled.api_v3_extensions,
... | A function that will check the list of enabled extensions from config
| A function that will check the list of enabled extensions from config | [
"A",
"function",
"that",
"will",
"check",
"the",
"list",
"of",
"enabled",
"extensions",
"from",
"config"
] | def is_extension_enabled(extension_name, service):
configs = CONF
config_dict = {
'compute': configs.compute_feature_enabled.api_extensions,
'compute_v3': configs.compute_feature_enabled.api_v3_extensions,
'volume': configs.volume_feature_enabled.api_extensions,
'network': config... | [
"def",
"is_extension_enabled",
"(",
"extension_name",
",",
"service",
")",
":",
"configs",
"=",
"CONF",
"config_dict",
"=",
"{",
"'compute'",
":",
"configs",
".",
"compute_feature_enabled",
".",
"api_extensions",
",",
"'compute_v3'",
":",
"configs",
".",
"compute_... | A function that will check the list of enabled extensions from config | [
"A",
"function",
"that",
"will",
"check",
"the",
"list",
"of",
"enabled",
"extensions",
"from",
"config"
] | [
"\"\"\"A function that will check the list of enabled extensions from config\n\n \"\"\""
] | [
{
"param": "extension_name",
"type": null
},
{
"param": "service",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "extension_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "service",
"type": null,
"docstring": null,
"docstri... |
1304a03b60ab3bf84f8b630b211aed36f8d14f3d | BeenzSyed/tempest | tempest/services/object_storage/object_client.py | [
"Apache-2.0"
] | Python | request | <not_specific> | def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
dscv = self.config.identity.disable_ssl_certificate_validation
self.http_obj = http.ClosingHttp(
disable_ssl_certificate_validation=dscv)
if headers is None:
headers = ... | A simple HTTP request interface. | A simple HTTP request interface. | [
"A",
"simple",
"HTTP",
"request",
"interface",
"."
] | def request(self, method, url, headers=None, body=None):
dscv = self.config.identity.disable_ssl_certificate_validation
self.http_obj = http.ClosingHttp(
disable_ssl_certificate_validation=dscv)
if headers is None:
headers = {}
if self.base_url is None:
... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
")",
":",
"dscv",
"=",
"self",
".",
"config",
".",
"identity",
".",
"disable_ssl_certificate_validation",
"self",
".",
"http_obj",
"=",
"http... | A simple HTTP request interface. | [
"A",
"simple",
"HTTP",
"request",
"interface",
"."
] | [
"\"\"\"A simple HTTP request interface.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "headers",
"type": null
},
{
"param": "body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens":... |
fc09741501e4e57bed08ab7ed0a1940e2c11c41a | BeenzSyed/tempest | tempest/api/compute/images/test_images.py | [
"Apache-2.0"
] | Python | tearDown | null | def tearDown(self):
"""Terminate test instances created after a test is executed."""
for image_id in self.image_ids:
self.client.delete_image(image_id)
self.image_ids.remove(image_id)
super(ImagesTestJSON, self).tearDown() | Terminate test instances created after a test is executed. | Terminate test instances created after a test is executed. | [
"Terminate",
"test",
"instances",
"created",
"after",
"a",
"test",
"is",
"executed",
"."
] | def tearDown(self):
for image_id in self.image_ids:
self.client.delete_image(image_id)
self.image_ids.remove(image_id)
super(ImagesTestJSON, self).tearDown() | [
"def",
"tearDown",
"(",
"self",
")",
":",
"for",
"image_id",
"in",
"self",
".",
"image_ids",
":",
"self",
".",
"client",
".",
"delete_image",
"(",
"image_id",
")",
"self",
".",
"image_ids",
".",
"remove",
"(",
"image_id",
")",
"super",
"(",
"ImagesTestJS... | Terminate test instances created after a test is executed. | [
"Terminate",
"test",
"instances",
"created",
"after",
"a",
"test",
"is",
"executed",
"."
] | [
"\"\"\"Terminate test instances created after a test is executed.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4344db1901aa3a2e4c5d217e660328c7d0689981 | BeenzSyed/tempest | tempest/services/identity/v3/xml/credentials_client.py | [
"Apache-2.0"
] | Python | request | <not_specific> | def request(self, method, url, headers=None, body=None, wait=None):
"""Overriding the existing HTTP request in super class rest_client."""
self._set_auth()
self.base_url = self.base_url.replace(urlparse(self.base_url).path,
"/v3")
return supe... | Overriding the existing HTTP request in super class rest_client. | Overriding the existing HTTP request in super class rest_client. | [
"Overriding",
"the",
"existing",
"HTTP",
"request",
"in",
"super",
"class",
"rest_client",
"."
] | def request(self, method, url, headers=None, body=None, wait=None):
self._set_auth()
self.base_url = self.base_url.replace(urlparse(self.base_url).path,
"/v3")
return super(CredentialsClientXML, self).request(method, url,
... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
",",
"wait",
"=",
"None",
")",
":",
"self",
".",
"_set_auth",
"(",
")",
"self",
".",
"base_url",
"=",
"self",
".",
"base_url",
".",
"... | Overriding the existing HTTP request in super class rest_client. | [
"Overriding",
"the",
"existing",
"HTTP",
"request",
"in",
"super",
"class",
"rest_client",
"."
] | [
"\"\"\"Overriding the existing HTTP request in super class rest_client.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "headers",
"type": null
},
{
"param": "body",
"type": null
},
{
"param": "wait",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens":... |
4344db1901aa3a2e4c5d217e660328c7d0689981 | BeenzSyed/tempest | tempest/services/identity/v3/xml/credentials_client.py | [
"Apache-2.0"
] | Python | list_credentials | <not_specific> | def list_credentials(self):
"""Lists out all the available credentials."""
resp, body = self.get('credentials', self.headers)
body = self._parse_creds(etree.fromstring(body))
return resp, body | Lists out all the available credentials. | Lists out all the available credentials. | [
"Lists",
"out",
"all",
"the",
"available",
"credentials",
"."
] | def list_credentials(self):
resp, body = self.get('credentials', self.headers)
body = self._parse_creds(etree.fromstring(body))
return resp, body | [
"def",
"list_credentials",
"(",
"self",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"'credentials'",
",",
"self",
".",
"headers",
")",
"body",
"=",
"self",
".",
"_parse_creds",
"(",
"etree",
".",
"fromstring",
"(",
"body",
")",
")",
... | Lists out all the available credentials. | [
"Lists",
"out",
"all",
"the",
"available",
"credentials",
"."
] | [
"\"\"\"Lists out all the available credentials.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6ec9b829b9753230c4e90e059920c769669ca8e | BeenzSyed/tempest | tempest/services/compute/json/quotas_client.py | [
"Apache-2.0"
] | Python | update_quota_set | <not_specific> | def update_quota_set(self, tenant_id, force=None,
injected_file_content_bytes=None,
metadata_items=None, ram=None, floating_ips=None,
fixed_ips=None, key_pairs=None, instances=None,
security_group_rules=None, injected_fi... |
Updates the tenant's quota limits for one or more resources
| Updates the tenant's quota limits for one or more resources | [
"Updates",
"the",
"tenant",
"'",
"s",
"quota",
"limits",
"for",
"one",
"or",
"more",
"resources"
] | def update_quota_set(self, tenant_id, force=None,
injected_file_content_bytes=None,
metadata_items=None, ram=None, floating_ips=None,
fixed_ips=None, key_pairs=None, instances=None,
security_group_rules=None, injected_fi... | [
"def",
"update_quota_set",
"(",
"self",
",",
"tenant_id",
",",
"force",
"=",
"None",
",",
"injected_file_content_bytes",
"=",
"None",
",",
"metadata_items",
"=",
"None",
",",
"ram",
"=",
"None",
",",
"floating_ips",
"=",
"None",
",",
"fixed_ips",
"=",
"None"... | Updates the tenant's quota limits for one or more resources | [
"Updates",
"the",
"tenant",
"'",
"s",
"quota",
"limits",
"for",
"one",
"or",
"more",
"resources"
] | [
"\"\"\"\n Updates the tenant's quota limits for one or more resources\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tenant_id",
"type": null
},
{
"param": "force",
"type": null
},
{
"param": "injected_file_content_bytes",
"type": null
},
{
"param": "metadata_items",
"type": null
},
{
"param": "ram",
"type": null
}... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tenant_id",
"type": null,
"docstring": null,
"docstring_token... |
c89fbccdc7ffaef3eead27af8a50fd6e846cd0f6 | BeenzSyed/tempest | tempest/services/identity/v3/json/identity_client.py | [
"Apache-2.0"
] | Python | check_trust_role | <not_specific> | def check_trust_role(self, trust_id, role_id):
"""HEAD Check if role is delegated by a trust."""
resp, body = self.head("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
return resp, body | HEAD Check if role is delegated by a trust. | HEAD Check if role is delegated by a trust. | [
"HEAD",
"Check",
"if",
"role",
"is",
"delegated",
"by",
"a",
"trust",
"."
] | def check_trust_role(self, trust_id, role_id):
resp, body = self.head("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
return resp, body | [
"def",
"check_trust_role",
"(",
"self",
",",
"trust_id",
",",
"role_id",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"head",
"(",
"\"OS-TRUST/trusts/%s/roles/%s\"",
"%",
"(",
"trust_id",
",",
"role_id",
")",
")",
"return",
"resp",
",",
"body"
] | HEAD Check if role is delegated by a trust. | [
"HEAD",
"Check",
"if",
"role",
"is",
"delegated",
"by",
"a",
"trust",
"."
] | [
"\"\"\"HEAD Check if role is delegated by a trust.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "trust_id",
"type": null
},
{
"param": "role_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "trust_id",
"type": null,
"docstring": null,
"docstring_tokens... |
aa6abd02d1ce6f6517331e40d9abe3b44cf3c846 | BeenzSyed/tempest | tempest/services/image/v1/json/image_client.py | [
"Apache-2.0"
] | Python | wait_for_image_status | <not_specific> | def wait_for_image_status(self, image_id, status):
"""Waits for a Image to reach a given status."""
start_time = time.time()
old_value = value = self._get_image_status(image_id)
while True:
dtime = time.time() - start_time
time.sleep(self.build_interval)
... | Waits for a Image to reach a given status. | Waits for a Image to reach a given status. | [
"Waits",
"for",
"a",
"Image",
"to",
"reach",
"a",
"given",
"status",
"."
] | def wait_for_image_status(self, image_id, status):
start_time = time.time()
old_value = value = self._get_image_status(image_id)
while True:
dtime = time.time() - start_time
time.sleep(self.build_interval)
if value != old_value:
LOG.info('Value... | [
"def",
"wait_for_image_status",
"(",
"self",
",",
"image_id",
",",
"status",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"old_value",
"=",
"value",
"=",
"self",
".",
"_get_image_status",
"(",
"image_id",
")",
"while",
"True",
":",
"dtime",
... | Waits for a Image to reach a given status. | [
"Waits",
"for",
"a",
"Image",
"to",
"reach",
"a",
"given",
"status",
"."
] | [
"\"\"\"Waits for a Image to reach a given status.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "image_id",
"type": null
},
{
"param": "status",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image_id",
"type": null,
"docstring": null,
"docstring_tokens... |
cd4ac3438b6dae6bd325010c0a1063011a2f3656 | volodymyrss/doi2cff | doi2cff/cli.py | [
"Apache-2.0"
] | Python | init | null | def init(doi, cff_fn):
"""Generate CITATION.cff file based on a Zenodo DOI of a Github release.
* DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release
"""
template = '''# YAML 1.2
# Metadata for citation of this software according to the CFF format (https://citation-file... | Generate CITATION.cff file based on a Zenodo DOI of a Github release.
* DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release
| Generate CITATION.cff file based on a Zenodo DOI of a Github release.
DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release | [
"Generate",
"CITATION",
".",
"cff",
"file",
"based",
"on",
"a",
"Zenodo",
"DOI",
"of",
"a",
"Github",
"release",
".",
"DOI",
"The",
"Digital",
"Object",
"Identifier",
"(",
"DOI",
")",
"name",
"of",
"a",
"Zenodo",
"upload",
"of",
"a",
"GitHub",
"release"
... | def init(doi, cff_fn):
template = '''# YAML 1.2
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.0.3
message: If you use this software, please cite it using these metadata.
# FIXME title as repository name might not be the best name, pleas... | [
"def",
"init",
"(",
"doi",
",",
"cff_fn",
")",
":",
"template",
"=",
"'''# YAML 1.2\n# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)\ncff-version: 1.0.3\nmessage: If you use this software, please cite it using these metadata.\n# FIXM... | Generate CITATION.cff file based on a Zenodo DOI of a Github release. | [
"Generate",
"CITATION",
".",
"cff",
"file",
"based",
"on",
"a",
"Zenodo",
"DOI",
"of",
"a",
"Github",
"release",
"."
] | [
"\"\"\"Generate CITATION.cff file based on a Zenodo DOI of a Github release.\n\n * DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release\n \"\"\""
] | [
{
"param": "doi",
"type": null
},
{
"param": "cff_fn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doi",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cff_fn",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cd4ac3438b6dae6bd325010c0a1063011a2f3656 | volodymyrss/doi2cff | doi2cff/cli.py | [
"Apache-2.0"
] | Python | update | null | def update(doi, cff_fn):
"""Update CITATION.cff with doi, version and release date of a new release
* DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release
"""
update_version(doi, cff_fn) | Update CITATION.cff with doi, version and release date of a new release
* DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release
| Update CITATION.cff with doi, version and release date of a new release
DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release | [
"Update",
"CITATION",
".",
"cff",
"with",
"doi",
"version",
"and",
"release",
"date",
"of",
"a",
"new",
"release",
"DOI",
"The",
"Digital",
"Object",
"Identifier",
"(",
"DOI",
")",
"name",
"of",
"a",
"Zenodo",
"upload",
"of",
"a",
"GitHub",
"release"
] | def update(doi, cff_fn):
update_version(doi, cff_fn) | [
"def",
"update",
"(",
"doi",
",",
"cff_fn",
")",
":",
"update_version",
"(",
"doi",
",",
"cff_fn",
")"
] | Update CITATION.cff with doi, version and release date of a new release
DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release | [
"Update",
"CITATION",
".",
"cff",
"with",
"doi",
"version",
"and",
"release",
"date",
"of",
"a",
"new",
"release",
"DOI",
"The",
"Digital",
"Object",
"Identifier",
"(",
"DOI",
")",
"name",
"of",
"a",
"Zenodo",
"upload",
"of",
"a",
"GitHub",
"release"
] | [
"\"\"\"Update CITATION.cff with doi, version and release date of a new release\n\n * DOI, The Digital Object Identifier (DOI) name of a Zenodo upload of a GitHub release\n \"\"\""
] | [
{
"param": "doi",
"type": null
},
{
"param": "cff_fn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doi",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cff_fn",
"type": null,
"docstring": null,
"docstring_tokens": ... |
917d785ed4a76d296928834acd7681fb05085876 | ryanpersaud/pyja3mas | ja3.py | [
"BSD-3-Clause"
] | Python | parse_variable_array | <not_specific> | def parse_variable_array(buf, byte_len):
"""Unpack data from buffer of specific length.
:param buf: Buffer to operate on
:type buf: bytes
:param byte_len: Length to process
:type byte_len: int
:returns: bytes, int
"""
_SIZE_FORMATS = ['!B', '!H', '!I', '!I']
assert byte_len <= 4
... | Unpack data from buffer of specific length.
:param buf: Buffer to operate on
:type buf: bytes
:param byte_len: Length to process
:type byte_len: int
:returns: bytes, int
| Unpack data from buffer of specific length. | [
"Unpack",
"data",
"from",
"buffer",
"of",
"specific",
"length",
"."
] | def parse_variable_array(buf, byte_len):
_SIZE_FORMATS = ['!B', '!H', '!I', '!I']
assert byte_len <= 4
size_format = _SIZE_FORMATS[byte_len - 1]
padding = b'\x00' if byte_len == 3 else b''
size = struct.unpack(size_format, padding + buf[:byte_len])[0]
data = buf[byte_len:byte_len + size]
ret... | [
"def",
"parse_variable_array",
"(",
"buf",
",",
"byte_len",
")",
":",
"_SIZE_FORMATS",
"=",
"[",
"'!B'",
",",
"'!H'",
",",
"'!I'",
",",
"'!I'",
"]",
"assert",
"byte_len",
"<=",
"4",
"size_format",
"=",
"_SIZE_FORMATS",
"[",
"byte_len",
"-",
"1",
"]",
"pa... | Unpack data from buffer of specific length. | [
"Unpack",
"data",
"from",
"buffer",
"of",
"specific",
"length",
"."
] | [
"\"\"\"Unpack data from buffer of specific length.\n\n :param buf: Buffer to operate on\n :type buf: bytes\n :param byte_len: Length to process\n :type byte_len: int\n :returns: bytes, int\n \"\"\""
] | [
{
"param": "buf",
"type": null
},
{
"param": "byte_len",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "buf",
"type": null,
"docstring": "Buffer to operate on",
"docstring_tokens": [
"Buffer",
"to",
... |
917d785ed4a76d296928834acd7681fb05085876 | ryanpersaud/pyja3mas | ja3.py | [
"BSD-3-Clause"
] | Python | convert_to_ja3_segment | <not_specific> | def convert_to_ja3_segment(data, element_width):
"""Convert a packed array of elements to a JA3 segment.
:param data: Current PCAP buffer item
:type: str
:param element_width: Byte count to process at a time
:type element_width: int
:returns: str
"""
int_vals = list()
data = bytearr... | Convert a packed array of elements to a JA3 segment.
:param data: Current PCAP buffer item
:type: str
:param element_width: Byte count to process at a time
:type element_width: int
:returns: str
| Convert a packed array of elements to a JA3 segment. | [
"Convert",
"a",
"packed",
"array",
"of",
"elements",
"to",
"a",
"JA3",
"segment",
"."
] | def convert_to_ja3_segment(data, element_width):
int_vals = list()
data = bytearray(data)
if len(data) % element_width:
message = '{count} is not a multiple of {width}'
message = message.format(count=len(data), width=element_width)
raise ValueError(message)
for i in range(0, len(... | [
"def",
"convert_to_ja3_segment",
"(",
"data",
",",
"element_width",
")",
":",
"int_vals",
"=",
"list",
"(",
")",
"data",
"=",
"bytearray",
"(",
"data",
")",
"if",
"len",
"(",
"data",
")",
"%",
"element_width",
":",
"message",
"=",
"'{count} is not a multiple... | Convert a packed array of elements to a JA3 segment. | [
"Convert",
"a",
"packed",
"array",
"of",
"elements",
"to",
"a",
"JA3",
"segment",
"."
] | [
"\"\"\"Convert a packed array of elements to a JA3 segment.\n\n :param data: Current PCAP buffer item\n :type: str\n :param element_width: Byte count to process at a time\n :type element_width: int\n :returns: str\n \"\"\""
] | [
{
"param": "data",
"type": null
},
{
"param": "element_width",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "element_width",
"type": null,
"docstring": null,
"docstring_t... |
917d785ed4a76d296928834acd7681fb05085876 | ryanpersaud/pyja3mas | ja3.py | [
"BSD-3-Clause"
] | Python | process_extensions | <not_specific> | def process_extensions(client_handshake):
"""Process any extra extensions and convert to a JA3 segment.
:param client_handshake: Handshake data from the packet
:type client_handshake: dpkt.ssl.TLSClientHello
:returns: list
"""
if not hasattr(client_handshake, "extensions"):
# Needed to ... | Process any extra extensions and convert to a JA3 segment.
:param client_handshake: Handshake data from the packet
:type client_handshake: dpkt.ssl.TLSClientHello
:returns: list
| Process any extra extensions and convert to a JA3 segment. | [
"Process",
"any",
"extra",
"extensions",
"and",
"convert",
"to",
"a",
"JA3",
"segment",
"."
] | def process_extensions(client_handshake):
if not hasattr(client_handshake, "extensions"):
return ["", "", ""]
exts = list()
elliptic_curve = ""
elliptic_curve_point_format = ""
for ext_val, ext_data in client_handshake.extensions:
if not GREASE_TABLE.get(ext_val):
exts.ap... | [
"def",
"process_extensions",
"(",
"client_handshake",
")",
":",
"if",
"not",
"hasattr",
"(",
"client_handshake",
",",
"\"extensions\"",
")",
":",
"return",
"[",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"]",
"exts",
"=",
"list",
"(",
")",
"elliptic_curve",
"=",
"\... | Process any extra extensions and convert to a JA3 segment. | [
"Process",
"any",
"extra",
"extensions",
"and",
"convert",
"to",
"a",
"JA3",
"segment",
"."
] | [
"\"\"\"Process any extra extensions and convert to a JA3 segment.\n\n :param client_handshake: Handshake data from the packet\n :type client_handshake: dpkt.ssl.TLSClientHello\n :returns: list\n \"\"\"",
"# Needed to preserve commas on the join",
"# Elliptic curve points (16 bit values)",
"# Ellip... | [
{
"param": "client_handshake",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "client_handshake",
"type": null,
"docstring": "Handshake data from the packet",
"docstring_tokens": [
"Hand... |
917d785ed4a76d296928834acd7681fb05085876 | ryanpersaud/pyja3mas | ja3.py | [
"BSD-3-Clause"
] | Python | process_ssl | <not_specific> | def process_ssl(pkt, any_port=False):
"""Process packets within the PCAP.
:param pcap: Opened PCAP file to be processed
:type pcap: dpkt.pcap.Reader
:param any_port: Whether or not to search for non-SSL ports
:type any_port: bool
"""
tls_handshake = pkt
if tls_handshake[0] != TLS_HANDS... | Process packets within the PCAP.
:param pcap: Opened PCAP file to be processed
:type pcap: dpkt.pcap.Reader
:param any_port: Whether or not to search for non-SSL ports
:type any_port: bool
| Process packets within the PCAP. | [
"Process",
"packets",
"within",
"the",
"PCAP",
"."
] | def process_ssl(pkt, any_port=False):
tls_handshake = pkt
if tls_handshake[0] != TLS_HANDSHAKE:
return
records = list()
try:
records, bytes_used = dpkt.ssl.tls_multi_factory(tls_handshake)
except dpkt.ssl.SSL3Exception:
return
except dpkt.dpkt.NeedData:
return
... | [
"def",
"process_ssl",
"(",
"pkt",
",",
"any_port",
"=",
"False",
")",
":",
"tls_handshake",
"=",
"pkt",
"if",
"tls_handshake",
"[",
"0",
"]",
"!=",
"TLS_HANDSHAKE",
":",
"return",
"records",
"=",
"list",
"(",
")",
"try",
":",
"records",
",",
"bytes_used"... | Process packets within the PCAP. | [
"Process",
"packets",
"within",
"the",
"PCAP",
"."
] | [
"\"\"\"Process packets within the PCAP.\n\n :param pcap: Opened PCAP file to be processed\n :type pcap: dpkt.pcap.Reader\n :param any_port: Whether or not to search for non-SSL ports\n :type any_port: bool\n \"\"\"",
"# records, bytes_used = dpkt.ssl.tls_multi_factory(tcp.data)",
"# We only want ... | [
{
"param": "pkt",
"type": null
},
{
"param": "any_port",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pkt",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "any_port",
"type": null,
"docstring": "Whether or not to search for ... |
917d785ed4a76d296928834acd7681fb05085876 | ryanpersaud/pyja3mas | ja3.py | [
"BSD-3-Clause"
] | Python | main | null | def main():
"""Intake arguments from the user and print out JA3 output."""
desc = "A python script for extracting JA3 fingerprints from PCAP files"
parser = argparse.ArgumentParser(description=(desc))
parser.add_argument("pcap", help="The pcap file to process")
help_text = "Look for client hellos on... | Intake arguments from the user and print out JA3 output. | Intake arguments from the user and print out JA3 output. | [
"Intake",
"arguments",
"from",
"the",
"user",
"and",
"print",
"out",
"JA3",
"output",
"."
] | def main():
desc = "A python script for extracting JA3 fingerprints from PCAP files"
parser = argparse.ArgumentParser(description=(desc))
parser.add_argument("pcap", help="The pcap file to process")
help_text = "Look for client hellos on any port instead of just 443"
parser.add_argument("-a", "--any... | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"\"A python script for extracting JA3 fingerprints from PCAP files\"",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"desc",
")",
")",
"parser",
".",
"add_argument",
"(",
"\"pcap\"",
",",
... | Intake arguments from the user and print out JA3 output. | [
"Intake",
"arguments",
"from",
"the",
"user",
"and",
"print",
"out",
"JA3",
"output",
"."
] | [
"\"\"\"Intake arguments from the user and print out JA3 output.\"\"\"",
"# Use an iterator to process each line of the file"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | check_for_headless_browsers | <not_specific> | def check_for_headless_browsers(request):
"""Given a UA string, determines if the request came from a headless
browser.
Args:
request (:obj: `str`) UA string or full HTTP request to parse for
headless browsers
Returns:
(:obj: `re`) regex object that is parseable if a match ... | Given a UA string, determines if the request came from a headless
browser.
Args:
request (:obj: `str`) UA string or full HTTP request to parse for
headless browsers
Returns:
(:obj: `re`) regex object that is parseable if a match for a headless
browser is found, None... | Given a UA string, determines if the request came from a headless
browser. | [
"Given",
"a",
"UA",
"string",
"determines",
"if",
"the",
"request",
"came",
"from",
"a",
"headless",
"browser",
"."
] | def check_for_headless_browsers(request):
match_obj = re.search(CURL_RE, request)
if match_obj is None:
match_obj = re.search(WGET_RE, request)
if match_obj is None:
match_obj = re.search(REQUESTS_RE, request)
if match_obj is None:
match_obj = re.search(POWERSHELL_RE, request)
... | [
"def",
"check_for_headless_browsers",
"(",
"request",
")",
":",
"match_obj",
"=",
"re",
".",
"search",
"(",
"CURL_RE",
",",
"request",
")",
"if",
"match_obj",
"is",
"None",
":",
"match_obj",
"=",
"re",
".",
"search",
"(",
"WGET_RE",
",",
"request",
")",
... | Given a UA string, determines if the request came from a headless
browser. | [
"Given",
"a",
"UA",
"string",
"determines",
"if",
"the",
"request",
"came",
"from",
"a",
"headless",
"browser",
"."
] | [
"\"\"\"Given a UA string, determines if the request came from a headless\n browser.\n\n Args:\n request (:obj: `str`) UA string or full HTTP request to parse for\n headless browsers\n\n Returns:\n (:obj: `re`) regex object that is parseable if a match for a headless\n br... | [
{
"param": "request",
"type": null
}
] | {
"returns": [
{
"docstring": "`re`) regex object that is parseable if a match for a headless\nbrowser is found, None otherwise",
"docstring_tokens": [
"`",
"re",
"`",
")",
"regex",
"object",
"that",
"is",
"parseable",
"if... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | extract_ua_str | <not_specific> | def extract_ua_str(request):
"""Attempts to extract a User-Agent string from an HTTP GET request.
If the GET request contains a User-Agent string, it will extract just the
UA string.
Args:
request (:obj: `str`) full HTTP GET Request
Returns:
(:obj: `bytes`) the UA string, or 'Unkn... | Attempts to extract a User-Agent string from an HTTP GET request.
If the GET request contains a User-Agent string, it will extract just the
UA string.
Args:
request (:obj: `str`) full HTTP GET Request
Returns:
(:obj: `bytes`) the UA string, or 'Unknown' if it is not found
| Attempts to extract a User-Agent string from an HTTP GET request.
If the GET request contains a User-Agent string, it will extract just the
UA string. | [
"Attempts",
"to",
"extract",
"a",
"User",
"-",
"Agent",
"string",
"from",
"an",
"HTTP",
"GET",
"request",
".",
"If",
"the",
"GET",
"request",
"contains",
"a",
"User",
"-",
"Agent",
"string",
"it",
"will",
"extract",
"just",
"the",
"UA",
"string",
"."
] | def extract_ua_str(request):
_LOGGER.debug("Attempting to Extract User-Agent String")
ua_idx = request.lower().find(b"user-agent")
if ua_idx >= 0:
new_substr = request[ua_idx + len("User-Agent: "):]
end_ua_idx = new_substr.find(b"\r\n")
return new_substr[:end_ua_idx]
return b"Unk... | [
"def",
"extract_ua_str",
"(",
"request",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Attempting to Extract User-Agent String\"",
")",
"ua_idx",
"=",
"request",
".",
"lower",
"(",
")",
".",
"find",
"(",
"b\"user-agent\"",
")",
"if",
"ua_idx",
">=",
"0",
":",
"... | Attempts to extract a User-Agent string from an HTTP GET request. | [
"Attempts",
"to",
"extract",
"a",
"User",
"-",
"Agent",
"string",
"from",
"an",
"HTTP",
"GET",
"request",
"."
] | [
"\"\"\"Attempts to extract a User-Agent string from an HTTP GET request.\n\n If the GET request contains a User-Agent string, it will extract just the\n UA string.\n\n Args:\n request (:obj: `str`) full HTTP GET Request\n\n Returns:\n (:obj: `bytes`) the UA string, or 'Unknown' if it is no... | [
{
"param": "request",
"type": null
}
] | {
"returns": [
{
"docstring": "`bytes`) the UA string, or 'Unknown' if it is not found",
"docstring_tokens": [
"`",
"bytes",
"`",
")",
"the",
"UA",
"string",
"or",
"'",
"Unknown",
"'",
"if",
"it",
... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | init_logger | null | def init_logger(debug_on):
"""Initializes the private module variable logger
Adds the file formatter and logging file to the default logging
configuration.
Args:
debug_on (bool): boolean determining if debug mode is set via the
command line
Returns:
void
"""
g... | Initializes the private module variable logger
Adds the file formatter and logging file to the default logging
configuration.
Args:
debug_on (bool): boolean determining if debug mode is set via the
command line
Returns:
void
| Initializes the private module variable logger
Adds the file formatter and logging file to the default logging
configuration. | [
"Initializes",
"the",
"private",
"module",
"variable",
"logger",
"Adds",
"the",
"file",
"formatter",
"and",
"logging",
"file",
"to",
"the",
"default",
"logging",
"configuration",
"."
] | def init_logger(debug_on):
global _LOGGER
log_conf.LOGGING_CONFIG["handlers"]["consoleHandler"]["formatter"] = "fileFormatter"
log_conf.LOGGING_CONFIG["handlers"]["fileHandler"]["filename"] = "%s/%s" % (LOG_DIR, LOG_FNAME)
log_conf.LOGGING_CONFIG["handlers"]["fileHandler"]["maxBytes"] = ROLLOVER_BYTES
... | [
"def",
"init_logger",
"(",
"debug_on",
")",
":",
"global",
"_LOGGER",
"log_conf",
".",
"LOGGING_CONFIG",
"[",
"\"handlers\"",
"]",
"[",
"\"consoleHandler\"",
"]",
"[",
"\"formatter\"",
"]",
"=",
"\"fileFormatter\"",
"log_conf",
".",
"LOGGING_CONFIG",
"[",
"\"handl... | Initializes the private module variable logger
Adds the file formatter and logging file to the default logging
configuration. | [
"Initializes",
"the",
"private",
"module",
"variable",
"logger",
"Adds",
"the",
"file",
"formatter",
"and",
"logging",
"file",
"to",
"the",
"default",
"logging",
"configuration",
"."
] | [
"\"\"\"Initializes the private module variable logger\n\n Adds the file formatter and logging file to the default logging\n configuration.\n\n Args:\n debug_on (bool): boolean determining if debug mode is set via the\n command line\n\n Returns:\n void\n \"\"\"",
"# prod-lev... | [
{
"param": "debug_on",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "debug_on",
"type": null,
"docstring": "boolean determining if debug mode is set via the\ncommand line",
"docstring_... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | handle_new_conn | null | def handle_new_conn(sock, fd_to_socket, poller):
"""Handles a new connection to the server.
Accepts the socket sonnection and registers the socket with the poller
appropriately.
Arguments:
sock (:obj: `socket`) socket object associated with the server socket
fd_to_socket (:obj: `dict`)... | Handles a new connection to the server.
Accepts the socket sonnection and registers the socket with the poller
appropriately.
Arguments:
sock (:obj: `socket`) socket object associated with the server socket
fd_to_socket (:obj: `dict`) Dictionary mapping file descriptors to
sock... | Handles a new connection to the server.
Accepts the socket sonnection and registers the socket with the poller
appropriately. | [
"Handles",
"a",
"new",
"connection",
"to",
"the",
"server",
".",
"Accepts",
"the",
"socket",
"sonnection",
"and",
"registers",
"the",
"socket",
"with",
"the",
"poller",
"appropriately",
"."
] | def handle_new_conn(sock, fd_to_socket, poller):
conn, addr = sock.accept()
conn.setblocking(0)
fd_to_socket[conn.fileno()] = conn
poller.register(conn, READ_ONLY)
_LOGGER.debug("New TCP Connection Created: %s", addr) | [
"def",
"handle_new_conn",
"(",
"sock",
",",
"fd_to_socket",
",",
"poller",
")",
":",
"conn",
",",
"addr",
"=",
"sock",
".",
"accept",
"(",
")",
"conn",
".",
"setblocking",
"(",
"0",
")",
"fd_to_socket",
"[",
"conn",
".",
"fileno",
"(",
")",
"]",
"=",... | Handles a new connection to the server. | [
"Handles",
"a",
"new",
"connection",
"to",
"the",
"server",
"."
] | [
"\"\"\"Handles a new connection to the server.\n\n Accepts the socket sonnection and registers the socket with the poller\n appropriately.\n\n Arguments:\n sock (:obj: `socket`) socket object associated with the server socket\n fd_to_socket (:obj: `dict`) Dictionary mapping file descriptors t... | [
{
"param": "sock",
"type": null
},
{
"param": "fd_to_socket",
"type": null
},
{
"param": "poller",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sock",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | retrieve_http_req | <not_specific> | def retrieve_http_req(sock, message_queues, sock_to_ja3, poller):
"""Attempts to process incoming bytes and get the HTTP GET request.
Reads input from the given socket and if it sees a GET request, it parses
the User-Agent string for browser metadata.
Arguments:
sock (:obj: `socket`) socket ob... | Attempts to process incoming bytes and get the HTTP GET request.
Reads input from the given socket and if it sees a GET request, it parses
the User-Agent string for browser metadata.
Arguments:
sock (:obj: `socket`) socket object to process any incoming bytes on
message_queues (:obj: `queu... | Attempts to process incoming bytes and get the HTTP GET request.
Reads input from the given socket and if it sees a GET request, it parses
the User-Agent string for browser metadata. | [
"Attempts",
"to",
"process",
"incoming",
"bytes",
"and",
"get",
"the",
"HTTP",
"GET",
"request",
".",
"Reads",
"input",
"from",
"the",
"given",
"socket",
"and",
"if",
"it",
"sees",
"a",
"GET",
"request",
"it",
"parses",
"the",
"User",
"-",
"Agent",
"stri... | def retrieve_http_req(sock, message_queues, sock_to_ja3, poller):
try:
init_request = sock.recv(2048)
except BlockingIOError as err:
_LOGGER.warning("Nothing to read")
return False
except ConnectionResetError as err:
_LOGGER.warning("Connection reset: %s", err)
return... | [
"def",
"retrieve_http_req",
"(",
"sock",
",",
"message_queues",
",",
"sock_to_ja3",
",",
"poller",
")",
":",
"try",
":",
"init_request",
"=",
"sock",
".",
"recv",
"(",
"2048",
")",
"except",
"BlockingIOError",
"as",
"err",
":",
"_LOGGER",
".",
"warning",
"... | Attempts to process incoming bytes and get the HTTP GET request. | [
"Attempts",
"to",
"process",
"incoming",
"bytes",
"and",
"get",
"the",
"HTTP",
"GET",
"request",
"."
] | [
"\"\"\"Attempts to process incoming bytes and get the HTTP GET request.\n\n Reads input from the given socket and if it sees a GET request, it parses\n the User-Agent string for browser metadata.\n\n Arguments:\n sock (:obj: `socket`) socket object to process any incoming bytes on\n message_q... | [
{
"param": "sock",
"type": null
},
{
"param": "message_queues",
"type": null
},
{
"param": "sock_to_ja3",
"type": null
},
{
"param": "poller",
"type": null
}
] | {
"returns": [
{
"docstring": "True on successful GET request, False otherwise and on error",
"docstring_tokens": [
"True",
"on",
"successful",
"GET",
"request",
"False",
"otherwise",
"and",
"on",
"error"
],
"t... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | tls_handshake | <not_specific> | def tls_handshake(sock, message_queues, fd_to_socket, sock_to_ja3, poller):
"""Takes a given connection and completes the TLS handshake to obtain the
JA3 fingerprint.
Arguments:
sock (:obj: `socket`) current TCP connection with a client to complete
the TLS handshake with.
messag... | Takes a given connection and completes the TLS handshake to obtain the
JA3 fingerprint.
Arguments:
sock (:obj: `socket`) current TCP connection with a client to complete
the TLS handshake with.
message_queues (:obj: `queue.queue`) standard queue for message IO for
the gi... | Takes a given connection and completes the TLS handshake to obtain the
JA3 fingerprint. | [
"Takes",
"a",
"given",
"connection",
"and",
"completes",
"the",
"TLS",
"handshake",
"to",
"obtain",
"the",
"JA3",
"fingerprint",
"."
] | def tls_handshake(sock, message_queues, fd_to_socket, sock_to_ja3, poller):
try:
if isinstance(sock, ssl.SSLSocket):
_LOGGER.info("returning the ssl socket for false")
return False
_LOGGER.info("receiving client hello")
client_hello = sock.recv(2048, socket.MSG_PEEK)
... | [
"def",
"tls_handshake",
"(",
"sock",
",",
"message_queues",
",",
"fd_to_socket",
",",
"sock_to_ja3",
",",
"poller",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"sock",
",",
"ssl",
".",
"SSLSocket",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"returning the... | Takes a given connection and completes the TLS handshake to obtain the
JA3 fingerprint. | [
"Takes",
"a",
"given",
"connection",
"and",
"completes",
"the",
"TLS",
"handshake",
"to",
"obtain",
"the",
"JA3",
"fingerprint",
"."
] | [
"\"\"\"Takes a given connection and completes the TLS handshake to obtain the\n JA3 fingerprint.\n\n Arguments:\n sock (:obj: `socket`) current TCP connection with a client to complete\n the TLS handshake with.\n message_queues (:obj: `queue.queue`) standard queue for message IO for\n... | [
{
"param": "sock",
"type": null
},
{
"param": "message_queues",
"type": null
},
{
"param": "fd_to_socket",
"type": null
},
{
"param": "sock_to_ja3",
"type": null
},
{
"param": "poller",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sock",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message_queues",
"type": null,
"docstring": null,
"docstring_... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | cleanup_connection | <not_specific> | def cleanup_connection(sock, poller, message_queues=None, sock_to_ja3=None):
"""Cleans up the connection for the given TCP socket.
Arguments:
sock (:obj: `socket`) current connected socket to close the connection
with
poller (:obj: `select.poll`) poller for concurrent IO operations
... | Cleans up the connection for the given TCP socket.
Arguments:
sock (:obj: `socket`) current connected socket to close the connection
with
poller (:obj: `select.poll`) poller for concurrent IO operations
message_queues (:obj: `queue.queue`) Optionally provided queue for the
... | Cleans up the connection for the given TCP socket. | [
"Cleans",
"up",
"the",
"connection",
"for",
"the",
"given",
"TCP",
"socket",
"."
] | def cleanup_connection(sock, poller, message_queues=None, sock_to_ja3=None):
try:
_LOGGER.info("Closing connection to %s", sock.getpeername())
except OSError as err:
_LOGGER.error(err)
_LOGGER.info("Closing connection to %s", sock)
if sock.fileno() == -1:
_LOGGER.warn... | [
"def",
"cleanup_connection",
"(",
"sock",
",",
"poller",
",",
"message_queues",
"=",
"None",
",",
"sock_to_ja3",
"=",
"None",
")",
":",
"try",
":",
"_LOGGER",
".",
"info",
"(",
"\"Closing connection to %s\"",
",",
"sock",
".",
"getpeername",
"(",
")",
")",
... | Cleans up the connection for the given TCP socket. | [
"Cleans",
"up",
"the",
"connection",
"for",
"the",
"given",
"TCP",
"socket",
"."
] | [
"\"\"\"Cleans up the connection for the given TCP socket.\n\n Arguments:\n sock (:obj: `socket`) current connected socket to close the connection\n with\n poller (:obj: `select.poll`) poller for concurrent IO operations\n message_queues (:obj: `queue.queue`) Optionally provided qu... | [
{
"param": "sock",
"type": null
},
{
"param": "poller",
"type": null
},
{
"param": "message_queues",
"type": null
},
{
"param": "sock_to_ja3",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sock",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "poller",
"type": null,
"docstring": null,
"docstring_tokens":... |
4dcca8148337f994b5d2819d54dab5b9421acd80 | ryanpersaud/pyja3mas | https_server.py | [
"BSD-3-Clause"
] | Python | main | null | def main():
"""Main method that runs and handles the HTTPs server concurrently
Args:
void
Returns:
void
"""
parser = argparse.ArgumentParser()
setup_arguments(parser)
args = parser.parse_args()
init_logger(args.debug)
_LOGGER.debug("Initializing Socket")
ser... | Main method that runs and handles the HTTPs server concurrently
Args:
void
Returns:
void
| Main method that runs and handles the HTTPs server concurrently
Args:
void
void | [
"Main",
"method",
"that",
"runs",
"and",
"handles",
"the",
"HTTPs",
"server",
"concurrently",
"Args",
":",
"void",
"void"
] | def main():
parser = argparse.ArgumentParser()
setup_arguments(parser)
args = parser.parse_args()
init_logger(args.debug)
_LOGGER.debug("Initializing Socket")
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serv.setbl... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"setup_arguments",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"init_logger",
"(",
"args",
".",
"debug",
")",
"_LOGGER",
".",
"debug",
... | Main method that runs and handles the HTTPs server concurrently
Args:
void | [
"Main",
"method",
"that",
"runs",
"and",
"handles",
"the",
"HTTPs",
"server",
"concurrently",
"Args",
":",
"void"
] | [
"\"\"\"Main method that runs and handles the HTTPs server concurrently\n\n Args:\n void\n\n Returns:\n void\n \"\"\"",
"# queue for sending messages back to the clients",
"# server socket gets a new connection",
"# not init connection to the server",
"# checks if this is the second ev... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
020f9a87fa984847faf352adeace345802bacce9 | automation-liberation/tello-control | tellocontrol/__init__.py | [
"Apache-2.0"
] | Python | configure_celery | null | def configure_celery():
"""
Configures Celery application based on configuration.
"""
celery.config_from_object('config')
celery.autodiscover_tasks(['tellocontrol.control', ])
celery.finalize() |
Configures Celery application based on configuration.
| Configures Celery application based on configuration. | [
"Configures",
"Celery",
"application",
"based",
"on",
"configuration",
"."
] | def configure_celery():
celery.config_from_object('config')
celery.autodiscover_tasks(['tellocontrol.control', ])
celery.finalize() | [
"def",
"configure_celery",
"(",
")",
":",
"celery",
".",
"config_from_object",
"(",
"'config'",
")",
"celery",
".",
"autodiscover_tasks",
"(",
"[",
"'tellocontrol.control'",
",",
"]",
")",
"celery",
".",
"finalize",
"(",
")"
] | Configures Celery application based on configuration. | [
"Configures",
"Celery",
"application",
"based",
"on",
"configuration",
"."
] | [
"\"\"\"\n Configures Celery application based on configuration.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6c33aab63925d620d01d96126f3ee5ff0c0cbc7a | xebbmw/hassio-supervisor | hassio/api/auth.py | [
"Apache-2.0"
] | Python | _process_basic | <not_specific> | def _process_basic(self, request, addon):
"""Process login request with basic auth.
Return a coroutine.
"""
auth = BasicAuth.decode(request.headers[AUTHORIZATION])
return self.sys_auth.check_login(addon, auth.login, auth.password) | Process login request with basic auth.
Return a coroutine.
| Process login request with basic auth.
Return a coroutine. | [
"Process",
"login",
"request",
"with",
"basic",
"auth",
".",
"Return",
"a",
"coroutine",
"."
] | def _process_basic(self, request, addon):
auth = BasicAuth.decode(request.headers[AUTHORIZATION])
return self.sys_auth.check_login(addon, auth.login, auth.password) | [
"def",
"_process_basic",
"(",
"self",
",",
"request",
",",
"addon",
")",
":",
"auth",
"=",
"BasicAuth",
".",
"decode",
"(",
"request",
".",
"headers",
"[",
"AUTHORIZATION",
"]",
")",
"return",
"self",
".",
"sys_auth",
".",
"check_login",
"(",
"addon",
",... | Process login request with basic auth. | [
"Process",
"login",
"request",
"with",
"basic",
"auth",
"."
] | [
"\"\"\"Process login request with basic auth.\n\n Return a coroutine.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "addon",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens"... |
6c33aab63925d620d01d96126f3ee5ff0c0cbc7a | xebbmw/hassio-supervisor | hassio/api/auth.py | [
"Apache-2.0"
] | Python | _process_dict | <not_specific> | def _process_dict(self, request, addon, data):
"""Process login with dict data.
Return a coroutine.
"""
username = data.get("username") or data.get("user")
password = data.get("password")
return self.sys_auth.check_login(addon, username, password) | Process login with dict data.
Return a coroutine.
| Process login with dict data.
Return a coroutine. | [
"Process",
"login",
"with",
"dict",
"data",
".",
"Return",
"a",
"coroutine",
"."
] | def _process_dict(self, request, addon, data):
username = data.get("username") or data.get("user")
password = data.get("password")
return self.sys_auth.check_login(addon, username, password) | [
"def",
"_process_dict",
"(",
"self",
",",
"request",
",",
"addon",
",",
"data",
")",
":",
"username",
"=",
"data",
".",
"get",
"(",
"\"username\"",
")",
"or",
"data",
".",
"get",
"(",
"\"user\"",
")",
"password",
"=",
"data",
".",
"get",
"(",
"\"pass... | Process login with dict data. | [
"Process",
"login",
"with",
"dict",
"data",
"."
] | [
"\"\"\"Process login with dict data.\n\n Return a coroutine.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "addon",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens"... |
7b2b35aad8c592da4ee30b5740f098e563e32443 | xebbmw/hassio-supervisor | hassio/dbus/rauc.py | [
"Apache-2.0"
] | Python | install | <not_specific> | def install(self, raucb_file):
"""Install rauc bundle file.
Return a coroutine.
"""
return self.dbus.Installer.Install(raucb_file) | Install rauc bundle file.
Return a coroutine.
| Install rauc bundle file.
Return a coroutine. | [
"Install",
"rauc",
"bundle",
"file",
".",
"Return",
"a",
"coroutine",
"."
] | def install(self, raucb_file):
return self.dbus.Installer.Install(raucb_file) | [
"def",
"install",
"(",
"self",
",",
"raucb_file",
")",
":",
"return",
"self",
".",
"dbus",
".",
"Installer",
".",
"Install",
"(",
"raucb_file",
")"
] | Install rauc bundle file. | [
"Install",
"rauc",
"bundle",
"file",
"."
] | [
"\"\"\"Install rauc bundle file.\n\n Return a coroutine.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "raucb_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "raucb_file",
"type": null,
"docstring": null,
"docstring_toke... |
7b2b35aad8c592da4ee30b5740f098e563e32443 | xebbmw/hassio-supervisor | hassio/dbus/rauc.py | [
"Apache-2.0"
] | Python | signal_completed | <not_specific> | def signal_completed(self):
"""Return a signal wrapper for completed signal.
Return a coroutine.
"""
return self.dbus.wait_signal(f"{DBUS_NAME}.Installer.Completed") | Return a signal wrapper for completed signal.
Return a coroutine.
| Return a signal wrapper for completed signal.
Return a coroutine. | [
"Return",
"a",
"signal",
"wrapper",
"for",
"completed",
"signal",
".",
"Return",
"a",
"coroutine",
"."
] | def signal_completed(self):
return self.dbus.wait_signal(f"{DBUS_NAME}.Installer.Completed") | [
"def",
"signal_completed",
"(",
"self",
")",
":",
"return",
"self",
".",
"dbus",
".",
"wait_signal",
"(",
"f\"{DBUS_NAME}.Installer.Completed\"",
")"
] | Return a signal wrapper for completed signal. | [
"Return",
"a",
"signal",
"wrapper",
"for",
"completed",
"signal",
"."
] | [
"\"\"\"Return a signal wrapper for completed signal.\n\n Return a coroutine.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b394b71f63d464aca392381cb2ac81a25af12612 | xebbmw/hassio-supervisor | hassio/hassos.py | [
"Apache-2.0"
] | Python | _download_raucb | None | async def _download_raucb(self, version: str) -> None:
"""Download rauc bundle (OTA) from github."""
url = URL_HASSOS_OTA.format(version=version, board=self.board)
raucb = Path(self.sys_config.path_tmp, f"hassos-{version}.raucb")
try:
_LOGGER.info("Fetch OTA update from %s",... | Download rauc bundle (OTA) from github. | Download rauc bundle (OTA) from github. | [
"Download",
"rauc",
"bundle",
"(",
"OTA",
")",
"from",
"github",
"."
] | async def _download_raucb(self, version: str) -> None:
url = URL_HASSOS_OTA.format(version=version, board=self.board)
raucb = Path(self.sys_config.path_tmp, f"hassos-{version}.raucb")
try:
_LOGGER.info("Fetch OTA update from %s", url)
async with self.sys_websession.get(ur... | [
"async",
"def",
"_download_raucb",
"(",
"self",
",",
"version",
":",
"str",
")",
"->",
"None",
":",
"url",
"=",
"URL_HASSOS_OTA",
".",
"format",
"(",
"version",
"=",
"version",
",",
"board",
"=",
"self",
".",
"board",
")",
"raucb",
"=",
"Path",
"(",
... | Download rauc bundle (OTA) from github. | [
"Download",
"rauc",
"bundle",
"(",
"OTA",
")",
"from",
"github",
"."
] | [
"\"\"\"Download rauc bundle (OTA) from github.\"\"\"",
"# Download RAUCB file"
] | [
{
"param": "self",
"type": null
},
{
"param": "version",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "version",
"type": "str",
"docstring": null,
"docstring_tokens... |
03cf26bfb6308be539ed7a6af5d701abb3a84805 | xebbmw/hassio-supervisor | hassio/host/control.py | [
"Apache-2.0"
] | Python | _check_dbus | <not_specific> | def _check_dbus(self, flag):
"""Check if systemd is connect or raise error."""
if flag == MANAGER and self.sys_dbus.systemd.is_connected:
return
if flag == HOSTNAME and self.sys_dbus.hostname.is_connected:
return
_LOGGER.error("No %s D-Bus connection available", ... | Check if systemd is connect or raise error. | Check if systemd is connect or raise error. | [
"Check",
"if",
"systemd",
"is",
"connect",
"or",
"raise",
"error",
"."
] | def _check_dbus(self, flag):
if flag == MANAGER and self.sys_dbus.systemd.is_connected:
return
if flag == HOSTNAME and self.sys_dbus.hostname.is_connected:
return
_LOGGER.error("No %s D-Bus connection available", flag)
raise HostNotSupportedError() | [
"def",
"_check_dbus",
"(",
"self",
",",
"flag",
")",
":",
"if",
"flag",
"==",
"MANAGER",
"and",
"self",
".",
"sys_dbus",
".",
"systemd",
".",
"is_connected",
":",
"return",
"if",
"flag",
"==",
"HOSTNAME",
"and",
"self",
".",
"sys_dbus",
".",
"hostname",
... | Check if systemd is connect or raise error. | [
"Check",
"if",
"systemd",
"is",
"connect",
"or",
"raise",
"error",
"."
] | [
"\"\"\"Check if systemd is connect or raise error.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "flag",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flag",
"type": null,
"docstring": null,
"docstring_tokens": [... |
617fa3c838b059ec092200800aedfd24ba8fe13d | xebbmw/hassio-supervisor | hassio/utils/gdbus.py | [
"Apache-2.0"
] | Python | parse_gvariant | Any | def parse_gvariant(raw: str) -> Any:
"""Parse GVariant input to python."""
# Process first string
json_raw = RE_GVARIANT_STRING_ESC.sub(
lambda x: x.group(0).replace('"', '\\"'), raw
)
json_raw = RE_GVARIANT_STRING.sub(r'"\1"', json_raw)
# Remove complex type... | Parse GVariant input to python. | Parse GVariant input to python. | [
"Parse",
"GVariant",
"input",
"to",
"python",
"."
] | def parse_gvariant(raw: str) -> Any:
json_raw = RE_GVARIANT_STRING_ESC.sub(
lambda x: x.group(0).replace('"', '\\"'), raw
)
json_raw = RE_GVARIANT_STRING.sub(r'"\1"', json_raw)
json_raw: str = RE_GVARIANT_TYPE.sub(
lambda x: x.group(0) if not x.group(1) else "", j... | [
"def",
"parse_gvariant",
"(",
"raw",
":",
"str",
")",
"->",
"Any",
":",
"json_raw",
"=",
"RE_GVARIANT_STRING_ESC",
".",
"sub",
"(",
"lambda",
"x",
":",
"x",
".",
"group",
"(",
"0",
")",
".",
"replace",
"(",
"'\"'",
",",
"'\\\\\"'",
")",
",",
"raw",
... | Parse GVariant input to python. | [
"Parse",
"GVariant",
"input",
"to",
"python",
"."
] | [
"\"\"\"Parse GVariant input to python.\"\"\"",
"# Process first string",
"# Remove complex type handling",
"# No data"
] | [
{
"param": "raw",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "raw",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f6fad670fa6222f2a583054b3dba7976d0dc6e93 | xebbmw/hassio-supervisor | hassio/ingress.py | [
"Apache-2.0"
] | Python | addons | List[Addon] | def addons(self) -> List[Addon]:
"""Return list of ingress Add-ons."""
addons = []
for addon in self.sys_addons.installed:
if not addon.with_ingress:
continue
addons.append(addon)
return addons | Return list of ingress Add-ons. | Return list of ingress Add-ons. | [
"Return",
"list",
"of",
"ingress",
"Add",
"-",
"ons",
"."
] | def addons(self) -> List[Addon]:
addons = []
for addon in self.sys_addons.installed:
if not addon.with_ingress:
continue
addons.append(addon)
return addons | [
"def",
"addons",
"(",
"self",
")",
"->",
"List",
"[",
"Addon",
"]",
":",
"addons",
"=",
"[",
"]",
"for",
"addon",
"in",
"self",
".",
"sys_addons",
".",
"installed",
":",
"if",
"not",
"addon",
".",
"with_ingress",
":",
"continue",
"addons",
".",
"appe... | Return list of ingress Add-ons. | [
"Return",
"list",
"of",
"ingress",
"Add",
"-",
"ons",
"."
] | [
"\"\"\"Return list of ingress Add-ons.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f6fad670fa6222f2a583054b3dba7976d0dc6e93 | xebbmw/hassio-supervisor | hassio/ingress.py | [
"Apache-2.0"
] | Python | validate_session | bool | def validate_session(self, session: str) -> bool:
"""Return True if session valid and make it longer valid."""
if session not in self.sessions:
return False
valid_until = utc_from_timestamp(self.sessions[session])
# Is still valid?
if valid_until < utcnow():
... | Return True if session valid and make it longer valid. | Return True if session valid and make it longer valid. | [
"Return",
"True",
"if",
"session",
"valid",
"and",
"make",
"it",
"longer",
"valid",
"."
] | def validate_session(self, session: str) -> bool:
if session not in self.sessions:
return False
valid_until = utc_from_timestamp(self.sessions[session])
if valid_until < utcnow():
return False
valid_until = valid_until + timedelta(minutes=15)
self.sessions... | [
"def",
"validate_session",
"(",
"self",
",",
"session",
":",
"str",
")",
"->",
"bool",
":",
"if",
"session",
"not",
"in",
"self",
".",
"sessions",
":",
"return",
"False",
"valid_until",
"=",
"utc_from_timestamp",
"(",
"self",
".",
"sessions",
"[",
"session... | Return True if session valid and make it longer valid. | [
"Return",
"True",
"if",
"session",
"valid",
"and",
"make",
"it",
"longer",
"valid",
"."
] | [
"\"\"\"Return True if session valid and make it longer valid.\"\"\"",
"# Is still valid?",
"# Update time"
] | [
{
"param": "self",
"type": null
},
{
"param": "session",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "session",
"type": "str",
"docstring": null,
"docstring_tokens... |
f6fad670fa6222f2a583054b3dba7976d0dc6e93 | xebbmw/hassio-supervisor | hassio/ingress.py | [
"Apache-2.0"
] | Python | update_hass_panel | null | async def update_hass_panel(self, addon: Addon):
"""Return True if Home Assistant up and running."""
method = "post" if addon.ingress_panel else "delete"
async with self.sys_homeassistant.make_request(
method, f"api/hassio_push/panel/{addon.slug}"
) as resp:
if re... | Return True if Home Assistant up and running. | Return True if Home Assistant up and running. | [
"Return",
"True",
"if",
"Home",
"Assistant",
"up",
"and",
"running",
"."
] | async def update_hass_panel(self, addon: Addon):
method = "post" if addon.ingress_panel else "delete"
async with self.sys_homeassistant.make_request(
method, f"api/hassio_push/panel/{addon.slug}"
) as resp:
if resp.status in (200, 201):
_LOGGER.info("Updat... | [
"async",
"def",
"update_hass_panel",
"(",
"self",
",",
"addon",
":",
"Addon",
")",
":",
"method",
"=",
"\"post\"",
"if",
"addon",
".",
"ingress_panel",
"else",
"\"delete\"",
"async",
"with",
"self",
".",
"sys_homeassistant",
".",
"make_request",
"(",
"method",... | Return True if Home Assistant up and running. | [
"Return",
"True",
"if",
"Home",
"Assistant",
"up",
"and",
"running",
"."
] | [
"\"\"\"Return True if Home Assistant up and running.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "addon",
"type": "Addon"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "addon",
"type": "Addon",
"docstring": null,
"docstring_tokens... |
7e9fedd19f53e31b88689fe72e410f76915c57e8 | xebbmw/hassio-supervisor | hassio/updater.py | [
"Apache-2.0"
] | Python | fetch_data | null | async def fetch_data(self):
"""Fetch current versions from Github.
Is a coroutine.
"""
url = URL_HASSIO_VERSION.format(channel=self.channel)
machine = self.sys_machine or "default"
board = self.sys_hassos.board
try:
_LOGGER.info("Fetch update data fr... | Fetch current versions from Github.
Is a coroutine.
| Fetch current versions from Github.
Is a coroutine. | [
"Fetch",
"current",
"versions",
"from",
"Github",
".",
"Is",
"a",
"coroutine",
"."
] | async def fetch_data(self):
url = URL_HASSIO_VERSION.format(channel=self.channel)
machine = self.sys_machine or "default"
board = self.sys_hassos.board
try:
_LOGGER.info("Fetch update data from %s", url)
async with self.sys_websession.get(url, timeout=10) as reque... | [
"async",
"def",
"fetch_data",
"(",
"self",
")",
":",
"url",
"=",
"URL_HASSIO_VERSION",
".",
"format",
"(",
"channel",
"=",
"self",
".",
"channel",
")",
"machine",
"=",
"self",
".",
"sys_machine",
"or",
"\"default\"",
"board",
"=",
"self",
".",
"sys_hassos"... | Fetch current versions from Github. | [
"Fetch",
"current",
"versions",
"from",
"Github",
"."
] | [
"\"\"\"Fetch current versions from Github.\n\n Is a coroutine.\n \"\"\"",
"# data valid?",
"# update supervisor version",
"# update Home Assistant version",
"# update hassos version"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
679d91f052cfdfccda2f7ad94ea8374dac9ed525 | xebbmw/hassio-supervisor | hassio/dbus/__init__.py | [
"Apache-2.0"
] | Python | load | None | async def load(self) -> None:
"""Connect interfaces to D-Bus."""
try:
await self.systemd.connect()
await self.hostname.connect()
await self.rauc.connect()
await self.nmi_dns.connect()
except DBusNotConnectedError:
_LOGGER.error(
... | Connect interfaces to D-Bus. | Connect interfaces to D-Bus. | [
"Connect",
"interfaces",
"to",
"D",
"-",
"Bus",
"."
] | async def load(self) -> None:
try:
await self.systemd.connect()
await self.hostname.connect()
await self.rauc.connect()
await self.nmi_dns.connect()
except DBusNotConnectedError:
_LOGGER.error(
"No DBus support from Host. Disabl... | [
"async",
"def",
"load",
"(",
"self",
")",
"->",
"None",
":",
"try",
":",
"await",
"self",
".",
"systemd",
".",
"connect",
"(",
")",
"await",
"self",
".",
"hostname",
".",
"connect",
"(",
")",
"await",
"self",
".",
"rauc",
".",
"connect",
"(",
")",
... | Connect interfaces to D-Bus. | [
"Connect",
"interfaces",
"to",
"D",
"-",
"Bus",
"."
] | [
"\"\"\"Connect interfaces to D-Bus.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bdde0260f22bccdafb2c7cc9e74880f781b0d94f | xebbmw/hassio-supervisor | hassio/api/__init__.py | [
"Apache-2.0"
] | Python | _register_proxy | None | def _register_proxy(self) -> None:
"""Register Home Assistant API Proxy."""
api_proxy = APIProxy()
api_proxy.coresys = self.coresys
self.webapp.add_routes(
[
web.get("/homeassistant/api/websocket", api_proxy.websocket),
web.get("/homeassistant... | Register Home Assistant API Proxy. | Register Home Assistant API Proxy. | [
"Register",
"Home",
"Assistant",
"API",
"Proxy",
"."
] | def _register_proxy(self) -> None:
api_proxy = APIProxy()
api_proxy.coresys = self.coresys
self.webapp.add_routes(
[
web.get("/homeassistant/api/websocket", api_proxy.websocket),
web.get("/homeassistant/websocket", api_proxy.websocket),
... | [
"def",
"_register_proxy",
"(",
"self",
")",
"->",
"None",
":",
"api_proxy",
"=",
"APIProxy",
"(",
")",
"api_proxy",
".",
"coresys",
"=",
"self",
".",
"coresys",
"self",
".",
"webapp",
".",
"add_routes",
"(",
"[",
"web",
".",
"get",
"(",
"\"/homeassistant... | Register Home Assistant API Proxy. | [
"Register",
"Home",
"Assistant",
"API",
"Proxy",
"."
] | [
"\"\"\"Register Home Assistant API Proxy.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bdde0260f22bccdafb2c7cc9e74880f781b0d94f | xebbmw/hassio-supervisor | hassio/api/__init__.py | [
"Apache-2.0"
] | Python | _register_addons | None | def _register_addons(self) -> None:
"""Register Add-on functions."""
api_addons = APIAddons()
api_addons.coresys = self.coresys
self.webapp.add_routes(
[
web.get("/addons", api_addons.list),
web.post("/addons/reload", api_addons.reload),
... | Register Add-on functions. | Register Add-on functions. | [
"Register",
"Add",
"-",
"on",
"functions",
"."
] | def _register_addons(self) -> None:
api_addons = APIAddons()
api_addons.coresys = self.coresys
self.webapp.add_routes(
[
web.get("/addons", api_addons.list),
web.post("/addons/reload", api_addons.reload),
web.get("/addons/{addon}/info",... | [
"def",
"_register_addons",
"(",
"self",
")",
"->",
"None",
":",
"api_addons",
"=",
"APIAddons",
"(",
")",
"api_addons",
".",
"coresys",
"=",
"self",
".",
"coresys",
"self",
".",
"webapp",
".",
"add_routes",
"(",
"[",
"web",
".",
"get",
"(",
"\"/addons\""... | Register Add-on functions. | [
"Register",
"Add",
"-",
"on",
"functions",
"."
] | [
"\"\"\"Register Add-on functions.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8fe2b5404a4b79f33fa326134e5aa07856bf2998 | xebbmw/hassio-supervisor | hassio/host/__init__.py | [
"Apache-2.0"
] | Python | supperted_features | <not_specific> | def supperted_features(self):
"""Return a list of supported host features."""
features = []
if self.sys_dbus.systemd.is_connected:
features.extend([FEATURES_REBOOT, FEATURES_SHUTDOWN, FEATURES_SERVICES])
if self.sys_dbus.hostname.is_connected:
features.append(FE... | Return a list of supported host features. | Return a list of supported host features. | [
"Return",
"a",
"list",
"of",
"supported",
"host",
"features",
"."
] | def supperted_features(self):
features = []
if self.sys_dbus.systemd.is_connected:
features.extend([FEATURES_REBOOT, FEATURES_SHUTDOWN, FEATURES_SERVICES])
if self.sys_dbus.hostname.is_connected:
features.append(FEATURES_HOSTNAME)
if self.sys_hassos.available:
... | [
"def",
"supperted_features",
"(",
"self",
")",
":",
"features",
"=",
"[",
"]",
"if",
"self",
".",
"sys_dbus",
".",
"systemd",
".",
"is_connected",
":",
"features",
".",
"extend",
"(",
"[",
"FEATURES_REBOOT",
",",
"FEATURES_SHUTDOWN",
",",
"FEATURES_SERVICES",
... | Return a list of supported host features. | [
"Return",
"a",
"list",
"of",
"supported",
"host",
"features",
"."
] | [
"\"\"\"Return a list of supported host features.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eed83c84df94ad6fe3cb15c95dce983debc3d020 | xebbmw/hassio-supervisor | tests/common.py | [
"Apache-2.0"
] | Python | mock_coro_func | <not_specific> | def mock_coro_func(return_value=None, exception=None):
"""Return a method to create a coro function that returns a value."""
async def coro(*args, **kwargs):
"""Fake coroutine."""
if exception:
raise exception
return return_value
return coro | Return a method to create a coro function that returns a value. | Return a method to create a coro function that returns a value. | [
"Return",
"a",
"method",
"to",
"create",
"a",
"coro",
"function",
"that",
"returns",
"a",
"value",
"."
] | def mock_coro_func(return_value=None, exception=None):
async def coro(*args, **kwargs):
if exception:
raise exception
return return_value
return coro | [
"def",
"mock_coro_func",
"(",
"return_value",
"=",
"None",
",",
"exception",
"=",
"None",
")",
":",
"async",
"def",
"coro",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"\"\"\"Fake coroutine.\"\"\"",
"if",
"exception",
":",
"raise",
"exception",
"return"... | Return a method to create a coro function that returns a value. | [
"Return",
"a",
"method",
"to",
"create",
"a",
"coro",
"function",
"that",
"returns",
"a",
"value",
"."
] | [
"\"\"\"Return a method to create a coro function that returns a value.\"\"\"",
"\"\"\"Fake coroutine.\"\"\""
] | [
{
"param": "return_value",
"type": null
},
{
"param": "exception",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "return_value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "exception",
"type": null,
"docstring": null,
"docstri... |
429439049430b1d20c36cf0cd4872d2d581b072e | saketkc/pyfastnbf | pyfastnbfit/pyfastnbfit.py | [
"BSD-3-Clause"
] | Python | fastfit_gamma | <not_specific> | def fastfit_gamma(observed, s=None, tol=1e-3, max_iterations=10):
"""Estimate parameters of a Gamma distribution.
Parameters
----------
observed: array_like
Observed values
s: array_like
Sufficient statistics. Default: None (inferred from the observations)
tol: float
... | Estimate parameters of a Gamma distribution.
Parameters
----------
observed: array_like
Observed values
s: array_like
Sufficient statistics. Default: None (inferred from the observations)
tol: float
Tolerance criterion for stopping
iterations when difference... | Estimate parameters of a Gamma distribution.
Parameters
float
Tolerance criterion for stopping
iterations when difference between sucessive estimates
drops below this value.
int
Maximum number of iterations.
Returns
| [
"Estimate",
"parameters",
"of",
"a",
"Gamma",
"distribution",
".",
"Parameters",
"float",
"Tolerance",
"criterion",
"for",
"stopping",
"iterations",
"when",
"difference",
"between",
"sucessive",
"estimates",
"drops",
"below",
"this",
"value",
".",
"int",
"Maximum",
... | def fastfit_gamma(observed, s=None, tol=1e-3, max_iterations=10):
xbar = np.mean(observed)
log_xbar = np.log(xbar)
bar_logx = np.mean(np.log(observed))
if s is None:
s = log_xbar - bar_logx
a = 0.5 / s
a_old = np.inf
iteration = 0
while (np.abs(a_old - a) > tol) and (iteration < ... | [
"def",
"fastfit_gamma",
"(",
"observed",
",",
"s",
"=",
"None",
",",
"tol",
"=",
"1e-3",
",",
"max_iterations",
"=",
"10",
")",
":",
"xbar",
"=",
"np",
".",
"mean",
"(",
"observed",
")",
"log_xbar",
"=",
"np",
".",
"log",
"(",
"xbar",
")",
"bar_log... | Estimate parameters of a Gamma distribution. | [
"Estimate",
"parameters",
"of",
"a",
"Gamma",
"distribution",
"."
] | [
"\"\"\"Estimate parameters of a Gamma distribution.\n\n Parameters\n ----------\n observed: array_like\n Observed values\n\n s: array_like\n Sufficient statistics. Default: None (inferred from the observations)\n\n tol: float\n Tolerance criterion for stopping\n ite... | [
{
"param": "observed",
"type": null
},
{
"param": "s",
"type": null
},
{
"param": "tol",
"type": null
},
{
"param": "max_iterations",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "observed",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": ... |
429439049430b1d20c36cf0cd4872d2d581b072e | saketkc/pyfastnbf | pyfastnbfit/pyfastnbfit.py | [
"BSD-3-Clause"
] | Python | fastfit_negbin | <not_specific> | def fastfit_negbin(observed, tol=1e-4, max_iterations=100):
"""Fit Negatove Binomial.
Parameters
----------
observed: array_like
Observed values
tol: float
Tolerance criterion for stopping
iterations when difference between sucessive estimates
drops below t... | Fit Negatove Binomial.
Parameters
----------
observed: array_like
Observed values
tol: float
Tolerance criterion for stopping
iterations when difference between sucessive estimates
drops below this value.
max_iterations: int
Maximum num... | Fit Negatove Binomial.
Parameters
float
Tolerance criterion for stopping
iterations when difference between sucessive estimates
drops below this value.
int
Maximum number of iterations.
Returns
dict
Dict with inferred parameters and number of iterations | [
"Fit",
"Negatove",
"Binomial",
".",
"Parameters",
"float",
"Tolerance",
"criterion",
"for",
"stopping",
"iterations",
"when",
"difference",
"between",
"sucessive",
"estimates",
"drops",
"below",
"this",
"value",
".",
"int",
"Maximum",
"number",
"of",
"iterations",
... | def fastfit_negbin(observed, tol=1e-4, max_iterations=100):
xmean = np.mean(observed)
xvar = np.var(observed)
b = xmean / xvar - 1
if b < 0:
b = 1e-3
a = xmean / b
a_old = np.inf
iteration = 0
while (np.abs(a_old - a) > tol) and (iteration < max_iterations):
a_old = a
... | [
"def",
"fastfit_negbin",
"(",
"observed",
",",
"tol",
"=",
"1e-4",
",",
"max_iterations",
"=",
"100",
")",
":",
"xmean",
"=",
"np",
".",
"mean",
"(",
"observed",
")",
"xvar",
"=",
"np",
".",
"var",
"(",
"observed",
")",
"b",
"=",
"xmean",
"/",
"xva... | Fit Negatove Binomial. | [
"Fit",
"Negatove",
"Binomial",
"."
] | [
"\"\"\"Fit Negatove Binomial.\n\n Parameters\n ----------\n observed: array_like\n Observed values\n\n tol: float\n Tolerance criterion for stopping\n iterations when difference between sucessive estimates\n drops below this value.\n\n max_iterations: int\n ... | [
{
"param": "observed",
"type": null
},
{
"param": "tol",
"type": null
},
{
"param": "max_iterations",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "observed",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tol",
"type": null,
"docstring": null,
"docstring_tokens"... |
92176925e94141edf7861e7d41a8040650edb339 | j3ygh/universetech-lotterydraw | twofake/core/draws.py | [
"MIT"
] | Python | cqssc_draw | <not_specific> | def cqssc_draw(gid, average_error_period=10):
"""
A cqssc number set draw.
If an error occurs, this function will return a random award,
or it will return an award for the given gid as a seed.
"""
random.seed()
error_occurred = random.randrange(average_error_period) == 0
if not error_oc... |
A cqssc number set draw.
If an error occurs, this function will return a random award,
or it will return an award for the given gid as a seed.
| A cqssc number set draw.
If an error occurs, this function will return a random award,
or it will return an award for the given gid as a seed. | [
"A",
"cqssc",
"number",
"set",
"draw",
".",
"If",
"an",
"error",
"occurs",
"this",
"function",
"will",
"return",
"a",
"random",
"award",
"or",
"it",
"will",
"return",
"an",
"award",
"for",
"the",
"given",
"gid",
"as",
"a",
"seed",
"."
] | def cqssc_draw(gid, average_error_period=10):
random.seed()
error_occurred = random.randrange(average_error_period) == 0
if not error_occurred:
random.seed(int(gid))
numberset = random.choices(range(1, 10), k=5)
award = ','.join([str(n) for n in numberset])
return award | [
"def",
"cqssc_draw",
"(",
"gid",
",",
"average_error_period",
"=",
"10",
")",
":",
"random",
".",
"seed",
"(",
")",
"error_occurred",
"=",
"random",
".",
"randrange",
"(",
"average_error_period",
")",
"==",
"0",
"if",
"not",
"error_occurred",
":",
"random",
... | A cqssc number set draw. | [
"A",
"cqssc",
"number",
"set",
"draw",
"."
] | [
"\"\"\"\n A cqssc number set draw.\n\n If an error occurs, this function will return a random award,\n or it will return an award for the given gid as a seed.\n \"\"\""
] | [
{
"param": "gid",
"type": null
},
{
"param": "average_error_period",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "average_error_period",
"type": null,
"docstring": null,
"docst... |
92176925e94141edf7861e7d41a8040650edb339 | j3ygh/universetech-lotterydraw | twofake/core/draws.py | [
"MIT"
] | Python | bjsyxw_draw | <not_specific> | def bjsyxw_draw(gid, average_error_period=10):
"""
A bj11x5 number set draw.
If an error occurs, this function will return a random number set,
or it will return an award for the given gid as a seed.
"""
random.seed()
error_occurred = random.randrange(average_error_period) == 0
if not e... |
A bj11x5 number set draw.
If an error occurs, this function will return a random number set,
or it will return an award for the given gid as a seed.
| A bj11x5 number set draw.
If an error occurs, this function will return a random number set,
or it will return an award for the given gid as a seed. | [
"A",
"bj11x5",
"number",
"set",
"draw",
".",
"If",
"an",
"error",
"occurs",
"this",
"function",
"will",
"return",
"a",
"random",
"number",
"set",
"or",
"it",
"will",
"return",
"an",
"award",
"for",
"the",
"given",
"gid",
"as",
"a",
"seed",
"."
] | def bjsyxw_draw(gid, average_error_period=10):
random.seed()
error_occurred = random.randrange(average_error_period) == 0
if not error_occurred:
random.seed(int(gid))
numberset = random.sample(range(1, 12), k=5)
award = ','.join([str(n) for n in numberset])
return award | [
"def",
"bjsyxw_draw",
"(",
"gid",
",",
"average_error_period",
"=",
"10",
")",
":",
"random",
".",
"seed",
"(",
")",
"error_occurred",
"=",
"random",
".",
"randrange",
"(",
"average_error_period",
")",
"==",
"0",
"if",
"not",
"error_occurred",
":",
"random",... | A bj11x5 number set draw. | [
"A",
"bj11x5",
"number",
"set",
"draw",
"."
] | [
"\"\"\"\n A bj11x5 number set draw.\n\n If an error occurs, this function will return a random number set,\n or it will return an award for the given gid as a seed.\n \"\"\""
] | [
{
"param": "gid",
"type": null
},
{
"param": "average_error_period",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "average_error_period",
"type": null,
"docstring": null,
"docst... |
098620d3840a1ca17782a092e9f07ba30023b67e | gunnarpope/python | json/pyjson.py | [
"MIT"
] | Python | jsonFileToDict | <not_specific> | def jsonFileToDict(filename):
"""Import a .json file into a Python dictionary
INPUT: filename.json file
Output: dict containing file contents
"""
with open(filename, 'r') as f:
jsondata = json.load(f)
dictdata = dict(jsondata)
return dictdata | Import a .json file into a Python dictionary
INPUT: filename.json file
Output: dict containing file contents
| Import a .json file into a Python dictionary
INPUT: filename.json file
Output: dict containing file contents | [
"Import",
"a",
".",
"json",
"file",
"into",
"a",
"Python",
"dictionary",
"INPUT",
":",
"filename",
".",
"json",
"file",
"Output",
":",
"dict",
"containing",
"file",
"contents"
] | def jsonFileToDict(filename):
with open(filename, 'r') as f:
jsondata = json.load(f)
dictdata = dict(jsondata)
return dictdata | [
"def",
"jsonFileToDict",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"jsondata",
"=",
"json",
".",
"load",
"(",
"f",
")",
"dictdata",
"=",
"dict",
"(",
"jsondata",
")",
"return",
"dictdata"
] | Import a .json file into a Python dictionary
INPUT: filename.json file
Output: dict containing file contents | [
"Import",
"a",
".",
"json",
"file",
"into",
"a",
"Python",
"dictionary",
"INPUT",
":",
"filename",
".",
"json",
"file",
"Output",
":",
"dict",
"containing",
"file",
"contents"
] | [
"\"\"\"Import a .json file into a Python dictionary\n\t INPUT: filename.json file\n\t\tOutput: dict containing file contents\n\t \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.