text
stringlengths
0
828
:param multiple_errors_tb_limit: the traceback size (default is 3) of individual parsers exceptions displayed when
parsyfiles tries several parsing chains and all of them fail.
:param full_paths_in_logs: if True, full file paths will be displayed in logs. Otherwise only the parent path will
be displayed and children paths will be indented (default is False)
:param dict_to_object_subclass_limit: the number of subclasses that the <dict_to_object> converter will try, when
instantiating an object from a dictionary. Default is 50
:return:
""""""
if multiple_errors_tb_limit is not None:
GLOBAL_CONFIG.multiple_errors_tb_limit = multiple_errors_tb_limit
if full_paths_in_logs is not None:
GLOBAL_CONFIG.full_paths_in_logs = full_paths_in_logs
if dict_to_object_subclass_limit is not None:
GLOBAL_CONFIG.dict_to_object_subclass_limit = dict_to_object_subclass_limit"
365,"def is_valid(self, context):
""""""Checks through the previous_actions iterable if required actions have
been executed
""""""
if self.requires:
for r in self.requires:
if not r in context.executed_actions:
raise RequirementMissingError(""Action '%s' requires '%s'"" % (self.name, r))
return True"
366,"def get_file_contents(file_path):
""""""Get the context of the file using full path name""""""
full_path = os.path.join(package_dir, file_path)
return open(full_path, 'r').read()"
367,"def refresh(self):
""""""Refresh a device""""""
# new_device = {}
if self.type in CONST.BINARY_SENSOR_TYPES:
response = self._lupusec.get_sensors()
for device in response:
if device['device_id'] == self._device_id:
self.update(device)
return device
elif self.type == CONST.ALARM_TYPE:
response = self._lupusec.get_panel()
self.update(response)
return response
elif self.type == CONST.TYPE_POWER_SWITCH:
response = self._lupusec.get_power_switches()
for pss in response:
if pss['device_id'] == self._device_id:
self.update(pss)
return pss"
368,"def update(self, json_state):
""""""Update the json data from a dictionary.
Only updates if it already exists in the device.
""""""
if self._type in CONST.BINARY_SENSOR_TYPES:
self._json_state['status'] = json_state['status']
else:
self._json_state.update(
{k: json_state[k] for k in json_state if self._json_state.get(k)})"
369,"def desc(self):
""""""Get a short description of the device.""""""
return '{0} (ID: {1}) - {2} - {3}'.format(
self.name, self.device_id, self.type, self.status)"
370,"def list(declared, undeclared):
""""""List configured queues.""""""
queues = current_queues.queues.values()
if declared:
queues = filter(lambda queue: queue.exists, queues)
elif undeclared:
queues = filter(lambda queue: not queue.exists, queues)
queue_names = [queue.routing_key for queue in queues]
queue_names.sort()
for queue in queue_names:
click.secho(queue)"
371,"def declare(queues):
""""""Initialize the given queues.""""""
current_queues.declare(queues=queues)
click.secho(
'Queues {} have been declared.'.format(
queues or current_queues.queues.keys()),
fg='green'
)"
372,"def purge_queues(queues=None):
""""""Purge the given queues.""""""
current_queues.purge(queues=queues)
click.secho(
'Queues {} have been purged.'.format(
queues or current_queues.queues.keys()),
fg='green'
)"
373,"def delete_queue(queues):
""""""Delete the given queues.""""""
current_queues.delete(queues=queues)
click.secho(
'Queues {} have been deleted.'.format(
queues or current_queues.queues.keys()),
fg='green'
)"
374,"def find_needed_formatter(input_format, output_format):