Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
_prepare_body_update_trunk
(prop_diff)
Prepare body for PUT /v2.0/trunks/TRUNK_ID.
Prepare body for PUT /v2.0/trunks/TRUNK_ID.
def _prepare_body_update_trunk(prop_diff): """Prepare body for PUT /v2.0/trunks/TRUNK_ID.""" return {'trunk': prop_diff}
[ "def", "_prepare_body_update_trunk", "(", "prop_diff", ")", ":", "return", "{", "'trunk'", ":", "prop_diff", "}" ]
[ 928, 0 ]
[ 930, 31 ]
python
en
['en', 'no', 'en']
True
_prepare_body_remove_subports
(subports)
Prepare body for PUT /v2.0/trunks/TRUNK_ID/remove_subports.
Prepare body for PUT /v2.0/trunks/TRUNK_ID/remove_subports.
def _prepare_body_remove_subports(subports): """Prepare body for PUT /v2.0/trunks/TRUNK_ID/remove_subports.""" return {'sub_ports': [{'port_id': sp['port_id']} for sp in subports]}
[ "def", "_prepare_body_remove_subports", "(", "subports", ")", ":", "return", "{", "'sub_ports'", ":", "[", "{", "'port_id'", ":", "sp", "[", "'port_id'", "]", "}", "for", "sp", "in", "subports", "]", "}" ]
[ 933, 0 ]
[ 935, 73 ]
python
en
['en', 'en', 'en']
True
_prepare_body_add_subports
(subports)
Prepare body for PUT /v2.0/trunks/TRUNK_ID/add_subports.
Prepare body for PUT /v2.0/trunks/TRUNK_ID/add_subports.
def _prepare_body_add_subports(subports): """Prepare body for PUT /v2.0/trunks/TRUNK_ID/add_subports.""" return {'sub_ports': subports}
[ "def", "_prepare_body_add_subports", "(", "subports", ")", ":", "return", "{", "'sub_ports'", ":", "subports", "}" ]
[ 938, 0 ]
[ 940, 34 ]
python
en
['en', 'en', 'en']
True
trunk_update
(request, trunk_id, old_trunk, new_trunk)
Handle update to a trunk in (at most) three neutron calls. The JavaScript side should know only about the old and new state of a trunk. However it should not know anything about how the old and new are meant to be diffed and sent to neutron. We handle that here. This code was adapted from Heat, see: h...
Handle update to a trunk in (at most) three neutron calls.
def trunk_update(request, trunk_id, old_trunk, new_trunk): """Handle update to a trunk in (at most) three neutron calls. The JavaScript side should know only about the old and new state of a trunk. However it should not know anything about how the old and new are meant to be diffed and sent to neutron....
[ "def", "trunk_update", "(", "request", ",", "trunk_id", ",", "old_trunk", ",", "new_trunk", ")", ":", "LOG", ".", "debug", "(", "\"trunk_update(): trunk_id=%s\"", ",", "trunk_id", ")", "# NOTE(bence romsics): We want to do set operations on the subports,", "# however we rec...
[ 944, 0 ]
[ 1029, 23 ]
python
en
['en', 'en', 'en']
True
network_list_for_tenant
(request, tenant_id, include_external=False, include_pre_auto_allocate=False, **params)
Return a network list available for the tenant. The list contains networks owned by the tenant and public networks. If requested_networks specified, it searches requested_networks only.
Return a network list available for the tenant.
def network_list_for_tenant(request, tenant_id, include_external=False, include_pre_auto_allocate=False, **params): """Return a network list available for the tenant. The list contains networks owned by the tenant and public networks. If requested_net...
[ "def", "network_list_for_tenant", "(", "request", ",", "tenant_id", ",", "include_external", "=", "False", ",", "include_pre_auto_allocate", "=", "False", ",", "*", "*", "params", ")", ":", "LOG", ".", "debug", "(", "\"network_list_for_tenant(): tenant_id=%(tenant_id)...
[ 1075, 0 ]
[ 1128, 19 ]
python
en
['en', 'en', 'en']
True
network_create
(request, **kwargs)
Create a network object. :param request: request context :param tenant_id: (optional) tenant id of the network created :param name: (optional) name of the network created :returns: Network object
Create a network object.
def network_create(request, **kwargs): """Create a network object. :param request: request context :param tenant_id: (optional) tenant id of the network created :param name: (optional) name of the network created :returns: Network object """ LOG.debug("network_create(): kwargs = %s", kwarg...
[ "def", "network_create", "(", "request", ",", "*", "*", "kwargs", ")", ":", "LOG", ".", "debug", "(", "\"network_create(): kwargs = %s\"", ",", "kwargs", ")", "if", "'tenant_id'", "not", "in", "kwargs", ":", "kwargs", "[", "'tenant_id'", "]", "=", "request",...
[ 1159, 0 ]
[ 1172, 27 ]
python
en
['en', 'en', 'en']
True
subnet_create
(request, network_id, **kwargs)
Create a subnet on a specified network. :param request: request context :param network_id: network id a subnet is created on :param cidr: (optional) subnet IP address range :param ip_version: (optional) IP version (4 or 6) :param gateway_ip: (optional) IP address of gateway :param tenant_id: (o...
Create a subnet on a specified network.
def subnet_create(request, network_id, **kwargs): """Create a subnet on a specified network. :param request: request context :param network_id: network id a subnet is created on :param cidr: (optional) subnet IP address range :param ip_version: (optional) IP version (4 or 6) :param gateway_ip: ...
[ "def", "subnet_create", "(", "request", ",", "network_id", ",", "*", "*", "kwargs", ")", ":", "LOG", ".", "debug", "(", "\"subnet_create(): netid=%(network_id)s, kwargs=%(kwargs)s\"", ",", "{", "'network_id'", ":", "network_id", ",", "'kwargs'", ":", "kwargs", "}"...
[ 1213, 0 ]
[ 1238, 25 ]
python
en
['en', 'en', 'en']
True
subnetpool_create
(request, name, prefixes, **kwargs)
Create a subnetpool. ip_version is auto-detected in back-end. Parameters: request -- Request context name -- Name for subnetpool prefixes -- List of prefixes for pool Keyword Arguments (optional): min_prefixlen -- Minimum prefix length for allocations f...
Create a subnetpool.
def subnetpool_create(request, name, prefixes, **kwargs): """Create a subnetpool. ip_version is auto-detected in back-end. Parameters: request -- Request context name -- Name for subnetpool prefixes -- List of prefixes for pool Keyword Arguments (optional):...
[ "def", "subnetpool_create", "(", "request", ",", "name", ",", "prefixes", ",", "*", "*", "kwargs", ")", ":", "LOG", ".", "debug", "(", "\"subnetpool_create(): name=%(name)s, prefixes=%(prefixes)s, \"", "\"kwargs=%(kwargs)s\"", ",", "{", "'name'", ":", "name", ",", ...
[ 1277, 0 ]
[ 1311, 33 ]
python
en
['en', 'zh', 'en']
True
port_list_with_trunk_types
(request, **params)
List neutron Ports for this tenant with possible TrunkPort indicated :param request: request context NOTE Performing two API calls is not atomic, but this is not worse than the original idea when we call port_list repeatedly for each network to perform identification run-time. We should ...
List neutron Ports for this tenant with possible TrunkPort indicated
def port_list_with_trunk_types(request, **params): """List neutron Ports for this tenant with possible TrunkPort indicated :param request: request context NOTE Performing two API calls is not atomic, but this is not worse than the original idea when we call port_list repeatedly for each ...
[ "def", "port_list_with_trunk_types", "(", "request", ",", "*", "*", "params", ")", ":", "LOG", ".", "debug", "(", "\"port_list_with_trunk_types(): params=%s\"", ",", "params", ")", "# When trunk feature is disabled in neutron, we have no need to fetch", "# trunk information and...
[ 1342, 0 ]
[ 1382, 45 ]
python
en
['en', 'en', 'en']
True
port_create
(request, network_id, **kwargs)
Create a port on a specified network. :param request: request context :param network_id: network id a subnet is created on :param device_id: (optional) device id attached to the port :param tenant_id: (optional) tenant id of the port created :param name: (optional) name of the port created :ret...
Create a port on a specified network.
def port_create(request, network_id, **kwargs): """Create a port on a specified network. :param request: request context :param network_id: network id a subnet is created on :param device_id: (optional) device id attached to the port :param tenant_id: (optional) tenant id of the port created :p...
[ "def", "port_create", "(", "request", ",", "network_id", ",", "*", "*", "kwargs", ")", ":", "LOG", ".", "debug", "(", "\"port_create(): netid=%(network_id)s, kwargs=%(kwargs)s\"", ",", "{", "'network_id'", ":", "network_id", ",", "'kwargs'", ":", "kwargs", "}", ...
[ 1401, 0 ]
[ 1419, 21 ]
python
en
['en', 'en', 'en']
True
servers_update_addresses
(request, servers, all_tenants=False)
Retrieve servers networking information from Neutron if enabled. Should be used when up to date networking information is required, and Nova's networking info caching mechanism is not fast enough.
Retrieve servers networking information from Neutron if enabled.
def servers_update_addresses(request, servers, all_tenants=False): """Retrieve servers networking information from Neutron if enabled. Should be used when up to date networking information is required, and Nova's networking info caching mechanism is not fast enough. """ # NOTE(e0ne): we don'...
[ "def", "servers_update_addresses", "(", "request", ",", "servers", ",", "all_tenants", "=", "False", ")", ":", "# NOTE(e0ne): we don't need to call neutron if we have no instances", "if", "not", "servers", ":", "return", "# Get all (filtered for relevant servers) information from...
[ 1721, 0 ]
[ 1786, 40 ]
python
en
['en', 'en', 'en']
True
list_extensions
(request)
List neutron extensions. :param request: django request object
List neutron extensions.
def list_extensions(request): """List neutron extensions. :param request: django request object """ neutron_api = neutronclient(request) try: extensions_list = neutron_api.list_extensions() except exceptions.ServiceCatalogException: return {} if 'extensions' in extensions_li...
[ "def", "list_extensions", "(", "request", ")", ":", "neutron_api", "=", "neutronclient", "(", "request", ")", "try", ":", "extensions_list", "=", "neutron_api", ".", "list_extensions", "(", ")", "except", "exceptions", ".", "ServiceCatalogException", ":", "return"...
[ 1829, 0 ]
[ 1842, 17 ]
python
en
['fr', 'lb', 'en']
False
is_extension_supported
(request, extension_alias)
Check if a specified extension is supported. :param request: django request object :param extension_alias: neutron extension alias
Check if a specified extension is supported.
def is_extension_supported(request, extension_alias): """Check if a specified extension is supported. :param request: django request object :param extension_alias: neutron extension alias """ extensions = list_extensions(request) for extension in extensions: if extension['alias'] == ext...
[ "def", "is_extension_supported", "(", "request", ",", "extension_alias", ")", ":", "extensions", "=", "list_extensions", "(", "request", ")", "for", "extension", "in", "extensions", ":", "if", "extension", "[", "'alias'", "]", "==", "extension_alias", ":", "retu...
[ 1846, 0 ]
[ 1857, 20 ]
python
en
['en', 'en', 'en']
True
get_feature_permission
(request, feature, operation=None)
Check if a feature-specific field can be displayed. This method check a permission for a feature-specific field. Such field is usually provided through Neutron extension. :param request: Request Object :param feature: feature name defined in FEATURE_MAP :param operation (optional): Operation type....
Check if a feature-specific field can be displayed.
def get_feature_permission(request, feature, operation=None): """Check if a feature-specific field can be displayed. This method check a permission for a feature-specific field. Such field is usually provided through Neutron extension. :param request: Request Object :param feature: feature name de...
[ "def", "get_feature_permission", "(", "request", ",", "feature", ",", "operation", "=", "None", ")", ":", "feature_info", "=", "FEATURE_MAP", ".", "get", "(", "feature", ")", "if", "not", "feature_info", ":", "raise", "ValueError", "(", "\"The requested feature ...
[ 1933, 0 ]
[ 1983, 15 ]
python
en
['en', 'en', 'en']
True
policy_create
(request, **kwargs)
Create a QoS Policy. :param request: request context :param name: name of the policy :param description: description of policy :param shared: boolean (true or false) :return: QoSPolicy object
Create a QoS Policy.
def policy_create(request, **kwargs): """Create a QoS Policy. :param request: request context :param name: name of the policy :param description: description of policy :param shared: boolean (true or false) :return: QoSPolicy object """ body = {'policy': kwargs} policy = neutronclie...
[ "def", "policy_create", "(", "request", ",", "*", "*", "kwargs", ")", ":", "body", "=", "{", "'policy'", ":", "kwargs", "}", "policy", "=", "neutronclient", "(", "request", ")", ".", "create_qos_policy", "(", "body", "=", "body", ")", ".", "get", "(", ...
[ 1993, 0 ]
[ 2004, 28 ]
python
en
['en', 'en', 'en']
True
policy_list
(request, **kwargs)
List of QoS Policies.
List of QoS Policies.
def policy_list(request, **kwargs): """List of QoS Policies.""" policies = neutronclient(request).list_qos_policies( **kwargs).get('policies') return [QoSPolicy(p) for p in policies]
[ "def", "policy_list", "(", "request", ",", "*", "*", "kwargs", ")", ":", "policies", "=", "neutronclient", "(", "request", ")", ".", "list_qos_policies", "(", "*", "*", "kwargs", ")", ".", "get", "(", "'policies'", ")", "return", "[", "QoSPolicy", "(", ...
[ 2007, 0 ]
[ 2011, 43 ]
python
en
['en', 'en', 'en']
True
policy_get
(request, policy_id, **kwargs)
Get QoS policy for a given policy id.
Get QoS policy for a given policy id.
def policy_get(request, policy_id, **kwargs): """Get QoS policy for a given policy id.""" policy = neutronclient(request).show_qos_policy( policy_id, **kwargs).get('policy') return QoSPolicy(policy)
[ "def", "policy_get", "(", "request", ",", "policy_id", ",", "*", "*", "kwargs", ")", ":", "policy", "=", "neutronclient", "(", "request", ")", ".", "show_qos_policy", "(", "policy_id", ",", "*", "*", "kwargs", ")", ".", "get", "(", "'policy'", ")", "re...
[ 2015, 0 ]
[ 2019, 28 ]
python
en
['en', 'en', 'en']
True
policy_delete
(request, policy_id)
Delete QoS policy for a given policy id.
Delete QoS policy for a given policy id.
def policy_delete(request, policy_id): """Delete QoS policy for a given policy id.""" neutronclient(request).delete_qos_policy(policy_id)
[ "def", "policy_delete", "(", "request", ",", "policy_id", ")", ":", "neutronclient", "(", "request", ")", ".", "delete_qos_policy", "(", "policy_id", ")" ]
[ 2023, 0 ]
[ 2025, 55 ]
python
en
['en', 'en', 'en']
True
rbac_policy_create
(request, **kwargs)
Create a RBAC Policy. :param request: request context :param target_tenant: target tenant of the policy :param tenant_id: owner tenant of the policy(Not recommended) :param object_type: network or qos_policy :param object_id: object id of policy :param action: access_as_shared or access_as_exte...
Create a RBAC Policy.
def rbac_policy_create(request, **kwargs): """Create a RBAC Policy. :param request: request context :param target_tenant: target tenant of the policy :param tenant_id: owner tenant of the policy(Not recommended) :param object_type: network or qos_policy :param object_id: object id of policy ...
[ "def", "rbac_policy_create", "(", "request", ",", "*", "*", "kwargs", ")", ":", "body", "=", "{", "'rbac_policy'", ":", "kwargs", "}", "rbac_policy", "=", "neutronclient", "(", "request", ")", ".", "create_rbac_policy", "(", "body", "=", "body", ")", ".", ...
[ 2044, 0 ]
[ 2058, 34 ]
python
en
['en', 'haw', 'en']
True
rbac_policy_list
(request, **kwargs)
List of RBAC Policies.
List of RBAC Policies.
def rbac_policy_list(request, **kwargs): """List of RBAC Policies.""" policies = neutronclient(request).list_rbac_policies( **kwargs).get('rbac_policies') return [RBACPolicy(p) for p in policies]
[ "def", "rbac_policy_list", "(", "request", ",", "*", "*", "kwargs", ")", ":", "policies", "=", "neutronclient", "(", "request", ")", ".", "list_rbac_policies", "(", "*", "*", "kwargs", ")", ".", "get", "(", "'rbac_policies'", ")", "return", "[", "RBACPolic...
[ 2061, 0 ]
[ 2065, 44 ]
python
en
['en', 'af', 'en']
True
rbac_policy_update
(request, policy_id, **kwargs)
Update a RBAC Policy. :param request: request context :param policy_id: target policy id :param target_tenant: target tenant of the policy :return: RBACPolicy object
Update a RBAC Policy.
def rbac_policy_update(request, policy_id, **kwargs): """Update a RBAC Policy. :param request: request context :param policy_id: target policy id :param target_tenant: target tenant of the policy :return: RBACPolicy object """ body = {'rbac_policy': kwargs} rbac_policy = neutronclient(r...
[ "def", "rbac_policy_update", "(", "request", ",", "policy_id", ",", "*", "*", "kwargs", ")", ":", "body", "=", "{", "'rbac_policy'", ":", "kwargs", "}", "rbac_policy", "=", "neutronclient", "(", "request", ")", ".", "update_rbac_policy", "(", "policy_id", ",...
[ 2068, 0 ]
[ 2079, 34 ]
python
en
['en', 'co', 'en']
True
rbac_policy_get
(request, policy_id, **kwargs)
Get RBAC policy for a given policy id.
Get RBAC policy for a given policy id.
def rbac_policy_get(request, policy_id, **kwargs): """Get RBAC policy for a given policy id.""" policy = neutronclient(request).show_rbac_policy( policy_id, **kwargs).get('rbac_policy') return RBACPolicy(policy)
[ "def", "rbac_policy_get", "(", "request", ",", "policy_id", ",", "*", "*", "kwargs", ")", ":", "policy", "=", "neutronclient", "(", "request", ")", ".", "show_rbac_policy", "(", "policy_id", ",", "*", "*", "kwargs", ")", ".", "get", "(", "'rbac_policy'", ...
[ 2083, 0 ]
[ 2087, 29 ]
python
en
['en', 'en', 'en']
True
rbac_policy_delete
(request, policy_id)
Delete RBAC policy for a given policy id.
Delete RBAC policy for a given policy id.
def rbac_policy_delete(request, policy_id): """Delete RBAC policy for a given policy id.""" neutronclient(request).delete_rbac_policy(policy_id)
[ "def", "rbac_policy_delete", "(", "request", ",", "policy_id", ")", ":", "neutronclient", "(", "request", ")", ".", "delete_rbac_policy", "(", "policy_id", ")" ]
[ 2091, 0 ]
[ 2093, 56 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.list
(self, **params)
Fetches a list all security groups. :returns: List of SecurityGroup objects
Fetches a list all security groups.
def list(self, **params): """Fetches a list all security groups. :returns: List of SecurityGroup objects """ # This is to ensure tenant_id key is not populated # if tenant_id=None is specified. tenant_id = params.pop('tenant_id', self.request.user.tenant_id) if t...
[ "def", "list", "(", "self", ",", "*", "*", "params", ")", ":", "# This is to ensure tenant_id key is not populated", "# if tenant_id=None is specified.", "tenant_id", "=", "params", ".", "pop", "(", "'tenant_id'", ",", "self", ".", "request", ".", "user", ".", "te...
[ 372, 4 ]
[ 382, 35 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager._sg_name_dict
(self, sg_id, rules)
Create a mapping dict from secgroup id to its name.
Create a mapping dict from secgroup id to its name.
def _sg_name_dict(self, sg_id, rules): """Create a mapping dict from secgroup id to its name.""" related_ids = set([sg_id]) related_ids |= set(filter(None, [r['remote_group_id'] for r in rules])) related_sgs = self.client.list_security_groups(id=related_ids, ...
[ "def", "_sg_name_dict", "(", "self", ",", "sg_id", ",", "rules", ")", ":", "related_ids", "=", "set", "(", "[", "sg_id", "]", ")", "related_ids", "|=", "set", "(", "filter", "(", "None", ",", "[", "r", "[", "'remote_group_id'", "]", "for", "r", "in",...
[ 384, 4 ]
[ 391, 65 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.get
(self, sg_id)
Fetches the security group. :returns: SecurityGroup object corresponding to sg_id
Fetches the security group.
def get(self, sg_id): """Fetches the security group. :returns: SecurityGroup object corresponding to sg_id """ secgroup = self.client.show_security_group(sg_id).get('security_group') sg_dict = self._sg_name_dict(sg_id, secgroup['security_group_rules']) return SecurityGro...
[ "def", "get", "(", "self", ",", "sg_id", ")", ":", "secgroup", "=", "self", ".", "client", ".", "show_security_group", "(", "sg_id", ")", ".", "get", "(", "'security_group'", ")", "sg_dict", "=", "self", ".", "_sg_name_dict", "(", "sg_id", ",", "secgroup...
[ 394, 4 ]
[ 401, 47 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.create
(self, name, desc)
Create a new security group. :returns: SecurityGroup object created
Create a new security group.
def create(self, name, desc): """Create a new security group. :returns: SecurityGroup object created """ body = {'security_group': {'name': name, 'description': desc, 'tenant_id': self.request.user.project_id}} ...
[ "def", "create", "(", "self", ",", "name", ",", "desc", ")", ":", "body", "=", "{", "'security_group'", ":", "{", "'name'", ":", "name", ",", "'description'", ":", "desc", ",", "'tenant_id'", ":", "self", ".", "request", ".", "user", ".", "project_id",...
[ 404, 4 ]
[ 413, 60 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.delete
(self, sg_id)
Delete the specified security group.
Delete the specified security group.
def delete(self, sg_id): """Delete the specified security group.""" self.client.delete_security_group(sg_id)
[ "def", "delete", "(", "self", ",", "sg_id", ")", ":", "self", ".", "client", ".", "delete_security_group", "(", "sg_id", ")" ]
[ 423, 4 ]
[ 425, 48 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.rule_create
(self, parent_group_id, direction=None, ethertype=None, ip_protocol=None, from_port=None, to_port=None, cidr=None, group_id=None, description=None)
Create a new security group rule. :param parent_group_id: security group id a rule is created to :param direction: ``ingress`` or ``egress`` :param ethertype: ``IPv4`` or ``IPv6`` :param ip_protocol: tcp, udp, icmp :param from_port: L4 port range min :param to_port: L4 p...
Create a new security group rule.
def rule_create(self, parent_group_id, direction=None, ethertype=None, ip_protocol=None, from_port=None, to_port=None, cidr=None, group_id=None, description=None): """Create a new security group rule. :param parent_group_id: security group id ...
[ "def", "rule_create", "(", "self", ",", "parent_group_id", ",", "direction", "=", "None", ",", "ethertype", "=", "None", ",", "ip_protocol", "=", "None", ",", "from_port", "=", "None", ",", "to_port", "=", "None", ",", "cidr", "=", "None", ",", "group_id...
[ 428, 4 ]
[ 474, 47 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.rule_delete
(self, sgr_id)
Delete the specified security group rule.
Delete the specified security group rule.
def rule_delete(self, sgr_id): """Delete the specified security group rule.""" self.client.delete_security_group_rule(sgr_id)
[ "def", "rule_delete", "(", "self", ",", "sgr_id", ")", ":", "self", ".", "client", ".", "delete_security_group_rule", "(", "sgr_id", ")" ]
[ 477, 4 ]
[ 479, 54 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.list_by_instance
(self, instance_id)
Gets security groups of an instance. :returns: List of SecurityGroup objects associated with the instance
Gets security groups of an instance.
def list_by_instance(self, instance_id): """Gets security groups of an instance. :returns: List of SecurityGroup objects associated with the instance """ ports = port_list(self.request, device_id=instance_id) sg_ids = [] for p in ports: sg_ids += p.security_g...
[ "def", "list_by_instance", "(", "self", ",", "instance_id", ")", ":", "ports", "=", "port_list", "(", "self", ".", "request", ",", "device_id", "=", "instance_id", ")", "sg_ids", "=", "[", "]", "for", "p", "in", "ports", ":", "sg_ids", "+=", "p", ".", ...
[ 482, 4 ]
[ 491, 59 ]
python
en
['en', 'en', 'en']
True
SecurityGroupManager.update_instance_security_group
(self, instance_id, new_security_group_ids)
Update security groups of a specified instance.
Update security groups of a specified instance.
def update_instance_security_group(self, instance_id, new_security_group_ids): """Update security groups of a specified instance.""" ports = port_list(self.request, device_id=instance_id) for p in ports: params = {'security_groups': new_security...
[ "def", "update_instance_security_group", "(", "self", ",", "instance_id", ",", "new_security_group_ids", ")", ":", "ports", "=", "port_list", "(", "self", ".", "request", ",", "device_id", "=", "instance_id", ")", "for", "p", "in", "ports", ":", "params", "=",...
[ 494, 4 ]
[ 500, 53 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.list_pools
(self)
Fetches a list of all floating IP pools. :returns: List of FloatingIpPool objects
Fetches a list of all floating IP pools.
def list_pools(self): """Fetches a list of all floating IP pools. :returns: List of FloatingIpPool objects """ search_opts = {'router:external': True} filter_provider = getattr(settings, 'NECTAR_NETWORK_PROVIDER_FILTER', False) if filter...
[ "def", "list_pools", "(", "self", ")", ":", "search_opts", "=", "{", "'router:external'", ":", "True", "}", "filter_provider", "=", "getattr", "(", "settings", ",", "'NECTAR_NETWORK_PROVIDER_FILTER'", ",", "False", ")", "if", "filter_provider", ":", "search_opts",...
[ 564, 4 ]
[ 575, 76 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.list
(self, all_tenants=False, **search_opts)
Fetches a list of all floating IPs. :returns: List of FloatingIp object
Fetches a list of all floating IPs.
def list(self, all_tenants=False, **search_opts): """Fetches a list of all floating IPs. :returns: List of FloatingIp object """ if not all_tenants: tenant_id = self.request.user.tenant_id # In Neutron, list_floatingips returns Floating IPs from # all...
[ "def", "list", "(", "self", ",", "all_tenants", "=", "False", ",", "*", "*", "search_opts", ")", ":", "if", "not", "all_tenants", ":", "tenant_id", "=", "self", ".", "request", ".", "user", ".", "tenant_id", "# In Neutron, list_floatingips returns Floating IPs f...
[ 595, 4 ]
[ 617, 48 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.get
(self, floating_ip_id)
Fetches the floating IP. :returns: FloatingIp object corresponding to floating_ip_id
Fetches the floating IP.
def get(self, floating_ip_id): """Fetches the floating IP. :returns: FloatingIp object corresponding to floating_ip_id """ fip = self.client.show_floatingip(floating_ip_id).get('floatingip') self._set_instance_info(fip) return FloatingIp(fip)
[ "def", "get", "(", "self", ",", "floating_ip_id", ")", ":", "fip", "=", "self", ".", "client", ".", "show_floatingip", "(", "floating_ip_id", ")", ".", "get", "(", "'floatingip'", ")", "self", ".", "_set_instance_info", "(", "fip", ")", "return", "Floating...
[ 620, 4 ]
[ 627, 30 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.allocate
(self, pool, tenant_id=None, **params)
Allocates a floating IP to the tenant. You must provide a pool name or id for which you would like to allocate a floating IP. :returns: FloatingIp object corresponding to an allocated floating IP
Allocates a floating IP to the tenant.
def allocate(self, pool, tenant_id=None, **params): """Allocates a floating IP to the tenant. You must provide a pool name or id for which you would like to allocate a floating IP. :returns: FloatingIp object corresponding to an allocated floating IP """ if not tenant_i...
[ "def", "allocate", "(", "self", ",", "pool", ",", "tenant_id", "=", "None", ",", "*", "*", "params", ")", ":", "if", "not", "tenant_id", ":", "tenant_id", "=", "self", ".", "request", ".", "user", ".", "project_id", "create_dict", "=", "{", "'floating_...
[ 630, 4 ]
[ 655, 30 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.release
(self, floating_ip_id)
Releases a floating IP specified.
Releases a floating IP specified.
def release(self, floating_ip_id): """Releases a floating IP specified.""" self.client.delete_floatingip(floating_ip_id)
[ "def", "release", "(", "self", ",", "floating_ip_id", ")", ":", "self", ".", "client", ".", "delete_floatingip", "(", "floating_ip_id", ")" ]
[ 658, 4 ]
[ 660, 53 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.associate
(self, floating_ip_id, port_id)
Associates the floating IP to the port. ``port_id`` represents a VNIC of an instance. ``port_id`` argument is different from a normal neutron port ID. A value passed as ``port_id`` must be one of target_id returned by ``list_targets``, ``get_target_by_instance`` or ``list_target...
Associates the floating IP to the port.
def associate(self, floating_ip_id, port_id): """Associates the floating IP to the port. ``port_id`` represents a VNIC of an instance. ``port_id`` argument is different from a normal neutron port ID. A value passed as ``port_id`` must be one of target_id returned by ``list_targe...
[ "def", "associate", "(", "self", ",", "floating_ip_id", ",", "port_id", ")", ":", "# NOTE: In Neutron Horizon floating IP support, port_id is", "# \"<port_id>_<ip_address>\" format to identify multiple ports.", "pid", ",", "ip_address", "=", "port_id", ".", "split", "(", "'_'...
[ 663, 4 ]
[ 678, 66 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.disassociate
(self, floating_ip_id)
Disassociates the floating IP specified.
Disassociates the floating IP specified.
def disassociate(self, floating_ip_id): """Disassociates the floating IP specified.""" update_dict = {'port_id': None} self.client.update_floatingip(floating_ip_id, {'floatingip': update_dict})
[ "def", "disassociate", "(", "self", ",", "floating_ip_id", ")", ":", "update_dict", "=", "{", "'port_id'", ":", "None", "}", "self", ".", "client", ".", "update_floatingip", "(", "floating_ip_id", ",", "{", "'floatingip'", ":", "update_dict", "}", ")" ]
[ 681, 4 ]
[ 685, 66 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.list_targets
(self)
Returns a list of association targets of instance VIFs. Each association target is represented as FloatingIpTarget object. FloatingIpTarget is a APIResourceWrapper/APIDictWrapper and 'id' and 'name' attributes must be defined in each object. FloatingIpTarget.id can be passed as port_id ...
Returns a list of association targets of instance VIFs.
def list_targets(self): """Returns a list of association targets of instance VIFs. Each association target is represented as FloatingIpTarget object. FloatingIpTarget is a APIResourceWrapper/APIDictWrapper and 'id' and 'name' attributes must be defined in each object. FloatingIp...
[ "def", "list_targets", "(", "self", ")", ":", "tenant_id", "=", "self", ".", "request", ".", "user", ".", "tenant_id", "ports", "=", "port_list", "(", "self", ".", "request", ",", "tenant_id", "=", "tenant_id", ")", "servers", ",", "has_more", "=", "nova...
[ 720, 4 ]
[ 751, 22 ]
python
en
['en', 'lb', 'en']
True
FloatingIpManager.list_targets_by_instance
(self, instance_id, target_list=None)
Returns a list of FloatingIpTarget objects of FIP association. :param instance_id: ID of target VM instance :param target_list: (optional) a list returned by list_targets(). If specified, looking up is done against the specified list to save extra API calls to a back-end. Otherw...
Returns a list of FloatingIpTarget objects of FIP association.
def list_targets_by_instance(self, instance_id, target_list=None): """Returns a list of FloatingIpTarget objects of FIP association. :param instance_id: ID of target VM instance :param target_list: (optional) a list returned by list_targets(). If specified, looking up is done agains...
[ "def", "list_targets_by_instance", "(", "self", ",", "instance_id", ",", "target_list", "=", "None", ")", ":", "if", "target_list", "is", "not", "None", ":", "# We assume that target_list was returned by list_targets()", "# so we can assume checks for subnet reachability and IP...
[ 760, 4 ]
[ 789, 26 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.is_simple_associate_supported
(self)
Returns True if the default floating IP pool is enabled.
Returns True if the default floating IP pool is enabled.
def is_simple_associate_supported(self): """Returns True if the default floating IP pool is enabled.""" # NOTE: There are two reason that simple association support # needs more considerations. (1) Neutron does not support the # default floating IP pool at the moment. It can be avoided ...
[ "def", "is_simple_associate_supported", "(", "self", ")", ":", "# NOTE: There are two reason that simple association support", "# needs more considerations. (1) Neutron does not support the", "# default floating IP pool at the moment. It can be avoided", "# in case where only one floating IP pool ...
[ 798, 4 ]
[ 807, 20 ]
python
en
['en', 'en', 'en']
True
FloatingIpManager.is_supported
(self)
Returns True if floating IP feature is supported.
Returns True if floating IP feature is supported.
def is_supported(self): """Returns True if floating IP feature is supported.""" return setting_utils.get_dict_config( 'OPENSTACK_NEUTRON_NETWORK', 'enable_router')
[ "def", "is_supported", "(", "self", ")", ":", "return", "setting_utils", ".", "get_dict_config", "(", "'OPENSTACK_NEUTRON_NETWORK'", ",", "'enable_router'", ")" ]
[ 809, 4 ]
[ 812, 57 ]
python
en
['en', 'en', 'en']
True
make_headers
( keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None, )
Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used as p...
Shortcuts for generating request headers.
def make_headers( keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None, ): """ Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_enc...
[ "def", "make_headers", "(", "keep_alive", "=", "None", ",", "accept_encoding", "=", "None", ",", "user_agent", "=", "None", ",", "basic_auth", "=", "None", ",", "proxy_basic_auth", "=", "None", ",", "disable_cache", "=", "None", ",", ")", ":", "headers", "...
[ 17, 0 ]
[ 86, 18 ]
python
en
['en', 'error', 'th']
False
set_file_position
(body, pos)
If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use.
If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use.
def set_file_position(body, pos): """ If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use. """ if pos is not None: rewind_body(body, pos) elif getattr(body, "tell", None) is not None: try: pos = body.tell() ...
[ "def", "set_file_position", "(", "body", ",", "pos", ")", ":", "if", "pos", "is", "not", "None", ":", "rewind_body", "(", "body", ",", "pos", ")", "elif", "getattr", "(", "body", ",", "\"tell\"", ",", "None", ")", "is", "not", "None", ":", "try", "...
[ 89, 0 ]
[ 104, 14 ]
python
en
['en', 'error', 'th']
False
rewind_body
(body, body_pos)
Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file.
Attempt to rewind body to a certain position. Primarily used for request redirects and retries.
def rewind_body(body, body_pos): """ Attempt to rewind body to a certain position. Primarily used for request redirects and retries. :param body: File-like object that supports seek. :param int pos: Position to seek to in file. """ body_seek = getattr(body, "seek", None) ...
[ "def", "rewind_body", "(", "body", ",", "body_pos", ")", ":", "body_seek", "=", "getattr", "(", "body", ",", "\"seek\"", ",", "None", ")", "if", "body_seek", "is", "not", "None", "and", "isinstance", "(", "body_pos", ",", "integer_types", ")", ":", "try"...
[ 107, 0 ]
[ 134, 9 ]
python
en
['en', 'error', 'th']
False
BaseFunction._prepare
(self)
Метод содержащий все действия работы функции
Метод содержащий все действия работы функции
def _prepare(self): """ Метод содержащий все действия работы функции """
[ "def", "_prepare", "(", "self", ")", ":" ]
[ 55, 4 ]
[ 58, 11 ]
python
en
['en', 'error', 'th']
False
BaseFunction.run
(self)
Контрактный метод служащий для запуска функции
Контрактный метод служащий для запуска функции
def run(self): """ Контрактный метод служащий для запуска функции """ self._prepare()
[ "def", "run", "(", "self", ")", ":", "self", ".", "_prepare", "(", ")" ]
[ 60, 4 ]
[ 64, 23 ]
python
en
['en', 'error', 'th']
False
LazySavingFunction.__init__
(self, *args, ignore_errors_on_saving: bool = False, **kwargs)
Инициализация функции с отложенным сохранением Args: ignore_errors_on_saving Указывает на игнорирование наличия ошибок при выполнении запроса и необходимость сохранения результата в БД в любом случае
Инициализация функции с отложенным сохранением
def __init__(self, *args, ignore_errors_on_saving: bool = False, **kwargs): """ Инициализация функции с отложенным сохранением Args: ignore_errors_on_saving Указывает на игнорирование наличия ошибок при выполнении запроса и необходимость сохранения результата в БД в любо...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "ignore_errors_on_saving", ":", "bool", "=", "False", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_ignore_errors_on_saving", "=", "ignore_errors_on_saving", "super", "(", ")", ".", "__init__", "(", ...
[ 76, 4 ]
[ 86, 41 ]
python
en
['en', 'error', 'th']
False
LazySavingFunction.do_on_save
(self, object_)
Добавление действия на момент сохранения Принимает действие (список, экземпляр модели, функция)
Добавление действия на момент сохранения
def do_on_save(self, object_): """ Добавление действия на момент сохранения Принимает действие (список, экземпляр модели, функция) """ if isinstance(object_, (Iterable, Sequence)): for act in object_: self.do_on_save(act) else: sel...
[ "def", "do_on_save", "(", "self", ",", "object_", ")", ":", "if", "isinstance", "(", "object_", ",", "(", "Iterable", ",", "Sequence", ")", ")", ":", "for", "act", "in", "object_", ":", "self", ".", "do_on_save", "(", "act", ")", "else", ":", "self",...
[ 88, 4 ]
[ 98, 47 ]
python
en
['en', 'error', 'th']
False
LazySavingFunction.run
(self)
Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок или явном указании игнорирования ошибок при сохранении
Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок или явном указании игнорирования ошибок при сохранении
def run(self): """ Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок или явном указании игнорирования ошибок при сохранении """ self._prepare() if self._ignore_errors_on_saving or self.result.has_not_errors: self.do_sa...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_prepare", "(", ")", "if", "self", ".", "_ignore_errors_on_saving", "or", "self", ".", "result", ".", "has_not_errors", ":", "self", ".", "do_save", "(", ")" ]
[ 100, 4 ]
[ 108, 26 ]
python
en
['en', 'error', 'th']
False
LazyDelegateSavingPredefinedQueueFunction.do_save
(self)
Выполнение сохранения объектов в зависимости от признака глобального сохранения создаваемых объектов функции.
Выполнение сохранения объектов в зависимости от признака глобального сохранения создаваемых объектов функции.
def do_save(self): """ Выполнение сохранения объектов в зависимости от признака глобального сохранения создаваемых объектов функции. """ self._do_save_objects_queue()
[ "def", "do_save", "(", "self", ")", ":", "self", ".", "_do_save_objects_queue", "(", ")" ]
[ 154, 4 ]
[ 159, 37 ]
python
en
['en', 'error', 'th']
False
LazyDelegateSavingPredefinedQueueFunction.run
(self)
Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок и локальном сохранении
Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок и локальном сохранении
def run(self): """ Выполнение действий функции с дальнейшим сохранением объектов в базу при отсутствии ошибок и локальном сохранении """ self._prepare()
[ "def", "run", "(", "self", ")", ":", "self", ".", "_prepare", "(", ")" ]
[ 161, 4 ]
[ 166, 23 ]
python
en
['en', 'error', 'th']
False
LazySavingSettableQueueFunction.set_queue_to_save
(self, queue_to_save)
Установка очереди на сохранение
Установка очереди на сохранение
def set_queue_to_save(self, queue_to_save): """ Установка очереди на сохранение """ self._queue_to_save = queue_to_save
[ "def", "set_queue_to_save", "(", "self", ",", "queue_to_save", ")", ":", "self", ".", "_queue_to_save", "=", "queue_to_save" ]
[ 206, 4 ]
[ 210, 43 ]
python
en
['en', 'error', 'th']
False
LazyDelegateSavingSettableQueueFunction.do_save
(self)
Сохранение делегировано на уровень пусковика
Сохранение делегировано на уровень пусковика
def do_save(self): """ Сохранение делегировано на уровень пусковика """
[ "def", "do_save", "(", "self", ")", ":" ]
[ 243, 4 ]
[ 246, 11 ]
python
en
['en', 'error', 'th']
False
LazyDelegateSavingSettableQueueFunction.run
(self)
Выполнение действий функции с дальнейшим сохранением объектов
Выполнение действий функции с дальнейшим сохранением объектов
def run(self): """ Выполнение действий функции с дальнейшим сохранением объектов """ self._prepare()
[ "def", "run", "(", "self", ")", ":", "self", ".", "_prepare", "(", ")" ]
[ 248, 4 ]
[ 252, 23 ]
python
en
['en', 'error', 'th']
False
_setoption
(wmod, arg)
Copy of the warning._setoption function but does not escape arguments.
Copy of the warning._setoption function but does not escape arguments.
def _setoption(wmod, arg): """ Copy of the warning._setoption function but does not escape arguments. """ parts = arg.split(':') if len(parts) > 5: raise wmod._OptionError("too many fields (max 5): %r" % (arg,)) while len(parts) < 5: parts.append('') action, message, category...
[ "def", "_setoption", "(", "wmod", ",", "arg", ")", ":", "parts", "=", "arg", ".", "split", "(", "':'", ")", "if", "len", "(", "parts", ")", ">", "5", ":", "raise", "wmod", ".", "_OptionError", "(", "\"too many fields (max 5): %r\"", "%", "(", "arg", ...
[ 10, 0 ]
[ 32, 66 ]
python
en
['en', 'error', 'th']
False
catch_warnings_for_item
(item)
catches the warnings generated during setup/call/teardown execution of the given item and after it is done posts them as warnings to this item.
catches the warnings generated during setup/call/teardown execution of the given item and after it is done posts them as warnings to this item.
def catch_warnings_for_item(item): """ catches the warnings generated during setup/call/teardown execution of the given item and after it is done posts them as warnings to this item. """ args = item.config.getoption('pythonwarnings') or [] inifilters = item.config.getini("filterwarnings") ...
[ "def", "catch_warnings_for_item", "(", "item", ")", ":", "args", "=", "item", ".", "config", ".", "getoption", "(", "'pythonwarnings'", ")", "or", "[", "]", "inifilters", "=", "item", ".", "config", ".", "getini", "(", "\"filterwarnings\"", ")", "with", "w...
[ 47, 0 ]
[ 89, 35 ]
python
en
['en', 'error', 'th']
False
_implementation
()
Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and PyPy: in particular, it probably...
Return a dict with the Python implementation and version.
def _implementation(): """Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 2.7.5 it will return {'name': 'CPython', 'version': '2.7.5'}. This function works best on CPython and Py...
[ "def", "_implementation", "(", ")", ":", "implementation", "=", "platform", ".", "python_implementation", "(", ")", "if", "implementation", "==", "'CPython'", ":", "implementation_version", "=", "platform", ".", "python_version", "(", ")", "elif", "implementation", ...
[ 25, 0 ]
[ 55, 70 ]
python
en
['en', 'en', 'en']
True
info
()
Generate information for a bug report.
Generate information for a bug report.
def info(): """Generate information for a bug report.""" try: platform_info = { 'system': platform.system(), 'release': platform.release(), } except IOError: platform_info = { 'system': 'Unknown', 'release': 'Unknown', } im...
[ "def", "info", "(", ")", ":", "try", ":", "platform_info", "=", "{", "'system'", ":", "platform", ".", "system", "(", ")", ",", "'release'", ":", "platform", ".", "release", "(", ")", ",", "}", "except", "IOError", ":", "platform_info", "=", "{", "'s...
[ 58, 0 ]
[ 109, 5 ]
python
en
['en', 'en', 'en']
True
main
()
Pretty-print the bug information as JSON.
Pretty-print the bug information as JSON.
def main(): """Pretty-print the bug information as JSON.""" print(json.dumps(info(), sort_keys=True, indent=2))
[ "def", "main", "(", ")", ":", "print", "(", "json", ".", "dumps", "(", "info", "(", ")", ",", "sort_keys", "=", "True", ",", "indent", "=", "2", ")", ")" ]
[ 112, 0 ]
[ 114, 55 ]
python
en
['en', 'en', 'en']
True
Core.process
(self, content)
Process (marshal) the tag with the specified value using the optional type information. @param content: The content to process. @type content: L{Object}
Process (marshal) the tag with the specified value using the optional type information.
def process(self, content): """ Process (marshal) the tag with the specified value using the optional type information. @param content: The content to process. @type content: L{Object} """ log.debug('processing:\n%s', content) self.reset() if conte...
[ "def", "process", "(", "self", ",", "content", ")", ":", "log", ".", "debug", "(", "'processing:\\n%s'", ",", "content", ")", "self", ".", "reset", "(", ")", "if", "content", ".", "tag", "is", "None", ":", "content", ".", "tag", "=", "content", ".", ...
[ 45, 4 ]
[ 62, 30 ]
python
en
['en', 'error', 'th']
False
Core.append
(self, parent, content)
Append the specified L{content} to the I{parent}. @param parent: The parent node to append to. @type parent: L{Element} @param content: The content to append. @type content: L{Object}
Append the specified L{content} to the I{parent}.
def append(self, parent, content): """ Append the specified L{content} to the I{parent}. @param parent: The parent node to append to. @type parent: L{Element} @param content: The content to append. @type content: L{Object} """ log.debug('appending parent:\...
[ "def", "append", "(", "self", ",", "parent", ",", "content", ")", ":", "log", ".", "debug", "(", "'appending parent:\\n%s\\ncontent:\\n%s'", ",", "parent", ",", "content", ")", "if", "self", ".", "start", "(", "content", ")", ":", "self", ".", "appender", ...
[ 64, 4 ]
[ 75, 37 ]
python
en
['en', 'error', 'th']
False
Core.reset
(self)
Reset the marshaller.
Reset the marshaller.
def reset(self): """ Reset the marshaller. """ pass
[ "def", "reset", "(", "self", ")", ":", "pass" ]
[ 77, 4 ]
[ 81, 12 ]
python
en
['en', 'error', 'th']
False
Core.node
(self, content)
Create and return an XML node. @param content: The content for which proccessing has been suspended. @type content: L{Object} @return: An element. @rtype: L{Element}
Create and return an XML node.
def node(self, content): """ Create and return an XML node. @param content: The content for which proccessing has been suspended. @type content: L{Object} @return: An element. @rtype: L{Element} """ return Element(content.tag)
[ "def", "node", "(", "self", ",", "content", ")", ":", "return", "Element", "(", "content", ".", "tag", ")" ]
[ 83, 4 ]
[ 91, 35 ]
python
en
['en', 'error', 'th']
False
Core.start
(self, content)
Appending this content has started. @param content: The content for which proccessing has started. @type content: L{Content} @return: True to continue appending @rtype: boolean
Appending this content has started.
def start(self, content): """ Appending this content has started. @param content: The content for which proccessing has started. @type content: L{Content} @return: True to continue appending @rtype: boolean """ return True
[ "def", "start", "(", "self", ",", "content", ")", ":", "return", "True" ]
[ 93, 4 ]
[ 101, 19 ]
python
en
['en', 'error', 'th']
False
Core.suspend
(self, content)
Appending this content has suspended. @param content: The content for which proccessing has been suspended. @type content: L{Content}
Appending this content has suspended.
def suspend(self, content): """ Appending this content has suspended. @param content: The content for which proccessing has been suspended. @type content: L{Content} """ pass
[ "def", "suspend", "(", "self", ",", "content", ")", ":", "pass" ]
[ 103, 4 ]
[ 109, 12 ]
python
en
['en', 'error', 'th']
False
Core.resume
(self, content)
Appending this content has resumed. @param content: The content for which proccessing has been resumed. @type content: L{Content}
Appending this content has resumed.
def resume(self, content): """ Appending this content has resumed. @param content: The content for which proccessing has been resumed. @type content: L{Content} """ pass
[ "def", "resume", "(", "self", ",", "content", ")", ":", "pass" ]
[ 111, 4 ]
[ 117, 12 ]
python
en
['en', 'error', 'th']
False
Core.end
(self, parent, content)
Appending this content has ended. @param parent: The parent node ending. @type parent: L{Element} @param content: The content for which proccessing has ended. @type content: L{Content}
Appending this content has ended.
def end(self, parent, content): """ Appending this content has ended. @param parent: The parent node ending. @type parent: L{Element} @param content: The content for which proccessing has ended. @type content: L{Content} """ pass
[ "def", "end", "(", "self", ",", "parent", ",", "content", ")", ":", "pass" ]
[ 119, 4 ]
[ 127, 12 ]
python
en
['en', 'error', 'th']
False
Core.setnil
(self, node, content)
Set the value of the I{node} to nill. @param node: A I{nil} node. @type node: L{Element} @param content: The content to set nil. @type content: L{Content}
Set the value of the I{node} to nill.
def setnil(self, node, content): """ Set the value of the I{node} to nill. @param node: A I{nil} node. @type node: L{Element} @param content: The content to set nil. @type content: L{Content} """ pass
[ "def", "setnil", "(", "self", ",", "node", ",", "content", ")", ":", "pass" ]
[ 129, 4 ]
[ 137, 12 ]
python
en
['en', 'error', 'th']
False
Core.setdefault
(self, node, content)
Set the value of the I{node} to a default value. @param node: A I{nil} node. @type node: L{Element} @param content: The content to set the default value. @type content: L{Content} @return: The default.
Set the value of the I{node} to a default value.
def setdefault(self, node, content): """ Set the value of the I{node} to a default value. @param node: A I{nil} node. @type node: L{Element} @param content: The content to set the default value. @type content: L{Content} @return: The default. """ p...
[ "def", "setdefault", "(", "self", ",", "node", ",", "content", ")", ":", "pass" ]
[ 139, 4 ]
[ 148, 12 ]
python
en
['en', 'error', 'th']
False
Core.optional
(self, content)
Get whether the specified content is optional. @param content: The content which to check. @type content: L{Content}
Get whether the specified content is optional.
def optional(self, content): """ Get whether the specified content is optional. @param content: The content which to check. @type content: L{Content} """ return False
[ "def", "optional", "(", "self", ",", "content", ")", ":", "return", "False" ]
[ 150, 4 ]
[ 156, 20 ]
python
en
['en', 'error', 'th']
False
matchmark
(colitem, markexpr)
Tries to match on any marker names, attached to the given colitem.
Tries to match on any marker names, attached to the given colitem.
def matchmark(colitem, markexpr): """Tries to match on any marker names, attached to the given colitem.""" return eval(markexpr, {}, MarkMapping.from_keywords(colitem.keywords))
[ "def", "matchmark", "(", "colitem", ",", "markexpr", ")", ":", "return", "eval", "(", "markexpr", ",", "{", "}", ",", "MarkMapping", ".", "from_keywords", "(", "colitem", ".", "keywords", ")", ")" ]
[ 246, 0 ]
[ 248, 74 ]
python
en
['en', 'en', 'en']
True
matchkeyword
(colitem, keywordexpr)
Tries to match given keyword expression to given collector item. Will match on the name of colitem, including the names of its parents. Only matches names of items which are either a :class:`Class` or a :class:`Function`. Additionally, matches on names in the 'extra_keyword_matches' set of any item...
Tries to match given keyword expression to given collector item.
def matchkeyword(colitem, keywordexpr): """Tries to match given keyword expression to given collector item. Will match on the name of colitem, including the names of its parents. Only matches names of items which are either a :class:`Class` or a :class:`Function`. Additionally, matches on names in ...
[ "def", "matchkeyword", "(", "colitem", ",", "keywordexpr", ")", ":", "mapped_names", "=", "set", "(", ")", "# Add the names of the current item and any parent items", "import", "pytest", "for", "item", "in", "colitem", ".", "listchain", "(", ")", ":", "if", "not",...
[ 251, 0 ]
[ 289, 83 ]
python
en
['en', 'en', 'en']
True
get_unpacked_marks
(obj)
obtain the unpacked marks that are stored on a object
obtain the unpacked marks that are stored on a object
def get_unpacked_marks(obj): """ obtain the unpacked marks that are stored on a object """ mark_list = getattr(obj, 'pytestmark', []) if not isinstance(mark_list, list): mark_list = [mark_list] return [ getattr(mark, 'mark', mark) # unpack MarkDecorator for mark in mark...
[ "def", "get_unpacked_marks", "(", "obj", ")", ":", "mark_list", "=", "getattr", "(", "obj", ",", "'pytestmark'", ",", "[", "]", ")", "if", "not", "isinstance", "(", "mark_list", ",", "list", ")", ":", "mark_list", "=", "[", "mark_list", "]", "return", ...
[ 441, 0 ]
[ 452, 5 ]
python
en
['en', 'error', 'th']
False
store_mark
(obj, mark)
store a Mark on a object this is used to implement the Mark declarations/decorators correctly
store a Mark on a object this is used to implement the Mark declarations/decorators correctly
def store_mark(obj, mark): """store a Mark on a object this is used to implement the Mark declarations/decorators correctly """ assert isinstance(mark, Mark), mark # always reassign name to avoid updating pytestmark # in a reference that was only borrowed obj.pytestmark = get_unpacked_marks(...
[ "def", "store_mark", "(", "obj", ",", "mark", ")", ":", "assert", "isinstance", "(", "mark", ",", "Mark", ")", ",", "mark", "# always reassign name to avoid updating pytestmark", "# in a reference that was only borrowed", "obj", ".", "pytestmark", "=", "get_unpacked_mar...
[ 455, 0 ]
[ 462, 53 ]
python
en
['en', 'en', 'en']
True
store_legacy_markinfo
(func, mark)
create the legacy MarkInfo objects and put them onto the function
create the legacy MarkInfo objects and put them onto the function
def store_legacy_markinfo(func, mark): """create the legacy MarkInfo objects and put them onto the function """ if not isinstance(mark, Mark): raise TypeError("got {mark!r} instead of a Mark".format(mark=mark)) holder = getattr(func, mark.name, None) if holder is None: holder = MarkI...
[ "def", "store_legacy_markinfo", "(", "func", ",", "mark", ")", ":", "if", "not", "isinstance", "(", "mark", ",", "Mark", ")", ":", "raise", "TypeError", "(", "\"got {mark!r} instead of a Mark\"", ".", "format", "(", "mark", "=", "mark", ")", ")", "holder", ...
[ 465, 0 ]
[ 475, 29 ]
python
en
['en', 'en', 'en']
True
_marked
(func, mark)
Returns True if :func: is already marked with :mark:, False otherwise. This can happen if marker is applied to class and the test file is invoked more than once.
Returns True if :func: is already marked with :mark:, False otherwise. This can happen if marker is applied to class and the test file is invoked more than once.
def _marked(func, mark): """ Returns True if :func: is already marked with :mark:, False otherwise. This can happen if marker is applied to class and the test file is invoked more than once. """ try: func_mark = getattr(func, mark.name) except AttributeError: return False ret...
[ "def", "_marked", "(", "func", ",", "mark", ")", ":", "try", ":", "func_mark", "=", "getattr", "(", "func", ",", "mark", ".", "name", ")", "except", "AttributeError", ":", "return", "False", "return", "mark", ".", "args", "==", "func_mark", ".", "args"...
[ 506, 0 ]
[ 515, 74 ]
python
en
['en', 'en', 'en']
True
transfer_markers
(funcobj, cls, mod)
this function transfers class level markers and module level markers into function level markinfo objects this is the main reason why marks are so broken the resolution will involve phasing out function level MarkInfo objects
this function transfers class level markers and module level markers into function level markinfo objects
def transfer_markers(funcobj, cls, mod): """ this function transfers class level markers and module level markers into function level markinfo objects this is the main reason why marks are so broken the resolution will involve phasing out function level MarkInfo objects """ for obj in (cls...
[ "def", "transfer_markers", "(", "funcobj", ",", "cls", ",", "mod", ")", ":", "for", "obj", "in", "(", "cls", ",", "mod", ")", ":", "for", "mark", "in", "get_unpacked_marks", "(", "obj", ")", ":", "if", "not", "_marked", "(", "funcobj", ",", "mark", ...
[ 518, 0 ]
[ 530, 52 ]
python
en
['en', 'error', 'th']
False
ParameterSet.extract_from
(cls, parameterset, legacy_force_tuple=False)
:param parameterset: a legacy style parameterset that may or may not be a tuple, and may or may not be wrapped into a mess of mark objects :param legacy_force_tuple: enforce tuple wrapping so single argument tuple values don't get decomposed and break te...
:param parameterset: a legacy style parameterset that may or may not be a tuple, and may or may not be wrapped into a mess of mark objects
def extract_from(cls, parameterset, legacy_force_tuple=False): """ :param parameterset: a legacy style parameterset that may or may not be a tuple, and may or may not be wrapped into a mess of mark objects :param legacy_force_tuple: enforce tuple wrapping so ...
[ "def", "extract_from", "(", "cls", ",", "parameterset", ",", "legacy_force_tuple", "=", "False", ")", ":", "if", "isinstance", "(", "parameterset", ",", "cls", ")", ":", "return", "parameterset", "if", "not", "isinstance", "(", "parameterset", ",", "MarkDecora...
[ 44, 4 ]
[ 74, 51 ]
python
en
['en', 'error', 'th']
False
MarkInfo.add_mark
(self, mark)
add a MarkInfo with the given args and kwargs.
add a MarkInfo with the given args and kwargs.
def add_mark(self, mark): """ add a MarkInfo with the given args and kwargs. """ self._marks.append(mark) self.combined = self.combined.combined_with(mark)
[ "def", "add_mark", "(", "self", ",", "mark", ")", ":", "self", ".", "_marks", ".", "append", "(", "mark", ")", "self", ".", "combined", "=", "self", ".", "combined", ".", "combined_with", "(", "mark", ")" ]
[ 493, 4 ]
[ 496, 57 ]
python
en
['en', 'en', 'en']
True
MarkInfo.__iter__
(self)
yield MarkInfo objects each relating to a marking-call.
yield MarkInfo objects each relating to a marking-call.
def __iter__(self): """ yield MarkInfo objects each relating to a marking-call. """ return map(MarkInfo, self._marks)
[ "def", "__iter__", "(", "self", ")", ":", "return", "map", "(", "MarkInfo", ",", "self", ".", "_marks", ")" ]
[ 498, 4 ]
[ 500, 41 ]
python
en
['en', 'en', 'en']
True
assert_server_running
(server: "subprocess.Popen[bytes]", log_file: Optional[str])
Get the exit code of the server, or None if it is still running.
Get the exit code of the server, or None if it is still running.
def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> None: """Get the exit code of the server, or None if it is still running.""" if server.poll() is not None: message = "Server died unexpectedly!" if log_file: message += f"\nSee {log_file}\n" ...
[ "def", "assert_server_running", "(", "server", ":", "\"subprocess.Popen[bytes]\"", ",", "log_file", ":", "Optional", "[", "str", "]", ")", "->", "None", ":", "if", "server", ".", "poll", "(", ")", "is", "not", "None", ":", "message", "=", "\"Server died unex...
[ 34, 0 ]
[ 40, 35 ]
python
en
['en', 'en', 'en']
True
copy_default_settings
(filepath)
Creates a default settings file at ``filepath``.
Creates a default settings file at ``filepath``.
def copy_default_settings(filepath): """ Creates a default settings file at ``filepath``. """ dirname = os.path.dirname(filepath) if not os.path.exists(dirname): os.makedirs(dirname) with open(filepath, 'w') as fp: key = os.urandom(KEY_LENGTH) output = SETTINGS_TEMPLATE...
[ "def", "copy_default_settings", "(", "filepath", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "filepath", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "dirname", ")", ":", "os", ".", "makedirs", "(", "dirname", ")", "...
[ 52, 0 ]
[ 64, 24 ]
python
en
['en', 'error', 'th']
False
settings_from_file
(filename, silent=False)
Configures django settings from an arbitrary (non sys.path) filename.
Configures django settings from an arbitrary (non sys.path) filename.
def settings_from_file(filename, silent=False): """ Configures django settings from an arbitrary (non sys.path) filename. """ mod = imp.new_module('config') mod.__file__ = filename try: exec(compile(open(filename, "rb").read(), filename, 'exec'), mod.__dict__) except IOError as e: ...
[ "def", "settings_from_file", "(", "filename", ",", "silent", "=", "False", ")", ":", "mod", "=", "imp", ".", "new_module", "(", "'config'", ")", "mod", ".", "__file__", "=", "filename", "try", ":", "exec", "(", "compile", "(", "open", "(", "filename", ...
[ 66, 0 ]
[ 90, 60 ]
python
en
['en', 'error', 'th']
False
cleanup
(days=30, logger=None, site=None, server=None, level=None)
Deletes a portion of the trailing data in Sentry based on their creation dates. For example, if ``days`` is 30, this would attempt to clean up all data thats older than 30 days. :param logger: limit all deletion scopes to messages from the specified logger. :param site: limit th...
Deletes a portion of the trailing data in Sentry based on their creation dates. For example, if ``days`` is 30, this would attempt to clean up all data thats older than 30 days.
def cleanup(days=30, logger=None, site=None, server=None, level=None): """ Deletes a portion of the trailing data in Sentry based on their creation dates. For example, if ``days`` is 30, this would attempt to clean up all data thats older than 30 days. :param logger: limit all deletion scopes to me...
[ "def", "cleanup", "(", "days", "=", "30", ",", "logger", "=", "None", ",", "site", "=", "None", ",", "server", "=", "None", ",", "level", "=", "None", ")", ":", "# TODO: we should collect which messages above were deleted", "# and potentially just send out post_dele...
[ 151, 0 ]
[ 234, 24 ]
python
en
['en', 'error', 'th']
False
dmlab_extra_summaries
(policy_id, policy_avg_stats, env_steps, summary_writer, cfg)
We precisely follow IMPALA repo (scalable_agent) here for the reward calculation. The procedure is: 1. Calculate mean raw episode score for the last few episodes for each level 2. Calculate human-normalized score using this mean value 3. Calculate capped score The key point is that human-norm...
We precisely follow IMPALA repo (scalable_agent) here for the reward calculation.
def dmlab_extra_summaries(policy_id, policy_avg_stats, env_steps, summary_writer, cfg): """ We precisely follow IMPALA repo (scalable_agent) here for the reward calculation. The procedure is: 1. Calculate mean raw episode score for the last few episodes for each level 2. Calculate human-normalized ...
[ "def", "dmlab_extra_summaries", "(", "policy_id", ",", "policy_avg_stats", ",", "env_steps", ",", "summary_writer", ",", "cfg", ")", ":", "new_level_returns", "=", "dmlab_extra_episodic_stats_processing", ".", "new_level_returns", "if", "policy_id", "not", "in", "new_le...
[ 164, 0 ]
[ 234, 91 ]
python
en
['en', 'error', 'th']
False
User.queue_refresh_repositories
(self)
Queue a job to refresh repositories unless we're already doing so
Queue a job to refresh repositories unless we're already doing so
def queue_refresh_repositories(self): """Queue a job to refresh repositories unless we're already doing so""" from .jobs import refresh_github_repositories_for_user_job if not self.currently_fetching_repos: self.currently_fetching_repos = True self.save() log...
[ "def", "queue_refresh_repositories", "(", "self", ")", ":", "from", ".", "jobs", "import", "refresh_github_repositories_for_user_job", "if", "not", "self", ".", "currently_fetching_repos", ":", "self", ".", "currently_fetching_repos", "=", "True", "self", ".", "save",...
[ 97, 4 ]
[ 106, 42 ]
python
en
['en', 'en', 'en']
True
splitPrefix
(name)
Split the name into a tuple (I{prefix}, I{name}). The first element in the tuple is I{None} when the name does't have a prefix. @param name: A node name containing an optional prefix. @type name: basestring @return: A tuple containing the (2) parts of I{name} @rtype: (I{prefix}, I{name})
Split the name into a tuple (I{prefix}, I{name}). The first element in the tuple is I{None} when the name does't have a prefix.
def splitPrefix(name): """ Split the name into a tuple (I{prefix}, I{name}). The first element in the tuple is I{None} when the name does't have a prefix. @param name: A node name containing an optional prefix. @type name: basestring @return: A tuple containing the (2) parts of I{name} @rty...
[ "def", "splitPrefix", "(", "name", ")", ":", "if", "isinstance", "(", "name", ",", "basestring", ")", "and", "':'", "in", "name", ":", "return", "tuple", "(", "name", ".", "split", "(", "':'", ",", "1", ")", ")", "else", ":", "return", "(", "None",...
[ 39, 0 ]
[ 52, 27 ]
python
en
['en', 'error', 'th']
False
Paper.jeeves_restrict_paperlabel
(paper, ctxt)
Policy for seeing author of papers.
Policy for seeing author of papers.
def jeeves_restrict_paperlabel(paper, ctxt): ''' Policy for seeing author of papers. ''' if phase == 'final': return True else: if paper == None: return False if PaperPCConflict.objects.get(paper=paper, pc=ctxt) != None: ...
[ "def", "jeeves_restrict_paperlabel", "(", "paper", ",", "ctxt", ")", ":", "if", "phase", "==", "'final'", ":", "return", "True", "else", ":", "if", "paper", "==", "None", ":", "return", "False", "if", "PaperPCConflict", ".", "objects", ".", "get", "(", "...
[ 76, 4 ]
[ 92, 84 ]
python
en
['en', 'error', 'th']
False
send_response_message
( bot_id: int, message_info: Dict[str, Any], response_data: Dict[str, Any] )
bot_id is the user_id of the bot sending the response message_info is used to address the message and should have these fields: type - "stream" or "private" display_recipient - like we have in other message events topic - see get_topic_from_message_info response_data is what the b...
bot_id is the user_id of the bot sending the response
def send_response_message( bot_id: int, message_info: Dict[str, Any], response_data: Dict[str, Any] ) -> None: """ bot_id is the user_id of the bot sending the response message_info is used to address the message and should have these fields: type - "stream" or "private" display_recipie...
[ "def", "send_response_message", "(", "bot_id", ":", "int", ",", "message_info", ":", "Dict", "[", "str", ",", "Any", "]", ",", "response_data", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "message_type", "=", "message_info", "[", ...
[ 152, 0 ]
[ 204, 5 ]
python
en
['en', 'error', 'th']
False
do_rest_call
( base_url: str, event: Dict[str, Any], service_handler: OutgoingWebhookServiceInterface, )
Returns response of call if no exception occurs.
Returns response of call if no exception occurs.
def do_rest_call( base_url: str, event: Dict[str, Any], service_handler: OutgoingWebhookServiceInterface, ) -> Optional[Response]: """Returns response of call if no exception occurs.""" try: start_time = perf_counter() response = service_handler.make_request( base_url, ...
[ "def", "do_rest_call", "(", "base_url", ":", "str", ",", "event", ":", "Dict", "[", "str", ",", "Any", "]", ",", "service_handler", ":", "OutgoingWebhookServiceInterface", ",", ")", "->", "Optional", "[", "Response", "]", ":", "try", ":", "start_time", "="...
[ 320, 0 ]
[ 398, 19 ]
python
en
['en', 'en', 'en']
True
GenericOutgoingWebhookService.make_request
(self, base_url: str, event: Dict[str, Any])
We send a simple version of the message to outgoing webhooks, since most of them really only need `content` and a few other fields. We may eventually allow certain bots to get more information, but that's not a high priority. We do send the gravatar info to the clients...
We send a simple version of the message to outgoing webhooks, since most of them really only need `content` and a few other fields. We may eventually allow certain bots to get more information, but that's not a high priority. We do send the gravatar info to the clients...
def make_request(self, base_url: str, event: Dict[str, Any]) -> Optional[Response]: """ We send a simple version of the message to outgoing webhooks, since most of them really only need `content` and a few other fields. We may eventually allow certain bots to get more informatio...
[ "def", "make_request", "(", "self", ",", "base_url", ":", "str", ",", "event", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "Response", "]", ":", "message_dict", "=", "MessageDict", ".", "finalize_payload", "(", "event", "[", "...
[ 51, 4 ]
[ 77, 61 ]
python
en
['en', 'error', 'th']
False
update_test_databases_if_required
(rebuild_test_database: bool = False)
Checks whether the zulip_test_template database template, is consistent with our database migrations; if not, it updates it in the fastest way possible: * If all we need to do is add some migrations, just runs those migrations on the template database. * Otherwise, we rebuild the test template da...
Checks whether the zulip_test_template database template, is consistent with our database migrations; if not, it updates it in the fastest way possible:
def update_test_databases_if_required(rebuild_test_database: bool = False) -> None: """Checks whether the zulip_test_template database template, is consistent with our database migrations; if not, it updates it in the fastest way possible: * If all we need to do is add some migrations, just runs those ...
[ "def", "update_test_databases_if_required", "(", "rebuild_test_database", ":", "bool", "=", "False", ")", "->", "None", ":", "test_template_db_status", "=", "TEST_DATABASE", ".", "template_status", "(", ")", "if", "test_template_db_status", "==", "\"needs_rebuild\"", ":...
[ 254, 0 ]
[ 285, 46 ]
python
en
['en', 'en', 'en']
True
destroy_leaked_test_databases
(expiry_time: int = 60 * 60)
The logic in zerver/lib/test_runner.py tries to delete all the temporary test databases generated by test-backend threads, but it cannot guarantee it handles all race conditions correctly. This is a catch-all function designed to delete any that might have been leaked due to crashes (etc.). The high-l...
The logic in zerver/lib/test_runner.py tries to delete all the temporary test databases generated by test-backend threads, but it cannot guarantee it handles all race conditions correctly. This is a catch-all function designed to delete any that might have been leaked due to crashes (etc.). The high-l...
def destroy_leaked_test_databases(expiry_time: int = 60 * 60) -> int: """The logic in zerver/lib/test_runner.py tries to delete all the temporary test databases generated by test-backend threads, but it cannot guarantee it handles all race conditions correctly. This is a catch-all function designed to ...
[ "def", "destroy_leaked_test_databases", "(", "expiry_time", ":", "int", "=", "60", "*", "60", ")", "->", "int", ":", "files", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "UUID_VAR_DIR", ",", "TEMPLATE_DATABASE_DIR", ",", "\"*\"", ...
[ 323, 0 ]
[ 374, 33 ]
python
en
['en', 'en', 'en']
True
reset_zulip_test_database
()
This function is used to reset the zulip_test database fastest way possible, i.e. First, it deletes the database and then clones it from zulip_test_template. This function is used with puppeteer tests, so it can quickly reset the test database after each run.
This function is used to reset the zulip_test database fastest way possible, i.e. First, it deletes the database and then clones it from zulip_test_template. This function is used with puppeteer tests, so it can quickly reset the test database after each run.
def reset_zulip_test_database() -> None: """ This function is used to reset the zulip_test database fastest way possible, i.e. First, it deletes the database and then clones it from zulip_test_template. This function is used with puppeteer tests, so it can quickly reset the test database after each ...
[ "def", "reset_zulip_test_database", "(", ")", "->", "None", ":", "from", "zerver", ".", "lib", ".", "test_runner", "import", "destroy_test_databases", "# Make sure default database is 'zulip_test'.", "assert", "connections", "[", "\"default\"", "]", ".", "settings_dict", ...
[ 390, 0 ]
[ 433, 22 ]
python
en
['en', 'error', 'th']
False
Database.template_status
(self)
NOTE: We immediately update the digest, assuming our callers will do what it takes to run the migrations. Ideally our callers would just do it themselves AFTER the migrations actually succeeded, but the caller codepaths are kind of complicated here. ...
NOTE: We immediately update the digest, assuming our callers will do what it takes to run the migrations.
def template_status(self) -> str: # This function returns a status string specifying the type of # state the template db is in and thus the kind of action required. if not self.database_exists(): # TODO: It's possible that `database_exists` will # return `False` eve...
[ "def", "template_status", "(", "self", ")", "->", "str", ":", "# This function returns a status string specifying the type of", "# state the template db is in and thus the kind of action required.", "if", "not", "self", ".", "database_exists", "(", ")", ":", "# TODO: It's possibl...
[ 176, 4 ]
[ 219, 24 ]
python
en
['en', 'error', 'th']
False
TestCaseFunction._fix_unittest_skip_decorator
(self)
The @unittest.skip decorator calls functools.wraps(self._testcase) The call to functools.wraps() fails unless self._testcase has a __name__ attribute. This is usually automatically supplied if the test is a function or method, but we need to add manually here. See issue...
The @unittest.skip decorator calls functools.wraps(self._testcase) The call to functools.wraps() fails unless self._testcase has a __name__ attribute. This is usually automatically supplied if the test is a function or method, but we need to add manually here.
def _fix_unittest_skip_decorator(self): """ The @unittest.skip decorator calls functools.wraps(self._testcase) The call to functools.wraps() fails unless self._testcase has a __name__ attribute. This is usually automatically supplied if the test is a function or method, but we ne...
[ "def", "_fix_unittest_skip_decorator", "(", "self", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "==", "2", ":", "setattr", "(", "self", ".", "_testcase", ",", "\"__name__\"", ",", "self", ".", "name", ")" ]
[ 79, 4 ]
[ 90, 58 ]
python
en
['en', 'error', 'th']
False
build_clib.check_library_list
(self, libraries)
Ensure that the list of libraries is valid. `library` is presumably provided as a command option 'libraries'. This method checks that it is a list of 2-tuples, where the tuples are (library_name, build_info_dict). Raise DistutilsSetupError if the structure is invalid anywhere; ...
Ensure that the list of libraries is valid.
def check_library_list(self, libraries): """Ensure that the list of libraries is valid. `library` is presumably provided as a command option 'libraries'. This method checks that it is a list of 2-tuples, where the tuples are (library_name, build_info_dict). Raise DistutilsSetup...
[ "def", "check_library_list", "(", "self", ",", "libraries", ")", ":", "if", "not", "isinstance", "(", "libraries", ",", "list", ")", ":", "raise", "DistutilsSetupError", "(", "\"'libraries' option must be a list of tuples\"", ")", "for", "lib", "in", "libraries", ...
[ 117, 4 ]
[ 150, 58 ]
python
en
['en', 'en', 'en']
True
PerformanceModuloEncoding.__init__
(self, num_velocity_bins=0, max_shift_steps=performance_lib.DEFAULT_MAX_SHIFT_STEPS)
Initiaizer for PerformanceModuloEncoding. Args: num_velocity_bins: Number of velocity bins. max_shift_steps: Maximum number of shift steps supported.
Initiaizer for PerformanceModuloEncoding.
def __init__(self, num_velocity_bins=0, max_shift_steps=performance_lib.DEFAULT_MAX_SHIFT_STEPS): """Initiaizer for PerformanceModuloEncoding. Args: num_velocity_bins: Number of velocity bins. max_shift_steps: Maximum number of shift steps supported. """ self._event_ranges =...
[ "def", "__init__", "(", "self", ",", "num_velocity_bins", "=", "0", ",", "max_shift_steps", "=", "performance_lib", ".", "DEFAULT_MAX_SHIFT_STEPS", ")", ":", "self", ".", "_event_ranges", "=", "MODULO_EVENT_RANGES", "+", "[", "(", "PerformanceEvent", ".", "TIME_SH...
[ 44, 2 ]
[ 99, 68 ]
python
en
['en', 'sn', 'en']
True