output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
Inserts a new Equipment Type and returns its identifier. | Make a summary of the following Python 3 code
def inserir(self, name):
equipment_type_map = dict()
equipment_type_map['name'] = name
url = 'equipmenttype/'
code, xml = self.submit(
{'equipment_type': equipment_type_map}, 'POST', url)
return self.response(code, xml) | You are a Python code architect, reviewing and designing scalable and efficient code |
Inserts a new Related Equipment with Environment and returns its identifier. | Can you tell what is the following Python 3 function doing
def inserir(self, id_equipment, id_environment, is_router=0):
equipment_environment_map = dict()
equipment_environment_map['id_equipamento'] = id_equipment
equipment_environment_map['id_ambiente'] = id_environment
equipment_envir... | As a Python code composer, you craft elegant and concise scripts. |
Remove Related Equipment with Environment from by the identifier. | Given the following Python 3 function, write the documentation
def remover(self, id_equipment, id_environment):
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(
u'The identifier of Equipment is invalid or was not informed.')
if not is_valid_int_param(id... | As a python code expert, you are capable of creating scripts from specifications. |
Update related Equipment with Environment from by the identifier. | Can you generate the documentation for the following Python 3 function
def update(self, id_equipment, id_environment, is_router):
if not is_valid_int_param(id_equipment):
raise InvalidParameterError(
u'The identifier of Equipment is invalid or was not informed.')
if not is_... | As a Python code composer, you craft elegant and concise scripts. |
def remove_connection(self, interface1, interface2):
"""Remove a connection between two interfaces"""
uri = "api/interface/disconnect/%s/%s/" % (interface1, interface2)
return self.delete(uri) | Write a Python 3 script to
remove a connection between two interfaces | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to search interfaces based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiInterfaceRequest, self).get(self.prepare_url('api/v3/interface/', kwargs)) | As a python code expert, you are capable of creating scripts from specifications. |
Method to associate interfaces and environments with an interface. | How would you explain what the following Python 3 function does
def associate_interface_environments(self, int_env_map):
data = {'interface_environments': int_env_map}
return super(ApiInterfaceRequest, self).post('api/v3/interface/environments/', data) | As a python code expert, you are capable of creating scripts from specifications. |
Method to connecting interfaces. | Explain what the following Python 3 code does
def connecting_interfaces(self, interfaces):
data = {'interfaces': interfaces}
url = 'api/v3/connections/' + str(interfaces[0].get('id')) + '/' + str(interfaces[1].get('id')) + '/'
return super(ApiInterfaceRequest, self).post(url, data) | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to create a channel on database. | Explain what the following Python 3 code does
def create_channel(self, channel):
data = {'channels': channel}
return super(ApiInterfaceRequest, self).post('api/v3/channel/', data) | You are a Python code architect, reviewing and designing scalable and efficient code |
Inserts a new Group L3 and returns its identifier. | Can you generate a brief explanation for the following Python 3 code
def inserir(self, name):
group_l3_map = dict()
group_l3_map['name'] = name
code, xml = self.submit({'group_l3': group_l3_map}, 'POST', 'groupl3/')
return self.response(code, xml) | You are a Python code generator, capable of creating scripts from specifications. |
def alterar(self, id_groupl3, name):
"""Change Group L3 from by the identifier.
:param id_groupl3: Identifier of the Group L3. Integer value and greater than zero.
:param name: Group L3 name. String with a minimum 2 and maximum of 80 characters
:return: None
:raise InvalidPara... | Can you create a Python 3 function that
changes Group L3 from by the identifier. | You are a Python code analyst, evaluating scripts for potential improvements. |
Remove Group L3 from by the identifier. | How would you explain what the following Python 3 function does
def remover(self, id_groupl3):
if not is_valid_int_param(id_groupl3):
raise InvalidParameterError(
u'The identifier of Group L3 is invalid or was not informed.')
url = 'groupl3/' + str(id_groupl3) + '/'
... | You are a Python code generator, capable of creating scripts from specifications. |
A function to get a specific entry in a URL. | Make a summary of the following Python 3 code
def get(self, url, auth_map=None):
try:
LOG.debug('GET %s', url)
request = Request(url)
if auth_map is not None:
for key in auth_map.iterkeys():
request.add_header(key, auth_map[key])
... | You are a Python code generator, capable of creating scripts from specifications. |
Gera um XML a partir dos dados do dicionário para autenticações para autenticação. | How would you explain what the following Python 3 function does
def post_map(self, url, map, auth_map=None):
xml = dumps_networkapi(map)
response_code, content = self.post(url, xml, 'text/plain', auth_map)
return response_code, content | As a Python code composer, you craft elegant and concise scripts. |
Enviar um XML a partir dos dados do dicionário. | Can you generate a brief explanation for the following Python 3 code
def put_map(self, url, map, auth_map=None):
xml = dumps_networkapi(map)
response_code, content = self.put(url, xml, 'text/plain', auth_map)
return response_code, content | You are a Python code analyst, evaluating scripts for potential improvements. |
Envia uma requisição HTTP. | Can you generate a brief explanation for the following Python 3 code
def get_map(self, url, auth_map=None):
response_code, content = self.get(url, auth_map)
return response_code, content | As a Python code composer, you craft elegant and concise scripts. |
Returns full url path with querystring | Can you generate a brief explanation for the following Python 3 code
def get_full_url(self, parsed_url):
full_path = parsed_url.path
if parsed_url.query:
full_path = '%s?%s' % (full_path, parsed_url.query)
return full_path | As a Python code composer, you craft elegant and concise scripts. |
def submit(self, map):
'''Envia a requisição HTTP de acordo com os parâmetros informados no construtor.
:param map: Dicionário com os dados do corpo da requisição.
:return: Retorna uma tupla contendo:
(< código de resposta http >, < corpo da resposta >).
:raise ConnectionE... | Write a Python 3 function for
submitting a map to the network API. | You are a Python code generator, capable of creating scripts from specifications. |
Method to search Virtual Interfaces based on extends search. | Make a summary of the following Python 3 code
def search(self, **kwargs):
return super(ApiV4VirtualInterface, self).get(self.prepare_url(
'api/v4/virtual-interface/', kwargs)) | As a python code expert, you are capable of creating scripts from specifications. |
Method to update Virtual Interfaces | Here you have a function in Python 3, explain what it does
def update(self, virtual_interfaces):
data = {'virtual_interfaces': virtual_interfaces}
virtual_interfaces_ids = [str(env.get('id')) for env in virtual_interfaces]
return super(ApiV4VirtualInterface, self).put\
('api/v4/vir... | As a Python code analyst, you investigate and solve complex coding mysteries |
def search(self, id_ugroup):
"""Search Group User by its identifier.
:param id_ugroup: Identifier of the Group User. Integer value and greater than zero.
:return: Following dictionary:
::
{‘user_group’: {'escrita': < escrita >,
'nome': < nome >,
'e... | Create a Python 3 function to
search Group User by its identifier. | You are a Python code architect, reviewing and designing scalable and efficient code |
Insert a new user group and returns its identifier. | How would you explain what the following Python 3 function does
def inserir(self, name, read, write, edit, remove):
ugroup_map = dict()
ugroup_map['nome'] = name
ugroup_map['leitura'] = read
ugroup_map['escrita'] = write
ugroup_map['edicao'] = edit
ugroup_map['exclusao'] ... | As a python code expert, you are capable of creating scripts from specifications. |
def alterar(self, id_user_group, name, read, write, edit, remove):
"""Edit user group data from its identifier.
:param id_user_group: User group id.
:param name: User group name.
:param read: If user group has read permission ('S' ou 'N').
:param write: If user group has write p... | Implement a Python 3 function for
editing user group data from its identifier. | As a python code expert, you are capable of creating scripts from specifications. |
def remover(self, id_user_group):
"""Removes a user group by its id.
:param id_user_group: User Group's identifier. Valid integer greater than zero.
:return: None
:raise GrupoUsuarioNaoExisteError: User Group not found.
:raise InvalidParameterError: User Group id is invalid or... | Write a Python 3 script for
removing a user group by its identifier. | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to get environment | Can you generate the documentation for the following Python 3 function
def get_environment(self, environment_ids):
uri = 'api/v3/environment/%s/' % environment_ids
return super(ApiEnvironment, self).get(uri) | You are a Python code generator, capable of creating scripts from specifications. |
Method to create environment | Can you generate the documentation for the following Python 3 function
def create_environment(self, environment):
uri = 'api/v3/environment/'
data = dict()
data['environments'] = list()
data['environments'].append(environment)
return super(ApiEnvironment, self).post(uri, data) | As a Python code composer, you craft elegant and concise scripts. |
Method to search environments based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiEnvironment, self).get(self.prepare_url('api/v3/environment/',
kwargs)) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to delete environments by their id s
| Given the following Python 3 function, write the documentation
def delete(self, ids):
url = build_uri_with_ids('api/v3/environment/%s/', ids)
return super(ApiEnvironment, self).delete(url) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to update environments
| Here you have a function in Python 3, explain what it does
def update(self, environments):
data = {'environments': environments}
environments_ids = [str(env.get('id')) for env in environments]
return super(ApiEnvironment, self).put('api/v3/environment/%s/' %
... | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to create environments
| Can you generate a brief explanation for the following Python 3 code
def create(self, environments):
data = {'environments': environments}
return super(ApiEnvironment, self).post('api/v3/environment/', data) | As a python code expert, you are capable of creating scripts from specifications. |
Method to delete asns by their id s
| How would you explain what the following Python 3 function does
def delete(self, ids):
url = build_uri_with_ids('api/v4/as/%s/', ids)
return super(ApiV4As, self).delete(url) | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to update asns | Given the following Python 3 function, write the documentation
def update(self, asns):
data = {'asns': asns}
asns_ids = [str(env.get('id')) for env in asns]
return super(ApiV4As, self).put('api/v4/as/%s/' %
';'.join(asns_ids), data) | As a Python code composer, you craft elegant and concise scripts. |
Method to create asns
| Can you generate the documentation for the following Python 3 function
def create(self, asns):
data = {'asns': asns}
return super(ApiV4As, self).post('api/v4/as/', data) | You are a Python code analyst, evaluating scripts for potential improvements. |
def find_logs(
self,
user_name,
first_date,
start_time,
last_date,
end_time,
action,
functionality,
parameter,
pagination):
"""
Search all logs, filtering by the given parameters.
... | How would you code a function in Python 3 to
search all logs in the database. | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to search equipments based on extends search. | Explain what the following Python 3 code does
def search(self, **kwargs):
return super(ApiV4Equipment, self).get(self.prepare_url(
'api/v4/equipment/', kwargs)) | As a Python code analyst, you investigate and solve complex coding mysteries |
Method to delete equipments by their id s
| Can you generate the documentation for the following Python 3 function
def delete(self, ids):
url = build_uri_with_ids('api/v4/equipment/%s/', ids)
return super(ApiV4Equipment, self).delete(url) | You are a Python code generator, capable of creating scripts from specifications. |
Method to create a list of unique equipment entries | Given the following Python 3 function, write the documentation
def create(self, equipments):
data = {'equipments': equipments}
return super(ApiV4Equipment, self).post('api/v4/equipment/', data) | You are a Python code generator, capable of creating scripts from specifications. |
def submit(self, map, method, postfix):
'''Realiza um requisição HTTP para a networkAPI.
:param map: Dicionário com os dados para gerar o XML enviado no corpo da requisição HTTP.
:param method: Método da requisição HTTP ('GET', 'POST', 'PUT' ou 'DELETE').
:param postfix: Posfixo a ser c... | How would you implement a function in Python 3 that
submits a map to a código. | As a Python code analyst, you investigate and solve complex coding mysteries |
Obtem do XML de resposta o código e a descrição do erro. | Explain what the following Python 3 code does
def get_error(self, xml):
'''Obtem do XML de resposta, o código e a descrição do erro.
O XML corresponde ao corpo da resposta HTTP de código 500.
:param xml: XML contido na resposta da requisição HTTP.
:return: Tupla com o código e a descr... | As a Python code analyst, you investigate and solve complex coding mysteries |
Retorna um objeto NetworkAPIError. | Here you have a function in Python 3, explain what it does
def response(self, code, xml, force_list=None):
if int(code) == 200:
# Retorna o map
return loads(xml, force_list)['networkapi']
elif int(code) == 500:
code, description = self.get_error(xml)
retur... | You are a Python code analyst, evaluating scripts for potential improvements. |
Inserts a new Script and returns its identifier. | Here you have a function in Python 3, explain what it does
def inserir(self, id_script_type, script, model, description):
script_map = dict()
script_map['id_script_type'] = id_script_type
script_map['script'] = script
script_map['model'] = model
script_map['description'] = descri... | You are a Python code analyst, evaluating scripts for potential improvements. |
def alterar(self, id_script, id_script_type, script, description, model=None):
"""Change Script from by the identifier.
:param id_script: Identifier of the Script. Integer value and greater than zero.
:param id_script_type: Identifier of the Script Type. Integer value and greater than zero.
... | Write a Python 3 script for
changing the script from by the identifier. | As a python code expert, you are capable of creating scripts from specifications. |
Remove a specific script from by the identifier. | Can you tell what is the following Python 3 function doing
def remover(self, id_script):
if not is_valid_int_param(id_script):
raise InvalidParameterError(
u'The identifier of Script is invalid or was not informed.')
url = 'script/' + str(id_script) + '/'
code, xml ... | You are a Python code generator, capable of creating scripts from specifications. |
def listar_por_tipo(self, id_script_type):
"""List all Script by Script Type.
:param id_script_type: Identifier of the Script Type. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{‘script’: [{‘id’: < id >,
‘tipo_rotei... | Create a Python 3 function to
list all Script by Script Type. | You are a Python code analyst, evaluating scripts for potential improvements. |
def listar_por_equipamento(self, id_equipment):
"""List all Script related Equipment.
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{script': [{‘id’: < id >,
‘nome’: ... | How would you implement a function in Python 3 that
lists all Script related Equipment. | You are a Python code generator, capable of creating scripts from specifications. |
Get a specific rule by its identifier. | How would you explain what the following Python 3 function does
def get_rule_by_id(self, rule_id):
url = "rule/get_by_id/" + str(rule_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['rule_contents', 'rule_blocks']) | As a Python code analyst, you investigate and solve complex coding mysteries |
def create_networks(self, ids, id_vlan):
"""Set column 'active = 1' in tables redeipv4 and redeipv6]
:param ids: ID for NetworkIPv4 and/or NetworkIPv6
:return: Nothing
"""
network_map = dict()
network_map['ids'] = ids
network_map['id_vlan'] = id_vlan
c... | Write a Python 3 function that can
create a new network in the specified set of VLANs. | As a Python code analyst, you investigate and solve complex coding mysteries |
def add_network(self, network, id_vlan, id_network_type,
id_environment_vip=None, cluster_unit=None):
"""
Add new network
:param network: IPV4 or IPV6 (ex.: "10.0.0.3/24")
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:param id_... | Create a Python 3 function for
adding new network :param network: IPV4 or IPV6 (ex.: "10.0.0.3/24") :param id_vlan: Identifier of the Vlan. Integer value and greater than zero. :param id_network_type: Identifier of the NetworkType. Integer value and greater than zero. :param id_environment_vip: Identifier of the Enviro... | You are a Python code architect, reviewing and designing scalable and efficient code |
def edit_network(self, id_network, ip_type, id_net_type, id_env_vip=None, cluster_unit=None):
"""
Edit a network 4 or 6
:param id_network: Identifier of the Network. Integer value and greater than zero.
:param id_net_type: Identifier of the NetworkType. Integer value and greater than ze... | Can you create a Python 3 function that
edits a network in the database. | As a Python code composer, you craft elegant and concise scripts. |
def get_network_ipv4(self, id_network):
"""
Get networkipv4
:param id_network: Identifier of the Network. Integer value and greater than zero.
:return: Following dictionary:
::
{'network': {'id': < id_networkIpv6 >,
'network_type': < id_tipo_rede >,
... | Can you create a Python 3 function that
gets the NetworkIpv4 from Networkapi. | As a Python code analyst, you investigate and solve complex coding mysteries |
Get the network ipv6. | Can you generate the documentation for the following Python 3 function
def get_network_ipv6(self, id_network):
if not is_valid_int_param(id_network):
raise InvalidParameterError(
u'O id do rede ip6 foi informado incorretamente.')
url = 'network/ipv6/id/' + str(id_network) +... | As a Python code composer, you craft elegant and concise scripts. |
Deallocate all relationships between NetworkIPv4. | Here you have a function in Python 3, explain what it does
def deallocate_network_ipv4(self, id_network_ipv4):
if not is_valid_int_param(id_network_ipv4):
raise InvalidParameterError(
u'The identifier of NetworkIPv4 is invalid or was not informed.')
url = 'network/ipv4/' + ... | As a python code expert, you are capable of creating scripts from specifications. |
def add_network_ipv6(
self,
id_vlan,
id_tipo_rede,
id_ambiente_vip=None,
prefix=None):
"""
Add new networkipv6
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:param id_tipo_rede: Identifier of the ... | Implement a Python 3 function for
adding a networkipv6 to the configuration file. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Adds new networkipv6 hosts to the current network. | Can you generate the documentation for the following Python 3 function
def add_network_ipv6_hosts(
self,
id_vlan,
id_tipo_rede,
num_hosts,
id_ambiente_vip=None):
"""
Add new networkipv6
:param id_vlan: Identifier of the Vlan. Integer v... | As a python code expert, you are capable of creating scripts from specifications. |
Deallocate all relationships between NetworkIPv6 and return the corresponding object. | Here you have a function in Python 3, explain what it does
def deallocate_network_ipv6(self, id_network_ipv6):
if not is_valid_int_param(id_network_ipv6):
raise InvalidParameterError(
u'The identifier of NetworkIPv6 is invalid or was not informed.')
url = 'network/ipv6/' + ... | As a Python code composer, you craft elegant and concise scripts. |
def remove_networks(self, ids):
"""
Set column 'active = 0' in tables redeipv4 and redeipv6]
:param ids: ID for NetworkIPv4 and/or NetworkIPv6
:return: Nothing
:raise NetworkInactiveError: Unable to remove the network because it is inactive.
:raise InvalidParameterErro... | How would you implement a function in Python 3 that
removes the networks with the given IDs. | You are a Python code architect, reviewing and designing scalable and efficient code |
List all DHCPRelayIPv4.
:param: networkipv4_id, ipv4_id
:return: Following dictionary:
{
"networkipv4": <networkipv4_id>,
"id": <id>,
"ipv4": {
"oct4": <oct4>,
"oct2": <oct2>,
"oct3": <oct3>,
"oct1": <oct1>... | Can you generate a brief explanation for the following Python 3 code
def add(self, networkipv4_id, ipv4_id):
data = dict()
data['networkipv4'] = networkipv4_id
data['ipv4'] = dict()
data['ipv4']['id'] = ipv4_id
uri = 'api/dhcprelayv4/'
return self.post(uri, data=data) | As a Python code analyst, you investigate and solve complex coding mysteries |
def list(self, networkipv4=None, ipv4=None):
"""List all DHCPRelayIPv4.
:param: networkipv4: networkipv4 id - list all dhcprelay filtering by networkipv4 id
ipv4: ipv4 id - list all dhcprelay filtering by ipv4 id
:return: Following dictionary:
[
{
"n... | Can you write a function in Python 3 where it
lists all DHCPRelayIPv4. :param: networkipv4: networkipv4 id - list all dhcprelay filtering by networkipv4 id ipv4: ipv4 id - list all dhcprelay filtering by ipv4 id :return: Following dictionary: [ { "networkipv4": <networkipv4_id>, "id": <id>, "ipv4": { "oct4": <oct4>, "o... | You are a Python code architect, reviewing and designing scalable and efficient code |
def add(self, networkipv6_id, ipv6_id):
"""List all DHCPRelayIPv4.
:param: Object DHCPRelayIPv4
:return: Following dictionary:
{
"networkipv6": <networkipv4_id>,
"id": <id>,
"ipv6": {
"block1": <block1>,
"block2": <block2>,
... | Create a Python 3 function to
list all DHCPRelayIPv4. :param: Object DHCPRelayIPv4 :return: Following dictionary: { "networkipv6": <networkipv4_id>, "id": <id>, "ipv6": { "block1": <block1>, "block2": <block2>, "block3": <block3>, "block4": <block4>, "block5": <block5>, "block6": <block6>, "block7": <block7>, "block8":... | You are a Python code generator, capable of creating scripts from specifications. |
List all DHCPRelayIPv6.
:param: networkipv6: networkipv6 id - list all dhcprelay filtering by networkipv6 id
ipv6: ipv6 id - list all dhcprelay filtering by ipv6 id
:return: Following dictionary:
[
{
"networkipv6": <networkipv4_id>,
"id": <id>,
... | Can you tell what is the following Python 3 function doing
def list(self, networkipv6=None, ipv6=None):
uri = 'api/dhcprelayv6/?'
if networkipv6:
uri += 'networkipv6=%s&' % networkipv6
if ipv6:
uri += 'ipv6=%s' % ipv6
return self.get(uri) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to delete ipv6 s by their ids
| Given the following Python 3 function, write the documentation
def delete(self, ids):
url = build_uri_with_ids('api/v3/ipv6/%s/', ids)
return super(ApiIPv6, self).delete(url) | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to update ipv6 s
| Given the following Python 3 function, write the documentation
def update(self, ipv6s):
data = {'ips': ipv6s}
ipv6s_ids = [str(ipv6.get('id')) for ipv6 in ipv6s]
return super(ApiIPv6, self).put('api/v3/ipv6/%s/' %
';'.join(ipv6s_ids), data) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to search ipv4 s based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiIPv4, self).get(self.prepare_url('api/v3/ipv4/',
kwargs)) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to update ipv4 s
| Explain what the following Python 3 code does
def update(self, ipv4s):
data = {'ips': ipv4s}
ipv4s_ids = [str(ipv4.get('id')) for ipv4 in ipv4s]
return super(ApiIPv4, self).put('api/v3/ipv4/%s/' %
';'.join(ipv4s_ids), data) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to create ipv4 s
| Can you generate a brief explanation for the following Python 3 code
def create(self, ipv4s):
data = {'ips': ipv4s}
return super(ApiIPv4, self).post('api/v3/ipv4/', data) | As a Python code composer, you craft elegant and concise scripts. |
Method to delete object group permissions general by their ids
| How would you explain what the following Python 3 function does
def delete(self, ids):
url = build_uri_with_ids('api/v3/object-group-perm-general/%s/', ids)
return super(ApiObjectGroupPermissionGeneral, self).delete(url) | As a python code expert, you are capable of creating scripts from specifications. |
Method to update object group permissions general desired | Here you have a function in Python 3, explain what it does
def update(self, ogpgs):
data = {'ogpgs': ogpgs}
ogpgs_ids = [str(ogpg.get('id')) for ogpg in ogpgs]
return super(ApiObjectGroupPermissionGeneral, self).put('api/v3/object-group-perm-general/%s/' %
... | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to create object group permissions general | Here you have a function in Python 3, explain what it does
def create(self, ogpgs):
data = {'ogpgs': ogpgs}
return super(ApiObjectGroupPermissionGeneral, self).post('api/v3/object-group-perm-general/', data) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to search ipv6 s based on extends search. | Explain what the following Python 3 code does
def search(self, **kwargs):
return super(ApiV4IPv6, self).get(self.prepare_url('api/v4/ipv6/',
kwargs)) | You are a Python code generator, capable of creating scripts from specifications. |
Method to delete ipv6 s by their ids
| Can you tell what is the following Python 3 function doing
def delete(self, ids):
url = build_uri_with_ids('api/v4/ipv6/%s/', ids)
return super(ApiV4IPv6, self).delete(url) | As a Python code analyst, you investigate and solve complex coding mysteries |
Inserts a new Option VIP and returns its identifier. | Given the following Python 3 function, write the documentation
def add(self, tipo_opcao, nome_opcao_txt):
optionvip_map = dict()
optionvip_map['tipo_opcao'] = tipo_opcao
optionvip_map['nome_opcao_txt'] = nome_opcao_txt
code, xml = self.submit(
{'option_vip': optionvip_map}, ... | You are a Python code analyst, evaluating scripts for potential improvements. |
Change Option VIP from by the identifier. | How would you explain what the following Python 3 function does
def alter(self, id_option_vip, tipo_opcao, nome_opcao_txt):
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
optionvip_map ... | As a Python code composer, you craft elegant and concise scripts. |
Remove Option VIP from by the identifier. | Given the following Python 3 function, write the documentation
def remove(self, id_option_vip):
if not is_valid_int_param(id_option_vip):
raise InvalidParameterError(
u'The identifier of Option VIP is invalid or was not informed.')
url = 'optionvip/' + str(id_option_vip) + ... | You are a Python code architect, reviewing and designing scalable and efficient code |
Get all Option VIP by Environment Vip. | Can you tell what is the following Python 3 function doing
def get_option_vip(self, id_environment_vip):
url = 'optionvip/environmentvip/' + str(id_environment_vip) + '/'
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['option_vip']) | You are a Python code architect, reviewing and designing scalable and efficient code |
def associate(self, id_option_vip, id_environment_vip):
"""Create a relationship of OptionVip with EnvironmentVip.
:param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero.
:param id_environment_vip: Identifier of the Environment VIP. Integer value and greater tha... | Implement a Python 3 function for
creating a relationship of OptionVip with EnvironmentVip. | As a python code expert, you are capable of creating scripts from specifications. |
Search rules by environment vip identifier. | Can you tell what is the following Python 3 function doing
def buscar_rules(self, id_ambiente_vip, id_vip=''):
url = 'environment-vip/get/rules/' + \
str(id_ambiente_vip) + '/' + str(id_vip)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | You are a Python code architect, reviewing and designing scalable and efficient code |
def buscar_healthchecks(self, id_ambiente_vip):
"""Search healthcheck by environmentvip_id
:return: Dictionary with the following structure:
::
{'healthcheck_opt': [{'name': <name>, 'id': <id>},...]}
:raise InvalidParameterError: Environment VIP identifier is null and in... | Write a Python 3 script for
searching healthcheck by environment vip identifier. | As a Python code analyst, you investigate and solve complex coding mysteries |
Search id of Option VIP when tipo_opcao = Retorno de trafego | How would you explain what the following Python 3 function does
def buscar_idtrafficreturn_opcvip(self, nome_opcao_txt):
trafficreturn_map = dict()
trafficreturn_map['trafficreturn'] = nome_opcao_txt
url = 'optionvip/trafficreturn/search/'
code, xml = self.submit({'trafficreturn_opt':... | As a python code expert, you are capable of creating scripts from specifications. |
def listar_por_marca(self, id_brand):
"""List all Model by Brand.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{‘model’: [{‘id’: < id >,
‘nome’: < nome >,
‘id_ma... | Can you create a Python 3 function that
lists all Model by Brand. | As a Python code analyst, you investigate and solve complex coding mysteries |
Inserts a new Model and returns its identifier. | Can you generate a brief explanation for the following Python 3 code
def inserir(self, id_brand, name):
model_map = dict()
model_map['name'] = name
model_map['id_brand'] = id_brand
code, xml = self.submit({'model': model_map}, 'POST', 'model/')
return self.response(code, xml) | You are a Python code analyst, evaluating scripts for potential improvements. |
Change the Model from by the identifier. | Make a summary of the following Python 3 code
def alterar(self, id_model, id_brand, name):
if not is_valid_int_param(id_model):
raise InvalidParameterError(
u'The identifier of Model is invalid or was not informed.')
model_map = dict()
model_map['name'] = name
... | As a Python code composer, you craft elegant and concise scripts. |
def remover(self, id_model):
"""Remove Model from by the identifier.
:param id_model: Identifier of the Model. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Model is null and invalid.
:raise ModeloEquipamentoNaoExisteError: ... | Implement a Python 3 function for
removing Model from by the identifier. | As a Python code translator, you convert algorithms and pseudocode into Python. |
List all interfaces of an equipment. | Explain what the following Python 3 code does
def listar_por_equipamento(self, id_equipamento):
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'Equipment id is invalid or was not informed.')
url = 'interface/equipamento/' + str(id_equipamento) + '/'... | You are a Python code analyst, evaluating scripts for potential improvements. |
def get_by_id(self, id_interface):
"""Get an interface by id.
:param id_interface: Interface identifier.
:return: Following dictionary:
::
{'interface': {'id': < id >,
'interface': < interface >,
'descricao': < descricao >,
'protegida':... | How would you implement a function in Python 3 that
gets an interface by id. | As a Python code composer, you craft elegant and concise scripts. |
Inserts a new interface for an equipment. | Can you generate a brief explanation for the following Python 3 code
def inserir(
self,
nome,
protegida,
descricao,
id_ligacao_front,
id_ligacao_back,
id_equipamento,
tipo=None,
vlan=None):
"""Insert new ... | As a Python code composer, you craft elegant and concise scripts. |
def alterar(
self,
id_interface,
nome,
protegida,
descricao,
id_ligacao_front,
id_ligacao_back,
tipo=None,
vlan=None):
"""Edit an interface by its identifier.
Equipment identifier is not changed.... | How would you implement a function in Python 3 that
edits an interface by its identifier. | You are a Python code architect, reviewing and designing scalable and efficient code |
def remover(self, id_interface):
"""Remove an interface by its identifier.
:param id_interface: Interface identifier.
:return: None
:raise InterfaceNaoExisteError: Interface doesn't exist.
:raise InterfaceError: Interface is linked to another interface.
:raise InvalidP... | Can you implement a function in Python 3 that
removes an interface by its identifier. | As a python code expert, you are capable of creating scripts from specifications. |
Remove a connection between two interfaces. | Can you tell what is the following Python 3 function doing
def remove_connection(self, id_interface, back_or_front):
msg_err = u'Parameter %s is invalid. Value: %s.'
if not is_valid_0_1(back_or_front):
raise InvalidParameterError(
msg_err %
('back_or_front',... | As a Python code composer, you craft elegant and concise scripts. |
def list_connections(self, nome_interface, id_equipamento):
"""List interfaces linked to back and front of specified interface.
:param nome_interface: Interface name.
:param id_equipamento: Equipment identifier.
:return: Dictionary with the following:
::
{'interfa... | Implement a Python 3 function for
listing the interfaces linked to back and front of a specified interface. | As a Python code composer, you craft elegant and concise scripts. |
List all Permission.
:return: Dictionary with the following structure:
::
{'perms': [{ 'function' < function >, 'id': < id > }, ... more permissions ...]}
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError: Networkapi failed to generate the XM... | Explain what the following Python 3 code does
def list_all(self):
code, map = self.submit(None, 'GET', 'perms/all/')
key = 'perms'
return get_list_map(self.response(code, map, [key]), key) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to delete ipv4 s by their ids
| Make a summary of the following Python 3 code
def delete(self, ids):
url = build_uri_with_ids('api/v4/ipv4/%s/', ids)
return super(ApiV4IPv4, self).delete(url) | As a Python code analyst, you investigate and solve complex coding mysteries |
Provisions a set of equipamentos and VIPs. | Explain what the following Python 3 code does
def provisionar(self, equipamentos, vips):
code, map = self.submit(
{
'equipamentos': {
'equipamento': equipamentos}, 'vips': {
'vip': vips}}, 'POST', 'grupovirtual/')
return self.response(c... | You are a Python code analyst, evaluating scripts for potential improvements. |
Remove o provisionamento de um grupo virtual para o sistema de Orquestração VM. | Given the following Python 3 function, write the documentation
def remover_provisionamento(self, equipamentos, vips):
code, map = self.submit({'equipamentos': {'equipamento': equipamentos}, 'vips': {
'vip': vips}}, 'DELETE', 'grupovirtual/')
return self.response(code, m... | As a Python code composer, you craft elegant and concise scripts. |
def list_with_usergroup(self):
"""List all users and their user groups.
is_more -If more than 3 of groups of users or no, to control expansion Screen.
:return: Dictionary with the following structure:
::
{'usuario': [{'nome': < nome >,
'id': < id >,
... | Write a Python 3 function that can
list all users and their user groups. | You are a Python code analyst, evaluating scripts for potential improvements. |
def get_by_user_ldap(self, user_name):
"""Get user by the ldap name.
is_more -If more than 3 of groups of users or no, to control expansion Screen.
:return: Dictionary with the following structure:
::
{'usuario': [{'nome': < nome >,
'id': < id >,
'... | How would you implement a function in Python 3 that
gets user by the ldap name. | You are a Python code analyst, evaluating scripts for potential improvements. |
Inserts a new User and returns its identifier. | Can you tell what is the following Python 3 function doing
def inserir(self, user, pwd, name, email, user_ldap):
user_map = dict()
user_map['user'] = user
user_map['password'] = pwd
user_map['name'] = name
user_map['email'] = email
user_map['user_ldap'] = user_ldap
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Change the User from by the identifier. | Here you have a function in Python 3, explain what it does
def alterar(self, id_user, user, password, nome, ativo, email, user_ldap):
if not is_valid_int_param(id_user):
raise InvalidParameterError(
u'The identifier of User is invalid or was not informed.')
url = 'user/' + s... | As a Python code analyst, you investigate and solve complex coding mysteries |
Change the password of a user from by the identifier. | Can you tell what is the following Python 3 function doing
def change_password(self, id_user, user_current_password, password):
if not is_valid_int_param(id_user):
raise InvalidParameterError(
u'The identifier of User is invalid or was not informed.')
if password is None or ... | As a python code expert, you are capable of creating scripts from specifications. |
Authenticate a user by username and password and return a dictionary with the user s attributes. | Given the following Python 3 function, write the documentation
def authenticate(self, username, password, is_ldap_user):
user_map = dict()
user_map['username'] = username
user_map['password'] = password
user_map['is_ldap_user'] = is_ldap_user
code, xml = self.submit({'user': use... | You are a Python code architect, reviewing and designing scalable and efficient code |
def authenticate_ldap(self, username, password):
"""Get user by username and password and their permissions.
:param username: Username. String with a minimum 3 and maximum of 45 characters
:param password: User password. String with a minimum 3 and maximum of 45 characters
:return: Fol... | Write a Python 3 function that can
get user by username and password and their permissions. :param username: Username. String with a minimum 3 and maximum of 45 characters :param password: User password. String with a minimum 3 and maximum of 45 characters :return: Following dictionary: :: {'user': {'id': < id >} {'use... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.