output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
def listar(self):
"""List all access types.
:return: Dictionary with structure:
::
{‘tipo_acesso’: [{‘id’: < id >,
‘protocolo’: < protocolo >}, ... other access types ...]}
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLError... | Create a Python 3 function to
list all access types. | You are a Python code architect, reviewing and designing scalable and efficient code |
def inserir(self, protocolo):
"""Insert new access type and returns its identifier.
:param protocolo: Protocol.
:return: Dictionary with structure: {‘tipo_acesso’: {‘id’: < id >}}
:raise ProtocoloTipoAcessoDuplicadoError: Protocol already exists.
:raise InvalidParameterError: ... | How would you implement a function in Python 3 that
inserts new access type and returns its identifier. | As a python code expert, you are capable of creating scripts from specifications. |
Edit access type by its identifier. | Make a summary of the following Python 3 code
def alterar(self, id_tipo_acesso, protocolo):
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(
u'Access type id is invalid or was not informed.')
tipo_acesso_map = dict()
tipo_acesso_map['protocolo'... | As a Python code analyst, you investigate and solve complex coding mysteries |
Removes access type by its identifier. | Given the following Python 3 function, write the documentation
def remover(self, id_tipo_acesso):
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(
u'Access type id is invalid or was not informed.')
url = 'tipoacesso/' + str(id_tipo_acesso) + '/'
... | You are a Python code generator, capable of creating scripts from specifications. |
Inserts a new Script Type and returns its identifier. | Explain what the following Python 3 code does
def inserir(self, type, description):
script_type_map = dict()
script_type_map['type'] = type
script_type_map['description'] = description
code, xml = self.submit(
{'script_type': script_type_map}, 'POST', 'scripttype/')
... | You are a Python code generator, capable of creating scripts from specifications. |
Change Script Type from by the identifier. | Here you have a function in Python 3, explain what it does
def alterar(self, id_script_type, type, description):
if not is_valid_int_param(id_script_type):
raise InvalidParameterError(
u'The identifier of Script Type is invalid or was not informed.')
script_type_map = dict()... | You are a Python code generator, capable of creating scripts from specifications. |
Remove Script Type from by the identifier. | Make a summary of the following Python 3 code
def remover(self, id_script_type):
if not is_valid_int_param(id_script_type):
raise InvalidParameterError(
u'The identifier of Script Type is invalid or was not informed.')
url = 'scripttype/' + str(id_script_type) + '/'
... | As a Python code analyst, you investigate and solve complex coding mysteries |
Method to search pool s based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiPool, self).get(self.prepare_url('api/v3/pool/',
kwargs)) | As a python code expert, you are capable of creating scripts from specifications. |
Method to create pool s
| Make a summary of the following Python 3 code
def create(self, pools):
data = {'server_pools': pools}
return super(ApiPool, self).post('api/v3/pool/', data) | As a python code expert, you are capable of creating scripts from specifications. |
def get_real_related(self, id_equip):
"""
Find reals related with equipment
:param id_equip: Identifier of equipment
:return: Following dictionary:
::
{'vips': [{'port_real': < port_real >,
'server_pool_member_id': < server_pool_member_id >,
... | Implement a Python 3 function for
getting the real related VISA entries for a given equipment. | As a python code expert, you are capable of creating scripts from specifications. |
def find_equips(
self,
name,
iexact,
environment,
equip_type,
group,
ip,
pagination):
"""
Find vlans by all search parameters
:param name: Filter by vlan name column
:param iexact: Filter by ... | Write a Python 3 script for
finding vlans by all search parameters. | You are a Python code architect, reviewing and designing scalable and efficient code |
def inserir(self, name, id_equipment_type, id_model, id_group, maintenance=False):
"""Inserts a new Equipment and returns its identifier
Além de inserir o equipamento, a networkAPI também associa o equipamento
ao grupo informado.
:param name: Equipment name. String with a minimum 3 and... | Can you write a function in Python 3 where it
inserts a new Equipment and returns its identifier. | As a Python code composer, you craft elegant and concise scripts. |
def edit(self, id_equip, nome, id_tipo_equipamento, id_modelo, maintenance=None):
"""Change Equipment from by the identifier.
:param id_equip: Identifier of the Equipment. Integer value and greater than zero.
:param nome: Equipment name. String with a minimum 3 and maximum of 30 characters
... | Can you write a function in Python 3 where it
changes the Equipment from by the identifier. | As a Python code analyst, you investigate and solve complex coding mysteries |
Criar um IP para um a VLAN para um a novo IP para um a equipamento. | Here you have a function in Python 3, explain what it does
def criar_ip(self, id_vlan, id_equipamento, descricao):
ip_map = dict()
ip_map['id_vlan'] = id_vlan
ip_map['descricao'] = descricao
ip_map['id_equipamento'] = id_equipamento
code, xml = self.submit({'ip': ip_map}, 'POST'... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def add_ipv4(self, id_network_ipv4, id_equipamento, descricao):
"""Allocate an IP on a network to an equipment.
Insert new IP for network and associate to the equipment
:param id_network_ipv4: ID for NetworkIPv4.
:param id_equipamento: ID for Equipment.
:param descricao: Descrip... | How would you code a function in Python 3 to
allocate an IP on a network and associate it with an equipment. | You are a Python code analyst, evaluating scripts for potential improvements. |
def add_ipv6(self, id_network_ipv6, id_equip, description):
"""Allocate an IP on a network to an equipment.
Insert new IP for network and associate to the equipment
:param id_network_ipv6: ID for NetworkIPv6.
:param id_equip: ID for Equipment.
:param description: Description for... | Implement a Python 3 function for
allocating an IP on a network and associate it with an equipment. | You are a Python code generator, capable of creating scripts from specifications. |
Removes association of IP and Equipment. | Given the following Python 3 function, write the documentation
def remover_ip(self, id_equipamento, id_ip):
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
if not is_valid_int_param(... | You are a Python code architect, reviewing and designing scalable and efficient code |
def associate_ipv6(self, id_equip, id_ipv6):
"""Associates an IPv6 to a equipament.
:param id_equip: Identifier of the equipment. Integer value and greater than zero.
:param id_ipv6: Identifier of the ip. Integer value and greater than zero.
:return: Dictionary with the following struc... | Can you implement a function in Python 3 that
associates an IPv6 with an equipment. | You are a Python code generator, capable of creating scripts from specifications. |
Listar os equipamentos de um tipo do equipamento ou um ambiente. | Here you have a function in Python 3, explain what it does
def listar_por_tipo_ambiente(self, id_tipo_equipamento, id_ambiente):
if not is_valid_int_param(id_tipo_equipamento):
raise InvalidParameterError(
u'O identificador do tipo do equipamento é inválido ou não foi informado.')
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Listar o nome do equipamento. | Explain what the following Python 3 code does
def listar_por_nome(self, nome):
if nome == '' or nome is None:
raise InvalidParameterError(
u'O nome do equipamento não foi informado.')
url = 'equipamento/nome/' + urllib.quote(nome) + '/'
code, xml = self.submit(None... | As a Python code analyst, you investigate and solve complex coding mysteries |
def listar_por_id(self, id):
"""Obtém um equipamento a partir do seu identificador.
:param id: ID do equipamento.
:return: Dicionário com a seguinte estrutura:
::
{'equipamento': {'id': < id_equipamento >,
'nome': < nome_equipamento >,
'id_tipo_equ... | Can you write a function in Python 3 where it
lists all the nome and modelo of a partir do seu identificador. | You are a Python code analyst, evaluating scripts for potential improvements. |
def list_all(self):
"""Return all equipments in database
:return: Dictionary with the following structure:
::
{'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} }
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLE... | Write a Python 3 script for
getting all equipments in database | You are a Python code generator, capable of creating scripts from specifications. |
def get_all(self):
"""Return all equipments in database
:return: Dictionary with the following structure:
::
{'equipaments': {'name' :< name_equipament >}, {... demais equipamentos ...} }
:raise DataBaseError: Networkapi failed to access the database.
:raise XMLErr... | Implement a Python 3 function for
getting all equipments in database | You are a Python code generator, capable of creating scripts from specifications. |
Remove um equipamento a partir do seu identificador. | Given the following Python 3 function, write the documentation
def remover(self, id_equipamento):
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
url = 'equipamento/' + str(id_equipam... | You are a Python code analyst, evaluating scripts for potential improvements. |
Associate a grupo with a given equipment. | Here you have a function in Python 3, explain what it does
def associar_grupo(self, id_equipamento, id_grupo_equipamento):
equip_map = dict()
equip_map['id_grupo'] = id_grupo_equipamento
equip_map['id_equipamento'] = id_equipamento
code, xml = self.submit(
{'equipamento_gru... | You are a Python code analyst, evaluating scripts for potential improvements. |
Remove an association between a group and a equipment. | How would you explain what the following Python 3 function does
def remover_grupo(self, id_equipamento, id_grupo):
if not is_valid_int_param(id_equipamento):
raise InvalidParameterError(
u'O identificador do equipamento é inválido ou não foi informado.')
if not is_valid_int... | As a Python code analyst, you investigate and solve complex coding mysteries |
def list_by_group(self, id_egroup):
"""Search Group Equipment from by the identifier.
:param id_egroup: Identifier of the Group Equipment. Integer value and greater than zero.
:return: Dictionary with the following structure:
::
{'equipaments':
[{'nome': < nam... | Implement a function in Python 3 to
search Group Equipment from by the identifier. | You are a Python code generator, capable of creating scripts from specifications. |
Search Group Equipment from by the identifier. | Can you generate a brief explanation for the following Python 3 code
def get_ips_by_equipment_and_environment(self, equip_nome, id_ambiente):
if id_ambiente is None:
raise InvalidParameterError(
u'The environment id is invalid or was not informed.')
url = 'equipment/getipsb... | You are a Python code analyst, evaluating scripts for potential improvements. |
Send a GET request. | Can you generate the documentation for the following Python 3 function
def get(self, uri):
request = None
try:
request = requests.get(
self._url(uri),
auth=self._auth_basic(),
headers=self._header()
)
request.raise_fo... | As a Python code composer, you craft elegant and concise scripts. |
Parse data request from python. | Can you generate the documentation for the following Python 3 function
def _parse(self, content):
if content:
stream = BytesIO(str(content))
data = json.loads(stream.getvalue())
return data | As a Python code translator, you convert algorithms and pseudocode into Python. |
def prepare_url(self, uri, kwargs):
"""Convert dict for URL params
"""
params = dict()
for key in kwargs:
if key in ('include', 'exclude', 'fields'):
params.update({
key: ','.join(kwargs.get(key))
})
elif key in ... | Write a Python 3 script to
convert dict for URL params | As a Python code composer, you craft elegant and concise scripts. |
Insert a new Rack into the database. | Explain what the following Python 3 code does
def insert_rack(
self,
number,
name,
mac_address_sw1,
mac_address_sw2,
mac_address_ilo,
id_sw1,
id_sw2,
id_ilo):
"""Create new Rack
:param number: Num... | You are a Python code analyst, evaluating scripts for potential improvements. |
def remover(self, id_rack):
"""Remove Rack by the identifier.
:param id_rack: Identifier of the Rack. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: The identifier of Rack is null and invalid.
:raise RackNaoExisteError: Rack not registered.
... | Can you write a function in Python 3 where it
removes a Rack by the identifier. | You are a Python code generator, capable of creating scripts from specifications. |
Get a specific healthcheck by id. | Can you tell what is the following Python 3 function doing
def buscar_healthcheck_por_id(self, id_healthcheck):
if not is_valid_int_param(id_healthcheck):
raise InvalidParameterError(
u'O identificador do healthcheck é inválido ou não foi informado.')
url = 'healthcheckexpec... | You are a Python code analyst, evaluating scripts for potential improvements. |
Lista todos os ambientes por equipamento especifico. | How would you explain what the following Python 3 function does
def listar_por_equip(self, equip_id):
if equip_id is None:
raise InvalidParameterError(
u'O id do equipamento não foi informado.')
url = 'ambiente/equip/' + str(equip_id) + '/'
code, xml = self.submit(... | As a python code expert, you are capable of creating scripts from specifications. |
Lista os healthcheck_expects de um ambiente. | Can you generate the documentation for the following Python 3 function
def listar_healthcheck_expect(self, id_ambiente):
if not is_valid_int_param(id_ambiente):
raise InvalidParameterError(
u'O identificador do ambiente é inválido ou não foi informado.')
url = 'healthchecke... | As a python code expert, you are capable of creating scripts from specifications. |
Insere um novo healthckeck_expect e retorna o seu identificador. | Explain what the following Python 3 code does
def add_healthcheck_expect(self, id_ambiente, expect_string, match_list):
healthcheck_map = dict()
healthcheck_map['id_ambiente'] = id_ambiente
healthcheck_map['expect_string'] = expect_string
healthcheck_map['match_list'] = match_list
... | As a python code expert, you are capable of creating scripts from specifications. |
Insere um novo ambiente e retorna o seu identificador. | Can you tell what is the following Python 3 function doing
def inserir(
self,
id_grupo_l3,
id_ambiente_logico,
id_divisao,
link,
id_filter=None,
acl_path=None,
ipv4_template=None,
ipv6_template=None,
... | You are a Python code analyst, evaluating scripts for potential improvements. |
Inserts new environment with ip config and returns your id. | Can you generate the documentation for the following Python 3 function
def insert_with_ip_range(
self,
id_l3_group,
id_logical_environment,
id_division,
id_ip_config,
link,
id_filter=None):
"""Insert new environment with ip conf... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def add_ip_range(self, id_environment, id_ip_config):
"""Makes relationship of environment with ip config and returns your id.
:param id_environment: Environment ID.
:param id_ip_config: IP Configuration ID.
:return: Following dictionary:
{'config_do_ambiente': {'id_config_do_... | Write a Python 3 script to
add an environment with an ip config and returns your id. | You are a Python code architect, reviewing and designing scalable and efficient code |
def add_expect_string_healthcheck(self, expect_string):
"""Inserts a new healthckeck_expect with only expect_string.
:param expect_string: expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': {'id': < id >}}
:raise InvalidPa... | Can you create a Python 3 function that
inserts a new healthcheck_expect with only expect_string. | As a Python code composer, you craft elegant and concise scripts. |
def listar_healtchcheck_expect_distinct(self):
"""Get all expect_string.
:return: Dictionary with the following structure:
::
{'healthcheck_expect': [
'expect_string': < expect_string >,
... demais healthcheck_expects ...]}
:raise InvalidParamet... | Implement a function in Python 3 to
get all expect_string. :return: Dictionary with the following structure: :: {'healthcheck_expect': [ 'expect_string': < expect_string >, ... demais healthcheck_expects ...]} :raise InvalidParameterError: Identifier is null and invalid. :raise DataBaseError: Networkapi failed to acces... | As a Python code composer, you craft elegant and concise scripts. |
Get all distinct acl paths. | How would you explain what the following Python 3 function does
def list_acl_path(self):
url = 'environment/acl_path/'
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 set_template(self, id_environment, name, network):
"""Set template value. If id_environment = 0, set '' to all environments related with the template name.
:param id_environment: Environment Identifier.
:param name: Template Name.
:param network: IPv4 or IPv6.
:return: None... | Can you create a Python 3 function that
sets the template value. | As a python code expert, you are capable of creating scripts from specifications. |
def get_environment_template(self, name, network):
"""Get environments by template name
:param name: Template name.
:param network: IPv4 or IPv6.
:return: Following dictionary:
::
{'ambiente': [divisao_dc - ambiente_logico - grupo_l3, other envs...] }
:ra... | Can you implement a function in Python 3 that
gets environments by template name. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Save blocks from environment id_env | Can you generate the documentation for the following Python 3 function
def save_blocks(self, id_env, blocks):
url = 'environment/save_blocks/'
map_dict = dict()
map_dict['id_env'] = id_env
map_dict['blocks'] = blocks
code, xml = self.submit({'map': map_dict}, 'POST', url)
... | You are a Python code architect, reviewing and designing scalable and efficient code |
Get a rule by its identifier. | How would you explain what the following Python 3 function does
def get_rule_by_pk(self, id_rule):
url = 'rule/get_by_id/' + str(id_rule)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml) | As a Python code composer, you craft elegant and concise scripts. |
def save_rule(self, name, id_env, contents, blocks_id):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blocks id or 0... | Write a Python 3 function for
saving a rule in an environment. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def update_rule(self, name, id_env, contents, blocks_id, id_rule):
"""
Save an environment rule
:param name: Name of the rule
:param id_env: Environment id
:param contents: Lists of contents in order. Ex: ['content one', 'content two', ...]
:param blocks_id: Lists of blo... | Can you implement a function in Python 3 that
updates an environment rule. | You are a Python code architect, reviewing and designing scalable and efficient code |
def get_all_rules(self, id_env):
"""Save an environment rule
:param id_env: Environment id
:return: Estrutura:
::
{ 'rules': [{'id': < id >,
'environment': < Environment Object >,
'content': < content >,
'name': < name >,
'c... | Create a Python 3 function for
getting all rules for an environment. | As a Python code composer, you craft elegant and concise scripts. |
def configuration_save(
self,
id_environment,
network,
prefix,
ip_version,
network_type):
"""
Add new prefix configuration
:param id_environment: Identifier of the Environment. Integer value and greater than zero.
:... | Can you implement a function in Python 3 that
adds new prefix configuration to the specified environment. | As a Python code composer, you craft elegant and concise scripts. |
def configuration_list_all(self, environment_id):
"""
List all prefix configurations by environment in DB
:return: Following dictionary:
::
{'lists_configuration': [{
'id': <id_ipconfig>,
'subnet': <subnet>,
'type': <type>,
'... | Can you create a Python 3 function that
lists all prefix configurations by environment in DB | As a python code expert, you are capable of creating scripts from specifications. |
Remove a specific configuration from an environment. | Can you tell what is the following Python 3 function doing
def configuration_remove(self, environment_id, configuration_id):
data = dict()
data["configuration_id"] = configuration_id
data["environment_id"] = environment_id
url = (
"environment/configuration/remove/%(enviro... | As a Python code analyst, you investigate and solve complex coding mysteries |
def associate(self, environment_id, environment_vip_id):
"""Associate a news Environment on Environment VIP and returns its identifier.
:param environment_id: Identifier of the Environment. Integer value and greater than zero.
:param environment_vip_id: Identifier of the Environment VIP. Integ... | Write a Python 3 script for
associating a news Environment on Environment VIP and returns its identifier. | You are a Python code generator, capable of creating scripts from specifications. |
Get all related Environment by Environment Vip. | Make a summary of the following Python 3 code
def get_related_environment_list(self, environment_vip_id):
url = 'environment/environmentvip/{}/'.format(environment_vip_id)
code, xml = self.submit(None, 'GET', url)
return self.response(code, xml, ['environment_related_list']) | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_equipment(self, **kwargs):
"""
Return list environments related with environment vip
"""
uri = 'api/v3/equipment/'
uri = self.prepare_url(uri, kwargs)
return super(ApiEquipment, self).get(uri) | Implement a Python 3 function for
returning list environments related with environment vip | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to search equipments based on extends search. | How would you explain what the following Python 3 function does
def search(self, **kwargs):
return super(ApiEquipment, self).get(self.prepare_url('api/v3/equipment/',
kwargs)) | As a Python code composer, you craft elegant and concise scripts. |
Method to delete equipments 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/v3/equipment/%s/', ids)
return super(ApiEquipment, self).delete(url) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to create equipments on database | Can you tell what is the following Python 3 function doing
def create(self, equipments):
data = {'equipments': equipments}
return super(ApiEquipment, self).post('api/v3/equipment/', data) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to undeploy pool s by their ids
| Explain what the following Python 3 code does
def delete(self, ids):
url = build_uri_with_ids('api/v3/pool/deploy/%s/', ids)
return super(ApiPoolDeploy, self).delete(url) | As a python code expert, you are capable of creating scripts from specifications. |
Execute the script 'gerador_vips' several times with options -real, -add and -del to adjust vip request reals.
:param id_vip: Identifier of the VIP. Integer value and greater than zero.
:param method_bal: method_bal.
:param reals: List of reals. Ex: [{'real_name':'Teste1', 'real_ip':'10.10.10.1'... | Can you generate a brief explanation for the following Python 3 code
def edit_reals(
self,
id_vip,
method_bal,
reals,
reals_prioritys,
reals_weights,
alter_priority=0):
"""Execute the script 'gerador_vips' several times with opt... | As a Python code analyst, you investigate and solve complex coding mysteries |
def inserir(self, name):
"""Inserts a new Brand and returns its identifier
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: Dictionary with the following structure:
::
{'marca': {'id': < id_brand >}}
:raise InvalidParameterE... | Create a Python 3 function for
inserting a new Brand and returns its identifier. | You are a Python code analyst, evaluating scripts for potential improvements. |
def alterar(self, id_brand, name):
"""Change Brand from by the identifier.
:param id_brand: Identifier of the Brand. Integer value and greater than zero.
:param name: Brand name. String with a minimum 3 and maximum of 100 characters
:return: None
:raise InvalidParameterError: ... | Can you write a function in Python 3 where it
changes the name of the Brand from by the identifier. | As a Python code composer, you craft elegant and concise scripts. |
Remove Brand from by the identifier. | Make a summary of the following Python 3 code
def remover(self, id_brand):
if not is_valid_int_param(id_brand):
raise InvalidParameterError(
u'The identifier of Brand is invalid or was not informed.')
url = 'brand/' + str(id_brand) + '/'
code, xml = self.submit(Non... | As a python code expert, you are capable of creating scripts from specifications. |
Method to remove Acl draft by type | Explain what the following Python 3 code does
def acl_remove_draft(self, id_vlan, type_acl):
parameters = dict(id_vlan=id_vlan, type_acl=type_acl)
uri = 'api/vlan/acl/remove/draft/%(id_vlan)s/%(type_acl)s/' % parameters
return super(ApiVlan, self).get(uri) | As a Python code analyst, you investigate and solve complex coding mysteries |
def acl_save_draft(self, id_vlan, type_acl, content_draft):
"""
Save Acl draft by type
:param id_vlan: Identity of Vlan
:param type_acl: Acl type v4 or v6
:return: None
:raise VlanDoesNotExistException: Vlan Does Not Exist.
:raise Invali... | Can you implement a function in Python 3 that
saves Acl draft by type | You are a Python code generator, capable of creating scripts from specifications. |
Method to search vlan s based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiVlan, self).get(self.prepare_url('api/v3/vlan/',
kwargs)) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to create vlan s
| Can you tell what is the following Python 3 function doing
def create(self, vlans):
data = {'vlans': vlans}
return super(ApiVlan, self).post('api/v3/vlan/', data) | As a Python code analyst, you investigate and solve complex coding mysteries |
Verifica se o parâmetro é um valor inteiro válido. | Can you generate a brief explanation for the following Python 3 code
def is_valid_int_param(param):
if param is None:
return False
try:
param = int(param)
if param < 0:
return False
except (TypeError, ValueError):
return False
return True | As a Python code composer, you craft elegant and concise scripts. |
Checks if the parameter is a valid ip version value. | Given the following Python 3 function, write the documentation
def is_valid_version_ip(param):
if param is None:
return False
if param == IP_VERSION.IPv4[0] or param == IP_VERSION.IPv6[0]:
return True
return False | As a Python code analyst, you investigate and solve complex coding mysteries |
Method to list Option Vip by Environment Vip | Explain what the following Python 3 code does
def option_vip_by_environmentvip(self, environment_vip_id):
uri = 'api/v3/option-vip/environment-vip/%s/' % environment_vip_id
return super(ApiVipRequest, self).get(uri) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to get details of vip request | Explain what the following Python 3 code does
def get_vip_request_details(self, vip_request_id):
uri = 'api/v3/vip-request/details/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to get vip request | Can you tell what is the following Python 3 function doing
def get_vip_request(self, vip_request_id):
uri = 'api/v3/vip-request/%s/' % vip_request_id
return super(ApiVipRequest, self).get(uri) | You are a Python code generator, capable of creating scripts from specifications. |
Method to list vip request | How would you explain what the following Python 3 function does
def search_vip_request(self, search):
uri = 'api/v3/vip-request/?%s' % urllib.urlencode({'search': search})
return super(ApiVipRequest, self).get(uri) | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to update vip request object | Can you tell what is the following Python 3 function doing
def update_vip_request(self, vip_request, vip_request_id):
uri = 'api/v3/vip-request/%s/' % vip_request_id
data = dict()
data['vips'] = list()
data['vips'].append(vip_request)
return super(ApiVipRequest, self).put(uri, ... | As a python code expert, you are capable of creating scripts from specifications. |
Method to search vip s based on extends search. | Can you generate a brief explanation for the following Python 3 code
def search(self, **kwargs):
return super(ApiVipRequest, self).get(self.prepare_url('api/v3/vip-request/',
kwargs)) | As a Python code analyst, you investigate and solve complex coding mysteries |
Inserts a new Option Pool and returns its identifier. | Can you tell what is the following Python 3 function doing
def add(self, tipo_opcao, nome_opcao):
#optionpool_map = dict()
#optionpool_map['type'] = tipo_opcao
#optionpool_map['name'] = nome_opcao
url='api/pools/options/save/'
return self.post(url, {'type': tipo_opcao, "name":n... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def modify(self, id_option_pool, tipo_opcao, nome_opcao):
"""Change Option Pool from by id.
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:param tipo_opcao: Type. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:param nome_opca... | Create a Python 3 function to
change the type of an option pool from by id. | You are a Python code architect, reviewing and designing scalable and efficient code |
def remove(self, id_option_pool):
"""Remove Option pool by identifier and all Environment related .
:param id_option_pool: Identifier of the Option Pool. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Option Pool identifier is null and invalid.
... | Write a Python 3 script for
removing an option pool by identifier. | As a Python code composer, you craft elegant and concise scripts. |
Search Option Pool by id. | Explain what the following Python 3 code does
def get_option_pool(self, id_option_pool):
if not is_valid_int_param(id_option_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
url = 'api/pools/options/' + str(id_option_pool... | As a python code expert, you are capable of creating scripts from specifications. |
def get_all_option_pool(self, option_type=None):
"""Get all Option Pool.
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
‘type’: < tipo_opcao >,
‘name’: < nome_opcao_txt >}, ... other option pool ...] }
:raise optionpoolNotFou... | Write a Python 3 function that can
get all option pool. | As a Python code analyst, you investigate and solve complex coding mysteries |
def get_all_environment_option_pool(self, id_environment=None, option_id=None, option_type=None):
"""Get all Option VIP by Environment .
:return: Dictionary with the following structure:
::
{[{‘id’: < id >,
option: {
'id': <id>
... | Implement a Python 3 function for
getting all environment option pool by environment. | As a python code expert, you are capable of creating scripts from specifications. |
This method associates an option pool with an Environment. | Given the following Python 3 function, write the documentation
def associate_environment_option_pool(self, id_option_pool, id_environment):
if not is_valid_int_param(id_option_pool):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
... | You are a Python code generator, capable of creating scripts from specifications. |
Remove a relationship of an option pool with an Environment. | How would you explain what the following Python 3 function does
def disassociate_environment_option_pool(self, environment_option_id):
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Option Pool is invalid or was not informed.')
... | As a Python code composer, you craft elegant and concise scripts. |
Modify an existing option pool with an Environment. | Explain what the following Python 3 code does
def modify_environment_option_pool(self, environment_option_id, id_option_pool,id_environment ):
if not is_valid_int_param(environment_option_id):
raise InvalidParameterError(
u'The identifier of Environment Option Pool is invalid or was... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Inserts a new filter and returns its identifier. | How would you explain what the following Python 3 function does
def add(self, name, description):
filter_map = dict()
filter_map['name'] = name
filter_map['description'] = description
code, xml = self.submit({'filter': filter_map}, 'POST', 'filter/')
return self.response(code, ... | As a python code expert, you are capable of creating scripts from specifications. |
def alter(self, id_filter, name, description):
"""Change Filter by the identifier.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:param name: Name. String with a maximum of 50 characters and respect [a-zA-Z\_-]
:param description: Description. String w... | Implement a function in Python 3 to
change the name or description of a specific filter. | You are a Python code architect, reviewing and designing scalable and efficient code |
Remove a Filter by the identifier. | How would you explain what the following Python 3 function does
def remove(self, id_filter):
if not is_valid_int_param(id_filter):
raise InvalidParameterError(
u'The identifier of Filter is invalid or was not informed.')
url = 'filter/' + str(id_filter) + '/'
code,... | You are a Python code generator, capable of creating scripts from specifications. |
def get(self, id_filter):
"""Get filter by id.
:param id_filter: Identifier of the Filter. Integer value and greater than zero.
:return: Following dictionary:
::
{‘filter’: {‘id’: < id >,
‘name’: < name >,
‘description’: < description >}}
... | Create a Python 3 function to
get filter by id. | As a Python code analyst, you investigate and solve complex coding mysteries |
Create a relationship between TipoEquipamento and Filter. | Make a summary of the following Python 3 code
def associate(self, et_id, id_filter):
if not is_valid_int_param(et_id):
raise InvalidParameterError(
u'The identifier of TipoEquipamento is invalid or was not informed.')
if not is_valid_int_param(id_filter):
raise ... | You are a Python code generator, capable of creating scripts from specifications. |
def dissociate(self, id_filter, id_eq_type):
"""Removes relationship between Filter and TipoEquipamento.
:param id_filter: Identifier of Filter. Integer value and greater than zero.
:param id_eq_type: Identifier of TipoEquipamento. Integer value, greater than zero.
:return: None
... | Implement a Python 3 function for
removing relationship between Filter and TipoEquipamento. | You are a Python code analyst, evaluating scripts for potential improvements. |
def search(self, id_egroup):
"""Search Group Equipament from by the identifier.
:param id_egroup: Identifier of the Group Equipament. Integer value and greater than zero.
:return: Following dictionary:
::
{‘group_equipament’: {‘id’: < id_egrupo >,
‘nome’: < n... | Write a Python 3 script to
search Group Equipament from by the identifier. | You are a Python code analyst, evaluating scripts for potential improvements. |
def remover(self, id_egrupo):
"""Remove um grupo de equipamento a partir do seu identificador.
:param id_egrupo: Identificador do grupo de equipamento.
:return: None
:raise GrupoEquipamentoNaoExisteError: Grupo de equipamento não cadastrado.
:raise InvalidParameterError: O ide... | Can you create a Python 3 function that
removes um grupo de equipamento a partir do seu identificador. | You are a Python code generator, capable of creating scripts from specifications. |
def associa_equipamento(self, id_equip, id_grupo_equipamento):
"""Associa um equipamento a um grupo.
:param id_equip: Identificador do equipamento.
:param id_grupo_equipamento: Identificador do grupo de equipamento.
:return: Dicionário com a seguinte estrutura:
{'equipament... | Can you create a Python 3 function that
associates a new entry in a system with a grupo. | You are a Python code generator, capable of creating scripts from specifications. |
Removes a associacao de um grupo de equipamento com um equipamento a partir do seu identificador. | Make a summary of the following Python 3 code
def remove(self, id_equipamento, id_egrupo):
if not is_valid_int_param(id_egrupo):
raise InvalidParameterError(
u'O identificador do grupo de equipamento é inválido ou não foi informado.')
if not is_valid_int_param(id_equipament... | As a python code expert, you are capable of creating scripts from specifications. |
Inserts a new Logical Environment and returns its identifier. | Given the following Python 3 function, write the documentation
def inserir(self, name):
logical_environment_map = dict()
logical_environment_map['name'] = name
code, xml = self.submit(
{'logical_environment': logical_environment_map}, 'POST', 'logicalenvironment/')
return ... | As a python code expert, you are capable of creating scripts from specifications. |
def alterar(self, id_logicalenvironment, name):
"""Change Logical Environment from by the identifier.
:param id_logicalenvironment: Identifier of the Logical Environment. Integer value and greater than zero.
:param name: Logical Environment name. String with a minimum 2 and maximum of 80 charac... | Implement a function in Python 3 to
change the Logical Environment from by the identifier. | As a python code expert, you are capable of creating scripts from specifications. |
Remove Logical Environment from by the identifier. | Can you generate the documentation for the following Python 3 function
def remover(self, id_logicalenvironment):
if not is_valid_int_param(id_logicalenvironment):
raise InvalidParameterError(
u'The identifier of Logical Environment is invalid or was not informed.')
url = 'l... | You are a Python code architect, reviewing and designing scalable and efficient code |
Search Administrative Permission by Group User by identifier. | Explain what the following Python 3 code does
def list_by_group(self, id_ugroup):
if id_ugroup is None:
raise InvalidParameterError(
u'The identifier of Group User is invalid or was not informed.')
url = 'aperms/group/' + str(id_ugroup) + '/'
code, xml = self.submi... | As a python code expert, you are capable of creating scripts from specifications. |
Search Administrative Permission from by the identifier. | Can you tell what is the following Python 3 function doing
def search(self, id_perm):
if not is_valid_int_param(id_perm):
raise InvalidParameterError(
u'The identifier of Administrative Permission is invalid or was not informed.')
url = 'aperms/get/' + str(id_perm) + '/'
... | You are a Python code generator, capable of creating scripts from specifications. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.