output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
def _merge_files(self, input_files, output_file):
"""Combine the input files to a big output file"""
# we assume that all the input files have the same charset
with open(output_file, mode='wb') as out:
for input_file in input_files:
out.write(open(input_file, mode='rb... | Implement a Python 3 function for
combining the input files to a big output file | As a Python code composer, you craft elegant and concise scripts. |
def create_from_name_and_dictionary(self, name, datas):
"""Return a populated object Object from dictionary datas
"""
if "type" not in datas:
str_type = "any"
else:
str_type = str(datas["type"]).lower()
if str_type not in ObjectRaw.Types:
type... | Implement a Python 3 function for
creating a populated object from a dictionary datas | As a Python code analyst, you investigate and solve complex coding mysteries |
Merge extended dicts into target | Can you tell what is the following Python 3 function doing
def merge_extends(self, target, extends, inherit_key="inherit", inherit=False):
if isinstance(target, dict):
if inherit and inherit_key in target and not to_boolean(target[inherit_key]):
return
if not isinstance(e... | You are a Python code generator, capable of creating scripts from specifications. |
def merge_sources(self, datas):
"""Merge sources files
"""
datas = [data for data in datas if data is not None]
if len(datas) == 0:
raise ValueError("Data missing")
if len(datas) == 1:
return datas[0]
if isinstance(datas[0], list):
i... | Write a Python 3 script for
merging sources files with new sources files | As a python code expert, you are capable of creating scripts from specifications. |
Merge the configs of the datas into the config | Can you generate the documentation for the following Python 3 function
def merge_configs(self, config, datas):
if not isinstance(config, dict) or len([x for x in datas if not isinstance(x, dict)]) > 0:
raise TypeError("Unable to merge: Dictionnary expected")
for key, value in config.items()... | You are a Python code analyst, evaluating scripts for potential improvements. |
Return a proper object
| Given the following Python 3 function, write the documentation
def factory(cls, object_raw):
if object_raw is None:
return None
if object_raw.type is ObjectRaw.Types.object:
return ObjectObject(object_raw)
elif object_raw.type is ObjectRaw.Types.type:
return O... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Render the documentation as defined in config | Here you have a function in Python 3, explain what it does
def render(self, sources, config, out=sys.stdout):
logger = logging.getLogger()
template = self.env.get_template(self.input)
output = template.render(sources=sources, layout=config["output"]["layout"], config=config["output"])
if... | You are a Python code architect, reviewing and designing scalable and efficient code |
def create_from_dictionary(self, datas):
"""Return a populated object Configuration from dictionnary datas
"""
configuration = ObjectConfiguration()
if "uri" in datas:
configuration.uri = str(datas["uri"])
if "title" in datas:
configuration.title = str(da... | Implement a function in Python 3 to
create an object Configuration from a dictionary datas | As a Python code analyst, you investigate and solve complex coding mysteries |
Create an object Parameter from a name and dictionary datas. | Can you tell what is the following Python 3 function doing
def create_from_name_and_dictionary(self, name, datas):
parameter = ObjectParameter()
self.set_common_datas(parameter, name, datas)
if "optional" in datas:
parameter.optional = to_boolean(datas["optional"])
if "type"... | As a Python code composer, you craft elegant and concise scripts. |
Validate the format of sources
| Make a summary of the following Python 3 code
def validate(self, sources):
if not isinstance(sources, Root):
raise Exception("Source object expected")
parameters = self.get_uri_with_missing_parameters(sources)
for parameter in parameters:
logging.getLogger().warn('Missin... | As a Python code composer, you craft elegant and concise scripts. |
def validate(self, config):
"""Validate that the source file is ok
"""
if not isinstance(config, ConfigObject):
raise Exception("Config object expected")
if config["output"]["componants"] not in ("local", "remote", "embedded", "without"):
raise ValueError("Unknow... | Create a Python 3 function for
validating that the source file is ok . | As a python code expert, you are capable of creating scripts from specifications. |
Retrieve a template path from the config object | Make a summary of the following Python 3 code
def get_template_from_config(self, config):
if config["output"]["template"] == "default":
return os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'template',
'default.html'
... | You are a Python code analyst, evaluating scripts for potential improvements. |
def create_from_dictionary(self, datas):
"""Return a populated object ResponseCode from dictionary datas
"""
if "code" not in datas:
raise ValueError("A response code must contain a code in \"%s\"." % repr(datas))
code = ObjectResponseCode()
self.set_common_datas(cod... | Create a Python 3 function to
create an object ResponseCode from a dictionary datas. | As a python code expert, you are capable of creating scripts from specifications. |
Add a handler to the watch queue. | Can you generate a brief explanation for the following Python 3 code
def add_handler(self, path, handler):
self.signatures[path] = self.get_path_signature(path)
self.handlers[path] = handler | As a Python code analyst, you investigate and solve complex coding mysteries |
generate a unique signature for a file contained in path | Can you tell what is the following Python 3 function doing
def get_path_signature(self, path):
if not os.path.exists(path):
return None
if os.path.isdir(path):
merge = {}
for root, dirs, files in os.walk(path):
for name in files:
fu... | As a python code expert, you are capable of creating scripts from specifications. |
Check if a file is changed
| Make a summary of the following Python 3 code
def check(self):
for (path, handler) in self.handlers.items():
current_signature = self.signatures[path]
new_signature = self.get_path_signature(path)
if new_signature != current_signature:
self.signatures[path] = ... | You are a Python code analyst, evaluating scripts for potential improvements. |
Return a tupple of values representing the unicity of the object
| Explain what the following Python 3 code does
def get_comparable_values(self):
return (int(self.major), int(self.minor), str(self.label), str(self.name)) | You are a Python code generator, capable of creating scripts from specifications. |
def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (int(self.order), str(self.label), str(self.name)) | How would you implement a function in Python 3 that
returns a tupple of values representing the unicity of the object | As a Python code analyst, you investigate and solve complex coding mysteries |
Return a tupple of values representing the unicity of the object
| Can you generate the documentation for the following Python 3 function
def get_comparable_values(self):
return (not self.generic, str(self.name), str(self.description)) | As a Python code translator, you convert algorithms and pseudocode into Python. |
def get_comparable_values_for_ordering(self):
"""Return a tupple of values representing the unicity of the object
"""
return (0 if self.position >= 0 else 1, int(self.position), str(self.name), str(self.description)) | Can you implement a function in Python 3 that
returns a tupple of values representing the unicity of the object | As a python code expert, you are capable of creating scripts from specifications. |
Return a tupple of values representing the unicity of the object
| Here you have a function in Python 3, explain what it does
def get_comparable_values(self):
return (not self.generic, int(self.code), str(self.message), str(self.description)) | You are a Python code generator, capable of creating scripts from specifications. |
Return a proper object from an object source | Can you generate the documentation for the following Python 3 function
def factory(cls, object_source):
if object_source.type is ObjectRaw.Types.object:
return ObjectObject(object_source)
elif object_source.type not in ObjectRaw.Types or object_source.type is ObjectRaw.Types.type:
... | As a python code expert, you are capable of creating scripts from specifications. |
Return a tupple of values representing the unicity of the object
| Given the following Python 3 function, write the documentation
def get_comparable_values(self):
return (str(self.name), str(self.description), str(self.type), bool(self.optional), str(self.constraints) if isinstance(self, Constraintable) else "") | You are a Python code architect, reviewing and designing scalable and efficient code |
def get_comparable_values(self):
"""Return a tupple of values representing the unicity of the object
"""
return (str(self.name), str(self.description), str(self.constraints)) | Create a Python 3 function for
returning a tupple of values representing the unicity of the object | You are a Python code analyst, evaluating scripts for potential improvements. |
Create an object Category from a name and dictionary datas. | Given the following Python 3 function, write the documentation
def create_from_name_and_dictionary(self, name, datas):
category = ObjectCategory(name)
self.set_common_datas(category, name, datas)
if "order" in datas:
category.order = int(datas["order"])
return category | You are a Python code architect, reviewing and designing scalable and efficient code |
def load_from_file(self, file_path, format=None):
"""Return dict from a file config
"""
if format is None:
base_name, file_extension = os.path.splitext(file_path)
if file_extension in (".yaml", ".yml"):
format = "yaml"
elif file_extension in ("... | Can you create a Python 3 function that
loads a config file into a dictionary | You are a Python code analyst, evaluating scripts for potential improvements. |
Return a list of dict from a directory containing files
| Explain what the following Python 3 code does
def load_all_from_directory(self, directory_path):
datas = []
for root, folders, files in os.walk(directory_path):
for f in files:
datas.append(self.load_from_file(os.path.join(root, f)))
return datas | As a python code expert, you are capable of creating scripts from specifications. |
Represent an object as JSON. | Can you generate a brief explanation for the following Python 3 code
def json_repr(obj):
def serialize(obj):
"""Recursively walk object's hierarchy.
"""
if obj is None:
return None
if isinstance(obj, Enum):
return str(obj)
if isinstance(obj, (bool, in... | You are a Python code generator, capable of creating scripts from specifications. |
Create an object root from a dictionnary datas
| Make a summary of the following Python 3 code
def create_from_root(self, root_source):
root_dto = ObjectRoot()
root_dto.configuration = root_source.configuration
root_dto.versions = [Version(x) for x in root_source.versions.values()]
for version in sorted(root_source.versions.values()... | As a Python code composer, you craft elegant and concise scripts. |
def set_common_datas(self, element, name, datas):
"""Populated common data for an element from dictionnary datas
"""
element.name = str(name)
if "description" in datas:
element.description = str(datas["description"]).strip()
if isinstance(element, Sampleable) and ele... | Create a Python 3 function for
populating common data for an element from dictionnary datas | You are a Python code architect, reviewing and designing scalable and efficient code |
def create_dictionary_of_element_from_dictionary(self, property_name, datas):
"""Populate a dictionary of elements
"""
response = {}
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], collections.Iterable):
for key, value in da... | Create a Python 3 function for
populating a dictionary of elements from a dictionary of datas | You are a Python code generator, capable of creating scripts from specifications. |
def create_list_of_element_from_dictionary(self, property_name, datas):
"""Populate a list of elements
"""
response = []
if property_name in datas and datas[property_name] is not None and isinstance(datas[property_name], list):
for value in datas[property_name]:
... | Can you create a Python 3 function that
populates a list of elements from a dictionary | As a Python code composer, you craft elegant and concise scripts. |
def create_from_config(self, config):
"""Create a template object file defined in the config object
"""
configService = ConfigService()
template = TemplateService()
template.output = config["output"]["location"]
template_file = configService.get_template_from_config(co... | Can you implement a function in Python 3 that
creates a template object from a config object | As a Python code translator, you convert algorithms and pseudocode into Python. |
Deploy network in equipments and set column active = 1 in tables redeipv4
| Explain what the following Python 3 code does
def deploy(self, id_networkv4):
data = dict()
uri = 'api/networkv4/%s/equipments/' % id_networkv4
return super(ApiNetworkIPv4, self).post(uri, data=data) | As a python code expert, you are capable of creating scripts from specifications. |
def get_by_id(self, id_networkv4):
"""Get IPv4 network
:param id_networkv4: ID for NetworkIPv4
:return: IPv4 Network
"""
uri = 'api/networkv4/%s/' % id_networkv4
return super(ApiNetworkIPv4, self).get(uri) | Can you write a function in Python 3 where it
gets IPv4 network by ID | As a Python code analyst, you investigate and solve complex coding mysteries |
List IPv4 networks with specific environment vip | Can you generate the documentation for the following Python 3 function
def list(self, environment_vip=None):
uri = 'api/networkv4/?'
if environment_vip:
uri += 'environment_vip=%s' % environment_vip
return super(ApiNetworkIPv4, self).get(uri) | As a Python code translator, you convert algorithms and pseudocode into Python. |
def undeploy(self, id_networkv4):
"""Remove deployment of network in equipments and set column 'active = 0' in tables redeipv4 ]
:param id_networkv4: ID for NetworkIPv4
:return: Equipments configuration output
"""
uri = 'api/networkv4/%s/equipments/' % id_networkv4
re... | Can you implement a function in Python 3 that
removes deployment of network in equipments and set column active = 0 in tables redeipv4 | You are a Python code analyst, evaluating scripts for potential improvements. |
def check_vip_ip(self, ip, environment_vip):
"""
Check available ip in environment vip
"""
uri = 'api/ipv4/ip/%s/environment-vip/%s/' % (ip, environment_vip)
return super(ApiNetworkIPv4, self).get(uri) | Implement a function in Python 3 to
check available ip in environment vip | As a Python code analyst, you investigate and solve complex coding mysteries |
Method to delete ipv4 | Can you generate the documentation for the following Python 3 function
def delete_ipv4(self, ipv4_id):
uri = 'api/ipv4/%s/' % (ipv4_id)
return super(ApiNetworkIPv4, self).delete(uri) | As a python code expert, you are capable of creating scripts from specifications. |
Method to search ipv4 s based on extends search. | How would you explain what the following Python 3 function does
def search(self, **kwargs):
return super(ApiNetworkIPv4, self).get(self.prepare_url('api/v3/networkv4/',
kwargs)) | As a Python code composer, you craft elegant and concise scripts. |
Method to delete network - ipv4 s by their ids
| Explain what the following Python 3 code does
def delete(self, ids):
url = build_uri_with_ids('api/v3/networkv4/%s/', ids)
return super(ApiNetworkIPv4, self).delete(url) | You are a Python code generator, capable of creating scripts from specifications. |
Method to update network - ipv4 s
| How would you explain what the following Python 3 function does
def update(self, networkipv4s):
data = {'networks': networkipv4s}
networkipv4s_ids = [str(networkipv4.get('id'))
for networkipv4 in networkipv4s]
return super(ApiNetworkIPv4, self).put('api/v3/networkv4... | You are a Python code generator, capable of creating scripts from specifications. |
def inserir(self, name):
"""Inserts a new Division Dc and returns its identifier.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: Dictionary with the following structure:
::
{'division_dc': {'id': < id_division_dc >}}
... | Write a Python 3 function for
inserting a new Division Dc and returns its identifier. | As a Python code analyst, you investigate and solve complex coding mysteries |
def alterar(self, id_divisiondc, name):
"""Change Division Dc from by the identifier.
:param id_divisiondc: Identifier of the Division Dc. Integer value and greater than zero.
:param name: Division Dc name. String with a minimum 2 and maximum of 80 characters
:return: None
:ra... | Write a Python 3 script for
changing Division Dc from by the identifier. | As a Python code composer, you craft elegant and concise scripts. |
Remove Division Dc from by the identifier. | Make a summary of the following Python 3 code
def remover(self, id_divisiondc):
if not is_valid_int_param(id_divisiondc):
raise InvalidParameterError(
u'The identifier of Division Dc is invalid or was not informed.')
url = 'divisiondc/' + str(id_divisiondc) + '/'
c... | As a Python code analyst, you investigate and solve complex coding mysteries |
Method to search object types based on extends search. | Here you have a function in Python 3, explain what it does
def search(self, **kwargs):
return super(ApiObjectType, self).get(self.prepare_url('api/v3/object-type/',
kwargs)) | As a Python code translator, you convert algorithms and pseudocode into Python. |
def find_vlans(
self,
number,
name,
iexact,
environment,
net_type,
network,
ip_version,
subnet,
acl,
pagination):
"""
Find vlans by all search parameters
:param nu... | Create a Python 3 function to
find vlans in the database. | As a Python code composer, you craft elegant and concise scripts. |
List all VLANs from an environment. | Can you generate the documentation for the following Python 3 function
def listar_por_ambiente(self, id_ambiente):
if not is_valid_int_param(id_ambiente):
raise InvalidParameterError(u'Environment id is none or invalid.')
url = 'vlan/ambiente/' + str(id_ambiente) + '/'
code, xml = ... | You are a Python code architect, reviewing and designing scalable and efficient code |
Inserts a new VLAN in the cache. | Can you generate a brief explanation for the following Python 3 code
def alocar(
self,
nome,
id_tipo_rede,
id_ambiente,
descricao,
id_ambiente_vip=None,
vrf=None):
"""Inserts a new VLAN.
:param nome: Name of Vlan. Strin... | As a python code expert, you are capable of creating scripts from specifications. |
def insert_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
network_ipv4,
network_ipv6,
vrf=None):
"""Create new VLAN
:param environment_id: ID for Enviro... | How would you code a function in Python 3 to
insert a new VLAN into the database. | You are a Python code generator, capable of creating scripts from specifications. |
def edit_vlan(
self,
environment_id,
name,
number,
description,
acl_file,
acl_file_v6,
id_vlan):
"""Edit a VLAN
:param id_vlan: ID for Vlan
:param environment_id: ID for Environment.
:param n... | How would you implement a function in Python 3 that
edits a VLAN in the specified Environment. | As a Python code composer, you craft elegant and concise scripts. |
def create_vlan(self, id_vlan):
""" Set column 'ativada = 1'.
:param id_vlan: VLAN identifier.
:return: None
"""
vlan_map = dict()
vlan_map['vlan_id'] = id_vlan
code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'vlan/create/')
return self.response(c... | Write a Python 3 script for
setting column 'ativada = 1'. :param id_vlan: VLAN identifier. :return: None | As a python code expert, you are capable of creating scripts from specifications. |
Create new VLAN without add NetworkIPv4. | Can you generate the documentation for the following Python 3 function
def allocate_without_network(self, environment_id, name, description, vrf=None):
vlan_map = dict()
vlan_map['environment_id'] = environment_id
vlan_map['name'] = name
vlan_map['description'] = description
vlan... | As a python code expert, you are capable of creating scripts from specifications. |
Check if there is communication permission for VLAN to trunk. | Explain what the following Python 3 code does
def verificar_permissao(self, id_vlan, nome_equipamento, nome_interface):
if not is_valid_int_param(id_vlan):
raise InvalidParameterError(
u'Vlan id is invalid or was not informed.')
url = 'vlan/' + str(id_vlan) + '/check/'
... | You are a Python code architect, reviewing and designing scalable and efficient code |
def buscar(self, id_vlan):
"""Get VLAN by its identifier.
:param id_vlan: VLAN identifier.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >,
'id_ambiente': < id_ambiente >,
... | Create a Python 3 function for
returning a dictionary of all the keys that are set in the base class. | You are a Python code architect, reviewing and designing scalable and efficient code |
def get(self, id_vlan):
"""Get a VLAN by your primary key.
Network IPv4/IPv6 related will also be fetched.
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{'vlan': {'id': < id_vlan >,
'nome': < nome_vlan >,
'num_vlan': < num_vlan >... | Write a Python 3 script for
getting a VLAN by your primary key. | You are a Python code analyst, evaluating scripts for potential improvements. |
List all VLANS having communication permission to trunk from a port in switch. | Make a summary of the following Python 3 code
def listar_permissao(self, nome_equipamento, nome_interface):
vlan_map = dict()
vlan_map['nome'] = nome_equipamento
vlan_map['nome_interface'] = nome_interface
code, xml = self.submit({'equipamento': vlan_map}, 'PUT', 'vlan/list/')
... | As a Python code analyst, you investigate and solve complex coding mysteries |
Create a VLAN in layer 2 using script navlan. | Can you tell what is the following Python 3 function doing
def create_ipv4(self, id_network_ipv4):
url = 'vlan/v4/create/'
vlan_map = dict()
vlan_map['id_network_ip'] = id_network_ipv4
code, xml = self.submit({'vlan': vlan_map}, 'POST', url)
return self.response(code, xml) | You are a Python code architect, reviewing and designing scalable and efficient code |
Create a VLAN in layer 2 using script navlan. | Make a summary of the following Python 3 code
def create_ipv6(self, id_network_ipv6):
url = 'vlan/v6/create/'
vlan_map = dict()
vlan_map['id_network_ip'] = id_network_ipv6
code, xml = self.submit({'vlan': vlan_map}, 'POST', url)
return self.response(code, xml) | As a Python code composer, you craft elegant and concise scripts. |
Apply the file acl in equipments
| Given the following Python 3 function, write the documentation
def apply_acl(self, equipments, vlan, environment, network):
'''Apply the file acl in equipments
:param equipments: list of equipments
:param vlan: Vvlan
:param environment: Environment
:param network: v4 or v6
... | As a python code expert, you are capable of creating scripts from specifications. |
def confirm_vlan(self, number_net, id_environment_vlan, ip_version=None):
"""Checking if the vlan insert need to be confirmed
:param number_net: Filter by vlan number column
:param id_environment_vlan: Filter by environment ID related
:param ip_version: Ip version for checking
... | Create a Python 3 function to
confirm a vlan insert need to be confirmed | You are a Python code generator, capable of creating scripts from specifications. |
Check if environment has a number vlan available | Can you generate a brief explanation for the following Python 3 code
def check_number_available(self, id_environment, num_vlan, id_vlan):
url = 'vlan/check_number_available/' + \
str(id_environment) + '/' + str(num_vlan) + '/' + str(id_vlan)
code, xml = self.submit(None, 'GET', url)
... | As a Python code composer, you craft elegant and concise scripts. |
def validar(self, id_vlan):
"""Validates ACL - IPv4 of VLAN from its identifier.
Assigns 1 to 'acl_valida'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
:r... | Implement a function in Python 3 to
validate ACL - IPv4 of VLAN from its identifier. | As a Python code composer, you craft elegant and concise scripts. |
def validate_ipv6(self, id_vlan):
"""Validates ACL - IPv6 of VLAN from its identifier.
Assigns 1 to 'acl_valida_v6'.
:param id_vlan: Identifier of the Vlan. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Vlan identifier is null and invalid.
... | Can you write a function in Python 3 where it
validates ACL - IPv6 of VLAN from its identifier. | You are a Python code analyst, evaluating scripts for potential improvements. |
def remove(self, id_vlan):
"""Remove a VLAN by your primary key.
Execute script to remove VLAN
:param id_vlan: ID for VLAN.
:return: Following dictionary:
::
{‘sucesso’: {‘codigo’: < codigo >,
‘descricao’: {'stdout':< stdout >, 'stderr':< stderr >}}}
... | How would you implement a function in Python 3 that
removes a VLAN by your primary key. | You are a Python code analyst, evaluating scripts for potential improvements. |
Deallocate all relationships between Vlan. | Explain what the following Python 3 code does
def deallocate(self, id_vlan):
if not is_valid_int_param(id_vlan):
raise InvalidParameterError(
u'The identifier of Vlan is invalid or was not informed.')
url = 'vlan/' + str(id_vlan) + '/deallocate/'
code, xml = self.s... | As a Python code composer, you craft elegant and concise scripts. |
def allocate_IPv6(
self,
name,
id_network_type,
id_environment,
description,
id_environment_vip=None):
"""Inserts a new VLAN.
:param name: Name of Vlan. String with a maximum of 50 characters.
:param id_network_type: Identi... | Create a Python 3 function to
insert a new VLAN in the internal cache. | You are a Python code analyst, evaluating scripts for potential improvements. |
Generate the script acl for a given vlan. | How would you explain what the following Python 3 function does
def create_script_acl(self, id_vlan, network_type):
'''Generate the script acl
:param id_vlan: Vlan Id
:param network_type: v4 or v6
:raise InvalidValueError: Attrs invalids.
:raise XMLError: Networkapi failed to g... | As a Python code analyst, you investigate and solve complex coding mysteries |
def inserir(self, id_user, id_group):
"""Create a relationship between User and Group.
:param id_user: Identifier of the User. Integer value and greater than zero.
:param id_group: Identifier of the Group. Integer value and greater than zero.
:return: Dictionary with the following stru... | Implement a Python 3 function for
creating a relationship between User and Group. | As a Python code analyst, you investigate and solve complex coding mysteries |
Return a string representation of a map. | Given the following Python 3 function, write the documentation
def dumps(map, root_name, root_attributes=None):
xml = ''
try:
implementation = getDOMImplementation()
except ImportError as i:
raise XMLErrorUtils(i, u'Erro ao obter o DOMImplementation')
doc = implementation.createDocument... | As a Python code analyst, you investigate and solve complex coding mysteries |
A chamada de las dicionário para cada nó s do XML. | Make a summary of the following Python 3 code
def loads(xml, force_list=None):
if force_list is None:
force_list = []
try:
xml = remove_illegal_characters(xml)
doc = parseString(xml)
except Exception as e:
raise XMLErrorUtils(e, u'Falha ao realizar o parse do xml.')
roo... | As a python code expert, you are capable of creating scripts from specifications. |
This method returns a list of vip s attributes by environment vip type. | Can you tell what is the following Python 3 function doing
def option_vip_by_environment_vip_type(self, environment_vip_id, type_option):
uri = "api/v3/option-vip/environment-vip/%s/type-option/%s/" % (environment_vip_id, type_option)
return self.get(uri) | As a python code expert, you are capable of creating scripts from specifications. |
Method to search neighbors based on extends search. | Can you tell what is the following Python 3 function doing
def search(self, **kwargs):
return super(ApiV4Neighbor, self).get(self.prepare_url(
'api/v4/neighbor/', kwargs)) | As a Python code composer, you craft elegant and concise scripts. |
Method to delete neighbors by their id s
| Explain what the following Python 3 code does
def delete(self, ids):
url = build_uri_with_ids('api/v4/neighbor/%s/', ids)
return super(ApiV4Neighbor, self).delete(url) | You are a Python code architect, reviewing and designing scalable and efficient code |
Method to update neighbors in cluster | Make a summary of the following Python 3 code
def update(self, neighbors):
data = {'neighbors': neighbors}
neighbors_ids = [str(env.get('id')) for env in neighbors]
return super(ApiV4Neighbor, self).put('api/v4/neighbor/%s/' %
';'.join(neighbors_i... | You are a Python code analyst, evaluating scripts for potential improvements. |
Adiciona um VIP para operação de inserir um grupo virtual. | Can you tell what is the following Python 3 function doing
def add_vip(
self,
id,
real_name_sufixo,
id_vlan,
descricao_vlan,
id_vlan_real,
descricao_vlan_real,
balanceadores,
id_healthcheck_expect,
fi... | You are a Python code analyst, evaluating scripts for potential improvements. |
Get Equipment Access by id. | Can you generate the documentation for the following Python 3 function
def get_access(self, id_access):
if not is_valid_int_param(id_access):
raise InvalidParameterError(u'Equipment Access ID is invalid.')
url = 'equipamentoacesso/id/' + str(id_access) + '/'
code, xml = self.submi... | You are a Python code generator, capable of creating scripts from specifications. |
List all equipment access by equipment name | Make a summary of the following Python 3 code
def list_by_equip(self, name):
equip_access_map = dict()
equip_access_map['name'] = name
code, xml = self.submit(
{"equipamento_acesso": equip_access_map}, 'POST', 'equipamentoacesso/name/')
key = 'equipamento_acesso'
re... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Add new relationship between equipment and access type and returns its id. | Can you generate the documentation for the following Python 3 function
def inserir(
self,
id_equipamento,
fqdn,
user,
password,
id_tipo_acesso,
enable_pass):
"""Add new relationship between equipment and access type and returns ... | As a Python code composer, you craft elegant and concise scripts. |
Edit access type by id. | Can you tell what is the following Python 3 function doing
def edit_by_id(
self,
id_equip_acesso,
id_tipo_acesso,
fqdn,
user,
password,
enable_pass):
"""Edit access type, fqdn, user, password and enable_pass of the relationship ... | You are a Python code generator, capable of creating scripts from specifications. |
Removes relationship between equipment and access type. | Can you generate a brief explanation for the following Python 3 code
def remover(self, id_tipo_acesso, id_equipamento):
if not is_valid_int_param(id_tipo_acesso):
raise InvalidParameterError(u'Access type id is invalid.')
if not is_valid_int_param(id_equipamento):
raise Invalid... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def set_poolmember_state(self, id_pools, pools):
"""
Enable/Disable pool member by list
"""
data = dict()
uri = "api/v3/pool/real/%s/member/status/" % ';'.join(id_pools)
data["server_pools"] = pools
return self.put(uri, data=data) | Create a Python 3 function to
enable or disable pool member by list | You are a Python code analyst, evaluating scripts for potential improvements. |
def get_poolmember_state(self, id_pools, checkstatus=0):
"""
Enable/Disable pool member by list
"""
uri = "api/v3/pool/real/%s/member/status/?checkstatus=%s" % (';'.join(id_pools), checkstatus)
return self.get(uri) | How would you code a function in Python 3 to
get the state of the pool members. | As a Python code analyst, you investigate and solve complex coding mysteries |
def list_all(self, environment_id, pagination):
"""
List All Pools To Populate Datatable
:param pagination: Object Pagination
:return: Following dictionary:{
"total" : < total >,
"pools"... | Write a Python 3 script for
listing all pools in the specified environment | As a python code expert, you are capable of creating scripts from specifications. |
This method returns a list of all pools in the system that are in the specified VIP. | Can you generate a brief explanation for the following Python 3 code
def list_all_by_reqvip(self, id_vip, pagination):
uri = "api/pools/pool_list_by_reqvip/"
data = dict()
data["start_record"] = pagination.start_record
data["end_record"] = pagination.end_record
data["asorting_... | As a python code expert, you are capable of creating scripts from specifications. |
def remove(self, pools):
"""
Remove Pools Running Script And Update to Not Created
:param ids: List of ids
:return: None on success
:raise ScriptRemovePoolException
:raise InvalidIdPoolException
:raise NetworkAPIException
"""
... | Can you write a function in Python 3 where it
removes Pools Running Script And Update to Not Created :param ids: List of ids :return: None on success :raise ScriptRemovePoolException :raise InvalidIdPoolException :raise NetworkAPIException | As a python code expert, you are capable of creating scripts from specifications. |
def create(self, pools):
"""
Create Pools Running Script And Update to Created
:param pools: List of pools
:return: None on success
:raise PoolDoesNotExistException
:raise ScriptCreatePoolException
:raise InvalidIdPoolException
... | Write a Python 3 script to
create Pools Running Script And Update to Created :param pools: List of pools :return: None on success :raise PoolDoesNotExistException :raise ScriptCreatePoolException :raise InvalidIdPoolException :raise NetworkAPIException | As a Python code translator, you convert algorithms and pseudocode into Python. |
Enable the specified pool members running script. | Make a summary of the following Python 3 code
def enable(self, ids):
data = dict()
data["ids"] = ids
uri = "api/pools/enable/"
return self.post(uri, data) | As a Python code composer, you craft elegant and concise scripts. |
Disable the specified pool members running script. | Here you have a function in Python 3, explain what it does
def disable(self, ids):
data = dict()
data["ids"] = ids
uri = "api/pools/disable/"
return self.post(uri, data) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Lista todos os direitos de um grupo de usuario. | Can you generate the documentation for the following Python 3 function
def listar_por_grupo_usuario(self, id_grupo_usuario):
if not is_valid_int_param(id_grupo_usuario):
raise InvalidParameterError(
u'O identificador do grupo de usuário é inválido ou não foi informado.')
url... | As a Python code analyst, you investigate and solve complex coding mysteries |
Buscar o id do direito grupo de usuário. | Can you tell what is the following Python 3 function doing
def buscar_por_id(self, id_direito):
if not is_valid_int_param(id_direito):
raise InvalidParameterError(
u'O identificador do direito grupo equipamento é inválido ou não foi informado.')
url = 'direitosgrupoequipamen... | As a Python code composer, you craft elegant and concise scripts. |
Insere um novo direito de um grupo de usuário em um grupo de equipamento. | Make a summary of the following Python 3 code
def inserir(
self,
id_grupo_usuario,
id_grupo_equipamento,
leitura,
escrita,
alterar_config,
exclusao):
"""Cria um novo direito de um grupo de usuário em um grupo de equipamento e re... | You are a Python code architect, reviewing and designing scalable and efficient code |
def alterar(self, id_direito, leitura, escrita, alterar_config, exclusao):
"""Altera os direitos de um grupo de usuário em um grupo de equipamento a partir do seu identificador.
:param id_direito: Identificador do direito grupo equipamento.
:param leitura: Indicação de permissão de leitura ('0'... | Can you implement a function in Python 3 that
alters os direitos de um grupo de equipamento. | As a Python code composer, you craft elegant and concise scripts. |
def remover(self, id_direito):
"""Remove os direitos de um grupo de usuário em um grupo de equipamento a partir do seu identificador.
:param id_direito: Identificador do direito grupo equipamento
:return: None
:raise DireitoGrupoEquipamentoNaoExisteError: Direito Grupo Equipamento não... | Write a Python 3 function that can
remove os direitos de um grupo de equipamento a partir do seu identificador. | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to search object group permissions based on extends search. | Given the following Python 3 function, write the documentation
def search(self, **kwargs):
return super(ApiObjectGroupPermission, self).get(self.prepare_url('api/v3/object-group-perm/',
kwargs)) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Method to create object group permissions | Make a summary of the following Python 3 code
def create(self, ogps):
data = {'ogps': ogps}
return super(ApiObjectGroupPermission, self).post('api/v3/object-group-perm/', data) | You are a Python code analyst, evaluating scripts for potential improvements. |
def inserir(self, id_equipment, id_script):
"""Inserts a new Related Equipment with Script and returns its identifier
:param id_equipment: Identifier of the Equipment. Integer value and greater than zero.
:param id_script: Identifier of the Script. Integer value and greater than zero.
... | Implement a Python 3 function for
inserting a new Related Equipment with Script and returns its identifier | As a python code expert, you are capable of creating scripts from specifications. |
Method to search vrf s based on extends search. | Can you generate a brief explanation for the following Python 3 code
def search(self, **kwargs):
return super(ApiVrf, self).get(self.prepare_url('api/v3/vrf/',
kwargs)) | You are a Python code generator, capable of creating scripts from specifications. |
Method to delete vrf s by their id s
| Here you have a function in Python 3, explain what it does
def delete(self, ids):
url = build_uri_with_ids('api/v3/vrf/%s/', ids)
return super(ApiVrf, self).delete(url) | You are a Python code analyst, evaluating scripts for potential improvements. |
Method to update vrf s
| How would you explain what the following Python 3 function does
def update(self, vrfs):
data = {'vrfs': vrfs}
vrfs_ids = [str(vrf.get('id')) for vrf in vrfs]
return super(ApiVrf, self).put('api/v3/vrf/%s/' %
';'.join(vrfs_ids), data) | You are a Python code architect, reviewing and designing scalable and efficient code |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.